UNPKG

@ckeditor/ckeditor5-ai

Version:

AI features for CKEditor 5.

24 lines • 649 kB
/* * Copyright (c) 2003-2026, 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 _0x5686f0,Command as _0x3a665b,ContextPlugin as _0x23f270,Editor as _0x5ca812}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x16addf,IconCheck as _0x4ab520,IconError as _0x90f260,IconSubmit as _0x177154,IconAIHistory as _0x41655b,IconMagicWand as _0x343811,IconRobotPencil as _0x98106a,IconMaximize as _0x5822e5,IconMinimize as _0x494a35,IconShowChangesOn as _0x135466,IconShowChangesOff as _0x3c0485,IconDocument as _0x448da1,IconBoxWithCross as _0x1dbb45,IconBoxWithCheck as _0x2d73d7,IconBoxWithMarker as _0x3c26bd,IconInfo as _0x11ec0d,IconWeb as _0x271520,IconCancel as _0x5ed072,IconSelection as _0xf81085,IconFileUpload as _0x5249ad,IconLink as _0x1e2b51,IconBulb as _0xeb7c36,IconAI as _0x348d31,IconPreviousArrow as _0x1607c0,IconDocumentOutline as _0x1c299b,IconLoupe as _0x10b46f,IconPaperClip as _0x5718be,IconBrowseFiles as _0x16f379,IconDropdownArrow as _0x4e78fd,IconStop as _0x1b062b,IconPlus as _0x37726c,IconAIChat as _0x2ea593,IconPin as _0x5e7c87,IconThreeHorizontalDots as _0x57c6c8,IconAIReview as _0x2e2f4a,IconAITranslate as _0x4d8ff7,IconAIAskAI as _0xbf82c1,IconThumbUp as _0x25b316,IconThumbDown as _0x42e1bc,IconChevronDown as _0x25b93f,IconChevronUp as _0x19d9ab,IconAIQuickActions as _0x15178f,IconAIChatCommands as _0x4ea6bb,IconAIImproveWriting as _0x3da124,IconAIContinueWriting as _0x382928,IconAIGrammarCheck as _0x2920e7,IconAIAdjustLength as _0x10b01a,IconAIChangeTone as _0x1aa706,IconAIOther as _0x47860a,IconRefresh as tt,IconNextArrow as et,IconOutdated as it,IconEye as st,IconEyeCrossedOut as nt,IconChevronRight as rt}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as ot,CKEditorError as at,ObservableMixin as ht,global as ct,isVisible as lt,Rect as ut,Collection as dt,FocusTracker as _t,KeystrokeHandler as It,first as At,logWarning as gt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as wt,insertToPriorityArray as Tt,scrollAncestorsToShowTarget as ft,ResizeObserver as St,_isMotionReduced as Rt,getConstrainedViewportRect as bt,DomEmitterMixin as Ot}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as vt,View as Nt,SpinnerView as yt,IconView as xt,AutocompleteView as Lt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Pt,ButtonLabelView as Ht,FocusCycler as Mt,createLabeledTextarea as Ut,Dialog as Bt,createDropdown as Gt,addMenuToDropdown as Ft,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Wt,DialogViewPosition as Yt,MenuBarMenuListView as $t,MenuBarMenuListItemView as qt,BodyCollection as Qt,BalloonPanelView as Xt,clickOutsideHandler as zt,addListToDropdown as jt,UIModel as Jt,submitHandler as Zt,LabeledFieldView as te,createLabeledInputText as _0x123337,FormHeaderView as _0x3e7902,HighlightedTextView as _0x2cc319,ViewCollection as _0x184ac3,FileDialogButtonView as _0x4509d1,InputTextView as _0x142293,SearchTextView as _0x1be4c1,ListItemButtonView as _0x1a80af,ButtonLabelWithHighlightView as _0x41ed25,DropdownMenuPanelPositioningFunctions as _0x16a65a,BalloonToolbar as _0x1397b8,FormRowView as _0xee19c6,TextareaView as _0x126012}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x53aae2,ClipboardMarkersUtils as _0x477206}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x5a415e,ViewDataTransfer as _0x352cb4,ViewUpcastWriter as _0x4642be,Matcher as _0x442511,_DetachOperation as _0x43c2ab,_insertIntoModelNodeList as _0x126834,_removeFromModelNodeList as _0x164b6b,ModelRange as _0x1445f3,transformOperationSets as _0x27476f,ViewDowncastWriter as _0x4b9165,ModelDocumentFragment as _0xee8836,ModelPosition as _0x3c2be3,ModelTreeWalker as _0x46a368,MarkerOperation as _0x147dae,InsertOperation as _0x129783}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x58cc9d,escape as _0x19d831,cloneDeep as _0x4c306c,throttle as _0x121c0b,debounce as _0x3c2cd8,escapeRegExp as _0x118ed5}from'es-toolkit/compat';import{createParser as _0x3df424}from'eventsource-parser';import{CloudServices as _0x5dd200}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x56717f}from'htmlparser2';import{isTag as _0x4e8462,findOne as _0x4e94ee,getParent as _0xe83088,findAll as _0x2c9ab8,removeElement as _0x32f2bc,prepend as _0x51f634,prependChild as _0x59f22f,appendChild as _0x4c46bc,append as _0x5a70f4,find as _0x592842,isComment as _0x468d05,replaceElement as _0x118b57,getChildren as _0x55fdbd,textContent as _0x11c8f9}from'domutils';import ti from'dom-serializer';import{Document as _0x34e0db,Element as _0x4d1237,Text as _0x5a8104,cloneNode as _0x118fd9,isDocument as _0x40c3ff,isText as _0x31735e,NodeWithChildren as _0x507edc}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x3ceff7,MarkdownGfmMdToHtml as _0xc438b}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0xec741 from'rehype-sanitize';import{fixElementSuggestionRange as _0x43b9ff,DocumentCompare as _0x53dd97,DATA_ID_MODEL_ATTRIBUTE as _0x4140c8,ConfirmMixin as _0x104e5b,getAllMarkersDomElementsSorted as _0x3b0cbb,SuggestionsConversion as _0x53f39c,DATA_ID_VIEW_ATTRIBUTE as _0x4b3396,getMarkerDomElement as _0x1e5795}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x2d4ba4 from'morphdom';import{diffArrays as _0x3e20ff}from'diff';const wi='_ungrouppedCommands';function Ti(_0x3317c4,_0x2d3608){const _0x3af402=(0x0,_0x2d3608['t'])('Other');return _0x3317c4['length']?'groupId'in _0x3317c4[0x0]?_0x3317c4:[{'groupId':wi,'groupLabel':_0x3af402,'order':0x1/0x0,'commands':_0x3317c4}]:[{'groupId':wi,'groupLabel':_0x3af402,'order':0x1/0x0,'commands':[]}];}const fi=globalThis['DataTransfer'],Si='ai-ui';class AIAssistantEditing extends _0x5686f0{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x2c1201}=this,_0x574fca=['ck-fake-ai-selection'];_0x2c1201['config']['get']('ai.assistant.useTheme')&&_0x574fca['push']('ck-ai-assistant-ui_theme'),_0x2c1201['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x574fca,'priority':0xc}}),_0x2c1201['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x17a595,{writer:_0x2a71eb})=>{if(!_0x17a595['markerRange']['isCollapsed'])return null;const _0x33b154=_0x2a71eb['createUIElement']('span');return _0x2a71eb['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x33b154),_0x33b154;}});}['afterInit'](){!async function(_0x3feded){const _0x351f00=_0x3ddba5([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x588350=0x3dffc4e1,_0x49419c=0x3df84e89^_0x588350,_0x58ec64=window[_0x3ddba5([0x44,0x61,0x74,0x65])][_0x3ddba5([0x6e,0x6f,0x77])](),_0x42f2c7=_0x3feded[_0x3ddba5([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x1148fe=new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x23b63f=>{_0x42f2c7[_0x3ddba5([0x6f,0x6e,0x63,0x65])](_0x3ddba5([0x72,0x65,0x61,0x64,0x79]),_0x23b63f);}),_0x871dc5={[_0x3ddba5([0x6b,0x74,0x79])]:_0x3ddba5([0x45,0x43]),[_0x3ddba5([0x75,0x73,0x65])]:_0x3ddba5([0x73,0x69,0x67]),[_0x3ddba5([0x63,0x72,0x76])]:_0x3ddba5([0x50,0x2d,0x32,0x35,0x36]),[_0x3ddba5([0x78])]:_0x3ddba5([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]),[_0x3ddba5([0x79])]:_0x3ddba5([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]),[_0x3ddba5([0x61,0x6c,0x67])]:_0x3ddba5([0x45,0x53,0x32,0x35,0x36])},_0x1d53c3=_0x42f2c7[_0x3ddba5([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x3ddba5([0x67,0x65,0x74])](_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x1c106d(){let _0x4c7d12,_0x322117=null,_0x42b061=null;try{if(_0x1d53c3==_0x3ddba5([0x47,0x50,0x4c]))return _0x3ddba5([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x4c7d12=_0x34a329(),!_0x4c7d12)return _0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x4c7d12[_0x3ddba5([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x42b061=_0x1abfd1(_0x4c7d12[_0x3ddba5([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x4c7d12[_0x3ddba5([0x6a,0x74,0x69])])),await _0x51dd3f()?_0x3f3b22()?_0x203e3b()?_0x3ddba5([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x1b7486()?(_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x3ddba5([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x322117=_0x180ced(_0x3ddba5([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x323b7c()):_0x3ddba5([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x3ddba5([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x203e3b(){const _0x163066=[_0x3ddba5([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x3ddba5([0x74,0x72,0x69,0x61,0x6c])][_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x58ec64/0x3e8:0xe10*_0x49419c;return _0x4c7d12[_0x3ddba5([0x65,0x78,0x70])]<_0x163066;}function _0x3f3b22(){const _0x493a8a=_0x4c7d12[_0x3ddba5([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x493a8a&&(!!_0x493a8a[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x2a]))||!!_0x493a8a[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x41,0x49])));}function _0x1b7486(){const _0x1796ba=_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x1796ba||0x0==_0x1796ba[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x29d94b}=new URL(window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x1796ba[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x29d94b))return!0x0;const _0x580092=_0x29d94b[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e]));return _0x1796ba[_0x3ddba5([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x4398ef=>_0x4398ef[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x2a])))[_0x3ddba5([0x6d,0x61,0x70])](_0x12d367=>_0x12d367[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e])))[_0x3ddba5([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x34315f=>_0x34315f[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x580092[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x3ddba5([0x6d,0x61,0x70])](_0x3a98ea=>Array(_0x580092[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x3a98ea[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x3ddba5([0x66,0x69,0x6c,0x6c])](_0x3a98ea[0x0]===_0x3ddba5([0x2a])?_0x3ddba5([0x2a]):'')[_0x3ddba5([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x3a98ea))[_0x3ddba5([0x73,0x6f,0x6d,0x65])](_0x15ccc4=>_0x580092[_0x3ddba5([0x65,0x76,0x65,0x72,0x79])]((_0x4872e5,_0x16e99f)=>_0x15ccc4[_0x16e99f]===_0x4872e5||_0x15ccc4[_0x16e99f]===_0x3ddba5([0x2a])));}function _0x323b7c(){return _0x322117&&_0x42b061?new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2be1a1,_0x44dd72)=>{_0x322117[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x2be1a1,_0x44dd72),_0x42b061[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x158ec1=>{_0x158ec1!=_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])&&_0x2be1a1(_0x158ec1);},_0x44dd72);}):_0x322117||_0x42b061||_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1abfd1(_0x5a97a2,_0x1a92ec){return new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x581f38=>{if(_0x548651())return _0x581f38(_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]));_0x14c2fd(),_0x42f2c7[_0x3ddba5([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4bfb6b=!0x1;const _0xaf908=ot();function _0x4ec93c(_0x238634){return!!_0x238634&&(typeof _0x238634===_0x3ddba5([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x238634===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x238634[_0x3ddba5([0x74,0x68,0x65,0x6e])]===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x238634[_0x3ddba5([0x63,0x61,0x74,0x63,0x68])]===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x57551b(_0xbecf2c){_0x769071(_0xbecf2c)[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x121dc1=>{if(!_0x121dc1||_0x121dc1[_0x3ddba5([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x3ddba5([0x6f,0x6b]))return _0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x4729a5(_0x597cf1(_0xaf908+_0x1a92ec))!=_0x121dc1[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]);})[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x16e1d0=>(_0x1c62d7(),_0x16e1d0),()=>{const _0x111200=_0xe1e591();return null==_0x111200?(_0x1c62d7(),_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])):_0x3ddba5(_0x58ec64-_0x111200>(0x19f340e1^_0x588350)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x581f38)[_0x3ddba5([0x63,0x61,0x74,0x63,0x68])](()=>{_0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x2bd5e1=0x3dc92a61^_0x588350;function _0x1c62d7(){const _0x42e5a7=_0x3ddba5([0x6c,0x6c,0x63,0x74,0x2d])+_0x4729a5(_0x597cf1(_0x5a97a2)),_0x3abdab=_0x57cdee(_0x4729a5(window[_0x3ddba5([0x4d,0x61,0x74,0x68])][_0x3ddba5([0x63,0x65,0x69,0x6c])](_0x58ec64/_0x2bd5e1)));window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x3ddba5([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x42e5a7,_0x3abdab);}function _0xe1e591(){const _0x1c3e05=_0x3ddba5([0x6c,0x6c,0x63,0x74,0x2d])+_0x4729a5(_0x597cf1(_0x5a97a2)),_0x395338=window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x3ddba5([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1c3e05);return _0x395338?window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x57cdee(_0x395338),0x10)*_0x2bd5e1:null;}function _0x769071(_0x459ee6){return new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x5cd89e,_0x56d7f6)=>{_0x459ee6[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x5cd89e,_0x56d7f6),window[_0x3ddba5([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x56d7f6,0x3dfe1021^_0x588350);});}}_0x42f2c7[_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x210584,_0x13c9c9)=>{if(_0x13c9c9[0x0]!=_0x5a97a2)return _0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x13c9c9[0x1]={..._0x13c9c9[0x1],[_0x3ddba5([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0xaf908};},{[_0x3ddba5([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x3ddba5([0x68,0x69,0x67,0x68])}),_0x42f2c7[_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x561916=>{_0x4ec93c(_0x561916[_0x3ddba5([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4bfb6b=!0x0,_0x57551b(_0x561916[_0x3ddba5([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x3ddba5([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x3ddba5([0x6c,0x6f,0x77])}),_0x1148fe[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>{_0x4bfb6b||_0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x548651(){return _0x42f2c7[_0x3ddba5([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x3ddba5([0x76,0x69,0x65,0x77])][_0x3ddba5([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x3ddba5([0x61,0x75,0x74,0x6f]);}function _0x14c2fd(){_0x42f2c7[_0x3ddba5([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x3ddba5([0x76,0x69,0x65,0x77])][_0x3ddba5([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x3ddba5([0x61,0x75,0x74,0x6f]);}}function _0x180ced(_0x3b3445){const _0x157367=[new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x410c1b=>setTimeout(_0x410c1b,0x3df6fa2d^_0x588350)),_0x1148fe[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4eb100=>{let _0x34d12c=0x0;_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x4e7695,_0x192f07)=>{_0x192f07[0x0][_0x3ddba5([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x34d12c++,_0x34d12c==(0x3dffc109^_0x588350)&&(_0x4eb100(),_0x4e7695[_0x3ddba5([0x6f,0x66,0x66])]());});}))];return window[_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x3ddba5([0x72,0x61,0x63,0x65])](_0x157367)[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>_0x3b3445);}async function _0x1ca79e(){await _0x1148fe,_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1cbe1d,_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1cbe1d,_0x42f2c7[_0x3ddba5([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x6bb18f(_0x28cb0b){const _0x179200=_0x3e484f();_0x42f2c7[_0x179200]=_0x3ddba5([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x28cb0b,_0x28cb0b!=_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])&&_0x1ca79e();}function _0x3e484f(){const _0xc068da=window[_0x3ddba5([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x3ddba5([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x3ddba5([0x6e,0x6f,0x77])]())[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x3ddba5([0x2e]),'');let _0xc28308=_0x3ddba5([0x6e]);for(let _0x419d79=0x0;_0x419d79<_0xc068da[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x419d79+=0x2){let _0x5bd0fe=window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xc068da[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x419d79,_0x419d79+0x2));_0x5bd0fe>=_0x351f00[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x5bd0fe-=_0x351f00[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0xc28308+=_0x351f00[_0x5bd0fe];}return _0xc28308;}function _0x34a329(){const _0x58a307=_0x1d53c3[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e]));if(0x3!=_0x58a307[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x2f985b(_0x58a307[0x1]);function _0x2f985b(_0x55a8f2){const _0x1ed764=_0xda10d9(_0x55a8f2);return _0x1ed764&&_0x53a639()?_0x1ed764:null;function _0x53a639(){const _0x205652=_0x1ed764[_0x3ddba5([0x6a,0x74,0x69])],_0x157702=window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x205652[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x205652[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x10ba3c={..._0x1ed764,[_0x3ddba5([0x6a,0x74,0x69])]:_0x205652[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x205652[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x10ba3c[_0x3ddba5([0x76,0x63])],_0x597cf1(_0x10ba3c)==_0x157702;}}}async function _0x51dd3f(){let _0x3a2563=!0x0;try{const _0x27bdeb=_0x1d53c3[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e])),[_0x3dbff9,_0x360e9d,_0x35d404]=_0x27bdeb;return _0x187685(_0x3dbff9),await _0x6dcf74(_0x3dbff9,_0x360e9d,_0x35d404),_0x3a2563;}catch{return!0x1;}function _0x187685(_0x4496a4){const _0x4b1142=_0xda10d9(_0x4496a4);_0x4b1142&&_0x4b1142[_0x3ddba5([0x61,0x6c,0x67])]==_0x3ddba5([0x45,0x53,0x32,0x35,0x36])||(_0x3a2563=!0x1);}async function _0x6dcf74(_0x51008d,_0x48221d,_0x2acd31){const _0x209e09=window[_0x3ddba5([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x3ddba5([0x66,0x72,0x6f,0x6d])](_0x2f660c(_0x2acd31),_0x5dc2da=>_0x5dc2da[_0x3ddba5([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x1a23b1=new window[(_0x3ddba5([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x3ddba5([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x51008d+_0x3ddba5([0x2e])+_0x48221d),_0x2fc1bb=window[_0x3ddba5([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x3ddba5([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x2fc1bb)return;const _0x47c694=await _0x2fc1bb[_0x3ddba5([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x3ddba5([0x6a,0x77,0x6b]),_0x871dc5,{[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x45,0x43,0x44,0x53,0x41]),[_0x3ddba5([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x3ddba5([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x2fc1bb[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x45,0x43,0x44,0x53,0x41]),[_0x3ddba5([0x68,0x61,0x73,0x68])]:{[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x47c694,_0x209e09,_0x1a23b1)||(_0x3a2563=!0x1);}}function _0xda10d9(_0xbaf213){return _0xbaf213[_0x3ddba5([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x3ddba5([0x65,0x79]))?JSON[_0x3ddba5([0x70,0x61,0x72,0x73,0x65])](_0x2f660c(_0xbaf213)):null;}function _0x2f660c(_0x3012f6){return window[_0x3ddba5([0x61,0x74,0x6f,0x62])](_0x3012f6[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x3ddba5([0x2b]))[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x3ddba5([0x2f])));}function _0x597cf1(_0x3889ed){let _0x8727e0=0x1505;function _0x2d0d60(_0x1f1005){for(let _0x2c4906=0x0;_0x2c4906<_0x1f1005[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2c4906++){const _0x1a2555=_0x1f1005[_0x3ddba5([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x2c4906);_0x8727e0=(_0x8727e0<<0x5)+_0x8727e0+_0x1a2555,_0x8727e0&=_0x8727e0;}}function _0x43650c(_0x230df2){Array[_0x3ddba5([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x230df2)?_0x230df2[_0x3ddba5([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x43650c):_0x230df2&&typeof _0x230df2==_0x3ddba5([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x3ddba5([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x230df2)[_0x3ddba5([0x73,0x6f,0x72,0x74])]()[_0x3ddba5([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x46f0a0,_0x9c2f7b])=>{_0x2d0d60(_0x46f0a0),_0x43650c(_0x9c2f7b);}):_0x2d0d60(window[_0x3ddba5([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x230df2));}return _0x43650c(_0x3889ed),_0x8727e0>>>0x0;}function _0x4729a5(_0x2e1e91){return _0x2e1e91[_0x3ddba5([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x3ddba5([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x3ddba5([0x30]));}function _0x57cdee(_0x43abd8){return _0x43abd8[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])]('')[_0x3ddba5([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x3ddba5([0x6a,0x6f,0x69,0x6e])]('');}function _0x1cbe1d(){}function _0x3ddba5(_0x40547b){return _0x40547b['map'](_0x19170c=>String['fromCharCode'](_0x19170c))['join']('');}_0x6bb18f(await _0x1c106d());}(this);}['showFakeVisualSelection'](){const _0x2555b8=this['editor']['model'];_0x2555b8['change'](_0x5b5811=>{const _0xeb7da2=_0x2555b8['document']['selection']['getRanges']();let _0xe5364e=0x0;for(const _0x6230f3 of _0xeb7da2){const _0x3c6241=Si+':'+_0xe5364e;if(_0x2555b8['markers']['has'](_0x3c6241))_0x5b5811['updateMarker'](_0x3c6241,{'range':_0x6230f3});else{if(_0x6230f3['start']['isAtEnd']){const _0x2b61f6=_0x6230f3['start']['getLastMatchingPosition'](({item:_0x26ef2e})=>!_0x2555b8['schema']['isContent'](_0x26ef2e),{'boundaries':_0x6230f3});_0x5b5811['addMarker'](_0x3c6241,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5b5811['createRange'](_0x2b61f6,_0x6230f3['end'])});}else _0x5b5811['addMarker'](_0x3c6241,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x6230f3});}_0xe5364e++;}});}['hideFakeVisualSelection'](){const _0x369b64=this['editor']['model'],_0x1168cc=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x1168cc['length']&&_0x369b64['change'](_0x56b115=>{_0x1168cc['forEach'](_0x3722d9=>{_0x56b115['removeMarker'](_0x3722d9);});});}['insertContent'](_0x20f8df,_0x51ba4d){const _0x11e53a=this['_getAISelection'](),_0x372476=_0x51ba4d||_0x11e53a['getFirstRange']();this['editor']['model']['canEditAt'](_0x372476)&&this['editor']['model']['change'](_0x160079=>{this['hideFakeVisualSelection'](),_0x51ba4d||this['_resetContentOfSelectedTableCells'](_0x160079,_0x11e53a),this['_pasteHTMLUsingClipboard']({'insertAt':_0x372476,'writer':_0x160079,'html':_0x20f8df});});}['insertContentBelow'](_0x1f3fdb){const {model:_0x2f4634}=this['editor'],_0x3eff47=this['_getAISelection']();_0x2f4634['change'](()=>{const _0x222cb4=this['_prepareTableInsertBelowPosition'](_0x1f3fdb,_0x3eff47)||this['_getDefaultInsertBelowPosition'](_0x3eff47);this['insertContent'](_0x1f3fdb,_0x222cb4);});}['_getAISelection'](){const _0x2eda8b=this['editor']['model'],_0x35665b=Array['from'](_0x2eda8b['markers']['getMarkersGroup'](Si))['map'](_0xd8085=>_0xd8085['getRange']());return _0x2eda8b['createSelection'](_0x35665b);}['_pasteHTMLUsingClipboard']({writer:_0x1d4d18,html:_0x4e9a7d,insertAt:_0x13c945}){const {view:_0x53d295}=this['editor']['editing'],_0xbb6bc6=this['editor']['plugins']['get'](_0x53aae2),_0x3a78ca=new fi();_0x3a78ca['setData']('text/html',_0x4e9a7d);const _0x14c3b2=new ClipboardEvent('paste',{'clipboardData':_0x3a78ca}),_0x203979=new _0x5a415e(_0x53d295,_0x14c3b2,{'dataTransfer':new _0x352cb4(_0x3a78ca)});_0x1d4d18['setSelection'](_0x13c945);const _0x23f5a7=(_0x4b1b60,_0x43012e)=>{_0x43012e['resultRange']&&_0x1d4d18['setSelection'](_0x43012e['resultRange']);};_0xbb6bc6['once']('contentInsertion',_0x23f5a7,{'priority':'lowest'}),_0x53d295['document']['fire']('paste',_0x203979),_0xbb6bc6['off']('contentInsertion',_0x23f5a7);}['_getDefaultInsertBelowPosition'](_0x3c712e){const {model:_0x5dbf99}=this['editor'],_0x1a7409=Array['from'](_0x3c712e['getSelectedBlocks']());return _0x1a7409['length']?_0x5dbf99['createPositionAfter'](_0x1a7409['pop']()):_0x3c712e['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x47f634,_0x1c75a7){const {model:_0x1a1687,plugins:_0x1b795d}=this['editor'];if(_0x1b795d['has']('TableUtils')){const _0x47fa09=_0x1b795d['get']('TableUtils')['getSelectedTableCells'](_0x1c75a7);if(_0x47fa09['length']){const _0x1f40d5=this['_getTableRowCountFromContent'](_0x47f634),_0x233801=this['_createEmptyTableRows'](_0x47fa09,_0x1f40d5);return _0x1a1687['createPositionAt'](_0x233801,0x0);}}return null;}['_getTableRowCountFromContent'](_0x3438e3){const _0x2bd1e4=this['editor']['plugins']['get']('TableUtils'),_0x5b65c6=this['editor']['data']['parse'](_0x3438e3),_0x2a1f26=Array['from'](_0x5b65c6['getChildren']())['filter'](_0x4f09b0=>_0x4f09b0['is']('element','table'));let _0x47bc9b=0x0;return _0x2a1f26['forEach'](_0x474357=>{_0x47bc9b+=_0x2bd1e4['getRows'](_0x474357);}),_0x47bc9b;}['_createEmptyTableRows'](_0x4affdd,_0x253d81){const _0x275444=this['editor']['plugins']['get']('TableUtils'),_0xc397bb=_0x275444['getRowIndexes'](_0x4affdd),_0xa06d54=_0x275444['getColumnIndexes'](_0x4affdd),_0x40bd5f=_0xc397bb['last']+0x1,_0x7abf97=_0xa06d54['first'],_0x17c7bc=_0x4affdd[0x0]['findAncestor']('table');for(let _0xd224d3=0x0;_0xd224d3<_0x253d81;_0xd224d3++)_0x275444['insertRows'](_0x17c7bc,{'at':_0x40bd5f});return _0x17c7bc['getChild'](_0x40bd5f)['getChild'](_0x7abf97);}['_resetContentOfSelectedTableCells'](_0x5112fc,_0x3fc0a){const {plugins:_0x2c19c1}=this['editor'],{model:_0xca24ae}=_0x5112fc;if(!_0x2c19c1['has']('TableUtils'))return;_0x2c19c1['get']('TableUtils')['getSelectedTableCells'](_0x3fc0a)['length']&&_0xca24ae['deleteContent'](_0x3fc0a);}}class AIAdapter extends _0x5686f0{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x5b6f19){super(_0x5b6f19),this['name']='AIRequestError';}}function Ri(_0x1eb0f0,_0x3c20a5,_0x19e617){const t=_0x1eb0f0['t'];switch(_0x3c20a5){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',_0x19e617);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x19e617);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'},_0x19e617);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_AWS_NOT_SUPPORTED':return t({'id':'AI_ERROR_AWS_NOT_SUPPORTED','string':'The\x20AWS\x20integration\x20is\x20no\x20longer\x20supported.\x20Please\x20contact\x20the\x20support.'});case'AI_ERROR_FAILED':return t({'id':'AI_ERROR_FAILED','string':'Failed\x20to\x20communicate\x20with\x20the\x20AI\x20service'});default:return _0x3c20a5;}}class ShowAIAssistantCommand extends _0x3a665b{['_commandDefinitions'];constructor(_0x496001,_0x2b9056){super(_0x496001),this['_commandDefinitions']=_0x2b9056,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3aa470,_0x2e3234,_0x5afec9)=>{this['isEnabled']&&(this['enabledCommandsIds']=bi(this['_commandDefinitions'],_0x5afec9));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x21b0ca,_0x30e0e4,_0x307384)=>{this['enabledCommandsIds']=_0x307384?bi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x543d1e=this['editor']['model'];this['_hasContext']=function(_0x2d8c1b){const _0x3c03a2=_0x2d8c1b['document']['selection'];return _0x3c03a2['isCollapsed']?0x0!==[..._0x3c03a2['getSelectedBlocks']()]['length']&&![..._0x3c03a2['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x2d8c1b['hasContent'](_0x3c03a2['getFirstRange']());}(_0x543d1e);const _0x48bd1d=_0x543d1e['document']['selection'],_0x360c5e=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x527f9f of _0x48bd1d['getRanges']())for(const _0x396749 of _0x527f9f['getItems']())if(_0x396749['is']('element')&&_0x360c5e['includes'](_0x396749['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x3e2816='',_0x2f5e4f='',_0x315565='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x3e2816,_0x2f5e4f,_0x315565);}}function bi(_0x1a8fd6,_0x3884a5){const _0xa46c7e=new Set();for(const _0x21ef8d of _0x1a8fd6['values']())(_0x3884a5||!0x1===_0x21ef8d['requiresContent'])&&_0xa46c7e['add'](_0x21ef8d['id']);return Array['from'](_0xa46c7e);}const Oi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */ ht(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x115ae6,_0xd5a5f7,_0x4b5ddf){super(),this['editor']=_0x115ae6,this['textAdapter']=_0xd5a5f7,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x4b5ddf,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x86a1dd,_0x2731fb,_0x5ebc79)=>{this['view']['value']=this['_sanitizeHTML'](_0x5ebc79);}),this['listenTo'](this['view'],'submitPrompt',(_0x27b040,_0x246121)=>{const _0x1fdde7=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x246121,_0x1fdde7,'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:_0x2d7615,query:_0x3015e4,htmlContent:_0x27a9d5,label:_0xc444de,mainActionLabel:_0x3e0e14}){this['view']['prompt']=_0xc444de,this['view']['mainAction']=_0x3e0e14,this['initialContext']=_0x27a9d5,_0x3015e4&&(this['view']['isRendered']?this['_handleQuery'](_0x3015e4,_0x27a9d5,_0x2d7615,_0xc444de):this['view']['once']('render',()=>{this['_handleQuery'](_0x3015e4,_0x27a9d5,_0x2d7615,_0xc444de);}));}['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'](_0x48748e,_0x3f2255,_0x4e4b40,_0x109af2){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x3f2255,this['previousQuery']=_0x48748e,this['previousLabel']=_0x109af2||_0x48748e,this['previousActionId']=_0x4e4b40,new Promise(_0x34ba52=>{this['textAdapter']['makeRequest']({'query':_0x48748e,'context':_0x3f2255,'onData':_0x104f52=>{this['currentResponse']=_0x104f52,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4e4b40})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x150285=>{_0x150285 instanceof AIRequestError?this['view']['handleError'](_0x150285['message']):this['view']['handleError'](),_0x34ba52();})['finally'](()=>{this['stopProcessing'](),_0x34ba52();});});}['_parseAndNormalizeContent'](_0x58b576,_0x32a775=!0x1){const _0x3aeec3=Oi['exec'](_0x58b576);_0x58b576=_0x3aeec3?_0x58b576['substring'](_0x3aeec3[0x1]['length']):_0x58b576['length']<0x64&&!_0x32a775?'':this['_stripMarkdownSyntax'](_0x58b576);const _0x58ac72=this['_domParser']['parseFromString'](_0x58b576,'text/html');if(_0x3aeec3){const _0x463c89=Array['from'](_0x58ac72['body']['childNodes']);_0x463c89['reverse']();for(const _0x2f0c49 of _0x463c89){if(_0x2f0c49['nodeType']==Node['ELEMENT_NODE'])break;_0x2f0c49['remove']();}}const _0x25a419=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x58ac72['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x25a419);const _0xbc21f2=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x139a64=this['editor']['data']['toModel'](_0x25a419);return _0xbc21f2||_0x139a64['markers']['clear'](),this['editor']['data']['stringify'](_0x139a64);}['_normalizeResponseHeadings'](_0x91c70a){const _0x483cd9=new _0x4642be(this['editor']['editing']['view']['document']),_0x2f4a33=new _0x442511({'name':/^h[1-5]$/}),_0x240256=[];let _0x5e322c=!0x1;for(const _0x1ea183 of _0x91c70a)_0x1ea183['is']('element')&&_0x2f4a33['match'](_0x1ea183)&&(_0x240256['push'](_0x1ea183),'h1'==_0x1ea183['name']&&(_0x5e322c=!0x0));if(_0x5e322c){for(const _0x18d6a0 of _0x240256)_0x483cd9['rename']('h'+(parseInt(_0x18d6a0['name'][0x1])+0x1),_0x18d6a0);}}['_isH1TagSupportEnabled'](){const {data:_0x40d03d,editing:_0x34b2d8}=this['editor'],_0x4ffed3=_0x40d03d['htmlProcessor']['toView']('<h1></h1>'),_0x80c9a5=_0x40d03d['toView'](_0x40d03d['toModel'](_0x4ffed3));return!!_0x34b2d8['view']['domConverter']['viewToDom'](_0x80c9a5)['querySelector']('h1');}['_sanitizeHTML'](_0x426dc8){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x426dc8),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x27514a){const _0x3f80ea=_0x27514a['trim']();return _0x3f80ea['startsWith']('```html')?_0x3f80ea['endsWith']('```')?_0x3f80ea['substring'](0x7,_0x3f80ea['length']-0x3):_0x3f80ea['substring'](0x7):_0x27514a;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x1ceada){super(_0x1ceada),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x1d2e49=>Ri(_0x1ceada,'AI_'+_0x1d2e49['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ri(_0x1ceada,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ri(_0x1ceada,'Try\x20again')),this['stopButton']=this['_createButton'](Ri(_0x1ceada,'Stop'));const _0x54cdba=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x54cdba['if']('isVisible','ck-hidden',_0x458f28=>!_0x458f28)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x5aa77f,_0x39a1ab){const _0x5d9498=new vt(this['locale']);return _0x5d9498['set']({'label':_0x5aa77f,'class':_0x39a1ab||'','isVisible':!0x0,'withText':!0x0}),_0x5d9498;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x564413,_0xed1962=''){super(_0x564413),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3d5f0c=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x564413,_0xed1962),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3d5f0c['if']('isVisible','ck-hidden',_0x3f51dd=>!_0x3f51dd)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3d5f0c['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 _0x10aaa6=!0x1;this['on']('change:value',(_0x4c2683,_0x30f5d3,_0x3ef5b8)=>{const _0x2af46a=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3ef5b8),this['isProcessing']&&_0x2af46a&&!_0x10aaa6&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x8c1882,_0x2fd015,_0x3eca19)=>{_0x10aaa6=!0x1,_0x3eca19?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x10aaa6=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x10aaa6=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x2df0ea=this['locale'],_0x22cf79=new vt(this['locale']),_0x5d866b='ck-ai-form__copy-button';return _0x22cf79['set']({'label':Ri(_0x2df0ea,'Copy'),'icon':_0x16addf,'class':_0x5d866b,'tooltip':!0x0}),_0x22cf79['bind']('isVisible')['to'](this,'value',_0x42483e=>!!_0x42483e),_0x22cf79['bind']('isEnabled')['to'](this,'isProcessing',_0x366cf3=>!_0x366cf3),_0x22cf79['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x22cf79['icon']=_0x4ab520,_0x22cf79['class']=_0x5d866b+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x22cf79['icon']=_0x16addf,_0x22cf79['class']=_0x5d866b;},0x3e8);}),_0x22cf79;}['_copyHTMLToClipboard'](_0x2a0ef1){const {window:_0xc96a4d,document:_0x184847}=ct;if(_0xc96a4d['ClipboardItem']){const {Blob:_0x470f75,ClipboardItem:_0x489a05}=_0xc96a4d,_0x530a95=[new _0x489a05({'text/html':new _0x470f75([_0x2a0ef1['innerHTML']],{'type':'text/html'}),'text/plain':new _0x470f75([_0x2a0ef1['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x530a95);}else{const _0x1ee8af=_0x184847['createElement']('div');_0x1ee8af['style']['position']='absolute',_0x1ee8af['style']['left']='-9999px',_0x1ee8af['innerHTML']='<span>[</span>'+_0x2a0ef1['innerHTML']+'<span>]</span>',_0x184847['body']['appendChild'](_0x1ee8af);const _0xa3377c=_0x184847['createRange']();_0xa3377c['setStartAfter'](_0x1ee8af['firstElementChild']),_0xa3377c['setEndBefore'](_0x1ee8af['lastElementChild']);const _0x39913e=_0xc96a4d['getSelection']();_0x39913e['removeAllRanges'](),_0x39913e['addRange'](_0xa3377c),_0x184847['execCommand']('copy'),_0x1ee8af['remove']();}}}class ContentFieldView extends Nt{constructor(_0x52183b,_0x1bdc2f=''){super(_0x52183b),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1bdc2f,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1d9ab6){this['element']['innerHTML']=_0x1d9ab6;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0xd332ed=new Nt(),_0x4f7ae3=this['locale'],_0x11dcd7=new yt();return _0x11dcd7['isVisible']=!0x0,_0xd332ed['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x11dcd7,{'text':Ri(_0x4f7ae3,'AI\x20is\x20writing...')}]}),_0xd332ed['render'](),_0xd332ed;}}class AIFormErrorView extends Nt{constructor(_0x3ea01c,_0x3fb501=''){super(_0x3ea01c);const _0x375e2d=new xt(),_0x163e50=this['bindTemplate'];this['set']('text',_0x3fb501),_0x375e2d['content']=_0x90f260,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x375e2d,{'text':_0x163e50['to']('text')}]});}}class AIFormPromptView extends Lt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x39f708,_0x4eb239){super(_0x39f708,_0x4eb239),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',(_0x4a3c06,_0x34c05b)=>{_0x4a3c06['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x34c05b());});}['_createSubmitButton'](){const _0x5b2b72=new vt(this['locale']),_0x1bd132=this['locale'];return _0x5b2b72['set']({'icon':_0x177154,'label':Ri(_0x1bd132,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5b2b72['on']('execute',()=>{this['submit']();}),_0x5b2b72['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x48d0cd,_0x145c73)=>!_0x48d0cd&&_0x145c73),_0x5b2b72;}['_createShowHistoryButton'](){const _0x48e8da=new vt(this['locale']),_0xcebda2=this['resultsView'],_0x9b8f23=this['locale'];_0x48e8da['set']({'label':Ri(_0x9b8f23,'History'),'withText':!0x1,'icon':_0x41655b,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x48e8da['bind']('isOn')['to'](_0xcebda2,'isVisible'),_0x48e8da['bind']('isEnabled')['to'](this,'isEnabled'),_0x48e8da['on']('execute',()=>{_0xcebda2['isVisible']=!_0xcebda2['isVisible'],_0xcebda2['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x381f54=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x58460e=new ut(this['queryView']['fieldView']['element']),_0x332940=_0x58460e['width'],_0x27068f='rtl'===_0x9b8f23['uiLanguageDirection']?'left':'right';_0x58460e['excludeScrollbarsAndBorders'](),_0x48e8da['element']['style'][_0x27068f]=_0x332940-_0x58460e['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x381f54),this['on']('render',_0x381f54),_0x48e8da;}['submit'](){const _0x103741=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x103741);}['focus'](_0x47270a){-0x1===_0x47270a?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x409f9d){super(_0x409f9d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ri(_0x409f9d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x5cd9b2=0x0;for(const _0x2ef658 of this['items'])_0x5cd9b2+=_0x2ef658['items']['length'];return{'resultsCount':_0x5cd9b2,'totalItemsCount':_0x5cd9b2};}['_createClearHistoryButton'](){const _0x3c55ad=this['locale'],_0x1b206c=new vt(this['locale']);return _0x1b206c['set']({'label':'('+Ri(_0x3c55ad,'Clear')+')','withText':!0x0}),_0x1b206c['on']('execute',()=>this['fire']('clearHistory')),_0x1b206c;}}class AIHistoryListItemView extends Pt{constructor(_0x3cebcd){super();const _0x4fff68=new Ht(),_0x5eb9d9=new vt(this['locale'],_0x4fff68);this['children']['add'](_0x5eb9d9),_0x5eb9d9['set']({'label':_0x3cebcd['prompt'],'withText':!0x0}),_0x5eb9d9['on']('execute',()=>{this['fire']('execute',{'value':_0x58cc9d(_0x3cebcd['prompt'])});});}}const vi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends dt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x4ae4f9,_0x5783ee)=>{const _0x4f5fe4=Ni(_0x5783ee['prompt']);for(const _0x1788df of this)if(_0x1788df!=_0x5783ee&&Ni(_0x1788df['prompt'])===_0x4f5fe4){this['remove'](_0x1788df);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2901b5=sessionStorage['getItem'](vi)||'[]';this['addMany'](JSON['parse'](_0x2901b5));}['_saveToSessionStorage'](){sessionStorage['setItem'](vi,JSON['stringify'](this['map'](_0x5be755=>_0x5be755)));}}function Ni(_0x51fab8){return _0x51fab8['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x302ce5,_0xfe45be,_0x5b0e2b=''){super(_0x302ce5),this['set']('isEnabled'