UNPKG

@ckeditor/ckeditor5-ai

Version:

AI Assistant feature for CKEditor 5.

24 lines • 84.6 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{Plugin as _0x239301,Command as _0x351cf7,icons as _0x160769}from'@ckeditor/ckeditor5-core/dist/index.js';import{uid as _0x535d59,CKEditorError as _0x2981d1,ObservableMixin as _0x1a455e,global as _0x601a75,isVisible as it,Rect as st,Collection as _0x463b6b,FocusTracker as _0x1cab19,KeystrokeHandler as ts,first as _0x4abb0d}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as nt,ButtonView as _0x8cb510,View as _0x3d218a,SpinnerView as _0x1e1ef1,IconView as _0x5808d9,AutocompleteView as ot,ListView as lt,ListItemGroupView as ut,ListItemView as _0x2459b9,ButtonLabelView as te,FocusCycler as _0xce45fc,createLabeledTextarea as _0x5bb2a8,Dialog as _0xe1ce3f,createDropdown as _0x398943,addMenuToDropdown as _0x84c208,MenuBarMenuView as _0x4a0af4,MenuBarMenuListItemButtonView as _0x16bbb8,DialogViewPosition as _0x2fbb7c,MenuBarMenuListView as _0x47c417,MenuBarMenuListItemView as _0xfeaad3}from'@ckeditor/ckeditor5-ui/dist/index.js';import{icons as ct}from'ckeditor5-collaboration/dist/index.js';import{ClipboardPipeline as _0x273354,ClipboardMarkersUtils as _0x26c465}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{DomEventData as _0x47ee81,DataTransfer as _0x14381d,UpcastWriter as _0x2aac74,Matcher as _0x151934}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x4ca8dd,escape as _0x2c3093}from'lodash-es';import{BedrockRuntimeClient as _0x503d29,InvokeModelWithResponseStreamCommand as _0x597048,InvokeModelCommand as _0x3d89ac}from'@aws-sdk/client-bedrock-runtime';const x='_ungrouppedCommands';function o(_0x45207f,_0x5bd2bb){const _0x4906de=(0x0,_0x5bd2bb['t'])('Other');return _0x45207f['length']?'groupId'in _0x45207f[0x0]?_0x45207f:[{'groupId':x,'groupLabel':_0x4906de,'order':0x1/0x0,'commands':_0x45207f}]:[{'groupId':x,'groupLabel':_0x4906de,'order':0x1/0x0,'commands':[]}];}const dt=globalThis['DataTransfer'],f='ai-ui';class a extends _0x239301{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x11dd76}=this,_0xe5bea2=['ck-fake-ai-selection'];_0x11dd76['config']['get']('ai.useTheme')&&_0xe5bea2['push']('ck-ai-assistant-ui_theme'),_0x11dd76['conversion']['for']('editingDowncast')['markerToHighlight']({'model':f,'view':{'classes':_0xe5bea2,'priority':0xc}}),_0x11dd76['conversion']['for']('editingDowncast')['markerToElement']({'model':f,'view':(_0x5abc33,{writer:_0x49db80})=>{if(!_0x5abc33['markerRange']['isCollapsed'])return null;const _0x4544e8=_0x49db80['createUIElement']('span');return _0x49db80['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4544e8),_0x4544e8;}});}['afterInit'](){!async function(_0x41f1d9){const _0x5da87c=_0x36e662([0x67,0x77,0x4d,0x57,0x70,0x46,0x7a,0x38,0x35,0x52,0x5a,0x55,0x74,0x79,0x62,0x34,0x66,0x78,0x59,0x72,0x76,0x4f,0x47,0x48,0x45,0x56,0x64,0x61,0x69,0x75,0x43,0x33,0x51,0x4b,0x49,0x44,0x32,0x6a,0x71,0x6d,0x39,0x42,0x50,0x68,0x36,0x30,0x6e,0x37,0x6f,0x54,0x53,0x4e,0x65,0x4a,0x58,0x6b,0x63,0x4c,0x41,0x6c,0x31,0x73]),_0x4dcfdb=0x113777ec,_0x22774b=0x113016ac^_0x4dcfdb,_0x4c19ff=window[_0x36e662([0x44,0x61,0x74,0x65])][_0x36e662([0x6e,0x6f,0x77])](),_0x437b5d=_0x41f1d9[_0x36e662([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x53666c=new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x34ad45=>{_0x437b5d[_0x36e662([0x6f,0x6e,0x63,0x65])](_0x36e662([0x72,0x65,0x61,0x64,0x79]),_0x34ad45);}),_0x3a680a={[_0x36e662([0x6b,0x74,0x79])]:_0x36e662([0x45,0x43]),[_0x36e662([0x75,0x73,0x65])]:_0x36e662([0x73,0x69,0x67]),[_0x36e662([0x63,0x72,0x76])]:_0x36e662([0x50,0x2d,0x32,0x35,0x36]),[_0x36e662([0x78])]:_0x36e662([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]),[_0x36e662([0x79])]:_0x36e662([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]),[_0x36e662([0x61,0x6c,0x67])]:_0x36e662([0x45,0x53,0x32,0x35,0x36])},_0x48b968=_0x437b5d[_0x36e662([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x36e662([0x67,0x65,0x74])](_0x36e662([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x3036fe(){let _0x2e04af,_0x260484=null,_0x132f56=null;try{if(_0x48b968==_0x36e662([0x47,0x50,0x4c]))return _0x36e662([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x2e04af=_0x48aebe(),!_0x2e04af)return _0x36e662([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x2e04af[_0x36e662([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x132f56=_0x312bc0(_0x2e04af[_0x36e662([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x2e04af[_0x36e662([0x6a,0x74,0x69])])),await _0x3b9645()?_0x596816()?_0x2eb340()?_0x36e662([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x89cb99()?(_0x2e04af[_0x36e662([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x36e662([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x260484=_0x4f930c(_0x36e662([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),_0x2e04af[_0x36e662([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x36e662([0x74,0x72,0x69,0x61,0x6c])&&(_0x260484=_0x4f930c(_0x36e662([0x54,0x72,0x69,0x61,0x6c,0x4c,0x69,0x6d,0x69,0x74]))),await _0x57e867()):_0x36e662([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x36e662([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x36e662([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch(_0x4d1d3e){return _0x36e662([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x2eb340(){const _0xc7c92c=[_0x36e662([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x36e662([0x74,0x72,0x69,0x61,0x6c])][_0x36e662([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2e04af[_0x36e662([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x4c19ff/0x3e8:0xe10*_0x22774b;return _0x2e04af[_0x36e662([0x65,0x78,0x70])]<_0xc7c92c;}function _0x596816(){const _0x3c501a=_0x2e04af[_0x36e662([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x3c501a&&(!!_0x3c501a[_0x36e662([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x36e662([0x2a]))||!!_0x3c501a[_0x36e662([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x36e662([0x41,0x49])));}function _0x89cb99(){const _0x48271c=_0x2e04af[_0x36e662([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x48271c||0x0==_0x48271c[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x2b93ad}=new URL(window[_0x36e662([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x48271c[_0x36e662([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2b93ad))return!0x0;const _0x5c5896=_0x2b93ad[_0x36e662([0x73,0x70,0x6c,0x69,0x74])](_0x36e662([0x2e]));return _0x48271c[_0x36e662([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x3f7ea=>_0x3f7ea[_0x36e662([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x36e662([0x2a])))[_0x36e662([0x6d,0x61,0x70])](_0x28b552=>_0x28b552[_0x36e662([0x73,0x70,0x6c,0x69,0x74])](_0x36e662([0x2e])))[_0x36e662([0x73,0x6f,0x6d,0x65])](_0xc95197=>_0x5c5896[_0x36e662([0x65,0x76,0x65,0x72,0x79])]((_0x9b7ee0,_0x92b0fc)=>_0xc95197[_0x92b0fc]===_0x9b7ee0||_0xc95197[_0x92b0fc]===_0x36e662([0x2a])));}function _0x57e867(){return _0x260484&&_0x132f56?new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x540805,_0x3f1735)=>{_0x260484[_0x36e662([0x74,0x68,0x65,0x6e])](_0x540805,_0x3f1735),_0x132f56[_0x36e662([0x74,0x68,0x65,0x6e])](_0x13304f=>{_0x13304f!=_0x36e662([0x56,0x61,0x6c,0x69,0x64])&&_0x540805(_0x13304f);},_0x3f1735);}):_0x260484||_0x132f56||_0x36e662([0x56,0x61,0x6c,0x69,0x64]);}}function _0x312bc0(_0x1e3824,_0x8ebffa){return new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x563343=>{if(_0x52736e())return _0x563343(_0x36e662([0x56,0x61,0x6c,0x69,0x64]));_0x1b890e(),_0x437b5d[_0x36e662([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x36e662([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4a21f4=!0x1;const _0x550ccd=_0x535d59();function _0x224214(_0x4bbb76){return!!_0x4bbb76&&(typeof _0x4bbb76===_0x36e662([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x4bbb76===_0x36e662([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x4bbb76[_0x36e662([0x74,0x68,0x65,0x6e])]===_0x36e662([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x4bbb76[_0x36e662([0x63,0x61,0x74,0x63,0x68])]===_0x36e662([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x4a6423(_0xdc85ab){_0xe19c6e(_0xdc85ab)[_0x36e662([0x74,0x68,0x65,0x6e])](_0x4deab6=>{if(!_0x4deab6||_0x4deab6[_0x36e662([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x36e662([0x6f,0x6b]))return _0x36e662([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x3b5e32(_0x4566cf(_0x550ccd+_0x8ebffa))!=_0x4deab6[_0x36e662([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x36e662([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x36e662([0x56,0x61,0x6c,0x69,0x64]);})[_0x36e662([0x74,0x68,0x65,0x6e])](_0x1d1a75=>(_0x179762(),_0x1d1a75),()=>{const _0x2e4d98=_0x1fca69();return null==_0x2e4d98?(_0x179762(),_0x36e662([0x56,0x61,0x6c,0x69,0x64])):_0x36e662(_0x4c19ff-_0x2e4d98>(0x353bf3ec^_0x4dcfdb)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x36e662([0x74,0x68,0x65,0x6e])](_0x563343)[_0x36e662([0x63,0x61,0x74,0x63,0x68])](()=>{_0x563343(_0x36e662([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x35ef7c=0x1101996c^_0x4dcfdb;function _0x179762(){const _0x2dd3cb=_0x36e662([0x6c,0x6c,0x63,0x74,0x2d])+_0x3b5e32(_0x4566cf(_0x1e3824)),_0x51d502=_0x510605(_0x3b5e32(window[_0x36e662([0x4d,0x61,0x74,0x68])][_0x36e662([0x63,0x65,0x69,0x6c])](_0x4c19ff/_0x35ef7c)));window[_0x36e662([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x36e662([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x2dd3cb,_0x51d502);}function _0x1fca69(){const _0x121f39=_0x36e662([0x6c,0x6c,0x63,0x74,0x2d])+_0x3b5e32(_0x4566cf(_0x1e3824)),_0x2f4d6c=window[_0x36e662([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x36e662([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x121f39);return _0x2f4d6c?window[_0x36e662([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x510605(_0x2f4d6c),0x10)*_0x35ef7c:null;}function _0xe19c6e(_0x3ddfa9){return new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x3c02d0,_0x561409)=>{_0x3ddfa9[_0x36e662([0x74,0x68,0x65,0x6e])](_0x3c02d0,_0x561409),window[_0x36e662([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x561409,0x1136a32c^_0x4dcfdb);});}}_0x437b5d[_0x36e662([0x6f,0x6e])](_0x36e662([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0xd0de06,_0x36ab37)=>{if(_0x36ab37[0x0]!=_0x1e3824)return _0x563343(_0x36e662([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x36ab37[0x1]={..._0x36ab37[0x1],[_0x36e662([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x550ccd};},{[_0x36e662([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x36e662([0x68,0x69,0x67,0x68])}),_0x437b5d[_0x36e662([0x6f,0x6e])](_0x36e662([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x491a08=>{_0x224214(_0x491a08[_0x36e662([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4a21f4=!0x0,_0x4a6423(_0x491a08[_0x36e662([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x36e662([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x36e662([0x6c,0x6f,0x77])}),_0x53666c[_0x36e662([0x74,0x68,0x65,0x6e])](()=>{_0x4a21f4||_0x563343(_0x36e662([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x52736e(){return _0x437b5d[_0x36e662([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x36e662([0x76,0x69,0x65,0x77])][_0x36e662([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x36e662([0x61,0x75,0x74,0x6f]);}function _0x1b890e(){_0x437b5d[_0x36e662([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x36e662([0x76,0x69,0x65,0x77])][_0x36e662([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x36e662([0x61,0x75,0x74,0x6f]);}}function _0x4f930c(_0x58226e){const _0x183c37=[new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4e48c9=>setTimeout(_0x4e48c9,0x113e4920^_0x4dcfdb)),_0x53666c[_0x36e662([0x74,0x68,0x65,0x6e])](()=>new window[(_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1beacf=>{let _0xc10285=0x0;_0x437b5d[_0x36e662([0x6d,0x6f,0x64,0x65,0x6c])][_0x36e662([0x6f,0x6e])](_0x36e662([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x57474b,_0x506a31)=>{_0x506a31[0x0][_0x36e662([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0xc10285++,_0xc10285==(0x11377614^_0x4dcfdb)&&(_0x1beacf(),_0x57474b[_0x36e662([0x6f,0x66,0x66])]());});}))];return window[_0x36e662([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x36e662([0x72,0x61,0x63,0x65])](_0x183c37)[_0x36e662([0x74,0x68,0x65,0x6e])](()=>_0x58226e);}async function _0x45110e(){await _0x53666c,_0x437b5d[_0x36e662([0x6d,0x6f,0x64,0x65,0x6c])][_0x36e662([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x526c0d,_0x437b5d[_0x36e662([0x6d,0x6f,0x64,0x65,0x6c])][_0x36e662([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x526c0d,_0x437b5d[_0x36e662([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x36e662([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x59efa8(_0x49408d){const _0x230ca3=_0x23cb14();_0x437b5d[_0x230ca3]=_0x36e662([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x49408d,_0x49408d!=_0x36e662([0x56,0x61,0x6c,0x69,0x64])&&_0x45110e();}function _0x23cb14(){const _0x5d8d9a=window[_0x36e662([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x36e662([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x36e662([0x6e,0x6f,0x77])]())[_0x36e662([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x36e662([0x2e]),'');let _0x42b025=_0x36e662([0x67]);for(let _0x17af11=0x0;_0x17af11<_0x5d8d9a[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x17af11+=0x2){let _0x353dd3=window[_0x36e662([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x5d8d9a[_0x36e662([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x17af11,_0x17af11+0x2));_0x353dd3>=_0x5da87c[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x353dd3-=_0x5da87c[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x42b025+=_0x5da87c[_0x353dd3];}return _0x42b025;}function _0x48aebe(){const _0x2adb1b=_0x48b968[_0x36e662([0x73,0x70,0x6c,0x69,0x74])](_0x36e662([0x2e]));if(0x3!=_0x2adb1b[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x4693d9(_0x2adb1b[0x1]);function _0x4693d9(_0x3b1a21){const _0x30f0a1=_0x5aef3c(_0x3b1a21);return _0x30f0a1&&_0x207e8c()?_0x30f0a1:null;function _0x207e8c(){const _0x4cf84c=_0x30f0a1[_0x36e662([0x6a,0x74,0x69])],_0x4d9345=window[_0x36e662([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x4cf84c[_0x36e662([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x4cf84c[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x3de1da={..._0x30f0a1,[_0x36e662([0x6a,0x74,0x69])]:_0x4cf84c[_0x36e662([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x4cf84c[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x3de1da[_0x36e662([0x76,0x63])],_0x4566cf(_0x3de1da)==_0x4d9345;}}}async function _0x3b9645(){let _0x22118b=!0x0;try{const _0x5422e5=_0x48b968[_0x36e662([0x73,0x70,0x6c,0x69,0x74])](_0x36e662([0x2e])),[_0x138d1c,_0x36a9b1,_0xc62701]=_0x5422e5;return _0xfbe991(_0x138d1c),await _0x39c683(_0x138d1c,_0x36a9b1,_0xc62701),_0x22118b;}catch(_0x632309){return!0x1;}function _0xfbe991(_0x3eafb8){const _0x5d8926=_0x5aef3c(_0x3eafb8);_0x5d8926&&_0x5d8926[_0x36e662([0x61,0x6c,0x67])]==_0x36e662([0x45,0x53,0x32,0x35,0x36])||(_0x22118b=!0x1);}async function _0x39c683(_0x28f0b8,_0x3db97c,_0x3260ba){const _0x39aac5=window[_0x36e662([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x36e662([0x66,0x72,0x6f,0x6d])](_0x4a32a5(_0x3260ba),_0xdf225b=>_0xdf225b[_0x36e662([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x359852=new window[(_0x36e662([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x36e662([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x28f0b8+_0x36e662([0x2e])+_0x3db97c),_0x312de5=window[_0x36e662([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x36e662([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x312de5)return;const _0x330c8f=await _0x312de5[_0x36e662([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x36e662([0x6a,0x77,0x6b]),_0x3a680a,{[_0x36e662([0x6e,0x61,0x6d,0x65])]:_0x36e662([0x45,0x43,0x44,0x53,0x41]),[_0x36e662([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x36e662([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x36e662([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x312de5[_0x36e662([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x36e662([0x6e,0x61,0x6d,0x65])]:_0x36e662([0x45,0x43,0x44,0x53,0x41]),[_0x36e662([0x68,0x61,0x73,0x68])]:{[_0x36e662([0x6e,0x61,0x6d,0x65])]:_0x36e662([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x330c8f,_0x39aac5,_0x359852)||(_0x22118b=!0x1);}}function _0x5aef3c(_0x528bc3){return _0x528bc3[_0x36e662([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x36e662([0x65,0x79]))?JSON[_0x36e662([0x70,0x61,0x72,0x73,0x65])](_0x4a32a5(_0x528bc3)):null;}function _0x4a32a5(_0x4b1d4f){return window[_0x36e662([0x61,0x74,0x6f,0x62])](_0x4b1d4f[_0x36e662([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x36e662([0x2b]))[_0x36e662([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x36e662([0x2f])));}function _0x4566cf(_0x1a60d9){let _0x58b808=0x1505;function _0x688f96(_0x1dedf7){for(let _0x65a022=0x0;_0x65a022<_0x1dedf7[_0x36e662([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x65a022++){const _0x532fb9=_0x1dedf7[_0x36e662([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x65a022);_0x58b808=(_0x58b808<<0x5)+_0x58b808+_0x532fb9,_0x58b808&=_0x58b808;}}function _0x39cf09(_0x3470fb){Array[_0x36e662([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x3470fb)?_0x3470fb[_0x36e662([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x39cf09):_0x3470fb&&typeof _0x3470fb==_0x36e662([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x36e662([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x3470fb)[_0x36e662([0x73,0x6f,0x72,0x74])]()[_0x36e662([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x438a39,_0x429ca2])=>{_0x688f96(_0x438a39),_0x39cf09(_0x429ca2);}):_0x688f96(window[_0x36e662([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x3470fb));}return _0x39cf09(_0x1a60d9),_0x58b808>>>0x0;}function _0x3b5e32(_0x2cd5be){return _0x2cd5be[_0x36e662([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x36e662([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x36e662([0x30]));}function _0x510605(_0xddd3a7){return _0xddd3a7[_0x36e662([0x73,0x70,0x6c,0x69,0x74])]('')[_0x36e662([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x36e662([0x6a,0x6f,0x69,0x6e])]('');}function _0x526c0d(){}function _0x36e662(_0x3461a3){return _0x3461a3['map'](_0x36957a=>String['fromCharCode'](_0x36957a))['join']('');}_0x59efa8(await _0x3036fe());}(this);}['showFakeVisualSelection'](){const _0x3fb559=this['editor']['model'];_0x3fb559['change'](_0xbe076a=>{const _0x245230=_0x3fb559['document']['selection']['getRanges']();let _0x4e0f0f=0x0;for(const _0x23bfb7 of _0x245230){const _0x7dc4ce=f+':'+_0x4e0f0f;if(_0x3fb559['markers']['has'](_0x7dc4ce))_0xbe076a['updateMarker'](_0x7dc4ce,{'range':_0x23bfb7});else{if(_0x23bfb7['start']['isAtEnd']){const _0xf713c5=_0x23bfb7['start']['getLastMatchingPosition'](({item:_0x3bd6c8})=>!_0x3fb559['schema']['isContent'](_0x3bd6c8),{'boundaries':_0x23bfb7});_0xbe076a['addMarker'](_0x7dc4ce,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xbe076a['createRange'](_0xf713c5,_0x23bfb7['end'])});}else _0xbe076a['addMarker'](_0x7dc4ce,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x23bfb7});}_0x4e0f0f++;}});}['hideFakeVisualSelection'](){const _0x41c74e=this['editor']['model'],_0x3591f9=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](f));_0x3591f9['length']&&_0x41c74e['change'](_0x5d5971=>{_0x3591f9['forEach'](_0x2a2ad1=>{_0x5d5971['removeMarker'](_0x2a2ad1);});});}['insertContent'](_0x5bd96d,_0x467aca){const _0x55bb38=this['_getAISelection'](),_0x209e8a=_0x467aca||_0x55bb38['getFirstRange']();this['editor']['model']['canEditAt'](_0x209e8a)&&this['editor']['model']['change'](_0x2aa958=>{this['hideFakeVisualSelection'](),_0x467aca||this['_resetContentOfSelectedTableCells'](_0x2aa958,_0x55bb38),this['_pasteHTMLUsingClipboard']({'insertAt':_0x209e8a,'writer':_0x2aa958,'html':_0x5bd96d});});}['insertContentBelow'](_0x2982f2){const {model:_0x4c2e00}=this['editor'],_0x49f602=this['_getAISelection']();_0x4c2e00['change'](()=>{const _0x41233a=this['_prepareTableInsertBelowPosition'](_0x2982f2,_0x49f602)||this['_getDefaultInsertBelowPosition'](_0x49f602);this['insertContent'](_0x2982f2,_0x41233a);});}['_getAISelection'](){const _0x404e18=this['editor']['model'],_0x9f5fe6=Array['from'](_0x404e18['markers']['getMarkersGroup'](f))['map'](_0x397ba2=>_0x397ba2['getRange']());return _0x404e18['createSelection'](_0x9f5fe6);}['_pasteHTMLUsingClipboard']({writer:_0x4ddb94,html:_0xa93795,insertAt:_0x4ffdc5}){const {view:_0x244320}=this['editor']['editing'],_0x4d30e3=this['editor']['plugins']['get'](_0x273354),_0x1d1f07=new dt();_0x1d1f07['setData']('text/html',_0xa93795);const _0x47974d=new ClipboardEvent('paste',{'clipboardData':_0x1d1f07}),_0x47cde9=new _0x47ee81(_0x244320,_0x47974d,{'dataTransfer':new _0x14381d(_0x1d1f07)});_0x4ddb94['setSelection'](_0x4ffdc5);const _0x4af33a=(_0x4427d9,_0x30e065)=>{_0x30e065['resultRange']&&_0x4ddb94['setSelection'](_0x30e065['resultRange']);};_0x4d30e3['once']('contentInsertion',_0x4af33a,{'priority':'lowest'}),_0x244320['document']['fire']('paste',_0x47cde9),_0x4d30e3['off']('contentInsertion',_0x4af33a);}['_getDefaultInsertBelowPosition'](_0x3bdb74){const {model:_0x43c5b0}=this['editor'],_0x472e6b=Array['from'](_0x3bdb74['getSelectedBlocks']());return _0x472e6b['length']?_0x43c5b0['createPositionAfter'](_0x472e6b['pop']()):_0x3bdb74['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x23d2f8,_0x49288b){const {model:_0x291edf,plugins:_0x15fb99}=this['editor'];if(_0x15fb99['has']('TableUtils')){const _0x3c7584=_0x15fb99['get']('TableUtils')['getSelectedTableCells'](_0x49288b);if(_0x3c7584['length']){const _0x39c4ef=this['_getTableRowCountFromContent'](_0x23d2f8),_0x18f827=this['_createEmptyTableRows'](_0x3c7584,_0x39c4ef);return _0x291edf['createPositionAt'](_0x18f827,0x0);}}return null;}['_getTableRowCountFromContent'](_0x354631){const _0x458101=this['editor']['plugins']['get']('TableUtils'),_0x3394b6=this['editor']['data']['parse'](_0x354631),_0x3efcb7=Array['from'](_0x3394b6['getChildren']())['filter'](_0x1c3666=>_0x1c3666['is']('element','table'));let _0x4d5046=0x0;return _0x3efcb7['forEach'](_0x2f8ffc=>{_0x4d5046+=_0x458101['getRows'](_0x2f8ffc);}),_0x4d5046;}['_createEmptyTableRows'](_0x42fd9c,_0x14691a){const _0x1c78ca=this['editor']['plugins']['get']('TableUtils'),_0x1bc71b=_0x1c78ca['getRowIndexes'](_0x42fd9c),_0x129716=_0x1c78ca['getColumnIndexes'](_0x42fd9c),_0x34b900=_0x1bc71b['last']+0x1,_0x345e2f=_0x129716['first'],_0x831cb=_0x42fd9c[0x0]['findAncestor']('table');for(let _0x34cce4=0x0;_0x34cce4<_0x14691a;_0x34cce4++)_0x1c78ca['insertRows'](_0x831cb,{'at':_0x34b900});return _0x831cb['getChild'](_0x34b900)['getChild'](_0x345e2f);}['_resetContentOfSelectedTableCells'](_0x432d92,_0x4d9679){const {plugins:_0x527d8d}=this['editor'],{model:_0x281676}=_0x432d92;if(!_0x527d8d['has']('TableUtils'))return;_0x527d8d['get']('TableUtils')['getSelectedTableCells'](_0x4d9679)['length']&&_0x281676['deleteContent'](_0x4d9679);}}class K extends _0x239301{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new _0x2981d1('aiadapter-text-adapter-not-set',null);}}class R extends Error{constructor(_0x398806){super(_0x398806),this['name']='AIRequestError';}}function i(_0xaa0cdc,_0x3357a7,_0x26d816){const t=_0xaa0cdc['t'];switch(_0x3357a7){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',_0x26d816);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x26d816);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'},_0x26d816);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 _0x3357a7;}}class E extends _0x351cf7{['_commandDefinitions'];constructor(_0x43dd43,_0x209dd3){super(_0x43dd43),this['_commandDefinitions']=_0x209dd3,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x4305c9,_0x3dbcbb,_0x276eaa)=>{this['isEnabled']&&(this['enabledCommandsIds']=G(this['_commandDefinitions'],_0x276eaa));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x44a62e,_0x37f526,_0x542c06)=>{this['enabledCommandsIds']=_0x542c06?G(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x5dcce9=this['editor']['model'];this['_hasContext']=function(_0x5d2049){const _0xd0f53d=_0x5d2049['document']['selection'];return _0xd0f53d['isCollapsed']?0x0!==[..._0xd0f53d['getSelectedBlocks']()]['length']&&![..._0xd0f53d['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x5d2049['hasContent'](_0xd0f53d['getFirstRange']());}(_0x5dcce9);const _0x4594c0=_0x5dcce9['document']['selection'],_0x46daf6=this['editor']['config']['get']('ai.aiAssistant.disabledElements');for(const _0x3a21fe of _0x4594c0['getRanges']())for(const _0x3efb9a of _0x3a21fe['getItems']())if(_0x3efb9a['is']('element')&&_0x46daf6['includes'](_0x3efb9a['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x13df46='',_0x554166='',_0x4cf2de='custom'){this['editor']['plugins']['get'](n)['showUI'](_0x13df46,_0x554166,_0x4cf2de);}}function G(_0xf53956,_0x1cc450){const _0x345886=new Set();for(const _0x45726e of _0xf53956['values']())(_0x1cc450||!0x1===_0x45726e['requiresContent'])&&_0x345886['add'](_0x45726e['id']);return Array['from'](_0x345886);}const Z=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class j extends/* #__PURE__ -- @preserve */ _0x1a455e(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x545c41,_0x2ec550,_0x42948d){super(),this['editor']=_0x545c41,this['textAdapter']=_0x2ec550,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x42948d,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x580167,_0x1b984d,_0xd135d3)=>{this['view']['value']=this['_sanitizeHTML'](_0xd135d3);}),this['listenTo'](this['view'],'submitPrompt',(_0x431df8,_0x53ad79)=>{const _0x4f34e5=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x53ad79,_0x4f34e5,'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:_0x59634c,query:_0x46ee00,htmlContent:_0x2c0e2a,label:_0x538e00,mainActionLabel:_0x53788b}){this['view']['prompt']=_0x538e00,this['view']['mainAction']=_0x53788b,this['initialContext']=_0x2c0e2a,_0x46ee00&&(this['view']['isRendered']?this['_handleQuery'](_0x46ee00,_0x2c0e2a,_0x59634c,_0x538e00):this['view']['once']('render',()=>{this['_handleQuery'](_0x46ee00,_0x2c0e2a,_0x59634c,_0x538e00);}));}['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'](_0x3e1032,_0x2c5d00,_0x9d3940,_0x163e92){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2c5d00,this['previousQuery']=_0x3e1032,this['previousLabel']=_0x163e92||_0x3e1032,this['previousActionId']=_0x9d3940,new Promise(_0x3270ca=>{this['textAdapter']['makeRequest']({'query':_0x3e1032,'context':_0x2c5d00,'onData':_0x226e61=>{this['currentResponse']=_0x226e61,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x9d3940})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x54f0df=>{_0x54f0df instanceof R?this['view']['handleError'](_0x54f0df['message']):this['view']['handleError'](),_0x3270ca();})['finally'](()=>{this['stopProcessing'](),_0x3270ca();});});}['_parseAndNormalizeContent'](_0xb47409,_0x157a87=!0x1){const _0x2d4387=Z['exec'](_0xb47409);_0xb47409=_0x2d4387?_0xb47409['substring'](_0x2d4387[0x1]['length']):_0xb47409['length']<0x64&&!_0x157a87?'':this['_stripMarkdownSyntax'](_0xb47409);const _0x34fe3e=this['_domParser']['parseFromString'](_0xb47409,'text/html');if(_0x2d4387){const _0x179ef2=Array['from'](_0x34fe3e['body']['childNodes']);_0x179ef2['reverse']();for(const _0x3b0508 of _0x179ef2){if(_0x3b0508['nodeType']==Node['ELEMENT_NODE'])break;_0x3b0508['remove']();}}const _0x48c6c3=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x34fe3e['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x48c6c3);const _0x582090=this['editor']['config']['get']('ai.aiAssistant.preserveComments'),_0x21caaa=this['editor']['data']['toModel'](_0x48c6c3);return _0x582090||_0x21caaa['markers']['clear'](),this['editor']['data']['stringify'](_0x21caaa);}['_normalizeResponseHeadings'](_0x302de2){const _0x338caa=new _0x2aac74(this['editor']['editing']['view']['document']),_0xad9bdf=new _0x151934({'name':/^h[1-5]$/}),_0x5d1f1e=[];let _0xebbb2c=!0x1;for(const _0x3976e4 of _0x302de2)_0x3976e4['is']('element')&&_0xad9bdf['match'](_0x3976e4)&&(_0x5d1f1e['push'](_0x3976e4),'h1'==_0x3976e4['name']&&(_0xebbb2c=!0x0));if(_0xebbb2c){for(const _0x50c608 of _0x5d1f1e)_0x338caa['rename']('h'+(parseInt(_0x50c608['name'][0x1])+0x1),_0x50c608);}}['_isH1TagSupportEnabled'](){const {data:_0x5de397,editing:_0x58b338}=this['editor'],_0x198a1a=_0x5de397['htmlProcessor']['toView']('<h1></h1>'),_0x39079a=_0x5de397['toView'](_0x5de397['toModel'](_0x198a1a));return!!_0x58b338['view']['domConverter']['viewToDom'](_0x39079a)['querySelector']('h1');}['_sanitizeHTML'](_0x5c3f97){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x5c3f97),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x395019){const _0x3bb826=_0x395019['trim']();return _0x3bb826['startsWith']('```html')?_0x3bb826['endsWith']('```')?_0x3bb826['substring'](0x7,_0x3bb826['length']-0x3):_0x3bb826['substring'](0x7):_0x395019;}}const M={'REPLACE':'replace','INSERT':'insert'};class at extends nt{constructor(_0x3d8b8d){super(_0x3d8b8d),this['set']('isVisible',!0x1),this['set']('mainAction',M['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x40d419=>i(_0x3d8b8d,'AI_'+_0x40d419['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](i(_0x3d8b8d,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](i(_0x3d8b8d,'Try\x20again')),this['stopButton']=this['_createButton'](i(_0x3d8b8d,'Stop'));const _0x298fa5=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x298fa5['if']('isVisible','ck-hidden',_0x28a1a9=>!_0x28a1a9)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0xe425c4,_0xd50b82){const _0x6ae82d=new _0x8cb510(this['locale']);return _0x6ae82d['set']({'label':_0xe425c4,'class':_0xd50b82||'','isVisible':!0x0,'withText':!0x0}),_0x6ae82d;}}var W='<svg\x20viewBox=\x220\x200\x2020\x2020\x22\x20xmlns=\x22http://www.w3.org/2000/svg\x22><path\x20d=\x22M5\x202.801a.7.7\x200\x200\x200-.7.7v11.5a.8.8\x200\x200\x201-1.6\x200v-11.5a2.3\x202.3\x200\x200\x201\x202.3-2.3h6.5a.8.8\x200\x200\x201\x200\x201.6H5Zm.7\x203.7a2.3\x202.3\x200\x200\x201\x202.3-2.3h7a2.3\x202.3\x200\x200\x201\x202.3\x202.3v10a2.3\x202.3\x200\x200\x201-2.3\x202.3H8a2.3\x202.3\x200\x200\x201-2.3-2.3v-10Zm2.3-.7a.7.7\x200\x200\x200-.7.7v10a.7.7\x200\x200\x200\x20.7.7h7a.7.7\x200\x200\x200\x20.7-.7v-10a.7.7\x200\x200\x200-.7-.7H8Z\x22/></svg>';class X extends _0x3d218a{['contentFieldView'];['copyButtonView'];constructor(_0x415e21,_0x2a4aab=''){super(_0x415e21),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x431cdb=this['bindTemplate'];this['contentFieldView']=new mt(_0x415e21,_0x2a4aab),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x431cdb['if']('isVisible','ck-hidden',_0x2a4476=>!_0x2a4476)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x431cdb['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 _0x5722dd=!0x1;this['on']('change:value',(_0x4b93d2,_0x57f5c8,_0x52b974)=>{const _0x50c896=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x52b974),this['isProcessing']&&_0x50c896&&!_0x5722dd&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x347adb,_0x248481,_0x4d3904)=>{_0x5722dd=!0x1,_0x4d3904?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x5722dd=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x5722dd=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x37924b=this['locale'],_0x2b33a2=new _0x8cb510(this['locale']),_0x1d0441='ck-ai-form__copy-button';return _0x2b33a2['set']({'label':i(_0x37924b,'Copy'),'icon':W,'class':_0x1d0441,'tooltip':!0x0}),_0x2b33a2['bind']('isVisible')['to'](this,'value',_0x1b88ec=>!!_0x1b88ec),_0x2b33a2['bind']('isEnabled')['to'](this,'isProcessing',_0x7624b8=>!_0x7624b8),_0x2b33a2['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x2b33a2['icon']=_0x160769['check'],_0x2b33a2['class']=_0x1d0441+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x2b33a2['icon']=W,_0x2b33a2['class']=_0x1d0441;},0x3e8);}),_0x2b33a2;}['_copyHTMLToClipboard'](_0x16f5ce){const {window:_0x1e5fd2,document:_0xb44e1f}=_0x601a75;if(_0x1e5fd2['ClipboardItem']){const {Blob:_0x8541dc,ClipboardItem:_0x34ff07}=_0x1e5fd2,_0x2b7298=[new _0x34ff07({'text/html':new _0x8541dc([_0x16f5ce['innerHTML']],{'type':'text/html'}),'text/plain':new _0x8541dc([_0x16f5ce['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x2b7298);}else{const _0x3c0cdd=_0xb44e1f['createElement']('div');_0x3c0cdd['style']['position']='absolute',_0x3c0cdd['style']['left']='-9999px',_0x3c0cdd['innerHTML']='<span>[</span>'+_0x16f5ce['innerHTML']+'<span>]</span>',_0xb44e1f['body']['appendChild'](_0x3c0cdd);const _0x86ad5=_0xb44e1f['createRange']();_0x86ad5['setStartAfter'](_0x3c0cdd['firstElementChild']),_0x86ad5['setEndBefore'](_0x3c0cdd['lastElementChild']);const _0x2c86db=_0x1e5fd2['getSelection']();_0x2c86db['removeAllRanges'](),_0x2c86db['addRange'](_0x86ad5),_0xb44e1f['execCommand']('copy'),_0x3c0cdd['remove']();}}}class mt extends _0x3d218a{constructor(_0x15549f,_0x1674b3=''){super(_0x15549f),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1674b3,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x19113e){this['element']['innerHTML']=_0x19113e;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x4c8a74=new _0x3d218a(),_0x4452cc=this['locale'],_0xc28242=new _0x1e1ef1();return _0xc28242['isVisible']=!0x0,_0x4c8a74['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0xc28242,{'text':i(_0x4452cc,'AI\x20is\x20writing...')}]}),_0x4c8a74['render'](),_0x4c8a74;}}class rt extends _0x3d218a{constructor(_0x4a9ad9,_0x4cdb55=''){super(_0x4a9ad9);const _0x4a7a57=new _0x5808d9(),_0x10592a=this['bindTemplate'];this['set']('text',_0x4cdb55),_0x4a7a57['content']='<svg\x20viewBox=\x220\x200\x2020\x2020\x22\x20xmlns=\x22http://www.w3.org/2000/svg\x22><path\x20clip-rule=\x22evenodd\x22\x20d=\x22M9.9\x204.385a1.2\x201.2\x200\x200\x200-.44.44h.002l-5.284\x209.15a1.2\x201.2\x200\x200\x200\x201.04\x201.8h10.564a1.2\x201.2\x200\x200\x200\x201.04-1.8l-5.282-9.15a1.2\x201.2\x200\x200\x200-1.64-.44Zm.05\x208.363a.301.301\x200\x200\x201\x20.115-.023h.9a.301.301\x200\x200\x201\x20.3.3v.9a.3.3\x200\x200\x201-.3.3h-.9a.3.3\x200\x200\x201-.3-.3v-.9a.3.3\x200\x200\x201\x20.185-.277Zm-.185-4.723a.3.3\x200\x200\x201\x20.3-.3h.9a.3.3\x200\x200\x201\x20.3.3v3.4a.3.3\x200\x200\x201-.3.3h-.9a.301.301\x200\x200\x201-.3-.3v-3.4Z\x22/></svg>\x0a',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x4a7a57,{'text':_0x10592a['to']('text')}]});}}class ht extends ot{['submitButtonView'];['showHistoryButtonView'];constructor(_0x431d17,_0x249028){super(_0x431d17,_0x249028),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',(_0x2b6fc3,_0x1fafd3)=>{_0x2b6fc3['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1fafd3());});}['_createSubmitButton'](){const _0x29aa1e=new _0x8cb510(this['locale']),_0x31f612=this['locale'];return _0x29aa1e['set']({'icon':'<svg\x20viewBox=\x220\x200\x2020\x2020\x22\x20xmlns=\x22http://www.w3.org/2000/svg\x22><path\x20d=\x22M15.875\x204.419a.75.75\x200\x200\x200-1.5\x200v7.25H6.818l2.33-1.955a.75.75\x200\x200\x200-.963-1.15l-3.792\x203.182a.75.75\x200\x200\x200-.17.945c.046.11.118.208.21.284l3.788\x203.18a.75.75\x200\x201\x200\x20.965-1.149l-2.19-1.837h7.629c.69\x200\x201.25-.56\x201.25-1.25v-7.5Z\x22/></svg>','label':i(_0x31f612,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x29aa1e['on']('execute',()=>{this['submit']();}),_0x29aa1e['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x29c56c,_0x25d076)=>!_0x29c56c&&_0x25d076),_0x29aa1e;}['_createShowHistoryButton'](){const _0x5a29f6=new _0x8cb510(this['locale']),_0x2a62cc=this['resultsView'],_0x44da6f=this['locale'];_0x5a29f6['set']({'label':i(_0x44da6f,'History'),'withText':!0x1,'icon':_0x160769['history'],'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x5a29f6['bind']('isOn')['to'](_0x2a62cc,'isVisible'),_0x5a29f6['bind']('isEnabled')['to'](this,'isEnabled'),_0x5a29f6['on']('execute',()=>{_0x2a62cc['isVisible']=!_0x2a62cc['isVisible'],_0x2a62cc['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x1234b5=()=>{_0x601a75['window']['requestAnimationFrame'](()=>{if(it(this['element'])){const _0x5554b1=new st(this['queryView']['fieldView']['element']),_0x18a315=_0x5554b1['width'],_0x733bc1='rtl'===_0x44da6f['uiLanguageDirection']?'left':'right';_0x5554b1['excludeScrollbarsAndBorders'](),_0x5a29f6['element']['style'][_0x733bc1]=_0x18a315-_0x5554b1['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x1234b5),this['on']('render',_0x1234b5),_0x5a29f6;}['submit'](){const _0xfadb87=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0xfadb87);}['focus'](_0x5ecfb6){-0x1===_0x5ecfb6?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class rs extends lt{['historyGroupView'];['clearHistoryButton'];constructor(_0x53e57d){super(_0x53e57d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new ut(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=i(_0x53e57d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x37777a=0x0;for(const _0x577c64 of this['items'])_0x37777a+=_0x577c64['items']['length'];return{'resultsCount':_0x37777a,'totalItemsCount':_0x37777a};}['_createClearHistoryButton'](){const _0x4cd02e=this['locale'],_0x44523d=new _0x8cb510(this['locale']);return _0x44523d['set']({'label':'('+i(_0x4cd02e,'Clear')+')','withText':!0x0}),_0x44523d['on']('execute',()=>this['fire']('clearHistory')),_0x44523d;}}class hs extends _0x2459b9{constructor(_0x3d7570){super();const _0x4d101e=new te(),_0x3a3086=new _0x8cb510(this['locale'],_0x4d101e);this['children']['add'](_0x3a3086),_0x3a3086['set']({'label':_0x3d7570['prompt'],'withText':!0x0}),_0x3a3086['on']('execute',()=>{this['fire']('execute',{'value':_0x4ca8dd(_0x3d7570['prompt'])});});}}const cs='CKEditor/AIFormView/PromptHistory';class os extends _0x463b6b{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x161161,_0xed7457)=>{const _0x1a0d5f=Ss(_0xed7457['prompt']);for(const _0xd07eff of this)if(_0xd07eff!=_0xed7457&&Ss(_0xd07eff['prompt'])===_0x1a0d5f){this['remove'](_0xd07eff);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x22528d=sessionStorage['getItem'](cs)||'[]';this['addMany'](JSON['parse'](_0x22528d));}['_saveToSessionStorage'](){sessionStorage['setItem'](cs,JSON['stringify'](this['map'](_0x862dea=>_0x862dea)));}}function Ss(_0x5c6556){return _0x5c6556['toLowerCase']()['trim']();}class k extends _0x3d218a{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x2c971d,_0x30da15,_0x3d3419=''){super(_0x2c971d),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',M['REPLACE']),this['_promptHistory']=new os(),this['errorView']=new rt(_0x2c971d),this['contentArea']=new X(_0x2c971d,_0x3d3419),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 _0x1cab19(),this['keystrokes']=new ts(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new _0xce45fc({'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 _0x1aa074=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x30da15],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x1aa074['if']('isError','ck-hidden',_0x5557cd=>!_0x5557cd)]},'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'](_0x223f73=0x1){-0x1===_0x223f73?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 _0x391a4e=this['locale'],_0x36b714=new ht(_0x391a4e,{'queryView':{'label':i(_0x391a4e,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x5bb2a8,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':i(_0x391a4e,'Empty\x20history'),'secondary':i(_0x391a4e,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x36b714['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x7d0243,_0x119a14)=>_0x7d0243&&!_0x119