@ckeditor/ckeditor5-ai 46.0.1-alpha.0 → 46.0.1-alpha.1
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 _0x229599,Command as _0x5ef009}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x52d84e,IconCheck as _0x34aa88,IconError as _0x136f15,IconSubmit as it,IconHistory as tt,IconMagicWand as _0x1763b6,IconRobotPencil as _0x4c2773}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x45b22a,CKEditorError as _0x4853ec,ObservableMixin as _0x1fca45,global as _0x3b0b8,isVisible as _0x556e7e,Rect as _0x26ebfa,Collection as _0x4a2166,FocusTracker as et,KeystrokeHandler as rt,first as _0xa95bf}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as ot,ButtonView as _0x451bcf,View as _0x3edbc3,SpinnerView as _0x4b67f5,IconView as _0x22adfe,AutocompleteView as st,ListView as yt,ListItemGroupView as Ct,ListItemView as xt,ButtonLabelView as wt,FocusCycler as ht,createLabeledTextarea as nt,Dialog as _0x380b7d,createDropdown as _0x58c081,addMenuToDropdown as _0x1156b2,MenuBarMenuView as _0x3f8494,MenuBarMenuListItemButtonView as _0x4bb7ac,DialogViewPosition as _0x1b757b,MenuBarMenuListView as _0x5c77e6,MenuBarMenuListItemView as _0x1ffa5c}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x2ea3da,ClipboardMarkersUtils as _0x52718a}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x3cd63,ViewDataTransfer as _0x1ad6a4,ViewUpcastWriter as _0x667fee,Matcher as _0x1cc8f3}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as kt,escape as ft}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x491405,InvokeModelWithResponseStreamCommand as _0x16efbc,InvokeModelCommand as _0x27592f}from'@aws-sdk/client-bedrock-runtime';const K='_ungrouppedCommands';function o(_0x339a36,_0x21d676){const _0x4850e1=(0x0,_0x21d676['t'])('Other');return _0x339a36['length']?'groupId'in _0x339a36[0x0]?_0x339a36:[{'groupId':K,'groupLabel':_0x4850e1,'order':0x1/0x0,'commands':_0x339a36}]:[{'groupId':K,'groupLabel':_0x4850e1,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],w='ai-ui';class a extends _0x229599{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x2eb756}=this,_0x402eab=['ck-fake-ai-selection'];_0x2eb756['config']['get']('ai.useTheme')&&_0x402eab['push']('ck-ai-assistant-ui_theme'),_0x2eb756['conversion']['for']('editingDowncast')['markerToHighlight']({'model':w,'view':{'classes':_0x402eab,'priority':0xc}}),_0x2eb756['conversion']['for']('editingDowncast')['markerToElement']({'model':w,'view':(_0x4fd686,{writer:_0x56e3ff})=>{if(!_0x4fd686['markerRange']['isCollapsed'])return null;const _0x38ef76=_0x56e3ff['createUIElement']('span');return _0x56e3ff['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x38ef76),_0x38ef76;}});}['afterInit'](){!async function(_0x43ac02){const _0x4a444b=_0x26773e([0x4d,0x52,0x6d,0x47,0x6a,0x4b,0x34,0x32,0x51,0x6e,0x63,0x4f,0x67,0x43,0x39,0x7a,0x46,0x65,0x61,0x38,0x64,0x41,0x49,0x6f,0x4a,0x35,0x6b,0x56,0x75,0x37,0x79,0x73,0x54,0x4e,0x44,0x62,0x36,0x78,0x70,0x48,0x45,0x55,0x57,0x76,0x58,0x31,0x5a,0x6c,0x42,0x69,0x30,0x53,0x74,0x77,0x50,0x59,0x66,0x4c,0x68,0x33,0x71,0x72]),_0x228025=0x415b3ba1,_0x5e44c6=0x415c54a9^_0x228025,_0x46b539=window[_0x26773e([0x44,0x61,0x74,0x65])][_0x26773e([0x6e,0x6f,0x77])](),_0x45b8c8=_0x43ac02[_0x26773e([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x3562d2=new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x38c951=>{_0x45b8c8[_0x26773e([0x6f,0x6e,0x63,0x65])](_0x26773e([0x72,0x65,0x61,0x64,0x79]),_0x38c951);}),_0x398e96={[_0x26773e([0x6b,0x74,0x79])]:_0x26773e([0x45,0x43]),[_0x26773e([0x75,0x73,0x65])]:_0x26773e([0x73,0x69,0x67]),[_0x26773e([0x63,0x72,0x76])]:_0x26773e([0x50,0x2d,0x32,0x35,0x36]),[_0x26773e([0x78])]:_0x26773e([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]),[_0x26773e([0x79])]:_0x26773e([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]),[_0x26773e([0x61,0x6c,0x67])]:_0x26773e([0x45,0x53,0x32,0x35,0x36])},_0x7fdaac=_0x45b8c8[_0x26773e([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x26773e([0x67,0x65,0x74])](_0x26773e([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x51555a(){let _0x2110bd,_0x4b982a=null,_0x5869a9=null;try{if(_0x7fdaac==_0x26773e([0x47,0x50,0x4c]))return _0x26773e([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x2110bd=_0x2507ac(),!_0x2110bd)return _0x26773e([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x2110bd[_0x26773e([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x5869a9=_0x14a1bf(_0x2110bd[_0x26773e([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x2110bd[_0x26773e([0x6a,0x74,0x69])])),await _0x9fc471()?_0x377205()?_0x436170()?_0x26773e([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x570a0a()?(_0x2110bd[_0x26773e([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x26773e([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x4b982a=_0x57ef37(_0x26773e([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x2110bd[_0x26773e([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x26773e([0x74,0x72,0x69,0x61,0x6c])&&(_0x4b982a=_0x57ef37(_0x26773e([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x41ec5a()):_0x26773e([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x26773e([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x26773e([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x26773e([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x436170(){const _0x45019e=[_0x26773e([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x26773e([0x74,0x72,0x69,0x61,0x6c])][_0x26773e([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2110bd[_0x26773e([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x46b539/0x3e8:0xe10*_0x5e44c6;return _0x2110bd[_0x26773e([0x65,0x78,0x70])]<_0x45019e;}function _0x377205(){const _0x16f2a4=_0x2110bd[_0x26773e([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x16f2a4&&(!!_0x16f2a4[_0x26773e([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26773e([0x2a]))||!!_0x16f2a4[_0x26773e([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26773e([0x41,0x49])));}function _0x570a0a(){const _0x1d4ace=_0x2110bd[_0x26773e([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x1d4ace||0x0==_0x1d4ace[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x3d98df}=new URL(window[_0x26773e([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x1d4ace[_0x26773e([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3d98df))return!0x0;const _0x7bfa73=_0x3d98df[_0x26773e([0x73,0x70,0x6c,0x69,0x74])](_0x26773e([0x2e]));return _0x1d4ace[_0x26773e([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x16627a=>_0x16627a[_0x26773e([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x26773e([0x2a])))[_0x26773e([0x6d,0x61,0x70])](_0x1fdc1e=>_0x1fdc1e[_0x26773e([0x73,0x70,0x6c,0x69,0x74])](_0x26773e([0x2e])))[_0x26773e([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x16d3ef=>_0x16d3ef[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x7bfa73[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x26773e([0x6d,0x61,0x70])](_0x56319f=>Array(_0x7bfa73[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x56319f[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x26773e([0x66,0x69,0x6c,0x6c])](_0x56319f[0x0]===_0x26773e([0x2a])?_0x26773e([0x2a]):'')[_0x26773e([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x56319f))[_0x26773e([0x73,0x6f,0x6d,0x65])](_0xce4618=>_0x7bfa73[_0x26773e([0x65,0x76,0x65,0x72,0x79])]((_0x5d0e95,_0x46efa6)=>_0xce4618[_0x46efa6]===_0x5d0e95||_0xce4618[_0x46efa6]===_0x26773e([0x2a])));}function _0x41ec5a(){return _0x4b982a&&_0x5869a9?new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x23de1d,_0x2717ed)=>{_0x4b982a[_0x26773e([0x74,0x68,0x65,0x6e])](_0x23de1d,_0x2717ed),_0x5869a9[_0x26773e([0x74,0x68,0x65,0x6e])](_0x55566a=>{_0x55566a!=_0x26773e([0x56,0x61,0x6c,0x69,0x64])&&_0x23de1d(_0x55566a);},_0x2717ed);}):_0x4b982a||_0x5869a9||_0x26773e([0x56,0x61,0x6c,0x69,0x64]);}}function _0x14a1bf(_0x3beeff,_0x234b3d){return new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x17504c=>{if(_0x2ec656())return _0x17504c(_0x26773e([0x56,0x61,0x6c,0x69,0x64]));_0xbe13a4(),_0x45b8c8[_0x26773e([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x26773e([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x14fc8b=!0x1;const _0x1c928e=_0x45b22a();function _0x1930aa(_0x13aec5){return!!_0x13aec5&&(typeof _0x13aec5===_0x26773e([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x13aec5===_0x26773e([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x13aec5[_0x26773e([0x74,0x68,0x65,0x6e])]===_0x26773e([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x13aec5[_0x26773e([0x63,0x61,0x74,0x63,0x68])]===_0x26773e([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x429552(_0x1948f6){_0x40a6ab(_0x1948f6)[_0x26773e([0x74,0x68,0x65,0x6e])](_0x3567a5=>{if(!_0x3567a5||_0x3567a5[_0x26773e([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x26773e([0x6f,0x6b]))return _0x26773e([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x3edfbc(_0x4e29ec(_0x1c928e+_0x234b3d))!=_0x3567a5[_0x26773e([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x26773e([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x26773e([0x56,0x61,0x6c,0x69,0x64]);})[_0x26773e([0x74,0x68,0x65,0x6e])](_0x159460=>(_0xfc2641(),_0x159460),()=>{const _0x39196b=_0x414007();return null==_0x39196b?(_0xfc2641(),_0x26773e([0x56,0x61,0x6c,0x69,0x64])):_0x26773e(_0x46b539-_0x39196b>(0x6557bfa1^_0x228025)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x26773e([0x74,0x68,0x65,0x6e])](_0x17504c)[_0x26773e([0x63,0x61,0x74,0x63,0x68])](()=>{_0x17504c(_0x26773e([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1e5d50=0x416dd521^_0x228025;function _0xfc2641(){const _0x4ae625=_0x26773e([0x6c,0x6c,0x63,0x74,0x2d])+_0x3edfbc(_0x4e29ec(_0x3beeff)),_0x46f56c=_0x3b1c60(_0x3edfbc(window[_0x26773e([0x4d,0x61,0x74,0x68])][_0x26773e([0x63,0x65,0x69,0x6c])](_0x46b539/_0x1e5d50)));window[_0x26773e([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x26773e([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x4ae625,_0x46f56c);}function _0x414007(){const _0x3fa275=_0x26773e([0x6c,0x6c,0x63,0x74,0x2d])+_0x3edfbc(_0x4e29ec(_0x3beeff)),_0x3a1f60=window[_0x26773e([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x26773e([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x3fa275);return _0x3a1f60?window[_0x26773e([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3b1c60(_0x3a1f60),0x10)*_0x1e5d50:null;}function _0x40a6ab(_0x3c7e65){return new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x3395e4,_0x5c3aa1)=>{_0x3c7e65[_0x26773e([0x74,0x68,0x65,0x6e])](_0x3395e4,_0x5c3aa1),window[_0x26773e([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x5c3aa1,0x415aef61^_0x228025);});}}_0x45b8c8[_0x26773e([0x6f,0x6e])](_0x26773e([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x428ab3,_0x4785e7)=>{if(_0x4785e7[0x0]!=_0x3beeff)return _0x17504c(_0x26773e([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x4785e7[0x1]={..._0x4785e7[0x1],[_0x26773e([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x1c928e};},{[_0x26773e([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x26773e([0x68,0x69,0x67,0x68])}),_0x45b8c8[_0x26773e([0x6f,0x6e])](_0x26773e([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x268282=>{_0x1930aa(_0x268282[_0x26773e([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x14fc8b=!0x0,_0x429552(_0x268282[_0x26773e([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x26773e([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x26773e([0x6c,0x6f,0x77])}),_0x3562d2[_0x26773e([0x74,0x68,0x65,0x6e])](()=>{_0x14fc8b||_0x17504c(_0x26773e([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x2ec656(){return _0x45b8c8[_0x26773e([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x26773e([0x76,0x69,0x65,0x77])][_0x26773e([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x26773e([0x61,0x75,0x74,0x6f]);}function _0xbe13a4(){_0x45b8c8[_0x26773e([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x26773e([0x76,0x69,0x65,0x77])][_0x26773e([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x26773e([0x61,0x75,0x74,0x6f]);}}function _0x57ef37(_0x37c97b){const _0x314bb6=[new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4c4e35=>setTimeout(_0x4c4e35,0x4152056d^_0x228025)),_0x3562d2[_0x26773e([0x74,0x68,0x65,0x6e])](()=>new window[(_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x31731e=>{let _0xccadb9=0x0;_0x45b8c8[_0x26773e([0x6d,0x6f,0x64,0x65,0x6c])][_0x26773e([0x6f,0x6e])](_0x26773e([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0xe873c8,_0x160c7f)=>{_0x160c7f[0x0][_0x26773e([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0xccadb9++,_0xccadb9==(0x415b3a59^_0x228025)&&(_0x31731e(),_0xe873c8[_0x26773e([0x6f,0x66,0x66])]());});}))];return window[_0x26773e([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x26773e([0x72,0x61,0x63,0x65])](_0x314bb6)[_0x26773e([0x74,0x68,0x65,0x6e])](()=>_0x37c97b);}async function _0x2f5d71(){await _0x3562d2,_0x45b8c8[_0x26773e([0x6d,0x6f,0x64,0x65,0x6c])][_0x26773e([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1b1501,_0x45b8c8[_0x26773e([0x6d,0x6f,0x64,0x65,0x6c])][_0x26773e([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1b1501,_0x45b8c8[_0x26773e([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x26773e([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x399517(_0x15cfc3){const _0xef0b7a=_0x399e8f();_0x45b8c8[_0xef0b7a]=_0x26773e([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x15cfc3,_0x15cfc3!=_0x26773e([0x56,0x61,0x6c,0x69,0x64])&&_0x2f5d71();}function _0x399e8f(){const _0x312ffd=window[_0x26773e([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x26773e([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x26773e([0x6e,0x6f,0x77])]())[_0x26773e([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x26773e([0x2e]),'');let _0x47ac49=_0x26773e([0x4d]);for(let _0x1460a9=0x0;_0x1460a9<_0x312ffd[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x1460a9+=0x2){let _0x4ec10a=window[_0x26773e([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x312ffd[_0x26773e([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x1460a9,_0x1460a9+0x2));_0x4ec10a>=_0x4a444b[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x4ec10a-=_0x4a444b[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x47ac49+=_0x4a444b[_0x4ec10a];}return _0x47ac49;}function _0x2507ac(){const _0x35d17e=_0x7fdaac[_0x26773e([0x73,0x70,0x6c,0x69,0x74])](_0x26773e([0x2e]));if(0x3!=_0x35d17e[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x540f61(_0x35d17e[0x1]);function _0x540f61(_0x361515){const _0x56915d=_0x3579e2(_0x361515);return _0x56915d&&_0x5b12f4()?_0x56915d:null;function _0x5b12f4(){const _0x3cc2c5=_0x56915d[_0x26773e([0x6a,0x74,0x69])],_0x3e8015=window[_0x26773e([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3cc2c5[_0x26773e([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x3cc2c5[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x82652e={..._0x56915d,[_0x26773e([0x6a,0x74,0x69])]:_0x3cc2c5[_0x26773e([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x3cc2c5[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x82652e[_0x26773e([0x76,0x63])],_0x4e29ec(_0x82652e)==_0x3e8015;}}}async function _0x9fc471(){let _0x299bcb=!0x0;try{const _0x3743c5=_0x7fdaac[_0x26773e([0x73,0x70,0x6c,0x69,0x74])](_0x26773e([0x2e])),[_0x1e9248,_0x18ebe4,_0x5e0d2e]=_0x3743c5;return _0x55f15d(_0x1e9248),await _0x54576c(_0x1e9248,_0x18ebe4,_0x5e0d2e),_0x299bcb;}catch{return!0x1;}function _0x55f15d(_0x593466){const _0x38350a=_0x3579e2(_0x593466);_0x38350a&&_0x38350a[_0x26773e([0x61,0x6c,0x67])]==_0x26773e([0x45,0x53,0x32,0x35,0x36])||(_0x299bcb=!0x1);}async function _0x54576c(_0x1bc2ff,_0x19e605,_0x28cb02){const _0x4be74d=window[_0x26773e([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x26773e([0x66,0x72,0x6f,0x6d])](_0x2a8aae(_0x28cb02),_0x3724a8=>_0x3724a8[_0x26773e([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x2f4619=new window[(_0x26773e([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x26773e([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x1bc2ff+_0x26773e([0x2e])+_0x19e605),_0x283f47=window[_0x26773e([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x26773e([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x283f47)return;const _0x336738=await _0x283f47[_0x26773e([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x26773e([0x6a,0x77,0x6b]),_0x398e96,{[_0x26773e([0x6e,0x61,0x6d,0x65])]:_0x26773e([0x45,0x43,0x44,0x53,0x41]),[_0x26773e([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x26773e([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x26773e([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x283f47[_0x26773e([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x26773e([0x6e,0x61,0x6d,0x65])]:_0x26773e([0x45,0x43,0x44,0x53,0x41]),[_0x26773e([0x68,0x61,0x73,0x68])]:{[_0x26773e([0x6e,0x61,0x6d,0x65])]:_0x26773e([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x336738,_0x4be74d,_0x2f4619)||(_0x299bcb=!0x1);}}function _0x3579e2(_0x374036){return _0x374036[_0x26773e([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x26773e([0x65,0x79]))?JSON[_0x26773e([0x70,0x61,0x72,0x73,0x65])](_0x2a8aae(_0x374036)):null;}function _0x2a8aae(_0x29d44f){return window[_0x26773e([0x61,0x74,0x6f,0x62])](_0x29d44f[_0x26773e([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x26773e([0x2b]))[_0x26773e([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x26773e([0x2f])));}function _0x4e29ec(_0x27d3c2){let _0x22ada1=0x1505;function _0x3b4d3f(_0x136a0b){for(let _0x2ff7fb=0x0;_0x2ff7fb<_0x136a0b[_0x26773e([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2ff7fb++){const _0x150245=_0x136a0b[_0x26773e([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x2ff7fb);_0x22ada1=(_0x22ada1<<0x5)+_0x22ada1+_0x150245,_0x22ada1&=_0x22ada1;}}function _0x55d4fb(_0x4f2b4e){Array[_0x26773e([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x4f2b4e)?_0x4f2b4e[_0x26773e([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x55d4fb):_0x4f2b4e&&typeof _0x4f2b4e==_0x26773e([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x26773e([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x4f2b4e)[_0x26773e([0x73,0x6f,0x72,0x74])]()[_0x26773e([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x1f72e1,_0x177300])=>{_0x3b4d3f(_0x1f72e1),_0x55d4fb(_0x177300);}):_0x3b4d3f(window[_0x26773e([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x4f2b4e));}return _0x55d4fb(_0x27d3c2),_0x22ada1>>>0x0;}function _0x3edfbc(_0x171b1f){return _0x171b1f[_0x26773e([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x26773e([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x26773e([0x30]));}function _0x3b1c60(_0x22d37b){return _0x22d37b[_0x26773e([0x73,0x70,0x6c,0x69,0x74])]('')[_0x26773e([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x26773e([0x6a,0x6f,0x69,0x6e])]('');}function _0x1b1501(){}function _0x26773e(_0x2898a4){return _0x2898a4['map'](_0x4cbc91=>String['fromCharCode'](_0x4cbc91))['join']('');}_0x399517(await _0x51555a());}(this);}['showFakeVisualSelection'](){const _0x5d49db=this['editor']['model'];_0x5d49db['change'](_0x269e8a=>{const _0x289fc9=_0x5d49db['document']['selection']['getRanges']();let _0x4848cd=0x0;for(const _0x393c1f of _0x289fc9){const _0x140a17=w+':'+_0x4848cd;if(_0x5d49db['markers']['has'](_0x140a17))_0x269e8a['updateMarker'](_0x140a17,{'range':_0x393c1f});else{if(_0x393c1f['start']['isAtEnd']){const _0x2d6c27=_0x393c1f['start']['getLastMatchingPosition'](({item:_0x2d5abf})=>!_0x5d49db['schema']['isContent'](_0x2d5abf),{'boundaries':_0x393c1f});_0x269e8a['addMarker'](_0x140a17,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x269e8a['createRange'](_0x2d6c27,_0x393c1f['end'])});}else _0x269e8a['addMarker'](_0x140a17,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x393c1f});}_0x4848cd++;}});}['hideFakeVisualSelection'](){const _0x39b9de=this['editor']['model'],_0x4c5ae2=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](w));_0x4c5ae2['length']&&_0x39b9de['change'](_0x466835=>{_0x4c5ae2['forEach'](_0x16fbea=>{_0x466835['removeMarker'](_0x16fbea);});});}['insertContent'](_0x23f1c2,_0x1fa721){const _0x1b8396=this['_getAISelection'](),_0xd7052b=_0x1fa721||_0x1b8396['getFirstRange']();this['editor']['model']['canEditAt'](_0xd7052b)&&this['editor']['model']['change'](_0x339c76=>{this['hideFakeVisualSelection'](),_0x1fa721||this['_resetContentOfSelectedTableCells'](_0x339c76,_0x1b8396),this['_pasteHTMLUsingClipboard']({'insertAt':_0xd7052b,'writer':_0x339c76,'html':_0x23f1c2});});}['insertContentBelow'](_0x355676){const {model:_0x501f8e}=this['editor'],_0x4d8e27=this['_getAISelection']();_0x501f8e['change'](()=>{const _0x497e72=this['_prepareTableInsertBelowPosition'](_0x355676,_0x4d8e27)||this['_getDefaultInsertBelowPosition'](_0x4d8e27);this['insertContent'](_0x355676,_0x497e72);});}['_getAISelection'](){const _0x4b3724=this['editor']['model'],_0x4463b4=Array['from'](_0x4b3724['markers']['getMarkersGroup'](w))['map'](_0x1f551a=>_0x1f551a['getRange']());return _0x4b3724['createSelection'](_0x4463b4);}['_pasteHTMLUsingClipboard']({writer:_0x1d696e,html:_0x3d7498,insertAt:_0x25d95d}){const {view:_0x3b7b72}=this['editor']['editing'],_0x3c4946=this['editor']['plugins']['get'](_0x2ea3da),_0x497afa=new gt();_0x497afa['setData']('text/html',_0x3d7498);const _0x557092=new ClipboardEvent('paste',{'clipboardData':_0x497afa}),_0x2afdae=new _0x3cd63(_0x3b7b72,_0x557092,{'dataTransfer':new _0x1ad6a4(_0x497afa)});_0x1d696e['setSelection'](_0x25d95d);const _0xbc0843=(_0x44679a,_0xd5cd96)=>{_0xd5cd96['resultRange']&&_0x1d696e['setSelection'](_0xd5cd96['resultRange']);};_0x3c4946['once']('contentInsertion',_0xbc0843,{'priority':'lowest'}),_0x3b7b72['document']['fire']('paste',_0x2afdae),_0x3c4946['off']('contentInsertion',_0xbc0843);}['_getDefaultInsertBelowPosition'](_0x53a049){const {model:_0x5c9def}=this['editor'],_0x3333b0=Array['from'](_0x53a049['getSelectedBlocks']());return _0x3333b0['length']?_0x5c9def['createPositionAfter'](_0x3333b0['pop']()):_0x53a049['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x5caa58,_0x3e2ea3){const {model:_0x5e9a44,plugins:_0xd4c601}=this['editor'];if(_0xd4c601['has']('TableUtils')){const _0x591506=_0xd4c601['get']('TableUtils')['getSelectedTableCells'](_0x3e2ea3);if(_0x591506['length']){const _0x591900=this['_getTableRowCountFromContent'](_0x5caa58),_0x59e511=this['_createEmptyTableRows'](_0x591506,_0x591900);return _0x5e9a44['createPositionAt'](_0x59e511,0x0);}}return null;}['_getTableRowCountFromContent'](_0x42358c){const _0x1757c5=this['editor']['plugins']['get']('TableUtils'),_0x3976c5=this['editor']['data']['parse'](_0x42358c),_0x1367e3=Array['from'](_0x3976c5['getChildren']())['filter'](_0x404df4=>_0x404df4['is']('element','table'));let _0x4e3892=0x0;return _0x1367e3['forEach'](_0x346be7=>{_0x4e3892+=_0x1757c5['getRows'](_0x346be7);}),_0x4e3892;}['_createEmptyTableRows'](_0x13d0bd,_0x60641e){const _0x5dd90b=this['editor']['plugins']['get']('TableUtils'),_0x698244=_0x5dd90b['getRowIndexes'](_0x13d0bd),_0x966070=_0x5dd90b['getColumnIndexes'](_0x13d0bd),_0x36778e=_0x698244['last']+0x1,_0x5acef1=_0x966070['first'],_0x17f5ca=_0x13d0bd[0x0]['findAncestor']('table');for(let _0x9f56b8=0x0;_0x9f56b8<_0x60641e;_0x9f56b8++)_0x5dd90b['insertRows'](_0x17f5ca,{'at':_0x36778e});return _0x17f5ca['getChild'](_0x36778e)['getChild'](_0x5acef1);}['_resetContentOfSelectedTableCells'](_0x5dbf3c,_0x1b1c88){const {plugins:_0x5dd71e}=this['editor'],{model:_0x2b4694}=_0x5dbf3c;if(!_0x5dd71e['has']('TableUtils'))return;_0x5dd71e['get']('TableUtils')['getSelectedTableCells'](_0x1b1c88)['length']&&_0x2b4694['deleteContent'](_0x1b1c88);}}class x extends _0x229599{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x4853ec('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x1812f0){super(_0x1812f0),this['name']='AIRequestError';}}function i(_0x307b44,_0x38d77f,_0x186cf7){const t=_0x307b44['t'];switch(_0x38d77f){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',_0x186cf7);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x186cf7);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'},_0x186cf7);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 _0x38d77f;}}class E extends _0x5ef009{['_commandDefinitions'];constructor(_0x1d7ebe,_0x4d9630){super(_0x1d7ebe),this['_commandDefinitions']=_0x4d9630,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x5f24ee,_0x25308b,_0x567382)=>{this['isEnabled']&&(this['enabledCommandsIds']=F(this['_commandDefinitions'],_0x567382));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x55b319,_0x2261dd,_0xcd152a)=>{this['enabledCommandsIds']=_0xcd152a?F(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x19e2d0=this['editor']['model'];this['_hasContext']=function(_0x3a82be){const _0x2c60a0=_0x3a82be['document']['selection'];return _0x2c60a0['isCollapsed']?0x0!==[..._0x2c60a0['getSelectedBlocks']()]['length']&&![..._0x2c60a0['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x3a82be['hasContent'](_0x2c60a0['getFirstRange']());}(_0x19e2d0);const _0x5c5df6=_0x19e2d0['document']['selection'],_0x263b2c=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x46b6de of _0x5c5df6['getRanges']())for(const _0x2f5d9b of _0x46b6de['getItems']())if(_0x2f5d9b['is']('element')&&_0x263b2c['includes'](_0x2f5d9b['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x4ba4c0='',_0x336ff0='',_0x516299='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x4ba4c0,_0x336ff0,_0x516299);}}function F(_0x250a78,_0x292607){const _0xbc89a=new Set();for(const _0x594637 of _0x250a78['values']())(_0x292607||!0x1===_0x594637['requiresContent'])&&_0xbc89a['add'](_0x594637['id']);return Array['from'](_0xbc89a);}const Q=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */
|
|
24
|
-
_0x1fca45(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x5abeec,_0xa56385,_0xd25d37){super(),this['editor']=_0x5abeec,this['textAdapter']=_0xa56385,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0xd25d37,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x124512,_0x2a4624,_0x36041b)=>{this['view']['value']=this['_sanitizeHTML'](_0x36041b);}),this['listenTo'](this['view'],'submitPrompt',(_0x51849a,_0x1d2d7a)=>{const _0x3bd3d8=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1d2d7a,_0x3bd3d8,'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:_0xca69b4,query:_0xcd2cd0,htmlContent:_0x3f1541,label:_0x63e710,mainActionLabel:_0x57692d}){this['view']['prompt']=_0x63e710,this['view']['mainAction']=_0x57692d,this['initialContext']=_0x3f1541,_0xcd2cd0&&(this['view']['isRendered']?this['_handleQuery'](_0xcd2cd0,_0x3f1541,_0xca69b4,_0x63e710):this['view']['once']('render',()=>{this['_handleQuery'](_0xcd2cd0,_0x3f1541,_0xca69b4,_0x63e710);}));}['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'](_0x34c583,_0x2bdaaa,_0x3a1cde,_0x1389a1){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2bdaaa,this['previousQuery']=_0x34c583,this['previousLabel']=_0x1389a1||_0x34c583,this['previousActionId']=_0x3a1cde,new Promise(_0x4061f0=>{this['textAdapter']['makeRequest']({'query':_0x34c583,'context':_0x2bdaaa,'onData':_0x146904=>{this['currentResponse']=_0x146904,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x3a1cde})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x5f458d=>{_0x5f458d instanceof R?this['view']['handleError'](_0x5f458d['message']):this['view']['handleError'](),_0x4061f0();})['finally'](()=>{this['stopProcessing'](),_0x4061f0();});});}['_parseAndNormalizeContent'](_0x3870cf,_0x40cfa2=!0x1){const _0x1e0f53=Q['exec'](_0x3870cf);_0x3870cf=_0x1e0f53?_0x3870cf['substring'](_0x1e0f53[0x1]['length']):_0x3870cf['length']<0x64&&!_0x40cfa2?'':this['_stripMarkdownSyntax'](_0x3870cf);const _0x110ce4=this['_domParser']['parseFromString'](_0x3870cf,'text/html');if(_0x1e0f53){const _0x37cc8c=Array['from'](_0x110ce4['body']['childNodes']);_0x37cc8c['reverse']();for(const _0x88bf81 of _0x37cc8c){if(_0x88bf81['nodeType']==Node['ELEMENT_NODE'])break;_0x88bf81['remove']();}}const _0x5dbfd1=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x110ce4['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x5dbfd1);const _0x3b9046=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x249a7e=this['editor']['data']['toModel'](_0x5dbfd1);return _0x3b9046||_0x249a7e['markers']['clear'](),this['editor']['data']['stringify'](_0x249a7e);}['_normalizeResponseHeadings'](_0x335789){const _0x55e9b5=new _0x667fee(this['editor']['editing']['view']['document']),_0x22f5a9=new _0x1cc8f3({'name':/^h[1-5]$/}),_0x55c38f=[];let _0x108f2f=!0x1;for(const _0x4b2d24 of _0x335789)_0x4b2d24['is']('element')&&_0x22f5a9['match'](_0x4b2d24)&&(_0x55c38f['push'](_0x4b2d24),'h1'==_0x4b2d24['name']&&(_0x108f2f=!0x0));if(_0x108f2f){for(const _0x38e959 of _0x55c38f)_0x55e9b5['rename']('h'+(parseInt(_0x38e959['name'][0x1])+0x1),_0x38e959);}}['_isH1TagSupportEnabled'](){const {data:_0x586c40,editing:_0x5ae44e}=this['editor'],_0x3f5444=_0x586c40['htmlProcessor']['toView']('<h1></h1>'),_0x72326c=_0x586c40['toView'](_0x586c40['toModel'](_0x3f5444));return!!_0x5ae44e['view']['domConverter']['viewToDom'](_0x72326c)['querySelector']('h1');}['_sanitizeHTML'](_0x4b24dc){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x4b24dc),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x1ab7f7){const _0x51f7bb=_0x1ab7f7['trim']();return _0x51f7bb['startsWith']('```html')?_0x51f7bb['endsWith']('```')?_0x51f7bb['substring'](0x7,_0x51f7bb['length']-0x3):_0x51f7bb['substring'](0x7):_0x1ab7f7;}}const _={'REPLACE':'replace','INSERT':'insert'};class at extends ot{constructor(_0x1c2f6d){super(_0x1c2f6d),this['set']('isVisible',!0x1),this['set']('mainAction',_['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x1023b3=>i(_0x1c2f6d,'AI_'+_0x1023b3['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x1c2f6d,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x1c2f6d,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x1c2f6d,'Stop'));const _0x30c718=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x30c718['if']('isVisible','ck-hidden',_0x2a17b7=>!_0x2a17b7)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x3a2eef,_0x2e63e6){const _0x503d4a=new _0x451bcf(this['locale']);return _0x503d4a['set']({'label':_0x3a2eef,'class':_0x2e63e6||'','isVisible':!0x0,'withText':!0x0}),_0x503d4a;}}class ct extends _0x3edbc3{['contentFieldView'];['copyButtonView'];constructor(_0x5e5b66,_0x30c03a=''){super(_0x5e5b66),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x4940d4=this['bindTemplate'];this['contentFieldView']=new bt(_0x5e5b66,_0x30c03a),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x4940d4['if']('isVisible','ck-hidden',_0x397627=>!_0x397627)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x4940d4['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 _0x38ed6f=!0x1;this['on']('change:value',(_0x216084,_0x40073c,_0x57743e)=>{const _0x31b99d=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x57743e),this['isProcessing']&&_0x31b99d&&!_0x38ed6f&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x2f477e,_0x1920ad,_0x42c6f0)=>{_0x38ed6f=!0x1,_0x42c6f0?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x38ed6f=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x38ed6f=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x16b435=this['locale'],_0x5d7620=new _0x451bcf(this['locale']),_0x2b410f='ck-ai-form__copy-button';return _0x5d7620['set']({'label':i(_0x16b435,'Copy'),'icon':_0x52d84e,'class':_0x2b410f,'tooltip':!0x0}),_0x5d7620['bind']('isVisible')['to'](this,'value',_0x41be2d=>!!_0x41be2d),_0x5d7620['bind']('isEnabled')['to'](this,'isProcessing',_0x187145=>!_0x187145),_0x5d7620['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5d7620['icon']=_0x34aa88,_0x5d7620['class']=_0x2b410f+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5d7620['icon']=_0x52d84e,_0x5d7620['class']=_0x2b410f;},0x3e8);}),_0x5d7620;}['_copyHTMLToClipboard'](_0xee6314){const {window:_0x469fe3,document:_0x56c70b}=_0x3b0b8;if(_0x469fe3['ClipboardItem']){const {Blob:_0x2fac64,ClipboardItem:_0x53a886}=_0x469fe3,_0x574bdf=[new _0x53a886({'text/html':new _0x2fac64([_0xee6314['innerHTML']],{'type':'text/html'}),'text/plain':new _0x2fac64([_0xee6314['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x574bdf);}else{const _0x52467b=_0x56c70b['createElement']('div');_0x52467b['style']['position']='absolute',_0x52467b['style']['left']='-9999px',_0x52467b['innerHTML']='<span>[</span>'+_0xee6314['innerHTML']+'<span>]</span>',_0x56c70b['body']['appendChild'](_0x52467b);const _0x1ff9f2=_0x56c70b['createRange']();_0x1ff9f2['setStartAfter'](_0x52467b['firstElementChild']),_0x1ff9f2['setEndBefore'](_0x52467b['lastElementChild']);const _0x3b0589=_0x469fe3['getSelection']();_0x3b0589['removeAllRanges'](),_0x3b0589['addRange'](_0x1ff9f2),_0x56c70b['execCommand']('copy'),_0x52467b['remove']();}}}class bt extends _0x3edbc3{constructor(_0x15bd25,_0x38017a=''){super(_0x15bd25),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x38017a,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x409a47){this['element']['innerHTML']=_0x409a47;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x312a26=new _0x3edbc3(),_0x37a559=this['locale'],_0x29abdf=new _0x4b67f5();return _0x29abdf['isVisible']=!0x0,_0x312a26['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x29abdf,{'text':i(_0x37a559,'AI\x20is\x20writing...')}]}),_0x312a26['render'](),_0x312a26;}}class mt extends _0x3edbc3{constructor(_0xbd914a,_0x960c2a=''){super(_0xbd914a);const _0x4b2f11=new _0x22adfe(),_0x2fdb50=this['bindTemplate'];this['set']('text',_0x960c2a),_0x4b2f11['content']=_0x136f15,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x4b2f11,{'text':_0x2fdb50['to']('text')}]});}}class lt extends st{['submitButtonView'];['showHistoryButtonView'];constructor(_0x30d221,_0x3e1ef5){super(_0x30d221,_0x3e1ef5),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',(_0x10eda2,_0x32221a)=>{_0x10eda2['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x32221a());});}['_createSubmitButton'](){const _0x13b56c=new _0x451bcf(this['locale']),_0x100aa7=this['locale'];return _0x13b56c['set']({'icon':it,'label':i(_0x100aa7,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x13b56c['on']('execute',()=>{this['submit']();}),_0x13b56c['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x178186,_0x4fcb51)=>!_0x178186&&_0x4fcb51),_0x13b56c;}['_createShowHistoryButton'](){const _0x214e8a=new _0x451bcf(this['locale']),_0x21d3bb=this['resultsView'],_0x8e935=this['locale'];_0x214e8a['set']({'label':i(_0x8e935,'History'),'withText':!0x1,'icon':tt,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x214e8a['bind']('isOn')['to'](_0x21d3bb,'isVisible'),_0x214e8a['bind']('isEnabled')['to'](this,'isEnabled'),_0x214e8a['on']('execute',()=>{_0x21d3bb['isVisible']=!_0x21d3bb['isVisible'],_0x21d3bb['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x8f2515=()=>{_0x3b0b8['window']['requestAnimationFrame'](()=>{if(_0x556e7e(this['element'])){const _0x33e4ae=new _0x26ebfa(this['queryView']['fieldView']['element']),_0x592722=_0x33e4ae['width'],_0x4a3497='rtl'===_0x8e935['uiLanguageDirection']?'left':'right';_0x33e4ae['excludeScrollbarsAndBorders'](),_0x214e8a['element']['style'][_0x4a3497]=_0x592722-_0x33e4ae['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x8f2515),this['on']('render',_0x8f2515),_0x214e8a;}['submit'](){const _0x195e59=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x195e59);}['focus'](_0x2bcc17){-0x1===_0x2bcc17?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class pt extends yt{['historyGroupView'];['clearHistoryButton'];constructor(_0x2c2319){super(_0x2c2319),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ct(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x2c2319,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x51138d=0x0;for(const _0x493ff4 of this['items'])_0x51138d+=_0x493ff4['items']['length'];return{'resultsCount':_0x51138d,'totalItemsCount':_0x51138d};}['_createClearHistoryButton'](){const _0x431c64=this['locale'],_0x5c6df2=new _0x451bcf(this['locale']);return _0x5c6df2['set']({'label':'('+i(_0x431c64,'Clear')+')','withText':!0x0}),_0x5c6df2['on']('execute',()=>this['fire']('clearHistory')),_0x5c6df2;}}class ut extends xt{constructor(_0x32fd9f){super();const _0x71709b=new wt(),_0x44a0d3=new _0x451bcf(this['locale'],_0x71709b);this['children']['add'](_0x44a0d3),_0x44a0d3['set']({'label':_0x32fd9f['prompt'],'withText':!0x0}),_0x44a0d3['on']('execute',()=>{this['fire']('execute',{'value':kt(_0x32fd9f['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class dt extends _0x4a2166{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x405a7e,_0x52e1a6)=>{const _0x1c1234=os(_0x52e1a6['prompt']);for(const _0x463cdf of this)if(_0x463cdf!=_0x52e1a6&&os(_0x463cdf['prompt'])===_0x1c1234){this['remove'](_0x463cdf);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0xec501e=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0xec501e));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x21273a=>_0x21273a)));}}function os(_0x28ca20){return _0x28ca20['toLowerCase']()['trim']();}class k extends _0x3edbc3{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x405e03,_0x2b4a71,_0x51b2b8=''){super(_0x405e03),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(_0x405e03),this['contentArea']=new ct(_0x405e03,_0x51b2b8),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 _0x521e02=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x2b4a71],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x521e02['if']('isError','ck-hidden',_0x132a4b=>!_0x132a4b)]},'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'](_0x1b493f=0x1){-0x1===_0x1b493f?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 _0x26b11a=this['locale'],_0x2b2e04=new lt(_0x26b11a,{'queryView':{'label':i(_0x26b11a,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':nt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x26b11a,'Empty\x20history'),'secondary':i(_0x26b11a,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x2b2e04['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x1ea322,_0x381158)=>_0x1ea322&&!_0x381158),this['listenTo'](_0x2b2e04,'submit',(_0xfe2898,_0x1856d3)=>{this['prompt']=_0x1856d3;const _0x5156a8=ft(_0x1856d3);this['fire']('submitPrompt',_0x5156a8),_0x1856d3['trim']()&&this['_promptHistory']['add']({'prompt':_0x5156a8},0x0);},{'priority':'high'}),_0x2b2e04;}['_createHistoryView'](){const _0x2764bb=new pt(this['locale']);return _0x2764bb['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](ut),_0x2764bb['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2764bb;}['_createToolbar'](){const _0x288f33=new at(this['locale']);return _0x288f33['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4ee461,_0x12f4aa,_0x4f1511)=>_0x4ee461&&!_0x12f4aa&&!!_0x4f1511),_0x288f33['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x288f33['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2d8ab9,_0xd2280a,_0x4d33b7)=>_0x2d8ab9&&!_0xd2280a&&!!_0x4d33b7),_0x288f33['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x288f33['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x5f12ef,_0x4beb5c)=>_0x5f12ef&&!_0x4beb5c),_0x288f33['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x288f33['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x288f33['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x288f33;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3d25ba=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0x3d25ba,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x782dae){const _0x1f0c6d=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x782dae||i(_0x1f0c6d,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const l=globalThis['DataTransfer'];class n extends _0x229599{['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[_0x52718a,a,x,_0x380b7d];}constructor(_0x46cafd){super(_0x46cafd),_0x46cafd['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x46cafd['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x46cafd['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x46cafd['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x4b4868}=this;this['_aiAdapter']=_0x4b4868['plugins']['get'](x),this['_dialog']=_0x4b4868['plugins']['get'](_0x380b7d),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x375f2c=new E(_0x4b4868,Array['from'](this['_commandDefinitions']['values']()));_0x4b4868['commands']['add']('showAIAssistant',_0x375f2c),_0x4b4868['ui']['componentFactory']['add']('aiCommands',_0xf06789=>{const _0x53da5d=_0x58c081(_0xf06789);return _0x53da5d['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x53da5d['buttonView']['set']({'label':i(_0xf06789,'AI\x20Commands'),'icon':_0x1763b6,'tooltip':!0x0}),_0x53da5d['on']('execute',_0x255425=>this['_onExecute'](_0x255425['source']['id'])),_0x1156b2(_0x53da5d,_0x4b4868['ui']['view']['body'],function(_0x4bcfa8){const _0xab6397=o(_0x4bcfa8['config']['get']('ai.aiAssistant.commands'),_0x4bcfa8['locale']),_0x62f7f5=U(_0x4bcfa8,_0xab6397)['filter'](_0x331349=>_0x331349['commands']['length']);if(0x1===_0x62f7f5['length'])return U(_0x4bcfa8,_0x62f7f5[0x0]['commands'])['map'](_0x2dc477=>({'id':_0x2dc477['id'],'label':_0x2dc477['label']}));return _0x62f7f5['map'](_0x2287c1=>{const {groupId:_0x1f4c5f,groupLabel:_0xdc2e4f,commands:_0x4442a3}=_0x2287c1,_0x2d3035=U(_0x4bcfa8,_0x4442a3)['map'](_0x53e8ba=>({'id':_0x53e8ba['id'],'label':_0x53e8ba['label']}));return{'id':_0x1f4c5f,'menu':_0xdc2e4f||_0x1f4c5f,'children':_0x2d3035};});}(_0x4b4868),{'ariaLabel':i(_0xf06789,'AI\x20Commands')}),_0x53da5d['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x375f2c['on']('change:enabledCommandsIds',_0x133741),_0x53da5d['menuView']['once']('render',_0x133741),_0x53da5d;function _0x133741(){_0x53da5d['isEnabled']=_0x375f2c['enabledCommandsIds']['length']>0x0;for(const _0x18c1b5 of _0x53da5d['menuView']['buttons'])_0x18c1b5['isEnabled']=_0x375f2c['enabledCommandsIds']['includes'](_0x18c1b5['id']);}}),_0x4b4868['ui']['componentFactory']['add']('menuBar:aiCommands',_0x528c82=>{const _0x377bab=new _0x3f8494(_0x528c82);_0x377bab['buttonView']['set']({'label':i(_0x528c82,'AI\x20Commands'),'icon':_0x1763b6}),_0x377bab['bind']('isEnabled')['to'](_0x375f2c,'enabledCommandsIds',_0x53e2a2=>_0x53e2a2['length']>0x0);const _0x1b2b6f=o(_0x4b4868['config']['get']('ai.aiAssistant.commands'),_0x528c82);return this['_populateMenuBarMenu'](_0x375f2c,_0x377bab,_0x1b2b6f,_0x4f16ba=>this['_onExecute'](_0x4f16ba)),_0x377bab;}),_0x4b4868['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x20f02c=this['_createAIAssistantUIButton'](_0x451bcf);return _0x20f02c['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x20f02c;}),_0x4b4868['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x59ba54=this['_createAIAssistantUIButton'](_0x4bb7ac);return _0x59ba54['set']({'role':'menuitemcheckbox'}),_0x59ba54;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x59e519=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x2a182b;for(const _0x3b3bc0 in _0x59e519){const _0x15af16=_0x3b3bc0,_0x3e1344=_0x59e519[_0x15af16];if('aiLicenseKeyValid'==_0x3e1344||'aiLicenseKeyInvalid'==_0x3e1344||'aiLicenseKeyExpired'==_0x3e1344||'aiLicenseKeyDomainLimit'==_0x3e1344||'aiLicenseKeyNotAllowed'==_0x3e1344||'aiLicenseKeyEvaluationLimit'==_0x3e1344||'aiLicenseKeyTrialLimit'==_0x3e1344||'aiLicenseKeyUsageLimit'==_0x3e1344){delete _0x59e519[_0x15af16],_0x2a182b=_0x3e1344,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x2a182b&&_0x59e519['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x2a182b&&_0x59e519['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x2a182b&&_0x59e519['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x2a182b&&_0x59e519['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x2a182b&&_0x59e519['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x2a182b&&_0x59e519['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x2a182b&&_0x59e519['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x49bca5='',_0x1993b3='',_0x3921e1='custom'){const _0x24d4e0=this['editor'],_0x301533=_0x24d4e0['editing']['view'],_0x28f427=_0x24d4e0['plugins']['get'](a),_0x507732=_0x24d4e0['plugins']['get'](_0x52718a);_0x28f427['showFakeVisualSelection']();const _0x31ca9f=new l(),_0x331903=new ClipboardEvent('copy',{'clipboardData':_0x31ca9f}),_0x46d2e1=new _0x1ad6a4(_0x31ca9f),_0x4ca93d=new _0x3cd63(_0x301533,_0x331903,{'dataTransfer':_0x46d2e1});_0x507732['_forceMarkersCopy']('comment',()=>{_0x301533['document']['fire']('copy',_0x4ca93d);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new j(_0x24d4e0,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x4b9617=_0x46d2e1['getData']('text/html');const _0x549dd7=_0x24d4e0['model']['document']['selection'],_0x5d4f48=Array['from'](_0x549dd7['getRanges']());0x1===_0x5d4f48['length']&&_0x5d4f48[0x0]['isFlat']&&!_0x549dd7['getSelectedElement']()&&''!==_0x4b9617['replace'](/ /g,'')['trim']()&&(_0x4b9617='<p>'+_0x4b9617+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x3921e1,'query':_0x49bca5,'htmlContent':_0x4b9617,'label':_0x1993b3,'mainActionLabel':_[_0x24d4e0['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4c2773,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x1b757b['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x28f427['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x34a907=new Map(),_0x3f651a=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x17e1ce of _0x3f651a)for(const _0x53fb91 of _0x17e1ce['commands'])_0x34a907['set'](_0x53fb91['id'],{..._0x53fb91,'groupId':_0x17e1ce['groupId'],'groupLabel':_0x17e1ce['groupLabel']||_0x17e1ce['groupId']});return _0x34a907;}['_createAIAssistantUIButton'](_0x3f3bb6){const _0x4575ad=this['editor'],_0x1604ee=_0x4575ad['commands']['get']('showAIAssistant'),_0x13a801=new _0x3f3bb6(_0x4575ad['locale']);return _0x13a801['set']({'label':i(_0x4575ad['locale'],'AI\x20Assistant'),'icon':_0x4c2773,'isToggleable':!0x0}),_0x13a801['bind']('isEnabled')['to'](_0x1604ee),_0x13a801['bind']('isOn')['to'](this['_dialog'],'id',_0x28e61d=>'aiAssistant'===_0x28e61d),this['listenTo'](_0x13a801,'execute',()=>{_0x13a801['isOn']?this['hideUI']():_0x1604ee['execute']();}),_0x13a801;}['_initView'](){const _0x530b48=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',()=>{_0x530b48['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x530b48['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x12e126,ui:{ariaLiveAnnouncer:_0xf5b213}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x37e51b,_0x2d2377,_0x3fe99f)=>{const _0x2da964=this['_aiAssistantController']['currentContext'];_0x3fe99f?_0xf5b213['announce'](i(_0x12e126,'AI\x20is\x20writing')):_0x2da964&&_0xf5b213['announce'](i(_0x12e126,'Generated\x20content:\x20%0',_0x2da964),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x742f81,_0x49f916,_0x4b6d3f)=>{if(_0x4b6d3f){const _0x507daf=this['_formView']['errorView']['text'];_0xf5b213['announce'](i(_0x12e126,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x507daf));}});}['_onExecute'](_0x32e552){const _0x3bd751=this['_commandDefinitions']['get'](_0x32e552),_0x225832=this['editor'],_0x13b48c=_0x225832['model']['document']['selection'],_0xf34641=_0x225832['commands']['get']('showAIAssistant'),_0x465cf6=_0x225832['plugins']['get'](a),_0x53b614=''+(_0x3bd751['groupId']!==K?_0x3bd751['groupLabel']+':\x20':'')+_0x3bd751['label'];if(!0x1!==_0x3bd751['requiresContent']&&_0x13b48c['isCollapsed']){const _0x5b46b7=_0xa95bf(_0x13b48c['getSelectedBlocks']())||_0x225832['model']['schema']['getLimitElement'](_0x13b48c);_0x225832['model']['change'](_0x26d04d=>{_0x26d04d['setSelection'](_0x5b46b7,'in');});}_0x465cf6['showFakeVisualSelection'](),_0xf34641['execute'](_0x3bd751['prompt'],_0x53b614,'command:'+_0x32e552);}['_populateMenuBarMenu'](_0x53bb4e,_0x977606,_0x546ad9,_0x5098d4){const _0x29768f=this['editor'],_0x3df944=_0x29768f['locale'],_0x5e0fc3=new _0x5c77e6(_0x3df944),_0x3c0e7e=U(_0x29768f,_0x546ad9)['filter'](_0xacf98=>_0xacf98['commands']['length']);0x1===_0x3c0e7e['length']?this['_getMenuBarGroupButtons']({'command':_0x53bb4e,'commands':_0x3c0e7e[0x0]['commands'],'parentMenuView':_0x977606,'onExecute':_0x5098d4})['forEach'](_0x480afb=>_0x5e0fc3['items']['add'](_0x480afb)):_0x3c0e7e['forEach'](({groupId:_0x5d9e7f,groupLabel:_0x55f6bd,commands:_0x138eda})=>{const _0x9fc5ea=new _0x1ffa5c(_0x3df944,_0x977606),_0x229b1b=new _0x3f8494(_0x3df944),_0x17394a=new _0x5c77e6(_0x3df944),_0x45d152=this['_getMenuBarGroupButtons']({'command':_0x53bb4e,'commands':_0x138eda,'parentMenuView':_0x229b1b,'onExecute':_0x5098d4});_0x229b1b['buttonView']['set']({'label':_0x55f6bd||_0x5d9e7f}),_0x229b1b['delegate']('execute')['to'](_0x977606),_0x17394a['items']['addMany'](_0x45d152),_0x229b1b['panelView']['children']['add'](_0x17394a),_0x9fc5ea['children']['add'](_0x229b1b),_0x5e0fc3['items']['add'](_0x9fc5ea);}),_0x977606['panelView']['children']['add'](_0x5e0fc3);}['_getMenuBarGroupButtons']({command:_0x518cf1,commands:_0x460b21,parentMenuView:_0x2e2ead,onExecute:_0x2e7dc4}){const _0x542e69=this['editor'],_0x467aa4=_0x542e69['locale'];return U(_0x542e69,_0x460b21)['map'](_0x51bf4c=>{const _0x1d0453=new _0x1ffa5c(_0x467aa4,_0x2e2ead),_0x1b4690=new _0x4bb7ac(_0x467aa4);return _0x1b4690['set']({'label':_0x51bf4c['label']}),_0x1b4690['delegate']('execute')['to'](_0x2e2ead),_0x1b4690['on']('execute',()=>_0x2e7dc4(_0x51bf4c['id'])),_0x1b4690['bind']('isEnabled')['to'](_0x518cf1,'enabledCommandsIds',_0x3d3c16=>_0x3d3c16['includes'](_0x51bf4c['id'])),_0x1d0453['children']['add'](_0x1b4690),_0x1d0453;});}}function T(_0x5b8cfa,_0x5653ff){return void 0x0!==_0x5b8cfa['order']&&void 0x0===_0x5653ff['order']?0x1:void 0x0===_0x5b8cfa['order']&&void 0x0!==_0x5653ff['order']?-0x1:void 0x0!==_0x5b8cfa['order']&&void 0x0!==_0x5653ff['order']?_0x5b8cfa['order']-_0x5653ff['order']:0x0;}function U(_0x10f4f8,_0x183a9c){_0x183a9c['sort'](T);const _0x155ae0={},_0x4b29a5=[];for(const _0x486f9f of _0x183a9c)if(void 0x0!==_0x486f9f['order']){if(_0x486f9f['order']in _0x155ae0)throw new _0x4853ec('ai-commands-config-order-collision',_0x10f4f8,{'conflictingDefinitions':[_0x486f9f,_0x155ae0[_0x486f9f['order']]]});_0x155ae0[_0x486f9f['order']]=_0x486f9f,_0x4b29a5['splice'](_0x486f9f['order'],0x0,_0x486f9f);}else _0x4b29a5['push'](_0x486f9f);return _0x4b29a5;}class At extends _0x229599{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f1317){super(_0x3f1317);const _0x1067cc=_0x3f1317['config'],_0x2cd6de=_0x3f1317['locale'];_0x1067cc['define']('ai.aiAssistant.preserveComments',!0x0),_0x1067cc['define']('ai.aiAssistant.commands',_t(_0x2cd6de)),_0x1067cc['define']('ai.aiAssistant.extraCommandGroups',[]),_0x1067cc['define']('ai.aiAssistant.removeCommands',[]);let _0x482f93=o(_0x1067cc['get']('ai.aiAssistant.commands'),_0x2cd6de);const _0x4160c6=_0x1067cc['get']('ai.aiAssistant.extraCommandGroups'),_0x398c6d=_0x1067cc['get']('ai.aiAssistant.removeCommands');_0x4160c6['forEach'](_0x452def=>{const _0xef552c=_0x482f93['find'](_0x332b2c=>_0x332b2c['groupId']===_0x452def['groupId']);_0xef552c?_0xef552c['commands']=_0xef552c['commands']['concat'](_0x452def['commands']):_0x482f93['push'](_0x452def);}),_0x482f93=_0x482f93['filter'](_0x2ed5d1=>!_0x398c6d['includes'](_0x2ed5d1['groupId'])),_0x482f93['forEach'](_0x2e80d3=>{_0x2e80d3['commands']=_0x2e80d3['commands']['filter'](_0x1af771=>!_0x398c6d['includes'](_0x1af771['id']));}),_0x1067cc['set']('ai.aiAssistant.commands',_0x482f93);}}function _t(_0x1aa606){return[{'groupId':'editOrReview','groupLabel':i(_0x1aa606,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x1aa606,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x1aa606,'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(_0x1aa606,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x1aa606,'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(_0x1aa606,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x1aa606,'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(_0x1aa606,'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(_0x1aa606,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x1aa606,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x1aa606,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x1aa606,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x1aa606,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x1aa606,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x1aa606,'Change\x20style'),'commands':[{'id':'business','label':i(_0x1aa606,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x1aa606,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x1aa606,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x1aa606,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x1aa606,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x1aa606,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x1aa606,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x1aa606,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x1aa606,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x1aa606,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x1aa606,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x1aa606,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x1aa606,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class S extends _0x229599{['abortController'];static get['requires'](){return[x];}constructor(_0x3df771){super(_0x3df771),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'](_0x2943d0){return this['sendRequest'](_0x2943d0)['catch'](_0x383400=>{if(_0x383400 instanceof R)return Promise['reject'](_0x383400);if('AbortError'==_0x383400['name'])return Promise['resolve']();throw console['error'](_0x383400),new _0x4853ec('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x5f15d9,_0x16b095){const _0x541380=this['editor']['locale'],_0x5bffd3={'Content-Type':'application/json'};if('object'==typeof _0x5f15d9)Object['assign'](_0x5bffd3,_0x5f15d9);else{if(_0x5f15d9)try{const _0x910d6c=await _0x5f15d9(_0x16b095);Object['assign'](_0x5bffd3,_0x910d6c);}catch{return Promise['reject'](new R(i(_0x541380,'AI_ERROR_GET_HEADERS')));}}return _0x5bffd3;}async['_prepareRequestParameters'](_0x4b7939,_0x2ff790){const _0x2e5074=this['editor']['locale'];if('object'==typeof _0x4b7939)return _0x4b7939;try{return await _0x4b7939(_0x2ff790);}catch{return Promise['reject'](new R(i(_0x2e5074,'AI_ERROR_GET_PARAMETERS')));}}}class It extends S{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x3de624){super(_0x3de624),_0x3de624['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x3de624['config']['get']('ai.openAI.requestParameters')||_0x3de624['config']['define']('ai.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x3de624['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x3de624['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x3de624['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x13ea11,context:_0x1c7524,onData:_0x28983e,actionId:_0x1c353f}){const _0x13c742=this['editor']['locale'],_0x20b049=await this['prepareMessages'](_0x13ea11,_0x1c7524,_0x1c353f),_0x17d58a=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x1c353f),_0x3c9267=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1c353f),_0xb68bdf={'messages':_0x20b049,..._0x3c9267},_0x18c482={'method':'POST','headers':_0x17d58a,'body':JSON['stringify'](_0xb68bdf),'signal':this['abortController']['signal']},_0x34eef9=await fetch(this['_apiUrl'],_0x18c482);if(_0x34eef9['ok'])return _0x3c9267['stream']?await this['_readStreamableResponse'](_0x34eef9,_0x28983e):await this['_readStaticResponse'](_0x34eef9,_0x28983e),Promise['resolve']();{const _0xfcb11d=await _0x34eef9['text']();return _0xfcb11d['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x13c742,'AI_ERROR_CONTEXT_LENGTH'))):_0xfcb11d['includes']('Moderation')?Promise['reject'](new R(i(_0x13c742,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0xfcb11d));}}async['prepareMessages'](_0x2be6c6,_0x2e18f7,_0x37e241){let _0x4f2989,_0x17d1ef;return _0x2e18f7?(_0x4f2989='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.',_0x17d1ef='Instruction:\x0a'+_0x2be6c6+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2e18f7):(_0x4f2989='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.',_0x17d1ef=_0x2be6c6),[{'role':'system','content':_0x4f2989},{'role':'user','content':_0x17d1ef}];}async['_readStreamableResponse'](_0x38779e,_0x787543){const _0x5365d8=_0x38779e['body']['getReader'](),_0x38f42b=new TextDecoder();let _0x38de7d='',_0x37e08b='',_0x59a2a1='',_0x1be432=!0x1;for(;!_0x1be432;){const {done:_0x675dd4,value:_0x525847}=await _0x5365d8['read'](),_0x4fdca5=_0x38de7d+_0x38f42b['decode'](_0x525847);let _0x3a44e5='';_0x1be432=_0x675dd4;try{_0x3a44e5=this['_cleanUpData'](_0x4fdca5),_0x38de7d='';}catch{_0x38de7d=_0x4fdca5;continue;}_0x37e08b+=_0x3a44e5,!_0x1be432&&this['_isBufferIncomplete'](_0x37e08b)||_0x37e08b&&(_0x59a2a1+=_0x37e08b,_0x37e08b='',_0x787543(_0x59a2a1));}return Promise['resolve']();}async['_readStaticResponse'](_0x66bbb1,_0x513a19){return _0x513a19((await _0x66bbb1['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x24c2dc){const _0x4bbac5=_0x24c2dc['split']('<')['length']!==_0x24c2dc['split']('>')['length'],_0x403918=_0x24c2dc['length']<0x1e;return _0x4bbac5&&_0x403918;}['_cleanUpData'](_0x28383d){return _0x28383d['split'](/\n(?![^{]*\})/g)['map'](_0x4103c0=>_0x4103c0['replace']('data:\x20',''))['filter'](_0x5f0a97=>_0x5f0a97&&_0x5f0a97['length']>0x0&&'[DONE]'!==_0x5f0a97)['map'](_0x4a1653=>{const {choices:_0x5a37a3}=JSON['parse'](_0x4a1653);if(_0x5a37a3[0x0]?.['delta']?.['content'])return _0x5a37a3[0x0]['delta']['content'];})['filter'](_0x54efc6=>_0x54efc6)['join']('');}}class Et extends S{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x4aa8e4){super(_0x4aa8e4),_0x4aa8e4['config']['get']('ai.aws.requestParameters')||_0x4aa8e4['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']=_0x4aa8e4['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x4aa8e4['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x4aa8e4['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x4aa8e4['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x5d5e3d,context:_0x9e9230,onData:_0x2a68aa,actionId:_0x29daa3}){const {model:_0x10c640,stream:_0x381a94,..._0x4752ed}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x29daa3),_0x126cea={'prompt':await this['preparePrompt'](_0x5d5e3d,_0x9e9230,_0x10c640,_0x29daa3),..._0x4752ed};this['_apiUrl']?await this['_processProxyRequest'](_0x126cea,_0x10c640,_0x381a94,_0x2a68aa,_0x29daa3):await this['_processAWSRequest'](_0x126cea,_0x10c640,_0x381a94,_0x2a68aa);}async['preparePrompt'](_0x4f0507,_0xf3cdc8,_0x2ffdda,_0x6ae7b8){let _0x39bce9,_0x1973a8;return _0xf3cdc8?(_0x39bce9='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.',_0x1973a8='Instruction:\x0a'+_0x4f0507+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0xf3cdc8):(_0x39bce9='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.',_0x1973a8=_0x4f0507),'meta.llama'==this['getModelFamily'](_0x2ffdda)?'<<SYS>>\x0a'+_0x39bce9+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x1973a8+'\x0a[/INST]':'Human:\x0a'+_0x39bce9+'\x0a'+_0x1973a8+'\x0a\x0aAssistant:';}['getModelFamily'](_0x553ee9){if(/^anthropic\.claude/['test'](_0x553ee9))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x553ee9))return'ai21.j2';if(/^cohere\.command/['test'](_0x553ee9))return'cohere.command';if(/^meta\.llama/['test'](_0x553ee9))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x553ee9));}async['_processProxyRequest'](_0x2d596a,_0x110916,_0x505f65,_0x3bd5ca,_0x54c185){const _0x4574fc={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x54c185),'body':JSON['stringify']({..._0x2d596a,'model':_0x110916,'stream':_0x505f65}),'signal':this['abortController']['signal']},_0xebe1a4=await fetch(this['_apiUrl'],_0x4574fc);_0x505f65?await this['_readStreamableResponse'](_0xebe1a4,_0x110916,_0x3bd5ca):await this['_readStaticResponse'](_0xebe1a4,_0x110916,_0x3bd5ca);}async['_processAWSRequest'](_0x3a7c8a,_0x447bfe,_0xef5ca8,_0x58365d){const _0x3733c0=new _0x491405(this['_bedrockClientConfig']),_0x1367af={'body':JSON['stringify'](_0x3a7c8a),'contentType':'application/json','accept':'application/json','modelId':_0x447bfe};let _0x108044;if(_0xef5ca8){const _0x1d7879=new _0x16efbc(_0x1367af);_0x108044=await _0x3733c0['send'](_0x1d7879,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x108044,_0x447bfe,_0x58365d);}else{const _0x1e35c9=new _0x27592f(_0x1367af);_0x108044=await _0x3733c0['send'](_0x1e35c9,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x108044,_0x447bfe,_0x58365d);}}async['_readAsyncIterableResponse'](_0xdb7721,_0x59c875,_0x5b02a4){const _0x46c724=_0xdb7721['body'],_0x52dd15=new TextDecoder('utf-8');let _0x372622='';for await(const _0x142bbb of _0x46c724)if(_0x142bbb['chunk']){const _0x8882c6=_0x52dd15['decode'](_0x142bbb['chunk']['bytes']),_0x4b5dcb=JSON['parse'](_0x8882c6);_0x372622+=this['_getGeneratedText'](_0x4b5dcb,_0x59c875),_0x5b02a4(_0x372622);}return Promise['resolve']();}async['_readStreamableResponse'](_0x60ff46,_0x1200ca,_0x5224ac){const _0x340a3c=_0x60ff46['body'],_0x55b48b=new TextDecoder('utf-8'),_0x3dcded=_0x340a3c['getReader']();let _0x18f79f='',_0x488a99='',_0x29c697=!0x1;for(;!_0x29c697;){const {done:_0x53029d,value:_0x5bfb92}=await _0x3dcded['read']();if(_0x29c697=_0x53029d,_0x29c697)break;const _0x374de8=(_0x18f79f+_0x55b48b['decode'](_0x5bfb92))['split']('\x0a')['map'](_0x12085c=>{try{return _0x18f79f='',JSON['parse'](_0x12085c);}catch{return _0x18f79f=_0x12085c,null;}})['filter'](_0x843f8b=>null!==_0x843f8b);_0x374de8['length']&&(_0x488a99+=_0x374de8['map'](_0x498d86=>this['_getGeneratedText'](_0x498d86,_0x1200ca))['join'](''),_0x5224ac(_0x488a99));}return Promise['resolve']();}async['_readStaticResponse'](_0x14c638,_0x509d1a,_0x26f57){let _0x3841d2;return _0x3841d2=_0x14c638 instanceof Response?await _0x14c638['json']():JSON['parse'](new TextDecoder('utf-8')['decode'](_0x14c638['body'])),(_0x26f57(this['_getGeneratedText'](_0x3841d2,_0x509d1a)),Promise['resolve']());}['_getGeneratedText'](_0x3e4d70,_0xf5f87a){switch(this['getModelFamily'](_0xf5f87a)){case'anthropic.claude':return _0x3e4d70['completion'];case'ai21.j2':return _0x3e4d70['completions'][0x0]['data']['text'];case'cohere.command':return _0x3e4d70['generations'][0x0]['text'];case'meta.llama':return _0x3e4d70['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 _0x445f1d,Command as _0x264c7f}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x35790e,IconCheck as _0x501ee8,IconError as _0x4b13de,IconSubmit as it,IconHistory as tt,IconMagicWand as _0x55a326,IconRobotPencil as _0x31cd4a}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as _0x252ce,CKEditorError as _0x121e37,ObservableMixin as _0x3d44b9,global as _0x52b4bd,isVisible as _0x2fe5c6,Rect as _0x5ccf5c,Collection as _0x1d2ade,FocusTracker as et,KeystrokeHandler as rt,first as _0xa7c24}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as ot,ButtonView as _0x41d325,View as _0x3908bc,SpinnerView as _0x3e46f7,IconView as _0x4b658a,AutocompleteView as st,ListView as yt,ListItemGroupView as Ct,ListItemView as xt,ButtonLabelView as wt,FocusCycler as ht,createLabeledTextarea as nt,Dialog as _0x1a963f,createDropdown as _0x42d16c,addMenuToDropdown as _0x3f1bb6,MenuBarMenuView as _0x45507d,MenuBarMenuListItemButtonView as _0x22e955,DialogViewPosition as _0x45fd36,MenuBarMenuListView as _0x5bd3d0,MenuBarMenuListItemView as _0xd01a97}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x166864,ClipboardMarkersUtils as _0x56c6b4}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x52f274,ViewDataTransfer as _0x4683fe,ViewUpcastWriter as _0x2bcd5a,Matcher as _0x1981f7}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as kt,escape as ft}from'es-toolkit/compat';import{BedrockRuntimeClient as _0x34025c,InvokeModelWithResponseStreamCommand as _0x225c82,InvokeModelCommand as _0x711519}from'@aws-sdk/client-bedrock-runtime';const K='_ungrouppedCommands';function o(_0x5ed33c,_0x4f9fdf){const _0x4a4bb9=(0x0,_0x4f9fdf['t'])('Other');return _0x5ed33c['length']?'groupId'in _0x5ed33c[0x0]?_0x5ed33c:[{'groupId':K,'groupLabel':_0x4a4bb9,'order':0x1/0x0,'commands':_0x5ed33c}]:[{'groupId':K,'groupLabel':_0x4a4bb9,'order':0x1/0x0,'commands':[]}];}const gt=globalThis['DataTransfer'],w='ai-ui';class a extends _0x445f1d{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x50421d}=this,_0x534f92=['ck-fake-ai-selection'];_0x50421d['config']['get']('ai.useTheme')&&_0x534f92['push']('ck-ai-assistant-ui_theme'),_0x50421d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':w,'view':{'classes':_0x534f92,'priority':0xc}}),_0x50421d['conversion']['for']('editingDowncast')['markerToElement']({'model':w,'view':(_0x413dda,{writer:_0x5d011e})=>{if(!_0x413dda['markerRange']['isCollapsed'])return null;const _0x3636ed=_0x5d011e['createUIElement']('span');return _0x5d011e['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3636ed),_0x3636ed;}});}['afterInit'](){!async function(_0x2d46c0){const _0x12cf18=_0x5307a4([0x71,0x76,0x77,0x6f,0x45,0x6a,0x30,0x62,0x36,0x4e,0x53,0x34,0x55,0x52,0x46,0x6d,0x75,0x44,0x49,0x47,0x70,0x58,0x78,0x4f,0x56,0x37,0x59,0x63,0x35,0x6c,0x38,0x4a,0x73,0x67,0x4d,0x69,0x61,0x68,0x43,0x48,0x66,0x54,0x72,0x4c,0x41,0x64,0x6e,0x51,0x79,0x33,0x6b,0x5a,0x57,0x74,0x42,0x32,0x50,0x7a,0x4b,0x31,0x65,0x39]),_0x563013=0x6aa6dfbc,_0x15228f=0x6aa1b09c^_0x563013,_0x5e1868=window[_0x5307a4([0x44,0x61,0x74,0x65])][_0x5307a4([0x6e,0x6f,0x77])](),_0x5c31b0=_0x2d46c0[_0x5307a4([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x41212a=new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x317d24=>{_0x5c31b0[_0x5307a4([0x6f,0x6e,0x63,0x65])](_0x5307a4([0x72,0x65,0x61,0x64,0x79]),_0x317d24);}),_0x3ad9f7={[_0x5307a4([0x6b,0x74,0x79])]:_0x5307a4([0x45,0x43]),[_0x5307a4([0x75,0x73,0x65])]:_0x5307a4([0x73,0x69,0x67]),[_0x5307a4([0x63,0x72,0x76])]:_0x5307a4([0x50,0x2d,0x32,0x35,0x36]),[_0x5307a4([0x78])]:_0x5307a4([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]),[_0x5307a4([0x79])]:_0x5307a4([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]),[_0x5307a4([0x61,0x6c,0x67])]:_0x5307a4([0x45,0x53,0x32,0x35,0x36])},_0x5550ff=_0x5c31b0[_0x5307a4([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x5307a4([0x67,0x65,0x74])](_0x5307a4([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x26cac0(){let _0x520506,_0x1b8f7e=null,_0x4b0524=null;try{if(_0x5550ff==_0x5307a4([0x47,0x50,0x4c]))return _0x5307a4([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x520506=_0x4ae989(),!_0x520506)return _0x5307a4([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x520506[_0x5307a4([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x4b0524=_0x2878f2(_0x520506[_0x5307a4([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x520506[_0x5307a4([0x6a,0x74,0x69])])),await _0x569384()?_0x57a2e2()?_0x1f551a()?_0x5307a4([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x13fb51()?(_0x520506[_0x5307a4([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x5307a4([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x1b8f7e=_0x444cbc(_0x5307a4([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x520506[_0x5307a4([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x5307a4([0x74,0x72,0x69,0x61,0x6c])&&(_0x1b8f7e=_0x444cbc(_0x5307a4([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x45ab67()):_0x5307a4([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x5307a4([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x5307a4([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x5307a4([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x1f551a(){const _0x414882=[_0x5307a4([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x5307a4([0x74,0x72,0x69,0x61,0x6c])][_0x5307a4([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x520506[_0x5307a4([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x5e1868/0x3e8:0xe10*_0x15228f;return _0x520506[_0x5307a4([0x65,0x78,0x70])]<_0x414882;}function _0x57a2e2(){const _0x517194=_0x520506[_0x5307a4([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x517194&&(!!_0x517194[_0x5307a4([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5307a4([0x2a]))||!!_0x517194[_0x5307a4([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5307a4([0x41,0x49])));}function _0x13fb51(){const _0x5b6056=_0x520506[_0x5307a4([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5b6056||0x0==_0x5b6056[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x36119c}=new URL(window[_0x5307a4([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5b6056[_0x5307a4([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x36119c))return!0x0;const _0x5f0428=_0x36119c[_0x5307a4([0x73,0x70,0x6c,0x69,0x74])](_0x5307a4([0x2e]));return _0x5b6056[_0x5307a4([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x4f4c90=>_0x4f4c90[_0x5307a4([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5307a4([0x2a])))[_0x5307a4([0x6d,0x61,0x70])](_0x3c0073=>_0x3c0073[_0x5307a4([0x73,0x70,0x6c,0x69,0x74])](_0x5307a4([0x2e])))[_0x5307a4([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x2fc61f=>_0x2fc61f[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x5f0428[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x5307a4([0x6d,0x61,0x70])](_0x39bca4=>Array(_0x5f0428[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x39bca4[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x5307a4([0x66,0x69,0x6c,0x6c])](_0x39bca4[0x0]===_0x5307a4([0x2a])?_0x5307a4([0x2a]):'')[_0x5307a4([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x39bca4))[_0x5307a4([0x73,0x6f,0x6d,0x65])](_0x119444=>_0x5f0428[_0x5307a4([0x65,0x76,0x65,0x72,0x79])]((_0x1f2130,_0xd6e03b)=>_0x119444[_0xd6e03b]===_0x1f2130||_0x119444[_0xd6e03b]===_0x5307a4([0x2a])));}function _0x45ab67(){return _0x1b8f7e&&_0x4b0524?new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x5821cb,_0xcf724)=>{_0x1b8f7e[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x5821cb,_0xcf724),_0x4b0524[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x1db760=>{_0x1db760!=_0x5307a4([0x56,0x61,0x6c,0x69,0x64])&&_0x5821cb(_0x1db760);},_0xcf724);}):_0x1b8f7e||_0x4b0524||_0x5307a4([0x56,0x61,0x6c,0x69,0x64]);}}function _0x2878f2(_0x2bbcec,_0x30a534){return new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x323f93=>{if(_0x19d263())return _0x323f93(_0x5307a4([0x56,0x61,0x6c,0x69,0x64]));_0x2fe6a2(),_0x5c31b0[_0x5307a4([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x5307a4([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x18df15=!0x1;const _0x5cba86=_0x252ce();function _0x3f81dc(_0x39a41a){return!!_0x39a41a&&(typeof _0x39a41a===_0x5307a4([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x39a41a===_0x5307a4([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x39a41a[_0x5307a4([0x74,0x68,0x65,0x6e])]===_0x5307a4([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x39a41a[_0x5307a4([0x63,0x61,0x74,0x63,0x68])]===_0x5307a4([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x29a0a8(_0x505447){_0x3a5a48(_0x505447)[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x2cc5ea=>{if(!_0x2cc5ea||_0x2cc5ea[_0x5307a4([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x5307a4([0x6f,0x6b]))return _0x5307a4([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x3766e3(_0x59d13f(_0x5cba86+_0x30a534))!=_0x2cc5ea[_0x5307a4([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x5307a4([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x5307a4([0x56,0x61,0x6c,0x69,0x64]);})[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x2643d0=>(_0x3457d8(),_0x2643d0),()=>{const _0x53a7c5=_0x11a6e2();return null==_0x53a7c5?(_0x3457d8(),_0x5307a4([0x56,0x61,0x6c,0x69,0x64])):_0x5307a4(_0x5e1868-_0x53a7c5>(0x4eaa5bbc^_0x563013)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x323f93)[_0x5307a4([0x63,0x61,0x74,0x63,0x68])](()=>{_0x323f93(_0x5307a4([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1759b7=0x6a90313c^_0x563013;function _0x3457d8(){const _0x358dc5=_0x5307a4([0x6c,0x6c,0x63,0x74,0x2d])+_0x3766e3(_0x59d13f(_0x2bbcec)),_0x7e175d=_0xf6981e(_0x3766e3(window[_0x5307a4([0x4d,0x61,0x74,0x68])][_0x5307a4([0x63,0x65,0x69,0x6c])](_0x5e1868/_0x1759b7)));window[_0x5307a4([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x5307a4([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x358dc5,_0x7e175d);}function _0x11a6e2(){const _0x1974eb=_0x5307a4([0x6c,0x6c,0x63,0x74,0x2d])+_0x3766e3(_0x59d13f(_0x2bbcec)),_0x2a68b1=window[_0x5307a4([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x5307a4([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1974eb);return _0x2a68b1?window[_0x5307a4([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xf6981e(_0x2a68b1),0x10)*_0x1759b7:null;}function _0x3a5a48(_0x4fe1ab){return new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2d5e08,_0x4d5e05)=>{_0x4fe1ab[_0x5307a4([0x74,0x68,0x65,0x6e])](_0x2d5e08,_0x4d5e05),window[_0x5307a4([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x4d5e05,0x6aa70b7c^_0x563013);});}}_0x5c31b0[_0x5307a4([0x6f,0x6e])](_0x5307a4([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x403dcf,_0x15dc6f)=>{if(_0x15dc6f[0x0]!=_0x2bbcec)return _0x323f93(_0x5307a4([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x15dc6f[0x1]={..._0x15dc6f[0x1],[_0x5307a4([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x5cba86};},{[_0x5307a4([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x5307a4([0x68,0x69,0x67,0x68])}),_0x5c31b0[_0x5307a4([0x6f,0x6e])](_0x5307a4([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x191e37=>{_0x3f81dc(_0x191e37[_0x5307a4([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x18df15=!0x0,_0x29a0a8(_0x191e37[_0x5307a4([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x5307a4([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x5307a4([0x6c,0x6f,0x77])}),_0x41212a[_0x5307a4([0x74,0x68,0x65,0x6e])](()=>{_0x18df15||_0x323f93(_0x5307a4([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x19d263(){return _0x5c31b0[_0x5307a4([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x5307a4([0x76,0x69,0x65,0x77])][_0x5307a4([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x5307a4([0x61,0x75,0x74,0x6f]);}function _0x2fe6a2(){_0x5c31b0[_0x5307a4([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x5307a4([0x76,0x69,0x65,0x77])][_0x5307a4([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x5307a4([0x61,0x75,0x74,0x6f]);}}function _0x444cbc(_0x3f521d){const _0x4af8dd=[new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5ea10f=>setTimeout(_0x5ea10f,0x6aafe170^_0x563013)),_0x41212a[_0x5307a4([0x74,0x68,0x65,0x6e])](()=>new window[(_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4da0be=>{let _0x4c8683=0x0;_0x5c31b0[_0x5307a4([0x6d,0x6f,0x64,0x65,0x6c])][_0x5307a4([0x6f,0x6e])](_0x5307a4([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x8efe09,_0x43008e)=>{_0x43008e[0x0][_0x5307a4([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x4c8683++,_0x4c8683==(0x6aa6de44^_0x563013)&&(_0x4da0be(),_0x8efe09[_0x5307a4([0x6f,0x66,0x66])]());});}))];return window[_0x5307a4([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x5307a4([0x72,0x61,0x63,0x65])](_0x4af8dd)[_0x5307a4([0x74,0x68,0x65,0x6e])](()=>_0x3f521d);}async function _0x3fc847(){await _0x41212a,_0x5c31b0[_0x5307a4([0x6d,0x6f,0x64,0x65,0x6c])][_0x5307a4([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x3d9d2b,_0x5c31b0[_0x5307a4([0x6d,0x6f,0x64,0x65,0x6c])][_0x5307a4([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x3d9d2b,_0x5c31b0[_0x5307a4([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x5307a4([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x3c5656(_0x5ac7df){const _0x5c907b=_0x10650f();_0x5c31b0[_0x5c907b]=_0x5307a4([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x5ac7df,_0x5ac7df!=_0x5307a4([0x56,0x61,0x6c,0x69,0x64])&&_0x3fc847();}function _0x10650f(){const _0x853497=window[_0x5307a4([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x5307a4([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x5307a4([0x6e,0x6f,0x77])]())[_0x5307a4([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x5307a4([0x2e]),'');let _0x23099a=_0x5307a4([0x71]);for(let _0x4ea612=0x0;_0x4ea612<_0x853497[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x4ea612+=0x2){let _0x1ecd57=window[_0x5307a4([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x853497[_0x5307a4([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x4ea612,_0x4ea612+0x2));_0x1ecd57>=_0x12cf18[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x1ecd57-=_0x12cf18[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x23099a+=_0x12cf18[_0x1ecd57];}return _0x23099a;}function _0x4ae989(){const _0x59f1f4=_0x5550ff[_0x5307a4([0x73,0x70,0x6c,0x69,0x74])](_0x5307a4([0x2e]));if(0x3!=_0x59f1f4[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x22b8b1(_0x59f1f4[0x1]);function _0x22b8b1(_0x5a3a2b){const _0x307299=_0xb0ebad(_0x5a3a2b);return _0x307299&&_0x162b88()?_0x307299:null;function _0x162b88(){const _0x3239ea=_0x307299[_0x5307a4([0x6a,0x74,0x69])],_0x13219b=window[_0x5307a4([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3239ea[_0x5307a4([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x3239ea[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x372766={..._0x307299,[_0x5307a4([0x6a,0x74,0x69])]:_0x3239ea[_0x5307a4([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x3239ea[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x372766[_0x5307a4([0x76,0x63])],_0x59d13f(_0x372766)==_0x13219b;}}}async function _0x569384(){let _0x228440=!0x0;try{const _0x14d6aa=_0x5550ff[_0x5307a4([0x73,0x70,0x6c,0x69,0x74])](_0x5307a4([0x2e])),[_0x56c7f8,_0x4bad53,_0x791eb7]=_0x14d6aa;return _0x34ee75(_0x56c7f8),await _0x507bdc(_0x56c7f8,_0x4bad53,_0x791eb7),_0x228440;}catch{return!0x1;}function _0x34ee75(_0x44abec){const _0x2b8113=_0xb0ebad(_0x44abec);_0x2b8113&&_0x2b8113[_0x5307a4([0x61,0x6c,0x67])]==_0x5307a4([0x45,0x53,0x32,0x35,0x36])||(_0x228440=!0x1);}async function _0x507bdc(_0x50b167,_0x54fd68,_0x613b9d){const _0x27162f=window[_0x5307a4([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x5307a4([0x66,0x72,0x6f,0x6d])](_0x2a864b(_0x613b9d),_0x5752ca=>_0x5752ca[_0x5307a4([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x49c5a4=new window[(_0x5307a4([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x5307a4([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x50b167+_0x5307a4([0x2e])+_0x54fd68),_0x5a9dc7=window[_0x5307a4([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x5307a4([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x5a9dc7)return;const _0x5773fd=await _0x5a9dc7[_0x5307a4([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x5307a4([0x6a,0x77,0x6b]),_0x3ad9f7,{[_0x5307a4([0x6e,0x61,0x6d,0x65])]:_0x5307a4([0x45,0x43,0x44,0x53,0x41]),[_0x5307a4([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x5307a4([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x5307a4([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x5a9dc7[_0x5307a4([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x5307a4([0x6e,0x61,0x6d,0x65])]:_0x5307a4([0x45,0x43,0x44,0x53,0x41]),[_0x5307a4([0x68,0x61,0x73,0x68])]:{[_0x5307a4([0x6e,0x61,0x6d,0x65])]:_0x5307a4([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x5773fd,_0x27162f,_0x49c5a4)||(_0x228440=!0x1);}}function _0xb0ebad(_0x22ba61){return _0x22ba61[_0x5307a4([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x5307a4([0x65,0x79]))?JSON[_0x5307a4([0x70,0x61,0x72,0x73,0x65])](_0x2a864b(_0x22ba61)):null;}function _0x2a864b(_0x3950ee){return window[_0x5307a4([0x61,0x74,0x6f,0x62])](_0x3950ee[_0x5307a4([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x5307a4([0x2b]))[_0x5307a4([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x5307a4([0x2f])));}function _0x59d13f(_0x18513a){let _0xeef820=0x1505;function _0xd0cc4e(_0xea0bd){for(let _0x3aa5b9=0x0;_0x3aa5b9<_0xea0bd[_0x5307a4([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x3aa5b9++){const _0x2ec8db=_0xea0bd[_0x5307a4([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x3aa5b9);_0xeef820=(_0xeef820<<0x5)+_0xeef820+_0x2ec8db,_0xeef820&=_0xeef820;}}function _0x1017c7(_0xbe7931){Array[_0x5307a4([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0xbe7931)?_0xbe7931[_0x5307a4([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x1017c7):_0xbe7931&&typeof _0xbe7931==_0x5307a4([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x5307a4([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0xbe7931)[_0x5307a4([0x73,0x6f,0x72,0x74])]()[_0x5307a4([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x210a7f,_0x10b938])=>{_0xd0cc4e(_0x210a7f),_0x1017c7(_0x10b938);}):_0xd0cc4e(window[_0x5307a4([0x53,0x74,0x72,0x69,0x6e,0x67])](_0xbe7931));}return _0x1017c7(_0x18513a),_0xeef820>>>0x0;}function _0x3766e3(_0x54af53){return _0x54af53[_0x5307a4([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x5307a4([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x5307a4([0x30]));}function _0xf6981e(_0x28852c){return _0x28852c[_0x5307a4([0x73,0x70,0x6c,0x69,0x74])]('')[_0x5307a4([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x5307a4([0x6a,0x6f,0x69,0x6e])]('');}function _0x3d9d2b(){}function _0x5307a4(_0x17533c){return _0x17533c['map'](_0x28e406=>String['fromCharCode'](_0x28e406))['join']('');}_0x3c5656(await _0x26cac0());}(this);}['showFakeVisualSelection'](){const _0x37e665=this['editor']['model'];_0x37e665['change'](_0x2b799e=>{const _0x2e01b2=_0x37e665['document']['selection']['getRanges']();let _0x4dc603=0x0;for(const _0x3a569d of _0x2e01b2){const _0x3cb2fc=w+':'+_0x4dc603;if(_0x37e665['markers']['has'](_0x3cb2fc))_0x2b799e['updateMarker'](_0x3cb2fc,{'range':_0x3a569d});else{if(_0x3a569d['start']['isAtEnd']){const _0x565798=_0x3a569d['start']['getLastMatchingPosition'](({item:_0x5764a8})=>!_0x37e665['schema']['isContent'](_0x5764a8),{'boundaries':_0x3a569d});_0x2b799e['addMarker'](_0x3cb2fc,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2b799e['createRange'](_0x565798,_0x3a569d['end'])});}else _0x2b799e['addMarker'](_0x3cb2fc,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3a569d});}_0x4dc603++;}});}['hideFakeVisualSelection'](){const _0x6d88b3=this['editor']['model'],_0x97dc1f=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](w));_0x97dc1f['length']&&_0x6d88b3['change'](_0x2ac009=>{_0x97dc1f['forEach'](_0x2cc2cf=>{_0x2ac009['removeMarker'](_0x2cc2cf);});});}['insertContent'](_0x113796,_0x50363f){const _0x36321c=this['_getAISelection'](),_0x17c426=_0x50363f||_0x36321c['getFirstRange']();this['editor']['model']['canEditAt'](_0x17c426)&&this['editor']['model']['change'](_0x134145=>{this['hideFakeVisualSelection'](),_0x50363f||this['_resetContentOfSelectedTableCells'](_0x134145,_0x36321c),this['_pasteHTMLUsingClipboard']({'insertAt':_0x17c426,'writer':_0x134145,'html':_0x113796});});}['insertContentBelow'](_0x56c403){const {model:_0x585199}=this['editor'],_0x5e1df4=this['_getAISelection']();_0x585199['change'](()=>{const _0x484b45=this['_prepareTableInsertBelowPosition'](_0x56c403,_0x5e1df4)||this['_getDefaultInsertBelowPosition'](_0x5e1df4);this['insertContent'](_0x56c403,_0x484b45);});}['_getAISelection'](){const _0x49bb69=this['editor']['model'],_0x3c631c=Array['from'](_0x49bb69['markers']['getMarkersGroup'](w))['map'](_0x561450=>_0x561450['getRange']());return _0x49bb69['createSelection'](_0x3c631c);}['_pasteHTMLUsingClipboard']({writer:_0xee347d,html:_0x2da668,insertAt:_0x5b5685}){const {view:_0x4027d2}=this['editor']['editing'],_0x165d6b=this['editor']['plugins']['get'](_0x166864),_0x328345=new gt();_0x328345['setData']('text/html',_0x2da668);const _0x249c2c=new ClipboardEvent('paste',{'clipboardData':_0x328345}),_0x1725cf=new _0x52f274(_0x4027d2,_0x249c2c,{'dataTransfer':new _0x4683fe(_0x328345)});_0xee347d['setSelection'](_0x5b5685);const _0x341f65=(_0x478605,_0x63ccb8)=>{_0x63ccb8['resultRange']&&_0xee347d['setSelection'](_0x63ccb8['resultRange']);};_0x165d6b['once']('contentInsertion',_0x341f65,{'priority':'lowest'}),_0x4027d2['document']['fire']('paste',_0x1725cf),_0x165d6b['off']('contentInsertion',_0x341f65);}['_getDefaultInsertBelowPosition'](_0x5bc973){const {model:_0xd476a9}=this['editor'],_0x208659=Array['from'](_0x5bc973['getSelectedBlocks']());return _0x208659['length']?_0xd476a9['createPositionAfter'](_0x208659['pop']()):_0x5bc973['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x29b36d,_0x28e72c){const {model:_0xb2bdc4,plugins:_0x2f00fc}=this['editor'];if(_0x2f00fc['has']('TableUtils')){const _0x48f98c=_0x2f00fc['get']('TableUtils')['getSelectedTableCells'](_0x28e72c);if(_0x48f98c['length']){const _0x28fc61=this['_getTableRowCountFromContent'](_0x29b36d),_0x4ee1fb=this['_createEmptyTableRows'](_0x48f98c,_0x28fc61);return _0xb2bdc4['createPositionAt'](_0x4ee1fb,0x0);}}return null;}['_getTableRowCountFromContent'](_0x367945){const _0x53b81b=this['editor']['plugins']['get']('TableUtils'),_0x1912fb=this['editor']['data']['parse'](_0x367945),_0x206898=Array['from'](_0x1912fb['getChildren']())['filter'](_0x5b997f=>_0x5b997f['is']('element','table'));let _0x6d0a27=0x0;return _0x206898['forEach'](_0x465d66=>{_0x6d0a27+=_0x53b81b['getRows'](_0x465d66);}),_0x6d0a27;}['_createEmptyTableRows'](_0x165aae,_0xde0a9e){const _0x57217a=this['editor']['plugins']['get']('TableUtils'),_0xf22bcc=_0x57217a['getRowIndexes'](_0x165aae),_0x3cce63=_0x57217a['getColumnIndexes'](_0x165aae),_0x22409e=_0xf22bcc['last']+0x1,_0x333eb2=_0x3cce63['first'],_0x538fac=_0x165aae[0x0]['findAncestor']('table');for(let _0x21b3e8=0x0;_0x21b3e8<_0xde0a9e;_0x21b3e8++)_0x57217a['insertRows'](_0x538fac,{'at':_0x22409e});return _0x538fac['getChild'](_0x22409e)['getChild'](_0x333eb2);}['_resetContentOfSelectedTableCells'](_0x35a6a5,_0x3a7e1d){const {plugins:_0x5dcac4}=this['editor'],{model:_0x248a0a}=_0x35a6a5;if(!_0x5dcac4['has']('TableUtils'))return;_0x5dcac4['get']('TableUtils')['getSelectedTableCells'](_0x3a7e1d)['length']&&_0x248a0a['deleteContent'](_0x3a7e1d);}}class x extends _0x445f1d{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x121e37('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x28d7a4){super(_0x28d7a4),this['name']='AIRequestError';}}function i(_0x171be7,_0x22f9b2,_0x3b7d15){const t=_0x171be7['t'];switch(_0x22f9b2){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',_0x3b7d15);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3b7d15);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'},_0x3b7d15);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 _0x22f9b2;}}class E extends _0x264c7f{['_commandDefinitions'];constructor(_0x5ca788,_0x236010){super(_0x5ca788),this['_commandDefinitions']=_0x236010,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x40389f,_0x31478c,_0x4bffc3)=>{this['isEnabled']&&(this['enabledCommandsIds']=F(this['_commandDefinitions'],_0x4bffc3));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x212886,_0x430d39,_0x3ed4db)=>{this['enabledCommandsIds']=_0x3ed4db?F(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0xf48da0=this['editor']['model'];this['_hasContext']=function(_0x580804){const _0x2786eb=_0x580804['document']['selection'];return _0x2786eb['isCollapsed']?0x0!==[..._0x2786eb['getSelectedBlocks']()]['length']&&![..._0x2786eb['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x580804['hasContent'](_0x2786eb['getFirstRange']());}(_0xf48da0);const _0x49cf18=_0xf48da0['document']['selection'],_0x3491b6=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x25265d of _0x49cf18['getRanges']())for(const _0x47dd50 of _0x25265d['getItems']())if(_0x47dd50['is']('element')&&_0x3491b6['includes'](_0x47dd50['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x982c28='',_0x37bcc7='',_0x237852='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x982c28,_0x37bcc7,_0x237852);}}function F(_0x457a86,_0x38f43d){const _0x10af6f=new Set();for(const _0x47c6ee of _0x457a86['values']())(_0x38f43d||!0x1===_0x47c6ee['requiresContent'])&&_0x10af6f['add'](_0x47c6ee['id']);return Array['from'](_0x10af6f);}const Q=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */
|
|
24
|
+
_0x3d44b9(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x187173,_0x3954c4,_0x135dc5){super(),this['editor']=_0x187173,this['textAdapter']=_0x3954c4,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x135dc5,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x5dbd87,_0x598996,_0x4f2649)=>{this['view']['value']=this['_sanitizeHTML'](_0x4f2649);}),this['listenTo'](this['view'],'submitPrompt',(_0xdbc045,_0x3b09b1)=>{const _0x41a1cf=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x3b09b1,_0x41a1cf,'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:_0x38fa28,query:_0x440cf1,htmlContent:_0x12066,label:_0x2a37a6,mainActionLabel:_0x343749}){this['view']['prompt']=_0x2a37a6,this['view']['mainAction']=_0x343749,this['initialContext']=_0x12066,_0x440cf1&&(this['view']['isRendered']?this['_handleQuery'](_0x440cf1,_0x12066,_0x38fa28,_0x2a37a6):this['view']['once']('render',()=>{this['_handleQuery'](_0x440cf1,_0x12066,_0x38fa28,_0x2a37a6);}));}['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'](_0x2d256f,_0xb9ae54,_0x50bfb4,_0x183f60){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0xb9ae54,this['previousQuery']=_0x2d256f,this['previousLabel']=_0x183f60||_0x2d256f,this['previousActionId']=_0x50bfb4,new Promise(_0x3848c9=>{this['textAdapter']['makeRequest']({'query':_0x2d256f,'context':_0xb9ae54,'onData':_0x320989=>{this['currentResponse']=_0x320989,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x50bfb4})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0xd3767f=>{_0xd3767f instanceof R?this['view']['handleError'](_0xd3767f['message']):this['view']['handleError'](),_0x3848c9();})['finally'](()=>{this['stopProcessing'](),_0x3848c9();});});}['_parseAndNormalizeContent'](_0x168cc6,_0x3f53ab=!0x1){const _0x38d782=Q['exec'](_0x168cc6);_0x168cc6=_0x38d782?_0x168cc6['substring'](_0x38d782[0x1]['length']):_0x168cc6['length']<0x64&&!_0x3f53ab?'':this['_stripMarkdownSyntax'](_0x168cc6);const _0x4abb3e=this['_domParser']['parseFromString'](_0x168cc6,'text/html');if(_0x38d782){const _0x4d98b4=Array['from'](_0x4abb3e['body']['childNodes']);_0x4d98b4['reverse']();for(const _0x1d7cb8 of _0x4d98b4){if(_0x1d7cb8['nodeType']==Node['ELEMENT_NODE'])break;_0x1d7cb8['remove']();}}const _0x3765d3=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x4abb3e['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x3765d3);const _0x4df45c=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0xfbfb8a=this['editor']['data']['toModel'](_0x3765d3);return _0x4df45c||_0xfbfb8a['markers']['clear'](),this['editor']['data']['stringify'](_0xfbfb8a);}['_normalizeResponseHeadings'](_0x449c0a){const _0x27e9f5=new _0x2bcd5a(this['editor']['editing']['view']['document']),_0x482b65=new _0x1981f7({'name':/^h[1-5]$/}),_0x58f86a=[];let _0x37e3f4=!0x1;for(const _0x41d2d2 of _0x449c0a)_0x41d2d2['is']('element')&&_0x482b65['match'](_0x41d2d2)&&(_0x58f86a['push'](_0x41d2d2),'h1'==_0x41d2d2['name']&&(_0x37e3f4=!0x0));if(_0x37e3f4){for(const _0x419557 of _0x58f86a)_0x27e9f5['rename']('h'+(parseInt(_0x419557['name'][0x1])+0x1),_0x419557);}}['_isH1TagSupportEnabled'](){const {data:_0x16818c,editing:_0x465c22}=this['editor'],_0x2fc700=_0x16818c['htmlProcessor']['toView']('<h1></h1>'),_0x1d5902=_0x16818c['toView'](_0x16818c['toModel'](_0x2fc700));return!!_0x465c22['view']['domConverter']['viewToDom'](_0x1d5902)['querySelector']('h1');}['_sanitizeHTML'](_0xeccf38){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0xeccf38),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x4c8a7b){const _0x4cb7ba=_0x4c8a7b['trim']();return _0x4cb7ba['startsWith']('```html')?_0x4cb7ba['endsWith']('```')?_0x4cb7ba['substring'](0x7,_0x4cb7ba['length']-0x3):_0x4cb7ba['substring'](0x7):_0x4c8a7b;}}const _={'REPLACE':'replace','INSERT':'insert'};class at extends ot{constructor(_0x17a9a3){super(_0x17a9a3),this['set']('isVisible',!0x1),this['set']('mainAction',_['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x2fae4b=>i(_0x17a9a3,'AI_'+_0x2fae4b['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x17a9a3,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x17a9a3,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x17a9a3,'Stop'));const _0x7f6aad=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x7f6aad['if']('isVisible','ck-hidden',_0x3bc39a=>!_0x3bc39a)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x57cbd0,_0x4e294e){const _0x51adab=new _0x41d325(this['locale']);return _0x51adab['set']({'label':_0x57cbd0,'class':_0x4e294e||'','isVisible':!0x0,'withText':!0x0}),_0x51adab;}}class ct extends _0x3908bc{['contentFieldView'];['copyButtonView'];constructor(_0x4f9483,_0x2e74df=''){super(_0x4f9483),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x23399c=this['bindTemplate'];this['contentFieldView']=new bt(_0x4f9483,_0x2e74df),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x23399c['if']('isVisible','ck-hidden',_0x3bc919=>!_0x3bc919)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x23399c['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 _0x5c8594=!0x1;this['on']('change:value',(_0x598458,_0x287a37,_0x14bf21)=>{const _0xfc546b=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x14bf21),this['isProcessing']&&_0xfc546b&&!_0x5c8594&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x51e102,_0x2c490f,_0x481f9a)=>{_0x5c8594=!0x1,_0x481f9a?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x5c8594=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x5c8594=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x11509c=this['locale'],_0x41375c=new _0x41d325(this['locale']),_0x277b53='ck-ai-form__copy-button';return _0x41375c['set']({'label':i(_0x11509c,'Copy'),'icon':_0x35790e,'class':_0x277b53,'tooltip':!0x0}),_0x41375c['bind']('isVisible')['to'](this,'value',_0x4e5872=>!!_0x4e5872),_0x41375c['bind']('isEnabled')['to'](this,'isProcessing',_0x300a97=>!_0x300a97),_0x41375c['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x41375c['icon']=_0x501ee8,_0x41375c['class']=_0x277b53+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x41375c['icon']=_0x35790e,_0x41375c['class']=_0x277b53;},0x3e8);}),_0x41375c;}['_copyHTMLToClipboard'](_0x31816b){const {window:_0x23f571,document:_0x1139e5}=_0x52b4bd;if(_0x23f571['ClipboardItem']){const {Blob:_0x32a006,ClipboardItem:_0x5336f3}=_0x23f571,_0x4d9e97=[new _0x5336f3({'text/html':new _0x32a006([_0x31816b['innerHTML']],{'type':'text/html'}),'text/plain':new _0x32a006([_0x31816b['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x4d9e97);}else{const _0x541b7e=_0x1139e5['createElement']('div');_0x541b7e['style']['position']='absolute',_0x541b7e['style']['left']='-9999px',_0x541b7e['innerHTML']='<span>[</span>'+_0x31816b['innerHTML']+'<span>]</span>',_0x1139e5['body']['appendChild'](_0x541b7e);const _0xd1da31=_0x1139e5['createRange']();_0xd1da31['setStartAfter'](_0x541b7e['firstElementChild']),_0xd1da31['setEndBefore'](_0x541b7e['lastElementChild']);const _0x3dbe79=_0x23f571['getSelection']();_0x3dbe79['removeAllRanges'](),_0x3dbe79['addRange'](_0xd1da31),_0x1139e5['execCommand']('copy'),_0x541b7e['remove']();}}}class bt extends _0x3908bc{constructor(_0x3f0d6a,_0x3e4e92=''){super(_0x3f0d6a),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x3e4e92,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1619dc){this['element']['innerHTML']=_0x1619dc;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x477379=new _0x3908bc(),_0x30a7b2=this['locale'],_0x226315=new _0x3e46f7();return _0x226315['isVisible']=!0x0,_0x477379['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x226315,{'text':i(_0x30a7b2,'AI\x20is\x20writing...')}]}),_0x477379['render'](),_0x477379;}}class mt extends _0x3908bc{constructor(_0x4f2b19,_0x39b8ca=''){super(_0x4f2b19);const _0x2a181f=new _0x4b658a(),_0x5476e8=this['bindTemplate'];this['set']('text',_0x39b8ca),_0x2a181f['content']=_0x4b13de,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2a181f,{'text':_0x5476e8['to']('text')}]});}}class lt extends st{['submitButtonView'];['showHistoryButtonView'];constructor(_0x276475,_0x2cdf0a){super(_0x276475,_0x2cdf0a),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',(_0x231081,_0x204cea)=>{_0x231081['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x204cea());});}['_createSubmitButton'](){const _0x594e0a=new _0x41d325(this['locale']),_0x3c6e80=this['locale'];return _0x594e0a['set']({'icon':it,'label':i(_0x3c6e80,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x594e0a['on']('execute',()=>{this['submit']();}),_0x594e0a['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x21ca73,_0x55e37c)=>!_0x21ca73&&_0x55e37c),_0x594e0a;}['_createShowHistoryButton'](){const _0x4836ea=new _0x41d325(this['locale']),_0x5cb6d1=this['resultsView'],_0xb68679=this['locale'];_0x4836ea['set']({'label':i(_0xb68679,'History'),'withText':!0x1,'icon':tt,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4836ea['bind']('isOn')['to'](_0x5cb6d1,'isVisible'),_0x4836ea['bind']('isEnabled')['to'](this,'isEnabled'),_0x4836ea['on']('execute',()=>{_0x5cb6d1['isVisible']=!_0x5cb6d1['isVisible'],_0x5cb6d1['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x575921=()=>{_0x52b4bd['window']['requestAnimationFrame'](()=>{if(_0x2fe5c6(this['element'])){const _0x3081ba=new _0x5ccf5c(this['queryView']['fieldView']['element']),_0x58ed0c=_0x3081ba['width'],_0x23be05='rtl'===_0xb68679['uiLanguageDirection']?'left':'right';_0x3081ba['excludeScrollbarsAndBorders'](),_0x4836ea['element']['style'][_0x23be05]=_0x58ed0c-_0x3081ba['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x575921),this['on']('render',_0x575921),_0x4836ea;}['submit'](){const _0x44c1f5=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x44c1f5);}['focus'](_0x49fa7f){-0x1===_0x49fa7f?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class pt extends yt{['historyGroupView'];['clearHistoryButton'];constructor(_0x2b43b9){super(_0x2b43b9),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Ct(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x2b43b9,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x2b5cd7=0x0;for(const _0x2b2a17 of this['items'])_0x2b5cd7+=_0x2b2a17['items']['length'];return{'resultsCount':_0x2b5cd7,'totalItemsCount':_0x2b5cd7};}['_createClearHistoryButton'](){const _0x4d0498=this['locale'],_0x34c9ab=new _0x41d325(this['locale']);return _0x34c9ab['set']({'label':'('+i(_0x4d0498,'Clear')+')','withText':!0x0}),_0x34c9ab['on']('execute',()=>this['fire']('clearHistory')),_0x34c9ab;}}class ut extends xt{constructor(_0x483242){super();const _0xf513be=new wt(),_0x5a17aa=new _0x41d325(this['locale'],_0xf513be);this['children']['add'](_0x5a17aa),_0x5a17aa['set']({'label':_0x483242['prompt'],'withText':!0x0}),_0x5a17aa['on']('execute',()=>{this['fire']('execute',{'value':kt(_0x483242['prompt'])});});}}const ts='CKEditor/AIFormView/PromptHistory';class dt extends _0x1d2ade{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1e5bee,_0x25be52)=>{const _0x1a7e9d=os(_0x25be52['prompt']);for(const _0x294041 of this)if(_0x294041!=_0x25be52&&os(_0x294041['prompt'])===_0x1a7e9d){this['remove'](_0x294041);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x15f2a9=sessionStorage['getItem'](ts)||'[]';this['addMany'](JSON['parse'](_0x15f2a9));}['_saveToSessionStorage'](){sessionStorage['setItem'](ts,JSON['stringify'](this['map'](_0x336ded=>_0x336ded)));}}function os(_0x43ec66){return _0x43ec66['toLowerCase']()['trim']();}class k extends _0x3908bc{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x16e839,_0x4d04f5,_0x93e90b=''){super(_0x16e839),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(_0x16e839),this['contentArea']=new ct(_0x16e839,_0x93e90b),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 _0x320c90=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x4d04f5],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x320c90['if']('isError','ck-hidden',_0x126969=>!_0x126969)]},'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'](_0x599fd3=0x1){-0x1===_0x599fd3?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 _0x1f1dbc=this['locale'],_0x3a9edb=new lt(_0x1f1dbc,{'queryView':{'label':i(_0x1f1dbc,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':nt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x1f1dbc,'Empty\x20history'),'secondary':i(_0x1f1dbc,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x3a9edb['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x4da9b0,_0x9c99aa)=>_0x4da9b0&&!_0x9c99aa),this['listenTo'](_0x3a9edb,'submit',(_0xa6f704,_0x1ca16f)=>{this['prompt']=_0x1ca16f;const _0x390ac1=ft(_0x1ca16f);this['fire']('submitPrompt',_0x390ac1),_0x1ca16f['trim']()&&this['_promptHistory']['add']({'prompt':_0x390ac1},0x0);},{'priority':'high'}),_0x3a9edb;}['_createHistoryView'](){const _0x2902cf=new pt(this['locale']);return _0x2902cf['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](ut),_0x2902cf['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2902cf;}['_createToolbar'](){const _0x19195e=new at(this['locale']);return _0x19195e['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x880f94,_0x4c333e,_0x37766e)=>_0x880f94&&!_0x4c333e&&!!_0x37766e),_0x19195e['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x19195e['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x338334,_0x2f16b6,_0x436467)=>_0x338334&&!_0x2f16b6&&!!_0x436467),_0x19195e['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x19195e['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3c2710,_0x572b19)=>_0x3c2710&&!_0x572b19),_0x19195e['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x19195e['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x19195e['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x19195e;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0xb27f06=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=i(_0xb27f06,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x23e8c3){const _0x291abc=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x23e8c3||i(_0x291abc,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const l=globalThis['DataTransfer'];class n extends _0x445f1d{['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[_0x56c6b4,a,x,_0x1a963f];}constructor(_0x21f7ff){super(_0x21f7ff),_0x21f7ff['config']['define']('ai.aiAssistant.disabledElements',['media','rawHtml','tableOfContents']),_0x21f7ff['config']['define']('ai.aiAssistant.contentAreaCssClass',''),_0x21f7ff['config']['define']('ai.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x21f7ff['config']['get']('ai.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x1fea2b}=this;this['_aiAdapter']=_0x1fea2b['plugins']['get'](x),this['_dialog']=_0x1fea2b['plugins']['get'](_0x1a963f),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x1eabfe=new E(_0x1fea2b,Array['from'](this['_commandDefinitions']['values']()));_0x1fea2b['commands']['add']('showAIAssistant',_0x1eabfe),_0x1fea2b['ui']['componentFactory']['add']('aiCommands',_0x194428=>{const _0x504f67=_0x42d16c(_0x194428);return _0x504f67['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x504f67['buttonView']['set']({'label':i(_0x194428,'AI\x20Commands'),'icon':_0x55a326,'tooltip':!0x0}),_0x504f67['on']('execute',_0x4627ff=>this['_onExecute'](_0x4627ff['source']['id'])),_0x3f1bb6(_0x504f67,_0x1fea2b['ui']['view']['body'],function(_0x450f85){const _0x2a184f=o(_0x450f85['config']['get']('ai.aiAssistant.commands'),_0x450f85['locale']),_0x3dad49=U(_0x450f85,_0x2a184f)['filter'](_0x58a2d1=>_0x58a2d1['commands']['length']);if(0x1===_0x3dad49['length'])return U(_0x450f85,_0x3dad49[0x0]['commands'])['map'](_0x40a2ba=>({'id':_0x40a2ba['id'],'label':_0x40a2ba['label']}));return _0x3dad49['map'](_0x6bec3=>{const {groupId:_0x27fbc4,groupLabel:_0x5440b6,commands:_0x4f555d}=_0x6bec3,_0x5b6e1a=U(_0x450f85,_0x4f555d)['map'](_0x4de1ef=>({'id':_0x4de1ef['id'],'label':_0x4de1ef['label']}));return{'id':_0x27fbc4,'menu':_0x5440b6||_0x27fbc4,'children':_0x5b6e1a};});}(_0x1fea2b),{'ariaLabel':i(_0x194428,'AI\x20Commands')}),_0x504f67['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x1eabfe['on']('change:enabledCommandsIds',_0x5e0e08),_0x504f67['menuView']['once']('render',_0x5e0e08),_0x504f67;function _0x5e0e08(){_0x504f67['isEnabled']=_0x1eabfe['enabledCommandsIds']['length']>0x0;for(const _0xf0c5dc of _0x504f67['menuView']['buttons'])_0xf0c5dc['isEnabled']=_0x1eabfe['enabledCommandsIds']['includes'](_0xf0c5dc['id']);}}),_0x1fea2b['ui']['componentFactory']['add']('menuBar:aiCommands',_0x4aa7a3=>{const _0x36eb8c=new _0x45507d(_0x4aa7a3);_0x36eb8c['buttonView']['set']({'label':i(_0x4aa7a3,'AI\x20Commands'),'icon':_0x55a326}),_0x36eb8c['bind']('isEnabled')['to'](_0x1eabfe,'enabledCommandsIds',_0x2a6d5b=>_0x2a6d5b['length']>0x0);const _0xbe0fd1=o(_0x1fea2b['config']['get']('ai.aiAssistant.commands'),_0x4aa7a3);return this['_populateMenuBarMenu'](_0x1eabfe,_0x36eb8c,_0xbe0fd1,_0x3ae89b=>this['_onExecute'](_0x3ae89b)),_0x36eb8c;}),_0x1fea2b['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x4e90af=this['_createAIAssistantUIButton'](_0x41d325);return _0x4e90af['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x4e90af;}),_0x1fea2b['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x51f742=this['_createAIAssistantUIButton'](_0x22e955);return _0x51f742['set']({'role':'menuitemcheckbox'}),_0x51f742;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x56a04e=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1a4900;for(const _0x59610e in _0x56a04e){const _0x5bf5a7=_0x59610e,_0x1f436b=_0x56a04e[_0x5bf5a7];if('aiLicenseKeyValid'==_0x1f436b||'aiLicenseKeyInvalid'==_0x1f436b||'aiLicenseKeyExpired'==_0x1f436b||'aiLicenseKeyDomainLimit'==_0x1f436b||'aiLicenseKeyNotAllowed'==_0x1f436b||'aiLicenseKeyEvaluationLimit'==_0x1f436b||'aiLicenseKeyTrialLimit'==_0x1f436b||'aiLicenseKeyUsageLimit'==_0x1f436b){delete _0x56a04e[_0x5bf5a7],_0x1a4900=_0x1f436b,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1a4900&&_0x56a04e['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1a4900&&_0x56a04e['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1a4900&&_0x56a04e['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1a4900&&_0x56a04e['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1a4900&&_0x56a04e['_showLicenseError']('evaluationLimit'),'aiLicenseKeyTrialLimit'==_0x1a4900&&_0x56a04e['_showLicenseError']('trialLimit'),'aiLicenseKeyUsageLimit'==_0x1a4900&&_0x56a04e['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x25a6da='',_0x253fec='',_0x5b69ea='custom'){const _0x56a568=this['editor'],_0x5a44e6=_0x56a568['editing']['view'],_0x346215=_0x56a568['plugins']['get'](a),_0x511743=_0x56a568['plugins']['get'](_0x56c6b4);_0x346215['showFakeVisualSelection']();const _0x4748b2=new l(),_0x4f6383=new ClipboardEvent('copy',{'clipboardData':_0x4748b2}),_0x22a4e7=new _0x4683fe(_0x4748b2),_0x79593=new _0x52f274(_0x5a44e6,_0x4f6383,{'dataTransfer':_0x22a4e7});_0x511743['_forceMarkersCopy']('comment',()=>{_0x5a44e6['document']['fire']('copy',_0x79593);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new j(_0x56a568,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x57c08c=_0x22a4e7['getData']('text/html');const _0x211e2a=_0x56a568['model']['document']['selection'],_0x37946a=Array['from'](_0x211e2a['getRanges']());0x1===_0x37946a['length']&&_0x37946a[0x0]['isFlat']&&!_0x211e2a['getSelectedElement']()&&''!==_0x57c08c['replace'](/ /g,'')['trim']()&&(_0x57c08c='<p>'+_0x57c08c+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x5b69ea,'query':_0x25a6da,'htmlContent':_0x57c08c,'label':_0x253fec,'mainActionLabel':_[_0x56a568['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x31cd4a,'title':i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':_0x45fd36['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x346215['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x58e3c2=new Map(),_0x207b44=o(this['editor']['config']['get']('ai.aiAssistant.commands'),this['editor']['locale']);for(const _0x239c7f of _0x207b44)for(const _0x16f4ac of _0x239c7f['commands'])_0x58e3c2['set'](_0x16f4ac['id'],{..._0x16f4ac,'groupId':_0x239c7f['groupId'],'groupLabel':_0x239c7f['groupLabel']||_0x239c7f['groupId']});return _0x58e3c2;}['_createAIAssistantUIButton'](_0x2b87b8){const _0x1e97db=this['editor'],_0x4f7180=_0x1e97db['commands']['get']('showAIAssistant'),_0x24b5e6=new _0x2b87b8(_0x1e97db['locale']);return _0x24b5e6['set']({'label':i(_0x1e97db['locale'],'AI\x20Assistant'),'icon':_0x31cd4a,'isToggleable':!0x0}),_0x24b5e6['bind']('isEnabled')['to'](_0x4f7180),_0x24b5e6['bind']('isOn')['to'](this['_dialog'],'id',_0x5af3ba=>'aiAssistant'===_0x5af3ba),this['listenTo'](_0x24b5e6,'execute',()=>{_0x24b5e6['isOn']?this['hideUI']():_0x4f7180['execute']();}),_0x24b5e6;}['_initView'](){const _0x510b6c=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',()=>{_0x510b6c['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x510b6c['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x479180,ui:{ariaLiveAnnouncer:_0x29a5bb}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0xf12c30,_0x3fdb7a,_0x1d6b94)=>{const _0x483923=this['_aiAssistantController']['currentContext'];_0x1d6b94?_0x29a5bb['announce'](i(_0x479180,'AI\x20is\x20writing')):_0x483923&&_0x29a5bb['announce'](i(_0x479180,'Generated\x20content:\x20%0',_0x483923),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x2f3cf3,_0x1d1689,_0xc70e87)=>{if(_0xc70e87){const _0x345f20=this['_formView']['errorView']['text'];_0x29a5bb['announce'](i(_0x479180,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x345f20));}});}['_onExecute'](_0x5ce793){const _0x1af264=this['_commandDefinitions']['get'](_0x5ce793),_0x198855=this['editor'],_0x4d2b11=_0x198855['model']['document']['selection'],_0x31f152=_0x198855['commands']['get']('showAIAssistant'),_0x25339b=_0x198855['plugins']['get'](a),_0x2bcdd2=''+(_0x1af264['groupId']!==K?_0x1af264['groupLabel']+':\x20':'')+_0x1af264['label'];if(!0x1!==_0x1af264['requiresContent']&&_0x4d2b11['isCollapsed']){const _0x28be2c=_0xa7c24(_0x4d2b11['getSelectedBlocks']())||_0x198855['model']['schema']['getLimitElement'](_0x4d2b11);_0x198855['model']['change'](_0x2db7d8=>{_0x2db7d8['setSelection'](_0x28be2c,'in');});}_0x25339b['showFakeVisualSelection'](),_0x31f152['execute'](_0x1af264['prompt'],_0x2bcdd2,'command:'+_0x5ce793);}['_populateMenuBarMenu'](_0x46401a,_0x3861ed,_0x346bf4,_0x429362){const _0x7333cd=this['editor'],_0x59bf14=_0x7333cd['locale'],_0x546c85=new _0x5bd3d0(_0x59bf14),_0x21432d=U(_0x7333cd,_0x346bf4)['filter'](_0x4cb398=>_0x4cb398['commands']['length']);0x1===_0x21432d['length']?this['_getMenuBarGroupButtons']({'command':_0x46401a,'commands':_0x21432d[0x0]['commands'],'parentMenuView':_0x3861ed,'onExecute':_0x429362})['forEach'](_0x5a35b3=>_0x546c85['items']['add'](_0x5a35b3)):_0x21432d['forEach'](({groupId:_0x1e5903,groupLabel:_0x2a556c,commands:_0x33b3c5})=>{const _0x345451=new _0xd01a97(_0x59bf14,_0x3861ed),_0x20963c=new _0x45507d(_0x59bf14),_0x1c504d=new _0x5bd3d0(_0x59bf14),_0x1bf995=this['_getMenuBarGroupButtons']({'command':_0x46401a,'commands':_0x33b3c5,'parentMenuView':_0x20963c,'onExecute':_0x429362});_0x20963c['buttonView']['set']({'label':_0x2a556c||_0x1e5903}),_0x20963c['delegate']('execute')['to'](_0x3861ed),_0x1c504d['items']['addMany'](_0x1bf995),_0x20963c['panelView']['children']['add'](_0x1c504d),_0x345451['children']['add'](_0x20963c),_0x546c85['items']['add'](_0x345451);}),_0x3861ed['panelView']['children']['add'](_0x546c85);}['_getMenuBarGroupButtons']({command:_0x1d89b6,commands:_0x202694,parentMenuView:_0x517d18,onExecute:_0x2f3dcd}){const _0x5807c8=this['editor'],_0x3cec51=_0x5807c8['locale'];return U(_0x5807c8,_0x202694)['map'](_0x243350=>{const _0x58c764=new _0xd01a97(_0x3cec51,_0x517d18),_0x229106=new _0x22e955(_0x3cec51);return _0x229106['set']({'label':_0x243350['label']}),_0x229106['delegate']('execute')['to'](_0x517d18),_0x229106['on']('execute',()=>_0x2f3dcd(_0x243350['id'])),_0x229106['bind']('isEnabled')['to'](_0x1d89b6,'enabledCommandsIds',_0x5dcf5a=>_0x5dcf5a['includes'](_0x243350['id'])),_0x58c764['children']['add'](_0x229106),_0x58c764;});}}function T(_0x556dad,_0x2bc7f1){return void 0x0!==_0x556dad['order']&&void 0x0===_0x2bc7f1['order']?0x1:void 0x0===_0x556dad['order']&&void 0x0!==_0x2bc7f1['order']?-0x1:void 0x0!==_0x556dad['order']&&void 0x0!==_0x2bc7f1['order']?_0x556dad['order']-_0x2bc7f1['order']:0x0;}function U(_0x431732,_0x233552){_0x233552['sort'](T);const _0x3c2ade={},_0x4206a6=[];for(const _0x4958f6 of _0x233552)if(void 0x0!==_0x4958f6['order']){if(_0x4958f6['order']in _0x3c2ade)throw new _0x121e37('ai-commands-config-order-collision',_0x431732,{'conflictingDefinitions':[_0x4958f6,_0x3c2ade[_0x4958f6['order']]]});_0x3c2ade[_0x4958f6['order']]=_0x4958f6,_0x4206a6['splice'](_0x4958f6['order'],0x0,_0x4958f6);}else _0x4206a6['push'](_0x4958f6);return _0x4206a6;}class At extends _0x445f1d{static get['requires'](){return[n,a];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xeb766){super(_0xeb766);const _0xdf2a0b=_0xeb766['config'],_0x1ea6ca=_0xeb766['locale'];_0xdf2a0b['define']('ai.aiAssistant.preserveComments',!0x0),_0xdf2a0b['define']('ai.aiAssistant.commands',_t(_0x1ea6ca)),_0xdf2a0b['define']('ai.aiAssistant.extraCommandGroups',[]),_0xdf2a0b['define']('ai.aiAssistant.removeCommands',[]);let _0x4cde0c=o(_0xdf2a0b['get']('ai.aiAssistant.commands'),_0x1ea6ca);const _0x3fed05=_0xdf2a0b['get']('ai.aiAssistant.extraCommandGroups'),_0x4c7dbe=_0xdf2a0b['get']('ai.aiAssistant.removeCommands');_0x3fed05['forEach'](_0x194b5b=>{const _0x30c91a=_0x4cde0c['find'](_0x136e18=>_0x136e18['groupId']===_0x194b5b['groupId']);_0x30c91a?_0x30c91a['commands']=_0x30c91a['commands']['concat'](_0x194b5b['commands']):_0x4cde0c['push'](_0x194b5b);}),_0x4cde0c=_0x4cde0c['filter'](_0xa0cab5=>!_0x4c7dbe['includes'](_0xa0cab5['groupId'])),_0x4cde0c['forEach'](_0x4d3327=>{_0x4d3327['commands']=_0x4d3327['commands']['filter'](_0x339830=>!_0x4c7dbe['includes'](_0x339830['id']));}),_0xdf2a0b['set']('ai.aiAssistant.commands',_0x4cde0c);}}function _t(_0x1af476){return[{'groupId':'editOrReview','groupLabel':i(_0x1af476,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':i(_0x1af476,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':i(_0x1af476,'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(_0x1af476,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':i(_0x1af476,'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(_0x1af476,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':i(_0x1af476,'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(_0x1af476,'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(_0x1af476,'Change\x20tone'),'commands':[{'id':'professional','label':i(_0x1af476,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':i(_0x1af476,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':i(_0x1af476,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':i(_0x1af476,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':i(_0x1af476,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':i(_0x1af476,'Change\x20style'),'commands':[{'id':'business','label':i(_0x1af476,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':i(_0x1af476,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':i(_0x1af476,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':i(_0x1af476,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':i(_0x1af476,'Translate'),'commands':[{'id':'translateEnglish','label':i(_0x1af476,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':i(_0x1af476,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':i(_0x1af476,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':i(_0x1af476,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':i(_0x1af476,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':i(_0x1af476,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':i(_0x1af476,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':i(_0x1af476,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class S extends _0x445f1d{['abortController'];static get['requires'](){return[x];}constructor(_0x5db517){super(_0x5db517),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'](_0x31a3e0){return this['sendRequest'](_0x31a3e0)['catch'](_0x58a5a5=>{if(_0x58a5a5 instanceof R)return Promise['reject'](_0x58a5a5);if('AbortError'==_0x58a5a5['name'])return Promise['resolve']();throw console['error'](_0x58a5a5),new _0x121e37('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x5b675a,_0x333f56){const _0x527daa=this['editor']['locale'],_0x191dcb={'Content-Type':'application/json'};if('object'==typeof _0x5b675a)Object['assign'](_0x191dcb,_0x5b675a);else{if(_0x5b675a)try{const _0xae8830=await _0x5b675a(_0x333f56);Object['assign'](_0x191dcb,_0xae8830);}catch{return Promise['reject'](new R(i(_0x527daa,'AI_ERROR_GET_HEADERS')));}}return _0x191dcb;}async['_prepareRequestParameters'](_0x4e3abd,_0x28b6a6){const _0xc69cca=this['editor']['locale'];if('object'==typeof _0x4e3abd)return _0x4e3abd;try{return await _0x4e3abd(_0x28b6a6);}catch{return Promise['reject'](new R(i(_0xc69cca,'AI_ERROR_GET_PARAMETERS')));}}}class It extends S{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x343c30){super(_0x343c30),_0x343c30['config']['define']('ai.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x343c30['config']['get']('ai.openAI.requestParameters')||_0x343c30['config']['define']('ai.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x343c30['config']['get']('ai.openAI.apiUrl'),this['_requestHeaders']=_0x343c30['config']['get']('ai.openAI.requestHeaders')||{},this['_requestParameters']=_0x343c30['config']['get']('ai.openAI.requestParameters');}async['sendRequest']({query:_0x1437f2,context:_0x5f86b8,onData:_0x39a95b,actionId:_0x4de2aa}){const _0x24a56a=this['editor']['locale'],_0x2168ff=await this['prepareMessages'](_0x1437f2,_0x5f86b8,_0x4de2aa),_0x2748cf=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4de2aa),_0x58a4bc=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4de2aa),_0x16fd3a={'messages':_0x2168ff,..._0x58a4bc},_0x1e17bf={'method':'POST','headers':_0x2748cf,'body':JSON['stringify'](_0x16fd3a),'signal':this['abortController']['signal']},_0x576009=await fetch(this['_apiUrl'],_0x1e17bf);if(_0x576009['ok'])return _0x58a4bc['stream']?await this['_readStreamableResponse'](_0x576009,_0x39a95b):await this['_readStaticResponse'](_0x576009,_0x39a95b),Promise['resolve']();{const _0x3a2b7e=await _0x576009['text']();return _0x3a2b7e['includes']('context_length_exceeded')?Promise['reject'](new R(i(_0x24a56a,'AI_ERROR_CONTEXT_LENGTH'))):_0x3a2b7e['includes']('Moderation')?Promise['reject'](new R(i(_0x24a56a,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x3a2b7e));}}async['prepareMessages'](_0x70b74,_0x1f924c,_0x18a4ad){let _0x13a62a,_0x4bed09;return _0x1f924c?(_0x13a62a='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.',_0x4bed09='Instruction:\x0a'+_0x70b74+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x1f924c):(_0x13a62a='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.',_0x4bed09=_0x70b74),[{'role':'system','content':_0x13a62a},{'role':'user','content':_0x4bed09}];}async['_readStreamableResponse'](_0x39b780,_0x5ef49f){const _0x2de0cf=_0x39b780['body']['getReader'](),_0x100b69=new TextDecoder();let _0x57cc84='',_0x23e5fd='',_0x463f1e='',_0x2286cb=!0x1;for(;!_0x2286cb;){const {done:_0x4658cb,value:_0x4094be}=await _0x2de0cf['read'](),_0x63306a=_0x57cc84+_0x100b69['decode'](_0x4094be);let _0x3fa274='';_0x2286cb=_0x4658cb;try{_0x3fa274=this['_cleanUpData'](_0x63306a),_0x57cc84='';}catch{_0x57cc84=_0x63306a;continue;}_0x23e5fd+=_0x3fa274,!_0x2286cb&&this['_isBufferIncomplete'](_0x23e5fd)||_0x23e5fd&&(_0x463f1e+=_0x23e5fd,_0x23e5fd='',_0x5ef49f(_0x463f1e));}return Promise['resolve']();}async['_readStaticResponse'](_0x992e7a,_0x38193e){return _0x38193e((await _0x992e7a['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x3ffa90){const _0x40fb18=_0x3ffa90['split']('<')['length']!==_0x3ffa90['split']('>')['length'],_0x465329=_0x3ffa90['length']<0x1e;return _0x40fb18&&_0x465329;}['_cleanUpData'](_0x54938b){return _0x54938b['split'](/\n(?![^{]*\})/g)['map'](_0x3187ac=>_0x3187ac['replace']('data:\x20',''))['filter'](_0x149bbe=>_0x149bbe&&_0x149bbe['length']>0x0&&'[DONE]'!==_0x149bbe)['map'](_0x5d8549=>{const {choices:_0x1ac571}=JSON['parse'](_0x5d8549);if(_0x1ac571[0x0]?.['delta']?.['content'])return _0x1ac571[0x0]['delta']['content'];})['filter'](_0x3325e8=>_0x3325e8)['join']('');}}class Et extends S{['_apiUrl'];['_requestHeaders'];['_bedrockClientConfig'];['_requestParameters'];static get['pluginName'](){return'AWSTextAdapter';}constructor(_0x249b22){super(_0x249b22),_0x249b22['config']['get']('ai.aws.requestParameters')||_0x249b22['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']=_0x249b22['config']['get']('ai.aws.apiUrl'),this['_bedrockClientConfig']=_0x249b22['config']['get']('ai.aws.bedrockClientConfig'),this['_requestHeaders']=_0x249b22['config']['get']('ai.aws.requestHeaders'),this['_requestParameters']=_0x249b22['config']['get']('ai.aws.requestParameters');}async['sendRequest']({query:_0x1a67d9,context:_0x2ce8f5,onData:_0x321ded,actionId:_0x226984}){const {model:_0x29c14f,stream:_0x11e871,..._0x4d9346}=await this['_prepareRequestParameters'](this['_requestParameters'],_0x226984),_0x31f4c2={'prompt':await this['preparePrompt'](_0x1a67d9,_0x2ce8f5,_0x29c14f,_0x226984),..._0x4d9346};this['_apiUrl']?await this['_processProxyRequest'](_0x31f4c2,_0x29c14f,_0x11e871,_0x321ded,_0x226984):await this['_processAWSRequest'](_0x31f4c2,_0x29c14f,_0x11e871,_0x321ded);}async['preparePrompt'](_0x125a45,_0x3f138a,_0x53833a,_0x198618){let _0x5485ef,_0x5ddef8;return _0x3f138a?(_0x5485ef='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.',_0x5ddef8='Instruction:\x0a'+_0x125a45+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3f138a):(_0x5485ef='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.',_0x5ddef8=_0x125a45),'meta.llama'==this['getModelFamily'](_0x53833a)?'<<SYS>>\x0a'+_0x5485ef+'\x0a<</SYS>>\x0a[INST]\x0a'+_0x5ddef8+'\x0a[/INST]':'Human:\x0a'+_0x5485ef+'\x0a'+_0x5ddef8+'\x0a\x0aAssistant:';}['getModelFamily'](_0x46ad81){if(/^anthropic\.claude/['test'](_0x46ad81))return'anthropic.claude';if(/^ai21\.j2/['test'](_0x46ad81))return'ai21.j2';if(/^cohere\.command/['test'](_0x46ad81))return'cohere.command';if(/^meta\.llama/['test'](_0x46ad81))return'meta.llama';throw new R(i(this['editor']['locale'],'AI_ERROR_UNSUPPORTED_MODEL',_0x46ad81));}async['_processProxyRequest'](_0x259f3e,_0x4a7492,_0x80c662,_0x45be15,_0x2b719d){const _0x217b04={'method':'POST','headers':await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x2b719d),'body':JSON['stringify']({..._0x259f3e,'model':_0x4a7492,'stream':_0x80c662}),'signal':this['abortController']['signal']},_0x2ff477=await fetch(this['_apiUrl'],_0x217b04);_0x80c662?await this['_readStreamableResponse'](_0x2ff477,_0x4a7492,_0x45be15):await this['_readStaticResponse'](_0x2ff477,_0x4a7492,_0x45be15);}async['_processAWSRequest'](_0x41f2b6,_0x2f63c1,_0x5e3635,_0xe09aa5){const _0x284f62=new _0x34025c(this['_bedrockClientConfig']),_0x4a8ae7={'body':JSON['stringify'](_0x41f2b6),'contentType':'application/json','accept':'application/json','modelId':_0x2f63c1};let _0x22c8a3;if(_0x5e3635){const _0x55b474=new _0x225c82(_0x4a8ae7);_0x22c8a3=await _0x284f62['send'](_0x55b474,{'abortSignal':this['abortController']['signal']}),await this['_readAsyncIterableResponse'](_0x22c8a3,_0x2f63c1,_0xe09aa5);}else{const _0x37e729=new _0x711519(_0x4a8ae7);_0x22c8a3=await _0x284f62['send'](_0x37e729,{'abortSignal':this['abortController']['signal']}),await this['_readStaticResponse'](_0x22c8a3,_0x2f63c1,_0xe09aa5);}}async['_readAsyncIterableResponse'](_0xed66ff,_0x55cd5e,_0x2ed49e){const _0x215977=_0xed66ff['body'],_0x400fe9=new TextDecoder('utf-8');let _0x20609e='';for await(const _0x286807 of _0x215977)if(_0x286807['chunk']){const _0x4ec2ba=_0x400fe9['decode'](_0x286807['chunk']['bytes']),_0x10062b=JSON['parse'](_0x4ec2ba);_0x20609e+=this['_getGeneratedText'](_0x10062b,_0x55cd5e),_0x2ed49e(_0x20609e);}return Promise['resolve']();}async['_readStreamableResponse'](_0x369902,_0x5746f4,_0x2c396c){const _0x2b3b8e=_0x369902['body'],_0x44a5e5=new TextDecoder('utf-8'),_0x51a6c6=_0x2b3b8e['getReader']();let _0x2c49af='',_0x4d6a7='',_0x393e30=!0x1;for(;!_0x393e30;){const {done:_0x489229,value:_0x346093}=await _0x51a6c6['read']();if(_0x393e30=_0x489229,_0x393e30)break;const _0x212121=(_0x2c49af+_0x44a5e5['decode'](_0x346093))['split']('\x0a')['map'](_0x233578=>{try{return _0x2c49af='',JSON['parse'](_0x233578);}catch{return _0x2c49af=_0x233578,null;}})['filter'](_0x15db34=>null!==_0x15db34);_0x212121['length']&&(_0x4d6a7+=_0x212121['map'](_0x25071c=>this['_getGeneratedText'](_0x25071c,_0x5746f4))['join'](''),_0x2c396c(_0x4d6a7));}return Promise['resolve']();}async['_readStaticResponse'](_0x1fee5f,_0x4d50b3,_0x17fd50){let _0x2fc430;return _0x2fc430=_0x1fee5f instanceof Response?await _0x1fee5f['json']():JSON['parse'](new TextDecoder('utf-8')['decode'](_0x1fee5f['body'])),(_0x17fd50(this['_getGeneratedText'](_0x2fc430,_0x4d50b3)),Promise['resolve']());}['_getGeneratedText'](_0x31e25b,_0x433b7b){switch(this['getModelFamily'](_0x433b7b)){case'anthropic.claude':return _0x31e25b['completion'];case'ai21.j2':return _0x31e25b['completions'][0x0]['data']['text'];case'cohere.command':return _0x31e25b['generations'][0x0]['text'];case'meta.llama':return _0x31e25b['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.1-alpha.
|
|
3
|
+
"version": "46.0.1-alpha.1",
|
|
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.1-alpha.
|
|
33
|
-
"@ckeditor/ckeditor5-core": "46.0.1-alpha.
|
|
34
|
-
"@ckeditor/ckeditor5-engine": "46.0.1-alpha.
|
|
35
|
-
"@ckeditor/ckeditor5-icons": "46.0.1-alpha.
|
|
36
|
-
"@ckeditor/ckeditor5-table": "46.0.1-alpha.
|
|
37
|
-
"@ckeditor/ckeditor5-ui": "46.0.1-alpha.
|
|
38
|
-
"@ckeditor/ckeditor5-utils": "46.0.1-alpha.
|
|
39
|
-
"ckeditor5": "46.0.1-alpha.
|
|
32
|
+
"@ckeditor/ckeditor5-clipboard": "46.0.1-alpha.1",
|
|
33
|
+
"@ckeditor/ckeditor5-core": "46.0.1-alpha.1",
|
|
34
|
+
"@ckeditor/ckeditor5-engine": "46.0.1-alpha.1",
|
|
35
|
+
"@ckeditor/ckeditor5-icons": "46.0.1-alpha.1",
|
|
36
|
+
"@ckeditor/ckeditor5-table": "46.0.1-alpha.1",
|
|
37
|
+
"@ckeditor/ckeditor5-ui": "46.0.1-alpha.1",
|
|
38
|
+
"@ckeditor/ckeditor5-utils": "46.0.1-alpha.1",
|
|
39
|
+
"ckeditor5": "46.0.1-alpha.1",
|
|
40
40
|
"es-toolkit": "1.39.5"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|