UNPKG

@ckeditor/ckeditor5-ai

Version:

AI Assistant feature for CKEditor 5.

23 lines 4.6 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ const _0x1cafdd=_0x143e;function _0x143e(_0x554875,_0x10b57d){const _0x2a41e4=_0x2a41();return _0x143e=function(_0x143e8b,_0x516919){_0x143e8b=_0x143e8b-0xe6;let _0x93c9ab=_0x2a41e4[_0x143e8b];return _0x93c9ab;},_0x143e(_0x554875,_0x10b57d);}(function(_0x31fabc,_0x5c8ec6){const _0x7b4ac6=_0x143e,_0x2f56db=_0x31fabc();while(!![]){try{const _0x4d6b88=-parseInt(_0x7b4ac6(0xf1))/0x1*(parseInt(_0x7b4ac6(0xec))/0x2)+parseInt(_0x7b4ac6(0xee))/0x3*(parseInt(_0x7b4ac6(0xf2))/0x4)+parseInt(_0x7b4ac6(0x104))/0x5+parseInt(_0x7b4ac6(0xed))/0x6+-parseInt(_0x7b4ac6(0xfc))/0x7*(-parseInt(_0x7b4ac6(0x10a))/0x8)+parseInt(_0x7b4ac6(0xfb))/0x9+-parseInt(_0x7b4ac6(0x105))/0xa;if(_0x4d6b88===_0x5c8ec6)break;else _0x2f56db['push'](_0x2f56db['shift']());}catch(_0x6935cd){_0x2f56db['push'](_0x2f56db['shift']());}}}(_0x2a41,0x5b928));import{Plugin as _0x290e59}from'ckeditor5/src/core.js';import{CKEditorError as _0x138aea}from'ckeditor5/src/utils.js';function _0x2a41(){const _0x470f06=['AI_ERROR_GET_HEADERS','application/json','requires','textAdapter','makeRequest','_prepareRequestParameters','reject','2296386KEWLRa','1806SPcXwy','catch','aborted','aitextadapter-send-request-failed','name','AI_ERROR_GET_PARAMETERS','object','abort','1720910UNJljR','961270hzunUp','init','_prepareRequestHeaders','locale','abortController','11472XJADGl','sendRequest','editor','signal','assign','plugins','AbortError','2ChdgsS','174096bdPWMq','507mdyKdM','error','get','555847iKYHZg','680WzZDBV','resolve'];_0x2a41=function(){return _0x470f06;};return _0x2a41();}import{AIAdapter as _0x4bea98,AIRequestError as _0xfab6a0}from'./aiadapter.js';import{getTranslation as _0x3f10dd}from'../utils/common-translations.js';export class AITextAdapter extends _0x290e59{[_0x1cafdd(0x109)];static get[_0x1cafdd(0xf6)](){return[_0x4bea98];}constructor(_0x374190){const _0x48fb67=_0x1cafdd;super(_0x374190),this[_0x48fb67(0x109)]=new AbortController();}[_0x1cafdd(0x106)](){const _0x7d0743=_0x1cafdd;this[_0x7d0743(0xe7)][_0x7d0743(0xea)][_0x7d0743(0xf0)](_0x4bea98)[_0x7d0743(0xf7)]=this;}[_0x1cafdd(0x103)](){const _0x443a40=_0x1cafdd;this[_0x443a40(0x109)][_0x443a40(0xe8)][_0x443a40(0xfe)]||(this[_0x443a40(0x109)][_0x443a40(0x103)](),this[_0x443a40(0x109)]=new AbortController());}async[_0x1cafdd(0xf8)](_0x395106){const _0x9bce03=_0x1cafdd;return this[_0x9bce03(0xe6)](_0x395106)[_0x9bce03(0xfd)](_0x2c61af=>{const _0x393c4a=_0x9bce03;if(_0x2c61af instanceof _0xfab6a0)return Promise[_0x393c4a(0xfa)](_0x2c61af);if(_0x393c4a(0xeb)==_0x2c61af[_0x393c4a(0x100)])return Promise[_0x393c4a(0xf3)]();throw console[_0x393c4a(0xef)](_0x2c61af),new _0x138aea(_0x393c4a(0xff),null);});}async[_0x1cafdd(0x107)](_0x12b47d,_0x482439){const _0x38c6c2=_0x1cafdd,_0x1d2913=this[_0x38c6c2(0xe7)][_0x38c6c2(0x108)],_0x5f2d0b={'Content-Type':_0x38c6c2(0xf5)};if(_0x38c6c2(0x102)==typeof _0x12b47d)Object[_0x38c6c2(0xe9)](_0x5f2d0b,_0x12b47d);else{if(_0x12b47d)try{const _0x5cf694=await _0x12b47d(_0x482439);Object[_0x38c6c2(0xe9)](_0x5f2d0b,_0x5cf694);}catch{return Promise[_0x38c6c2(0xfa)](new _0xfab6a0(_0x3f10dd(_0x1d2913,_0x38c6c2(0xf4))));}}return _0x5f2d0b;}async[_0x1cafdd(0xf9)](_0x249cb2,_0x4ba2af){const _0x459134=_0x1cafdd,_0x4fce4d=this[_0x459134(0xe7)][_0x459134(0x108)];if(_0x459134(0x102)==typeof _0x249cb2)return _0x249cb2;try{return await _0x249cb2(_0x4ba2af);}catch{return Promise[_0x459134(0xfa)](new _0xfab6a0(_0x3f10dd(_0x4fce4d,_0x459134(0x101))));}}}