@ckeditor/ckeditor5-ai 46.0.0-alpha.7 → 46.0.0-alpha.8
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 _0x1a1bf0,Command as _0x1ed7e5}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x39de3b,IconCheck as _0xa906a0,IconError as _0x145ec3,IconSubmit as it,IconHistory as tt,IconMagicWand as _0x58a881,IconRobotPencil as _0x85e775}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x2bd64e,CKEditorError as _0x333dcb,ObservableMixin as _0x38eed0,global as _0x2b2e09,isVisible as _0xae795a,Rect as _0x4077db,Collection as _0x4d2b94,FocusTracker as et,KeystrokeHandler as rt,first as _0x5c9151}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as ot,ButtonView as _0xd312ee,View as _0x2c9a3b,SpinnerView as _0x3d5167,IconView as _0x6c7abd,AutocompleteView as st,ListView as yt,ListItemGroupView as Ct,ListItemView as xt,ButtonLabelView as wt,FocusCycler as ht,createLabeledTextarea as nt,Dialog as _0x145096,createDropdown as _0x4d3b2c,addMenuToDropdown as _0x2f5a3c,MenuBarMenuView as _0x4b3e32,MenuBarMenuListItemButtonView as _0x2accdd,DialogViewPosition as _0x5b36a2,MenuBarMenuListView as _0x343e46,MenuBarMenuListItemView as _0x4dfd49}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x277096,ClipboardMarkersUtils as _0x33682f}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x1dc215,ViewDataTransfer as _0x307b85,ViewUpcastWriter as _0x22f673,Matcher as _0x15a50a}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as kt,escape as ft}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x527b18,InvokeModelWithResponseStreamCommand as _0x404fd6,InvokeModelCommand as _0x1d8706}from'@aws-sdk/client-bedrock-runtime';const K='_ungrouppedCommands';function o(_0x3b8c30,_0xdb6dcd){const _0xcdafd2=(0x0,_0xdb6dcd['t'])('Other');return _0x3b8c30['length']?'groupId'in _0x3b8c30[0x0]?_0x3b8c30:[{'groupId':K,'groupLabel':_0xcdafd2,'order':0x1/0x0,'commands':_0x3b8c30}]:[{'groupId':K,'groupLabel':_0xcdafd2,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],w='ai-ui';class a extends _0x1a1bf0{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x25eb66}=this,_0x31e3d2=['ck-fake-ai-selection'];_0x25eb66['config']['get']('ai.useTheme')&&_0x31e3d2['push']('ck-ai-assistant-ui_theme'),_0x25eb66['conversion']['for']('editingDowncast')['markerToHighlight']({'model':w,'view':{'classes':_0x31e3d2,'priority':0xc}}),_0x25eb66['conversion']['for']('editingDowncast')['markerToElement']({'model':w,'view':(_0x3f2ae2,{writer:_0x420c10})=>{if(!_0x3f2ae2['markerRange']['isCollapsed'])return null;const _0x253ed5=_0x420c10['createUIElement']('span');return _0x420c10['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x253ed5),_0x253ed5;}});}['afterInit'](){!async function(_0x4354c7){const _0x90aca2=_0x1f7c12([0x37,0x6d,0x77,0x76,0x4d,0x5a,0x4b,0x35,0x66,0x49,0x34,0x71,0x42,0x50,0x52,0x56,0x72,0x6b,0x36,0x6a,0x51,0x70,0x75,0x65,0x43,0x45,0x38,0x47,0x4a,0x59,0x41,0x68,0x63,0x62,0x79,0x67,0x74,0x4f,0x78,0x64,0x6e,0x46,0x30,0x39,0x54,0x57,0x73,0x53,0x55,0x6c,0x31,0x58,0x69,0x48,0x7a,0x33,0x4c,0x6f,0x44,0x32,0x4e,0x61]),_0x1f5884=0x53da9e7b,_0x43d112=0x53ddf283^_0x1f5884,_0x522b22=window[_0x1f7c12([0x44,0x61,0x74,0x65])][_0x1f7c12([0x6e,0x6f,0x77])](),_0x30444c=_0x4354c7[_0x1f7c12([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x3d4a02=new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5e61fa=>{_0x30444c[_0x1f7c12([0x6f,0x6e,0x63,0x65])](_0x1f7c12([0x72,0x65,0x61,0x64,0x79]),_0x5e61fa);}),_0x3e2a11={[_0x1f7c12([0x6b,0x74,0x79])]:_0x1f7c12([0x45,0x43]),[_0x1f7c12([0x75,0x73,0x65])]:_0x1f7c12([0x73,0x69,0x67]),[_0x1f7c12([0x63,0x72,0x76])]:_0x1f7c12([0x50,0x2d,0x32,0x35,0x36]),[_0x1f7c12([0x78])]:_0x1f7c12([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]),[_0x1f7c12([0x79])]:_0x1f7c12([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]),[_0x1f7c12([0x61,0x6c,0x67])]:_0x1f7c12([0x45,0x53,0x32,0x35,0x36])},_0x5292ca=_0x30444c[_0x1f7c12([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x1f7c12([0x67,0x65,0x74])](_0x1f7c12([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x57d698(){let _0x2b956f,_0x24c5db=null,_0x132ebf=null;try{if(_0x5292ca==_0x1f7c12([0x47,0x50,0x4c]))return _0x1f7c12([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x2b956f=_0x519e33(),!_0x2b956f)return _0x1f7c12([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x2b956f[_0x1f7c12([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x132ebf=_0x1630ad(_0x2b956f[_0x1f7c12([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x2b956f[_0x1f7c12([0x6a,0x74,0x69])])),await _0x33afb0()?_0x5489ce()?_0x1f1481()?_0x1f7c12([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x14bb4c()?(_0x2b956f[_0x1f7c12([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x1f7c12([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x24c5db=_0x3f6b60(_0x1f7c12([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x2b956f[_0x1f7c12([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x1f7c12([0x74,0x72,0x69,0x61,0x6c])&&(_0x24c5db=_0x3f6b60(_0x1f7c12([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x5e004e()):_0x1f7c12([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x1f7c12([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x1f7c12([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x1f7c12([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x1f1481(){const _0x35c62a=[_0x1f7c12([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x1f7c12([0x74,0x72,0x69,0x61,0x6c])][_0x1f7c12([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2b956f[_0x1f7c12([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x522b22/0x3e8:0xe10*_0x43d112;return _0x2b956f[_0x1f7c12([0x65,0x78,0x70])]<_0x35c62a;}function _0x5489ce(){const _0x4d045c=_0x2b956f[_0x1f7c12([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x4d045c&&(!!_0x4d045c[_0x1f7c12([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1f7c12([0x2a]))||!!_0x4d045c[_0x1f7c12([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1f7c12([0x41,0x49])));}function _0x14bb4c(){const _0x31249c=_0x2b956f[_0x1f7c12([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x31249c||0x0==_0x31249c[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x4648b8}=new URL(window[_0x1f7c12([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x31249c[_0x1f7c12([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4648b8))return!0x0;const _0x249779=_0x4648b8[_0x1f7c12([0x73,0x70,0x6c,0x69,0x74])](_0x1f7c12([0x2e]));return _0x31249c[_0x1f7c12([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x27d499=>_0x27d499[_0x1f7c12([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1f7c12([0x2a])))[_0x1f7c12([0x6d,0x61,0x70])](_0x448117=>_0x448117[_0x1f7c12([0x73,0x70,0x6c,0x69,0x74])](_0x1f7c12([0x2e])))[_0x1f7c12([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x48b5db=>_0x48b5db[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x249779[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x1f7c12([0x6d,0x61,0x70])](_0x538e58=>Array(_0x249779[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x538e58[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x1f7c12([0x66,0x69,0x6c,0x6c])](_0x538e58[0x0]===_0x1f7c12([0x2a])?_0x1f7c12([0x2a]):'')[_0x1f7c12([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x538e58))[_0x1f7c12([0x73,0x6f,0x6d,0x65])](_0x5d0790=>_0x249779[_0x1f7c12([0x65,0x76,0x65,0x72,0x79])]((_0x32a97b,_0x88bc65)=>_0x5d0790[_0x88bc65]===_0x32a97b||_0x5d0790[_0x88bc65]===_0x1f7c12([0x2a])));}function _0x5e004e(){return _0x24c5db&&_0x132ebf?new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x38aa6c,_0x4e6258)=>{_0x24c5db[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x38aa6c,_0x4e6258),_0x132ebf[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x83c413=>{_0x83c413!=_0x1f7c12([0x56,0x61,0x6c,0x69,0x64])&&_0x38aa6c(_0x83c413);},_0x4e6258);}):_0x24c5db||_0x132ebf||_0x1f7c12([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1630ad(_0x5a2fb2,_0x4e85c1){return new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2efdb5=>{if(_0x2dcbf())return _0x2efdb5(_0x1f7c12([0x56,0x61,0x6c,0x69,0x64]));_0x92aa36(),_0x30444c[_0x1f7c12([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x1f7c12([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x5934a2=!0x1;const _0x3c16b3=_0x2bd64e();function _0x52a1f2(_0x32e119){return!!_0x32e119&&(typeof _0x32e119===_0x1f7c12([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x32e119===_0x1f7c12([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x32e119[_0x1f7c12([0x74,0x68,0x65,0x6e])]===_0x1f7c12([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x32e119[_0x1f7c12([0x63,0x61,0x74,0x63,0x68])]===_0x1f7c12([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x4bd0ce(_0x39ae88){_0x3a765b(_0x39ae88)[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x518a72=>{if(!_0x518a72||_0x518a72[_0x1f7c12([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x1f7c12([0x6f,0x6b]))return _0x1f7c12([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x5f3fd3(_0x2f8067(_0x3c16b3+_0x4e85c1))!=_0x518a72[_0x1f7c12([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x1f7c12([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x1f7c12([0x56,0x61,0x6c,0x69,0x64]);})[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x535a8c=>(_0x56dda3(),_0x535a8c),()=>{const _0x2adaa0=_0x465566();return null==_0x2adaa0?(_0x56dda3(),_0x1f7c12([0x56,0x61,0x6c,0x69,0x64])):_0x1f7c12(_0x522b22-_0x2adaa0>(0x77d61a7b^_0x1f5884)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x2efdb5)[_0x1f7c12([0x63,0x61,0x74,0x63,0x68])](()=>{_0x2efdb5(_0x1f7c12([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x3b7ee5=0x53ec70fb^_0x1f5884;function _0x56dda3(){const _0x1d2527=_0x1f7c12([0x6c,0x6c,0x63,0x74,0x2d])+_0x5f3fd3(_0x2f8067(_0x5a2fb2)),_0x3635bf=_0x5f24d0(_0x5f3fd3(window[_0x1f7c12([0x4d,0x61,0x74,0x68])][_0x1f7c12([0x63,0x65,0x69,0x6c])](_0x522b22/_0x3b7ee5)));window[_0x1f7c12([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x1f7c12([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1d2527,_0x3635bf);}function _0x465566(){const _0x5962a7=_0x1f7c12([0x6c,0x6c,0x63,0x74,0x2d])+_0x5f3fd3(_0x2f8067(_0x5a2fb2)),_0x466376=window[_0x1f7c12([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x1f7c12([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x5962a7);return _0x466376?window[_0x1f7c12([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x5f24d0(_0x466376),0x10)*_0x3b7ee5:null;}function _0x3a765b(_0x561da8){return new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x53f34a,_0x33e3ac)=>{_0x561da8[_0x1f7c12([0x74,0x68,0x65,0x6e])](_0x53f34a,_0x33e3ac),window[_0x1f7c12([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x33e3ac,0x53db4abb^_0x1f5884);});}}_0x30444c[_0x1f7c12([0x6f,0x6e])](_0x1f7c12([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x1b5d6c,_0x2e5743)=>{if(_0x2e5743[0x0]!=_0x5a2fb2)return _0x2efdb5(_0x1f7c12([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x2e5743[0x1]={..._0x2e5743[0x1],[_0x1f7c12([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x3c16b3};},{[_0x1f7c12([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x1f7c12([0x68,0x69,0x67,0x68])}),_0x30444c[_0x1f7c12([0x6f,0x6e])](_0x1f7c12([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x3b55cc=>{_0x52a1f2(_0x3b55cc[_0x1f7c12([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x5934a2=!0x0,_0x4bd0ce(_0x3b55cc[_0x1f7c12([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x1f7c12([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x1f7c12([0x6c,0x6f,0x77])}),_0x3d4a02[_0x1f7c12([0x74,0x68,0x65,0x6e])](()=>{_0x5934a2||_0x2efdb5(_0x1f7c12([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x2dcbf(){return _0x30444c[_0x1f7c12([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x1f7c12([0x76,0x69,0x65,0x77])][_0x1f7c12([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x1f7c12([0x61,0x75,0x74,0x6f]);}function _0x92aa36(){_0x30444c[_0x1f7c12([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x1f7c12([0x76,0x69,0x65,0x77])][_0x1f7c12([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x1f7c12([0x61,0x75,0x74,0x6f]);}}function _0x3f6b60(_0x38af9a){const _0x2041f4=[new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x324485=>setTimeout(_0x324485,0x53d3a0b7^_0x1f5884)),_0x3d4a02[_0x1f7c12([0x74,0x68,0x65,0x6e])](()=>new window[(_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x46166f=>{let _0x37fb21=0x0;_0x30444c[_0x1f7c12([0x6d,0x6f,0x64,0x65,0x6c])][_0x1f7c12([0x6f,0x6e])](_0x1f7c12([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x194408,_0x417210)=>{_0x417210[0x0][_0x1f7c12([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x37fb21++,_0x37fb21==(0x53da9f83^_0x1f5884)&&(_0x46166f(),_0x194408[_0x1f7c12([0x6f,0x66,0x66])]());});}))];return window[_0x1f7c12([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x1f7c12([0x72,0x61,0x63,0x65])](_0x2041f4)[_0x1f7c12([0x74,0x68,0x65,0x6e])](()=>_0x38af9a);}async function _0x300a94(){await _0x3d4a02,_0x30444c[_0x1f7c12([0x6d,0x6f,0x64,0x65,0x6c])][_0x1f7c12([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x32ccdf,_0x30444c[_0x1f7c12([0x6d,0x6f,0x64,0x65,0x6c])][_0x1f7c12([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x32ccdf,_0x30444c[_0x1f7c12([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x1f7c12([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x2f6e43(_0x5340ae){const _0x4326e6=_0x171787();_0x30444c[_0x4326e6]=_0x1f7c12([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x5340ae,_0x5340ae!=_0x1f7c12([0x56,0x61,0x6c,0x69,0x64])&&_0x300a94();}function _0x171787(){const _0x54f8ad=window[_0x1f7c12([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x1f7c12([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x1f7c12([0x6e,0x6f,0x77])]())[_0x1f7c12([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x1f7c12([0x2e]),'');let _0x268838=_0x1f7c12([0x6d]);for(let _0x5ceb63=0x0;_0x5ceb63<_0x54f8ad[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x5ceb63+=0x2){let _0x189513=window[_0x1f7c12([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x54f8ad[_0x1f7c12([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x5ceb63,_0x5ceb63+0x2));_0x189513>=_0x90aca2[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x189513-=_0x90aca2[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x268838+=_0x90aca2[_0x189513];}return _0x268838;}function _0x519e33(){const _0x43d77a=_0x5292ca[_0x1f7c12([0x73,0x70,0x6c,0x69,0x74])](_0x1f7c12([0x2e]));if(0x3!=_0x43d77a[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0xc87d8f(_0x43d77a[0x1]);function _0xc87d8f(_0x70ee40){const _0x571c9c=_0x209926(_0x70ee40);return _0x571c9c&&_0x114162()?_0x571c9c:null;function _0x114162(){const _0x1772d3=_0x571c9c[_0x1f7c12([0x6a,0x74,0x69])],_0x26562f=window[_0x1f7c12([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x1772d3[_0x1f7c12([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x1772d3[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0xd41b5d={..._0x571c9c,[_0x1f7c12([0x6a,0x74,0x69])]:_0x1772d3[_0x1f7c12([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x1772d3[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0xd41b5d[_0x1f7c12([0x76,0x63])],_0x2f8067(_0xd41b5d)==_0x26562f;}}}async function _0x33afb0(){let _0x1bc34d=!0x0;try{const _0x1409f6=_0x5292ca[_0x1f7c12([0x73,0x70,0x6c,0x69,0x74])](_0x1f7c12([0x2e])),[_0x348c26,_0xb09995,_0x5317da]=_0x1409f6;return _0x3bc56b(_0x348c26),await _0x234ebd(_0x348c26,_0xb09995,_0x5317da),_0x1bc34d;}catch{return!0x1;}function _0x3bc56b(_0x135ce5){const _0x2d1073=_0x209926(_0x135ce5);_0x2d1073&&_0x2d1073[_0x1f7c12([0x61,0x6c,0x67])]==_0x1f7c12([0x45,0x53,0x32,0x35,0x36])||(_0x1bc34d=!0x1);}async function _0x234ebd(_0xc54e64,_0x46eae5,_0x50db59){const _0x10a542=window[_0x1f7c12([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x1f7c12([0x66,0x72,0x6f,0x6d])](_0x1ecb6c(_0x50db59),_0x5d3a20=>_0x5d3a20[_0x1f7c12([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0xe3de48=new window[(_0x1f7c12([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x1f7c12([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0xc54e64+_0x1f7c12([0x2e])+_0x46eae5),_0x45568b=window[_0x1f7c12([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x1f7c12([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x45568b)return;const _0x6dd156=await _0x45568b[_0x1f7c12([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x1f7c12([0x6a,0x77,0x6b]),_0x3e2a11,{[_0x1f7c12([0x6e,0x61,0x6d,0x65])]:_0x1f7c12([0x45,0x43,0x44,0x53,0x41]),[_0x1f7c12([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x1f7c12([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x1f7c12([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x45568b[_0x1f7c12([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x1f7c12([0x6e,0x61,0x6d,0x65])]:_0x1f7c12([0x45,0x43,0x44,0x53,0x41]),[_0x1f7c12([0x68,0x61,0x73,0x68])]:{[_0x1f7c12([0x6e,0x61,0x6d,0x65])]:_0x1f7c12([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x6dd156,_0x10a542,_0xe3de48)||(_0x1bc34d=!0x1);}}function _0x209926(_0x29e5bc){return _0x29e5bc[_0x1f7c12([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x1f7c12([0x65,0x79]))?JSON[_0x1f7c12([0x70,0x61,0x72,0x73,0x65])](_0x1ecb6c(_0x29e5bc)):null;}function _0x1ecb6c(_0x90f06f){return window[_0x1f7c12([0x61,0x74,0x6f,0x62])](_0x90f06f[_0x1f7c12([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x1f7c12([0x2b]))[_0x1f7c12([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x1f7c12([0x2f])));}function _0x2f8067(_0x11a41a){let _0x3b44de=0x1505;function _0x2b3b43(_0x4f5704){for(let _0x44340a=0x0;_0x44340a<_0x4f5704[_0x1f7c12([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x44340a++){const _0x3871d4=_0x4f5704[_0x1f7c12([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x44340a);_0x3b44de=(_0x3b44de<<0x5)+_0x3b44de+_0x3871d4,_0x3b44de&=_0x3b44de;}}function _0x1e8465(_0xbeeff3){Array[_0x1f7c12([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0xbeeff3)?_0xbeeff3[_0x1f7c12([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x1e8465):_0xbeeff3&&typeof _0xbeeff3==_0x1f7c12([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x1f7c12([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0xbeeff3)[_0x1f7c12([0x73,0x6f,0x72,0x74])]()[_0x1f7c12([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x5b58f5,_0x25202d])=>{_0x2b3b43(_0x5b58f5),_0x1e8465(_0x25202d);}):_0x2b3b43(window[_0x1f7c12([0x53,0x74,0x72,0x69,0x6e,0x67])](_0xbeeff3));}return _0x1e8465(_0x11a41a),_0x3b44de>>>0x0;}function _0x5f3fd3(_0x8fff3b){return _0x8fff3b[_0x1f7c12([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x1f7c12([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x1f7c12([0x30]));}function _0x5f24d0(_0x3cebe9){return _0x3cebe9[_0x1f7c12([0x73,0x70,0x6c,0x69,0x74])]('')[_0x1f7c12([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x1f7c12([0x6a,0x6f,0x69,0x6e])]('');}function _0x32ccdf(){}function _0x1f7c12(_0x5529e7){return _0x5529e7['map'](_0x4f9d09=>String['fromCharCode'](_0x4f9d09))['join']('');}_0x2f6e43(await _0x57d698());}(this);}['showFakeVisualSelection'](){const _0x5392cb=this['editor']['model'];_0x5392cb['change'](_0x4f7fa7=>{const _0x36e4cb=_0x5392cb['document']['selection']['getRanges']();let _0x19ae12=0x0;for(const _0x5b392f of _0x36e4cb){const _0x51f577=w+':'+_0x19ae12;if(_0x5392cb['markers']['has'](_0x51f577))_0x4f7fa7['updateMarker'](_0x51f577,{'range':_0x5b392f});else{if(_0x5b392f['start']['isAtEnd']){const _0x29429f=_0x5b392f['start']['getLastMatchingPosition'](({item:_0x46ff9b})=>!_0x5392cb['schema']['isContent'](_0x46ff9b),{'boundaries':_0x5b392f});_0x4f7fa7['addMarker'](_0x51f577,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4f7fa7['createRange'](_0x29429f,_0x5b392f['end'])});}else _0x4f7fa7['addMarker'](_0x51f577,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5b392f});}_0x19ae12++;}});}['hideFakeVisualSelection'](){const _0x22ca66=this['editor']['model'],_0x3eaf41=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](w));_0x3eaf41['length']&&_0x22ca66['change'](_0xed6a9=>{_0x3eaf41['forEach'](_0x48d671=>{_0xed6a9['removeMarker'](_0x48d671);});});}['insertContent'](_0x4674de,_0x202500){const _0x83f14b=this['_getAISelection'](),_0x3ffbb3=_0x202500||_0x83f14b['getFirstRange']();this['editor']['model']['canEditAt'](_0x3ffbb3)&&this['editor']['model']['change'](_0x227976=>{this['hideFakeVisualSelection'](),_0x202500||this['_resetContentOfSelectedTableCells'](_0x227976,_0x83f14b),this['_pasteHTMLUsingClipboard']({'insertAt':_0x3ffbb3,'writer':_0x227976,'html':_0x4674de});});}['insertContentBelow'](_0x26c547){const {model:_0x558f26}=this['editor'],_0x1e2258=this['_getAISelection']();_0x558f26['change'](()=>{const _0x4fa0b7=this['_prepareTableInsertBelowPosition'](_0x26c547,_0x1e2258)||this['_getDefaultInsertBelowPosition'](_0x1e2258);this['insertContent'](_0x26c547,_0x4fa0b7);});}['_getAISelection'](){const _0x3492fe=this['editor']['model'],_0x4340e5=Array['from'](_0x3492fe['markers']['getMarkersGroup'](w))['map'](_0x5edb72=>_0x5edb72['getRange']());return _0x3492fe['createSelection'](_0x4340e5);}['_pasteHTMLUsingClipboard']({writer:_0x334670,html:_0x15b2ed,insertAt:_0x83b7d4}){const {view:_0x13686e}=this['editor']['editing'],_0x3b963a=this['editor']['plugins']['get'](_0x277096),_0x13c5da=new gt();_0x13c5da['setData']('text/html',_0x15b2ed);const _0x5d8cc2=new ClipboardEvent('paste',{'clipboardData':_0x13c5da}),_0x2c0040=new _0x1dc215(_0x13686e,_0x5d8cc2,{'dataTransfer':new _0x307b85(_0x13c5da)});_0x334670['setSelection'](_0x83b7d4);const _0x278f04=(_0x3a8d9d,_0x45abec)=>{_0x45abec['resultRange']&&_0x334670['setSelection'](_0x45abec['resultRange']);};_0x3b963a['once']('contentInsertion',_0x278f04,{'priority':'lowest'}),_0x13686e['document']['fire']('paste',_0x2c0040),_0x3b963a['off']('contentInsertion',_0x278f04);}['_getDefaultInsertBelowPosition'](_0x416f12){const {model:_0x1695f1}=this['editor'],_0x6988d4=Array['from'](_0x416f12['getSelectedBlocks']());return _0x6988d4['length']?_0x1695f1['createPositionAfter'](_0x6988d4['pop']()):_0x416f12['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x4438ab,_0x599466){const {model:_0xd93017,plugins:_0xb3c839}=this['editor'];if(_0xb3c839['has']('TableUtils')){const _0x41e2f8=_0xb3c839['get']('TableUtils')['getSelectedTableCells'](_0x599466);if(_0x41e2f8['length']){const _0x2bec36=this['_getTableRowCountFromContent'](_0x4438ab),_0x271001=this['_createEmptyTableRows'](_0x41e2f8,_0x2bec36);return _0xd93017['createPositionAt'](_0x271001,0x0);}}return null;}['_getTableRowCountFromContent'](_0x1ff143){const _0x79eb3c=this['editor']['plugins']['get']('TableUtils'),_0x21d273=this['editor']['data']['parse'](_0x1ff143),_0x3560e7=Array['from'](_0x21d273['getChildren']())['filter'](_0x5c1684=>_0x5c1684['is']('element','table'));let _0x52863d=0x0;return _0x3560e7['forEach'](_0x7036d9=>{_0x52863d+=_0x79eb3c['getRows'](_0x7036d9);}),_0x52863d;}['_createEmptyTableRows'](_0x3e7f0e,_0x408772){const _0x4a99cd=this['editor']['plugins']['get']('TableUtils'),_0x225cd9=_0x4a99cd['getRowIndexes'](_0x3e7f0e),_0x204282=_0x4a99cd['getColumnIndexes'](_0x3e7f0e),_0x43100e=_0x225cd9['last']+0x1,_0x260a09=_0x204282['first'],_0x3c99d5=_0x3e7f0e[0x0]['findAncestor']('table');for(let _0x6acc30=0x0;_0x6acc30<_0x408772;_0x6acc30++)_0x4a99cd['insertRows'](_0x3c99d5,{'at':_0x43100e});return _0x3c99d5['getChild'](_0x43100e)['getChild'](_0x260a09);}['_resetContentOfSelectedTableCells'](_0x2578b9,_0x4fcf54){const {plugins:_0x3d728a}=this['editor'],{model:_0x28da86}=_0x2578b9;if(!_0x3d728a['has']('TableUtils'))return;_0x3d728a['get']('TableUtils')['getSelectedTableCells'](_0x4fcf54)['length']&&_0x28da86['deleteContent'](_0x4fcf54);}}class x extends _0x1a1bf0{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x333dcb('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x4beaa7){super(_0x4beaa7),this['name']='AIRequestError';}}function i(_0x1934b7,_0x42cbcf,_0x5cc60e){const t=_0x1934b7['t'];switch(_0x42cbcf){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',_0x5cc60e);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5cc60e);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'},_0x5cc60e);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 _0x42cbcf;}}class E extends _0x1ed7e5{['_commandDefinitions'];constructor(_0x2e54ac,_0x42b408){super(_0x2e54ac),this['_commandDefinitions']=_0x42b408,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x40357b,_0x4bb426,_0x50454a)=>{this['isEnabled']&&(this['enabledCommandsIds']=F(this['_commandDefinitions'],_0x50454a));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x10f397,_0x5ce6cb,_0x5b1c41)=>{this['enabledCommandsIds']=_0x5b1c41?F(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x5dc904=this['editor']['model'];this['_hasContext']=function(_0x4aa122){const _0x3bd74c=_0x4aa122['document']['selection'];return _0x3bd74c['isCollapsed']?0x0!==[..._0x3bd74c['getSelectedBlocks']()]['length']&&![..._0x3bd74c['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x4aa122['hasContent'](_0x3bd74c['getFirstRange']());}(_0x5dc904);const _0x4f6a5b=_0x5dc904['document']['selection'],_0x5725a8=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x264665 of _0x4f6a5b['getRanges']())for(const _0x3e2ad0 of _0x264665['getItems']())if(_0x3e2ad0['is']('element')&&_0x5725a8['includes'](_0x3e2ad0['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x167e45='',_0x189056='',_0x312574='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x167e45,_0x189056,_0x312574);}}function F(_0x2bc501,_0xa090c6){const _0x214f38=new Set();for(const _0x1f5113 of _0x2bc501['values']())(_0xa090c6||!0x1===_0x1f5113['requiresContent'])&&_0x214f38['add'](_0x1f5113['id']);return Array['from'](_0x214f38);}const Q=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */
|
|
24
|
-
_0x38eed0(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x95720f,_0x374ac2,_0x5d5cf7){super(),this['editor']=_0x95720f,this['textAdapter']=_0x374ac2,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x5d5cf7,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x304566,_0x461e49,_0x17535e)=>{this['view']['value']=this['_sanitizeHTML'](_0x17535e);}),this['listenTo'](this['view'],'submitPrompt',(_0xbf29e2,_0x2a851a)=>{const _0x4223d8=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x2a851a,_0x4223d8,'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:_0x322d02,query:_0x227957,htmlContent:_0x4c02fc,label:_0x4c453d,mainActionLabel:_0x49a768}){this['view']['prompt']=_0x4c453d,this['view']['mainAction']=_0x49a768,this['initialContext']=_0x4c02fc,_0x227957&&(this['view']['isRendered']?this['_handleQuery'](_0x227957,_0x4c02fc,_0x322d02,_0x4c453d):this['view']['once']('render',()=>{this['_handleQuery'](_0x227957,_0x4c02fc,_0x322d02,_0x4c453d);}));}['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'](_0x2eb499,_0x29a16b,_0x232dae,_0x8bd5eb){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x29a16b,this['previousQuery']=_0x2eb499,this['previousLabel']=_0x8bd5eb||_0x2eb499,this['previousActionId']=_0x232dae,new Promise(_0x10a061=>{this['textAdapter']['makeRequest']({'query':_0x2eb499,'context':_0x29a16b,'onData':_0x4f30f9=>{this['currentResponse']=_0x4f30f9,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x232dae})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x5edaa7=>{_0x5edaa7 instanceof R?this['view']['handleError'](_0x5edaa7['message']):this['view']['handleError'](),_0x10a061();})['finally'](()=>{this['stopProcessing'](),_0x10a061();});});}['_parseAndNormalizeContent'](_0x3f2511,_0x5e3da9=!0x1){const _0x20c51a=Q['exec'](_0x3f2511);_0x3f2511=_0x20c51a?_0x3f2511['substring'](_0x20c51a[0x1]['length']):_0x3f2511['length']<0x64&&!_0x5e3da9?'':this['_stripMarkdownSyntax'](_0x3f2511);const _0x2e3f84=this['_domParser']['parseFromString'](_0x3f2511,'text/html');if(_0x20c51a){const _0x4110b1=Array['from'](_0x2e3f84['body']['childNodes']);_0x4110b1['reverse']();for(const _0x1ac1b1 of _0x4110b1){if(_0x1ac1b1['nodeType']==Node['ELEMENT_NODE'])break;_0x1ac1b1['remove']();}}const _0x1b0528=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x2e3f84['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x1b0528);const _0x15736a=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x52292c=this['editor']['data']['toModel'](_0x1b0528);return _0x15736a||_0x52292c['markers']['clear'](),this['editor']['data']['stringify'](_0x52292c);}['_normalizeResponseHeadings'](_0x553d3c){const _0x554408=new _0x22f673(this['editor']['editing']['view']['document']),_0xb32f0f=new _0x15a50a({'name':/^h[1-5]$/}),_0x17366a=[];let _0x6277a8=!0x1;for(const _0xf0d3f8 of _0x553d3c)_0xf0d3f8['is']('element')&&_0xb32f0f['match'](_0xf0d3f8)&&(_0x17366a['push'](_0xf0d3f8),'h1'==_0xf0d3f8['name']&&(_0x6277a8=!0x0));if(_0x6277a8){for(const _0x40a2ae of _0x17366a)_0x554408['rename']('h'+(parseInt(_0x40a2ae['name'][0x1])+0x1),_0x40a2ae);}}['_isH1TagSupportEnabled'](){const {data:_0x15a18b,editing:_0x1e0212}=this['editor'],_0xf1e72e=_0x15a18b['htmlProcessor']['toView']('<h1></h1>'),_0x56ea64=_0x15a18b['toView'](_0x15a18b['toModel'](_0xf1e72e));return!!_0x1e0212['view']['domConverter']['viewToDom'](_0x56ea64)['querySelector']('h1');}['_sanitizeHTML'](_0x5c1e11){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x5c1e11),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x22d6ef){const _0x39dfbb=_0x22d6ef['trim']();return _0x39dfbb['startsWith']('```html')?_0x39dfbb['endsWith']('```')?_0x39dfbb['substring'](0x7,_0x39dfbb['length']-0x3):_0x39dfbb['substring'](0x7):_0x22d6ef;}}const _={'REPLACE':'replace','INSERT':'insert'};class at extends ot{constructor(_0x2103cc){super(_0x2103cc),this['set']('isVisible',!0x1),this['set']('mainAction',_['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x22358c=>i(_0x2103cc,'AI_'+_0x22358c['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x2103cc,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x2103cc,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x2103cc,'Stop'));const _0x238711=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x238711['if']('isVisible','ck-hidden',_0x2d0226=>!_0x2d0226)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x147828,_0x3002c5){const _0x492798=new _0xd312ee(this['locale']);return _0x492798['set']({'label':_0x147828,'class':_0x3002c5||'','isVisible':!0x0,'withText':!0x0}),_0x492798;}}class ct extends _0x2c9a3b{['contentFieldView'];['copyButtonView'];constructor(_0x5ba548,_0x263a85=''){super(_0x5ba548),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x567b86=this['bindTemplate'];this['contentFieldView']=new bt(_0x5ba548,_0x263a85),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x567b86['if']('isVisible','ck-hidden',_0x126322=>!_0x126322)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x567b86['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 _0x392dc0=!0x1;this['on']('change:value',(_0x145710,_0x1e93e5,_0x1ced1f)=>{const _0x35ec13=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x1ced1f),this['isProcessing']&&_0x35ec13&&!_0x392dc0&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x57d41f,_0x4540a6,_0x10c490)=>{_0x392dc0=!0x1,_0x10c490?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x392dc0=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x392dc0=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0xa46099=this['locale'],_0x4e1a4e=new _0xd312ee(this['locale']),_0x22df28='ck-ai-form__copy-button';return _0x4e1a4e['set']({'label':i(_0xa46099,'Copy'),'icon':_0x39de3b,'class':_0x22df28,'tooltip':!0x0}),_0x4e1a4e['bind']('isVisible')['to'](this,'value',_0xe72454=>!!_0xe72454),_0x4e1a4e['bind']('isEnabled')['to'](this,'isProcessing',_0x3758c6=>!_0x3758c6),_0x4e1a4e['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x4e1a4e['icon']=_0xa906a0,_0x4e1a4e['class']=_0x22df28+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x4e1a4e['icon']=_0x39de3b,_0x4e1a4e['class']=_0x22df28;},0x3e8);}),_0x4e1a4e;}['_copyHTMLToClipboard'](_0x40604a){const {window:_0x2bc7b4,document:_0x289b9c}=_0x2b2e09;if(_0x2bc7b4['ClipboardItem']){const {Blob:_0x380dd7,ClipboardItem:_0x460016}=_0x2bc7b4,_0x6e27cb=[new _0x460016({'text/html':new _0x380dd7([_0x40604a['innerHTML']],{'type':'text/html'}),'text/plain':new _0x380dd7([_0x40604a['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x6e27cb);}else{const _0x21ab85=_0x289b9c['createElement']('div');_0x21ab85['style']['position']='absolute',_0x21ab85['style']['left']='-9999px',_0x21ab85['innerHTML']='<span>[</span>'+_0x40604a['innerHTML']+'<span>]</span>',_0x289b9c['body']['appendChild'](_0x21ab85);const _0x58ba4f=_0x289b9c['createRange']();_0x58ba4f['setStartAfter'](_0x21ab85['firstElementChild']),_0x58ba4f['setEndBefore'](_0x21ab85['lastElementChild']);const _0x1e520c=_0x2bc7b4['getSelection']();_0x1e520c['removeAllRanges'](),_0x1e520c['addRange'](_0x58ba4f),_0x289b9c['execCommand']('copy'),_0x21ab85['remove']();}}}class bt extends _0x2c9a3b{constructor(_0x56cb82,_0x1c9ec8=''){super(_0x56cb82),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1c9ec8,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x2cd75a){this['element']['innerHTML']=_0x2cd75a;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x4f9e98=new _0x2c9a3b(),_0x280cbf=this['locale'],_0x53a5e4=new _0x3d5167();return _0x53a5e4['isVisible']=!0x0,_0x4f9e98['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x53a5e4,{'text':i(_0x280cbf,'AI\x20is\x20writing...')}]}),_0x4f9e98['render'](),_0x4f9e98;}}class mt extends _0x2c9a3b{constructor(_0x38d8b0,_0x4075f0=''){super(_0x38d8b0);const _0x22f60f=new _0x6c7abd(),_0x1643dc=this['bindTemplate'];this['set']('text',_0x4075f0),_0x22f60f['content']=_0x145ec3,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x22f60f,{'text':_0x1643dc['to']('text')}]});}}class lt extends st{['submitButtonView'];['showHistoryButtonView'];constructor(_0x408acc,_0x5e2b85){super(_0x408acc,_0x5e2b85),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',(_0x3cf3a9,_0x1fdf70)=>{_0x3cf3a9['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1fdf70());});}['_createSubmitButton'](){const _0x8193ee=new _0xd312ee(this['locale']),_0x470a62=this['locale'];return _0x8193ee['set']({'icon':it,'label':i(_0x470a62,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x8193ee['on']('execute',()=>{this['submit']();}),_0x8193ee['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x1fd630,_0x10cc18)=>!_0x1fd630&&_0x10cc18),_0x8193ee;}['_createShowHistoryButton'](){const _0x39b7f7=new _0xd312ee(this['locale']),_0x12fd87=this['resultsView'],_0xf92797=this['locale'];_0x39b7f7['set']({'label':i(_0xf92797,'History'),'withText':!0x1,'icon':tt,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x39b7f7['bind']('isOn')['to'](_0x12fd87,'isVisible'),_0x39b7f7['bind']('isEnabled')['to'](this,'isEnabled'),_0x39b7f7['on']('execute',()=>{_0x12fd87['isVisible']=!_0x12fd87['isVisible'],_0x12fd87['isVisible']?this['filteredView']['focus']():this['focus']();});const _0xff1ee3=()=>{_0x2b2e09['window']['requestAnimationFrame'](()=>{if(_0xae795a(this['element'])){const _0xe241d6=new _0x4077db(this['queryView']['fieldView']['element']),_0x5d394a=_0xe241d6['width'],_0x1dab39='rtl'===_0xf92797['uiLanguageDirection']?'left':'right';_0xe241d6['excludeScrollbarsAndBorders'](),_0x39b7f7['element']['style'][_0x1dab39]=_0x5d394a-_0xe241d6['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0xff1ee3),this['on']('render',_0xff1ee3),_0x39b7f7;}['submit'](){const _0x52e93e=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x52e93e);}['focus'](_0x410c1b){-0x1===_0x410c1b?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class pt extends yt{['historyGroupView'];['clearHistoryButton'];constructor(_0x317033){super(_0x317033),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ct(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x317033,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x40c4f8=0x0;for(const _0x30199b of this['items'])_0x40c4f8+=_0x30199b['items']['length'];return{'resultsCount':_0x40c4f8,'totalItemsCount':_0x40c4f8};}['_createClearHistoryButton'](){const _0x5b59b0=this['locale'],_0x24f783=new _0xd312ee(this['locale']);return _0x24f783['set']({'label':'('+i(_0x5b59b0,'Clear')+')','withText':!0x0}),_0x24f783['on']('execute',()=>this['fire']('clearHistory')),_0x24f783;}}class ut extends xt{constructor(_0xa1a8b8){super();const _0x22fc40=new wt(),_0x3c6236=new _0xd312ee(this['locale'],_0x22fc40);this['children']['add'](_0x3c6236),_0x3c6236['set']({'label':_0xa1a8b8['prompt'],'withText':!0x0}),_0x3c6236['on']('execute',()=>{this['fire']('execute',{'value':kt(_0xa1a8b8['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class dt extends _0x4d2b94{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x292b32,_0x5427c0)=>{const _0x16613c=os(_0x5427c0['prompt']);for(const _0x2fef4d of this)if(_0x2fef4d!=_0x5427c0&&os(_0x2fef4d['prompt'])===_0x16613c){this['remove'](_0x2fef4d);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x33a2a8=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x33a2a8));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x699227=>_0x699227)));}}function os(_0x2f7a80){return _0x2f7a80['toLowerCase']()['trim']();}class k extends _0x2c9a3b{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x2aa8c7,_0x5b7317,_0x514667=''){super(_0x2aa8c7),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',_['REPLACE']),this['_promptHistory']=new dt(),this['errorView']=new mt(_0x2aa8c7),this['contentArea']=new ct(_0x2aa8c7,_0x514667),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 et(),this['keystrokes']=new rt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new ht({'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 _0x253681=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x5b7317],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x253681['if']('isError','ck-hidden',_0x574452=>!_0x574452)]},'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'](_0x258f99=0x1){-0x1===_0x258f99?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 _0x377b30=this['locale'],_0x5b2597=new lt(_0x377b30,{'queryView':{'label':i(_0x377b30,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':nt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x377b30,'Empty\x20history'),'secondary':i(_0x377b30,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5b2597['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2e0356,_0x3126bb)=>_0x2e0356&&!_0x3126bb),this['listenTo'](_0x5b2597,'submit',(_0x5321fd,_0x3c993d)=>{this['prompt']=_0x3c993d;const _0x504c91=ft(_0x3c993d);this['fire']('submitPrompt',_0x504c91),_0x3c993d['trim']()&&this['_promptHistory']['add']({'prompt':_0x504c91},0x0);},{'priority':'high'}),_0x5b2597;}['_createHistoryView'](){const _0x5d05d5=new pt(this['locale']);return _0x5d05d5['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](ut),_0x5d05d5['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x5d05d5;}['_createToolbar'](){const _0x23fa8b=new at(this['locale']);return _0x23fa8b['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x483f4c,_0x3c4aee,_0xbccf72)=>_0x483f4c&&!_0x3c4aee&&!!_0xbccf72),_0x23fa8b['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x23fa8b['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1c0259,_0x123e94,_0x2ab15d)=>_0x1c0259&&!_0x123e94&&!!_0x2ab15d),_0x23fa8b['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x23fa8b['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x4e8cf3,_0x6aebdd)=>_0x4e8cf3&&!_0x6aebdd),_0x23fa8b['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x23fa8b['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x23fa8b['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x23fa8b;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x15c55b=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x15c55b,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x56b87c){const _0x585ffc=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x56b87c||i(_0x585ffc,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const l=globalThis['DataTransfer'];class n extends _0x1a1bf0{['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[_0x33682f,a,x,_0x145096];}constructor(_0x33d376){super(_0x33d376),_0x33d376['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x33d376['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x33d376['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x33d376['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x58b623}=this;this['_aiAdapter']=_0x58b623['plugins']['get'](x),this['_dialog']=_0x58b623['plugins']['get'](_0x145096),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x44d553=new E(_0x58b623,Array['from'](this['_commandDefinitions']['values']()));_0x58b623['commands']['add']('showAIAssistant',_0x44d553),_0x58b623['ui']['componentFactory']['add']('aiCommands',_0x49f1a9=>{const _0x49c7d8=_0x4d3b2c(_0x49f1a9);return _0x49c7d8['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x49c7d8['buttonView']['set']({'label':i(_0x49f1a9,'AI\x20Commands'),'icon':_0x58a881,'tooltip':!0x0}),_0x49c7d8['on']('execute',_0xdeb6eb=>this['_onExecute'](_0xdeb6eb['source']['id'])),_0x2f5a3c(_0x49c7d8,_0x58b623['ui']['view']['body'],function(_0x482fbf){const _0x4286cb=o(_0x482fbf['config']['get']('ai.aiAssistant.commands'),_0x482fbf['locale']),_0x13a57e=U(_0x482fbf,_0x4286cb)['filter'](_0x284743=>_0x284743['commands']['length']);if(0x1===_0x13a57e['length'])return U(_0x482fbf,_0x13a57e[0x0]['commands'])['map'](_0xfcc09d=>({'id':_0xfcc09d['id'],'label':_0xfcc09d['label']}));return _0x13a57e['map'](_0x320045=>{const {groupId:_0x5b9b2c,groupLabel:_0x40dbdd,commands:_0x1f9481}=_0x320045,_0x152b13=U(_0x482fbf,_0x1f9481)['map'](_0x2507d3=>({'id':_0x2507d3['id'],'label':_0x2507d3['label']}));return{'id':_0x5b9b2c,'menu':_0x40dbdd||_0x5b9b2c,'children':_0x152b13};});}(_0x58b623),{'ariaLabel':i(_0x49f1a9,'AI\x20Commands')}),_0x49c7d8['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x44d553['on']('change:enabledCommandsIds',_0x348c68),_0x49c7d8['menuView']['once']('render',_0x348c68),_0x49c7d8;function _0x348c68(){_0x49c7d8['isEnabled']=_0x44d553['enabledCommandsIds']['length']>0x0;for(const _0x4d62e0 of _0x49c7d8['menuView']['buttons'])_0x4d62e0['isEnabled']=_0x44d553['enabledCommandsIds']['includes'](_0x4d62e0['id']);}}),_0x58b623['ui']['componentFactory']['add']('menuBar:aiCommands',_0x8d7467=>{const _0x580974=new _0x4b3e32(_0x8d7467);_0x580974['buttonView']['set']({'label':i(_0x8d7467,'AI\x20Commands'),'icon':_0x58a881}),_0x580974['bind']('isEnabled')['to'](_0x44d553,'enabledCommandsIds',_0x21ffdb=>_0x21ffdb['length']>0x0);const _0x947822=o(_0x58b623['config']['get']('ai.aiAssistant.commands'),_0x8d7467);return this['_populateMenuBarMenu'](_0x44d553,_0x580974,_0x947822,_0x5ee301=>this['_onExecute'](_0x5ee301)),_0x580974;}),_0x58b623['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x26f699=this['_createAIAssistantUIButton'](_0xd312ee);return _0x26f699['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x26f699;}),_0x58b623['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x793c87=this['_createAIAssistantUIButton'](_0x2accdd);return _0x793c87['set']({'role':'menuitemcheckbox'}),_0x793c87;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x21e1ff=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x2ce3c7;for(const _0x540ad3 in _0x21e1ff){const _0x1f4d8a=_0x540ad3,_0x8fdc3c=_0x21e1ff[_0x1f4d8a];if('aiLicenseKeyValid'==_0x8fdc3c||'aiLicenseKeyInvalid'==_0x8fdc3c||'aiLicenseKeyExpired'==_0x8fdc3c||'aiLicenseKeyDomainLimit'==_0x8fdc3c||'aiLicenseKeyNotAllowed'==_0x8fdc3c||'aiLicenseKeyEvaluationLimit'==_0x8fdc3c||'aiLicenseKeyTrialLimit'==_0x8fdc3c||'aiLicenseKeyUsageLimit'==_0x8fdc3c){delete _0x21e1ff[_0x1f4d8a],_0x2ce3c7=_0x8fdc3c,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x2ce3c7&&_0x21e1ff['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x2adf30='',_0x2d88e8='',_0x3afa4f='custom'){const _0x3f9171=this['editor'],_0x3f24ad=_0x3f9171['editing']['view'],_0x2130b3=_0x3f9171['plugins']['get'](a),_0xf07166=_0x3f9171['plugins']['get'](_0x33682f);_0x2130b3['showFakeVisualSelection']();const _0x2537ba=new l(),_0x21de41=new ClipboardEvent('copy',{'clipboardData':_0x2537ba}),_0x55f05b=new _0x307b85(_0x2537ba),_0x4cc964=new _0x1dc215(_0x3f24ad,_0x21de41,{'dataTransfer':_0x55f05b});_0xf07166['_forceMarkersCopy']('comment',()=>{_0x3f24ad['document']['fire']('copy',_0x4cc964);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new j(_0x3f9171,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x4d5477=_0x55f05b['getData']('text/html');const _0x331c84=_0x3f9171['model']['document']['selection'],_0x70bf52=Array['from'](_0x331c84['getRanges']());0x1===_0x70bf52['length']&&_0x70bf52[0x0]['isFlat']&&!_0x331c84['getSelectedElement']()&&''!==_0x4d5477['replace'](/ /g,'')['trim']()&&(_0x4d5477='<p>'+_0x4d5477+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x3afa4f,'query':_0x2adf30,'htmlContent':_0x4d5477,'label':_0x2d88e8,'mainActionLabel':_[_0x3f9171['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x85e775,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x5b36a2['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x2130b3['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x91ce6=new Map(),_0x402f18=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x13bbd4 of _0x402f18)for(const _0x57b0b2 of _0x13bbd4['commands'])_0x91ce6['set'](_0x57b0b2['id'],{..._0x57b0b2,'groupId':_0x13bbd4['groupId'],'groupLabel':_0x13bbd4['groupLabel']||_0x13bbd4['groupId']});return _0x91ce6;}['_createAIAssistantUIButton'](_0x1396bb){const _0x4e0b62=this['editor'],_0xcb9c90=_0x4e0b62['commands']['get']('showAIAssistant'),_0x4d1665=new _0x1396bb(_0x4e0b62['locale']);return _0x4d1665['set']({'label':i(_0x4e0b62['locale'],'AI\x20Assistant'),'icon':_0x85e775,'isToggleable':!0x0}),_0x4d1665['bind']('isEnabled')['to'](_0xcb9c90),_0x4d1665['bind']('isOn')['to'](this['_dialog'],'id',_0x41015c=>'aiAssistant'===_0x41015c),this['listenTo'](_0x4d1665,'execute',()=>{_0x4d1665['isOn']?this['hideUI']():_0xcb9c90['execute']();}),_0x4d1665;}['_initView'](){const _0x5c891e=this['editor']['plugins']['get'](a);this['_formView']=new k(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',()=>{_0x5c891e['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x5c891e['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x40e430,ui:{ariaLiveAnnouncer:_0x1147b0}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x305321,_0xda6288,_0x328fc5)=>{const _0x4c806f=this['_aiAssistantController']['currentContext'];_0x328fc5?_0x1147b0['announce'](i(_0x40e430,'AI\x20is\x20writing')):_0x4c806f&&_0x1147b0['announce'](i(_0x40e430,'Generated\x20content:\x20%0',_0x4c806f),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x20e02e,_0x9224c8,_0x3654a4)=>{if(_0x3654a4){const _0xc834e7=this['_formView']['errorView']['text'];_0x1147b0['announce'](i(_0x40e430,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0xc834e7));}});}['_onExecute'](_0x20f55f){const _0xc36600=this['_commandDefinitions']['get'](_0x20f55f),_0x255748=this['editor'],_0xfa916a=_0x255748['model']['document']['selection'],_0x470d1e=_0x255748['commands']['get']('showAIAssistant'),_0x9fd80e=_0x255748['plugins']['get'](a),_0x23faeb=''+(_0xc36600['groupId']!==K?_0xc36600['groupLabel']+':\x20':'')+_0xc36600['label'];if(!0x1!==_0xc36600['requiresContent']&&_0xfa916a['isCollapsed']){const _0x3bf594=_0x5c9151(_0xfa916a['getSelectedBlocks']())||_0x255748['model']['schema']['getLimitElement'](_0xfa916a);_0x255748['model']['change'](_0x262ced=>{_0x262ced['setSelection'](_0x3bf594,'in');});}_0x9fd80e['showFakeVisualSelection'](),_0x470d1e['execute'](_0xc36600['prompt'],_0x23faeb,'command:'+_0x20f55f);}['_populateMenuBarMenu'](_0x3c05cf,_0x4f762f,_0x39de2b,_0x2f668e){const _0x1aa3bf=this['editor'],_0x4c1317=_0x1aa3bf['locale'],_0x38c089=new _0x343e46(_0x4c1317),_0x5b3932=U(_0x1aa3bf,_0x39de2b)['filter'](_0x5c6374=>_0x5c6374['commands']['length']);0x1===_0x5b3932['length']?this['_getMenuBarGroupButtons']({'command':_0x3c05cf,'commands':_0x5b3932[0x0]['commands'],'parentMenuView':_0x4f762f,'onExecute':_0x2f668e})['forEach'](_0x5effc0=>_0x38c089['items']['add'](_0x5effc0)):_0x5b3932['forEach'](({groupId:_0x2b83ec,groupLabel:_0x56814c,commands:_0x3fdbcb})=>{const _0x11a6fc=new _0x4dfd49(_0x4c1317,_0x4f762f),_0x240f7d=new _0x4b3e32(_0x4c1317),_0x18a1f5=new _0x343e46(_0x4c1317),_0x2a391f=this['_getMenuBarGroupButtons']({'command':_0x3c05cf,'commands':_0x3fdbcb,'parentMenuView':_0x240f7d,'onExecute':_0x2f668e});_0x240f7d['buttonView']['set']({'label':_0x56814c||_0x2b83ec}),_0x240f7d['delegate']('execute')['to'](_0x4f762f),_0x18a1f5['items']['addMany'](_0x2a391f),_0x240f7d['panelView']['children']['add'](_0x18a1f5),_0x11a6fc['children']['add'](_0x240f7d),_0x38c089['items']['add'](_0x11a6fc);}),_0x4f762f['panelView']['children']['add'](_0x38c089);}['_getMenuBarGroupButtons']({command:_0x2d62e7,commands:_0x5ae4eb,parentMenuView:_0x3396cf,onExecute:_0x2776a0}){const _0x58cc4a=this['editor'],_0x3c7bda=_0x58cc4a['locale'];return U(_0x58cc4a,_0x5ae4eb)['map'](_0x6c715=>{const _0x3c7f69=new _0x4dfd49(_0x3c7bda,_0x3396cf),_0xd287cb=new _0x2accdd(_0x3c7bda);return _0xd287cb['set']({'label':_0x6c715['label']}),_0xd287cb['delegate']('execute')['to'](_0x3396cf),_0xd287cb['on']('execute',()=>_0x2776a0(_0x6c715['id'])),_0xd287cb['bind']('isEnabled')['to'](_0x2d62e7,'enabledCommandsIds',_0x1ae3d2=>_0x1ae3d2['includes'](_0x6c715['id'])),_0x3c7f69['children']['add'](_0xd287cb),_0x3c7f69;});}}function T(_0x394bc9,_0x1ac768){return void 0x0!==_0x394bc9['order']&&void 0x0===_0x1ac768['order']?0x1:void 0x0===_0x394bc9['order']&&void 0x0!==_0x1ac768['order']?-0x1:void 0x0!==_0x394bc9['order']&&void 0x0!==_0x1ac768['order']?_0x394bc9['order']-_0x1ac768['order']:0x0;}function U(_0x25a938,_0x3efe14){_0x3efe14['sort'](T);const _0x27838a={},_0x12c227=[];for(const _0x38a93e of _0x3efe14)if(void 0x0!==_0x38a93e['order']){if(_0x38a93e['order']in _0x27838a)throw new _0x333dcb('ai-commands-config-order-collision',_0x25a938,{'conflictingDefinitions':[_0x38a93e,_0x27838a[_0x38a93e['order']]]});_0x27838a[_0x38a93e['order']]=_0x38a93e,_0x12c227['splice'](_0x38a93e['order'],0x0,_0x38a93e);}else _0x12c227['push'](_0x38a93e);return _0x12c227;}class At extends _0x1a1bf0{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x49b2c8){super(_0x49b2c8);const _0x3c4a02=_0x49b2c8['config'],_0x550c40=_0x49b2c8['locale'];_0x3c4a02['define']('ai.aiAssistant.preserveComments',!0x0),_0x3c4a02['define']('ai.aiAssistant.commands',_t(_0x550c40)),_0x3c4a02['define']('ai.aiAssistant.extraCommandGroups',[]),_0x3c4a02['define']('ai.aiAssistant.removeCommands',[]);let _0xb55a43=o(_0x3c4a02['get']('ai.aiAssistant.commands'),_0x550c40);const _0x1d1b38=_0x3c4a02['get']('ai.aiAssistant.extraCommandGroups'),_0x3b9b5b=_0x3c4a02['get']('ai.aiAssistant.removeCommands');_0x1d1b38['forEach'](_0x831f46=>{const _0x25bb0d=_0xb55a43['find'](_0x65229c=>_0x65229c['groupId']===_0x831f46['groupId']);_0x25bb0d?_0x25bb0d['commands']=_0x25bb0d['commands']['concat'](_0x831f46['commands']):_0xb55a43['push'](_0x831f46);}),_0xb55a43=_0xb55a43['filter'](_0x39bcfa=>!_0x3b9b5b['includes'](_0x39bcfa['groupId'])),_0xb55a43['forEach'](_0x54e17c=>{_0x54e17c['commands']=_0x54e17c['commands']['filter'](_0x9e65db=>!_0x3b9b5b['includes'](_0x9e65db['id']));}),_0x3c4a02['set']('ai.aiAssistant.commands',_0xb55a43);}}function _t(_0x33d05b){return[{'groupId':'editOrReview','groupLabel':i(_0x33d05b,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x33d05b,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x33d05b,'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(_0x33d05b,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x33d05b,'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(_0x33d05b,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x33d05b,'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(_0x33d05b,'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(_0x33d05b,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x33d05b,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x33d05b,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x33d05b,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x33d05b,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x33d05b,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x33d05b,'Change\x20style'),'commands':[{'id':'business','label':i(_0x33d05b,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x33d05b,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x33d05b,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x33d05b,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x33d05b,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x33d05b,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x33d05b,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x33d05b,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x33d05b,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x33d05b,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x33d05b,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x33d05b,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x33d05b,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class S extends _0x1a1bf0{['abortController'];static get['requires'](){return[x];}constructor(_0x375437){super(_0x375437),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](x)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x1f0148){return this['sendRequest'](_0x1f0148)['catch'](_0x3ba0c0=>{if(_0x3ba0c0 instanceof R)return Promise['reject'](_0x3ba0c0);if('AbortError'==_0x3ba0c0['name'])return Promise['resolve']();throw console['error'](_0x3ba0c0),new _0x333dcb('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x4e2e0b,_0x3f58a8){const _0x5b22cd=this['editor']['locale'],_0x14f650={'Content-Type':'application/json'};if('object'==typeof _0x4e2e0b)Object['assign'](_0x14f650,_0x4e2e0b);else{if(_0x4e2e0b)try{const _0x5f2792=await _0x4e2e0b(_0x3f58a8);Object['assign'](_0x14f650,_0x5f2792);}catch{return Promise['reject'](new R(i(_0x5b22cd,'AI_ERROR_GET_HEADERS')));}}return _0x14f650;}async['_prepareRequestParameters'](_0x566a56,_0x634e72){const _0x592dc7=this['editor']['locale'];if('object'==typeof _0x566a56)return _0x566a56;try{return await _0x566a56(_0x634e72);}catch{return Promise['reject'](new R(i(_0x592dc7,'AI_ERROR_GET_PARAMETERS')));}}}class It extends S{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x1dfd31){super(_0x1dfd31),_0x1dfd31['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x1dfd31['config']['get']('ai.openAI.requestParameters')||_0x1dfd31['config']['define']('ai.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x1dfd31['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x1dfd31['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x1dfd31['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x555041,context:_0x4cedf6,onData:_0x19db37,actionId:_0x332688}){const _0x3b2f32=this['editor']['locale'],_0x2bff49=await this['prepareMessages'](_0x555041,_0x4cedf6,_0x332688),_0x35ae34=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x332688),_0xb87168=await this['_prepareRequestParameters'](this['_requestParameters'],_0x332688),_0x1c063d={'messages':_0x2bff49,..._0xb87168},_0x33bef7={'method':'POST','headers':_0x35ae34,'body':JSON['stringify'](_0x1c063d),'signal':this['abortController']['signal']},_0x57d833=await fetch(this['_apiUrl'],_0x33bef7);if(_0x57d833['ok'])return _0xb87168['stream']?await this['_readStreamableResponse'](_0x57d833,_0x19db37):await this['_readStaticResponse'](_0x57d833,_0x19db37),Promise['resolve']();{const _0x1926a8=await _0x57d833['text']();return _0x1926a8['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x3b2f32,'AI_ERROR_CONTEXT_LENGTH'))):_0x1926a8['includes']('Moderation')?Promise['reject'](new R(i(_0x3b2f32,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x1926a8));}}async['prepareMessages'](_0x2d49ce,_0x3752de,_0x50313a){let _0x34635b,_0x361d17;return _0x3752de?(_0x34635b='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.',_0x361d17='Instruction:\x0a'+_0x2d49ce+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3752de):(_0x34635b='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.',_0x361d17=_0x2d49ce),[{'role':'system','content':_0x34635b},{'role':'user','content':_0x361d17}];}async['_readStreamableResponse'](_0x37c7fa,_0x3f1a28){const _0x5d9784=_0x37c7fa['body']['getReader'](),_0x40aecc=new TextDecoder();let _0x4f5915='',_0x59f6c6='',_0x134562='',_0xef769f=!0x1;for(;!_0xef769f;){const {done:_0x12f3e6,value:_0x2d66e5}=await _0x5d9784['read'](),_0x5d3963=_0x4f5915+_0x40aecc['decode'](_0x2d66e5);let _0x4f4882='';_0xef769f=_0x12f3e6;try{_0x4f4882=this['_cleanUpData'](_0x5d3963),_0x4f5915='';}catch{_0x4f5915=_0x5d3963;continue;}_0x59f6c6+=_0x4f4882,!_0xef769f&&this['_isBufferIncomplete'](_0x59f6c6)||_0x59f6c6&&(_0x134562+=_0x59f6c6,_0x59f6c6='',_0x3f1a28(_0x134562));}return Promise['resolve']();}async['_readStaticResponse'](_0x2f8c6d,_0x534bdb){return _0x534bdb((await _0x2f8c6d['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x14c18b){const _0x3bdf3a=_0x14c18b['split']('<')['length']!==_0x14c18b['split']('>')['length'],_0x2a1fd6=_0x14c18b['length']<0x1e;return _0x3bdf3a&&_0x2a1fd6;}['_cleanUpData'](_0x1340b7){return _0x1340b7['split'](/\n(?![^{]*\})/g)['map'](_0x30aa56=>_0x30aa56['replace']('data:\x20',''))['filter'](_0xd9a549=>_0xd9a549&&_0xd9a549['length']>0x0&&'[DONE]'!==_0xd9a549)['map'](_0x3eea6e=>{const {choices:_0x5344e8}=JSON['parse'](_0x3eea6e);if(_0x5344e8[0x0]?.['delta']?.['content'])return _0x5344e8[0x0]['delta']['content'];})['filter'](_0x8bc1ba=>_0x8bc1ba)['join']('');}}class Et extends S{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x2ba0fc){super(_0x2ba0fc),_0x2ba0fc['config']['get']('ai.aws.requestParameters')||_0x2ba0fc['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']=_0x2ba0fc['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x2ba0fc['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x2ba0fc['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x2ba0fc['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x1bb1b6,context:_0xd4d2e2,onData:_0x1c0bbf,actionId:_0x3c94ec}){const {model:_0x5db43d,stream:_0x51008f,..._0x167cc7}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x3c94ec),_0xc01814={'prompt':await this['preparePrompt'](_0x1bb1b6,_0xd4d2e2,_0x5db43d,_0x3c94ec),..._0x167cc7};this['_apiUrl']?await this['_processProxyRequest'](_0xc01814,_0x5db43d,_0x51008f,_0x1c0bbf,_0x3c94ec):await this['_processAWSRequest'](_0xc01814,_0x5db43d,_0x51008f,_0x1c0bbf);}async['preparePrompt'](_0x4e9d4e,_0x28a87e,_0x18b106,_0x1fa36f){let _0x1e616d,_0x2caffc;return _0x28a87e?(_0x1e616d='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.',_0x2caffc='Instruction:\x0a'+_0x4e9d4e+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x28a87e):(_0x1e616d='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.',_0x2caffc=_0x4e9d4e),'meta.llama'==this['getModelFamily'](_0x18b106)?'<<SYS>>\x0a'+_0x1e616d+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x2caffc+'\x0a[/INST]':'Human:\x0a'+_0x1e616d+'\x0a'+_0x2caffc+'\x0a\x0aAssistant:';}['getModelFamily'](_0x971c2){if(/^anthropic\.claude/['test'](_0x971c2))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x971c2))return'ai21.j2';if(/^cohere\.command/['test'](_0x971c2))return'cohere.command';if(/^meta\.llama/['test'](_0x971c2))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x971c2));}async['_processProxyRequest'](_0x580a63,_0x5b7cca,_0x233c69,_0x36d972,_0xbbc619){const _0x8f673f={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xbbc619),'body':JSON['stringify']({..._0x580a63,'model':_0x5b7cca,'stream':_0x233c69}),'signal':this['abortController']['signal']},_0x460cb0=await fetch(this['_apiUrl'],_0x8f673f);_0x233c69?await this['_readStreamableResponse'](_0x460cb0,_0x5b7cca,_0x36d972):await this['_readStaticResponse'](_0x460cb0,_0x5b7cca,_0x36d972);}async['_processAWSRequest'](_0x36225e,_0x54ed42,_0x4df7cb,_0x3be559){const _0x3fe54d=new _0x527b18(this['_bedrockClientConfig']),_0x4726d2={'body':JSON['stringify'](_0x36225e),'contentType':'application/json','accept':'application/json','modelId':_0x54ed42};let _0x1fb2e4;if(_0x4df7cb){const _0x57f49d=new _0x404fd6(_0x4726d2);_0x1fb2e4=await _0x3fe54d['send'](_0x57f49d,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x1fb2e4,_0x54ed42,_0x3be559);}else{const _0x2bd5f4=new _0x1d8706(_0x4726d2);_0x1fb2e4=await _0x3fe54d['send'](_0x2bd5f4,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x1fb2e4,_0x54ed42,_0x3be559);}}async['_readAsyncIterableResponse'](_0xb32075,_0x3254d8,_0x59f68c){const _0x4e846b=_0xb32075['body'],_0xec6f75=new TextDecoder('utf-8');let _0x3f7b17='';for await(const _0x555455 of _0x4e846b)if(_0x555455['chunk']){const _0x525fc8=_0xec6f75['decode'](_0x555455['chunk']['bytes']),_0xa533d6=JSON['parse'](_0x525fc8);_0x3f7b17+=this['_getGeneratedText'](_0xa533d6,_0x3254d8),_0x59f68c(_0x3f7b17);}return Promise['resolve']();}async['_readStreamableResponse'](_0x7bd317,_0x10ab77,_0xf821a8){const _0x386323=_0x7bd317['body'],_0x28e358=new TextDecoder('utf-8'),_0x1f87b5=_0x386323['getReader']();let _0x52432d='',_0x175a5d='',_0x3e0fd9=!0x1;for(;!_0x3e0fd9;){const {done:_0x3f4be2,value:_0x27efc9}=await _0x1f87b5['read']();if(_0x3e0fd9=_0x3f4be2,_0x3e0fd9)break;const _0x408ad5=(_0x52432d+_0x28e358['decode'](_0x27efc9))['split']('\x0a')['map'](_0x21dfdb=>{try{return _0x52432d='',JSON['parse'](_0x21dfdb);}catch{return _0x52432d=_0x21dfdb,null;}})['filter'](_0x2020ba=>null!==_0x2020ba);_0x408ad5['length']&&(_0x175a5d+=_0x408ad5['map'](_0x30f3dd=>this['_getGeneratedText'](_0x30f3dd,_0x10ab77))['join'](''),_0xf821a8(_0x175a5d));}return Promise['resolve']();}async['_readStaticResponse'](_0x2193d4,_0x367438,_0x32e538){let _0x4db702;return _0x4db702=_0x2193d4 instanceof Response?await _0x2193d4['json']():JSON['parse'](new TextDecoder('utf-8')['decode'](_0x2193d4['body'])),(_0x32e538(this['_getGeneratedText'](_0x4db702,_0x367438)),Promise['resolve']());}['_getGeneratedText'](_0x3c172c,_0x4df723){switch(this['getModelFamily'](_0x4df723)){case'anthropic.claude':return _0x3c172c['completion'];case'ai21.j2':return _0x3c172c['completions'][0x0]['data']['text'];case'cohere.command':return _0x3c172c['generations'][0x0]['text'];case'meta.llama':return _0x3c172c['generation'];}}}export{x as AIAdapter,At as AIAssistant,n as AIAssistantUI,R as AIRequestError,S as AITextAdapter,Et as AWSTextAdapter,It as OpenAITextAdapter,E as ShowAIAssistantCommand,_t as getDefaultAICommands};
|
|
23
|
+
import{Plugin as _0x2084de,Command as _0x52ca6a}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x3cc613,IconCheck as _0x6b2964,IconError as _0x24a619,IconSubmit as it,IconHistory as tt,IconMagicWand as _0x367889,IconRobotPencil as _0x38f8ec}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x49bc33,CKEditorError as _0x2fb82f,ObservableMixin as _0x54b505,global as _0x43f39d,isVisible as _0x2912f2,Rect as _0x14a995,Collection as _0x31f308,FocusTracker as et,KeystrokeHandler as rt,first as _0x4ad56f}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as ot,ButtonView as _0x459498,View as _0x133ec8,SpinnerView as _0x1defc2,IconView as _0x243c82,AutocompleteView as st,ListView as yt,ListItemGroupView as Ct,ListItemView as xt,ButtonLabelView as wt,FocusCycler as ht,createLabeledTextarea as nt,Dialog as _0x53561b,createDropdown as _0x2e82fb,addMenuToDropdown as _0x1210f7,MenuBarMenuView as _0x1d5dc5,MenuBarMenuListItemButtonView as _0x4a4578,DialogViewPosition as _0x323db1,MenuBarMenuListView as _0x436615,MenuBarMenuListItemView as _0x423d37}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x31afb4,ClipboardMarkersUtils as _0x1b19e1}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x4fd616,ViewDataTransfer as _0x1c0f1e,ViewUpcastWriter as _0x12a727,Matcher as _0x5447b3}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as kt,escape as ft}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x501e7f,InvokeModelWithResponseStreamCommand as _0x1f8225,InvokeModelCommand as _0x29e835}from'@aws-sdk/client-bedrock-runtime';const K='_ungrouppedCommands';function o(_0x5c2183,_0x3c30c5){const _0x25fbc4=(0x0,_0x3c30c5['t'])('Other');return _0x5c2183['length']?'groupId'in _0x5c2183[0x0]?_0x5c2183:[{'groupId':K,'groupLabel':_0x25fbc4,'order':0x1/0x0,'commands':_0x5c2183}]:[{'groupId':K,'groupLabel':_0x25fbc4,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],w='ai-ui';class a extends _0x2084de{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x544d92}=this,_0x5ec0c8=['ck-fake-ai-selection'];_0x544d92['config']['get']('ai.useTheme')&&_0x5ec0c8['push']('ck-ai-assistant-ui_theme'),_0x544d92['conversion']['for']('editingDowncast')['markerToHighlight']({'model':w,'view':{'classes':_0x5ec0c8,'priority':0xc}}),_0x544d92['conversion']['for']('editingDowncast')['markerToElement']({'model':w,'view':(_0x14551a,{writer:_0x3fb38c})=>{if(!_0x14551a['markerRange']['isCollapsed'])return null;const _0x4224a2=_0x3fb38c['createUIElement']('span');return _0x3fb38c['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4224a2),_0x4224a2;}});}['afterInit'](){!async function(_0x12a00e){const _0x3884da=_0x34143a([0x44,0x59,0x38,0x33,0x67,0x42,0x56,0x7a,0x73,0x43,0x74,0x5a,0x55,0x64,0x31,0x30,0x52,0x79,0x68,0x75,0x37,0x34,0x48,0x39,0x54,0x4a,0x4d,0x4c,0x6b,0x61,0x36,0x70,0x71,0x4b,0x53,0x78,0x57,0x72,0x65,0x6e,0x66,0x41,0x49,0x51,0x76,0x50,0x4e,0x46,0x35,0x77,0x6d,0x62,0x6c,0x58,0x4f,0x45,0x32,0x69,0x6a,0x47,0x6f,0x63]),_0x570c9d=0x5f02c8a0,_0x5127ab=0x5f05a5b0^_0x570c9d,_0x481b2b=window[_0x34143a([0x44,0x61,0x74,0x65])][_0x34143a([0x6e,0x6f,0x77])](),_0x392c66=_0x12a00e[_0x34143a([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x32fc46=new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x45621c=>{_0x392c66[_0x34143a([0x6f,0x6e,0x63,0x65])](_0x34143a([0x72,0x65,0x61,0x64,0x79]),_0x45621c);}),_0x3b77db={[_0x34143a([0x6b,0x74,0x79])]:_0x34143a([0x45,0x43]),[_0x34143a([0x75,0x73,0x65])]:_0x34143a([0x73,0x69,0x67]),[_0x34143a([0x63,0x72,0x76])]:_0x34143a([0x50,0x2d,0x32,0x35,0x36]),[_0x34143a([0x78])]:_0x34143a([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]),[_0x34143a([0x79])]:_0x34143a([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]),[_0x34143a([0x61,0x6c,0x67])]:_0x34143a([0x45,0x53,0x32,0x35,0x36])},_0x2cdd3d=_0x392c66[_0x34143a([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x34143a([0x67,0x65,0x74])](_0x34143a([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x5a39a0(){let _0x4cf874,_0x53fdca=null,_0x3c940e=null;try{if(_0x2cdd3d==_0x34143a([0x47,0x50,0x4c]))return _0x34143a([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x4cf874=_0x23f9fd(),!_0x4cf874)return _0x34143a([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x4cf874[_0x34143a([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x3c940e=_0x32cd56(_0x4cf874[_0x34143a([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x4cf874[_0x34143a([0x6a,0x74,0x69])])),await _0x4fb7ab()?_0x3569ab()?_0x43f09e()?_0x34143a([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x46a1fa()?(_0x4cf874[_0x34143a([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x34143a([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x53fdca=_0x1cb89b(_0x34143a([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x4cf874[_0x34143a([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x34143a([0x74,0x72,0x69,0x61,0x6c])&&(_0x53fdca=_0x1cb89b(_0x34143a([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x2ed7e5()):_0x34143a([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x34143a([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x34143a([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x34143a([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x43f09e(){const _0x3f61a3=[_0x34143a([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x34143a([0x74,0x72,0x69,0x61,0x6c])][_0x34143a([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4cf874[_0x34143a([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x481b2b/0x3e8:0xe10*_0x5127ab;return _0x4cf874[_0x34143a([0x65,0x78,0x70])]<_0x3f61a3;}function _0x3569ab(){const _0x4f9de2=_0x4cf874[_0x34143a([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x4f9de2&&(!!_0x4f9de2[_0x34143a([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x34143a([0x2a]))||!!_0x4f9de2[_0x34143a([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x34143a([0x41,0x49])));}function _0x46a1fa(){const _0x401409=_0x4cf874[_0x34143a([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x401409||0x0==_0x401409[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x56ddcc}=new URL(window[_0x34143a([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x401409[_0x34143a([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x56ddcc))return!0x0;const _0x3eced9=_0x56ddcc[_0x34143a([0x73,0x70,0x6c,0x69,0x74])](_0x34143a([0x2e]));return _0x401409[_0x34143a([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x361f1e=>_0x361f1e[_0x34143a([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x34143a([0x2a])))[_0x34143a([0x6d,0x61,0x70])](_0x5ab88b=>_0x5ab88b[_0x34143a([0x73,0x70,0x6c,0x69,0x74])](_0x34143a([0x2e])))[_0x34143a([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x23f659=>_0x23f659[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x3eced9[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x34143a([0x6d,0x61,0x70])](_0x56cd7a=>Array(_0x3eced9[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x56cd7a[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x34143a([0x66,0x69,0x6c,0x6c])](_0x56cd7a[0x0]===_0x34143a([0x2a])?_0x34143a([0x2a]):'')[_0x34143a([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x56cd7a))[_0x34143a([0x73,0x6f,0x6d,0x65])](_0x55eeb4=>_0x3eced9[_0x34143a([0x65,0x76,0x65,0x72,0x79])]((_0x12ae39,_0x83edb8)=>_0x55eeb4[_0x83edb8]===_0x12ae39||_0x55eeb4[_0x83edb8]===_0x34143a([0x2a])));}function _0x2ed7e5(){return _0x53fdca&&_0x3c940e?new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x218ee1,_0x19fd2b)=>{_0x53fdca[_0x34143a([0x74,0x68,0x65,0x6e])](_0x218ee1,_0x19fd2b),_0x3c940e[_0x34143a([0x74,0x68,0x65,0x6e])](_0x1e2513=>{_0x1e2513!=_0x34143a([0x56,0x61,0x6c,0x69,0x64])&&_0x218ee1(_0x1e2513);},_0x19fd2b);}):_0x53fdca||_0x3c940e||_0x34143a([0x56,0x61,0x6c,0x69,0x64]);}}function _0x32cd56(_0x24cfc2,_0x36694c){return new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5758ef=>{if(_0x525d6e())return _0x5758ef(_0x34143a([0x56,0x61,0x6c,0x69,0x64]));_0x49ce9f(),_0x392c66[_0x34143a([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x34143a([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x3d8c9e=!0x1;const _0x1696b5=_0x49bc33();function _0x6f40d3(_0xc09b07){return!!_0xc09b07&&(typeof _0xc09b07===_0x34143a([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0xc09b07===_0x34143a([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0xc09b07[_0x34143a([0x74,0x68,0x65,0x6e])]===_0x34143a([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0xc09b07[_0x34143a([0x63,0x61,0x74,0x63,0x68])]===_0x34143a([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0xa86648(_0x165965){_0x1ae8c5(_0x165965)[_0x34143a([0x74,0x68,0x65,0x6e])](_0x1f679b=>{if(!_0x1f679b||_0x1f679b[_0x34143a([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x34143a([0x6f,0x6b]))return _0x34143a([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x1c251a(_0x20a9da(_0x1696b5+_0x36694c))!=_0x1f679b[_0x34143a([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x34143a([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x34143a([0x56,0x61,0x6c,0x69,0x64]);})[_0x34143a([0x74,0x68,0x65,0x6e])](_0x4feefb=>(_0x1659e4(),_0x4feefb),()=>{const _0x3efaed=_0x55bf1c();return null==_0x3efaed?(_0x1659e4(),_0x34143a([0x56,0x61,0x6c,0x69,0x64])):_0x34143a(_0x481b2b-_0x3efaed>(0x7b0e4ca0^_0x570c9d)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x34143a([0x74,0x68,0x65,0x6e])](_0x5758ef)[_0x34143a([0x63,0x61,0x74,0x63,0x68])](()=>{_0x5758ef(_0x34143a([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1fd898=0x5f342620^_0x570c9d;function _0x1659e4(){const _0x141701=_0x34143a([0x6c,0x6c,0x63,0x74,0x2d])+_0x1c251a(_0x20a9da(_0x24cfc2)),_0x452f5d=_0x2b61d3(_0x1c251a(window[_0x34143a([0x4d,0x61,0x74,0x68])][_0x34143a([0x63,0x65,0x69,0x6c])](_0x481b2b/_0x1fd898)));window[_0x34143a([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x34143a([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x141701,_0x452f5d);}function _0x55bf1c(){const _0xbcf93a=_0x34143a([0x6c,0x6c,0x63,0x74,0x2d])+_0x1c251a(_0x20a9da(_0x24cfc2)),_0x36b00b=window[_0x34143a([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x34143a([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0xbcf93a);return _0x36b00b?window[_0x34143a([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x2b61d3(_0x36b00b),0x10)*_0x1fd898:null;}function _0x1ae8c5(_0x30e59b){return new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x28fea4,_0x56d1d9)=>{_0x30e59b[_0x34143a([0x74,0x68,0x65,0x6e])](_0x28fea4,_0x56d1d9),window[_0x34143a([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x56d1d9,0x5f031c60^_0x570c9d);});}}_0x392c66[_0x34143a([0x6f,0x6e])](_0x34143a([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x28e4c7,_0x2c8927)=>{if(_0x2c8927[0x0]!=_0x24cfc2)return _0x5758ef(_0x34143a([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x2c8927[0x1]={..._0x2c8927[0x1],[_0x34143a([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x1696b5};},{[_0x34143a([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x34143a([0x68,0x69,0x67,0x68])}),_0x392c66[_0x34143a([0x6f,0x6e])](_0x34143a([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x40293f=>{_0x6f40d3(_0x40293f[_0x34143a([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x3d8c9e=!0x0,_0xa86648(_0x40293f[_0x34143a([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x34143a([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x34143a([0x6c,0x6f,0x77])}),_0x32fc46[_0x34143a([0x74,0x68,0x65,0x6e])](()=>{_0x3d8c9e||_0x5758ef(_0x34143a([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x525d6e(){return _0x392c66[_0x34143a([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x34143a([0x76,0x69,0x65,0x77])][_0x34143a([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x34143a([0x61,0x75,0x74,0x6f]);}function _0x49ce9f(){_0x392c66[_0x34143a([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x34143a([0x76,0x69,0x65,0x77])][_0x34143a([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x34143a([0x61,0x75,0x74,0x6f]);}}function _0x1cb89b(_0x366ec0){const _0x5d5703=[new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x45f4a5=>setTimeout(_0x45f4a5,0x5f0bf66c^_0x570c9d)),_0x32fc46[_0x34143a([0x74,0x68,0x65,0x6e])](()=>new window[(_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2754a6=>{let _0x5cdc38=0x0;_0x392c66[_0x34143a([0x6d,0x6f,0x64,0x65,0x6c])][_0x34143a([0x6f,0x6e])](_0x34143a([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x513adf,_0x3caf3b)=>{_0x3caf3b[0x0][_0x34143a([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x5cdc38++,_0x5cdc38==(0x5f02c958^_0x570c9d)&&(_0x2754a6(),_0x513adf[_0x34143a([0x6f,0x66,0x66])]());});}))];return window[_0x34143a([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x34143a([0x72,0x61,0x63,0x65])](_0x5d5703)[_0x34143a([0x74,0x68,0x65,0x6e])](()=>_0x366ec0);}async function _0x564458(){await _0x32fc46,_0x392c66[_0x34143a([0x6d,0x6f,0x64,0x65,0x6c])][_0x34143a([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1e1435,_0x392c66[_0x34143a([0x6d,0x6f,0x64,0x65,0x6c])][_0x34143a([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1e1435,_0x392c66[_0x34143a([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x34143a([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x461899(_0x3f2101){const _0x3e33b6=_0x1a69c9();_0x392c66[_0x3e33b6]=_0x34143a([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x3f2101,_0x3f2101!=_0x34143a([0x56,0x61,0x6c,0x69,0x64])&&_0x564458();}function _0x1a69c9(){const _0x798773=window[_0x34143a([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x34143a([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x34143a([0x6e,0x6f,0x77])]())[_0x34143a([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x34143a([0x2e]),'');let _0x323108=_0x34143a([0x44]);for(let _0x2a1e80=0x0;_0x2a1e80<_0x798773[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2a1e80+=0x2){let _0x574572=window[_0x34143a([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x798773[_0x34143a([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x2a1e80,_0x2a1e80+0x2));_0x574572>=_0x3884da[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x574572-=_0x3884da[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x323108+=_0x3884da[_0x574572];}return _0x323108;}function _0x23f9fd(){const _0x5d639d=_0x2cdd3d[_0x34143a([0x73,0x70,0x6c,0x69,0x74])](_0x34143a([0x2e]));if(0x3!=_0x5d639d[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x2fd192(_0x5d639d[0x1]);function _0x2fd192(_0x36898e){const _0x4f4ab1=_0x29511a(_0x36898e);return _0x4f4ab1&&_0x4c3447()?_0x4f4ab1:null;function _0x4c3447(){const _0x555827=_0x4f4ab1[_0x34143a([0x6a,0x74,0x69])],_0x3b3dd8=window[_0x34143a([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x555827[_0x34143a([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x555827[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0xc6aaff={..._0x4f4ab1,[_0x34143a([0x6a,0x74,0x69])]:_0x555827[_0x34143a([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x555827[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0xc6aaff[_0x34143a([0x76,0x63])],_0x20a9da(_0xc6aaff)==_0x3b3dd8;}}}async function _0x4fb7ab(){let _0x22f9c4=!0x0;try{const _0x360d7b=_0x2cdd3d[_0x34143a([0x73,0x70,0x6c,0x69,0x74])](_0x34143a([0x2e])),[_0x3e0aed,_0xb8e666,_0x37b888]=_0x360d7b;return _0x5cb70f(_0x3e0aed),await _0x35ead7(_0x3e0aed,_0xb8e666,_0x37b888),_0x22f9c4;}catch{return!0x1;}function _0x5cb70f(_0x482f2b){const _0x2e8acb=_0x29511a(_0x482f2b);_0x2e8acb&&_0x2e8acb[_0x34143a([0x61,0x6c,0x67])]==_0x34143a([0x45,0x53,0x32,0x35,0x36])||(_0x22f9c4=!0x1);}async function _0x35ead7(_0x885c73,_0x58f792,_0x333b02){const _0x301b06=window[_0x34143a([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x34143a([0x66,0x72,0x6f,0x6d])](_0x559d02(_0x333b02),_0x43f6c1=>_0x43f6c1[_0x34143a([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x3e7118=new window[(_0x34143a([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x34143a([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x885c73+_0x34143a([0x2e])+_0x58f792),_0x64c143=window[_0x34143a([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x34143a([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x64c143)return;const _0x488d77=await _0x64c143[_0x34143a([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x34143a([0x6a,0x77,0x6b]),_0x3b77db,{[_0x34143a([0x6e,0x61,0x6d,0x65])]:_0x34143a([0x45,0x43,0x44,0x53,0x41]),[_0x34143a([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x34143a([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x34143a([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x64c143[_0x34143a([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x34143a([0x6e,0x61,0x6d,0x65])]:_0x34143a([0x45,0x43,0x44,0x53,0x41]),[_0x34143a([0x68,0x61,0x73,0x68])]:{[_0x34143a([0x6e,0x61,0x6d,0x65])]:_0x34143a([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x488d77,_0x301b06,_0x3e7118)||(_0x22f9c4=!0x1);}}function _0x29511a(_0x41e4bd){return _0x41e4bd[_0x34143a([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x34143a([0x65,0x79]))?JSON[_0x34143a([0x70,0x61,0x72,0x73,0x65])](_0x559d02(_0x41e4bd)):null;}function _0x559d02(_0x171d92){return window[_0x34143a([0x61,0x74,0x6f,0x62])](_0x171d92[_0x34143a([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x34143a([0x2b]))[_0x34143a([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x34143a([0x2f])));}function _0x20a9da(_0x1e6b67){let _0x2515a9=0x1505;function _0x296daa(_0x583231){for(let _0x4bee5f=0x0;_0x4bee5f<_0x583231[_0x34143a([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x4bee5f++){const _0x193284=_0x583231[_0x34143a([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x4bee5f);_0x2515a9=(_0x2515a9<<0x5)+_0x2515a9+_0x193284,_0x2515a9&=_0x2515a9;}}function _0x22f99d(_0x646ff9){Array[_0x34143a([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x646ff9)?_0x646ff9[_0x34143a([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x22f99d):_0x646ff9&&typeof _0x646ff9==_0x34143a([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x34143a([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x646ff9)[_0x34143a([0x73,0x6f,0x72,0x74])]()[_0x34143a([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x211e04,_0x220095])=>{_0x296daa(_0x211e04),_0x22f99d(_0x220095);}):_0x296daa(window[_0x34143a([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x646ff9));}return _0x22f99d(_0x1e6b67),_0x2515a9>>>0x0;}function _0x1c251a(_0x5acd85){return _0x5acd85[_0x34143a([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x34143a([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x34143a([0x30]));}function _0x2b61d3(_0xdadebc){return _0xdadebc[_0x34143a([0x73,0x70,0x6c,0x69,0x74])]('')[_0x34143a([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x34143a([0x6a,0x6f,0x69,0x6e])]('');}function _0x1e1435(){}function _0x34143a(_0x33f489){return _0x33f489['map'](_0x30be5f=>String['fromCharCode'](_0x30be5f))['join']('');}_0x461899(await _0x5a39a0());}(this);}['showFakeVisualSelection'](){const _0x239332=this['editor']['model'];_0x239332['change'](_0x45b32a=>{const _0x4a224f=_0x239332['document']['selection']['getRanges']();let _0x5d1f4a=0x0;for(const _0x4be6fb of _0x4a224f){const _0xf1f661=w+':'+_0x5d1f4a;if(_0x239332['markers']['has'](_0xf1f661))_0x45b32a['updateMarker'](_0xf1f661,{'range':_0x4be6fb});else{if(_0x4be6fb['start']['isAtEnd']){const _0x2ee574=_0x4be6fb['start']['getLastMatchingPosition'](({item:_0x4e64fb})=>!_0x239332['schema']['isContent'](_0x4e64fb),{'boundaries':_0x4be6fb});_0x45b32a['addMarker'](_0xf1f661,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x45b32a['createRange'](_0x2ee574,_0x4be6fb['end'])});}else _0x45b32a['addMarker'](_0xf1f661,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4be6fb});}_0x5d1f4a++;}});}['hideFakeVisualSelection'](){const _0x5313a8=this['editor']['model'],_0x167ba6=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](w));_0x167ba6['length']&&_0x5313a8['change'](_0x207921=>{_0x167ba6['forEach'](_0x27b235=>{_0x207921['removeMarker'](_0x27b235);});});}['insertContent'](_0x5c059f,_0x18d717){const _0x54e058=this['_getAISelection'](),_0x2aef14=_0x18d717||_0x54e058['getFirstRange']();this['editor']['model']['canEditAt'](_0x2aef14)&&this['editor']['model']['change'](_0x4f2a1a=>{this['hideFakeVisualSelection'](),_0x18d717||this['_resetContentOfSelectedTableCells'](_0x4f2a1a,_0x54e058),this['_pasteHTMLUsingClipboard']({'insertAt':_0x2aef14,'writer':_0x4f2a1a,'html':_0x5c059f});});}['insertContentBelow'](_0x1b666f){const {model:_0x5ed657}=this['editor'],_0x5e7b40=this['_getAISelection']();_0x5ed657['change'](()=>{const _0x364558=this['_prepareTableInsertBelowPosition'](_0x1b666f,_0x5e7b40)||this['_getDefaultInsertBelowPosition'](_0x5e7b40);this['insertContent'](_0x1b666f,_0x364558);});}['_getAISelection'](){const _0x4e8f86=this['editor']['model'],_0x372edb=Array['from'](_0x4e8f86['markers']['getMarkersGroup'](w))['map'](_0x58dd54=>_0x58dd54['getRange']());return _0x4e8f86['createSelection'](_0x372edb);}['_pasteHTMLUsingClipboard']({writer:_0x1f0acd,html:_0x6b17f,insertAt:_0x3d216a}){const {view:_0x4dd56a}=this['editor']['editing'],_0x1bd57d=this['editor']['plugins']['get'](_0x31afb4),_0x4f7001=new gt();_0x4f7001['setData']('text/html',_0x6b17f);const _0x3b3448=new ClipboardEvent('paste',{'clipboardData':_0x4f7001}),_0x5f4fee=new _0x4fd616(_0x4dd56a,_0x3b3448,{'dataTransfer':new _0x1c0f1e(_0x4f7001)});_0x1f0acd['setSelection'](_0x3d216a);const _0x4b1585=(_0x13236e,_0xabc5f1)=>{_0xabc5f1['resultRange']&&_0x1f0acd['setSelection'](_0xabc5f1['resultRange']);};_0x1bd57d['once']('contentInsertion',_0x4b1585,{'priority':'lowest'}),_0x4dd56a['document']['fire']('paste',_0x5f4fee),_0x1bd57d['off']('contentInsertion',_0x4b1585);}['_getDefaultInsertBelowPosition'](_0x3d03f4){const {model:_0x193046}=this['editor'],_0x38fbed=Array['from'](_0x3d03f4['getSelectedBlocks']());return _0x38fbed['length']?_0x193046['createPositionAfter'](_0x38fbed['pop']()):_0x3d03f4['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0xa1830f,_0xb6ef41){const {model:_0x3fa116,plugins:_0xfe3797}=this['editor'];if(_0xfe3797['has']('TableUtils')){const _0x337a36=_0xfe3797['get']('TableUtils')['getSelectedTableCells'](_0xb6ef41);if(_0x337a36['length']){const _0x5092f1=this['_getTableRowCountFromContent'](_0xa1830f),_0x40d7c7=this['_createEmptyTableRows'](_0x337a36,_0x5092f1);return _0x3fa116['createPositionAt'](_0x40d7c7,0x0);}}return null;}['_getTableRowCountFromContent'](_0x57441c){const _0x4e2483=this['editor']['plugins']['get']('TableUtils'),_0x581e11=this['editor']['data']['parse'](_0x57441c),_0x4a1f8c=Array['from'](_0x581e11['getChildren']())['filter'](_0x455e45=>_0x455e45['is']('element','table'));let _0x1b2c88=0x0;return _0x4a1f8c['forEach'](_0x729880=>{_0x1b2c88+=_0x4e2483['getRows'](_0x729880);}),_0x1b2c88;}['_createEmptyTableRows'](_0x1bea03,_0x53a13b){const _0xcba014=this['editor']['plugins']['get']('TableUtils'),_0x343496=_0xcba014['getRowIndexes'](_0x1bea03),_0x917436=_0xcba014['getColumnIndexes'](_0x1bea03),_0x212948=_0x343496['last']+0x1,_0x5a5bf0=_0x917436['first'],_0x134e56=_0x1bea03[0x0]['findAncestor']('table');for(let _0x48a4e4=0x0;_0x48a4e4<_0x53a13b;_0x48a4e4++)_0xcba014['insertRows'](_0x134e56,{'at':_0x212948});return _0x134e56['getChild'](_0x212948)['getChild'](_0x5a5bf0);}['_resetContentOfSelectedTableCells'](_0xe3d85,_0x3d574f){const {plugins:_0x31bdd4}=this['editor'],{model:_0x9dc6fe}=_0xe3d85;if(!_0x31bdd4['has']('TableUtils'))return;_0x31bdd4['get']('TableUtils')['getSelectedTableCells'](_0x3d574f)['length']&&_0x9dc6fe['deleteContent'](_0x3d574f);}}class x extends _0x2084de{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x2fb82f('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x3fc805){super(_0x3fc805),this['name']='AIRequestError';}}function i(_0x4b2df1,_0x4293e2,_0x288f8d){const t=_0x4b2df1['t'];switch(_0x4293e2){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',_0x288f8d);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x288f8d);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'},_0x288f8d);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 _0x4293e2;}}class E extends _0x52ca6a{['_commandDefinitions'];constructor(_0xf49916,_0x1c73a7){super(_0xf49916),this['_commandDefinitions']=_0x1c73a7,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xbcceb1,_0x1fe431,_0xfe6e87)=>{this['isEnabled']&&(this['enabledCommandsIds']=F(this['_commandDefinitions'],_0xfe6e87));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0xce298,_0xc5176f,_0x4af1e3)=>{this['enabledCommandsIds']=_0x4af1e3?F(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x36d6cc=this['editor']['model'];this['_hasContext']=function(_0x73e18d){const _0x16edca=_0x73e18d['document']['selection'];return _0x16edca['isCollapsed']?0x0!==[..._0x16edca['getSelectedBlocks']()]['length']&&![..._0x16edca['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x73e18d['hasContent'](_0x16edca['getFirstRange']());}(_0x36d6cc);const _0x54d74f=_0x36d6cc['document']['selection'],_0x4732d3=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0xf9961c of _0x54d74f['getRanges']())for(const _0x4484f6 of _0xf9961c['getItems']())if(_0x4484f6['is']('element')&&_0x4732d3['includes'](_0x4484f6['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x461df4='',_0x422a53='',_0x2bd178='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x461df4,_0x422a53,_0x2bd178);}}function F(_0x154cc1,_0x28b84c){const _0x53d28f=new Set();for(const _0x9c106e of _0x154cc1['values']())(_0x28b84c||!0x1===_0x9c106e['requiresContent'])&&_0x53d28f['add'](_0x9c106e['id']);return Array['from'](_0x53d28f);}const Q=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */
|
|
24
|
+
_0x54b505(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x35f8ee,_0x311510,_0x36b8a1){super(),this['editor']=_0x35f8ee,this['textAdapter']=_0x311510,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x36b8a1,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x2770c1,_0x2bbf6c,_0x27c508)=>{this['view']['value']=this['_sanitizeHTML'](_0x27c508);}),this['listenTo'](this['view'],'submitPrompt',(_0x2fe452,_0x1235e1)=>{const _0xb38128=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1235e1,_0xb38128,'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:_0x263e9b,query:_0x2a424b,htmlContent:_0x4dc537,label:_0x1aca33,mainActionLabel:_0x342034}){this['view']['prompt']=_0x1aca33,this['view']['mainAction']=_0x342034,this['initialContext']=_0x4dc537,_0x2a424b&&(this['view']['isRendered']?this['_handleQuery'](_0x2a424b,_0x4dc537,_0x263e9b,_0x1aca33):this['view']['once']('render',()=>{this['_handleQuery'](_0x2a424b,_0x4dc537,_0x263e9b,_0x1aca33);}));}['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'](_0x1b549e,_0x15669c,_0x3b1008,_0x83a8ae){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x15669c,this['previousQuery']=_0x1b549e,this['previousLabel']=_0x83a8ae||_0x1b549e,this['previousActionId']=_0x3b1008,new Promise(_0x83d3d0=>{this['textAdapter']['makeRequest']({'query':_0x1b549e,'context':_0x15669c,'onData':_0x26d975=>{this['currentResponse']=_0x26d975,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x3b1008})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x2b3d9b=>{_0x2b3d9b instanceof R?this['view']['handleError'](_0x2b3d9b['message']):this['view']['handleError'](),_0x83d3d0();})['finally'](()=>{this['stopProcessing'](),_0x83d3d0();});});}['_parseAndNormalizeContent'](_0x5ef5aa,_0x1a6cc7=!0x1){const _0x76bbe8=Q['exec'](_0x5ef5aa);_0x5ef5aa=_0x76bbe8?_0x5ef5aa['substring'](_0x76bbe8[0x1]['length']):_0x5ef5aa['length']<0x64&&!_0x1a6cc7?'':this['_stripMarkdownSyntax'](_0x5ef5aa);const _0x4cb6ba=this['_domParser']['parseFromString'](_0x5ef5aa,'text/html');if(_0x76bbe8){const _0x1abc76=Array['from'](_0x4cb6ba['body']['childNodes']);_0x1abc76['reverse']();for(const _0x5e5ba6 of _0x1abc76){if(_0x5e5ba6['nodeType']==Node['ELEMENT_NODE'])break;_0x5e5ba6['remove']();}}const _0xa386ef=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x4cb6ba['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0xa386ef);const _0x9fe274=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x51558c=this['editor']['data']['toModel'](_0xa386ef);return _0x9fe274||_0x51558c['markers']['clear'](),this['editor']['data']['stringify'](_0x51558c);}['_normalizeResponseHeadings'](_0x269a09){const _0x1088ed=new _0x12a727(this['editor']['editing']['view']['document']),_0x210a4f=new _0x5447b3({'name':/^h[1-5]$/}),_0x49844e=[];let _0x461a73=!0x1;for(const _0x225422 of _0x269a09)_0x225422['is']('element')&&_0x210a4f['match'](_0x225422)&&(_0x49844e['push'](_0x225422),'h1'==_0x225422['name']&&(_0x461a73=!0x0));if(_0x461a73){for(const _0x116d38 of _0x49844e)_0x1088ed['rename']('h'+(parseInt(_0x116d38['name'][0x1])+0x1),_0x116d38);}}['_isH1TagSupportEnabled'](){const {data:_0xab0d56,editing:_0x14c192}=this['editor'],_0x43a831=_0xab0d56['htmlProcessor']['toView']('<h1></h1>'),_0x16461d=_0xab0d56['toView'](_0xab0d56['toModel'](_0x43a831));return!!_0x14c192['view']['domConverter']['viewToDom'](_0x16461d)['querySelector']('h1');}['_sanitizeHTML'](_0x1c7bf9){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x1c7bf9),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x5509b4){const _0x4a4ee3=_0x5509b4['trim']();return _0x4a4ee3['startsWith']('```html')?_0x4a4ee3['endsWith']('```')?_0x4a4ee3['substring'](0x7,_0x4a4ee3['length']-0x3):_0x4a4ee3['substring'](0x7):_0x5509b4;}}const _={'REPLACE':'replace','INSERT':'insert'};class at extends ot{constructor(_0x172486){super(_0x172486),this['set']('isVisible',!0x1),this['set']('mainAction',_['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x14fea7=>i(_0x172486,'AI_'+_0x14fea7['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x172486,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x172486,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x172486,'Stop'));const _0x223afa=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x223afa['if']('isVisible','ck-hidden',_0x18d179=>!_0x18d179)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x45cd86,_0x5e982c){const _0x4cb787=new _0x459498(this['locale']);return _0x4cb787['set']({'label':_0x45cd86,'class':_0x5e982c||'','isVisible':!0x0,'withText':!0x0}),_0x4cb787;}}class ct extends _0x133ec8{['contentFieldView'];['copyButtonView'];constructor(_0x642894,_0x299233=''){super(_0x642894),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x20bec7=this['bindTemplate'];this['contentFieldView']=new bt(_0x642894,_0x299233),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x20bec7['if']('isVisible','ck-hidden',_0x15e76a=>!_0x15e76a)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x20bec7['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 _0x339a42=!0x1;this['on']('change:value',(_0x4d9380,_0x2a9d7,_0x584f9a)=>{const _0x111f14=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x584f9a),this['isProcessing']&&_0x111f14&&!_0x339a42&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x2d2f56,_0x56c270,_0x276172)=>{_0x339a42=!0x1,_0x276172?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x339a42=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x339a42=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x567f5a=this['locale'],_0x51ac43=new _0x459498(this['locale']),_0x16d2a9='ck-ai-form__copy-button';return _0x51ac43['set']({'label':i(_0x567f5a,'Copy'),'icon':_0x3cc613,'class':_0x16d2a9,'tooltip':!0x0}),_0x51ac43['bind']('isVisible')['to'](this,'value',_0x256fe5=>!!_0x256fe5),_0x51ac43['bind']('isEnabled')['to'](this,'isProcessing',_0x24a191=>!_0x24a191),_0x51ac43['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x51ac43['icon']=_0x6b2964,_0x51ac43['class']=_0x16d2a9+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x51ac43['icon']=_0x3cc613,_0x51ac43['class']=_0x16d2a9;},0x3e8);}),_0x51ac43;}['_copyHTMLToClipboard'](_0x3ab735){const {window:_0x236b14,document:_0x13d3fe}=_0x43f39d;if(_0x236b14['ClipboardItem']){const {Blob:_0x17efe8,ClipboardItem:_0x21ff80}=_0x236b14,_0x288b38=[new _0x21ff80({'text/html':new _0x17efe8([_0x3ab735['innerHTML']],{'type':'text/html'}),'text/plain':new _0x17efe8([_0x3ab735['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x288b38);}else{const _0x12451a=_0x13d3fe['createElement']('div');_0x12451a['style']['position']='absolute',_0x12451a['style']['left']='-9999px',_0x12451a['innerHTML']='<span>[</span>'+_0x3ab735['innerHTML']+'<span>]</span>',_0x13d3fe['body']['appendChild'](_0x12451a);const _0x4e026b=_0x13d3fe['createRange']();_0x4e026b['setStartAfter'](_0x12451a['firstElementChild']),_0x4e026b['setEndBefore'](_0x12451a['lastElementChild']);const _0x480075=_0x236b14['getSelection']();_0x480075['removeAllRanges'](),_0x480075['addRange'](_0x4e026b),_0x13d3fe['execCommand']('copy'),_0x12451a['remove']();}}}class bt extends _0x133ec8{constructor(_0x18134f,_0x2a2e54=''){super(_0x18134f),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x2a2e54,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x2dc2b2){this['element']['innerHTML']=_0x2dc2b2;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x7199de=new _0x133ec8(),_0x727373=this['locale'],_0x11d8bf=new _0x1defc2();return _0x11d8bf['isVisible']=!0x0,_0x7199de['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x11d8bf,{'text':i(_0x727373,'AI\x20is\x20writing...')}]}),_0x7199de['render'](),_0x7199de;}}class mt extends _0x133ec8{constructor(_0x4fe2f6,_0xe82ead=''){super(_0x4fe2f6);const _0x5bc9e4=new _0x243c82(),_0x2620c5=this['bindTemplate'];this['set']('text',_0xe82ead),_0x5bc9e4['content']=_0x24a619,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5bc9e4,{'text':_0x2620c5['to']('text')}]});}}class lt extends st{['submitButtonView'];['showHistoryButtonView'];constructor(_0x53a8cb,_0xdc6644){super(_0x53a8cb,_0xdc6644),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',(_0x5b86d5,_0x2e9ebd)=>{_0x5b86d5['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2e9ebd());});}['_createSubmitButton'](){const _0x46e11b=new _0x459498(this['locale']),_0x1f2ca5=this['locale'];return _0x46e11b['set']({'icon':it,'label':i(_0x1f2ca5,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x46e11b['on']('execute',()=>{this['submit']();}),_0x46e11b['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x4cd95a,_0x319318)=>!_0x4cd95a&&_0x319318),_0x46e11b;}['_createShowHistoryButton'](){const _0x391ba1=new _0x459498(this['locale']),_0x485184=this['resultsView'],_0x27ca70=this['locale'];_0x391ba1['set']({'label':i(_0x27ca70,'History'),'withText':!0x1,'icon':tt,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x391ba1['bind']('isOn')['to'](_0x485184,'isVisible'),_0x391ba1['bind']('isEnabled')['to'](this,'isEnabled'),_0x391ba1['on']('execute',()=>{_0x485184['isVisible']=!_0x485184['isVisible'],_0x485184['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x4e29af=()=>{_0x43f39d['window']['requestAnimationFrame'](()=>{if(_0x2912f2(this['element'])){const _0x4e93d3=new _0x14a995(this['queryView']['fieldView']['element']),_0x30ad38=_0x4e93d3['width'],_0x18b800='rtl'===_0x27ca70['uiLanguageDirection']?'left':'right';_0x4e93d3['excludeScrollbarsAndBorders'](),_0x391ba1['element']['style'][_0x18b800]=_0x30ad38-_0x4e93d3['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x4e29af),this['on']('render',_0x4e29af),_0x391ba1;}['submit'](){const _0x265545=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x265545);}['focus'](_0xf0d1d1){-0x1===_0xf0d1d1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class pt extends yt{['historyGroupView'];['clearHistoryButton'];constructor(_0x3dcf5e){super(_0x3dcf5e),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ct(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x3dcf5e,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x30bafc=0x0;for(const _0x3df1d3 of this['items'])_0x30bafc+=_0x3df1d3['items']['length'];return{'resultsCount':_0x30bafc,'totalItemsCount':_0x30bafc};}['_createClearHistoryButton'](){const _0x262c7c=this['locale'],_0x4deaf2=new _0x459498(this['locale']);return _0x4deaf2['set']({'label':'('+i(_0x262c7c,'Clear')+')','withText':!0x0}),_0x4deaf2['on']('execute',()=>this['fire']('clearHistory')),_0x4deaf2;}}class ut extends xt{constructor(_0x4b2fc9){super();const _0xb286e1=new wt(),_0x4d0c8c=new _0x459498(this['locale'],_0xb286e1);this['children']['add'](_0x4d0c8c),_0x4d0c8c['set']({'label':_0x4b2fc9['prompt'],'withText':!0x0}),_0x4d0c8c['on']('execute',()=>{this['fire']('execute',{'value':kt(_0x4b2fc9['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class dt extends _0x31f308{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1d2506,_0x70bf64)=>{const _0xf29216=os(_0x70bf64['prompt']);for(const _0x210970 of this)if(_0x210970!=_0x70bf64&&os(_0x210970['prompt'])===_0xf29216){this['remove'](_0x210970);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x4cddd2=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x4cddd2));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x28c41c=>_0x28c41c)));}}function os(_0x2f6429){return _0x2f6429['toLowerCase']()['trim']();}class k extends _0x133ec8{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x5f2ebf,_0x2a7493,_0x5d53b8=''){super(_0x5f2ebf),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',_['REPLACE']),this['_promptHistory']=new dt(),this['errorView']=new mt(_0x5f2ebf),this['contentArea']=new ct(_0x5f2ebf,_0x5d53b8),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 et(),this['keystrokes']=new rt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new ht({'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 _0x2a503a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x2a7493],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x2a503a['if']('isError','ck-hidden',_0x332bd2=>!_0x332bd2)]},'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'](_0x790485=0x1){-0x1===_0x790485?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 _0x434fd1=this['locale'],_0x175353=new lt(_0x434fd1,{'queryView':{'label':i(_0x434fd1,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':nt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x434fd1,'Empty\x20history'),'secondary':i(_0x434fd1,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x175353['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x1cb0b1,_0x1e8df6)=>_0x1cb0b1&&!_0x1e8df6),this['listenTo'](_0x175353,'submit',(_0x2eaf4b,_0x215921)=>{this['prompt']=_0x215921;const _0x5f0911=ft(_0x215921);this['fire']('submitPrompt',_0x5f0911),_0x215921['trim']()&&this['_promptHistory']['add']({'prompt':_0x5f0911},0x0);},{'priority':'high'}),_0x175353;}['_createHistoryView'](){const _0x2568ac=new pt(this['locale']);return _0x2568ac['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](ut),_0x2568ac['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2568ac;}['_createToolbar'](){const _0x4af6f3=new at(this['locale']);return _0x4af6f3['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4ad3be,_0xdf1012,_0x3d58f2)=>_0x4ad3be&&!_0xdf1012&&!!_0x3d58f2),_0x4af6f3['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x4af6f3['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1d7b45,_0x2e4825,_0x409c2f)=>_0x1d7b45&&!_0x2e4825&&!!_0x409c2f),_0x4af6f3['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x4af6f3['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2c0ce6,_0x5d3d0a)=>_0x2c0ce6&&!_0x5d3d0a),_0x4af6f3['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x4af6f3['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x4af6f3['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x4af6f3;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x52504e=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x52504e,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x1d28d7){const _0x14823f=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x1d28d7||i(_0x14823f,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const l=globalThis['DataTransfer'];class n extends _0x2084de{['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[_0x1b19e1,a,x,_0x53561b];}constructor(_0x21dcda){super(_0x21dcda),_0x21dcda['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x21dcda['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x21dcda['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x21dcda['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x248870}=this;this['_aiAdapter']=_0x248870['plugins']['get'](x),this['_dialog']=_0x248870['plugins']['get'](_0x53561b),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x2d6cc1=new E(_0x248870,Array['from'](this['_commandDefinitions']['values']()));_0x248870['commands']['add']('showAIAssistant',_0x2d6cc1),_0x248870['ui']['componentFactory']['add']('aiCommands',_0x41bd43=>{const _0x2342c7=_0x2e82fb(_0x41bd43);return _0x2342c7['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x2342c7['buttonView']['set']({'label':i(_0x41bd43,'AI\x20Commands'),'icon':_0x367889,'tooltip':!0x0}),_0x2342c7['on']('execute',_0x382cb1=>this['_onExecute'](_0x382cb1['source']['id'])),_0x1210f7(_0x2342c7,_0x248870['ui']['view']['body'],function(_0x2cd9be){const _0x40cfd7=o(_0x2cd9be['config']['get']('ai.aiAssistant.commands'),_0x2cd9be['locale']),_0x1c0546=U(_0x2cd9be,_0x40cfd7)['filter'](_0x28887d=>_0x28887d['commands']['length']);if(0x1===_0x1c0546['length'])return U(_0x2cd9be,_0x1c0546[0x0]['commands'])['map'](_0x19bd31=>({'id':_0x19bd31['id'],'label':_0x19bd31['label']}));return _0x1c0546['map'](_0xce68e1=>{const {groupId:_0x2254e3,groupLabel:_0x2c693b,commands:_0x2de719}=_0xce68e1,_0x4bb8cc=U(_0x2cd9be,_0x2de719)['map'](_0x3c5777=>({'id':_0x3c5777['id'],'label':_0x3c5777['label']}));return{'id':_0x2254e3,'menu':_0x2c693b||_0x2254e3,'children':_0x4bb8cc};});}(_0x248870),{'ariaLabel':i(_0x41bd43,'AI\x20Commands')}),_0x2342c7['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x2d6cc1['on']('change:enabledCommandsIds',_0x3b3505),_0x2342c7['menuView']['once']('render',_0x3b3505),_0x2342c7;function _0x3b3505(){_0x2342c7['isEnabled']=_0x2d6cc1['enabledCommandsIds']['length']>0x0;for(const _0x3a74c1 of _0x2342c7['menuView']['buttons'])_0x3a74c1['isEnabled']=_0x2d6cc1['enabledCommandsIds']['includes'](_0x3a74c1['id']);}}),_0x248870['ui']['componentFactory']['add']('menuBar:aiCommands',_0x2fe5ab=>{const _0x1ccff7=new _0x1d5dc5(_0x2fe5ab);_0x1ccff7['buttonView']['set']({'label':i(_0x2fe5ab,'AI\x20Commands'),'icon':_0x367889}),_0x1ccff7['bind']('isEnabled')['to'](_0x2d6cc1,'enabledCommandsIds',_0x4c34b0=>_0x4c34b0['length']>0x0);const _0x5e5983=o(_0x248870['config']['get']('ai.aiAssistant.commands'),_0x2fe5ab);return this['_populateMenuBarMenu'](_0x2d6cc1,_0x1ccff7,_0x5e5983,_0x1782f8=>this['_onExecute'](_0x1782f8)),_0x1ccff7;}),_0x248870['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x23de32=this['_createAIAssistantUIButton'](_0x459498);return _0x23de32['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x23de32;}),_0x248870['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x4b6bf5=this['_createAIAssistantUIButton'](_0x4a4578);return _0x4b6bf5['set']({'role':'menuitemcheckbox'}),_0x4b6bf5;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x15ed7d=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3b4e23;for(const _0xe7d621 in _0x15ed7d){const _0x3903a2=_0xe7d621,_0x3681c8=_0x15ed7d[_0x3903a2];if('aiLicenseKeyValid'==_0x3681c8||'aiLicenseKeyInvalid'==_0x3681c8||'aiLicenseKeyExpired'==_0x3681c8||'aiLicenseKeyDomainLimit'==_0x3681c8||'aiLicenseKeyNotAllowed'==_0x3681c8||'aiLicenseKeyEvaluationLimit'==_0x3681c8||'aiLicenseKeyTrialLimit'==_0x3681c8||'aiLicenseKeyUsageLimit'==_0x3681c8){delete _0x15ed7d[_0x3903a2],_0x3b4e23=_0x3681c8,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x3b4e23&&_0x15ed7d['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x488716='',_0x582773='',_0x1bf545='custom'){const _0x3abd1b=this['editor'],_0x5eefbf=_0x3abd1b['editing']['view'],_0x278163=_0x3abd1b['plugins']['get'](a),_0xb2221c=_0x3abd1b['plugins']['get'](_0x1b19e1);_0x278163['showFakeVisualSelection']();const _0x56769c=new l(),_0x1cf35b=new ClipboardEvent('copy',{'clipboardData':_0x56769c}),_0x12a6d2=new _0x1c0f1e(_0x56769c),_0x440e62=new _0x4fd616(_0x5eefbf,_0x1cf35b,{'dataTransfer':_0x12a6d2});_0xb2221c['_forceMarkersCopy']('comment',()=>{_0x5eefbf['document']['fire']('copy',_0x440e62);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new j(_0x3abd1b,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x16435f=_0x12a6d2['getData']('text/html');const _0x16c7c8=_0x3abd1b['model']['document']['selection'],_0x43b0ee=Array['from'](_0x16c7c8['getRanges']());0x1===_0x43b0ee['length']&&_0x43b0ee[0x0]['isFlat']&&!_0x16c7c8['getSelectedElement']()&&''!==_0x16435f['replace'](/ /g,'')['trim']()&&(_0x16435f='<p>'+_0x16435f+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x1bf545,'query':_0x488716,'htmlContent':_0x16435f,'label':_0x582773,'mainActionLabel':_[_0x3abd1b['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x38f8ec,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x323db1['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x278163['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x15ea41=new Map(),_0x898b93=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x2b655c of _0x898b93)for(const _0x30a11d of _0x2b655c['commands'])_0x15ea41['set'](_0x30a11d['id'],{..._0x30a11d,'groupId':_0x2b655c['groupId'],'groupLabel':_0x2b655c['groupLabel']||_0x2b655c['groupId']});return _0x15ea41;}['_createAIAssistantUIButton'](_0x40b8c){const _0x231b02=this['editor'],_0x2dcddc=_0x231b02['commands']['get']('showAIAssistant'),_0x39889c=new _0x40b8c(_0x231b02['locale']);return _0x39889c['set']({'label':i(_0x231b02['locale'],'AI\x20Assistant'),'icon':_0x38f8ec,'isToggleable':!0x0}),_0x39889c['bind']('isEnabled')['to'](_0x2dcddc),_0x39889c['bind']('isOn')['to'](this['_dialog'],'id',_0x2be278=>'aiAssistant'===_0x2be278),this['listenTo'](_0x39889c,'execute',()=>{_0x39889c['isOn']?this['hideUI']():_0x2dcddc['execute']();}),_0x39889c;}['_initView'](){const _0x5395a1=this['editor']['plugins']['get'](a);this['_formView']=new k(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',()=>{_0x5395a1['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x5395a1['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x40f114,ui:{ariaLiveAnnouncer:_0x3f90ae}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x27a9de,_0x2d68e6,_0x5050ed)=>{const _0x5f26f8=this['_aiAssistantController']['currentContext'];_0x5050ed?_0x3f90ae['announce'](i(_0x40f114,'AI\x20is\x20writing')):_0x5f26f8&&_0x3f90ae['announce'](i(_0x40f114,'Generated\x20content:\x20%0',_0x5f26f8),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x3d67d6,_0xd1819,_0x2f3b59)=>{if(_0x2f3b59){const _0x5d23b8=this['_formView']['errorView']['text'];_0x3f90ae['announce'](i(_0x40f114,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5d23b8));}});}['_onExecute'](_0x4a1555){const _0x12bf37=this['_commandDefinitions']['get'](_0x4a1555),_0x28e0d0=this['editor'],_0x232d6=_0x28e0d0['model']['document']['selection'],_0x9816b=_0x28e0d0['commands']['get']('showAIAssistant'),_0x4be960=_0x28e0d0['plugins']['get'](a),_0x38b891=''+(_0x12bf37['groupId']!==K?_0x12bf37['groupLabel']+':\x20':'')+_0x12bf37['label'];if(!0x1!==_0x12bf37['requiresContent']&&_0x232d6['isCollapsed']){const _0xf0a455=_0x4ad56f(_0x232d6['getSelectedBlocks']())||_0x28e0d0['model']['schema']['getLimitElement'](_0x232d6);_0x28e0d0['model']['change'](_0x405cc4=>{_0x405cc4['setSelection'](_0xf0a455,'in');});}_0x4be960['showFakeVisualSelection'](),_0x9816b['execute'](_0x12bf37['prompt'],_0x38b891,'command:'+_0x4a1555);}['_populateMenuBarMenu'](_0x2ef0fd,_0x15910b,_0x448202,_0x319331){const _0x59c10b=this['editor'],_0x3e5230=_0x59c10b['locale'],_0x20d4ee=new _0x436615(_0x3e5230),_0x3b464c=U(_0x59c10b,_0x448202)['filter'](_0x464c26=>_0x464c26['commands']['length']);0x1===_0x3b464c['length']?this['_getMenuBarGroupButtons']({'command':_0x2ef0fd,'commands':_0x3b464c[0x0]['commands'],'parentMenuView':_0x15910b,'onExecute':_0x319331})['forEach'](_0x898c98=>_0x20d4ee['items']['add'](_0x898c98)):_0x3b464c['forEach'](({groupId:_0xe50b5c,groupLabel:_0x1e30d3,commands:_0x372895})=>{const _0x46947f=new _0x423d37(_0x3e5230,_0x15910b),_0x928a5d=new _0x1d5dc5(_0x3e5230),_0x295242=new _0x436615(_0x3e5230),_0x1380d7=this['_getMenuBarGroupButtons']({'command':_0x2ef0fd,'commands':_0x372895,'parentMenuView':_0x928a5d,'onExecute':_0x319331});_0x928a5d['buttonView']['set']({'label':_0x1e30d3||_0xe50b5c}),_0x928a5d['delegate']('execute')['to'](_0x15910b),_0x295242['items']['addMany'](_0x1380d7),_0x928a5d['panelView']['children']['add'](_0x295242),_0x46947f['children']['add'](_0x928a5d),_0x20d4ee['items']['add'](_0x46947f);}),_0x15910b['panelView']['children']['add'](_0x20d4ee);}['_getMenuBarGroupButtons']({command:_0x475c5b,commands:_0x18cf8e,parentMenuView:_0x2c7b53,onExecute:_0x417ba6}){const _0x17d313=this['editor'],_0x2ba52=_0x17d313['locale'];return U(_0x17d313,_0x18cf8e)['map'](_0x7de35d=>{const _0x1cfbae=new _0x423d37(_0x2ba52,_0x2c7b53),_0x4a24d3=new _0x4a4578(_0x2ba52);return _0x4a24d3['set']({'label':_0x7de35d['label']}),_0x4a24d3['delegate']('execute')['to'](_0x2c7b53),_0x4a24d3['on']('execute',()=>_0x417ba6(_0x7de35d['id'])),_0x4a24d3['bind']('isEnabled')['to'](_0x475c5b,'enabledCommandsIds',_0x266039=>_0x266039['includes'](_0x7de35d['id'])),_0x1cfbae['children']['add'](_0x4a24d3),_0x1cfbae;});}}function T(_0xa64716,_0x4e38f8){return void 0x0!==_0xa64716['order']&&void 0x0===_0x4e38f8['order']?0x1:void 0x0===_0xa64716['order']&&void 0x0!==_0x4e38f8['order']?-0x1:void 0x0!==_0xa64716['order']&&void 0x0!==_0x4e38f8['order']?_0xa64716['order']-_0x4e38f8['order']:0x0;}function U(_0x362cff,_0x4ca829){_0x4ca829['sort'](T);const _0x53abc5={},_0x190d7e=[];for(const _0x41daca of _0x4ca829)if(void 0x0!==_0x41daca['order']){if(_0x41daca['order']in _0x53abc5)throw new _0x2fb82f('ai-commands-config-order-collision',_0x362cff,{'conflictingDefinitions':[_0x41daca,_0x53abc5[_0x41daca['order']]]});_0x53abc5[_0x41daca['order']]=_0x41daca,_0x190d7e['splice'](_0x41daca['order'],0x0,_0x41daca);}else _0x190d7e['push'](_0x41daca);return _0x190d7e;}class At extends _0x2084de{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbe216c){super(_0xbe216c);const _0x4a173c=_0xbe216c['config'],_0x36fa6c=_0xbe216c['locale'];_0x4a173c['define']('ai.aiAssistant.preserveComments',!0x0),_0x4a173c['define']('ai.aiAssistant.commands',_t(_0x36fa6c)),_0x4a173c['define']('ai.aiAssistant.extraCommandGroups',[]),_0x4a173c['define']('ai.aiAssistant.removeCommands',[]);let _0x46d020=o(_0x4a173c['get']('ai.aiAssistant.commands'),_0x36fa6c);const _0x267445=_0x4a173c['get']('ai.aiAssistant.extraCommandGroups'),_0x3b96dd=_0x4a173c['get']('ai.aiAssistant.removeCommands');_0x267445['forEach'](_0x3be484=>{const _0xb8f988=_0x46d020['find'](_0x1361e6=>_0x1361e6['groupId']===_0x3be484['groupId']);_0xb8f988?_0xb8f988['commands']=_0xb8f988['commands']['concat'](_0x3be484['commands']):_0x46d020['push'](_0x3be484);}),_0x46d020=_0x46d020['filter'](_0x156928=>!_0x3b96dd['includes'](_0x156928['groupId'])),_0x46d020['forEach'](_0x2e9be4=>{_0x2e9be4['commands']=_0x2e9be4['commands']['filter'](_0x5bc76e=>!_0x3b96dd['includes'](_0x5bc76e['id']));}),_0x4a173c['set']('ai.aiAssistant.commands',_0x46d020);}}function _t(_0x2a65d1){return[{'groupId':'editOrReview','groupLabel':i(_0x2a65d1,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x2a65d1,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x2a65d1,'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(_0x2a65d1,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x2a65d1,'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(_0x2a65d1,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x2a65d1,'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(_0x2a65d1,'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(_0x2a65d1,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x2a65d1,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x2a65d1,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x2a65d1,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x2a65d1,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x2a65d1,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x2a65d1,'Change\x20style'),'commands':[{'id':'business','label':i(_0x2a65d1,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x2a65d1,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x2a65d1,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x2a65d1,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x2a65d1,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x2a65d1,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x2a65d1,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x2a65d1,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x2a65d1,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x2a65d1,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x2a65d1,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x2a65d1,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x2a65d1,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class S extends _0x2084de{['abortController'];static get['requires'](){return[x];}constructor(_0x434c69){super(_0x434c69),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](x)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x4cfaea){return this['sendRequest'](_0x4cfaea)['catch'](_0x4836af=>{if(_0x4836af instanceof R)return Promise['reject'](_0x4836af);if('AbortError'==_0x4836af['name'])return Promise['resolve']();throw console['error'](_0x4836af),new _0x2fb82f('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x7d5114,_0x1fbd2a){const _0x5c7df2=this['editor']['locale'],_0x45f205={'Content-Type':'application/json'};if('object'==typeof _0x7d5114)Object['assign'](_0x45f205,_0x7d5114);else{if(_0x7d5114)try{const _0x1333fd=await _0x7d5114(_0x1fbd2a);Object['assign'](_0x45f205,_0x1333fd);}catch{return Promise['reject'](new R(i(_0x5c7df2,'AI_ERROR_GET_HEADERS')));}}return _0x45f205;}async['_prepareRequestParameters'](_0x342e07,_0x38c825){const _0x4b1052=this['editor']['locale'];if('object'==typeof _0x342e07)return _0x342e07;try{return await _0x342e07(_0x38c825);}catch{return Promise['reject'](new R(i(_0x4b1052,'AI_ERROR_GET_PARAMETERS')));}}}class It extends S{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x3ad5bf){super(_0x3ad5bf),_0x3ad5bf['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x3ad5bf['config']['get']('ai.openAI.requestParameters')||_0x3ad5bf['config']['define']('ai.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x3ad5bf['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x3ad5bf['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x3ad5bf['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0xef5921,context:_0x28d6e9,onData:_0x14f204,actionId:_0x2d85b0}){const _0x136031=this['editor']['locale'],_0x2ac712=await this['prepareMessages'](_0xef5921,_0x28d6e9,_0x2d85b0),_0x137921=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x2d85b0),_0x4c73f9=await this['_prepareRequestParameters'](this['_requestParameters'],_0x2d85b0),_0x26a725={'messages':_0x2ac712,..._0x4c73f9},_0x27191f={'method':'POST','headers':_0x137921,'body':JSON['stringify'](_0x26a725),'signal':this['abortController']['signal']},_0x171423=await fetch(this['_apiUrl'],_0x27191f);if(_0x171423['ok'])return _0x4c73f9['stream']?await this['_readStreamableResponse'](_0x171423,_0x14f204):await this['_readStaticResponse'](_0x171423,_0x14f204),Promise['resolve']();{const _0x28794e=await _0x171423['text']();return _0x28794e['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x136031,'AI_ERROR_CONTEXT_LENGTH'))):_0x28794e['includes']('Moderation')?Promise['reject'](new R(i(_0x136031,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x28794e));}}async['prepareMessages'](_0x56cd80,_0x1b0105,_0x248429){let _0x307826,_0x5ac575;return _0x1b0105?(_0x307826='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.',_0x5ac575='Instruction:\x0a'+_0x56cd80+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x1b0105):(_0x307826='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.',_0x5ac575=_0x56cd80),[{'role':'system','content':_0x307826},{'role':'user','content':_0x5ac575}];}async['_readStreamableResponse'](_0x29759a,_0xad5aec){const _0x11b572=_0x29759a['body']['getReader'](),_0x27419c=new TextDecoder();let _0x5ebad6='',_0x132a8e='',_0x5a436e='',_0x4a656c=!0x1;for(;!_0x4a656c;){const {done:_0x40ae98,value:_0x4890dd}=await _0x11b572['read'](),_0x58aba8=_0x5ebad6+_0x27419c['decode'](_0x4890dd);let _0x13332a='';_0x4a656c=_0x40ae98;try{_0x13332a=this['_cleanUpData'](_0x58aba8),_0x5ebad6='';}catch{_0x5ebad6=_0x58aba8;continue;}_0x132a8e+=_0x13332a,!_0x4a656c&&this['_isBufferIncomplete'](_0x132a8e)||_0x132a8e&&(_0x5a436e+=_0x132a8e,_0x132a8e='',_0xad5aec(_0x5a436e));}return Promise['resolve']();}async['_readStaticResponse'](_0x437409,_0x109746){return _0x109746((await _0x437409['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x5f5107){const _0x554c04=_0x5f5107['split']('<')['length']!==_0x5f5107['split']('>')['length'],_0x4282e7=_0x5f5107['length']<0x1e;return _0x554c04&&_0x4282e7;}['_cleanUpData'](_0x17c7e3){return _0x17c7e3['split'](/\n(?![^{]*\})/g)['map'](_0x3562d5=>_0x3562d5['replace']('data:\x20',''))['filter'](_0x4f852a=>_0x4f852a&&_0x4f852a['length']>0x0&&'[DONE]'!==_0x4f852a)['map'](_0x46bdda=>{const {choices:_0x4447c7}=JSON['parse'](_0x46bdda);if(_0x4447c7[0x0]?.['delta']?.['content'])return _0x4447c7[0x0]['delta']['content'];})['filter'](_0x575741=>_0x575741)['join']('');}}class Et extends S{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x2359c0){super(_0x2359c0),_0x2359c0['config']['get']('ai.aws.requestParameters')||_0x2359c0['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']=_0x2359c0['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x2359c0['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x2359c0['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x2359c0['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x577482,context:_0x3521f3,onData:_0x4a8196,actionId:_0x168648}){const {model:_0x30d043,stream:_0x1b9de0,..._0x838602}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x168648),_0x4429b4={'prompt':await this['preparePrompt'](_0x577482,_0x3521f3,_0x30d043,_0x168648),..._0x838602};this['_apiUrl']?await this['_processProxyRequest'](_0x4429b4,_0x30d043,_0x1b9de0,_0x4a8196,_0x168648):await this['_processAWSRequest'](_0x4429b4,_0x30d043,_0x1b9de0,_0x4a8196);}async['preparePrompt'](_0x46ef13,_0x3431c6,_0x38804a,_0x5b4698){let _0x29f67f,_0x11b5b2;return _0x3431c6?(_0x29f67f='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.',_0x11b5b2='Instruction:\x0a'+_0x46ef13+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3431c6):(_0x29f67f='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.',_0x11b5b2=_0x46ef13),'meta.llama'==this['getModelFamily'](_0x38804a)?'<<SYS>>\x0a'+_0x29f67f+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x11b5b2+'\x0a[/INST]':'Human:\x0a'+_0x29f67f+'\x0a'+_0x11b5b2+'\x0a\x0aAssistant:';}['getModelFamily'](_0x4116ca){if(/^anthropic\.claude/['test'](_0x4116ca))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x4116ca))return'ai21.j2';if(/^cohere\.command/['test'](_0x4116ca))return'cohere.command';if(/^meta\.llama/['test'](_0x4116ca))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x4116ca));}async['_processProxyRequest'](_0x1a6e59,_0x40da0d,_0x359d58,_0x3bdd97,_0x166431){const _0x8e28e5={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x166431),'body':JSON['stringify']({..._0x1a6e59,'model':_0x40da0d,'stream':_0x359d58}),'signal':this['abortController']['signal']},_0x531ded=await fetch(this['_apiUrl'],_0x8e28e5);_0x359d58?await this['_readStreamableResponse'](_0x531ded,_0x40da0d,_0x3bdd97):await this['_readStaticResponse'](_0x531ded,_0x40da0d,_0x3bdd97);}async['_processAWSRequest'](_0x38f1ec,_0x3a4027,_0xddbd3d,_0x1cccca){const _0xc6c11a=new _0x501e7f(this['_bedrockClientConfig']),_0x6cfd5b={'body':JSON['stringify'](_0x38f1ec),'contentType':'application/json','accept':'application/json','modelId':_0x3a4027};let _0x55ba7b;if(_0xddbd3d){const _0x4a587f=new _0x1f8225(_0x6cfd5b);_0x55ba7b=await _0xc6c11a['send'](_0x4a587f,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x55ba7b,_0x3a4027,_0x1cccca);}else{const _0x5291ea=new _0x29e835(_0x6cfd5b);_0x55ba7b=await _0xc6c11a['send'](_0x5291ea,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x55ba7b,_0x3a4027,_0x1cccca);}}async['_readAsyncIterableResponse'](_0x36c234,_0x1f9ad6,_0x5186ae){const _0x19e0b5=_0x36c234['body'],_0x5c5d0c=new TextDecoder('utf-8');let _0x521aca='';for await(const _0x2b6479 of _0x19e0b5)if(_0x2b6479['chunk']){const _0x2e17f5=_0x5c5d0c['decode'](_0x2b6479['chunk']['bytes']),_0x4223e9=JSON['parse'](_0x2e17f5);_0x521aca+=this['_getGeneratedText'](_0x4223e9,_0x1f9ad6),_0x5186ae(_0x521aca);}return Promise['resolve']();}async['_readStreamableResponse'](_0x258646,_0x106f15,_0x4007cb){const _0x2d37e3=_0x258646['body'],_0x5a0c07=new TextDecoder('utf-8'),_0x9526b3=_0x2d37e3['getReader']();let _0x47b030='',_0x423b8a='',_0x39830d=!0x1;for(;!_0x39830d;){const {done:_0x9e4cab,value:_0x4fb679}=await _0x9526b3['read']();if(_0x39830d=_0x9e4cab,_0x39830d)break;const _0x2cdf81=(_0x47b030+_0x5a0c07['decode'](_0x4fb679))['split']('\x0a')['map'](_0x5acd01=>{try{return _0x47b030='',JSON['parse'](_0x5acd01);}catch{return _0x47b030=_0x5acd01,null;}})['filter'](_0x206cff=>null!==_0x206cff);_0x2cdf81['length']&&(_0x423b8a+=_0x2cdf81['map'](_0x3b1f48=>this['_getGeneratedText'](_0x3b1f48,_0x106f15))['join'](''),_0x4007cb(_0x423b8a));}return Promise['resolve']();}async['_readStaticResponse'](_0x2bb9f6,_0x4f6f96,_0x5d1fc0){let _0x26bc44;return _0x26bc44=_0x2bb9f6 instanceof Response?await _0x2bb9f6['json']():JSON['parse'](new TextDecoder('utf-8')['decode'](_0x2bb9f6['body'])),(_0x5d1fc0(this['_getGeneratedText'](_0x26bc44,_0x4f6f96)),Promise['resolve']());}['_getGeneratedText'](_0x2aec11,_0x354872){switch(this['getModelFamily'](_0x354872)){case'anthropic.claude':return _0x2aec11['completion'];case'ai21.j2':return _0x2aec11['completions'][0x0]['data']['text'];case'cohere.command':return _0x2aec11['generations'][0x0]['text'];case'meta.llama':return _0x2aec11['generation'];}}}export{x as AIAdapter,At as AIAssistant,n as AIAssistantUI,R as AIRequestError,S as AITextAdapter,Et as AWSTextAdapter,It as OpenAITextAdapter,E as ShowAIAssistantCommand,_t as getDefaultAICommands};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ai",
|
|
3
|
-
"version": "46.0.0-alpha.
|
|
3
|
+
"version": "46.0.0-alpha.8",
|
|
4
4
|
"description": "AI Assistant feature for CKEditor 5.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@aws-sdk/client-bedrock-runtime": "3.823.0",
|
|
32
|
-
"@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.
|
|
33
|
-
"@ckeditor/ckeditor5-core": "46.0.0-alpha.
|
|
34
|
-
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.
|
|
35
|
-
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.
|
|
36
|
-
"@ckeditor/ckeditor5-table": "46.0.0-alpha.
|
|
37
|
-
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.
|
|
38
|
-
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.
|
|
39
|
-
"ckeditor5": "46.0.0-alpha.
|
|
32
|
+
"@ckeditor/ckeditor5-clipboard": "46.0.0-alpha.8",
|
|
33
|
+
"@ckeditor/ckeditor5-core": "46.0.0-alpha.8",
|
|
34
|
+
"@ckeditor/ckeditor5-engine": "46.0.0-alpha.8",
|
|
35
|
+
"@ckeditor/ckeditor5-icons": "46.0.0-alpha.8",
|
|
36
|
+
"@ckeditor/ckeditor5-table": "46.0.0-alpha.8",
|
|
37
|
+
"@ckeditor/ckeditor5-ui": "46.0.0-alpha.8",
|
|
38
|
+
"@ckeditor/ckeditor5-utils": "46.0.0-alpha.8",
|
|
39
|
+
"ckeditor5": "46.0.0-alpha.8",
|
|
40
40
|
"es-toolkit": "1.39.5"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|