@ckeditor/ckeditor5-ai 45.2.1-alpha.2 → 45.2.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ai.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +9 -9
- package/src/aiassistantediting.js +1 -1
package/dist/index.js
CHANGED
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as _0x2f232d,Command as _0x5ba5d4}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x2e1479,IconCheck as _0x89e765,IconError as tt,IconSubmit as ht,IconHistory as et,IconMagicWand as _0xbab348,IconRobotPencil as _0x165e59}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x4916fb,CKEditorError as _0x4385cd,ObservableMixin as _0x1d64c3,global as _0x458d51,isVisible as ot,Rect as it,Collection as _0x5a8a7e,FocusTracker as mt,KeystrokeHandler as ut,first as _0x234dcc}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as at,ButtonView as _0x511da1,View as _0x454e4f,SpinnerView as _0x4f9c6e,IconView as rt,AutocompleteView as nt,ListView as Ct,ListItemGroupView as Ht,ListItemView as xt,ButtonLabelView as kt,FocusCycler as pt,createLabeledTextarea as dt,Dialog as _0x5ef99e,createDropdown as _0x599764,addMenuToDropdown as _0xc76d7e,MenuBarMenuView as _0x57b171,MenuBarMenuListItemButtonView as _0x1c0c13,DialogViewPosition as _0x2099b1,MenuBarMenuListView as _0x563a2f,MenuBarMenuListItemView as _0x168321}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x5db133,ClipboardMarkersUtils as _0xa55bc5}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{DomEventData as _0xb476a2,DataTransfer as _0x119717,UpcastWriter as _0x5c48b0,Matcher as _0x43adaa}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as jt,escape as yt}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x4e6a65,InvokeModelWithResponseStreamCommand as _0x455256,InvokeModelCommand as _0x14a46b}from'@aws-sdk/client-bedrock-runtime';const x='_ungrouppedCommands';function o(_0x193224,_0x3e964b){const _0x877a20=(0x0,_0x3e964b['t'])('Other');return _0x193224['length']?'groupId'in _0x193224[0x0]?_0x193224:[{'groupId':x,'groupLabel':_0x877a20,'order':0x1/0x0,'commands':_0x193224}]:[{'groupId':x,'groupLabel':_0x877a20,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],f='ai-ui';class a extends _0x2f232d{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x5576d4}=this,_0x111468=['ck-fake-ai-selection'];_0x5576d4['config']['get']('ai.useTheme')&&_0x111468['push']('ck-ai-assistant-ui_theme'),_0x5576d4['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0x111468,'priority':0xc}}),_0x5576d4['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0x4581ee,{writer:_0x516c6d})=>{if(!_0x4581ee['markerRange']['isCollapsed'])return null;const _0x4c8213=_0x516c6d['createUIElement']('span');return _0x516c6d['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4c8213),_0x4c8213;}});}['afterInit'](){!async function(_0x3587f1){const _0x18fdb1=_0x1ba69f([0x4e,0x33,0x68,0x7a,0x65,0x4f,0x31,0x55,0x71,0x6e,0x57,0x59,0x61,0x78,0x37,0x6a,0x63,0x6d,0x42,0x4d,0x49,0x44,0x66,0x67,0x45,0x6b,0x79,0x43,0x64,0x41,0x76,0x39,0x62,0x30,0x72,0x75,0x4b,0x77,0x46,0x52,0x54,0x4c,0x6c,0x6f,0x73,0x53,0x5a,0x74,0x38,0x48,0x56,0x35,0x36,0x34,0x58,0x32,0x51,0x70,0x47,0x69,0x4a,0x50]),_0x3e4541=0x1e3bac5f,_0x395f1b=0x1e3cc68f^_0x3e4541,_0x1714fb=window[_0x1ba69f([0x44,0x61,0x74,0x65])][_0x1ba69f([0x6e,0x6f,0x77])](),_0x941e01=_0x3587f1[_0x1ba69f([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x338528=new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1f0a16=>{_0x941e01[_0x1ba69f([0x6f,0x6e,0x63,0x65])](_0x1ba69f([0x72,0x65,0x61,0x64,0x79]),_0x1f0a16);}),_0x2b4fb3={[_0x1ba69f([0x6b,0x74,0x79])]:_0x1ba69f([0x45,0x43]),[_0x1ba69f([0x75,0x73,0x65])]:_0x1ba69f([0x73,0x69,0x67]),[_0x1ba69f([0x63,0x72,0x76])]:_0x1ba69f([0x50,0x2d,0x32,0x35,0x36]),[_0x1ba69f([0x78])]:_0x1ba69f([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x1ba69f([0x79])]:_0x1ba69f([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x1ba69f([0x61,0x6c,0x67])]:_0x1ba69f([0x45,0x53,0x32,0x35,0x36])},_0x5f0c74=_0x941e01[_0x1ba69f([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x1ba69f([0x67,0x65,0x74])](_0x1ba69f([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x3614e8(){let _0x38c424,_0x5e8619=null,_0x5959d4=null;try{if(_0x5f0c74==_0x1ba69f([0x47,0x50,0x4c]))return _0x1ba69f([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x38c424=_0x28a302(),!_0x38c424)return _0x1ba69f([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x38c424[_0x1ba69f([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x5959d4=_0x45660f(_0x38c424[_0x1ba69f([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x38c424[_0x1ba69f([0x6a,0x74,0x69])])),await _0x1dc549()?_0x3c7e62()?_0x33c06e()?_0x1ba69f([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x4c744c()?(_0x38c424[_0x1ba69f([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x1ba69f([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x5e8619=_0x4a79de(_0x1ba69f([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x38c424[_0x1ba69f([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x1ba69f([0x74,0x72,0x69,0x61,0x6c])&&(_0x5e8619=_0x4a79de(_0x1ba69f([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x49982e()):_0x1ba69f([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x1ba69f([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x1ba69f([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x1ba69f([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x33c06e(){const _0x38fa86=[_0x1ba69f([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x1ba69f([0x74,0x72,0x69,0x61,0x6c])][_0x1ba69f([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x38c424[_0x1ba69f([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x1714fb/0x3e8:0xe10*_0x395f1b;return _0x38c424[_0x1ba69f([0x65,0x78,0x70])]<_0x38fa86;}function _0x3c7e62(){const _0x424b9=_0x38c424[_0x1ba69f([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x424b9&&(!!_0x424b9[_0x1ba69f([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1ba69f([0x2a]))||!!_0x424b9[_0x1ba69f([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1ba69f([0x41,0x49])));}function _0x4c744c(){const _0x5725b9=_0x38c424[_0x1ba69f([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5725b9||0x0==_0x5725b9[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x2b3a92}=new URL(window[_0x1ba69f([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5725b9[_0x1ba69f([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2b3a92))return!0x0;const _0xbb9629=_0x2b3a92[_0x1ba69f([0x73,0x70,0x6c,0x69,0x74])](_0x1ba69f([0x2e]));return _0x5725b9[_0x1ba69f([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x1bb2b5=>_0x1bb2b5[_0x1ba69f([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1ba69f([0x2a])))[_0x1ba69f([0x6d,0x61,0x70])](_0xb0824f=>_0xb0824f[_0x1ba69f([0x73,0x70,0x6c,0x69,0x74])](_0x1ba69f([0x2e])))[_0x1ba69f([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x252071=>_0x252071[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0xbb9629[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x1ba69f([0x6d,0x61,0x70])](_0x1905f9=>Array(_0xbb9629[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x1905f9[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x1ba69f([0x66,0x69,0x6c,0x6c])](_0x1905f9[0x0]===_0x1ba69f([0x2a])?_0x1ba69f([0x2a]):'')[_0x1ba69f([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x1905f9))[_0x1ba69f([0x73,0x6f,0x6d,0x65])](_0x489687=>_0xbb9629[_0x1ba69f([0x65,0x76,0x65,0x72,0x79])]((_0x4eaf30,_0x3435da)=>_0x489687[_0x3435da]===_0x4eaf30||_0x489687[_0x3435da]===_0x1ba69f([0x2a])));}function _0x49982e(){return _0x5e8619&&_0x5959d4?new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x206f13,_0x4daf5e)=>{_0x5e8619[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x206f13,_0x4daf5e),_0x5959d4[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x1cc3f6=>{_0x1cc3f6!=_0x1ba69f([0x56,0x61,0x6c,0x69,0x64])&&_0x206f13(_0x1cc3f6);},_0x4daf5e);}):_0x5e8619||_0x5959d4||_0x1ba69f([0x56,0x61,0x6c,0x69,0x64]);}}function _0x45660f(_0x180168,_0x3b05c8){return new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x484479=>{if(_0x132ed2())return _0x484479(_0x1ba69f([0x56,0x61,0x6c,0x69,0x64]));_0x4f438d(),_0x941e01[_0x1ba69f([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x1ba69f([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x1c3e7e=!0x1;const _0x24582f=_0x4916fb();function _0x460932(_0x526ba9){return!!_0x526ba9&&(typeof _0x526ba9===_0x1ba69f([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x526ba9===_0x1ba69f([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x526ba9[_0x1ba69f([0x74,0x68,0x65,0x6e])]===_0x1ba69f([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x526ba9[_0x1ba69f([0x63,0x61,0x74,0x63,0x68])]===_0x1ba69f([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x564624(_0x45c75c){_0x1b60db(_0x45c75c)[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x4236bb=>{if(!_0x4236bb||_0x4236bb[_0x1ba69f([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x1ba69f([0x6f,0x6b]))return _0x1ba69f([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x4dbe3c(_0xc233e4(_0x24582f+_0x3b05c8))!=_0x4236bb[_0x1ba69f([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x1ba69f([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x1ba69f([0x56,0x61,0x6c,0x69,0x64]);})[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x3579ab=>(_0x511c52(),_0x3579ab),()=>{const _0x208bf1=_0xcd2c6c();return null==_0x208bf1?(_0x511c52(),_0x1ba69f([0x56,0x61,0x6c,0x69,0x64])):_0x1ba69f(_0x1714fb-_0x208bf1>(0x3a37285f^_0x3e4541)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x484479)[_0x1ba69f([0x63,0x61,0x74,0x63,0x68])](()=>{_0x484479(_0x1ba69f([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x389700=0x1e0d42df^_0x3e4541;function _0x511c52(){const _0x1f68c7=_0x1ba69f([0x6c,0x6c,0x63,0x74,0x2d])+_0x4dbe3c(_0xc233e4(_0x180168)),_0x251a8e=_0x5a22d0(_0x4dbe3c(window[_0x1ba69f([0x4d,0x61,0x74,0x68])][_0x1ba69f([0x63,0x65,0x69,0x6c])](_0x1714fb/_0x389700)));window[_0x1ba69f([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x1ba69f([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1f68c7,_0x251a8e);}function _0xcd2c6c(){const _0x553ebf=_0x1ba69f([0x6c,0x6c,0x63,0x74,0x2d])+_0x4dbe3c(_0xc233e4(_0x180168)),_0x32c46e=window[_0x1ba69f([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x1ba69f([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x553ebf);return _0x32c46e?window[_0x1ba69f([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x5a22d0(_0x32c46e),0x10)*_0x389700:null;}function _0x1b60db(_0x4605fe){return new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2693bf,_0x39e9f1)=>{_0x4605fe[_0x1ba69f([0x74,0x68,0x65,0x6e])](_0x2693bf,_0x39e9f1),window[_0x1ba69f([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x39e9f1,0x1e3a789f^_0x3e4541);});}}_0x941e01[_0x1ba69f([0x6f,0x6e])](_0x1ba69f([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x3af856,_0x20bd65)=>{if(_0x20bd65[0x0]!=_0x180168)return _0x484479(_0x1ba69f([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x20bd65[0x1]={..._0x20bd65[0x1],[_0x1ba69f([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x24582f};},{[_0x1ba69f([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x1ba69f([0x68,0x69,0x67,0x68])}),_0x941e01[_0x1ba69f([0x6f,0x6e])](_0x1ba69f([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x476b56=>{_0x460932(_0x476b56[_0x1ba69f([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x1c3e7e=!0x0,_0x564624(_0x476b56[_0x1ba69f([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x1ba69f([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x1ba69f([0x6c,0x6f,0x77])}),_0x338528[_0x1ba69f([0x74,0x68,0x65,0x6e])](()=>{_0x1c3e7e||_0x484479(_0x1ba69f([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x132ed2(){return _0x941e01[_0x1ba69f([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x1ba69f([0x76,0x69,0x65,0x77])][_0x1ba69f([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x1ba69f([0x61,0x75,0x74,0x6f]);}function _0x4f438d(){_0x941e01[_0x1ba69f([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x1ba69f([0x76,0x69,0x65,0x77])][_0x1ba69f([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x1ba69f([0x61,0x75,0x74,0x6f]);}}function _0x4a79de(_0x5eb902){const _0x3c7529=[new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0xbc19d0=>setTimeout(_0xbc19d0,0x1e329293^_0x3e4541)),_0x338528[_0x1ba69f([0x74,0x68,0x65,0x6e])](()=>new window[(_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x254c84=>{let _0x3592e4=0x0;_0x941e01[_0x1ba69f([0x6d,0x6f,0x64,0x65,0x6c])][_0x1ba69f([0x6f,0x6e])](_0x1ba69f([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x5f3c0d,_0x8d5736)=>{_0x8d5736[0x0][_0x1ba69f([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x3592e4++,_0x3592e4==(0x1e3bada7^_0x3e4541)&&(_0x254c84(),_0x5f3c0d[_0x1ba69f([0x6f,0x66,0x66])]());});}))];return window[_0x1ba69f([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x1ba69f([0x72,0x61,0x63,0x65])](_0x3c7529)[_0x1ba69f([0x74,0x68,0x65,0x6e])](()=>_0x5eb902);}async function _0x11318c(){await _0x338528,_0x941e01[_0x1ba69f([0x6d,0x6f,0x64,0x65,0x6c])][_0x1ba69f([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0xabaada,_0x941e01[_0x1ba69f([0x6d,0x6f,0x64,0x65,0x6c])][_0x1ba69f([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0xabaada,_0x941e01[_0x1ba69f([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x1ba69f([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x395e10(_0x431947){const _0x1be13c=_0xf8a688();_0x941e01[_0x1be13c]=_0x1ba69f([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x431947,_0x431947!=_0x1ba69f([0x56,0x61,0x6c,0x69,0x64])&&_0x11318c();}function _0xf8a688(){const _0x596edc=window[_0x1ba69f([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x1ba69f([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x1ba69f([0x6e,0x6f,0x77])]())[_0x1ba69f([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x1ba69f([0x2e]),'');let _0x77d896=_0x1ba69f([0x4e]);for(let _0x3ad331=0x0;_0x3ad331<_0x596edc[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x3ad331+=0x2){let _0x31bbae=window[_0x1ba69f([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x596edc[_0x1ba69f([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x3ad331,_0x3ad331+0x2));_0x31bbae>=_0x18fdb1[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x31bbae-=_0x18fdb1[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x77d896+=_0x18fdb1[_0x31bbae];}return _0x77d896;}function _0x28a302(){const _0x1e24f5=_0x5f0c74[_0x1ba69f([0x73,0x70,0x6c,0x69,0x74])](_0x1ba69f([0x2e]));if(0x3!=_0x1e24f5[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x5ef0e9(_0x1e24f5[0x1]);function _0x5ef0e9(_0x1208f1){const _0x4e2eec=_0x527c63(_0x1208f1);return _0x4e2eec&&_0x48e6b5()?_0x4e2eec:null;function _0x48e6b5(){const _0x588aed=_0x4e2eec[_0x1ba69f([0x6a,0x74,0x69])],_0x18b22a=window[_0x1ba69f([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x588aed[_0x1ba69f([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x588aed[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x3802a7={..._0x4e2eec,[_0x1ba69f([0x6a,0x74,0x69])]:_0x588aed[_0x1ba69f([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x588aed[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x3802a7[_0x1ba69f([0x76,0x63])],_0xc233e4(_0x3802a7)==_0x18b22a;}}}async function _0x1dc549(){let _0x5ae212=!0x0;try{const _0x260f02=_0x5f0c74[_0x1ba69f([0x73,0x70,0x6c,0x69,0x74])](_0x1ba69f([0x2e])),[_0x1bf4cb,_0x20ccb9,_0x527d4f]=_0x260f02;return _0x4ab465(_0x1bf4cb),await _0x51ef8b(_0x1bf4cb,_0x20ccb9,_0x527d4f),_0x5ae212;}catch{return!0x1;}function _0x4ab465(_0x5af74c){const _0x1f6c8d=_0x527c63(_0x5af74c);_0x1f6c8d&&_0x1f6c8d[_0x1ba69f([0x61,0x6c,0x67])]==_0x1ba69f([0x45,0x53,0x32,0x35,0x36])||(_0x5ae212=!0x1);}async function _0x51ef8b(_0xdfd2e8,_0x1906da,_0x3fa5dc){const _0x52653b=window[_0x1ba69f([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x1ba69f([0x66,0x72,0x6f,0x6d])](_0xeaf238(_0x3fa5dc),_0x5373c1=>_0x5373c1[_0x1ba69f([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x1cb560=new window[(_0x1ba69f([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x1ba69f([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0xdfd2e8+_0x1ba69f([0x2e])+_0x1906da),_0xe82605=window[_0x1ba69f([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x1ba69f([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0xe82605)return;const _0x593ce2=await _0xe82605[_0x1ba69f([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x1ba69f([0x6a,0x77,0x6b]),_0x2b4fb3,{[_0x1ba69f([0x6e,0x61,0x6d,0x65])]:_0x1ba69f([0x45,0x43,0x44,0x53,0x41]),[_0x1ba69f([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x1ba69f([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x1ba69f([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0xe82605[_0x1ba69f([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x1ba69f([0x6e,0x61,0x6d,0x65])]:_0x1ba69f([0x45,0x43,0x44,0x53,0x41]),[_0x1ba69f([0x68,0x61,0x73,0x68])]:{[_0x1ba69f([0x6e,0x61,0x6d,0x65])]:_0x1ba69f([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x593ce2,_0x52653b,_0x1cb560)||(_0x5ae212=!0x1);}}function _0x527c63(_0xb8bdde){return _0xb8bdde[_0x1ba69f([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x1ba69f([0x65,0x79]))?JSON[_0x1ba69f([0x70,0x61,0x72,0x73,0x65])](_0xeaf238(_0xb8bdde)):null;}function _0xeaf238(_0x689507){return window[_0x1ba69f([0x61,0x74,0x6f,0x62])](_0x689507[_0x1ba69f([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x1ba69f([0x2b]))[_0x1ba69f([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x1ba69f([0x2f])));}function _0xc233e4(_0x3b394a){let _0x1de2d5=0x1505;function _0x4f4f00(_0xab367a){for(let _0x32ccab=0x0;_0x32ccab<_0xab367a[_0x1ba69f([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x32ccab++){const _0x154877=_0xab367a[_0x1ba69f([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x32ccab);_0x1de2d5=(_0x1de2d5<<0x5)+_0x1de2d5+_0x154877,_0x1de2d5&=_0x1de2d5;}}function _0x443121(_0x47176e){Array[_0x1ba69f([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x47176e)?_0x47176e[_0x1ba69f([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x443121):_0x47176e&&typeof _0x47176e==_0x1ba69f([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x1ba69f([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x47176e)[_0x1ba69f([0x73,0x6f,0x72,0x74])]()[_0x1ba69f([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x44968f,_0x46c826])=>{_0x4f4f00(_0x44968f),_0x443121(_0x46c826);}):_0x4f4f00(window[_0x1ba69f([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x47176e));}return _0x443121(_0x3b394a),_0x1de2d5>>>0x0;}function _0x4dbe3c(_0x3f5d17){return _0x3f5d17[_0x1ba69f([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x1ba69f([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x1ba69f([0x30]));}function _0x5a22d0(_0x1b2de9){return _0x1b2de9[_0x1ba69f([0x73,0x70,0x6c,0x69,0x74])]('')[_0x1ba69f([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x1ba69f([0x6a,0x6f,0x69,0x6e])]('');}function _0xabaada(){}function _0x1ba69f(_0x1ae669){return _0x1ae669['map'](_0x251acd=>String['fromCharCode'](_0x251acd))['join']('');}_0x395e10(await _0x3614e8());}(this);}['showFakeVisualSelection'](){const _0x4b8b13=this['editor']['model'];_0x4b8b13['change'](_0x3cb040=>{const _0x41b93b=_0x4b8b13['document']['selection']['getRanges']();let _0xf7f839=0x0;for(const _0x269356 of _0x41b93b){const _0x43a5dd=f+':'+_0xf7f839;if(_0x4b8b13['markers']['has'](_0x43a5dd))_0x3cb040['updateMarker'](_0x43a5dd,{'range':_0x269356});else{if(_0x269356['start']['isAtEnd']){const _0x5723b4=_0x269356['start']['getLastMatchingPosition'](({item:_0x325a87})=>!_0x4b8b13['schema']['isContent'](_0x325a87),{'boundaries':_0x269356});_0x3cb040['addMarker'](_0x43a5dd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3cb040['createRange'](_0x5723b4,_0x269356['end'])});}else _0x3cb040['addMarker'](_0x43a5dd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x269356});}_0xf7f839++;}});}['hideFakeVisualSelection'](){const _0x39b0ca=this['editor']['model'],_0x20c249=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x20c249['length']&&_0x39b0ca['change'](_0x28ae27=>{_0x20c249['forEach'](_0x67111b=>{_0x28ae27['removeMarker'](_0x67111b);});});}['insertContent'](_0x18c062,_0x24ab83){const _0x3442b7=this['_getAISelection'](),_0x3439b6=_0x24ab83||_0x3442b7['getFirstRange']();this['editor']['model']['canEditAt'](_0x3439b6)&&this['editor']['model']['change'](_0x341394=>{this['hideFakeVisualSelection'](),_0x24ab83||this['_resetContentOfSelectedTableCells'](_0x341394,_0x3442b7),this['_pasteHTMLUsingClipboard']({'insertAt':_0x3439b6,'writer':_0x341394,'html':_0x18c062});});}['insertContentBelow'](_0x33ce78){const {model:_0x44a081}=this['editor'],_0x131cac=this['_getAISelection']();_0x44a081['change'](()=>{const _0x286442=this['_prepareTableInsertBelowPosition'](_0x33ce78,_0x131cac)||this['_getDefaultInsertBelowPosition'](_0x131cac);this['insertContent'](_0x33ce78,_0x286442);});}['_getAISelection'](){const _0x140759=this['editor']['model'],_0xd41b4f=Array['from'](_0x140759['markers']['getMarkersGroup'](f))['map'](_0x143876=>_0x143876['getRange']());return _0x140759['createSelection'](_0xd41b4f);}['_pasteHTMLUsingClipboard']({writer:_0x52357a,html:_0x441122,insertAt:_0x55789b}){const {view:_0x5e7b84}=this['editor']['editing'],_0x3ec7ec=this['editor']['plugins']['get'](_0x5db133),_0x8b46f7=new gt();_0x8b46f7['setData']('text/html',_0x441122);const _0x484439=new ClipboardEvent('paste',{'clipboardData':_0x8b46f7}),_0x14b075=new _0xb476a2(_0x5e7b84,_0x484439,{'dataTransfer':new _0x119717(_0x8b46f7)});_0x52357a['setSelection'](_0x55789b);const _0x3af238=(_0x28803b,_0x51b77c)=>{_0x51b77c['resultRange']&&_0x52357a['setSelection'](_0x51b77c['resultRange']);};_0x3ec7ec['once']('contentInsertion',_0x3af238,{'priority':'lowest'}),_0x5e7b84['document']['fire']('paste',_0x14b075),_0x3ec7ec['off']('contentInsertion',_0x3af238);}['_getDefaultInsertBelowPosition'](_0x1b0e4d){const {model:_0x86217b}=this['editor'],_0x265374=Array['from'](_0x1b0e4d['getSelectedBlocks']());return _0x265374['length']?_0x86217b['createPositionAfter'](_0x265374['pop']()):_0x1b0e4d['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x1d251d,_0x3ff553){const {model:_0x2ba65b,plugins:_0x5e8622}=this['editor'];if(_0x5e8622['has']('TableUtils')){const _0x4c22ea=_0x5e8622['get']('TableUtils')['getSelectedTableCells'](_0x3ff553);if(_0x4c22ea['length']){const _0x2329cc=this['_getTableRowCountFromContent'](_0x1d251d),_0x45fb17=this['_createEmptyTableRows'](_0x4c22ea,_0x2329cc);return _0x2ba65b['createPositionAt'](_0x45fb17,0x0);}}return null;}['_getTableRowCountFromContent'](_0x1cca0e){const _0x100320=this['editor']['plugins']['get']('TableUtils'),_0x179f32=this['editor']['data']['parse'](_0x1cca0e),_0x32a4f7=Array['from'](_0x179f32['getChildren']())['filter'](_0x39aa2f=>_0x39aa2f['is']('element','table'));let _0x2ae93d=0x0;return _0x32a4f7['forEach'](_0x33026e=>{_0x2ae93d+=_0x100320['getRows'](_0x33026e);}),_0x2ae93d;}['_createEmptyTableRows'](_0x13eb84,_0x546d7c){const _0x9d6e31=this['editor']['plugins']['get']('TableUtils'),_0x10cb01=_0x9d6e31['getRowIndexes'](_0x13eb84),_0x1c0b0e=_0x9d6e31['getColumnIndexes'](_0x13eb84),_0x44ae29=_0x10cb01['last']+0x1,_0x1883af=_0x1c0b0e['first'],_0x3e7e0a=_0x13eb84[0x0]['findAncestor']('table');for(let _0x3e1db8=0x0;_0x3e1db8<_0x546d7c;_0x3e1db8++)_0x9d6e31['insertRows'](_0x3e7e0a,{'at':_0x44ae29});return _0x3e7e0a['getChild'](_0x44ae29)['getChild'](_0x1883af);}['_resetContentOfSelectedTableCells'](_0x1e69a8,_0x29386b){const {plugins:_0x1b7f7f}=this['editor'],{model:_0x462edd}=_0x1e69a8;if(!_0x1b7f7f['has']('TableUtils'))return;_0x1b7f7f['get']('TableUtils')['getSelectedTableCells'](_0x29386b)['length']&&_0x462edd['deleteContent'](_0x29386b);}}class E extends _0x2f232d{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x4385cd('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x558c22){super(_0x558c22),this['name']='AIRequestError';}}function i(_0x510cae,_0x53d123,_0x3bb385){const t=_0x510cae['t'];switch(_0x53d123){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'AI\x20is\x20writing':return t('AI\x20is\x20writing');case'Generated\x20content:\x20%0':return t('Generated\x20content:\x20%0',_0x3bb385);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3bb385);case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x3bb385);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x53d123;}}class j extends _0x5ba5d4{['_commandDefinitions'];constructor(_0x31a1b9,_0x4a7e8f){super(_0x31a1b9),this['_commandDefinitions']=_0x4a7e8f,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3fef58,_0x120375,_0x3ca200)=>{this['isEnabled']&&(this['enabledCommandsIds']=G(this['_commandDefinitions'],_0x3ca200));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x56f910,_0x2edce9,_0x3b6885)=>{this['enabledCommandsIds']=_0x3b6885?G(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3613e4=this['editor']['model'];this['_hasContext']=function(_0x152687){const _0x14e680=_0x152687['document']['selection'];return _0x14e680['isCollapsed']?0x0!==[..._0x14e680['getSelectedBlocks']()]['length']&&![..._0x14e680['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x152687['hasContent'](_0x14e680['getFirstRange']());}(_0x3613e4);const _0x38b6be=_0x3613e4['document']['selection'],_0x19bce4=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x5d91e7 of _0x38b6be['getRanges']())for(const _0x51f1ec of _0x5d91e7['getItems']())if(_0x51f1ec['is']('element')&&_0x19bce4['includes'](_0x51f1ec['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x19937e='',_0x52cb90='',_0x5c7460='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x19937e,_0x52cb90,_0x5c7460);}}function G(_0x534c0e,_0x5e9492){const _0x5e2536=new Set();for(const _0x3cdfbb of _0x534c0e['values']())(_0x5e9492||!0x1===_0x3cdfbb['requiresContent'])&&_0x5e2536['add'](_0x3cdfbb['id']);return Array['from'](_0x5e2536);}const Z=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class k extends/* #__PURE__ -- @preserve */
|
|
24
|
-
_0x1d64c3(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x2fd1c9,_0x52f753,_0x21af03){super(),this['editor']=_0x2fd1c9,this['textAdapter']=_0x52f753,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x21af03,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x37c38c,_0x439e20,_0x58aa0e)=>{this['view']['value']=this['_sanitizeHTML'](_0x58aa0e);}),this['listenTo'](this['view'],'submitPrompt',(_0x4db708,_0xec455c)=>{const _0x2e8bbc=this['currentContext']||this['initialContext'];this['_handleQuery'](_0xec455c,_0x2e8bbc,'custom');}),this['listenTo'](this['view'],'tryAgainEvent',()=>{this['view']['prompt']=this['previousLabel'],this['_handleQuery'](this['previousQuery'],this['previousContext'],this['previousActionId'],this['previousLabel']);}),this['listenTo'](this['view'],'stopProcessing',()=>{this['stopProcessing']();});}['destroy'](){this['stopListening']();}async['updateView']({actionId:_0x394c32,query:_0x3b6a28,htmlContent:_0x21207e,label:_0x1da146,mainActionLabel:_0x737bbb}){this['view']['prompt']=_0x1da146,this['view']['mainAction']=_0x737bbb,this['initialContext']=_0x21207e,_0x3b6a28&&(this['view']['isRendered']?this['_handleQuery'](_0x3b6a28,_0x21207e,_0x394c32,_0x1da146):this['view']['once']('render',()=>{this['_handleQuery'](_0x3b6a28,_0x21207e,_0x394c32,_0x1da146);}));}['stopProcessing'](){this['isProcessing']&&(this['isProcessing']=!0x1,this['view']['finishProcessing'](),this['textAdapter']['abort']());}['reset'](){this['initialContext']='',this['currentContext']='',this['currentResponse']='',this['previousContext']='',this['previousQuery']='',this['previousLabel']='',this['previousActionId']=void 0x0,this['view']['reset'](),this['stopProcessing']();}async['_handleQuery'](_0x3a9be3,_0x52d98d,_0x3403be,_0x385681){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x52d98d,this['previousQuery']=_0x3a9be3,this['previousLabel']=_0x385681||_0x3a9be3,this['previousActionId']=_0x3403be,new Promise(_0x4c26fe=>{this['textAdapter']['makeRequest']({'query':_0x3a9be3,'context':_0x52d98d,'onData':_0x2d9dba=>{this['currentResponse']=_0x2d9dba,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x3403be})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x123084=>{_0x123084 instanceof R?this['view']['handleError'](_0x123084['message']):this['view']['handleError'](),_0x4c26fe();})['finally'](()=>{this['stopProcessing'](),_0x4c26fe();});});}['_parseAndNormalizeContent'](_0xf57003,_0x4acd9a=!0x1){const _0x3bc3bc=Z['exec'](_0xf57003);_0xf57003=_0x3bc3bc?_0xf57003['substring'](_0x3bc3bc[0x1]['length']):_0xf57003['length']<0x64&&!_0x4acd9a?'':this['_stripMarkdownSyntax'](_0xf57003);const _0x86a215=this['_domParser']['parseFromString'](_0xf57003,'text/html');if(_0x3bc3bc){const _0x1c33d2=Array['from'](_0x86a215['body']['childNodes']);_0x1c33d2['reverse']();for(const _0x1b38fb of _0x1c33d2){if(_0x1b38fb['nodeType']==Node['ELEMENT_NODE'])break;_0x1b38fb['remove']();}}const _0x5ab1d5=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x86a215['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x5ab1d5);const _0x57fa06=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x30e24d=this['editor']['data']['toModel'](_0x5ab1d5);return _0x57fa06||_0x30e24d['markers']['clear'](),this['editor']['data']['stringify'](_0x30e24d);}['_normalizeResponseHeadings'](_0x305947){const _0x15c868=new _0x5c48b0(this['editor']['editing']['view']['document']),_0x356c95=new _0x43adaa({'name':/^h[1-5]$/}),_0x24cd20=[];let _0x3630df=!0x1;for(const _0x10b9a2 of _0x305947)_0x10b9a2['is']('element')&&_0x356c95['match'](_0x10b9a2)&&(_0x24cd20['push'](_0x10b9a2),'h1'==_0x10b9a2['name']&&(_0x3630df=!0x0));if(_0x3630df){for(const _0x174e22 of _0x24cd20)_0x15c868['rename']('h'+(parseInt(_0x174e22['name'][0x1])+0x1),_0x174e22);}}['_isH1TagSupportEnabled'](){const {data:_0x3d3a32,editing:_0xf25681}=this['editor'],_0x98329c=_0x3d3a32['htmlProcessor']['toView']('<h1></h1>'),_0x294126=_0x3d3a32['toView'](_0x3d3a32['toModel'](_0x98329c));return!!_0xf25681['view']['domConverter']['viewToDom'](_0x294126)['querySelector']('h1');}['_sanitizeHTML'](_0x18f8ff){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x18f8ff),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x120d9d){const _0x1cb107=_0x120d9d['trim']();return _0x1cb107['startsWith']('```html')?_0x1cb107['endsWith']('```')?_0x1cb107['substring'](0x7,_0x1cb107['length']-0x3):_0x1cb107['substring'](0x7):_0x120d9d;}}const M={'REPLACE':'replace','INSERT':'insert'};class lt extends at{constructor(_0x332824){super(_0x332824),this['set']('isVisible',!0x1),this['set']('mainAction',M['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x401b7c=>i(_0x332824,'AI_'+_0x401b7c['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x332824,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x332824,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x332824,'Stop'));const _0x1349d0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x1349d0['if']('isVisible','ck-hidden',_0x256393=>!_0x256393)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x22f7cd,_0x4fb59d){const _0x566bd3=new _0x511da1(this['locale']);return _0x566bd3['set']({'label':_0x22f7cd,'class':_0x4fb59d||'','isVisible':!0x0,'withText':!0x0}),_0x566bd3;}}class Y extends _0x454e4f{['contentFieldView'];['copyButtonView'];constructor(_0x313c97,_0x3c622c=''){super(_0x313c97),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x362cfe=this['bindTemplate'];this['contentFieldView']=new At(_0x313c97,_0x3c622c),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x362cfe['if']('isVisible','ck-hidden',_0x27bfe7=>!_0x27bfe7)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x362cfe['if']('isProcessing','ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':'div','attributes':{'class':['ck','ck-ai-form__copy-button-wrapper']},'children':[this['copyButtonView']]}]}]});}['render'](){super['render'](),this['value']&&this['contentFieldView']['setContent'](this['value']);let _0xb63bb8=!0x1;this['on']('change:value',(_0x56c9e6,_0x472b92,_0x22b584)=>{const _0x4f899c=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x22b584),this['isProcessing']&&_0x4f899c&&!_0xb63bb8&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x28ddc9,_0x38b04e,_0x4af861)=>{_0xb63bb8=!0x1,_0x4af861?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0xb63bb8=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0xb63bb8=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x39d927=this['locale'],_0x40145b=new _0x511da1(this['locale']),_0x2eeefb='ck-ai-form__copy-button';return _0x40145b['set']({'label':i(_0x39d927,'Copy'),'icon':_0x2e1479,'class':_0x2eeefb,'tooltip':!0x0}),_0x40145b['bind']('isVisible')['to'](this,'value',_0x2aa7c6=>!!_0x2aa7c6),_0x40145b['bind']('isEnabled')['to'](this,'isProcessing',_0x498f47=>!_0x498f47),_0x40145b['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x40145b['icon']=_0x89e765,_0x40145b['class']=_0x2eeefb+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x40145b['icon']=_0x2e1479,_0x40145b['class']=_0x2eeefb;},0x3e8);}),_0x40145b;}['_copyHTMLToClipboard'](_0x52fef2){const {window:_0x572f49,document:_0x383614}=_0x458d51;if(_0x572f49['ClipboardItem']){const {Blob:_0x458cbe,ClipboardItem:_0x54922d}=_0x572f49,_0xafa217=[new _0x54922d({'text/html':new _0x458cbe([_0x52fef2['innerHTML']],{'type':'text/html'}),'text/plain':new _0x458cbe([_0x52fef2['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0xafa217);}else{const _0x4be041=_0x383614['createElement']('div');_0x4be041['style']['position']='absolute',_0x4be041['style']['left']='-9999px',_0x4be041['innerHTML']='<span>[</span>'+_0x52fef2['innerHTML']+'<span>]</span>',_0x383614['body']['appendChild'](_0x4be041);const _0x49e17a=_0x383614['createRange']();_0x49e17a['setStartAfter'](_0x4be041['firstElementChild']),_0x49e17a['setEndBefore'](_0x4be041['lastElementChild']);const _0x393477=_0x572f49['getSelection']();_0x393477['removeAllRanges'](),_0x393477['addRange'](_0x49e17a),_0x383614['execCommand']('copy'),_0x4be041['remove']();}}}class At extends _0x454e4f{constructor(_0xb10f37,_0x1d618c=''){super(_0xb10f37),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1d618c,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x17625d){this['element']['innerHTML']=_0x17625d;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x354e67=new _0x454e4f(),_0x3a04f5=this['locale'],_0x441175=new _0x4f9c6e();return _0x441175['isVisible']=!0x0,_0x354e67['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x441175,{'text':i(_0x3a04f5,'AI\x20is\x20writing...')}]}),_0x354e67['render'](),_0x354e67;}}class st extends _0x454e4f{constructor(_0x30be7f,_0x15f364=''){super(_0x30be7f);const _0x5de7bf=new rt(),_0x254d92=this['bindTemplate'];this['set']('text',_0x15f364),_0x5de7bf['content']=tt,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5de7bf,{'text':_0x254d92['to']('text')}]});}}class ct extends nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x1dc587,_0x9f5201){super(_0x1dc587,_0x9f5201),this['queryView']['fieldView']['minRows']=0x1,this['queryView']['fieldView']['maxRows']=0x3,this['submitButtonView']=this['_createSubmitButton'](),this['showHistoryButtonView']=this['_createShowHistoryButton'](),this['focusableChildren']['add'](this['showHistoryButtonView'],0x1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['showHistoryButtonView']),this['children']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x200c9b,_0x1eb92c)=>{_0x200c9b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1eb92c());});}['_createSubmitButton'](){const _0x5ae39b=new _0x511da1(this['locale']),_0x5b0736=this['locale'];return _0x5ae39b['set']({'icon':ht,'label':i(_0x5b0736,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5ae39b['on']('execute',()=>{this['submit']();}),_0x5ae39b['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x14c247,_0x365a26)=>!_0x14c247&&_0x365a26),_0x5ae39b;}['_createShowHistoryButton'](){const _0x8879f9=new _0x511da1(this['locale']),_0x3393dc=this['resultsView'],_0x289a51=this['locale'];_0x8879f9['set']({'label':i(_0x289a51,'History'),'withText':!0x1,'icon':et,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x8879f9['bind']('isOn')['to'](_0x3393dc,'isVisible'),_0x8879f9['bind']('isEnabled')['to'](this,'isEnabled'),_0x8879f9['on']('execute',()=>{_0x3393dc['isVisible']=!_0x3393dc['isVisible'],_0x3393dc['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x2ff317=()=>{_0x458d51['window']['requestAnimationFrame'](()=>{if(ot(this['element'])){const _0x452b25=new it(this['queryView']['fieldView']['element']),_0x5b34d7=_0x452b25['width'],_0x4a38aa='rtl'===_0x289a51['uiLanguageDirection']?'left':'right';_0x452b25['excludeScrollbarsAndBorders'](),_0x8879f9['element']['style'][_0x4a38aa]=_0x5b34d7-_0x452b25['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x2ff317),this['on']('render',_0x2ff317),_0x8879f9;}['submit'](){const _0x587c58=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x587c58);}['focus'](_0x32e48d){-0x1===_0x32e48d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class ft extends Ct{['historyGroupView'];['clearHistoryButton'];constructor(_0x12cb79){super(_0x12cb79),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ht(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x12cb79,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x413065=0x0;for(const _0x1631e1 of this['items'])_0x413065+=_0x1631e1['items']['length'];return{'resultsCount':_0x413065,'totalItemsCount':_0x413065};}['_createClearHistoryButton'](){const _0x50f4c8=this['locale'],_0x1760e6=new _0x511da1(this['locale']);return _0x1760e6['set']({'label':'('+i(_0x50f4c8,'Clear')+')','withText':!0x0}),_0x1760e6['on']('execute',()=>this['fire']('clearHistory')),_0x1760e6;}}class bt extends xt{constructor(_0x3b2e21){super();const _0x5e9299=new kt(),_0x44ec2c=new _0x511da1(this['locale'],_0x5e9299);this['children']['add'](_0x44ec2c),_0x44ec2c['set']({'label':_0x3b2e21['prompt'],'withText':!0x0}),_0x44ec2c['on']('execute',()=>{this['fire']('execute',{'value':jt(_0x3b2e21['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class wt extends _0x5a8a7e{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x2fb034,_0x47bfef)=>{const _0x512d93=os(_0x47bfef['prompt']);for(const _0x1bd088 of this)if(_0x1bd088!=_0x47bfef&&os(_0x1bd088['prompt'])===_0x512d93){this['remove'](_0x1bd088);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x3b574c=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x3b574c));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x544513=>_0x544513)));}}function os(_0x1a54e6){return _0x1a54e6['toLowerCase']()['trim']();}class _ extends _0x454e4f{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x243d18,_0x56a4f1,_0x107d1=''){super(_0x243d18),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',M['REPLACE']),this['_promptHistory']=new wt(),this['errorView']=new st(_0x243d18),this['contentArea']=new Y(_0x243d18,_0x107d1),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new mt(),this['keystrokes']=new ut(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new pt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x31a282=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x56a4f1],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x31a282['if']('isError','ck-hidden',_0x5a4853=>!_0x5a4853)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x4780e8=0x1){-0x1===_0x4780e8?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x173059=this['locale'],_0x573b38=new ct(_0x173059,{'queryView':{'label':i(_0x173059,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':dt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x173059,'Empty\x20history'),'secondary':i(_0x173059,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x573b38['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x6afce4,_0x3b0131)=>_0x6afce4&&!_0x3b0131),this['listenTo'](_0x573b38,'submit',(_0x20ab51,_0x42c6ba)=>{this['prompt']=_0x42c6ba;const _0x378f72=yt(_0x42c6ba);this['fire']('submitPrompt',_0x378f72),_0x42c6ba['trim']()&&this['_promptHistory']['add']({'prompt':_0x378f72},0x0);},{'priority':'high'}),_0x573b38;}['_createHistoryView'](){const _0x4fb070=new ft(this['locale']);return _0x4fb070['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](bt),_0x4fb070['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x4fb070;}['_createToolbar'](){const _0x21c7b7=new lt(this['locale']);return _0x21c7b7['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1c1e28,_0x353f3f,_0x4713a0)=>_0x1c1e28&&!_0x353f3f&&!!_0x4713a0),_0x21c7b7['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x21c7b7['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x510345,_0x29b9ab,_0x4ab2c0)=>_0x510345&&!_0x29b9ab&&!!_0x4ab2c0),_0x21c7b7['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x21c7b7['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2899f5,_0x19f160)=>_0x2899f5&&!_0x19f160),_0x21c7b7['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x21c7b7['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x21c7b7['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x21c7b7;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x4cd4fc=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x4cd4fc,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x20321b){const _0x9960d7=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x20321b||i(_0x9960d7,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const w=globalThis['DataTransfer'];class n extends _0x2f232d{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0xa55bc5,a,E,_0x5ef99e];}constructor(_0x23cd81){super(_0x23cd81),_0x23cd81['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x23cd81['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x23cd81['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x23cd81['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x486b15}=this;this['_aiAdapter']=_0x486b15['plugins']['get'](E),this['_dialog']=_0x486b15['plugins']['get'](_0x5ef99e),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x477212=new j(_0x486b15,Array['from'](this['_commandDefinitions']['values']()));_0x486b15['commands']['add']('showAIAssistant',_0x477212),_0x486b15['ui']['componentFactory']['add']('aiCommands',_0x2e34b9=>{const _0x10919=_0x599764(_0x2e34b9);return _0x10919['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x10919['buttonView']['set']({'label':i(_0x2e34b9,'AI\x20Commands'),'icon':_0xbab348,'tooltip':!0x0}),_0x10919['on']('execute',_0x53a062=>this['_onExecute'](_0x53a062['source']['id'])),_0xc76d7e(_0x10919,_0x486b15['ui']['view']['body'],function(_0x2adbf0){const _0x12ace0=o(_0x2adbf0['config']['get']('ai.aiAssistant.commands'),_0x2adbf0['locale']),_0x5a5907=U(_0x2adbf0,_0x12ace0)['filter'](_0x583682=>_0x583682['commands']['length']);if(0x1===_0x5a5907['length'])return U(_0x2adbf0,_0x5a5907[0x0]['commands'])['map'](_0x68e923=>({'id':_0x68e923['id'],'label':_0x68e923['label']}));return _0x5a5907['map'](_0x598bde=>{const {groupId:_0x2f719c,groupLabel:_0xe42de0,commands:_0x410893}=_0x598bde,_0xd26b21=U(_0x2adbf0,_0x410893)['map'](_0xf2702f=>({'id':_0xf2702f['id'],'label':_0xf2702f['label']}));return{'id':_0x2f719c,'menu':_0xe42de0||_0x2f719c,'children':_0xd26b21};});}(_0x486b15),{'ariaLabel':i(_0x2e34b9,'AI\x20Commands')}),_0x10919['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x477212['on']('change:enabledCommandsIds',_0x14a9bd),_0x10919['menuView']['once']('render',_0x14a9bd),_0x10919;function _0x14a9bd(){_0x10919['isEnabled']=_0x477212['enabledCommandsIds']['length']>0x0;for(const _0x34b78d of _0x10919['menuView']['buttons'])_0x34b78d['isEnabled']=_0x477212['enabledCommandsIds']['includes'](_0x34b78d['id']);}}),_0x486b15['ui']['componentFactory']['add']('menuBar:aiCommands',_0x4e16b0=>{const _0x47b29c=new _0x57b171(_0x4e16b0);_0x47b29c['buttonView']['set']({'label':i(_0x4e16b0,'AI\x20Commands'),'icon':_0xbab348}),_0x47b29c['bind']('isEnabled')['to'](_0x477212,'enabledCommandsIds',_0x54a6d6=>_0x54a6d6['length']>0x0);const _0x22aae8=o(_0x486b15['config']['get']('ai.aiAssistant.commands'),_0x4e16b0);return this['_populateMenuBarMenu'](_0x477212,_0x47b29c,_0x22aae8,_0x82d945=>this['_onExecute'](_0x82d945)),_0x47b29c;}),_0x486b15['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x22f298=this['_createAIAssistantUIButton'](_0x511da1);return _0x22f298['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x22f298;}),_0x486b15['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x18e9c2=this['_createAIAssistantUIButton'](_0x1c0c13);return _0x18e9c2['set']({'role':'menuitemcheckbox'}),_0x18e9c2;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0xe13799=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x409003;for(const _0x1b1e00 in _0xe13799){const _0x12bc7f=_0x1b1e00,_0x5e36c0=_0xe13799[_0x12bc7f];if('aiLicenseKeyValid'==_0x5e36c0||'aiLicenseKeyInvalid'==_0x5e36c0||'aiLicenseKeyExpired'==_0x5e36c0||'aiLicenseKeyDomainLimit'==_0x5e36c0||'aiLicenseKeyNotAllowed'==_0x5e36c0||'aiLicenseKeyEvaluationLimit'==_0x5e36c0||'aiLicenseKeyTrialLimit'==_0x5e36c0||'aiLicenseKeyUsageLimit'==_0x5e36c0){delete _0xe13799[_0x12bc7f],_0x409003=_0x5e36c0,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x409003&&_0xe13799['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x409003&&_0xe13799['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x409003&&_0xe13799['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x409003&&_0xe13799['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x409003&&_0xe13799['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x409003&&_0xe13799['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x409003&&_0xe13799['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x2a4dd5='',_0x3ea1d1='',_0x40a9a4='custom'){const _0x454bb0=this['editor'],_0x2db722=_0x454bb0['editing']['view'],_0x818eb2=_0x454bb0['plugins']['get'](a),_0x2b87c6=_0x454bb0['plugins']['get'](_0xa55bc5);_0x818eb2['showFakeVisualSelection']();const _0xbea69c=new w(),_0xe8714c=new ClipboardEvent('copy',{'clipboardData':_0xbea69c}),_0x128aea=new _0x119717(_0xbea69c),_0x1b051d=new _0xb476a2(_0x2db722,_0xe8714c,{'dataTransfer':_0x128aea});_0x2b87c6['_forceMarkersCopy']('comment',()=>{_0x2db722['document']['fire']('copy',_0x1b051d);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new k(_0x454bb0,this['_aiAdapter']['textAdapter'],this['_formView']));let _0xd1732a=_0x128aea['getData']('text/html');const _0x4b4c82=_0x454bb0['model']['document']['selection'],_0x534759=Array['from'](_0x4b4c82['getRanges']());0x1===_0x534759['length']&&_0x534759[0x0]['isFlat']&&!_0x4b4c82['getSelectedElement']()&&''!==_0xd1732a['replace'](/ /g,'')['trim']()&&(_0xd1732a='<p>'+_0xd1732a+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x40a9a4,'query':_0x2a4dd5,'htmlContent':_0xd1732a,'label':_0x3ea1d1,'mainActionLabel':M[_0x454bb0['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x165e59,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x2099b1['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x818eb2['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x7b3bb0=new Map(),_0xf7b095=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0xc259ff of _0xf7b095)for(const _0x59fb2f of _0xc259ff['commands'])_0x7b3bb0['set'](_0x59fb2f['id'],{..._0x59fb2f,'groupId':_0xc259ff['groupId'],'groupLabel':_0xc259ff['groupLabel']||_0xc259ff['groupId']});return _0x7b3bb0;}['_createAIAssistantUIButton'](_0x405b94){const _0x2af9f5=this['editor'],_0x3dbd79=_0x2af9f5['commands']['get']('showAIAssistant'),_0x5c4edc=new _0x405b94(_0x2af9f5['locale']);return _0x5c4edc['set']({'label':i(_0x2af9f5['locale'],'AI\x20Assistant'),'icon':_0x165e59,'isToggleable':!0x0}),_0x5c4edc['bind']('isEnabled')['to'](_0x3dbd79),_0x5c4edc['bind']('isOn')['to'](this['_dialog'],'id',_0x5e0853=>'aiAssistant'===_0x5e0853),this['listenTo'](_0x5c4edc,'execute',()=>{_0x5c4edc['isOn']?this['hideUI']():_0x3dbd79['execute']();}),_0x5c4edc;}['_initView'](){const _0x43e943=this['editor']['plugins']['get'](a);this['_formView']=new _(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.aiAssistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x43e943['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x43e943['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x2aaf6d,ui:{ariaLiveAnnouncer:_0x4e72d5}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x38cf01,_0x2b6127,_0x19a2de)=>{const _0x5e884a=this['_aiAssistantController']['currentContext'];_0x19a2de?_0x4e72d5['announce'](i(_0x2aaf6d,'AI\x20is\x20writing')):_0x5e884a&&_0x4e72d5['announce'](i(_0x2aaf6d,'Generated\x20content:\x20%0',_0x5e884a),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x197549,_0x282823,_0xf119e8)=>{if(_0xf119e8){const _0x1a5123=this['_formView']['errorView']['text'];_0x4e72d5['announce'](i(_0x2aaf6d,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1a5123));}});}['_onExecute'](_0x383e36){const _0x2af688=this['_commandDefinitions']['get'](_0x383e36),_0x3a609a=this['editor'],_0x43094b=_0x3a609a['model']['document']['selection'],_0x4c7155=_0x3a609a['commands']['get']('showAIAssistant'),_0x2a4c53=_0x3a609a['plugins']['get'](a),_0x59d908=''+(_0x2af688['groupId']!==x?_0x2af688['groupLabel']+':\x20':'')+_0x2af688['label'];if(!0x1!==_0x2af688['requiresContent']&&_0x43094b['isCollapsed']){const _0x3b77ae=_0x234dcc(_0x43094b['getSelectedBlocks']())||_0x3a609a['model']['schema']['getLimitElement'](_0x43094b);_0x3a609a['model']['change'](_0x2de6d5=>{_0x2de6d5['setSelection'](_0x3b77ae,'in');});}_0x2a4c53['showFakeVisualSelection'](),_0x4c7155['execute'](_0x2af688['prompt'],_0x59d908,'command:'+_0x383e36);}['_populateMenuBarMenu'](_0x24692c,_0x44f78f,_0x584563,_0x128667){const _0xa1bb2a=this['editor'],_0x37fb4d=_0xa1bb2a['locale'],_0x283d56=new _0x563a2f(_0x37fb4d),_0x55c711=U(_0xa1bb2a,_0x584563)['filter'](_0x67707b=>_0x67707b['commands']['length']);0x1===_0x55c711['length']?this['_getMenuBarGroupButtons']({'command':_0x24692c,'commands':_0x55c711[0x0]['commands'],'parentMenuView':_0x44f78f,'onExecute':_0x128667})['forEach'](_0x562639=>_0x283d56['items']['add'](_0x562639)):_0x55c711['forEach'](({groupId:_0x25324d,groupLabel:_0x533e3e,commands:_0x6e81a0})=>{const _0x1437f2=new _0x168321(_0x37fb4d,_0x44f78f),_0x28c715=new _0x57b171(_0x37fb4d),_0x259947=new _0x563a2f(_0x37fb4d),_0x25d0d4=this['_getMenuBarGroupButtons']({'command':_0x24692c,'commands':_0x6e81a0,'parentMenuView':_0x28c715,'onExecute':_0x128667});_0x28c715['buttonView']['set']({'label':_0x533e3e||_0x25324d}),_0x28c715['delegate']('execute')['to'](_0x44f78f),_0x259947['items']['addMany'](_0x25d0d4),_0x28c715['panelView']['children']['add'](_0x259947),_0x1437f2['children']['add'](_0x28c715),_0x283d56['items']['add'](_0x1437f2);}),_0x44f78f['panelView']['children']['add'](_0x283d56);}['_getMenuBarGroupButtons']({command:_0x511e22,commands:_0x104a20,parentMenuView:_0x4f550c,onExecute:_0xf5b172}){const _0x288481=this['editor'],_0x54bbbb=_0x288481['locale'];return U(_0x288481,_0x104a20)['map'](_0x93d79=>{const _0x1cfed6=new _0x168321(_0x54bbbb,_0x4f550c),_0x5a8c0b=new _0x1c0c13(_0x54bbbb);return _0x5a8c0b['set']({'label':_0x93d79['label']}),_0x5a8c0b['delegate']('execute')['to'](_0x4f550c),_0x5a8c0b['on']('execute',()=>_0xf5b172(_0x93d79['id'])),_0x5a8c0b['bind']('isEnabled')['to'](_0x511e22,'enabledCommandsIds',_0x3cc9b6=>_0x3cc9b6['includes'](_0x93d79['id'])),_0x1cfed6['children']['add'](_0x5a8c0b),_0x1cfed6;});}}function B(_0x5c6b6b,_0x155ea4){return void 0x0!==_0x5c6b6b['order']&&void 0x0===_0x155ea4['order']?0x1:void 0x0===_0x5c6b6b['order']&&void 0x0!==_0x155ea4['order']?-0x1:void 0x0!==_0x5c6b6b['order']&&void 0x0!==_0x155ea4['order']?_0x5c6b6b['order']-_0x155ea4['order']:0x0;}function U(_0x138ffc,_0x16ebd8){_0x16ebd8['sort'](B);const _0x1bbb5f={},_0x5e27c8=[];for(const _0x24fc75 of _0x16ebd8)if(void 0x0!==_0x24fc75['order']){if(_0x24fc75['order']in _0x1bbb5f)throw new _0x4385cd('ai-commands-config-order-collision',_0x138ffc,{'conflictingDefinitions':[_0x24fc75,_0x1bbb5f[_0x24fc75['order']]]});_0x1bbb5f[_0x24fc75['order']]=_0x24fc75,_0x5e27c8['splice'](_0x24fc75['order'],0x0,_0x24fc75);}else _0x5e27c8['push'](_0x24fc75);return _0x5e27c8;}class r extends _0x2f232d{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x845f24){super(_0x845f24);const _0x6bae39=_0x845f24['config'],_0x22efce=_0x845f24['locale'];_0x6bae39['define']('ai.aiAssistant.preserveComments',!0x0),_0x6bae39['define']('ai.aiAssistant.commands',function(_0x1b06eb){return[{'groupId':'editOrReview','groupLabel':i(_0x1b06eb,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x1b06eb,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x1b06eb,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':i(_0x1b06eb,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x1b06eb,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':i(_0x1b06eb,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x1b06eb,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':i(_0x1b06eb,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':i(_0x1b06eb,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x1b06eb,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x1b06eb,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x1b06eb,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x1b06eb,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x1b06eb,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x1b06eb,'Change\x20style'),'commands':[{'id':'business','label':i(_0x1b06eb,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x1b06eb,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x1b06eb,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x1b06eb,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x1b06eb,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x1b06eb,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x1b06eb,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x1b06eb,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x1b06eb,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x1b06eb,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x1b06eb,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x1b06eb,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x1b06eb,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}(_0x22efce)),_0x6bae39['define']('ai.aiAssistant.extraCommandGroups',[]),_0x6bae39['define']('ai.aiAssistant.removeCommands',[]);let _0x4790c2=o(_0x6bae39['get']('ai.aiAssistant.commands'),_0x22efce);const _0x31fe74=_0x6bae39['get']('ai.aiAssistant.extraCommandGroups'),_0x44c254=_0x6bae39['get']('ai.aiAssistant.removeCommands');_0x31fe74['forEach'](_0x13c68e=>{const _0x2910ad=_0x4790c2['find'](_0x3b3c52=>_0x3b3c52['groupId']===_0x13c68e['groupId']);_0x2910ad?_0x2910ad['commands']=_0x2910ad['commands']['concat'](_0x13c68e['commands']):_0x4790c2['push'](_0x13c68e);}),_0x4790c2=_0x4790c2['filter'](_0x20eb3e=>!_0x44c254['includes'](_0x20eb3e['groupId'])),_0x4790c2['forEach'](_0x1812a6=>{_0x1812a6['commands']=_0x1812a6['commands']['filter'](_0x2174eb=>!_0x44c254['includes'](_0x2174eb['id']));}),_0x6bae39['set']('ai.aiAssistant.commands',_0x4790c2);}}class P extends _0x2f232d{['abortController'];static get['requires'](){return[E];}constructor(_0x1ce33d){super(_0x1ce33d),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](E)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x299fbb){return this['sendRequest'](_0x299fbb)['catch'](_0x2b3f85=>{if(_0x2b3f85 instanceof R)return Promise['reject'](_0x2b3f85);if('AbortError'==_0x2b3f85['name'])return Promise['resolve']();throw console['error'](_0x2b3f85),new _0x4385cd('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x1bf894,_0x11d2f4){const _0x436441=this['editor']['locale'],_0x350c0e={'Content-Type':'application/json'};if('object'==typeof _0x1bf894)Object['assign'](_0x350c0e,_0x1bf894);else{if(_0x1bf894)try{const _0xe8838=await _0x1bf894(_0x11d2f4);Object['assign'](_0x350c0e,_0xe8838);}catch{return Promise['reject'](new R(i(_0x436441,'AI_ERROR_GET_HEADERS')));}}return _0x350c0e;}async['_prepareRequestParameters'](_0x3d2970,_0x1e5266){const _0x5764e8=this['editor']['locale'];if('object'==typeof _0x3d2970)return _0x3d2970;try{return await _0x3d2970(_0x1e5266);}catch{return Promise['reject'](new R(i(_0x5764e8,'AI_ERROR_GET_PARAMETERS')));}}}class O extends P{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x5968bb){super(_0x5968bb),_0x5968bb['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x5968bb['config']['get']('ai.openAI.requestParameters')||_0x5968bb['config']['define']('ai.openAI.requestParameters',{'model':'gpt-3.5-turbo','max_tokens':0x7d0,'temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x5968bb['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x5968bb['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x5968bb['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x268c09,context:_0x6c8485,onData:_0x57dfc9,actionId:_0x1bbcd6}){const _0xd69bb1=this['editor']['locale'],_0x5f1b9a=await this['prepareMessages'](_0x268c09,_0x6c8485,_0x1bbcd6),_0x27b813=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x1bbcd6),_0x52a416=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1bbcd6),_0x1ba9cc={'messages':_0x5f1b9a,..._0x52a416},_0x1697c6={'method':'POST','headers':_0x27b813,'body':JSON['stringify'](_0x1ba9cc),'signal':this['abortController']['signal']},_0x35f338=await fetch(this['_apiUrl'],_0x1697c6);if(_0x35f338['ok'])return _0x52a416['stream']?await this['_readStreamableResponse'](_0x35f338,_0x57dfc9):await this['_readStaticResponse'](_0x35f338,_0x57dfc9),Promise['resolve']();{const _0x291ec1=await _0x35f338['text']();return _0x291ec1['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0xd69bb1,'AI_ERROR_CONTEXT_LENGTH'))):_0x291ec1['includes']('Moderation')?Promise['reject'](new R(i(_0xd69bb1,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x291ec1));}}async['prepareMessages'](_0x317b21,_0x1319c4,_0x3e9131){let _0x20c7ad,_0x3f2de4;return _0x1319c4?(_0x20c7ad='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x3f2de4='Instruction:\x0a'+_0x317b21+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x1319c4):(_0x20c7ad='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x3f2de4=_0x317b21),[{'role':'system','content':_0x20c7ad},{'role':'user','content':_0x3f2de4}];}async['_readStreamableResponse'](_0x154563,_0x3a588a){const _0x1f9323=_0x154563['body']['getReader'](),_0x5eaaa6=new TextDecoder();let _0x8a6827='',_0x4e6c46='',_0x35f947='',_0x14cbe2=!0x1;for(;!_0x14cbe2;){const {done:_0x467312,value:_0x4c90c7}=await _0x1f9323['read'](),_0x2d0084=_0x8a6827+_0x5eaaa6['decode'](_0x4c90c7);let _0x24a815='';_0x14cbe2=_0x467312;try{_0x24a815=this['_cleanUpData'](_0x2d0084),_0x8a6827='';}catch{_0x8a6827=_0x2d0084;continue;}_0x4e6c46+=_0x24a815,!_0x14cbe2&&this['_isBufferIncomplete'](_0x4e6c46)||_0x4e6c46&&(_0x35f947+=_0x4e6c46,_0x4e6c46='',_0x3a588a(_0x35f947));}return Promise['resolve']();}async['_readStaticResponse'](_0x450792,_0x118fa8){return _0x118fa8((await _0x450792['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x2f23b1){const _0x5ac42c=_0x2f23b1['split']('<')['length']!==_0x2f23b1['split']('>')['length'],_0x48aa4a=_0x2f23b1['length']<0x1e;return _0x5ac42c&&_0x48aa4a;}['_cleanUpData'](_0xd172ea){return _0xd172ea['split'](/\n(?![^{]*\})/g)['map'](_0x1af4ce=>_0x1af4ce['replace']('data:\x20',''))['filter'](_0x1c48c4=>_0x1c48c4&&_0x1c48c4['length']>0x0&&'[DONE]'!==_0x1c48c4)['map'](_0x18a5c3=>{const {choices:_0x18fa1d}=JSON['parse'](_0x18a5c3);if(_0x18fa1d[0x0]?.['delta']?.['content'])return _0x18fa1d[0x0]['delta']['content'];})['filter'](_0x48ad4e=>_0x48ad4e)['join']('');}}class D extends P{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x33d832){super(_0x33d832),_0x33d832['config']['get']('ai.aws.requestParameters')||_0x33d832['config']['define']('ai.aws.requestParameters',{'model':'anthropic.claude-v2','max_tokens_to_sample':0x7d0,'temperature':0x1,'top_p':0x1,'top_k':0xfa,'anthropic_version':'bedrock-2023-05-31','stream':!0x0}),this['_apiUrl']=_0x33d832['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x33d832['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x33d832['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x33d832['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x3a7c0e,context:_0x4c82be,onData:_0x515a54,actionId:_0xb0f96e}){const {model:_0x18c808,stream:_0x5c47c6,..._0x43569d}=await this['_prepareRequestParameters'](this['_requestParameters'],_0xb0f96e),_0x32a40c={'prompt':await this['preparePrompt'](_0x3a7c0e,_0x4c82be,_0x18c808,_0xb0f96e),..._0x43569d};this['_apiUrl']?await this['_processProxyRequest'](_0x32a40c,_0x18c808,_0x5c47c6,_0x515a54,_0xb0f96e):await this['_processAWSRequest'](_0x32a40c,_0x18c808,_0x5c47c6,_0x515a54);}async['preparePrompt'](_0xa9ce48,_0x5dc5bd,_0x1ed19e,_0x27bbdc){let _0x22a25f,_0x25eb55;return _0x5dc5bd?(_0x22a25f='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x25eb55='Instruction:\x0a'+_0xa9ce48+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x5dc5bd):(_0x22a25f='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x25eb55=_0xa9ce48),'meta.llama'==this['getModelFamily'](_0x1ed19e)?'<<SYS>>\x0a'+_0x22a25f+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x25eb55+'\x0a[/INST]':'Human:\x0a'+_0x22a25f+'\x0a'+_0x25eb55+'\x0a\x0aAssistant:';}['getModelFamily'](_0x24245c){if(/^anthropic\.claude/['test'](_0x24245c))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x24245c))return'ai21.j2';if(/^cohere\.command/['test'](_0x24245c))return'cohere.command';if(/^meta\.llama/['test'](_0x24245c))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x24245c));}async['_processProxyRequest'](_0x2f3967,_0x2d0ebb,_0x4e5046,_0xb1f203,_0x5ec7aa){const _0x3ef888={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x5ec7aa),'body':JSON['stringify']({..._0x2f3967,'model':_0x2d0ebb,'stream':_0x4e5046}),'signal':this['abortController']['signal']},_0xedd834=await fetch(this['_apiUrl'],_0x3ef888);_0x4e5046?await this['_readStreamableResponse'](_0xedd834,_0x2d0ebb,_0xb1f203):await this['_readStaticResponse'](_0xedd834,_0x2d0ebb,_0xb1f203);}async['_processAWSRequest'](_0x4c082c,_0x3a4916,_0x3b66fb,_0x3728e4){const _0x552334=new _0x4e6a65(this['_bedrockClientConfig']),_0x3ec9c2={'body':JSON['stringify'](_0x4c082c),'contentType':'application/json','accept':'application/json','modelId':_0x3a4916};let _0x485f6d;if(_0x3b66fb){const _0x1647e8=new _0x455256(_0x3ec9c2);_0x485f6d=await _0x552334['send'](_0x1647e8,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x485f6d,_0x3a4916,_0x3728e4);}else{const _0x4ad954=new _0x14a46b(_0x3ec9c2);_0x485f6d=await _0x552334['send'](_0x4ad954,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x485f6d,_0x3a4916,_0x3728e4);}}async['_readAsyncIterableResponse'](_0x1a6eda,_0x1778dd,_0x2429b6){const _0x333a1a=_0x1a6eda['body'],_0x3d25c5=new TextDecoder('utf-8');let _0x3d179e='';for await(const _0x42d9eb of _0x333a1a)if(_0x42d9eb['chunk']){const _0x1419e3=_0x3d25c5['decode'](_0x42d9eb['chunk']['bytes']),_0x4af472=JSON['parse'](_0x1419e3);_0x3d179e+=this['_getGeneratedText'](_0x4af472,_0x1778dd),_0x2429b6(_0x3d179e);}return Promise['resolve']();}async['_readStreamableResponse'](_0x55fedd,_0x56c9ac,_0x595985){const _0x310629=_0x55fedd['body'],_0x5167c4=new TextDecoder('utf-8'),_0x46e6f8=_0x310629['getReader']();let _0x44fa9f='',_0x4a2dbe='',_0x1b82e5=!0x1;for(;!_0x1b82e5;){const {done:_0x162650,value:_0x30ecbc}=await _0x46e6f8['read']();if(_0x1b82e5=_0x162650,_0x1b82e5)break;const _0x2c9f20=(_0x44fa9f+_0x5167c4['decode'](_0x30ecbc))['split']('\x0a')['map'](_0x20cc71=>{try{return _0x44fa9f='',JSON['parse'](_0x20cc71);}catch{return _0x44fa9f=_0x20cc71,null;}})['filter'](_0x422b69=>null!==_0x422b69);_0x2c9f20['length']&&(_0x4a2dbe+=_0x2c9f20['map'](_0x1d1282=>this['_getGeneratedText'](_0x1d1282,_0x56c9ac))['join'](''),_0x595985(_0x4a2dbe));}return Promise['resolve']();}async['_readStaticResponse'](_0x45e736,_0x5b2220,_0x2ecab8){let _0x2cbee0;return _0x2cbee0=_0x45e736 instanceof Response?await _0x45e736['json']():JSON['parse'](Buffer['from'](_0x45e736['body'])['toString']('utf8')),(_0x2ecab8(this['_getGeneratedText'](_0x2cbee0,_0x5b2220)),Promise['resolve']());}['_getGeneratedText'](_0x41e30a,_0x1868bc){switch(this['getModelFamily'](_0x1868bc)){case'anthropic.claude':return _0x41e30a['completion'];case'ai21.j2':return _0x41e30a['completions'][0x0]['data']['text'];case'cohere.command':return _0x41e30a['generations'][0x0]['text'];case'meta.llama':return _0x41e30a['generation'];}}}export{E as AIAdapter,r as AIAssistant,n as AIAssistantUI,R as AIRequestError,P as AITextAdapter,D as AWSTextAdapter,O as OpenAITextAdapter};
|
|
23
|
+
import{Plugin as _0x24be83,Command as _0x3b6f50}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x48000c,IconCheck as _0x82a084,IconError as tt,IconSubmit as ht,IconHistory as et,IconMagicWand as _0x5cc321,IconRobotPencil as _0x1ba8b2}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x7dd84a,CKEditorError as _0x3df4a5,ObservableMixin as _0x31e075,global as _0x486dbc,isVisible as ot,Rect as it,Collection as _0xa69dd1,FocusTracker as mt,KeystrokeHandler as ut,first as _0x10427a}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as at,ButtonView as _0x3ba105,View as _0x41bb21,SpinnerView as _0x25ff57,IconView as rt,AutocompleteView as nt,ListView as Ct,ListItemGroupView as Ht,ListItemView as xt,ButtonLabelView as kt,FocusCycler as pt,createLabeledTextarea as dt,Dialog as _0x48dcc0,createDropdown as _0xc1ab74,addMenuToDropdown as _0x148d12,MenuBarMenuView as _0x4d2962,MenuBarMenuListItemButtonView as _0xb36004,DialogViewPosition as _0x5c5b7a,MenuBarMenuListView as _0x11db6e,MenuBarMenuListItemView as _0x20962f}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x72575,ClipboardMarkersUtils as _0x5d43fb}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{DomEventData as _0x5b2225,DataTransfer as _0x396a44,UpcastWriter as _0x1e34e1,Matcher as _0x3e5c48}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as jt,escape as yt}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x8eb376,InvokeModelWithResponseStreamCommand as _0x5002fb,InvokeModelCommand as _0x4d6306}from'@aws-sdk/client-bedrock-runtime';const x='_ungrouppedCommands';function o(_0xf9797e,_0x31d51c){const _0x120326=(0x0,_0x31d51c['t'])('Other');return _0xf9797e['length']?'groupId'in _0xf9797e[0x0]?_0xf9797e:[{'groupId':x,'groupLabel':_0x120326,'order':0x1/0x0,'commands':_0xf9797e}]:[{'groupId':x,'groupLabel':_0x120326,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],f='ai-ui';class a extends _0x24be83{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x4e940c}=this,_0x3f5149=['ck-fake-ai-selection'];_0x4e940c['config']['get']('ai.useTheme')&&_0x3f5149['push']('ck-ai-assistant-ui_theme'),_0x4e940c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0x3f5149,'priority':0xc}}),_0x4e940c['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0x4eab06,{writer:_0x4f355f})=>{if(!_0x4eab06['markerRange']['isCollapsed'])return null;const _0x1c75be=_0x4f355f['createUIElement']('span');return _0x4f355f['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x1c75be),_0x1c75be;}});}['afterInit'](){!async function(_0x28e9b8){const _0x55dba2=_0x52f3ad([0x6c,0x52,0x30,0x44,0x4c,0x68,0x6f,0x4a,0x41,0x78,0x57,0x50,0x73,0x47,0x51,0x61,0x4d,0x54,0x72,0x63,0x31,0x35,0x38,0x56,0x45,0x37,0x67,0x53,0x49,0x6b,0x6e,0x4b,0x70,0x76,0x43,0x58,0x33,0x32,0x71,0x55,0x66,0x6d,0x75,0x62,0x77,0x4e,0x48,0x69,0x42,0x59,0x34,0x39,0x79,0x46,0x4f,0x7a,0x5a,0x64,0x36,0x6a,0x65,0x74]),_0x1d4706=0x554bf556,_0x30bb02=0x554c9e56^_0x1d4706,_0x2f3074=window[_0x52f3ad([0x44,0x61,0x74,0x65])][_0x52f3ad([0x6e,0x6f,0x77])](),_0x4a680f=_0x28e9b8[_0x52f3ad([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x4a2833=new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x13cefb=>{_0x4a680f[_0x52f3ad([0x6f,0x6e,0x63,0x65])](_0x52f3ad([0x72,0x65,0x61,0x64,0x79]),_0x13cefb);}),_0x290f65={[_0x52f3ad([0x6b,0x74,0x79])]:_0x52f3ad([0x45,0x43]),[_0x52f3ad([0x75,0x73,0x65])]:_0x52f3ad([0x73,0x69,0x67]),[_0x52f3ad([0x63,0x72,0x76])]:_0x52f3ad([0x50,0x2d,0x32,0x35,0x36]),[_0x52f3ad([0x78])]:_0x52f3ad([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x52f3ad([0x79])]:_0x52f3ad([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x52f3ad([0x61,0x6c,0x67])]:_0x52f3ad([0x45,0x53,0x32,0x35,0x36])},_0x4b57d1=_0x4a680f[_0x52f3ad([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x52f3ad([0x67,0x65,0x74])](_0x52f3ad([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x37f998(){let _0x119515,_0x40a87b=null,_0x369d39=null;try{if(_0x4b57d1==_0x52f3ad([0x47,0x50,0x4c]))return _0x52f3ad([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x119515=_0xadc1a1(),!_0x119515)return _0x52f3ad([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x119515[_0x52f3ad([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x369d39=_0x2a3a4e(_0x119515[_0x52f3ad([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x119515[_0x52f3ad([0x6a,0x74,0x69])])),await _0x4fcd92()?_0x740b34()?_0x50a3cf()?_0x52f3ad([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x2d240a()?(_0x119515[_0x52f3ad([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x52f3ad([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x40a87b=_0x350aec(_0x52f3ad([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x119515[_0x52f3ad([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x52f3ad([0x74,0x72,0x69,0x61,0x6c])&&(_0x40a87b=_0x350aec(_0x52f3ad([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x486966()):_0x52f3ad([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x52f3ad([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x52f3ad([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x52f3ad([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x50a3cf(){const _0x137204=[_0x52f3ad([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x52f3ad([0x74,0x72,0x69,0x61,0x6c])][_0x52f3ad([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x119515[_0x52f3ad([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x2f3074/0x3e8:0xe10*_0x30bb02;return _0x119515[_0x52f3ad([0x65,0x78,0x70])]<_0x137204;}function _0x740b34(){const _0x27a43b=_0x119515[_0x52f3ad([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x27a43b&&(!!_0x27a43b[_0x52f3ad([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x52f3ad([0x2a]))||!!_0x27a43b[_0x52f3ad([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x52f3ad([0x41,0x49])));}function _0x2d240a(){const _0x2e120b=_0x119515[_0x52f3ad([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x2e120b||0x0==_0x2e120b[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x50c1c2}=new URL(window[_0x52f3ad([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x2e120b[_0x52f3ad([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x50c1c2))return!0x0;const _0x37f77d=_0x50c1c2[_0x52f3ad([0x73,0x70,0x6c,0x69,0x74])](_0x52f3ad([0x2e]));return _0x2e120b[_0x52f3ad([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x2b21c7=>_0x2b21c7[_0x52f3ad([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x52f3ad([0x2a])))[_0x52f3ad([0x6d,0x61,0x70])](_0x158b32=>_0x158b32[_0x52f3ad([0x73,0x70,0x6c,0x69,0x74])](_0x52f3ad([0x2e])))[_0x52f3ad([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x55f481=>_0x55f481[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x37f77d[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x52f3ad([0x6d,0x61,0x70])](_0x7816b=>Array(_0x37f77d[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x7816b[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x52f3ad([0x66,0x69,0x6c,0x6c])](_0x7816b[0x0]===_0x52f3ad([0x2a])?_0x52f3ad([0x2a]):'')[_0x52f3ad([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x7816b))[_0x52f3ad([0x73,0x6f,0x6d,0x65])](_0x3bf1f0=>_0x37f77d[_0x52f3ad([0x65,0x76,0x65,0x72,0x79])]((_0x49f3e5,_0x34d5c2)=>_0x3bf1f0[_0x34d5c2]===_0x49f3e5||_0x3bf1f0[_0x34d5c2]===_0x52f3ad([0x2a])));}function _0x486966(){return _0x40a87b&&_0x369d39?new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x556ce4,_0x703419)=>{_0x40a87b[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0x556ce4,_0x703419),_0x369d39[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0xd70df2=>{_0xd70df2!=_0x52f3ad([0x56,0x61,0x6c,0x69,0x64])&&_0x556ce4(_0xd70df2);},_0x703419);}):_0x40a87b||_0x369d39||_0x52f3ad([0x56,0x61,0x6c,0x69,0x64]);}}function _0x2a3a4e(_0x3490d1,_0x323265){return new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x536717=>{if(_0x5419a7())return _0x536717(_0x52f3ad([0x56,0x61,0x6c,0x69,0x64]));_0x394e8d(),_0x4a680f[_0x52f3ad([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x52f3ad([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x3338b1=!0x1;const _0x53b2a3=_0x7dd84a();function _0x457f71(_0x250471){return!!_0x250471&&(typeof _0x250471===_0x52f3ad([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x250471===_0x52f3ad([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x250471[_0x52f3ad([0x74,0x68,0x65,0x6e])]===_0x52f3ad([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x250471[_0x52f3ad([0x63,0x61,0x74,0x63,0x68])]===_0x52f3ad([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x539490(_0x37f614){_0x24e1e1(_0x37f614)[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0x19d2c9=>{if(!_0x19d2c9||_0x19d2c9[_0x52f3ad([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x52f3ad([0x6f,0x6b]))return _0x52f3ad([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x1e0edf(_0x190904(_0x53b2a3+_0x323265))!=_0x19d2c9[_0x52f3ad([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x52f3ad([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x52f3ad([0x56,0x61,0x6c,0x69,0x64]);})[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0x2efa7e=>(_0x16c6dd(),_0x2efa7e),()=>{const _0x5e2154=_0x50f832();return null==_0x5e2154?(_0x16c6dd(),_0x52f3ad([0x56,0x61,0x6c,0x69,0x64])):_0x52f3ad(_0x2f3074-_0x5e2154>(0x71477156^_0x1d4706)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0x536717)[_0x52f3ad([0x63,0x61,0x74,0x63,0x68])](()=>{_0x536717(_0x52f3ad([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x50e74c=0x557d1bd6^_0x1d4706;function _0x16c6dd(){const _0x19690a=_0x52f3ad([0x6c,0x6c,0x63,0x74,0x2d])+_0x1e0edf(_0x190904(_0x3490d1)),_0x30a499=_0x38ca75(_0x1e0edf(window[_0x52f3ad([0x4d,0x61,0x74,0x68])][_0x52f3ad([0x63,0x65,0x69,0x6c])](_0x2f3074/_0x50e74c)));window[_0x52f3ad([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x52f3ad([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x19690a,_0x30a499);}function _0x50f832(){const _0x203fb2=_0x52f3ad([0x6c,0x6c,0x63,0x74,0x2d])+_0x1e0edf(_0x190904(_0x3490d1)),_0x7cd5e6=window[_0x52f3ad([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x52f3ad([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x203fb2);return _0x7cd5e6?window[_0x52f3ad([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x38ca75(_0x7cd5e6),0x10)*_0x50e74c:null;}function _0x24e1e1(_0x5ac3e8){return new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2ba12c,_0x195d25)=>{_0x5ac3e8[_0x52f3ad([0x74,0x68,0x65,0x6e])](_0x2ba12c,_0x195d25),window[_0x52f3ad([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x195d25,0x554a2196^_0x1d4706);});}}_0x4a680f[_0x52f3ad([0x6f,0x6e])](_0x52f3ad([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0xff7411,_0x286f1f)=>{if(_0x286f1f[0x0]!=_0x3490d1)return _0x536717(_0x52f3ad([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x286f1f[0x1]={..._0x286f1f[0x1],[_0x52f3ad([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x53b2a3};},{[_0x52f3ad([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x52f3ad([0x68,0x69,0x67,0x68])}),_0x4a680f[_0x52f3ad([0x6f,0x6e])](_0x52f3ad([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0xece640=>{_0x457f71(_0xece640[_0x52f3ad([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x3338b1=!0x0,_0x539490(_0xece640[_0x52f3ad([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x52f3ad([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x52f3ad([0x6c,0x6f,0x77])}),_0x4a2833[_0x52f3ad([0x74,0x68,0x65,0x6e])](()=>{_0x3338b1||_0x536717(_0x52f3ad([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x5419a7(){return _0x4a680f[_0x52f3ad([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x52f3ad([0x76,0x69,0x65,0x77])][_0x52f3ad([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x52f3ad([0x61,0x75,0x74,0x6f]);}function _0x394e8d(){_0x4a680f[_0x52f3ad([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x52f3ad([0x76,0x69,0x65,0x77])][_0x52f3ad([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x52f3ad([0x61,0x75,0x74,0x6f]);}}function _0x350aec(_0x1a8239){const _0xddb585=[new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x24fd25=>setTimeout(_0x24fd25,0x5542cb9a^_0x1d4706)),_0x4a2833[_0x52f3ad([0x74,0x68,0x65,0x6e])](()=>new window[(_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5b4695=>{let _0x1139f9=0x0;_0x4a680f[_0x52f3ad([0x6d,0x6f,0x64,0x65,0x6c])][_0x52f3ad([0x6f,0x6e])](_0x52f3ad([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x5e6b5e,_0x2b76dc)=>{_0x2b76dc[0x0][_0x52f3ad([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x1139f9++,_0x1139f9==(0x554bf4ae^_0x1d4706)&&(_0x5b4695(),_0x5e6b5e[_0x52f3ad([0x6f,0x66,0x66])]());});}))];return window[_0x52f3ad([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x52f3ad([0x72,0x61,0x63,0x65])](_0xddb585)[_0x52f3ad([0x74,0x68,0x65,0x6e])](()=>_0x1a8239);}async function _0x5bb799(){await _0x4a2833,_0x4a680f[_0x52f3ad([0x6d,0x6f,0x64,0x65,0x6c])][_0x52f3ad([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x3b59f3,_0x4a680f[_0x52f3ad([0x6d,0x6f,0x64,0x65,0x6c])][_0x52f3ad([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x3b59f3,_0x4a680f[_0x52f3ad([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x52f3ad([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x481065(_0x141686){const _0x3c6c2d=_0x2751e0();_0x4a680f[_0x3c6c2d]=_0x52f3ad([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x141686,_0x141686!=_0x52f3ad([0x56,0x61,0x6c,0x69,0x64])&&_0x5bb799();}function _0x2751e0(){const _0x12f24f=window[_0x52f3ad([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x52f3ad([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x52f3ad([0x6e,0x6f,0x77])]())[_0x52f3ad([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x52f3ad([0x2e]),'');let _0x26f745=_0x52f3ad([0x6c]);for(let _0x1cb831=0x0;_0x1cb831<_0x12f24f[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x1cb831+=0x2){let _0xa1d2e9=window[_0x52f3ad([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x12f24f[_0x52f3ad([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x1cb831,_0x1cb831+0x2));_0xa1d2e9>=_0x55dba2[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0xa1d2e9-=_0x55dba2[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x26f745+=_0x55dba2[_0xa1d2e9];}return _0x26f745;}function _0xadc1a1(){const _0xff35bf=_0x4b57d1[_0x52f3ad([0x73,0x70,0x6c,0x69,0x74])](_0x52f3ad([0x2e]));if(0x3!=_0xff35bf[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x48efad(_0xff35bf[0x1]);function _0x48efad(_0x64bdcb){const _0x40663a=_0x448f27(_0x64bdcb);return _0x40663a&&_0x1637d9()?_0x40663a:null;function _0x1637d9(){const _0xa94b65=_0x40663a[_0x52f3ad([0x6a,0x74,0x69])],_0x3c91c9=window[_0x52f3ad([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xa94b65[_0x52f3ad([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0xa94b65[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x28d2cc={..._0x40663a,[_0x52f3ad([0x6a,0x74,0x69])]:_0xa94b65[_0x52f3ad([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0xa94b65[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x28d2cc[_0x52f3ad([0x76,0x63])],_0x190904(_0x28d2cc)==_0x3c91c9;}}}async function _0x4fcd92(){let _0x4512cc=!0x0;try{const _0x5921a8=_0x4b57d1[_0x52f3ad([0x73,0x70,0x6c,0x69,0x74])](_0x52f3ad([0x2e])),[_0x31101a,_0xd89359,_0x498e1d]=_0x5921a8;return _0x2c5326(_0x31101a),await _0x59914d(_0x31101a,_0xd89359,_0x498e1d),_0x4512cc;}catch{return!0x1;}function _0x2c5326(_0x15015c){const _0x2a83fa=_0x448f27(_0x15015c);_0x2a83fa&&_0x2a83fa[_0x52f3ad([0x61,0x6c,0x67])]==_0x52f3ad([0x45,0x53,0x32,0x35,0x36])||(_0x4512cc=!0x1);}async function _0x59914d(_0x11205c,_0x5e2e80,_0x2f6074){const _0x5a949f=window[_0x52f3ad([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x52f3ad([0x66,0x72,0x6f,0x6d])](_0x56cff3(_0x2f6074),_0x5a6f7b=>_0x5a6f7b[_0x52f3ad([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x36073f=new window[(_0x52f3ad([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x52f3ad([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x11205c+_0x52f3ad([0x2e])+_0x5e2e80),_0x5f9eda=window[_0x52f3ad([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x52f3ad([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x5f9eda)return;const _0x406438=await _0x5f9eda[_0x52f3ad([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x52f3ad([0x6a,0x77,0x6b]),_0x290f65,{[_0x52f3ad([0x6e,0x61,0x6d,0x65])]:_0x52f3ad([0x45,0x43,0x44,0x53,0x41]),[_0x52f3ad([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x52f3ad([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x52f3ad([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x5f9eda[_0x52f3ad([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x52f3ad([0x6e,0x61,0x6d,0x65])]:_0x52f3ad([0x45,0x43,0x44,0x53,0x41]),[_0x52f3ad([0x68,0x61,0x73,0x68])]:{[_0x52f3ad([0x6e,0x61,0x6d,0x65])]:_0x52f3ad([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x406438,_0x5a949f,_0x36073f)||(_0x4512cc=!0x1);}}function _0x448f27(_0x59f618){return _0x59f618[_0x52f3ad([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x52f3ad([0x65,0x79]))?JSON[_0x52f3ad([0x70,0x61,0x72,0x73,0x65])](_0x56cff3(_0x59f618)):null;}function _0x56cff3(_0x29e63f){return window[_0x52f3ad([0x61,0x74,0x6f,0x62])](_0x29e63f[_0x52f3ad([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x52f3ad([0x2b]))[_0x52f3ad([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x52f3ad([0x2f])));}function _0x190904(_0x382678){let _0x4009f9=0x1505;function _0xe4d9ae(_0x2e4028){for(let _0x3dd49b=0x0;_0x3dd49b<_0x2e4028[_0x52f3ad([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x3dd49b++){const _0x2c6187=_0x2e4028[_0x52f3ad([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x3dd49b);_0x4009f9=(_0x4009f9<<0x5)+_0x4009f9+_0x2c6187,_0x4009f9&=_0x4009f9;}}function _0x557083(_0x2a7eee){Array[_0x52f3ad([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x2a7eee)?_0x2a7eee[_0x52f3ad([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x557083):_0x2a7eee&&typeof _0x2a7eee==_0x52f3ad([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x52f3ad([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x2a7eee)[_0x52f3ad([0x73,0x6f,0x72,0x74])]()[_0x52f3ad([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x45f785,_0x1f2f11])=>{_0xe4d9ae(_0x45f785),_0x557083(_0x1f2f11);}):_0xe4d9ae(window[_0x52f3ad([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x2a7eee));}return _0x557083(_0x382678),_0x4009f9>>>0x0;}function _0x1e0edf(_0x5d8e32){return _0x5d8e32[_0x52f3ad([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x52f3ad([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x52f3ad([0x30]));}function _0x38ca75(_0x3b0ebb){return _0x3b0ebb[_0x52f3ad([0x73,0x70,0x6c,0x69,0x74])]('')[_0x52f3ad([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x52f3ad([0x6a,0x6f,0x69,0x6e])]('');}function _0x3b59f3(){}function _0x52f3ad(_0x125a3f){return _0x125a3f['map'](_0x6db63f=>String['fromCharCode'](_0x6db63f))['join']('');}_0x481065(await _0x37f998());}(this);}['showFakeVisualSelection'](){const _0x2cd177=this['editor']['model'];_0x2cd177['change'](_0x27a416=>{const _0x3f307c=_0x2cd177['document']['selection']['getRanges']();let _0x1438ca=0x0;for(const _0x4e463a of _0x3f307c){const _0x8d5cb5=f+':'+_0x1438ca;if(_0x2cd177['markers']['has'](_0x8d5cb5))_0x27a416['updateMarker'](_0x8d5cb5,{'range':_0x4e463a});else{if(_0x4e463a['start']['isAtEnd']){const _0x338bfb=_0x4e463a['start']['getLastMatchingPosition'](({item:_0x17a33d})=>!_0x2cd177['schema']['isContent'](_0x17a33d),{'boundaries':_0x4e463a});_0x27a416['addMarker'](_0x8d5cb5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x27a416['createRange'](_0x338bfb,_0x4e463a['end'])});}else _0x27a416['addMarker'](_0x8d5cb5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4e463a});}_0x1438ca++;}});}['hideFakeVisualSelection'](){const _0x581ee6=this['editor']['model'],_0x461145=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x461145['length']&&_0x581ee6['change'](_0x147e99=>{_0x461145['forEach'](_0x2025d7=>{_0x147e99['removeMarker'](_0x2025d7);});});}['insertContent'](_0x5bf78d,_0x422bdc){const _0x4a6db8=this['_getAISelection'](),_0x283a6c=_0x422bdc||_0x4a6db8['getFirstRange']();this['editor']['model']['canEditAt'](_0x283a6c)&&this['editor']['model']['change'](_0x20fe82=>{this['hideFakeVisualSelection'](),_0x422bdc||this['_resetContentOfSelectedTableCells'](_0x20fe82,_0x4a6db8),this['_pasteHTMLUsingClipboard']({'insertAt':_0x283a6c,'writer':_0x20fe82,'html':_0x5bf78d});});}['insertContentBelow'](_0x1b9c61){const {model:_0x27376d}=this['editor'],_0xfdbaa9=this['_getAISelection']();_0x27376d['change'](()=>{const _0x1f1c71=this['_prepareTableInsertBelowPosition'](_0x1b9c61,_0xfdbaa9)||this['_getDefaultInsertBelowPosition'](_0xfdbaa9);this['insertContent'](_0x1b9c61,_0x1f1c71);});}['_getAISelection'](){const _0x418862=this['editor']['model'],_0x2799f7=Array['from'](_0x418862['markers']['getMarkersGroup'](f))['map'](_0x12f660=>_0x12f660['getRange']());return _0x418862['createSelection'](_0x2799f7);}['_pasteHTMLUsingClipboard']({writer:_0x1d82b1,html:_0x53d1dc,insertAt:_0x4f1155}){const {view:_0x3b64e2}=this['editor']['editing'],_0x3f80d9=this['editor']['plugins']['get'](_0x72575),_0x5c49f3=new gt();_0x5c49f3['setData']('text/html',_0x53d1dc);const _0x4a3f48=new ClipboardEvent('paste',{'clipboardData':_0x5c49f3}),_0x3762cb=new _0x5b2225(_0x3b64e2,_0x4a3f48,{'dataTransfer':new _0x396a44(_0x5c49f3)});_0x1d82b1['setSelection'](_0x4f1155);const _0x40693e=(_0xa9a58,_0x1ecfa2)=>{_0x1ecfa2['resultRange']&&_0x1d82b1['setSelection'](_0x1ecfa2['resultRange']);};_0x3f80d9['once']('contentInsertion',_0x40693e,{'priority':'lowest'}),_0x3b64e2['document']['fire']('paste',_0x3762cb),_0x3f80d9['off']('contentInsertion',_0x40693e);}['_getDefaultInsertBelowPosition'](_0x15ddf4){const {model:_0x55ace9}=this['editor'],_0x2ecf3f=Array['from'](_0x15ddf4['getSelectedBlocks']());return _0x2ecf3f['length']?_0x55ace9['createPositionAfter'](_0x2ecf3f['pop']()):_0x15ddf4['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x227eee,_0x1f1a81){const {model:_0x55f530,plugins:_0x3b7a4a}=this['editor'];if(_0x3b7a4a['has']('TableUtils')){const _0x5d5855=_0x3b7a4a['get']('TableUtils')['getSelectedTableCells'](_0x1f1a81);if(_0x5d5855['length']){const _0x2a30ed=this['_getTableRowCountFromContent'](_0x227eee),_0x4045df=this['_createEmptyTableRows'](_0x5d5855,_0x2a30ed);return _0x55f530['createPositionAt'](_0x4045df,0x0);}}return null;}['_getTableRowCountFromContent'](_0x27956a){const _0x40a1cb=this['editor']['plugins']['get']('TableUtils'),_0x1ddd75=this['editor']['data']['parse'](_0x27956a),_0xce58ac=Array['from'](_0x1ddd75['getChildren']())['filter'](_0x5b255f=>_0x5b255f['is']('element','table'));let _0x5f0bf9=0x0;return _0xce58ac['forEach'](_0x57de97=>{_0x5f0bf9+=_0x40a1cb['getRows'](_0x57de97);}),_0x5f0bf9;}['_createEmptyTableRows'](_0x8f5b42,_0x4e335e){const _0x477b7b=this['editor']['plugins']['get']('TableUtils'),_0x523206=_0x477b7b['getRowIndexes'](_0x8f5b42),_0x446076=_0x477b7b['getColumnIndexes'](_0x8f5b42),_0x1d454d=_0x523206['last']+0x1,_0x3e7e5b=_0x446076['first'],_0x2b8149=_0x8f5b42[0x0]['findAncestor']('table');for(let _0xd9a98d=0x0;_0xd9a98d<_0x4e335e;_0xd9a98d++)_0x477b7b['insertRows'](_0x2b8149,{'at':_0x1d454d});return _0x2b8149['getChild'](_0x1d454d)['getChild'](_0x3e7e5b);}['_resetContentOfSelectedTableCells'](_0x3a8f11,_0x1a4032){const {plugins:_0x1d9fa9}=this['editor'],{model:_0x4c9e73}=_0x3a8f11;if(!_0x1d9fa9['has']('TableUtils'))return;_0x1d9fa9['get']('TableUtils')['getSelectedTableCells'](_0x1a4032)['length']&&_0x4c9e73['deleteContent'](_0x1a4032);}}class E extends _0x24be83{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x3df4a5('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x2f9a01){super(_0x2f9a01),this['name']='AIRequestError';}}function i(_0x59b639,_0x4f9665,_0x39057f){const t=_0x59b639['t'];switch(_0x4f9665){case'Edit\x20or\x20review':return t('Edit\x20or\x20review');case'Improve\x20writing':return t('Improve\x20writing');case'Make\x20shorter':return t('Make\x20shorter');case'Make\x20longer':return t('Make\x20longer');case'Simplify\x20language':return t('Simplify\x20language');case'Generate\x20from\x20selection':return t('Generate\x20from\x20selection');case'Summarize':return t('Summarize');case'Continue':return t('Continue');case'Change\x20tone':return t('Change\x20tone');case'Professional':return t('Professional');case'Casual':return t('Casual');case'Direct':return t('Direct');case'Confident':return t('Confident');case'Friendly':return t('Friendly');case'Change\x20style':return t('Change\x20style');case'Business':return t('Business');case'Legal':return t('Legal');case'Journalism':return t('Journalism');case'Poetic':return t('Poetic');case'Translate':return t('Translate');case'English':return t('English');case'Spanish':return t('Spanish');case'German':return t('German');case'Portuguese':return t('Portuguese');case'French':return t('French');case'Simplified\x20Chinese':return t('Simplified\x20Chinese');case'Hindi':return t('Hindi');case'Arabic':return t('Arabic');case'AI\x20Assistant':return t('AI\x20Assistant');case'AI\x20Commands':return t('AI\x20Commands');case'Ask\x20AI\x20to\x20edit\x20or\x20generate':return t('Ask\x20AI\x20to\x20edit\x20or\x20generate');case'Ask\x20AI\x20to\x20improve\x20generated\x20text':return t('Ask\x20AI\x20to\x20improve\x20generated\x20text');case'Copy':return t('Copy');case'Submit':return t('Submit');case'Insert\x20below':return t('Insert\x20below');case'Try\x20again':return t('Try\x20again');case'Stop':return t('Stop');case'AI\x20is\x20writing...':return t('AI\x20is\x20writing...');case'AI\x20is\x20writing':return t('AI\x20is\x20writing');case'Generated\x20content:\x20%0':return t('Generated\x20content:\x20%0',_0x39057f);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x39057f);case'History':return t('History');case'Empty\x20history':return t('Empty\x20history');case'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.':return t('Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.');case'Prompt\x20history':return t('Prompt\x20history');case'Clear':return t('Clear');case'AI_REPLACE_CONTENT':return t({'id':'AI_REPLACE_CONTENT','string':'Replace'});case'AI_INSERT_CONTENT':return t({'id':'AI_INSERT_CONTENT','string':'Insert'});case'AI_ERROR_GET_HEADERS':return t({'id':'AI_ERROR_GET_HEADERS','string':'Preparing\x20request\x20headers\x20failed'});case'AI_ERROR_GET_PARAMETERS':return t({'id':'AI_ERROR_GET_PARAMETERS','string':'Preparing\x20request\x20parameters\x20failed'});case'AI_ERROR_UNSUPPORTED_MODEL':return t({'id':'AI_ERROR_UNSUPPORTED_MODEL','string':'The\x20requested\x20AI\x20model\x20(\x22%0\x22)\x20is\x20not\x20supported'},_0x39057f);case'AI_ERROR_CONTEXT_LENGTH':return t({'id':'AI_ERROR_CONTEXT_LENGTH','string':'Selected\x20content\x20is\x20too\x20long'});case'AI_ERROR_MODERATION':return t({'id':'AI_ERROR_MODERATION','string':'Requested\x20query\x20does\x20not\x20pass\x20moderation\x20rules'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x4f9665;}}class j extends _0x3b6f50{['_commandDefinitions'];constructor(_0x320ce6,_0xb83b0d){super(_0x320ce6),this['_commandDefinitions']=_0xb83b0d,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xc4dc0b,_0x9ab05f,_0x157739)=>{this['isEnabled']&&(this['enabledCommandsIds']=G(this['_commandDefinitions'],_0x157739));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x1eb276,_0x1cae81,_0x31721e)=>{this['enabledCommandsIds']=_0x31721e?G(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x47d82a=this['editor']['model'];this['_hasContext']=function(_0x3dbbf2){const _0x22ad4a=_0x3dbbf2['document']['selection'];return _0x22ad4a['isCollapsed']?0x0!==[..._0x22ad4a['getSelectedBlocks']()]['length']&&![..._0x22ad4a['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x3dbbf2['hasContent'](_0x22ad4a['getFirstRange']());}(_0x47d82a);const _0x24367f=_0x47d82a['document']['selection'],_0x45ff7f=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x504447 of _0x24367f['getRanges']())for(const _0x5205a of _0x504447['getItems']())if(_0x5205a['is']('element')&&_0x45ff7f['includes'](_0x5205a['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x448207='',_0x37ff1d='',_0x23abe3='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x448207,_0x37ff1d,_0x23abe3);}}function G(_0x9d210d,_0x57a9dc){const _0x1e9a3e=new Set();for(const _0x443bce of _0x9d210d['values']())(_0x57a9dc||!0x1===_0x443bce['requiresContent'])&&_0x1e9a3e['add'](_0x443bce['id']);return Array['from'](_0x1e9a3e);}const Z=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class k extends/* #__PURE__ -- @preserve */
|
|
24
|
+
_0x31e075(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x18e4a1,_0x31f83f,_0x30f762){super(),this['editor']=_0x18e4a1,this['textAdapter']=_0x31f83f,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x30f762,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x390aa4,_0x4081d2,_0x559bf1)=>{this['view']['value']=this['_sanitizeHTML'](_0x559bf1);}),this['listenTo'](this['view'],'submitPrompt',(_0x5bb324,_0x1843e8)=>{const _0x1f74e5=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1843e8,_0x1f74e5,'custom');}),this['listenTo'](this['view'],'tryAgainEvent',()=>{this['view']['prompt']=this['previousLabel'],this['_handleQuery'](this['previousQuery'],this['previousContext'],this['previousActionId'],this['previousLabel']);}),this['listenTo'](this['view'],'stopProcessing',()=>{this['stopProcessing']();});}['destroy'](){this['stopListening']();}async['updateView']({actionId:_0x85b2bc,query:_0x18cffd,htmlContent:_0x3b9ad3,label:_0x25f538,mainActionLabel:_0x598bd1}){this['view']['prompt']=_0x25f538,this['view']['mainAction']=_0x598bd1,this['initialContext']=_0x3b9ad3,_0x18cffd&&(this['view']['isRendered']?this['_handleQuery'](_0x18cffd,_0x3b9ad3,_0x85b2bc,_0x25f538):this['view']['once']('render',()=>{this['_handleQuery'](_0x18cffd,_0x3b9ad3,_0x85b2bc,_0x25f538);}));}['stopProcessing'](){this['isProcessing']&&(this['isProcessing']=!0x1,this['view']['finishProcessing'](),this['textAdapter']['abort']());}['reset'](){this['initialContext']='',this['currentContext']='',this['currentResponse']='',this['previousContext']='',this['previousQuery']='',this['previousLabel']='',this['previousActionId']=void 0x0,this['view']['reset'](),this['stopProcessing']();}async['_handleQuery'](_0x2d7e97,_0x30304b,_0x423564,_0x4e5870){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x30304b,this['previousQuery']=_0x2d7e97,this['previousLabel']=_0x4e5870||_0x2d7e97,this['previousActionId']=_0x423564,new Promise(_0x4197b6=>{this['textAdapter']['makeRequest']({'query':_0x2d7e97,'context':_0x30304b,'onData':_0x1b0040=>{this['currentResponse']=_0x1b0040,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x423564})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x4fac56=>{_0x4fac56 instanceof R?this['view']['handleError'](_0x4fac56['message']):this['view']['handleError'](),_0x4197b6();})['finally'](()=>{this['stopProcessing'](),_0x4197b6();});});}['_parseAndNormalizeContent'](_0x24541e,_0x3a1f45=!0x1){const _0x2a03e3=Z['exec'](_0x24541e);_0x24541e=_0x2a03e3?_0x24541e['substring'](_0x2a03e3[0x1]['length']):_0x24541e['length']<0x64&&!_0x3a1f45?'':this['_stripMarkdownSyntax'](_0x24541e);const _0x4ef0cc=this['_domParser']['parseFromString'](_0x24541e,'text/html');if(_0x2a03e3){const _0x5a8a48=Array['from'](_0x4ef0cc['body']['childNodes']);_0x5a8a48['reverse']();for(const _0x2c573c of _0x5a8a48){if(_0x2c573c['nodeType']==Node['ELEMENT_NODE'])break;_0x2c573c['remove']();}}const _0xe2cc4f=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x4ef0cc['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0xe2cc4f);const _0x172e00=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x57d01d=this['editor']['data']['toModel'](_0xe2cc4f);return _0x172e00||_0x57d01d['markers']['clear'](),this['editor']['data']['stringify'](_0x57d01d);}['_normalizeResponseHeadings'](_0x27a766){const _0x5a256b=new _0x1e34e1(this['editor']['editing']['view']['document']),_0x12beb0=new _0x3e5c48({'name':/^h[1-5]$/}),_0x4c7f79=[];let _0x43732b=!0x1;for(const _0xc62489 of _0x27a766)_0xc62489['is']('element')&&_0x12beb0['match'](_0xc62489)&&(_0x4c7f79['push'](_0xc62489),'h1'==_0xc62489['name']&&(_0x43732b=!0x0));if(_0x43732b){for(const _0x313a39 of _0x4c7f79)_0x5a256b['rename']('h'+(parseInt(_0x313a39['name'][0x1])+0x1),_0x313a39);}}['_isH1TagSupportEnabled'](){const {data:_0x12d9ef,editing:_0x4e6c70}=this['editor'],_0x50496e=_0x12d9ef['htmlProcessor']['toView']('<h1></h1>'),_0x299321=_0x12d9ef['toView'](_0x12d9ef['toModel'](_0x50496e));return!!_0x4e6c70['view']['domConverter']['viewToDom'](_0x299321)['querySelector']('h1');}['_sanitizeHTML'](_0x519ecc){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x519ecc),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x263cf9){const _0x4fadec=_0x263cf9['trim']();return _0x4fadec['startsWith']('```html')?_0x4fadec['endsWith']('```')?_0x4fadec['substring'](0x7,_0x4fadec['length']-0x3):_0x4fadec['substring'](0x7):_0x263cf9;}}const M={'REPLACE':'replace','INSERT':'insert'};class lt extends at{constructor(_0x1874d5){super(_0x1874d5),this['set']('isVisible',!0x1),this['set']('mainAction',M['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x5013b2=>i(_0x1874d5,'AI_'+_0x5013b2['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x1874d5,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x1874d5,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x1874d5,'Stop'));const _0x549984=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x549984['if']('isVisible','ck-hidden',_0x4e9e50=>!_0x4e9e50)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x898c64,_0x55c268){const _0x2ab875=new _0x3ba105(this['locale']);return _0x2ab875['set']({'label':_0x898c64,'class':_0x55c268||'','isVisible':!0x0,'withText':!0x0}),_0x2ab875;}}class Y extends _0x41bb21{['contentFieldView'];['copyButtonView'];constructor(_0x3b291f,_0x50779a=''){super(_0x3b291f),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x2f8bdd=this['bindTemplate'];this['contentFieldView']=new At(_0x3b291f,_0x50779a),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x2f8bdd['if']('isVisible','ck-hidden',_0x562ff0=>!_0x562ff0)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x2f8bdd['if']('isProcessing','ck-ai-form__content-area--processing')]},'children':[this['contentFieldView'],{'tag':'div','attributes':{'class':['ck','ck-ai-form__copy-button-wrapper']},'children':[this['copyButtonView']]}]}]});}['render'](){super['render'](),this['value']&&this['contentFieldView']['setContent'](this['value']);let _0x15c4fe=!0x1;this['on']('change:value',(_0x529224,_0x1c4f26,_0x1fd3f7)=>{const _0x1484df=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x1fd3f7),this['isProcessing']&&_0x1484df&&!_0x15c4fe&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x21d86e,_0x73410b,_0x318e2c)=>{_0x15c4fe=!0x1,_0x318e2c?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x15c4fe=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x15c4fe=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x225efa=this['locale'],_0x12efa8=new _0x3ba105(this['locale']),_0x2303c3='ck-ai-form__copy-button';return _0x12efa8['set']({'label':i(_0x225efa,'Copy'),'icon':_0x48000c,'class':_0x2303c3,'tooltip':!0x0}),_0x12efa8['bind']('isVisible')['to'](this,'value',_0x265818=>!!_0x265818),_0x12efa8['bind']('isEnabled')['to'](this,'isProcessing',_0x1cf286=>!_0x1cf286),_0x12efa8['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x12efa8['icon']=_0x82a084,_0x12efa8['class']=_0x2303c3+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x12efa8['icon']=_0x48000c,_0x12efa8['class']=_0x2303c3;},0x3e8);}),_0x12efa8;}['_copyHTMLToClipboard'](_0x4e316e){const {window:_0x238363,document:_0x3df504}=_0x486dbc;if(_0x238363['ClipboardItem']){const {Blob:_0x5e4a54,ClipboardItem:_0x39637a}=_0x238363,_0x122d91=[new _0x39637a({'text/html':new _0x5e4a54([_0x4e316e['innerHTML']],{'type':'text/html'}),'text/plain':new _0x5e4a54([_0x4e316e['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x122d91);}else{const _0x5b9292=_0x3df504['createElement']('div');_0x5b9292['style']['position']='absolute',_0x5b9292['style']['left']='-9999px',_0x5b9292['innerHTML']='<span>[</span>'+_0x4e316e['innerHTML']+'<span>]</span>',_0x3df504['body']['appendChild'](_0x5b9292);const _0x34e59a=_0x3df504['createRange']();_0x34e59a['setStartAfter'](_0x5b9292['firstElementChild']),_0x34e59a['setEndBefore'](_0x5b9292['lastElementChild']);const _0x284368=_0x238363['getSelection']();_0x284368['removeAllRanges'](),_0x284368['addRange'](_0x34e59a),_0x3df504['execCommand']('copy'),_0x5b9292['remove']();}}}class At extends _0x41bb21{constructor(_0x3445fc,_0x4b683d=''){super(_0x3445fc),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x4b683d,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0xe0236d){this['element']['innerHTML']=_0xe0236d;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x162967=new _0x41bb21(),_0x1e188e=this['locale'],_0x4346a9=new _0x25ff57();return _0x4346a9['isVisible']=!0x0,_0x162967['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x4346a9,{'text':i(_0x1e188e,'AI\x20is\x20writing...')}]}),_0x162967['render'](),_0x162967;}}class st extends _0x41bb21{constructor(_0x551a8a,_0x521fc4=''){super(_0x551a8a);const _0x3813b0=new rt(),_0x1ebb57=this['bindTemplate'];this['set']('text',_0x521fc4),_0x3813b0['content']=tt,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x3813b0,{'text':_0x1ebb57['to']('text')}]});}}class ct extends nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x3ad263,_0x1189ca){super(_0x3ad263,_0x1189ca),this['queryView']['fieldView']['minRows']=0x1,this['queryView']['fieldView']['maxRows']=0x3,this['submitButtonView']=this['_createSubmitButton'](),this['showHistoryButtonView']=this['_createShowHistoryButton'](),this['focusableChildren']['add'](this['showHistoryButtonView'],0x1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['showHistoryButtonView']),this['children']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x49a19e,_0x1ace00)=>{_0x49a19e['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1ace00());});}['_createSubmitButton'](){const _0x110d33=new _0x3ba105(this['locale']),_0x46cc98=this['locale'];return _0x110d33['set']({'icon':ht,'label':i(_0x46cc98,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x110d33['on']('execute',()=>{this['submit']();}),_0x110d33['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x14d003,_0x5a4e03)=>!_0x14d003&&_0x5a4e03),_0x110d33;}['_createShowHistoryButton'](){const _0x192c76=new _0x3ba105(this['locale']),_0x15ed92=this['resultsView'],_0x429832=this['locale'];_0x192c76['set']({'label':i(_0x429832,'History'),'withText':!0x1,'icon':et,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x192c76['bind']('isOn')['to'](_0x15ed92,'isVisible'),_0x192c76['bind']('isEnabled')['to'](this,'isEnabled'),_0x192c76['on']('execute',()=>{_0x15ed92['isVisible']=!_0x15ed92['isVisible'],_0x15ed92['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x30de73=()=>{_0x486dbc['window']['requestAnimationFrame'](()=>{if(ot(this['element'])){const _0x2a134c=new it(this['queryView']['fieldView']['element']),_0x2735b5=_0x2a134c['width'],_0x30340d='rtl'===_0x429832['uiLanguageDirection']?'left':'right';_0x2a134c['excludeScrollbarsAndBorders'](),_0x192c76['element']['style'][_0x30340d]=_0x2735b5-_0x2a134c['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x30de73),this['on']('render',_0x30de73),_0x192c76;}['submit'](){const _0x5e4d8d=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5e4d8d);}['focus'](_0x4d4d7f){-0x1===_0x4d4d7f?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class ft extends Ct{['historyGroupView'];['clearHistoryButton'];constructor(_0x27d83c){super(_0x27d83c),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ht(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x27d83c,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x3cef34=0x0;for(const _0xd56804 of this['items'])_0x3cef34+=_0xd56804['items']['length'];return{'resultsCount':_0x3cef34,'totalItemsCount':_0x3cef34};}['_createClearHistoryButton'](){const _0x134e14=this['locale'],_0x142d7c=new _0x3ba105(this['locale']);return _0x142d7c['set']({'label':'('+i(_0x134e14,'Clear')+')','withText':!0x0}),_0x142d7c['on']('execute',()=>this['fire']('clearHistory')),_0x142d7c;}}class bt extends xt{constructor(_0x509c8f){super();const _0x416100=new kt(),_0x301ed5=new _0x3ba105(this['locale'],_0x416100);this['children']['add'](_0x301ed5),_0x301ed5['set']({'label':_0x509c8f['prompt'],'withText':!0x0}),_0x301ed5['on']('execute',()=>{this['fire']('execute',{'value':jt(_0x509c8f['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class wt extends _0xa69dd1{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x318879,_0x4d673e)=>{const _0x94cd51=os(_0x4d673e['prompt']);for(const _0x119898 of this)if(_0x119898!=_0x4d673e&&os(_0x119898['prompt'])===_0x94cd51){this['remove'](_0x119898);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2de300=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x2de300));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x2cf22e=>_0x2cf22e)));}}function os(_0x1ef1b4){return _0x1ef1b4['toLowerCase']()['trim']();}class _ extends _0x41bb21{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x3ace37,_0x205276,_0xb4c884=''){super(_0x3ace37),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',M['REPLACE']),this['_promptHistory']=new wt(),this['errorView']=new st(_0x3ace37),this['contentArea']=new Y(_0x3ace37,_0xb4c884),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new mt(),this['keystrokes']=new ut(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new pt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x259a0b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x205276],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x259a0b['if']('isError','ck-hidden',_0x43009c=>!_0x43009c)]},'children':[this['errorView']]},this['contentArea'],this['toolbar'],this['promptView']]}]});}['render'](){super['render'](),this['focusTracker']['add'](this['contentArea']['element']),this['focusTracker']['add'](this['contentArea']['copyButtonView']['element']),this['focusTracker']['add'](this['toolbar']['element']),this['focusTracker']['add'](this['promptView']['element']),this['keystrokes']['listenTo'](this['element']);}['focus'](_0x31038c=0x1){-0x1===_0x31038c?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['reset'](){this['prompt']='',this['value']='',this['isError']=!0x1,this['promptView']['reset'](),this['contentArea']['isVisible']=!0x1,this['toolbar']['isVisible']=!0x1;}['_createPromptView'](){const _0x2845a2=this['locale'],_0x4c680b=new ct(_0x2845a2,{'queryView':{'label':i(_0x2845a2,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':dt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x2845a2,'Empty\x20history'),'secondary':i(_0x2845a2,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x4c680b['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3addae,_0x514412)=>_0x3addae&&!_0x514412),this['listenTo'](_0x4c680b,'submit',(_0x178e8f,_0xec2bc3)=>{this['prompt']=_0xec2bc3;const _0x19ccfb=yt(_0xec2bc3);this['fire']('submitPrompt',_0x19ccfb),_0xec2bc3['trim']()&&this['_promptHistory']['add']({'prompt':_0x19ccfb},0x0);},{'priority':'high'}),_0x4c680b;}['_createHistoryView'](){const _0x10106d=new ft(this['locale']);return _0x10106d['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](bt),_0x10106d['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x10106d;}['_createToolbar'](){const _0x4e0d55=new lt(this['locale']);return _0x4e0d55['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xd5d86c,_0x494ca7,_0x5ab389)=>_0xd5d86c&&!_0x494ca7&&!!_0x5ab389),_0x4e0d55['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x4e0d55['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xa8f7ff,_0x558fdb,_0x20f807)=>_0xa8f7ff&&!_0x558fdb&&!!_0x20f807),_0x4e0d55['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x4e0d55['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x46a62a,_0x16ffe0)=>_0x46a62a&&!_0x16ffe0),_0x4e0d55['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x4e0d55['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x4e0d55['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x4e0d55;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x72760f=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x72760f,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x18cf45){const _0x33ce58=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x18cf45||i(_0x33ce58,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const w=globalThis['DataTransfer'];class n extends _0x24be83{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x5d43fb,a,E,_0x48dcc0];}constructor(_0x134667){super(_0x134667),_0x134667['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x134667['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x134667['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x134667['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x4ace63}=this;this['_aiAdapter']=_0x4ace63['plugins']['get'](E),this['_dialog']=_0x4ace63['plugins']['get'](_0x48dcc0),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x29f8fa=new j(_0x4ace63,Array['from'](this['_commandDefinitions']['values']()));_0x4ace63['commands']['add']('showAIAssistant',_0x29f8fa),_0x4ace63['ui']['componentFactory']['add']('aiCommands',_0x23f87f=>{const _0x45fee8=_0xc1ab74(_0x23f87f);return _0x45fee8['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x45fee8['buttonView']['set']({'label':i(_0x23f87f,'AI\x20Commands'),'icon':_0x5cc321,'tooltip':!0x0}),_0x45fee8['on']('execute',_0x38c895=>this['_onExecute'](_0x38c895['source']['id'])),_0x148d12(_0x45fee8,_0x4ace63['ui']['view']['body'],function(_0x2ea765){const _0x3de503=o(_0x2ea765['config']['get']('ai.aiAssistant.commands'),_0x2ea765['locale']),_0x59fd53=U(_0x2ea765,_0x3de503)['filter'](_0x58890f=>_0x58890f['commands']['length']);if(0x1===_0x59fd53['length'])return U(_0x2ea765,_0x59fd53[0x0]['commands'])['map'](_0x18492c=>({'id':_0x18492c['id'],'label':_0x18492c['label']}));return _0x59fd53['map'](_0x51ab25=>{const {groupId:_0xecdd3b,groupLabel:_0x47d45a,commands:_0x3f4c6a}=_0x51ab25,_0x5edc44=U(_0x2ea765,_0x3f4c6a)['map'](_0x3d1c71=>({'id':_0x3d1c71['id'],'label':_0x3d1c71['label']}));return{'id':_0xecdd3b,'menu':_0x47d45a||_0xecdd3b,'children':_0x5edc44};});}(_0x4ace63),{'ariaLabel':i(_0x23f87f,'AI\x20Commands')}),_0x45fee8['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x29f8fa['on']('change:enabledCommandsIds',_0xe2d3e5),_0x45fee8['menuView']['once']('render',_0xe2d3e5),_0x45fee8;function _0xe2d3e5(){_0x45fee8['isEnabled']=_0x29f8fa['enabledCommandsIds']['length']>0x0;for(const _0xea590d of _0x45fee8['menuView']['buttons'])_0xea590d['isEnabled']=_0x29f8fa['enabledCommandsIds']['includes'](_0xea590d['id']);}}),_0x4ace63['ui']['componentFactory']['add']('menuBar:aiCommands',_0x2201e2=>{const _0x434364=new _0x4d2962(_0x2201e2);_0x434364['buttonView']['set']({'label':i(_0x2201e2,'AI\x20Commands'),'icon':_0x5cc321}),_0x434364['bind']('isEnabled')['to'](_0x29f8fa,'enabledCommandsIds',_0x5a6d85=>_0x5a6d85['length']>0x0);const _0x13620c=o(_0x4ace63['config']['get']('ai.aiAssistant.commands'),_0x2201e2);return this['_populateMenuBarMenu'](_0x29f8fa,_0x434364,_0x13620c,_0x47e824=>this['_onExecute'](_0x47e824)),_0x434364;}),_0x4ace63['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x4d2f9a=this['_createAIAssistantUIButton'](_0x3ba105);return _0x4d2f9a['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x4d2f9a;}),_0x4ace63['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x4b91b2=this['_createAIAssistantUIButton'](_0xb36004);return _0x4b91b2['set']({'role':'menuitemcheckbox'}),_0x4b91b2;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x1ff95f=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x5ce132;for(const _0x5e5840 in _0x1ff95f){const _0x3d9c37=_0x5e5840,_0x1279ab=_0x1ff95f[_0x3d9c37];if('aiLicenseKeyValid'==_0x1279ab||'aiLicenseKeyInvalid'==_0x1279ab||'aiLicenseKeyExpired'==_0x1279ab||'aiLicenseKeyDomainLimit'==_0x1279ab||'aiLicenseKeyNotAllowed'==_0x1279ab||'aiLicenseKeyEvaluationLimit'==_0x1279ab||'aiLicenseKeyTrialLimit'==_0x1279ab||'aiLicenseKeyUsageLimit'==_0x1279ab){delete _0x1ff95f[_0x3d9c37],_0x5ce132=_0x1279ab,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x5ce132&&_0x1ff95f['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x5ce132&&_0x1ff95f['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x5ce132&&_0x1ff95f['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x5ce132&&_0x1ff95f['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x5ce132&&_0x1ff95f['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x5ce132&&_0x1ff95f['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x5ce132&&_0x1ff95f['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x1e2a19='',_0x44db3a='',_0x1510ee='custom'){const _0x543f12=this['editor'],_0x5dc108=_0x543f12['editing']['view'],_0x2fb129=_0x543f12['plugins']['get'](a),_0x17b4cc=_0x543f12['plugins']['get'](_0x5d43fb);_0x2fb129['showFakeVisualSelection']();const _0x2e3130=new w(),_0x2900e2=new ClipboardEvent('copy',{'clipboardData':_0x2e3130}),_0x240215=new _0x396a44(_0x2e3130),_0x3b308a=new _0x5b2225(_0x5dc108,_0x2900e2,{'dataTransfer':_0x240215});_0x17b4cc['_forceMarkersCopy']('comment',()=>{_0x5dc108['document']['fire']('copy',_0x3b308a);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new k(_0x543f12,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x15a723=_0x240215['getData']('text/html');const _0x15fbe7=_0x543f12['model']['document']['selection'],_0x3cac54=Array['from'](_0x15fbe7['getRanges']());0x1===_0x3cac54['length']&&_0x3cac54[0x0]['isFlat']&&!_0x15fbe7['getSelectedElement']()&&''!==_0x15a723['replace'](/ /g,'')['trim']()&&(_0x15a723='<p>'+_0x15a723+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x1510ee,'query':_0x1e2a19,'htmlContent':_0x15a723,'label':_0x44db3a,'mainActionLabel':M[_0x543f12['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x1ba8b2,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x5c5b7a['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x2fb129['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x418734=new Map(),_0x480ed6=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x376bd5 of _0x480ed6)for(const _0x17f4ba of _0x376bd5['commands'])_0x418734['set'](_0x17f4ba['id'],{..._0x17f4ba,'groupId':_0x376bd5['groupId'],'groupLabel':_0x376bd5['groupLabel']||_0x376bd5['groupId']});return _0x418734;}['_createAIAssistantUIButton'](_0x330709){const _0x143b6d=this['editor'],_0x18644f=_0x143b6d['commands']['get']('showAIAssistant'),_0xb701f8=new _0x330709(_0x143b6d['locale']);return _0xb701f8['set']({'label':i(_0x143b6d['locale'],'AI\x20Assistant'),'icon':_0x1ba8b2,'isToggleable':!0x0}),_0xb701f8['bind']('isEnabled')['to'](_0x18644f),_0xb701f8['bind']('isOn')['to'](this['_dialog'],'id',_0x19f032=>'aiAssistant'===_0x19f032),this['listenTo'](_0xb701f8,'execute',()=>{_0xb701f8['isOn']?this['hideUI']():_0x18644f['execute']();}),_0xb701f8;}['_initView'](){const _0x52823b=this['editor']['plugins']['get'](a);this['_formView']=new _(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.aiAssistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x52823b['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x52823b['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0xe9f66b,ui:{ariaLiveAnnouncer:_0x2ab812}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x25e864,_0x24b512,_0x3bafa9)=>{const _0x52ae71=this['_aiAssistantController']['currentContext'];_0x3bafa9?_0x2ab812['announce'](i(_0xe9f66b,'AI\x20is\x20writing')):_0x52ae71&&_0x2ab812['announce'](i(_0xe9f66b,'Generated\x20content:\x20%0',_0x52ae71),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x118a18,_0x297602,_0x1177ae)=>{if(_0x1177ae){const _0x45d11a=this['_formView']['errorView']['text'];_0x2ab812['announce'](i(_0xe9f66b,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x45d11a));}});}['_onExecute'](_0x225062){const _0x1f3ff6=this['_commandDefinitions']['get'](_0x225062),_0x2a3b17=this['editor'],_0x27b85c=_0x2a3b17['model']['document']['selection'],_0x1a08cd=_0x2a3b17['commands']['get']('showAIAssistant'),_0x1128d6=_0x2a3b17['plugins']['get'](a),_0x8ee17a=''+(_0x1f3ff6['groupId']!==x?_0x1f3ff6['groupLabel']+':\x20':'')+_0x1f3ff6['label'];if(!0x1!==_0x1f3ff6['requiresContent']&&_0x27b85c['isCollapsed']){const _0x341a9c=_0x10427a(_0x27b85c['getSelectedBlocks']())||_0x2a3b17['model']['schema']['getLimitElement'](_0x27b85c);_0x2a3b17['model']['change'](_0x49b140=>{_0x49b140['setSelection'](_0x341a9c,'in');});}_0x1128d6['showFakeVisualSelection'](),_0x1a08cd['execute'](_0x1f3ff6['prompt'],_0x8ee17a,'command:'+_0x225062);}['_populateMenuBarMenu'](_0x5cb912,_0x1b9600,_0x1be536,_0x28dc0d){const _0x51ebd6=this['editor'],_0x26c60e=_0x51ebd6['locale'],_0x339fbc=new _0x11db6e(_0x26c60e),_0x59e310=U(_0x51ebd6,_0x1be536)['filter'](_0x5a6ed9=>_0x5a6ed9['commands']['length']);0x1===_0x59e310['length']?this['_getMenuBarGroupButtons']({'command':_0x5cb912,'commands':_0x59e310[0x0]['commands'],'parentMenuView':_0x1b9600,'onExecute':_0x28dc0d})['forEach'](_0x10b49e=>_0x339fbc['items']['add'](_0x10b49e)):_0x59e310['forEach'](({groupId:_0x34504b,groupLabel:_0x3f43be,commands:_0x4f4aff})=>{const _0x386fe5=new _0x20962f(_0x26c60e,_0x1b9600),_0x8b382a=new _0x4d2962(_0x26c60e),_0x1785c2=new _0x11db6e(_0x26c60e),_0x150567=this['_getMenuBarGroupButtons']({'command':_0x5cb912,'commands':_0x4f4aff,'parentMenuView':_0x8b382a,'onExecute':_0x28dc0d});_0x8b382a['buttonView']['set']({'label':_0x3f43be||_0x34504b}),_0x8b382a['delegate']('execute')['to'](_0x1b9600),_0x1785c2['items']['addMany'](_0x150567),_0x8b382a['panelView']['children']['add'](_0x1785c2),_0x386fe5['children']['add'](_0x8b382a),_0x339fbc['items']['add'](_0x386fe5);}),_0x1b9600['panelView']['children']['add'](_0x339fbc);}['_getMenuBarGroupButtons']({command:_0x1e7a62,commands:_0x19ee31,parentMenuView:_0x1273ee,onExecute:_0x30326b}){const _0x26e96c=this['editor'],_0x1f0065=_0x26e96c['locale'];return U(_0x26e96c,_0x19ee31)['map'](_0x2f961f=>{const _0x1cb9ed=new _0x20962f(_0x1f0065,_0x1273ee),_0x103343=new _0xb36004(_0x1f0065);return _0x103343['set']({'label':_0x2f961f['label']}),_0x103343['delegate']('execute')['to'](_0x1273ee),_0x103343['on']('execute',()=>_0x30326b(_0x2f961f['id'])),_0x103343['bind']('isEnabled')['to'](_0x1e7a62,'enabledCommandsIds',_0x3d0038=>_0x3d0038['includes'](_0x2f961f['id'])),_0x1cb9ed['children']['add'](_0x103343),_0x1cb9ed;});}}function B(_0x92b8ea,_0x22ddb5){return void 0x0!==_0x92b8ea['order']&&void 0x0===_0x22ddb5['order']?0x1:void 0x0===_0x92b8ea['order']&&void 0x0!==_0x22ddb5['order']?-0x1:void 0x0!==_0x92b8ea['order']&&void 0x0!==_0x22ddb5['order']?_0x92b8ea['order']-_0x22ddb5['order']:0x0;}function U(_0x16ab73,_0x7a0f85){_0x7a0f85['sort'](B);const _0xddd407={},_0x2090e2=[];for(const _0x503f78 of _0x7a0f85)if(void 0x0!==_0x503f78['order']){if(_0x503f78['order']in _0xddd407)throw new _0x3df4a5('ai-commands-config-order-collision',_0x16ab73,{'conflictingDefinitions':[_0x503f78,_0xddd407[_0x503f78['order']]]});_0xddd407[_0x503f78['order']]=_0x503f78,_0x2090e2['splice'](_0x503f78['order'],0x0,_0x503f78);}else _0x2090e2['push'](_0x503f78);return _0x2090e2;}class r extends _0x24be83{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x405250){super(_0x405250);const _0x20997b=_0x405250['config'],_0x212afa=_0x405250['locale'];_0x20997b['define']('ai.aiAssistant.preserveComments',!0x0),_0x20997b['define']('ai.aiAssistant.commands',function(_0x18389f){return[{'groupId':'editOrReview','groupLabel':i(_0x18389f,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x18389f,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x18389f,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':i(_0x18389f,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x18389f,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':i(_0x18389f,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x18389f,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':i(_0x18389f,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':i(_0x18389f,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x18389f,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x18389f,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x18389f,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x18389f,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x18389f,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x18389f,'Change\x20style'),'commands':[{'id':'business','label':i(_0x18389f,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x18389f,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x18389f,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x18389f,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x18389f,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x18389f,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x18389f,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x18389f,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x18389f,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x18389f,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x18389f,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x18389f,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x18389f,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}(_0x212afa)),_0x20997b['define']('ai.aiAssistant.extraCommandGroups',[]),_0x20997b['define']('ai.aiAssistant.removeCommands',[]);let _0x2060d2=o(_0x20997b['get']('ai.aiAssistant.commands'),_0x212afa);const _0x4a1462=_0x20997b['get']('ai.aiAssistant.extraCommandGroups'),_0x4af170=_0x20997b['get']('ai.aiAssistant.removeCommands');_0x4a1462['forEach'](_0x3a8e4a=>{const _0x87eda6=_0x2060d2['find'](_0x21f563=>_0x21f563['groupId']===_0x3a8e4a['groupId']);_0x87eda6?_0x87eda6['commands']=_0x87eda6['commands']['concat'](_0x3a8e4a['commands']):_0x2060d2['push'](_0x3a8e4a);}),_0x2060d2=_0x2060d2['filter'](_0x1f9f81=>!_0x4af170['includes'](_0x1f9f81['groupId'])),_0x2060d2['forEach'](_0x5810fd=>{_0x5810fd['commands']=_0x5810fd['commands']['filter'](_0x4b176b=>!_0x4af170['includes'](_0x4b176b['id']));}),_0x20997b['set']('ai.aiAssistant.commands',_0x2060d2);}}class P extends _0x24be83{['abortController'];static get['requires'](){return[E];}constructor(_0x1e5040){super(_0x1e5040),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](E)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x5763ea){return this['sendRequest'](_0x5763ea)['catch'](_0x4814c3=>{if(_0x4814c3 instanceof R)return Promise['reject'](_0x4814c3);if('AbortError'==_0x4814c3['name'])return Promise['resolve']();throw console['error'](_0x4814c3),new _0x3df4a5('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x3ba88a,_0x8e59c7){const _0x219f9e=this['editor']['locale'],_0x1a817f={'Content-Type':'application/json'};if('object'==typeof _0x3ba88a)Object['assign'](_0x1a817f,_0x3ba88a);else{if(_0x3ba88a)try{const _0x2a0df3=await _0x3ba88a(_0x8e59c7);Object['assign'](_0x1a817f,_0x2a0df3);}catch{return Promise['reject'](new R(i(_0x219f9e,'AI_ERROR_GET_HEADERS')));}}return _0x1a817f;}async['_prepareRequestParameters'](_0x3c0d57,_0x3a9579){const _0x59da7c=this['editor']['locale'];if('object'==typeof _0x3c0d57)return _0x3c0d57;try{return await _0x3c0d57(_0x3a9579);}catch{return Promise['reject'](new R(i(_0x59da7c,'AI_ERROR_GET_PARAMETERS')));}}}class O extends P{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x373d97){super(_0x373d97),_0x373d97['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x373d97['config']['get']('ai.openAI.requestParameters')||_0x373d97['config']['define']('ai.openAI.requestParameters',{'model':'gpt-3.5-turbo','max_tokens':0x7d0,'temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x373d97['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x373d97['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x373d97['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x398746,context:_0x267197,onData:_0x3cf8ea,actionId:_0x41e49a}){const _0x29bc2c=this['editor']['locale'],_0xec4d56=await this['prepareMessages'](_0x398746,_0x267197,_0x41e49a),_0x3384a8=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x41e49a),_0x37048c=await this['_prepareRequestParameters'](this['_requestParameters'],_0x41e49a),_0x59ceb9={'messages':_0xec4d56,..._0x37048c},_0x149575={'method':'POST','headers':_0x3384a8,'body':JSON['stringify'](_0x59ceb9),'signal':this['abortController']['signal']},_0x5eb761=await fetch(this['_apiUrl'],_0x149575);if(_0x5eb761['ok'])return _0x37048c['stream']?await this['_readStreamableResponse'](_0x5eb761,_0x3cf8ea):await this['_readStaticResponse'](_0x5eb761,_0x3cf8ea),Promise['resolve']();{const _0x23bc3b=await _0x5eb761['text']();return _0x23bc3b['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x29bc2c,'AI_ERROR_CONTEXT_LENGTH'))):_0x23bc3b['includes']('Moderation')?Promise['reject'](new R(i(_0x29bc2c,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x23bc3b));}}async['prepareMessages'](_0x22fd41,_0x112bf2,_0x54f688){let _0x4b274c,_0x44d0f6;return _0x112bf2?(_0x4b274c='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x44d0f6='Instruction:\x0a'+_0x22fd41+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x112bf2):(_0x4b274c='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x44d0f6=_0x22fd41),[{'role':'system','content':_0x4b274c},{'role':'user','content':_0x44d0f6}];}async['_readStreamableResponse'](_0x3ed2d6,_0x376e4b){const _0x333ee7=_0x3ed2d6['body']['getReader'](),_0x582feb=new TextDecoder();let _0x20bbd7='',_0x2c6632='',_0x20d718='',_0x12dcbc=!0x1;for(;!_0x12dcbc;){const {done:_0x19d1ef,value:_0x305deb}=await _0x333ee7['read'](),_0x5c8783=_0x20bbd7+_0x582feb['decode'](_0x305deb);let _0x2c3d12='';_0x12dcbc=_0x19d1ef;try{_0x2c3d12=this['_cleanUpData'](_0x5c8783),_0x20bbd7='';}catch{_0x20bbd7=_0x5c8783;continue;}_0x2c6632+=_0x2c3d12,!_0x12dcbc&&this['_isBufferIncomplete'](_0x2c6632)||_0x2c6632&&(_0x20d718+=_0x2c6632,_0x2c6632='',_0x376e4b(_0x20d718));}return Promise['resolve']();}async['_readStaticResponse'](_0x3760e2,_0x2411cb){return _0x2411cb((await _0x3760e2['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x3e43e7){const _0x2e6928=_0x3e43e7['split']('<')['length']!==_0x3e43e7['split']('>')['length'],_0x13773c=_0x3e43e7['length']<0x1e;return _0x2e6928&&_0x13773c;}['_cleanUpData'](_0xe758){return _0xe758['split'](/\n(?![^{]*\})/g)['map'](_0x37b96e=>_0x37b96e['replace']('data:\x20',''))['filter'](_0x5ea8b6=>_0x5ea8b6&&_0x5ea8b6['length']>0x0&&'[DONE]'!==_0x5ea8b6)['map'](_0x33bf0c=>{const {choices:_0x5ae15b}=JSON['parse'](_0x33bf0c);if(_0x5ae15b[0x0]?.['delta']?.['content'])return _0x5ae15b[0x0]['delta']['content'];})['filter'](_0x19b0eb=>_0x19b0eb)['join']('');}}class D extends P{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x1d0c12){super(_0x1d0c12),_0x1d0c12['config']['get']('ai.aws.requestParameters')||_0x1d0c12['config']['define']('ai.aws.requestParameters',{'model':'anthropic.claude-v2','max_tokens_to_sample':0x7d0,'temperature':0x1,'top_p':0x1,'top_k':0xfa,'anthropic_version':'bedrock-2023-05-31','stream':!0x0}),this['_apiUrl']=_0x1d0c12['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x1d0c12['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x1d0c12['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x1d0c12['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x289ddd,context:_0x5b3bdd,onData:_0x47c0ae,actionId:_0x12fb38}){const {model:_0x437741,stream:_0x3bedb9,..._0x213728}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x12fb38),_0xbbbd1e={'prompt':await this['preparePrompt'](_0x289ddd,_0x5b3bdd,_0x437741,_0x12fb38),..._0x213728};this['_apiUrl']?await this['_processProxyRequest'](_0xbbbd1e,_0x437741,_0x3bedb9,_0x47c0ae,_0x12fb38):await this['_processAWSRequest'](_0xbbbd1e,_0x437741,_0x3bedb9,_0x47c0ae);}async['preparePrompt'](_0x5731a6,_0x42cec8,_0x52a22f,_0x5493a7){let _0x1041ce,_0xeb358;return _0x42cec8?(_0x1041ce='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0xeb358='Instruction:\x0a'+_0x5731a6+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x42cec8):(_0x1041ce='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0xeb358=_0x5731a6),'meta.llama'==this['getModelFamily'](_0x52a22f)?'<<SYS>>\x0a'+_0x1041ce+'\x0a<</SYS>>\x0a[INST]\x0a'+_0xeb358+'\x0a[/INST]':'Human:\x0a'+_0x1041ce+'\x0a'+_0xeb358+'\x0a\x0aAssistant:';}['getModelFamily'](_0x456a1c){if(/^anthropic\.claude/['test'](_0x456a1c))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x456a1c))return'ai21.j2';if(/^cohere\.command/['test'](_0x456a1c))return'cohere.command';if(/^meta\.llama/['test'](_0x456a1c))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x456a1c));}async['_processProxyRequest'](_0x13454f,_0x2f7553,_0x3d50e6,_0x278ef5,_0xd4d0f3){const _0x1dcab0={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xd4d0f3),'body':JSON['stringify']({..._0x13454f,'model':_0x2f7553,'stream':_0x3d50e6}),'signal':this['abortController']['signal']},_0x3c9e69=await fetch(this['_apiUrl'],_0x1dcab0);_0x3d50e6?await this['_readStreamableResponse'](_0x3c9e69,_0x2f7553,_0x278ef5):await this['_readStaticResponse'](_0x3c9e69,_0x2f7553,_0x278ef5);}async['_processAWSRequest'](_0x5175dd,_0x48be9a,_0x43a395,_0x4defc7){const _0x1e3040=new _0x8eb376(this['_bedrockClientConfig']),_0x2a604b={'body':JSON['stringify'](_0x5175dd),'contentType':'application/json','accept':'application/json','modelId':_0x48be9a};let _0x288de3;if(_0x43a395){const _0x27ff1b=new _0x5002fb(_0x2a604b);_0x288de3=await _0x1e3040['send'](_0x27ff1b,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x288de3,_0x48be9a,_0x4defc7);}else{const _0x19c516=new _0x4d6306(_0x2a604b);_0x288de3=await _0x1e3040['send'](_0x19c516,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x288de3,_0x48be9a,_0x4defc7);}}async['_readAsyncIterableResponse'](_0x30153a,_0xbc4e71,_0x20af6c){const _0x38b2eb=_0x30153a['body'],_0x45b61c=new TextDecoder('utf-8');let _0x1d7677='';for await(const _0xe9a734 of _0x38b2eb)if(_0xe9a734['chunk']){const _0x588828=_0x45b61c['decode'](_0xe9a734['chunk']['bytes']),_0x9861bb=JSON['parse'](_0x588828);_0x1d7677+=this['_getGeneratedText'](_0x9861bb,_0xbc4e71),_0x20af6c(_0x1d7677);}return Promise['resolve']();}async['_readStreamableResponse'](_0x2f5d31,_0x30ba71,_0x1b2bd3){const _0x15791a=_0x2f5d31['body'],_0x56449d=new TextDecoder('utf-8'),_0x54abd8=_0x15791a['getReader']();let _0x34c670='',_0x7e37f4='',_0x584e2b=!0x1;for(;!_0x584e2b;){const {done:_0x8552a2,value:_0x3c3b5b}=await _0x54abd8['read']();if(_0x584e2b=_0x8552a2,_0x584e2b)break;const _0x181002=(_0x34c670+_0x56449d['decode'](_0x3c3b5b))['split']('\x0a')['map'](_0x10be6a=>{try{return _0x34c670='',JSON['parse'](_0x10be6a);}catch{return _0x34c670=_0x10be6a,null;}})['filter'](_0x40f120=>null!==_0x40f120);_0x181002['length']&&(_0x7e37f4+=_0x181002['map'](_0x2efe92=>this['_getGeneratedText'](_0x2efe92,_0x30ba71))['join'](''),_0x1b2bd3(_0x7e37f4));}return Promise['resolve']();}async['_readStaticResponse'](_0x283b8e,_0x406289,_0x439eab){let _0x3e3677;return _0x3e3677=_0x283b8e instanceof Response?await _0x283b8e['json']():JSON['parse'](Buffer['from'](_0x283b8e['body'])['toString']('utf8')),(_0x439eab(this['_getGeneratedText'](_0x3e3677,_0x406289)),Promise['resolve']());}['_getGeneratedText'](_0x5002b,_0x30eb32){switch(this['getModelFamily'](_0x30eb32)){case'anthropic.claude':return _0x5002b['completion'];case'ai21.j2':return _0x5002b['completions'][0x0]['data']['text'];case'cohere.command':return _0x5002b['generations'][0x0]['text'];case'meta.llama':return _0x5002b['generation'];}}}export{E as AIAdapter,r as AIAssistant,n as AIAssistantUI,R as AIRequestError,P as AITextAdapter,D as AWSTextAdapter,O as OpenAITextAdapter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ai",
|
|
3
|
-
"version": "45.2.1-alpha.
|
|
3
|
+
"version": "45.2.1-alpha.4",
|
|
4
4
|
"description": "AI Assistant feature for CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-bedrock-runtime": "3.621.0",
|
|
27
|
-
"@ckeditor/ckeditor5-clipboard": "45.2.1-alpha.
|
|
28
|
-
"@ckeditor/ckeditor5-core": "45.2.1-alpha.
|
|
29
|
-
"@ckeditor/ckeditor5-engine": "45.2.1-alpha.
|
|
30
|
-
"@ckeditor/ckeditor5-icons": "45.2.1-alpha.
|
|
31
|
-
"@ckeditor/ckeditor5-table": "45.2.1-alpha.
|
|
32
|
-
"@ckeditor/ckeditor5-ui": "45.2.1-alpha.
|
|
33
|
-
"@ckeditor/ckeditor5-utils": "45.2.1-alpha.
|
|
34
|
-
"ckeditor5": "45.2.1-alpha.
|
|
27
|
+
"@ckeditor/ckeditor5-clipboard": "45.2.1-alpha.4",
|
|
28
|
+
"@ckeditor/ckeditor5-core": "45.2.1-alpha.4",
|
|
29
|
+
"@ckeditor/ckeditor5-engine": "45.2.1-alpha.4",
|
|
30
|
+
"@ckeditor/ckeditor5-icons": "45.2.1-alpha.4",
|
|
31
|
+
"@ckeditor/ckeditor5-table": "45.2.1-alpha.4",
|
|
32
|
+
"@ckeditor/ckeditor5-ui": "45.2.1-alpha.4",
|
|
33
|
+
"@ckeditor/ckeditor5-utils": "45.2.1-alpha.4",
|
|
34
|
+
"ckeditor5": "45.2.1-alpha.4",
|
|
35
35
|
"es-toolkit": "1.32.0"
|
|
36
36
|
},
|
|
37
37
|
"type": "module",
|