@ckeditor/ckeditor5-ai 48.2.0-alpha.5 → 48.2.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -6
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as _0x49edc5,Command as _0x588cbb,ContextPlugin as _0x179c1c,Editor as _0x3c7507}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x7e1abc,IconCheck as _0x491051,IconError as _0x46b74a,IconSubmit as _0x2edd45,IconAIHistory as _0x1f9f29,IconMagicWand as _0x26418f,IconRobotPencil as _0x3c2d8c,IconMaximize as _0x5b4120,IconMinimize as _0x5f47b8,IconShowChangesOn as _0x40c492,IconShowChangesOff as _0x855da,IconDocument as _0x4849ee,IconBoxWithCross as _0x4b09ba,IconBoxWithCheck as _0x56f9ef,IconBoxWithMarker as _0xbe57e4,IconInfo as _0x2c1eeb,IconWeb as _0x24eb32,IconCancel as _0x386fc5,IconSelection as _0xf4ac81,IconFileUpload as _0x174ee1,IconLink as _0x394fe8,IconImage as _0x5b6445,IconBulb as _0x285f1c,IconAI as _0x1e1027,IconPreviousArrow as _0x56c2cb,IconDocumentOutline as _0xb21257,IconLoupe as _0x4a6a21,IconPaperClip as _0x53363e,IconBrowseFiles as _0x5aa236,IconDropdownArrow as _0x226b43,IconStop as _0x4b8a16,IconPlus as _0xd19b58,IconAIChat as _0x23f8a8,IconPin as _0x41fe50,IconThreeHorizontalDots as _0x5d46bb,IconAIReview as _0x3c89ba,IconAITranslate as _0x355ab3,IconAIAskAI as _0x5e930d,IconThumbUp as _0x507dcd,IconThumbDown as _0x2836d8,IconChevronDown as _0x6c20cd,IconChevronUp as _0x162447,IconAIQuickActions as _0x279395,IconAIChatCommands as _0x151286,IconAIImproveWriting as _0x5ab2d4,IconAIContinueWriting as _0x4e6981,IconAIGrammarCheck as _0x575687,IconAIAdjustLength as _0x5c17e8,IconAIChangeTone as _0x36ae18,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x441b4b,createLabeledInputText as _0x4fa1a8,FormHeaderView as _0x485188,HighlightedTextView as _0x574ada,ViewCollection as _0x3ee0e4,FileDialogButtonView as _0x2b7121,InputTextView as _0x18ca7a,SearchTextView as _0xc66991,ListItemButtonView as _0x206b4d,ButtonLabelWithHighlightView as _0x4c3b9a,DropdownMenuPanelPositioningFunctions as _0x59f796,BalloonToolbar as _0x15f36b,FormRowView as _0x792f28,TextareaView as _0x33f904}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x53e87c,ClipboardMarkersUtils as _0x31ebd1}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x423c38,ViewDataTransfer as _0x427900,ViewUpcastWriter as _0x9f0d05,Matcher as _0x1d988b,_DetachOperation as _0x1ff4a8,_insertIntoModelNodeList as _0x58afdc,_removeFromModelNodeList as _0x31c058,ModelRange as _0x533258,transformOperationSets as _0x4fc222,ViewDowncastWriter as _0x3a40d4,ModelDocumentFragment as _0x24abee,ModelPosition as _0x56bf4a,ModelTreeWalker as _0x2f31ae,MarkerOperation as _0x511dc9,InsertOperation as _0x241317}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0xd1c895,escape as _0x13f09b,cloneDeep as _0x4f4192,throttle as _0x35b1e7,debounce as _0xf959ba,escapeRegExp as _0x325daf}from'es-toolkit/compat';import{createParser as _0x5bc300}from'eventsource-parser';import{CloudServices as _0x201364}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x41e112}from'htmlparser2';import{isTag as _0x25fe0f,findOne as _0x47014d,getParent as _0x5a6b8c,findAll as _0x61ba86,removeElement as _0x1221fe,prepend as _0x30dc49,prependChild as _0x102c31,appendChild as _0x51cc9e,append as _0x249093,find as _0x42a687,isComment as _0x3b312e,replaceElement as _0x2f4258,getChildren as _0x381e7f,textContent as ti}from'domutils';import _0xb56587 from'dom-serializer';import{isText as _0x3bbec3,cloneNode as _0x4382fa,Document as _0x1d2d6f,Element as _0x3ea511,Text as _0x34224c,isDocument as _0x3aeaad,NodeWithChildren as _0x3d283e}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x3429fe,MarkdownGfmMdToHtml as _0x358b4c}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x5d3be1 from'rehype-sanitize';import{fixElementSuggestionRange as _0x455e7a,DocumentCompare as _0x5e3d64,DATA_ID_MODEL_ATTRIBUTE as _0x352880,ConfirmMixin as _0x2f3261,getAllMarkersDomElementsSorted as _0x35a2b6,SuggestionsConversion as _0x580927,DATA_ID_VIEW_ATTRIBUTE as _0x3dc87a,getMarkerDomElement as _0x3ba088}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x72a3b0 from'morphdom';import{diffArrays as _0x27f9c1}from'diff';const Ti='_ungrouppedCommands';function fi(_0x31fe2b,_0x1e0f2d){const _0x2cef60=(0x0,_0x1e0f2d['t'])('Other');return _0x31fe2b['length']?'groupId'in _0x31fe2b[0x0]?_0x31fe2b:[{'groupId':Ti,'groupLabel':_0x2cef60,'order':0x1/0x0,'commands':_0x31fe2b}]:[{'groupId':Ti,'groupLabel':_0x2cef60,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x49edc5{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0xc49bf1}=this,_0x40c268=['ck-fake-ai-selection'];_0xc49bf1['config']['get']('ai.assistant.useTheme')&&_0x40c268['push']('ck-ai-assistant-ui_theme'),_0xc49bf1['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x40c268,'priority':0xc}}),_0xc49bf1['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x53d73b,{writer:_0x11d9cc})=>{if(!_0x53d73b['markerRange']['isCollapsed'])return null;const _0x4c139e=_0x11d9cc['createUIElement']('span');return _0x11d9cc['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4c139e),_0x4c139e;}});}['afterInit'](){!async function(_0x4be254){const _0x5490de=_0x27d941([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]),_0x4b619c=0x3dffc4e1,_0x333484=0x3df84f59^_0x4b619c,_0x4f7925=window[_0x27d941([0x44,0x61,0x74,0x65])][_0x27d941([0x6e,0x6f,0x77])](),_0x5f9c73=_0x4be254[_0x27d941([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x356e4e=new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3469d8=>{_0x5f9c73[_0x27d941([0x6f,0x6e,0x63,0x65])](_0x27d941([0x72,0x65,0x61,0x64,0x79]),_0x3469d8);}),_0x3f353f={[_0x27d941([0x6b,0x74,0x79])]:_0x27d941([0x45,0x43]),[_0x27d941([0x75,0x73,0x65])]:_0x27d941([0x73,0x69,0x67]),[_0x27d941([0x63,0x72,0x76])]:_0x27d941([0x50,0x2d,0x32,0x35,0x36]),[_0x27d941([0x78])]:_0x27d941([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]),[_0x27d941([0x79])]:_0x27d941([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]),[_0x27d941([0x61,0x6c,0x67])]:_0x27d941([0x45,0x53,0x32,0x35,0x36])},_0x3d93b9=_0x5f9c73[_0x27d941([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x27d941([0x67,0x65,0x74])](_0x27d941([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x1f4eb8(){let _0x3edd4f,_0x42119e=null,_0x3ab7aa=null;try{if(_0x3d93b9==_0x27d941([0x47,0x50,0x4c]))return _0x27d941([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x3edd4f=_0x396803(),!_0x3edd4f)return _0x27d941([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x3edd4f[_0x27d941([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x3ab7aa=_0x1deb98(_0x3edd4f[_0x27d941([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x3edd4f[_0x27d941([0x6a,0x74,0x69])])),await _0x572211()?_0x599dfd()?_0x46141a()?_0x27d941([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x3edf6a()?(_0x3edd4f[_0x27d941([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x27d941([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x42119e=_0x20bbbb(_0x27d941([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x20c24d()):_0x27d941([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x27d941([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x27d941([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x27d941([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x46141a(){const _0x1d05ee=[_0x27d941([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x27d941([0x74,0x72,0x69,0x61,0x6c])][_0x27d941([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3edd4f[_0x27d941([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x4f7925/0x3e8:0xe10*_0x333484;return _0x3edd4f[_0x27d941([0x65,0x78,0x70])]<_0x1d05ee;}function _0x599dfd(){const _0xee8f0=_0x3edd4f[_0x27d941([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0xee8f0&&(!!_0xee8f0[_0x27d941([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x27d941([0x2a]))||!!_0xee8f0[_0x27d941([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x27d941([0x41,0x49])));}function _0x3edf6a(){const _0x5b4e89=_0x3edd4f[_0x27d941([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5b4e89||0x0==_0x5b4e89[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x57140b}=new URL(window[_0x27d941([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5b4e89[_0x27d941([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x57140b))return!0x0;const _0x31e6ae=_0x57140b[_0x27d941([0x73,0x70,0x6c,0x69,0x74])](_0x27d941([0x2e]));return _0x5b4e89[_0x27d941([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x1cb1e8=>_0x1cb1e8[_0x27d941([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x27d941([0x2a])))[_0x27d941([0x6d,0x61,0x70])](_0x14da65=>_0x14da65[_0x27d941([0x73,0x70,0x6c,0x69,0x74])](_0x27d941([0x2e])))[_0x27d941([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x311c8b=>_0x311c8b[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x31e6ae[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x27d941([0x6d,0x61,0x70])](_0x3fb9d3=>Array(_0x31e6ae[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x3fb9d3[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x27d941([0x66,0x69,0x6c,0x6c])](_0x3fb9d3[0x0]===_0x27d941([0x2a])?_0x27d941([0x2a]):'')[_0x27d941([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x3fb9d3))[_0x27d941([0x73,0x6f,0x6d,0x65])](_0x353d4c=>_0x31e6ae[_0x27d941([0x65,0x76,0x65,0x72,0x79])]((_0x218299,_0x57e62a)=>_0x353d4c[_0x57e62a]===_0x218299||_0x353d4c[_0x57e62a]===_0x27d941([0x2a])));}function _0x20c24d(){return _0x42119e&&_0x3ab7aa?new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2109d6,_0x3da3d1)=>{_0x42119e[_0x27d941([0x74,0x68,0x65,0x6e])](_0x2109d6,_0x3da3d1),_0x3ab7aa[_0x27d941([0x74,0x68,0x65,0x6e])](_0x56bc58=>{_0x56bc58!=_0x27d941([0x56,0x61,0x6c,0x69,0x64])&&_0x2109d6(_0x56bc58);},_0x3da3d1);}):_0x42119e||_0x3ab7aa||_0x27d941([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1deb98(_0x2b2486,_0x423a69){return new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x218084=>{if(_0x46f0b3())return _0x218084(_0x27d941([0x56,0x61,0x6c,0x69,0x64]));_0x3932eb(),_0x5f9c73[_0x27d941([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x27d941([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4184e5=!0x1;const _0x2cf194=at();function _0x174502(_0x22b6da){return!!_0x22b6da&&(typeof _0x22b6da===_0x27d941([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x22b6da===_0x27d941([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x22b6da[_0x27d941([0x74,0x68,0x65,0x6e])]===_0x27d941([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x22b6da[_0x27d941([0x63,0x61,0x74,0x63,0x68])]===_0x27d941([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x2b90d1(_0x2ff9c3){_0x1c44cc(_0x2ff9c3)[_0x27d941([0x74,0x68,0x65,0x6e])](_0x1d234b=>{if(!_0x1d234b||_0x1d234b[_0x27d941([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x27d941([0x6f,0x6b]))return _0x27d941([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x2f3120(_0x2696c6(_0x2cf194+_0x423a69))!=_0x1d234b[_0x27d941([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x27d941([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x27d941([0x56,0x61,0x6c,0x69,0x64]);})[_0x27d941([0x74,0x68,0x65,0x6e])](_0x304cac=>(_0x134b9c(),_0x304cac),()=>{const _0xd45598=_0x15151f();return null==_0xd45598?(_0x134b9c(),_0x27d941([0x56,0x61,0x6c,0x69,0x64])):_0x27d941(_0x4f7925-_0xd45598>(0x19f340e1^_0x4b619c)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x27d941([0x74,0x68,0x65,0x6e])](_0x218084)[_0x27d941([0x63,0x61,0x74,0x63,0x68])](()=>{_0x218084(_0x27d941([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x442041=0x3dc92a61^_0x4b619c;function _0x134b9c(){const _0x46b827=_0x27d941([0x6c,0x6c,0x63,0x74,0x2d])+_0x2f3120(_0x2696c6(_0x2b2486)),_0x5d58ef=_0x1f5ab7(_0x2f3120(window[_0x27d941([0x4d,0x61,0x74,0x68])][_0x27d941([0x63,0x65,0x69,0x6c])](_0x4f7925/_0x442041)));window[_0x27d941([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x27d941([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x46b827,_0x5d58ef);}function _0x15151f(){const _0x3d0b34=_0x27d941([0x6c,0x6c,0x63,0x74,0x2d])+_0x2f3120(_0x2696c6(_0x2b2486)),_0x2af881=window[_0x27d941([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x27d941([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x3d0b34);return _0x2af881?window[_0x27d941([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x1f5ab7(_0x2af881),0x10)*_0x442041:null;}function _0x1c44cc(_0x1f3808){return new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x311c4c,_0x437b41)=>{_0x1f3808[_0x27d941([0x74,0x68,0x65,0x6e])](_0x311c4c,_0x437b41),window[_0x27d941([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x437b41,0x3dfe1021^_0x4b619c);});}}_0x5f9c73[_0x27d941([0x6f,0x6e])](_0x27d941([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x2ca7a9,_0x1344e1)=>{if(_0x1344e1[0x0]!=_0x2b2486)return _0x218084(_0x27d941([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x1344e1[0x1]={..._0x1344e1[0x1],[_0x27d941([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x2cf194};},{[_0x27d941([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x27d941([0x68,0x69,0x67,0x68])}),_0x5f9c73[_0x27d941([0x6f,0x6e])](_0x27d941([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0xa105f=>{_0x174502(_0xa105f[_0x27d941([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4184e5=!0x0,_0x2b90d1(_0xa105f[_0x27d941([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x27d941([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x27d941([0x6c,0x6f,0x77])}),_0x356e4e[_0x27d941([0x74,0x68,0x65,0x6e])](()=>{_0x4184e5||_0x218084(_0x27d941([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x46f0b3(){return _0x5f9c73[_0x27d941([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x27d941([0x76,0x69,0x65,0x77])][_0x27d941([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x27d941([0x61,0x75,0x74,0x6f]);}function _0x3932eb(){_0x5f9c73[_0x27d941([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x27d941([0x76,0x69,0x65,0x77])][_0x27d941([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x27d941([0x61,0x75,0x74,0x6f]);}}function _0x20bbbb(_0x2db702){const _0xe1340c=[new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3a86f8=>setTimeout(_0x3a86f8,0x3df6fa2d^_0x4b619c)),_0x356e4e[_0x27d941([0x74,0x68,0x65,0x6e])](()=>new window[(_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x1a3c1d=>{let _0x6092ac=0x0;_0x5f9c73[_0x27d941([0x6d,0x6f,0x64,0x65,0x6c])][_0x27d941([0x6f,0x6e])](_0x27d941([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x12183c,_0x1ce5fa)=>{_0x1ce5fa[0x0][_0x27d941([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x6092ac++,_0x6092ac==(0x3dffc109^_0x4b619c)&&(_0x1a3c1d(),_0x12183c[_0x27d941([0x6f,0x66,0x66])]());});}))];return window[_0x27d941([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x27d941([0x72,0x61,0x63,0x65])](_0xe1340c)[_0x27d941([0x74,0x68,0x65,0x6e])](()=>_0x2db702);}async function _0x1968ca(){await _0x356e4e,_0x5f9c73[_0x27d941([0x6d,0x6f,0x64,0x65,0x6c])][_0x27d941([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1ae2e1,_0x5f9c73[_0x27d941([0x6d,0x6f,0x64,0x65,0x6c])][_0x27d941([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1ae2e1,_0x5f9c73[_0x27d941([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x27d941([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x2b7a96(_0x20522a){const _0x59c6f6=_0x5a7029();_0x5f9c73[_0x59c6f6]=_0x27d941([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x20522a,_0x20522a!=_0x27d941([0x56,0x61,0x6c,0x69,0x64])&&_0x1968ca();}function _0x5a7029(){const _0x1bca78=window[_0x27d941([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x27d941([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x27d941([0x6e,0x6f,0x77])]())[_0x27d941([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x27d941([0x2e]),'');let _0x3cc111=_0x27d941([0x6e]);for(let _0x6ef129=0x0;_0x6ef129<_0x1bca78[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x6ef129+=0x2){let _0x43c236=window[_0x27d941([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x1bca78[_0x27d941([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x6ef129,_0x6ef129+0x2));_0x43c236>=_0x5490de[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x43c236-=_0x5490de[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x3cc111+=_0x5490de[_0x43c236];}return _0x3cc111;}function _0x396803(){const _0x3073cf=_0x3d93b9[_0x27d941([0x73,0x70,0x6c,0x69,0x74])](_0x27d941([0x2e]));if(0x3!=_0x3073cf[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x225a49(_0x3073cf[0x1]);function _0x225a49(_0x19a025){const _0x49e15b=_0x2ae05f(_0x19a025);return _0x49e15b&&_0x1f0082()?_0x49e15b:null;function _0x1f0082(){const _0x31370a=_0x49e15b[_0x27d941([0x6a,0x74,0x69])],_0x4902ee=window[_0x27d941([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x31370a[_0x27d941([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x31370a[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x266fb9={..._0x49e15b,[_0x27d941([0x6a,0x74,0x69])]:_0x31370a[_0x27d941([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x31370a[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x266fb9[_0x27d941([0x76,0x63])],_0x2696c6(_0x266fb9)==_0x4902ee;}}}async function _0x572211(){let _0x12dc7a=!0x0;try{const _0x1cfdad=_0x3d93b9[_0x27d941([0x73,0x70,0x6c,0x69,0x74])](_0x27d941([0x2e])),[_0x1649ba,_0x17e8f2,_0x485603]=_0x1cfdad;return _0x289f69(_0x1649ba),await _0x547f87(_0x1649ba,_0x17e8f2,_0x485603),_0x12dc7a;}catch{return!0x1;}function _0x289f69(_0x5cbcb4){const _0x69aedc=_0x2ae05f(_0x5cbcb4);_0x69aedc&&_0x69aedc[_0x27d941([0x61,0x6c,0x67])]==_0x27d941([0x45,0x53,0x32,0x35,0x36])||(_0x12dc7a=!0x1);}async function _0x547f87(_0x568efa,_0x5afadc,_0x2739c8){const _0x2336a5=window[_0x27d941([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x27d941([0x66,0x72,0x6f,0x6d])](_0x3f930a(_0x2739c8),_0x54a318=>_0x54a318[_0x27d941([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x3553a3=new window[(_0x27d941([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x27d941([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x568efa+_0x27d941([0x2e])+_0x5afadc),_0x4c8a89=window[_0x27d941([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x27d941([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x4c8a89)return;const _0x4559f7=await _0x4c8a89[_0x27d941([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x27d941([0x6a,0x77,0x6b]),_0x3f353f,{[_0x27d941([0x6e,0x61,0x6d,0x65])]:_0x27d941([0x45,0x43,0x44,0x53,0x41]),[_0x27d941([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x27d941([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x27d941([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x4c8a89[_0x27d941([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x27d941([0x6e,0x61,0x6d,0x65])]:_0x27d941([0x45,0x43,0x44,0x53,0x41]),[_0x27d941([0x68,0x61,0x73,0x68])]:{[_0x27d941([0x6e,0x61,0x6d,0x65])]:_0x27d941([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x4559f7,_0x2336a5,_0x3553a3)||(_0x12dc7a=!0x1);}}function _0x2ae05f(_0x4cd078){return _0x4cd078[_0x27d941([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x27d941([0x65,0x79]))?JSON[_0x27d941([0x70,0x61,0x72,0x73,0x65])](_0x3f930a(_0x4cd078)):null;}function _0x3f930a(_0x29eb24){return window[_0x27d941([0x61,0x74,0x6f,0x62])](_0x29eb24[_0x27d941([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x27d941([0x2b]))[_0x27d941([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x27d941([0x2f])));}function _0x2696c6(_0xda1465){let _0x5c0b3b=0x1505;function _0x46be23(_0x5da631){for(let _0x816b01=0x0;_0x816b01<_0x5da631[_0x27d941([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x816b01++){const _0x38b037=_0x5da631[_0x27d941([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x816b01);_0x5c0b3b=(_0x5c0b3b<<0x5)+_0x5c0b3b+_0x38b037,_0x5c0b3b&=_0x5c0b3b;}}function _0x55a7a7(_0x3067e1){Array[_0x27d941([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x3067e1)?_0x3067e1[_0x27d941([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x55a7a7):_0x3067e1&&typeof _0x3067e1==_0x27d941([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x27d941([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x3067e1)[_0x27d941([0x73,0x6f,0x72,0x74])]()[_0x27d941([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x153f57,_0x4cdefc])=>{_0x46be23(_0x153f57),_0x55a7a7(_0x4cdefc);}):_0x46be23(window[_0x27d941([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x3067e1));}return _0x55a7a7(_0xda1465),_0x5c0b3b>>>0x0;}function _0x2f3120(_0x1236a7){return _0x1236a7[_0x27d941([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x27d941([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x27d941([0x30]));}function _0x1f5ab7(_0x4c2b8e){return _0x4c2b8e[_0x27d941([0x73,0x70,0x6c,0x69,0x74])]('')[_0x27d941([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x27d941([0x6a,0x6f,0x69,0x6e])]('');}function _0x1ae2e1(){}function _0x27d941(_0x57ddae){return _0x57ddae['map'](_0x1c5b5a=>String['fromCharCode'](_0x1c5b5a))['join']('');}_0x2b7a96(await _0x1f4eb8());}(this);}['showFakeVisualSelection'](){const _0x192dee=this['editor']['model'];_0x192dee['change'](_0x5aac7f=>{const _0x39a5ab=_0x192dee['document']['selection']['getRanges']();let _0x258080=0x0;for(const _0x5611a2 of _0x39a5ab){const _0x2d55e7=bi+':'+_0x258080;if(_0x192dee['markers']['has'](_0x2d55e7))_0x5aac7f['updateMarker'](_0x2d55e7,{'range':_0x5611a2});else{if(_0x5611a2['start']['isAtEnd']){const _0x3d77c7=_0x5611a2['start']['getLastMatchingPosition'](({item:_0x30501f})=>!_0x192dee['schema']['isContent'](_0x30501f),{'boundaries':_0x5611a2});_0x5aac7f['addMarker'](_0x2d55e7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5aac7f['createRange'](_0x3d77c7,_0x5611a2['end'])});}else _0x5aac7f['addMarker'](_0x2d55e7,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5611a2});}_0x258080++;}});}['hideFakeVisualSelection'](){const _0x50381c=this['editor']['model'],_0x58aa6b=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x58aa6b['length']&&_0x50381c['change'](_0x4c8044=>{_0x58aa6b['forEach'](_0x1dbfe3=>{_0x4c8044['removeMarker'](_0x1dbfe3);});});}['insertContent'](_0x30a24e,_0xadf7ae){const _0x5bdf7c=this['_getAISelection'](),_0x266400=_0xadf7ae||_0x5bdf7c['getFirstRange']();this['editor']['model']['canEditAt'](_0x266400)&&this['editor']['model']['change'](_0x320786=>{this['hideFakeVisualSelection'](),_0xadf7ae||this['_resetContentOfSelectedTableCells'](_0x320786,_0x5bdf7c),this['_pasteHTMLUsingClipboard']({'insertAt':_0x266400,'writer':_0x320786,'html':_0x30a24e});});}['insertContentBelow'](_0x82ecb4){const {model:_0x35726f}=this['editor'],_0xcf2d33=this['_getAISelection']();_0x35726f['change'](()=>{const _0x23eb2a=this['_prepareTableInsertBelowPosition'](_0x82ecb4,_0xcf2d33)||this['_getDefaultInsertBelowPosition'](_0xcf2d33);this['insertContent'](_0x82ecb4,_0x23eb2a);});}['_getAISelection'](){const _0x6d26ef=this['editor']['model'],_0x41fb2b=Array['from'](_0x6d26ef['markers']['getMarkersGroup'](bi))['map'](_0x349c6e=>_0x349c6e['getRange']());return _0x6d26ef['createSelection'](_0x41fb2b);}['_pasteHTMLUsingClipboard']({writer:_0x4be67c,html:_0x51bf0b,insertAt:_0x3217f2}){const {view:_0x478e5d}=this['editor']['editing'],_0x40c95c=this['editor']['plugins']['get'](_0x53e87c),_0x171254=new Ri();_0x171254['setData']('text/html',_0x51bf0b);const _0x337d5f=new ClipboardEvent('paste',{'clipboardData':_0x171254}),_0x57520d=new _0x423c38(_0x478e5d,_0x337d5f,{'dataTransfer':new _0x427900(_0x171254)});_0x4be67c['setSelection'](_0x3217f2);const _0x29d98b=(_0x59708a,_0x385ff4)=>{_0x385ff4['resultRange']&&_0x4be67c['setSelection'](_0x385ff4['resultRange']);};_0x40c95c['once']('contentInsertion',_0x29d98b,{'priority':'lowest'}),_0x478e5d['document']['fire']('paste',_0x57520d),_0x40c95c['off']('contentInsertion',_0x29d98b);}['_getDefaultInsertBelowPosition'](_0x39578c){const {model:_0x250d2e}=this['editor'],_0x5e20ca=Array['from'](_0x39578c['getSelectedBlocks']());return _0x5e20ca['length']?_0x250d2e['createPositionAfter'](_0x5e20ca['pop']()):_0x39578c['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x178153,_0x46339b){const {model:_0x4fafd6,plugins:_0x4c5d61}=this['editor'];if(_0x4c5d61['has']('TableUtils')){const _0x2a4a2b=_0x4c5d61['get']('TableUtils')['getSelectedTableCells'](_0x46339b);if(_0x2a4a2b['length']){const _0xb7d703=this['_getTableRowCountFromContent'](_0x178153),_0x5fc426=this['_createEmptyTableRows'](_0x2a4a2b,_0xb7d703);return _0x4fafd6['createPositionAt'](_0x5fc426,0x0);}}return null;}['_getTableRowCountFromContent'](_0x45da71){const _0x5db7f6=this['editor']['plugins']['get']('TableUtils'),_0x3b8a7a=this['editor']['data']['parse'](_0x45da71,'$documentFragment'),_0x784379=Array['from'](_0x3b8a7a['getChildren']())['filter'](_0x484083=>_0x484083['is']('element','table'));let _0x3ee8fe=0x0;return _0x784379['forEach'](_0x4e804a=>{_0x3ee8fe+=_0x5db7f6['getRows'](_0x4e804a);}),_0x3ee8fe;}['_createEmptyTableRows'](_0x2de8d5,_0xac8a53){const _0x5356d2=this['editor']['plugins']['get']('TableUtils'),_0x28c7eb=_0x5356d2['getRowIndexes'](_0x2de8d5),_0x2d1eba=_0x5356d2['getColumnIndexes'](_0x2de8d5),_0x153e3e=_0x28c7eb['last']+0x1,_0x27e6ff=_0x2d1eba['first'],_0x24a00c=_0x2de8d5[0x0]['findAncestor']('table');for(let _0x259c18=0x0;_0x259c18<_0xac8a53;_0x259c18++)_0x5356d2['insertRows'](_0x24a00c,{'at':_0x153e3e});return _0x24a00c['getChild'](_0x153e3e)['getChild'](_0x27e6ff);}['_resetContentOfSelectedTableCells'](_0x5d70c3,_0x59a8df){const {plugins:_0x246efd}=this['editor'],{model:_0x27e191}=_0x5d70c3;if(!_0x246efd['has']('TableUtils'))return;_0x246efd['get']('TableUtils')['getSelectedTableCells'](_0x59a8df)['length']&&_0x27e191['deleteContent'](_0x59a8df);}}class AIAdapter extends _0x49edc5{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x335c01){super(_0x335c01),this['name']='AIRequestError';}}function Si(_0xe41a26,_0x10cfb1,_0x14ae03){const t=_0xe41a26['t'];switch(_0x10cfb1){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',_0x14ae03);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x14ae03);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'},_0x14ae03);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 _0x10cfb1;}}class ShowAIAssistantCommand extends _0x588cbb{['_commandDefinitions'];constructor(_0x2d62d8,_0x51a67d){super(_0x2d62d8),this['_commandDefinitions']=_0x51a67d,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x1e320c,_0x422b9b,_0x30f461)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x30f461));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x515ef3,_0x5563b6,_0x5a064d)=>{this['enabledCommandsIds']=_0x5a064d?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x29b8c7=this['editor']['model'];this['_hasContext']=function(_0x56ce65){const _0x3a37b9=_0x56ce65['document']['selection'];return _0x3a37b9['isCollapsed']?0x0!==[..._0x3a37b9['getSelectedBlocks']()]['length']&&![..._0x3a37b9['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x56ce65['hasContent'](_0x3a37b9['getFirstRange']());}(_0x29b8c7);const _0x2dbfd3=_0x29b8c7['document']['selection'],_0x2a8cb0=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x227090 of _0x2dbfd3['getRanges']())for(const _0x2ee504 of _0x227090['getItems']())if(_0x2ee504['is']('element')&&_0x2a8cb0['includes'](_0x2ee504['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0xa18efd='',_0x52711a='',_0x425f09='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0xa18efd,_0x52711a,_0x425f09);}}function Oi(_0xefe48c,_0x506ae8){const _0x276800=new Set();for(const _0x4307c1 of _0xefe48c['values']())(_0x506ae8||!0x1===_0x4307c1['requiresContent'])&&_0x276800['add'](_0x4307c1['id']);return Array['from'](_0x276800);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
|
|
24
|
-
ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x1a8808,_0x4bebca,_0x5c3065){super(),this['editor']=_0x1a8808,this['textAdapter']=_0x4bebca,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x5c3065,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x2ee5b6,_0x1ef14d,_0x13f0e1)=>{this['view']['value']=this['_sanitizeHTML'](_0x13f0e1);}),this['listenTo'](this['view'],'submitPrompt',(_0x3c356b,_0x44446c)=>{const _0x1266c6=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x44446c,_0x1266c6,'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:_0x29721e,query:_0x39fdc6,htmlContent:_0x11e6ec,label:_0x57d052,mainActionLabel:_0x898135}){this['view']['prompt']=_0x57d052,this['view']['mainAction']=_0x898135,this['initialContext']=_0x11e6ec,_0x39fdc6&&(this['view']['isRendered']?this['_handleQuery'](_0x39fdc6,_0x11e6ec,_0x29721e,_0x57d052):this['view']['once']('render',()=>{this['_handleQuery'](_0x39fdc6,_0x11e6ec,_0x29721e,_0x57d052);}));}['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'](_0x482dd6,_0x38e052,_0x91fd34,_0x5800df){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x38e052,this['previousQuery']=_0x482dd6,this['previousLabel']=_0x5800df||_0x482dd6,this['previousActionId']=_0x91fd34,new Promise(_0x35ec83=>{this['textAdapter']['makeRequest']({'query':_0x482dd6,'context':_0x38e052,'onData':_0x3b48b9=>{this['currentResponse']=_0x3b48b9,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x91fd34})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x48dc7d=>{_0x48dc7d instanceof AIRequestError?this['view']['handleError'](_0x48dc7d['message']):this['view']['handleError'](),_0x35ec83();})['finally'](()=>{this['stopProcessing'](),_0x35ec83();});});}['_parseAndNormalizeContent'](_0x526fb6,_0x1948ae=!0x1){const _0x2addc2=vi['exec'](_0x526fb6);_0x526fb6=_0x2addc2?_0x526fb6['substring'](_0x2addc2[0x1]['length']):_0x526fb6['length']<0x64&&!_0x1948ae?'':this['_stripMarkdownSyntax'](_0x526fb6);const _0x12bcb2=this['_domParser']['parseFromString'](_0x526fb6,'text/html');if(_0x2addc2){const _0x3058b2=Array['from'](_0x12bcb2['body']['childNodes']);_0x3058b2['reverse']();for(const _0x33e04d of _0x3058b2){if(_0x33e04d['nodeType']==Node['ELEMENT_NODE'])break;_0x33e04d['remove']();}}const _0x370e3d=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x12bcb2['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x370e3d);const _0x413aaf=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x3160c9=this['editor']['data']['toModel'](_0x370e3d);return _0x413aaf||_0x3160c9['markers']['clear'](),this['editor']['data']['stringify'](_0x3160c9);}['_normalizeResponseHeadings'](_0x24ba16){const _0xd0926c=new _0x9f0d05(this['editor']['editing']['view']['document']),_0x5a3f6c=new _0x1d988b({'name':/^h[1-5]$/}),_0x223f11=[];let _0x34f747=!0x1;for(const _0x5331ee of _0x24ba16)_0x5331ee['is']('element')&&_0x5a3f6c['match'](_0x5331ee)&&(_0x223f11['push'](_0x5331ee),'h1'==_0x5331ee['name']&&(_0x34f747=!0x0));if(_0x34f747){for(const _0x5efe71 of _0x223f11)_0xd0926c['rename']('h'+(parseInt(_0x5efe71['name'][0x1])+0x1),_0x5efe71);}}['_isH1TagSupportEnabled'](){const {data:_0x27f053,editing:_0x3635a2}=this['editor'],_0x17eedb=_0x27f053['htmlProcessor']['toView']('<h1></h1>'),_0x4854a1=_0x27f053['toView'](_0x27f053['toModel'](_0x17eedb));return!!_0x3635a2['view']['domConverter']['viewToDom'](_0x4854a1)['querySelector']('h1');}['_sanitizeHTML'](_0x36468d){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x36468d),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x14bf6c){const _0x567721=_0x14bf6c['trim']();return _0x567721['startsWith']('```html')?_0x567721['endsWith']('```')?_0x567721['substring'](0x7,_0x567721['length']-0x3):_0x567721['substring'](0x7):_0x14bf6c;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0xb39bca){super(_0xb39bca),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x5e49b0=>Si(_0xb39bca,'AI_'+_0x5e49b0['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0xb39bca,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0xb39bca,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0xb39bca,'Stop'));const _0x4643fe=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x4643fe['if']('isVisible','ck-hidden',_0x4179eb=>!_0x4179eb)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x5a796d,_0x599959){const _0x4a893b=new yt(this['locale']);return _0x4a893b['set']({'label':_0x5a796d,'class':_0x599959||'','isVisible':!0x0,'withText':!0x0}),_0x4a893b;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x4d07e5,_0x307370=''){super(_0x4d07e5),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x1e4eb6=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x4d07e5,_0x307370),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x1e4eb6['if']('isVisible','ck-hidden',_0x5958aa=>!_0x5958aa)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x1e4eb6['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 _0x57f9ad=!0x1;this['on']('change:value',(_0x53d66b,_0x4d3ac3,_0x410e26)=>{const _0x3df941=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x410e26),this['isProcessing']&&_0x3df941&&!_0x57f9ad&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xb94014,_0x4a55d3,_0x230ce8)=>{_0x57f9ad=!0x1,_0x230ce8?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x57f9ad=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x57f9ad=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x26596a=this['locale'],_0x1e8317=new yt(this['locale']),_0x2af66c='ck-ai-form__copy-button';return _0x1e8317['set']({'label':Si(_0x26596a,'Copy'),'icon':_0x7e1abc,'class':_0x2af66c,'tooltip':!0x0}),_0x1e8317['bind']('isVisible')['to'](this,'value',_0x16d159=>!!_0x16d159),_0x1e8317['bind']('isEnabled')['to'](this,'isProcessing',_0x150765=>!_0x150765),_0x1e8317['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x1e8317['icon']=_0x491051,_0x1e8317['class']=_0x2af66c+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x1e8317['icon']=_0x7e1abc,_0x1e8317['class']=_0x2af66c;},0x3e8);}),_0x1e8317;}['_copyHTMLToClipboard'](_0x53d8ce){const {window:_0x2c2cc8,document:_0x47aa64}=lt;if(_0x2c2cc8['ClipboardItem']){const {Blob:_0x79e11c,ClipboardItem:_0x373441}=_0x2c2cc8,_0x482fe5=[new _0x373441({'text/html':new _0x79e11c([_0x53d8ce['innerHTML']],{'type':'text/html'}),'text/plain':new _0x79e11c([_0x53d8ce['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x482fe5);}else{const _0x52422c=_0x47aa64['createElement']('div');_0x52422c['style']['position']='absolute',_0x52422c['style']['left']='-9999px',_0x52422c['innerHTML']='<span>[</span>'+_0x53d8ce['innerHTML']+'<span>]</span>',_0x47aa64['body']['appendChild'](_0x52422c);const _0x3d5d78=_0x47aa64['createRange']();_0x3d5d78['setStartAfter'](_0x52422c['firstElementChild']),_0x3d5d78['setEndBefore'](_0x52422c['lastElementChild']);const _0x53e8d2=_0x2c2cc8['getSelection']();_0x53e8d2['removeAllRanges'](),_0x53e8d2['addRange'](_0x3d5d78),_0x47aa64['execCommand']('copy'),_0x52422c['remove']();}}}class ContentFieldView extends Nt{constructor(_0x205bd8,_0x1f1d07=''){super(_0x205bd8),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1f1d07,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x31c1cd){this['element']['innerHTML']=_0x31c1cd;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x42f9b0=new Nt(),_0x2e735f=this['locale'],_0x5cbb57=new xt();return _0x5cbb57['isVisible']=!0x0,_0x42f9b0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x5cbb57,{'text':Si(_0x2e735f,'AI\x20is\x20writing...')}]}),_0x42f9b0['render'](),_0x42f9b0;}}class AIFormErrorView extends Nt{constructor(_0x2ee5d2,_0x256a2f=''){super(_0x2ee5d2);const _0x2191bb=new Lt(),_0x336326=this['bindTemplate'];this['set']('text',_0x256a2f),_0x2191bb['content']=_0x46b74a,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2191bb,{'text':_0x336326['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x5d6931,_0xe08882){super(_0x5d6931,_0xe08882),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',(_0x1cda39,_0x223a8f)=>{_0x1cda39['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x223a8f());});}['_createSubmitButton'](){const _0x455b26=new yt(this['locale']),_0x489eaf=this['locale'];return _0x455b26['set']({'icon':_0x2edd45,'label':Si(_0x489eaf,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x455b26['on']('execute',()=>{this['submit']();}),_0x455b26['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x4686a3,_0x446608)=>!_0x4686a3&&_0x446608),_0x455b26;}['_createShowHistoryButton'](){const _0x38bd2d=new yt(this['locale']),_0x270b32=this['resultsView'],_0x3674f4=this['locale'];_0x38bd2d['set']({'label':Si(_0x3674f4,'History'),'withText':!0x1,'icon':_0x1f9f29,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x38bd2d['bind']('isOn')['to'](_0x270b32,'isVisible'),_0x38bd2d['bind']('isEnabled')['to'](this,'isEnabled'),_0x38bd2d['on']('execute',()=>{_0x270b32['isVisible']=!_0x270b32['isVisible'],_0x270b32['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x4bfc61=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x337a21=new dt(this['queryView']['fieldView']['element']),_0x47b21b=_0x337a21['width'],_0x59b10b='rtl'===_0x3674f4['uiLanguageDirection']?'left':'right';_0x337a21['excludeScrollbarsAndBorders'](),_0x38bd2d['element']['style'][_0x59b10b]=_0x47b21b-_0x337a21['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x4bfc61),this['on']('render',_0x4bfc61),_0x38bd2d;}['submit'](){const _0x5de25a=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5de25a);}['focus'](_0x4b5ebb){-0x1===_0x4b5ebb?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x2f13aa){super(_0x2f13aa),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x2f13aa,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x4df810=0x0;for(const _0x3569f3 of this['items'])_0x4df810+=_0x3569f3['items']['length'];return{'resultsCount':_0x4df810,'totalItemsCount':_0x4df810};}['_createClearHistoryButton'](){const _0x47e211=this['locale'],_0x327b82=new yt(this['locale']);return _0x327b82['set']({'label':'('+Si(_0x47e211,'Clear')+')','withText':!0x0}),_0x327b82['on']('execute',()=>this['fire']('clearHistory')),_0x327b82;}}class AIHistoryListItemView extends Ht{constructor(_0x13f016){super();const _0x4a033e=new Mt(),_0x23247b=new yt(this['locale'],_0x4a033e);this['children']['add'](_0x23247b),_0x23247b['set']({'label':_0x13f016['prompt'],'withText':!0x0}),_0x23247b['on']('execute',()=>{this['fire']('execute',{'value':_0xd1c895(_0x13f016['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x2ccf5f,_0x381d45)=>{const _0x552728=Ni(_0x381d45['prompt']);for(const _0x33b2e4 of this)if(_0x33b2e4!=_0x381d45&&Ni(_0x33b2e4['prompt'])===_0x552728){this['remove'](_0x33b2e4);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x321abc=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x321abc));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x25159b=>_0x25159b)));}}function Ni(_0x4c60e4){return _0x4c60e4['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x2e9ace,_0xecdba9,_0x3205ac=''){super(_0x2e9ace),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x2e9ace),this['contentArea']=new AIFormContentArea(_0x2e9ace,_0x3205ac),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 It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'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 _0x4ffff1=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0xecdba9],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x4ffff1['if']('isError','ck-hidden',_0x45bf69=>!_0x45bf69)]},'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'](_0x7a15b8=0x1){-0x1===_0x7a15b8?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 _0x3ea473=this['locale'],_0x391491=new AIFormPromptView(_0x3ea473,{'queryView':{'label':Si(_0x3ea473,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x3ea473,'Empty\x20history'),'secondary':Si(_0x3ea473,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x391491['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3928f1,_0x705a82)=>_0x3928f1&&!_0x705a82),this['listenTo'](_0x391491,'submit',(_0x51ab99,_0x2fcc17)=>{this['prompt']=_0x2fcc17;const _0xe23948=_0x13f09b(_0x2fcc17);this['fire']('submitPrompt',_0xe23948),_0x2fcc17['trim']()&&this['_promptHistory']['add']({'prompt':_0xe23948},0x0);},{'priority':'high'}),_0x391491;}['_createHistoryView'](){const _0x191744=new AIHistoryListView(this['locale']);return _0x191744['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x191744['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x191744;}['_createToolbar'](){const _0x3da40c=new AIFormToolbarView(this['locale']);return _0x3da40c['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xc93807,_0x552f47,_0x14d439)=>_0xc93807&&!_0x552f47&&!!_0x14d439),_0x3da40c['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x3da40c['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2e29dc,_0x12427c,_0x53eefc)=>_0x2e29dc&&!_0x12427c&&!!_0x53eefc),_0x3da40c['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x3da40c['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x410b5e,_0x5567a6)=>_0x410b5e&&!_0x5567a6),_0x3da40c['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x3da40c['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x3da40c['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x3da40c;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x562adb=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x562adb,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4c1e86){const _0x3ee583=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4c1e86||Si(_0x3ee583,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x49edc5{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x31ebd1,AIAssistantEditing,AIAdapter,Gt];}constructor(_0xaecd9a){super(_0xaecd9a),_0xaecd9a['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0xaecd9a['config']['define']('ai.assistant.contentAreaCssClass',''),_0xaecd9a['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0xaecd9a['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x32c61e}=this;this['_aiAdapter']=_0x32c61e['plugins']['get'](AIAdapter),this['_dialog']=_0x32c61e['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5c58a5=new ShowAIAssistantCommand(_0x32c61e,Array['from'](this['_commandDefinitions']['values']()));_0x32c61e['commands']['add']('showAIAssistant',_0x5c58a5),_0x32c61e['ui']['componentFactory']['add']('aiCommands',_0x33eb96=>{const _0x157826=Ft(_0x33eb96);return _0x157826['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x157826['buttonView']['set']({'label':Si(_0x33eb96,'AI\x20Commands'),'icon':_0x26418f,'tooltip':!0x0}),_0x157826['on']('execute',_0x3f7efd=>this['_onExecute'](_0x3f7efd['source']['id'])),Wt(_0x157826,_0x32c61e['ui']['view']['body'],function(_0x69ca10){const _0x2386fd=fi(_0x69ca10['config']['get']('ai.assistant.commands'),_0x69ca10['locale']),_0x596cc1=Pi(_0x69ca10,_0x2386fd)['filter'](_0x314cb9=>_0x314cb9['commands']['length']);if(0x1===_0x596cc1['length'])return Pi(_0x69ca10,_0x596cc1[0x0]['commands'])['map'](_0x5b3f0e=>({'id':_0x5b3f0e['id'],'label':_0x5b3f0e['label']}));return _0x596cc1['map'](_0x365fa6=>{const {groupId:_0x56c47f,groupLabel:_0x43d36b,commands:_0x5e28da}=_0x365fa6,_0x453214=Pi(_0x69ca10,_0x5e28da)['map'](_0x409b17=>({'id':_0x409b17['id'],'label':_0x409b17['label']}));return{'id':_0x56c47f,'menu':_0x43d36b||_0x56c47f,'children':_0x453214};});}(_0x32c61e),{'ariaLabel':Si(_0x33eb96,'AI\x20Commands')}),_0x157826['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5c58a5['on']('change:enabledCommandsIds',_0x5af6ac),_0x157826['menuView']['once']('render',_0x5af6ac),_0x157826;function _0x5af6ac(){_0x157826['isEnabled']=_0x5c58a5['enabledCommandsIds']['length']>0x0;for(const _0x23a7ca of _0x157826['menuView']['buttons'])_0x23a7ca['isEnabled']=_0x5c58a5['enabledCommandsIds']['includes'](_0x23a7ca['id']);}}),_0x32c61e['ui']['componentFactory']['add']('menuBar:aiCommands',_0x33fe35=>{const _0x2358eb=new Kt(_0x33fe35);_0x2358eb['buttonView']['set']({'label':Si(_0x33fe35,'AI\x20Commands'),'icon':_0x26418f}),_0x2358eb['bind']('isEnabled')['to'](_0x5c58a5,'enabledCommandsIds',_0x223bd5=>_0x223bd5['length']>0x0);const _0x1f5aa6=fi(_0x32c61e['config']['get']('ai.assistant.commands'),_0x33fe35);return this['_populateMenuBarMenu'](_0x5c58a5,_0x2358eb,_0x1f5aa6,_0x4b1b62=>this['_onExecute'](_0x4b1b62)),_0x2358eb;}),_0x32c61e['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x2ca7ff=this['_createAIAssistantUIButton'](yt);return _0x2ca7ff['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x2ca7ff;}),_0x32c61e['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0xf79bb=this['_createAIAssistantUIButton'](Yt);return _0xf79bb['set']({'role':'menuitemcheckbox'}),_0xf79bb;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x8f9757=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3d45f5;for(const _0x3ca318 in _0x8f9757){const _0x2eedf5=_0x3ca318,_0x3624d1=_0x8f9757[_0x2eedf5];if('aiLicenseKeyValid'==_0x3624d1||'aiLicenseKeyInvalid'==_0x3624d1||'aiLicenseKeyExpired'==_0x3624d1||'aiLicenseKeyDomainLimit'==_0x3624d1||'aiLicenseKeyNotAllowed'==_0x3624d1||'aiLicenseKeyEvaluationLimit'==_0x3624d1||'aiLicenseKeyUsageLimit'==_0x3624d1){delete _0x8f9757[_0x2eedf5],_0x3d45f5=_0x3624d1,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3d45f5&&_0x8f9757['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3d45f5&&_0x8f9757['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3d45f5&&_0x8f9757['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3d45f5&&_0x8f9757['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3d45f5&&_0x8f9757['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x3d45f5&&_0x8f9757['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x3f9e63='',_0xe7f67b='',_0x590389='custom'){const _0x6dd33e=this['editor'],_0x1578a6=_0x6dd33e['editing']['view'],_0x3bc117=_0x6dd33e['plugins']['get'](AIAssistantEditing),_0x5205b6=_0x6dd33e['plugins']['get'](_0x31ebd1);_0x3bc117['showFakeVisualSelection']();const _0xb4e1f8=new xi(),_0x3dfa1c=new ClipboardEvent('copy',{'clipboardData':_0xb4e1f8}),_0x2b9b00=new _0x427900(_0xb4e1f8),_0x39005a=new _0x423c38(_0x1578a6,_0x3dfa1c,{'dataTransfer':_0x2b9b00});_0x5205b6['_forceMarkersCopy']('comment',()=>{_0x1578a6['document']['fire']('copy',_0x39005a);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x6dd33e,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x48acba=_0x2b9b00['getData']('text/html');const _0x3b54a1=_0x6dd33e['model']['document']['selection'],_0x5b6880=Array['from'](_0x3b54a1['getRanges']());0x1===_0x5b6880['length']&&_0x5b6880[0x0]['isFlat']&&!_0x3b54a1['getSelectedElement']()&&''!==_0x48acba['replace'](/ /g,'')['trim']()&&(_0x48acba='<p>'+_0x48acba+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x590389,'query':_0x3f9e63,'htmlContent':_0x48acba,'label':_0xe7f67b,'mainActionLabel':ki[_0x6dd33e['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x3c2d8c,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x3bc117['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x4607ac=new Map(),_0x1d76f4=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x48bc11 of _0x1d76f4)for(const _0x181f4e of _0x48bc11['commands'])_0x4607ac['set'](_0x181f4e['id'],{..._0x181f4e,'groupId':_0x48bc11['groupId'],'groupLabel':_0x48bc11['groupLabel']||_0x48bc11['groupId']});return _0x4607ac;}['_createAIAssistantUIButton'](_0x46747d){const _0x5e891b=this['editor'],_0x4347c8=_0x5e891b['commands']['get']('showAIAssistant'),_0x58c0d3=new _0x46747d(_0x5e891b['locale']);return _0x58c0d3['set']({'label':Si(_0x5e891b['locale'],'AI\x20Assistant'),'icon':_0x3c2d8c,'isToggleable':!0x0}),_0x58c0d3['bind']('isEnabled')['to'](_0x4347c8),_0x58c0d3['bind']('isOn')['to'](this['_dialog'],'id',_0x33ec00=>'aiAssistant'===_0x33ec00),this['listenTo'](_0x58c0d3,'execute',()=>{_0x58c0d3['isOn']?this['hideUI']():_0x4347c8['execute']();}),_0x58c0d3;}['_initView'](){const _0x4308ed=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x4308ed['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x4308ed['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x2f5779,ui:{ariaLiveAnnouncer:_0x44d5dc}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x18f00e,_0x367a19,_0x424e13)=>{const _0x51429a=this['_aiAssistantController']['currentContext'];_0x424e13?_0x44d5dc['announce'](Si(_0x2f5779,'AI\x20is\x20writing')):_0x51429a&&_0x44d5dc['announce'](Si(_0x2f5779,'Generated\x20content:\x20%0',_0x51429a),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0xf524b2,_0x3a12b6,_0x4d6f00)=>{if(_0x4d6f00){const _0x402033=this['_formView']['errorView']['text'];_0x44d5dc['announce'](Si(_0x2f5779,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x402033));}});}['_onExecute'](_0x1eabdd){const _0x3de17b=this['_commandDefinitions']['get'](_0x1eabdd),_0x34bc8b=this['editor'],_0x42f05f=_0x34bc8b['model']['document']['selection'],_0x2a3be7=_0x34bc8b['commands']['get']('showAIAssistant'),_0xca2fa1=_0x34bc8b['plugins']['get'](AIAssistantEditing),_0x206e6=''+(_0x3de17b['groupId']!==Ti?_0x3de17b['groupLabel']+':\x20':'')+_0x3de17b['label'];if(!0x1!==_0x3de17b['requiresContent']&&_0x42f05f['isCollapsed']){const _0x96bcd9=gt(_0x42f05f['getSelectedBlocks']())||_0x34bc8b['model']['schema']['getLimitElement'](_0x42f05f);_0x34bc8b['model']['change'](_0x481b6c=>{_0x481b6c['setSelection'](_0x96bcd9,'in');});}_0xca2fa1['showFakeVisualSelection'](),_0x2a3be7['execute'](_0x3de17b['prompt'],_0x206e6,'command:'+_0x1eabdd);}['_populateMenuBarMenu'](_0x46b0d1,_0xb54a31,_0x9b6036,_0x50420e){const _0x5b760b=this['editor'],_0x4a93d9=_0x5b760b['locale'],_0x561545=new qt(_0x4a93d9),_0x3c7e91=Pi(_0x5b760b,_0x9b6036)['filter'](_0xa1f24=>_0xa1f24['commands']['length']);0x1===_0x3c7e91['length']?this['_getMenuBarGroupButtons']({'command':_0x46b0d1,'commands':_0x3c7e91[0x0]['commands'],'parentMenuView':_0xb54a31,'onExecute':_0x50420e})['forEach'](_0x1639e8=>_0x561545['items']['add'](_0x1639e8)):_0x3c7e91['forEach'](({groupId:_0x483f37,groupLabel:_0x9701ab,commands:_0x2bd5cc})=>{const _0x1f0bbf=new Qt(_0x4a93d9,_0xb54a31),_0x1e6a96=new Kt(_0x4a93d9),_0x129500=new qt(_0x4a93d9),_0x1ddb44=this['_getMenuBarGroupButtons']({'command':_0x46b0d1,'commands':_0x2bd5cc,'parentMenuView':_0x1e6a96,'onExecute':_0x50420e});_0x1e6a96['buttonView']['set']({'label':_0x9701ab||_0x483f37}),_0x1e6a96['delegate']('execute')['to'](_0xb54a31),_0x129500['items']['addMany'](_0x1ddb44),_0x1e6a96['panelView']['children']['add'](_0x129500),_0x1f0bbf['children']['add'](_0x1e6a96),_0x561545['items']['add'](_0x1f0bbf);}),_0xb54a31['panelView']['children']['add'](_0x561545);}['_getMenuBarGroupButtons']({command:_0x41b16f,commands:_0x1b9b4a,parentMenuView:_0x4dd832,onExecute:_0x54c730}){const _0x132c86=this['editor'],_0x3b1998=_0x132c86['locale'];return Pi(_0x132c86,_0x1b9b4a)['map'](_0x4fa141=>{const _0x45cb85=new Qt(_0x3b1998,_0x4dd832),_0x249e47=new Yt(_0x3b1998);return _0x249e47['set']({'label':_0x4fa141['label']}),_0x249e47['delegate']('execute')['to'](_0x4dd832),_0x249e47['on']('execute',()=>_0x54c730(_0x4fa141['id'])),_0x249e47['bind']('isEnabled')['to'](_0x41b16f,'enabledCommandsIds',_0x4a9f77=>_0x4a9f77['includes'](_0x4fa141['id'])),_0x45cb85['children']['add'](_0x249e47),_0x45cb85;});}}function Li(_0x107d18,_0x202783){return void 0x0!==_0x107d18['order']&&void 0x0===_0x202783['order']?0x1:void 0x0===_0x107d18['order']&&void 0x0!==_0x202783['order']?-0x1:void 0x0!==_0x107d18['order']&&void 0x0!==_0x202783['order']?_0x107d18['order']-_0x202783['order']:0x0;}function Pi(_0x503249,_0x335ff4){_0x335ff4['sort'](Li);const _0x14d543={},_0x185850=[];for(const _0x3c725c of _0x335ff4)if(void 0x0!==_0x3c725c['order']){if(_0x3c725c['order']in _0x14d543)throw new ht('ai-commands-config-order-collision',_0x503249,{'conflictingDefinitions':[_0x3c725c,_0x14d543[_0x3c725c['order']]]});_0x14d543[_0x3c725c['order']]=_0x3c725c,_0x185850['splice'](_0x3c725c['order'],0x0,_0x3c725c);}else _0x185850['push'](_0x3c725c);return _0x185850;}class AIAssistant extends _0x49edc5{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2a2584){super(_0x2a2584);const _0x580d49=_0x2a2584['config'],_0x1816df=_0x2a2584['locale'];_0x580d49['define']('ai.assistant.preserveComments',!0x0),_0x580d49['define']('ai.assistant.commands',Di(_0x1816df)),_0x580d49['define']('ai.assistant.extraCommandGroups',[]),_0x580d49['define']('ai.assistant.removeCommands',[]);let _0x40947c=fi(_0x580d49['get']('ai.assistant.commands'),_0x1816df);const _0x55a7a8=_0x580d49['get']('ai.assistant.extraCommandGroups'),_0x1311ce=_0x580d49['get']('ai.assistant.removeCommands');_0x55a7a8['forEach'](_0x41fb6d=>{const _0x187edc=_0x40947c['find'](_0x5ec0cf=>_0x5ec0cf['groupId']===_0x41fb6d['groupId']);_0x187edc?_0x187edc['commands']=_0x187edc['commands']['concat'](_0x41fb6d['commands']):_0x40947c['push'](_0x41fb6d);}),_0x40947c=_0x40947c['filter'](_0x54bb6f=>!_0x1311ce['includes'](_0x54bb6f['groupId'])),_0x40947c['forEach'](_0x2fc811=>{_0x2fc811['commands']=_0x2fc811['commands']['filter'](_0x276c0b=>!_0x1311ce['includes'](_0x276c0b['id']));}),_0x580d49['set']('ai.assistant.commands',_0x40947c);}}function Di(_0x71d624){return[{'groupId':'editOrReview','groupLabel':Si(_0x71d624,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x71d624,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x71d624,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Si(_0x71d624,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x71d624,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Si(_0x71d624,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x71d624,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Si(_0x71d624,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Si(_0x71d624,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x71d624,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x71d624,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x71d624,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x71d624,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x71d624,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x71d624,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x71d624,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x71d624,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x71d624,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x71d624,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x71d624,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x71d624,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x71d624,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x71d624,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x71d624,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x71d624,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x71d624,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x71d624,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x71d624,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x49edc5{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x3f6dc7){super(_0x3f6dc7),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x4abfc7){return this['sendRequest'](_0x4abfc7)['catch'](_0x4043b=>{if(_0x4043b instanceof AIRequestError)return Promise['reject'](_0x4043b);if('AbortError'==_0x4043b['name'])return Promise['resolve']();throw console['error'](_0x4043b),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x1581ee,_0x5b7924){const _0x48c801=this['editor']['locale'],_0x3aea40={'Content-Type':'application/json'};if('object'==typeof _0x1581ee)Object['assign'](_0x3aea40,_0x1581ee);else{if(_0x1581ee)try{const _0x35adda=await _0x1581ee(_0x5b7924);Object['assign'](_0x3aea40,_0x35adda);}catch{return Promise['reject'](new AIRequestError(Si(_0x48c801,'AI_ERROR_GET_HEADERS')));}}return _0x3aea40;}async['_prepareRequestParameters'](_0x2361a4,_0x368149){const _0x4c8166=this['editor']['locale'];if('object'==typeof _0x2361a4)return _0x2361a4;try{return await _0x2361a4(_0x368149);}catch{return Promise['reject'](new AIRequestError(Si(_0x4c8166,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x3409ae){super(_0x3409ae),_0x3409ae['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x3409ae['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x3409ae['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x3409ae['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x3409ae['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x3409ae['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x415800,context:_0x3ac7da,onData:_0x53195a,actionId:_0x5784bf}){const _0x3e1e7d=this['editor']['locale'],_0x48df2e=await this['prepareMessages'](_0x415800,_0x3ac7da,_0x5784bf),_0x560961=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x5784bf),_0x2a2be1=await this['_prepareRequestParameters'](this['_requestParameters'],_0x5784bf),_0x308878={'messages':_0x48df2e,..._0x2a2be1},_0x2f5afb={'method':'POST','headers':_0x560961,'body':JSON['stringify'](_0x308878),'signal':this['abortController']['signal']},_0x44958e=await fetch(this['_apiUrl'],_0x2f5afb);if(_0x44958e['ok'])return _0x2a2be1['stream']?await this['_readStreamableResponse'](_0x44958e,_0x53195a):await this['_readStaticResponse'](_0x44958e,_0x53195a),Promise['resolve']();{const _0x4c25fc=await _0x44958e['text']();return _0x4c25fc['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x3e1e7d,'AI_ERROR_CONTEXT_LENGTH'))):_0x4c25fc['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x3e1e7d,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x4c25fc));}}async['prepareMessages'](_0x559ab3,_0x3964b7,_0x425cfb){let _0xab9e3a,_0xab7c71;return _0x3964b7?(_0xab9e3a='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0xab7c71='Instruction:\x0a'+_0x559ab3+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3964b7):(_0xab9e3a='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0xab7c71=_0x559ab3),[{'role':'system','content':_0xab9e3a},{'role':'user','content':_0xab7c71}];}async['_readStreamableResponse'](_0x52fcee,_0xf71db7){const _0x56806b=_0x52fcee['body']['getReader'](),_0xe29946=new TextDecoder();let _0x114a51='',_0x524cba='',_0x3e81e6='',_0x2d8493=!0x1;for(;!_0x2d8493;){const {done:_0x25fb41,value:_0x393883}=await _0x56806b['read'](),_0x43cefb=_0x114a51+_0xe29946['decode'](_0x393883);let _0x3f7a16='';_0x2d8493=_0x25fb41;try{_0x3f7a16=this['_cleanUpData'](_0x43cefb),_0x114a51='';}catch{_0x114a51=_0x43cefb;continue;}_0x524cba+=_0x3f7a16,!_0x2d8493&&this['_isBufferIncomplete'](_0x524cba)||_0x524cba&&(_0x3e81e6+=_0x524cba,_0x524cba='',_0xf71db7(_0x3e81e6));}return Promise['resolve']();}async['_readStaticResponse'](_0x225c24,_0xc6fb7b){return _0xc6fb7b((await _0x225c24['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x33bcae){const _0x49ca11=_0x33bcae['split']('<')['length']!==_0x33bcae['split']('>')['length'],_0x451e00=_0x33bcae['length']<0x1e;return _0x49ca11&&_0x451e00;}['_cleanUpData'](_0x4168fd){return _0x4168fd['split'](/\n(?![^{]*\})/g)['map'](_0x5ab11e=>_0x5ab11e['replace']('data:\x20',''))['filter'](_0x96480d=>_0x96480d&&_0x96480d['length']>0x0&&'[DONE]'!==_0x96480d)['map'](_0xbaf8ce=>{const {choices:_0x33b67a}=JSON['parse'](_0xbaf8ce);if(_0x33b67a[0x0]?.['delta']?.['content'])return _0x33b67a[0x0]['delta']['content'];})['filter'](_0x7c4e28=>_0x7c4e28)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0xd856a2){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x5c4f88,_0xb847ba={}){super(_0x5c4f88),this['isToggleable']=!0x0,this['set']('side',_0xb847ba['side']||'top');const _0x28bc55=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0xb847ba['class']||[]),_0x28bc55['to']('side',_0x2f4837=>'ck-tab-button_'+_0x2f4837),_0x28bc55['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x5266ea,_0x3f6afa={}){super(_0x5266ea);const _0xb2d19=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x3f6afa['class']||[]),_0xb2d19['to']('class'),_0xb2d19['if']('isVisible','ck-hidden',_0x5588b6=>!_0x5588b6)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x678b93,_0x41307d={}){super(_0x678b93),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x41307d['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x41307d['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x3daa47,_0x9e4c16)=>_0x3daa47&&null!==_0x9e4c16);const _0x3cdd0e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x41307d['class']||[]),_0x3cdd0e['to']('side',_0x453467=>'ck-tabs_'+_0x453467),_0x3cdd0e['to']('class'),_0x3cdd0e['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x3cdd0e['to']('activeTab',_0x260d04=>null===_0x260d04?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x3cdd0e['to']('side',_0x27bfef=>'ck-tabs__buttons-container_'+_0x27bfef)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x3cdd0e['to']('side',_0x2f4068=>'ck-tabs__panels-container_'+_0x2f4068)]},'children':this['panelViews']},...mt(_0x41307d['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x2def02){const _0x3d7db8=this['_tabs']['get'](_0x2def02);return _0x3d7db8||null;}['addTab'](_0x34da98){const _0x356a10=this['_setupButton']({'id':_0x34da98['id'],'label':_0x34da98['buttonLabel'],'icon':_0x34da98['buttonIcon'],'order':_0x34da98['order']}),_0xbb8113=new TabPanelView(this['locale']);return _0xbb8113['render'](),_0x34da98['content']&&_0xbb8113['children']['add'](_0x34da98['content']),this['panelViews']['add'](_0xbb8113),this['_tabs']['set'](_0x34da98['id'],{'button':_0x356a10,'panel':_0xbb8113,'order':void 0x0!==_0x34da98['order']?_0x34da98['order']:null}),this['fire']('addTab:'+_0x34da98['id'],{'id':_0x34da98['id'],'button':_0x356a10,'panel':_0xbb8113}),null===this['activeTab']?this['activateTab'](_0x34da98['id']):this['_hidePanel'](_0x34da98['id']),{'button':_0x356a10,'panel':_0xbb8113};}['activateTab'](_0x52ce67){if(null!==_0x52ce67&&!this['getTab'](_0x52ce67))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x52ce67});if(this['activeTab']===_0x52ce67)return;const _0x25a36c=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x52ce67,_0x52ce67&&this['_showPanel'](_0x52ce67),this['fire']('activateTab:'+_0x52ce67,{'newTab':_0x52ce67,'oldTab':_0x25a36c});}['toggleTabPanel'](_0x190a4f){if(!this['getTab'](_0x190a4f))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x190a4f});this['activeTab']===_0x190a4f?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x190a4f);}['showTab'](_0x2ebabf){if(!this['getTab'](_0x2ebabf))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2ebabf});this['_showPanel'](_0x2ebabf),this['_showButton'](_0x2ebabf),this['fire']('show:'+_0x2ebabf,_0x2ebabf);}['hideTab'](_0x115cdb){if(!this['getTab'](_0x115cdb))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x115cdb});const _0x557f37=this['activeTab'];this['_hidePanel'](_0x115cdb),this['_hideButton'](_0x115cdb);const _0x2cc31f=this['getTabIds']();_0x557f37===_0x115cdb&&_0x2cc31f['length']>0x1&&this['activateTab'](_0x2cc31f['find'](_0x101590=>_0x101590!==_0x115cdb)),this['fire']('hide:'+_0x115cdb,_0x115cdb);}['_getPanel'](_0x306d2f){const _0x4c37e9=this['_tabs']['get'](_0x306d2f);return _0x4c37e9?_0x4c37e9['panel']:null;}['_showPanel'](_0x2aad7f){null!==this['activeTab']&&this['activeTab']!==_0x2aad7f||this['_getPanel'](_0x2aad7f)['show']();}['_hidePanel'](_0x55b385){const _0x23615c=this['_getPanel'](_0x55b385);_0x23615c['isVisible']&&(this['activeTab']===_0x55b385&&(this['activeTab']=null),_0x23615c['hide']());}['_getButton'](_0x3772ff){const _0x41de8b=this['_tabs']['get'](_0x3772ff);return _0x41de8b?_0x41de8b['button']:null;}['_showButton'](_0x1ff626){this['_getButton'](_0x1ff626)['show']();}['_hideButton'](_0x4d08aa){this['_getButton'](_0x4d08aa)['hide']();}['_setupButton'](_0x321cf1){const _0x43fd49=new TabButtonView(this['locale'],{'side':this['side']}),_0x221e60=this['buttonViews'];if(_0x43fd49['set']({'label':_0x321cf1['label'],'icon':_0x321cf1['icon'],'tooltip':!0x0,'withText':!0x0}),_0x43fd49['bind']('isOn')['to'](this,'activeTab',_0x4cb34a=>_0x4cb34a===_0x321cf1['id']),_0x43fd49['bind']('side')['to'](this,'side'),_0x321cf1['order']){const _0xa3cdb8=[...this['_tabs']]['reduce']((_0x3842fd,_0x1d4f9c)=>{const _0x4344ae=_0x1d4f9c[0x0],{order:_0x1eb5d0}=_0x1d4f9c[0x1];return!_0x1eb5d0||_0x1eb5d0>_0x321cf1['order']?_0x3842fd:_0x1eb5d0>=_0x3842fd['order']?{'id':_0x4344ae,'order':_0x1eb5d0}:_0x3842fd;},{'id':'','order':0x0}),_0xb480f=_0x221e60['getIndex'](this['_getButton'](_0xa3cdb8['id']));_0x221e60['add'](_0x43fd49,_0xb480f+0x1);}else _0x221e60['add'](_0x43fd49);return _0x43fd49['on']('execute',()=>{this['toggleTabPanel'](_0x321cf1['id']);}),_0x43fd49;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x1d8edc,_0x9ddc16={}){super(_0x1d8edc,_0x9ddc16),this['set']('type',_0x9ddc16['type']||'sidebar'),this['set']('side',_0x9ddc16['side']||'right'),this['set']('isVisible',_0x9ddc16['visibleByDefault']??!0x0);const _0x3300a8=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x3300a8['if']('type','ck-ai-tabs__overlay',_0x1605b1=>'overlay'===_0x1605b1),_0x3300a8['if']('type','ck-ai-tabs__sidebar',_0x195458=>'sidebar'===_0x195458),_0x3300a8['if']('isVisible','ck-hidden',_0x2de28c=>!_0x2de28c)]}}),this['buttonViews']['on']('add',(_0x113168,_0x345970)=>{_0x345970['set']('withText',!0x1);});}}class AITabs extends _0x179c1c{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x33be49){if(super(_0x33be49),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x1dd6b9=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x1dd6b9['showResizeButton']&&(this['showResizeButton']=_0x1dd6b9['showResizeButton']),'sidebar'!==_0x1dd6b9['type']&&'overlay'!==_0x1dd6b9['type']||_0x1dd6b9['side']&&(this['side']=_0x1dd6b9['side']),'sidebar'===_0x1dd6b9['type']){if(this['container']=_0x1dd6b9['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x1dd6b9['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x1dd6b9['visibleByDefault'],'collapsible':_0x1dd6b9['collapsible']}),this['view']['render'](),this['view']['bind']('side')['to'](this,'side'),this['view']['bind']('type')['to'](this,'type'),this['container']&&this['container']['appendChild'](this['view']['element']),this['context']instanceof _0x3c7507&&this['context']['ui']['focusTracker']['add'](this['view']['element']),this['listenTo'](this,'resizeTabs',()=>{this['view']['isMaximized']=!this['view']['isMaximized'],this['fire']('resizedTabs',this['view']['isMaximized']);});}['switchType'](_0x554f09){if(_0x554f09&&this['type']!==_0x554f09){if(!Vi['includes'](_0x554f09))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x554f09;}}['switchSide'](_0x59d18c){if(_0x59d18c&&this['side']!==_0x59d18c){if(!Hi['includes'](_0x59d18c))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x59d18c;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x179c1c{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x201364];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5755fd){if(super(_0x5755fd),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x2264ed=this['context']['plugins']['get'](_0x201364);if(!_0x2264ed['token'])throw new ht('ai-missing-token',this);this['_token']=_0x2264ed['token'];}['startConversation'](_0x55c17b,_0x5ed3e5){const _0x4bc42b=this['_sendApiRequest']('/conversations','POST',{'id':_0x55c17b,'group':_0x5ed3e5});return{'getConversation':async()=>(await _0x4bc42b['request'])['json'](),'abortController':_0x4bc42b['abortController']};}['queryAssistant']({message:_0x20aa08,conversationId:_0xe5a43a,parts:_0x17afab,capabilities:_0x3a69a9,model:_0x310146,attributes:_0x3fb953}){const _0x14ef07={'prompt':_0x20aa08,'content':_0x17afab,'model':_0x310146,..._0x3a69a9&&{'capabilities':_0x3a69a9},..._0x3fb953&&{'attributes':_0x3fb953}},_0x3aa680=this['_sendApiRequest']('/conversations/'+_0xe5a43a+'/messages','POST',_0x14ef07,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x5f168a=(await _0x3aa680['request'])['body'];return this['_getStreamReader'](_0x5f168a);},'abortController':_0x3aa680['abortController']};}['executeCustomAction']({content:_0x35ea5a,message:_0x172369,model:_0x16c322,outputFormat:_0x1d2ba2}){const _0x21f535={'content':[{'type':'text','content':_0x35ea5a}],'prompt':_0x172369,'model':_0x16c322,'outputFormat':_0x1d2ba2},_0x2144be=this['_sendApiRequest']('/actions/custom/calls','POST',_0x21f535);return{'getStream':async()=>{const _0x5d44bc=(await _0x2144be['request'])['body'];return this['_getStreamReader'](_0x5d44bc);},'abortController':_0x2144be['abortController']};}['executeAction']({actionName:_0x2211b1,content:_0x1d4e84,args:_0x27968b}){const _0x299242={'content':[{'type':'text','content':_0x1d4e84}],'args':_0x27968b},_0x14a143=this['_sendApiRequest']('/actions/system/'+_0x2211b1+'/calls','POST',_0x299242);return{'getStream':async()=>{const _0x4fb5eb=(await _0x14a143['request'])['body'];return this['_getStreamReader'](_0x4fb5eb);},'abortController':_0x14a143['abortController']};}['uploadFile'](_0x3b6075,_0xe3550e,_0x4a5b81){const _0x325632=new FormData();_0x325632['append']('file',_0xe3550e,_0xe3550e['name']),_0x4a5b81&&_0x325632['append']('attributes',JSON['stringify'](_0x4a5b81));const _0x4d5a49=this['_sendApiRequest']('/conversations/'+_0x3b6075+'/files','POST',_0x325632);return{'getId':async()=>(await _0x4d5a49['request'])['json'](),'abortController':_0x4d5a49['abortController']};}['fetchDocument'](_0x3f0919,_0x38590f){const _0xf55aba=this['_sendApiRequest']('/conversations/'+_0x3f0919+'/documents/'+_0x38590f,'GET');return{'getDocument':async()=>(await _0xf55aba['request'])['json'](),'abortController':_0xf55aba['abortController']};}['uploadDocument'](_0x11301f,_0x34f8ca,_0x2cb895){const _0x47aa6b={'content':_0x34f8ca};_0x2cb895&&(_0x47aa6b['attributes']=_0x2cb895);const _0x38fd60=this['_sendApiRequest']('/conversations/'+_0x11301f+'/documents','POST',_0x47aa6b);return{'getId':async()=>(await _0x38fd60['request'])['json'](),'abortController':_0x38fd60['abortController']};}['uploadDocuments'](_0x23125f,_0x40587b){const _0x4df1c9={'documents':_0x40587b['map'](_0x249e28=>({'content':_0x249e28['content'],'attributes':{'version':_0x249e28['version'],'sessionId':_0x249e28['sessionId'],'channelId':_0x249e28['channelId'],'rootName':_0x249e28['rootName'],'selections':_0x249e28['selections']},...void 0x0!==_0x249e28['name']?{'name':_0x249e28['name']}:{},...void 0x0!==_0x249e28['description']?{'description':_0x249e28['description']}:{}}))},_0x64cc26=this['_sendApiRequest']('/conversations/'+_0x23125f+'/documents/batch','POST',_0x4df1c9);return{'getIds':async()=>(await _0x64cc26['request'])['json'](),'abortController':_0x64cc26['abortController']};}['fetchDocuments'](_0xcf2394,_0x4dc2e1){const _0x499420=new URLSearchParams();_0x499420['append']('documentIds',_0x4dc2e1['join'](','));const _0x137abd=this['_sendApiRequest']('/conversations/'+_0xcf2394+'/documents/batch?'+_0x499420['toString'](),'GET');return{'getDocuments':async()=>(await _0x137abd['request'])['json'](),'abortController':_0x137abd['abortController']};}['fetchConversations'](_0x355f34,_0x43d1f6={}){const _0x1abf7b=new URLSearchParams();_0x1abf7b['append']('group',_0x355f34),_0x1abf7b['append']('excludeEmpty',!0x1!==_0x43d1f6['excludeEmpty']?'true':'false'),_0x1abf7b['append']('limit',_0x43d1f6['limit']?_0x43d1f6['limit']['toString']():'100'),_0x1abf7b['append']('sortBy',_0x43d1f6['sortBy']?_0x43d1f6['sortBy']:'createdAt'),_0x1abf7b['append']('order',_0x43d1f6['order']?_0x43d1f6['order']:'desc');const _0x1617a6=this['_sendApiRequest']('/conversations?'+_0x1abf7b['toString'](),'GET');return{'getConversations':async()=>{const _0x355c5a=await _0x1617a6['request'];return(await _0x355c5a['json']())['items'];},'abortController':_0x1617a6['abortController']};}['deleteConversation'](_0x3872c7){const _0x3a7966=this['_sendApiRequest']('/conversations/'+_0x3872c7,'DELETE');return{'execute':async()=>{await _0x3a7966['request'];},'abortController':_0x3a7966['abortController']};}['updateConversation'](_0x1ed1e2,_0x33d15b){const _0x217ee8=this['_sendApiRequest']('/conversations/'+_0x1ed1e2,'PATCH',_0x33d15b);return{'getResult':async()=>(await _0x217ee8['request'],_0x33d15b),'abortController':_0x217ee8['abortController']};}['fetchConversation'](_0x1297df){const _0x427a31=this['_sendApiRequest']('/conversations/'+_0x1297df,'GET');return{'getConversation':async()=>(await _0x427a31['request'])['json'](),'abortController':_0x427a31['abortController']};}['fetchConversationMessages'](_0x2812f3){const _0x5801f6=this['_sendApiRequest']('/conversations/'+_0x2812f3+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x4558b1=await _0x5801f6['request'];return(await _0x4558b1['json']())['items'];},'abortController':_0x5801f6['abortController']};}['uploadUrl'](_0x4cc0b2,_0x1e4ffc,_0x240324){const _0x2f01f9=this['_sendApiRequest']('/conversations/'+_0x4cc0b2+'/web-resources','POST',{'url':_0x1e4ffc,'attributes':_0x240324});return{'getId':async()=>(await _0x2f01f9['request'])['json'](),'abortController':_0x2f01f9['abortController']};}['getModels'](_0x6c7fb4='en'){const _0x10908b=new URLSearchParams();_0x10908b['append']('language',_0x6c7fb4);const _0x5c4737='/models/1?'+_0x10908b['toString'](),_0xf02640=this['_sendApiRequest'](_0x5c4737,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0xf02640['request'])['json'](),'abortController':_0xf02640['abortController']};}['deleteFile'](_0x555d9d,_0x36325b){const _0x369b2e=this['_sendApiRequest']('/conversations/'+_0x555d9d+'/files/'+_0x36325b,'DELETE');return{'execute':async()=>{await _0x369b2e['request'];},'abortController':_0x369b2e['abortController']};}['deleteDocument'](_0x20e6bb,_0x3d7fbe){const _0x362c74=this['_sendApiRequest']('/conversations/'+_0x20e6bb+'/documents/'+_0x3d7fbe,'DELETE');return{'execute':async()=>{await _0x362c74['request'];},'abortController':_0x362c74['abortController']};}['deleteWebResource'](_0x469986,_0x1141dd){const _0x25fd13=this['_sendApiRequest']('/conversations/'+_0x469986+'/web-resources/'+_0x1141dd,'DELETE');return{'execute':async()=>{await _0x25fd13['request'];},'abortController':_0x25fd13['abortController']};}['cancelStream'](_0x23a31c,_0x57f491){const _0x3a2fa7=this['_sendApiRequest']('/conversations/'+_0x23a31c+'/messages/'+_0x57f491+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x3a2fa7['request'];},'abortController':_0x3a2fa7['abortController']};}['resumeStream'](_0x443e7b,_0x47e4e5,_0x3de96b='0-0'){const _0x5073b5=new URLSearchParams({'lastEventId':_0x3de96b}),_0xe6d991=this['_sendApiRequest']('/conversations/'+_0x443e7b+'/messages/'+_0x47e4e5+'/stream?'+_0x5073b5['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x5a2e71=await _0xe6d991['request'];return this['_getStreamReader'](_0x5a2e71['body']);},'abortController':_0xe6d991['abortController']};}['callSystemReview']({reviewName:_0x180a61,content:_0x6b8a26,args:_0x4e942a}){const _0x71380c=this['_sendApiRequest']('/reviews/system/'+_0x180a61+'/calls','POST',{'content':[{'type':'text','content':_0x6b8a26}],'args':_0x4e942a});return{'getStream':async()=>{const _0x12cc00=(await _0x71380c['request'])['body'];return this['_getStreamReader'](_0x12cc00);},'abortController':_0x71380c['abortController']};}['callCustomReview']({content:_0x39303d,prompt:_0x2db798,model:_0x5e9747}){const _0x246d8b=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x39303d}],'prompt':_0x2db798,'model':_0x5e9747});return{'getStream':async()=>{const _0x28ec0c=(await _0x246d8b['request'])['body'];return this['_getStreamReader'](_0x28ec0c);},'abortController':_0x246d8b['abortController']};}['upsertAIChatRating'](_0x2d26aa,_0x414c52,_0x23ffe9){const _0x9a86bc=this['_sendApiRequest']('/conversations/'+_0x2d26aa+'/messages/'+_0x414c52+'/ratings','PUT',{'positiveCount':_0x23ffe9['positiveCount'],'totalCount':_0x23ffe9['totalCount'],'modificationId':_0x23ffe9['modificationId']});return{'execute':async()=>{await _0x9a86bc['request'];},'abortController':_0x9a86bc['abortController']};}['upsertAIActionRating'](_0x582fa3,_0x65986c,_0x50dd7b){const _0x263ce9=this['_sendApiRequest']('/actions/system/'+_0x582fa3+'/calls/'+_0x65986c+'/ratings','PUT',{'positiveCount':_0x50dd7b['positiveCount'],'totalCount':_0x50dd7b['totalCount']});return{'execute':async()=>{await _0x263ce9['request'];},'abortController':_0x263ce9['abortController']};}['upsertCustomAIActionRating'](_0x3a71fd,_0x348f89){const _0x43fe77=this['_sendApiRequest']('/actions/custom/calls/'+_0x3a71fd+'/ratings','PUT',{'positiveCount':_0x348f89['positiveCount'],'totalCount':_0x348f89['totalCount']});return{'execute':async()=>{await _0x43fe77['request'];},'abortController':_0x43fe77['abortController']};}['upsertAIReviewRating'](_0x3ce99a,_0x2f1ad2,_0xe44d8c,_0x11d142){const _0x13021a=this['_sendApiRequest']('/reviews/system/'+_0x3ce99a+'/calls/'+_0x2f1ad2+'/ratings','PUT',{'positiveCount':_0xe44d8c['positiveCount'],'totalCount':_0xe44d8c['totalCount'],'dataId':_0x11d142});return{'execute':async()=>{await _0x13021a['request'];},'abortController':_0x13021a['abortController']};}['upsertCustomAIReviewRating'](_0x2010ff,_0x56f7e0,_0x14f7ee){const _0x2cd916=this['_sendApiRequest']('/reviews/custom/calls/'+_0x2010ff+'/ratings','PUT',{'positiveCount':_0x56f7e0['positiveCount'],'totalCount':_0x56f7e0['totalCount'],'dataId':_0x14f7ee});return{'execute':async()=>{await _0x2cd916['request'];},'abortController':_0x2cd916['abortController']};}['_sendApiRequest'](_0x397926,_0x1e5f0a,_0x54d253,_0x2144f3={}){const {useCache:_0x281e2d=!0x1,apiUrl:_0x55199c=this['_apiUrl']}=_0x2144f3,_0x559577=new AbortController(),_0x12dd5c=_0x281e2d?_0x1e5f0a+':'+_0x397926:null;if(_0x12dd5c){const _0x3be2b6=this['_responseCache']['get'](_0x12dd5c);if(_0x3be2b6)return{'request':_0x3be2b6['then'](_0x2aa797=>_0x2aa797['clone']()),'abortController':_0x559577};}const _0x28c7ff=_0x54d253 instanceof FormData,_0x2b0433={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x54d253&&!_0x28c7ff&&(_0x2b0433['Content-Type']='application/json');const _0x239018={'method':_0x1e5f0a,'headers':_0x2b0433,'signal':_0x559577['signal']};_0x54d253&&(_0x239018['body']=_0x28c7ff?_0x54d253:JSON['stringify'](_0x54d253));const _0x120825=fetch(''+_0x55199c+_0x397926,_0x239018)['catch'](_0x142ccf=>{_0x12dd5c&&this['_responseCache']['delete'](_0x12dd5c),this['_handleError'](_0x142ccf);})['then'](_0x25e38e=>_0x25e38e['ok']?_0x25e38e:_0x25e38e['json']()['then'](_0x46e71f=>{throw _0x12dd5c&&this['_responseCache']['delete'](_0x12dd5c),{'url':_0x55199c,'path':_0x397926,'method':_0x1e5f0a,'body':_0x54d253,'status':(_0x25e38e||{})['status'],'statusText':(_0x25e38e||{})['statusText'],'code':_0x46e71f['code'],'message':_0x46e71f['message'],'traceId':_0x46e71f['traceId']};}));return _0x12dd5c&&this['_responseCache']['set'](_0x12dd5c,_0x120825['then'](_0x162b30=>_0x162b30['clone']())),{'request':_0x120825,'abortController':_0x559577};}async*['_getStreamReader'](_0x4f2089){const _0x1617b0=[],_0x431ce6=_0x4f2089['getReader'](),_0xb704c2=_0x5bc300({'onError':_0x5e2150=>{this['_handleError'](_0x5e2150);},'onEvent':_0x52f5ec=>{_0x52f5ec['data']=JSON['parse'](_0x52f5ec['data']),_0x1617b0['push'](_0x52f5ec);}});try{let _0x4d8f96=!0x1;for(;!_0x4d8f96;){const {done:_0x10db6d,value:_0x2f72c9}=await _0x431ce6['read']();_0x10db6d&&(_0x4d8f96=!0x0),_0xb704c2['feed'](this['_decoder']['decode'](_0x2f72c9,{'stream':!0x0})),yield*_0x1617b0,_0x1617b0['length']=0x0;}}catch(_0x103874){this['_handleError'](_0x103874);}finally{_0x431ce6['releaseLock'](),_0xb704c2['reset']();}}['_handleError'](_0x3c24bd){if(_0x3c24bd instanceof ht)throw _0x3c24bd;if(_0x3c24bd instanceof Error&&'AbortError'===_0x3c24bd['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x3c24bd});throw new ht('ai-request-failed',this,{'originalError':_0x3c24bd});}}function Mi(_0x5d5d8b,_0x28b3e0,_0x3fe288){const t=_0x5d5d8b['t'];switch(_0x28b3e0){case'AI_SUGGESTION_HEADER_TITLE':return t({'id':'AI_SUGGESTION_HEADER_TITLE','string':'Proposed\x20changes'});case'AI_SUGGESTION_BUTTON_SHOW_CHANGES':return t({'id':'AI_SUGGESTION_BUTTON_SHOW_CHANGES','string':'Show\x20details'});case'AI_MINI_TOOLBAR_LIKE':return t({'id':'AI_MINI_TOOLBAR_LIKE','string':'I\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_DISLIKE':return t({'id':'AI_MINI_TOOLBAR_DISLIKE','string':'I\x20don\x27t\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_COPY':return t({'id':'AI_MINI_TOOLBAR_COPY','string':'Copy\x20to\x20clipboard'});case'AI_SUGGESTION_CONTENT_PART_TITLE':return t({'id':'AI_SUGGESTION_CONTENT_PART_TITLE','string':'Change\x20%0'},_0x3fe288);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x3fe288);case'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED':return t({'id':'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED','string':'Folders\x20cannot\x20be\x20added\x20to\x20the\x20chat.\x20Try\x20adding\x20individual\x20files\x20instead.'});case'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES','string':'Unable\x20to\x20load\x20resources\x20from\x20%0.\x20Please\x20try\x20again.'},_0x3fe288);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x3fe288);case'AI_CHAT_CONTEXT_INVALID_DATA':return t({'id':'AI_CHAT_CONTEXT_INVALID_DATA','string':'Invalid\x20context\x20data\x20type\x20for\x20the\x20selected\x20resource.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE','string':'Unsupported\x20resource\x20type.\x20Only\x20files\x20and\x20URLs\x20are\x20supported.'});case'AI_CHAT_CONTEXT_URL_EMPTY_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_EMPTY_ERROR','string':'URL\x20cannot\x20be\x20empty.'});case'AI_CHAT_CONTEXT_URL_INVALID_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_INVALID_ERROR','string':'Please\x20enter\x20a\x20valid\x20URL.'});case'AI_CHAT_INVALID_REQUEST':return t({'id':'AI_CHAT_INVALID_REQUEST','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE','string':'The\x20file\x20type\x20is\x20not\x20supported.\x20Please\x20upload\x20a\x20different\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_LARGE':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_LARGE','string':'The\x20file\x20is\x20too\x20large.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES','string':'The\x20file\x20has\x20too\x20many\x20pages.\x20Please\x20upload\x20a\x20file\x20with\x20fewer\x20pages.'});case'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED':return t({'id':'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED','string':'The\x20form\x20data\x20size\x20limits\x20are\x20exceeded.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR','string':'AI\x20is\x20preparing\x20a\x20response...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH','string':'AI\x20is\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REASONING','string':'AI\x20is\x20using\x20reasoning\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING','string':'AI\x20is\x20using\x20reasoning\x20and\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH','string':'Scanned\x20the\x20internet\x20for\x20insights'});case'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING','string':'AI\x20used\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING','string':'AI\x20used\x20search\x20and\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR','string':'Ask\x20AI\x20anything...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH','string':'Ask\x20AI\x20anything\x20(web\x20search\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING','string':'Ask\x20AI\x20anything\x20(reasoning\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING','string':'Ask\x20AI\x20anything\x20(web\x20search\x20and\x20reasoning\x20enabled)...'});case'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL','string':'Suggest\x20all'},_0x3fe288);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x3fe288);case'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL','string':'Apply\x20all'});case'AI_CHAT_SUGGESTION_ACTION_APPLY':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY','string':'Apply'});case'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP':return t({'id':'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP','string':'More\x20options'},_0x3fe288);case'AI_CHAT_MODEL_SELECTOR_GROUP':return t({'id':'AI_CHAT_MODEL_SELECTOR_GROUP','string':'Models'});case'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP','string':'Select\x20a\x20model'});case'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP','string':'Start\x20a\x20new\x20conversation\x20to\x20change\x20the\x20model'});case'AI_CHAT_CAPABILITIES_YES':return t({'id':'AI_CHAT_CAPABILITIES_YES','string':'Yes'});case'AI_CHAT_CAPABILITIES_NO':return t({'id':'AI_CHAT_CAPABILITIES_NO','string':'No'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT','string':'The\x20selected\x20model\x20is\x20no\x20longer\x20available,\x20so\x20you\x20cannot\x20continue\x20this\x20conversation.\x20Please\x20'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON','string':'start\x20a\x20new\x20one.'});case'AI_CHAT_CONTEXT_SOURCES_LABEL':return t({'id':'AI_CHAT_CONTEXT_SOURCES_LABEL','string':'Sources'});case'AI_CHAT_HISTORY_HEADING':return t({'id':'AI_CHAT_HISTORY_HEADING','string':'Chat\x20History'});case'AI_CHAT_HISTORY_SEARCH_LABEL':return t({'id':'AI_CHAT_HISTORY_SEARCH_LABEL','string':'Search\x20history'});case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY','string':'No\x20chats\x20were\x20found\x20matching\x20\x22%0\x22.'},_0x3fe288);case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY','string':'Please\x20try\x20a\x20different\x20phrase\x20or\x20check\x20the\x20spelling.'});case'AI_CHAT_HISTORY_EMPTY_MESSAGE':return t({'id':'AI_CHAT_HISTORY_EMPTY_MESSAGE','string':'Your\x20chat\x20history\x20for\x20current\x20document\x20will\x20appear\x20here.'});case'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON':return t({'id':'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON','string':'Go\x20to\x20chat'});case'AI_CHAT_HISTORY_PIN_BUTTON':return t({'id':'AI_CHAT_HISTORY_PIN_BUTTON','string':'Pin'});case'AI_CHAT_HISTORY_SHOW_MORE_ITEMS':return t({'id':'AI_CHAT_HISTORY_SHOW_MORE_ITEMS','string':'Show\x20more\x20items'});case'AI_CHAT_HISTORY_EDIT_NAME':return t({'id':'AI_CHAT_HISTORY_EDIT_NAME','string':'Edit\x20name'});case'AI_CHAT_HISTORY_REMOVE':return t({'id':'AI_CHAT_HISTORY_REMOVE','string':'Remove'});case'AI_CHAT_HISTORY_REMOVE_CONFIRM':return t({'id':'AI_CHAT_HISTORY_REMOVE_CONFIRM','string':'Do\x20you\x20want\x20to\x20remove\x20this\x20chat?'});case'AI_CHAT_HISTORY_ACCEPT':return t({'id':'AI_CHAT_HISTORY_ACCEPT','string':'Accept'});case'AI_CHAT_HISTORY_CANCEL':return t({'id':'AI_CHAT_HISTORY_CANCEL','string':'Cancel'});case'AI_CHAT_HISTORY_LOADING_REMOVING':return t({'id':'AI_CHAT_HISTORY_LOADING_REMOVING','string':'Removing\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_RENAMING':return t({'id':'AI_CHAT_HISTORY_LOADING_RENAMING','string':'Renaming\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_PINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_PINNING','string':'Pinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_UNPINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_UNPINNING','string':'Unpinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_CATEGORY_PINNED':return t({'id':'AI_CHAT_HISTORY_CATEGORY_PINNED','string':'Pinned'});case'AI_CHAT_HISTORY_CATEGORY_TODAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_TODAY','string':'Today'});case'AI_CHAT_HISTORY_CATEGORY_YESTERDAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_YESTERDAY','string':'Yesterday'});case'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS','string':'Last\x2014\x20days'});case'AI_CHAT_HISTORY_CATEGORY_LATER':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LATER','string':'Later'});case'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE','string':'Failed\x20to\x20change\x20the\x20\x22%0\x22\x20chat\x20name.\x20Please\x20try\x20again\x20later.'},_0x3fe288);case'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED','string':'Failed\x20to\x20%0\x20the\x20\x22%1\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x3fe288);case'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM':return t({'id':'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM','string':'Failed\x20to\x20delete\x20the\x20\x22%0\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x3fe288);case'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS':return t({'id':'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS','string':'Failed\x20to\x20load\x20the\x20chat\x20history.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_ERROR_GENERIC':return t({'id':'AI_CHAT_HISTORY_ERROR_GENERIC','string':'Something\x20went\x20wrong.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_PIN_ACTION':return t({'id':'AI_CHAT_HISTORY_PIN_ACTION','string':'pin'});case'AI_CHAT_HISTORY_UNPIN_ACTION':return t({'id':'AI_CHAT_HISTORY_UNPIN_ACTION','string':'unpin'});case'AI_BALLOON_HEADER_TITLE':return t({'id':'AI_BALLOON_HEADER_TITLE','string':'Change\x20%0'},_0x3fe288);case'AI_BALLOON_APPLY_BUTTON':return t({'id':'AI_BALLOON_APPLY_BUTTON','string':'Apply'});case'AI_BALLOON_SUGGEST_BUTTON':return t({'id':'AI_BALLOON_SUGGEST_BUTTON','string':'Suggest'});case'AI_BALLOON_NEXT_LABEL':return t({'id':'AI_BALLOON_NEXT_LABEL','string':'Next'});case'AI_BALLOON_PREVIOUS_LABEL':return t({'id':'AI_BALLOON_PREVIOUS_LABEL','string':'Previous'});case'AI_SUGGESTION_NO_PARTS_WARNING':return t({'id':'AI_SUGGESTION_NO_PARTS_WARNING','string':'This\x20change\x20is\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_SUGGESTION_EMPTY_PART_WARNING':return t({'id':'AI_SUGGESTION_EMPTY_PART_WARNING','string':'Some\x20of\x20the\x20changes\x20are\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_ACTIONS_TRY_AGAIN':return t({'id':'AI_ACTIONS_TRY_AGAIN','string':'Retry'});case'AI_ACTIONS_PREVIOUS_INTERACTION':return t({'id':'AI_ACTIONS_PREVIOUS_INTERACTION','string':'Previous'});case'AI_ACTIONS_NEXT_INTERACTION':return t({'id':'AI_ACTIONS_NEXT_INTERACTION','string':'Next'});case'AI_MODEL_NAME_AUTO':return t({'id':'AI_MODEL_NAME_AUTO','string':'Auto'});case'AI_QUICK_ACTIONS_HEADING':return t({'id':'AI_QUICK_ACTIONS_HEADING','string':'AI\x20Quick\x20Actions'});case'AI_QUICK_ACTIONS_SEARCH':return t({'id':'AI_QUICK_ACTIONS_SEARCH','string':'Search\x20AI\x20commands'});case'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND','string':'No\x20AI\x20commands\x20found'});case'AI_QUICK_ACTIONS_ASK_AI':return t({'id':'AI_QUICK_ACTIONS_ASK_AI','string':'Ask\x20AI'});case'AI_QUICK_ACTIONS_CHAT_COMMANDS':return t({'id':'AI_QUICK_ACTIONS_CHAT_COMMANDS','string':'Chat\x20commands'});case'AI_QUICK_ACTIONS_IMPROVE_WRITING':return t({'id':'AI_QUICK_ACTIONS_IMPROVE_WRITING','string':'Improve\x20writing'});case'AI_QUICK_ACTIONS_CONTINUE_WRITING':return t({'id':'AI_QUICK_ACTIONS_CONTINUE_WRITING','string':'Continue\x20writing'});case'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING':return t({'id':'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING','string':'Fix\x20grammar\x20&\x20spelling'});case'AI_QUICK_ACTIONS_ADJUST_LENGTH':return t({'id':'AI_QUICK_ACTIONS_ADJUST_LENGTH','string':'Adjust\x20length'});case'AI_QUICK_ACTIONS_CHANGE_TONE':return t({'id':'AI_QUICK_ACTIONS_CHANGE_TONE','string':'Change\x20tone'});case'AI_QUICK_ACTIONS_TRANSLATE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE','string':'Translate'});case'AI_QUICK_ACTIONS_EXPLAIN':return t({'id':'AI_QUICK_ACTIONS_EXPLAIN','string':'Explain'});case'AI_QUICK_ACTIONS_SUMMARIZE':return t({'id':'AI_QUICK_ACTIONS_SUMMARIZE','string':'Summarize'});case'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS':return t({'id':'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS','string':'Highlight\x20key\x20points'});case'AI_QUICK_ACTIONS_MAKE_SHORTER':return t({'id':'AI_QUICK_ACTIONS_MAKE_SHORTER','string':'Make\x20shorter'});case'AI_QUICK_ACTIONS_MAKE_LONGER':return t({'id':'AI_QUICK_ACTIONS_MAKE_LONGER','string':'Make\x20longer'});case'AI_QUICK_ACTIONS_MORE_CASUAL':return t({'id':'AI_QUICK_ACTIONS_MORE_CASUAL','string':'More\x20casual'});case'AI_QUICK_ACTIONS_MORE_DIRECT':return t({'id':'AI_QUICK_ACTIONS_MORE_DIRECT','string':'More\x20direct'});case'AI_QUICK_ACTIONS_MORE_FRIENDLY':return t({'id':'AI_QUICK_ACTIONS_MORE_FRIENDLY','string':'More\x20friendly'});case'AI_QUICK_ACTIONS_MORE_CONFIDENT':return t({'id':'AI_QUICK_ACTIONS_MORE_CONFIDENT','string':'More\x20confident'});case'AI_QUICK_ACTIONS_MORE_PROFESSIONAL':return t({'id':'AI_QUICK_ACTIONS_MORE_PROFESSIONAL','string':'More\x20professional'});case'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT':return t({'id':'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT','string':'Adjust\x20based\x20on\x20the\x20rest\x20of\x20the\x20document'});case'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH','string':'English'});case'AI_QUICK_ACTIONS_TRANSLATE_CHINESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_QUICK_ACTIONS_TRANSLATE_FRENCH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_FRENCH','string':'French'});case'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE','string':'Japanese'});case'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE','string':'Portuguese'});case'AI_QUICK_ACTIONS_TRANSLATE_KOREAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_KOREAN','string':'Korean'});case'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN','string':'Italian'});case'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN','string':'Russian'});case'AI_QUICK_ACTIONS_TRANSLATE_SPANISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_SPANISH','string':'Spanish'});case'AI_QUICK_ACTIONS_TRANSLATE_GERMAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_GERMAN','string':'German'});case'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','string':'%0\x20plugin\x20is\x20required\x20but\x20not\x20found.'},_0x3fe288);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x28b3e0;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x59f833,_0x3edbe1){const _0x1f5fd7=new yt(_0x59f833),_0x44be63=Mi(_0x59f833,'AI_TABS_LABEL_MINIMIZE'),_0x28d1b2=Mi(_0x59f833,'AI_TABS_LABEL_MAXIMIZE');return _0x1f5fd7['set']({'withText':!0x1,'icon':_0x5b4120,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x1f5fd7['bind']('label')['to'](_0x3edbe1,'isMaximized',_0x2f1337=>_0x2f1337?_0x44be63:_0x28d1b2),_0x1f5fd7['bind']('icon')['to'](_0x3edbe1,'isMaximized',_0x45bd69=>_0x45bd69?_0x5f47b8:_0x5b4120),_0x1f5fd7['bind']('isOn')['to'](_0x3edbe1,'isMaximized'),_0x1f5fd7['on']('execute',()=>{_0x3edbe1['fire']('resizeTabs');}),_0x1f5fd7;}function Wi(_0x2b607a,_0x13e362){return _0x41e112(_0x2b607a,_0x13e362);}function Ki(_0x3bfb75,_0xb7fb40){return _0xb56587(_0x3bfb75,_0xb7fb40);}function Yi(_0x42efb3,_0x3fabcd,_0x43a360){const _0x4793e1=null!==_0x3fabcd?_0x416b98=>_0x416b98['attribs'][_0x42efb3]===_0x3fabcd:_0x43473e=>Boolean(_0x43473e['attribs'][_0x42efb3]);return _0x47014d(_0x342350=>_0x25fe0f(_0x342350)&&_0x4793e1(_0x342350),_0x43a360);}function $i(_0x51b6fe,_0x3dedf1,_0x1220da){const _0x2b94c6=null!==_0x3dedf1?_0x23c570=>_0x23c570['attribs'][_0x51b6fe]===_0x3dedf1:_0x453ebe=>Boolean(_0x453ebe['attribs'][_0x51b6fe]);return _0x61ba86(_0x4b1405=>_0x25fe0f(_0x4b1405)&&_0x2b94c6(_0x4b1405),_0x1220da);}function qi(_0x407a13){return _0x61ba86(_0x1f8620=>_0x25fe0f(_0x1f8620)&&function(_0x53d28b){const _0xe81d84=_0x53d28b['toLowerCase']();return'script'===_0xe81d84||'style'===_0xe81d84||_0xe81d84['includes']('-');}(_0x1f8620['name']),_0x407a13);}function Qi(_0x17d4bc){return _0x42a687(_0xb1681a=>_0x3b312e(_0xb1681a),_0x17d4bc,!0x0,0x1/0x0);}function Xi(_0x14dced,_0x1dd633){return _0x14dced&&_0x25fe0f(_0x14dced)?_0x14dced['attribs'][_0x1dd633]:null;}function zi(_0x28abb8,_0x11700d,_0x480b74){_0x25fe0f(_0x28abb8)&&(null===_0x480b74?delete _0x28abb8['attribs'][_0x11700d]:_0x28abb8['attribs'][_0x11700d]=_0x480b74);}function ji(_0x861cf8,_0x19497c,_0x208e4c){const _0x2bac84=_0x19497c['cloneNode'](!0x0);'beforebegin'===_0x208e4c?_0x30dc49(_0x861cf8,_0x2bac84):'afterbegin'===_0x208e4c?_0x102c31(_0x861cf8,_0x2bac84):'beforeend'===_0x208e4c?_0x51cc9e(_0x861cf8,_0x2bac84):'afterend'===_0x208e4c&&_0x249093(_0x861cf8,_0x2bac84);}function Ji(_0x346455){const _0xa1a008=[];let _0x18eb38=_0x346455;for(;_0x18eb38;)_0x18eb38=_0x5a6b8c(_0x18eb38),_0x18eb38&&_0xa1a008['push'](_0x18eb38);return _0xa1a008;}function Zi(_0xa95844){return _0xa95844['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x505f79){let _0x6941ee=0x0;for(;_0x505f79['parentNode'];)_0x505f79=_0x505f79['parentNode'],_0x6941ee++;return _0x6941ee;}function es(_0x23be1a){const _0x16a73d=[];let _0x5b12c2=_0x23be1a['nextSibling'];for(;_0x5b12c2;)_0x16a73d['push'](_0x5b12c2),_0x5b12c2=_0x5b12c2['nextSibling'];_0x16a73d['forEach'](_0x555908=>{_0x1221fe(_0x555908);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
|
|
25
|
-
ct(){['_m2html'];constructor(){super();const
|
|
26
|
-
ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x467557){super(),this['_generateUid']=_0x467557||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x3a7fb8,_0x211a6f,_0x295f04){this['_uidCounter']=0x0;const _0x1ccb95=_0x3a7fb8['cloneNode'](!0x0);rs(_0x211a6f,_0x1ccb95);const _0x570a8f=_0x1ccb95['childNodes'],_0x3bfc64=Array['from'](_0x570a8f)['filter'](_0x4b4f0a=>!(0x3===_0x4b4f0a['nodeType']&&''===Ki(_0x4b4f0a)['trim']())),_0x19e239=_0x3bfc64['length'];for(const _0x36d211 of _0x3bfc64)_0x36d211&&_0x25fe0f(_0x36d211)&&void 0x0===_0x36d211['attribs']['data-id']&&zi(_0x36d211,'data-id','new-element');if(0x0===_0x211a6f['childNodes']['length']){const _0x331f48=[];return $i('data-id','new-element',_0x1ccb95)['forEach'](_0x25400c=>{const _0x37d143=this['_generateUid']();zi(_0x25400c,'data-id',_0x37d143),_0x331f48['push'](_0x37d143);}),this['_removeSpecialComments'](_0x1ccb95),{'parsedContent':_0x1ccb95,'newNodeIds':_0x331f48,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set(),this['_existingDataIds']=new Set($i('data-id',null,_0x211a6f)['map'](_0x28f22=>Xi(_0x28f22,'data-id'))['filter'](_0x3e66fb=>!!_0x3e66fb));let _0x3b6175=-0x1,_0x3f78ec=!0x1;for(let _0x241eee=0x0;_0x241eee<_0x19e239;_0x241eee++){const _0x5dfaa0=_0x3bfc64[_0x241eee],_0x1b3542=_0x3bfc64[_0x241eee+0x1];if(this['_isNewNode'](_0x5dfaa0)){if(-0x1===_0x3b6175&&(_0x3b6175=_0x241eee),this['_markWrappedElements'](_0x5dfaa0),!this['_isNewNode'](_0x1b3542)){const [_0x3826eb,_0x4ec3d5]=this['_findReferenceNode'](_0x5dfaa0,_0x3f78ec,_0x211a6f);if(_0x3826eb){const _0x488283=Array['from'](_0x3bfc64)['slice'](_0x3b6175,_0x241eee+0x1);this['_insertNodes'](_0x3826eb,_0x488283,_0x4ec3d5),_0x3b6175=-0x1;}}}else{if(this['_isExistingContentComment'](_0x5dfaa0))_0x3f78ec=!0x0;else{if(this['_isExistingNode'](_0x5dfaa0)){const _0x4fe362=Xi(_0x5dfaa0,'data-id');if(_0x4fe362&&this['_existingDataIds']['has'](_0x4fe362)){this['_referencedExistingIds']['add'](_0x4fe362);const _0x3d7bba=Yi('data-id',_0x4fe362,_0x211a6f);this['_replaceNode'](_0x3d7bba,_0x5dfaa0);}}else{if(ss(_0x5dfaa0)){const _0x397330=ns(_0x5dfaa0);!!Yi('data-id',_0x397330,_0x1ccb95)||this['_touchedNodesState']['removedIds']['push'](_0x397330);}}}}}for(const _0x48612f of this['_touchedNodesState']['removedIds']){const _0x5cbc77=Yi('data-id',_0x48612f,_0x211a6f);_0x5cbc77&&(this['_rescueUnwrappedElements'](_0x5cbc77),this['_removeNode'](_0x5cbc77,_0x48612f,_0x295f04));}if($i('data-id','new-element',_0x211a6f)['forEach'](_0x535648=>{const _0x510291=this['_getUid'](_0x535648);zi(_0x535648,'data-id',_0x510291),this['_touchedNodesState']['newIds']['push'](_0x510291);}),this['_removeSpecialComments'](_0x211a6f),_0x295f04&&_0x295f04['cutAfterUnstable']){const _0x191d79=this['_findLastConfirmationPoint'](_0x3bfc64),_0x3bdbdf=this['_getLastStableElement'](_0x211a6f,_0x191d79);this['_markUnstableElements'](_0x211a6f,_0x3bdbdf);}if(this['_processWrappedElements'](_0x211a6f,_0x295f04),_0x295f04&&_0x295f04['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0xac7d73=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x211a6f);let _0x51697a=_0xac7d73[_0xac7d73['length']-0x1];for(;_0x51697a;)es(_0x51697a),_0x51697a=_0x51697a['parentNode'];}return{'parsedContent':_0x211a6f,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x1e9e5b,_0x4ea0db,_0x5971e5){for(const _0x5236ef of _0x4ea0db){const _0x5d88b3=this['_getUid'](_0x5236ef);zi(_0x5236ef,'data-id',_0x5d88b3),this['_touchedNodesState']['newIds']['push'](_0x5d88b3),this['_touchedNodesState']['lastTouchedId']=_0x5d88b3;}const _0x35be63='afterbegin'===_0x5971e5||'afterend'===_0x5971e5?_0x4ea0db['reverse']():_0x4ea0db;for(const _0x3df3aa of _0x35be63)ji(_0x1e9e5b,_0x3df3aa,_0x5971e5);}['_replaceNode'](_0x326af4,_0x3b71ef){if(!_0x326af4)return;if(_0x16c5a4=_0x3b71ef,Zi(Ki(_0x326af4))===Zi(Ki(_0x16c5a4)))return;var _0x16c5a4;const _0x29256a=Xi(_0x326af4,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x29256a),this['_touchedNodesState']['lastTouchedId']=_0x29256a,_0x2f4258(_0x326af4,_0x3b71ef['cloneNode'](!0x0));}['_removeNode'](_0x2687b1,_0x44b97f,_0x26fefb){if(_0x26fefb&&_0x26fefb['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x44b97f;const _0x18ff39=_0x26fefb['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x18ff39,'data-id',_0x44b97f),zi(_0x18ff39,'data-removed','true'),_0x2f4258(_0x2687b1,_0x18ff39);}else _0x1221fe(_0x2687b1);}['_findReferenceNode'](_0x2fbe37,_0x4e45cc,_0x36abac){const _0x27ba2b=this['_findPrevElementWithDataId'](_0x2fbe37,!0x1);if(_0x27ba2b){const _0x18a9f0=ns(_0x27ba2b),_0x534923=Yi('data-id',_0x18a9f0,_0x36abac);if(_0x534923)return[_0x534923,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x18a9f0);}const _0x1b16af=this['_findNextElementWithDataId'](_0x2fbe37,!0x1);if(_0x1b16af){const _0x1abbb1=ns(_0x1b16af),_0x18c432=Yi('data-id',_0x1abbb1,_0x36abac);if(_0x18c432)return[_0x18c432,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1abbb1);}return _0x4e45cc?_0x2fbe37['nextSibling']?this['_findFallbackReferenceNode'](_0x2fbe37,_0x36abac):[_0x36abac['childNodes'][_0x36abac['childNodes']['length']-0x1],'afterend']:[_0x36abac['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x53a7d6,_0x357fe5){const _0x5f28e6=[],_0x4b35bc=this['_findPrevElementWithDataId'](_0x53a7d6,!0x0);if(_0x4b35bc){const _0x57bf31=Yi('data-id',ns(_0x4b35bc),_0x357fe5);_0x57bf31&&_0x5f28e6['push']([_0x57bf31,'afterend']);}const _0x2debe8=this['_findNextElementWithDataId'](_0x53a7d6,!0x0);if(_0x2debe8){const _0x15c82c=Yi('data-id',ns(_0x2debe8),_0x357fe5);_0x15c82c&&_0x5f28e6['push']([_0x15c82c,'beforebegin']);}if(_0x5f28e6['length']>0x1)return ts(_0x5f28e6[0x0][0x0])<=ts(_0x5f28e6[0x1][0x0])?_0x5f28e6[0x0]:_0x5f28e6[0x1];return 0x1===_0x5f28e6['length']?_0x5f28e6[0x0]:[_0x357fe5['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x41aede,_0x1c7305){let _0x1c0ed5=_0x41aede['nextSibling'],_0x429311=null,_0xcf14a1=!0x1;for(;_0x1c0ed5;){if(_0x3b312e(_0x1c0ed5)){if(ss(_0x1c0ed5)&&(_0x429311=_0x1c0ed5),this['_isExistingContentComment'](_0x1c0ed5)&&_0x1c7305&&!_0xcf14a1){_0xcf14a1=!0x0,_0x1c0ed5=_0x1c0ed5['nextSibling'];continue;}break;}const _0x4413bb=Xi(_0x1c0ed5,'data-id');if(_0x4413bb&&'new-element'!==_0x4413bb&&this['_existingDataIds']['has'](_0x4413bb)){_0x429311=_0x1c0ed5;break;}_0x1c0ed5=_0x1c0ed5['nextSibling'];}return _0x429311;}['_findPrevElementWithDataId'](_0x16fce6,_0x2a2b0f){let _0x4babe2=_0x16fce6['previousSibling'],_0x452592=null,_0x4ceb21=!0x1;for(;_0x4babe2;){if(_0x3b312e(_0x4babe2)){if(ss(_0x4babe2)&&(_0x452592=_0x4babe2),this['_isExistingContentComment'](_0x4babe2)&&_0x2a2b0f&&!_0x4ceb21){_0x4ceb21=!0x0,_0x4babe2=_0x4babe2['previousSibling'];continue;}break;}const _0xf233ca=Xi(_0x4babe2,'data-id');if(_0xf233ca&&'new-element'!==_0xf233ca&&this['_existingDataIds']['has'](_0xf233ca)){_0x452592=_0x4babe2;break;}_0x4babe2=_0x4babe2['previousSibling'];}return _0x452592;}['_markWrappedElements'](_0x18b805){_0x25fe0f(_0x18b805)&&$i('data-id',null,_0x18b805)['forEach'](_0x156aaa=>{this['_isExistingNode'](_0x156aaa)&&(zi(_0x156aaa,'data-wrapped-id',Xi(_0x156aaa,'data-id')),zi(_0x156aaa,'data-id',null));});}['_processWrappedElements'](_0x5e9722,_0x3dcf9c){$i('data-wrapped-id',null,_0x5e9722)['forEach'](_0x471419=>{const _0x29a200=Xi(_0x471419,'data-wrapped-id');if(this['_hasUnstableParent'](_0x471419))return;const _0x5cae23=Yi('data-id',_0x29a200,_0x5e9722);zi(_0x471419,'data-id',_0x29a200),_0x5cae23&&(this['_removeNode'](_0x5cae23,_0x29a200,_0x3dcf9c),this['_touchedNodesState']['removedIds']['push'](_0x29a200),this['_touchedNodesState']['lastTouchedId']=_0x29a200);});}['_hasUnstableParent'](_0xf45e28){let _0xbaef21=_0xf45e28['parentNode'];for(;_0xbaef21;){if(Xi(_0xbaef21,'data-unstable'))return!0x0;_0xbaef21=_0xbaef21['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x1925e1){const _0x55ee19=new Set(this['_touchedNodesState']['removedIds']),_0x5f890f=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x1925e1)['forEach'](_0x45e921=>{const _0x149440=Xi(_0x45e921,'data-id'),_0xa0ceaf=!!_0x149440&&this['_referencedExistingIds']['has'](_0x149440),_0x5b541a=!!_0x149440&&_0x5f890f['has'](_0x149440);if(!_0x149440||!_0xa0ceaf&&!_0x5b541a)return;if(_0x55ee19['has'](_0x149440))return;let _0x3a4a4c=_0x45e921['parentNode'],_0x16e80c=!0x1;for(;_0x3a4a4c;){if(_0x3a4a4c===_0x1925e1){_0x16e80c=!0x0;break;}const _0x3cc46d=Xi(_0x3a4a4c,'data-id');if(_0x3cc46d&&(this['_referencedExistingIds']['has'](_0x3cc46d)||_0x5f890f['has'](_0x3cc46d)))return;_0x3a4a4c=_0x3a4a4c['parentNode'];}if(_0x16e80c){if(_0x30dc49(_0x1925e1,_0x45e921),_0xa0ceaf){const _0x2c6f32=this['_generateUid'](),_0x2f01a7=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x149440);-0x1!==_0x2f01a7&&this['_touchedNodesState']['modifiedIds']['splice'](_0x2f01a7,0x1),zi(_0x45e921,'data-unwrapped-id',_0x149440),zi(_0x45e921,'data-id',_0x2c6f32),this['_touchedNodesState']['newIds']['push'](_0x2c6f32),this['_touchedNodesState']['rescuedNewIds']['add'](_0x2c6f32),this['_touchedNodesState']['lastTouchedId']=_0x2c6f32;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x149440),this['_touchedNodesState']['lastTouchedId']=_0x149440;}});}['_getUid'](_0x27cefd){return this['_isExistingNode'](_0x27cefd)?Xi(_0x27cefd,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x138ea2){Qi(_0x138ea2)['filter'](_0x4a8c5f=>ss(_0x4a8c5f)||this['_isExistingContentComment'](_0x4a8c5f))['forEach'](_0x25324e=>{_0x1221fe(_0x25324e);});}['_findLastConfirmationPoint'](_0x1f3b8b){let _0x5c8e2e=null,_0x5182fb=null,_0x315921=null,_0x29b0ba=null;const _0x5cf49b=_0x373675=>{_0x373675&&(_0x5c8e2e=_0x373675),_0x315921=null,_0x29b0ba=null;};for(let _0xda8bf8=0x0;_0xda8bf8<_0x1f3b8b['length'];_0xda8bf8++){const _0x273f16=_0x1f3b8b[_0xda8bf8];if(this['_isExistingContentComment'](_0x273f16)){_0x5cf49b(_0x5182fb);continue;}if(_0x25fe0f(_0x273f16)){const _0x2eca7f=Xi(_0x273f16,'data-id'),_0x2593c4=_0xda8bf8===_0x1f3b8b['length']-0x1;if(_0x2eca7f&&'new-element'!==_0x2eca7f&&this['_touchedNodesState']['modifiedIds']['includes'](_0x2eca7f)&&!_0x2593c4){_0x5cf49b(_0x2eca7f),_0x5182fb=_0x2eca7f;continue;}}let _0xc377bb=null;const _0x17d4e9=ns(_0x273f16);if(_0x17d4e9&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x17d4e9))_0x5182fb=_0x17d4e9;else{if(_0x17d4e9&&this['_touchedNodesState']['newIds']['includes'](_0x17d4e9))_0xc377bb='N';else{if(!ss(_0x273f16))continue;_0xc377bb='R';}_0xc377bb===_0x29b0ba||null===_0x29b0ba?_0x29b0ba=_0xc377bb:null!==_0x315921?(_0x5cf49b(_0x5182fb),_0x29b0ba=_0xc377bb):(_0x315921=_0x29b0ba,_0x29b0ba=_0xc377bb),_0x5182fb=_0x17d4e9;}}const _0x2ee464=_0x1f3b8b[_0x1f3b8b['length']-0x1];return _0x2ee464&&!_0x25fe0f(_0x2ee464)&&!ss(_0x2ee464)&&_0x5182fb&&_0x5cf49b(_0x5182fb),_0x5c8e2e;}['_getLastStableElement'](_0x972f3a,_0x372d91){if(!_0x372d91)return null;const _0x59d4c6=Yi('data-id',_0x372d91,_0x972f3a);if(!_0x59d4c6)return null;const _0x1e257c=[_0x59d4c6,...Ji(_0x59d4c6)]['at'](-0x2);if(_0x1e257c===_0x59d4c6)return _0x59d4c6;let _0x37d449=_0x1e257c['previousSibling'];for(;_0x37d449&&!_0x25fe0f(_0x37d449);)_0x37d449=_0x37d449['previousSibling'];return _0x37d449;}['_markUnstableElements'](_0x26c67f,_0x1760f2){const _0x116f2f=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5db1c9=_0x1760f2?_0x1760f2['nextSibling']:_0x26c67f['firstChild'];for(;_0x5db1c9;){_0x25fe0f(_0x5db1c9)&&((_0x116f2f['has'](Xi(_0x5db1c9,'data-id'))||$i('data-id',null,_0x5db1c9)['some'](_0x44ce4f=>_0x116f2f['has'](Xi(_0x44ce4f,'data-id'))))&&zi(_0x5db1c9,'data-unstable','true')),_0x5db1c9=_0x5db1c9['nextSibling'];}}['_isNewNode'](_0x5386b0){return Boolean('new-element'===Xi(_0x5386b0,'data-id'));}['_isExistingNode'](_0x26e033){return Boolean((Xi(_0x26e033,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0x26e033,'data-id'));}['_isExistingContentComment'](_0x1611a3){return Boolean(_0x3b312e(_0x1611a3)&&Ki(_0x1611a3)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function ss(_0x39a2bc){return!!_0x39a2bc&&Boolean(_0x3b312e(_0x39a2bc)&&Ki(_0x39a2bc)['match'](/removed[\s*-]data-id="[^"]+"/));}function ns(_0x3a44b1){if(!_0x3a44b1)return null;if(_0x25fe0f(_0x3a44b1))return Xi(_0x3a44b1,'data-id')??null;if(_0x3b312e(_0x3a44b1)){const _0x327100=Ki(_0x3a44b1)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x327100&&_0x327100[0x1])return _0x327100[0x1];}return null;}function rs(_0x18c797,_0x268a8e){const _0x59fa81=new Map();for(const _0x39911f of qi(_0x18c797))_0x59fa81['set'](Xi(_0x39911f,'data-id'),_0x39911f);const _0x3cb451=new Set();for(const _0x2b32b9 of qi(_0x268a8e)){const _0x3a550a=Xi(_0x2b32b9,'data-id'),_0x195cc9=_0x3a550a?_0x59fa81['get'](_0x3a550a):void 0x0;_0x195cc9?(_0x2f4258(_0x2b32b9,_0x4382fa(_0x195cc9,!0x0)),_0x3cb451['add'](_0x3a550a)):_0x1221fe(_0x2b32b9);}for(const _0x3fbe4d of Qi(_0x268a8e))ss(_0x3fbe4d)&&_0x59fa81['has'](ns(_0x3fbe4d))&&_0x1221fe(_0x3fbe4d);const _0x40e7c8=new Set($i('data-id',null,_0x268a8e)['map'](_0xe77d9e=>Xi(_0xe77d9e,'data-id')));for(const [_0x5a93f6,_0x5197ee]of _0x59fa81){if(_0x3cb451['has'](_0x5a93f6))continue;let _0xdcf6f7=_0x5197ee['parent'],_0x496a06=null;for(;_0xdcf6f7&&_0x25fe0f(_0xdcf6f7);){const _0x1e1bda=Xi(_0xdcf6f7,'data-id');if(_0x1e1bda&&_0x40e7c8['has'](_0x1e1bda)){_0x496a06=_0x1e1bda;break;}_0xdcf6f7=_0xdcf6f7['parent'];}if(!_0x496a06)continue;const _0xef8d83=Yi('data-id',_0x496a06,_0x268a8e);_0xef8d83&&_0x51cc9e(_0xef8d83,_0x4382fa(_0x5197ee,!0x0));}}function os({changeGroups:_0x1c5b0f,documentContextContent:_0x78decc,showDiff:_0xe8e46,trimUnchanged:_0x391b6a=!0x0}){return _0x1c5b0f['map'](_0x248af7=>{if('destroyed'===_0x248af7['editor']['state'])return null;const _0x324c93=new _0x1d2d6f([]),_0x548d0e=new _0x1d2d6f([]),_0x1a68ae=new Set();for(const _0x19f259 of _0x248af7['changes'])'new'==_0x19f259['type']&&$i('data-id',null,_0x19f259['node'])['forEach'](_0x1aec50=>{_0x1a68ae['add'](Xi(_0x1aec50,'data-id'));});for(const _0x59bb68 of _0x248af7['changes'])if('removed'!=_0x59bb68['type']?_0x548d0e['children']['push'](_0x59bb68['node']['cloneNode'](!0x0)):_0xe8e46||_0x1a68ae['has'](_0x59bb68['id'])||_0x548d0e['children']['push'](_0x59bb68['node']['cloneNode'](!0x0)),'new'!=_0x59bb68['type']&&(_0xe8e46||'removed'!=_0x59bb68['type'])){const _0xebf32a=_0x47014d(_0x2a3ae3=>Xi(_0x2a3ae3,'data-id')==_0x59bb68['id'],_0x78decc['get'](_0x248af7['documentId']),!0x0);_0xebf32a&&_0x324c93['children']['push'](_0xebf32a['cloneNode'](!0x0));}const {content:_0x28a04e,hasChanges:_0x12d30}=as(_0x248af7['editor'],_0x324c93,_0x548d0e,_0xe8e46,_0x391b6a);return{'type':_0x248af7['changes'][0x0]['type'],'index':_0x248af7['index'],'content':_0x28a04e,'hasChanges':_0x12d30};})['filter'](_0x2471eb=>null!==_0x2471eb);}function as(_0x59b1ed,_0x382ef8,_0x25739a,_0x5ee723,_0x3359b5=!0x0){const _0x25fb1b=_0x59b1ed['plugins']['get']('DocumentCompare'),_0x3db6a7=Ki(_0x382ef8),_0x196578=Ki(_0x25739a),_0x1c32ff=_0x59b1ed['data']['parse'](_0x3db6a7,'$root'),_0x50b021=_0x59b1ed['model']['createPositionAt'](_0x1c32ff,0x0),_0x2ae280=_0x25fb1b['getDiff'](_0x3db6a7,_0x196578,{'anchor':_0x50b021,'markDeletions':_0x5ee723,'targetEditor':_0x59b1ed})['getOperations']();if(0x0==_0x2ae280['length'])return{'content':_0x382ef8['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x5ee723?function(_0x6c0a1f,_0x379c6e,_0xdf2b28){if(0x0==_0x6c0a1f['length'])return;const _0x4bd957=_0xdf2b28['plugins']['get']('DocumentCompare'),_0x3952ae=_0xdf2b28['plugins']['get']('SuggestionsConversion');_0xdf2b28['model']['change'](_0x3b8467=>{const _0x7efeab=new Set();for(let _0x3f3ad8=0x0;_0x3f3ad8<_0x6c0a1f['length'];_0x3f3ad8++){const _0x5b1b54=_0x6c0a1f[_0x3f3ad8];if(_0x5b1b54['baseVersion']=null,_0x5b1b54['isDocumentOperation']=!0x1,_0x4bd957['isMarkedRemoveOperation'](_0x5b1b54)){const _0x58f27c=_0x455e7a(_0x5b1b54['newRange'],_0xdf2b28['model']),_0x400098='suggestion:deletion:'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x400098,_0x58f27c);}else switch(_0x5b1b54['type']){case'rename':{if(_0x5b1b54['oldName']==_0x5b1b54['newName'])break;_0x3b8467['batch']['addOperation'](_0x5b1b54),_0xdf2b28['model']['applyOperation'](_0x5b1b54);const _0x46a894='$elementName',_0x203134=_0x5b1b54['position'],_0x103d9b=_0xdf2b28['model']['createRange'](_0x203134,_0xdf2b28['model']['createPositionAt'](_0x203134['nodeAfter'],'end')),_0x4fdf90='suggestion:attribute:'+_0x46a894+':'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x4fdf90,_0x103d9b);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x5b1b54['oldValue']==_0x5b1b54['newValue'])break;_0x3b8467['batch']['addOperation'](_0x5b1b54),_0xdf2b28['model']['applyOperation'](_0x5b1b54);const _0x547274=_0x5b1b54['key'];if(!_0x3952ae['isRegisteredAttribute'](_0x547274))break;const _0x37253c=_0x455e7a(_0x5b1b54['range'],_0xdf2b28['model']),_0x32a85e='suggestion:attribute:'+_0x547274+':'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x32a85e,_0x37253c);break;}case'insert':{_0x3b8467['batch']['addOperation'](_0x5b1b54),_0xdf2b28['model']['applyOperation'](_0x5b1b54);if(_0x6c0a1f[_0x3f3ad8+0x1]&&'move'==_0x6c0a1f[_0x3f3ad8+0x1]['type']){hs(_0x379c6e,_0x5b1b54);break;}const _0x4395af=_0x5b1b54['position'],_0x26a7f9=_0x5b1b54['howMany'],_0x2f82ac=_0x455e7a(_0xdf2b28['model']['createRange'](_0x4395af,_0x4395af['getShiftedBy'](_0x26a7f9)),_0xdf2b28['model']),_0x4dd7d1='suggestion:insertion:'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x4dd7d1,_0x2f82ac);break;}case'split':{_0x3b8467['batch']['addOperation'](_0x5b1b54),_0xdf2b28['model']['applyOperation'](_0x5b1b54);const _0x12decb=_0x5b1b54['splitPosition'],_0x25209c=_0x5b1b54['moveTargetPosition'],_0x4e5023=_0xdf2b28['model']['createRange'](_0x12decb,_0x25209c),_0x40e068='suggestion:insertion:'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x40e068,_0x4e5023);break;}case'move':{_0x3b8467['batch']['addOperation'](_0x5b1b54),_0xdf2b28['model']['applyOperation'](_0x5b1b54),_0x6c0a1f[_0x3f3ad8-0x1]&&'insert'==_0x6c0a1f[_0x3f3ad8-0x1]['type']&&hs(_0x379c6e,_0x5b1b54);const _0x1071a8=_0x5b1b54['getMovedRangeStart'](),_0x2036d4=_0x5b1b54['howMany'];for(let _0x3a9aa2=0x0;_0x3a9aa2<_0x2036d4;_0x3a9aa2++){const _0x133b32=_0x1071a8['getShiftedBy'](_0x3a9aa2)['nodeAfter'];_0x7efeab['add'](_0x133b32);}break;}case'remove':{const _0x4b1e6c=_0x5b1b54['sourcePosition'],_0xeef9eb=_0x5b1b54['howMany'],_0x428721=new _0x1ff4a8(_0x4b1e6c,_0xeef9eb);_0x3b8467['batch']['addOperation'](_0x428721),_0xdf2b28['model']['applyOperation'](_0x428721);break;}}}for(const _0x31e64 of _0x7efeab){const _0x1e9281=_0xdf2b28['model']['createRangeOn'](_0x31e64),_0x441459='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x379c6e['markers']['set'](_0x441459,_0x455e7a(_0x1e9281,_0xdf2b28['model']));}});}(_0x2ae280,_0x1c32ff,_0x59b1ed):_0x59b1ed['model']['change'](_0x3ded9c=>{for(const _0x342135 of _0x2ae280)if('remove'==_0x342135['type']){const _0x4ab9a8=_0x342135['sourcePosition'],_0x510eba=_0x342135['howMany'],_0x33ea95=new _0x1ff4a8(_0x4ab9a8,_0x510eba);_0x3ded9c['batch']['addOperation'](_0x33ea95),_0x59b1ed['model']['applyOperation'](_0x33ea95);}else{if('marker'==_0x342135['type']){const _0x5ef13d=_0x342135['name'],_0x2e421c=_0x342135['newRange'];null!==_0x2e421c?_0x1c32ff['markers']['set'](_0x5ef13d,_0x2e421c):_0x1c32ff['markers']['delete'](_0x5ef13d);}else _0x342135['baseVersion']=null,_0x342135['isDocumentOperation']=!0x1,_0x3ded9c['batch']['addOperation'](_0x342135),_0x59b1ed['model']['applyOperation'](_0x342135);}}),_0x3359b5){const _0x21cd58=cs(_0x59b1ed,_0x2ae280,_0x1c32ff);us(_0x59b1ed['model'],_0x21cd58),function(_0x194191,_0x131978){const _0x1e6028=_0x131978['getFirstRange']()['start'];let _0x4c6867=_0x131978['getFirstRange']()['end'];const _0x480e19=_0x1e6028['root'];(_0x4c6867['textNode']||_0x4c6867['nodeAfter']&&_0x4c6867['nodeAfter']['is']('$text'))&&(_0x58afdc(_0x4c6867,'...'),_0x4c6867=_0x4c6867['getShiftedBy'](0x3)),(_0x1e6028['textNode']||_0x1e6028['nodeBefore']&&_0x1e6028['nodeBefore']['is']('$text'))&&(_0x58afdc(_0x1e6028,'...'),function(_0x50c3b6,_0x16cfb0,_0x426d0b){for(let [_0x5a2891,_0x48bf88]of _0x50c3b6['markers']){const _0x42a128=_0x48bf88['_getTransformedByInsertion'](_0x16cfb0,_0x426d0b,!0x1);_0x48bf88=_0x42a128[0x0],_0x50c3b6['markers']['set'](_0x5a2891,_0x48bf88);}}(_0x480e19,_0x1e6028,0x3),_0x1e6028['parent']==_0x4c6867['parent']&&(_0x4c6867=_0x4c6867['getShiftedBy'](0x3)));const _0x4469ea=_0x194191['createRange'](_0x194191['createPositionAt'](_0x480e19,0x0),_0x1e6028),_0x135ced=_0x194191['createRange'](_0x4c6867,_0x194191['createPositionAt'](_0x480e19,'end')),_0x3ee65e=[..._0x4469ea['getMinimalFlatRanges'](),..._0x135ced['getMinimalFlatRanges']()];_0x3ee65e['reverse']();for(const _0x15d226 of _0x3ee65e)_0x31c058(_0x15d226),_s(_0x480e19,_0x15d226);}(_0x59b1ed['model'],_0x21cd58);}return{'content':Wi(_0x59b1ed['data']['stringify'](_0x1c32ff,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function hs(_0x30c335,_0x149b41){for(const [_0x36a421,_0x1daa82]of _0x30c335['markers']){const _0x6cc738=_0x533258['_createFromRanges'](_0x1daa82['getTransformedByOperation'](_0x149b41));_0x30c335['markers']['set'](_0x36a421,_0x6cc738);}}function cs(_0x321188,_0x33bc6d,_0x12bf62){const _0xa5798c=_0x321188['plugins']['get']('DocumentCompare');let _0x52983a=_0x321188['model']['createPositionAt'](_0x12bf62,Number['POSITIVE_INFINITY']),_0x3f23ca=_0x321188['model']['createPositionAt'](_0x12bf62,0x0);for(const _0x5da147 of _0x33bc6d){let _0x511ee8,_0x1b1a1a;if(_0xa5798c['isMarkedRemoveOperation'](_0x5da147))_0x511ee8=_0x5da147['newRange']['start'],_0x1b1a1a=_0x5da147['newRange']['end'];else switch(_0x52983a=ls(_0x52983a,_0x5da147),_0x3f23ca=ls(_0x3f23ca,_0x5da147),_0x5da147['type']){case'rename':_0x511ee8=_0x5da147['position'],_0x1b1a1a=_0x511ee8['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x511ee8=_0x5da147['range']['start'],_0x1b1a1a=_0x5da147['range']['end'];break;case'insert':_0x511ee8=_0x5da147['position'],_0x1b1a1a=_0x511ee8['getShiftedBy'](_0x5da147['howMany']);break;case'split':_0x511ee8=_0x5da147['splitPosition'],_0x1b1a1a=_0x5da147['moveTargetPosition'];break;case'merge':{const _0x183f16=_0x5da147['targetPosition']['path']['slice'](0x0,-0x1);_0x511ee8=_0x321188['model']['createPositionFromPath'](_0x12bf62,_0x183f16),_0x1b1a1a=_0x511ee8['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x4f564b=_0x5da147['howMany'],_0x3ad561=_0x5da147['sourcePosition']['_getTransformedByInsertion'](_0x5da147['targetPosition'],_0x4f564b),_0x6a09fa=_0x5da147['getMovedRangeStart']();'remove'==_0x5da147['type']?(_0x511ee8=_0x3ad561,_0x1b1a1a=_0x3ad561):(_0x511ee8=_0x6a09fa,_0x1b1a1a=_0x6a09fa['getShiftedBy'](_0x4f564b));break;}}_0x511ee8&&_0x511ee8['isBefore'](_0x52983a)&&(_0x52983a=_0x511ee8['clone'](),_0x52983a['stickiness']='toNone'),_0x1b1a1a&&_0x1b1a1a['isAfter'](_0x3f23ca)&&(_0x3f23ca=_0x1b1a1a['clone'](),_0x3f23ca['stickiness']='toNone');}return _0x321188['model']['createSelection'](_0x321188['model']['createRange'](_0x52983a,_0x3f23ca));}function ls(_0x2ec310,_0x56f384){return'move'!=_0x56f384['type']&&'remove'!=_0x56f384['type']||_0x56f384['sourceRange']['containsPosition'](_0x2ec310)&&((_0x2ec310=_0x56f384['sourcePosition']['clone']())['stickiness']='toNone'),_0x2ec310['getTransformedByOperation'](_0x56f384);}function us(_0x3014fd,_0x37408f){ds(_0x3014fd,_0x37408f,'forward');const _0x3867c0=_0x37408f['getFirstRange']();_0x37408f['setTo']([]),_0x37408f['setTo'](_0x3867c0,{'backward':!0x0}),ds(_0x3014fd,_0x37408f,'backward');}function ds(_0x3d4f7c,_0x68bce4,_0x25a724){let _0x3c9693=0x14;for(;_0x3c9693;){_0x3d4f7c['modifySelection'](_0x68bce4,{'unit':'word','direction':_0x25a724}),_0x3c9693--;const _0x3a8889=_0x68bce4['focus']['forward'==_0x25a724?'nodeBefore':'nodeAfter'];if(_0x3a8889&&_0x3a8889['is']('element')&&_0x3d4f7c['schema']['isBlock'](_0x3a8889)&&_0x3d4f7c['schema']['isObject'](_0x3a8889))break;}}function _s(_0xe96064,_0x357582){for(const [_0xc871e4,_0x4e8e5d]of _0xe96064['markers']){const _0x78ef69=_0x4e8e5d['_getTransformedByDeletion'](_0x357582['start'],_0x357582['end']['offset']-_0x357582['start']['offset']);null!=_0x78ef69?_0xe96064['markers']['set'](_0xc871e4,_0x78ef69):_0xe96064['markers']['delete'](_0xc871e4);}}class AIReply extends ct(){['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x1f21e3,isDone:_0x4fe922=!0x1,isComplete:_0x4cb1f9,interactionId:_0x127916,areActionsDisabled:_0x417fd6,isFromHistory:_0x509649=!0x1,documentContextContent:_0x35ef3d,locale:_0x4790e4,id:_0x422549,channelsToEditors:_0x573e48}){super(),this['id']=_0x422549||at(),this['interactionId']=_0x127916,this['type']=_0x1f21e3,this['areActionsDisabled']=!!_0x417fd6,this['isFromHistory']=_0x509649,this['locale']=_0x4790e4,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x35ef3d?.['map'](_0x22ee59=>[_0x22ee59['id'],Wi(_0x22ee59['content'])])||[]),this['_documentIdToSource']=new Map(_0x35ef3d?.['map'](_0x23e840=>[_0x23e840['id'],{'editor':_0x573e48['get'](_0x23e840['channelId']),'rootName':_0x23e840['rootName']}])||[]),this['set']('isDone',_0x4fe922),this['set']('isComplete',_0x4cb1f9??_0x4fe922),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x32a725,_0x254539){const _0x1fac20='text'===this['type']?'text':_0x254539;this['content']['has'](_0x1fac20)||this['content']['set'](_0x1fac20,''),this['content']['set'](_0x1fac20,this['content']['get'](_0x1fac20)+_0x32a725),this['onContentChange'](_0x1fac20);}['done'](_0x213ab2=!0x0){this['isComplete']=_0x213ab2,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x5a756e,_0x2e6ea1){this['changeGroups'][_0x5a756e]['state']=_0x2e6ea1,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x5a756e,'state':_0x2e6ea1});}['getContentParts']({showDiff:_0x531a2a,groupIndex:_0xe461eb}){const _0x1007fe=this['_getCachedContentParts'](_0x531a2a,_0xe461eb);if(_0x1007fe)return _0x1007fe;let _0x2ef2cb=[];if(void 0x0===_0xe461eb)_0x2ef2cb=this['changeGroups'];else{const _0x554b57=this['changeGroups']['find'](({index:_0x3d7350})=>_0x3d7350===_0xe461eb);if(!_0x554b57)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0xe461eb});_0x2ef2cb=[_0x554b57];}const _0x299b06=os({'showDiff':_0x531a2a,'changeGroups':_0x2ef2cb,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x531a2a,_0x299b06),_0x299b06;}['_getCachedContentParts'](_0x3a417a,_0x2d13ad){const _0x49671c=_0x3a417a?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x49671c]['length'])return null;const _0x214f01=this['cachedSuggestionContentParts'][_0x49671c];if(void 0x0===_0x2d13ad)return _0x214f01['length']>0x0&&_0x214f01['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x3a417a,null),null):_0x4f4192(_0x214f01);{const _0x312e2f=_0x214f01['find'](({index:_0x460e03})=>_0x460e03===_0x2d13ad);if(_0x312e2f)return[_0x4f4192(_0x312e2f)];}return null;}['_setCachedContentParts'](_0x1671d5,_0x517a6b){const _0x578e52=_0x1671d5?'withDiff':'withoutDiff';_0x517a6b?_0x517a6b['forEach'](_0x4d826e=>{const _0x5625a5=this['cachedSuggestionContentParts'][_0x578e52],_0x27fcab=_0x5625a5['find'](({index:_0x28483f})=>_0x28483f===_0x4d826e['index']);if(_0x27fcab){const _0x30a495=_0x5625a5['indexOf'](_0x27fcab);_0x5625a5['splice'](_0x30a495,0x1,_0x4d826e);}else _0x5625a5['push'](_0x4d826e);}):this['cachedSuggestionContentParts'][_0x578e52]['length']=0x0;}['onContentChange'](_0x19920d){if('modification'===this['type']){if(_0x19920d)this['parsedContent']['set'](_0x19920d,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x19920d)));else{for(const [_0xaeca59,_0x166d36]of this['content'])this['parsedContent']['set'](_0xaeca59,this['aiResponseParser']['parseAndNormalizeHTML'](_0x166d36));}const _0x3c3300=this['changeGroups'];for(const _0x2179c8 of this['content']['keys']())this['updateChangeGroups'](_0x2179c8);const _0x4aa12e=this['_getDifferentChangeGroups'](_0x3c3300,this['changeGroups']);(_0x4aa12e['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x4aa12e),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x53e569,_0x4ff8a4){const _0x5044d3=[];for(const _0x340ce6 of _0x4ff8a4){const _0x197633=_0x53e569[_0x340ce6['index']];_0x197633?_0x197633['changes']['length']!==_0x340ce6['changes']['length']?_0x5044d3['push'](_0x340ce6):_0x197633['changes']['forEach']((_0x4ad933,_0x1862dc)=>{const _0x31dc36=_0x340ce6['changes'][_0x1862dc];_0x4ad933['id']!==_0x31dc36['id']&&_0x5044d3['push'](_0x340ce6);}):_0x5044d3['push'](_0x340ce6);}return _0x5044d3;}['updateChangeGroups'](_0x4b1055){const _0x488f3e=this['documentContextContent']['get'](_0x4b1055),_0x1e5d89=this['parsedContent']['get'](_0x4b1055);if(!_0x488f3e||!_0x1e5d89)return;const _0x4c52ee=new _0x3ea511('p',{},[new _0x3ea511('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x34224c(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x1fb2c2=this['aiResponseApplier']['merge'](_0x1e5d89,_0x488f3e['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x4c52ee});this['parsedMergedContent']['set'](_0x4b1055,_0x1fb2c2['parsedContent']);let _0x1e5f8d=[];if(_0x61ba86(_0x3e9feb=>{const _0x371177=Xi(_0x3e9feb,'data-id');if(!_0x371177||!_0x47925f(_0x371177))return!0x1;const _0x2def84=[_0x3e9feb,...Ji(_0x3e9feb)]['at'](-0x2);if(_0x3e9feb!=_0x2def84){const _0x5eda38=Xi(_0x2def84,'data-id');_0x47925f(_0x5eda38)||(_0x1e5f8d['push']({'node':_0x2def84,'id':_0x5eda38,'type':'modified'}),_0x1fb2c2['modifiedNodeIds']['push'](_0x5eda38));}else _0x1fb2c2['modifiedNodeIds']['includes'](_0x371177)?_0x1e5f8d['push']({'node':_0x3e9feb,'type':'modified','id':_0x371177}):_0x1fb2c2['newNodeIds']['includes'](_0x371177)?_0x1e5f8d['push']({'node':_0x3e9feb,'type':'new','id':_0x371177,'anchorId':Xi(_0x3e9feb['previousSibling'],'data-id')}):_0x1e5f8d['push']({'node':_0x3e9feb,'type':'removed','id':_0x371177});return!0x0;},this['parsedMergedContent']['get'](_0x4b1055)),_0x1e5f8d=_0x1e5f8d['filter'](({node:_0x2a0b8d})=>[...Ji(_0x2a0b8d),_0x2a0b8d]['every'](_0x40355f=>!Xi(_0x40355f,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x75c9bd=>_0x75c9bd['documentId']!==_0x4b1055),0x0==_0x1e5f8d['length'])return;const _0x5c9b51=[[_0x1e5f8d[0x0]]];for(let _0x49448f=0x1;_0x49448f<_0x1e5f8d['length'];_0x49448f++){const _0x37af4c=_0x5c9b51[_0x5c9b51['length']-0x1],_0x49ae42=_0x37af4c[_0x37af4c['length']-0x1];_0x1e5f8d[_0x49448f]['node']['previousSibling']==_0x49ae42['node']&&'modified'!=_0x1e5f8d[_0x49448f]['type']&&'modified'!=_0x49ae42['type']?_0x37af4c['push'](_0x1e5f8d[_0x49448f]):_0x5c9b51['push']([_0x1e5f8d[_0x49448f]]);}for(const _0x19d661 of _0x5c9b51){const _0x58dc50=_0x19d661[0x0],_0x4ab182=_0x19d661[_0x19d661['length']-0x1],_0xf8b951=_0xfd7121(_0x58dc50['node']['previousSibling']);_0xf8b951&&_0x19d661['unshift'](_0xf8b951);const _0x366baa=_0xfd7121(_0x4ab182['node']['nextSibling']);_0x366baa&&_0x19d661['push'](_0x366baa);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x4b1055))['forEach'](_0x549c30=>{zi(_0x549c30,'data-wrapped-id',null);});const _0x5934a0=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x4b1055))['forEach'](_0x4ff6d4=>{const _0x553990=Xi(_0x4ff6d4,'data-unwrapped-id'),_0x49df69=Xi(_0x4ff6d4,'data-id');_0x5934a0['set'](_0x49df69,_0x553990),zi(_0x4ff6d4,'data-id',_0x553990),zi(_0x4ff6d4,'data-unwrapped-id',null);});for(const _0x2a2b6a of _0x1e5f8d){const _0x199c9d=_0x5934a0['get'](_0x2a2b6a['id']);_0x199c9d&&(_0x2a2b6a['id']=_0x199c9d);}this['changeGroups']['push'](..._0x5c9b51['map']((_0x1260b3,_0x323d08)=>({'changes':_0x1260b3,'state':'pending','index':_0x323d08,'editor':this['_documentIdToSource']['get'](_0x4b1055)['editor'],'rootName':this['_documentIdToSource']['get'](_0x4b1055)['rootName'],'documentId':_0x4b1055})));const _0x3262ad=Array['from'](this['documentContextContent']['keys']());function _0x47925f(_0x40d855){return _0x1fb2c2['modifiedNodeIds']['includes'](_0x40d855)||_0x1fb2c2['newNodeIds']['includes'](_0x40d855)||_0x1fb2c2['removedNodeIds']['includes'](_0x40d855);}function _0xfd7121(_0x2b507a){if(_0x2b507a&&Xi(_0x2b507a,'data-id')&&!Xi(_0x2b507a,'data-unstable')){const _0x25ab04=Xi(_0x2b507a,'data-id');if(!_0x47925f(_0x25ab04))return{'node':_0x2b507a,'type':'context','id':_0x25ab04};}return null;}this['changeGroups']['sort']((_0x552d92,_0x193ebc)=>_0x3262ad['indexOf'](_0x552d92['documentId'])-_0x3262ad['indexOf'](_0x193ebc['documentId'])),this['changeGroups']['forEach']((_0x1fb554,_0x4cf812)=>{_0x1fb554['index']=_0x4cf812;});}}const Is=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x4da50f,locale:_0x499240,channelsToEditors:_0x2c2e9f}){super(),this['id']=at(),this['connector']=_0x4da50f,this['isStopped']=!0x0,this['locale']=_0x499240,this['_channelsToEditors']=_0x2c2e9f||new Map();}async['start'](){await this['_run']();}async['resume'](_0x677f48){await this['_run'](_0x677f48);}async['_run'](_0x45614d){const _0x4966f3=[];let _0x44a472,_0x2a888e,_0x35077c,_0x5f2710=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x45614d||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x151d29=await this['currentRequest']['getStream']();for await(const _0x17a101 of _0x151d29){if(this['isStopped'])return;if('error'==_0x17a101['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x17a101['event']){case'message-metadata':this['messageId']=_0x17a101['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x17a101['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x17a101['data']['conversationTitle'],!0x0);break;case'source':_0x4966f3['push'](_0x17a101['data']['source']);break;case'web-search':this['_isWebSearching']||(this['_isWebSearching']=!0x0,this['fire']('webSearchStarted',this));break;case'reasoning':this['_isReasoning']||(this['_isReasoning']=!0x0,this['fire']('reasoningStarted',this));break;case'modification-delta':case'text-delta':this['resetReasoningState'](),this['resetWebSearchState'](),_0x44a472='modification-delta'==_0x17a101['event']?'modification':'text',_0x2a888e='modification-delta'==_0x17a101['event']?_0x17a101['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x44a472&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x44a472,'interactionId':this['id'],'id':_0x2a888e,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x17a101['event']&&{'documentId':_0x17a101['data']['documentId']}}),'modification'==_0x44a472&&(this['currentReply']['sources']=_0x4966f3['splice'](0x0))),this['currentReply']['appendContent'](_0x17a101['data']['textDelta'],_0x17a101['data']['documentId']);break;case'mcp-tool-result':_0x35077c=JSON['parse'](_0x17a101['data']['result']),this['_handleToolResultData']({'toolName':_0x17a101['data']['toolName'],'data':_0x35077c['data'],'attributes':_0x35077c['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x17a101['data']['toolName'],'data':_0x17a101['data']['data']});}}_0x5f2710=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x4966f3['length']>0x0&&(this['currentReply']['sources']=_0x4966f3['splice'](0x0)),this['_finalizeInteraction'](_0x5f2710),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x18abc8){return this['replies']['find'](_0x30766c=>_0x30766c['id']===_0x18abc8);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x598d1c=>_0x598d1c['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x273c07){const _0x5f0e54=this['getDocumentContext'](),_0x5073d1=new AIReply({'locale':this['locale'],'documentContextContent':_0x5f0e54?.['documents'],..._0x273c07});return this['replies']['push'](_0x5073d1),_0x5073d1['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x5073d1),_0x5073d1;}['setConversationTitle'](_0x7e90d5,_0x1c0b52=!0x1){this['fire']('setConversationTitle',_0x7e90d5,_0x1c0b52);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x4c7aab){this['fire']('toolDataReceived',{'type':'result','toolName':_0x4c7aab['toolName'],'data':structuredClone(_0x4c7aab['data']||{}),'attributes':structuredClone(_0x4c7aab['attributes']||{})},this);}['_handleToolNotificationData'](_0x3791a0){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x3791a0['toolName'],'data':structuredClone(_0x3791a0['data'])},this);}['_finalizeInteraction'](_0x3b4fb2=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x3b4fb2),this['currentRequest']=this['currentReply']=void 0x0;}}const As=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),gs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x25479c,config:_0xbc289a,ownerId:_0x3c945a}){super(),this['_connector']=_0x25479c,this['_config']=_0xbc289a,this['_ownerId']=_0x3c945a;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x19b6c1){const _0x184801=await this['_createContextItemFromContent'](_0x19b6c1);return this['_addToConversationContextItem'](_0x184801),'current-document'===_0x184801['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x184801;}async['populateDocumentsFromMessage'](_0x1e3b22,_0x1ff7b5){const _0x197a55=_0x1e3b22['filter'](_0x215eaa=>'document'===_0x215eaa['type']);if(0x0===_0x197a55['length'])return{'hasUnmatched':!0x1};const _0x433aab=_0x197a55['map'](_0x2def53=>_0x2def53['id']),_0x19ed3d=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x433aab)['getDocuments'](),_0x362845=new Map(_0x19ed3d['map'](_0x48d42b=>[_0x48d42b['id'],_0x48d42b])),_0x52c20c=[];let _0x3a8a89=!0x1;for(const _0x27f6d0 of _0x197a55){const _0x5de587=_0x362845['get'](_0x27f6d0['id']);_0x5de587&&(this['_matchDocumentToRoot'](_0x5de587,_0x1ff7b5)||(_0x3a8a89=!0x0),_0x52c20c['push']({'id':_0x5de587['id'],'content':_0x5de587['content'],'version':_0x5de587['attributes']?.['version']??0x0,'sessionId':_0x5de587['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x5de587['attributes']?.['channelId']??_0x1ff7b5[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x5de587['attributes']?.['rootName']??_0x1ff7b5[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x3b50f8={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x52c20c};return this['_addToConversationContextItem'](_0x3b50f8),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3b50f8,'hasUnmatched':_0x3a8a89};}['_matchDocumentToRoot'](_0x792e7e,_0x4997da){const _0x244995=_0x792e7e['attributes']?.['channelId'],_0x45d08f=_0x792e7e['attributes']?.['rootName'];if(_0x244995&&_0x45d08f){for(const _0x26d5da of _0x4997da)if(_0x26d5da['config']['get']('collaboration.channelId')===_0x244995){for(const _0x13a31f of _0x26d5da['model']['document']['getRoots']())if('$graveyard'!==_0x13a31f['rootName']&&_0x13a31f['rootName']===_0x45d08f)return{'editor':_0x26d5da,'rootName':_0x13a31f['rootName']};}}}async['_createContextItemFromContent'](_0x2b7003){if('document'===_0x2b7003['type']){const _0x596cd2=await this['_connector']['fetchDocument'](this['_ownerId'],_0x2b7003['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x2b7003['type'],'content':_0x596cd2['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x596cd2['attributes']?.['version'],'sessionId':_0x596cd2['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x2b7003['type'])return{'id':_0x2b7003['id'],'uiId':_0x2b7003['id'],'label':_0x2b7003['data']?.['label']||_0x2b7003['id'],'type':'mcp-tool-context','mcpServerName':_0x2b7003['mcpServerName'],'toolName':_0x2b7003['toolName'],'data':_0x2b7003['data']||{}};return{'id':_0x2b7003['id'],'uiId':_0x2b7003['id'],'label':_0x2b7003['attributes']?.['label']||_0x2b7003['name']||_0x2b7003['url']||_0x2b7003['id'],'type':_0x2b7003['type'],..._0x2b7003?.['attributes']?.['resourceId']?{'resourceId':_0x2b7003['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x136b37){const _0x309c37=this['_pendingContextItems']['get'](_0x136b37);_0x309c37?.['isReadOnly']||this['_removeContextItem'](_0x136b37);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xd410c6 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0xd410c6['uiId']);const _0x11e026=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x11e026&&this['_addContextItem']({..._0x11e026,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x401511){for(const _0x3f4c01 of _0x401511['values']())this['_addToConversationContextItem'](_0x3f4c01);this['clearPendingContextItems'](),this['fire']('contextSent',{'contextItems':Array['from'](this['getSentContextItems']()['values']())});}['isCurrentDocumentInContext'](){return this['_pendingContextItems']['has']('current-document');}['isSelectionInContext'](){return this['_pendingContextItems']['has']('selection');}['isCurrentDocumentInConversation'](){return this['_conversationContextItems']['has']('current-document');}static['mapContextItemsToRequestData'](_0x459609){return Array['from'](_0x459609['values']())['flatMap'](_0x503993=>this['_mapContextItemToRequestData'](_0x503993));}async['addFilesToContext'](_0x2109ce,_0x8489d9,_0x476451='file'){const _0x6cbd3c='files-'+at();this['_startUploadOperation'](_0x6cbd3c);try{await Promise['all'](_0x2109ce['map'](async _0x45c12f=>{const _0x2c36c0='file-'+at(),_0x7dcd07=_0x13f09b(_0x45c12f['name']),_0x3e3f80='file'===_0x476451&&_0x45c12f['type']['startsWith']('image/')?'image':_0x476451;try{this['_addContextItem']({'type':_0x3e3f80,'label':_0x8489d9?.['label']||_0x7dcd07,'uiId':_0x2c36c0,'resourceId':_0x8489d9?.['resourceId']},!0x0);const _0x4387ba=this['_connector']['uploadFile'](this['_ownerId'],_0x45c12f,_0x8489d9);this['_ongoingUploads']['set'](_0x2c36c0,_0x4387ba['abortController']);const {id:_0x4d4fbd}=await _0x4387ba['getId']();this['_ongoingUploads']['delete'](_0x2c36c0),this['_finishContextItemLoading']({'type':_0x3e3f80,'id':_0x4d4fbd,'label':_0x8489d9?.['label']||_0x7dcd07,'uiId':_0x2c36c0,'resourceId':_0x8489d9?.['resourceId']},!0x1);}catch(_0x26b70d){this['_ongoingUploads']['delete'](_0x2c36c0);if(!(_0x26b70d instanceof ht&&_0x26b70d['message']['startsWith']('ai-request-aborted'))){const _0x14f912=As['get'](_0x26b70d['code'])||'ai-chat-file-upload-failed',_0x236191=new ht(_0x14f912,null,{'fileName':_0x7dcd07,..._0x26b70d});_0x236191['stack']=_0x26b70d['stack'],this['fire']('error',{'error':_0x236191});}this['_removeContextItem'](_0x2c36c0);}}));}finally{this['_finishUploadOperation'](_0x6cbd3c);}}['addCurrentDocumentToContext'](_0x22498f){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x306233={'type':'document','uiId':'current-document','label':_0x22498f,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x306233);}async['updateCurrentDocuments'](_0x5b4109){const _0x5579c7=this['_pendingContextItems']['get']('current-document');if(!_0x5579c7||!_0x5b4109['length']||_0x5b4109['every'](_0x52d8d6=>!_0x52d8d6['content']))return;_0x5b4109['length']>0x1&&_0x5b4109['some'](_0x39da48=>!_0x39da48['description'])&&wt('ai-chat-documents-missing-description');try{const _0x467cc2=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x5b4109)['getIds']();if(_0x467cc2['length']!==_0x5b4109['length']||_0x467cc2['some'](_0xe6d5df=>!_0xe6d5df?.['id'])){const _0x2967a6=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x2967a6});}_0x5579c7['documents']=_0x5b4109['map']((_0xb4418d,_0x5b1fd5)=>{return{'id':_0x467cc2[_0x5b1fd5]['id'],'content':_0xb4418d['content'],'version':_0xb4418d['version'],'sessionId':_0xb4418d['sessionId'],'selection':(_0x244b38=_0xb4418d['selections'],_0x244b38?_0x244b38['map'](_0x5f5886=>({'start':_0x5f5886['start'],'end':_0x5f5886['end']})):[]),'channelId':_0xb4418d['channelId'],'rootName':_0xb4418d['rootName']};var _0x244b38;});}catch(_0x2b9f98){const _0x306fef=new ht('ai-chat-document-upload-failed',null);_0x306fef['stack']=_0x2b9f98['stack'],this['fire']('error',{'error':_0x306fef});}}['addSelectionToContext'](_0x4189ca){this['_addContextItem']({'type':'selection','label':_0x4189ca,'uiId':'selection','content':_0x4189ca});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x47370b,_0x3b0055){const _0x42aaea='url-'+at();this['_startUploadOperation'](_0x42aaea);const _0x5f00b0='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x3b0055?.['label']||_0x47370b,'uiId':_0x5f00b0,'resourceId':_0x3b0055?.['resourceId']},!0x0);const _0x476056=this['_connector']['uploadUrl'](this['_ownerId'],_0x47370b,_0x3b0055);this['_ongoingUploads']['set'](_0x5f00b0,_0x476056['abortController']);const {id:_0x75eab1}=await _0x476056['getId']();this['_ongoingUploads']['delete'](_0x5f00b0),this['_finishContextItemLoading']({'type':'web-resource','id':_0x75eab1,'label':_0x3b0055?.['label']||_0x47370b,'uiId':_0x5f00b0,'resourceId':_0x3b0055?.['resourceId']},!0x1);}catch(_0x53097d){this['_ongoingUploads']['delete'](_0x5f00b0),(_0x53097d['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x47370b,'originalError':_0x53097d}),'url':_0x47370b}),this['_removeContextItem'](_0x5f00b0));}finally{this['_finishUploadOperation'](_0x42aaea);}}['addToolItemToContext'](_0x1936a8){_0x1936a8['id']=_0x1936a8['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x1936a8['uiId'],_0x1936a8),this['fire']('contextItemAdded',{'contextItem':_0x1936a8,'isLoading':!0x1});}async['loadSourceResources'](_0x356b5f,_0x831886,_0x44ea2c){const _0xb1c3ea=this['_addContextOptionsState']['sources']['find'](_0x3da2e8=>_0x3da2e8['id']===_0x356b5f);if(!_0xb1c3ea)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x356b5f}),'sourceId':_0x356b5f}),[];try{const _0x5ceca9=(await _0xb1c3ea['getResources'](_0x831886))['map'](_0x368ede=>{const _0xd85466=this['_isResourceInContext'](_0x368ede['id']);return{..._0x368ede,'isInContext':_0xd85466};});return _0xb1c3ea['resources']=_0x5ceca9,this['fire']('sourceResourcesLoaded',{'sourceId':_0x356b5f,'source':_0xb1c3ea,'resources':_0x5ceca9,'uid':_0x44ea2c}),_0x5ceca9;}catch(_0x1ea6ba){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x356b5f,'originalError':_0x1ea6ba}),'sourceId':_0x356b5f,'sourceLabel':_0xb1c3ea['label']}),[];}}async['addResourceToContext'](_0x582288,_0x17cb7f){if(this['_isResourceInContext'](_0x17cb7f['id']))return;let _0x3de6be=_0x17cb7f['data'];if(!_0x3de6be&&_0x582288['getData'])try{_0x3de6be=await _0x582288['getData'](_0x17cb7f['id']);}catch(_0x3c8e68){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id'],'originalError':_0x3c8e68}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});}if(_0x3de6be)switch(_0x17cb7f['type']){case'web-resource':if('string'!=typeof _0x3de6be)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id'],'expectedType':'string','actualType':typeof _0x3de6be}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});await this['addUrlToContext'](_0x3de6be,{'label':_0x17cb7f['label'],'resourceId':_0x17cb7f['id']});break;case'file':if(!(_0x3de6be instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id'],'expectedType':'File','actualType':typeof _0x3de6be}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});await this['addFilesToContext']([_0x3de6be],{'label':_0x17cb7f['label'],'resourceId':_0x17cb7f['id']});break;case'text':if('object'!=typeof _0x3de6be||!('content'in _0x3de6be)||!('type'in _0x3de6be))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x3de6be}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});_0x3de6be=AIChatContext['_convertTextResourceToFile'](_0x3de6be,_0x17cb7f['label']),await this['addFilesToContext']([_0x3de6be],{'label':_0x17cb7f['label'],'resourceId':_0x17cb7f['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id'],'resourceType':_0x17cb7f['type']}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']}),'resourceId':_0x17cb7f['id'],'sourceId':_0x582288['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x53ec7a){if(void 0x0!==_0x53ec7a)this['_addContextOptionsState']['document']['isHidden']=!_0x53ec7a;else{const _0x428b94=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x428b94;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x55c69d,_0x2ec34e){switch(_0x55c69d['type']){case'markdown':return new File([_0x55c69d['content']],_0x2ec34e,{'type':'text/markdown'});case'html':return new File([_0x55c69d['content']],_0x2ec34e,{'type':'text/html'});default:return new File([_0x55c69d['content']],_0x2ec34e,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x4d817b){switch(_0x4d817b['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x4d817b['id']}];case'web-resource':return[{'type':'web-resource','id':_0x4d817b['id']}];case'document':return _0x4d817b['documents']?.['length']?_0x4d817b['documents']['map'](_0x5a7445=>({'type':'document','id':_0x5a7445['id'],..._0x5a7445['selection']?.['length']&&{'selection':_0x5a7445['selection']}})):[{'type':'document','id':_0x4d817b['id'],..._0x4d817b['selection']?.['length']&&{'selection':_0x4d817b['selection']}}];case'mcp-tool-context':{const _0x55c82c=_0x4d817b;return[{'type':'mcp-tool-context','mcpServerName':_0x55c82c['mcpServerName'],'toolName':_0x55c82c['toolName'],'data':{..._0x55c82c['data'],'label':_0x55c82c['label']||_0x55c82c['data']?.['label']||_0x55c82c['id']},'id':_0x55c82c['id']}];}default:return[];}}['_addContextItem'](_0x9a24f3,_0x2ec5ca=!0x1){if(this['_pendingContextItems']['set'](_0x9a24f3['uiId'],_0x9a24f3),_0x9a24f3['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x9a24f3,'isLoading':_0x2ec5ca}),'current-document'===_0x9a24f3['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x9a24f3['resourceId']){const _0x1b290c=this['_findSourceIdsByResourceId'](_0x9a24f3['resourceId']);_0x1b290c&&_0x1b290c['forEach'](_0x326c3e=>{this['_updateResourceInContextState'](_0x326c3e,_0x9a24f3['resourceId'],!0x0);});}}['_removeContextItem'](_0x353617){const _0x42b7d1=this['_pendingContextItems']['get'](_0x353617),_0x3bde59=this['_ongoingUploads']['get'](_0x353617);if(_0x3bde59&&(_0x3bde59['abort'](),this['_ongoingUploads']['delete'](_0x353617)),_0x42b7d1?.['resourceId']){const _0x4363fe=this['_findSourceIdsByResourceId'](_0x42b7d1['resourceId']);_0x4363fe&&_0x4363fe['forEach'](_0x2fd733=>{this['_updateResourceInContextState'](_0x2fd733,_0x42b7d1['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x353617),this['fire']('contextItemRemoved',{'uiId':_0x353617,'type':_0x42b7d1?.['type']}),'current-document'===_0x353617&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x4aafe2,_0x270fe2){if(this['_pendingContextItems']['has'](_0x4aafe2['uiId'])&&(this['_pendingContextItems']['set'](_0x4aafe2['uiId'],_0x4aafe2),this['fire']('contextItemLoadingEnded',{'contextItem':_0x4aafe2,'isLoading':_0x270fe2}),_0x4aafe2['resourceId'])){const _0x3f8ab8=this['_findSourceIdsByResourceId'](_0x4aafe2['resourceId']);_0x3f8ab8&&_0x3f8ab8['forEach'](_0x4dcd56=>{this['_updateResourceInContextState'](_0x4dcd56,_0x4aafe2['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x48bb00){this['_conversationContextItems']['set'](_0x48bb00['uiId'],_0x48bb00);}['_setAddContextOptionsDefaultState'](){this['_addContextOptionsState']={'document':{'enabled':!0x1!==this['_config']?.['document']?.['enabled'],'isHidden':!0x1},'urls':{'enabled':!0x1!==this['_config']?.['urls']?.['enabled']},'files':{'enabled':!0x1!==this['_config']?.['files']?.['enabled']},'sources':this['_getCustomSourcesInitialState'](),'customItems':this['_config']?.['customItems']?.['map'](_0x283970=>({..._0x283970,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x3ca86e=>({..._0x3ca86e,'resources':[]}))??[];}['_isResourceInContext'](_0x19edda){for(const _0x2f26e0 of this['_pendingContextItems']['values']())if(_0x2f26e0['resourceId']===_0x19edda)return!0x0;for(const _0x55fd21 of this['_conversationContextItems']['values']())if(_0x55fd21['resourceId']===_0x19edda)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x34c8c6){const _0x4fbdce=[];for(const _0x1e23c6 of this['_addContextOptionsState']['sources']){_0x1e23c6['resources']['find'](_0x20b11e=>_0x20b11e['id']===_0x34c8c6)&&_0x4fbdce['push'](_0x1e23c6['id']);}return 0x0===_0x4fbdce['length']?null:_0x4fbdce;}['_updateResourceInContextState'](_0x32ba00,_0x67ea33,_0x43308d){const _0x5d1566=this['_addContextOptionsState']['sources']['find'](_0x223a08=>_0x223a08['id']===_0x32ba00);if(!_0x5d1566)return;const _0x7eb82b=_0x5d1566['resources']['find'](_0x531c12=>_0x531c12['id']===_0x67ea33);_0x7eb82b&&(_0x7eb82b['isInContext']=_0x43308d,this['fire']('resourceStateChanged',{'sourceId':_0x32ba00,'resourceId':_0x67ea33,'isInContext':_0x43308d}));}['_startUploadOperation'](_0x4f4eb7){this['_ongoingUploadOperations']['set'](_0x4f4eb7,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x5d386a){this['_ongoingUploadOperations']['delete'](_0x5d386a),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const ws=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x1db7c4){const _0x275825={};return _0x1db7c4&&_0x1db7c4['isWebSearchEnabled']&&(_0x275825['webSearch']={}),_0x1db7c4&&_0x1db7c4['isReasoningEnabled']&&(_0x275825['reasoning']={}),_0x275825;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x5f4b42){_0x5f4b42!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x5f4b42,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x5c06d3){_0x5c06d3!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x5c06d3,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x5b3157){super(_0x5b3157),this['conversationId']=_0x5b3157['conversationId'],this['contextItems']=_0x5b3157['contextItems'],this['capabilities']=_0x5b3157['capabilities'],this['userMessage']=_0x5b3157['userMessage'],this['model']=_0x5b3157['model'],this['attributes']=_0x5b3157['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x2b4bbf){super(),this['options']=_0x2b4bbf,this['connector']=_0x2b4bbf['connector'],this['chatModels']=_0x2b4bbf['chatModels'],this['id']=_0x2b4bbf['conversationId'],this['isFromHistory']=_0x2b4bbf['isFromHistory'],this['_channelsToEditors']=_0x2b4bbf['channelsToEditors'],this['_getSessionId']=_0x2b4bbf['getSessionId'];}async['init'](_0x5eabbb){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x5eabbb,'ownerId':this['id']}),this['chatContext']['delegate'](...gs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...ws)['to'](this),this['chatCapabilities']['init']();const _0x4d5127=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x4d5127});const _0x3fe19a=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x3fe19a&&await this['setModel'](_0x3fe19a);}catch(_0x5f5d03){const _0x58c525=new ht('ai-chat-conversation-init-failed',null,{'message':_0x5f5d03['message']||_0x5f5d03});_0x58c525['stack']=_0x5f5d03['stack'],this['fire']('error',{'error':_0x58c525});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x3596e4}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x3596e4,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x101bef){const _0x26f076=new ht('ai-chat-conversation-start-failed',null,{'message':_0x101bef['message'],'conversationId':this['id']});throw _0x26f076['stack']=_0x101bef['stack'],this['fire']('error',{'error':_0x26f076}),_0x26f076;}}async['load'](_0x3eec0c){try{const _0x3bde01=await this['connector']['fetchConversation'](_0x3eec0c)['getConversation'](),_0x3ade4e=await this['connector']['fetchConversationMessages'](_0x3eec0c)['getMessages'](),_0x4ade1a=_0x3ade4e[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x3bde01['id'],'title'in _0x3bde01?this['fire']('setConversationTitle',_0x3bde01['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x5da24c=(await this['chatModels']['getAll']())['find'](_0x55ffac=>_0x55ffac['id']['toLowerCase']()===_0x4ade1a['toLowerCase']());this['selectedModel']=_0x5da24c,this['fire']('modelSelected',{'selectedModel':_0x5da24c,'isDisabled':!0x0});const {streamingMessageId:_0x5789d1}=await this['_processMessagesToInteractions'](_0x3ade4e,_0x4ade1a);return _0x5789d1&&this['currentInteraction']?this['_resumeStream'](_0x5789d1):this['currentInteraction']=void 0x0,this;}catch(_0x575eac){const _0x22856a=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0x575eac['message'],'conversationId':_0x3eec0c});throw _0x22856a['stack']=_0x575eac['stack'],this['fire']('error',{'error':_0x22856a}),_0x22856a;}}async['_processMessagesToInteractions'](_0x43d47a,_0x63d259){let _0x5417a6,_0x1f31a2,_0x5d6572=!0x1;for(const _0x7c13df of _0x43d47a)if('user'===_0x7c13df['role']){const {contextItems:_0x2c975f,hasUnmatched:_0x5ed131}=await this['_extractContextItems'](_0x7c13df);_0x5d6572=_0x5ed131;const _0x5335f8={'isReasoningEnabled':Object['hasOwn'](_0x7c13df['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x7c13df['capabilities'],'webSearch')};_0x5417a6=this['createInteraction']({'userMessage':_0x7c13df['prompt'],'contextItems':_0x2c975f,'capabilities':_0x5335f8,'modelId':_0x63d259,'attributes':_0x7c13df['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x5417a6,_0x1f31a2=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x7c13df['role']&&_0x5417a6){if('streaming'===_0x7c13df['status']){_0x1f31a2=_0x7c13df['id'];continue;}if('error'===_0x7c13df['status'])continue;const _0x1b12b6=[];for(const _0x5d142e of _0x7c13df['content'])switch(_0x5d142e['type']){case'text':case'modification':{const _0x424b6d=_0x5417a6['getDocumentContext'](),_0x12187f=this['_hasSessionMismatch'](_0x424b6d)||_0x5d6572;_0x5417a6['currentReply']?.['type']!==_0x5d142e['type']&&(_0x5417a6['currentReply']=_0x5417a6['createReply']({'type':_0x5d142e['type'],'isDone':!0x0,'interactionId':_0x5417a6['id'],'areActionsDisabled':_0x12187f,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x1b12b6['length']>0x0&&(_0x5417a6['currentReply']['sources']=_0x1b12b6['splice'](0x0))),_0x5417a6['currentReply']['appendContent'](_0x5d142e['content'],_0x5d142e['documentId']);break;}case'url':_0x1b12b6['push'](_0x5d142e);break;case'mcp-tool-result':{const {data:_0x50fb1f,attributes:_0x1b423a}=JSON['parse'](_0x5d142e['content']);_0x5417a6['_handleToolResultData']({'toolName':_0x5d142e['toolName'],'data':_0x50fb1f,'attributes':_0x1b423a});break;}}'cancelled'===_0x7c13df['status']&&this['fire']('error',{'interactionId':_0x5417a6['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x1f31a2};}async['_resumeStream'](_0xb210bc){if(this['currentInteraction'])try{const _0x278aca=this['connector']['resumeStream'](this['id'],_0xb210bc);await this['currentInteraction']['resume'](_0x278aca);}catch(_0x474a51){_0x474a51 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x474a51});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x6eed6c){const _0xd45463=new Map();if(!_0x6eed6c['content'])return{'contextItems':_0xd45463,'hasUnmatched':!0x1};const {contextItem:_0x197573,hasUnmatched:_0xdcab0}=await this['chatContext']['populateDocumentsFromMessage'](_0x6eed6c['content'],Array['from'](this['_channelsToEditors']['values']()));_0x197573&&_0xd45463['set'](_0x197573['id'],_0x197573);for(const _0x3feca1 of _0x6eed6c['content']){if('document'===_0x3feca1['type'])continue;const _0x55543c=await this['chatContext']['populateFromMessage'](_0x3feca1);_0x55543c&&_0xd45463['set'](_0x55543c['id'],_0x55543c);}return{'contextItems':_0xd45463,'hasUnmatched':_0xdcab0};}async['handleUserInteraction']({userMessage:_0x51d54d,attributes:_0x69ac9b}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x311dbd=new Map(this['getPendingContextItems']()),_0x1a05ef=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4b683c=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x51d54d,'contextItems':_0x311dbd,'capabilities':_0x1a05ef,'modelId':_0x4b683c,'attributes':_0x69ac9b,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x51e67d){if(_0x51e67d instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x51e67d});else{const _0x4950e5=As['get'](_0x51e67d['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x4950e5,null,{'error':_0x51e67d})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x2c3a06,contextItems:_0xc60ab3,capabilities:_0x4a7672,modelId:_0x251189,attributes:_0xc9ad43,channelsToEditors:_0x37ba12}){const _0x4b0ff8=new AIChatInteraction({'userMessage':_0x2c3a06,'contextItems':_0xc60ab3,'capabilities':_0x4a7672,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x251189,'attributes':_0xc9ad43,'channelsToEditors':_0x37ba12});return _0x4b0ff8['delegate'](...Is)['to'](this),this['interactions']['push'](_0x4b0ff8),this['fire']('interactionCreated',_0x4b0ff8),_0x4b0ff8;}['getInteraction'](_0x3b8e0e){return this['interactions']['find'](_0x1bc871=>_0x1bc871['id']===_0x3b8e0e);}['removeInteraction'](_0x2c3e99){const _0x312603=this['getInteraction'](_0x2c3e99);_0x312603&&(_0x312603['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x312603),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x20e64c=this['lastInteraction'];_0x20e64c?.['conversationId']&&_0x20e64c['messageId']&&this['connector']['cancelStream'](_0x20e64c['conversationId'],_0x20e64c['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x4c4ce0){this['chatContext']['addCurrentDocumentToContext'](_0x4c4ce0);}async['updateCurrentDocumentsInContext'](_0x329906){await this['chatContext']['updateCurrentDocuments'](_0x329906);}['toggleAddCurrentDocumentOptionVisibility'](_0x1ecc71){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x1ecc71);}['_hasSessionMismatch'](_0x5c7755){return!!_0x5c7755&&_0x5c7755['documents']['some'](_0x59a7ae=>{const _0x2c8e4d=this['_channelsToEditors']['get'](_0x59a7ae['channelId']);return!_0x2c8e4d||_0x59a7ae['sessionId']!==this['_getSessionId'](_0x2c8e4d);});}['addSelectionToContext'](_0x354112){this['chatContext']['addSelectionToContext'](_0x354112);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x50900d){this['chatContext']['addFilesToContext'](_0x50900d);}['addUrlToContext'](_0x268ec8){this['chatContext']['addUrlToContext'](_0x268ec8);}['addToolItemToContext'](_0x38640c){this['chatContext']['addToolItemToContext'](_0x38640c);}['addResourceToContext'](_0x317045,_0x35ac7b){this['chatContext']['addResourceToContext'](_0x317045,_0x35ac7b);}['loadSourceResources'](_0x173665,_0xba0c36,_0x5e63d6){return this['chatContext']['loadSourceResources'](_0x173665,_0xba0c36,_0x5e63d6);}['removeFromContext'](_0xf2d8f7){this['chatContext']['removeFromContext'](_0xf2d8f7);}['setWebSearch'](_0x4af8ba){this['chatCapabilities']['setWebSearch'](_0x4af8ba);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x2db72f){this['chatCapabilities']['setReasoning'](_0x2db72f);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x2b91bb){_0x2b91bb?!0x1===await this['chatModels']['isAvailable'](_0x2b91bb)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x2b91bb}),_0x2b91bb=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x2b91bb=(await this['chatModels']['getAvailableModels']())[0x0]),_0x2b91bb['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x2b91bb,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x2b91bb}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x5fc96a,config:_0x2f1644,locale:_0x1275b3}){super(),this['_connector']=_0x5fc96a,this['_config']=_0x2f1644,this['_locale']=_0x1275b3;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x2f21ba=await this['getAll']();let _0x2a47f2;return _0x2a47f2=this['_availableModels']?this['_filterModels'](_0x2f21ba,this['_availableModels']):_0x2f21ba['filter'](_0x1d11fd=>_0x1d11fd['recommended']),_0x2a47f2;}async['getModel'](_0x540e9f){const _0x3416ff=await this['getAll']();if(!_0x3416ff['length'])return null;if(_0x540e9f){const _0xccbe43=this['_getModelById'](_0x3416ff,_0x540e9f);if(_0xccbe43)return _0xccbe43;wt('ai-chat-model-id-unrecognized',{'modelId':_0x540e9f,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x4569eb=await this['getAvailableModels']();if(!_0x4569eb['length'])return null;if(this['_defaultModelId']){const _0x16140b=this['_getModelById'](_0x4569eb,this['_defaultModelId']);if(_0x16140b)return _0x16140b;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x4569eb[0x0]['id']});}return _0x4569eb[0x0];}async['isAvailable'](_0x176f94){return(await this['getAvailableModels']())['some'](_0x2afc38=>_0x2afc38['name']===_0x176f94['name']&&_0x2afc38['provider']===_0x176f94['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x64a474=this['_locale']['uiLanguage']||'en',_0x52b882=this['_connector']['getModels'](_0x64a474),_0x53764e=await _0x52b882['list']();this['_modelList']=_0x53764e['items']['map'](_0x2783ae=>Cs(_0x2783ae)?{..._0x2783ae,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x2783ae);}catch(_0x3a980b){throw Ct('ai-models-unable-to-retrieve',{'error':_0x3a980b}),_0x3a980b;}return[...this['_modelList']];}['_filterModels'](_0x543be1,_0x346db7){let _0x11b2ff;if(_0x346db7){_0x11b2ff=[];const _0x12a548=new Set(),_0x129ed7='string'==typeof _0x346db7?[_0x346db7['toLocaleLowerCase']()]:_0x346db7['map'](_0x21441d=>_0x21441d['toLocaleLowerCase']());for(const _0x54e82b of _0x129ed7)for(const _0x577517 of _0x543be1)!_0x12a548['has'](_0x577517['id'])&&this['_isMatchingFilter'](_0x577517,_0x54e82b)&&(_0x11b2ff['push'](_0x577517),_0x12a548['add'](_0x577517['id']));}else _0x11b2ff=_0x543be1;return _0x11b2ff;}['_isMatchingFilter'](_0x245133,_0xc1af32){const _0x2b5575=_0x245133['id']['toLocaleLowerCase'](),_0x37e9c2=_0x245133['name']['toLocaleLowerCase'](),_0xfeeb11=_0x245133['provider']['toLocaleLowerCase']();return _0x2b5575===_0xc1af32||_0x37e9c2===_0xc1af32||Cs(_0x245133)&&'auto'===_0xc1af32||_0xfeeb11===_0xc1af32||_0x2b5575['startsWith'](_0xc1af32);}['_getModelById'](_0x5512ca,_0xa442b2){return _0x5512ca['find'](_0x1c5a5d=>Cs(_0x1c5a5d)&&'auto'===_0xa442b2?_0x1c5a5d:_0x1c5a5d['id']===_0xa442b2)||null;}}function Cs(_0x4800a7){return _0x4800a7['id']['startsWith']('agent');}function ms(_0x3364c3){return _0x3364c3?_0x3364c3 instanceof _0x3c7507?[_0x3364c3]:_0x3364c3['editors']&&0x0!==_0x3364c3['editors']['length']?Array['from'](_0x3364c3['editors']):[]:[];}function ps(_0x4f65a2){const _0x53edf6=ms(_0x4f65a2);if(!_0x53edf6['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x53edf6['length'])return _0x53edf6[0x0];const _0x31f2f9=_0x53edf6['find'](_0xbe0ee6=>_0xbe0ee6['ui']?.['focusTracker']?.['isFocused']);if(_0x31f2f9)return _0x31f2f9;const _0x3e4829=function(_0x53baca){if(_0x53baca instanceof _0x3c7507)return;const _0x4a7b72=_0x53baca;if(!_0x4a7b72['plugins']||!_0x4a7b72['plugins']['has']('AIEditing'))return;const _0x343e7b=_0x4a7b72['plugins']['get']('AIEditing');return _0x343e7b['getLastContentFocusedEditor']?.();}(_0x4f65a2);return _0x3e4829&&_0x53edf6['includes'](_0x3e4829)?_0x3e4829:_0x53edf6[0x0];}function Es({interaction:_0xf1b9c8,reply:_0x50a5c5,groups:_0x199863,transform:_0x38a7ea,documentCompare:_0x1fcf3a,documentCompareOptions:_0x1d9548}){const _0x1530d2=_0xf1b9c8['getDocumentContext']()['documents']['find'](_0x201d54=>_0x201d54['id']==_0x199863[0x0]['documentId']),_0x291367=_0x199863[0x0]['editor'];if(!_0x1530d2)return[];const _0x1d145c=_0x1530d2['content'],_0x154080=_0x1530d2['version'],_0x2b3b1a=_0x50a5c5['documentContextContent']['get'](_0x199863[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x3da18}of _0x199863){const _0x278bd1=_0x3da18['filter'](_0x12793c=>'new'!=_0x12793c['type'])['map'](_0x3e69e3=>Yi('data-id',_0x3e69e3['id'],_0x2b3b1a)),_0x570a42=_0x3da18['filter'](_0x8782aa=>'removed'!=_0x8782aa['type'])['map'](_0x52ae5e=>_0x52ae5e['node']['cloneNode'](!0x0));let _0x5b21c6=null;if(_0x278bd1['length']){_0x5b21c6=_0x278bd1[0x0]['previousSibling'];for(let _0x528c9f=0x0;_0x528c9f<_0x278bd1['length'];_0x528c9f++)_0x1221fe(_0x278bd1[_0x528c9f]);}if(_0x570a42['length']){_0x5b21c6||(_0x3da18[0x0]['anchorId']?_0x5b21c6=Yi('data-id',_0x3da18[0x0]['anchorId'],_0x2b3b1a):(_0x5b21c6=_0x570a42['shift'](),_0x102c31(_0x2b3b1a,_0x5b21c6)));for(let _0x3d7aa1=0x0;_0x3d7aa1<_0x570a42['length'];_0x3d7aa1++)_0x249093(_0x5b21c6,_0x570a42[_0x3d7aa1]),_0x5b21c6=_0x570a42[_0x3d7aa1];}}const _0x15d253=Ki(_0x2b3b1a),_0x2b38d4=_0x1fcf3a['getDiff'](_0x1d145c,_0x15d253,{'targetEditor':_0x291367,..._0x1d9548})['getOperations']();if(_0x38a7ea){const _0x5186d4=_0x291367['model']['document']['history']['getOperations'](_0x154080),_0x182d11={'document':_0x291367['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x4fc222(_0x2b38d4,_0x5186d4,_0x182d11)['operationsA'];}return _0x2b38d4;}function Ts(_0x138a99,_0x5686f8){if('marker'!=_0x5686f8['type'])return;const _0x3ea932=_0x138a99['model']['markers']['get'](_0x5686f8['name']);_0x3ea932&&(_0x5686f8['oldRange']=_0x3ea932['getRange']());}function fs(_0xa0696e,_0x1a45e4){if(_0xa0696e['files']['length']>0x0&&_0x1a45e4['filesEnabled']){const _0xb4f09d=_0xa0696e['files']['filter'](_0x5a3c13=>_0x5a3c13['name']);return _0xb4f09d['length']>0x0?{'type':'file','files':_0xb4f09d}:null;}if(_0x1a45e4['urlsEnabled']){const _0x38ada1=function(_0x3de742){const _0x3c2f49=_0x3de742['trim']();if(/\s/['test'](_0x3c2f49))return null;try{const _0x4770ed=new URL(_0x3c2f49);return'http:'!==_0x4770ed['protocol']&&'https:'!==_0x4770ed['protocol']?null:_0x4770ed['toString']();}catch{return null;}}(_0xa0696e['plainText']);if(_0x38ada1)return{'type':'url','url':_0x38ada1};}const _0x606e=_0xa0696e['forceTextAttachment']?0x1:_0x1a45e4['longTextThreshold']??0x1/0x0;if(_0xa0696e['plainText']['length']>=Math['max'](_0x606e,0x1)&&_0x1a45e4['filesEnabled']){const _0x7c006=_0x1a45e4['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0xa0696e['plainText']],_0x7c006,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x179c1c{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x5e3d64];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x5e7080=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x2ee961,_0x5a86d6)=>{this['_handleUIUserMessage']({'message':_0x5a86d6});}),this['listenTo'](_0x5e7080['view'],'change:activeTab',(_0x2f9e72,_0x540f4e,_0x2a7462)=>{'chat'!==_0x2a7462&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x874922,_0x170568)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x170568));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x504e99,_0x9cec2d)=>{this['activeConversation']?.['addUrlToContext'](_0x9cec2d);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x13e188,_0x3da820)=>{const _0x4b3378=this['activeConversation'];if(!_0x4b3378)return;_0x3da820['hasDirectory']&&(_0x3da820['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0xe6b0a7=fs(_0x3da820,{'pastedTextLabel':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0xe6b0a7&&(_0x3da820['preventDefault'](),'url'===_0xe6b0a7['type']?_0x4b3378['addUrlToContext'](_0xe6b0a7['url']):_0x4b3378['chatContext']['addFilesToContext'](_0xe6b0a7['files'],void 0x0,_0xe6b0a7['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x366ea3,_0x27ad2e)=>{_0x27ad2e['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x22ac80,_0x3c821b)=>{this['activeConversation']?.['addResourceToContext'](_0x3c821b['source'],_0x3c821b['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x3e5f3e,_0x2a3dc4)=>{this['_removeFromContext'](_0x2a3dc4);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x3ca0e0,_0x1b6a3f)=>{this['activeConversation']?.['loadSourceResources'](_0x1b6a3f['sourceId'],_0x1b6a3f['query'],_0x1b6a3f['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x13e20f,_0x80b5b3)=>{this['activeConversation']?.['setModel'](_0x80b5b3);}),this['listenTo'](this['_aiChatUi'],'like',(_0x579e20,{replyId:_0x1aef9b})=>{console['log']('Liked\x20response',_0x1aef9b);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x5e9128,{replyId:_0x5720f7})=>{console['log']('Disliked\x20response',_0x5720f7);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x547f22,_0x5135c3)=>{this['_insertSuggestion'](_0x5135c3);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x40b3f4,{replyId:_0x1fa46c,partIndex:_0x15db2c})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x1fa46c,_0x15db2c);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x1127ba,{replyId:_0x9322f,partIndex:_0x3a2cd8})=>{const _0x8701cf=this['_getDocumentRangeForReplyChanges'](_0x9322f,_0x3a2cd8);if(!_0x8701cf)return;const {reply:_0x546117}=this['getInteractionAndReplyById'](_0x9322f);'$graveyard'!=_0x8701cf['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x546117['changeGroups'][_0x3a2cd8]['editor'],'ranges':[_0x8701cf['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x36a63c,_0x45b086)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x45b086);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x2946b4,{replyId:_0x199264,showDiff:_0x5a4148})=>{const {interaction:_0x2c04d7,reply:_0x39ab2d}=this['getInteractionAndReplyById'](_0x199264),_0x461b09=_0x39ab2d['getContentParts']({'showDiff':_0x5a4148});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x2c04d7['id']+':'+_0x39ab2d['id'],'parts':_0x461b09});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x355449,{replyId:_0x4722c0,partIndex:_0x17fb82})=>{this['_rejectSuggestion']({'replyId':_0x4722c0,'partIndex':_0x17fb82}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x9df2d7,_0x98d0ec)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x98d0ec);}),this['on']('replyCreated',(_0x501ac2,_0x563a5c)=>{this['_addFeedItemReply'](_0x563a5c);});}['afterInit'](){this['context']instanceof _0x3c7507?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5c4fd9,_0x3b436d)=>{_0x3b436d['on']('ready',()=>{this['_integrateEditor'](_0x3b436d);});}),this['_initConversation']();}async['_initConversation'](){const _0x11330a=this['context']['config']['get']('ai.chat.initialConversation');let _0x51a2d5=_0x11330a;('lastCreated'!=_0x11330a||(_0x51a2d5=await this['_getLastCreatedConversationId'](),_0x51a2d5))&&('new'==_0x51a2d5?await this['_startConversationSafely']():await this['loadConversation'](_0x51a2d5));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0xee0cda){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0xee0cda)['getConversation'](),await this['_startConversationSafely']({'id':_0xee0cda}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0xee0cda),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0xfa00f0){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0xee0cda}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0xfa00f0}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x4566a2){let _0x61cc89=null,_0x4aa0e6=null;this['on']('toolDataReceived',(_0x1f18a8,_0x366ca7,_0x10ef25)=>{_0x10ef25['id']!==_0x61cc89&&(_0x61cc89=_0x10ef25['id'],_0x4aa0e6=this['_getAIChatFeedAPI'](_0x10ef25)),_0x4566a2(_0x366ca7,_0x4aa0e6);});}['addCurrentDocumentToChatContext'](){ms(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x48da11){const _0x1287b6=this['_aiEditing']['getSelectionText'](_0x48da11);this['activeConversation']?.['addSelectionToContext'](_0x1287b6),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x53934b){await this['_startConversationSafely']({'modelId':_0x53934b?.['modelId']});}async['sendMessage'](_0x491ed9){await this['_handleUIUserMessage'](_0x491ed9);}['getGroupId'](){const _0x448e1b=this['context']['config']['get']('collaboration.channelId');if(!_0x448e1b)throw new ht('ai-missing-channel-id',this);return _0x448e1b;}['_handleRemovedConversation'](_0x1f25c0){this['activeConversation']['id']===_0x1f25c0&&this['_startConversationSafely']();}['_insertSuggestion'](_0x17287c){const _0x223805=this['context']['plugins']['get'](_0x5e3d64),{reply:_0x1a2572,interaction:_0xd8f487}=this['getInteractionAndReplyById'](_0x17287c['replyId']),_0x708d52=void 0x0!==_0x17287c['partIndex']?[_0x1a2572['changeGroups'][_0x17287c['partIndex']]]:_0x1a2572['changeGroups']['filter'](_0x6e9f17=>'pending'==_0x6e9f17['state']);_0x708d52['map'](_0x578259=>_0x1a2572['changeGroups']['indexOf'](_0x578259))['forEach'](_0x2b88f2=>{const _0x54467c=this['_getDocumentRangeForReplyChanges'](_0x17287c['replyId'],_0x2b88f2);_0x54467c&&'$graveyard'!=_0x54467c['range']['root']['rootName']?(_0x1a2572['setChangeGroupState'](_0x2b88f2,'accepted'),void 0x0!==_0x17287c['partIndex']&&this['_scrollToSuggestionRange'](_0x54467c['range'],!0x1,_0x54467c['targetEditor'])):_0x1a2572['setChangeGroupState'](_0x2b88f2,'outdated');});const _0x3ce8b1={},_0x23a90c=_0x708d52['reduce']((_0x32964f,_0x52988b)=>('outdated'===_0x52988b['state']||(_0x32964f[_0x52988b['documentId']]=[..._0x32964f[_0x52988b['documentId']]||[],_0x52988b],_0x3ce8b1[_0x52988b['documentId']]=[..._0x3ce8b1[_0x52988b['documentId']]||[],_0x1a2572['changeGroups']['indexOf'](_0x52988b)]),_0x32964f),{});for(const [_0x259e4c,_0x251d63]of Object['entries'](_0x23a90c)){const _0x565c02=_0x251d63[0x0]['editor'];if(!_0x565c02['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x565c02});continue;}const _0x4b5950=Es({'reply':_0x1a2572,'interaction':_0xd8f487,'groups':_0x251d63,'transform':!0x0,'documentCompare':_0x223805,'documentCompareOptions':{'anchor':_0x251d63[0x0]['rootName'],'markDeletions':!0x0}});let _0x553207;_0x565c02['model']['change'](_0x4213a2=>{_0x553207=_0x4213a2['batch'],_0x565c02['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4b5950),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x553207,{'interactionId':_0xd8f487['id'],'replyId':_0x1a2572['id'],'indexes':_0x3ce8b1[_0x259e4c]});}this['_updateRatings'](_0x1a2572);}['_applySuggestion'](_0x3abb50){const _0x9004bc=this['context']['plugins']['get'](_0x5e3d64),{reply:_0x451520,interaction:_0x50d6c3}=this['getInteractionAndReplyById'](_0x3abb50['replyId']),_0x25cdc0=void 0x0!==_0x3abb50['partIndex']?[_0x451520['changeGroups'][_0x3abb50['partIndex']]]:_0x451520['changeGroups']['filter'](_0x55ebad=>'pending'==_0x55ebad['state']);_0x25cdc0['map'](_0x2ec136=>_0x451520['changeGroups']['indexOf'](_0x2ec136))['forEach'](_0x548606=>{const _0x38dbb5=this['_getDocumentRangeForReplyChanges'](_0x3abb50['replyId'],_0x548606);_0x38dbb5&&'$graveyard'!=_0x38dbb5['range']['root']['rootName']?(_0x451520['setChangeGroupState'](_0x548606,'accepted'),void 0x0!==_0x3abb50['partIndex']&&this['_scrollToSuggestionRange'](_0x38dbb5['range'],!0x1,_0x38dbb5['targetEditor'])):_0x451520['setChangeGroupState'](_0x548606,'outdated');});const _0x236b29={},_0x24ec74=_0x25cdc0['reduce']((_0x4f840e,_0xfa3ae8)=>('outdated'===_0xfa3ae8['state']||(_0x4f840e[_0xfa3ae8['documentId']]=[..._0x4f840e[_0xfa3ae8['documentId']]||[],_0xfa3ae8],_0x236b29[_0xfa3ae8['documentId']]=[..._0x236b29[_0xfa3ae8['documentId']]||[],_0x451520['changeGroups']['indexOf'](_0xfa3ae8)]),_0x4f840e),{});for(const [_0x573573,_0x25f627]of Object['entries'](_0x24ec74)){const _0xae2473=Es({'reply':_0x451520,'interaction':_0x50d6c3,'groups':_0x25f627,'transform':!0x0,'documentCompare':_0x9004bc,'documentCompareOptions':{'anchor':_0x25f627[0x0]['rootName'],'markDeletions':!0x1}});let _0x19b297;const _0x19c9a1=_0x25f627[0x0]['editor'];_0x19c9a1['model']['change'](_0x33e5e3=>{_0x19b297=_0x33e5e3['batch'];for(const _0x504d19 of _0xae2473)_0x504d19['baseVersion']=_0x19c9a1['model']['document']['version'],Ts(_0x19c9a1,_0x504d19),_0x33e5e3['batch']['addOperation'](_0x504d19),_0x19c9a1['model']['applyOperation'](_0x504d19);}),this['_batchToChanges']['set'](_0x19b297,{'interactionId':_0x50d6c3['id'],'replyId':_0x451520['id'],'indexes':_0x236b29[_0x573573]});}this['_updateRatings'](_0x451520);}['_rejectSuggestion'](_0x30a7a6){const {reply:_0x3fb3a6}=this['getInteractionAndReplyById'](_0x30a7a6['replyId']);_0x3fb3a6['setChangeGroupState'](_0x30a7a6['partIndex'],'rejected');}['_openBalloonFor'](_0x131fb8,_0x4650d9){if(!this['_hasAIChatBalloon'])return;const {reply:_0xa2d866}=this['getInteractionAndReplyById'](_0x131fb8),_0x5d1096=_0xa2d866['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x5d1096['length'])return;let _0x2daaee,_0x164fb5;if(void 0x0!==_0x4650d9?(_0x164fb5=_0x5d1096['find'](_0x273633=>_0x273633['index']==_0x4650d9),_0x2daaee=_0x164fb5?.['index']):(_0x164fb5=_0x5d1096[0x0],_0x2daaee=_0x164fb5['index']),!_0x164fb5)return void _0xa2d866['setChangeGroupState'](_0x4650d9??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x131fb8&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2daaee)return;const _0x478e0f=this['_getUserPresentableContentPartDocumentRange'](_0x131fb8,_0xa2d866,_0x164fb5),_0x5e246b=_0xa2d866['changeGroups']['find'](_0x5a2dbe=>_0x5a2dbe['index']==_0x2daaee)['editor'],_0x14ae6c=_0x5e246b['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x14ae6c&&this['_activeBalloon']['close'](),!_0x478e0f)return _0x14ae6c['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x14ae6c,this['_currentPreviewedChangeGroup']={'replyId':_0x131fb8,'partIndex':_0x2daaee},this['_scrollToSuggestionRange'](_0x478e0f,!0x0,_0x5e246b);const _0x4a38a4=this['_getPresentableSiblingContentPartIndex'](_0x131fb8,_0x2daaee,'next');_0x14ae6c['clearContent'](),_0x14ae6c['updateContent']({'part':_0x164fb5,'renderingStrategy':'static'}),_0x14ae6c['open']({'index':_0x2daaee,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x2daaee+0x1)['toString']()),'showRotator':null!==_0x4a38a4,'ranges':[_0x478e0f],'areActionsDisabled':_0xa2d866['areActionsDisabled'],'targetEditor':_0x5e246b}),_0x14ae6c['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x131fb8,_0x2daaee),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x131fb8,'index':_0x2daaee,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x27319e,_0x292a09,_0x3c1f75){const {reply:_0x1d953a}=this['getInteractionAndReplyById'](_0x27319e),_0x3cc1e0=_0x1d953a['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x3cc1e0['length'])return null;const _0x4efe00='next'==_0x3c1f75?0x1:-0x1;function _0x4eaa86(_0x576744){const _0x3a3f69=(_0x576744+_0x4efe00+_0x3cc1e0['length'])%_0x3cc1e0['length'];return{'siblingIndex':_0x3a3f69,'siblingPart':_0x3cc1e0[_0x3a3f69]};}const _0x14e04a=_0x3cc1e0['findIndex'](_0x2aba5c=>_0x2aba5c['index']==_0x292a09);let {siblingIndex:_0x4eccf1,siblingPart:_0x486b04}=_0x4eaa86(_0x14e04a);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x27319e,_0x1d953a,_0x486b04);)if({siblingIndex:_0x4eccf1,siblingPart:_0x486b04}=_0x4eaa86(_0x4eccf1),_0x4eccf1===_0x14e04a)return null;return _0x486b04['index'];}['_getUserPresentableContentPartDocumentRange'](_0x72f52b,_0x168d43,_0x1e40f0){const _0xa28351=_0x168d43['changeGroups'];if(!_0x1e40f0['hasChanges'])return null;const _0x23770f=_0xa28351['find'](_0x89f358=>_0x89f358['index']==_0x1e40f0['index']);if('pending'!==_0x23770f?.['state'])return null;if('destroyed'===_0x23770f?.['editor']['state'])return _0x168d43['setChangeGroupState'](_0x1e40f0['index'],'outdated'),null;const _0x4be10d=this['_getDocumentRangeForReplyChanges'](_0x72f52b,_0x1e40f0['index']);if(!_0x4be10d)return _0x168d43['setChangeGroupState'](_0x1e40f0['index'],'outdated'),null;const {range:_0x1a7faa,currentIndex:_0xe465c4}=_0x4be10d;return'$graveyard'==_0x1a7faa['root']['rootName']?(_0x168d43['setChangeGroupState'](_0xe465c4,'outdated'),null):_0x4be10d['range'];}['_getDocumentRangeForReplyChanges'](_0x33811d,_0x4e0611){const {reply:_0x396c3b,interaction:_0x32c56d}=this['getInteractionAndReplyById'](_0x33811d),_0x46af4f=_0x396c3b['changeGroups']['filter'](_0x3283f3=>'pending'==_0x3283f3['state']),_0x2aa28a=_0x46af4f['map'](_0x212c18=>_0x396c3b['changeGroups']['indexOf'](_0x212c18));void 0x0===_0x4e0611&&(_0x4e0611=_0x2aa28a[0x0]);const _0x848d75=_0x2aa28a['indexOf'](_0x4e0611);if(-0x1==_0x848d75)return null;const _0x38c68a=_0x46af4f[_0x848d75],_0x593627=_0x38c68a['editor'];if('destroyed'===_0x593627['state'])return null;const _0x198a48=_0x396c3b['documentContextContent']['get'](_0x38c68a['documentId']),_0x3ed231=new _0x1d2d6f([]),_0x4cf7ca=new _0x1d2d6f([]);for(const _0x1860ed of _0x38c68a['changes'])if('removed'!=_0x1860ed['type']&&_0x4cf7ca['children']['push'](_0x1860ed['node']['cloneNode'](!0x0)),'new'!=_0x1860ed['type']){const _0x48c171=_0x47014d(_0x13efd6=>Xi(_0x13efd6,'data-id')==_0x1860ed['id'],_0x198a48,!0x0);_0x3ed231['children']['push'](_0x48c171['cloneNode'](!0x0));}if(0x0==_0x3ed231['children']['length']){if(_0x38c68a['changes'][0x0]['anchorId']){const _0x1dfce7=Yi('data-id',_0x38c68a['changes'][0x0]['anchorId'],_0x198a48);_0x3ed231['children']['unshift'](_0x1dfce7['cloneNode'](!0x0)),_0x4cf7ca['children']['unshift'](_0x1dfce7['cloneNode'](!0x0)),_0x1dfce7['nextSibling']&&(_0x3ed231['children']['push'](_0x1dfce7['nextSibling']['cloneNode'](!0x0)),_0x4cf7ca['children']['push'](_0x1dfce7['nextSibling']['cloneNode'](!0x0)));}else{const _0x81c209=_0x198a48['children'][0x0];if(!_0x81c209)return null;_0x3ed231['children']['push'](_0x81c209['cloneNode'](!0x0)),_0x4cf7ca['children']['push'](_0x81c209['cloneNode'](!0x0));}}const _0x3d0f16=_0x32c56d['getDocumentContext'](),_0x11db03=_0x3d0f16['content']||_0x3d0f16['documents']['find'](_0x373365=>_0x373365['id']==_0x38c68a['documentId'])['content'],_0x2a6f48=_0x593627['model']['document']['getRoot'](_0x38c68a['rootName']),_0x3602bc=_0x593627['data']['parse'](_0x11db03,_0x2a6f48),_0x33c21a=Ki(_0x3ed231),_0x3cd99b=_0x593627['data']['parse'](_0x33c21a,_0x2a6f48),_0x5d7855=_0x593627['data']['parse'](_0x33c21a,_0x2a6f48),_0x5dacb4=_0x593627['model']['createPositionAt'](_0x3cd99b,0x0),_0x4f18b1=Ki(_0x4cf7ca),_0x708a38={'targetEditor':_0x593627,'anchor':_0x5dacb4,'markDeletions':!0x1},_0x5bf1ec=_0x593627['plugins']['get'](_0x5e3d64)['getDiff'](_0x33c21a,_0x4f18b1,_0x708a38)['getOperations']();if(!_0x5bf1ec['length'])return null;_0x593627['model']['change'](_0xf86987=>{for(const _0x41f9a0 of _0x5bf1ec)if('remove'==_0x41f9a0['type']){const _0x46f8c3=_0x41f9a0['sourcePosition'],_0x1327b7=_0x41f9a0['howMany'],_0x2ca7cf=new _0x1ff4a8(_0x46f8c3,_0x1327b7);_0xf86987['batch']['addOperation'](_0x2ca7cf),_0x593627['model']['applyOperation'](_0x2ca7cf);}else'marker'!==_0x41f9a0['type']&&(_0x41f9a0['baseVersion']=null,_0x41f9a0['isDocumentOperation']=!0x1,_0xf86987['batch']['addOperation'](_0x41f9a0),_0x593627['model']['applyOperation'](_0x41f9a0));});const _0x84b961=cs(_0x593627,_0x5bf1ec,_0x3cd99b);us(_0x593627['model'],_0x84b961);const _0x5d0f5c=_0x84b961['getFirstRange']()['start']['path']['slice'](),_0x1b49a4=_0x84b961['getFirstRange']()['end']['path']['slice'](),_0x5c48d9=[];let _0x4aa981=_0x3cd99b,_0x5ae600=_0x5d7855;for(let _0x1fc3cc=0x0;_0x1fc3cc<_0x1b49a4['length'];_0x1fc3cc++){const _0xbb4c18=_0x4aa981['maxOffset']-_0x1b49a4[_0x1fc3cc];_0x5c48d9[_0x1fc3cc]=_0x5ae600['maxOffset']-_0xbb4c18,_0x4aa981=_0x4aa981['getChildAtOffset'](_0x1b49a4[_0x1fc3cc]),_0x5ae600=_0x5ae600['getChildAtOffset'](_0x5c48d9[_0x1fc3cc]);}const _0x2d6fe0=_0x593627['model']['createRange'](_0x593627['model']['createPositionFromPath'](_0x5d7855,_0x5d0f5c),_0x593627['model']['createPositionFromPath'](_0x5d7855,_0x5c48d9)),_0x18e251=_0x5d7855['getChild'](0x0)['getAttribute'](_0x352880),_0x41e531=Array['from'](_0x3602bc['getChildren']())['find'](_0x215d84=>_0x215d84['getAttribute'](_0x352880)==_0x18e251)['getPath'](),_0x42b1ea=_0x2d6fe0['start']['path']['slice'](),_0x4f4ac3=_0x2d6fe0['end']['path']['slice']();_0x42b1ea[0x0]=_0x41e531[0x0]+_0x42b1ea[0x0],_0x4f4ac3[0x0]=_0x41e531[0x0]+_0x4f4ac3[0x0];let _0x27242d=_0x593627['model']['createRange'](_0x593627['model']['createPositionFromPath'](_0x593627['model']['document']['getRoot'](_0x38c68a['rootName']),_0x42b1ea),_0x593627['model']['createPositionFromPath'](_0x593627['model']['document']['getRoot'](_0x38c68a['rootName']),_0x4f4ac3));const _0xbe5d79=_0x3d0f16['documents']['find'](_0x2d2feb=>_0x2d2feb['id']==_0x38c68a['documentId'])['version'],_0x9c9503=_0x593627['model']['document']['history']['getOperations'](_0xbe5d79);for(const _0x5f4d05 of _0x9c9503)_0x27242d=_0x533258['_createFromRanges'](_0x27242d['getTransformedByOperation'](_0x5f4d05));return{'range':_0x27242d,'currentIndex':_0x4e0611,'targetEditor':_0x593627};}['_integrateEditorBalloon'](_0x20c284){if(!_0x20c284['plugins']['has']('AIChatBalloon'))return;const _0x4fb872=_0x20c284['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x4fb872['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x4fb872,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x3916a3,partIndex:_0x43b442}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x278c3e}=this['getInteractionAndReplyById'](_0x3916a3),_0x586f88=_0x278c3e['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x43b442});_0x4fb872['updateContent']({'part':_0x586f88[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x4fb872,'applySuggestion',()=>{const {replyId:_0x52ae73,partIndex:_0xd18346}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x52ae73,'partIndex':_0xd18346}),_0x4fb872['setState']('accepted');}),this['listenTo'](_0x4fb872,'insertSuggestion',()=>{const {replyId:_0x5ae729,partIndex:_0x443c0a}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x5ae729,'partIndex':_0x443c0a}),_0x4fb872['setState']('accepted');}),this['listenTo'](_0x4fb872,'rejectSuggestion',()=>{const {replyId:_0x26de7d,partIndex:_0x56daf6}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x26de7d,'partIndex':_0x56daf6}),_0x4fb872['setState']('rejected');}),this['listenTo'](_0x4fb872,'showNext',()=>{const {replyId:_0x2ce218,partIndex:_0xdea93e}=this['_currentPreviewedChangeGroup'],_0x174b82=this['_getPresentableSiblingContentPartIndex'](_0x2ce218,_0xdea93e,'next');null!==_0x174b82&&this['_openBalloonFor'](_0x2ce218,_0x174b82);}),this['listenTo'](_0x4fb872,'showPrevious',()=>{const {replyId:_0x308cfe,partIndex:_0x14a2e5}=this['_currentPreviewedChangeGroup'],_0x21f248=this['_getPresentableSiblingContentPartIndex'](_0x308cfe,_0x14a2e5,'previous');null!==_0x21f248&&this['_openBalloonFor'](_0x308cfe,_0x21f248);}),this['listenTo'](_0x4fb872,'dialogClosed',(_0x52a535,{id:_0x40da6c})=>{if('aiChatBalloon'!==_0x40da6c)return;const {replyId:_0x308344,partIndex:_0xbee361}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x308344,'index':_0xbee361,'isActive':!0x1}),this['_activeBalloon']===_0x4fb872&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x305a54){if(this['_channelsToEditors']['set'](_0x305a54['config']['get']('collaboration.channelId'),_0x305a54),this['_integrateEditorBalloon'](_0x305a54),this['addCurrentDocumentToChatContext'](),_0x305a54['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x305a54['plugins']['has']('Undo')){const _0x306c78=_0x305a54['commands']['get']('undo'),_0x30b142=_0x305a54['commands']['get']('redo');this['listenTo'](_0x306c78,'revert',(_0x15f653,_0x3ec855,_0xb07517)=>{const _0x327a52=this['_batchToChanges']['get'](_0x3ec855);if(!_0x327a52)return;const _0x406d3e=this['activeConversation']['getInteraction'](_0x327a52['interactionId']),_0x257c4b=_0x406d3e?.['getReply'](_0x327a52['replyId']);this['_batchToChanges']['delete'](_0x3ec855),_0x406d3e&&_0x257c4b&&(_0x327a52['indexes']['forEach'](_0x3ed9fc=>_0x257c4b['setChangeGroupState'](_0x3ed9fc,'pending')),this['_batchToChanges']['set'](_0xb07517,_0x327a52));}),this['listenTo'](_0x30b142,'revert',(_0x5899d2,_0x18ac5c,_0x44888e)=>{const _0x13f944=this['_batchToChanges']['get'](_0x18ac5c);if(!_0x13f944)return;const _0x36a089=this['activeConversation']['getInteraction'](_0x13f944['interactionId']),_0x1bdaaa=_0x36a089?.['getReply'](_0x13f944['replyId']);this['_batchToChanges']['delete'](_0x18ac5c),_0x36a089&&_0x1bdaaa&&(_0x13f944['indexes']['forEach'](_0x5a0ead=>_0x1bdaaa['setChangeGroupState'](_0x5a0ead,'accepted')),this['_batchToChanges']['set'](_0x44888e,_0x13f944));});}const _0x1f0563=_0x305a54['config']['get']('ai.chat.context');_0x1f0563['alwaysAddSelection']&&_0x1f0563['document']['enabled']&&this['listenTo'](_0x305a54['model']['document']['selection'],'change:range',(_0x129e15,_0x2be3d5)=>{if(!_0x2be3d5['directChange'])return;'chat'===_0x305a54['plugins']['get']('AITabs')['view']['activeTab']&&(_0x305a54['model']['hasContent'](_0x305a54['model']['document']['selection'])?this['addSelectionToChatContext'](_0x305a54):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x3f1267=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x201e18=await _0x3f1267['getConversations']();return _0x201e18['length']?_0x201e18[0x0]['id']:'new';}catch(_0xaf1b45){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0xaf1b45})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x204044={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x204044);}catch(_0x11f95d){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x204044['id']||at()}),console['error'](_0x11f95d),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x568766,modelId:_0x4de9ff}={}){this['_closeActiveBalloon']();let _0x27b087=_0x4de9ff;_0x27b087||(_0x568766||!this['activeConversation']?_0x27b087=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x27b087=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x26c739=this['getGroupId'](),_0x2ad18d=_0x568766||at();let _0x34be3a;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x27b087,'conversationId':_0x2ad18d,'group':_0x26c739,'locale':this['context']['locale'],'isFromHistory':!!_0x568766,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x483087=>this['_aiEditing']['getSessionId'](_0x483087)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x395e50,_0xda3504)=>{this['_aiChatUi']['createConversation'](_0xda3504),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x568766||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x562325,_0x285a9e)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x285a9e['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x497125=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x497125);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x3b9133=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x3b9133);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x4c1b04,_0x4fb89a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x4fb89a,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x15afde,_0x5557c7)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x5557c7,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['listenTo'](this['activeConversation'],'interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['listenTo'](this['activeConversation'],'interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['listenTo'](this['activeConversation'],'interactionDestroyed',(_0x283d16,_0xdf5469)=>{this['_aiChatUi']['removeFeedInteraction'](_0xdf5469['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x1173fd,_0x33116e,_0x5e5368)=>{this['_updateConversationTitle'](_0x33116e,_0x5e5368);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x5bd2d2,_0x458bf5)=>{void 0x0!==_0x34be3a&&_0x34be3a!==_0x458bf5['id']&&this['_updateReplyContentThrottled']['flush'](),_0x34be3a=_0x458bf5['id'],_0x458bf5['isFromHistory']?await this['_updateReplyContent']({'reply':_0x458bf5}):await this['_updateReplyContentThrottled']({'reply':_0x458bf5});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0xadc4ff,{reply:_0x1218cf,index:_0x13a3bc,state:_0x5b96c6})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x1218cf['id'],'index':_0x13a3bc,'state':_0x5b96c6}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x1218cf['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x13a3bc&&this['_activeBalloon']?.['setState'](_0x5b96c6);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x3843bb,_0x225724)=>{if(this['_aiChatUi']['addContextItem'](_0x225724['contextItem'],_0x225724['isLoading']),'selection'===_0x225724['contextItem']['type']){const _0x521ece=ps(this['context']),_0xa76991=[..._0x521ece['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x521ece,'ranges':_0xa76991,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x2006fe,_0x91674)=>{this['_aiChatUi']['removeContextItem'](_0x91674['uiId']),'current-document'==_0x91674['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x91674['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x405ed5,_0x2fd344)=>{this['_aiChatUi']['setContextItemLoading'](_0x2fd344['contextItem']['uiId'],_0x2fd344['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x3598fd,_0x1aaead)=>{this['_aiChatUi']['setConversationContext'](_0x1aaead['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x438603,_0x4b7aa0)=>{this['_aiChatUi']['setAddContextOptions'](_0x4b7aa0['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0xd795b1,_0x43b220)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x43b220['sourceId'],_0x43b220['source'],_0x43b220['resources'],_0x43b220['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x1e44f4,_0x431aad)=>{this['_aiChatUi']['updateResourceState'](_0x431aad['sourceId'],_0x431aad['resourceId'],_0x431aad['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x35543b,_0x187d8e)=>{this['_aiChatUi']['updateCapabilities'](_0x187d8e);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x356602,_0x78a379)=>{const _0x1481ef=(await this['_aiChatModels']['getAll']())['find'](_0x21ee3d=>_0x21ee3d['id']===_0x78a379['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x1481ef,_0x78a379['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x3bbb23,{error:_0x508027,interactionId:_0x209508,fileName:_0x410248,url:_0x30c985,sourceId:_0x960e65,sourceLabel:_0xf50e7a})=>{const _0x1bb72d=_0x209508?_0x209508+':'+at():at();_0x508027['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x1bb72d}):_0x508027['message']['startsWith']('ai-chat-conversation-init-failed')||_0x508027['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x410248),'id':_0x1bb72d}):_0x508027['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x30c985),'id':_0x1bb72d}):_0x508027['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x1bb72d}):_0x508027['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x1bb72d}):_0x508027['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x960e65&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x960e65),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0xf50e7a||'source'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x1bb72d}),this['_logError'](_0x508027)):_0x508027['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x1bb72d}),this['_logError'](_0x508027)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x1bb72d}),this['_logError'](_0x508027));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x568766||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x13113e,attributes:_0x1fb813}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x72b561=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x72b561);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x13113e,'attributes':_0x1fb813});}['_logError'](_0x2d71c0){Ct(_0x2d71c0['message'],_0x2d71c0['data']);}['_removeFromContext'](_0x371973){this['activeConversation']?.['removeFromContext'](_0x371973);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x5f10a6){const [_0x139e51,_0x3e9390]=_0x5f10a6['split'](':'),_0x4893cf=this['activeConversation']['getInteraction'](_0x139e51),_0x14be60=_0x4893cf['getReply'](_0x3e9390);return{'interaction':_0x4893cf,'reply':_0x14be60};}['_scrollToSuggestionRange'](_0x38ba37,_0x5dd0b1=!0x1,_0x5f30f4){const _0x15a247={'target':_0x5f30f4['editing']['view']['domConverter']['viewRangeToDom'](_0x5f30f4['editing']['mapper']['toViewRange'](_0x38ba37)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x5dd0b1};_0x5dd0b1&&(_0x15a247['alignToTop']=!0x0),Tt(_0x15a247);}['_updateConversationTitle'](_0x193258,_0xed051=!0x1){this['_aiChatUi']['setConversationTitle'](_0x193258||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0xed051);}['_addFeedItemReply'](_0x5a339c){'text'===_0x5a339c['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x5a339c):this['_aiChatUi']['addFeedItemAISuggestion'](_0x5a339c);}async['_updateReplyContent']({reply:_0x140cc8,renderingStrategy:_0x242eaa}){const {id:_0x185646,interactionId:_0x123cab,isDone:_0x126ef6,type:_0x1efa1a,parsedContent:_0x407180}=_0x140cc8,_0x33d250=_0x123cab+':'+_0x185646;if('modification'===_0x1efa1a){const _0x1456a8=_0x140cc8['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x33d250,'parts':_0x1456a8,'isDone':_0x126ef6,'skipLoadingEffects':_0x140cc8['isFromHistory']});}else'text'===_0x1efa1a&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x33d250,'parsedContent':_0x407180['get']('text'),'renderingStrategy':_0x242eaa,'isDone':_0x126ef6});_0x126ef6&&_0x140cc8['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x33d250,_0x140cc8['sources']);}['_updateReplyContentThrottled']=_0x35b1e7(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x59e4c5=this['activeConversation']?.['lastInteraction'];_0x59e4c5&&(_0x59e4c5['stop'](),this['_aiChatUi']['stopInteraction'](_0x59e4c5)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x41d4a0=this['activeConversation']?.['lastInteraction'];if(_0x41d4a0){for await(const _0xa738f6 of _0x41d4a0['replies'])this['_aiChatUi']['hasFeedItem'](_0xa738f6['id'])||this['_addFeedItemReply'](_0xa738f6),await this['_updateReplyContent']({'reply':_0xa738f6,'renderingStrategy':'static'});}}['_updateRatings'](_0x2b4206){const _0x5a577e={'positiveCount':_0x2b4206['changeGroups']['filter'](_0x3565dc=>'accepted'===_0x3565dc['state'])['length'],'totalCount':_0x2b4206['changeGroups']['length'],'modificationId':_0x2b4206['id']},_0x30cdd9=this['activeConversation']['getInteraction'](_0x2b4206['interactionId'])['messageId'];_0x30cdd9&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x30cdd9,_0x5a577e);}['_getAIChatFeedAPI'](_0x5099a4){const _0x376566=this['_aiChatUi'],_0x59ff24=()=>{_0x5099a4['resetWebSearchState'](),_0x5099a4['resetReasoningState'](),_0x376566['clearLoadingMessage']();},_0x589c26=()=>{_0x5099a4['currentReply']&&(_0x5099a4['currentReply']['done'](),_0x5099a4['currentReply']=void 0x0);};return{'insertTextReply':(_0xe8777,_0x1b9ef8)=>{_0x589c26(),_0x59ff24();const _0x3743ea=_0x5099a4['currentReply']=_0x5099a4['createReply']({'type':'text','interactionId':_0x5099a4['id'],'id':_0x1b9ef8||at(),'channelsToEditors':this['_channelsToEditors']});return _0x3743ea['appendContent'](_0xe8777),_0x589c26(),_0x3743ea;},'insertCustomElement':async(_0x3c7a72,_0x1cb7a4)=>(_0x589c26(),_0x59ff24(),_0x376566['addFeedItemCustomElement'](_0x3c7a72,_0x1cb7a4||at())),'setLoadingMessage':_0x37849d=>{_0x376566['setLoadingMessage'](_0x37849d);},'clearLoadingMessage':()=>{_0x376566['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ms(this['context'])['find'](_0x491dcf=>'destroyed'!==_0x491dcf['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const Rs='ai-selection',bs=['br'];class AIEditing extends _0x179c1c{constructor(_0x7f6aae){super(_0x7f6aae),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x2d65c3){let _0x14eabd=this['_sessionIdByEditor']['get'](_0x2d65c3);return!_0x14eabd&&(_0x14eabd=_0x2d65c3['plugins']['has']('RealTimeCollaborationClient')&&_0x2d65c3['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x2d65c3,_0x14eabd)),_0x14eabd;}async['getDocumentData'](){const _0x5ac705=ms(this['context']);if(!_0x5ac705['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x4051e=[],_0x41b8f7=new Set();for(const _0x4e7292 of _0x5ac705){const _0x4e32bc=_0x4e7292['config']['get']('roots')||{};for(const _0x1caff8 of _0x4e7292['model']['document']['getRoots']()){if('$graveyard'===_0x1caff8['rootName'])continue;const _0x1c7625=await this['_getDocumentDataForEditorRoot'](_0x4e7292,_0x1caff8,_0x41b8f7),_0x26493f=_0x4e32bc[_0x1caff8['rootName']];let _0x417c8a;_0x26493f?.['label']?_0x417c8a=_0x26493f['label']:(wt('ai-document-root-missing-label',{'editor':_0x4e7292,'rootConfig':_0x26493f}),_0x417c8a=_0x1caff8['rootName']),_0x4051e['push']({'editor':_0x4e7292,'rootName':_0x1caff8['rootName'],'content':_0x1c7625['content'],'version':_0x1c7625['version'],'sessionId':this['getSessionId'](_0x4e7292),'channelId':_0x4e7292['config']['get']('collaboration.channelId'),'selections':_0x1c7625['selections'],'name':_0x417c8a,'description':_0x26493f?.['description']});}}return _0x4051e;}async['_getDocumentDataForEditorRoot'](_0x175b0d,_0x3851be,_0x17fe8c){const _0x4389e6=_0x175b0d['data']['toView'](_0x3851be,{'convertAiChatSelectionMarker':!0x0}),_0x197a84=new _0x3a40d4(_0x175b0d['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4389e6,_0x197a84,_0x17fe8c);let _0x11a341=await this['_getDocumentDataStringFromView'](_0x4389e6,_0x175b0d);const _0x4d9243=this['_getMarkersInDocumentOrder'](_0x175b0d,_0x3851be),_0x54cf43=[];for(const _0x2f434b of _0x4d9243){const _0x65c743='<'+_0x2f434b['name']+':start></'+_0x2f434b['name']+':start>',_0x1b9016=_0x11a341['indexOf'](_0x65c743);_0x11a341=_0x11a341['substring'](0x0,_0x1b9016)+_0x11a341['substring'](_0x1b9016+_0x65c743['length']);const _0x2b41fa='<'+_0x2f434b['name']+':end></'+_0x2f434b['name']+':end>',_0x4607e3=_0x11a341['indexOf'](_0x2b41fa);_0x11a341=_0x11a341['substring'](0x0,_0x4607e3)+_0x11a341['substring'](_0x4607e3+_0x2b41fa['length']),_0x54cf43['push']({'markerName':_0x2f434b['name'],'start':_0x1b9016,'end':_0x4607e3,'htmlFragment':_0x11a341['substring'](_0x1b9016,_0x4607e3)});}return{'content':_0x11a341,'version':_0x175b0d['model']['document']['version'],'selections':_0x54cf43};}['afterInit'](){this['context']instanceof _0x3c7507?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x4db440,_0xb3ed6d)=>{_0xb3ed6d['on']('ready',()=>{this['_integrateEditor'](_0xb3ed6d);});});}['_setOutputDataProcessor'](_0x22799f){this['_outputDataProcessor']=_0x22799f;}async['_getDocumentDataStringFromView'](_0x2370ab,_0xb777cc){let _0x4ae29b;if(this['_outputDataProcessor']){const _0x34a069=_0xb777cc['data']['processor']['domConverter']['viewToDom'](_0x2370ab),_0x24f0e5=await this['_outputDataProcessor'](_0x34a069);_0x4ae29b=_0xb777cc['data']['processor']['htmlWriter']['getHtml'](_0x24f0e5);}else _0x4ae29b=_0xb777cc['data']['processor']['toData'](_0x2370ab);return _0x4ae29b;}['_integrateEditor'](_0x37de1d){if(!_0x37de1d['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x37de1d);_0x37de1d['ui']['focusTracker']['on']('change:isFocused',(_0x421ced,_0x5349e8,_0x4167fc)=>{_0x4167fc&&(this['_lastContentFocusedEditor']=_0x37de1d);}),_0x37de1d['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x37de1d&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x37de1d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Rs,'view':({markerName:_0x6a7676})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x6a7676['split'](':')[0x1]],'priority':0xc})}),_0x37de1d['conversion']['for']('dataDowncast')['markerToElement']({'model':Rs+':context','view':(_0x44891c,{writer:_0x4dc809,options:_0x4282fd})=>_0x4282fd['convertAiChatSelectionMarker']?_0x4dc809['createUIElement'](_0x44891c['markerName']+':'+(_0x44891c['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x568067){const _0x30e182=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x568067);const _0xf1cba4=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x30e182,_0xf1cba4);}['hideFakeVisualSelection'](_0x3c526f){const _0x558b14=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x3c526f);const _0x479ee5=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x558b14,_0x479ee5);}async['modelToDataWithIds'](_0x4588a5,_0x56cc72){const _0x14c913=_0x56cc72['data']['toView'](_0x4588a5),_0x390e56=new _0x3a40d4(_0x56cc72['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x14c913,_0x390e56),this['_getDocumentDataStringFromView'](_0x14c913,_0x56cc72);}['_setDataIdsOnChildren'](_0x98f0bd,_0x32b619,_0x5a99b8=new Set()){let _0x317a83=!0x1;for(const _0xe84235 of _0x98f0bd['getChildren']()){if(!_0xe84235['is']('view:element')||bs['includes'](_0xe84235['name']))continue;const _0x51a12b=_0xe84235['is']('view:containerElement'),_0x2820d2=_0xe84235['is']('view:emptyElement'),_0x19db3e=_0xe84235['is']('view:rawElement'),_0x194da2=this['_setDataIdsOnChildren'](_0xe84235,_0x32b619,_0x5a99b8);if(_0xe84235['hasAttribute']('data-id')){_0x317a83=!0x0,_0x5a99b8['add'](_0xe84235['getAttribute']('data-id'));continue;}(_0x51a12b||_0x2820d2||_0x19db3e||_0x194da2)&&(_0x32b619['setAttribute']('data-id',this['_nextDataId'](_0x5a99b8),_0xe84235),_0x317a83=!0x0);}return _0x317a83;}['_nextDataId'](_0x4d824e){let _0x2bbb38;do{_0x2bbb38='';for(let _0x19a17e=0x0;_0x19a17e<0x4;_0x19a17e++)_0x2bbb38+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x4d824e['has'](_0x2bbb38));return _0x4d824e['add'](_0x2bbb38),_0x2bbb38;}['getSelectionText'](_0x3457a9){const _0x5ae9fa=(_0x3457a9?_0x3457a9['model']:ps(this['context'])['model'])['document']['selection'],_0x474bc2=[],_0x278400=Array['from'](_0x5ae9fa['getRanges']());_0x278400['sort']((_0x292229,_0x5a8c7e)=>_0x292229['start']['isBefore'](_0x5a8c7e['start'])?-0x1:0x1);for(const _0xfc54d5 of _0x278400)for(const _0x7fa738 of _0xfc54d5['getItems']())_0x7fa738['is']('$textProxy')?_0x474bc2['push'](_0x7fa738['data']):_0x7fa738['is']('element')&&_0x474bc2['length']>0x0&&'\x20'!==_0x474bc2[_0x474bc2['length']-0x1]&&_0x474bc2['push']('\x20');return _0x474bc2['length']?'\x22'+_0x474bc2['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x512898){for(let _0x3c679f=0x0;_0x3c679f<this['_fakeSelections']['length'];_0x3c679f++)if(this['_fakeSelections'][_0x3c679f]['id']==_0x512898)return void this['_fakeSelections']['splice'](_0x3c679f,0x1);}['_addFakeSelection'](_0x35b3d2){this['_removeFakeSelectionById'](_0x35b3d2['id']),ft(this['_fakeSelections'],_0x35b3d2);}['_refreshFakeSelection'](_0x35661a,_0x5d7c9d){if(_0x35661a==_0x5d7c9d)return;const _0x4d7ce4=_0x35661a?_0x35661a['editor']:null,_0x29e660=_0x5d7c9d?_0x5d7c9d['editor']:null,_0x2b3a85=(_0xdeb2d4,_0x17a4d9)=>{const _0x4f2053=_0x17a4d9['model']['markers']['getMarkersGroup'](Rs);for(const _0x1b2d1a of _0x4f2053)_0xdeb2d4['removeMarker'](_0x1b2d1a);},_0x5ebe03=(_0x2847b8,_0x2d66da,_0x532494)=>{const _0x1e0900=_0x2d66da['model'];for(let _0x3795d5=0x0;_0x3795d5<_0x532494['ranges']['length'];_0x3795d5++){let _0x58dd35=_0x532494['ranges'][_0x3795d5];const _0x4a7b22=Rs+':'+_0x532494['id']+':'+_0x3795d5;if(_0x58dd35['start']['isAtEnd']){const _0x1cd6a9=_0x58dd35['start']['getLastMatchingPosition'](({item:_0x49499d})=>!_0x1e0900['schema']['isContent'](_0x49499d),{'boundaries':_0x58dd35});_0x58dd35=_0x2847b8['createRange'](_0x1cd6a9,_0x58dd35['end']);}_0x2847b8['addMarker'](_0x4a7b22,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x58dd35});}};_0x4d7ce4&&_0x29e660&&_0x4d7ce4===_0x29e660&&_0x5d7c9d?_0x4d7ce4['model']['change'](_0x21d217=>{_0x2b3a85(_0x21d217,_0x4d7ce4),_0x5ebe03(_0x21d217,_0x29e660,_0x5d7c9d);}):(_0x4d7ce4&&_0x4d7ce4['model']['change'](_0xe0f882=>_0x2b3a85(_0xe0f882,_0x4d7ce4)),_0x29e660&&_0x5d7c9d&&_0x29e660['model']['change'](_0x2a145d=>_0x5ebe03(_0x2a145d,_0x29e660,_0x5d7c9d)));}['_getMarkersInDocumentOrder'](_0x1249b9,_0x17be98){const _0x21f712=Array['from'](_0x1249b9['model']['markers']['getMarkersGroup'](Rs+':context'));return(_0x17be98?_0x21f712['filter'](_0x4f9218=>{const _0x543d80=_0x4f9218['getRange']();return _0x543d80&&_0x543d80['root']['rootName']===_0x17be98['rootName'];}):_0x21f712)['sort']((_0xe0e8f8,_0x103b8f)=>_0xe0e8f8['getStart']()['isBefore'](_0x103b8f['getStart']())?-0x1:_0xe0e8f8['getStart']()['isAfter'](_0x103b8f['getStart']())?0x1:0x0);}}const Ss=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Os=[...Ss,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function vs(_0x547591){const _0x294e81=new AbortController();return{'promise':new Promise((_0x5da4cf,_0x5cb5d0)=>{const _0x30cb90=setTimeout(_0x5da4cf,_0x547591);_0x294e81['signal']['addEventListener']('abort',()=>{clearTimeout(_0x30cb90),_0x5cb5d0();});}),'abortController':_0x294e81};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x43fc7e){this['options']={'delay':_0x43fc7e?.['delay']??0xa,'textNodeStyle':_0x43fc7e?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x1f88ed,targetElement:_0x57d96d,abortSignal:_0x365153}){this['isStreaming']&&this['stop'](),_0x365153?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x4382fa(_0x1f88ed,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x2ec4b3=0x0;_0x2ec4b3<this['currentIndex'];_0x2ec4b3++)this['nodesList'][_0x2ec4b3]['shouldBeStreamed']=!0x0;do{const _0x5182f6=Date['now'](),_0x1d2f51=this['nodesList'][this['currentIndex']],_0x4fef74=_0x5182f6-this['lastUpdateTime'];if(_0x1d2f51){_0x1d2f51['shouldBeStreamed']=!0x0;let _0x1c719c=_0x1d2f51['parent'];for(;_0x1c719c;)_0x1c719c['shouldBeStreamed']=!0x0,_0x1c719c=_0x1c719c['parent'];}if(_0x4fef74<this['options']['delay'])try{const {promise:_0x2d9d6c,abortController:_0x3160f9}=vs(this['options']['delay']-_0x4fef74);this['timeoutAbortController']=_0x3160f9,await _0x2d9d6c;}catch(_0x427b86){return;}_0x72a3b0(_0x57d96d,'<'+_0x57d96d['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x57d96d['tagName']+'>',{'childrenOnly':!0x0}),this['currentIndex']++,this['lastUpdateTime']=Date['now']();}while(this['currentIndex']<this['nodesList']['length']);this['currentIndex']=this['nodesList']['length'],this['isStreaming']=!0x1;}['reset'](){this['isStreaming']=!0x1,this['document']=null,this['nodesList']=[],this['currentIndex']=0x0,this['timeoutAbortController']=null;}['cleanUpAnimations']({targetElement:_0x1dd3e9}){Array['from'](_0x1dd3e9['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x1bd319=>{_0x1bd319['replaceWith'](_0x1bd319['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x1dca06){let _0x33b97d='';if(function(_0x1e82fc){return _0x3aeaad(_0x1e82fc);}(_0x1dca06)){for(const _0x18c6a1 of _0x1dca06['children'])_0x33b97d+=this['renderNode'](_0x18c6a1);}else{if(Ns(_0x1dca06)){if(!_0x1dca06['shouldBeStreamed'])return'';const _0x12ba6f=_0x1dca06,_0x545d1b=Object['entries'](_0x12ba6f['attribs'])['map'](([_0x2fbf82,_0x37846d])=>_0x2fbf82+'=\x22'+_0x37846d+'\x22')['join']('\x20');_0x33b97d+='<'+_0x12ba6f['tagName']+(_0x545d1b?'\x20'+_0x545d1b:'')+'>';for(const _0x510f6b of _0x381e7f(_0x12ba6f))_0x33b97d+=this['renderNode'](_0x510f6b);_0x33b97d+='</'+_0x12ba6f['tagName']+'>';}else{if(!ys(_0x1dca06))return'';if(!_0x1dca06['shouldBeStreamed'])return'';!function(_0x20eafc){if(!_0x20eafc['parent']||!Ns(_0x20eafc['parent']))return!0x1;if(!ks['includes'](_0x20eafc['parent']['tagName']))return!0x1;return!ti(_0x20eafc)['match'](/^\s*[<>]\s*$/);}(_0x1dca06)?_0x33b97d+=_0xb56587(_0x1dca06):_0x33b97d+=_0xb56587(new _0x3ea511('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x1dca06]));}}return _0x33b97d;}['getParsedDocumentNodeList'](){const _0x446f02=[];return function(_0x2a64dc,_0x583874){const _0x2c84b=_0x38d6b2=>{if(_0x583874(_0x38d6b2),_0x38d6b2 instanceof _0x3d283e)for(let _0x43e03b=0x0;_0x43e03b<_0x38d6b2['children']['length'];_0x43e03b++){const _0x573d2e=_0x38d6b2['children'][_0x43e03b];_0x2c84b(_0x573d2e);}};for(let _0x1760ad=0x0;_0x1760ad<_0x2a64dc['children']['length'];_0x1760ad++)_0x2c84b(_0x2a64dc['children'][_0x1760ad]);}(this['document'],_0x1aa163=>{if(ys(_0x1aa163)){const _0x4f6da6=this['splitTextNodeIntoWordNodes'](_0x1aa163);_0x4f6da6['length']&&_0x446f02['push'](..._0x4f6da6);}_0x1aa163['isWordSplitSource']||_0x1aa163['isWordSplitResult']||_0x446f02['push'](_0x1aa163);}),_0x446f02;}['splitTextNodeIntoWordNodes'](_0x38ba83){if(_0x38ba83['isWordSplitSource']||_0x38ba83['isWordSplitResult'])return[];const _0x1aae79=ti(_0x38ba83)['match'](/(?:\s*\S+\s*)/g),_0x547cce=[];if(_0x1aae79&&_0x1aae79['length']>0x1){for(const _0x5c4127 of _0x1aae79){const _0x5879fb=new _0x34224c(_0x5c4127);_0x5879fb['isWordSplitResult']=!0x0,_0x30dc49(_0x38ba83,_0x5879fb),_0x547cce['push'](_0x5879fb);}_0x38ba83['isWordSplitSource']=!0x0,_0x1221fe(_0x38ba83);}return _0x547cce;}}const ks=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ys(_0x19bb74){return _0x3bbec3(_0x19bb74);}function Ns(_0x539f62){return _0x25fe0f(_0x539f62);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x29070e){super();const _0x31364e=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x29070e,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x31364e['if']('isDone','ck-ai-chat__feed__item_done'),_0x31364e['if']('isVisible','ck-hidden',_0x355d6b=>!_0x355d6b),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x48328e=>{_0x48328e['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x2bfd95,_0x31b7b0,_0x5cf5bd){await this['htmlStreamer']['stream']({'document':_0x2bfd95,'targetElement':_0x31b7b0,'abortSignal':_0x5cf5bd});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x2401b0,_0x394ac0){super(_0x2401b0),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x2401b0),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x2401b0,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x394ac0['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x2de69b=>_0x2de69b?_0x40c492:_0x855da),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x1676a2=new Lt();_0x1676a2['content']=_0x4849ee,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x394ac0['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x1676a2,{'tag':'span','children':[Mi(_0x2401b0,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const xs={'accepted':_0x56f9ef,'rejected':_0x4b09ba,'outdated':_0x4b09ba};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x31895e){super(_0x31895e);const _0x40cd75=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x40cd75['to']('state',_0x39d1e6=>'ck-ai-suggestion__content-part-state_'+_0x39d1e6),_0x40cd75['if']('isVisible','ck-hidden',_0x365955=>!_0x365955)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x40cd75['to']('state',_0x17791c=>{switch(_0x17791c){case'accepted':return Mi(_0x31895e,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x31895e,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x31895e,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x406d35){this['state']=_0x406d35;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=xs[this['state']],this['on']('change:state',()=>{this['content']=xs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x8a5426,_0x1d0934,_0x260658){super(_0x8a5426);const _0x4739e2=Boolean(_0x260658);this['set']('isEnabled',!_0x4739e2),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x5bc9e2=[];if(_0x4739e2){const _0xf323da=new yt(_0x8a5426);_0xf323da['set']({'label':Mi(_0x8a5426,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2c1eeb}),_0xf323da['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x5bc9e2['push'](_0xf323da);}else{_0x1d0934['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x8a5426),this['_applyButton']['set']({'label':Mi(_0x8a5426,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x56f9ef}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x1fe88e=>!_0x1fe88e),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x5bc9e2['push'](this['_applyButton'])),_0x1d0934['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x8a5426),this['_suggestButton']['set']({'label':Mi(_0x8a5426,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xbe57e4}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x5bc9e2['push'](this['_suggestButton']));const _0x13baa1=new yt(_0x8a5426);_0x13baa1['set']({'label':Mi(_0x8a5426,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4b09ba}),_0x13baa1['bind']('isEnabled')['to'](this),_0x13baa1['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x5bc9e2['push'](_0x13baa1);}this['items']['addMany'](_0x5bc9e2);const _0x371958=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x371958['if']('isVisible','ck-hidden',_0x5569a9=>!_0x5569a9)]}});}['setButtonsVisibility']({showApplyButton:_0x8c410b,showSuggestButton:_0x48274f}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x8c410b),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x48274f);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x126f6e,{part:_0x2ae316,uiIndex:_0x481397,availableActions:_0x495486,areActionsDisabled:_0x7088f9}){super(_0x126f6e),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x126f6e,_0x495486,_0x7088f9),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x2ae316['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x2ae316['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x2ae316['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x126f6e),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x126f6e,_0x481397),this['children']=this['createCollection'](),this['children']['addMany']([this['titleLabelView'],this['toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-suggestion__body__content-part__title']},'children':this['children']}),this['on']('change:state',(_0x4f56f2,_0x533586,_0x36b464,_0x55c121)=>{'pending'===_0x55c121?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x36b464?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x36b464),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0xbc1b24,_0x3ae127){super(_0xbc1b24),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0xbc1b24,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x3ae127['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x5b9809){super(_0x5b9809),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x2f7332,renderingStrategy:_0x59b6e5,abortSignal:_0x2fe28f}){const _0x1d1a25=_0x4382fa(_0x2f7332['content'],!0x0);for(const _0x4a06ac of qi(_0x1d1a25))_0x1221fe(_0x4a06ac);'streaming'===_0x59b6e5?await this['htmlStreamer']['stream']({'document':_0x1d1a25,'targetElement':this['element'],'abortSignal':_0x2fe28f}):_0x72a3b0(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x1d1a25)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x196c81,{part:_0x5afbef,uiIndex:_0x21fcfc,areActionsDisabled:_0x10927f,availableActions:_0x3a2fc9}){super(_0x196c81);const _0x2b3768=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x4d0d76=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x10927f;};this['on']('change:state',_0x4d0d76),this['on']('change:isDone',_0x4d0d76),_0x4d0d76(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x196c81,{'part':_0x5afbef,'uiIndex':_0x21fcfc,'availableActions':_0x3a2fc9,'areActionsDisabled':_0x10927f}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Ss)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x196c81),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x2b3768['to']('state',_0x4a16e9=>'ck-ai-suggestion__body__content-part_'+_0x4a16e9),_0x2b3768['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x2b3768['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x2b3768['if']('isVisible','ck-hidden',_0x1d6f85=>!_0x1d6f85)]},'children':this['_children'],'on':{'mouseenter':_0x2b3768['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5afbef['index']});}),'mouseleave':_0x2b3768['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5afbef['index']});}),'click':_0x2b3768['to'](_0x816551=>{const _0x73852e=_0x816551['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x73852e)&&this['fire']('showChangeInText',{'index':_0x5afbef['index']});})}});}async['updateContent']({part:_0xe0d4a8,showUnchangedParts:_0x400dff=!0x1,abortSignal:_0xb0d9bb}){this['partDefinition']=_0xe0d4a8,this['isVisible']=this['partDefinition']['hasChanges']||_0x400dff,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0xe0d4a8,'renderingStrategy':'static','abortSignal':_0xb0d9bb});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x5b1384,_0x293d9c){super(_0x5b1384),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3ce705=>!_0x3ce705)]},'children':this['_createSkeletonItems'](_0x293d9c)});}['_createSkeletonItems'](_0x553e9e){const _0x3f6876=['ck','ck-ai-skeleton__item'];return _0x553e9e['map'](_0x15b591=>{let _0x3c3412='';switch(_0x15b591['attributes']['align']){case'right':_0x3c3412='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x3c3412='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x3c3412='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x15b591['tag'],'attributes':{'class':[..._0x3f6876,_0x15b591['attributes']['class']?_0x15b591['attributes']['class']:''],'style':'width:\x20'+_0x15b591['attributes']['width']+';\x20height:\x20'+_0x15b591['attributes']['height']+';'+_0x3c3412}};});}}const Ls={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Ps(0x5,'100%','44px','right'),'aiChatResources':Ps(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Ps(_0x3f03b1,_0x28e229,_0x1672b1,_0x2b6f14){return new Array(_0x3f03b1)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x28e229,'height':_0x1672b1,'align':_0x2b6f14}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x11e628){const _0x1477da=this['createTask'](_0x11e628);return this['queue']['push'](_0x1477da),this['_processQueue'](),_0x1477da['completePromise'];}['abort'](){this['isProcessing']&&(this['_abortController']['abort'](),this['_abortController']=void 0x0,this['queue']=[],this['fire']('_queueEmpty'),this['isProcessing']=!0x1);}get['queueEmptyPromise'](){return this['queue']['length']||this['isProcessing']?new Promise(_0x1c4ea6=>{this['once']('_queueEmpty',()=>{_0x1c4ea6();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x34eee3=this['queue']['shift']();try{await _0x34eee3['callback'](this['_abortController']['signal']),_0x34eee3['resolve']();}catch(_0x4e21f7){_0x34eee3['reject'](_0x4e21f7);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x2377a0){let _0x5c42ff,_0x543c0a;const _0x322393=new Promise((_0x24b50f,_0x5f29da)=>{_0x5c42ff=_0x24b50f,_0x543c0a=_0x5f29da;});return{'callback':_0x2377a0,'resolve':_0x5c42ff,'reject':_0x543c0a,'completePromise':_0x322393};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x437814){super(_0x437814),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x437814['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x2c91ef){this['element']['innerHTML']=_0x2c91ef;}}const Ds=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x347aff,_0x1b0f38=[...Ds],_0x2b221d){super(_0x347aff);const _0x26b114=this['bindTemplate'],_0x50c09b=Boolean(_0x2b221d);if(this['set']('isEnabled',!_0x50c09b),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x50c09b){const _0x3176ef=new yt(_0x347aff);_0x3176ef['set']({'label':Mi(_0x347aff,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2c1eeb}),_0x3176ef['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x2be021=new Nt(_0x347aff);_0x2be021['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x347aff,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x3176ef]}]}),this['children']['add'](_0x2be021);}else this['_applyChangesButton']=new yt(_0x347aff),this['_applyChangesButton']['set']({'label':Mi(_0x347aff,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1b0f38['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x347aff),this['_insertSuggestionsButton']['set']({'label':Mi(_0x347aff,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1b0f38['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0xf737a0=>{_0xf737a0['bind']('isEnabled')['to'](this);}),this['children']['addMany']([this['_applyChangesButton'],this['_insertSuggestionsButton']]);this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__ai-suggestion__actions',_0x26b114['if']('isVisible','ck-hidden',_0x49aabd=>!_0x49aabd)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x377687){this['isVisible']=_0x377687;}['_switchButtonLabelsPlurality'](_0x298b7d){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x298b7d?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x17da6b,_0x2b1fe2){super(_0x17da6b),this['bodyCollection']=_0x2b1fe2,this['children']=this['createCollection'](),this['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources',this['bindTemplate']['if']('isVisible','ck-hidden',_0x284355=>!_0x284355)]},'children':this['children']});const _0x9f5cf4=new Nt(this['locale']),_0x466823=new Lt();_0x466823['content']=_0x24eb32,_0x9f5cf4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x466823,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x9f5cf4),this['_setupBalloonPanel'](_0x17da6b);}['addSource'](_0x4de683){this['children']['add'](new AIWebSourceView(this['locale'],_0x4de683,this['balloonPanelView']));}['_setupBalloonPanel'](_0x2a223b){this['balloonPanelView']=new zt(_0x2a223b),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x34289c,_0x2e73e0,_0x378ca2){super(_0x34289c),this['source']=_0x2e73e0,this['balloonPanelView']=_0x378ca2,this['set']({'label':_0x2e73e0['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x3eccff=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x3eccff['to'](()=>{window['open'](_0x2e73e0['url'],'_blank');}),'mouseenter':_0x3eccff['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x3eccff['to'](()=>{this['_hideTooltip']();})}}),_0x2e73e0['favicon']){const _0x52da11=new Nt(_0x34289c);_0x52da11['setTemplate']({'tag':'img','attributes':{'src':_0x2e73e0['favicon']||_0x24eb32,'alt':_0x2e73e0['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x52da11);}else this['set']('icon',_0x24eb32);}['_createTooltipContentView'](_0x2320cd,_0x3d2d15){const _0x50d7d2=new Nt(_0x2320cd),_0x315c2e=[];let _0xe83d44;_0x3d2d15?.['favicon']?(_0xe83d44=new Nt(_0x2320cd),_0xe83d44['setTemplate']({'tag':'img','attributes':{'src':_0x3d2d15['favicon'],'alt':_0x3d2d15['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0xe83d44=new Lt(),_0xe83d44['content']=_0x24eb32,_0xe83d44['extendTemplate']({'attributes':{'alt':_0x3d2d15['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x315c2e['push'](_0xe83d44);const _0x368c4e=new Nt(_0x2320cd);_0x368c4e['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x3d2d15['url']},'children':[{'text':new URL(_0x3d2d15['url'])?.['hostname']}]}),_0x315c2e['push'](_0x368c4e);const _0x4e7507=new Nt(_0x2320cd);_0x4e7507['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x315c2e});const _0x270541=new Nt(_0x2320cd);return _0x270541['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x3d2d15['title']['length']>0x190?_0x3d2d15['title']['substring'](0x0,0x190)+'...':_0x3d2d15['title']}]}),_0x50d7d2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x4e7507,_0x270541]}),_0x50d7d2;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x26a21a=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x26a21a);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0xf959ba(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x1bfce3,_0x2ace55){super(_0x1bfce3);const {areActionsDisabled:_0x149615,showUnchangedParts:_0xc04c65,availableActions:_0xbd357b}=_0x2ace55;this['_areActionsDisabled']=_0x149615,this['_showUnchangedParts']=_0xc04c65,this['_availableActions']=_0xbd357b,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x1bfce3,Ls['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x1bfce3,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x1bfce3,_0x2ace55['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x2ace55['bodyCollection']),_0x2ace55['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Ss)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0x558576=>_0x558576 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x5ccafe,abortSignal:_0x37d8f8,skipLoadingEffects:_0x2fbc26}){this['_cachedContentParts']['length']?_0x5ccafe['forEach'](_0x5547d6=>{const _0x2f39f8=this['_cachedContentParts']['findIndex'](_0x5d4019=>_0x5d4019['index']==_0x5547d6['index']);-0x1===_0x2f39f8?this['_cachedContentParts']['push'](_0x5547d6):this['_cachedContentParts'][_0x2f39f8]=_0x5547d6;}):this['_cachedContentParts']=_0x5ccafe;const _0x518114=this['_showUnchangedParts']?_0x5ccafe:_0x5ccafe['filter'](_0x27fef3=>_0x27fef3['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x518114['length']>0x1),_0x2fbc26&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x23bd9f of _0x518114)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x2eed63=>{let _0x23f212=this['getPartView'](_0x23bd9f['index']);if(!_0x23f212){if(_0x23f212=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x23bd9f,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x23f212['delegate'](...Ss)['to'](this),_0x23f212['bind']('isTrackChangesOn')['to'](this),!_0x2fbc26&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x2eed63),_0x2eed63['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x23f212,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x2fbc26||this['_showSkeletonDebounced']();}await _0x23f212['updateContent']({'part':_0x23bd9f,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x2eed63}),_0x23f212['markAsDone']();});return _0x37d8f8?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x5476fd,_0x4c96be){const _0x355ca7=this['getPartView'](_0x5476fd);_0x355ca7&&(_0x355ca7['state']=_0x4c96be),this['hasPendingParts']='pending'==_0x4c96be||this['_contentPartViews']['some'](_0x3ede24=>'pending'==_0x3ede24['state']);}['setPartActive'](_0x41cdf7,_0x47ae0f){if(!0x1===_0x41cdf7){for(const _0x2e234d of this['_contentPartViews'])_0x2e234d['isActive']=!0x1;}else{const _0x51bb4a=this['getPartView'](_0x41cdf7);_0x51bb4a&&(_0x51bb4a['isActive']=_0x47ae0f);}}['updateSources'](_0x5e30d1){_0x5e30d1['forEach'](_0xbe9d10=>this['_sourcesView']['addSource'](_0xbe9d10)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x212cb6){return this['_contentPartViews']['find'](_0x123a71=>_0x123a71['partDefinition']['index']==_0x212cb6)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x4a4b77=!this['_cachedContentParts']['find'](({hasChanges:_0x51ba73})=>_0x51ba73),_0x2a7bf1=!!this['_cachedContentParts']['find'](({hasChanges:_0x16d0d2})=>!_0x16d0d2);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x2a7bf1,_0x4a4b77?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x575a3d=>_0x575a3d['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x4c4d81){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x508416=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x508416>0x0){const {promise:_0x266ec0,abortController:_0x327326}=vs(_0x508416);_0x4c4d81?.['addEventListener']('abort',()=>_0x327326['abort']()),await _0x266ec0['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0xe43e82=>_0xe43e82['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4cb9bc,_0x3b13f8,_0x3bda2f){super(_0x4cb9bc);const {showDiff:_0x21e51a,areActionsDisabled:_0x519bfd,showUnchangedParts:_0x4bd24d,availableActions:_0x5ea264}=_0x3b13f8;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4cb9bc,{'showDiff':_0x21e51a}),this['headerView']['on']('toggleShowChanges',(_0x3e4ccc,_0x28ec64)=>{this['areChangesVisible']=_0x28ec64['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x28ec64['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4cb9bc,{'areActionsDisabled':_0x519bfd,'showUnchangedParts':!!_0x4bd24d,'availableActions':_0x5ea264,'bodyCollection':_0x3bda2f}),this['bodyView']['delegate'](...Ss)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x5d6357){await this['bodyView']['updateContentParts'](_0x5d6357);}['updateSources'](_0x801684){this['bodyView']['updateSources'](_0x801684);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x856923,_0x220649,_0x5b0719){super(_0x220649),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x856923,{'showDiff':_0x220649['showDiff'],'areActionsDisabled':_0x220649['areActionsDisabled'],'availableActions':_0x220649['availableActions']},_0x5b0719),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x308a65,_0x30d635)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x30d635['showDiff']});}),this['containerView']['bind']('isTrackChangesOn')['to'](this),this['containerView']['on']('like',()=>{this['fire']('like',{'replyId':this['options']['id']});}),this['containerView']['on']('dislike',()=>{this['fire']('dislike',{'replyId':this['options']['id']});}),this['containerView']['on']('showChangeInText',(_0x31bd4f,{index:_0x251fe2})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x251fe2});}),this['containerView']['on']('applySuggestion',(_0x2e3823,{index:_0x569987}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x569987});}),this['containerView']['on']('insertSuggestion',(_0x38efdb,{index:_0xa0ac4c}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0xa0ac4c});}),this['containerView']['on']('rejectSuggestion',(_0x459519,{index:_0x20e543})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x20e543});}),this['containerView']['on']('mouseOverSuggestion',(_0x1421c2,{index:_0x588145})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x588145});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x554584,{index:_0x3f8263})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3f8263});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x30406f){await this['containerView']['updateContent'](_0x30406f);}['updatePartState'](_0x581cf0,_0x57649a){this['containerView']['bodyView']['updatePartState'](_0x581cf0,_0x57649a);}['setPartActive'](_0x27ecca,_0x4acdd4){!0x1===_0x27ecca?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x27ecca,_0x4acdd4);}['updateSources'](_0x15f97d){this['containerView']['updateSources'](_0x15f97d);}['getPartView'](_0x55f791){return this['containerView']['bodyView']['getPartView'](_0x55f791);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x55f445,_0x12ac9e,_0x48c108){super(_0x12ac9e),this['_bodyCollection']=_0x48c108,this['locale']=_0x55f445,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x44e2c7,renderingStrategy:_0x41c4b4,abortSignal:_0x2ace7f}){'streaming'===_0x41c4b4?await this['streamIntoElement'](_0x44e2c7,this['replyContainer']['element'],_0x2ace7f):this['replyContainer']['element']['innerHTML']=_0xb56587(_0x44e2c7);}['updateSources'](_0x3462e0){const _0x5a6d30=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x5a6d30['children']['addMany'](_0x3462e0['map'](_0x10af8d=>new AIWebSourceView(this['locale'],_0x10af8d,_0x5a6d30['balloonPanelView']))),_0x5a6d30['isVisible']=!0x0,this['children']['add'](_0x5a6d30);}}class AISpinnerView extends xt{constructor(_0x8e68b2=void 0x0){super();const _0x23c463=_0x8e68b2?'ck-ai-spinner_'+_0x8e68b2:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x23c463]}});}}const Vs={'file':_0x174ee1,'image':_0x5b6445,'document':_0x4849ee,'web-resource':_0x394fe8,'text':_0x174ee1,'selection':_0xf4ac81,'mcp-tool-context':_0x4849ee},Hs='ck-ai-chat-context-chip',Ms='ck-ai-chat-context-chip_wide',Us='ck-ai-chat-context-chip_document',Bs='ck-ai-chat-context-chip__label',Gs='ck-ai-chat-context-chip__type-icon',Fs='ck-ai-chat-context-controls__chip-tooltip',Ws='n';class AIChatContextItemButtonView extends yt{constructor(_0x27010b,_0x390560,_0x4904af,_0x45450a,_0x4d6054=!0x1){super(_0x27010b),this['_isAnimationOnEnterEnabled']=_0x45450a,this['_initializeProperties'](_0x390560,_0x4904af,_0x4d6054),this['_setupTemplate']();}['render'](){super['render'](),this['_isAnimationOnEnterEnabled']&&this['element']&&(this['element']['classList']['add']('ck-ai-chat-context-chip_new-chip'),this['_handleAnimationEndOnce'](this['element'],()=>{this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}));}['disableAnimationOnEnter'](){this['_isAnimationOnEnterEnabled']=!0x1,this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}['_initializeProperties'](_0x4a0524,_0x1610b6,_0x53d1ad){this['set']('label',_0x4a0524['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x4a0524['type']),this['set']('id',_0x4a0524['uiId']),this['set']('readonly',_0x1610b6),this['set']('isLoading',_0x53d1ad);}['_setupTemplate'](){const _0x4e1cd4=this['_createIconView'](),_0x2af53e=this['_createRemoveButton'](),_0x4bfbf1=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4bfbf1),'children':this['_createTemplateChildren'](_0x4e1cd4,_0x2af53e,_0x4bfbf1)});}['_createTemplateAttributes'](_0x476352){return{'class':[Hs,_0x476352['if']('itemType',Us,_0x4f4486=>'document'==_0x4f4486),_0x476352['if']('itemType',Ms,_0x34e2b8=>'selection'==_0x34e2b8)],'data-cke-tooltip-text':_0x476352['to']('label',Ks),'data-cke-tooltip-position':Ws,'data-cke-tooltip-class':Fs};}['_createTemplateChildren'](_0x116723,_0x464b20,_0x2dfe42){const _0x2c608a=this['_createLabelElement'](_0x2dfe42),_0x1ead91=this['_createLoaderIcon']();return this['readonly']?[_0x116723,_0x2c608a]:[_0x116723,_0x1ead91,_0x2c608a,_0x464b20];}['_createLabelElement'](_0x504205){return{'tag':'span','attributes':{'class':Bs},'children':[{'text':_0x504205['to']('label')}]};}['_createRemoveButton'](){const _0x40d811=new yt(this['locale']);return _0x40d811['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x386fc5}),this['_setupRemoveButtonEvent'](_0x40d811),_0x40d811;}['_setupRemoveButtonEvent'](_0x1a3ca2){_0x1a3ca2['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0xb588ef=this['bindTemplate'],_0x44baef=new Lt();return _0x44baef['content']=Vs[this['itemType']],_0x44baef['extendTemplate']({'attributes':{'class':[Gs,_0xb588ef['if']('isLoading','ck-hidden',_0x1de825=>_0x1de825)]}}),_0x44baef;}['_handleAnimationEndOnce'](_0x5a25e3,_0x4a3159){if(!_0x5a25e3)return;const _0x3e8553=()=>{_0x4a3159(),_0x5a25e3['removeEventListener']('animationend',_0x3e8553),_0x5a25e3['removeEventListener']('webkitAnimationEnd',_0x3e8553);};_0x5a25e3['addEventListener']('animationend',_0x3e8553),_0x5a25e3['addEventListener']('webkitAnimationEnd',_0x3e8553);}['_createLoaderIcon'](){const _0x31c41e=new AISpinnerView('small');return _0x31c41e['bind']('isVisible')['to'](this,'isLoading',_0x114a38=>_0x114a38),_0x31c41e;}}function Ks(_0x2abd00){if(!_0x2abd00)return _0x2abd00;if(_0x2abd00['length']<=0x78)return _0x2abd00;const _0x170e2b=_0x2abd00['slice'](0x0,0x78),_0x498021=_0x170e2b['lastIndexOf']('\x20');return(_0x498021>0x0?_0x170e2b['slice'](0x0,_0x498021):_0x170e2b)+'…';}const Ys={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},$s='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x4e8da2,_0xcb0d39,_0x61a56,_0x5ad384,_0x247c5d){this['_locale']=_0x4e8da2,this['_visibleChips']=_0xcb0d39,this['_config']={...Ys,..._0x61a56,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x61a56['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x5ad384,this['_parentView']=_0x247c5d||null;}['setContainerElement'](_0x595bdd){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x595bdd,this['_setupVisibilityObserver']();}get['showMoreButtonView'](){return this['_showMoreButtonView'];}get['overflowChips'](){return this['_overflowChips'];}['reorganizeChips'](){requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});}['showBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_updateBalloonContent'](),this['_showMoreButtonView']['isOn']=!0x0,this['_showMoreBalloonPanelView']['show'](),this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')}));}['hideBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_showMoreButtonView']['isOn']=!0x1,this['_showMoreBalloonPanelView']['hide']());}['clear'](){this['_overflowChips']['clear'](),this['hideBalloonPanel'](),this['_updateShowMoreButtonVisibility'](),this['_showMoreButtonView']&&(this['_showMoreButtonView']['label']=''),this['_showMoreBalloonPanelView']&&this['_showMoreBalloonPanelView']['content']['clear']();}['destroy'](){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_showMoreButtonView']&&(this['_showMoreButtonView']['destroy'](),this['_showMoreButtonView']=null),this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['destroy'](),this['_showMoreBalloonPanelView']=null);}['_checkAndHandleOverflow'](){if(!this['_containerElement'])return;if(!this['_isContainerVisible']())return void(this['_pendingCalculation']=!0x0);this['_pendingCalculation']=!0x1;const _0x423ce5=[...this['_visibleChips'],...this['_overflowChips']],_0x118c0e=this['_createCalculationContainer'](),_0x11e674=this['_calculateOverflowInContainer'](_0x118c0e,_0x423ce5),_0x557885=_0x118c0e['_ancestorsToRestore'];_0x557885&&this['_restoreAncestorVisibility'](_0x557885),_0x118c0e['remove'](),this['_applyOverflowResults'](_0x423ce5,_0x11e674);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0xece55=new yt(this['_locale']);_0xece55['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x2fa1d4=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x2fa1d4['push'](this['_config']['cssClasses']['controlsButton']),_0xece55['extendTemplate']({'attributes':{'class':_0x2fa1d4}}),_0xece55;}['_createShowMoreBalloonPanelView'](){const _0x19a6cf=new zt(this['_locale']);return _0x19a6cf['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x19a6cf),_0x19a6cf;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x373203=>{_0x373203['disableAnimationOnEnter']();});const _0x1dd76f=new Nt(this['_locale']);_0x1dd76f['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x1dd76f);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x1a505=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x1a505?'':'none');}['_repinBalloonPanel'](){this['_showMoreButtonView']?.['isOn']&&this['_showMoreBalloonPanelView']?.['isVisible']&&this['_showMoreButtonView']['element']&&this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')});}['_findTargetContainer'](_0x5379f1){const _0x161e30=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x12095a=this['_containerElement']?.['classList'];if(_0x12095a){const _0x239061=_0x12095a[0x0]||'',_0x481dfb=_0x5379f1['querySelector']('.'+_0x239061),_0x3f0973=_0x5379f1['querySelector'](_0x161e30);return _0x481dfb||_0x3f0973||_0x5379f1;}return _0x5379f1['querySelector'](_0x161e30)||_0x5379f1;}['_calculateContainerWidth'](){const _0xd0a5a6=this['_parentView']?.['element']||this['_containerElement'];if(!_0xd0a5a6)return $s;const _0x5e868e=window['getComputedStyle'](_0xd0a5a6)['width'];if('auto'===_0x5e868e||'0px'===_0x5e868e||!_0x5e868e){const _0xbf785a=_0xd0a5a6['parentElement'];if(_0xbf785a){const _0x36e680=window['getComputedStyle'](_0xbf785a);return'auto'!==_0x36e680['width']?_0x36e680['width']:$s;}return $s;}return _0x5e868e;}['_applyCalculationStyles'](_0x47d717,_0x2c45c1){this['_config']['cssClasses']['calculationContainer']&&_0x47d717['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x47d717['style']['width']=_0x2c45c1,_0x47d717['style']['position']='absolute',_0x47d717['style']['top']='-9999px',_0x47d717['style']['left']='-9999px',_0x47d717['style']['opacity']='0',_0x47d717['style']['pointerEvents']='none',_0x47d717['style']['zIndex']='-1',_0x47d717['style']['visibility']='visible\x20!important',_0x47d717['style']['display']='block\x20!important',_0x47d717['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0xdff342){_0xdff342['forEach'](({element:_0x5654ca,originalDisplay:_0x44cb36,originalVisibility:_0xc1a069})=>{_0x5654ca['style']['display']=_0x44cb36,_0x5654ca['style']['visibility']=_0xc1a069;});}['_makeAncestorsVisible'](_0x265d91){const _0x248412=[];let _0x3af0e2=_0x265d91;for(;_0x3af0e2&&_0x3af0e2!==document['body'];){const _0x3fbaa0=window['getComputedStyle'](_0x3af0e2);'none'!==_0x3fbaa0['display']&&'hidden'!==_0x3fbaa0['visibility']||(_0x248412['push']({'element':_0x3af0e2,'originalDisplay':_0x3af0e2['style']['display'],'originalVisibility':_0x3af0e2['style']['visibility']}),_0x3af0e2['style']['display']='block',_0x3af0e2['style']['visibility']='visible'),_0x3af0e2=_0x3af0e2['parentElement'];}return _0x248412;}['_createContainerElements'](){let _0x1c8d2e,_0xd4f902;return this['_parentView']?.['element']?(_0x1c8d2e=this['_parentView']['element']['cloneNode'](!0x0),_0xd4f902=this['_findTargetContainer'](_0x1c8d2e)):(_0x1c8d2e=document['createElement']('div'),_0xd4f902=_0x1c8d2e),{'calculationContainer':_0x1c8d2e,'targetContainer':_0xd4f902};}['_createCalculationContainer'](){const {calculationContainer:_0x4d2d1a,targetContainer:_0x3a2128}=this['_createContainerElements'](),_0x12a1e1=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x4d2d1a,_0x12a1e1);const _0x1f17ea=this['_parentView']?.['element']||this['_containerElement'],_0x5b5929=_0x1f17ea?.['parentElement'];_0x5b5929?_0x5b5929['appendChild'](_0x4d2d1a):document['body']['appendChild'](_0x4d2d1a),_0x4d2d1a['_targetContainer']=_0x3a2128;const _0x56e6de=this['_makeAncestorsVisible'](_0x5b5929||null);return _0x4d2d1a['offsetWidth'],_0x4d2d1a['_ancestorsToRestore']=_0x56e6de,_0x4d2d1a;}['_calculateOverflowInContainer'](_0x545118,_0x3fe884){const _0x4971b6=_0x545118['_targetContainer']||_0x545118,_0x2b0798=[],{rowCount:_0xad9e9c}=this['_renderChipsAndCountRows'](_0x4971b6,_0x3fe884);if(_0xad9e9c<=this['_config']['maxVisibleRows'])return _0x2b0798;const _0x404e44=_0x3fe884['slice']();for(;_0x404e44['length']>0x0;){if(this['_testButtonFit'](_0x545118,_0x4971b6,_0x404e44)){const _0xb3a897=_0x3fe884['filter'](_0x43da36=>!_0x404e44['includes'](_0x43da36));_0x2b0798['push'](..._0xb3a897);break;}if(!_0x404e44['pop']())break;}return _0x2b0798;}['_renderChipsAndCountRows'](_0xcb9741,_0x1b20f4){_0xcb9741['innerHTML']='',_0x1b20f4['forEach'](_0x1f27a3=>{if(_0x1f27a3['element']){const _0x119283=_0x1f27a3['element']['cloneNode'](!0x0);_0xcb9741['appendChild'](_0x119283);}}),_0xcb9741['offsetWidth'];const _0x41ae49=_0xcb9741['children'],_0x19d5a6=[];return Array['from'](_0x41ae49)['forEach'](_0x1321e2=>{const _0x1e2801=_0x1321e2['getBoundingClientRect']()['top'];_0x19d5a6['some'](_0x199343=>Math['abs'](_0x199343-_0x1e2801)<this['_config']['rowDetectionTolerance'])||_0x19d5a6['push'](_0x1e2801);}),{'rowCount':_0x19d5a6['length']};}['_createMockButton'](){const _0x519d48=document['createElement']('button');return _0x519d48['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x519d48['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x519d48['textContent']='+\x201',_0x519d48;}['_testButtonFit'](_0xd928a7,_0x4e5348,_0x52bb8e){this['_renderChipsAndCountRows'](_0x4e5348,_0x52bb8e);const _0x5cd961=this['_createMockButton']();_0xd928a7['appendChild'](_0x5cd961),_0xd928a7['offsetWidth'];const _0x57ef2a=[..._0x4e5348['children'],_0x5cd961],_0x1c3e2b=[];_0x57ef2a['forEach'](_0x16d475=>{const _0x43d4bd=_0x16d475['getBoundingClientRect']()['top'];_0x1c3e2b['some'](_0x957813=>Math['abs'](_0x957813-_0x43d4bd)<this['_config']['rowDetectionTolerance'])||_0x1c3e2b['push'](_0x43d4bd);});const _0x31aa4d=_0x1c3e2b['length'];return _0x5cd961['remove'](),_0x31aa4d<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x196e20,_0x5c089e){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x196e20['forEach'](_0x2208db=>{_0x5c089e['includes'](_0x2208db)?this['_overflowChips']['add'](_0x2208db):this['_visibleChips']['add'](_0x2208db);});}['_updateOverflowUI'](_0x4c7562){if(_0x4c7562>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x4c7562>0x0&&this['_showMoreButtonView']){const _0x3d1e42=''+this['_config']['showMoreLabelPrefix']+(_0x4c7562<0x63?_0x4c7562:'99');this['_showMoreButtonView']['label']=_0x3d1e42;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x5b40e9,_0x3208ec){this['_distributeChips'](_0x5b40e9,_0x3208ec),this['_updateOverflowUI'](_0x3208ec['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x44a31f=>{_0x44a31f[0x0]['isIntersecting']&&this['_pendingCalculation']&&requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});},{'threshold':0.01,'rootMargin':'50px'}),this['_intersectionObserver']['observe'](this['_containerElement']));}['_isContainerVisible'](){if(!this['_containerElement'])return!0x1;if(!this['_containerElement']['isConnected'])return!0x1;const _0x50ac4f=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x50ac4f['width']||0x0===_0x50ac4f['height'])return!0x1;const _0x545198=window['innerHeight']||document['documentElement']['clientHeight'],_0x185fc8=window['innerWidth']||document['documentElement']['clientWidth'],_0x35e9fa=0xc8;return _0x50ac4f['bottom']>=-0xc8&&_0x50ac4f['top']<=_0x545198+_0x35e9fa&&_0x50ac4f['right']>=-0xc8&&_0x50ac4f['left']<=_0x185fc8+_0x35e9fa;}}const qs='ck-ai-chat__feed__context-chips',Qs='ck-ai-chat-context-chips-wrapper',Xs='ck-ai-chat-context-chips-wrapper-balloon',zs='ck-ai-chat-controls-button',js='ck-ai-chat-controls_context_show-more-button',Js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x37db0a,_0x4f6a7b,_0x3f73e2){super(_0x37db0a),this['_bodyCollection']=_0x3f73e2,this['_createContextChips'](_0x4f6a7b);const _0x1ebba4={'cssClasses':{'showMoreButton':js+'\x20'+Gi,'showMoreBalloon':Js,'overflowContainer':Xs,'controlsButton':zs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x37db0a,this['_contextChips'],_0x1ebba4,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[qs,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x30df82=this['element']['querySelector']('.'+Qs);_0x30df82&&(this['_overflowManager']['setContainerElement'](_0x30df82),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x1cb555){for(const _0x536a68 of _0x1cb555){const _0xfb018d=new AIChatContextItemButtonView(this['locale'],_0x536a68,!0x0,!0x1);this['_contextChips']['add'](_0xfb018d);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x58811f,_0x5edaf0,_0x3f3152){super(_0x5edaf0),this['_locale']=_0x58811f,this['_bodyCollection']=_0x3f3152,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x358135=>!_0x358135['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x538062,_0x4c5e37){super(_0x4c5e37);const {isWebSearchEnabled:_0x2c77b7,isReasoningEnabled:_0x10b088}=_0x4c5e37['capabilities'],_0x29ff64=[];let _0x486b9f='';_0x2c77b7&&_0x10b088?(_0x486b9f=Mi(_0x538062,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x29ff64['push'](Zs(_0x24eb32)),_0x29ff64['push'](Zs(_0x285f1c))):_0x2c77b7?(_0x486b9f=Mi(_0x538062,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x29ff64['push'](Zs(_0x24eb32))):_0x10b088&&(_0x486b9f=Mi(_0x538062,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x29ff64['push'](Zs(_0x285f1c))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x486b9f?'':'ck-hidden']}});const _0x3c86ef=new Nt();_0x3c86ef['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x29ff64,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x486b9f]}]}),this['children']['add'](_0x3c86ef),this['capabilities']=_0x4c5e37['capabilities'];}}function Zs(_0x49c442){const _0x4550ea=new Lt();return _0x4550ea['content']=_0x49c442,_0x4550ea;}const tn=['wheel','touchstart','pointerdown','keydown'],en=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x295e86){this['element']=_0x295e86,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x1b8486 of tn){const _0x4564a2='keydown'!==_0x1b8486;this['element']['addEventListener'](_0x1b8486,this['_onUserEvent']['bind'](this),{'passive':_0x4564a2,'signal':this['abortController']['signal']});}}['start']({smooth:_0x1ba636=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x1ba636?'smooth':'auto',this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}['stop'](){requestAnimationFrame(()=>{this['_stop']();});}['destroy'](){this['_stop'](),this['abortController']['abort']();}['_stop'](){null!==this['animationFrameId']&&(cancelAnimationFrame(this['animationFrameId']),this['animationFrameId']=null),this['isRunning']&&(this['isRunning']=!0x1),this['isUserPaused']=!0x1;}['_onUserEvent'](_0x2de23c){if(this['isRunning']){if('keydown'===_0x2de23c['type']){const _0x26f5b1=_0x2de23c['key'];if(!en['includes'](_0x26f5b1))return;}_0x2de23c instanceof WheelEvent?_0x2de23c['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x3807cf,scrollHeight:_0x39e2d8,clientHeight:_0x16577c}=this['element'];return _0x39e2d8-_0x3807cf-_0x16577c<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0xfe5cd1){super(_0xfe5cd1),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x564723,_0x5f4096){super(_0x564723),this['_bodyCollection']=_0x5f4096,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Os)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x238861,_0x21b9b5){let _0x501151;return'ai-reply'===_0x238861?_0x501151=new AIChatFeedReplyItemView(this['locale'],_0x21b9b5,this['_bodyCollection']):'ai-suggestion-reply'===_0x238861?(_0x501151=new AIChatFeedSuggestionItemView(this['locale'],_0x21b9b5,this['_bodyCollection']),_0x501151['bind']('isTrackChangesOn')['to'](this)):_0x501151='user-message'===_0x238861?new AIChatFeedUserMessageItemView(this['locale'],_0x21b9b5,this['_bodyCollection']):'interaction-header'===_0x238861?new AIChatFeedInteractionHeaderView(this['locale'],_0x21b9b5):'custom-element'===_0x238861?new AIChatFeedCustomElementView(_0x21b9b5):new AIChatFeedErrorItemView(_0x21b9b5),this['children']['add'](_0x501151),_0x501151;}async['updateReplyItem']({id:_0x4b5165,parsedContent:_0x59787,renderingStrategy:_0xc48a79,abortSignal:_0x3b0f3f}){const _0x395199=this['getItemById'](_0x4b5165);if(!(_0x395199 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x395199,'id':_0x4b5165,'parsedContent':_0x59787});await _0x395199['updateContent']({'parsedContent':_0x59787,'renderingStrategy':_0xc48a79,'abortSignal':_0x3b0f3f});}async['updateWebSources'](_0x14e438,_0x1d56d3){const _0x4cff58=this['getItemById'](_0x14e438);if(_0x4cff58 instanceof AIChatFeedSuggestionItemView)_0x4cff58['updateSources'](_0x1d56d3);else{if(!(_0x4cff58 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x4cff58,'id':_0x14e438,'sources':_0x1d56d3});_0x4cff58['updateSources'](_0x1d56d3);}}async['updateSuggestionItem']({id:_0x474ddf,parts:_0x6dc4b7,abortSignal:_0xb48ab8,skipLoadingEffects:_0x2742c2}){const _0x5f45dd=this['getItemById'](_0x474ddf);if(!(_0x5f45dd instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x5f45dd,'id':_0x474ddf,'parts':_0x6dc4b7});await _0x5f45dd['updateContent']({'parts':_0x6dc4b7,'abortSignal':_0xb48ab8,'skipLoadingEffects':_0x2742c2});}['updateSuggestionPartState']({id:_0x2995f5,index:_0x53d004,state:_0x713bff}){const _0x345571=this['getItemById'](_0x2995f5);if(!(_0x345571 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x2995f5});_0x345571['updatePartState'](_0x53d004,_0x713bff);}['setSuggestionPartActive']({id:_0x2964de,index:_0x55c65e,isActive:_0x46f6f1}){const _0x75a2bd=this['getItemById'](_0x2964de);if(!(_0x75a2bd instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x2964de});this['children']['filter'](_0x4abe23=>_0x4abe23 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x445616=>{_0x445616['setPartActive'](!0x1);}),_0x75a2bd['setPartActive'](_0x55c65e,_0x46f6f1);}['markItemAsDone'](_0x431c52){this['getItemById'](_0x431c52)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x8d8c88=>_0x8d8c88['options']['id']);}['removeItem'](_0x5054e4){this['children']['remove'](this['getItemById'](_0x5054e4));}['hasItem'](_0x577336){return!!this['children']['find'](_0xc9d693=>_0xc9d693['options']['id']['includes'](_0x577336));}['scrollToSuggestion'](_0x429502,_0x1c23fb){const _0x126b20=this['getItemById'](_0x429502);if(!(_0x126b20 instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x429502,'partIndex':_0x1c23fb});const _0x44377f=_0x126b20['getPartView'](_0x1c23fb);_0x44377f?Rt(_0x44377f['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x429502,'partIndex':_0x1c23fb});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x200613=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x200613,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x388f22=new AISkeletonView(this['locale'],Ls['aiFeed']);return _0x388f22['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x388f22;}['_createFeedItems'](){const _0x1985cc=new Nt(this['locale']);return _0x1985cc['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1985cc;}['_createFeedLoader'](){const _0x13878a=new Nt(this['locale']);return _0x13878a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x1f8920=>!_0x1f8920)]},'children':this['_createLoaderChildren']()}),_0x13878a;}['_createLoaderChildren'](){const _0x236952=new AISpinnerView();return _0x236952['isVisible']=!0x0,[_0x236952,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x3ae1d7){const _0x3d6813=this['children']['find'](_0x3e6fcf=>_0x3e6fcf['options']['id']['includes'](_0x3ae1d7));if(!_0x3d6813)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x3ae1d7});return _0x3d6813;}['setLoadingMessage'](_0x5341b2){this['set']('loadingMessage',_0x5341b2);}['toggleLoadingSkeleton'](_0x1d6518){this['set']('isLoadingSkeletonVisible',_0x1d6518);}['startAutoScroll'](_0xe2d9dc={}){this['scrollManager']['start'](_0xe2d9dc);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x3d04f1=0x0;for(const _0x298465 of this['items'])_0x3d04f1+=_0x298465['items']['length'];return{'resultsCount':_0x3d04f1,'totalItemsCount':_0x3d04f1};}}function sn(_0x29c2df){const _0x4eeedf=[];let _0x5d3fa5=!0x1;for(const _0x4bbd51 of Array['from'](_0x29c2df['items'])){if('file'!==_0x4bbd51['kind'])continue;const _0x3a0292=_0x4bbd51['webkitGetAsEntry']();if(_0x3a0292?.['isDirectory']){_0x5d3fa5=!0x0;continue;}const _0x5d026d=_0x4bbd51['getAsFile']();_0x5d026d&&_0x4eeedf['push'](_0x5d026d);}return{'files':_0x4eeedf,'hasDirectory':_0x5d3fa5};}const nn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x477a5a,_0x2a856c){super(_0x477a5a,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x477a5a),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x2a856c,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=AIChatPromptInputView['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=AIChatPromptInputView['MAX_ROWS'],this['queryView']['fieldWrapperChildren']['add'](this['_addContextButtonView']),this['_setUpAddContextButtonPositioning'](),this['extendTemplate']({'attributes':{'class':['ck','ck-ai-chat__prompt-input']}}),this['submitButtonView']=this['_createSubmitButton'](),this['submitButtonView']['bind']('isEnabled')['to'](this,'isEmpty',this,'isUploadInProgress',(_0x18ac7,_0x381e1d)=>!_0x18ac7&&!_0x381e1d),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x3364ef,_0x2db1fb)=>{this['isUploadInProgress']||this['isEmpty']||_0x3364ef['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2db1fb());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x518c1f=>this['_handlePaste'](_0x518c1f)),this['element']['addEventListener']('drop',_0x2026cd=>this['_handleDrop'](_0x2026cd));}['_handlePaste'](_0x26ec40){const _0x1e652b=_0x26ec40['clipboardData'];if(!_0x1e652b)return;const {files:_0x15256b,hasDirectory:_0x5eeded}=sn(_0x1e652b),_0xebfa0a={'files':_0x15256b,'plainText':_0x1e652b['getData']('text/plain'),'hasDirectory':_0x5eeded,'forceTextAttachment':!0x1,'preventDefault':()=>_0x26ec40['preventDefault']()};this['fire']('promptInputPaste',_0xebfa0a);}['_handleDrop'](_0x187c8b){const _0x5c7ca2=_0x187c8b['dataTransfer'];if(!_0x5c7ca2)return;const _0x1f9a16={'files':[],'plainText':_0x5c7ca2['getData']('text/uri-list')||_0x5c7ca2['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x187c8b['preventDefault']()};this['fire']('promptInputPaste',_0x1f9a16);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x1ddaac=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x1ddaac)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x499078=_0x13f09b(_0x1ddaac);this['fire']('sendUserMessage',_0x499078),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x31379e){this['queryView']['fieldView']['set']('placeholder',_0x31379e);}['focus'](_0x59f737=!0x1){super['focus'](),_0x59f737&&(this['element']['classList']['contains'](nn)||(this['element']['classList']['add'](nn),setTimeout(()=>{this['element']['classList']['remove'](nn);},0x320)));}['_createSubmitButton'](){const _0x4635b1=new yt(this['locale']);return _0x4635b1['set']({'icon':_0x2edd45,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x4635b1['on']('execute',()=>{this['submit']();}),_0x4635b1;}['setIsUploadInProgress'](_0x3a18ee){this['isUploadInProgress']=_0x3a18ee;}['_setUpAddContextButtonPositioning'](){const _0x2f6a97=this['locale'],_0x45832c=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x1f35c9=new dt(this['queryView']['fieldView']['element']),_0x5d586b=new dt(this['_addContextButtonView']['element']),_0x51e26c=_0x1f35c9['width'],_0x3d160a='rtl'===_0x2f6a97['uiLanguageDirection']?'right':'left';_0x1f35c9['excludeScrollbarsAndBorders']();const _0x45973f=_0x51e26c-_0x1f35c9['width']+0x1;this['_addContextButtonView']['element']['style'][_0x3d160a]='calc('+(_0x51e26c-_0x5d586b['width']-_0x45973f)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x45832c),this['on']('render',()=>{_0x45832c(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x45832c();});});}}class AIChatDropZoneView extends Nt{constructor(_0x37331f){super(_0x37331f);const _0x33d875=new Lt();_0x33d875['content']=_0x174ee1,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x33d875,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x37331f,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x483d8b){let _0x14ce2f=0x0;_0x483d8b['addEventListener']('dragenter',_0x31abbd=>{_0x31abbd['dataTransfer']&&(_0x14ce2f++,0x1===_0x14ce2f&&this['fire']('dragEnter'),_0x483d8b['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x483d8b['addEventListener']('dragover',_0x5e70f7=>{_0x5e70f7['dataTransfer']&&_0x5e70f7['preventDefault']();}),_0x483d8b['addEventListener']('dragleave',()=>{--_0x14ce2f<=0x0&&(_0x14ce2f=0x0,_0x483d8b['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x483d8b['addEventListener']('drop',_0x22e6e=>{_0x22e6e['preventDefault'](),_0x14ce2f=0x0,_0x483d8b['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x22e6e);});}['_handleDrop'](_0x55657b){const _0x3b390a=_0x55657b['dataTransfer'];if(!_0x3b390a)return;const {files:_0x10112a,hasDirectory:_0x5b4e80}=sn(_0x3b390a),_0x382196={'files':_0x10112a,'plainText':_0x3b390a['getData']('text/uri-list')||_0x3b390a['getData']('text/plain'),'hasDirectory':_0x5b4e80,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x382196);}}const rn='ck-ai-chat__prompt-capabilities',on='ck-ai-chat-controls-button',an='ck-ai-chat-controls-button--commands',hn='ck-ai-chat-controls__model-selection',cn='ck-ai-chat-controls__model-selection__item-name',ln='ck-ai-chat-controls__model-selection__item-description',un='ck-ai-chat-controls__model-selection__item-capabilities',dn='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x4b4ab3){super(_0x4b4ab3),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1514e8=>'selector'===_0x1514e8),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x24fc0d=>_0x24fc0d?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x4a3cca=>_0x4a3cca),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x2180d1=>_0x2180d1),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x5355e0=>Mi(this['locale'],_0x5355e0?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x5de357=>_0x5de357),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x252be4=>Mi(this['locale'],_0x252be4?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[rn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x8fbbaa,_0x5c9e59){if(_0x5c9e59)this['set']('modelDisplayMode','hidden');else{const _0x1a43d9=0x1===_0x8fbbaa['length'];this['set']('modelDisplayMode',_0x1a43d9?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x8fbbaa?.['length'])for(const _0x568b01 of _0x8fbbaa){const _0x3b6ee5=new Zt({'label':_0x568b01['name'],'withText':!0x0,'role':'menuitemradio','id':_0x568b01['id'],'model':_0x568b01});_0x3b6ee5['bind']('isOn')['to'](this,'activeModelId',_0x53b7fc=>_0x53b7fc===_0x568b01['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x3b6ee5,'labelView':new _n(this['locale'],_0x568b01)});}}['setWebSearch'](_0x5567b0){this['set']('webSearchActive',_0x5567b0);}['setReasoning'](_0x29db4f){this['set']('reasoningActive',_0x29db4f);}['setModel'](_0x3042fc){if(!_0x3042fc)return;this['activeModelId']=_0x3042fc['id'],this['activeModelName']=_0x3042fc['name']||_0x3042fc['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x3042fc['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x3042fc['name']);const _0x21b7e1=_0x3042fc['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x21b7e1),this['_webSearchButton']['set']('isVisible',_0x21b7e1);const _0x4def77=_0x3042fc['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x4def77),this['_reasoningButton']['set']('isVisible',_0x4def77);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x50489f){this['set']('modelSelectorEnabled',!0x1),_0x50489f&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x43e7b2=new yt();return _0x43e7b2['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x24eb32,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x43e7b2['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x43e7b2;}['_createReasoningButton'](){const _0xb2a1cd=new yt();return _0xb2a1cd['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x285f1c,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0xb2a1cd['on']('execute',()=>{this['fire']('toggleReasoning');}),_0xb2a1cd;}['_createCommandsButton'](){const _0x1ea6bd=new yt();return _0x1ea6bd['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x1e1027,'withText':!0x0,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':dn}),_0x1ea6bd['extendTemplate']({'attributes':{'class':[an]}}),_0x1ea6bd['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x1ea6bd;}['_createModelSelectionDropdown'](){const _0x28e395=Ft(this['locale']);return _0x28e395['set']({'panelPosition':'ne','class':[hn]}),_0x28e395['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':dn,'class':Gi}),this['listenTo'](_0x28e395,'execute',_0x5a9675=>{this['fire']('selectModel',_0x5a9675['source']['model']);}),_0x28e395;}['_createModelNameView'](){const _0x4dd523=new In(this['locale']);return _0x4dd523['bind']('text')['to'](this,'activeModelName',_0x4d451c=>_0x4d451c??''),_0x4dd523['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1a8e46=>'name'===_0x1a8e46),_0x4dd523;}}let _n=class ModelButtonLabelView extends Mt{constructor(_0x53a5a0,_0x27af5e){super();const _0x41f291=this['bindTemplate'],_0x3b664e=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x41f291['to']('style'),'id':_0x41f291['to']('id')},'children':[{'tag':'div','attributes':{'class':[cn]},'children':[{'text':_0x41f291['to']('text')}]},{'tag':'div','attributes':{'class':[ln]},'children':[{'tag':'span','children':[{'text':_0x27af5e['description']}]}]},{'tag':'div','attributes':{'class':[un]},'children':_0x3b664e}]}),_0x3b664e['addMany'](this['_getCapabilityParts'](_0x53a5a0,_0x24eb32,'AI_CHAT_SEARCH_WEB',_0x27af5e['capabilities']['webSearch']?.['enabled']??!0x1)),_0x3b664e['addMany'](this['_getCapabilityParts'](_0x53a5a0,_0x285f1c,'AI_CHAT_REASONING',_0x27af5e['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0xee710e,_0x2fd009,_0x120f87,_0x34abfd){const _0x1fcf79=new Lt();_0x1fcf79['content']=_0x2fd009;const _0x54a601=new Nt(_0xee710e);_0x54a601['setTemplate']({'tag':'span','children':[{'text':Mi(_0xee710e,_0x120f87)+':\x20'}]});const _0x9d0651=new Nt(_0xee710e);return _0x9d0651['setTemplate']({'tag':'span','children':[{'text':Mi(_0xee710e,_0x34abfd?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x1fcf79,_0x54a601,_0x9d0651];}},In=class ModelNameView extends Nt{constructor(_0x799bca){super(_0x799bca),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x4c89e2=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x4c89e2['if']('isVisible','ck-hidden',_0x218318=>!_0x218318)]},'children':[{'text':_0x4c89e2['to']('text')}]});}};const An='ck-ai-chat-context-controls__url-form',gn='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x440b57){super(_0x440b57),this['focusTracker']=new It(),this['keystrokes']=new At(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0xebb86=>{this['focusTracker']['add'](_0xebb86['element']),this['keystrokes']['listenTo'](_0xebb86['element']);}),te({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x189375){this['urlInputField']['errorText']=_0x189375,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x2391b0=new yt(this['locale']);return _0x2391b0['set']({'icon':_0x56c2cb,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0xa3c22d,_0x55204a,_0x1cbfa0)=>{_0x2391b0['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x1cbfa0?'':'\x20ck-hidden')]});}),_0x2391b0;}['_createUrlInputField'](){const _0x5eac57=new _0x441b4b(this['locale'],_0x4fa1a8);return _0x5eac57['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x5eac57['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x5eac57;}['_createConfirmButton'](){const _0x4427ba=new yt(this['locale']);return _0x4427ba['set']({'icon':_0x491051,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x4427ba;}['_setupTemplate'](){const _0x1cc1c5=new _0x485188(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x1cc1c5['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':An,'tabindex':'-1'},'children':[_0x1cc1c5,{'tag':'div','attributes':{'class':gn},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x2f8f52=>{_0x2f8f52['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x329fc9,_0x582c95)=>{this['clear'](),this['fire']('cancel'),_0x582c95();});}['_handleSubmit'](){const _0x3f9c2c=this['getValue']()['trim']();_0x3f9c2c?this['_isValidUrl'](_0x3f9c2c)?(this['clearError'](),this['fire']('submitUrl',_0x3f9c2c)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x1d22a1=this['getValue']()['trim'](),_0x27a4c1=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x1d22a1['length']>0x0&&!_0x27a4c1;}['_isValidUrl'](_0x13b9ee){try{return!!new URL(_0x13b9ee);}catch{return!0x1;}}}const wn='ck-ai-chat-resources__item',Cn='ck-ai-chat-resources__item--in-context',mn='ck-ai-chat-resources__item-title',pn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x232f45,_0x5ed809){super(_0x232f45),this['resource']=_0x5ed809,this['set']('isInContext',!!_0x5ed809['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x373448){if(_0x373448['isInContext'])return _0x491051;switch(_0x373448['type']){case'document':return _0x4849ee;case'web-resource':return _0x394fe8;case'file':case'text':return _0x174ee1;default:return _0xb21257;}}['highlightText'](_0x330d75){if(!_0x330d75||''===_0x330d75['trim']())return void this['_titleView']['highlightText'](null);const _0x23e180=new RegExp(_0x325daf(_0x330d75),'gi');this['_titleView']['highlightText'](_0x23e180);}['updateResourceState'](_0x53f2c1){this['resource']['isInContext']=_0x53f2c1,this['isInContext']=_0x53f2c1,this['_updateIcon']();}['_createTitleView'](){const _0x530142=new _0x574ada();return _0x530142['text']=this['resource']['label'],_0x530142['extendTemplate']({'tag':'span','attributes':{'class':[mn]}}),_0x530142;}['_createIconView'](){const _0x547a7f=new Lt();return _0x547a7f['content']=this['getResourceIcon'](this['resource']),_0x547a7f;}['_setupTemplate'](){const _0x3aff82=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[wn,_0x3aff82['if']('isVisible','ck-hidden',_0x5aa7da=>!_0x5aa7da),_0x3aff82['if']('isInContext',Cn)]},'children':[{'tag':'div','attributes':{'class':[pn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3aff82['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const En='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x327421,_0x569294){super(_0x327421),this['_source']=_0x569294,this['extendTemplate']({'attributes':{'class':[En]}});}['setResources'](_0x1428be,_0x1fc701){this['items']['clear']();let _0x3352b4=_0x1428be;if(this['_source']['useDefaultFiltering']&&_0x1fc701&&''!==_0x1fc701['trim']()){const _0x42d5e2=new RegExp(_0x1fc701['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x3352b4=_0x1428be['filter'](_0x40a566=>_0x42d5e2['test'](_0x40a566['label']));}for(const _0x337abd of _0x3352b4){const _0x557bec=new AIChatResourceListItemView(this['locale'],_0x337abd);_0x557bec['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x337abd);}),this['items']['add'](_0x557bec);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x1fc701);}['highlightText'](_0x4c9845){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x230439=>{_0x230439['highlightText'](_0x4c9845);});}['updateResourceState'](_0x5ccd55,_0x36dd9c){for(const _0x3f1a22 of this['items']){const _0x385167=_0x3f1a22;_0x385167['resource']['id']===_0x5ccd55&&_0x385167['updateResourceState'](_0x36dd9c);}}['_handleResourceSelection'](_0x32d606,_0x3c2ccc){this['fire']('addResourceToContext',{'source':_0x32d606,'resource':_0x3c2ccc});}}class AIChatContextResourcesSearchInputView extends _0x441b4b{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x1d4ffe){const t=_0x1d4ffe['t'],_0x3ccf1b={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x4fa1a8,'label':Mi(_0x1d4ffe,'AI_CHAT_SEARCH_RESOURCES')};super(_0x1d4ffe,_0x3ccf1b['creator']),this['label']=_0x3ccf1b['label'],this['_viewConfig']=_0x3ccf1b,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x1d4ffe,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x27c58d){this['fire']('search',_0x27c58d);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x4a6a21,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x79b0f9,t){this['resetButtonView']=new yt(_0x79b0f9),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x386fc5,'class':'ck-search__reset','isVisible':!0x1,'tooltip':!0x0}),this['resetButtonView']['on']('execute',()=>{this['reset'](),this['focus'](),this['fire']('reset');}),this['resetButtonView']['bind']('isVisible')['to'](this['fieldView'],'isEmpty',_0x4d8996=>!_0x4d8996),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0xd8827e,_0x70afc2){super(_0xd8827e),this['_source']=_0x70afc2['source'],this['_searchInputVisibleFrom']=_0x70afc2['searchInputVisibleFrom']??0x7,this['set']('isLoading',!0x0),this['_searchView']=this['_createSearchView'](),this['_searchSection']=this['_createSearchSection'](),this['_resourcesListView']=this['_createResourcesListView'](),this['_skeletonLoader']=this['_createSkeletonView'](),this['children']=new _0x3ee0e4([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x275dcf=new Nt(this['locale']);return _0x275dcf['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x538df1,_0x4a9803)=>{this['loadResources'](_0x4a9803),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x4a9803);}),_0x275dcf;}['_createResourcesListView'](){const _0x226f37=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x226f37['delegate']('addResourceToContext')['to'](this),_0x226f37['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x226f37;}['_createSkeletonView'](){const _0x5ed87b=new AISkeletonView(this['locale'],Ls['aiChatResources']);return _0x5ed87b['bind']('isVisible')['to'](this,'isLoading'),_0x5ed87b;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1a350d){const _0x250d1f=at();this['_latestLoadResourcesUid']=_0x250d1f,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1a350d,'uid':_0x250d1f}),this['isLoading']=!0x0;}['setResources'](_0x13eb21,_0x243ed4){if(_0x243ed4&&_0x243ed4!==this['_latestLoadResourcesUid'])return;const _0x5e9351=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x13eb21,_0x5e9351),_0x13eb21['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x2dc9fc,_0xc123bc){this['_resourcesListView']['updateResourceState'](_0x2dc9fc,_0xc123bc);}}const Tn='ck-ai-chat-context-controls__source-balloon-panel',fn='ck-button-icon\x20ck-button-back',Rn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x479253,_0x1cb11e,_0x202580){this['_locale']=_0x479253,this['_bodyCollection']=_0x1cb11e,this['_config']=_0x202580;}['showSourceResourcesBalloon']({source:_0x3aa622,withBackButton:_0x28f448}){let _0x35e2e5=this['_sourceResourceBalloons']['get'](_0x3aa622['id']);_0x35e2e5||(_0x35e2e5=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x3aa622['id'],_0x35e2e5),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x35e2e5)),this['_addSourceResourceContent']({'balloonPanel':_0x35e2e5,'source':_0x3aa622,'withBackButton':_0x28f448}),_0x35e2e5['show']();const _0x7e425a=this['_config']['getTargetElement']();_0x7e425a&&_0x35e2e5['pin']({'target':_0x7e425a,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x11c762,_0xdc7eb7,_0xa3374e){const _0x3ca6d2=this['_sourceResourceBalloons']['get'](_0x11c762);if(!_0x3ca6d2)return;const _0x1608a6=this['_getResourcesViewFromBalloon'](_0x3ca6d2);_0x1608a6&&(_0x1608a6['setResources'](_0xdc7eb7,_0xa3374e),_0x1608a6['once']('change:isLoading',()=>{_0x3ca6d2['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x1254d1){const _0x27fd37=this['_sourceResourceBalloons']['get'](_0x1254d1);_0x27fd37&&requestAnimationFrame(()=>{_0x27fd37['hide'](),this['_sourceResourceBalloons']['delete'](_0x1254d1),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0xcbc39d of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0xcbc39d);}['isAnyResourceBalloonVisible'](){for(const _0x25d111 of this['_sourceResourceBalloons']['values']())if(_0x25d111['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x48e345,_0x2421d8,_0x245556){const _0x36353=this['_sourceResourceBalloons']['get'](_0x48e345);if(!_0x36353||!_0x36353['isVisible'])return;const _0x4e2aa0=this['_config']['getTargetElement']();if(!_0x4e2aa0)return;_0x36353['pin']({'target':_0x4e2aa0,'limiter':this['_config']['getLimiterElement']()});const _0xf4a76=this['_getResourcesViewFromBalloon'](_0x36353);_0xf4a76&&_0xf4a76['updateResourceState'](_0x2421d8,_0x245556);}['destroy'](){for(const _0x2eb502 of this['_sourceResourceBalloons']['values']())_0x2eb502['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x2b1c27=new zt(this['_locale']);return _0x2b1c27['extendTemplate']({'attributes':{'class':Tn}}),this['_bodyCollection']['add'](_0x2b1c27),_0x2b1c27;}['_addSourceResourceContent']({balloonPanel:_0x5e6c98,source:_0x468b61,withBackButton:_0x5f5d4a}){_0x5e6c98['content']['clear']();const _0x5888d7=this['_createBalloonHeader']({'balloonPanel':_0x5e6c98,'source':_0x468b61,'withBackButton':_0x5f5d4a});_0x5e6c98['content']['add'](_0x5888d7);const _0x10e1df=this['_createBalloonResourcesView'](_0x468b61);_0x5e6c98['content']['add'](_0x10e1df);}['_createBalloonHeader']({balloonPanel:_0xee0f97,source:_0x107377,withBackButton:_0x2d53d2}){const _0x3e76da=new _0x485188(this['_locale'],{'label':_0x107377['label'],'class':Rn});return _0x2d53d2&&_0x3e76da['children']['add'](this['_createBackButton'](_0xee0f97),0x0),_0x3e76da;}['_createBackButton'](_0x224a88){const _0xe7aa72=new yt(this['_locale']);return _0xe7aa72['set']({'icon':_0x56c2cb,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':fn}),_0xe7aa72['on']('execute',()=>{_0x224a88['hide'](),this['_config']['onBackToContext']();}),_0xe7aa72;}['_createBalloonResourcesView'](_0x483335){const _0x15fd08=new AIChatContextResourcesView(this['_locale'],{'source':_0x483335,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x15fd08['on']('loadSourceResources',(_0x140521,_0x32adab)=>{this['_config']['onLoadSourceResources'](_0x32adab);}),_0x15fd08['on']('addResourceToContext',(_0x481214,_0x370a71)=>{this['_config']['onResourceSelected'](_0x370a71['source'],_0x370a71['resource']),this['closeSourceResourceBalloon'](_0x483335['id']);}),_0x15fd08;}['_getResourcesViewFromBalloon'](_0x158e11){const _0x5282b3=_0x158e11['content']['get'](0x1);return _0x5282b3 instanceof AIChatContextResourcesView?_0x5282b3:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x2624b9){jt({'emitter':_0x2624b9,'contextElements':[_0x2624b9['element']],'callback':()=>{_0x2624b9['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x2624b9['isVisible']});}}const bn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Sn='ck-ai-chat-context-controls',On='ck-ai-chat-context-controls__pending-contexts',vn='ck-ai-chat-context-controls__add-context-balloon-panel',kn='ck-ai-chat-context-controls__add-context-button',yn='ck-ai-chat-context-controls__url-balloon-panel',Nn='ck-ai-chat-context-controls__balloon-button',xn='ck-ai-chat-context-controls__balloon-button-source',Ln='ck-ai-chat-controls-button',Pn='ck-ai-chat-context-chips-wrapper-balloon',Dn='ck-ai-chat-controls_context_show-more-button',Vn='ck-ai-chat-context-controls__show-more-balloon-panel',Hn='ck-ai-chat',Mn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x95c933,_0x3a636b){super(_0x95c933),this['bodyCollection']=_0x3a636b['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x95c933),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x95c933),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x95c933),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x95c933,_0x3a636b);const _0xee6c08={'cssClasses':{'showMoreButton':Dn+'\x20'+Gi,'showMoreBalloon':Vn,'overflowContainer':Pn,'controlsButton':Ln}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x95c933,this['_currentContextsChips'],_0xee6c08,this['bodyCollection'],this),this['_addContextBalloonConfig']={'buttonView':this['addContextButtonView'],'balloonView':this['_addContextBalloonPanelView'],'hideMethod':this['hideAddContextBalloonPanel']['bind'](this),'showMethod':this['showAddContextBalloonPanel']['bind'](this)},this['_setupTemplate'](),this['_bindEventHandlers']();}['render'](){super['render'](),this['_setupAllBalloonClickOutsideHandlers'](),this['_overflowManager']['setContainerElement'](this['element']),this['_overflowManager']['reorganizeChips']();}['destroy'](){super['destroy'](),this['_overflowManager']['destroy'](),this['_resourcesBalloonView']['destroy']();}['addContextItem'](_0x25ce85,_0xd14ccd){const _0x251b5d=this['_createContextButton'](_0x25ce85,'current',!0x0,_0xd14ccd);this['_addContextToCollection'](_0x251b5d,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x5cf554){this['_removeContextFromCollection'](_0x5cf554,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x5cf554,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x3fc02b,_0x1433e1){let _0x1a95b2=this['_currentContextsChips']['find'](_0x24a2ea=>_0x24a2ea['id']===_0x3fc02b);_0x1a95b2||(_0x1a95b2=this['_overflowManager']['overflowChips']['find'](_0x2cf8cb=>_0x2cf8cb['id']===_0x3fc02b)),_0x1a95b2&&(_0x1a95b2['isLoading']=_0x1433e1);}['setConversationContext'](_0x54747a){this['_conversationContextsChips']['clear']();for(const _0x49b5c6 of _0x54747a){const _0x145474=this['_createContextButton'](_0x49b5c6,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x145474,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0xdc3f9f,_0x476685,_0x359e8c){this['_resourcesBalloonView']['updateResourceState'](_0xdc3f9f,_0x476685,_0x359e8c);}['hideAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x1);}['showAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['hideAllBalloons'](){this['hideAddContextBalloonPanel'](),this['hideUrlBalloonPanel'](),this['_resourcesBalloonView']['closeAll']();}['_showSourceResourcesBalloon']({source:_0x1a09db,withBackButton:_0xf1922c}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x1a09db,'withBackButton':_0xf1922c}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x2c905e,_0x13f466,_0x7e6646,_0x15150d){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x2c905e,_0x7e6646,_0x15150d);}['closeSourceResourceBalloon'](_0x1f4b92){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x1f4b92),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x11629e){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x11629e),this['_setAddContextButtonEnabled'](_0x11629e);}['_setAddContextButtonEnabled'](_0x4c244e){const _0xaaad0c=!_0x4c244e['document']['isHidden']&&_0x4c244e['document']['enabled'],_0xc7f330=_0x4c244e['urls']['enabled'],_0x58eede=_0x4c244e['files']['enabled'],_0x5dbc19=_0x4c244e['sources']['length']>0x0,_0x5ad640=_0x4c244e['customItems']&&_0x4c244e['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0xaaad0c||_0xc7f330||_0x58eede||_0x5dbc19||_0x5ad640;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Sn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':On},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x4d8c10){const _0x167168=new yt(_0x4d8c10);return _0x167168['set']({'label':Mi(_0x4d8c10,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ln+'\x20'+kn+'\x20'+Gi,'icon':_0x53363e,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x167168;}['_createAddContextBalloonPanelView'](_0x3c112d){return this['_createBaseBalloonPanel'](_0x3c112d,vn);}['_createUrlBalloonPanelView'](_0x4f2325){const _0x6e5c61=this['_createBaseBalloonPanel'](_0x4f2325,yn);return this['_addUrlContent'](_0x6e5c61,_0x4f2325),_0x6e5c61;}['_createResourcesBalloonView'](_0x56e7ef,_0x11ce9a){const _0x455668={'searchInputVisibleFrom':_0x11ce9a['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});},'onResourceSelected':(_0x5ae56b,_0x1f9bb6)=>{this['fire']('addResourceToContext',{'source':_0x5ae56b,'resource':_0x1f9bb6});},'onLoadSourceResources':_0x1eac08=>{this['fire']('loadSourceResources',_0x1eac08);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x56e7ef,_0x11ce9a['bodyCollection'],_0x455668);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Hn)||document['body'];}['_createBaseBalloonPanel'](_0x43a63c,_0x19f16e){const _0x17c77b=new zt(_0x43a63c);return _0x17c77b['extendTemplate']({'attributes':{'class':_0x19f16e}}),this['bodyCollection']['add'](_0x17c77b),_0x17c77b;}['_setBalloonPanelContent'](_0x3900d9,_0x4d1bb2,_0x2aa2ff){if(_0x3900d9['content']['clear'](),!_0x2aa2ff['document']['isHidden']&&_0x2aa2ff['document']['enabled']){const _0x1de316=this['_createBalloonButton'](_0x4d1bb2,{'label':Mi(_0x4d1bb2,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x4849ee});_0x1de316['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x3900d9['content']['add'](_0x1de316);}if(_0x2aa2ff['urls']['enabled']){const _0x48fb1d=this['_createBalloonButton'](_0x4d1bb2,{'label':Mi(_0x4d1bb2,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x394fe8});_0x48fb1d['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_urlInputView']['focus']();}),_0x3900d9['content']['add'](_0x48fb1d);}if(_0x2aa2ff['files']['enabled']){const _0x4dbfcc=new _0x2b7121(_0x4d1bb2);_0x4dbfcc['set']({'label':Mi(_0x4d1bb2,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x5aa236,'withText':!0x0,'tooltip':!0x0,'class':Nn,'allowMultipleFiles':!0x0}),_0x4dbfcc['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x4dbfcc['on']('done',(_0x2b4e29,_0xdfa290)=>{this['fire']('addFileToContext',_0xdfa290);}),_0x4dbfcc['tooltip']=!0x0,_0x3900d9['content']['add'](_0x4dbfcc);}for(const _0x3e19cc of _0x2aa2ff['sources']){const _0x12e708=this['_createBalloonButton'](_0x4d1bb2,{'label':_0x3e19cc['label'],'icon':_0x3e19cc['icon']||_0xb21257,'type':'source'});_0x3900d9['content']['add'](_0x12e708),_0x12e708['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x3e19cc,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x255d7d of _0x2aa2ff['customItems']||[]){const _0x579f49=this['_createBalloonButton'](_0x4d1bb2,{'label':_0x255d7d['label'],'icon':_0x255d7d['icon']||_0xb21257,'type':'customItem'});_0x3900d9['content']['add'](_0x579f49),_0x579f49['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x255d7d);});}this['_hasExactlyOneSource']=0x1===_0x3900d9['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x595bf1,_0x252c37){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x252c37),this['_urlInputView']['on']('submitUrl',(_0xecfb6f,_0x560b79)=>{this['_handleUrlSubmit'](_0x560b79);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});}),_0x595bf1['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x157c51,_0x584bf7){const _0x2ade20='source'===_0x584bf7['type']?new SourcesBalloonButtonView(_0x157c51):new yt(_0x157c51);return _0x2ade20['set']({'label':_0x584bf7['label'],'icon':_0x584bf7['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Nn}),_0x2ade20;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x128c9c){const _0x5aff86=this['_addContextBalloonConfig'];_0x5aff86['buttonView']['isOn']=_0x128c9c,_0x128c9c?_0x5aff86['balloonView']['show']():_0x5aff86['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x2e37e5,buttonView:_0x1eda89,hideMethod:_0x166d12}=this['_addContextBalloonConfig'];jt({'emitter':_0x2e37e5,'contextElements':[_0x2e37e5['element'],_0x1eda89['element']],'callback':()=>{_0x166d12();},'activator':()=>_0x1eda89['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x438e45,_0x401b13,_0x2e7b00=!0x1,_0x2348e5=!0x1){const _0x342662='conversation'===_0x401b13||!0x0===_0x438e45['isReadOnly'],_0x52a481=new AIChatContextItemButtonView(this['locale'],_0x438e45,_0x342662,_0x2e7b00,_0x2348e5);return _0x342662||_0x52a481['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x52a481['id']);}),_0x52a481;}['_addContextToCollection'](_0x43b047,_0x5e6ce0){_0x5e6ce0['add'](_0x43b047,0x0);}['_removeContextFromCollection'](_0x32c8d4,_0x36363d){const _0x88fa03=_0x36363d['find'](_0x50fb6b=>_0x50fb6b['id']===_0x32c8d4);_0x88fa03&&_0x36363d['remove'](_0x88fa03);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x2f07ce){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x2f07ce);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x4c632f){super(_0x4c632f),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[xn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x34f0b2=new Lt();return _0x34f0b2['content']=_0x226b43,_0x34f0b2['extendTemplate']({'attributes':{'class':xn+'__arrow'}}),_0x34f0b2;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x2bcbcd){super(_0x2bcbcd),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_loaderView']=this['_createLoaderView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-loader-wrapper','ck-reset_all']},'children':[this['_loaderView'],this['_cancelButtonView']]});}['_createCancelButtonView'](){const _0x2a0cd0=new yt(this['locale']);return _0x2a0cd0['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x4b8a16}),_0x2a0cd0['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x2a0cd0;}['_createLoaderView'](){const _0x17e0ff=new Nt(this['locale']);return _0x17e0ff['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x17e0ff;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x3c28ee,_0x4f4fe1){super(_0x3c28ee),this['_filesEnabled']=_0x4f4fe1['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x3c28ee,{'bodyCollection':_0x4f4fe1['bodyCollection'],'searchInputVisibleFrom':_0x4f4fe1['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x3c28ee),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x3c28ee),this['_loaderView']=this['_createLoaderView'](_0x3c28ee),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x3c28ee),this['_dropZoneView']=new AIChatDropZoneView(_0x3c28ee),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...bn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x1e5b68=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x1e5b68['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x1e5b68['if']('isLoading','ck-hidden',_0x35f9c3=>_0x35f9c3||!this['isModelAvailable']),_0x1e5b68['if']('isModelAvailable','ck-hidden',_0x182e0f=>!_0x182e0f||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x1e5b68['if']('isLoading','ck-hidden',_0x4f3011=>!_0x4f3011)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x1e5b68['if']('isModelAvailable','ck-hidden',_0x2360a7=>_0x2360a7)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}['_createContextPanelView'](_0x58d114,_0x30272a){return new AIChatContextPanelView(_0x58d114,_0x30272a);}['_createPromptInputView'](_0x1af55b){return new AIChatPromptInputView(_0x1af55b,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x5563d2){return new AIChatPromptCapabilitiesView(_0x5563d2);}['_createLoaderView'](_0x9f07d6){return new AIChatControlsLoaderView(_0x9f07d6);}['_createModelUnavailableMessageView'](_0x4389d8){const _0x41d0bd=new AIChatModelUnavailableMessageView(_0x4389d8);return _0x41d0bd['delegate']('startConversation')['to'](this),_0x41d0bd;}['_handlePromptInputFocus'](_0x266b45,_0x263db4,_0xd1670c){_0xd1670c?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x88a590,_0x2641d){this['_contextPanelView']['addContextItem'](_0x88a590,_0x2641d);}['removeContextItem'](_0x17db27){this['_contextPanelView']['removeContextItem'](_0x17db27);}['setContextItemLoading'](_0x356121,_0x5688f7){this['_contextPanelView']['setContextItemLoading'](_0x356121,_0x5688f7);}['setIsUploadInProgress'](_0x24fcbf){this['_promptInputView']['setIsUploadInProgress'](_0x24fcbf);}['setConversationContext'](_0x70b3ff){this['_contextPanelView']['setConversationContext'](_0x70b3ff);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x358bd8,_0x55b3ec,_0x17eced){this['_contextPanelView']['updateResourceState'](_0x358bd8,_0x55b3ec,_0x17eced);}['setWebSearch'](_0xaedcb){this['_promptCapabilitiesView']['setWebSearch'](_0xaedcb);}['setReasoning'](_0x40d2cf){this['_promptCapabilitiesView']['setReasoning'](_0x40d2cf);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x11d881){this['_contextPanelView']['setAddContextOptions'](_0x11d881);}['setInputPlaceholder'](_0x3184b7){this['_promptInputView']['setPlaceholderText'](_0x3184b7);}['setModelList'](_0x9a3831,_0x3da90a){this['_promptCapabilitiesView']['setModelList'](_0x9a3831,_0x3da90a);}['setModel'](_0x289acc){_0x289acc?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x289acc)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x4eb545){this['_promptCapabilitiesView']['disableModelSelector'](_0x4eb545);}['populateSourceResourceBalloon'](_0x10c577,_0x578afd,_0x63559f,_0x4dd27f){this['_contextPanelView']['populateSourceResourceBalloon'](_0x10c577,_0x578afd,_0x63559f,_0x4dd27f);}['closeSourceResourceBalloon'](_0x170f0e){this['_contextPanelView']['closeSourceResourceBalloon'](_0x170f0e);}['focusPromptInput'](_0x45c697=!0x1){this['_promptInputView']['focus'](_0x45c697);}['setPromptInputValue'](_0x26ebc1){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x26ebc1;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x4dacbf){super(_0x4dacbf);const _0x19a8d4=new yt(_0x4dacbf);_0x19a8d4['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x19a8d4['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x19a8d4]}]});}}class AIHeaderView extends _0x485188{['resizeButton'];constructor(_0x1565cb,_0x254957){super(_0x1565cb,{'label':_0x254957['label'],'class':'ck-ai-header\x20'+_0x254957['class'],'icon':_0x254957['icon']}),this['set']('isMaximized',!0x1),_0x254957['content']&&this['children']['add'](_0x254957['content']),_0x254957['showResizeButton']&&(this['resizeButton']=Fi(_0x1565cb,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x14c45c){super(_0x14c45c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x14c45c,'AI_DISCLAIMER_TEXT')}]}]});}}function Un(_0xd3a753,_0x46efa2){const _0x38700b=new yt(_0xd3a753);return _0x38700b['set']({'label':Mi(_0xd3a753,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0xd19b58,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x38700b['on']('execute',()=>{_0x46efa2['fire']('startConversation');}),_0x38700b;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x29ff4c,_0x10c006){super(_0x29ff4c),this['_bodyCollection']=new Xt(_0x29ff4c),this['_bodyCollection']['attachToDom']();const _0x3c335d=Un(_0x29ff4c,this);this['chatHeader']=new AIHeaderView(_0x29ff4c,{'label':Mi(_0x29ff4c,'AI_CHAT_HEADING'),'icon':_0x23f8a8,'class':'ck-ai-header_chat','content':_0x3c335d,'showResizeButton':_0x10c006['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x29ff4c,this['_bodyCollection']),this['chatFeed']['delegate'](...Os)['to'](this),this['chatControls']=new AIChatControlsView(_0x29ff4c,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x10c006['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x10c006['filesEnabled']}),this['chatControls']['delegate'](...Os)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x29ff4c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x29ff4c['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0xbaf8fc,_0x29341a,_0x54e5a1,_0xcd4b0d){this['chatControls']['populateSourceResourceBalloon'](_0xbaf8fc,_0x29341a,_0x54e5a1,_0xcd4b0d);}['closeSourceResourceBalloon'](_0xb427d6){this['chatControls']['closeSourceResourceBalloon'](_0xb427d6);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x179c1c{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x2134e3){super(_0x2134e3);const _0x12e84e=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x12e84e['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled')}),this['_view']['delegate']('resizeTabs')['to'](_0x12e84e),this['_view']['delegate'](...Os)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x1775fc,{showDiff:_0x2e978e})=>{this['showDiff']=_0x2e978e;}),this['disableControls'](),_0x12e84e['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x23f8a8,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x12e84e['view'],'isMaximized',_0xa94bcb=>_0xa94bcb),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x26a523=>_0x26a523),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x5258a8){const _0x31f409=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x5258a8['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x31f409}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x1433cc,staticMessage:_0x244155}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x1433cc,'initialContent':'<p>'+_0x244155+'</p>'});});}async['addFeedItemUserMessage'](_0x53a5c7){const _0x4eb3f7=_0x53a5c7['attributes']?.['displayedPrompt']||_0x53a5c7['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x53a5c7['contextItems']['values']()),'initialContent':'<p>'+_0x4eb3f7+'</p>','id':_0x53a5c7['id']});});}async['addFeedItemError']({errorMessage:_0x55e103,id:_0x526df0}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x55e103+'</p>','id':_0x526df0});});}async['addFeedItemAIReply'](_0x23ed28){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x23ed28['interactionId']+':'+_0x23ed28['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x118d11){const _0x1606c3=ms(this['context']),_0x25c066=_0x1606c3['map'](_0x117ea0=>_0x117ea0['config']['get']('ai.availableReplyActions')||[...Ds]);let _0x56322e=_0x25c066['reduce']((_0x1f4c6a,_0x4327cb)=>_0x1f4c6a['filter'](_0x262114=>_0x4327cb['includes'](_0x262114)),_0x25c066[0x0]||[...Ds]);const _0x28f0d6=_0x1606c3['every'](_0x17a40=>_0x17a40['plugins']['has']('TrackChanges')),_0x5865c9=_0x1606c3['map'](_0x4947e3=>_0x4947e3['commands']['get']('trackChanges'));return _0x28f0d6?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x5865c9,'value',(..._0x34a63c)=>_0x34a63c['some'](_0x29139a=>_0x29139a))):_0x56322e=_0x56322e['filter'](_0x20df88=>'insertSuggestion'!=_0x20df88),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x118d11['interactionId']+':'+_0x118d11['id'],'areActionsDisabled':_0x118d11['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x56322e}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x23d2e5,_0x4ec719){return this['_promiseQueue']['enqueue'](async()=>{const _0x154e04=this['_view']['chatFeed']['children']['last'];if(_0x154e04 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x154e04),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x23d2e5['id'],'capabilities':{'isWebSearchEnabled':_0x154e04['capabilities']['isWebSearchEnabled']||_0x4ec719['isWebSearchEnabled'],'isReasoningEnabled':_0x154e04['capabilities']['isReasoningEnabled']||_0x4ec719['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x23d2e5['id'],'capabilities':_0x4ec719});});}async['addFeedItemCustomElement'](_0x5a3f7a,_0x367d5b){let _0x557c5b;return await this['_promiseQueue']['enqueue'](async()=>{_0x557c5b=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x5a3f7a,'id':_0x367d5b});}),_0x557c5b;}['removeFeedItem'](_0x422b3d){this['_view']['chatFeed']['removeItem'](_0x422b3d);}['hasFeedItem'](_0x51de7d){return this['_view']['chatFeed']['hasItem'](_0x51de7d);}['updateFeedInteractionHeader'](_0x389be6){const _0x40c573=this['_view']['chatFeed']['children']['find'](_0x18ed8c=>_0x18ed8c['options']['id']==_0x389be6['id']&&_0x18ed8c instanceof AIChatFeedInteractionHeaderView);_0x40c573&&_0x40c573['set']('isVisible',_0x389be6['isVisible']);}async['updateFeedItemAIReplyContent'](_0x552d20){const _0x27e11f=_0x552d20['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x520a9e=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x552d20,'abortSignal':_0x520a9e,'renderingStrategy':_0x27e11f}),_0x552d20['isDone']&&this['markFeedItemAsDone'](_0x552d20['id']);});}['updateFeedItemAIReplySources'](_0x748425,_0x1c8d26){this['_view']['chatFeed']['updateWebSources'](_0x748425,_0x1c8d26);}async['updateFeedItemAIReplySuggestionContent'](_0xa8058d){return this['_promiseQueue']['enqueue'](async _0x1c6e8f=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0xa8058d,'abortSignal':_0x1c6e8f}),_0xa8058d['isDone']&&this['markFeedItemAsDone'](_0xa8058d['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x45bc9e){this['_view']['chatFeed']['updateSuggestionPartState'](_0x45bc9e);}['setFeedItemAIReplySuggestionPartActive'](_0x367359){this['_view']['chatFeed']['setSuggestionPartActive'](_0x367359);}['markFeedItemAsDone'](_0x5a8804){this['_view']['chatFeed']['markItemAsDone'](_0x5a8804);}['removeFeedInteraction'](_0x2683ad){this['_view']['chatFeed']['getItemIds']()['filter'](_0x25cb56=>_0x25cb56['startsWith'](_0x2683ad))['forEach'](_0x127e3f=>this['_view']['chatFeed']['removeItem'](_0x127e3f));}['startInteraction'](){const _0x294bf2=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x294bf2),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x105ea8){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x373ec1=>_0x373ec1['startsWith'](_0x105ea8['id']))['forEach'](_0x11ed74=>this['markFeedItemAsDone'](_0x11ed74)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x50f8c6,_0xe81234){this['_view']['chatControls']['addContextItem'](_0x50f8c6,_0xe81234);}['removeContextItem'](_0x49af65){this['_view']['chatControls']['removeContextItem'](_0x49af65);}['setContextItemLoading'](_0x18f688,_0xe1d884){this['_view']['chatControls']['setContextItemLoading'](_0x18f688,_0xe1d884);}['setIsUploadInProgress'](_0x4ec5b2){this['_view']['chatControls']['setIsUploadInProgress'](_0x4ec5b2);}['setConversationContext'](_0x257f98){this['_view']['chatControls']['setConversationContext'](_0x257f98);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x425193,_0x536716,_0x5b9113){this['_view']['chatControls']['updateResourceState'](_0x425193,_0x536716,_0x5b9113);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x2c78a2){this['_view']['chatControls']['setAddContextOptions'](_0x2c78a2);}['updateCapabilities'](_0xca5c6e){this['_view']['chatControls']['setWebSearch'](_0xca5c6e['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0xca5c6e['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0xca5c6e));}['setSelectedModel'](_0x1ff859,_0x3ad10f){this['_view']['chatControls']['setModel'](_0x1ff859),_0x3ad10f&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x584dc2){this['feedItemRenderingStrategy']=_0x584dc2;}['toggleLoadingSkeleton'](_0x30ef26){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x30ef26);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x4155c7,_0x44ff2c=!0x1){if(_0x44ff2c&&!St()&&_0x4155c7['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x4155c7);this['_view']['chatHeader']['label']=_0x4155c7;}['setLoadingMessage'](_0x17a5cf){this['_view']['chatFeed']['setLoadingMessage'](_0x17a5cf);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x47a14c){let _0x959ae8=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x47a14c[_0x959ae8],_0x959ae8++,_0x959ae8===_0x47a14c['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x41c9ca){return _0x41c9ca['isWebSearchEnabled']&&_0x41c9ca['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x41c9ca['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x41c9ca['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x556f17){return _0x556f17?_0x556f17['isWebSearchEnabled']&&_0x556f17['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x556f17['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x556f17['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x4d501f,_0x3fdcec,_0x1abed5,_0x556c69){this['_view']['populateSourceResourceBalloon'](_0x4d501f,_0x3fdcec,_0x1abed5,_0x556c69);}['closeSourceResourceBalloon'](_0x95279d){this['_view']['closeSourceResourceBalloon'](_0x95279d);}['setPromptInputValue'](_0x541045){this['_view']['chatControls']['setPromptInputValue'](_0x541045);}['focusPromptInput'](_0x16a809=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x16a809);}['scrollFeedToSuggestion'](_0x270984,_0x3cff22){this['_view']['chatFeed']['scrollToSuggestion'](_0x270984,_0x3cff22);}['startAutoScroll'](_0x2f8778={}){this['_view']['chatFeed']['startAutoScroll'](_0x2f8778);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x28efea,_0x586891){super(_0x28efea),this['sections']=_0x586891,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x3d8943){let _0x413a5b=0x0,_0x44c1cd=0x0;for(const _0x340482 of this['sections']){const {resultsCount:_0x1eb1e6,totalItemsCount:_0x237f06}=_0x340482['filter'](_0x3d8943);_0x413a5b+=_0x1eb1e6,_0x44c1cd+=_0x237f06;}return{'resultsCount':_0x413a5b,'totalItemsCount':_0x44c1cd};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x558ac8,{title:_0x4b81aa,items:_0x5da6bc}){super(_0x558ac8);const _0x3d2cb7=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x4b81aa,this['itemsViews']=_0x5da6bc;const _0x19b872=new Nt(_0x558ac8);_0x19b872['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x558ac8),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x3d2cb7['if']('isVisible','ck-hidden',_0x4c50b3=>!_0x4c50b3)]},'children':[_0x19b872,this['_itemsListView']]});}['filter'](_0x520204){const _0x4c63ab=this['itemsViews']['length'];let _0x5505b0=0x0;for(const _0x30dd36 of this['itemsViews']){if(_0x520204){const _0x5c17bc=_0x30dd36['isMatching'](_0x520204);_0x30dd36['isVisible']=!!_0x5c17bc,_0x30dd36['highlightText'](_0x520204);}else _0x30dd36['isVisible']=!0x0,_0x30dd36['highlightText'](null);_0x30dd36['isVisible']&&_0x5505b0++;}return this['isVisible']=_0x5505b0>0x0,{'resultsCount':_0x5505b0,'totalItemsCount':_0x4c63ab};}['getItem'](_0x5710b0){return this['itemsViews']['find'](_0x53c184=>_0x53c184['id']===_0x5710b0);}['removeItem'](_0x196cce){const _0x4ca062=this['itemsViews']['indexOf'](_0x196cce);-0x1!==_0x4ca062&&(this['itemsViews']['splice'](_0x4ca062,0x1),this['_itemsListView']['items']['remove'](_0x196cce));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
|
|
27
|
-
_0x2f3261(Ht){['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x488055,_0xc8673d){super(_0x488055);const _0x90e6f3=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0xc8673d['pinned']),this['set']('loadingState',null),this['set']('title',_0xc8673d['title']),this['id']=_0xc8673d['id'];const {createdAt:_0x586a35,active:_0x4c2359=!0x1}=_0xc8673d;this['_titleView']=new _0x574ada(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x469c5f=this['_createCheckView'](),_0x2f5839=this['_createPinButtonView'](_0x488055),_0x1104c6=this['_createMenuDropdownView'](),_0x21727c=this['_createEditInputView'](_0x488055),_0x5bdfe7=this['_createAcceptEditButtonView'](_0x488055,_0x21727c),_0x3550b1=this['_createCancelEditButtonView'](_0x488055);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x2f5839),this['actions']['add'](_0x1104c6),this['on']('change:isEdit',(_0x3ba63f,_0x571df5,_0x5e31c1)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x5e31c1?(this['actions']['add'](_0x5bdfe7),this['actions']['add'](_0x3550b1),this['mainContent']['add'](_0x21727c),_0x21727c['element']['value']=this['title']||'',_0x21727c['element']['focus']()):(this['actions']['add'](_0x2f5839),this['actions']['add'](_0x1104c6),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x4c2359?'ck-ai-chat-history__item--active':'',_0x90e6f3['if']('isVisible','ck-hidden',_0x4ac37d=>!_0x4ac37d),_0x90e6f3['if']('isEdit','ck-ai-chat-history__item--edit')],'role':'listitem'},'children':[{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-check-container']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-check',_0x90e6f3['if']('loadingState','ck-hidden',_0x33910e=>!!_0x33910e)]},'children':_0x4c2359?[_0x469c5f]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x90e6f3['if']('loadingState','ck-hidden',_0x1e9b68=>!_0x1e9b68)]},'children':[this['_createSpinnerView']()]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-row']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-content']},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-title-container',_0x90e6f3['if']('loadingState','ck-hidden',_0x78fbda=>!!_0x78fbda)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x90e6f3['if']('loadingState','ck-hidden',_0x423845=>!_0x423845)]},'children':[{'text':_0x90e6f3['to']('loadingState',_0x35e35b=>_0x35e35b?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x35e35b]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x586a35]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-actions']},'children':this['actions']}]}]}),this['on']('click',()=>{this['isEdit']||this['fire']('selectConversation',{'id':this['id']});});}['updateTitle'](_0x1c48cc){this['set']('title',_0x1c48cc);}['updateLoadingState'](_0x1f4c15,_0x4add1a){this['set']('loadingState',_0x4add1a?_0x1f4c15:null);}['_createCheckView'](){const _0x4cccba=new Lt();return _0x4cccba['set']({'content':_0x491051}),_0x4cccba;}['_createPinButtonView'](_0x5a1129){const _0x2709f4=new yt(_0x5a1129);return _0x2709f4['set']({'label':Mi(_0x5a1129,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x41fe50,'withText':!0x1,'tooltip':!0x0}),_0x2709f4['bind']('isOn')['to'](this,'pinned'),_0x2709f4['on']('execute',()=>{const _0x8b623e=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x8b623e});}),_0x2709f4;}['_createMenuDropdownView'](){const _0x2da471=Ft(this['locale']),_0x1a6ff4=_0x2da471['panelView']['children'];_0x2da471['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x5d46bb}),_0x2da471['panelPosition']='sw';const _0x481ecb=new yt(this['locale']);_0x481ecb['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x481ecb['withText']=!0x0,_0x481ecb['on']('execute',()=>{this['isEdit']=!0x0;});const _0x5acbb6=new yt(this['locale']);_0x5acbb6['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x5acbb6['withText']=!0x0,_0x5acbb6['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x558f84=new Dt(this['locale']),_0x6b461a=new Ht(this['locale']);_0x6b461a['children']['add'](_0x481ecb);const _0x22ca68=new Ht(this['locale']);return _0x22ca68['children']['add'](_0x5acbb6),_0x558f84['items']['addMany']([_0x6b461a,_0x22ca68]),_0x1a6ff4['add'](_0x558f84),_0x2da471;}['_createEditInputView'](_0x2c1500){const _0x309d88=new _0x18ca7a(_0x2c1500),_0x48adc7=_0x309d88['bindTemplate'];return _0x309d88['extendTemplate']({'on':{'keydown':_0x48adc7['to'](_0x285737=>{'Enter'==_0x285737['key']&&this['_commitEditInputValue'](_0x309d88);})}}),_0x309d88;}['_createAcceptEditButtonView'](_0x460a26,_0x16be6c){const _0x2d0dc8=new yt(_0x460a26);return _0x2d0dc8['set']({'icon':_0x491051,'withText':!0x1,'tooltip':Mi(_0x460a26,'AI_CHAT_HISTORY_ACCEPT')}),_0x2d0dc8['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x2d0dc8['on']('execute',()=>{this['_commitEditInputValue'](_0x16be6c);}),_0x2d0dc8;}['_commitEditInputValue'](_0x25f03b){const _0x3f8f39=_0x25f03b['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x3f8f39});}['_createCancelEditButtonView'](_0x55dc8d){const _0x1c9774=new yt(_0x55dc8d);return _0x1c9774['set']({'icon':_0x386fc5,'withText':!0x1,'tooltip':Mi(_0x55dc8d,'AI_CHAT_HISTORY_CANCEL')}),_0x1c9774['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1c9774['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1c9774;}['_createSpinnerView'](){const _0x40d44e=new AISpinnerView('tiny');return _0x40d44e['isVisible']=!0x0,_0x40d44e;}['isMatching'](_0x386802){return'string'==typeof this['title']&&this['title']['match'](_0x386802)?{'title':!0x0}:null;}['highlightText'](_0x2035b7){this['_titleView']['highlightText'](_0x2035b7);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x319e8d,_0x6c2e2c){super(_0x319e8d),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x2c0c20=Un(_0x319e8d,this);this['headerView']=new AIHeaderView(_0x319e8d,{'label':Mi(_0x319e8d,'AI_CHAT_HISTORY_HEADING'),'icon':_0x1f9f29,'class':'ck-ai-header_history','content':_0x2c0c20,'showResizeButton':_0x6c2e2c}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x319e8d,[]),this['sectionsView']['delegate'](...Bn)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x5d1488=>!_0x5d1488)]}}),this['on']('change:isLoading',()=>this['_updateViewVisibility']()),this['on']('change:hasItems',()=>this['_updateViewVisibility']()),this['on']('change:errorMessage',()=>this['_updateViewVisibility']()),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat-history','ck-rounded-corners'],'dir':'ltr'},'children':[this['headerView'],{'tag':'div','attributes':{'class':['ck-ai-chat-history__content']},'children':[this['skeletonView'],this['mainErrorView'],this['emptyView'],this['searchView']]}]});}['_updateViewVisibility'](){this['isSearchViewVisible']=!this['isLoading']&&this['hasItems'],this['isEmptyViewVisible']=!this['isLoading']&&!this['hasItems']&&!this['errorMessage'],this['isMainErrorViewVisible']=!this['isSearchViewVisible']&&!!this['errorMessage'];}['_createSearchView'](){const _0x24702d=new _0xc66991(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x5e344b=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x5e344b),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1b245f=this['_createErrorView']();return _0x1b245f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0xd79c20=>!_0xd79c20)]}}),_0x24702d['on']('render',()=>{_0x24702d['children']['add'](_0x1b245f,0x1);}),_0x24702d['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x4f7520=>!_0x4f7520)]}}),_0x24702d;}['_createSkeletonView'](){const _0x366297=new AISkeletonView(this['locale'],Ls['aiHistory']);return _0x366297['bind']('isVisible')['to'](this,'isLoading'),_0x366297;}['_createErrorView'](){const _0x3683b8=new Nt(this['locale']),_0x3fb245=new yt(this['locale']);_0x3fb245['set']({'withText':!0x1,'icon':_0x386fc5,'class':'ck-ai-notification_error__dismiss-button'}),_0x3fb245['bind']('isVisible')['to'](this,'hasItems',_0x31b7a6=>!!_0x31b7a6),_0x3fb245['on']('execute',()=>{this['errorMessage']='';});const _0xf7afe8=this['bindTemplate'];return _0x3683b8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0xf7afe8['to']('errorMessage')}]},_0x3fb245]}),_0x3683b8;}['_createEmptyStateView'](){const _0x36378e=new Nt(this['locale']);return _0x36378e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0xb4f15b=>!_0xb4f15b)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x36378e;}['_createListItemViews'](_0x9fc72,_0x5069a4){const _0x17f2b1=[];for(const _0xde3c97 of _0x9fc72){const _0x3a669a=new AIChatHistoryListItemView(_0x5069a4,_0xde3c97);_0x3a669a['delegate'](...Bn)['to'](this),_0x17f2b1['push'](_0x3a669a);}return _0x17f2b1;}['updateHistoryItemsWithCategories'](_0x31a0e4){const _0x4b26e1=this['locale']||'en',_0x293d91=[];for(const _0x51b7c6 of _0x31a0e4){const _0x42ecbd=this['_createListItemViews'](_0x51b7c6['items'],_0x4b26e1);_0x293d91['push'](new AIChatHistoryListView(_0x4b26e1,{'title':_0x51b7c6['title'],'items':_0x42ecbd}));}this['sectionsView']['sections']=_0x293d91,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x293d91),this['hasItems']=_0x31a0e4['some'](_0x4043b4=>_0x4043b4['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x370446){for(const _0x496815 of this['sectionsView']['sections']){const _0x9aa0c6=_0x496815['getItem'](_0x370446);if(_0x9aa0c6){if(_0x496815['removeItem'](_0x9aa0c6),0x0===_0x496815['itemsViews']['length']){const _0x367df0=this['sectionsView']['sections']['indexOf'](_0x496815);-0x1!==_0x367df0&&(this['sectionsView']['sections']['splice'](_0x367df0,0x1),this['sectionsView']['items']['remove'](_0x496815));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x1b5a60,_0x2ea3d0){for(const _0x220480 of this['sectionsView']['sections']){const _0x8c5530=_0x220480['getItem'](_0x1b5a60);if(_0x8c5530){_0x8c5530['updateTitle'](_0x2ea3d0);break;}}}['updateItemLoadingState'](_0x5a853b,_0x5bf78d,_0x31ef56){for(const _0x28cf73 of this['sectionsView']['sections']){const _0xa84d1e=_0x28cf73['getItem'](_0x5a853b);if(_0xa84d1e){_0xa84d1e['updateLoadingState'](_0x5bf78d,_0x31ef56);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x4bd3b9=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x4bd3b9);}}}const Bn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x179c1c{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1e73c4){super(_0x1e73c4);const _0x474fd9=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x474fd9['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x474fd9),this['_historyView']['delegate'](...Bn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x474fd9['view'],'isMaximized',_0x2cb279=>_0x2cb279),_0x474fd9['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x1f9f29,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x2cd7e8){this['_historyView']['removeHistoryItem'](_0x2cd7e8);}['updateItems'](_0x42c5d0){this['_historyView']['updateHistoryItemsWithCategories'](_0x42c5d0);}['updateItemTitle'](_0x59870c,_0x12bff0){this['_historyView']['updateItemTitle'](_0x59870c,_0x12bff0);}['updateItemLoadingState'](_0x2868c8,_0x137975,_0x22a5d4){this['_historyView']['updateItemLoadingState'](_0x2868c8,_0x137975,_0x22a5d4);}['setLoadingSkeleton'](_0x2e5bcc){this['_historyView']['isLoading']=_0x2e5bcc;}['showError'](_0x26b351){this['_historyView']['errorMessage']=_0x26b351;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x1218ce,title:_0x5d4d24,createdAt:_0x7df152,updatedAt:_0xb81696,pinned:_0x45a398}){super(),this['id']=_0x1218ce,this['createdAt']=new Date(_0x7df152),this['set']('title',_0x5d4d24),this['set']('updatedAt',_0xb81696?new Date(_0xb81696):null),this['set']('pinned',_0x45a398||!0x1);}['updateTitle'](_0x45369e){this['set']('title',_0x45369e),this['updatedAt']=new Date();}['updatePinned'](_0x42ce61){this['set']('pinned',_0x42ce61),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x253e2b,group:_0x3a45b7}){super(),this['connector']=_0x253e2b,this['group']=_0x3a45b7;}async['init'](){try{const _0x1dab80=this['connector']['fetchConversations'](this['group']),_0x5ed42c=await _0x1dab80['getConversations']();this['loadItems'](_0x5ed42c);}catch(_0xc41f60){this['fire']('error',{'error':_0xc41f60,'operation':'init'});}}['addItem'](_0x204799){this['items']['push'](_0x204799);}async['removeItem'](_0x2bd87f){const _0x594a48=this['items']['findIndex'](_0x1baef7=>_0x1baef7['id']===_0x2bd87f);if(-0x1===_0x594a48)return!0x1;try{return await this['connector']['deleteConversation'](_0x2bd87f)['execute'](),this['items']['splice'](_0x594a48,0x1),this['fire']('itemRemoved',{'itemId':_0x2bd87f}),!0x0;}catch(_0x57dccc){return this['fire']('error',{'error':_0x57dccc,'operation':'removeItem','itemId':_0x2bd87f}),!0x1;}}['getItem'](_0x3e24ec){return this['items']['find'](_0x296a2b=>_0x296a2b['id']===_0x3e24ec);}async['updateItemTitle'](_0x31ad9e,_0x2a7720){const _0x31d7b0=this['getItem'](_0x31ad9e);if(!_0x31d7b0)return!0x1;try{return await this['connector']['updateConversation'](_0x31ad9e,{'title':_0x2a7720})['getResult'](),_0x31d7b0['updateTitle'](_0x2a7720),this['fire']('itemUpdated',{'itemId':_0x31ad9e,'updates':{'title':_0x2a7720}}),!0x0;}catch(_0x16cbe1){return this['fire']('error',{'error':_0x16cbe1,'operation':'updateItemTitle','itemId':_0x31ad9e}),!0x1;}}async['updateItemPinned'](_0x4356f9,_0x1ffdcc){const _0x85abe2=this['getItem'](_0x4356f9);if(!_0x85abe2)return!0x1;try{return await this['connector']['updateConversation'](_0x4356f9,{'pinned':_0x1ffdcc})['getResult'](),_0x85abe2['updatePinned'](_0x1ffdcc),this['fire']('itemUpdated',{'itemId':_0x4356f9,'updates':{'pinned':_0x1ffdcc}}),!0x0;}catch(_0x13c0a8){return this['fire']('error',{'error':_0x13c0a8,'operation':'updateItemPinned','itemId':_0x4356f9}),!0x1;}}['loadItems'](_0x1b7daf){try{this['items']=[],_0x1b7daf['map'](_0x592385=>{this['addItem'](new AIChatHistoryItem(_0x592385));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x5096a8){this['fire']('error',{'error':_0x5096a8,'operation':'loadItems'});}}['getItems'](_0x2358dc={}){const _0x3eac13=void 0x0!==_0x2358dc['pinned']&&_0x2358dc['pinned'],_0x419a14=_0x2358dc['from']?new Date(_0x2358dc['from']['getFullYear'](),_0x2358dc['from']['getMonth'](),_0x2358dc['from']['getDate']()):null,_0xd2e58c=_0x2358dc['to']?new Date(_0x2358dc['to']['getFullYear'](),_0x2358dc['to']['getMonth'](),_0x2358dc['to']['getDate']()):null;return this['items']['filter'](_0x289031=>{if(_0x289031['pinned']!==_0x3eac13)return!0x1;if(_0xd2e58c){const _0x510f07=new Date(_0x289031['createdAt']['getFullYear'](),_0x289031['createdAt']['getMonth'](),_0x289031['createdAt']['getDate']());return _0x419a14?_0x419a14['getTime']()===_0xd2e58c['getTime']()?_0x510f07['getTime']()===_0x419a14['getTime']():_0x510f07<_0xd2e58c&&_0x510f07>=_0x419a14:_0x510f07<_0xd2e58c;}return!0x0;});}}class AIChatHistoryController extends _0x179c1c{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x524eaa=this['context']['plugins']['get'](AITabs);try{const _0x4180de=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x4180de}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x38fa26,_0x404ac0)=>{this['_setItemLoading'](_0x404ac0['id'],'remove'),this['_handleRemove'](_0x404ac0['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x247933,_0x5badf3)=>{this['_setItemLoading'](_0x5badf3['id'],'rename'),this['_handleEditTitle'](_0x5badf3['id'],_0x5badf3['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x52f57e,_0x444dad)=>{void 0x0!==_0x444dad['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x444dad['itemId'],_0x444dad['updates']['title']),void 0x0!==_0x444dad['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x444dad['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x40af36,_0x9689e6)=>{this['_aiChatController']['_handleRemovedConversation'](_0x9689e6['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x9689e6['itemId']),this['_clearItemLoading'](_0x9689e6['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x446737,_0x112e42)=>{this['_handleHistoryErrorUI'](_0x112e42['error'],_0x112e42['operation'],_0x112e42['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x3758df,_0x3b2686)=>{this['_handleSelectConversation'](_0x3b2686['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x377d69,_0x749786)=>{const _0x416fbe=_0x749786['pinned']?'pin':'unpin';this['_setItemLoading'](_0x749786['id'],_0x416fbe),this['_handleTogglePin'](_0x749786['id'],_0x749786['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x524eaa['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x524eaa['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x112228){this['_handleHistoryErrorUI'](_0x112228,'init');}}async['_handleEditTitle'](_0x309b84,_0x421122){await this['history']['updateItemTitle'](_0x309b84,_0x421122);}async['_handleTogglePin'](_0xaebe97,_0x3f9ba6){await this['history']['updateItemPinned'](_0xaebe97,_0x3f9ba6);}async['_handleRemove'](_0x5911b1){await this['history']['removeItem'](_0x5911b1);}async['_handleSelectConversation'](_0x475962){await this['_aiChatController']['loadConversation'](_0x475962);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x1ba869=this['_aiChatController']['activeConversation']?.['id'],_0x5cec18=this['_getCategorizedItems']()['map'](_0x1a21f8=>({'title':_0x1a21f8['title'],'items':_0x1a21f8['items']['map'](_0xe6f250=>({'id':_0xe6f250['id'],'title':_0xe6f250['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0xe6f250['createdAt'])['toLocaleDateString'](),'active':_0xe6f250['id']===_0x1ba869,'pinned':_0xe6f250['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x5cec18);}['_setItemLoading'](_0x3afe89,_0xe93abc){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3afe89,_0xe93abc,!0x0);}['_clearItemLoading'](_0x5d8f38){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x5d8f38,null,!0x1);}['_handleHistoryErrorUI'](_0x26e2ae,_0x1bbd83,_0x441de7){const _0x200c67=this['_generateErrorMessage'](_0x1bbd83,_0x441de7);this['_aiChatHistoryUi']['showError'](_0x200c67),_0x441de7&&this['_clearItemLoading'](_0x441de7),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x3c72dd,_0xdd0515){const _0x32f273=_0xdd0515?this['history']['getItem'](_0xdd0515):null,_0x16a1a5=_0x32f273?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x3c72dd){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x16a1a5);case'updateItemPinned':{const _0x4b28c8=Mi(this['context']['locale'],_0x32f273?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x4b28c8,_0x16a1a5]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x16a1a5);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x5c3918=new Date(),_0x315cc6=new Date(_0x5c3918['getFullYear'](),_0x5c3918['getMonth'](),_0x5c3918['getDate']()),_0x41eed6=new Date(_0x315cc6);_0x41eed6['setDate'](_0x41eed6['getDate']()-0x1);const _0x2a7182=new Date(_0x315cc6);_0x2a7182['setDate'](_0x2a7182['getDate']()-0xe);const _0xaf600c=this['history']['getItems']({'pinned':!0x0}),_0x3e365a=this['history']['getItems']({'from':_0x315cc6,'to':_0x315cc6}),_0x3e05f7=this['history']['getItems']({'from':_0x41eed6,'to':_0x41eed6}),_0x1d6804=this['history']['getItems']({'from':_0x2a7182,'to':_0x41eed6}),_0x9bad2d=this['history']['getItems']({'to':_0x2a7182}),_0x3799aa=[];return _0xaf600c['length']>0x0&&_0x3799aa['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0xaf600c}),_0x3e365a['length']>0x0&&_0x3799aa['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x3e365a}),_0x3e05f7['length']>0x0&&_0x3799aa['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x3e05f7}),_0x1d6804['length']>0x0&&_0x3799aa['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x1d6804}),_0x9bad2d['length']>0x0&&_0x3799aa['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x9bad2d}),_0x3799aa;}}class AIChatHistory extends _0x179c1c{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x179c1c{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x39530c){super(_0x39530c),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends yt{['id'];constructor(_0x5760f3,_0x39096a){super(_0x5760f3);const {id:_0xed76e7,type:_0x536bd3,icon:_0x1631c8}=_0x39096a;this['id']=_0xed76e7,this['set']({'label':_0x39096a['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x39096a['id']}}),_0x1631c8?this['icon']=_0x1631c8:'chat'===_0x536bd3?this['icon']=_0x23f8a8:'review'===_0x536bd3?this['icon']=_0x3c89ba:'translate'===_0x536bd3&&(this['icon']=_0x355ab3);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x4cbc1b,_0x2cbe7b){super(_0x4cbc1b),this['set']('isEnabled',!0x0);const _0x403cd0=_0x2cbe7b['map'](_0x5f042f=>{const _0x209f7e=new Ht(this['locale']),_0x22b470=new AIChatShortcutView(this['locale'],_0x5f042f);return _0x22b470['bind']('isEnabled')['to'](this),_0x209f7e['children']['add'](_0x22b470),_0x22b470['delegate']('execute')['to'](this),_0x209f7e;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x403cd0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Gn='chat-shortcuts';class AIChatShortcuts extends _0x179c1c{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x1833f0=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x308089=_0x1833f0['activeConversation'];_0x308089['isFromHistory']||this['_injectShortcuts'](_0x308089);}),this['listenTo'](_0x1833f0,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x1d006f=['chat','review','translate'];this['_shortcuts']['forEach'](_0x434f82=>{let _0x1e6c58=!0x0;if(_0x434f82['id']&&_0x434f82['label']&&_0x1d006f['includes'](_0x434f82['type'])?'chat'===_0x434f82['type']&&(_0x1e6c58='string'==typeof _0x434f82['prompt']):_0x1e6c58=!0x1,!_0x1e6c58)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x434f82});});}['_injectShortcuts'](_0x4e6e2c){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Gn),this['_shortcutsView']['on']('execute',_0x2a8761=>{const _0x1b3d5b=_0x2a8761['source']['id'];this['_executeShortcut'](_0x1b3d5b);}),this['_listenedConversation']=_0x4e6e2c,this['listenTo'](_0x4e6e2c,'uploadProgressChanged',(_0x3eef02,_0x14dc58)=>{this['_shortcutsView']['isEnabled']=!_0x14dc58['isUploadInProgress'];});}['_removeShortcuts'](){const _0x1cc10f=this['context']['plugins']['get'](AIChatUI);_0x1cc10f['hasFeedItem'](Gn)&&_0x1cc10f['removeFeedItem'](Gn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x24c593){const _0x4ab328=this['_shortcuts']['find'](_0xa64151=>_0xa64151['id']===_0x24c593),_0x52ae07=_0x4ab328['type'];'chat'===_0x52ae07?this['_runChatShortcut'](_0x4ab328):'review'===_0x52ae07?_0x4ab328['commandId']?this['_runReviewShortcut'](_0x4ab328):this['_switchTab']('reviewMode'):'translate'===_0x52ae07&&(_0x4ab328['language']?this['_runTranslateShortcut'](_0x4ab328):this['_switchTab']('translate'));}['_switchTab'](_0x3eccd2){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x3eccd2});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x3eccd2);}async['_runChatShortcut']({prompt:_0x303a39,draftMode:_0x320e96,useWebSearch:_0x5e5d42=!0x1,useReasoning:_0x2d07f4=!0x1,model:_0x1e0549}){const _0x2e4531=this['context']['plugins']['get']('AIChatController'),_0x555ec8=_0x2e4531['activeConversation'];let _0x2765b3;_0x2765b3=_0x1e0549?await _0x555ec8['chatModels']['getModel'](_0x1e0549):await _0x555ec8['chatModels']['getDefault'](),_0x2765b3&&await _0x555ec8['setModel'](_0x2765b3),_0x555ec8['setWebSearch'](_0x5e5d42),_0x555ec8['setReasoning'](_0x2d07f4),_0x2e4531['addCurrentDocumentToChatContext'](),_0x320e96?(this['_aiChatUI']['setPromptInputValue'](_0x303a39),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x2e4531['sendMessage']({'message':_0x303a39});}['_runReviewShortcut']({commandId:_0x270112,model:_0x3fb6f7,prompt:_0x42fd32,params:_0x1cff47}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x59da89={'id':_0x270112,'isCustom':'custom'===_0x270112};_0x3fb6f7&&_0x42fd32&&(_0x59da89['args']={'model':_0x3fb6f7,'prompt':_0x42fd32}),_0x1cff47&&(_0x59da89['params']=_0x1cff47),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x59da89);}['_runTranslateShortcut']({language:_0x1867ab}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x1867ab,'args':{'language':_0x1867ab}});}}class ToggleAICommand extends _0x588cbb{constructor(_0x154065){super(_0x154065);const _0x41eb97=_0x154065['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x41eb97,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x5e6975=this['editor']['plugins']['get']('AITabs')['view'];_0x5e6975['isVisible']=!_0x5e6975['isVisible'];}}class AIToggleButtonUI extends _0x49edc5{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5221a0=this['editor'];_0x5221a0['commands']['add']('toggleAi',new ToggleAICommand(_0x5221a0)),_0x5221a0['ui']['componentFactory']['add']('toggleAi',()=>{const _0x361128=this['_createAIUIButton'](yt);return _0x361128['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x361128;}),_0x5221a0['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3d3850=this['_createAIUIButton'](Yt);return _0x3d3850['set']({'role':'menuitemcheckbox'}),_0x3d3850;});}['_createAIUIButton'](_0x559d48){const _0xfdb54b=this['editor'],_0x7cc9ee=_0xfdb54b['commands']['get']('toggleAi'),_0x14fc5b=new _0x559d48(_0xfdb54b['locale']);return _0x14fc5b['set']({'label':Mi(_0xfdb54b['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x5e930d,'isToggleable':!0x0}),_0x14fc5b['bind']('isEnabled')['to'](_0x7cc9ee),_0x14fc5b['bind']('isOn')['to'](_0x7cc9ee,'value',_0x73953f=>!!_0x73953f),this['listenTo'](_0x14fc5b,'execute',()=>{_0x7cc9ee['execute']();}),_0x14fc5b;}}const Fn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x28cf58){super(_0x28cf58),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x12b1ef){this['showError'](_0x12b1ef);}['showError'](_0x29df76){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x29df76,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x521812=new Nt(this['locale']),_0x4be8dc=new Nt(this['locale']);return _0x4be8dc['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x521812['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2abcac=>!_0x2abcac)]},'children':[_0x4be8dc]}),_0x521812;}}const Wn=0xa;class AIBalloon extends _0x179c1c{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x1a035e){const {id:_0x1b201e}=this['_currentConfig']??{};this['_currentConfig']=_0x1a035e,this['_editor']=_0x1a035e['targetEditor'];const {id:_0x1e66b9}=this['_currentConfig'];this['isOpen']&&_0x1b201e===_0x1e66b9?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x1b41b2=this['_editor'];if(!_0x1b41b2)return;const _0xc08af8=_0x1b41b2['plugins']['get']('Dialog');_0xc08af8['isOpen']&&this['_currentConfig']&&_0xc08af8['id']===this['_currentConfig']['id']&&_0xc08af8['hide']();}['_updateDialog'](){const _0x18cf80=this['_editor']['plugins']['get']('Dialog'),{icon:_0x22bf5c,title:_0x500069}=this['_currentConfig'];_0x18cf80['view']?.['headerView']&&(_0x18cf80['view']['headerView']['label']=_0x500069,_0x18cf80['view']['headerView']['iconView']&&_0x22bf5c&&(_0x18cf80['view']['headerView']['iconView']['content']=_0x22bf5c)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x18cf80['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x5832e4=this['_editor']['plugins']['get']('Dialog'),{id:_0x89a772,title:_0x3a9358,icon:_0x524a75,class:_0x3c7f5f,mainView:_0xaca618}=this['_currentConfig'];_0xaca618['delegate'](...Fn)['to'](this),_0x5832e4['show']({'title':_0x3a9358,'icon':_0x524a75,'hasCloseButton':!0x0,'id':_0x89a772,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x3c7f5f||''),'content':_0xaca618,'onShow':_0x45149e=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x45149e['view']?.['updatePosition']();const _0x15e2f2=this['_getSelectionElements']();_0x15e2f2&&_0x15e2f2[0x0]&&Tt({'target':_0x15e2f2[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x45149e['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x89a772});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x89a772}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x16d176,_0x105f4f){if(!_0x105f4f){const _0x424756=this['_getTargetRootDomRect']();if(!_0x424756)return null;_0x105f4f=_0x424756;}const _0xfb1bbb=this['_getSelectionElements']();if(!_0xfb1bbb||0x0===_0xfb1bbb['length'])return{'left':Math['round'](_0x105f4f['left']+_0x105f4f['width']/0x2-_0x16d176['width']/0x2),'top':Math['round'](_0x105f4f['top']+_0x105f4f['height']/0x2-_0x16d176['height']/0x2)};const _0x2a459b=Math['round'](_0x105f4f['left']+_0x105f4f['width']/0x2-_0x16d176['width']/0x2),_0x47c032=_0xfb1bbb['map'](_0x49f6c9=>new dt(_0x49f6c9)),_0x13fea0=_0x16d176['height'];return{'left':_0x2a459b,'top':this['_calculateOptimalTopPosition'](_0x47c032,_0x13fea0,_0x105f4f)};}['_calculateOptimalTopPosition'](_0x4a37a5,_0x148c82,_0x536af1){const _0x52058e=new dt(lt['window']),_0x8f6282=_0x4a37a5['map'](_0x18a1e3=>_0x18a1e3['getVisible']())['filter'](_0x2796c7=>_0x2796c7),_0x2d6731=dt['getBoundingRect'](_0x8f6282);if(!_0x2d6731)return Math['round'](_0x536af1['top']+_0x536af1['height']/0x2);const _0x1341f0=_0x52058e['getIntersection'](_0x2d6731);if(!_0x1341f0)return Math['round'](_0x536af1['top']+_0x536af1['height']/0x2);const _0x5368cc=_0x536af1['getVisible'](),_0x4fd2ca=_0x5368cc&&_0x2d6731['height']>_0x5368cc['height'],_0x1923b6=_0x1341f0['top'],_0x21dcf3=_0x1341f0['bottom'];if(_0x4fd2ca){const _0x1edb7c=(_0x5368cc||_0x52058e)['height']/0x2-_0x148c82/0x2,_0x55570a=_0x1923b6-Wn-_0x536af1['top'],_0x25bc78=_0x536af1['bottom']-_0x21dcf3-Wn;return _0x55570a>=_0x148c82?Math['max'](Wn,_0x1923b6-_0x148c82-Wn):_0x25bc78>=_0x148c82?_0x21dcf3+Wn:Math['max'](Wn,_0x1edb7c);}const _0x5027bd=_0x1923b6-_0x148c82,_0x3b0051=_0x536af1['bottom']-_0x21dcf3-Wn,_0x2cbbdd=_0x1923b6-Wn-_0x536af1['top'];let _0x4bc3d8;if(_0x3b0051>=_0x148c82)_0x4bc3d8=_0x21dcf3+Wn;else{if(_0x2cbbdd>=_0x148c82)_0x4bc3d8=_0x5027bd-Wn;else _0x4bc3d8=_0x1923b6+_0x2d6731['height']/0x2-_0x148c82/0x2;}return _0x4bc3d8;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x283c54=this['_editor'];this['listenTo'](_0x283c54['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x303c1e,data:{newRange:_0x3af6a5}}of _0x283c54['model']['document']['differ']['getChangedMarkers']())if(_0x303c1e['startsWith'](Rs+':')&&(_0x3af6a5&&(_0x3af6a5['start']['isEqual'](_0x3af6a5['end'])||'$graveyard'==_0x3af6a5['root']['rootName'])||null==_0x3af6a5)){const _0x3bdfb1=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x3bdfb1),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x309236=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x309236['model']['document']);}['_getSelectionElements'](){const _0x556ce8=this['_editor'];return _0x35a2b6(_0x556ce8['editing'],[..._0x556ce8['model']['markers']['getMarkersGroup']('ai-selection'),..._0x556ce8['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x2685f7=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x2685f7)return null;const _0xa52f80=this['_editor'],_0x4f7f47=_0xa52f80['editing']['view']['document']['getRoot'](_0x2685f7['rootName']);if(!_0x4f7f47)return null;const _0x295ae6=_0xa52f80['editing']['view']['domConverter']['mapViewToDom'](_0x4f7f47);return _0x295ae6&&_0x295ae6 instanceof HTMLElement?new dt(_0x295ae6):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x51d07f,_0x181b08={}){super(_0x51d07f),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x181b08};const _0x5599b5=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x5599b5?'ck-ai-mini-toolbar\x20ck-hidden':'ck-ai-mini-toolbar',this['_config']['showCopy']&&(this['_setupCopyButton'](),this['items']['add'](this['copyButton'])),this['_config']['showChanges']&&(this['_setupShowChangesButton'](),this['items']['add'](this['showChangesButton'])),this['_setupRatingButtons'](),this['_config']['showLike']&&this['items']['add'](this['likeButton']),this['_config']['showDislike']&&this['items']['add'](this['dislikeButton']),this['_config']['customView']&&this['items']['addMany'](this['_config']['customView']);}['toggleShowChangesEnabled'](_0x173754){this['showChangesButton']['isEnabled']=_0x173754;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x507dcd,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0x2836d8,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x7e1abc,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x4f0996=new Lt();_0x4f0996['set']({'content':_0x491051}),_0x4f0996['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x4f0996);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x855da,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x38286f=>_0x38286f?_0x40c492:_0x855da),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x4f9d9d,_0x4c5aa2){super(_0x4f9d9d);const _0x152329=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x4c5aa2,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x4f9d9d),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x4f9d9d,_0x4c5aa2['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x4c5aa2),this['_stateView']=new AISuggestionContentPartStateView(_0x4f9d9d),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x4f9d9d,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x4f9d9d,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0xa8e254,_0x189c9e,_0x2a8057,_0x2ab9c1)=>{let _0x41e048,_0xa9b3b7;'pending'===_0x2ab9c1?(_0x41e048=this['_partToolbarView'],_0xa9b3b7=this['_stateView']):(_0x41e048=this['_stateView'],_0xa9b3b7=this['_partToolbarView']),this['_stateView']['setState'](_0x2a8057),_0x41e048['isVisible']=!0x1,_0xa9b3b7['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x152329['to']('_state',_0x5081a4=>'ck-ai-chat-balloon-main_state_'+_0x5081a4)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x4c5aa2);});}['render'](){super['render'](),this['nextButtonView']['render'](),this['previousButtonView']['render'](),this['_focusTracker']['add'](this['element']),this['_focusTracker']['add'](this['nextButtonView']),this['_focusTracker']['add'](this['previousButtonView']),this['_focusTracker']['add'](this['_miniToolbarView']),this['_focusTracker']['add'](this['_partToolbarView']),this['_keystrokes']['listenTo'](this['element']),this['_keystrokes']['listenTo'](this['nextButtonView']['element']),this['_keystrokes']['listenTo'](this['previousButtonView']['element']),this['_focusables']['addMany']([this['nextButtonView'],this['previousButtonView'],this['_partToolbarView'],this['_miniToolbarView']]);}['destroy'](){super['destroy'](),this['previousButtonView']['destroy'](),this['nextButtonView']['destroy']();}['focus'](){this['focusCycler']['focusFirst']();}['focusLast'](){this['focusCycler']['focusLast']();}async['updateContent'](_0x5a8cec){_0x5a8cec?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x5a8cec);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x82d87e){this['_state']=_0x82d87e;}['showError'](_0x3e269e){super['showError'](_0x3e269e),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x556629){super['showBlockingError'](_0x556629),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x134859){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x134859;}['togglePartToolbarEnabled'](_0x10903f){this['_partToolbarView']['isEnabled']=_0x10903f;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x43cb59,showSuggestButton:_0x183277}){_0x43cb59=_0x43cb59&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x183277=_0x183277&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x43cb59,'showSuggestButton':_0x183277});}['_createNextButtonView'](){const _0x13b748=new yt(this['locale']);return _0x13b748['set']({'icon':_0x6c20cd,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x13b748['on']('execute',()=>{this['fire']('showNext');}),_0x13b748;}['_createPreviousButtonView'](){const _0x55a696=new yt(this['locale']);return _0x55a696['set']({'icon':_0x162447,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x55a696['on']('execute',()=>{this['fire']('showPrevious');}),_0x55a696;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x36d04c,_0x273097){super(_0x36d04c),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x273097});}}class AIChatBalloon extends _0x49edc5{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x53523c){super(_0x53523c),this['set']('showDiff',!0x1);}['open'](_0x48996b){const _0x124ff3=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x124ff3['plugins']['get']('AIBalloon')['open']({..._0x48996b,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x48996b['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x48996b['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x26e8f7){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x26e8f7);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x96369e){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x96369e);}['_createChatBalloonView'](){const _0x202572=this['editor'],_0x257816=_0x202572['plugins']['get']('AIBalloon'),_0x1e398b=_0x202572['commands']['get']('trackChanges');let _0x5fe3ff=_0x202572['config']['get']('ai.availableReplyActions')||[...Ds];_0x202572['plugins']['has']('TrackChanges')||(_0x5fe3ff=_0x5fe3ff['filter'](_0x471f4c=>'insertSuggestion'!=_0x471f4c));const _0x11dada=new AIChatBalloonView(_0x202572['locale'],{'availableActions':_0x5fe3ff,'showApplyButton':!0x0,'showSuggestButton':!!_0x1e398b});return _0x11dada['bind']('showDiff')['to'](this),_0x11dada['delegate'](...Ss)['to'](this),_0x11dada['delegate']('showPrevious','showNext')['to'](this),_0x257816['delegate']('dialogClosed')['to'](this),_0x11dada['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x11dada['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x11dada['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1e398b&&_0x11dada['bind']('isTrackChangesOn')['to'](_0x1e398b,'value'),_0x11dada['render'](),_0x11dada;}['_toggleRotatorButtonsInDialogHeader'](_0x58e059){const _0x35aa49=this['editor'],_0x5b34e2=_0x35aa49['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x58e059),_0x5b34e2['has'](this['_chatBalloonView']['previousButtonView'])||(_0x5b34e2['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x35aa49['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x5b34e2['remove'](this['_chatBalloonView']['previousButtonView']),_0x5b34e2['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x49edc5{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x580927];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Kn(_0xa11c7b){const {editor:_0x5abfe1,action:_0x5bbf95,withText:_0x95cd2b=!0x1,withIcon:_0x204ab5=!0x0,isInDropdown:_0xb9cfa9=!0x0,shouldPreventFocus:_0x24de62=!0x1,actionButtons:_0x5867fd}=_0xa11c7b;return()=>{const _0x2dde43=_0x5abfe1['locale'],_0x51fa42=new yt(_0x2dde43),_0x28c92f=_0x51fa42['bindTemplate'];_0xb9cfa9&&_0x51fa42['extendTemplate']({'on':{'mouseenter':_0x28c92f['to'](()=>{_0x24de62&&_0x24de62()||_0x51fa42['focus']();})}}),_0x5867fd['push']({'buttonView':_0x51fa42,'action':_0x5bbf95});const _0x1e5301=_0x5bbf95['icon']??_0x5bbf95['parent']?.['icon'];return _0x51fa42['set']({'label':_0x5bbf95['label'],'withText':_0x95cd2b,'role':'menuitem','icon':_0x204ab5?_0x1e5301??_0x279395:void 0x0,'tooltip':!_0x95cd2b,'class':'ck-ai-quick-actions-button','isEnabled':_0x5bbf95['isEnabled']}),_0x51fa42['on']('execute',()=>{_0x5abfe1['editing']['view']['focus'](),_0x5abfe1['commands']['execute']('aiQuickAction',_0x5bbf95);}),_0x51fa42;};}class DropdownMenuButtonWithHighlightView extends _0x206b4d{['arrowView'];constructor(_0x1852ba,_0x208ee4){super(_0x1852ba,_0x208ee4);const _0x5c08fa=this['bindTemplate'];this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':['ck-dropdown-menu-list__nested-menu__button'],'aria-haspopup':!0x0,'aria-expanded':this['bindTemplate']['to']('isOn',_0x4f48c9=>String(_0x4f48c9)),'data-cke-tooltip-disabled':_0x5c08fa['to']('isOn')},'on':{'mouseenter':_0x5c08fa['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x288903=new Lt();return _0x288903['content']=_0x226b43,_0x288903['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x288903;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x4ae701,_0x247d2f,_0x50a1f3){super(_0x4ae701),this['_allListItems']=_0x247d2f,this['_allSearchableItems']=_0x50a1f3;}['filter'](_0x5992c3){if(!_0x5992c3)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x3a0410=_0x5992c3['source']['toLowerCase']()['trim'](),_0x44d474=this['_allSearchableItems']['filter'](_0x120de8=>(_0x120de8['groupLabel']?_0x120de8['label']+'\x20('+_0x120de8['groupLabel']+')':_0x120de8['label'])['toLowerCase']()['includes'](_0x3a0410));return this['items']['clear'](),this['items']['addMany'](_0x44d474['sort']((_0x24dda8,_0x3fe69a)=>{const _0x3b25bc=_0x24dda8['groupLabel'],_0x3cd772=_0x3fe69a['groupLabel'];return _0x3b25bc||_0x3cd772?_0x3b25bc?0x1:-0x1:0x0;})['map'](_0x5e6c33=>_0x5e6c33['item'])),this['_highlightQuery'](_0x3a0410,_0x44d474),{'resultsCount':_0x44d474['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x48c799,_0x5c7f1c){if(!_0x48c799)return;const _0x588e25=new RegExp(_0x325daf(_0x48c799),'gi');_0x5c7f1c['forEach'](_0xbcc091=>{_0xbcc091['highlightViews']&&_0xbcc091['highlightViews']['forEach'](_0x29c6f1=>{'function'==typeof _0x29c6f1['highlightText']&&_0x29c6f1['highlightText'](_0x588e25);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x569d44=>{_0x569d44['highlightViews']&&_0x569d44['highlightViews']['forEach'](_0x5d0f29=>{'function'==typeof _0x5d0f29['highlightText']&&_0x5d0f29['highlightText'](null);});});}}const Yn='menu',$n='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x3adbc2,_0x3d075f,_0x559e15,_0x123ad5,_0x8aa339=!0x1,_0x398d73=[]){const _0x23ab28=_0x3adbc2['locale'];super(_0x23ab28),this['_bodyCollection']=_0x123ad5,this['_hasSearch']=_0x8aa339,this['_actionButtons']=_0x398d73;const _0x3f5a85=this['_createListItems'](_0x3adbc2,_0x3d075f,_0x559e15);this['optionsListView']=new AIQuickActionsFilteredListView(_0x23ab28,_0x3f5a85,this['_allSearchableItems']),this['optionsListView']['role']=Yn,this['optionsListView']['items']['addMany'](_0x3f5a85),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x8aa339&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x3f5a85,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x8aa339&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x2bfb6c=_0x8aa339&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x3ee0e4(_0x2bfb6c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x23ab28['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0xc66991(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x3d5899=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3d5899);}['_createListItems'](_0x5c1f69,_0x49fed9,_0x20eee7){const _0xbca80c=new _0x3ee0e4();return _0x49fed9['forEach'](_0x22da81=>{if('actions'in _0x22da81){const {listItem:_0x401564}=this['_createActionGroupButton'](_0x5c1f69,_0x22da81,_0x20eee7);_0xbca80c['add'](_0x401564),_0x22da81['actions']['forEach'](_0x5ce77c=>{const {listItem:_0x3e3304,highlightViews:_0x4ffce6}=this['_createSearchResultActionButton'](_0x5c1f69,_0x5ce77c,_0x22da81['label'],_0x22da81['icon']);this['_allSearchableItems']['push']({'item':_0x3e3304,'label':_0x5ce77c['label'],'groupLabel':_0x22da81['label'],'highlightViews':_0x4ffce6});});}else{const {listItem:_0x53660d}=this['_createActionButton'](_0x5c1f69,_0x22da81);_0xbca80c['add'](_0x53660d);const _0x46c525=_0x53660d['children']['first'];if(_0x46c525){const {listItem:_0x21b214,highlightViews:_0x545076}=this['_createSearchResultActionButton'](_0x5c1f69,_0x22da81);this['_allSearchableItems']['push']({'item':_0x21b214,'label':_0x46c525['label']||'','highlightViews':_0x545076});}}}),_0xbca80c;}['_createActionButton'](_0x3078a5,_0x1d0bbc,_0x198cf7,_0x10363e){const _0x17cde6=new Ht(this['locale']);if(_0x198cf7&&_0x10363e){const _0x359023=new yt(this['locale']),_0x315241=_0x359023['bindTemplate'],_0x1b8a7e=new _0x574ada();_0x1b8a7e['text']=_0x1d0bbc['label'];const _0x28a051=new _0x574ada();_0x28a051['text']=_0x198cf7;const _0x30d66f=new Lt();_0x30d66f['content']=_0x10363e,_0x30d66f['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2865fd=new Nt(this['locale']);_0x2865fd['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x4866f4=new Nt(this['locale']);return _0x4866f4['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x359023['set']({'label':_0x1d0bbc['label']+'\x20('+_0x198cf7+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x1d0bbc['isEnabled']}),_0x359023['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x315241['if']('isEnabled','ck-disabled',_0x392352=>!_0x392352)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1b8a7e,_0x2865fd,_0x30d66f,_0x28a051,_0x4866f4],'on':{'mouseenter':_0x315241['to'](()=>{this['_isSearchFocused']()||_0x359023['focus']();}),'click':_0x315241['to'](()=>{_0x359023['fire']('execute');})}}),_0x359023['on']('execute',()=>{_0x359023['isEnabled']&&(_0x3078a5['editing']['view']['focus'](),_0x3078a5['commands']['execute']('aiQuickAction',_0x1d0bbc));}),_0x17cde6['children']['add'](_0x359023),this['_actionButtons']['push']({'buttonView':_0x359023,'action':_0x1d0bbc}),{'listItem':_0x17cde6,'highlightViews':[_0x1b8a7e,_0x28a051]};}{const _0x5e6fae=new _0x4c3b9a(),_0x169467=new yt(this['locale'],_0x5e6fae),_0x2c3dc3=_0x169467['bindTemplate'],_0x3e15a1=_0x1d0bbc['icon']??_0x1d0bbc['parent']?.['icon'],_0x5bc00f=void 0x0!==_0x1d0bbc['icon'];return _0x169467['set']({'label':_0x1d0bbc['label'],'withText':!0x0,'role':'menuitem','icon':_0x5bc00f?_0x3e15a1??_0x279395:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x1d0bbc['isEnabled']}),_0x169467['extendTemplate']({'on':{'mouseenter':_0x2c3dc3['to'](()=>{this['_isSearchFocused']()||_0x169467['focus']();})}}),_0x169467['on']('execute',()=>{_0x3078a5['editing']['view']['focus'](),_0x3078a5['commands']['execute']('aiQuickAction',_0x1d0bbc);}),_0x17cde6['children']['add'](_0x169467),this['_actionButtons']['push']({'buttonView':_0x169467,'action':_0x1d0bbc}),{'listItem':_0x17cde6,'highlightViews':[_0x5e6fae]};}}['_createSearchResultActionButton'](_0x274c5d,_0x311577,_0x51247f,_0x23ef59){return _0x51247f&&_0x23ef59?this['_createSearchResultGroupedActionButton'](_0x274c5d,_0x311577,_0x51247f,_0x23ef59):this['_createSearchResultIndividualActionButton'](_0x274c5d,_0x311577);}['_createSearchResultGroupedActionButton'](_0x270e94,_0x568419,_0x1c5077,_0x438b6d){const _0x5806ee=new Ht(this['locale']),_0x17dc30=new yt(this['locale']),_0x4b1ee2=_0x17dc30['bindTemplate'],{view:_0x2db011,highlightView:_0x5b82c1}=this['_createSearchResultGroupRow'](_0x1c5077,_0x438b6d),{view:_0x3ac5c2,highlightView:_0x35aa94}=this['_createSearchResultActionRow'](_0x568419['label']),_0x2823e5=this['_createSearchResultContentView'](_0x2db011,_0x3ac5c2);return _0x17dc30['set']({'label':_0x568419['label'],'withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button\x20ck-ai-quick-actions-search-result-button_with-group','tooltip':!0x1,'isEnabled':_0x568419['isEnabled']}),_0x17dc30['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group',_0x4b1ee2['if']('isEnabled','ck-disabled',_0x37f62a=>!_0x37f62a)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2823e5],'on':{'mouseenter':_0x4b1ee2['to'](()=>{this['_isSearchFocused']()||_0x17dc30['focus']();}),'click':_0x4b1ee2['to'](()=>{this['_handleSearchResultButtonClick'](_0x17dc30);})}}),this['_setupActionButtonExecution'](_0x17dc30,_0x270e94,_0x568419),_0x5806ee['children']['add'](_0x17dc30),this['_actionButtons']['push']({'buttonView':_0x17dc30,'action':_0x568419}),{'listItem':_0x5806ee,'highlightViews':[_0x5b82c1,_0x35aa94]};}['_createSearchResultIndividualActionButton'](_0x2e9bee,_0x1d80c9){const _0x36549e=new Ht(this['locale']),_0x31eef5=new _0x4c3b9a(),_0x2cf3a7=new yt(this['locale'],_0x31eef5),_0xafda7c=_0x2cf3a7['bindTemplate'];return _0x2cf3a7['set']({'label':_0x1d80c9['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x1d80c9['isEnabled']}),_0x2cf3a7['extendTemplate']({'on':{'mouseenter':_0xafda7c['to'](()=>{this['_isSearchFocused']()||_0x2cf3a7['focus']();})}}),this['_setupActionButtonExecution'](_0x2cf3a7,_0x2e9bee,_0x1d80c9),_0x36549e['children']['add'](_0x2cf3a7),this['_actionButtons']['push']({'buttonView':_0x2cf3a7,'action':_0x1d80c9}),{'listItem':_0x36549e,'highlightViews':[_0x31eef5]};}['_createSearchResultGroupRow'](_0x3e5725,_0x2ea910){const _0x5560d8=new Nt(this['locale']),_0x4f30fb=new Lt();_0x4f30fb['content']=_0x2ea910,_0x4f30fb['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3465a7=new _0x574ada();return _0x3465a7['text']=_0x3e5725,_0x5560d8['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x4f30fb,_0x3465a7]}),{'view':_0x5560d8,'highlightView':_0x3465a7};}['_createSearchResultActionRow'](_0x12fb20){const _0x2fdea2=new Nt(this['locale']),_0x2a8253=new _0x574ada();return _0x2a8253['text']=_0x12fb20,_0x2fdea2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x2a8253]}),{'view':_0x2fdea2,'highlightView':_0x2a8253};}['_createSearchResultContentView'](_0x140654,_0x4b576b){const _0xf73f70=new Nt(this['locale']);return _0xf73f70['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x140654,_0x4b576b]}),_0xf73f70;}['_setupActionButtonExecution'](_0x5d18a7,_0x528002,_0x2e9dbe){_0x5d18a7['on']('execute',()=>{_0x5d18a7['isEnabled']&&(_0x528002['editing']['view']['focus'](),_0x528002['commands']['execute']('aiQuickAction',_0x2e9dbe));});}['_createActionGroupButton'](_0x491d21,_0x30d5ab,_0x4b5574){const _0x5609a7=new Ht(this['locale']),_0x16b1b1=new _0x4c3b9a(),_0x30217c=new DropdownMenuButtonWithHighlightView(this['locale'],_0x16b1b1),_0x5dac57=_0x30217c['bindTemplate'],_0x13af4f=this['_getPanelKeystroke'](_0x4b5574),_0x1d92b3=this['_createGroupActionsList'](_0x491d21,_0x30d5ab['actions'],_0x4b5574);_0x30217c['set']({'label':_0x30d5ab['label'],'withText':!0x0,'role':$n,'icon':_0x30d5ab['icon']??_0x279395,'isEnabled':_0x30d5ab['actions']['some'](_0x4df798=>_0x4df798['isEnabled'])}),_0x30217c['extendTemplate']({'on':{'mouseenter':_0x5dac57['to'](()=>{this['_isSearchFocused']()||_0x30217c['focus']();})}});const _0xc4d01c=new zt(this['locale']);return _0xc4d01c['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x5dac57['to'](_0x298dd9=>{this['_handlePanelKeydown'](_0x298dd9,_0x13af4f,_0x30217c,_0xc4d01c);})}}),_0x30217c['bind']('isOn')['to'](_0xc4d01c,'isVisible'),this['_bodyCollection']['add'](_0xc4d01c),_0xc4d01c['content']['add'](_0x1d92b3),this['_setupGroupMenuBehavior'](_0x30217c,_0xc4d01c),_0x5609a7['children']['add'](_0x30217c),this['_actionButtons']['push']({'buttonView':_0x30217c,'action':_0x30d5ab}),{'listItem':_0x5609a7,'highlightView':_0x16b1b1};}['_createGroupActionsList'](_0x525c88,_0x470a22,_0x325608){const _0x442382=new Dt(this['locale']);return _0x442382['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x470a22['forEach'](_0x4524e2=>{const _0x548f5b=new Ht(this['locale']),_0x210adf=Kn({'editor':_0x525c88,'action':_0x4524e2,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x548f5b['children']['add'](_0x210adf),_0x325608['focusTracker']['add'](_0x210adf),_0x442382['items']['add'](_0x548f5b);}),_0x442382;}['_setupGroupMenuBehavior'](_0x28e4c1,_0x54ebc9){const _0x4f792c=_0x28e4c1['bindTemplate'],_0x3f0cc4=this['_getButtonKeystroke'](_0x28e4c1);_0x28e4c1['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x4f792c['to'](()=>{this['_showNestedPanel'](_0x54ebc9,_0x28e4c1);}),'mouseleave':_0x4f792c['to'](_0x417c2f=>{const _0x58cc0f=_0x417c2f['relatedTarget'];this['_isMovingToNestedMenu'](_0x58cc0f,_0x54ebc9)||this['_hideNestedPanel'](_0x54ebc9);}),'keydown':_0x4f792c['to'](_0x429968=>{_0x429968['key']==_0x3f0cc4&&(this['_showNestedPanel'](_0x54ebc9,_0x28e4c1),_0x54ebc9['content']['get'](0x0)['focus']());})}}),_0x54ebc9['on']('render',()=>{_0x54ebc9['element']?.['addEventListener']('mouseleave',_0x4f336e=>{const _0x40f886=_0x4f336e['relatedTarget'];_0x28e4c1['element']?.['contains'](_0x40f886)||this['_isMovingToNestedMenu'](_0x40f886,_0x54ebc9)||this['_hideNestedPanel'](_0x54ebc9);});});}['_showNestedPanel'](_0x316f3c,_0x1d3324){this['_openNestedPanels']['forEach'](_0x12390e=>{_0x12390e!==_0x316f3c&&_0x12390e['isVisible']&&_0x12390e['hide']();}),_0x316f3c['show'](),_0x316f3c['pin']({'positions':[_0x59f796['eastSouth']],'target':_0x1d3324['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x316f3c);}['_hideNestedPanel'](_0x8fd2d5){_0x8fd2d5['hide'](),this['_openNestedPanels']['delete'](_0x8fd2d5);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x1cf598=>_0x1cf598['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x2d66ea,_0x1ee0ec){if(!_0x2d66ea)return!0x1;if(_0x1ee0ec['element']?.['contains'](_0x2d66ea))return!0x0;const _0x3d4057=_0x2d66ea;return _0x3d4057['closest']&&(null!==_0x3d4057['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x3d4057['closest']('.ck-ai-quick-actions-group-list')||null!==_0x3d4057['closest']('.ck-ai-quick-actions-group-button'));}['resetSearch'](){this['_searchTextView']&&this['_searchTextView']['reset']();}['destroy'](){this['_hideAllNestedPanels'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['focus'](){this['_searchTextView']?this['_searchTextView']['focus']():this['optionsListView']['focus']();}['_getPanelKeystroke'](_0x200a37){return'rtl'===_0x200a37['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x33074c){return'rtl'===_0x33074c['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x1d292d,_0x48b191,_0x259378,_0x42d305){_0x1d292d['key']==_0x48b191&&(_0x259378['focus'](),this['_hideNestedPanel'](_0x42d305));}['_handleSearchResultButtonClick'](_0x25c208){_0x25c208['fire']('execute');}}function qn(_0x3548a3){const {editor:_0x20c260,content:_0x25c97b,buttonDefinition:_0x57c359,bodyCollection:_0x3f73ed,hasSearch:_0x411f18=!0x1,actionButtons:_0x480711}=_0x3548a3;return()=>{const _0x406529=_0x20c260['locale'],_0x1cb3de=_0x20c260['commands']['get']('aiQuickAction'),_0x2f4d66=Ft(_0x406529);_0x2f4d66['bind']('isEnabled')['to'](_0x1cb3de),_0x2f4d66['buttonView']['set']({'icon':_0x57c359['icon']??_0x279395,'label':_0x57c359['label'],'tooltip':!0x0}),_0x2f4d66['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x5edcbd=new AIQuickActionsDropdownContentView(_0x20c260,_0x25c97b,_0x2f4d66,_0x3f73ed,_0x411f18,_0x480711);return _0x2f4d66['panelView']['children']['add'](_0x5edcbd),_0x411f18&&_0x2f4d66['on']('change:isOpen',(_0x34b45b,_0x2961eb,_0x5c9934)=>{if(_0x5c9934){if(_0x20c260['plugins']['has']('AIEditing')){const _0x588ab8=_0x20c260['plugins']['get'](AIEditing),_0x1a0e4d=_0x20c260['model']['document']['selection'],_0x8265ce=Array['from'](_0x1a0e4d['getRanges']());_0x8265ce['length']>0x0&&_0x588ab8['showFakeVisualSelection']({'editor':_0x20c260,'ranges':_0x8265ce,'id':'quick-action','priority':0x14});}}else _0x20c260['plugins']['has']('AIEditing')&&_0x20c260['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x5edcbd['resetSearch']();}),_0x2f4d66;};}const Qn='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Xn='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',zn='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',jn=/* #__PURE__ -- @preserve */
|
|
28
|
-
((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x49edc5{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x15f36b,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x9568d0=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x9568d0),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x223b9b){return function(_0x2dfa59){const _0x45aa56=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x2dfa59['uiLanguage']),_0x39cf7e=_0x45aa56||'English',_0x5ed2bd=[{'id':'ask-ai','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x151286},{'id':'chat-commands','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x151286,'actions':[{'id':'explain','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Qn['replace']('%0',_0x39cf7e),'type':'chat'},{'id':'summarize','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Xn['replace']('%0',_0x39cf7e),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':zn['replace']('%0',_0x39cf7e),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x5ab2d4},{'id':'continue','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x4e6981},{'id':'fix-grammar','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x575687},{'id':'adjust-length','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x5c17e8,'actions':[{'id':'make-shorter','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x36ae18,'actions':[{'id':'make-tone-casual','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x355ab3,'actions':[{'id':'translate-to-english','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x2dfa59,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x5ed2bd;}(_0x223b9b);}['_getDefaultAndCustomActions'](){const _0x4182a1=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x57dc4b=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x557f34=>({..._0x557f34,'type':'chat'===_0x557f34['type']?'chat':'action','icon':void 0x0}));return _0x4182a1['find'](_0x120b21=>'other'===_0x120b21['id'])['actions']['push'](..._0x57dc4b),_0x4182a1;}async['_initActionTypeQuickActions'](){try{const _0x2dffbf=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x3cfecc=await _0x2dffbf['getAll'](),_0x312c4c=(await _0x2dffbf['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x312c4c),this['_enableButtonsByType']('action',_0x5a833c=>!!_0x3cfecc['find'](_0x3f7639=>_0x3f7639['id']===_0x5a833c['model'])||void 0x0===_0x5a833c['model']);}catch(_0x3b756c){const _0x1d9d4f=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x3b756c});Ct(_0x1d9d4f['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x3e7a4c=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x3e7a4c,'change:isConversationReady',(_0x3ae4c6,_0x3d75b0,_0x157a55)=>{_0x157a55&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x3e7a4c['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x2647b7,_0x181976){this['_quickActionsDefinition']['forEach'](_0x2f798b=>{'actions'in _0x2f798b?_0x2f798b['actions']['forEach'](_0x1fcc00=>{_0x1fcc00['type']===_0x2647b7&&(_0x1fcc00['isEnabled']=_0x181976(_0x1fcc00));}):_0x2f798b['type']===_0x2647b7&&(_0x2f798b['isEnabled']=_0x181976(_0x2f798b));}),this['_actionButtons']['forEach'](_0x21b7c0=>{if(Jn(_0x21b7c0['action']))return;if(_0x21b7c0['action']['type']!==_0x2647b7)return;const _0x51f037=_0x181976(_0x21b7c0['action']);if(_0x21b7c0['action']['isEnabled']=_0x51f037,_0x21b7c0['buttonView']['isEnabled']=_0x51f037,!_0x51f037&&_0x21b7c0['action']['model']){const _0x3a2b31=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x21b7c0['action']['id'],'modelId':_0x21b7c0['action']['model']});Ct(_0x3a2b31['message']);}}),this['_actionButtons']['filter'](_0x22f7b7=>Jn(_0x22f7b7['action']))['forEach'](_0x4780b9=>{_0x4780b9['buttonView']['isEnabled']=_0x4780b9['action']['actions']['some'](_0x4d97f3=>_0x4d97f3['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x310cc3,group:_0x579ba0})=>{_0x310cc3['isEnabled']=_0x579ba0['actions']['some'](_0x4b9f53=>_0x4b9f53['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x488360){this['_actionButtons']['forEach'](_0x426e37=>{Jn(_0x426e37['action'])||'action'===_0x426e37['action']['type']&&(_0x426e37['action']['model']||(_0x426e37['action']['model']=_0x488360));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x22ff53=new Xt(this['editor']['locale']);_0x22ff53['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x22ff53),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x22ff53);}['_initializeQuickActionsDropdown'](_0x5f077d){const _0x3efe24=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',qn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x279395,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x5f077d,'hasSearch':_0x3efe24,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x5195c8){this['_quickActionsDefinition']=_0x5195c8['map'](_0x412e9b=>{if('actions'in _0x412e9b){const _0x17acd4=_0x412e9b;return{..._0x17acd4,'actions':_0x17acd4['actions']['map'](_0x551a78=>{const {actions:_0x2eae26,..._0x18f643}=_0x17acd4;return{..._0x551a78,'isEnabled':!0x1,'parent':_0x18f643};})['filter'](_0x3fffa1=>this['_shouldIncludeAction'](_0x3fffa1))};}return{..._0x412e9b,'isEnabled':!0x1};})['filter'](_0x4d78bc=>'actions'in _0x4d78bc?_0x4d78bc['actions']['length']>0x0:this['_shouldIncludeAction'](_0x4d78bc));}['_shouldIncludeAction'](_0x1dbee8){const _0x13c078=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](jn[_0x1dbee8['type']])&&!_0x13c078['includes'](_0x1dbee8['id'])&&!('chat'===_0x1dbee8['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0xdc792b){this['_quickActionsDefinition']['forEach'](_0x238fbf=>{if('actions'in _0x238fbf){const _0x1dd6ad=qn({'editor':this['editor'],'content':_0x238fbf['actions'],'buttonDefinition':_0x238fbf,'bodyCollection':_0xdc792b,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x238fbf['id'],_0x1dd6ad),_0x238fbf['actions']['forEach'](_0x37c298=>{const _0x3c505d=Kn({'editor':this['editor'],'action':_0x37c298,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x37c298['id'],_0x3c505d);});}else{const _0x3dc58c=Kn({'editor':this['editor'],'action':_0x238fbf,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x238fbf['id'],_0x3dc58c);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x24e8e6=>{const _0x40d69f=this['editor']['commands']['get']('aiQuickAction'),_0x539d59=new Kt(_0x24e8e6),_0x439e0f=Mi(_0x24e8e6,'AI_QUICK_ACTIONS_HEADING');_0x539d59['buttonView']['set']({'label':_0x439e0f,'icon':_0x279395});const _0x409f61=new qt(_0x24e8e6);return _0x409f61['set']({'ariaLabel':_0x439e0f,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x2615e6=>{if('actions'in _0x2615e6){const _0x51b163=_0x2615e6,_0xbf110b=new Qt(_0x24e8e6,_0x539d59),_0x4af3a2=new Kt(_0x24e8e6),_0x225da9=new qt(_0x24e8e6);_0x4af3a2['buttonView']['set']({'label':_0x51b163['label'],'icon':_0x51b163['icon']}),_0x51b163['actions']['forEach'](_0x1ce2eb=>{const _0x5eb76c=new Qt(_0x24e8e6,_0x4af3a2),_0x2c661c=new Yt(_0x24e8e6);_0x2c661c['set']({'label':_0x1ce2eb['label'],'icon':_0x1ce2eb['icon'],'role':'menuitem','isEnabled':_0x1ce2eb['isEnabled']}),_0x2c661c['on']('execute',()=>{this['_executeQuickAction'](_0x1ce2eb);}),this['_actionButtons']['push']({'buttonView':_0x2c661c,'action':_0x1ce2eb}),_0x2c661c['delegate']('execute')['to'](_0x4af3a2),_0x5eb76c['children']['add'](_0x2c661c),_0x225da9['items']['add'](_0x5eb76c);}),_0x4af3a2['isEnabled']=_0x51b163['actions']['some'](_0x536b2c=>_0x536b2c['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x4af3a2,'group':_0x51b163}),_0x4af3a2['panelView']['children']['add'](_0x225da9),_0xbf110b['children']['add'](_0x4af3a2),_0x409f61['items']['add'](_0xbf110b);}else{const _0x1de1d1=_0x2615e6,_0x487ade=new Qt(_0x24e8e6,_0x539d59),_0x3bcdf3=new Yt(_0x24e8e6);_0x3bcdf3['set']({'label':_0x1de1d1['label'],'icon':_0x1de1d1['icon'],'role':'menuitem','isEnabled':_0x1de1d1['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x3bcdf3,'action':_0x1de1d1}),_0x3bcdf3['on']('execute',()=>{this['_executeQuickAction'](_0x1de1d1);}),_0x3bcdf3['delegate']('execute')['to'](_0x539d59),_0x487ade['children']['add'](_0x3bcdf3),_0x409f61['items']['add'](_0x487ade);}}),(Object['values'](jn)['some'](_0x4c4c6d=>this['editor']['plugins']['has'](_0x4c4c6d))?_0x539d59['bind']('isEnabled')['to'](_0x40d69f):_0x539d59['set']({'isEnabled':!0x1}),_0x539d59['panelView']['children']['add'](_0x409f61),_0x539d59);});}['_executeQuickAction'](_0x34e174){const _0x241034=this['editor'];_0x241034['editing']['view']['focus'](),_0x241034['commands']['execute']('aiQuickAction',_0x34e174);const _0x411986=_0x241034['ui']['view']['menuBarView'];_0x411986&&_0x411986['close']&&_0x411986['close']();}}function Jn(_0x5ca9fb){return'actions'in _0x5ca9fb;}class AIQuickActionsCommand extends _0x588cbb{['execute'](_0x58ac12){switch(this['_expandSelectionIfCollapsed'](),_0x58ac12['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3d5f06=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3d5f06});}this['_handleAIChatAction'](_0x58ac12);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x3ffba8=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3ffba8});}this['_handleAIActionsAction'](_0x58ac12);}}async['_handleAIChatAction'](_0xaa5e40){const _0x4060ee=this['editor']['plugins']['get']('AIChatController'),_0xf5c3b6=this['editor']['plugins']['get']('AITabs')['view'];if(_0xf5c3b6['isVisible']||(_0xf5c3b6['isVisible']=!0x0),'chat'!==_0xf5c3b6['activeTab']&&_0xf5c3b6['activateTab']('chat'),'ask-ai'===_0xaa5e40['id'])_0x4060ee['removeSelectionFromChatContext'](),_0x4060ee['addSelectionToChatContext'](this['editor']),_0x4060ee['focusPromptInput']();else await _0x4060ee['startConversation']({'modelId':_0xaa5e40['model']}),_0x4060ee['removeSelectionFromChatContext'](),_0x4060ee['addSelectionToChatContext'](this['editor']),_0x4060ee['focusPromptInput'](),await _0x4060ee['sendMessage']({'message':_0xaa5e40['prompt']||_0xaa5e40['displayedPrompt']||_0xaa5e40['label'],'attributes':{'quickActionData':{'id':_0xaa5e40['id']},'displayedPrompt':_0xaa5e40['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x5c039d=this['editor'],_0x25d33a=_0x5c039d['model']['document']['selection'];if(!_0x25d33a['isCollapsed'])return;const _0x2cea54=gt(_0x25d33a['getSelectedBlocks']())||_0x5c039d['model']['schema']['getLimitElement'](_0x25d33a);_0x5c039d['model']['change'](_0x457c7e=>{_0x457c7e['setSelection'](_0x2cea54,'in');});}['_handleAIActionsActionLabel'](_0x13ab56){return _0x13ab56['parent']?.['label']&&'other'!==_0x13ab56['parent']?.['id']?_0x13ab56['parent']['label']+':\x20'+_0x13ab56['label']:_0x13ab56['label'];}async['_handleAIActionsAction'](_0x42ba71){const _0x12092b=this['editor']['plugins']['get']('AIActions'),_0x2f8d03=_0x42ba71['prompt']?{'userMessage':_0x42ba71['prompt'],'model':_0x42ba71['model']}:{'actionName':_0x42ba71['actionName']||_0x42ba71['id'],'args':_0x42ba71['args']},_0x5ce429=this['_handleAIActionsActionLabel'](_0x42ba71);await _0x12092b['executeAction'](_0x2f8d03,_0x5ce429,_0x42ba71['icon']);}}class AIQuickActionsEditing extends _0x49edc5{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x32b318=this['editor'],_0x22d67f=new AIQuickActionsCommand(this['editor']);if(_0x32b318['commands']['add']('aiQuickAction',_0x22d67f),_0x32b318['plugins']['has']('AIChat')){const _0x593e69=this['editor']['plugins']['get']('AIChatController');_0x32b318['model']['document']['selection']['on']('change:range',(_0xb35de9,_0x30ad68)=>{_0x30ad68['directChange']&&_0x593e69['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x3876bb,_0x2d3e85='text'){'modification'===this['type']&&'text'===_0x2d3e85&&(_0x2d3e85=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x3876bb,_0x2d3e85);}['updateChangeGroups'](_0x57f2dc){const _0xd9cf7b=this['parsedContent']['get'](_0x57f2dc)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x57f2dc,_0xd9cf7b),this['changeGroups']=[],0x0==_0xd9cf7b['childNodes']['length'])return;rs(this['documentContextContent']['get'](_0x57f2dc),this['parsedMergedContent']['get'](_0x57f2dc));const _0xe08fa2=this['documentContextContent']['get'](_0x57f2dc)['children']['map'](_0x1a28bb=>({'node':_0x1a28bb,'id':Xi(_0x1a28bb,'data-id')})),_0x56c614=_0xd9cf7b['children']['map'](_0xadda6=>({'node':_0xadda6,'id':Xi(_0xadda6,'data-id')||at()})),_0x117564=_0x27f9c1(_0xe08fa2,_0x56c614,{'comparator':(_0x170fb0,_0x4bf774)=>_0x170fb0['id']==_0x4bf774['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x117564['length']&&_0x117564[_0x117564['length']-0x1]['removed'];)_0x117564['pop']();}const _0xf4f6af=_0x117564['map'](_0x28e26a=>{const _0x182982=_0x28e26a['added']?'new':_0x28e26a['removed']?'removed':'modified';return{'node':_0x28e26a['value'][0x0]['node'],'type':_0x182982,'id':_0x28e26a['value'][0x0]['id']};}),_0x58d6ca=this['_documentIdToSource']['get'](_0x57f2dc);this['changeGroups']['push']({'changes':_0xf4f6af,'state':'pending','index':this['changeGroups']['length'],'editor':_0x58d6ca['editor'],'rootName':_0x58d6ca['rootName'],'documentId':_0x57f2dc});}['_getDifferentChangeGroups'](_0x37e8d3,_0x193b3f){return _0x193b3f;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x3b8988){super(_0x3b8988),this['content']=_0x3b8988['content'],this['version']=_0x3b8988['version'],this['editor']=_0x3b8988['editor'],this['rootName']=_0x3b8988['rootName'],this['actionName']=_0x3b8988['actionName'],this['args']=_0x3b8988['args'],this['userMessage']=_0x3b8988['userMessage'],this['model']=_0x3b8988['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x56b73b){const _0x45d640=this['editor']['config']['get']('collaboration.channelId'),_0x1a16b4=new AIActionsReply({..._0x56b73b,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x45d640,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x45d640,this['editor']]])});return this['replies']['push'](_0x1a16b4),_0x1a16b4['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x1a16b4),_0x1a16b4;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x4af521,_0x1eb6af=!0x0,_0x50f169=!0x0){super(_0x4af521),this['set']('isEnabled',!0x1),_0x1eb6af&&(this['applyButton']=this['_createButton'](Mi(_0x4af521,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x50f169&&(this['suggestButton']=this['_createButton'](Mi(_0x4af521,'AI_BALLOON_SUGGEST_BUTTON'),_0x1eb6af?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1eb6af,'showSuggestButton':_0x50f169}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x7f6106,showSuggestButton:_0x59495f}){this['applyButton']&&(this['applyButton']['isVisible']=_0x7f6106),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x59495f);}['_createButton'](_0x240e34,_0x4178df){const _0x31a438=new yt(this['locale']);return _0x31a438['set']({'label':_0x240e34,'class':_0x4178df,'isVisible':!0x0,'withText':!0x0}),_0x31a438;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0xb9ef31){super(_0xb9ef31),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0xb9ef31,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x12f530){super(_0x12f530),this['set']('isVisible',!0x0);const _0xf41582=new AISpinnerView('small');_0xf41582['isVisible']=!0x0;const _0x6eaa43=new Nt(this['locale']);_0x6eaa43['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x59d6ee=>!_0x59d6ee)]},'children':[_0xf41582,_0x6eaa43]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x2eddb5,_0x1ef6dd){super(_0x2eddb5),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x1ef6dd,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x3ee0e4(),this['_addContentWrapper'](_0x1ef6dd),this['_addDisclaimerView'](),this['_addToolbar'](_0x1ef6dd),this['_focusables']['clear'](),this['_focusables']['addMany']([this['_toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-main']},'children':this['_dialogContent']}),this['on']('change:isTrackChangesOn',()=>{this['_toggleToolbarButtonsVisibility'](_0x1ef6dd);});}['render'](){super['render']();for(const _0x499db2 of this['_focusables'])this['_focusTracker']['add'](_0x499db2['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0xe272be){-0x1===_0xe272be?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x24c797){this['_isLoading']=_0x24c797;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1e5527){super['showError'](_0x1e5527),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x59f9de){super['showBlockingError'](_0x59f9de),this['setErrorState']();}['addMiniToolbarItem'](_0x48ae16){this['_miniToolbarView']['items']['has'](_0x48ae16)||this['_miniToolbarView']['items']['add'](_0x48ae16);}['removeMiniToolbarItem'](_0x58cec2){this['_miniToolbarView']['items']['has'](_0x58cec2)&&this['_miniToolbarView']['items']['remove'](_0x58cec2);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0xeed9cb,showSuggestButton:_0x38dfe8}){_0xeed9cb=_0xeed9cb&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x38dfe8=_0x38dfe8&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0xeed9cb,'showSuggestButton':_0x38dfe8});}async['updateContent'](_0x5a20a6){await this['_streamableContentView']['update'](_0x5a20a6);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x36b61e){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x36b61e['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x37bfe3,showSuggestButton:_0x18a75c}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x37bfe3,_0x18a75c),this['_toolbarView']['applyButton']?.['on']('execute',()=>{this['fire']('applySuggestion');}),this['_toolbarView']['suggestButton']?.['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_toolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',this,'_hasError',(_0x268e81,_0x34975f,_0x3a8bd7)=>!(_0x268e81||_0x34975f||_0x3a8bd7)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x37bfe3,'showSuggestButton':_0x18a75c}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x47372d){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x47372d),this['_miniToolbarView']['delegate'](...Ss)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x4129bd,_0xeb7ef1)=>!(_0x4129bd||_0xeb7ef1)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x5bd098=new yt(this['locale']),_0x2d591e=new yt(this['locale']),_0x27ac11=new AIActionsBalloonNavigationCounterView(this['locale']),_0x3f096d=new yt(this['locale']);_0x5bd098['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x2d591e['set']({'icon':_0x56c2cb,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x3f096d['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x5bd098['bind']('isEnabled')['to'](this,'isBusy',_0x10882a=>!_0x10882a),_0x5bd098['on']('execute',()=>{this['fire']('tryAgain');}),_0x2d591e['bind']('isEnabled')['to'](this,'isBusy',_0x112d97=>!_0x112d97),_0x2d591e['on']('execute',()=>{this['fire']('showPrevious');}),_0x3f096d['bind']('isEnabled')['to'](this,'isBusy',_0x5aa092=>!_0x5aa092),_0x3f096d['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x2d591e,this['_navigationCounter']=_0x27ac11,this['_navigationNextButton']=_0x3f096d,this['_navigationTryAgainButton']=_0x5bd098;}['updateMiniToolbarButtons'](_0x1dd762,_0x5dc9cc){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0xc7867c=_0x1dd762>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0xc7867c){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x566308=_0x1dd762-_0x5dc9cc;this['_navigationCounter']['setInteractionCount'](_0x566308+'/'+_0x1dd762),this['_navigationPreviousButton']['isEnabled']=_0x5dc9cc<_0x1dd762-0x1,this['_navigationNextButton']['isEnabled']=_0x5dc9cc>0x0;}else this['removeMiniToolbarItem'](this['_navigationPreviousButton']),this['removeMiniToolbarItem'](this['_navigationCounter']),this['removeMiniToolbarItem'](this['_navigationNextButton']);}['disableMiniToolbarButtons'](){this['_navigationTryAgainButton']['isEnabled']=!0x1,this['_navigationPreviousButton']['isEnabled']=!0x1,this['_navigationNextButton']['isEnabled']=!0x1;}['startAutoScroll'](){this['_initializeScrollManager'](),this['_scrollManager']&&this['_scrollManager']['start']();}['stopAutoScroll'](){this['_scrollManager']&&this['_scrollManager']['stop']();}['toggleIsLoading'](_0x5f3a61){this['_isLoading']=_0x5f3a61;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x588761=this['_getScrollableElement']();_0x588761&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x588761));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x3c99d9){super(_0x3c99d9);const _0x11c7b7=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x11c7b7['to']('interactionCount')}]});}['setInteractionCount'](_0x4355f0){this['set']('interactionCount',_0x4355f0);}}class AIActions extends _0x49edc5{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x5e3d64];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x23a11f){super(_0x23a11f),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x801ed0,_0x1a6517,_0x22d67a){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x2d6f87,anchorData:_0x215de4,root:_0x338ac2}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x801ed0,_0x2d6f87,_0x215de4,_0x338ac2,_0x1a6517,_0x22d67a);}}const {modelFragment:_0x432e10,anchorData:_0x4a2531,root:_0x376b40}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x801ed0,_0x432e10,_0x4a2531,_0x376b40,_0x1a6517,_0x22d67a);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x57a159=this['editor']['plugins']['has']('TrackChanges');let _0x46d2dc=this['editor']['config']['get']('ai.availableReplyActions')||[...Ds];_0x57a159||(_0x46d2dc=_0x46d2dc['filter'](_0xebf52=>'insertSuggestion'!=_0xebf52));const _0x537088=this['editor']['commands']['get']('trackChanges'),_0x219b24=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x57a159,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x46d2dc});return _0x219b24['bind']('isBusy')['to'](this),_0x537088&&_0x219b24['bind']('isTrackChangesOn')['to'](_0x537088,'value'),_0x219b24['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x219b24['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x219b24['on']('showNext',()=>{this['_navigateToNext']();}),_0x219b24;}['_normalizeSelectionStart'](){const _0x295382=this['editor']['model'],_0x4623e9=_0x295382['document']['selection'],_0x4ecda4=_0x4623e9['getFirstRange']();if(!_0x4ecda4||_0x4ecda4['isCollapsed'])return;const _0x3e59aa=gt(_0x4623e9['getSelectedBlocks']());if(!_0x3e59aa)return;const _0x1ebf63=_0x295382['createPositionAt'](_0x3e59aa,0x0);_0x1ebf63['isAfter'](_0x4ecda4['start'])&&_0x295382['change'](_0x557447=>{_0x557447['setSelection'](_0x557447['createRange'](_0x1ebf63,_0x4ecda4['end']));});}['_getExecuteDataRegular'](){const _0x5efae9=this['editor']['model']['document']['selection'],_0x28858f=_0x5efae9['getFirstRange']()['start']['root'];if(_0x5efae9['isCollapsed']){const _0x2fecda=gt(_0x5efae9['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x5efae9);this['editor']['model']['change'](_0x359a09=>{_0x359a09['setSelection'](_0x2fecda,'in');});}this['_normalizeSelectionStart']();const _0x4462d1=_0x5efae9['getFirstRange'](),_0x18d0e6=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x5efae9),_0x4462d1['start'],_0x4462d1['end']);this['_copyMarkersToFragment'](_0x18d0e6,_0x5efae9,{'isTableSelection':!0x1});const _0x1f02bb=_0x5efae9['getFirstRange']()['start'],_0x38267c=new Map();let _0x501f9e=_0x18d0e6;for(let _0x262d74=0x0;_0x262d74<_0x1f02bb['path']['length'];_0x262d74++)_0x38267c['set'](_0x501f9e,_0x1f02bb['path'][_0x262d74]),_0x501f9e=_0x501f9e['getChild'](0x0);return{'modelFragment':_0x18d0e6,'anchorData':_0x38267c,'root':_0x28858f};}['_getExecuteDataInTable'](){const _0x1165d5=this['editor']['model']['document']['selection'],_0x123582=this['editor']['plugins']['get']('TableSelection'),_0x48ee2a=_0x1165d5['getFirstRange']()['start']['root'],_0x4c1c34=_0x123582['getSelectionAsFragment'](),_0x4bc560=_0x1165d5['getFirstRange']()['start']['parent']['parent'],_0x338d3d=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x4bc560),this['editor']['model']['createPositionAfter'](_0x4bc560)),_0x59054f=this['_wrapWithCommonAncestors'](_0x4c1c34,_0x338d3d['start'],_0x338d3d['end']);this['_copyMarkersToFragment'](_0x59054f,_0x1165d5,{'isTableSelection':!0x0});const _0x18275b=_0x1165d5['getFirstRange']()['start'],_0x31515a=new Map();let _0x5ad9eb=_0x59054f;for(let _0x28b17b=0x0;_0x28b17b<_0x18275b['path']['length'];_0x28b17b++)if(_0x31515a['set'](_0x5ad9eb,_0x18275b['path'][_0x28b17b]),_0x28b17b<_0x18275b['path']['length']-0x1)_0x5ad9eb=_0x5ad9eb['getChild'](0x0);else{let _0x4752d9=_0x5ad9eb['nextSibling'];for(;_0x4752d9;)_0x31515a['set'](_0x4752d9,_0x18275b['path'][_0x28b17b]),_0x4752d9=_0x4752d9['nextSibling'];}return{'modelFragment':_0x59054f,'anchorData':_0x31515a,'root':_0x48ee2a};}async['_executeAction'](_0x40a517,_0x1d6b12,_0x413301,_0x3e6954,_0xd9d098,_0x3809db){const _0xc08c27=this['editor']['plugins']['get'](AIEditing),_0x31d64d=this['editor']['plugins']['get'](AIBalloon),_0x440cb3=this['editor']['model']['document']['selection'],_0x43ba37=await _0xc08c27['modelToDataWithIds'](_0x1d6b12,this['editor']),_0x7b0d25=this['editor']['model']['document']['version'],_0x17c203=[..._0x440cb3['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x31d64d['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0xd9d098,'icon':_0x3809db||_0x279395,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x17c203,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x31d64d),this['_interactionParams']={'action':_0x40a517,'content':_0x43ba37,'version':_0x7b0d25,'aiBalloon':_0x31d64d,'modelFragment':_0x1d6b12,'anchorData':_0x413301,'root':_0x3e6954},this['_setupApplyListeners'](),this['listenTo'](_0x31d64d,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x31d64d,'dialogClosed',(_0x2c7a09,{id:_0x38f296})=>{if('aiActionsBalloon'===_0x38f296){for(const _0x20a330 of this['_interactions']){if(0x0===_0x20a330['replies']['length']||_0x20a330['stoppedExplicitly'])continue;const _0x3a9aaf=_0x20a330['replies'][_0x20a330['replies']['length']-0x1],_0x2a2a99=_0x3a9aaf['changeGroups'][0x0];_0x2a2a99&&'pending'===_0x2a2a99['state']&&_0x3a9aaf['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x31d64d);}}),this['_createInteraction'](_0x43ba37,_0x7b0d25,_0x31d64d,_0x40a517);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x3c2ba9,anchorData:_0x53afd3,root:_0x1bfad1}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x3c2ba9,_0x53afd3,_0x1bfad1,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x3c2ba9,_0x53afd3,_0x1bfad1,!0x0);});}['_wrapWithCommonAncestors'](_0x46ca2e,_0x3b24f4,_0x4ac2e3){const _0x3b2d3b=this['editor']['model']['createRange'](_0x3b24f4,_0x4ac2e3)['getCommonAncestor'](),_0x474b23=_0x3b2d3b['is']('documentFragment')?[]:_0x3b2d3b['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x474b23['length']){const _0x3dbd35=_0x474b23['map'](_0xc35b8e=>_0xc35b8e['_clone'](!0x1));for(let _0x4148d0=0x1;_0x4148d0<_0x3dbd35['length'];_0x4148d0++)_0x3dbd35[_0x4148d0-0x1]['_appendChild'](_0x3dbd35[_0x4148d0]);return _0x3dbd35[_0x3dbd35['length']-0x1]['_appendChild'](_0x46ca2e),new _0x24abee(_0x3dbd35[0x0]);}return _0x46ca2e;}['_copyMarkersToFragment'](_0x246493,_0x44c9e7,_0x2735bd={'isTableSelection':!0x1}){const _0x3d8032=this['editor']['model'],_0x3ccf21=Array['from'](_0x44c9e7['getRanges']()),_0x232d63=_0x44c9e7['getFirstRange']()['start'];for(const _0x29b564 of _0x3d8032['markers']){if(_0x29b564['name']['startsWith'](Rs)||!_0x29b564['affectsData'])continue;const _0x50cea1=_0x29b564['getRange']();if(!_0x3ccf21['some'](_0x9f42a=>_0x9f42a['containsRange'](_0x50cea1,!0x0)))continue;const _0x204b39=this['_regularCalculateMarkerPath'](_0x50cea1['start'],_0x232d63,_0x2735bd['isTableSelection']),_0x47977a=this['_regularCalculateMarkerPath'](_0x50cea1['end'],_0x232d63,_0x2735bd['isTableSelection']),_0x8ced3f=_0x3d8032['createPositionFromPath'](_0x246493,_0x204b39),_0x3b6e14=_0x3d8032['createPositionFromPath'](_0x246493,_0x47977a);if(!_0x8ced3f['isEqual'](_0x3b6e14)){const _0x4a9e80=_0x3d8032['createRange'](_0x8ced3f,_0x3b6e14);_0x246493['markers']['set'](_0x29b564['name'],_0x4a9e80);}}}['_regularCalculateMarkerPath'](_0x106228,_0x54a195,_0x48d455=!0x1){const _0xb4be21=[..._0x106228['path']['slice']()];for(let _0xe497de=0x0;_0xe497de<Math['max'](_0x54a195['path']['length'],_0x106228['path']['length']);_0xe497de++){const _0xdb63a4=_0x54a195['path'][_0xe497de]||0x0,_0x22f42a=(_0x106228['path'][_0xe497de]||0x0)-_0xdb63a4;if(_0xb4be21[_0xe497de]=_0x22f42a,0x0!==_0x22f42a&&!_0x48d455)break;}return _0xb4be21;}async['_createInteraction'](_0x2a8439,_0x18bdcd,_0x19df59,_0x559442){const _0x25f66c=this['editor'],_0x75bc79=_0x25f66c['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x559442,'content':_0x2a8439,'version':_0x18bdcd,'aiBalloon':_0x19df59,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x75bc79});const _0x3d467d=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x25f66c['locale'],'content':_0x2a8439,'version':_0x18bdcd,'editor':_0x25f66c,'rootName':_0x75bc79['rootName'],..._0x559442});this['_interactions']['push'](_0x3d467d);const _0xbc5432=(_0x30be22,_0x3c9765=!0x1,_0x312cf7='streaming')=>this['_promiseQueue']['enqueue'](async _0xe1197b=>{try{const _0x40d123=os({'changeGroups':_0x30be22['changeGroups'],'documentContextContent':_0x30be22['documentContextContent'],'showDiff':_0x3c9765,'trimUnchanged':!0x1});_0x40d123['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x40d123[0x0],'renderingStrategy':_0x312cf7,'abortSignal':_0xe1197b});}catch(_0x427911){if(this['_isAbortError'](_0x427911))return;throw _0x427911;}});_0x3d467d['on']('replyCreated',(_0x5bb551,_0x3ede98)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0xbc5432(_0x3ede98)['catch'](_0x2ba7b3=>{this['_isAbortError'](_0x2ba7b3)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x2ba7b3),this['_setErrorState'](_0x3d467d));});}),_0x3d467d['on']('replyContentUpdated',(_0x2cfb6b,_0x61f573)=>{_0xbc5432(_0x61f573)['catch'](_0x2e990e=>{this['_isAbortError'](_0x2e990e)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x2e990e),this['_setErrorState'](_0x3d467d));});}),_0x3d467d['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0xfbd2b3){this['_isAbortError'](_0xfbd2b3)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0xfbd2b3),this['_setErrorState'](_0x3d467d));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x46aba0,{showDiff:_0x570f62})=>{try{this['_balloonShowDiff']=_0x570f62;const _0x468bb7=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x468bb7&&await _0xbc5432(_0x468bb7,_0x570f62,'static');}catch(_0x26e167){this['_isAbortError'](_0x26e167)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x26e167),this['_setErrorState'](_0x3d467d));}}),_0x3d467d['on']('replyChangeGroupStateUpdated',()=>{const _0x441b02={'positiveCount':_0x3d467d['replies']['reduce']((_0x22b5be,_0x36b320)=>_0x22b5be+_0x36b320['changeGroups']['filter'](_0x3c8f21=>'accepted'===_0x3c8f21['state'])['length'],0x0),'totalCount':_0x3d467d['replies']['reduce']((_0x28f2a0,_0x15082b)=>_0x28f2a0+_0x15082b['changeGroups']['length'],0x0)},_0x252e8f=_0x3d467d['actionCallId'],_0x4e0b20=_0x3d467d['actionName'];_0x4e0b20?this['_aiConnector']['upsertAIActionRating'](_0x4e0b20,_0x252e8f,_0x441b02):this['_aiConnector']['upsertCustomAIActionRating'](_0x252e8f,_0x441b02);}),this['_setLoadingState']();try{const _0x569885=await _0x3d467d['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x569885;}catch(_0x19489c){if(this['_isAbortError'](_0x19489c))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x3d467d);}}['_applyChanges'](_0xc8807b,_0x3a2d0d,_0x34c6a3,_0x14464e){const _0x34209b=this['editor'];if(_0x14464e&&!_0x34209b['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x5ea8a7=this['editor']['plugins']['get'](_0x5e3d64),_0x44927c=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x44927c||!_0x44927c['replies']['length'])return;const _0x235830=_0x44927c['replies'][_0x44927c['replies']['length']-0x1],_0x197f55=_0x235830['changeGroups'];_0x235830['setChangeGroupState'](0x0,'accepted');let _0x3031be=Es({'reply':_0x235830,'interaction':_0x44927c,'groups':_0x197f55,'transform':!0x1,'documentCompare':_0x5ea8a7,'documentCompareOptions':{'anchor':_0x34209b['model']['createPositionAt'](_0xc8807b,0x0),'markDeletions':_0x14464e}});_0x3031be=this['_filterOperationsOutsideRange'](_0x3031be,_0x3a2d0d);for(const _0x569e5d of _0x3031be)this['_anchorOperation'](_0x3a2d0d,_0x569e5d,_0x34c6a3);const _0x58e301=_0x44927c['getDocumentContext']()['documents'][0x0]['version'],_0x48bcb2=_0x34209b['model']['document']['history']['getOperations'](_0x58e301),_0x29be73={'document':_0x34209b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x52b6e9=_0x4fc222(_0x3031be,_0x48bcb2,_0x29be73)['operationsA'];_0x34209b['model']['change'](_0x1e14e9=>{if(_0x1e14e9['setSelection'](_0x34209b['model']['document']['selection']['focus']),_0x14464e)_0x34209b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x52b6e9);else{for(const _0x110bb1 of _0x52b6e9)_0x110bb1['baseVersion']=_0x34209b['model']['document']['version'],Ts(_0x34209b,_0x110bb1),_0x1e14e9['batch']['addOperation'](_0x110bb1),_0x34209b['model']['applyOperation'](_0x110bb1);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x46886d,_0x35aa9a){return _0x46886d['filter'](_0x11c7ab=>{if('rename'==_0x11c7ab['type']){const _0x11115c=_0x11c7ab['position']['nodeAfter'];return!_0x35aa9a['has'](_0x11115c);}if(_0x11c7ab['type']['indexOf']('Attribute')>-0x1){const _0xfe5282=_0x11c7ab['range']['start']['nodeAfter'];return!_0x35aa9a['has'](_0xfe5282);}return!0x0;});}['_anchorOperation'](_0x468302,_0xa3f10e,_0x1cfaed){const _0x5db68b=_0xa3f10e['clone']();for(const _0x166c93 in _0xa3f10e){const _0x3b13bd=_0xa3f10e[_0x166c93];_0x3b13bd instanceof _0x533258?_0xa3f10e[_0x166c93]=new _0x533258(_0x3f3dd7(_0x3b13bd['start']),_0x3f3dd7(_0x3b13bd['end'])):_0x3b13bd instanceof _0x56bf4a&&(_0xa3f10e[_0x166c93]=_0x3f3dd7(_0x3b13bd));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x5db68b['type'])){if(_0x5db68b['isDocumentOperation']=!0x1,_0x5db68b['baseVersion']=null,'remove'==_0x5db68b['type']){const _0x205725=_0x5db68b['sourcePosition'],_0xcb0f00=_0x5db68b['howMany'];new _0x1ff4a8(_0x205725,_0xcb0f00)['_execute']();}else _0x5db68b['_execute']();}function _0x3f3dd7(_0x4f5daa){if('$graveyard'==_0x4f5daa['root']['rootName'])return _0x4f5daa;const _0x50f509=[];let _0x31c01b=_0x4f5daa['root'];for(let _0x3018f5=0x0;_0x3018f5<_0x4f5daa['path']['length'];_0x3018f5++){const _0x1ed9f2=_0x468302['get'](_0x31c01b)||0x0;_0x50f509[_0x3018f5]=_0x4f5daa['path'][_0x3018f5]+_0x1ed9f2,_0x31c01b=_0x31c01b['getChildAtOffset'](_0x4f5daa['path'][_0x3018f5]);}return new _0x56bf4a(_0x1cfaed,_0x50f509,_0x4f5daa['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x18631a,content:_0x27890a,version:_0x5ead2a,aiBalloon:_0x50b489}=this['_interactionParams'];this['_clearErrorState'](),this['_actionsBalloonView']['clearContent'](),this['_actionsBalloonView']['showLoader'](),this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),this['stopListening'](this['_actionsBalloonView']),this['_setupApplyListeners'](),this['_createInteraction'](_0x27890a,_0x5ead2a,_0x50b489,_0x18631a)['catch'](_0x141afb=>{this['_isAbortError'](_0x141afb)||console['error']('Error\x20refreshing\x20interaction:',_0x141afb);});}['_isAbortError'](_0x4cf8a4){return!!_0x4cf8a4['message']&&_0x4cf8a4['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x3bf720=this['_interactions']['length'];this['_currentInteractionIndex']<_0x3bf720-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x4f57c5){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4f57c5;const _0x519a7c=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x519a7c)return;if(_0x519a7c['hasError'])return this['_setErrorState'](_0x519a7c),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x519a7c['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x1907e9=_0x519a7c['replies'][_0x519a7c['replies']['length']-0x1];if(_0x1907e9)try{const _0x9736d=os({'changeGroups':_0x1907e9['changeGroups'],'documentContextContent':_0x1907e9['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x82926f=>setTimeout(_0x82926f,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x9736d[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x146f42){this['_isAbortError'](_0x146f42)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x146f42);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x4dc0d3){const _0x1e3600=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x1e3600),_0x4dc0d3['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x49edc5{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3d80e3){super(_0x3d80e3),_0x3d80e3['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x66f122,_0x4c77cb){super(_0x66f122),this['id']=_0x4c77cb,this['set']('status','pending'),this['set']('changeId',_0x4c77cb),this['resultResponseView']=this['_createResultResponseView'](),this['acceptButtonView']=this['_createAcceptButtonView'](),this['dismissButtonView']=this['_createDismissButtonView'](),this['infoButtonView']=this['_createInfoButtonView'](),this['outdatedButtonView']=this['_createOutdatedButtonView'](),this['set']('isInfoToggleOn',!0x1),this['set']('isActive',!0x1),this['set']('showDiff',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-result',this['bindTemplate']['if']('isActive','ck-ai_review__check-run-result_active')]},'on':{'click':this['bindTemplate']['to']('click'),'mouseover':this['bindTemplate']['to']('mouseover'),'mouseout':this['bindTemplate']['to']('mouseout')},'children':[this['resultResponseView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-footer']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-action-buttons']},'children':[this['acceptButtonView'],this['dismissButtonView'],this['outdatedButtonView']]},this['infoButtonView']]}]}),this['on']('click',(_0x13b810,_0x26401a)=>{_0x26401a&&_0x26401a['target']&&'A'===_0x26401a['target']['tagName']&&_0x26401a['preventDefault'](),this['fire']('activateChange',{'id':_0x4c77cb,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4c77cb,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4c77cb,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x405dc0=new Nt(this['locale']);return _0x405dc0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x59babb=>!_0x59babb)]}}),_0x405dc0;}['_createAcceptButtonView'](){const _0x569ad8=new yt(this['locale']);return _0x569ad8['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x569ad8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x55d08b=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x55d08b['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x524277=>'pending'!==_0x524277&&'accepted'!==_0x524277),this['bindTemplate']['if']('status',Bi,_0x111518=>'pending'===_0x111518),this['bindTemplate']['if']('status',Gi,_0x1277e8=>'pending'!==_0x1277e8),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2bc366=>'accepted'===_0x2bc366)]}}),this['on']('change:status',(_0x48ae5f,_0x16c019,_0x43a0b6)=>{_0x569ad8['isEnabled']='pending'===_0x43a0b6,'accepted'===_0x43a0b6&&(_0x569ad8['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x569ad8['icon']=_0x491051);}),_0x569ad8;}['_createDismissButtonView'](){const _0x36960c=new yt(this['locale']);return _0x36960c['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x36960c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5e3cb6=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x5e3cb6['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x1eb508=>'pending'!==_0x1eb508&&'rejected'!==_0x1eb508),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x13f4a3=>'pending'===_0x13f4a3),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x395a35=>'rejected'===_0x395a35)]}}),this['on']('change:status',(_0x17dd30,_0x2ecad6,_0xd55023)=>{_0x36960c['isEnabled']='pending'===_0xd55023,'rejected'===_0xd55023&&(_0x36960c['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x36960c['icon']=_0x386fc5);}),_0x36960c;}['_createInfoButtonView'](){const _0x5a2c49=new yt(this['locale']);return _0x5a2c49['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2c1eeb,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x5a2c49['bind']('isOn')['to'](this,'isInfoToggleOn',_0x2d999d=>_0x2d999d),_0x5a2c49['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x5a2c49;}['_createOutdatedButtonView'](){const _0x79d36d=new yt(this['locale']);return _0x79d36d['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x79d36d['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x579fa9=>'outdated'!==_0x579fa9)],'disabled':'disabled'}}),_0x79d36d;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x3d35f9,_0x5312f0){super(_0x3d35f9),this['set']({'isVisible':!0x1,'position':'arrow_se','class':null,'top':0x0,'left':0x0}),this['extendTemplate']({'tag':'div','attributes':{'class':['ck-reset'],'tabindex':'-1'}}),this['set']('isDiffActive',!0x1),this['content']['add'](this['_createContentView']()),_0x5312f0['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x2b7695){this['resultItemView']['changeId']=_0x2b7695['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x2b7695['contentDiffed'];}['showBalloon'](_0x2ae657,_0x3a5968,_0x47995c,_0x203932,_0x515d9a,_0x36d258){const _0x26cc5a=_0x3a5968();if(!_0x26cc5a)return;this['updateContent'](_0x2ae657),this['show']();const _0x3d1944=Array['from'](_0x26cc5a['getClientRects']())['reverse'](),_0x272bb1=this['_getPointedRectIndexFromEvent'](_0x47995c,_0x3d1944),_0x147cb7=_0x3d1944[_0x272bb1??0x0];'click'===_0x203932?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x3a5968(),_0x272bb1,_0x2ae657['id'],_0x515d9a,_0x36d258)||_0x147cb7})):'hover'===_0x203932&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x3a5968(),_0x272bb1,_0x2ae657['id'])||_0x147cb7}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x5e9209=[this['element']];return this['_pinnedTargetElement']&&_0x5e9209['push'](this['_pinnedTargetElement']),_0x5e9209;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x293b27=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x293b27['setTemplate']({'tag':'div','attributes':{'class':['ck-reset','ck-ai_review-balloon-panel-suggestion',this['bindTemplate']['if']('isDiffActive','ck-ai_review-balloon-panel-suggestion_diff-active')]},'children':[{'tag':'p','attributes':{'class':['ck-ai_review__suggestion-text']},'children':[this['resultItemView']]}]}),_0x293b27;}['_getBestRectPositionOnClick'](_0x13df3b,_0x42aff8,_0x166e9b,_0x36d730,_0x3e2fac){if(!_0x13df3b)return null;const _0x1f5cfa=this['position']['replace']('arrow_',''),_0xf0706b=Array['from'](_0x13df3b['getClientRects']());let _0xa373e5,_0x775183=_0xf0706b['reverse']();return void 0x0!==_0x42aff8&&this['_isPinnedRectVisible'](_0x775183[_0x42aff8],_0x36d730,_0x3e2fac)?(_0xa373e5=_0x775183[_0x42aff8],this['_pinnedRectIndex']=_0x42aff8):this['_isPinnedRectVisible'](_0x775183[0x0],_0x36d730,_0x3e2fac)&&void 0x0===_0x42aff8?_0xa373e5=_0x775183[0x0]:(_0x775183='s'==_0x1f5cfa[0x0]?[..._0xf0706b]['reverse']():_0xf0706b,_0x775183['forEach'](_0x5699eb=>{this['_isPinnedRectVisible'](_0x5699eb,_0x36d730,_0x3e2fac)&&(_0xa373e5=_0x5699eb);})),this['_pinnedTargetChangeId']=_0x166e9b,this['_pinnedTargetElement']=_0x13df3b,_0xa373e5||_0x13df3b['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x1774c7,_0x4971bb,_0x538aba){if(!_0x1774c7)return null;const _0x18ebe0=Array['from'](_0x1774c7['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x4971bb&&this['_pinnedTargetChangeId']!==_0x538aba)return this['_pinnedRectIndex']=_0x4971bb,this['_pinnedTargetElement']=_0x1774c7,this['_pinnedTargetChangeId']=_0x538aba,_0x18ebe0[_0x4971bb];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x538aba){if(_0x1774c7!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x18ebe0[this['_pinnedRectIndex']];}return void 0x0!==_0x4971bb&&this['_pinnedTargetChangeId']!==_0x538aba?(this['_pinnedRectIndex']=_0x4971bb,this['_pinnedTargetElement']=_0x1774c7,this['_pinnedTargetChangeId']=_0x538aba,_0x18ebe0[_0x4971bb]):_0x1774c7['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x1f59d2,_0x334322){if(_0x1f59d2)for(let _0x5df059=0x0;_0x5df059<_0x334322['length'];_0x5df059++){const _0xdabc70=_0x334322[_0x5df059];if(_0x1f59d2['clientX']>=_0xdabc70['left']-0x3&&_0x1f59d2['clientX']<=_0xdabc70['right']+0x3&&_0x1f59d2['clientY']>=_0xdabc70['top']-0x3&&_0x1f59d2['clientY']<=_0xdabc70['bottom']+0x3)return _0x5df059;}}['_isPinnedRectVisible'](_0x443682,_0x43ae5b,_0x470e14){const _0x355e1f=new dt(_0x443682),_0x489561=_0x43ae5b||document['documentElement'],_0x5ad334=_0x355e1f['getIntersection'](Ot(_0x470e14)),_0x374211=new dt(_0x489561)['getIntersection'](_0x355e1f);return!!(_0x5ad334&&_0x374211&&_0x355e1f['width']>0x0);}}const Zn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x179c1c{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3ab3e5){super(_0x3ab3e5),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Zn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x447249=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x447249);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x146076){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x36aa8e=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x146076,_0x36aa8e);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x1b4d2f){_0x1b4d2f&&('error-general'!==_0x1b4d2f['status']?'error-chunk'!==_0x1b4d2f['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x4778a5){this['_mainView']['addCheckRunResult'](_0x4778a5);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x385a48){this['_mainView']['showGeneralReviewCoreErrorView'](_0x385a48??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x32282c,_0x1ad462){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x32282c,_0x1ad462);}['setActiveStateInResults'](_0x264ea2){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x48c3c8=>{_0x48c3c8['id']===_0x264ea2&&_0x48c3c8['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x52e3ce=>_0x52e3ce['setItemAsInactive']());}['updateChangeState'](_0x5160e8,_0x4313c6){'accepted'===_0x4313c6||'rejected'===_0x4313c6||'outdated'===_0x4313c6?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x5160e8,_0x4313c6):this['_mainView']['reviewCheckResultsView']['showResult'](_0x5160e8,_0x4313c6);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x5c328d,_0x4b10be,_0x334e2d,_0x76b671,_0x15f59a,_0x25fc76){this['_balloonSuggestionView']['showBalloon'](_0x5c328d,_0x4b10be,_0x334e2d,_0x76b671,_0x15f59a,_0x25fc76);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x3d2821){const _0x542e15=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x6c7098=>_0x6c7098['id']===_0x3d2821);return _0x542e15?_0x542e15['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x370375){super(_0x370375),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0xfb810e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0xfb810e['if']('isVisible','ck-hidden',_0xc8f408=>!_0xc8f408)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0xfb810e['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x185ba5,_0x29c14e){super(_0x185ba5),this['reviewCoreHeader']=_0x29c14e['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x185ba5),this['reviewCheckListView']=_0x29c14e['list'],this['reviewCheckListView']['delegate'](...Zn)['to'](this),this['reviewCheckResultsView']=_0x29c14e['results'],this['reviewCheckResultsView']['delegate'](...Zn)['to'](this),this['reviewCompletedView']=_0x29c14e['completed'],this['reviewCompletedView']['delegate']('finishReview')['to'](this),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isLoading',!0x1),this['reviewCheckResultsView']['set']('isResultReady',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-review','ck-rounded-corners'],'dir':'ltr'},'children':[this['reviewCoreHeader'],this['generalErrorView'],this['reviewCheckListView'],this['reviewCheckResultsView'],this['reviewCompletedView']]});}['showReviewCheckListView'](){this['reviewCheckListView']['resetAllParameterizedChecks'](),this['reviewCheckListView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1);}['showReviewCheckResultsView'](){this['hideActionsWhenResultIsReady'](),this['reviewCheckResultsView']['resetErrorState'](),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['clearResults'](),this['reviewCheckResultsView']['set']('isLoading',!0x0),this['reviewCheckResultsView']['set']('isCompleted',!0x1);}['addCheckRunResult'](_0x54ed2f){this['reviewCheckResultsView']['addResult'](_0x54ed2f),this['reviewCheckResultsView']['set']('isLoading',!0x1);}['showReviewCompletedView'](){this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isCompleted',!0x0),this['reviewCheckListView']['set']('isVisible',!0x1);}['showActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']?(this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1)):this['reviewCheckResultsView']['isResultReady']=!0x0;}['showNoChangesView'](){this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x0);}['hideActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']=!0x1;}['showGeneralReviewCoreErrorView'](_0x1d251a){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x1d251a;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x3e30cb,_0xae1270){super(_0xae1270),this['set']({'label':_0x3e30cb,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x39bd4a,_0x2218af){super(_0x39bd4a),this['_contents']=_0x2218af,this['_resultViews']=new _0x3ee0e4(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x39bd4a),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x51e07c=this['_createCombinedSkeletonLoader'](),_0x43f00e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x43f00e['if']('isLoading','ck-ai_review__check-run_loading',_0xe88cd6=>_0xe88cd6),_0x43f00e['if']('isResultReady','ck-ai_review__check-run_ready',_0x4f011d=>_0x4f011d),_0x43f00e['if']('isVisible','ck-hidden',_0x4cf518=>!_0x4cf518)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x51e07c,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x19c44d){const _0x8099eb=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x19c44d['id']);_0x8099eb['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x8099eb),_0x8099eb['resultResponseView']['element']['innerHTML']=_0x19c44d['contentDiffed'];}['hideResult'](_0x268466,_0x48b317){if('pending'===_0x48b317)return;const _0x3aada7=this['_resultViews']['find'](_0x1fb47b=>_0x1fb47b['id']===_0x268466);_0x3aada7&&(_0x3aada7['status']=_0x48b317,_0x3aada7['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x205de6,_0x4b7d91){if('pending'!==_0x4b7d91)return;const _0xd56dfb=this['_resultViews']['find'](_0x49d98f=>_0x49d98f['id']===_0x205de6);_0xd56dfb&&(_0xd56dfb['status']=_0x4b7d91,_0xd56dfb['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x15cedd,_0x303754){this['headerTitle']=_0x15cedd,this['headerSubtitle']=_0x303754||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],Ls['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x21069a=new Nt(this['locale']),_0x541870=[];for(let _0x488b22=0x0;_0x488b22<0x10;_0x488b22++){const _0x594b46=this['_createSkeletonLoader']();_0x594b46['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x541870['push'](_0x594b46);}return _0x21069a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x37c926=>!_0x37c926)]},'children':_0x541870}),_0x21069a;}['_createResultsBodyView'](){const _0x1abcbc=new Nt(this['locale']);return _0x1abcbc['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x2b2a02=>_0x2b2a02)]},'children':this['_resultViews']}),_0x1abcbc;}['_createErrorView'](){const _0x17079d=new Nt(this['locale']),_0x4b0ed2=new yt(this['locale']),t=this['locale']['t'];return _0x17079d['delegate']('retryReview')['to'](this),_0x4b0ed2['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x4b0ed2['on']('execute',()=>{this['fire']('retryReview');}),_0x17079d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x4da47e=>!_0x4da47e),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x25b655=>'chunk'===_0x25b655)]},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error','ck-ai-notification__full-width','ck-ai_review__check-run-error-message',this['bindTemplate']['if']('errorType','ck-ai-notification_warning',_0x37750b=>'chunk'===_0x37750b)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3fbb86=>'general'!==_0x3fbb86)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x5a5754=>'chunk'!==_0x5a5754)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x4b0ed2]}),_0x17079d;}['_createCancelButtonView'](){const _0x3f90d2=new yt(this['locale']);return _0x3f90d2['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x4b8a16}),_0x3f90d2['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x58b646=>_0x58b646),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xc0825b=>_0xc0825b)]}}),_0x3f90d2['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3f90d2;}['_createToggleDiffButtonView'](){const _0x4be9e0=new yt(this['locale']);_0x4be9e0['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x4be9e0['bind']('isEnabled')['to'](this,'isError',_0x175984=>!_0x175984),_0x4be9e0['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4b564b=>!_0x4b564b),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3bfea8=>_0x3bfea8)]}});const _0x19851c=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x3e0757=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x4be9e0['bind']('isOn')['to'](this,'isToggleDiffOn',_0x4783df=>_0x4783df),_0x4be9e0['bind']('icon')['to'](this,'isToggleDiffOn',_0x1d49f7=>_0x1d49f7?nt:rt),_0x4be9e0['bind']('label')['to'](this,'isToggleDiffOn',_0x4c513d=>_0x4c513d?_0x19851c:_0x3e0757),_0x4be9e0['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x4be9e0;}['_createAcceptAllButtonView'](){const _0x2175b0=new yt(this['locale']);return _0x2175b0['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2175b0['bind']('isEnabled')['to'](this,'isError',_0x385bcb=>!_0x385bcb),_0x2175b0['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4ff153=>!_0x4ff153),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x52d44a=>_0x52d44a)]}}),_0x2175b0['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2175b0;}['_createExitReviewButtonView'](){const _0x5d4f0f=new yt(this['locale']);return _0x5d4f0f['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x5d4f0f['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x97bcf8=>!_0x97bcf8),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x33f1b9=>_0x33f1b9)]}}),_0x5d4f0f['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x5d4f0f;}['_createResultHeaderView'](){const _0x4f51c7=new Nt(this['locale']),_0x5d94e3=this['_createTitleView']();return _0x4f51c7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0xb3390a=>_0xb3390a)]},'children':[_0x5d94e3,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x419d59=>!_0x419d59)],'title':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x4f51c7;}['_createTitleView'](){const _0x3764be=new Nt(this['locale']),_0x3b5ce8=new AISpinnerView();return _0x3b5ce8['bind']('isVisible')['to'](this,'isResultReady',_0x4571b4=>!_0x4571b4),_0x3764be['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xf0d902=>_0xf0d902)]},'children':[_0x3b5ce8,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]}]}),_0x3764be;}['_createFinishReviewButtonView'](){const _0x2ced19=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x2ced19['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3e3fd5=>!_0x3e3fd5)]}}),_0x2ced19['delegate']('finishReview')['to'](this),_0x2ced19;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x31c323,_0x8735e4){super(_0x31c323),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x8735e4['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x8735e4['headerText']);const _0x5c9230=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x5c9230['if']('isVisible','ck-hidden',_0x4c9cf4=>!_0x4c9cf4)]},'children':[this['_resultsHeader'],{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-content-icon']},'children':[{'text':'👍'}]},{'tag':'p','attributes':{'class':['ck-ai_review__review-completed-content-text']},'children':[{'text':_0x8735e4['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x710202){const _0x5c7ad1=new AIReviewCoreFinishReviewButtonView(_0x710202,this['locale']);return _0x5c7ad1['delegate']('finishReview')['to'](this),_0x5c7ad1;}['_createResultHeaderView'](_0x290c94){const _0x15c468=new Nt(this['locale']);return _0x15c468['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x290c94},'children':[{'text':_0x290c94}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x15c468;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x4ca0a9,_0x33aef5){super(_0x4ca0a9),this['_defaultValue']=_0x33aef5['default']||(_0x33aef5['data']['length']>0x0?_0x33aef5['data'][0x0]['id']:''),this['_defaultLabel']=_0x33aef5['data']['find'](_0x36fbf6=>_0x36fbf6['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x14c45a=this['_prepareListOptions'](_0x33aef5['data']);Jt(this['_dropdownView'],_0x14c45a,{'role':'menu','ariaLabel':_0x33aef5['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x15e829=>{_0x15e829['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x2cf94f=>{this['formValue']=_0x2cf94f['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x2cf94f['source']['model']['label'];}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai_review__check-list-item-parameterized-form-element','ck-ai_review__check-list-item-parameterized-form-element_dropdown']},'children':[this['_dropdownView']]});}['resetToDefault'](){this['formValue']=this['_defaultValue'],this['_dropdownView']['buttonView']['label']=this['_defaultLabel'];}['_prepareListOptions'](_0x48fe36=[]){const _0x73ac06=new _t();this['resetToDefault']();for(const _0x4cf22b of _0x48fe36){const _0x2acada=new Zt({'label':_0x4cf22b['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4cf22b['id'],'model':_0x4cf22b});_0x2acada['bind']('isOn')['to'](this,'formValue',_0x569ded=>_0x569ded===_0x2acada['id']);const _0x48d827={'type':'button','model':_0x2acada};_0x73ac06['add'](_0x48d827);}return _0x73ac06;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x5e2571,_0x51a5cb,_0x5318d5){super(_0x5e2571),this['argsKey']=_0x51a5cb?.['argsKey'];if('dropdown'===_0x51a5cb['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x51a5cb);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x1be46a=new _0x792f28(this['locale'],{'children':[this['_formItem']],'class':[_0x5318d5?'ck-form__row_with-submit':'']});_0x5318d5&&_0x1be46a['children']['add'](_0x5318d5),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x1be46a]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x33f904{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x4ca397){super(_0x4ca397),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x3ee0e4();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0xc5fa62,_0xe986ff,_0x37e236=!0x1){super(_0xc5fa62),this['_check']=_0xe986ff,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0xe986ff['defaultModel']?_0xe986ff['defaultModel']['id']:'',this['_defaultLabel']=_0xe986ff['defaultModel']?_0xe986ff['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x441b4b(this['locale'],()=>new AIReviewCorePromptInputView(_0xc5fa62)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x37e236),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x792f28(this['locale'],{'children':[this['promptInputView']]}),new _0x792f28(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x4b4350,_0x5bbcce)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x5bbcce()):_0x5bbcce();}),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x3de46a=>{this['_focusables']['add'](_0x3de46a),this['focusTracker']['add'](_0x3de46a['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x2bd63e of this['_getFormValidators']()){const _0x35f06b=_0x2bd63e();if(_0x35f06b)return this['promptInputView']['errorText']=_0x35f06b,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x388322=new yt(this['locale']),t=this['locale']['t'];return _0x388322['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x388322['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x388322;}['_createCancelButtonView'](){const _0x4e1a3e=new yt(this['locale']),t=this['locale']['t'];return _0x4e1a3e['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x4e1a3e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x756e83=>{_0x756e83['stopPropagation']();})}}),_0x4e1a3e['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x4e1a3e;}['_setModelList'](_0x4b4168){this['_modelSelectionDropdownItems']['clear']();const _0x4389b3=this['_check']['models'];if(_0x4b4168)this['set']('modelDisplayMode','hidden');else{const _0x9be78e=0x1===_0x4389b3['length'];this['set']('modelDisplayMode',_0x9be78e?'name':'selector');}if(this['resetToDefault'](),_0x4389b3?.['length']){0x1===_0x4389b3['length']&&this['set']('activeModelName',_0x4389b3[0x0]['name']||_0x4389b3[0x0]['id']);for(const _0x222348 of _0x4389b3){const _0x404475=new Zt({'label':_0x222348['name'],'withText':!0x0,'role':'menuitemradio','id':_0x222348['id'],'model':_0x222348});_0x404475['bind']('isOn')['to'](this,'modelId',_0xf5bd7c=>_0xf5bd7c===_0x222348['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x404475,'labelView':new ModelButtonLabelView(this['locale'],_0x222348)});}}}['_createModelSelectionDropdown'](){const _0x2c5b56=Ft(this['locale']);return _0x2c5b56['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x2c5b56['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x2c5b56['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x335aee=>'selector'===_0x335aee),this['listenTo'](_0x2c5b56,'execute',_0x43d577=>{this['modelId']=_0x43d577['source']['model']['id'],_0x2c5b56['buttonView']['label']=_0x43d577['source']['label'];}),_0x2c5b56;}['_createModelNameView'](){const _0x95f80=new ModelNameView(this['locale']);return _0x95f80['bind']('text')['to'](this,'activeModelName',_0x59ec17=>_0x59ec17??''),_0x95f80['bind']('isVisible')['to'](this,'modelDisplayMode',_0x52e8f4=>'name'===_0x52e8f4),_0x95f80;}['_createActionsFooterView'](){const _0x32ee86=new Nt(this['locale']);return _0x32ee86['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x32ee86;}}class ModelNameView extends Nt{constructor(_0x4e0064){super(_0x4e0064),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x25931a=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x25931a['if']('isVisible','ck-hidden',_0x9b962c=>!_0x9b962c)]},'children':[{'text':_0x25931a['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x2a5cb1,_0x3239bf){super();const _0x3c01f3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3c01f3['to']('style'),'id':_0x3c01f3['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x3c01f3['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x3239bf['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x3ee0e4();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x36cb12,_0x2dcdb5,_0x466659,_0x4f9333=!0x1){super(_0x36cb12),this['_hideModels']=_0x4f9333,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x2dcdb5['isParameterized']);const _0x3480f1=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai_review__check-list-item_selected',_0x3ff02e=>_0x3ff02e),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x171323=>_0x171323)],'style':{'--ck-ai-review-check-list-item-index':_0x466659}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-list-item-title-text']},'children':[{'text':_0x2dcdb5['title']}]},_0x3480f1]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x2dcdb5['description']?[{'text':_0x2dcdb5['description']}]:[]}]}]},..._0x2dcdb5['isParameterized']?[this['_createParameterizedView'](_0x2dcdb5)]:[],...'custom'===_0x2dcdb5['id']?[this['_createCustomView'](_0x2dcdb5,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x2dcdb5['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x2dcdb5['id'],'args':_0x2dcdb5['useArgs']?_0x2dcdb5['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x1d09ec=>{_0x1d09ec['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x2da8ab=new Lt();return _0x2da8ab['content']=ot,_0x2da8ab['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x2da8ab;}['_createParameterizedView'](_0x2b1356){const _0x15cd5c=new Nt(),_0x2cef36=this['_createFormView'](_0x2b1356);return _0x15cd5c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x5a1a4b=>!_0x5a1a4b)]},'children':[_0x2cef36]}),_0x15cd5c;}['_createFormView'](_0x120513){const _0x494309=new Nt(),_0x33a398=Array['isArray'](_0x120513['options'])?_0x120513['options']:[],_0x6eb91=new yt(this['locale']),t=this['locale']['t'];_0x6eb91['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x6eb91['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x559de1=>{_0x559de1['stopPropagation']();})}}),_0x6eb91['on']('execute',()=>{const _0x3c4cc3=[],_0x5e0687={};this['_formItemsCollection']['forEach'](_0x2392ab=>{_0x3c4cc3['push'](_0x2392ab['value']),_0x120513['useArgs']&&_0x120513['options']&&(_0x5e0687[_0x2392ab['argsKey']]=_0x2392ab['value']);}),this['fire']('runReviewCheck',{'id':_0x120513['id'],'params':_0x3c4cc3['length']?_0x3c4cc3:void 0x0,'args':Object['keys'](_0x5e0687)['length']?_0x5e0687:void 0x0});});const _0xdfef01=_0x33a398['length'];return _0x33a398['forEach']((_0x14f979,_0x39145d)=>{const _0x336da4=_0x39145d===_0xdfef01-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x14f979,_0x336da4?_0x6eb91:null));}),_0x494309['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x494309;}['_createCustomView'](_0x2c0cce,_0x17b624=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x2c0cce,_0x17b624),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-parameterized','ck-ai_review__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x5ae8da=>!_0x5ae8da)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x498e74,_0x2e4fa1,_0x2a368c)=>{_0x2a368c||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x23d558){super(_0x23d558),this['_checkViews']=new _0x3ee0e4(),this['_setupTemplate']();}['setChecks'](_0x38f9ae,_0x52eb5e=!0x1){this['_checkViews']['clear']();for(const [_0x528ee4,_0x4b5cda]of _0x38f9ae['entries']()){const _0x52c03f=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x4b5cda,_0x528ee4,_0x52eb5e);_0x52c03f['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x52c03f);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x315bc3 of this['_checkViews'])_0x315bc3 instanceof AIReviewCoreReviewCommandListItemView&&_0x315bc3['resetToDefault']();}['_setupTemplate'](){const _0x2c47ac=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x2c47ac['if']('isVisible','ck-hidden',_0x1b16a0=>!_0x1b16a0)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x351fb3=this['context']['plugins']['get']('AITabs'),_0x3d9608=this['context']['locale'],_0x8d2aaa=new AIHeaderView(_0x3d9608,{'label':Mi(_0x3d9608,'AI_REVIEW_MODE'),'icon':_0x3c89ba,'class':'ck-ai-header_review','showResizeButton':_0x351fb3['showResizeButton']});return _0x8d2aaa['delegate']('resizeTabs')['to'](_0x351fb3),_0x8d2aaa['bind']('isMaximized')['to'](_0x351fb3['view'],'isMaximized',_0x22073a=>_0x22073a),new AIReviewCoreView(this['context']['locale'],{'header':_0x8d2aaa,'list':new AIReviewCoreReviewCheckListView(_0x3d9608),'results':new AIReviewCoreUICheckResultsView(_0x3d9608,{'generalErrorText':Mi(_0x3d9608,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x3d9608,{'headerText':Mi(_0x3d9608,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x3d9608,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x3d9608,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x2eed22=this['context']['plugins']['get']('AITabs');_0x2eed22['view']['on']('activateTab',(_0x1d9f9d,{newTab:_0x576d97,oldTab:_0x59d0f2})=>{'reviewMode'===_0x576d97?this['fire']('getReviewCheckList'):'reviewMode'===_0x59d0f2&&this['fire']('leaveReview');}),_0x2eed22['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x3c89ba,'order':0x0,'content':this['_mainView']});}}const tr='review-',er=['softBreak'],ir=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x179c1c{static get['requires'](){return[_0x5e3d64,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x5d7fe8){super(_0x5d7fe8),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x52c489=_0x5e85ee=>this['_scheduleAttachReviewEditingToEditor'](_0x5e85ee);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x3c7507)return void _0x52c489(this['context']);const _0x1e3c12=this['context'];for(const _0x1cc071 of _0x1e3c12['editors'])_0x52c489(_0x1cc071);this['listenTo'](_0x1e3c12['editors'],'add',(_0x37539d,_0x5b120c)=>{_0x52c489(_0x5b120c);}),this['listenTo'](_0x1e3c12['editors'],'remove',(_0x25ea8f,_0x2b8ef0)=>{for(const [_0x4115a9,_0x56973e]of this['_markers'])_0x56973e['editor']===_0x2b8ef0&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x4115a9,'changeId':_0x56973e['groupId']}),this['_markers']['delete'](_0x4115a9));});}['_scheduleAttachReviewEditingToEditor'](_0x10efa8){const _0x17df9c=()=>{'destroyed'!==_0x10efa8['state']&&_0x10efa8['conversion']&&this['_attachReviewEditingToEditor'](_0x10efa8);};if('ready'===_0x10efa8['state'])return void _0x17df9c();const _0x2efc90=()=>{this['stopListening'](_0x10efa8,'ready',_0x2efc90),_0x17df9c();};this['listenTo'](_0x10efa8,'ready',_0x2efc90);}['_attachReviewEditingToEditor'](_0x106d8b){this['_reviewEditingAttachedEditors']['has'](_0x106d8b)||(_0x106d8b['conversion']['for']('editingDowncast')['markerToElement']({'model':tr+'insert','view':(_0x481878,{writer:_0x2d736c})=>{const _0x2f3067=this['_markers']['get'](_0x481878['markerName']),_0x179a8d={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x2f3067?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x481878['markerName']};return _0x2d736c['createUIElement']('span',_0x179a8d,function(_0x3f5100){const _0x469b36=this['toDomElement'](_0x3f5100);return _0x469b36['innerHTML']=_0x2f3067?.['content']?.['asString']||'',_0x469b36;});}}),_0x106d8b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-only','view':_0x1f1af1=>{const _0x216869=this['_markers']['get'](_0x1f1af1['markerName']),_0x3e7bc6=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x216869?.['id']||'')&&_0x3e7bc6['push']('ck-ai_review__change_active'),{'classes':_0x3e7bc6,'attributes':{'data-marker-id':_0x1f1af1['markerName']}};}}),_0x106d8b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-context','view':_0x18c304=>{const _0x2c02f8=this['_markers']['get'](_0x18c304['markerName']),_0x1bcd3d=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x2c02f8?.['id']||'')&&_0x1bcd3d['push']('ck-ai_review__change_active'),{'classes':_0x1bcd3d,'attributes':{'data-marker-id':_0x18c304['markerName']}};}}),_0x106d8b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-text','view':_0x45beca=>{const _0x3e83b1=this['_markers']['get'](_0x45beca['markerName']),_0x45c515=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x3e83b1?.['id']||'')&&_0x45c515['push']('ck-ai_review__change_active'),{'classes':_0x45c515,'attributes':{'data-marker-id':_0x45beca['markerName']}};}}),_0x106d8b['conversion']['for']('dataDowncast')['markerToElement']({'model':tr+'suggestion-context','view':(_0x25863d,{writer:_0x4f505c})=>_0x4f505c['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x25863d['isOpening']?'start':'end')})}),_0x106d8b['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x352880,'view':_0x3dc87a}),this['_updateMouseMarkerInteractionListeners'](_0x106d8b),this['listenTo'](_0x106d8b,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x106d8b),{'priority':'lowest'}),this['listenTo'](_0x106d8b,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x106d8b),{'priority':'lowest'}),_0x106d8b['model']['document']['registerPostFixer'](_0x480146=>this['_validateMarkers'](_0x106d8b,_0x480146)),_0x106d8b['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x106d8b)),this['_reviewEditingAttachedEditors']['add'](_0x106d8b));}['_updateMouseMarkerInteractionListeners'](_0x2f08f7){let _0x4211dc=this['_boundEditables']['get'](_0x2f08f7);_0x4211dc||(_0x4211dc=new Map(),this['_boundEditables']['set'](_0x2f08f7,_0x4211dc));const _0x189857=new Set(_0x2f08f7['ui']['getEditableElementsNames']());for(const _0x367c7c of _0x189857){if(_0x4211dc['has'](_0x367c7c))continue;const _0x21180a=_0x2f08f7['ui']['getEditableElement'](_0x367c7c);_0x4211dc['set'](_0x367c7c,_0x21180a),this['_attachMouseMarkerInteractionListeners'](_0x21180a);}for(const [_0x301289,_0x32fc03]of _0x4211dc)_0x189857['has'](_0x301289)||(_0x4211dc['delete'](_0x301289),this['_domEmitter']['stopListening'](_0x32fc03));}['_attachMouseMarkerInteractionListeners'](_0xb3f5fc){this['_domEmitter']['listenTo'](_0xb3f5fc,'mouseup',(_0x3089f6,_0x3c0ded)=>{const _0x59a938=_0x3c0ded['target'],_0x136894=this['_findMarkerElement'](_0x59a938);if(!_0x136894)return;const _0x378a08=_0x136894['getAttribute']('data-marker-id'),_0x5d72ed=_0x378a08['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x378a08,'changeId':_0x5d72ed,'markerElement':()=>this['_findMarkerElementById'](_0x378a08),'domEvent':_0x3c0ded});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0xb3f5fc,'mouseover',(_0x4e5aa1,_0x2a133e)=>{const _0x4f3acb=_0x2a133e['target'],_0x5afaca=_0x2a133e['relatedTarget'];let _0x18bdf4=this['_findMarkerElement'](_0x4f3acb);if(!_0x18bdf4&&_0x5afaca&&(_0x18bdf4=this['_findMarkerElement'](_0x5afaca)),!_0x18bdf4)return;const _0xf96714=_0x18bdf4['getAttribute']('data-marker-id'),_0x3d812c=_0xf96714['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x3d812c,'markerElement':()=>this['_findMarkerElementById'](_0xf96714),'domEvent':_0x2a133e});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0xf959ba((_0x120222,_0x243801)=>{const _0x49ba77=_0x243801['target'];if(this['_findMarkerElement'](_0x49ba77))return;_0x49ba77['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x38ada2=this['context']['plugins']['get']('AIEditing'),_0x3e70de=ms(this['context']);if(!_0x3e70de['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x35c5b6=new Set(),_0x39bfca=[],_0x15fab4=new Map();for(const _0x1a06ce of _0x3e70de)for(const _0x5c44db of _0x1a06ce['model']['document']['getRoots']()){if('$graveyard'===_0x5c44db['rootName'])continue;const _0x275896=this['_buildDocumentDataSliceForRoot'](_0x1a06ce,_0x5c44db,_0x38ada2,_0x35c5b6);_0x39bfca['push'](_0x275896['content']);for(const [_0x5eddf6,_0x391f78]of _0x275896['elements'])_0x15fab4['set'](_0x5eddf6,_0x391f78);}return{'elements':_0x15fab4,'content':_0x39bfca['join']('')};}['_buildDocumentDataSliceForRoot'](_0x4437e3,_0x50c478,_0x265723,_0x5444c2){const _0x4eac58=_0x4437e3['model'],_0x5a8d34=new _0x24abee();for(const _0x23d751 of _0x50c478['getChildren']())_0x5a8d34['_appendChild'](_0x23d751['_clone'](!0x0));for(const _0xfefd4c of _0x4eac58['markers']){const _0x3515c2=_0xfefd4c['getRange']();_0x3515c2&&_0x3515c2['root']['rootName']===_0x50c478['rootName']&&_0x5a8d34['markers']['set'](_0xfefd4c['name'],this['_changeRangeOwnerDocument'](_0x3515c2['clone'](),_0x5a8d34));}const _0x25f020=new Map(),_0x172d0f=_0x4eac58['document']['version'],_0x3532c7=new _0x2f31ae({'ignoreElementEnd':!0x0,'startPosition':_0x4eac58['createPositionAt'](_0x5a8d34,0x0)});for(const {item:_0x2267f4}of _0x3532c7){if(_0x2267f4['is']('element')&&_0x2267f4['name']&&ir['includes'](_0x2267f4['name'])){const _0x369b7f=this['_upsertDataId'](_0x2267f4,()=>_0x265723['_nextDataId'](_0x5444c2));_0x5444c2['add'](_0x369b7f);}if(!_0x2267f4['is']('$textProxy'))continue;const _0x43a957=_0x2267f4['parent'];if(!_0x43a957||!_0x43a957['is']('element'))continue;const _0x228656=this['_upsertDataId'](_0x43a957,()=>_0x265723['_nextDataId'](_0x5444c2));_0x5444c2['add'](_0x228656);for(const _0x19865b of _0x43a957['getChildren']())_0x19865b['is']('element')&&(_0x19865b['name']&&er['includes'](_0x19865b['name'])||_0x5444c2['add'](this['_upsertDataId'](_0x19865b,()=>_0x265723['_nextDataId'](_0x5444c2))));let _0x3c1897=_0x43a957;for(;_0x3c1897['parent']&&!_0x3c1897['parent']['is']('documentFragment');)_0x3c1897=_0x3c1897['parent'],_0x3c1897['hasAttribute'](_0x352880)&&_0x3c1897['_removeAttribute'](_0x352880);_0x25f020['set'](_0x228656,{'editor':_0x4437e3,'rootName':_0x50c478['rootName'],'path':_0x43a957['getPath'](),'documentVersion':_0x172d0f,'getContent':this['_createGetContentUsingDataIdFn'](_0x3c1897['_clone'](!0x0),_0x228656,_0x4437e3['data'])}),_0x3532c7['jumpTo'](_0x4eac58['createPositionAfter'](_0x43a957));}return{'content':_0x4437e3['data']['processor']['toData'](_0x4437e3['data']['toView'](_0x5a8d34)),'elements':_0x25f020};}['diffContent'](_0x18d99a,_0x33aab8,_0x4e5fb2,_0x1f15a7=!0x1){const {contentInitial:_0x21d705,contentNew:_0x4088c3}=this['_neutralizeChangesOnUnsupportedElements'](_0x33aab8,_0x4e5fb2),_0x3ebf7b=[],_0x3668b4=_0x18d99a['data']['parse'](_0x4088c3,'$documentFragment'),_0x38e10c=_0x18d99a['data']['parse'](_0x21d705,'$documentFragment'),_0x524dcb=_0x18d99a['model']['createPositionAt'](_0x38e10c,0x0);if(this['_haveSingleTopLevelElement'](_0x3668b4)){if(!this['_hasSameTopLevelElement'](_0x38e10c,_0x3668b4))return _0x3ebf7b;}else{const _0x3eb947=_0x18d99a['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x38e10c,_0x3eb947)||!this['_haveOnlyInlineContent'](_0x3668b4,_0x3eb947))return _0x3ebf7b;}const _0x599751=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x21d705,_0x4088c3,{'targetEditor':_0x18d99a,'anchor':_0x524dcb,'markDeletions':!0x0})['getOperations']()['filter'](_0x3c13cf=>'insert'===_0x3c13cf['type']||'marker'===_0x3c13cf['type']&&_0x3c13cf['name']['startsWith']('$markedRemove')),_0x18d6c1=this['_groupAdjacentOperations'](_0x599751),_0x189ec0=[];if(_0x1f15a7){if(_0x18d6c1['length']){const _0x4d638b=_0x18d6c1[0x0]['operations'][0x0],_0x570dce='insert'===_0x4d638b['type']?_0x4d638b['position']:_0x4d638b['newRange']['start'],_0x36c832=this['_getPositionLimitingRange'](_0x570dce,_0x18d99a,'inside'),_0x560893=_0x36c832?_0x3668b4['getChild'](0x0)['getChildren']():_0x3668b4['getChildren'](),_0x247b60=_0x36c832||_0x18d99a['model']['createRangeIn'](_0x38e10c),_0x4ce9bf=[new _0x511dc9('$markedRemove:synthetic'+at(),null,_0x247b60,_0x18d99a['model']['document']['model']['markers'],!0x0,_0x18d99a['model']['document']['version']+0x1),new _0x241317(_0x247b60['end'],_0x560893,_0x18d99a['model']['document']['version']+0x2)];_0x189ec0['push']({'operations':_0x4ce9bf,'operationsIsolated':_0x4ce9bf,'groupOffset':0x0});}}else _0x189ec0['push'](..._0x18d6c1);let _0xac2ea8=0x0;return _0x18d99a['model']['change'](_0x7a3237=>{for(let _0x25569c=0x0;_0x25569c<_0x189ec0['length'];_0x25569c++){const _0x39a791=_0x189ec0[_0x25569c],_0x49d47a=_0x7a3237['createDocumentFragment']();for(const _0x10219b of _0x38e10c['getChildren']())_0x7a3237['append'](_0x10219b['_clone'](!0x0),_0x49d47a);for(const _0x53aec4 of _0x39a791['operationsIsolated'])if('insert'===_0x53aec4['type']){const _0x4745d=_0x53aec4;_0x4745d['baseVersion']=null,_0x4745d['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4745d,_0x49d47a),_0x7a3237['batch']['addOperation'](_0x53aec4),_0x18d99a['model']['applyOperation'](_0x53aec4);const _0x413c63='suggestion:insertion:id:authorId:'+_0xac2ea8++,_0x3c4b86=_0x18d99a['model']['createRange'](_0x4745d['position'],_0x4745d['position']['getShiftedBy'](_0x4745d['howMany']));_0x49d47a['markers']['set'](_0x413c63,_0x3c4b86);}else{if('marker'===_0x53aec4['type']&&_0x53aec4['name']['startsWith']('$markedRemove')){const _0x51521b=_0x53aec4,_0x21ce40='suggestion:deletion:id:authorId:'+_0xac2ea8++;this['_changeOperationOwnerDocument'](_0x51521b,_0x49d47a),_0x49d47a['markers']['set'](_0x21ce40,_0x51521b['newRange']);}}if(_0x1f15a7)_0x3ebf7b['push']({..._0x39a791,'context':this['_createGetContentFn'](_0x38e10c,_0x18d99a['data']),'content':this['_createGetContentFn'](_0x38e10c,_0x18d99a['data'])});else{const _0x2064cb=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x39a791['operationsIsolated'][0x0]),_0x49d47a),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x39a791['operationsIsolated'][_0x39a791['operationsIsolated']['length']-0x1]),_0x49d47a),_0x18d99a);_0x49d47a['markers']['set'](tr+'suggestion-context',new _0x533258(_0x2064cb['start'],_0x2064cb['end'])),_0x3ebf7b['push']({..._0x39a791,'context':this['_createGetContextFn'](_0x49d47a,_0x18d99a['data'],{'ellipsisBefore':_0x2064cb['hasContentBefore'],'ellipsisAfter':_0x2064cb['hasContentAfter']}),'content':this['_createGetContentFn'](_0x49d47a,_0x18d99a['data'])});}}}),_0x3ebf7b;}['markChangePositionInEditorContent'](_0x3edd68,_0x7d479c){if(!_0x3edd68['length'])return;const _0x1993e3=_0x3edd68[0x0]['parent']['id'],_0x2d6951=_0x7d479c['elements']['get'](_0x1993e3);if(!_0x2d6951)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x1993e3);const _0x4e776a=_0x2d6951['path'],_0x1d02dc=_0x2d6951['editor'],_0x4a3642=_0x1d02dc['model']['document']['getRoot'](_0x2d6951['rootName']);if(!_0x4a3642)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x2d6951['rootName']);const _0x3bc5a0=_0x1d02dc['model']['document']['history']['getOperations'](_0x2d6951['documentVersion']),_0x5000f7=[];for(const _0x1c1bc7 of _0x3edd68){const _0x2dd436=_0x1c1bc7['operationsIsolated']['map'](_0x5e3c55=>this['_translateOperationToEditorContent'](_0x5e3c55,_0x4e776a,_0x4a3642));if(!_0x2dd436||!_0x2dd436['length'])continue;const _0x2de580=_0x2dd436['every'](_0x2ef1d7=>'marker'===_0x2ef1d7['type']&&_0x2ef1d7['name']['startsWith']('$markedRemove')),_0x3e5251={'document':_0x1d02dc['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x2eb2a0=_0x4fc222(_0x2dd436,_0x3bc5a0,_0x3e5251)['operationsA'];for(const _0x772ac of _0x2eb2a0)if('insert'===_0x772ac['type']){const _0x438a5d=_0x772ac,_0x28aea4=_0x438a5d['nodes'];_0x1d02dc['model']['change'](_0x232729=>{const _0xa4385b=_0x232729['createDocumentFragment']();for(const _0x2e5854 of _0x28aea4)_0x232729['append'](_0x2e5854['_clone'](!0x0),_0xa4385b);_0x5000f7['push']({'start':_0x438a5d['position'],'end':_0x438a5d['position'],'type':'insert','groupId':_0x1c1bc7['id'],'content':{'asString':this['_createGetContentFn'](_0xa4385b,_0x1d02dc['data'])(),'asFragment':_0xa4385b}});});}else{if('marker'===_0x772ac['type']&&_0x772ac['name']['startsWith']('$markedRemove')){const _0x258edf=_0x772ac;let _0x1a2baa='remove-text';if(_0x2de580){const _0x4e2b65=this['_findAdjacentContextDistance'](_0x258edf['newRange']['start'],'backward',_0x1d02dc['model']['schema']),_0xd398d4=this['_findAdjacentContextDistance'](_0x258edf['newRange']['end'],'forward',_0x1d02dc['model']['schema']);if(_0x4e2b65||_0xd398d4){const _0x3acc1d=_0x258edf['newRange']['start']['getShiftedBy'](-_0x4e2b65),_0x1f8687=_0x258edf['newRange']['end']['getShiftedBy'](_0xd398d4);_0x5000f7['push']({'start':_0x3acc1d,'end':_0x1f8687,'groupId':_0x1c1bc7['id'],'type':'remove-context'});}else _0x1a2baa='remove-only';}_0x5000f7['push']({'start':_0x258edf['newRange']['start'],'end':_0x258edf['newRange']['end'],'groupId':_0x1c1bc7['id'],'type':_0x1a2baa});}}}this['_insertMarkers'](_0x5000f7,_0x1d02dc);}['clearAllMarkers'](){const _0x5d5d89=new Map();for(const _0x8bc89e of this['_markers']['keys']()){const _0x2b2492=this['_markers']['get'](_0x8bc89e);_0x2b2492?.['editor']&&(_0x5d5d89['has'](_0x2b2492['editor'])||_0x5d5d89['set'](_0x2b2492['editor'],[]),_0x5d5d89['get'](_0x2b2492['editor'])['push'](_0x8bc89e));}for(const [_0x2fe7d2,_0x2ef392]of _0x5d5d89)_0x2fe7d2['model']['change'](_0x1af9ef=>{for(const _0x29a9a4 of _0x2ef392)_0x2fe7d2['model']['markers']['get'](_0x29a9a4)&&_0x1af9ef['removeMarker'](_0x29a9a4);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x376d4d of ms(this['context']))_0x376d4d['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x1a9b2f of ms(this['context']))_0x1a9b2f['disableReadOnlyMode']('ai-review');}['applyChange'](_0x4472a8){const _0x477bee=_0x4472a8['map'](_0x3f2015=>this['_getMarkersDataForGroup'](_0x3f2015))['flat'](),_0x4e94e3=new Map();for(const _0x16869d of _0x477bee)_0x4e94e3['has'](_0x16869d['editor'])||_0x4e94e3['set'](_0x16869d['editor'],[]),_0x4e94e3['get'](_0x16869d['editor'])['push'](_0x16869d);for(const [_0x4a883c,_0x5c9e24]of _0x4e94e3){const _0x4187f3=_0x4a883c['model'];_0x4187f3['change'](_0x5b1175=>{for(const _0x5f17c9 of _0x5c9e24){const _0x5a4b26=_0x4a883c['model']['markers']['get'](_0x5f17c9['id']);if(_0x5a4b26){if('insert'===_0x5f17c9['type']){if(!_0x5f17c9['content'])continue;_0x4187f3['insertContent'](_0x5f17c9['content']['asFragment']||null,_0x5a4b26['getRange']()['start']);}else'remove-text'!==_0x5f17c9['type']&&'remove-only'!==_0x5f17c9['type']||_0x4187f3['deleteContent'](_0x4187f3['createSelection'](_0x5a4b26['getRange']()));_0x5b1175['removeMarker'](_0x5f17c9['id']),this['_markers']['delete'](_0x5f17c9['id']);}}});}}['rejectChange'](_0x1b1b19){const _0x545649=this['_getMarkersDataForGroup'](_0x1b1b19),_0x596040=new Map();for(const _0x4e457a of _0x545649)_0x596040['has'](_0x4e457a['editor'])||_0x596040['set'](_0x4e457a['editor'],[]),_0x596040['get'](_0x4e457a['editor'])['push'](_0x4e457a);for(const [_0x1a2362,_0x1e41f2]of _0x596040)_0x1a2362['model']['change'](_0x1cebfa=>{for(const _0x2424fa of _0x1e41f2)_0x1cebfa['removeMarker'](_0x2424fa['id']),this['_markers']['delete'](_0x2424fa['id']);});}['getEditor'](){return ps(this['context']);}['getEditors'](){return ms(this['context']);}['getEditorForChange'](_0x1b6f1f){const _0x2ae3d8=this['_getMarkersDataForGroup'](_0x1b6f1f);return _0x2ae3d8[0x0]?.['editor'];}['getMarkerElementForChange'](_0x281b4c){const _0x4961e9=Array['from'](this['_markers']['values']())['filter'](_0x11a917=>_0x11a917['groupId']===_0x281b4c);if(!_0x4961e9['length'])return null;const _0x41054e=0x1===_0x4961e9['length']?_0x4961e9[0x0]:this['_sortMarkers'](_0x4961e9)[0x0],_0x31eb5e=_0x41054e['editor']['model']['markers']['get'](_0x41054e['id']);if(!_0x31eb5e)return null;return{'modelRange':_0x31eb5e['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x41054e['id'])};}['getContentElementForChange'](_0x397ba9){const _0x35fbec=Array['from'](this['_markers']['values']())['filter'](_0x54c8bb=>_0x54c8bb['groupId']===_0x397ba9);if(!_0x35fbec['length'])return null;const _0x4dd454=0x1===_0x35fbec['length']?_0x35fbec[0x0]:this['_sortMarkers'](_0x35fbec)[0x0],_0x3037ee=_0x4dd454['editor'],_0x33d062=_0x3037ee['model']['markers']['get'](_0x4dd454['id']);if(!_0x33d062)return null;const _0x2effb5=_0x33d062['getRange'](),_0xc4087e=_0x3037ee['editing']['view']['getDomRoot'](_0x2effb5['root']['rootName'])||_0x3037ee['editing']['view']['getDomRoot']();if(!_0xc4087e||!_0x2effb5)return null;let _0x4aaccd=_0x2effb5['start']['parent'];for(;_0x4aaccd['parent']&&!_0x4aaccd['parent']['is']('rootElement');)_0x4aaccd=_0x4aaccd['parent'];if(!_0x4aaccd||!_0x4aaccd['name'])return null;const _0xf2c303=_0xc4087e['querySelector']('[data-marker-id=\x22'+_0x4dd454['id']+'\x22]');if(!_0xf2c303)return null;let _0x467878=null;_0x3037ee['model']['change'](_0x39b90f=>{_0x467878=_0x39b90f['createDocumentFragment'](),_0x39b90f['append'](_0x4aaccd['_clone'](!0x0),_0x467878);});const _0x4d91b0=_0x3037ee['data']['toView'](_0x467878)['getChild'](0x0);return _0xf2c303['closest'](_0x4d91b0['name']);}['reactivateMarkers'](_0x44bd85){const _0x23b094=this['_getMarkersDataForGroup'](_0x44bd85);if(!_0x23b094['length'])return;const _0x14af45=Array['from'](this['_activeMarkers'])['sort'](),_0x181ed1=Array['from'](new Set(_0x23b094['map'](_0x5da8e9=>_0x5da8e9['id'])))['sort']();_0x14af45['join']('|')!==_0x181ed1['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x44bd85));}['setMarkersInElementAsActive'](_0x213c1c){const _0x51477c=this['_getMarkersDataForGroup'](_0x213c1c);if(!_0x51477c['length'])return;const _0x2eaab4=_0x51477c[0x0]['editor'],_0x4883e6=new Set(_0x51477c['map'](_0x26dca8=>_0x26dca8['id'])),_0x5104e8=Array['from'](_0x4883e6['values']())['map'](_0x29ab21=>_0x2eaab4['model']['markers']['get'](_0x29ab21))['filter'](_0x9c753d=>!!_0x9c753d);_0x4883e6['forEach'](_0xa1cfde=>{this['_activeMarkers']['add'](_0xa1cfde);}),_0x2eaab4['model']['change'](()=>{_0x5104e8['forEach'](_0x331745=>{_0x2eaab4['editing']['reconvertMarker'](_0x331745);});});}['setAllMarkersAsInactive'](){const _0x4fcb72=Array['from'](this['_activeMarkers']);if(!_0x4fcb72['length'])return;this['_activeMarkers']['clear']();const _0x157047=new Map();for(const _0x44548c of _0x4fcb72){const _0x3f33e0=this['_markers']['get'](_0x44548c);if(!_0x3f33e0)continue;const _0x174928=_0x3f33e0['editor'],_0x5c49f3=_0x174928['model']['markers']['get'](_0x44548c);_0x5c49f3&&(_0x157047['has'](_0x174928)||_0x157047['set'](_0x174928,[]),_0x157047['get'](_0x174928)['push'](_0x5c49f3));}for(const [_0xca5fe,_0x45ecc7]of _0x157047)_0xca5fe['model']['change'](()=>{_0x45ecc7['forEach'](_0x5c7bee=>{_0xca5fe['editing']['reconvertMarker'](_0x5c7bee);});});}['_getPositionLimitingRange'](_0x8cd581,_0x31af4e,_0xd671f0='outside'){if(!_0x8cd581)return null;let _0x223c74=_0x8cd581['parent'];for(;_0x223c74&&_0x223c74['parent']&&!_0x223c74['parent']['is']('rootElement')&&!_0x31af4e['model']['schema']['isLimit'](_0x223c74)&&!_0x31af4e['model']['schema']['isBlock'](_0x223c74);)_0x223c74=_0x223c74['parent'];if(!_0x223c74||!_0x223c74['name']||_0x223c74['is']('rootElement'))return null;let _0x469209=null;return _0x31af4e['model']['change'](_0x29be88=>{_0x469209='inside'===_0xd671f0?_0x29be88['createRangeIn'](_0x223c74):_0x29be88['createRangeOn'](_0x223c74);}),_0x469209;}['_validateMarkers'](_0x4eb1c5,_0x3050b0){const _0x436a6d=Array['from'](this['_markers']['keys']()),_0x314d1a=new Map();for(const _0x1e74f7 of _0x436a6d){const _0x298a56=_0x4eb1c5['model']['markers']['get'](_0x1e74f7);if(!_0x298a56)continue;const _0x44d998=_0x298a56['getStart']()['root']['rootName']+':'+_0x298a56['getStart']()['path'][0x0];_0x314d1a['has'](_0x44d998)||_0x314d1a['set'](_0x44d998,[]),_0x314d1a['get'](_0x44d998)['push'](_0x298a56);}const _0x3e495e=new Set();for(const _0x4de3da of _0x4eb1c5['model']['document']['differ']['getChanges']()){let _0x4a8325='',_0x100bf2=null;if('insert'===_0x4de3da['type'])_0x100bf2=new _0x533258(_0x4de3da['position'],_0x4de3da['position']['getShiftedBy'](_0x4de3da['length'])),_0x4a8325=_0x4de3da['position']['root']['rootName']+':'+_0x4de3da['position']['path'][0x0];else{if('remove'!==_0x4de3da['type'])continue;_0x100bf2=new _0x533258(_0x4de3da['position']),_0x4a8325=_0x4de3da['position']['root']['rootName']+':'+_0x4de3da['position']['path'][0x0];}const _0xa01102=_0x314d1a['get'](_0x4a8325)||[];if(_0xa01102['length']){for(const _0x59e737 of _0xa01102)if(_0x100bf2['root']['rootName']===_0x59e737['getRange']()['root']['rootName']&&('insert'!==_0x4de3da['type']||!_0x100bf2['containsRange'](_0x59e737['getRange']()))&&(_0x100bf2['isIntersecting'](_0x59e737['getRange']())||_0x100bf2['start']['isTouching'](_0x59e737['getRange']()['end'])||_0x100bf2['end']['isTouching'](_0x59e737['getRange']()['start']))){const _0x469057=this['_parseMarkerName'](_0x59e737['name']);Array['from'](this['_markers']['values']())['filter'](_0x17a06a=>_0x17a06a['groupId']===_0x469057['groupId'])['forEach'](_0x430f17=>_0x3e495e['add'](_0x430f17['id']));}}}if(_0x3e495e['size']){for(const _0x510f00 of _0x3e495e)_0x3050b0['removeMarker'](_0x510f00);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x584c96){for(const {name:_0x34b2f9,data:_0xb390e9}of _0x584c96['model']['document']['differ']['getChangedMarkers']()){if(!_0x34b2f9['startsWith'](tr))continue;const _0x4336fd=_0xb390e9['oldRange'],_0xb62eff=_0xb390e9['newRange'],_0x4e561c=_0x4336fd&&'$graveyard'===_0x4336fd['root']['rootName'],_0x218537=_0xb62eff&&'$graveyard'===_0xb62eff['root']['rootName'];if(_0x4e561c&&_0x218537)continue;const _0x3fbb41=this['_parseMarkerName'](_0x34b2f9);this['_markers']['get'](_0x34b2f9)&&(_0x218537||!_0xb62eff?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x34b2f9,'changeId':_0x3fbb41['groupId']}):_0x4e561c&&_0xb62eff&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x34b2f9,'changeId':_0x3fbb41['groupId']}));}}['_parseMarkerName'](_0x2ce9f4){const _0x1b9f8c=_0x2ce9f4['split'](':'),_0xc09b=(_0x1b9f8c[0x1]||'')['split']('_');return{'prefix':_0x1b9f8c[0x0],'groupId':_0xc09b[0x0],'suffix':_0xc09b[0x1]};}['_translateOperationToEditorContent'](_0xeb4953,_0x65b46b,_0x1b91d7){if('insert'===_0xeb4953['type']){const _0xb3f563=_0xeb4953;return new _0x241317(this['_changePosition'](_0x65b46b['concat'](_0xb3f563['position']['offset']),_0x1b91d7),_0xb3f563['nodes'],_0xb3f563['baseVersion']);}if('marker'===_0xeb4953['type']&&_0xeb4953['name']['startsWith']('$markedRemove')){const _0x40e6fe=_0xeb4953;return new _0x511dc9(_0x40e6fe['name'],_0x40e6fe['oldRange'],this['_changeRange'](_0x40e6fe['newRange'],_0x65b46b['concat'](_0x40e6fe['newRange']['start']['offset']),_0x65b46b['concat'](_0x40e6fe['newRange']['end']['offset']),_0x1b91d7),_0x40e6fe['_markers'],_0x40e6fe['affectsData'],_0x40e6fe['baseVersion']);}return _0xeb4953;}['_groupAdjacentOperations'](_0x3b16cb){if(!_0x3b16cb['length'])return[];const _0x3f9f76=[];let _0x5f21a1=0x0,_0x3ab007=0x0,_0x24db1e=[];for(let _0xac880b=0x0;_0xac880b<=_0x3b16cb['length'];_0xac880b++){const _0x1e7df4=_0x3b16cb[_0xac880b],_0x33038c=_0x3b16cb[_0xac880b-0x1];!_0x1e7df4||_0x33038c&&!this['_getOperationEnd'](_0x33038c)['isTouching'](this['_getOperationStart'](_0x1e7df4))?(_0x3f9f76['push']({'operations':_0x24db1e,'operationsIsolated':_0x24db1e['map'](_0x453b0d=>this['_shiftOperation'](_0x453b0d['clone'](),-_0x3ab007)),'groupOffset':_0x5f21a1}),_0x24db1e=_0x1e7df4?[_0x1e7df4]:[],_0x3ab007+=_0x5f21a1,_0x5f21a1=0x0):_0x24db1e['push'](_0x1e7df4),_0x1e7df4&&'insert'===_0x1e7df4['type']&&(_0x5f21a1+=_0x1e7df4['howMany']);}return _0x3f9f76;}['_findAdjacentContextDistance'](_0x32c1e2,_0x578539,_0x52134e,_0xea8f4=0x1){const _0x1a404e=new _0x2f31ae({'startPosition':_0x32c1e2,'direction':_0x578539});let _0x1c85c5=0x0;for(let _0x3aa0dd=0x0;_0x3aa0dd<_0xea8f4;_0x3aa0dd++){let _0x516354=0x0,_0x54a960=!0x1,_0x52e608='forward'===_0x578539?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x4412c1}of _0x1a404e)if(_0x4412c1['is']('$textProxy')){const _0x4ecdee=_0x52e608['exec'](_0x4412c1['data']);if(_0x4ecdee&&_0x4ecdee['length']){if(_0x516354+='forward'===_0x578539?_0x4ecdee['index']+_0x4ecdee[0x0]['length']:_0x4412c1['data']['length']-_0x4ecdee['index'],_0x4ecdee[0x0]['length']!==_0x4412c1['data']['length'])break;_0x54a960=!0x0,_0x52e608='forward'===_0x578539?/^\w+/:/\w+$/;}else{if(_0x54a960)break;_0x516354+=_0x4412c1['offsetSize'];}}else{if(_0x4412c1['is']('element')){_0x52134e['isInline'](_0x4412c1)&&!_0x54a960&&(_0x516354+=0x1);break;}}_0x1c85c5+=_0x516354,_0x1a404e['jumpTo'](_0x32c1e2['getShiftedBy']('forward'===_0x578539?_0x1c85c5:-_0x1c85c5));}return _0x1c85c5;}['_getChangeContext'](_0x25913b,_0x5d8af9,_0x3813fd){const _0x132367=_0x3813fd['model']['schema'],_0x4455c0=this['_findAdjacentContextDistance'](_0x25913b,'backward',_0x132367,0x6),_0x26f1b8=this['_findAdjacentContextDistance'](_0x5d8af9,'forward',_0x132367,0x6),_0x2bbde2=_0x25913b['getShiftedBy'](-_0x4455c0),_0xc8f09=_0x5d8af9['getShiftedBy'](_0x26f1b8);return{'start':_0x2bbde2,'end':_0xc8f09,'hasContentBefore':!_0x2bbde2['isAtStart'],'hasContentAfter':!_0xc8f09['isAtEnd']};}['_insertMarkers'](_0x48d9ea,_0x189e85){const _0x428a7b=this['context']['plugins']['get']('AIEditing'),_0xd5980a=new Set();_0x189e85['model']['change'](_0x372c01=>{for(const _0x415d4a of _0x48d9ea){const _0x501813=''+tr+_0x415d4a['type']+':'+_0x415d4a['groupId']+'_'+_0x428a7b['_nextDataId'](_0xd5980a);this['_markers']['set'](_0x501813,{'id':_0x501813,'groupId':_0x415d4a['groupId'],'type':_0x415d4a['type'],'content':_0x415d4a['content'],'editor':_0x189e85}),_0x372c01['addMarker'](_0x501813,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x372c01['createRange'](_0x415d4a['start'],_0x415d4a['end'])});}});}['_createGetContextFn'](_0x5d03ab,_0x4a19c0,_0x4b0707){let _0x1a5f27='';return()=>{if(!_0x1a5f27){const _0x232a59=_0x4a19c0['toView'](_0x5d03ab,{'showSuggestionHighlights':!0x0});let _0x669ea9=_0x232a59['getChild'](0x0);if(_0x669ea9['is']('containerElement')||(_0x669ea9=_0x232a59),!_0x669ea9)return'';let _0x5b38d6=!0x1;const _0x3e91c2=[];for(const _0x58beb9 of _0x669ea9['getChildren']())_0x58beb9['is']('element','span')&&_0x58beb9['hasClass']('ck-ai_review-marker_context-end')&&(_0x5b38d6=!0x1),_0x5b38d6&&_0x3e91c2['push'](_0x58beb9),_0x58beb9['is']('element','span')&&_0x58beb9['hasClass']('ck-ai_review-marker_context-start')&&(_0x5b38d6=!0x0);_0x669ea9['_removeChildren'](0x0,_0x669ea9['childCount']),_0x4b0707?.['ellipsisBefore']&&_0x669ea9['_appendChild']('…'),_0x669ea9['_appendChild'](_0x3e91c2),_0x4b0707?.['ellipsisAfter']&&_0x669ea9['_appendChild']('…');const _0x468bfc=_0x4a19c0['htmlProcessor']['domConverter']['viewToDom'](_0x232a59),_0x14c4c0=_0x4a19c0['htmlProcessor']['htmlWriter']['getHtml'](_0x468bfc);_0x1a5f27=this['_removeUnsupportedElements'](_0x14c4c0);}return _0x1a5f27;};}['_createGetContentFn'](_0x5e1587,_0x54b303){let _0x46d4d7='';return()=>(_0x46d4d7||(_0x46d4d7=this['_removeUnsupportedElements'](_0x54b303['stringify'](_0x5e1587,{'showSuggestionHighlights':!0x0}))),_0x46d4d7);}['_createGetContentUsingDataIdFn'](_0x4b4e73,_0x5e6b28,_0x552a48){let _0x186dc6='';return()=>{if(!_0x186dc6){const _0x4eeb37=_0x552a48['toView'](new _0x24abee(_0x4b4e73)),_0x15c48c=_0x552a48['htmlProcessor']['domConverter']['viewToDom'](_0x4eeb37)['querySelector']('[data-id=\x22'+_0x5e6b28+'\x22]');_0x186dc6=_0x15c48c?.['outerHTML']||'';}return _0x186dc6;};}['_removeUnsupportedElements'](_0x1e3296){if(!_0x1e3296)return'';const _0x4255a0=Wi(_0x1e3296,{'decodeEntities':!0x1}),_0x56bd65=qi(_0x4255a0);if(!_0x56bd65['length'])return _0x1e3296;for(const _0x1b82a2 of _0x56bd65)_0x1221fe(_0x1b82a2);return Ki(_0x4255a0,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x1aa158,_0x493cbd){const _0x400305=Wi(_0x1aa158,{'decodeEntities':!0x1}),_0x3fd0c2=Wi(_0x493cbd,{'decodeEntities':!0x1}),_0x421862=qi(_0x400305),_0x182963=qi(_0x3fd0c2);if(!_0x421862['length']&&!_0x182963['length'])return{'contentInitial':_0x1aa158,'contentNew':_0x493cbd};const _0x256129=new Map();for(const _0x29c5ef of _0x421862)_0x256129['set'](Xi(_0x29c5ef,'data-id'),_0x29c5ef);for(const _0x5a96bf of _0x182963){const _0x59f449=Xi(_0x5a96bf,'data-id'),_0x287931=_0x59f449?_0x256129['get'](_0x59f449):void 0x0;_0x287931?_0x2f4258(_0x5a96bf,_0x4382fa(_0x287931,!0x0)):_0x1221fe(_0x5a96bf);}return{'contentInitial':Ki(_0x400305,{'encodeEntities':!0x1}),'contentNew':Ki(_0x3fd0c2,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x3f6abf,_0x5126a2=0x5){let _0x2eecd1=_0x3f6abf,_0x58249a=null;for(let _0xee431=0x0;_0xee431<_0x5126a2&&_0x2eecd1;_0xee431++){if(!_0x2eecd1['className']){_0x2eecd1=_0x2eecd1['parentElement'];continue;}if(!(''+_0x2eecd1['className'])['includes']('ck-ai_review-marker_')){_0x2eecd1=_0x2eecd1['parentElement'];continue;}if(!_0x2eecd1['getAttribute']('data-marker-id'))break;_0x58249a=_0x2eecd1;break;}return _0x58249a;}['_findMarkerElementById'](_0x521a7f){const _0x3f37c5=this['_markers']['get'](_0x521a7f);if(!_0x3f37c5)return null;const _0x47f734=_0x3f37c5['editor']['model']['markers']['get'](_0x521a7f);return _0x47f734?_0x3ba088(_0x3f37c5['editor']['editing'],_0x47f734):null;}['_getMarkersDataForGroup'](_0x4b1f80){return Array['from'](this['_markers']['values']())['filter'](_0x51db7d=>_0x51db7d['groupId']===_0x4b1f80);}['_getOperationStart'](_0x33d000){return'insert'===_0x33d000['type']?_0x33d000['position']:_0x33d000['newRange']['start'];}['_getOperationEnd'](_0x1bce7b,_0x32bb7b=!0x1){return'insert'===_0x1bce7b['type']?_0x32bb7b?_0x1bce7b['position']:_0x1bce7b['position']['getShiftedBy'](_0x1bce7b['howMany']):_0x1bce7b['newRange']['end'];}['_shiftOperation'](_0x3e7e19,_0x56c979){return'insert'===_0x3e7e19['type']?_0x3e7e19['position']=_0x3e7e19['position']['getShiftedBy'](_0x56c979):'marker'===_0x3e7e19['type']&&_0x3e7e19['newRange']&&(_0x3e7e19['newRange']=new _0x533258(_0x3e7e19['newRange']['start']['getShiftedBy'](_0x56c979),_0x3e7e19['newRange']['end']['getShiftedBy'](_0x56c979))),_0x3e7e19;}['_changeOperationOwnerDocument'](_0x57a30e,_0x2feeab){'insert'===_0x57a30e['type']?_0x57a30e['position']=this['_changePositionOwnerDocument'](_0x57a30e['position'],_0x2feeab):'marker'===_0x57a30e['type']&&_0x57a30e['newRange']&&(_0x57a30e['newRange']=this['_changeRangeOwnerDocument'](_0x57a30e['newRange'],_0x2feeab));}['_changePositionOwnerDocument'](_0x5ef345,_0xbb640c){return new _0x56bf4a(_0xbb640c,_0x5ef345['path']);}['_changeRangeOwnerDocument'](_0x148c88,_0x4ee1b7){return new _0x533258(this['_changePositionOwnerDocument'](_0x148c88['start'],_0x4ee1b7),this['_changePositionOwnerDocument'](_0x148c88['end'],_0x4ee1b7));}['_changePosition'](_0x5ed767,_0x3413d9){return new _0x56bf4a(_0x3413d9,[..._0x5ed767]);}['_changeRange'](_0x5e5dc9,_0x542123,_0x3b6abe,_0x4811b2){return new _0x533258(this['_changePosition'](_0x542123,_0x4811b2),this['_changePosition'](_0x3b6abe,_0x4811b2));}['_sortMarkers'](_0x4eeec7){const _0x50e653=_0x477261=>{switch(_0x477261){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x4eeec7['sort']((_0x4c6b11,_0xbaadc4)=>_0x50e653(_0x4c6b11['type'])-_0x50e653(_0xbaadc4['type']));}['_hasSameTopLevelElement'](_0x3e0841,_0x20cc1d){const _0x45735c=_0x3e0841['getChild'](0x0),_0x59969d=_0x20cc1d['getChild'](0x0);return!(!_0x45735c||!_0x59969d)&&((!_0x45735c['is']('element')||!_0x59969d['is']('element')||_0x45735c['name']===_0x59969d['name'])&&!(_0x45735c['is']('element')&&!_0x59969d['is']('element')||!_0x45735c['is']('element')&&_0x59969d['is']('element')));}['_haveSingleTopLevelElement'](_0x64295b){return 0x1===_0x64295b['childCount'];}['_haveOnlyInlineContent'](_0x37c3e0,_0x2fd0d9){for(const _0x2b049b of _0x37c3e0['getChildren']())if(_0x2b049b['is']('element')&&!_0x2fd0d9['isInline'](_0x2b049b))return!0x1;return!0x0;}['_upsertDataId'](_0x5532d5,_0x2e0404){let _0x10fc3e=_0x5532d5['getAttribute'](_0x352880);return _0x10fc3e||(_0x10fc3e=_0x2e0404(),_0x5532d5['_setAttribute'](_0x352880,_0x10fc3e)),_0x10fc3e;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0xdc6ab8,contentNew:_0x3f53f9,contentInitial:_0x1e3de8,documentVersion:_0x586a8c}){super(),this['id']=_0xdc6ab8,this['contentNew']=_0x3f53f9,this['contentInitial']=_0x1e3de8,this['documentVersion']=_0x586a8c;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x229ccc,_0x53698a,_0x4a6de4){super(),this['id']=_0x229ccc,this['parent']=_0x4a6de4,this['_data']=_0x53698a,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x31310e,_0xd7eaf1,_0x2f39ac,_0x450468,_0x29a4f2){super(),this['_sourceCheck']=_0xd7eaf1,this['_documentData']=_0x31310e,this['_aiConnector']=_0x2f39ac,this['_reviewParams']=_0x450468,this['_reviewArgs']=_0x29a4f2,this['on']('change:status',(_0x370426,_0x264dfe,_0x3861e1)=>{'aborted'==_0x3861e1&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x3861e1,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x7571c9=>'pending'===_0x7571c9['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0xa1ca53){this['_documentData']=_0xa1ca53;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x2ec692=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x24d364 of _0x2ec692)'unmodified'!==_0x24d364['data']['operation']&&('error'!==_0x24d364['data']['operation']?'review-metadata'!==_0x24d364['event']?this['_addReviewCheckResult'](_0x24d364['data']['dataId'],_0x24d364['data']['textDelta']):this['callId']=_0x24d364['data']['callId']:this['status']='error-chunk');'error-chunk'!==this['status']&&(0x0===this['_results']['size']||0x0===this['_changes']['length']?this['status']='unmodified':this['status']='ready');}catch(_0x1d88c0){this['_currentError']=_0x1d88c0,_0x1d88c0 instanceof Error&&_0x1d88c0['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x273686,_0x33afbb){const _0x115a2f=this['_results']['get'](_0x273686);if(!_0x115a2f)return;if(0x0===_0x33afbb['length'])return;const _0x54ab50=[];_0x33afbb['forEach']((_0x39d57b,_0x44a344)=>{const _0x504f3d=new AIReviewCheckResultChange(_0x115a2f['id']+'-'+_0x44a344,_0x39d57b,_0x115a2f);_0x504f3d['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x504f3d,'status':_0x504f3d['status']});}),_0x504f3d['on']('change:isActivated',()=>{_0x504f3d['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x504f3d}):this['fire']('reviewCheckResultDeactivated',{'change':_0x504f3d});}),this['_changes']['push'](_0x504f3d),_0x54ab50['push'](_0x504f3d);}),this['fire']('reviewCheckResultReady',{'changes':_0x54ab50,'result':_0x115a2f,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x13fdf9){const _0x5a1d47=this['_changes']['find'](_0x139b84=>_0x139b84['id']===_0x13fdf9);return!(!_0x5a1d47||'pending'!==_0x5a1d47['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x435ed8=>!0x0===_0x435ed8['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x1713fa=>'pending'===_0x1713fa['status']);}['getChangeById'](_0x7d7977){return this['_changes']['find'](_0x29f302=>_0x29f302['id']===_0x7d7977);}['markAllChangesAsAccepted'](){for(const _0x46a5ac of this['_changes'])'pending'===_0x46a5ac['status']&&(_0x46a5ac['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x5f037c){const _0x301aab=this['_changes']['find'](_0x425f2e=>_0x425f2e['id']===_0x5f037c);_0x301aab&&'pending'===_0x301aab['status']&&(_0x301aab['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x53200e){const _0x34d840=this['_changes']['find'](_0x21635a=>_0x21635a['id']===_0x53200e);_0x34d840&&'pending'===_0x34d840['status']&&(_0x34d840['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x2ccebd){const _0x489dda=this['_changes']['find'](_0x4f9772=>_0x4f9772['id']===_0x2ccebd);_0x489dda&&'pending'===_0x489dda['status']&&(_0x489dda['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x43fb88){const _0x4767e6=this['_changes']['find'](_0x3d41bc=>_0x3d41bc['id']===_0x43fb88);_0x4767e6&&'outdated'===_0x4767e6['status']&&(_0x4767e6['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x3b5878){this['_changes']['filter'](_0x20b81e=>_0x20b81e['isActivated']&&_0x20b81e['id']!==_0x3b5878)['forEach'](_0x4b8000=>{_0x4b8000['isActivated']=!0x1;});const _0x8aee73=this['_changes']['find'](_0x3c2273=>_0x3c2273['id']===_0x3b5878);_0x8aee73&&'pending'===_0x8aee73['status']&&(_0x8aee73['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x5a10cb=>_0x5a10cb['isActivated'])['forEach'](_0x5ccf22=>{_0x5ccf22['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x13ecc3){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3f1b7f;if(_0x13ecc3){const _0x2fd931=this['_changes']['find'](_0x4f750f=>_0x4f750f['id']===_0x13ecc3);if(_0x2fd931&&_0x2fd931['isRated'])return;_0x2fd931&&(_0x3f1b7f=_0x2fd931['parent']['id'],_0x2fd931['isRated']=!0x0);}const _0x6e64c8={'positiveCount':this['_changes']['filter'](_0x3da0d2=>'accepted'===_0x3da0d2['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x6e64c8,this['callId'],_0x3f1b7f);}['_addReviewCheckResult'](_0xbe92f7,_0x5e33f1){const _0x23536b=this['_documentData']['elements']['get'](_0xbe92f7);if(!_0x23536b)return;const _0x3b1fd1=_0x23536b['getContent']();if(_0x3b1fd1===_0x5e33f1)return;const _0x5c84de=new AIReviewCheckResult({'id':_0xbe92f7,'contentInitial':_0x3b1fd1,'contentNew':_0x5e33f1,'documentVersion':_0x23536b['documentVersion']});this['_results']['set'](_0x5c84de['id'],_0x5c84de),this['fire']('reviewCheckResultAdded',{'result':_0x5c84de,'source':this,'editor':_0x23536b['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x30c0d3=>'pending'===_0x30c0d3['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x9a2c01=>'pending'===_0x9a2c01['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2e4e5c=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0xbcbc86=0x0;_0xbcbc86<this['_reviewParams']['length'];_0xbcbc86++){if(!this['_reviewParams'][_0xbcbc86]||!this['_sourceCheck']['options'][_0xbcbc86])continue;const _0x4885e7=this['_sourceCheck']['options'][_0xbcbc86],_0x5b95c4=_0x4885e7['data']?.['find'](_0x340c3c=>_0x340c3c['id']===this['_reviewParams'][_0xbcbc86]);_0x5b95c4&&_0x2e4e5c['push'](_0x5b95c4['label']);}return _0x2e4e5c['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x3db449,_0xcc941d,_0x461842){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0xcc941d,_0x3db449,_0x461842);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x179c1c{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async['_initAvailableReviewChecks'](){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}['_initUIListeners'](){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x1a6a4b,_0x4fe0a4)=>this['runCheck'](_0x4fe0a4)),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>this['abort']()),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x280266=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x280266['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x280266['map'](_0x5b06d4=>_0x5b06d4['id']));const _0x1a1ce4=this['_currentReviewCheckRun'];_0x1a1ce4['markAllChangesAsAccepted'](),_0x1a1ce4['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x1d3568,_0x5cfade)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5cfade['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x5cfade['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x5cfade['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5cfade['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x20f4b6,_0x22ca9d)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x22ca9d['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x22ca9d['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x22ca9d['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x22ca9d['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x1596e6,_0x17899c)=>{this['_onActivateChange'](_0x17899c);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0xf1f9cb,_0x5c69ed)=>{this['_onDeactivateChange'](_0x5c69ed);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x37ec03,_0x19aa83)=>{this['_onChangeMarkerClicked'](_0x37ec03,_0x19aa83);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x5edfa7,_0x43de27)=>{this['_onChangeMarkerHovered'](_0x5edfa7,_0x43de27);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x1a25b3,_0x1e06e9)=>{this['_onChangeMarkerRemoved'](_0x1a25b3,_0x1e06e9);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x1f0171,_0x278f36)=>{this['_onChangeMarkerRestored'](_0x1f0171,_0x278f36);});}async['runCheck'](_0x2db254){if(!this['_availableReviewChecks'])return;const _0x1c49c0=this['_availableReviewChecks']['find'](_0x1453dd=>_0x1453dd['id']===_0x2db254['id']);if(_0x1c49c0){this['_onReviewCheckRun'](_0x2db254),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x2db254,_0x1c49c0),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x4509a0,_0x495a47)=>{switch(_0x495a47['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x495a47);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x495a47['status']&&'error-chunk'!==_0x495a47['status']&&'error-general'!==_0x495a47['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x1d1789,_0x4d5a18)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x236236=this['_diffContent'](_0x4d5a18['editor'],_0x4d5a18['result']['contentInitial'],_0x4d5a18['result']['contentNew']);_0x4d5a18['source']['addResultChanges'](_0x4d5a18['result']['id'],_0x236236);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x5aec59,_0x3398f2)=>{for(const _0x5dd658 of _0x3398f2['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x5dd658);this['_markChangePositionInEditorContent'](_0x3398f2['changes'],_0x3398f2['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x232e0e,_0x1ba5d7)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x1ba5d7['change']['id'],_0x1ba5d7['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x2a4e1d,_0x442459)=>{this['_onReviewCheckResultActivated'](_0x442459);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x104a24){_0x104a24 instanceof Error&&_0x104a24['message']['includes']('ai-request-aborted')||(_0x104a24 instanceof ht?this['_logError'](_0x104a24):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x104a24)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x2db254['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x52a936,_0x597f4c){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x597f4c,this['_aiConnector'],_0x52a936['params'],_0x52a936['args']);}['_onChangeMarkerRemoved'](_0x5be85a,_0x395f6a){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x395f6a['changeId']);}['_onChangeMarkerRestored'](_0x17a8c7,_0x381c07){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x381c07['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x50cb8b=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x50cb8b&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1f26eb of this['_aiReviewCoreEditing']['getEditors']())_0x1f26eb['editing']['view']['change'](_0x3a95ab=>{for(const _0x5e6375 of _0x1f26eb['editing']['view']['document']['getRoots']())_0x3a95ab['removeClass']('ck-ai_review-diff',_0x5e6375),_0x3a95ab['removeClass']('ck-ai_review-highlights',_0x5e6375),_0x3a95ab['removeClass']('ck-ai-translate-mode-content',_0x5e6375);});}['_logError'](_0x35e538,_0x5ff0f5=!0x1){Ct(_0x35e538['message']),_0x5ff0f5||(_0x35e538['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x3b9d67){if('content'===this['_changeActivationSource']){const _0x187cc9=this['_aiReviewCoreUi']['getChangeElement'](_0x3b9d67);_0x187cc9&&Rt(_0x187cc9['closest']('.ck-ai_review__check-run-result')||_0x187cc9);}else{if('panel'===this['_changeActivationSource']){const _0x9b0fd6=this['_getChangeContentElement'](_0x3b9d67);if(!_0x9b0fd6)return;Tt({'target':_0x9b0fd6,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x5f4aea,_0x34a2b7,_0x5cf65f,_0x279e37,_0x23fd50){super(_0x5cf65f,_0x279e37,_0x23fd50),this['_prompt']=_0x5f4aea,this['_model']=_0x34a2b7;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5a37ff,_0x2fa505,_0x11794b){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x2fa505,_0x5a37ff,_0x11794b);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x1958e0){this['id']=_0x1958e0['id'],this['commandId']=_0x1958e0['commandId'],this['title']=_0x1958e0['title'],this['description']=_0x1958e0['description'],this['isParameterized']=_0x1958e0['isParameterized'],this['useArgs']=_0x1958e0['useArgs'],this['options']=_0x1958e0['options'],this['args']=_0x1958e0['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x150f50,_0x213646,_0x1d844c){super(_0x150f50),this['prompt']=_0x150f50['prompt'],this['model']=_0x150f50['model'],this['model']?this['_defaultModel']=_0x213646['find'](_0x19bf21=>_0x19bf21['id']===this['model'])||null:this['_defaultModel']=_0x1d844c;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x5ccab5){this['_prompt']=_0x5ccab5;}set['model'](_0x5a597e){this['_model']=_0x5a597e;}}class AIReviewCoreCheckRegistry extends _0x179c1c{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const sr=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x3c2e2a){this['_checks']=_0x3c2e2a['map'](_0xdb3ff6=>new AIReviewCheck(_0xdb3ff6));}get['checks'](){return this['_checks'];}['getCheckById'](_0x480464){return this['checks']['find'](_0x52b85f=>_0x52b85f['id']===_0x480464);}['removeCheckById'](_0x1056ab){this['_checks']=this['_checks']['filter'](_0x67ef13=>_0x67ef13['id']!==_0x1056ab);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x537642,_0x28fc29,_0x4a801e){super(_0x537642),this['_models']=_0x28fc29,this['_defaultModel']=_0x4a801e;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x932396,_0x6703db,_0x48cc6e){super(),this['_allModels']=_0x932396,this['_recommendedModels']=_0x6703db,this['_defaultModel']=_0x48cc6e;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x44100d){this['_checks']=_0x44100d['map'](_0x423ee4=>!0x0===_0x423ee4['isExtra']?new AIReviewCheckExtra(_0x423ee4,this['_allModels'],this['_defaultModel']):'custom'===_0x423ee4['id']?new AIReviewCheckCustom(_0x423ee4,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x423ee4));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x2263dc){super(_0x2263dc),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x9878dd=>({'id':_0x9878dd['id'],'commandId':_0x9878dd['id'],'title':_0x9878dd['label'],'description':_0x9878dd['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x9878dd['prompt'],'model':_0x9878dd['model']}));}async['_loadChecksList'](){const _0x2731ae=[...sr,...this['getExtraChecks']()]['map'](_0x1bbb07=>_0x1bbb07['isExtra']?_0x1bbb07:this['_translateReviewCheck'](_0x1bbb07)),_0x2e944c=await this['_getModels'](),_0x10d77e=new AIReviewModeCheckList(_0x2e944c['all'],_0x2e944c['recommended'],_0x2e944c['default']);return _0x10d77e['setupChecks'](_0x2731ae),_0x10d77e;}async['_getModels'](){const _0x91f67f=this['context']['plugins']['get']('AIConnector');try{const _0x424856=new AIModels({'connector':_0x91f67f,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0xeed2bd={'all':await _0x424856['getAll'](),'recommended':await _0x424856['getAvailableModels'](),'default':await _0x424856['getDefault']()};return this['_modelsLoadError']=null,_0xeed2bd;}catch(_0x585ef9){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x585ef9),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x276300){const _0x1f8fc0='AI_REVIEW_CHECK_'+_0x276300['id']['toUpperCase']()['replaceAll']('-','_'),_0x13ea62={..._0x276300,'title':this['_translate'](_0x1f8fc0+'_TITLE',_0x276300['title']),'description':this['_translate'](_0x1f8fc0+'_DESCRIPTION',_0x276300['description'])};return _0x276300['options']&&(_0x13ea62['options']=_0x276300['options']['map'](_0x50d963=>({..._0x50d963,'label':this['_translate'](_0x1f8fc0+'_OPTIONS_LABEL',_0x50d963['label']||''),'data':_0x50d963['data']?_0x50d963['data']['map'](_0x1412c8=>({..._0x1412c8,'label':this['_translate'](_0x1f8fc0+'_OPTIONS_DATA_'+_0x1412c8['id']['toUpperCase'](),_0x1412c8['label'])})):void 0x0}))),_0x13ea62;}['_translate'](_0x34a83e,_0x97699){const _0x13f52a=Mi(this['context']['locale'],_0x34a83e);return _0x13f52a===_0x34a83e?_0x97699:_0x13f52a;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x965a86){super(_0x965a86),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',sr['map'](_0x34f432=>_0x34f432['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x2faa05,_0x1c1e05)=>{this['_isDiffOn']=_0x1c1e05['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x2d77c2,_0x9f963c){if(_0x2d77c2['isCustom'])return new AIReviewCustomCheckRun(_0x2d77c2['args']['prompt'],_0x2d77c2['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x9f963c,this['_aiConnector']);if(_0x9f963c['isExtra']){const _0x74a07b=_0x9f963c;return new AIReviewExtraCheckRun(_0x2d77c2['args']?.['prompt']??_0x74a07b['prompt'],_0x2d77c2['args']?.['model']??_0x74a07b['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x9f963c,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x9f963c,this['_aiConnector'],_0x2d77c2['params'],_0x2d77c2['args']);}['_onReviewCheckResultActivated'](_0x3fd075){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x3fd075['change']['id']),this['_scrollToChange'](_0x3fd075['change']['id']);const _0xf14ab1=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3fd075['change']['id']);if(!_0xf14ab1)return;const _0x3b4516=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3fd075['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3fd075['change'],()=>_0xf14ab1['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3b4516,_0xf14ab1['modelRange']['root']['rootName']),_0x3b4516?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x3fd075['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x4e5aa4){this['_currentReviewCheckRun']&&'click'===_0x4e5aa4['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4e5aa4['id']));}['_onDeactivateChange'](_0x4d71a7){this['_currentReviewCheckRun']&&'balloon'===_0x4d71a7['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x8616f7,_0x5dd759){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5dd759['changeId']);const _0x5f5844=this['_currentReviewCheckRun']['getChangeById'](_0x5dd759['changeId']);if(!_0x5f5844)return;const _0x2728f8=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5dd759['changeId']),_0x158bf6=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5dd759['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5f5844,_0x5dd759['markerElement'],_0x5dd759['domEvent'],'click',this['_getBalloonDomRoot'](_0x158bf6,_0x2728f8?.['modelRange']['root']['rootName']),_0x158bf6?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x119939,_0xd11dd){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x57220a=this['_currentReviewCheckRun']['getChangeById'](_0xd11dd['changeId']);if(!_0x57220a)return;const _0x4156a8=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xd11dd['changeId']),_0x15f4e5=this['_aiReviewCoreEditing']['getEditorForChange'](_0xd11dd['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x57220a,_0xd11dd['markerElement'],_0xd11dd['domEvent'],'hover',this['_getBalloonDomRoot'](_0x15f4e5,_0x4156a8?.['modelRange']['root']['rootName']),_0x15f4e5?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x52ad40){const _0x241070=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x52ad40);return _0x241070?_0x241070['getElement']():null;}['_markChangePositionInEditorContent'](_0x417db1,_0x2b6650){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x417db1,_0x2b6650);}['_diffContent'](_0x18f826,_0x37fd3e,_0x516121){return this['_aiReviewCoreEditing']['diffContent'](_0x18f826,_0x37fd3e,_0x516121,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2c0636){_0x2c0636?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x5600e8 of this['_aiReviewCoreEditing']['getEditors']())_0x5600e8['editing']['view']['change'](_0x1d1993=>{for(const _0x3e5972 of _0x5600e8['editing']['view']['document']['getRoots']()){for(const _0x3087d8 of _0x3e5972['getClassNames']())_0x3087d8['startsWith']('ck-ai_review-')&&_0x1d1993['removeClass'](_0x3087d8,_0x3e5972);_0x1d1993['addClass'](_0x2c0636?'ck-ai_review-diff':'ck-ai_review-highlights',_0x3e5972);}});}['_getBalloonDomRoot'](_0x3cdbab,_0x8928ba){const _0x18d6cd=_0x3cdbab['editing']['view'];if(_0x8928ba){const _0x57cb0f=_0x18d6cd['getDomRoot'](_0x8928ba);if(_0x57cb0f)return _0x57cb0f;}return _0x18d6cd['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x4f1aa7=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x3ace62=await _0x4f1aa7['getChecksList']();_0x4f1aa7['modelsLoadError']&&this['_logError'](_0x4f1aa7['modelsLoadError']);let _0x234214=_0x3ace62['checks'];const _0x26c5b9=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x26c5b9,_0x234214),this['_usesAvailableCommandsConfig']&&(_0x234214=_0x26c5b9['map'](_0x121ee5=>_0x234214['find'](_0x3c1203=>_0x3c1203['id']===_0x121ee5))['filter'](_0x2b1966=>!!_0x2b1966)),this['_filterChecksWithMissingModel'](_0x234214);}['_logWarningForNonExistentChecks'](_0x33fe4e,_0x296dac){const _0x132ec8=_0x33fe4e['filter'](_0x12d7ee=>!_0x296dac['some'](_0x7ac20c=>_0x7ac20c['id']===_0x12d7ee));if(_0x132ec8['length']){const _0x1c7339=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x132ec8['join'](',\x20')});wt(_0x1c7339['message']);}}['_filterChecksWithMissingModel'](_0x39d6a9){const _0xe12830=[];return _0x39d6a9['forEach'](_0x3771a0=>{(_0x3771a0 instanceof AIReviewCheckExtra&&!_0x3771a0['defaultModel']||_0x3771a0 instanceof AIReviewCheckCustom&&!_0x3771a0['models']['length'])&&_0xe12830['push'](_0x3771a0['id']);}),_0xe12830['length']&&_0xe12830['forEach'](_0x349b91=>{_0x39d6a9=_0x39d6a9['filter'](_0x325378=>_0x325378['id']!==_0x349b91);const _0x175961=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x349b91});Ct(_0x175961['message']);}),_0x39d6a9;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x4d5757){this['_editor']=_0x4d5757['editor'],this['_rootName']=_0x4d5757['rootName'],this['_channelId']=_0x4d5757['channelId'],this['_sessionId']=_0x4d5757['sessionId'];}get['status'](){return this['_error']?'error':this['_isAborted']?'aborted':void 0x0!==this['_contentRawNew']?'completed':'initialized';}get['editor'](){return this['_editor'];}get['rootName'](){return this['_rootName'];}get['channelId'](){return this['_channelId'];}get['sessionId'](){return this['_sessionId'];}get['documentVersion'](){return this['_documentVersion'];}set['documentVersion'](_0x2946b7){this['_documentVersion']=_0x2946b7;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1d99ca){this['_contentRawOld']=_0x1d99ca;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x463149){this['_contentRawNew']=_0x463149;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x402a04){this['_error']=_0x402a04;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x3ff3c7){return _0x3ff3c7['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x5312e8){this['_affectedBlocks']=_0x5312e8;}}class AIGateway extends _0x179c1c{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x466402,_0x50f208){if('completed'!==_0x466402['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x466402['status']});const _0x2ea9bb=_0x466402['editor'];if('suggest'===_0x50f208&&!_0x2ea9bb['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x2af397='suggest'===_0x50f208,_0x56fb07=this['context']['plugins']['get'](_0x5e3d64),_0x90f13=_0x2ea9bb['model']['createPositionAt'](_0x2ea9bb['model']['document']['getRoot'](),0x0),_0x2f5d60=_0x56fb07['getDiff'](_0x466402['contentRawOld'],_0x466402['contentRawNew'],{'anchor':_0x90f13,'markDeletions':_0x2af397,'targetEditor':_0x2ea9bb}),_0x1d0b98=_0x2ea9bb['model']['document']['history']['getOperations'](_0x466402['documentVersion']),_0x4e2ae1={'document':_0x2ea9bb['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4c4235=_0x4fc222(_0x2f5d60['getOperations'](),_0x1d0b98,_0x4e2ae1)['operationsA'];_0x2ea9bb['model']['change'](_0x1b1270=>{if(_0x2af397)_0x2ea9bb['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4c4235);else{for(const _0x461991 of _0x4c4235)_0x461991['baseVersion']=_0x2ea9bb['model']['document']['version'],Ts(_0x2ea9bb,_0x461991),_0x1b1270['batch']['addOperation'](_0x461991),_0x2ea9bb['model']['applyOperation'](_0x461991);}});}['mergeChangesIntoContent'](_0x323246,_0x4d506b,_0xdf507a){const _0x39d510=new AIResponseParser(),_0x54d7c9=new AIResponseApplier();let _0x38f6cb=_0x39d510['parseAndNormalizeHTML'](_0x4d506b);for(const _0xcdb75f of _0x323246)try{const _0x5412d0=_0x39d510['parseAndNormalizeHTML'](_0xcdb75f['content']);_0x38f6cb=_0x54d7c9['merge'](_0x5412d0,_0x38f6cb,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x508d7a){throw new ht('ai-gateway-merge-failed',this,{..._0xcdb75f},_0x508d7a);}return as(_0xdf507a,_0x39d510['parseAndNormalizeHTML'](_0x4d506b),_0x38f6cb,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x179c1c{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0x340472=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x340472['getChecksList']())['checks']['map'](_0x29be66=>{const _0x49a918={'id':_0x29be66['id'],'title':_0x29be66['title'],'description':_0x29be66['description']};return'custom'!==_0x29be66['id']&&_0x29be66['options']?.['length']&&(_0x49a918['parameters']=_0x29be66['options'][0x0]['data']['map'](_0x802f0e=>({..._0x802f0e}))),_0x49a918;});}async['getAvailableModels'](){const _0x17aefb=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x17aefb,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x412653,_0x5de427){return await this['_runReviewCheck'](_0x412653,()=>this['_createReviewCheckRun'](_0x412653,_0x5de427?.['parameterId']),_0x5de427?.['signal']);}async['runCustomReview'](_0x44a7d6,_0x353850){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x44a7d6,_0x353850?.['model']),_0x353850?.['signal']);}['applyReview'](_0x7e9946,_0x189071){this['context']['plugins']['get']('AIGateway')['apply'](_0x7e9946,_0x189071);}async['_runReviewCheck'](_0x5b3e13,_0x61e462,_0x17a9f6){const _0x267dab=ps(this['context']),_0x325ceb=new AIReviewRunResult({'editor':_0x267dab,'rootName':_0x267dab['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x267dab['plugins']['get']('AIEditing')['getSessionId'](_0x267dab)});let _0x218296,_0xf968d7;if(_0x17a9f6){if(_0x17a9f6['aborted'])return _0x325ceb['abort'](),_0x325ceb;const _0x571c70=()=>{_0x325ceb['error']||(_0x325ceb['abort'](),_0x218296&&_0x218296['abort']());};_0x17a9f6['addEventListener']('abort',_0x571c70),_0xf968d7=()=>_0x17a9f6['removeEventListener']('abort',_0x571c70);}try{_0x218296=await _0x61e462(),_0x325ceb['contentRawOld']=_0x218296['documentData']['content'],_0x325ceb['documentVersion']=Array['from'](_0x218296['documentData']['elements'])['find'](([,_0x3849fe])=>_0x3849fe['rootName']===_0x325ceb['rootName'])?.[0x1]['documentVersion']??0x1,_0x218296['on']('reviewCheckRunUpdated',(_0x311c93,_0x3af020)=>{'aborted'===_0x3af020['status']?_0x325ceb['abort']():'error-general'!==_0x3af020['status']&&'error-chunk'!==_0x3af020['status']||(_0x325ceb['error']=this['_normalizeError'](_0x3af020['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x5b3e13}));}),'aborted'!==_0x325ceb['status']&&await _0x218296['start']();}catch(_0x135dc6){_0x325ceb['error']=this['_normalizeError'](_0x135dc6,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x5b3e13});}finally{_0xf968d7&&_0xf968d7();}if(!_0x218296||'aborted'===_0x325ceb['status']||'error'===_0x325ceb['status'])return _0x325ceb;_0x325ceb['affectedBlocks']=_0x218296['results']['map'](_0x472608=>({'id':_0x472608['id'],'content':_0x472608['contentNew']}));try{_0x325ceb['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x325ceb['affectedBlocks'],_0x325ceb['contentRawOld'],_0x325ceb['editor']));}catch(_0x4b9452){_0x325ceb['error']=this['_normalizeError'](_0x4b9452,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x5b3e13});}return _0x325ceb;}async['_createReviewCheckRun'](_0x15a751,_0x1dd34a){const _0x2c6da0=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x31e461=>_0x31e461['id']===_0x15a751);if(!_0x2c6da0)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x15a751});if(_0x2c6da0 instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x15a751});const _0x3e36a6=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x56852a=this['context']['plugins']['get']('AIConnector');if(_0x2c6da0 instanceof AIReviewCheckExtra){if(!_0x2c6da0['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x15a751});return new AIReviewExtraCheckRun(_0x2c6da0['prompt'],_0x2c6da0['defaultModel']['id'],_0x3e36a6,_0x2c6da0,_0x56852a);}return new AIReviewSystemCheckRun(_0x3e36a6,_0x2c6da0,_0x56852a,_0x1dd34a?[_0x1dd34a]:void 0x0);}async['_createCustomReviewCheckRun'](_0xa0d4c1,_0x2dd7bb,_0x19a776){const _0x64a685=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x43c097=>_0x43c097['id']===_0xa0d4c1);if(!_0x64a685)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0xa0d4c1});if(!(_0x64a685 instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0xa0d4c1});const _0x4bef66=_0x19a776??_0x64a685['defaultModel']?.['id'];if(!_0x2dd7bb)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0xa0d4c1});if(!_0x4bef66)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0xa0d4c1});return new AIReviewCustomCheckRun(_0x2dd7bb,_0x4bef66,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x64a685,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x53bc87,_0x3d5cd0,_0x42fc99){let _0x49ff27=_0x53bc87;return _0x53bc87 instanceof ht||(_0x49ff27=new ht(_0x3d5cd0,this,_0x42fc99,_0x53bc87)),_0x49ff27;}}class AIReviewMode extends _0x179c1c{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x3003fc,_0x5f4ec1){if(this['assertStartReviewPreconditions'](_0x3003fc)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x3003fc});const _0x1a6546=this['context']['plugins']['get']('AIReviewModeController');await _0x1a6546['runCheck']({'id':_0x3003fc,'params':_0x5f4ec1?.['parameterId']?[_0x5f4ec1['parameterId']]:void 0x0});}async['startCustomReview'](_0x2d8a76,_0x153aa9){if(!_0x2d8a76)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x1174fb=sr['find'](_0x39fc12=>'custom'===_0x39fc12['commandId'])['id'],_0x4fa988=this['assertStartReviewPreconditions'](_0x1174fb),_0x48154f=_0x153aa9?.['model']??_0x4fa988['defaultModel']?.['id'];if(!_0x48154f)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x4948aa=this['context']['plugins']['get']('AIReviewModeController');await _0x4948aa['runCheck']({'id':_0x1174fb,'isCustom':!0x0,'args':{'prompt':_0x2d8a76,'model':_0x48154f}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x4e1685=>{const _0x4e6361={'id':_0x4e1685['id'],'title':_0x4e1685['title'],'description':_0x4e1685['description']};return'custom'!==_0x4e1685['id']&&_0x4e1685['options']?.['length']&&(_0x4e6361['parameters']=_0x4e1685['options'][0x0]['data']['map'](_0x3ad0b9=>({..._0x3ad0b9}))),_0x4e6361;});}['assertStartReviewPreconditions'](_0x4f4dfc){const _0x15573d=this['context']['plugins']['get']('AIReviewModeController');if(_0x15573d['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x1e8ad6=_0x15573d['getAvailableChecks']()['find'](_0x49f663=>_0x49f663['id']===_0x4f4dfc);if(!_0x1e8ad6)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x4f4dfc});const _0x5e6378=this['context']['plugins']['get']('AITabs')['view'];return _0x5e6378['isVisible']=!0x0,_0x5e6378['activateTab']('reviewMode'),_0x1e8ad6;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x155992,_0x58a1ff,_0x3a05e4,_0x3d3ede,_0x4d3bd0,_0x3f70c3){super(_0x155992,_0x58a1ff,_0x3a05e4,_0x4d3bd0,_0x3f70c3),this['_title']=_0x3d3ede;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x22a005){this['_checks']=_0x22a005['map'](_0xb7c5ad=>new AITranslateCheck(_0xb7c5ad));}}const nr=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x1c2924){super(_0x1c2924),this['context']['config']['define']('ai.translate.languages',nr);}async['_loadChecksList'](){const _0x2e84c2=[],_0x587ecd=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x357b3b of _0x587ecd)_0x2e84c2['push']({'title':_0x357b3b['label'],'id':_0x357b3b['id'],'commandId':_0x357b3b['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x357b3b['id']}});const _0xdad24e=new AITranslateCheckList();return _0xdad24e['setupChecks'](this['_translateChecks'](_0x2e84c2)),_0xdad24e;}['_translateChecks'](_0x15f727){const _0x2a169f=this['context']['locale'];return _0x15f727['map'](_0x13480d=>{const _0x1524c1='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x13480d['title']['toUpperCase']()['replaceAll']('-','_'),_0x3ecbec=Mi(_0x2a169f,_0x1524c1);return{..._0x13480d,'title':_0x3ecbec===_0x1524c1?_0x13480d['title']:_0x3ecbec};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x2f1dca,_0x36f33d){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x36f33d,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x2f1dca['params'],_0x2f1dca['args']);}['_onReviewCheckResultActivated'](_0x5eb619){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5eb619['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5eb619['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x4e1656){this['_currentReviewCheckRun']&&('hover'===_0x4e1656['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4e1656['id'])),'click'===_0x4e1656['uiInteraction']&&this['_scrollToChange'](_0x4e1656['id']));}['_onDeactivateChange'](_0x1b2c78){this['_currentReviewCheckRun']&&'panel'===_0x1b2c78['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x36745a,_0x5536e3){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5536e3['changeId']),this['_scrollToChange'](_0x5536e3['changeId']));}['_onChangeMarkerHovered'](_0x519de0,_0x2ee957){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2ee957['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x2ee957['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x34be78){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x34be78);}['_markChangePositionInEditorContent'](_0xec83e0,_0x475622){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0xec83e0,_0x475622);}['_diffContent'](_0x3abb3c,_0x4dcbfd,_0x163587){return this['_aiReviewCoreEditing']['diffContent'](_0x3abb3c,_0x4dcbfd,_0x163587,!0x0);}['_onReviewCheckRun'](){for(const _0x5783c9 of this['_aiReviewCoreEditing']['getEditors']())_0x5783c9['editing']['view']['change'](_0x2e65e4=>{for(const _0x2ad1e1 of _0x5783c9['editing']['view']['document']['getRoots']())_0x2e65e4['addClass']('ck-ai-translate-mode-content',_0x2ad1e1);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x95c985,_0x48cf07){super(_0x95c985,_0x48cf07),this['on']('set:isLoading',(_0x2ddc59,_0x554d71,_0x518d6f)=>{_0x518d6f&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x4adda3,_0x49581d,_0x2b787f)=>{_0x2b787f&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x19ecdc=super['_createAcceptAllButtonView']();return _0x19ecdc['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x19ecdc;}['_createExitReviewButtonView'](){const _0x410fbf=super['_createExitReviewButtonView']();return _0x410fbf['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x410fbf;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x222172=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x222172['if']('isVisible','ck-hidden',_0x464996=>!_0x464996)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x222172['if']('isVisible','ck-hidden',_0x110afd=>!_0x110afd)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x4773ff=this['context']['plugins']['get']('AITabs'),_0x395de7=this['context']['locale'],_0x14cc05=new AIHeaderView(_0x395de7,{'label':Mi(_0x395de7,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x355ab3,'class':'ck-ai-header_review-translate','showResizeButton':_0x4773ff['showResizeButton']});_0x14cc05['delegate']('resizeTabs')['to'](_0x4773ff),_0x14cc05['bind']('isMaximized')['to'](_0x4773ff['view'],'isMaximized',_0x1e69cc=>_0x1e69cc);const _0x378dc0=new AIReviewCoreView(_0x395de7,{'header':_0x14cc05,'list':new AITranslateCheckListView(_0x395de7),'results':new AITranslateCheckResultsView(_0x395de7,{'generalErrorText':Mi(_0x395de7,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x395de7,{'headerText':Mi(_0x395de7,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0x395de7,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x395de7,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x378dc0['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x378dc0;}['registerTab'](){const _0x10d478=this['context']['plugins']['get']('AITabs');_0x10d478['view']['on']('activateTab',(_0x5cedda,{newTab:_0x175e84,oldTab:_0x56e7c4})=>{'translate'===_0x175e84?this['fire']('getReviewCheckList'):'translate'===_0x56e7c4&&this['fire']('leaveReview');}),_0x10d478['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x355ab3,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x179c1c{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};
|
|
23
|
+
import{Plugin as _0x41a2d8,Command as _0xd5099f,ContextPlugin as _0x2e5d09,Editor as _0x435807}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x51f25e,IconCheck as _0x36337b,IconError as _0x309aa6,IconSubmit as _0x1bfbe9,IconAIHistory as _0x105978,IconMagicWand as _0x3116a8,IconRobotPencil as _0x4eea09,IconMaximize as _0x124a0f,IconMinimize as _0x4dd5d2,IconShowChangesOn as _0x9a19f,IconShowChangesOff as _0x54b721,IconDocument as _0xdbabf8,IconBoxWithCross as _0x2ba020,IconBoxWithCheck as _0x4fb4f5,IconBoxWithMarker as _0x452d46,IconInfo as _0x2a9ed6,IconWeb as _0x5da227,IconCancel as _0x395853,IconSelection as _0x474b74,IconFileUpload as _0x15039b,IconLink as _0x35b63e,IconImage as _0xb6dd68,IconBulb as _0x295154,IconAI as _0x2bcdb8,IconPreviousArrow as _0x361218,IconDocumentOutline as _0x238dc8,IconLoupe as _0x6c2312,IconPaperClip as _0x14b7d9,IconBrowseFiles as _0x258b14,IconDropdownArrow as _0x248521,IconStop as _0x5b2e11,IconPlus as _0x39b836,IconAIChat as _0x5ef127,IconPin as _0xe1d023,IconThreeHorizontalDots as _0x45860d,IconAIReview as _0x268514,IconAITranslate as _0x260bc9,IconAIAskAI as _0xc998,IconThumbUp as _0x27d385,IconThumbDown as _0x1b1546,IconChevronDown as _0x7a6e23,IconChevronUp as _0xbe2f13,IconAIQuickActions as _0xbc7ee5,IconAIChatCommands as _0x4fd1c,IconAIImproveWriting as _0x247953,IconAIContinueWriting as _0x15599a,IconAIGrammarCheck as _0x373739,IconAIAdjustLength as _0x54f0eb,IconAIChangeTone as _0xa1345e,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x1d7af5,createLabeledInputText as _0x246673,FormHeaderView as _0x351f99,HighlightedTextView as _0xb413a6,ViewCollection as _0x3207b0,FileDialogButtonView as _0x8276b5,InputTextView as _0x28c3c2,SearchTextView as _0x5ebf54,ListItemButtonView as _0x3c53e5,ButtonLabelWithHighlightView as _0x448772,DropdownMenuPanelPositioningFunctions as _0x53f294,BalloonToolbar as _0x5e70f8,FormRowView as _0x1b3812,TextareaView as _0x4915e1}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x12e122,ClipboardMarkersUtils as _0x494f7c}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x9ad6d7,ViewDataTransfer as _0x50ceb7,ViewUpcastWriter as _0x3a6e19,Matcher as _0x4f9af0,_DetachOperation as _0x2b0abe,_insertIntoModelNodeList as _0x32fede,_removeFromModelNodeList as _0x55a7d0,ModelRange as _0x805f9a,transformOperationSets as _0x5d10bd,ViewDowncastWriter as _0x4fdba0,ModelDocumentFragment as _0x38ddee,ModelPosition as _0x47e467,ModelTreeWalker as _0x5c0e47,MarkerOperation as _0x394603,InsertOperation as _0x51ba4d}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x22ed42,escape as _0x5d498f,cloneDeep as _0x2ea6b1,throttle as _0x3efce3,debounce as _0x5b0594,escapeRegExp as _0x3e499a}from'es-toolkit/compat';import{createParser as _0xa89478}from'eventsource-parser';import{CloudServices as _0x8b5fd0}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x4cee02}from'htmlparser2';import{isTag as _0x2ff01e,findOne as _0x2605ec,getParent as _0x2c617a,findAll as _0x17cdaf,removeElement as _0x1aae33,prepend as _0x151fab,prependChild as _0x2f7a9f,appendChild as _0x25c79c,append as _0x433357,find as _0x31e40c,isComment as _0x2fa3ae,replaceElement as _0x7545e8,getChildren as _0x30df0e,textContent as ti}from'domutils';import _0x5d6d16 from'dom-serializer';import{isText as _0x29bd03,cloneNode as _0x3777a6,Document as _0x49fb06,Element as _0x2f80a7,Text as _0x2c0b48,isDocument as _0x1ace06,NodeWithChildren as _0x4e770c}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x193091,MarkdownGfmMdToHtml as _0x2f547a}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x360d32 from'rehype-sanitize';import{fixElementSuggestionRange as _0x2d59b2,DocumentCompare as _0x1289fc,DATA_ID_MODEL_ATTRIBUTE as _0x9b10fa,ConfirmMixin as _0x452051,getAllMarkersDomElementsSorted as _0x2bcd44,SuggestionsConversion as _0x34d276,DATA_ID_VIEW_ATTRIBUTE as _0x412f54,getMarkerDomElement as _0x11ef4d}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x5e167d from'morphdom';import{diffArrays as _0x4079c9}from'diff';const Ti='_ungrouppedCommands';function fi(_0x4ac7ec,_0x3b3a96){const _0x5cec27=(0x0,_0x3b3a96['t'])('Other');return _0x4ac7ec['length']?'groupId'in _0x4ac7ec[0x0]?_0x4ac7ec:[{'groupId':Ti,'groupLabel':_0x5cec27,'order':0x1/0x0,'commands':_0x4ac7ec}]:[{'groupId':Ti,'groupLabel':_0x5cec27,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x41a2d8{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x96ae74}=this,_0x5dda5b=['ck-fake-ai-selection'];_0x96ae74['config']['get']('ai.assistant.useTheme')&&_0x5dda5b['push']('ck-ai-assistant-ui_theme'),_0x96ae74['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x5dda5b,'priority':0xc}}),_0x96ae74['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x1d72cb,{writer:_0x3b1ed7})=>{if(!_0x1d72cb['markerRange']['isCollapsed'])return null;const _0xf4ba7c=_0x3b1ed7['createUIElement']('span');return _0x3b1ed7['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0xf4ba7c),_0xf4ba7c;}});}['afterInit'](){!async function(_0x453cbb){const _0x363480=_0x44e77c([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]),_0x129003=0x3dffc4e1,_0x54399f=0x3df84f31^_0x129003,_0x117a13=window[_0x44e77c([0x44,0x61,0x74,0x65])][_0x44e77c([0x6e,0x6f,0x77])](),_0x17a7ed=_0x453cbb[_0x44e77c([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x294f64=new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x5370d9=>{_0x17a7ed[_0x44e77c([0x6f,0x6e,0x63,0x65])](_0x44e77c([0x72,0x65,0x61,0x64,0x79]),_0x5370d9);}),_0x310758={[_0x44e77c([0x6b,0x74,0x79])]:_0x44e77c([0x45,0x43]),[_0x44e77c([0x75,0x73,0x65])]:_0x44e77c([0x73,0x69,0x67]),[_0x44e77c([0x63,0x72,0x76])]:_0x44e77c([0x50,0x2d,0x32,0x35,0x36]),[_0x44e77c([0x78])]:_0x44e77c([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]),[_0x44e77c([0x79])]:_0x44e77c([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]),[_0x44e77c([0x61,0x6c,0x67])]:_0x44e77c([0x45,0x53,0x32,0x35,0x36])},_0x2e6c2f=_0x17a7ed[_0x44e77c([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x44e77c([0x67,0x65,0x74])](_0x44e77c([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0xed90fd(){let _0x284e60,_0x59cc8d=null,_0x33e584=null;try{if(_0x2e6c2f==_0x44e77c([0x47,0x50,0x4c]))return _0x44e77c([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x284e60=_0x55f425(),!_0x284e60)return _0x44e77c([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x284e60[_0x44e77c([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x33e584=_0x107a9e(_0x284e60[_0x44e77c([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x284e60[_0x44e77c([0x6a,0x74,0x69])])),await _0x827c1b()?_0x1f923a()?_0x3f73bd()?_0x44e77c([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x3aae4b()?(_0x284e60[_0x44e77c([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x44e77c([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x59cc8d=_0x5bd339(_0x44e77c([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x308883()):_0x44e77c([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x44e77c([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x44e77c([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x44e77c([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x3f73bd(){const _0x5a3eba=[_0x44e77c([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x44e77c([0x74,0x72,0x69,0x61,0x6c])][_0x44e77c([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x284e60[_0x44e77c([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x117a13/0x3e8:0xe10*_0x54399f;return _0x284e60[_0x44e77c([0x65,0x78,0x70])]<_0x5a3eba;}function _0x1f923a(){const _0x4b903c=_0x284e60[_0x44e77c([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x4b903c&&(!!_0x4b903c[_0x44e77c([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x44e77c([0x2a]))||!!_0x4b903c[_0x44e77c([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x44e77c([0x41,0x49])));}function _0x3aae4b(){const _0x44cfed=_0x284e60[_0x44e77c([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x44cfed||0x0==_0x44cfed[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x401022}=new URL(window[_0x44e77c([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x44cfed[_0x44e77c([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x401022))return!0x0;const _0x7909fb=_0x401022[_0x44e77c([0x73,0x70,0x6c,0x69,0x74])](_0x44e77c([0x2e]));return _0x44cfed[_0x44e77c([0x66,0x69,0x6c,0x74,0x65,0x72])](_0xed9497=>_0xed9497[_0x44e77c([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x44e77c([0x2a])))[_0x44e77c([0x6d,0x61,0x70])](_0x2934aa=>_0x2934aa[_0x44e77c([0x73,0x70,0x6c,0x69,0x74])](_0x44e77c([0x2e])))[_0x44e77c([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x582476=>_0x582476[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x7909fb[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x44e77c([0x6d,0x61,0x70])](_0x461ec1=>Array(_0x7909fb[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x461ec1[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x44e77c([0x66,0x69,0x6c,0x6c])](_0x461ec1[0x0]===_0x44e77c([0x2a])?_0x44e77c([0x2a]):'')[_0x44e77c([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x461ec1))[_0x44e77c([0x73,0x6f,0x6d,0x65])](_0xe879b6=>_0x7909fb[_0x44e77c([0x65,0x76,0x65,0x72,0x79])]((_0x4095e1,_0x146ae2)=>_0xe879b6[_0x146ae2]===_0x4095e1||_0xe879b6[_0x146ae2]===_0x44e77c([0x2a])));}function _0x308883(){return _0x59cc8d&&_0x33e584?new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x156cbf,_0x261cdc)=>{_0x59cc8d[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x156cbf,_0x261cdc),_0x33e584[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x25409b=>{_0x25409b!=_0x44e77c([0x56,0x61,0x6c,0x69,0x64])&&_0x156cbf(_0x25409b);},_0x261cdc);}):_0x59cc8d||_0x33e584||_0x44e77c([0x56,0x61,0x6c,0x69,0x64]);}}function _0x107a9e(_0x914900,_0x5e45a0){return new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x41a1e8=>{if(_0x266c90())return _0x41a1e8(_0x44e77c([0x56,0x61,0x6c,0x69,0x64]));_0x3c297e(),_0x17a7ed[_0x44e77c([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x44e77c([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x559852=!0x1;const _0x1d5c44=at();function _0x54a533(_0x4115e1){return!!_0x4115e1&&(typeof _0x4115e1===_0x44e77c([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x4115e1===_0x44e77c([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x4115e1[_0x44e77c([0x74,0x68,0x65,0x6e])]===_0x44e77c([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x4115e1[_0x44e77c([0x63,0x61,0x74,0x63,0x68])]===_0x44e77c([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x467c33(_0xec6003){_0x2be23c(_0xec6003)[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x419c4f=>{if(!_0x419c4f||_0x419c4f[_0x44e77c([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x44e77c([0x6f,0x6b]))return _0x44e77c([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x31262b(_0xfa2871(_0x1d5c44+_0x5e45a0))!=_0x419c4f[_0x44e77c([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x44e77c([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x44e77c([0x56,0x61,0x6c,0x69,0x64]);})[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x2d5fba=>(_0x5f39d8(),_0x2d5fba),()=>{const _0x31bbb7=_0x407e45();return null==_0x31bbb7?(_0x5f39d8(),_0x44e77c([0x56,0x61,0x6c,0x69,0x64])):_0x44e77c(_0x117a13-_0x31bbb7>(0x19f340e1^_0x129003)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x41a1e8)[_0x44e77c([0x63,0x61,0x74,0x63,0x68])](()=>{_0x41a1e8(_0x44e77c([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x42fbb5=0x3dc92a61^_0x129003;function _0x5f39d8(){const _0x435661=_0x44e77c([0x6c,0x6c,0x63,0x74,0x2d])+_0x31262b(_0xfa2871(_0x914900)),_0x141d5b=_0xbe139d(_0x31262b(window[_0x44e77c([0x4d,0x61,0x74,0x68])][_0x44e77c([0x63,0x65,0x69,0x6c])](_0x117a13/_0x42fbb5)));window[_0x44e77c([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x44e77c([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x435661,_0x141d5b);}function _0x407e45(){const _0x206568=_0x44e77c([0x6c,0x6c,0x63,0x74,0x2d])+_0x31262b(_0xfa2871(_0x914900)),_0x12e751=window[_0x44e77c([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x44e77c([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x206568);return _0x12e751?window[_0x44e77c([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xbe139d(_0x12e751),0x10)*_0x42fbb5:null;}function _0x2be23c(_0x437a8c){return new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x17219e,_0x54000c)=>{_0x437a8c[_0x44e77c([0x74,0x68,0x65,0x6e])](_0x17219e,_0x54000c),window[_0x44e77c([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x54000c,0x3dfe1021^_0x129003);});}}_0x17a7ed[_0x44e77c([0x6f,0x6e])](_0x44e77c([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x685b0b,_0x519f66)=>{if(_0x519f66[0x0]!=_0x914900)return _0x41a1e8(_0x44e77c([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x519f66[0x1]={..._0x519f66[0x1],[_0x44e77c([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x1d5c44};},{[_0x44e77c([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x44e77c([0x68,0x69,0x67,0x68])}),_0x17a7ed[_0x44e77c([0x6f,0x6e])](_0x44e77c([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x5a407f=>{_0x54a533(_0x5a407f[_0x44e77c([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x559852=!0x0,_0x467c33(_0x5a407f[_0x44e77c([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x44e77c([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x44e77c([0x6c,0x6f,0x77])}),_0x294f64[_0x44e77c([0x74,0x68,0x65,0x6e])](()=>{_0x559852||_0x41a1e8(_0x44e77c([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x266c90(){return _0x17a7ed[_0x44e77c([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x44e77c([0x76,0x69,0x65,0x77])][_0x44e77c([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x44e77c([0x61,0x75,0x74,0x6f]);}function _0x3c297e(){_0x17a7ed[_0x44e77c([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x44e77c([0x76,0x69,0x65,0x77])][_0x44e77c([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x44e77c([0x61,0x75,0x74,0x6f]);}}function _0x5bd339(_0x46ab13){const _0x39b3d4=[new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x392aeb=>setTimeout(_0x392aeb,0x3df6fa2d^_0x129003)),_0x294f64[_0x44e77c([0x74,0x68,0x65,0x6e])](()=>new window[(_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x142edd=>{let _0x3d8f3f=0x0;_0x17a7ed[_0x44e77c([0x6d,0x6f,0x64,0x65,0x6c])][_0x44e77c([0x6f,0x6e])](_0x44e77c([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x593bf9,_0x270e82)=>{_0x270e82[0x0][_0x44e77c([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x3d8f3f++,_0x3d8f3f==(0x3dffc109^_0x129003)&&(_0x142edd(),_0x593bf9[_0x44e77c([0x6f,0x66,0x66])]());});}))];return window[_0x44e77c([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x44e77c([0x72,0x61,0x63,0x65])](_0x39b3d4)[_0x44e77c([0x74,0x68,0x65,0x6e])](()=>_0x46ab13);}async function _0x380da5(){await _0x294f64,_0x17a7ed[_0x44e77c([0x6d,0x6f,0x64,0x65,0x6c])][_0x44e77c([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x2fe8eb,_0x17a7ed[_0x44e77c([0x6d,0x6f,0x64,0x65,0x6c])][_0x44e77c([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x2fe8eb,_0x17a7ed[_0x44e77c([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x44e77c([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x18a887(_0xa33ee1){const _0x5d2884=_0x500d98();_0x17a7ed[_0x5d2884]=_0x44e77c([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0xa33ee1,_0xa33ee1!=_0x44e77c([0x56,0x61,0x6c,0x69,0x64])&&_0x380da5();}function _0x500d98(){const _0x479bfa=window[_0x44e77c([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x44e77c([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x44e77c([0x6e,0x6f,0x77])]())[_0x44e77c([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x44e77c([0x2e]),'');let _0x569f78=_0x44e77c([0x6e]);for(let _0x425c7d=0x0;_0x425c7d<_0x479bfa[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x425c7d+=0x2){let _0x36cb74=window[_0x44e77c([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x479bfa[_0x44e77c([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x425c7d,_0x425c7d+0x2));_0x36cb74>=_0x363480[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x36cb74-=_0x363480[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x569f78+=_0x363480[_0x36cb74];}return _0x569f78;}function _0x55f425(){const _0x577990=_0x2e6c2f[_0x44e77c([0x73,0x70,0x6c,0x69,0x74])](_0x44e77c([0x2e]));if(0x3!=_0x577990[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x4544a9(_0x577990[0x1]);function _0x4544a9(_0x2e9ee6){const _0x3c5561=_0x3abd21(_0x2e9ee6);return _0x3c5561&&_0x15995c()?_0x3c5561:null;function _0x15995c(){const _0xb3151a=_0x3c5561[_0x44e77c([0x6a,0x74,0x69])],_0x3e54bc=window[_0x44e77c([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xb3151a[_0x44e77c([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0xb3151a[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x4d17ce={..._0x3c5561,[_0x44e77c([0x6a,0x74,0x69])]:_0xb3151a[_0x44e77c([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0xb3151a[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x4d17ce[_0x44e77c([0x76,0x63])],_0xfa2871(_0x4d17ce)==_0x3e54bc;}}}async function _0x827c1b(){let _0x2bd744=!0x0;try{const _0x1c374d=_0x2e6c2f[_0x44e77c([0x73,0x70,0x6c,0x69,0x74])](_0x44e77c([0x2e])),[_0x9c28b5,_0x5f0889,_0x1c86a8]=_0x1c374d;return _0x5a96fe(_0x9c28b5),await _0x405db8(_0x9c28b5,_0x5f0889,_0x1c86a8),_0x2bd744;}catch{return!0x1;}function _0x5a96fe(_0x4d5b88){const _0x16de01=_0x3abd21(_0x4d5b88);_0x16de01&&_0x16de01[_0x44e77c([0x61,0x6c,0x67])]==_0x44e77c([0x45,0x53,0x32,0x35,0x36])||(_0x2bd744=!0x1);}async function _0x405db8(_0x535efd,_0x37db7d,_0x22efc7){const _0x4b81ec=window[_0x44e77c([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x44e77c([0x66,0x72,0x6f,0x6d])](_0x5a14c9(_0x22efc7),_0x177706=>_0x177706[_0x44e77c([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x35c17f=new window[(_0x44e77c([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x44e77c([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x535efd+_0x44e77c([0x2e])+_0x37db7d),_0x482271=window[_0x44e77c([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x44e77c([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x482271)return;const _0x5413bf=await _0x482271[_0x44e77c([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x44e77c([0x6a,0x77,0x6b]),_0x310758,{[_0x44e77c([0x6e,0x61,0x6d,0x65])]:_0x44e77c([0x45,0x43,0x44,0x53,0x41]),[_0x44e77c([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x44e77c([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x44e77c([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x482271[_0x44e77c([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x44e77c([0x6e,0x61,0x6d,0x65])]:_0x44e77c([0x45,0x43,0x44,0x53,0x41]),[_0x44e77c([0x68,0x61,0x73,0x68])]:{[_0x44e77c([0x6e,0x61,0x6d,0x65])]:_0x44e77c([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x5413bf,_0x4b81ec,_0x35c17f)||(_0x2bd744=!0x1);}}function _0x3abd21(_0x3c5a0c){return _0x3c5a0c[_0x44e77c([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x44e77c([0x65,0x79]))?JSON[_0x44e77c([0x70,0x61,0x72,0x73,0x65])](_0x5a14c9(_0x3c5a0c)):null;}function _0x5a14c9(_0x329949){return window[_0x44e77c([0x61,0x74,0x6f,0x62])](_0x329949[_0x44e77c([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x44e77c([0x2b]))[_0x44e77c([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x44e77c([0x2f])));}function _0xfa2871(_0x348211){let _0x115f0e=0x1505;function _0x1c4395(_0x571945){for(let _0xd1ed9a=0x0;_0xd1ed9a<_0x571945[_0x44e77c([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0xd1ed9a++){const _0x5add27=_0x571945[_0x44e77c([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0xd1ed9a);_0x115f0e=(_0x115f0e<<0x5)+_0x115f0e+_0x5add27,_0x115f0e&=_0x115f0e;}}function _0x5453a6(_0x441503){Array[_0x44e77c([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x441503)?_0x441503[_0x44e77c([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x5453a6):_0x441503&&typeof _0x441503==_0x44e77c([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x44e77c([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x441503)[_0x44e77c([0x73,0x6f,0x72,0x74])]()[_0x44e77c([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0xf44ec4,_0x22e652])=>{_0x1c4395(_0xf44ec4),_0x5453a6(_0x22e652);}):_0x1c4395(window[_0x44e77c([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x441503));}return _0x5453a6(_0x348211),_0x115f0e>>>0x0;}function _0x31262b(_0x1d408e){return _0x1d408e[_0x44e77c([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x44e77c([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x44e77c([0x30]));}function _0xbe139d(_0x4f83de){return _0x4f83de[_0x44e77c([0x73,0x70,0x6c,0x69,0x74])]('')[_0x44e77c([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x44e77c([0x6a,0x6f,0x69,0x6e])]('');}function _0x2fe8eb(){}function _0x44e77c(_0x44e189){return _0x44e189['map'](_0x382f04=>String['fromCharCode'](_0x382f04))['join']('');}_0x18a887(await _0xed90fd());}(this);}['showFakeVisualSelection'](){const _0x548640=this['editor']['model'];_0x548640['change'](_0x2e8df2=>{const _0x53a15d=_0x548640['document']['selection']['getRanges']();let _0x388236=0x0;for(const _0x60b52b of _0x53a15d){const _0x3dbe8b=bi+':'+_0x388236;if(_0x548640['markers']['has'](_0x3dbe8b))_0x2e8df2['updateMarker'](_0x3dbe8b,{'range':_0x60b52b});else{if(_0x60b52b['start']['isAtEnd']){const _0x42d1b7=_0x60b52b['start']['getLastMatchingPosition'](({item:_0x5e3175})=>!_0x548640['schema']['isContent'](_0x5e3175),{'boundaries':_0x60b52b});_0x2e8df2['addMarker'](_0x3dbe8b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2e8df2['createRange'](_0x42d1b7,_0x60b52b['end'])});}else _0x2e8df2['addMarker'](_0x3dbe8b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x60b52b});}_0x388236++;}});}['hideFakeVisualSelection'](){const _0x19ecb9=this['editor']['model'],_0xe3902b=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0xe3902b['length']&&_0x19ecb9['change'](_0x353fa5=>{_0xe3902b['forEach'](_0x16c824=>{_0x353fa5['removeMarker'](_0x16c824);});});}['insertContent'](_0x95cb69,_0x5158f9){const _0x29ac2b=this['_getAISelection'](),_0x206591=_0x5158f9||_0x29ac2b['getFirstRange']();this['editor']['model']['canEditAt'](_0x206591)&&this['editor']['model']['change'](_0x3dbc5d=>{this['hideFakeVisualSelection'](),_0x5158f9||this['_resetContentOfSelectedTableCells'](_0x3dbc5d,_0x29ac2b),this['_pasteHTMLUsingClipboard']({'insertAt':_0x206591,'writer':_0x3dbc5d,'html':_0x95cb69});});}['insertContentBelow'](_0x2c07b9){const {model:_0x218dbe}=this['editor'],_0x3e029f=this['_getAISelection']();_0x218dbe['change'](()=>{const _0x2df7de=this['_prepareTableInsertBelowPosition'](_0x2c07b9,_0x3e029f)||this['_getDefaultInsertBelowPosition'](_0x3e029f);this['insertContent'](_0x2c07b9,_0x2df7de);});}['_getAISelection'](){const _0x5a68fa=this['editor']['model'],_0x55d937=Array['from'](_0x5a68fa['markers']['getMarkersGroup'](bi))['map'](_0xa97b61=>_0xa97b61['getRange']());return _0x5a68fa['createSelection'](_0x55d937);}['_pasteHTMLUsingClipboard']({writer:_0x506666,html:_0xdfbed3,insertAt:_0xa53d49}){const {view:_0x5dcd36}=this['editor']['editing'],_0x29de87=this['editor']['plugins']['get'](_0x12e122),_0x381aff=new Ri();_0x381aff['setData']('text/html',_0xdfbed3);const _0x58030c=new ClipboardEvent('paste',{'clipboardData':_0x381aff}),_0x457dbf=new _0x9ad6d7(_0x5dcd36,_0x58030c,{'dataTransfer':new _0x50ceb7(_0x381aff)});_0x506666['setSelection'](_0xa53d49);const _0x53f170=(_0x49a1c0,_0x231a2e)=>{_0x231a2e['resultRange']&&_0x506666['setSelection'](_0x231a2e['resultRange']);};_0x29de87['once']('contentInsertion',_0x53f170,{'priority':'lowest'}),_0x5dcd36['document']['fire']('paste',_0x457dbf),_0x29de87['off']('contentInsertion',_0x53f170);}['_getDefaultInsertBelowPosition'](_0x34c342){const {model:_0x215e5c}=this['editor'],_0x1aed04=Array['from'](_0x34c342['getSelectedBlocks']());return _0x1aed04['length']?_0x215e5c['createPositionAfter'](_0x1aed04['pop']()):_0x34c342['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x2debb2,_0x3b9ff9){const {model:_0x2ea13b,plugins:_0xad4041}=this['editor'];if(_0xad4041['has']('TableUtils')){const _0x4b338f=_0xad4041['get']('TableUtils')['getSelectedTableCells'](_0x3b9ff9);if(_0x4b338f['length']){const _0x3b47f3=this['_getTableRowCountFromContent'](_0x2debb2),_0x500eb8=this['_createEmptyTableRows'](_0x4b338f,_0x3b47f3);return _0x2ea13b['createPositionAt'](_0x500eb8,0x0);}}return null;}['_getTableRowCountFromContent'](_0x197d9c){const _0x9ec026=this['editor']['plugins']['get']('TableUtils'),_0x22f133=this['editor']['data']['parse'](_0x197d9c,'$documentFragment'),_0x4c7628=Array['from'](_0x22f133['getChildren']())['filter'](_0x2d4b70=>_0x2d4b70['is']('element','table'));let _0x3e5da6=0x0;return _0x4c7628['forEach'](_0x419ba9=>{_0x3e5da6+=_0x9ec026['getRows'](_0x419ba9);}),_0x3e5da6;}['_createEmptyTableRows'](_0xb5dcd0,_0x2b92c8){const _0x3ec789=this['editor']['plugins']['get']('TableUtils'),_0xf5db3d=_0x3ec789['getRowIndexes'](_0xb5dcd0),_0x1c7d4a=_0x3ec789['getColumnIndexes'](_0xb5dcd0),_0x5102e9=_0xf5db3d['last']+0x1,_0x111739=_0x1c7d4a['first'],_0x4f26f6=_0xb5dcd0[0x0]['findAncestor']('table');for(let _0xcb5f69=0x0;_0xcb5f69<_0x2b92c8;_0xcb5f69++)_0x3ec789['insertRows'](_0x4f26f6,{'at':_0x5102e9});return _0x4f26f6['getChild'](_0x5102e9)['getChild'](_0x111739);}['_resetContentOfSelectedTableCells'](_0x3232ed,_0x78d388){const {plugins:_0x238c8a}=this['editor'],{model:_0x8f323d}=_0x3232ed;if(!_0x238c8a['has']('TableUtils'))return;_0x238c8a['get']('TableUtils')['getSelectedTableCells'](_0x78d388)['length']&&_0x8f323d['deleteContent'](_0x78d388);}}class AIAdapter extends _0x41a2d8{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x562462){super(_0x562462),this['name']='AIRequestError';}}function Si(_0x2c4b40,_0x3c01f6,_0x4211c2){const t=_0x2c4b40['t'];switch(_0x3c01f6){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',_0x4211c2);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x4211c2);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'},_0x4211c2);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 _0x3c01f6;}}class ShowAIAssistantCommand extends _0xd5099f{['_commandDefinitions'];constructor(_0x133fbe,_0x14be34){super(_0x133fbe),this['_commandDefinitions']=_0x14be34,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x5140d2,_0x1d0063,_0x4785b1)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x4785b1));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x5e683c,_0x5a56c9,_0x86d93a)=>{this['enabledCommandsIds']=_0x86d93a?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x19be79=this['editor']['model'];this['_hasContext']=function(_0x4ffa46){const _0x7f75bd=_0x4ffa46['document']['selection'];return _0x7f75bd['isCollapsed']?0x0!==[..._0x7f75bd['getSelectedBlocks']()]['length']&&![..._0x7f75bd['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x4ffa46['hasContent'](_0x7f75bd['getFirstRange']());}(_0x19be79);const _0x3b1bb5=_0x19be79['document']['selection'],_0x555c14=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2b2af1 of _0x3b1bb5['getRanges']())for(const _0xbb50f1 of _0x2b2af1['getItems']())if(_0xbb50f1['is']('element')&&_0x555c14['includes'](_0xbb50f1['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x1e6cad='',_0x113e71='',_0x5e9246='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x1e6cad,_0x113e71,_0x5e9246);}}function Oi(_0x18d9cd,_0x969795){const _0x252dc4=new Set();for(const _0x3c800d of _0x18d9cd['values']())(_0x969795||!0x1===_0x3c800d['requiresContent'])&&_0x252dc4['add'](_0x3c800d['id']);return Array['from'](_0x252dc4);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
|
|
24
|
+
ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x2c50fd,_0x1c9805,_0x1cb497){super(),this['editor']=_0x2c50fd,this['textAdapter']=_0x1c9805,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x1cb497,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x265475,_0x43c74b,_0x1b143d)=>{this['view']['value']=this['_sanitizeHTML'](_0x1b143d);}),this['listenTo'](this['view'],'submitPrompt',(_0x491a7b,_0x7a0519)=>{const _0x11d50c=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x7a0519,_0x11d50c,'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:_0x564504,query:_0x5d7a9f,htmlContent:_0x499b4b,label:_0x286e70,mainActionLabel:_0x21329a}){this['view']['prompt']=_0x286e70,this['view']['mainAction']=_0x21329a,this['initialContext']=_0x499b4b,_0x5d7a9f&&(this['view']['isRendered']?this['_handleQuery'](_0x5d7a9f,_0x499b4b,_0x564504,_0x286e70):this['view']['once']('render',()=>{this['_handleQuery'](_0x5d7a9f,_0x499b4b,_0x564504,_0x286e70);}));}['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'](_0x108382,_0x3b1a52,_0x3ceb36,_0x51deab){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x3b1a52,this['previousQuery']=_0x108382,this['previousLabel']=_0x51deab||_0x108382,this['previousActionId']=_0x3ceb36,new Promise(_0x2d3c1a=>{this['textAdapter']['makeRequest']({'query':_0x108382,'context':_0x3b1a52,'onData':_0x1dd571=>{this['currentResponse']=_0x1dd571,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x3ceb36})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x59016a=>{_0x59016a instanceof AIRequestError?this['view']['handleError'](_0x59016a['message']):this['view']['handleError'](),_0x2d3c1a();})['finally'](()=>{this['stopProcessing'](),_0x2d3c1a();});});}['_parseAndNormalizeContent'](_0x1554fa,_0x3bbc5d=!0x1){const _0x2b6bb4=vi['exec'](_0x1554fa);_0x1554fa=_0x2b6bb4?_0x1554fa['substring'](_0x2b6bb4[0x1]['length']):_0x1554fa['length']<0x64&&!_0x3bbc5d?'':this['_stripMarkdownSyntax'](_0x1554fa);const _0x303eac=this['_domParser']['parseFromString'](_0x1554fa,'text/html');if(_0x2b6bb4){const _0x2f6d9c=Array['from'](_0x303eac['body']['childNodes']);_0x2f6d9c['reverse']();for(const _0x243480 of _0x2f6d9c){if(_0x243480['nodeType']==Node['ELEMENT_NODE'])break;_0x243480['remove']();}}const _0xa0834e=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x303eac['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0xa0834e);const _0x50381c=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x22af8e=this['editor']['data']['toModel'](_0xa0834e);return _0x50381c||_0x22af8e['markers']['clear'](),this['editor']['data']['stringify'](_0x22af8e);}['_normalizeResponseHeadings'](_0x134416){const _0x3b5c06=new _0x3a6e19(this['editor']['editing']['view']['document']),_0x233f98=new _0x4f9af0({'name':/^h[1-5]$/}),_0x135124=[];let _0x1cb3f1=!0x1;for(const _0x11954a of _0x134416)_0x11954a['is']('element')&&_0x233f98['match'](_0x11954a)&&(_0x135124['push'](_0x11954a),'h1'==_0x11954a['name']&&(_0x1cb3f1=!0x0));if(_0x1cb3f1){for(const _0x4fa1e0 of _0x135124)_0x3b5c06['rename']('h'+(parseInt(_0x4fa1e0['name'][0x1])+0x1),_0x4fa1e0);}}['_isH1TagSupportEnabled'](){const {data:_0x233b8e,editing:_0x4ac350}=this['editor'],_0x4bce4d=_0x233b8e['htmlProcessor']['toView']('<h1></h1>'),_0x5de47d=_0x233b8e['toView'](_0x233b8e['toModel'](_0x4bce4d));return!!_0x4ac350['view']['domConverter']['viewToDom'](_0x5de47d)['querySelector']('h1');}['_sanitizeHTML'](_0x19ee3d){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x19ee3d),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x55f505){const _0x35d20b=_0x55f505['trim']();return _0x35d20b['startsWith']('```html')?_0x35d20b['endsWith']('```')?_0x35d20b['substring'](0x7,_0x35d20b['length']-0x3):_0x35d20b['substring'](0x7):_0x55f505;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x3adf60){super(_0x3adf60),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x48c49c=>Si(_0x3adf60,'AI_'+_0x48c49c['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x3adf60,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x3adf60,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x3adf60,'Stop'));const _0x2053ef=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x2053ef['if']('isVisible','ck-hidden',_0x1cc369=>!_0x1cc369)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x2cb4a0,_0x122660){const _0x5027cb=new yt(this['locale']);return _0x5027cb['set']({'label':_0x2cb4a0,'class':_0x122660||'','isVisible':!0x0,'withText':!0x0}),_0x5027cb;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x4e209c,_0x52346a=''){super(_0x4e209c),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x51aaf9=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x4e209c,_0x52346a),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x51aaf9['if']('isVisible','ck-hidden',_0x523bf7=>!_0x523bf7)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x51aaf9['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 _0x504a25=!0x1;this['on']('change:value',(_0x748f89,_0x5bc3a9,_0x460d59)=>{const _0x2b2a50=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x460d59),this['isProcessing']&&_0x2b2a50&&!_0x504a25&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x3d27af,_0x43a88f,_0x168458)=>{_0x504a25=!0x1,_0x168458?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x504a25=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x504a25=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x1318a1=this['locale'],_0x9e63c2=new yt(this['locale']),_0xdd4cfc='ck-ai-form__copy-button';return _0x9e63c2['set']({'label':Si(_0x1318a1,'Copy'),'icon':_0x51f25e,'class':_0xdd4cfc,'tooltip':!0x0}),_0x9e63c2['bind']('isVisible')['to'](this,'value',_0x62bd98=>!!_0x62bd98),_0x9e63c2['bind']('isEnabled')['to'](this,'isProcessing',_0x5e2286=>!_0x5e2286),_0x9e63c2['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x9e63c2['icon']=_0x36337b,_0x9e63c2['class']=_0xdd4cfc+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x9e63c2['icon']=_0x51f25e,_0x9e63c2['class']=_0xdd4cfc;},0x3e8);}),_0x9e63c2;}['_copyHTMLToClipboard'](_0x1fe53e){const {window:_0x4cc15a,document:_0x19aa49}=lt;if(_0x4cc15a['ClipboardItem']){const {Blob:_0x16fbee,ClipboardItem:_0x35f6f9}=_0x4cc15a,_0x449ee6=[new _0x35f6f9({'text/html':new _0x16fbee([_0x1fe53e['innerHTML']],{'type':'text/html'}),'text/plain':new _0x16fbee([_0x1fe53e['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x449ee6);}else{const _0x419e83=_0x19aa49['createElement']('div');_0x419e83['style']['position']='absolute',_0x419e83['style']['left']='-9999px',_0x419e83['innerHTML']='<span>[</span>'+_0x1fe53e['innerHTML']+'<span>]</span>',_0x19aa49['body']['appendChild'](_0x419e83);const _0x567ace=_0x19aa49['createRange']();_0x567ace['setStartAfter'](_0x419e83['firstElementChild']),_0x567ace['setEndBefore'](_0x419e83['lastElementChild']);const _0x5d497b=_0x4cc15a['getSelection']();_0x5d497b['removeAllRanges'](),_0x5d497b['addRange'](_0x567ace),_0x19aa49['execCommand']('copy'),_0x419e83['remove']();}}}class ContentFieldView extends Nt{constructor(_0x10e5a5,_0x5a2e65=''){super(_0x10e5a5),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x5a2e65,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x547905){this['element']['innerHTML']=_0x547905;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x30ebe2=new Nt(),_0x11d1b3=this['locale'],_0x1236f9=new xt();return _0x1236f9['isVisible']=!0x0,_0x30ebe2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x1236f9,{'text':Si(_0x11d1b3,'AI\x20is\x20writing...')}]}),_0x30ebe2['render'](),_0x30ebe2;}}class AIFormErrorView extends Nt{constructor(_0x3b0d41,_0x4a0cdc=''){super(_0x3b0d41);const _0x5048a7=new Lt(),_0x1de4be=this['bindTemplate'];this['set']('text',_0x4a0cdc),_0x5048a7['content']=_0x309aa6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5048a7,{'text':_0x1de4be['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x1586d1,_0x203f9d){super(_0x1586d1,_0x203f9d),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',(_0x36c471,_0xb53ced)=>{_0x36c471['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0xb53ced());});}['_createSubmitButton'](){const _0x672ef7=new yt(this['locale']),_0x44542b=this['locale'];return _0x672ef7['set']({'icon':_0x1bfbe9,'label':Si(_0x44542b,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x672ef7['on']('execute',()=>{this['submit']();}),_0x672ef7['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5129b1,_0x2615e6)=>!_0x5129b1&&_0x2615e6),_0x672ef7;}['_createShowHistoryButton'](){const _0x3f0ddb=new yt(this['locale']),_0x4b2faf=this['resultsView'],_0x580abd=this['locale'];_0x3f0ddb['set']({'label':Si(_0x580abd,'History'),'withText':!0x1,'icon':_0x105978,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x3f0ddb['bind']('isOn')['to'](_0x4b2faf,'isVisible'),_0x3f0ddb['bind']('isEnabled')['to'](this,'isEnabled'),_0x3f0ddb['on']('execute',()=>{_0x4b2faf['isVisible']=!_0x4b2faf['isVisible'],_0x4b2faf['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x1c509d=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x499f4e=new dt(this['queryView']['fieldView']['element']),_0x204ef3=_0x499f4e['width'],_0x3d0f53='rtl'===_0x580abd['uiLanguageDirection']?'left':'right';_0x499f4e['excludeScrollbarsAndBorders'](),_0x3f0ddb['element']['style'][_0x3d0f53]=_0x204ef3-_0x499f4e['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x1c509d),this['on']('render',_0x1c509d),_0x3f0ddb;}['submit'](){const _0x3bed27=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x3bed27);}['focus'](_0x5e4d56){-0x1===_0x5e4d56?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x2b95d4){super(_0x2b95d4),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x2b95d4,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x308d4d=0x0;for(const _0x1b22fe of this['items'])_0x308d4d+=_0x1b22fe['items']['length'];return{'resultsCount':_0x308d4d,'totalItemsCount':_0x308d4d};}['_createClearHistoryButton'](){const _0x3ed12f=this['locale'],_0x5c5442=new yt(this['locale']);return _0x5c5442['set']({'label':'('+Si(_0x3ed12f,'Clear')+')','withText':!0x0}),_0x5c5442['on']('execute',()=>this['fire']('clearHistory')),_0x5c5442;}}class AIHistoryListItemView extends Ht{constructor(_0x370487){super();const _0x22c575=new Mt(),_0x945029=new yt(this['locale'],_0x22c575);this['children']['add'](_0x945029),_0x945029['set']({'label':_0x370487['prompt'],'withText':!0x0}),_0x945029['on']('execute',()=>{this['fire']('execute',{'value':_0x22ed42(_0x370487['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1ba94b,_0x21d524)=>{const _0xfc1d21=Ni(_0x21d524['prompt']);for(const _0x1fb507 of this)if(_0x1fb507!=_0x21d524&&Ni(_0x1fb507['prompt'])===_0xfc1d21){this['remove'](_0x1fb507);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x36f10d=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x36f10d));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x14e004=>_0x14e004)));}}function Ni(_0x2fe93b){return _0x2fe93b['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x112804,_0x1d717e,_0x7de825=''){super(_0x112804),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x112804),this['contentArea']=new AIFormContentArea(_0x112804,_0x7de825),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 It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'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 _0xe785c9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x1d717e],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xe785c9['if']('isError','ck-hidden',_0x42e24c=>!_0x42e24c)]},'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'](_0x3e9e66=0x1){-0x1===_0x3e9e66?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 _0x30fabb=this['locale'],_0x5f41ce=new AIFormPromptView(_0x30fabb,{'queryView':{'label':Si(_0x30fabb,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x30fabb,'Empty\x20history'),'secondary':Si(_0x30fabb,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5f41ce['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x521433,_0x29a3d4)=>_0x521433&&!_0x29a3d4),this['listenTo'](_0x5f41ce,'submit',(_0x49d959,_0x31ef62)=>{this['prompt']=_0x31ef62;const _0x35a689=_0x5d498f(_0x31ef62);this['fire']('submitPrompt',_0x35a689),_0x31ef62['trim']()&&this['_promptHistory']['add']({'prompt':_0x35a689},0x0);},{'priority':'high'}),_0x5f41ce;}['_createHistoryView'](){const _0x35c4a8=new AIHistoryListView(this['locale']);return _0x35c4a8['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x35c4a8['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x35c4a8;}['_createToolbar'](){const _0x20b34c=new AIFormToolbarView(this['locale']);return _0x20b34c['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4092d3,_0x1b09fc,_0x26d675)=>_0x4092d3&&!_0x1b09fc&&!!_0x26d675),_0x20b34c['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x20b34c['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x5aa304,_0x40df03,_0x58f0d1)=>_0x5aa304&&!_0x40df03&&!!_0x58f0d1),_0x20b34c['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x20b34c['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x12ab26,_0x377cdc)=>_0x12ab26&&!_0x377cdc),_0x20b34c['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x20b34c['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x20b34c['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x20b34c;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x5cef41=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x5cef41,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x5bc9a5){const _0x2301da=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x5bc9a5||Si(_0x2301da,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x41a2d8{['licenseKey'];['_licenseKeyCheckInterval'];['_dialog'];['_formView'];['_aiAdapter'];['_aiAssistantController'];['_uiCssClasses']='';static get['pluginName'](){return'AIAssistantUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[_0x494f7c,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x24694a){super(_0x24694a),_0x24694a['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x24694a['config']['define']('ai.assistant.contentAreaCssClass',''),_0x24694a['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x24694a['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x24ba7e}=this;this['_aiAdapter']=_0x24ba7e['plugins']['get'](AIAdapter),this['_dialog']=_0x24ba7e['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x553c09=new ShowAIAssistantCommand(_0x24ba7e,Array['from'](this['_commandDefinitions']['values']()));_0x24ba7e['commands']['add']('showAIAssistant',_0x553c09),_0x24ba7e['ui']['componentFactory']['add']('aiCommands',_0x565ad9=>{const _0x241ace=Ft(_0x565ad9);return _0x241ace['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x241ace['buttonView']['set']({'label':Si(_0x565ad9,'AI\x20Commands'),'icon':_0x3116a8,'tooltip':!0x0}),_0x241ace['on']('execute',_0x1e211b=>this['_onExecute'](_0x1e211b['source']['id'])),Wt(_0x241ace,_0x24ba7e['ui']['view']['body'],function(_0x390062){const _0x4d1cc2=fi(_0x390062['config']['get']('ai.assistant.commands'),_0x390062['locale']),_0x295688=Pi(_0x390062,_0x4d1cc2)['filter'](_0x4075e1=>_0x4075e1['commands']['length']);if(0x1===_0x295688['length'])return Pi(_0x390062,_0x295688[0x0]['commands'])['map'](_0x52ec27=>({'id':_0x52ec27['id'],'label':_0x52ec27['label']}));return _0x295688['map'](_0x38b67c=>{const {groupId:_0x140ac4,groupLabel:_0x59049a,commands:_0x303684}=_0x38b67c,_0x3ef04e=Pi(_0x390062,_0x303684)['map'](_0x51a8fa=>({'id':_0x51a8fa['id'],'label':_0x51a8fa['label']}));return{'id':_0x140ac4,'menu':_0x59049a||_0x140ac4,'children':_0x3ef04e};});}(_0x24ba7e),{'ariaLabel':Si(_0x565ad9,'AI\x20Commands')}),_0x241ace['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x553c09['on']('change:enabledCommandsIds',_0x25b9f7),_0x241ace['menuView']['once']('render',_0x25b9f7),_0x241ace;function _0x25b9f7(){_0x241ace['isEnabled']=_0x553c09['enabledCommandsIds']['length']>0x0;for(const _0x59ab5a of _0x241ace['menuView']['buttons'])_0x59ab5a['isEnabled']=_0x553c09['enabledCommandsIds']['includes'](_0x59ab5a['id']);}}),_0x24ba7e['ui']['componentFactory']['add']('menuBar:aiCommands',_0x137a5f=>{const _0x1847fb=new Kt(_0x137a5f);_0x1847fb['buttonView']['set']({'label':Si(_0x137a5f,'AI\x20Commands'),'icon':_0x3116a8}),_0x1847fb['bind']('isEnabled')['to'](_0x553c09,'enabledCommandsIds',_0x555c21=>_0x555c21['length']>0x0);const _0x429d45=fi(_0x24ba7e['config']['get']('ai.assistant.commands'),_0x137a5f);return this['_populateMenuBarMenu'](_0x553c09,_0x1847fb,_0x429d45,_0x54516a=>this['_onExecute'](_0x54516a)),_0x1847fb;}),_0x24ba7e['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x421907=this['_createAIAssistantUIButton'](yt);return _0x421907['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x421907;}),_0x24ba7e['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0xf442e6=this['_createAIAssistantUIButton'](Yt);return _0xf442e6['set']({'role':'menuitemcheckbox'}),_0xf442e6;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x590242=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3ee7ee;for(const _0x1702f2 in _0x590242){const _0x1299b7=_0x1702f2,_0x38f557=_0x590242[_0x1299b7];if('aiLicenseKeyValid'==_0x38f557||'aiLicenseKeyInvalid'==_0x38f557||'aiLicenseKeyExpired'==_0x38f557||'aiLicenseKeyDomainLimit'==_0x38f557||'aiLicenseKeyNotAllowed'==_0x38f557||'aiLicenseKeyEvaluationLimit'==_0x38f557||'aiLicenseKeyUsageLimit'==_0x38f557){delete _0x590242[_0x1299b7],_0x3ee7ee=_0x38f557,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3ee7ee&&_0x590242['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3ee7ee&&_0x590242['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3ee7ee&&_0x590242['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3ee7ee&&_0x590242['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3ee7ee&&_0x590242['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x3ee7ee&&_0x590242['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x5a7eed='',_0x3f3e82='',_0x39783d='custom'){const _0x30bbbd=this['editor'],_0x3d1d56=_0x30bbbd['editing']['view'],_0x1f629b=_0x30bbbd['plugins']['get'](AIAssistantEditing),_0x26b4f5=_0x30bbbd['plugins']['get'](_0x494f7c);_0x1f629b['showFakeVisualSelection']();const _0x105abc=new xi(),_0xd29f25=new ClipboardEvent('copy',{'clipboardData':_0x105abc}),_0x16b459=new _0x50ceb7(_0x105abc),_0x471c16=new _0x9ad6d7(_0x3d1d56,_0xd29f25,{'dataTransfer':_0x16b459});_0x26b4f5['_forceMarkersCopy']('comment',()=>{_0x3d1d56['document']['fire']('copy',_0x471c16);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x30bbbd,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x56013b=_0x16b459['getData']('text/html');const _0x14bb07=_0x30bbbd['model']['document']['selection'],_0xdcf863=Array['from'](_0x14bb07['getRanges']());0x1===_0xdcf863['length']&&_0xdcf863[0x0]['isFlat']&&!_0x14bb07['getSelectedElement']()&&''!==_0x56013b['replace'](/ /g,'')['trim']()&&(_0x56013b='<p>'+_0x56013b+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x39783d,'query':_0x5a7eed,'htmlContent':_0x56013b,'label':_0x3f3e82,'mainActionLabel':ki[_0x30bbbd['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4eea09,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x1f629b['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x3d9c49=new Map(),_0x29b11e=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x260a2d of _0x29b11e)for(const _0x414288 of _0x260a2d['commands'])_0x3d9c49['set'](_0x414288['id'],{..._0x414288,'groupId':_0x260a2d['groupId'],'groupLabel':_0x260a2d['groupLabel']||_0x260a2d['groupId']});return _0x3d9c49;}['_createAIAssistantUIButton'](_0x9fc689){const _0x55e3a4=this['editor'],_0x49ca26=_0x55e3a4['commands']['get']('showAIAssistant'),_0x383cef=new _0x9fc689(_0x55e3a4['locale']);return _0x383cef['set']({'label':Si(_0x55e3a4['locale'],'AI\x20Assistant'),'icon':_0x4eea09,'isToggleable':!0x0}),_0x383cef['bind']('isEnabled')['to'](_0x49ca26),_0x383cef['bind']('isOn')['to'](this['_dialog'],'id',_0x27c7bf=>'aiAssistant'===_0x27c7bf),this['listenTo'](_0x383cef,'execute',()=>{_0x383cef['isOn']?this['hideUI']():_0x49ca26['execute']();}),_0x383cef;}['_initView'](){const _0x447f17=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x447f17['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x447f17['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0xce50a4,ui:{ariaLiveAnnouncer:_0x15fe4b}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x2d2349,_0x5d159b,_0x916dd5)=>{const _0x39aa33=this['_aiAssistantController']['currentContext'];_0x916dd5?_0x15fe4b['announce'](Si(_0xce50a4,'AI\x20is\x20writing')):_0x39aa33&&_0x15fe4b['announce'](Si(_0xce50a4,'Generated\x20content:\x20%0',_0x39aa33),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x4c4b86,_0x568641,_0x2923c9)=>{if(_0x2923c9){const _0x3b01b1=this['_formView']['errorView']['text'];_0x15fe4b['announce'](Si(_0xce50a4,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3b01b1));}});}['_onExecute'](_0x21ff1c){const _0x41a819=this['_commandDefinitions']['get'](_0x21ff1c),_0x36de1a=this['editor'],_0x26e255=_0x36de1a['model']['document']['selection'],_0x3022d2=_0x36de1a['commands']['get']('showAIAssistant'),_0x5c4660=_0x36de1a['plugins']['get'](AIAssistantEditing),_0x402d30=''+(_0x41a819['groupId']!==Ti?_0x41a819['groupLabel']+':\x20':'')+_0x41a819['label'];if(!0x1!==_0x41a819['requiresContent']&&_0x26e255['isCollapsed']){const _0x2e7d3e=gt(_0x26e255['getSelectedBlocks']())||_0x36de1a['model']['schema']['getLimitElement'](_0x26e255);_0x36de1a['model']['change'](_0x2a537a=>{_0x2a537a['setSelection'](_0x2e7d3e,'in');});}_0x5c4660['showFakeVisualSelection'](),_0x3022d2['execute'](_0x41a819['prompt'],_0x402d30,'command:'+_0x21ff1c);}['_populateMenuBarMenu'](_0x276e32,_0x16ac70,_0x2e885c,_0x1bfc6e){const _0x4de1f1=this['editor'],_0x1be320=_0x4de1f1['locale'],_0x25778b=new qt(_0x1be320),_0x2a58e2=Pi(_0x4de1f1,_0x2e885c)['filter'](_0x5b8f4a=>_0x5b8f4a['commands']['length']);0x1===_0x2a58e2['length']?this['_getMenuBarGroupButtons']({'command':_0x276e32,'commands':_0x2a58e2[0x0]['commands'],'parentMenuView':_0x16ac70,'onExecute':_0x1bfc6e})['forEach'](_0x396b2f=>_0x25778b['items']['add'](_0x396b2f)):_0x2a58e2['forEach'](({groupId:_0xf8473e,groupLabel:_0x30021a,commands:_0x23ee51})=>{const _0xc6d12c=new Qt(_0x1be320,_0x16ac70),_0x3adf78=new Kt(_0x1be320),_0x57e252=new qt(_0x1be320),_0x16fc4f=this['_getMenuBarGroupButtons']({'command':_0x276e32,'commands':_0x23ee51,'parentMenuView':_0x3adf78,'onExecute':_0x1bfc6e});_0x3adf78['buttonView']['set']({'label':_0x30021a||_0xf8473e}),_0x3adf78['delegate']('execute')['to'](_0x16ac70),_0x57e252['items']['addMany'](_0x16fc4f),_0x3adf78['panelView']['children']['add'](_0x57e252),_0xc6d12c['children']['add'](_0x3adf78),_0x25778b['items']['add'](_0xc6d12c);}),_0x16ac70['panelView']['children']['add'](_0x25778b);}['_getMenuBarGroupButtons']({command:_0xa40d4c,commands:_0x4adb17,parentMenuView:_0x504ac3,onExecute:_0x53ca59}){const _0x341b5e=this['editor'],_0x41a33b=_0x341b5e['locale'];return Pi(_0x341b5e,_0x4adb17)['map'](_0x5af374=>{const _0x1f036c=new Qt(_0x41a33b,_0x504ac3),_0x4fbdd6=new Yt(_0x41a33b);return _0x4fbdd6['set']({'label':_0x5af374['label']}),_0x4fbdd6['delegate']('execute')['to'](_0x504ac3),_0x4fbdd6['on']('execute',()=>_0x53ca59(_0x5af374['id'])),_0x4fbdd6['bind']('isEnabled')['to'](_0xa40d4c,'enabledCommandsIds',_0x43ec6d=>_0x43ec6d['includes'](_0x5af374['id'])),_0x1f036c['children']['add'](_0x4fbdd6),_0x1f036c;});}}function Li(_0x326f30,_0xc74a13){return void 0x0!==_0x326f30['order']&&void 0x0===_0xc74a13['order']?0x1:void 0x0===_0x326f30['order']&&void 0x0!==_0xc74a13['order']?-0x1:void 0x0!==_0x326f30['order']&&void 0x0!==_0xc74a13['order']?_0x326f30['order']-_0xc74a13['order']:0x0;}function Pi(_0x50d9ae,_0x576ae5){_0x576ae5['sort'](Li);const _0x29bf9c={},_0x1fe78a=[];for(const _0x123022 of _0x576ae5)if(void 0x0!==_0x123022['order']){if(_0x123022['order']in _0x29bf9c)throw new ht('ai-commands-config-order-collision',_0x50d9ae,{'conflictingDefinitions':[_0x123022,_0x29bf9c[_0x123022['order']]]});_0x29bf9c[_0x123022['order']]=_0x123022,_0x1fe78a['splice'](_0x123022['order'],0x0,_0x123022);}else _0x1fe78a['push'](_0x123022);return _0x1fe78a;}class AIAssistant extends _0x41a2d8{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xe47f7f){super(_0xe47f7f);const _0x1211c2=_0xe47f7f['config'],_0x5cd959=_0xe47f7f['locale'];_0x1211c2['define']('ai.assistant.preserveComments',!0x0),_0x1211c2['define']('ai.assistant.commands',Di(_0x5cd959)),_0x1211c2['define']('ai.assistant.extraCommandGroups',[]),_0x1211c2['define']('ai.assistant.removeCommands',[]);let _0x16b73a=fi(_0x1211c2['get']('ai.assistant.commands'),_0x5cd959);const _0x53d9b9=_0x1211c2['get']('ai.assistant.extraCommandGroups'),_0x395849=_0x1211c2['get']('ai.assistant.removeCommands');_0x53d9b9['forEach'](_0x18abfc=>{const _0x3d9b59=_0x16b73a['find'](_0x4e6004=>_0x4e6004['groupId']===_0x18abfc['groupId']);_0x3d9b59?_0x3d9b59['commands']=_0x3d9b59['commands']['concat'](_0x18abfc['commands']):_0x16b73a['push'](_0x18abfc);}),_0x16b73a=_0x16b73a['filter'](_0x26ff7b=>!_0x395849['includes'](_0x26ff7b['groupId'])),_0x16b73a['forEach'](_0x4d6566=>{_0x4d6566['commands']=_0x4d6566['commands']['filter'](_0x57acfa=>!_0x395849['includes'](_0x57acfa['id']));}),_0x1211c2['set']('ai.assistant.commands',_0x16b73a);}}function Di(_0x1abf21){return[{'groupId':'editOrReview','groupLabel':Si(_0x1abf21,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x1abf21,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x1abf21,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Si(_0x1abf21,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x1abf21,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Si(_0x1abf21,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x1abf21,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Si(_0x1abf21,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Si(_0x1abf21,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x1abf21,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x1abf21,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x1abf21,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x1abf21,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x1abf21,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x1abf21,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x1abf21,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x1abf21,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x1abf21,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x1abf21,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x1abf21,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x1abf21,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x1abf21,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x1abf21,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x1abf21,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x1abf21,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x1abf21,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x1abf21,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x1abf21,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x41a2d8{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x56fa14){super(_0x56fa14),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x536ec9){return this['sendRequest'](_0x536ec9)['catch'](_0x1ebfb6=>{if(_0x1ebfb6 instanceof AIRequestError)return Promise['reject'](_0x1ebfb6);if('AbortError'==_0x1ebfb6['name'])return Promise['resolve']();throw console['error'](_0x1ebfb6),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x1e3272,_0x2b8b2c){const _0x507844=this['editor']['locale'],_0x2299a0={'Content-Type':'application/json'};if('object'==typeof _0x1e3272)Object['assign'](_0x2299a0,_0x1e3272);else{if(_0x1e3272)try{const _0x35eebf=await _0x1e3272(_0x2b8b2c);Object['assign'](_0x2299a0,_0x35eebf);}catch{return Promise['reject'](new AIRequestError(Si(_0x507844,'AI_ERROR_GET_HEADERS')));}}return _0x2299a0;}async['_prepareRequestParameters'](_0x2e1cd9,_0x4f8ff6){const _0x172b79=this['editor']['locale'];if('object'==typeof _0x2e1cd9)return _0x2e1cd9;try{return await _0x2e1cd9(_0x4f8ff6);}catch{return Promise['reject'](new AIRequestError(Si(_0x172b79,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x4992b9){super(_0x4992b9),_0x4992b9['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x4992b9['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x4992b9['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x4992b9['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x4992b9['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x4992b9['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x1822e8,context:_0x22bc21,onData:_0x15448a,actionId:_0x292adb}){const _0x2d6f38=this['editor']['locale'],_0x4a4fc0=await this['prepareMessages'](_0x1822e8,_0x22bc21,_0x292adb),_0x2b3bba=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x292adb),_0xe8e8cb=await this['_prepareRequestParameters'](this['_requestParameters'],_0x292adb),_0x1c55c6={'messages':_0x4a4fc0,..._0xe8e8cb},_0x368df5={'method':'POST','headers':_0x2b3bba,'body':JSON['stringify'](_0x1c55c6),'signal':this['abortController']['signal']},_0xf7c715=await fetch(this['_apiUrl'],_0x368df5);if(_0xf7c715['ok'])return _0xe8e8cb['stream']?await this['_readStreamableResponse'](_0xf7c715,_0x15448a):await this['_readStaticResponse'](_0xf7c715,_0x15448a),Promise['resolve']();{const _0x3dd9da=await _0xf7c715['text']();return _0x3dd9da['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x2d6f38,'AI_ERROR_CONTEXT_LENGTH'))):_0x3dd9da['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x2d6f38,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x3dd9da));}}async['prepareMessages'](_0x14f379,_0x5d2213,_0x6248a8){let _0x3f74bf,_0x96b9ac;return _0x5d2213?(_0x3f74bf='Your\x20task\x20is\x20to\x20execute\x20the\x20instruction\x20using\x20the\x20provided\x20HTML\x20content.\x20Follow\x20the\x20instruction\x20closely.\x20Your\x20answer\x20must\x20be\x20a\x20properly\x20formatted\x20HTML\x20code.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x96b9ac='Instruction:\x0a'+_0x14f379+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x5d2213):(_0x3f74bf='Your\x20task\x20is\x20to\x20generate\x20HTML\x20content\x20accordingly\x20to\x20the\x20given\x20instruction.\x20Never\x20include\x20<img>\x20tag\x20in\x20your\x20response\x20even\x20if\x20asked\x20for.\x20Your\x20answer\x20must\x20be\x20a\x20well-structured\x20and\x20properly\x20formatted\x20HTML\x20code.\x20Answer\x20only\x20with\x20the\x20generated\x20HTML\x20content.\x20Do\x20not\x20add\x20any\x20additional\x20remarks\x20or\x20notes.\x20Do\x20not\x20act\x20like\x20a\x20chatbot\x20or\x20a\x20real\x20person.',_0x96b9ac=_0x14f379),[{'role':'system','content':_0x3f74bf},{'role':'user','content':_0x96b9ac}];}async['_readStreamableResponse'](_0x2cd36e,_0x4623c2){const _0xb400d0=_0x2cd36e['body']['getReader'](),_0x560dd2=new TextDecoder();let _0x53360f='',_0x35b0fa='',_0x521b97='',_0x5d2c61=!0x1;for(;!_0x5d2c61;){const {done:_0x55bd2d,value:_0xd564ba}=await _0xb400d0['read'](),_0x11be06=_0x53360f+_0x560dd2['decode'](_0xd564ba);let _0x553294='';_0x5d2c61=_0x55bd2d;try{_0x553294=this['_cleanUpData'](_0x11be06),_0x53360f='';}catch{_0x53360f=_0x11be06;continue;}_0x35b0fa+=_0x553294,!_0x5d2c61&&this['_isBufferIncomplete'](_0x35b0fa)||_0x35b0fa&&(_0x521b97+=_0x35b0fa,_0x35b0fa='',_0x4623c2(_0x521b97));}return Promise['resolve']();}async['_readStaticResponse'](_0x30c433,_0x760eb6){return _0x760eb6((await _0x30c433['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x445d51){const _0xd529f2=_0x445d51['split']('<')['length']!==_0x445d51['split']('>')['length'],_0x35a616=_0x445d51['length']<0x1e;return _0xd529f2&&_0x35a616;}['_cleanUpData'](_0x49b083){return _0x49b083['split'](/\n(?![^{]*\})/g)['map'](_0x5833cb=>_0x5833cb['replace']('data:\x20',''))['filter'](_0x5260e5=>_0x5260e5&&_0x5260e5['length']>0x0&&'[DONE]'!==_0x5260e5)['map'](_0x28b758=>{const {choices:_0x4baa07}=JSON['parse'](_0x28b758);if(_0x4baa07[0x0]?.['delta']?.['content'])return _0x4baa07[0x0]['delta']['content'];})['filter'](_0x1cf9e4=>_0x1cf9e4)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x23f3de){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x1da6f8,_0x5f3256={}){super(_0x1da6f8),this['isToggleable']=!0x0,this['set']('side',_0x5f3256['side']||'top');const _0x3cd639=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x5f3256['class']||[]),_0x3cd639['to']('side',_0xb9d30f=>'ck-tab-button_'+_0xb9d30f),_0x3cd639['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x350482,_0x819551={}){super(_0x350482);const _0x75811f=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x819551['class']||[]),_0x75811f['to']('class'),_0x75811f['if']('isVisible','ck-hidden',_0x5ee4b8=>!_0x5ee4b8)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x55f44f,_0xc9a65b={}){super(_0x55f44f),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0xc9a65b['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0xc9a65b['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x4b6cfa,_0x41f25b)=>_0x4b6cfa&&null!==_0x41f25b);const _0x1772c4=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0xc9a65b['class']||[]),_0x1772c4['to']('side',_0x3f93ec=>'ck-tabs_'+_0x3f93ec),_0x1772c4['to']('class'),_0x1772c4['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x1772c4['to']('activeTab',_0x14d1e2=>null===_0x14d1e2?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x1772c4['to']('side',_0x477f9a=>'ck-tabs__buttons-container_'+_0x477f9a)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x1772c4['to']('side',_0x33f9b6=>'ck-tabs__panels-container_'+_0x33f9b6)]},'children':this['panelViews']},...mt(_0xc9a65b['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x1fcc0e){const _0xe71dfb=this['_tabs']['get'](_0x1fcc0e);return _0xe71dfb||null;}['addTab'](_0x1a9eac){const _0x529b50=this['_setupButton']({'id':_0x1a9eac['id'],'label':_0x1a9eac['buttonLabel'],'icon':_0x1a9eac['buttonIcon'],'order':_0x1a9eac['order']}),_0x1b766f=new TabPanelView(this['locale']);return _0x1b766f['render'](),_0x1a9eac['content']&&_0x1b766f['children']['add'](_0x1a9eac['content']),this['panelViews']['add'](_0x1b766f),this['_tabs']['set'](_0x1a9eac['id'],{'button':_0x529b50,'panel':_0x1b766f,'order':void 0x0!==_0x1a9eac['order']?_0x1a9eac['order']:null}),this['fire']('addTab:'+_0x1a9eac['id'],{'id':_0x1a9eac['id'],'button':_0x529b50,'panel':_0x1b766f}),null===this['activeTab']?this['activateTab'](_0x1a9eac['id']):this['_hidePanel'](_0x1a9eac['id']),{'button':_0x529b50,'panel':_0x1b766f};}['activateTab'](_0x16c94c){if(null!==_0x16c94c&&!this['getTab'](_0x16c94c))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x16c94c});if(this['activeTab']===_0x16c94c)return;const _0x4a38f2=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x16c94c,_0x16c94c&&this['_showPanel'](_0x16c94c),this['fire']('activateTab:'+_0x16c94c,{'newTab':_0x16c94c,'oldTab':_0x4a38f2});}['toggleTabPanel'](_0x39fea3){if(!this['getTab'](_0x39fea3))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x39fea3});this['activeTab']===_0x39fea3?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x39fea3);}['showTab'](_0xdc6b5c){if(!this['getTab'](_0xdc6b5c))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xdc6b5c});this['_showPanel'](_0xdc6b5c),this['_showButton'](_0xdc6b5c),this['fire']('show:'+_0xdc6b5c,_0xdc6b5c);}['hideTab'](_0x376430){if(!this['getTab'](_0x376430))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x376430});const _0x4d8ec5=this['activeTab'];this['_hidePanel'](_0x376430),this['_hideButton'](_0x376430);const _0x5165c0=this['getTabIds']();_0x4d8ec5===_0x376430&&_0x5165c0['length']>0x1&&this['activateTab'](_0x5165c0['find'](_0x11bf56=>_0x11bf56!==_0x376430)),this['fire']('hide:'+_0x376430,_0x376430);}['_getPanel'](_0x20cb3c){const _0x53e5e4=this['_tabs']['get'](_0x20cb3c);return _0x53e5e4?_0x53e5e4['panel']:null;}['_showPanel'](_0x3e70d2){null!==this['activeTab']&&this['activeTab']!==_0x3e70d2||this['_getPanel'](_0x3e70d2)['show']();}['_hidePanel'](_0x391c4b){const _0x3bc055=this['_getPanel'](_0x391c4b);_0x3bc055['isVisible']&&(this['activeTab']===_0x391c4b&&(this['activeTab']=null),_0x3bc055['hide']());}['_getButton'](_0x3bdf41){const _0x4ee0fe=this['_tabs']['get'](_0x3bdf41);return _0x4ee0fe?_0x4ee0fe['button']:null;}['_showButton'](_0x3b423f){this['_getButton'](_0x3b423f)['show']();}['_hideButton'](_0x33446c){this['_getButton'](_0x33446c)['hide']();}['_setupButton'](_0x6af0e4){const _0x4ac7c6=new TabButtonView(this['locale'],{'side':this['side']}),_0x1bbb10=this['buttonViews'];if(_0x4ac7c6['set']({'label':_0x6af0e4['label'],'icon':_0x6af0e4['icon'],'tooltip':!0x0,'withText':!0x0}),_0x4ac7c6['bind']('isOn')['to'](this,'activeTab',_0x3bae61=>_0x3bae61===_0x6af0e4['id']),_0x4ac7c6['bind']('side')['to'](this,'side'),_0x6af0e4['order']){const _0x5881ea=[...this['_tabs']]['reduce']((_0x15ca50,_0x54f8a0)=>{const _0x1dcc34=_0x54f8a0[0x0],{order:_0x33d647}=_0x54f8a0[0x1];return!_0x33d647||_0x33d647>_0x6af0e4['order']?_0x15ca50:_0x33d647>=_0x15ca50['order']?{'id':_0x1dcc34,'order':_0x33d647}:_0x15ca50;},{'id':'','order':0x0}),_0x46ade2=_0x1bbb10['getIndex'](this['_getButton'](_0x5881ea['id']));_0x1bbb10['add'](_0x4ac7c6,_0x46ade2+0x1);}else _0x1bbb10['add'](_0x4ac7c6);return _0x4ac7c6['on']('execute',()=>{this['toggleTabPanel'](_0x6af0e4['id']);}),_0x4ac7c6;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x4f82f5,_0x1fadfa={}){super(_0x4f82f5,_0x1fadfa),this['set']('type',_0x1fadfa['type']||'sidebar'),this['set']('side',_0x1fadfa['side']||'right'),this['set']('isVisible',_0x1fadfa['visibleByDefault']??!0x0);const _0x18b336=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x18b336['if']('type','ck-ai-tabs__overlay',_0x53540d=>'overlay'===_0x53540d),_0x18b336['if']('type','ck-ai-tabs__sidebar',_0x3a2df0=>'sidebar'===_0x3a2df0),_0x18b336['if']('isVisible','ck-hidden',_0x20f1a0=>!_0x20f1a0)]}}),this['buttonViews']['on']('add',(_0x209f15,_0x4b68d4)=>{_0x4b68d4['set']('withText',!0x1);});}}class AITabs extends _0x2e5d09{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x18590e){if(super(_0x18590e),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x5353ba=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x5353ba['showResizeButton']&&(this['showResizeButton']=_0x5353ba['showResizeButton']),'sidebar'!==_0x5353ba['type']&&'overlay'!==_0x5353ba['type']||_0x5353ba['side']&&(this['side']=_0x5353ba['side']),'sidebar'===_0x5353ba['type']){if(this['container']=_0x5353ba['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x5353ba['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x5353ba['visibleByDefault'],'collapsible':_0x5353ba['collapsible']}),this['view']['render'](),this['view']['bind']('side')['to'](this,'side'),this['view']['bind']('type')['to'](this,'type'),this['container']&&this['container']['appendChild'](this['view']['element']),this['context']instanceof _0x435807&&this['context']['ui']['focusTracker']['add'](this['view']['element']),this['listenTo'](this,'resizeTabs',()=>{this['view']['isMaximized']=!this['view']['isMaximized'],this['fire']('resizedTabs',this['view']['isMaximized']);});}['switchType'](_0x3aecfb){if(_0x3aecfb&&this['type']!==_0x3aecfb){if(!Vi['includes'](_0x3aecfb))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x3aecfb;}}['switchSide'](_0x3f2336){if(_0x3f2336&&this['side']!==_0x3f2336){if(!Hi['includes'](_0x3f2336))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x3f2336;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x2e5d09{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x8b5fd0];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4ec5b1){if(super(_0x4ec5b1),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x4e15cf=this['context']['plugins']['get'](_0x8b5fd0);if(!_0x4e15cf['token'])throw new ht('ai-missing-token',this);this['_token']=_0x4e15cf['token'];}['startConversation'](_0x49e30c,_0x37619f){const _0x286542=this['_sendApiRequest']('/conversations','POST',{'id':_0x49e30c,'group':_0x37619f});return{'getConversation':async()=>(await _0x286542['request'])['json'](),'abortController':_0x286542['abortController']};}['queryAssistant']({message:_0x2a28bd,conversationId:_0x5dcbb0,parts:_0x110446,capabilities:_0x241876,model:_0x555195,attributes:_0x34552f}){const _0x5e93af={'prompt':_0x2a28bd,'content':_0x110446,'model':_0x555195,..._0x241876&&{'capabilities':_0x241876},..._0x34552f&&{'attributes':_0x34552f}},_0x127aec=this['_sendApiRequest']('/conversations/'+_0x5dcbb0+'/messages','POST',_0x5e93af,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0xb8da5b=(await _0x127aec['request'])['body'];return this['_getStreamReader'](_0xb8da5b);},'abortController':_0x127aec['abortController']};}['executeCustomAction']({content:_0x3be8e0,message:_0x4fd4c0,model:_0x26da8c,outputFormat:_0x1b1176}){const _0x370863={'content':[{'type':'text','content':_0x3be8e0}],'prompt':_0x4fd4c0,'model':_0x26da8c,'outputFormat':_0x1b1176},_0x42d4d4=this['_sendApiRequest']('/actions/custom/calls','POST',_0x370863);return{'getStream':async()=>{const _0x5c9bab=(await _0x42d4d4['request'])['body'];return this['_getStreamReader'](_0x5c9bab);},'abortController':_0x42d4d4['abortController']};}['executeAction']({actionName:_0x4411fc,content:_0x3c1a81,args:_0x586bc9}){const _0x1d1147={'content':[{'type':'text','content':_0x3c1a81}],'args':_0x586bc9},_0x1c71af=this['_sendApiRequest']('/actions/system/'+_0x4411fc+'/calls','POST',_0x1d1147);return{'getStream':async()=>{const _0x2c083b=(await _0x1c71af['request'])['body'];return this['_getStreamReader'](_0x2c083b);},'abortController':_0x1c71af['abortController']};}['uploadFile'](_0xd092d0,_0x562f6f,_0xf889e8){const _0xa2aa09=new FormData();_0xa2aa09['append']('file',_0x562f6f,_0x562f6f['name']),_0xf889e8&&_0xa2aa09['append']('attributes',JSON['stringify'](_0xf889e8));const _0x2f8332=this['_sendApiRequest']('/conversations/'+_0xd092d0+'/files','POST',_0xa2aa09);return{'getId':async()=>(await _0x2f8332['request'])['json'](),'abortController':_0x2f8332['abortController']};}['fetchDocument'](_0x5a8a54,_0xebb1f6){const _0x56931d=this['_sendApiRequest']('/conversations/'+_0x5a8a54+'/documents/'+_0xebb1f6,'GET');return{'getDocument':async()=>(await _0x56931d['request'])['json'](),'abortController':_0x56931d['abortController']};}['uploadDocument'](_0x435461,_0x1751c4,_0x49c772){const _0x4f9843={'content':_0x1751c4};_0x49c772&&(_0x4f9843['attributes']=_0x49c772);const _0xbcfbf8=this['_sendApiRequest']('/conversations/'+_0x435461+'/documents','POST',_0x4f9843);return{'getId':async()=>(await _0xbcfbf8['request'])['json'](),'abortController':_0xbcfbf8['abortController']};}['uploadDocuments'](_0x68d83d,_0x3ada88){const _0x19ff81={'documents':_0x3ada88['map'](_0x24c2d0=>({'content':_0x24c2d0['content'],'attributes':{'version':_0x24c2d0['version'],'sessionId':_0x24c2d0['sessionId'],'channelId':_0x24c2d0['channelId'],'rootName':_0x24c2d0['rootName'],'selections':_0x24c2d0['selections']},...void 0x0!==_0x24c2d0['name']?{'name':_0x24c2d0['name']}:{},...void 0x0!==_0x24c2d0['description']?{'description':_0x24c2d0['description']}:{}}))},_0x515e34=this['_sendApiRequest']('/conversations/'+_0x68d83d+'/documents/batch','POST',_0x19ff81);return{'getIds':async()=>(await _0x515e34['request'])['json'](),'abortController':_0x515e34['abortController']};}['fetchDocuments'](_0xf7130a,_0x3b1c42){const _0x1a2d76=new URLSearchParams();_0x1a2d76['append']('documentIds',_0x3b1c42['join'](','));const _0x3fbff7=this['_sendApiRequest']('/conversations/'+_0xf7130a+'/documents/batch?'+_0x1a2d76['toString'](),'GET');return{'getDocuments':async()=>(await _0x3fbff7['request'])['json'](),'abortController':_0x3fbff7['abortController']};}['fetchConversations'](_0x2e674a,_0x4318e9={}){const _0x14d947=new URLSearchParams();_0x14d947['append']('group',_0x2e674a),_0x14d947['append']('excludeEmpty',!0x1!==_0x4318e9['excludeEmpty']?'true':'false'),_0x14d947['append']('limit',_0x4318e9['limit']?_0x4318e9['limit']['toString']():'100'),_0x14d947['append']('sortBy',_0x4318e9['sortBy']?_0x4318e9['sortBy']:'createdAt'),_0x14d947['append']('order',_0x4318e9['order']?_0x4318e9['order']:'desc');const _0x21eadc=this['_sendApiRequest']('/conversations?'+_0x14d947['toString'](),'GET');return{'getConversations':async()=>{const _0x2257b9=await _0x21eadc['request'];return(await _0x2257b9['json']())['items'];},'abortController':_0x21eadc['abortController']};}['deleteConversation'](_0x3515b8){const _0x45b7f6=this['_sendApiRequest']('/conversations/'+_0x3515b8,'DELETE');return{'execute':async()=>{await _0x45b7f6['request'];},'abortController':_0x45b7f6['abortController']};}['updateConversation'](_0x3281b6,_0x3714b0){const _0x44ac65=this['_sendApiRequest']('/conversations/'+_0x3281b6,'PATCH',_0x3714b0);return{'getResult':async()=>(await _0x44ac65['request'],_0x3714b0),'abortController':_0x44ac65['abortController']};}['fetchConversation'](_0x1127f3){const _0x4cf97b=this['_sendApiRequest']('/conversations/'+_0x1127f3,'GET');return{'getConversation':async()=>(await _0x4cf97b['request'])['json'](),'abortController':_0x4cf97b['abortController']};}['fetchConversationMessages'](_0x42eef5){const _0x9e48e=this['_sendApiRequest']('/conversations/'+_0x42eef5+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x2a5c29=await _0x9e48e['request'];return(await _0x2a5c29['json']())['items'];},'abortController':_0x9e48e['abortController']};}['uploadUrl'](_0x46a49e,_0x5679ae,_0x2cbae6){const _0x1c0b1e=this['_sendApiRequest']('/conversations/'+_0x46a49e+'/web-resources','POST',{'url':_0x5679ae,'attributes':_0x2cbae6});return{'getId':async()=>(await _0x1c0b1e['request'])['json'](),'abortController':_0x1c0b1e['abortController']};}['getModels'](_0x25ef25='en'){const _0xb426fe=new URLSearchParams();_0xb426fe['append']('language',_0x25ef25);const _0x3ef12b='/models/1?'+_0xb426fe['toString'](),_0xa7f5ed=this['_sendApiRequest'](_0x3ef12b,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0xa7f5ed['request'])['json'](),'abortController':_0xa7f5ed['abortController']};}['deleteFile'](_0x4c6f03,_0x59b8c4){const _0x5c2717=this['_sendApiRequest']('/conversations/'+_0x4c6f03+'/files/'+_0x59b8c4,'DELETE');return{'execute':async()=>{await _0x5c2717['request'];},'abortController':_0x5c2717['abortController']};}['deleteDocument'](_0x2ae838,_0x5b88dc){const _0x46a452=this['_sendApiRequest']('/conversations/'+_0x2ae838+'/documents/'+_0x5b88dc,'DELETE');return{'execute':async()=>{await _0x46a452['request'];},'abortController':_0x46a452['abortController']};}['deleteWebResource'](_0x3ac1d9,_0x7e3e76){const _0x4f73ad=this['_sendApiRequest']('/conversations/'+_0x3ac1d9+'/web-resources/'+_0x7e3e76,'DELETE');return{'execute':async()=>{await _0x4f73ad['request'];},'abortController':_0x4f73ad['abortController']};}['cancelStream'](_0x330e13,_0x1a6a58){const _0x3cf284=this['_sendApiRequest']('/conversations/'+_0x330e13+'/messages/'+_0x1a6a58+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x3cf284['request'];},'abortController':_0x3cf284['abortController']};}['resumeStream'](_0x352024,_0x106791,_0x56105d='0-0'){const _0x8ef887=new URLSearchParams({'lastEventId':_0x56105d}),_0x1e5343=this['_sendApiRequest']('/conversations/'+_0x352024+'/messages/'+_0x106791+'/stream?'+_0x8ef887['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x1488ca=await _0x1e5343['request'];return this['_getStreamReader'](_0x1488ca['body']);},'abortController':_0x1e5343['abortController']};}['callSystemReview']({reviewName:_0x3293e4,content:_0x152b10,args:_0x4fbe26}){const _0x40ed7e=this['_sendApiRequest']('/reviews/system/'+_0x3293e4+'/calls','POST',{'content':[{'type':'text','content':_0x152b10}],'args':_0x4fbe26});return{'getStream':async()=>{const _0x54218d=(await _0x40ed7e['request'])['body'];return this['_getStreamReader'](_0x54218d);},'abortController':_0x40ed7e['abortController']};}['callCustomReview']({content:_0x3ee7e9,prompt:_0x2c1acc,model:_0x1b86b3}){const _0x46294d=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x3ee7e9}],'prompt':_0x2c1acc,'model':_0x1b86b3});return{'getStream':async()=>{const _0x59e6b5=(await _0x46294d['request'])['body'];return this['_getStreamReader'](_0x59e6b5);},'abortController':_0x46294d['abortController']};}['upsertAIChatRating'](_0x204e35,_0x127c59,_0x5245f6){const _0x4413de=this['_sendApiRequest']('/conversations/'+_0x204e35+'/messages/'+_0x127c59+'/ratings','PUT',{'positiveCount':_0x5245f6['positiveCount'],'totalCount':_0x5245f6['totalCount'],'modificationId':_0x5245f6['modificationId']});return{'execute':async()=>{await _0x4413de['request'];},'abortController':_0x4413de['abortController']};}['upsertAIActionRating'](_0x116e0b,_0x14c2f4,_0x525c4a){const _0x2a168a=this['_sendApiRequest']('/actions/system/'+_0x116e0b+'/calls/'+_0x14c2f4+'/ratings','PUT',{'positiveCount':_0x525c4a['positiveCount'],'totalCount':_0x525c4a['totalCount']});return{'execute':async()=>{await _0x2a168a['request'];},'abortController':_0x2a168a['abortController']};}['upsertCustomAIActionRating'](_0x5ee84e,_0x4247dc){const _0x4eb4e2=this['_sendApiRequest']('/actions/custom/calls/'+_0x5ee84e+'/ratings','PUT',{'positiveCount':_0x4247dc['positiveCount'],'totalCount':_0x4247dc['totalCount']});return{'execute':async()=>{await _0x4eb4e2['request'];},'abortController':_0x4eb4e2['abortController']};}['upsertAIReviewRating'](_0x51f6df,_0x47a61d,_0x547684,_0x14d9c9){const _0x43d8ff=this['_sendApiRequest']('/reviews/system/'+_0x51f6df+'/calls/'+_0x47a61d+'/ratings','PUT',{'positiveCount':_0x547684['positiveCount'],'totalCount':_0x547684['totalCount'],'dataId':_0x14d9c9});return{'execute':async()=>{await _0x43d8ff['request'];},'abortController':_0x43d8ff['abortController']};}['upsertCustomAIReviewRating'](_0x19626a,_0x364f5c,_0x46b1fb){const _0x239dd6=this['_sendApiRequest']('/reviews/custom/calls/'+_0x19626a+'/ratings','PUT',{'positiveCount':_0x364f5c['positiveCount'],'totalCount':_0x364f5c['totalCount'],'dataId':_0x46b1fb});return{'execute':async()=>{await _0x239dd6['request'];},'abortController':_0x239dd6['abortController']};}['_sendApiRequest'](_0x12822a,_0x22e523,_0x105f60,_0x2056fb={}){const {useCache:_0xb69664=!0x1,apiUrl:_0x5ca9e5=this['_apiUrl']}=_0x2056fb,_0x4eb4a9=new AbortController(),_0x5ac4f6=_0xb69664?_0x22e523+':'+_0x12822a:null;if(_0x5ac4f6){const _0x5e1619=this['_responseCache']['get'](_0x5ac4f6);if(_0x5e1619)return{'request':_0x5e1619['then'](_0x25b125=>_0x25b125['clone']()),'abortController':_0x4eb4a9};}const _0x139096=_0x105f60 instanceof FormData,_0x104f6e={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x105f60&&!_0x139096&&(_0x104f6e['Content-Type']='application/json');const _0x1960c7={'method':_0x22e523,'headers':_0x104f6e,'signal':_0x4eb4a9['signal']};_0x105f60&&(_0x1960c7['body']=_0x139096?_0x105f60:JSON['stringify'](_0x105f60));const _0x188782=fetch(''+_0x5ca9e5+_0x12822a,_0x1960c7)['catch'](_0x1091cb=>{_0x5ac4f6&&this['_responseCache']['delete'](_0x5ac4f6),this['_handleError'](_0x1091cb);})['then'](_0x3ed5ac=>_0x3ed5ac['ok']?_0x3ed5ac:_0x3ed5ac['json']()['then'](_0x2eedf8=>{throw _0x5ac4f6&&this['_responseCache']['delete'](_0x5ac4f6),{'url':_0x5ca9e5,'path':_0x12822a,'method':_0x22e523,'body':_0x105f60,'status':(_0x3ed5ac||{})['status'],'statusText':(_0x3ed5ac||{})['statusText'],'code':_0x2eedf8['code'],'message':_0x2eedf8['message'],'traceId':_0x2eedf8['traceId']};}));return _0x5ac4f6&&this['_responseCache']['set'](_0x5ac4f6,_0x188782['then'](_0x53505c=>_0x53505c['clone']())),{'request':_0x188782,'abortController':_0x4eb4a9};}async*['_getStreamReader'](_0x21d720){const _0x20727b=[],_0x3745d4=_0x21d720['getReader'](),_0x841b0a=_0xa89478({'onError':_0x42b984=>{this['_handleError'](_0x42b984);},'onEvent':_0x38a35e=>{_0x38a35e['data']=JSON['parse'](_0x38a35e['data']),_0x20727b['push'](_0x38a35e);}});try{let _0x355041=!0x1;for(;!_0x355041;){const {done:_0x22a3c3,value:_0x5d4733}=await _0x3745d4['read']();_0x22a3c3&&(_0x355041=!0x0),_0x841b0a['feed'](this['_decoder']['decode'](_0x5d4733,{'stream':!0x0})),yield*_0x20727b,_0x20727b['length']=0x0;}}catch(_0x3cfd53){this['_handleError'](_0x3cfd53);}finally{_0x3745d4['releaseLock'](),_0x841b0a['reset']();}}['_handleError'](_0x2b41d5){if(_0x2b41d5 instanceof ht)throw _0x2b41d5;if(_0x2b41d5 instanceof Error&&'AbortError'===_0x2b41d5['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x2b41d5});throw new ht('ai-request-failed',this,{'originalError':_0x2b41d5});}}function Mi(_0x5ddc1e,_0xd5fe9f,_0x17740b){const t=_0x5ddc1e['t'];switch(_0xd5fe9f){case'AI_SUGGESTION_HEADER_TITLE':return t({'id':'AI_SUGGESTION_HEADER_TITLE','string':'Proposed\x20changes'});case'AI_SUGGESTION_BUTTON_SHOW_CHANGES':return t({'id':'AI_SUGGESTION_BUTTON_SHOW_CHANGES','string':'Show\x20details'});case'AI_MINI_TOOLBAR_LIKE':return t({'id':'AI_MINI_TOOLBAR_LIKE','string':'I\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_DISLIKE':return t({'id':'AI_MINI_TOOLBAR_DISLIKE','string':'I\x20don\x27t\x20like\x20this\x20response'});case'AI_MINI_TOOLBAR_COPY':return t({'id':'AI_MINI_TOOLBAR_COPY','string':'Copy\x20to\x20clipboard'});case'AI_SUGGESTION_CONTENT_PART_TITLE':return t({'id':'AI_SUGGESTION_CONTENT_PART_TITLE','string':'Change\x20%0'},_0x17740b);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x17740b);case'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED':return t({'id':'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED','string':'Folders\x20cannot\x20be\x20added\x20to\x20the\x20chat.\x20Try\x20adding\x20individual\x20files\x20instead.'});case'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES','string':'Unable\x20to\x20load\x20resources\x20from\x20%0.\x20Please\x20try\x20again.'},_0x17740b);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x17740b);case'AI_CHAT_CONTEXT_INVALID_DATA':return t({'id':'AI_CHAT_CONTEXT_INVALID_DATA','string':'Invalid\x20context\x20data\x20type\x20for\x20the\x20selected\x20resource.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE','string':'Unsupported\x20resource\x20type.\x20Only\x20files\x20and\x20URLs\x20are\x20supported.'});case'AI_CHAT_CONTEXT_URL_EMPTY_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_EMPTY_ERROR','string':'URL\x20cannot\x20be\x20empty.'});case'AI_CHAT_CONTEXT_URL_INVALID_ERROR':return t({'id':'AI_CHAT_CONTEXT_URL_INVALID_ERROR','string':'Please\x20enter\x20a\x20valid\x20URL.'});case'AI_CHAT_INVALID_REQUEST':return t({'id':'AI_CHAT_INVALID_REQUEST','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE':return t({'id':'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE','string':'The\x20file\x20type\x20is\x20not\x20supported.\x20Please\x20upload\x20a\x20different\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_LARGE':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_LARGE','string':'The\x20file\x20is\x20too\x20large.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES':return t({'id':'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES','string':'The\x20file\x20has\x20too\x20many\x20pages.\x20Please\x20upload\x20a\x20file\x20with\x20fewer\x20pages.'});case'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED':return t({'id':'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED','string':'The\x20form\x20data\x20size\x20limits\x20are\x20exceeded.\x20Please\x20upload\x20a\x20smaller\x20file.'});case'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR','string':'AI\x20is\x20preparing\x20a\x20response...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH','string':'AI\x20is\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_REASONING','string':'AI\x20is\x20using\x20reasoning\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING','string':'AI\x20is\x20using\x20reasoning\x20and\x20searching\x20the\x20web\x20to\x20provide\x20the\x20most\x20accurate\x20answer...'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH','string':'Scanned\x20the\x20internet\x20for\x20insights'});case'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING','string':'AI\x20used\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING':return t({'id':'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING','string':'AI\x20used\x20search\x20and\x20reasoning\x20to\x20improve\x20the\x20response'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR','string':'Ask\x20AI\x20anything...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH','string':'Ask\x20AI\x20anything\x20(web\x20search\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING','string':'Ask\x20AI\x20anything\x20(reasoning\x20enabled)...'});case'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING':return t({'id':'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING','string':'Ask\x20AI\x20anything\x20(web\x20search\x20and\x20reasoning\x20enabled)...'});case'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL','string':'Suggest\x20all'},_0x17740b);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x17740b);case'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL','string':'Apply\x20all'});case'AI_CHAT_SUGGESTION_ACTION_APPLY':return t({'id':'AI_CHAT_SUGGESTION_ACTION_APPLY','string':'Apply'});case'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP':return t({'id':'AI_CHAT_SUGGESTION_MORE_OPTIONS_TOOLTIP','string':'More\x20options'},_0x17740b);case'AI_CHAT_MODEL_SELECTOR_GROUP':return t({'id':'AI_CHAT_MODEL_SELECTOR_GROUP','string':'Models'});case'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP','string':'Select\x20a\x20model'});case'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP':return t({'id':'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP','string':'Start\x20a\x20new\x20conversation\x20to\x20change\x20the\x20model'});case'AI_CHAT_CAPABILITIES_YES':return t({'id':'AI_CHAT_CAPABILITIES_YES','string':'Yes'});case'AI_CHAT_CAPABILITIES_NO':return t({'id':'AI_CHAT_CAPABILITIES_NO','string':'No'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT','string':'The\x20selected\x20model\x20is\x20no\x20longer\x20available,\x20so\x20you\x20cannot\x20continue\x20this\x20conversation.\x20Please\x20'});case'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON':return t({'id':'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON','string':'start\x20a\x20new\x20one.'});case'AI_CHAT_CONTEXT_SOURCES_LABEL':return t({'id':'AI_CHAT_CONTEXT_SOURCES_LABEL','string':'Sources'});case'AI_CHAT_HISTORY_HEADING':return t({'id':'AI_CHAT_HISTORY_HEADING','string':'Chat\x20History'});case'AI_CHAT_HISTORY_SEARCH_LABEL':return t({'id':'AI_CHAT_HISTORY_SEARCH_LABEL','string':'Search\x20history'});case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY','string':'No\x20chats\x20were\x20found\x20matching\x20\x22%0\x22.'},_0x17740b);case'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY':return t({'id':'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY','string':'Please\x20try\x20a\x20different\x20phrase\x20or\x20check\x20the\x20spelling.'});case'AI_CHAT_HISTORY_EMPTY_MESSAGE':return t({'id':'AI_CHAT_HISTORY_EMPTY_MESSAGE','string':'Your\x20chat\x20history\x20for\x20current\x20document\x20will\x20appear\x20here.'});case'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON':return t({'id':'AI_CHAT_HISTORY_GO_TO_CHAT_BUTTON','string':'Go\x20to\x20chat'});case'AI_CHAT_HISTORY_PIN_BUTTON':return t({'id':'AI_CHAT_HISTORY_PIN_BUTTON','string':'Pin'});case'AI_CHAT_HISTORY_SHOW_MORE_ITEMS':return t({'id':'AI_CHAT_HISTORY_SHOW_MORE_ITEMS','string':'Show\x20more\x20items'});case'AI_CHAT_HISTORY_EDIT_NAME':return t({'id':'AI_CHAT_HISTORY_EDIT_NAME','string':'Edit\x20name'});case'AI_CHAT_HISTORY_REMOVE':return t({'id':'AI_CHAT_HISTORY_REMOVE','string':'Remove'});case'AI_CHAT_HISTORY_REMOVE_CONFIRM':return t({'id':'AI_CHAT_HISTORY_REMOVE_CONFIRM','string':'Do\x20you\x20want\x20to\x20remove\x20this\x20chat?'});case'AI_CHAT_HISTORY_ACCEPT':return t({'id':'AI_CHAT_HISTORY_ACCEPT','string':'Accept'});case'AI_CHAT_HISTORY_CANCEL':return t({'id':'AI_CHAT_HISTORY_CANCEL','string':'Cancel'});case'AI_CHAT_HISTORY_LOADING_REMOVING':return t({'id':'AI_CHAT_HISTORY_LOADING_REMOVING','string':'Removing\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_RENAMING':return t({'id':'AI_CHAT_HISTORY_LOADING_RENAMING','string':'Renaming\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_PINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_PINNING','string':'Pinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_LOADING_UNPINNING':return t({'id':'AI_CHAT_HISTORY_LOADING_UNPINNING','string':'Unpinning\x20the\x20chat...'});case'AI_CHAT_HISTORY_CATEGORY_PINNED':return t({'id':'AI_CHAT_HISTORY_CATEGORY_PINNED','string':'Pinned'});case'AI_CHAT_HISTORY_CATEGORY_TODAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_TODAY','string':'Today'});case'AI_CHAT_HISTORY_CATEGORY_YESTERDAY':return t({'id':'AI_CHAT_HISTORY_CATEGORY_YESTERDAY','string':'Yesterday'});case'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS','string':'Last\x2014\x20days'});case'AI_CHAT_HISTORY_CATEGORY_LATER':return t({'id':'AI_CHAT_HISTORY_CATEGORY_LATER','string':'Later'});case'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE','string':'Failed\x20to\x20change\x20the\x20\x22%0\x22\x20chat\x20name.\x20Please\x20try\x20again\x20later.'},_0x17740b);case'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED':return t({'id':'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED','string':'Failed\x20to\x20%0\x20the\x20\x22%1\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x17740b);case'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM':return t({'id':'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM','string':'Failed\x20to\x20delete\x20the\x20\x22%0\x22\x20chat.\x20Please\x20try\x20again\x20later.'},_0x17740b);case'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS':return t({'id':'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS','string':'Failed\x20to\x20load\x20the\x20chat\x20history.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_ERROR_GENERIC':return t({'id':'AI_CHAT_HISTORY_ERROR_GENERIC','string':'Something\x20went\x20wrong.\x20Please\x20try\x20again\x20later.'});case'AI_CHAT_HISTORY_PIN_ACTION':return t({'id':'AI_CHAT_HISTORY_PIN_ACTION','string':'pin'});case'AI_CHAT_HISTORY_UNPIN_ACTION':return t({'id':'AI_CHAT_HISTORY_UNPIN_ACTION','string':'unpin'});case'AI_BALLOON_HEADER_TITLE':return t({'id':'AI_BALLOON_HEADER_TITLE','string':'Change\x20%0'},_0x17740b);case'AI_BALLOON_APPLY_BUTTON':return t({'id':'AI_BALLOON_APPLY_BUTTON','string':'Apply'});case'AI_BALLOON_SUGGEST_BUTTON':return t({'id':'AI_BALLOON_SUGGEST_BUTTON','string':'Suggest'});case'AI_BALLOON_NEXT_LABEL':return t({'id':'AI_BALLOON_NEXT_LABEL','string':'Next'});case'AI_BALLOON_PREVIOUS_LABEL':return t({'id':'AI_BALLOON_PREVIOUS_LABEL','string':'Previous'});case'AI_SUGGESTION_NO_PARTS_WARNING':return t({'id':'AI_SUGGESTION_NO_PARTS_WARNING','string':'This\x20change\x20is\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_SUGGESTION_EMPTY_PART_WARNING':return t({'id':'AI_SUGGESTION_EMPTY_PART_WARNING','string':'Some\x20of\x20the\x20changes\x20are\x20not\x20supported\x20by\x20the\x20editor\x20and\x20can\x27t\x20be\x20previewed\x20or\x20applied.'});case'AI_ACTIONS_TRY_AGAIN':return t({'id':'AI_ACTIONS_TRY_AGAIN','string':'Retry'});case'AI_ACTIONS_PREVIOUS_INTERACTION':return t({'id':'AI_ACTIONS_PREVIOUS_INTERACTION','string':'Previous'});case'AI_ACTIONS_NEXT_INTERACTION':return t({'id':'AI_ACTIONS_NEXT_INTERACTION','string':'Next'});case'AI_MODEL_NAME_AUTO':return t({'id':'AI_MODEL_NAME_AUTO','string':'Auto'});case'AI_QUICK_ACTIONS_HEADING':return t({'id':'AI_QUICK_ACTIONS_HEADING','string':'AI\x20Quick\x20Actions'});case'AI_QUICK_ACTIONS_SEARCH':return t({'id':'AI_QUICK_ACTIONS_SEARCH','string':'Search\x20AI\x20commands'});case'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND','string':'No\x20AI\x20commands\x20found'});case'AI_QUICK_ACTIONS_ASK_AI':return t({'id':'AI_QUICK_ACTIONS_ASK_AI','string':'Ask\x20AI'});case'AI_QUICK_ACTIONS_CHAT_COMMANDS':return t({'id':'AI_QUICK_ACTIONS_CHAT_COMMANDS','string':'Chat\x20commands'});case'AI_QUICK_ACTIONS_IMPROVE_WRITING':return t({'id':'AI_QUICK_ACTIONS_IMPROVE_WRITING','string':'Improve\x20writing'});case'AI_QUICK_ACTIONS_CONTINUE_WRITING':return t({'id':'AI_QUICK_ACTIONS_CONTINUE_WRITING','string':'Continue\x20writing'});case'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING':return t({'id':'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING','string':'Fix\x20grammar\x20&\x20spelling'});case'AI_QUICK_ACTIONS_ADJUST_LENGTH':return t({'id':'AI_QUICK_ACTIONS_ADJUST_LENGTH','string':'Adjust\x20length'});case'AI_QUICK_ACTIONS_CHANGE_TONE':return t({'id':'AI_QUICK_ACTIONS_CHANGE_TONE','string':'Change\x20tone'});case'AI_QUICK_ACTIONS_TRANSLATE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE','string':'Translate'});case'AI_QUICK_ACTIONS_EXPLAIN':return t({'id':'AI_QUICK_ACTIONS_EXPLAIN','string':'Explain'});case'AI_QUICK_ACTIONS_SUMMARIZE':return t({'id':'AI_QUICK_ACTIONS_SUMMARIZE','string':'Summarize'});case'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS':return t({'id':'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS','string':'Highlight\x20key\x20points'});case'AI_QUICK_ACTIONS_MAKE_SHORTER':return t({'id':'AI_QUICK_ACTIONS_MAKE_SHORTER','string':'Make\x20shorter'});case'AI_QUICK_ACTIONS_MAKE_LONGER':return t({'id':'AI_QUICK_ACTIONS_MAKE_LONGER','string':'Make\x20longer'});case'AI_QUICK_ACTIONS_MORE_CASUAL':return t({'id':'AI_QUICK_ACTIONS_MORE_CASUAL','string':'More\x20casual'});case'AI_QUICK_ACTIONS_MORE_DIRECT':return t({'id':'AI_QUICK_ACTIONS_MORE_DIRECT','string':'More\x20direct'});case'AI_QUICK_ACTIONS_MORE_FRIENDLY':return t({'id':'AI_QUICK_ACTIONS_MORE_FRIENDLY','string':'More\x20friendly'});case'AI_QUICK_ACTIONS_MORE_CONFIDENT':return t({'id':'AI_QUICK_ACTIONS_MORE_CONFIDENT','string':'More\x20confident'});case'AI_QUICK_ACTIONS_MORE_PROFESSIONAL':return t({'id':'AI_QUICK_ACTIONS_MORE_PROFESSIONAL','string':'More\x20professional'});case'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT':return t({'id':'AI_QUICK_ACTIONS_ADJUST_BASED_ON_DOCUMENT','string':'Adjust\x20based\x20on\x20the\x20rest\x20of\x20the\x20document'});case'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH','string':'English'});case'AI_QUICK_ACTIONS_TRANSLATE_CHINESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_QUICK_ACTIONS_TRANSLATE_FRENCH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_FRENCH','string':'French'});case'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE','string':'Japanese'});case'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE','string':'Portuguese'});case'AI_QUICK_ACTIONS_TRANSLATE_KOREAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_KOREAN','string':'Korean'});case'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN','string':'Italian'});case'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN','string':'Russian'});case'AI_QUICK_ACTIONS_TRANSLATE_SPANISH':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_SPANISH','string':'Spanish'});case'AI_QUICK_ACTIONS_TRANSLATE_GERMAN':return t({'id':'AI_QUICK_ACTIONS_TRANSLATE_GERMAN','string':'German'});case'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND':return t({'id':'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','string':'%0\x20plugin\x20is\x20required\x20but\x20not\x20found.'},_0x17740b);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0xd5fe9f;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x2db0a5,_0x1d4d5f){const _0x522fcb=new yt(_0x2db0a5),_0x43d31f=Mi(_0x2db0a5,'AI_TABS_LABEL_MINIMIZE'),_0x1c62b8=Mi(_0x2db0a5,'AI_TABS_LABEL_MAXIMIZE');return _0x522fcb['set']({'withText':!0x1,'icon':_0x124a0f,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x522fcb['bind']('label')['to'](_0x1d4d5f,'isMaximized',_0x1f5f13=>_0x1f5f13?_0x43d31f:_0x1c62b8),_0x522fcb['bind']('icon')['to'](_0x1d4d5f,'isMaximized',_0x463bcb=>_0x463bcb?_0x4dd5d2:_0x124a0f),_0x522fcb['bind']('isOn')['to'](_0x1d4d5f,'isMaximized'),_0x522fcb['on']('execute',()=>{_0x1d4d5f['fire']('resizeTabs');}),_0x522fcb;}function Wi(_0x2521d2,_0x32ed5d){return _0x4cee02(_0x2521d2,_0x32ed5d);}function Ki(_0x4916eb,_0x404d0e){return _0x5d6d16(_0x4916eb,_0x404d0e);}function Yi(_0x416f29,_0x2b0dea,_0x13acf9){const _0x1bf7c2=null!==_0x2b0dea?_0xbc8072=>_0xbc8072['attribs'][_0x416f29]===_0x2b0dea:_0x55bb35=>Boolean(_0x55bb35['attribs'][_0x416f29]);return _0x2605ec(_0x315d57=>_0x2ff01e(_0x315d57)&&_0x1bf7c2(_0x315d57),_0x13acf9);}function $i(_0x56833c,_0x169e40,_0x2fa44e){const _0xf8a7e2=null!==_0x169e40?_0x581fda=>_0x581fda['attribs'][_0x56833c]===_0x169e40:_0x14f005=>Boolean(_0x14f005['attribs'][_0x56833c]);return _0x17cdaf(_0x5579f6=>_0x2ff01e(_0x5579f6)&&_0xf8a7e2(_0x5579f6),_0x2fa44e);}function qi(_0x53be1e){return _0x17cdaf(_0x39459a=>_0x2ff01e(_0x39459a)&&function(_0x26e734){const _0x7af744=_0x26e734['toLowerCase']();return'script'===_0x7af744||'style'===_0x7af744||_0x7af744['includes']('-');}(_0x39459a['name']),_0x53be1e);}function Qi(_0x3eb9bd){return _0x31e40c(_0x255195=>_0x2fa3ae(_0x255195),_0x3eb9bd,!0x0,0x1/0x0);}function Xi(_0xe0c1ae,_0x30adae){return _0xe0c1ae&&_0x2ff01e(_0xe0c1ae)?_0xe0c1ae['attribs'][_0x30adae]:null;}function zi(_0x5c9327,_0x5e9e95,_0x4d0792){_0x2ff01e(_0x5c9327)&&(null===_0x4d0792?delete _0x5c9327['attribs'][_0x5e9e95]:_0x5c9327['attribs'][_0x5e9e95]=_0x4d0792);}function ji(_0x4cc8de,_0x55031c,_0x6abd8e){const _0x5d66f3=_0x55031c['cloneNode'](!0x0);'beforebegin'===_0x6abd8e?_0x151fab(_0x4cc8de,_0x5d66f3):'afterbegin'===_0x6abd8e?_0x2f7a9f(_0x4cc8de,_0x5d66f3):'beforeend'===_0x6abd8e?_0x25c79c(_0x4cc8de,_0x5d66f3):'afterend'===_0x6abd8e&&_0x433357(_0x4cc8de,_0x5d66f3);}function Ji(_0x41b701){const _0x294736=[];let _0x544e70=_0x41b701;for(;_0x544e70;)_0x544e70=_0x2c617a(_0x544e70),_0x544e70&&_0x294736['push'](_0x544e70);return _0x294736;}function Zi(_0x59b09d){return _0x59b09d['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x57f2af){let _0x29e14d=0x0;for(;_0x57f2af['parentNode'];)_0x57f2af=_0x57f2af['parentNode'],_0x29e14d++;return _0x29e14d;}function es(_0x5306f4){const _0x23c369=[];let _0x15a232=_0x5306f4['nextSibling'];for(;_0x15a232;)_0x23c369['push'](_0x15a232),_0x15a232=_0x15a232['nextSibling'];_0x23c369['forEach'](_0x552479=>{_0x1aae33(_0x552479);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
|
|
25
|
+
ct(){['_m2html'];constructor(){super();const _0x3e946e=Object['entries'](_0x193091),_0x3c73a6=_0x3e946e['findIndex'](([_0x298ec1])=>'rehypeDomRaw'===_0x298ec1);if(-0x1===_0x3c73a6)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x3e946e['splice'](_0x3c73a6+0x1,0x0,['rehypeSanitize',_0x360d32]),this['_m2html']=new _0x2f547a({'plugins':Object['fromEntries'](_0x3e946e)});}['convertMarkdownToHTML'](_0x135917){const _0x268c28=this['_m2html']['parse'](_0x135917);return this['parseAndNormalizeHTML'](_0x268c28);}['parseAndNormalizeHTML'](_0x351d58){return this['_parseHTML'](_0x351d58);}['_parseHTML'](_0x659f66){const _0x333ae9=Wi('<dummy>'+_0x659f66['replace'](/<[^>]*?$/g,'')+'</dummy>');return is(_0x333ae9),_0x333ae9['children']=_0x333ae9['children'][0x0]['children'],_0x333ae9;}}function is(_0xc215b8){for(const _0x390b88 of _0xc215b8['children'])_0x2ff01e(_0x390b88)?'pre'!==_0x390b88['name']&&is(_0x390b88):_0x29bd03(_0x390b88)&&(_0x390b88['data']=_0x390b88['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}class AIResponseApplier extends/* #__PURE__ -- @preserve */
|
|
26
|
+
ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x3ea9c2){super(),this['_generateUid']=_0x3ea9c2||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x93a851,_0x476a74,_0x45a8b2){this['_uidCounter']=0x0;const _0x87bda0=_0x93a851['cloneNode'](!0x0);rs(_0x476a74,_0x87bda0);const _0x3af4fd=_0x87bda0['childNodes'],_0x4e178b=Array['from'](_0x3af4fd)['filter'](_0x55eb93=>!(0x3===_0x55eb93['nodeType']&&''===Ki(_0x55eb93)['trim']())),_0x138dc7=_0x4e178b['length'];for(const _0x2a154b of _0x4e178b)_0x2a154b&&_0x2ff01e(_0x2a154b)&&void 0x0===_0x2a154b['attribs']['data-id']&&zi(_0x2a154b,'data-id','new-element');if(0x0===_0x476a74['childNodes']['length']){const _0x4904c8=[];return $i('data-id','new-element',_0x87bda0)['forEach'](_0x3c59ed=>{const _0x22afbe=this['_generateUid']();zi(_0x3c59ed,'data-id',_0x22afbe),_0x4904c8['push'](_0x22afbe);}),this['_removeSpecialComments'](_0x87bda0),{'parsedContent':_0x87bda0,'newNodeIds':_0x4904c8,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set(),this['_existingDataIds']=new Set($i('data-id',null,_0x476a74)['map'](_0x45ac6d=>Xi(_0x45ac6d,'data-id'))['filter'](_0x21c4bc=>!!_0x21c4bc));let _0x32d431=-0x1,_0x5049cb=!0x1;for(let _0xa99ab=0x0;_0xa99ab<_0x138dc7;_0xa99ab++){const _0x50873c=_0x4e178b[_0xa99ab],_0x2c9094=_0x4e178b[_0xa99ab+0x1];if(this['_isNewNode'](_0x50873c)){if(-0x1===_0x32d431&&(_0x32d431=_0xa99ab),this['_markWrappedElements'](_0x50873c),!this['_isNewNode'](_0x2c9094)){const [_0x51741d,_0x5d7104]=this['_findReferenceNode'](_0x50873c,_0x5049cb,_0x476a74);if(_0x51741d){const _0x1eb1e6=Array['from'](_0x4e178b)['slice'](_0x32d431,_0xa99ab+0x1);this['_insertNodes'](_0x51741d,_0x1eb1e6,_0x5d7104),_0x32d431=-0x1;}}}else{if(this['_isExistingContentComment'](_0x50873c))_0x5049cb=!0x0;else{if(this['_isExistingNode'](_0x50873c)){const _0x140092=Xi(_0x50873c,'data-id');if(_0x140092&&this['_existingDataIds']['has'](_0x140092)){this['_referencedExistingIds']['add'](_0x140092);const _0x154ea0=Yi('data-id',_0x140092,_0x476a74);this['_replaceNode'](_0x154ea0,_0x50873c);}}else{if(ss(_0x50873c)){const _0x1dcf4a=ns(_0x50873c);!!Yi('data-id',_0x1dcf4a,_0x87bda0)||this['_touchedNodesState']['removedIds']['push'](_0x1dcf4a);}}}}}for(const _0x4622f4 of this['_touchedNodesState']['removedIds']){const _0x15048f=Yi('data-id',_0x4622f4,_0x476a74);_0x15048f&&(this['_rescueUnwrappedElements'](_0x15048f),this['_removeNode'](_0x15048f,_0x4622f4,_0x45a8b2));}if($i('data-id','new-element',_0x476a74)['forEach'](_0x5974ad=>{const _0x1e8c55=this['_getUid'](_0x5974ad);zi(_0x5974ad,'data-id',_0x1e8c55),this['_touchedNodesState']['newIds']['push'](_0x1e8c55);}),this['_removeSpecialComments'](_0x476a74),_0x45a8b2&&_0x45a8b2['cutAfterUnstable']){const _0x3a03ec=this['_findLastConfirmationPoint'](_0x4e178b),_0x434e5b=this['_getLastStableElement'](_0x476a74,_0x3a03ec);this['_markUnstableElements'](_0x476a74,_0x434e5b);}if(this['_processWrappedElements'](_0x476a74,_0x45a8b2),_0x45a8b2&&_0x45a8b2['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x44c022=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x476a74);let _0x13bf61=_0x44c022[_0x44c022['length']-0x1];for(;_0x13bf61;)es(_0x13bf61),_0x13bf61=_0x13bf61['parentNode'];}return{'parsedContent':_0x476a74,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x1be524,_0x6ac3a7,_0x1e5de7){for(const _0x362e96 of _0x6ac3a7){const _0x5667aa=this['_getUid'](_0x362e96);zi(_0x362e96,'data-id',_0x5667aa),this['_touchedNodesState']['newIds']['push'](_0x5667aa),this['_touchedNodesState']['lastTouchedId']=_0x5667aa;}const _0x539dcf='afterbegin'===_0x1e5de7||'afterend'===_0x1e5de7?_0x6ac3a7['reverse']():_0x6ac3a7;for(const _0x3646d9 of _0x539dcf)ji(_0x1be524,_0x3646d9,_0x1e5de7);}['_replaceNode'](_0x41912e,_0x422670){if(!_0x41912e)return;if(_0xa41181=_0x422670,Zi(Ki(_0x41912e))===Zi(Ki(_0xa41181)))return;var _0xa41181;const _0x15fdc2=Xi(_0x41912e,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x15fdc2),this['_touchedNodesState']['lastTouchedId']=_0x15fdc2,_0x7545e8(_0x41912e,_0x422670['cloneNode'](!0x0));}['_removeNode'](_0x560272,_0x571dd3,_0x422a84){if(_0x422a84&&_0x422a84['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x571dd3;const _0x3f3954=_0x422a84['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x3f3954,'data-id',_0x571dd3),zi(_0x3f3954,'data-removed','true'),_0x7545e8(_0x560272,_0x3f3954);}else _0x1aae33(_0x560272);}['_findReferenceNode'](_0x3a2728,_0x385d4b,_0x553a8e){const _0xa539cb=this['_findPrevElementWithDataId'](_0x3a2728,!0x1);if(_0xa539cb){const _0x200870=ns(_0xa539cb),_0xd202a6=Yi('data-id',_0x200870,_0x553a8e);if(_0xd202a6)return[_0xd202a6,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x200870);}const _0x14f2cd=this['_findNextElementWithDataId'](_0x3a2728,!0x1);if(_0x14f2cd){const _0x13c105=ns(_0x14f2cd),_0x3a2f09=Yi('data-id',_0x13c105,_0x553a8e);if(_0x3a2f09)return[_0x3a2f09,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x13c105);}return _0x385d4b?_0x3a2728['nextSibling']?this['_findFallbackReferenceNode'](_0x3a2728,_0x553a8e):[_0x553a8e['childNodes'][_0x553a8e['childNodes']['length']-0x1],'afterend']:[_0x553a8e['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x499910,_0x5b0d4a){const _0x2fd32b=[],_0x1cd484=this['_findPrevElementWithDataId'](_0x499910,!0x0);if(_0x1cd484){const _0x2b69f2=Yi('data-id',ns(_0x1cd484),_0x5b0d4a);_0x2b69f2&&_0x2fd32b['push']([_0x2b69f2,'afterend']);}const _0x1595f0=this['_findNextElementWithDataId'](_0x499910,!0x0);if(_0x1595f0){const _0x55525a=Yi('data-id',ns(_0x1595f0),_0x5b0d4a);_0x55525a&&_0x2fd32b['push']([_0x55525a,'beforebegin']);}if(_0x2fd32b['length']>0x1)return ts(_0x2fd32b[0x0][0x0])<=ts(_0x2fd32b[0x1][0x0])?_0x2fd32b[0x0]:_0x2fd32b[0x1];return 0x1===_0x2fd32b['length']?_0x2fd32b[0x0]:[_0x5b0d4a['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x79080f,_0x1d799b){let _0x57905e=_0x79080f['nextSibling'],_0x38f290=null,_0xd7b968=!0x1;for(;_0x57905e;){if(_0x2fa3ae(_0x57905e)){if(ss(_0x57905e)&&(_0x38f290=_0x57905e),this['_isExistingContentComment'](_0x57905e)&&_0x1d799b&&!_0xd7b968){_0xd7b968=!0x0,_0x57905e=_0x57905e['nextSibling'];continue;}break;}const _0x437520=Xi(_0x57905e,'data-id');if(_0x437520&&'new-element'!==_0x437520&&this['_existingDataIds']['has'](_0x437520)){_0x38f290=_0x57905e;break;}_0x57905e=_0x57905e['nextSibling'];}return _0x38f290;}['_findPrevElementWithDataId'](_0x2b60e2,_0x3ea19f){let _0x37edcc=_0x2b60e2['previousSibling'],_0x1e3feb=null,_0x367628=!0x1;for(;_0x37edcc;){if(_0x2fa3ae(_0x37edcc)){if(ss(_0x37edcc)&&(_0x1e3feb=_0x37edcc),this['_isExistingContentComment'](_0x37edcc)&&_0x3ea19f&&!_0x367628){_0x367628=!0x0,_0x37edcc=_0x37edcc['previousSibling'];continue;}break;}const _0x1b176a=Xi(_0x37edcc,'data-id');if(_0x1b176a&&'new-element'!==_0x1b176a&&this['_existingDataIds']['has'](_0x1b176a)){_0x1e3feb=_0x37edcc;break;}_0x37edcc=_0x37edcc['previousSibling'];}return _0x1e3feb;}['_markWrappedElements'](_0x3ceba9){_0x2ff01e(_0x3ceba9)&&$i('data-id',null,_0x3ceba9)['forEach'](_0x5db350=>{this['_isExistingNode'](_0x5db350)&&(zi(_0x5db350,'data-wrapped-id',Xi(_0x5db350,'data-id')),zi(_0x5db350,'data-id',null));});}['_processWrappedElements'](_0x1b569c,_0x1a9702){$i('data-wrapped-id',null,_0x1b569c)['forEach'](_0x389566=>{const _0x1c00d8=Xi(_0x389566,'data-wrapped-id');if(this['_hasUnstableParent'](_0x389566))return;const _0xfba8c7=Yi('data-id',_0x1c00d8,_0x1b569c);zi(_0x389566,'data-id',_0x1c00d8),_0xfba8c7&&(this['_removeNode'](_0xfba8c7,_0x1c00d8,_0x1a9702),this['_touchedNodesState']['removedIds']['push'](_0x1c00d8),this['_touchedNodesState']['lastTouchedId']=_0x1c00d8);});}['_hasUnstableParent'](_0x200f52){let _0x158488=_0x200f52['parentNode'];for(;_0x158488;){if(Xi(_0x158488,'data-unstable'))return!0x0;_0x158488=_0x158488['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x7cadf){const _0x322942=new Set(this['_touchedNodesState']['removedIds']),_0x33b9c3=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x7cadf)['forEach'](_0x450c3b=>{const _0x7bfab1=Xi(_0x450c3b,'data-id'),_0x3d6575=!!_0x7bfab1&&this['_referencedExistingIds']['has'](_0x7bfab1),_0x328738=!!_0x7bfab1&&_0x33b9c3['has'](_0x7bfab1);if(!_0x7bfab1||!_0x3d6575&&!_0x328738)return;if(_0x322942['has'](_0x7bfab1))return;let _0x3746c3=_0x450c3b['parentNode'],_0x1e6f2b=!0x1;for(;_0x3746c3;){if(_0x3746c3===_0x7cadf){_0x1e6f2b=!0x0;break;}const _0x198bb5=Xi(_0x3746c3,'data-id');if(_0x198bb5&&(this['_referencedExistingIds']['has'](_0x198bb5)||_0x33b9c3['has'](_0x198bb5)))return;_0x3746c3=_0x3746c3['parentNode'];}if(_0x1e6f2b){if(_0x151fab(_0x7cadf,_0x450c3b),_0x3d6575){const _0x412fbd=this['_generateUid'](),_0x51d0b8=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x7bfab1);-0x1!==_0x51d0b8&&this['_touchedNodesState']['modifiedIds']['splice'](_0x51d0b8,0x1),zi(_0x450c3b,'data-unwrapped-id',_0x7bfab1),zi(_0x450c3b,'data-id',_0x412fbd),this['_touchedNodesState']['newIds']['push'](_0x412fbd),this['_touchedNodesState']['rescuedNewIds']['add'](_0x412fbd),this['_touchedNodesState']['lastTouchedId']=_0x412fbd;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x7bfab1),this['_touchedNodesState']['lastTouchedId']=_0x7bfab1;}});}['_getUid'](_0x1c49e0){return this['_isExistingNode'](_0x1c49e0)?Xi(_0x1c49e0,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x14b65b){Qi(_0x14b65b)['filter'](_0x39bccf=>ss(_0x39bccf)||this['_isExistingContentComment'](_0x39bccf))['forEach'](_0x23811c=>{_0x1aae33(_0x23811c);});}['_findLastConfirmationPoint'](_0x30b5b2){let _0x17e68c=null,_0x40cbe6=null,_0x42d0d5=null,_0x4c5752=null;const _0x58377e=_0x103309=>{_0x103309&&(_0x17e68c=_0x103309),_0x42d0d5=null,_0x4c5752=null;};for(let _0x51fa28=0x0;_0x51fa28<_0x30b5b2['length'];_0x51fa28++){const _0x4d8764=_0x30b5b2[_0x51fa28];if(this['_isExistingContentComment'](_0x4d8764)){_0x58377e(_0x40cbe6);continue;}if(_0x2ff01e(_0x4d8764)){const _0x478750=Xi(_0x4d8764,'data-id'),_0x4ad992=_0x51fa28===_0x30b5b2['length']-0x1;if(_0x478750&&'new-element'!==_0x478750&&this['_touchedNodesState']['modifiedIds']['includes'](_0x478750)&&!_0x4ad992){_0x58377e(_0x478750),_0x40cbe6=_0x478750;continue;}}let _0x22904d=null;const _0x19dcde=ns(_0x4d8764);if(_0x19dcde&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x19dcde))_0x40cbe6=_0x19dcde;else{if(_0x19dcde&&this['_touchedNodesState']['newIds']['includes'](_0x19dcde))_0x22904d='N';else{if(!ss(_0x4d8764))continue;_0x22904d='R';}_0x22904d===_0x4c5752||null===_0x4c5752?_0x4c5752=_0x22904d:null!==_0x42d0d5?(_0x58377e(_0x40cbe6),_0x4c5752=_0x22904d):(_0x42d0d5=_0x4c5752,_0x4c5752=_0x22904d),_0x40cbe6=_0x19dcde;}}const _0x22ec68=_0x30b5b2[_0x30b5b2['length']-0x1];return _0x22ec68&&!_0x2ff01e(_0x22ec68)&&!ss(_0x22ec68)&&_0x40cbe6&&_0x58377e(_0x40cbe6),_0x17e68c;}['_getLastStableElement'](_0x1a7d56,_0x329db9){if(!_0x329db9)return null;const _0x53d107=Yi('data-id',_0x329db9,_0x1a7d56);if(!_0x53d107)return null;const _0x26a206=[_0x53d107,...Ji(_0x53d107)]['at'](-0x2);if(_0x26a206===_0x53d107)return _0x53d107;let _0xa01c9=_0x26a206['previousSibling'];for(;_0xa01c9&&!_0x2ff01e(_0xa01c9);)_0xa01c9=_0xa01c9['previousSibling'];return _0xa01c9;}['_markUnstableElements'](_0x51f96c,_0x9cc747){const _0xeaec38=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5ce80c=_0x9cc747?_0x9cc747['nextSibling']:_0x51f96c['firstChild'];for(;_0x5ce80c;){_0x2ff01e(_0x5ce80c)&&((_0xeaec38['has'](Xi(_0x5ce80c,'data-id'))||$i('data-id',null,_0x5ce80c)['some'](_0x49a857=>_0xeaec38['has'](Xi(_0x49a857,'data-id'))))&&zi(_0x5ce80c,'data-unstable','true')),_0x5ce80c=_0x5ce80c['nextSibling'];}}['_isNewNode'](_0xff83e5){return Boolean('new-element'===Xi(_0xff83e5,'data-id'));}['_isExistingNode'](_0x1cd1ee){return Boolean((Xi(_0x1cd1ee,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0x1cd1ee,'data-id'));}['_isExistingContentComment'](_0x1adee2){return Boolean(_0x2fa3ae(_0x1adee2)&&Ki(_0x1adee2)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function ss(_0x31269a){return!!_0x31269a&&Boolean(_0x2fa3ae(_0x31269a)&&Ki(_0x31269a)['match'](/removed[\s*-]data-id="[^"]+"/));}function ns(_0x25fd37){if(!_0x25fd37)return null;if(_0x2ff01e(_0x25fd37))return Xi(_0x25fd37,'data-id')??null;if(_0x2fa3ae(_0x25fd37)){const _0x108445=Ki(_0x25fd37)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x108445&&_0x108445[0x1])return _0x108445[0x1];}return null;}function rs(_0x284919,_0x210cfe){const _0x379b88=new Map();for(const _0x5f4e9a of qi(_0x284919))_0x379b88['set'](Xi(_0x5f4e9a,'data-id'),_0x5f4e9a);const _0x46b9d5=new Set();for(const _0x1491d6 of qi(_0x210cfe)){const _0x5b9d3f=Xi(_0x1491d6,'data-id'),_0x1233b2=_0x5b9d3f?_0x379b88['get'](_0x5b9d3f):void 0x0;_0x1233b2?(_0x7545e8(_0x1491d6,_0x3777a6(_0x1233b2,!0x0)),_0x46b9d5['add'](_0x5b9d3f)):_0x1aae33(_0x1491d6);}for(const _0x3eb905 of Qi(_0x210cfe))ss(_0x3eb905)&&_0x379b88['has'](ns(_0x3eb905))&&_0x1aae33(_0x3eb905);const _0x29f3b3=new Set($i('data-id',null,_0x210cfe)['map'](_0x2cd286=>Xi(_0x2cd286,'data-id')));for(const [_0x405a2f,_0xe92950]of _0x379b88){if(_0x46b9d5['has'](_0x405a2f))continue;let _0x532be4=_0xe92950['parent'],_0x107f76=null;for(;_0x532be4&&_0x2ff01e(_0x532be4);){const _0xe8f467=Xi(_0x532be4,'data-id');if(_0xe8f467&&_0x29f3b3['has'](_0xe8f467)){_0x107f76=_0xe8f467;break;}_0x532be4=_0x532be4['parent'];}if(!_0x107f76)continue;const _0x30a0ec=Yi('data-id',_0x107f76,_0x210cfe);_0x30a0ec&&_0x25c79c(_0x30a0ec,_0x3777a6(_0xe92950,!0x0));}}function os({changeGroups:_0x153476,documentContextContent:_0x43bd53,showDiff:_0x332442,trimUnchanged:_0xa52634=!0x0}){return _0x153476['map'](_0x57f728=>{if('destroyed'===_0x57f728['editor']['state'])return null;const _0x2938d1=new _0x49fb06([]),_0x12d867=new _0x49fb06([]),_0x546de3=new Set();for(const _0x38e19d of _0x57f728['changes'])'new'==_0x38e19d['type']&&$i('data-id',null,_0x38e19d['node'])['forEach'](_0x582fe1=>{_0x546de3['add'](Xi(_0x582fe1,'data-id'));});for(const _0x53c8e7 of _0x57f728['changes'])if('removed'!=_0x53c8e7['type']?_0x12d867['children']['push'](_0x53c8e7['node']['cloneNode'](!0x0)):_0x332442||_0x546de3['has'](_0x53c8e7['id'])||_0x12d867['children']['push'](_0x53c8e7['node']['cloneNode'](!0x0)),'new'!=_0x53c8e7['type']&&(_0x332442||'removed'!=_0x53c8e7['type'])){const _0x5b3f62=_0x2605ec(_0x44fe56=>Xi(_0x44fe56,'data-id')==_0x53c8e7['id'],_0x43bd53['get'](_0x57f728['documentId']),!0x0);_0x5b3f62&&_0x2938d1['children']['push'](_0x5b3f62['cloneNode'](!0x0));}const {content:_0x17d8d6,hasChanges:_0xd3e67b}=as(_0x57f728['editor'],_0x2938d1,_0x12d867,_0x332442,_0xa52634);return{'type':_0x57f728['changes'][0x0]['type'],'index':_0x57f728['index'],'content':_0x17d8d6,'hasChanges':_0xd3e67b};})['filter'](_0xeb423a=>null!==_0xeb423a);}function as(_0x42b069,_0x3d5639,_0x5bb41c,_0x4b3908,_0x3085d3=!0x0){const _0x101773=_0x42b069['plugins']['get']('DocumentCompare'),_0x5c4ed9=Ki(_0x3d5639),_0x585072=Ki(_0x5bb41c),_0x225ad5=_0x42b069['data']['parse'](_0x5c4ed9,'$root'),_0x1ad6dc=_0x42b069['model']['createPositionAt'](_0x225ad5,0x0),_0x27276f=_0x101773['getDiff'](_0x5c4ed9,_0x585072,{'anchor':_0x1ad6dc,'markDeletions':_0x4b3908,'targetEditor':_0x42b069})['getOperations']();if(0x0==_0x27276f['length'])return{'content':_0x3d5639['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x4b3908?function(_0x4840e0,_0x1b9994,_0x3e6762){if(0x0==_0x4840e0['length'])return;const _0x41f0d5=_0x3e6762['plugins']['get']('DocumentCompare'),_0x284a92=_0x3e6762['plugins']['get']('SuggestionsConversion');_0x3e6762['model']['change'](_0x4e0e67=>{const _0x23ebe4=new Set();for(let _0x213be8=0x0;_0x213be8<_0x4840e0['length'];_0x213be8++){const _0x3def53=_0x4840e0[_0x213be8];if(_0x3def53['baseVersion']=null,_0x3def53['isDocumentOperation']=!0x1,_0x41f0d5['isMarkedRemoveOperation'](_0x3def53)){const _0x4f0699=_0x2d59b2(_0x3def53['newRange'],_0x3e6762['model']),_0x108977='suggestion:deletion:'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0x108977,_0x4f0699);}else switch(_0x3def53['type']){case'rename':{if(_0x3def53['oldName']==_0x3def53['newName'])break;_0x4e0e67['batch']['addOperation'](_0x3def53),_0x3e6762['model']['applyOperation'](_0x3def53);const _0x527dd='$elementName',_0x23a11f=_0x3def53['position'],_0x23ae65=_0x3e6762['model']['createRange'](_0x23a11f,_0x3e6762['model']['createPositionAt'](_0x23a11f['nodeAfter'],'end')),_0x3b2cc4='suggestion:attribute:'+_0x527dd+':'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0x3b2cc4,_0x23ae65);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x3def53['oldValue']==_0x3def53['newValue'])break;_0x4e0e67['batch']['addOperation'](_0x3def53),_0x3e6762['model']['applyOperation'](_0x3def53);const _0x55ffc8=_0x3def53['key'];if(!_0x284a92['isRegisteredAttribute'](_0x55ffc8))break;const _0x40069e=_0x2d59b2(_0x3def53['range'],_0x3e6762['model']),_0x58c1cb='suggestion:attribute:'+_0x55ffc8+':'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0x58c1cb,_0x40069e);break;}case'insert':{_0x4e0e67['batch']['addOperation'](_0x3def53),_0x3e6762['model']['applyOperation'](_0x3def53);if(_0x4840e0[_0x213be8+0x1]&&'move'==_0x4840e0[_0x213be8+0x1]['type']){hs(_0x1b9994,_0x3def53);break;}const _0x386fe5=_0x3def53['position'],_0x2a4ffe=_0x3def53['howMany'],_0x3e94f1=_0x2d59b2(_0x3e6762['model']['createRange'](_0x386fe5,_0x386fe5['getShiftedBy'](_0x2a4ffe)),_0x3e6762['model']),_0x242fd2='suggestion:insertion:'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0x242fd2,_0x3e94f1);break;}case'split':{_0x4e0e67['batch']['addOperation'](_0x3def53),_0x3e6762['model']['applyOperation'](_0x3def53);const _0xb1e617=_0x3def53['splitPosition'],_0x5c0cbe=_0x3def53['moveTargetPosition'],_0x32c331=_0x3e6762['model']['createRange'](_0xb1e617,_0x5c0cbe),_0xf813d5='suggestion:insertion:'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0xf813d5,_0x32c331);break;}case'move':{_0x4e0e67['batch']['addOperation'](_0x3def53),_0x3e6762['model']['applyOperation'](_0x3def53),_0x4840e0[_0x213be8-0x1]&&'insert'==_0x4840e0[_0x213be8-0x1]['type']&&hs(_0x1b9994,_0x3def53);const _0x524db3=_0x3def53['getMovedRangeStart'](),_0x83e148=_0x3def53['howMany'];for(let _0x24e971=0x0;_0x24e971<_0x83e148;_0x24e971++){const _0x56d513=_0x524db3['getShiftedBy'](_0x24e971)['nodeAfter'];_0x23ebe4['add'](_0x56d513);}break;}case'remove':{const _0x2f43ff=_0x3def53['sourcePosition'],_0xbc3fc8=_0x3def53['howMany'],_0x2fb0e9=new _0x2b0abe(_0x2f43ff,_0xbc3fc8);_0x4e0e67['batch']['addOperation'](_0x2fb0e9),_0x3e6762['model']['applyOperation'](_0x2fb0e9);break;}}}for(const _0x141889 of _0x23ebe4){const _0x220a88=_0x3e6762['model']['createRangeOn'](_0x141889),_0x3fcb2='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x1b9994['markers']['set'](_0x3fcb2,_0x2d59b2(_0x220a88,_0x3e6762['model']));}});}(_0x27276f,_0x225ad5,_0x42b069):_0x42b069['model']['change'](_0x18bb43=>{for(const _0x4e6028 of _0x27276f)if('remove'==_0x4e6028['type']){const _0x5923cb=_0x4e6028['sourcePosition'],_0x3219b6=_0x4e6028['howMany'],_0x151959=new _0x2b0abe(_0x5923cb,_0x3219b6);_0x18bb43['batch']['addOperation'](_0x151959),_0x42b069['model']['applyOperation'](_0x151959);}else{if('marker'==_0x4e6028['type']){const _0x5cad43=_0x4e6028['name'],_0x15a2cd=_0x4e6028['newRange'];null!==_0x15a2cd?_0x225ad5['markers']['set'](_0x5cad43,_0x15a2cd):_0x225ad5['markers']['delete'](_0x5cad43);}else _0x4e6028['baseVersion']=null,_0x4e6028['isDocumentOperation']=!0x1,_0x18bb43['batch']['addOperation'](_0x4e6028),_0x42b069['model']['applyOperation'](_0x4e6028);}}),_0x3085d3){const _0x566bc1=cs(_0x42b069,_0x27276f,_0x225ad5);us(_0x42b069['model'],_0x566bc1),function(_0x476932,_0x13c9a6){const _0x5557e9=_0x13c9a6['getFirstRange']()['start'];let _0x28e5d2=_0x13c9a6['getFirstRange']()['end'];const _0x152b45=_0x5557e9['root'];(_0x28e5d2['textNode']||_0x28e5d2['nodeAfter']&&_0x28e5d2['nodeAfter']['is']('$text'))&&(_0x32fede(_0x28e5d2,'...'),_0x28e5d2=_0x28e5d2['getShiftedBy'](0x3)),(_0x5557e9['textNode']||_0x5557e9['nodeBefore']&&_0x5557e9['nodeBefore']['is']('$text'))&&(_0x32fede(_0x5557e9,'...'),function(_0x39ee41,_0x329ff3,_0x44e63e){for(let [_0x503dda,_0x2f8d93]of _0x39ee41['markers']){const _0x185ca6=_0x2f8d93['_getTransformedByInsertion'](_0x329ff3,_0x44e63e,!0x1);_0x2f8d93=_0x185ca6[0x0],_0x39ee41['markers']['set'](_0x503dda,_0x2f8d93);}}(_0x152b45,_0x5557e9,0x3),_0x5557e9['parent']==_0x28e5d2['parent']&&(_0x28e5d2=_0x28e5d2['getShiftedBy'](0x3)));const _0xc66dbf=_0x476932['createRange'](_0x476932['createPositionAt'](_0x152b45,0x0),_0x5557e9),_0x5b46b7=_0x476932['createRange'](_0x28e5d2,_0x476932['createPositionAt'](_0x152b45,'end')),_0x522ebe=[..._0xc66dbf['getMinimalFlatRanges'](),..._0x5b46b7['getMinimalFlatRanges']()];_0x522ebe['reverse']();for(const _0x2a357b of _0x522ebe)_0x55a7d0(_0x2a357b),_s(_0x152b45,_0x2a357b);}(_0x42b069['model'],_0x566bc1);}return{'content':Wi(_0x42b069['data']['stringify'](_0x225ad5,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function hs(_0x10d738,_0x31cb5e){for(const [_0x5c3387,_0x3041b1]of _0x10d738['markers']){const _0x38c7d1=_0x805f9a['_createFromRanges'](_0x3041b1['getTransformedByOperation'](_0x31cb5e));_0x10d738['markers']['set'](_0x5c3387,_0x38c7d1);}}function cs(_0x1b0906,_0xb2196e,_0x3ca4eb){const _0x2a9e78=_0x1b0906['plugins']['get']('DocumentCompare');let _0xa1911e=_0x1b0906['model']['createPositionAt'](_0x3ca4eb,Number['POSITIVE_INFINITY']),_0x81ca19=_0x1b0906['model']['createPositionAt'](_0x3ca4eb,0x0);for(const _0x2525d2 of _0xb2196e){let _0x477574,_0x59fa0b;if(_0x2a9e78['isMarkedRemoveOperation'](_0x2525d2))_0x477574=_0x2525d2['newRange']['start'],_0x59fa0b=_0x2525d2['newRange']['end'];else switch(_0xa1911e=ls(_0xa1911e,_0x2525d2),_0x81ca19=ls(_0x81ca19,_0x2525d2),_0x2525d2['type']){case'rename':_0x477574=_0x2525d2['position'],_0x59fa0b=_0x477574['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x477574=_0x2525d2['range']['start'],_0x59fa0b=_0x2525d2['range']['end'];break;case'insert':_0x477574=_0x2525d2['position'],_0x59fa0b=_0x477574['getShiftedBy'](_0x2525d2['howMany']);break;case'split':_0x477574=_0x2525d2['splitPosition'],_0x59fa0b=_0x2525d2['moveTargetPosition'];break;case'merge':{const _0x3a8e7d=_0x2525d2['targetPosition']['path']['slice'](0x0,-0x1);_0x477574=_0x1b0906['model']['createPositionFromPath'](_0x3ca4eb,_0x3a8e7d),_0x59fa0b=_0x477574['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x30aa27=_0x2525d2['howMany'],_0x1d9976=_0x2525d2['sourcePosition']['_getTransformedByInsertion'](_0x2525d2['targetPosition'],_0x30aa27),_0x494f1f=_0x2525d2['getMovedRangeStart']();'remove'==_0x2525d2['type']?(_0x477574=_0x1d9976,_0x59fa0b=_0x1d9976):(_0x477574=_0x494f1f,_0x59fa0b=_0x494f1f['getShiftedBy'](_0x30aa27));break;}}_0x477574&&_0x477574['isBefore'](_0xa1911e)&&(_0xa1911e=_0x477574['clone'](),_0xa1911e['stickiness']='toNone'),_0x59fa0b&&_0x59fa0b['isAfter'](_0x81ca19)&&(_0x81ca19=_0x59fa0b['clone'](),_0x81ca19['stickiness']='toNone');}return _0x1b0906['model']['createSelection'](_0x1b0906['model']['createRange'](_0xa1911e,_0x81ca19));}function ls(_0x28572b,_0x18ffa3){return'move'!=_0x18ffa3['type']&&'remove'!=_0x18ffa3['type']||_0x18ffa3['sourceRange']['containsPosition'](_0x28572b)&&((_0x28572b=_0x18ffa3['sourcePosition']['clone']())['stickiness']='toNone'),_0x28572b['getTransformedByOperation'](_0x18ffa3);}function us(_0xb701d5,_0x4e4edf){ds(_0xb701d5,_0x4e4edf,'forward');const _0x49e502=_0x4e4edf['getFirstRange']();_0x4e4edf['setTo']([]),_0x4e4edf['setTo'](_0x49e502,{'backward':!0x0}),ds(_0xb701d5,_0x4e4edf,'backward');}function ds(_0x19e275,_0x4bcd0d,_0x43b187){let _0x9789b4=0x14;for(;_0x9789b4;){_0x19e275['modifySelection'](_0x4bcd0d,{'unit':'word','direction':_0x43b187}),_0x9789b4--;const _0x4c2a70=_0x4bcd0d['focus']['forward'==_0x43b187?'nodeBefore':'nodeAfter'];if(_0x4c2a70&&_0x4c2a70['is']('element')&&_0x19e275['schema']['isBlock'](_0x4c2a70)&&_0x19e275['schema']['isObject'](_0x4c2a70))break;}}function _s(_0x4fd2e4,_0x4ee723){for(const [_0x43578f,_0x427098]of _0x4fd2e4['markers']){const _0x14c2fa=_0x427098['_getTransformedByDeletion'](_0x4ee723['start'],_0x4ee723['end']['offset']-_0x4ee723['start']['offset']);null!=_0x14c2fa?_0x4fd2e4['markers']['set'](_0x43578f,_0x14c2fa):_0x4fd2e4['markers']['delete'](_0x43578f);}}class AIReply extends ct(){['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x178035,isDone:_0x5917e6=!0x1,isComplete:_0xcfea89,interactionId:_0x2ca253,areActionsDisabled:_0x173453,isFromHistory:_0x28412a=!0x1,documentContextContent:_0x18fa69,locale:_0x84ff44,id:_0x1f503c,channelsToEditors:_0x484352}){super(),this['id']=_0x1f503c||at(),this['interactionId']=_0x2ca253,this['type']=_0x178035,this['areActionsDisabled']=!!_0x173453,this['isFromHistory']=_0x28412a,this['locale']=_0x84ff44,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x18fa69?.['map'](_0x39068e=>[_0x39068e['id'],Wi(_0x39068e['content'])])||[]),this['_documentIdToSource']=new Map(_0x18fa69?.['map'](_0xe6c1a7=>[_0xe6c1a7['id'],{'editor':_0x484352['get'](_0xe6c1a7['channelId']),'rootName':_0xe6c1a7['rootName']}])||[]),this['set']('isDone',_0x5917e6),this['set']('isComplete',_0xcfea89??_0x5917e6),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x4c6c19,_0xf8ea69){const _0x54415b='text'===this['type']?'text':_0xf8ea69;this['content']['has'](_0x54415b)||this['content']['set'](_0x54415b,''),this['content']['set'](_0x54415b,this['content']['get'](_0x54415b)+_0x4c6c19),this['onContentChange'](_0x54415b);}['done'](_0x3137d1=!0x0){this['isComplete']=_0x3137d1,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x63a699,_0xf297ba){this['changeGroups'][_0x63a699]['state']=_0xf297ba,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x63a699,'state':_0xf297ba});}['getContentParts']({showDiff:_0x2fbc9c,groupIndex:_0x3c5ac9}){const _0x25eeba=this['_getCachedContentParts'](_0x2fbc9c,_0x3c5ac9);if(_0x25eeba)return _0x25eeba;let _0x17ecc3=[];if(void 0x0===_0x3c5ac9)_0x17ecc3=this['changeGroups'];else{const _0x5da0d9=this['changeGroups']['find'](({index:_0x36a3cc})=>_0x36a3cc===_0x3c5ac9);if(!_0x5da0d9)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x3c5ac9});_0x17ecc3=[_0x5da0d9];}const _0x3c8ccc=os({'showDiff':_0x2fbc9c,'changeGroups':_0x17ecc3,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x2fbc9c,_0x3c8ccc),_0x3c8ccc;}['_getCachedContentParts'](_0x493482,_0x722e50){const _0x1c67ba=_0x493482?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x1c67ba]['length'])return null;const _0x578eda=this['cachedSuggestionContentParts'][_0x1c67ba];if(void 0x0===_0x722e50)return _0x578eda['length']>0x0&&_0x578eda['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x493482,null),null):_0x2ea6b1(_0x578eda);{const _0x2b6f2f=_0x578eda['find'](({index:_0xad7b72})=>_0xad7b72===_0x722e50);if(_0x2b6f2f)return[_0x2ea6b1(_0x2b6f2f)];}return null;}['_setCachedContentParts'](_0x1990d3,_0x37d7bc){const _0x4b799f=_0x1990d3?'withDiff':'withoutDiff';_0x37d7bc?_0x37d7bc['forEach'](_0x334d42=>{const _0x33ff13=this['cachedSuggestionContentParts'][_0x4b799f],_0x283f8f=_0x33ff13['find'](({index:_0x14a539})=>_0x14a539===_0x334d42['index']);if(_0x283f8f){const _0x2df69b=_0x33ff13['indexOf'](_0x283f8f);_0x33ff13['splice'](_0x2df69b,0x1,_0x334d42);}else _0x33ff13['push'](_0x334d42);}):this['cachedSuggestionContentParts'][_0x4b799f]['length']=0x0;}['onContentChange'](_0x32ea43){if('modification'===this['type']){if(_0x32ea43)this['parsedContent']['set'](_0x32ea43,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x32ea43)));else{for(const [_0x1eb49d,_0x17dabf]of this['content'])this['parsedContent']['set'](_0x1eb49d,this['aiResponseParser']['parseAndNormalizeHTML'](_0x17dabf));}const _0x18419c=this['changeGroups'];for(const _0x52cf87 of this['content']['keys']())this['updateChangeGroups'](_0x52cf87);const _0x5bfb91=this['_getDifferentChangeGroups'](_0x18419c,this['changeGroups']);(_0x5bfb91['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x5bfb91),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x3e8f20,_0x4a6fe1){const _0x5b87af=[];for(const _0x557c91 of _0x4a6fe1){const _0x35df17=_0x3e8f20[_0x557c91['index']];_0x35df17?_0x35df17['changes']['length']!==_0x557c91['changes']['length']?_0x5b87af['push'](_0x557c91):_0x35df17['changes']['forEach']((_0xb54af7,_0x3f2051)=>{const _0x5d2494=_0x557c91['changes'][_0x3f2051];_0xb54af7['id']!==_0x5d2494['id']&&_0x5b87af['push'](_0x557c91);}):_0x5b87af['push'](_0x557c91);}return _0x5b87af;}['updateChangeGroups'](_0x2c1984){const _0x18cfdb=this['documentContextContent']['get'](_0x2c1984),_0x29b4a8=this['parsedContent']['get'](_0x2c1984);if(!_0x18cfdb||!_0x29b4a8)return;const _0x40674f=new _0x2f80a7('p',{},[new _0x2f80a7('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x2c0b48(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x1f21bc=this['aiResponseApplier']['merge'](_0x29b4a8,_0x18cfdb['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x40674f});this['parsedMergedContent']['set'](_0x2c1984,_0x1f21bc['parsedContent']);let _0x96038c=[];if(_0x17cdaf(_0x5c6dcc=>{const _0x35b71c=Xi(_0x5c6dcc,'data-id');if(!_0x35b71c||!_0x5d89d5(_0x35b71c))return!0x1;const _0x4f398c=[_0x5c6dcc,...Ji(_0x5c6dcc)]['at'](-0x2);if(_0x5c6dcc!=_0x4f398c){const _0x1eef93=Xi(_0x4f398c,'data-id');_0x5d89d5(_0x1eef93)||(_0x96038c['push']({'node':_0x4f398c,'id':_0x1eef93,'type':'modified'}),_0x1f21bc['modifiedNodeIds']['push'](_0x1eef93));}else _0x1f21bc['modifiedNodeIds']['includes'](_0x35b71c)?_0x96038c['push']({'node':_0x5c6dcc,'type':'modified','id':_0x35b71c}):_0x1f21bc['newNodeIds']['includes'](_0x35b71c)?_0x96038c['push']({'node':_0x5c6dcc,'type':'new','id':_0x35b71c,'anchorId':Xi(_0x5c6dcc['previousSibling'],'data-id')}):_0x96038c['push']({'node':_0x5c6dcc,'type':'removed','id':_0x35b71c});return!0x0;},this['parsedMergedContent']['get'](_0x2c1984)),_0x96038c=_0x96038c['filter'](({node:_0x36d0a8})=>[...Ji(_0x36d0a8),_0x36d0a8]['every'](_0x5f17b8=>!Xi(_0x5f17b8,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x5bb80a=>_0x5bb80a['documentId']!==_0x2c1984),0x0==_0x96038c['length'])return;const _0x14ccaf=[[_0x96038c[0x0]]];for(let _0x59bdbe=0x1;_0x59bdbe<_0x96038c['length'];_0x59bdbe++){const _0x2d1037=_0x14ccaf[_0x14ccaf['length']-0x1],_0x94b5d4=_0x2d1037[_0x2d1037['length']-0x1];_0x96038c[_0x59bdbe]['node']['previousSibling']==_0x94b5d4['node']&&'modified'!=_0x96038c[_0x59bdbe]['type']&&'modified'!=_0x94b5d4['type']?_0x2d1037['push'](_0x96038c[_0x59bdbe]):_0x14ccaf['push']([_0x96038c[_0x59bdbe]]);}for(const _0x31d27f of _0x14ccaf){const _0x497c6b=_0x31d27f[0x0],_0x41eb4b=_0x31d27f[_0x31d27f['length']-0x1],_0x5bd24d=_0x21d4eb(_0x497c6b['node']['previousSibling']);_0x5bd24d&&_0x31d27f['unshift'](_0x5bd24d);const _0x46ada8=_0x21d4eb(_0x41eb4b['node']['nextSibling']);_0x46ada8&&_0x31d27f['push'](_0x46ada8);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x2c1984))['forEach'](_0x43de35=>{zi(_0x43de35,'data-wrapped-id',null);});const _0x7fce5=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x2c1984))['forEach'](_0x37380e=>{const _0x4efb60=Xi(_0x37380e,'data-unwrapped-id'),_0x620b46=Xi(_0x37380e,'data-id');_0x7fce5['set'](_0x620b46,_0x4efb60),zi(_0x37380e,'data-id',_0x4efb60),zi(_0x37380e,'data-unwrapped-id',null);});for(const _0x16dc69 of _0x96038c){const _0x4c6807=_0x7fce5['get'](_0x16dc69['id']);_0x4c6807&&(_0x16dc69['id']=_0x4c6807);}this['changeGroups']['push'](..._0x14ccaf['map']((_0x57474c,_0x378ac1)=>({'changes':_0x57474c,'state':'pending','index':_0x378ac1,'editor':this['_documentIdToSource']['get'](_0x2c1984)['editor'],'rootName':this['_documentIdToSource']['get'](_0x2c1984)['rootName'],'documentId':_0x2c1984})));const _0x24b85d=Array['from'](this['documentContextContent']['keys']());function _0x5d89d5(_0x22776f){return _0x1f21bc['modifiedNodeIds']['includes'](_0x22776f)||_0x1f21bc['newNodeIds']['includes'](_0x22776f)||_0x1f21bc['removedNodeIds']['includes'](_0x22776f);}function _0x21d4eb(_0x1cf072){if(_0x1cf072&&Xi(_0x1cf072,'data-id')&&!Xi(_0x1cf072,'data-unstable')){const _0x4edb44=Xi(_0x1cf072,'data-id');if(!_0x5d89d5(_0x4edb44))return{'node':_0x1cf072,'type':'context','id':_0x4edb44};}return null;}this['changeGroups']['sort']((_0x12f460,_0x4f11d0)=>_0x24b85d['indexOf'](_0x12f460['documentId'])-_0x24b85d['indexOf'](_0x4f11d0['documentId'])),this['changeGroups']['forEach']((_0x5c3c87,_0x17a168)=>{_0x5c3c87['index']=_0x17a168;});}}const Is=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x2ab7fb,locale:_0x409840,channelsToEditors:_0x5b6da9}){super(),this['id']=at(),this['connector']=_0x2ab7fb,this['isStopped']=!0x0,this['locale']=_0x409840,this['_channelsToEditors']=_0x5b6da9||new Map();}async['start'](){await this['_run']();}async['resume'](_0x1a4ef2){await this['_run'](_0x1a4ef2);}async['_run'](_0x7908ff){const _0x442daf=[];let _0x5f09df,_0x3ed2ff,_0x343616,_0x2c2aaf=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x7908ff||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x463153=await this['currentRequest']['getStream']();for await(const _0x5ee36c of _0x463153){if(this['isStopped'])return;if('error'==_0x5ee36c['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x5ee36c['event']){case'message-metadata':this['messageId']=_0x5ee36c['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x5ee36c['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x5ee36c['data']['conversationTitle'],!0x0);break;case'source':_0x442daf['push'](_0x5ee36c['data']['source']);break;case'web-search':this['_isWebSearching']||(this['_isWebSearching']=!0x0,this['fire']('webSearchStarted',this));break;case'reasoning':this['_isReasoning']||(this['_isReasoning']=!0x0,this['fire']('reasoningStarted',this));break;case'modification-delta':case'text-delta':this['resetReasoningState'](),this['resetWebSearchState'](),_0x5f09df='modification-delta'==_0x5ee36c['event']?'modification':'text',_0x3ed2ff='modification-delta'==_0x5ee36c['event']?_0x5ee36c['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x5f09df&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x5f09df,'interactionId':this['id'],'id':_0x3ed2ff,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x5ee36c['event']&&{'documentId':_0x5ee36c['data']['documentId']}}),'modification'==_0x5f09df&&(this['currentReply']['sources']=_0x442daf['splice'](0x0))),this['currentReply']['appendContent'](_0x5ee36c['data']['textDelta'],_0x5ee36c['data']['documentId']);break;case'mcp-tool-result':_0x343616=JSON['parse'](_0x5ee36c['data']['result']),this['_handleToolResultData']({'toolName':_0x5ee36c['data']['toolName'],'data':_0x343616['data'],'attributes':_0x343616['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x5ee36c['data']['toolName'],'data':_0x5ee36c['data']['data']});}}_0x2c2aaf=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x442daf['length']>0x0&&(this['currentReply']['sources']=_0x442daf['splice'](0x0)),this['_finalizeInteraction'](_0x2c2aaf),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x11f36a){return this['replies']['find'](_0x37a558=>_0x37a558['id']===_0x11f36a);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x58e6b6=>_0x58e6b6['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x156070){const _0x1294d5=this['getDocumentContext'](),_0x456608=new AIReply({'locale':this['locale'],'documentContextContent':_0x1294d5?.['documents'],..._0x156070});return this['replies']['push'](_0x456608),_0x456608['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x456608),_0x456608;}['setConversationTitle'](_0x45ae49,_0x4e2d1b=!0x1){this['fire']('setConversationTitle',_0x45ae49,_0x4e2d1b);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x2f4b54){this['fire']('toolDataReceived',{'type':'result','toolName':_0x2f4b54['toolName'],'data':structuredClone(_0x2f4b54['data']||{}),'attributes':structuredClone(_0x2f4b54['attributes']||{})},this);}['_handleToolNotificationData'](_0xb99726){this['fire']('toolDataReceived',{'type':'notification','toolName':_0xb99726['toolName'],'data':structuredClone(_0xb99726['data'])},this);}['_finalizeInteraction'](_0x486d62=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x486d62),this['currentRequest']=this['currentReply']=void 0x0;}}const As=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),gs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x51e37a,config:_0xdc803a,ownerId:_0x3621db}){super(),this['_connector']=_0x51e37a,this['_config']=_0xdc803a,this['_ownerId']=_0x3621db;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x5b403e){const _0x39647d=await this['_createContextItemFromContent'](_0x5b403e);return this['_addToConversationContextItem'](_0x39647d),'current-document'===_0x39647d['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x39647d;}async['populateDocumentsFromMessage'](_0x598dd4,_0x2b8e89){const _0x2696e5=_0x598dd4['filter'](_0x13a8d7=>'document'===_0x13a8d7['type']);if(0x0===_0x2696e5['length'])return{'hasUnmatched':!0x1};const _0x1aa71c=_0x2696e5['map'](_0xe8c228=>_0xe8c228['id']),_0x4d7e81=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x1aa71c)['getDocuments'](),_0x11ae72=new Map(_0x4d7e81['map'](_0x35ea9f=>[_0x35ea9f['id'],_0x35ea9f])),_0x1c925f=[];let _0x492cc1=!0x1;for(const _0x2c3df7 of _0x2696e5){const _0x2c66e2=_0x11ae72['get'](_0x2c3df7['id']);_0x2c66e2&&(this['_matchDocumentToRoot'](_0x2c66e2,_0x2b8e89)||(_0x492cc1=!0x0),_0x1c925f['push']({'id':_0x2c66e2['id'],'content':_0x2c66e2['content'],'version':_0x2c66e2['attributes']?.['version']??0x0,'sessionId':_0x2c66e2['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x2c66e2['attributes']?.['channelId']??_0x2b8e89[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x2c66e2['attributes']?.['rootName']??_0x2b8e89[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x5000b6={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x1c925f};return this['_addToConversationContextItem'](_0x5000b6),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x5000b6,'hasUnmatched':_0x492cc1};}['_matchDocumentToRoot'](_0x461e05,_0x4adae3){const _0x2a1aa1=_0x461e05['attributes']?.['channelId'],_0x27caef=_0x461e05['attributes']?.['rootName'];if(_0x2a1aa1&&_0x27caef){for(const _0x3679bd of _0x4adae3)if(_0x3679bd['config']['get']('collaboration.channelId')===_0x2a1aa1){for(const _0x2d746a of _0x3679bd['model']['document']['getRoots']())if('$graveyard'!==_0x2d746a['rootName']&&_0x2d746a['rootName']===_0x27caef)return{'editor':_0x3679bd,'rootName':_0x2d746a['rootName']};}}}async['_createContextItemFromContent'](_0x2e666f){if('document'===_0x2e666f['type']){const _0x161eb3=await this['_connector']['fetchDocument'](this['_ownerId'],_0x2e666f['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x2e666f['type'],'content':_0x161eb3['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x161eb3['attributes']?.['version'],'sessionId':_0x161eb3['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x2e666f['type'])return{'id':_0x2e666f['id'],'uiId':_0x2e666f['id'],'label':_0x2e666f['data']?.['label']||_0x2e666f['id'],'type':'mcp-tool-context','mcpServerName':_0x2e666f['mcpServerName'],'toolName':_0x2e666f['toolName'],'data':_0x2e666f['data']||{}};return{'id':_0x2e666f['id'],'uiId':_0x2e666f['id'],'label':_0x2e666f['attributes']?.['label']||_0x2e666f['name']||_0x2e666f['url']||_0x2e666f['id'],'type':_0x2e666f['type'],..._0x2e666f?.['attributes']?.['resourceId']?{'resourceId':_0x2e666f['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x3ef4cd){const _0x29b40c=this['_pendingContextItems']['get'](_0x3ef4cd);_0x29b40c?.['isReadOnly']||this['_removeContextItem'](_0x3ef4cd);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x38075c of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x38075c['uiId']);const _0x36b827=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x36b827&&this['_addContextItem']({..._0x36b827,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0xaec69){for(const _0x3fb893 of _0xaec69['values']())this['_addToConversationContextItem'](_0x3fb893);this['clearPendingContextItems'](),this['fire']('contextSent',{'contextItems':Array['from'](this['getSentContextItems']()['values']())});}['isCurrentDocumentInContext'](){return this['_pendingContextItems']['has']('current-document');}['isSelectionInContext'](){return this['_pendingContextItems']['has']('selection');}['isCurrentDocumentInConversation'](){return this['_conversationContextItems']['has']('current-document');}static['mapContextItemsToRequestData'](_0x423562){return Array['from'](_0x423562['values']())['flatMap'](_0x502de1=>this['_mapContextItemToRequestData'](_0x502de1));}async['addFilesToContext'](_0x2812b8,_0x650cc8,_0x546370='file'){const _0xfb7535='files-'+at();this['_startUploadOperation'](_0xfb7535);try{await Promise['all'](_0x2812b8['map'](async _0x5e2a99=>{const _0x1a861b='file-'+at(),_0x54c8fe=_0x5d498f(_0x5e2a99['name']),_0x4db65f='file'===_0x546370&&_0x5e2a99['type']['startsWith']('image/')?'image':_0x546370;try{this['_addContextItem']({'type':_0x4db65f,'label':_0x650cc8?.['label']||_0x54c8fe,'uiId':_0x1a861b,'resourceId':_0x650cc8?.['resourceId']},!0x0);const _0x4b43fb=this['_connector']['uploadFile'](this['_ownerId'],_0x5e2a99,_0x650cc8);this['_ongoingUploads']['set'](_0x1a861b,_0x4b43fb['abortController']);const {id:_0x20037b}=await _0x4b43fb['getId']();this['_ongoingUploads']['delete'](_0x1a861b),this['_finishContextItemLoading']({'type':_0x4db65f,'id':_0x20037b,'label':_0x650cc8?.['label']||_0x54c8fe,'uiId':_0x1a861b,'resourceId':_0x650cc8?.['resourceId']},!0x1);}catch(_0x89b677){this['_ongoingUploads']['delete'](_0x1a861b);if(!(_0x89b677 instanceof ht&&_0x89b677['message']['startsWith']('ai-request-aborted'))){const _0x3ab44c=As['get'](_0x89b677['code'])||'ai-chat-file-upload-failed',_0x4ddaee=new ht(_0x3ab44c,null,{'fileName':_0x54c8fe,..._0x89b677});_0x4ddaee['stack']=_0x89b677['stack'],this['fire']('error',{'error':_0x4ddaee});}this['_removeContextItem'](_0x1a861b);}}));}finally{this['_finishUploadOperation'](_0xfb7535);}}['addCurrentDocumentToContext'](_0x3ce53c){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x35839b={'type':'document','uiId':'current-document','label':_0x3ce53c,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x35839b);}async['updateCurrentDocuments'](_0x3c6c6a){const _0x20c9ff=this['_pendingContextItems']['get']('current-document');if(!_0x20c9ff||!_0x3c6c6a['length']||_0x3c6c6a['every'](_0x28c48c=>!_0x28c48c['content']))return;_0x3c6c6a['length']>0x1&&_0x3c6c6a['some'](_0x4abc73=>!_0x4abc73['description'])&&wt('ai-chat-documents-missing-description');try{const _0x2dc039=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x3c6c6a)['getIds']();if(_0x2dc039['length']!==_0x3c6c6a['length']||_0x2dc039['some'](_0x3651f8=>!_0x3651f8?.['id'])){const _0x5659f4=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x5659f4});}_0x20c9ff['documents']=_0x3c6c6a['map']((_0x410700,_0x364239)=>{return{'id':_0x2dc039[_0x364239]['id'],'content':_0x410700['content'],'version':_0x410700['version'],'sessionId':_0x410700['sessionId'],'selection':(_0x116c6f=_0x410700['selections'],_0x116c6f?_0x116c6f['map'](_0x41caf6=>({'start':_0x41caf6['start'],'end':_0x41caf6['end']})):[]),'channelId':_0x410700['channelId'],'rootName':_0x410700['rootName']};var _0x116c6f;});}catch(_0x3df060){const _0x31708c=new ht('ai-chat-document-upload-failed',null);_0x31708c['stack']=_0x3df060['stack'],this['fire']('error',{'error':_0x31708c});}}['addSelectionToContext'](_0x2bab12){this['_addContextItem']({'type':'selection','label':_0x2bab12,'uiId':'selection','content':_0x2bab12});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x1f8079,_0x1ede0a){const _0x35ed51='url-'+at();this['_startUploadOperation'](_0x35ed51);const _0x71e9c0='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x1ede0a?.['label']||_0x1f8079,'uiId':_0x71e9c0,'resourceId':_0x1ede0a?.['resourceId']},!0x0);const _0x2b3102=this['_connector']['uploadUrl'](this['_ownerId'],_0x1f8079,_0x1ede0a);this['_ongoingUploads']['set'](_0x71e9c0,_0x2b3102['abortController']);const {id:_0x58fc76}=await _0x2b3102['getId']();this['_ongoingUploads']['delete'](_0x71e9c0),this['_finishContextItemLoading']({'type':'web-resource','id':_0x58fc76,'label':_0x1ede0a?.['label']||_0x1f8079,'uiId':_0x71e9c0,'resourceId':_0x1ede0a?.['resourceId']},!0x1);}catch(_0x113094){this['_ongoingUploads']['delete'](_0x71e9c0),(_0x113094['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x1f8079,'originalError':_0x113094}),'url':_0x1f8079}),this['_removeContextItem'](_0x71e9c0));}finally{this['_finishUploadOperation'](_0x35ed51);}}['addToolItemToContext'](_0x23544d){_0x23544d['id']=_0x23544d['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x23544d['uiId'],_0x23544d),this['fire']('contextItemAdded',{'contextItem':_0x23544d,'isLoading':!0x1});}async['loadSourceResources'](_0x52a28c,_0x259866,_0x5bdf4e){const _0x36aacb=this['_addContextOptionsState']['sources']['find'](_0x439c7d=>_0x439c7d['id']===_0x52a28c);if(!_0x36aacb)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x52a28c}),'sourceId':_0x52a28c}),[];try{const _0x3186ca=(await _0x36aacb['getResources'](_0x259866))['map'](_0x293412=>{const _0x29a864=this['_isResourceInContext'](_0x293412['id']);return{..._0x293412,'isInContext':_0x29a864};});return _0x36aacb['resources']=_0x3186ca,this['fire']('sourceResourcesLoaded',{'sourceId':_0x52a28c,'source':_0x36aacb,'resources':_0x3186ca,'uid':_0x5bdf4e}),_0x3186ca;}catch(_0x2116f4){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x52a28c,'originalError':_0x2116f4}),'sourceId':_0x52a28c,'sourceLabel':_0x36aacb['label']}),[];}}async['addResourceToContext'](_0x589328,_0x3bd4c9){if(this['_isResourceInContext'](_0x3bd4c9['id']))return;let _0x310abb=_0x3bd4c9['data'];if(!_0x310abb&&_0x589328['getData'])try{_0x310abb=await _0x589328['getData'](_0x3bd4c9['id']);}catch(_0x534488){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id'],'originalError':_0x534488}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});}if(_0x310abb)switch(_0x3bd4c9['type']){case'web-resource':if('string'!=typeof _0x310abb)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id'],'expectedType':'string','actualType':typeof _0x310abb}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});await this['addUrlToContext'](_0x310abb,{'label':_0x3bd4c9['label'],'resourceId':_0x3bd4c9['id']});break;case'file':if(!(_0x310abb instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id'],'expectedType':'File','actualType':typeof _0x310abb}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});await this['addFilesToContext']([_0x310abb],{'label':_0x3bd4c9['label'],'resourceId':_0x3bd4c9['id']});break;case'text':if('object'!=typeof _0x310abb||!('content'in _0x310abb)||!('type'in _0x310abb))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x310abb}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});_0x310abb=AIChatContext['_convertTextResourceToFile'](_0x310abb,_0x3bd4c9['label']),await this['addFilesToContext']([_0x310abb],{'label':_0x3bd4c9['label'],'resourceId':_0x3bd4c9['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id'],'resourceType':_0x3bd4c9['type']}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']}),'resourceId':_0x3bd4c9['id'],'sourceId':_0x589328['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x4b1311){if(void 0x0!==_0x4b1311)this['_addContextOptionsState']['document']['isHidden']=!_0x4b1311;else{const _0x2cd392=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x2cd392;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x14babd,_0x468852){switch(_0x14babd['type']){case'markdown':return new File([_0x14babd['content']],_0x468852,{'type':'text/markdown'});case'html':return new File([_0x14babd['content']],_0x468852,{'type':'text/html'});default:return new File([_0x14babd['content']],_0x468852,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x2b59ea){switch(_0x2b59ea['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x2b59ea['id']}];case'web-resource':return[{'type':'web-resource','id':_0x2b59ea['id']}];case'document':return _0x2b59ea['documents']?.['length']?_0x2b59ea['documents']['map'](_0x59ae6d=>({'type':'document','id':_0x59ae6d['id'],..._0x59ae6d['selection']?.['length']&&{'selection':_0x59ae6d['selection']}})):[{'type':'document','id':_0x2b59ea['id'],..._0x2b59ea['selection']?.['length']&&{'selection':_0x2b59ea['selection']}}];case'mcp-tool-context':{const _0xe11d78=_0x2b59ea;return[{'type':'mcp-tool-context','mcpServerName':_0xe11d78['mcpServerName'],'toolName':_0xe11d78['toolName'],'data':{..._0xe11d78['data'],'label':_0xe11d78['label']||_0xe11d78['data']?.['label']||_0xe11d78['id']},'id':_0xe11d78['id']}];}default:return[];}}['_addContextItem'](_0x5e0f92,_0x54bc18=!0x1){if(this['_pendingContextItems']['set'](_0x5e0f92['uiId'],_0x5e0f92),_0x5e0f92['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x5e0f92,'isLoading':_0x54bc18}),'current-document'===_0x5e0f92['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x5e0f92['resourceId']){const _0x1d83d0=this['_findSourceIdsByResourceId'](_0x5e0f92['resourceId']);_0x1d83d0&&_0x1d83d0['forEach'](_0x220632=>{this['_updateResourceInContextState'](_0x220632,_0x5e0f92['resourceId'],!0x0);});}}['_removeContextItem'](_0x50e430){const _0x3915d7=this['_pendingContextItems']['get'](_0x50e430),_0x312ca5=this['_ongoingUploads']['get'](_0x50e430);if(_0x312ca5&&(_0x312ca5['abort'](),this['_ongoingUploads']['delete'](_0x50e430)),_0x3915d7?.['resourceId']){const _0x4ec88c=this['_findSourceIdsByResourceId'](_0x3915d7['resourceId']);_0x4ec88c&&_0x4ec88c['forEach'](_0x240ddd=>{this['_updateResourceInContextState'](_0x240ddd,_0x3915d7['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x50e430),this['fire']('contextItemRemoved',{'uiId':_0x50e430,'type':_0x3915d7?.['type']}),'current-document'===_0x50e430&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x2a3c75,_0x125812){if(this['_pendingContextItems']['has'](_0x2a3c75['uiId'])&&(this['_pendingContextItems']['set'](_0x2a3c75['uiId'],_0x2a3c75),this['fire']('contextItemLoadingEnded',{'contextItem':_0x2a3c75,'isLoading':_0x125812}),_0x2a3c75['resourceId'])){const _0x264692=this['_findSourceIdsByResourceId'](_0x2a3c75['resourceId']);_0x264692&&_0x264692['forEach'](_0x4deced=>{this['_updateResourceInContextState'](_0x4deced,_0x2a3c75['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x2e2429){this['_conversationContextItems']['set'](_0x2e2429['uiId'],_0x2e2429);}['_setAddContextOptionsDefaultState'](){this['_addContextOptionsState']={'document':{'enabled':!0x1!==this['_config']?.['document']?.['enabled'],'isHidden':!0x1},'urls':{'enabled':!0x1!==this['_config']?.['urls']?.['enabled']},'files':{'enabled':!0x1!==this['_config']?.['files']?.['enabled']},'sources':this['_getCustomSourcesInitialState'](),'customItems':this['_config']?.['customItems']?.['map'](_0x1a5ad6=>({..._0x1a5ad6,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x5a4393=>({..._0x5a4393,'resources':[]}))??[];}['_isResourceInContext'](_0xdeb4d6){for(const _0x165d4b of this['_pendingContextItems']['values']())if(_0x165d4b['resourceId']===_0xdeb4d6)return!0x0;for(const _0xcc9a0a of this['_conversationContextItems']['values']())if(_0xcc9a0a['resourceId']===_0xdeb4d6)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x337201){const _0x2dfd16=[];for(const _0x555632 of this['_addContextOptionsState']['sources']){_0x555632['resources']['find'](_0x10b2fc=>_0x10b2fc['id']===_0x337201)&&_0x2dfd16['push'](_0x555632['id']);}return 0x0===_0x2dfd16['length']?null:_0x2dfd16;}['_updateResourceInContextState'](_0x139bec,_0x34441b,_0x35dd20){const _0x11eb7c=this['_addContextOptionsState']['sources']['find'](_0x27b55f=>_0x27b55f['id']===_0x139bec);if(!_0x11eb7c)return;const _0x4cee4e=_0x11eb7c['resources']['find'](_0x244c5f=>_0x244c5f['id']===_0x34441b);_0x4cee4e&&(_0x4cee4e['isInContext']=_0x35dd20,this['fire']('resourceStateChanged',{'sourceId':_0x139bec,'resourceId':_0x34441b,'isInContext':_0x35dd20}));}['_startUploadOperation'](_0x3ce2cd){this['_ongoingUploadOperations']['set'](_0x3ce2cd,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x1940f2){this['_ongoingUploadOperations']['delete'](_0x1940f2),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const ws=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x5e2602){const _0x1b0416={};return _0x5e2602&&_0x5e2602['isWebSearchEnabled']&&(_0x1b0416['webSearch']={}),_0x5e2602&&_0x5e2602['isReasoningEnabled']&&(_0x1b0416['reasoning']={}),_0x1b0416;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x1ccc49){_0x1ccc49!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x1ccc49,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0xac0d06){_0xac0d06!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0xac0d06,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x2a95fd){super(_0x2a95fd),this['conversationId']=_0x2a95fd['conversationId'],this['contextItems']=_0x2a95fd['contextItems'],this['capabilities']=_0x2a95fd['capabilities'],this['userMessage']=_0x2a95fd['userMessage'],this['model']=_0x2a95fd['model'],this['attributes']=_0x2a95fd['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x4ec614){super(),this['options']=_0x4ec614,this['connector']=_0x4ec614['connector'],this['chatModels']=_0x4ec614['chatModels'],this['id']=_0x4ec614['conversationId'],this['isFromHistory']=_0x4ec614['isFromHistory'],this['_channelsToEditors']=_0x4ec614['channelsToEditors'],this['_getSessionId']=_0x4ec614['getSessionId'];}async['init'](_0x1a5c02){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x1a5c02,'ownerId':this['id']}),this['chatContext']['delegate'](...gs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...ws)['to'](this),this['chatCapabilities']['init']();const _0x580614=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x580614});const _0x33437e=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x33437e&&await this['setModel'](_0x33437e);}catch(_0x890c77){const _0xb0d4c9=new ht('ai-chat-conversation-init-failed',null,{'message':_0x890c77['message']||_0x890c77});_0xb0d4c9['stack']=_0x890c77['stack'],this['fire']('error',{'error':_0xb0d4c9});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x2f3191}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x2f3191,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x181047){const _0x29f4f5=new ht('ai-chat-conversation-start-failed',null,{'message':_0x181047['message'],'conversationId':this['id']});throw _0x29f4f5['stack']=_0x181047['stack'],this['fire']('error',{'error':_0x29f4f5}),_0x29f4f5;}}async['load'](_0x354616){try{const _0x25dce9=await this['connector']['fetchConversation'](_0x354616)['getConversation'](),_0x30cc39=await this['connector']['fetchConversationMessages'](_0x354616)['getMessages'](),_0x584208=_0x30cc39[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x25dce9['id'],'title'in _0x25dce9?this['fire']('setConversationTitle',_0x25dce9['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x1105b0=(await this['chatModels']['getAll']())['find'](_0x1c81e2=>_0x1c81e2['id']['toLowerCase']()===_0x584208['toLowerCase']());this['selectedModel']=_0x1105b0,this['fire']('modelSelected',{'selectedModel':_0x1105b0,'isDisabled':!0x0});const {streamingMessageId:_0xa194bd}=await this['_processMessagesToInteractions'](_0x30cc39,_0x584208);return _0xa194bd&&this['currentInteraction']?this['_resumeStream'](_0xa194bd):this['currentInteraction']=void 0x0,this;}catch(_0x49269b){const _0x191222=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0x49269b['message'],'conversationId':_0x354616});throw _0x191222['stack']=_0x49269b['stack'],this['fire']('error',{'error':_0x191222}),_0x191222;}}async['_processMessagesToInteractions'](_0x357dbd,_0x2afaf1){let _0x4d0a59,_0x7df7f1,_0x33c568=!0x1;for(const _0x20c771 of _0x357dbd)if('user'===_0x20c771['role']){const {contextItems:_0x7d942d,hasUnmatched:_0x467af8}=await this['_extractContextItems'](_0x20c771);_0x33c568=_0x467af8;const _0x570fd6={'isReasoningEnabled':Object['hasOwn'](_0x20c771['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x20c771['capabilities'],'webSearch')};_0x4d0a59=this['createInteraction']({'userMessage':_0x20c771['prompt'],'contextItems':_0x7d942d,'capabilities':_0x570fd6,'modelId':_0x2afaf1,'attributes':_0x20c771['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x4d0a59,_0x7df7f1=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x20c771['role']&&_0x4d0a59){if('streaming'===_0x20c771['status']){_0x7df7f1=_0x20c771['id'];continue;}if('error'===_0x20c771['status'])continue;const _0x26030f=[];for(const _0x1183c4 of _0x20c771['content'])switch(_0x1183c4['type']){case'text':case'modification':{const _0x1e0ba7=_0x4d0a59['getDocumentContext'](),_0x2d0c12=this['_hasSessionMismatch'](_0x1e0ba7)||_0x33c568;_0x4d0a59['currentReply']?.['type']!==_0x1183c4['type']&&(_0x4d0a59['currentReply']=_0x4d0a59['createReply']({'type':_0x1183c4['type'],'isDone':!0x0,'interactionId':_0x4d0a59['id'],'areActionsDisabled':_0x2d0c12,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x26030f['length']>0x0&&(_0x4d0a59['currentReply']['sources']=_0x26030f['splice'](0x0))),_0x4d0a59['currentReply']['appendContent'](_0x1183c4['content'],_0x1183c4['documentId']);break;}case'url':_0x26030f['push'](_0x1183c4);break;case'mcp-tool-result':{const {data:_0x43f657,attributes:_0x2af088}=JSON['parse'](_0x1183c4['content']);_0x4d0a59['_handleToolResultData']({'toolName':_0x1183c4['toolName'],'data':_0x43f657,'attributes':_0x2af088});break;}}'cancelled'===_0x20c771['status']&&this['fire']('error',{'interactionId':_0x4d0a59['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x7df7f1};}async['_resumeStream'](_0x8b986c){if(this['currentInteraction'])try{const _0x5cf834=this['connector']['resumeStream'](this['id'],_0x8b986c);await this['currentInteraction']['resume'](_0x5cf834);}catch(_0xd89fba){_0xd89fba instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0xd89fba});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x3d427a){const _0x146cd7=new Map();if(!_0x3d427a['content'])return{'contextItems':_0x146cd7,'hasUnmatched':!0x1};const {contextItem:_0x24a7e0,hasUnmatched:_0x38be9f}=await this['chatContext']['populateDocumentsFromMessage'](_0x3d427a['content'],Array['from'](this['_channelsToEditors']['values']()));_0x24a7e0&&_0x146cd7['set'](_0x24a7e0['id'],_0x24a7e0);for(const _0x51cd70 of _0x3d427a['content']){if('document'===_0x51cd70['type'])continue;const _0x47dc30=await this['chatContext']['populateFromMessage'](_0x51cd70);_0x47dc30&&_0x146cd7['set'](_0x47dc30['id'],_0x47dc30);}return{'contextItems':_0x146cd7,'hasUnmatched':_0x38be9f};}async['handleUserInteraction']({userMessage:_0x574707,attributes:_0x27e171}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x1aac77=new Map(this['getPendingContextItems']()),_0xe83893=this['chatCapabilities']['getCapabilitiesConfig'](),_0x476b48=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x574707,'contextItems':_0x1aac77,'capabilities':_0xe83893,'modelId':_0x476b48,'attributes':_0x27e171,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x1f9456){if(_0x1f9456 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x1f9456});else{const _0x5285e8=As['get'](_0x1f9456['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x5285e8,null,{'error':_0x1f9456})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x34b255,contextItems:_0x5a112d,capabilities:_0x25e6dd,modelId:_0x29cbe6,attributes:_0x105057,channelsToEditors:_0x5d3809}){const _0x52e174=new AIChatInteraction({'userMessage':_0x34b255,'contextItems':_0x5a112d,'capabilities':_0x25e6dd,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x29cbe6,'attributes':_0x105057,'channelsToEditors':_0x5d3809});return _0x52e174['delegate'](...Is)['to'](this),this['interactions']['push'](_0x52e174),this['fire']('interactionCreated',_0x52e174),_0x52e174;}['getInteraction'](_0x137827){return this['interactions']['find'](_0x42a56d=>_0x42a56d['id']===_0x137827);}['removeInteraction'](_0xc7cd51){const _0x31dd6a=this['getInteraction'](_0xc7cd51);_0x31dd6a&&(_0x31dd6a['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x31dd6a),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x1201f5=this['lastInteraction'];_0x1201f5?.['conversationId']&&_0x1201f5['messageId']&&this['connector']['cancelStream'](_0x1201f5['conversationId'],_0x1201f5['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x2314a7){this['chatContext']['addCurrentDocumentToContext'](_0x2314a7);}async['updateCurrentDocumentsInContext'](_0x5f3404){await this['chatContext']['updateCurrentDocuments'](_0x5f3404);}['toggleAddCurrentDocumentOptionVisibility'](_0x32f61b){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x32f61b);}['_hasSessionMismatch'](_0x34befc){return!!_0x34befc&&_0x34befc['documents']['some'](_0x3af521=>{const _0x6ae3b5=this['_channelsToEditors']['get'](_0x3af521['channelId']);return!_0x6ae3b5||_0x3af521['sessionId']!==this['_getSessionId'](_0x6ae3b5);});}['addSelectionToContext'](_0x23f038){this['chatContext']['addSelectionToContext'](_0x23f038);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x16785e){this['chatContext']['addFilesToContext'](_0x16785e);}['addUrlToContext'](_0x32727a){this['chatContext']['addUrlToContext'](_0x32727a);}['addToolItemToContext'](_0x43f070){this['chatContext']['addToolItemToContext'](_0x43f070);}['addResourceToContext'](_0x2ab2ad,_0x33ba57){this['chatContext']['addResourceToContext'](_0x2ab2ad,_0x33ba57);}['loadSourceResources'](_0x124b35,_0x18c0e4,_0x5130d4){return this['chatContext']['loadSourceResources'](_0x124b35,_0x18c0e4,_0x5130d4);}['removeFromContext'](_0x3d5143){this['chatContext']['removeFromContext'](_0x3d5143);}['setWebSearch'](_0xb470d9){this['chatCapabilities']['setWebSearch'](_0xb470d9);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x2cd928){this['chatCapabilities']['setReasoning'](_0x2cd928);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0xd41013){_0xd41013?!0x1===await this['chatModels']['isAvailable'](_0xd41013)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0xd41013}),_0xd41013=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0xd41013=(await this['chatModels']['getAvailableModels']())[0x0]),_0xd41013['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0xd41013,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0xd41013}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x35de32,config:_0x1ef7c9,locale:_0x25bac7}){super(),this['_connector']=_0x35de32,this['_config']=_0x1ef7c9,this['_locale']=_0x25bac7;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x9cd33c=await this['getAll']();let _0x2a971a;return _0x2a971a=this['_availableModels']?this['_filterModels'](_0x9cd33c,this['_availableModels']):_0x9cd33c['filter'](_0x4a9c34=>_0x4a9c34['recommended']),_0x2a971a;}async['getModel'](_0x260b28){const _0xe0d671=await this['getAll']();if(!_0xe0d671['length'])return null;if(_0x260b28){const _0x323fe3=this['_getModelById'](_0xe0d671,_0x260b28);if(_0x323fe3)return _0x323fe3;wt('ai-chat-model-id-unrecognized',{'modelId':_0x260b28,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0xa1191f=await this['getAvailableModels']();if(!_0xa1191f['length'])return null;if(this['_defaultModelId']){const _0x57f9d9=this['_getModelById'](_0xa1191f,this['_defaultModelId']);if(_0x57f9d9)return _0x57f9d9;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0xa1191f[0x0]['id']});}return _0xa1191f[0x0];}async['isAvailable'](_0x5e4c59){return(await this['getAvailableModels']())['some'](_0x3a6b2a=>_0x3a6b2a['name']===_0x5e4c59['name']&&_0x3a6b2a['provider']===_0x5e4c59['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x3cbcba=this['_locale']['uiLanguage']||'en',_0x1c8254=this['_connector']['getModels'](_0x3cbcba),_0x35a729=await _0x1c8254['list']();this['_modelList']=_0x35a729['items']['map'](_0x36bcc3=>Cs(_0x36bcc3)?{..._0x36bcc3,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x36bcc3);}catch(_0x3a2fd1){throw Ct('ai-models-unable-to-retrieve',{'error':_0x3a2fd1}),_0x3a2fd1;}return[...this['_modelList']];}['_filterModels'](_0x1685d4,_0x3a5df0){let _0x3ce924;if(_0x3a5df0){_0x3ce924=[];const _0x2b2f9e=new Set(),_0x2580ca='string'==typeof _0x3a5df0?[_0x3a5df0['toLocaleLowerCase']()]:_0x3a5df0['map'](_0x490996=>_0x490996['toLocaleLowerCase']());for(const _0x11cab4 of _0x2580ca)for(const _0x3101a9 of _0x1685d4)!_0x2b2f9e['has'](_0x3101a9['id'])&&this['_isMatchingFilter'](_0x3101a9,_0x11cab4)&&(_0x3ce924['push'](_0x3101a9),_0x2b2f9e['add'](_0x3101a9['id']));}else _0x3ce924=_0x1685d4;return _0x3ce924;}['_isMatchingFilter'](_0x5e3484,_0xa43ae4){const _0x39969b=_0x5e3484['id']['toLocaleLowerCase'](),_0x2496fd=_0x5e3484['name']['toLocaleLowerCase'](),_0x2ea765=_0x5e3484['provider']['toLocaleLowerCase']();return _0x39969b===_0xa43ae4||_0x2496fd===_0xa43ae4||Cs(_0x5e3484)&&'auto'===_0xa43ae4||_0x2ea765===_0xa43ae4||_0x39969b['startsWith'](_0xa43ae4);}['_getModelById'](_0x508213,_0x2bbb7b){return _0x508213['find'](_0x9cfa00=>Cs(_0x9cfa00)&&'auto'===_0x2bbb7b?_0x9cfa00:_0x9cfa00['id']===_0x2bbb7b)||null;}}function Cs(_0xb50003){return _0xb50003['id']['startsWith']('agent');}function ms(_0x26615c){return _0x26615c?_0x26615c instanceof _0x435807?[_0x26615c]:_0x26615c['editors']&&0x0!==_0x26615c['editors']['length']?Array['from'](_0x26615c['editors']):[]:[];}function ps(_0x441c2e){const _0x4a7c1f=ms(_0x441c2e);if(!_0x4a7c1f['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x4a7c1f['length'])return _0x4a7c1f[0x0];const _0x195408=_0x4a7c1f['find'](_0x2a61a2=>_0x2a61a2['ui']?.['focusTracker']?.['isFocused']);if(_0x195408)return _0x195408;const _0x4c0174=function(_0x385600){if(_0x385600 instanceof _0x435807)return;const _0x160c48=_0x385600;if(!_0x160c48['plugins']||!_0x160c48['plugins']['has']('AIEditing'))return;const _0x2e7f22=_0x160c48['plugins']['get']('AIEditing');return _0x2e7f22['getLastContentFocusedEditor']?.();}(_0x441c2e);return _0x4c0174&&_0x4a7c1f['includes'](_0x4c0174)?_0x4c0174:_0x4a7c1f[0x0];}function Es({interaction:_0x1443b0,reply:_0x2dd2c5,groups:_0x192182,transform:_0x59e259,documentCompare:_0x267414,documentCompareOptions:_0x1438c4}){const _0x4e18a1=_0x1443b0['getDocumentContext']()['documents']['find'](_0x28875d=>_0x28875d['id']==_0x192182[0x0]['documentId']),_0x20a860=_0x192182[0x0]['editor'];if(!_0x4e18a1)return[];const _0x4053d6=_0x4e18a1['content'],_0x1310c9=_0x4e18a1['version'],_0x27e42a=_0x2dd2c5['documentContextContent']['get'](_0x192182[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x153ab3}of _0x192182){const _0x79bf0=_0x153ab3['filter'](_0x450310=>'new'!=_0x450310['type'])['map'](_0x115b42=>Yi('data-id',_0x115b42['id'],_0x27e42a)),_0x227410=_0x153ab3['filter'](_0x545989=>'removed'!=_0x545989['type'])['map'](_0x1e2848=>_0x1e2848['node']['cloneNode'](!0x0));let _0xa74439=null;if(_0x79bf0['length']){_0xa74439=_0x79bf0[0x0]['previousSibling'];for(let _0x2c1e11=0x0;_0x2c1e11<_0x79bf0['length'];_0x2c1e11++)_0x1aae33(_0x79bf0[_0x2c1e11]);}if(_0x227410['length']){_0xa74439||(_0x153ab3[0x0]['anchorId']?_0xa74439=Yi('data-id',_0x153ab3[0x0]['anchorId'],_0x27e42a):(_0xa74439=_0x227410['shift'](),_0x2f7a9f(_0x27e42a,_0xa74439)));for(let _0x392096=0x0;_0x392096<_0x227410['length'];_0x392096++)_0x433357(_0xa74439,_0x227410[_0x392096]),_0xa74439=_0x227410[_0x392096];}}const _0x3bb9c6=Ki(_0x27e42a),_0x2738e1=_0x267414['getDiff'](_0x4053d6,_0x3bb9c6,{'targetEditor':_0x20a860,..._0x1438c4})['getOperations']();if(_0x59e259){const _0x55aa55=_0x20a860['model']['document']['history']['getOperations'](_0x1310c9),_0xfcb8ac={'document':_0x20a860['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x5d10bd(_0x2738e1,_0x55aa55,_0xfcb8ac)['operationsA'];}return _0x2738e1;}function Ts(_0x5823c8,_0x3a0c0c){if('marker'!=_0x3a0c0c['type'])return;const _0x567c19=_0x5823c8['model']['markers']['get'](_0x3a0c0c['name']);_0x567c19&&(_0x3a0c0c['oldRange']=_0x567c19['getRange']());}function fs(_0x5df250,_0x248324){if(_0x5df250['files']['length']>0x0&&_0x248324['filesEnabled']){const _0x2db95d=_0x5df250['files']['filter'](_0x156ece=>_0x156ece['name']);return _0x2db95d['length']>0x0?{'type':'file','files':_0x2db95d}:null;}if(_0x248324['urlsEnabled']){const _0x23d91d=function(_0x329e95){const _0x113c6e=_0x329e95['trim']();if(/\s/['test'](_0x113c6e))return null;try{const _0x2a79fb=new URL(_0x113c6e);return'http:'!==_0x2a79fb['protocol']&&'https:'!==_0x2a79fb['protocol']?null:_0x2a79fb['toString']();}catch{return null;}}(_0x5df250['plainText']);if(_0x23d91d)return{'type':'url','url':_0x23d91d};}const _0x5c9db2=_0x5df250['forceTextAttachment']?0x1:_0x248324['longTextThreshold']??0x1/0x0;if(_0x5df250['plainText']['length']>=Math['max'](_0x5c9db2,0x1)&&_0x248324['filesEnabled']){const _0x1bb0e9=_0x248324['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x5df250['plainText']],_0x1bb0e9,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x2e5d09{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x1289fc];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x2d51e2=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x194a2b,_0x1f6989)=>{this['_handleUIUserMessage']({'message':_0x1f6989});}),this['listenTo'](_0x2d51e2['view'],'change:activeTab',(_0x43c040,_0x4cca1b,_0x2c156d)=>{'chat'!==_0x2c156d&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x5d25f5,_0x196610)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x196610));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x1568ba,_0x391fc9)=>{this['activeConversation']?.['addUrlToContext'](_0x391fc9);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0xfe0f76,_0x5afe5a)=>{const _0x231329=this['activeConversation'];if(!_0x231329)return;_0x5afe5a['hasDirectory']&&(_0x5afe5a['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x390a96=fs(_0x5afe5a,{'pastedTextLabel':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x390a96&&(_0x5afe5a['preventDefault'](),'url'===_0x390a96['type']?_0x231329['addUrlToContext'](_0x390a96['url']):_0x231329['chatContext']['addFilesToContext'](_0x390a96['files'],void 0x0,_0x390a96['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5f4f31,_0xedfc2e)=>{_0xedfc2e['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x3588bc,_0x259595)=>{this['activeConversation']?.['addResourceToContext'](_0x259595['source'],_0x259595['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x36194c,_0x503e4d)=>{this['_removeFromContext'](_0x503e4d);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x1ddec7,_0x1fdcec)=>{this['activeConversation']?.['loadSourceResources'](_0x1fdcec['sourceId'],_0x1fdcec['query'],_0x1fdcec['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x456cd9,_0x2886ec)=>{this['activeConversation']?.['setModel'](_0x2886ec);}),this['listenTo'](this['_aiChatUi'],'like',(_0x1cfe61,{replyId:_0x4a23ee})=>{console['log']('Liked\x20response',_0x4a23ee);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x6929dd,{replyId:_0x21f788})=>{console['log']('Disliked\x20response',_0x21f788);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x58f7eb,_0xa25d28)=>{this['_insertSuggestion'](_0xa25d28);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3323df,{replyId:_0x1afd6d,partIndex:_0x37d31a})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x1afd6d,_0x37d31a);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x3d917d,{replyId:_0x4f074b,partIndex:_0x58a631})=>{const _0x516a03=this['_getDocumentRangeForReplyChanges'](_0x4f074b,_0x58a631);if(!_0x516a03)return;const {reply:_0x34b6e2}=this['getInteractionAndReplyById'](_0x4f074b);'$graveyard'!=_0x516a03['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x34b6e2['changeGroups'][_0x58a631]['editor'],'ranges':[_0x516a03['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x42ec9b,_0xc3d489)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0xc3d489);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x5ac4bb,{replyId:_0x1856a9,showDiff:_0x19658a})=>{const {interaction:_0x104a8c,reply:_0x50aa5a}=this['getInteractionAndReplyById'](_0x1856a9),_0x14c98d=_0x50aa5a['getContentParts']({'showDiff':_0x19658a});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x104a8c['id']+':'+_0x50aa5a['id'],'parts':_0x14c98d});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x87b8b2,{replyId:_0x2b8091,partIndex:_0x3997c5})=>{this['_rejectSuggestion']({'replyId':_0x2b8091,'partIndex':_0x3997c5}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x4cbcc5,_0x4cf8c8)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4cf8c8);}),this['on']('replyCreated',(_0x30835e,_0x4c7b80)=>{this['_addFeedItemReply'](_0x4c7b80);});}['afterInit'](){this['context']instanceof _0x435807?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x351020,_0x5e59f4)=>{_0x5e59f4['on']('ready',()=>{this['_integrateEditor'](_0x5e59f4);});}),this['_initConversation']();}async['_initConversation'](){const _0x1fe5a9=this['context']['config']['get']('ai.chat.initialConversation');let _0x530b3c=_0x1fe5a9;('lastCreated'!=_0x1fe5a9||(_0x530b3c=await this['_getLastCreatedConversationId'](),_0x530b3c))&&('new'==_0x530b3c?await this['_startConversationSafely']():await this['loadConversation'](_0x530b3c));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x1bee8a){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x1bee8a)['getConversation'](),await this['_startConversationSafely']({'id':_0x1bee8a}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x1bee8a),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x38bc84){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x1bee8a}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x38bc84}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x567946){let _0x1e42aa=null,_0x2c2312=null;this['on']('toolDataReceived',(_0x552756,_0xe41e17,_0x3ff036)=>{_0x3ff036['id']!==_0x1e42aa&&(_0x1e42aa=_0x3ff036['id'],_0x2c2312=this['_getAIChatFeedAPI'](_0x3ff036)),_0x567946(_0xe41e17,_0x2c2312);});}['addCurrentDocumentToChatContext'](){ms(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x22a6c0){const _0x1eba6d=this['_aiEditing']['getSelectionText'](_0x22a6c0);this['activeConversation']?.['addSelectionToContext'](_0x1eba6d),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x48f1af){await this['_startConversationSafely']({'modelId':_0x48f1af?.['modelId']});}async['sendMessage'](_0x9d9482){await this['_handleUIUserMessage'](_0x9d9482);}['getGroupId'](){const _0x58ef2f=this['context']['config']['get']('collaboration.channelId');if(!_0x58ef2f)throw new ht('ai-missing-channel-id',this);return _0x58ef2f;}['_handleRemovedConversation'](_0x494460){this['activeConversation']['id']===_0x494460&&this['_startConversationSafely']();}['_insertSuggestion'](_0x28595b){const _0x488502=this['context']['plugins']['get'](_0x1289fc),{reply:_0x4fb117,interaction:_0x1998ff}=this['getInteractionAndReplyById'](_0x28595b['replyId']),_0x4ea788=void 0x0!==_0x28595b['partIndex']?[_0x4fb117['changeGroups'][_0x28595b['partIndex']]]:_0x4fb117['changeGroups']['filter'](_0x232247=>'pending'==_0x232247['state']);_0x4ea788['map'](_0x2a2c3b=>_0x4fb117['changeGroups']['indexOf'](_0x2a2c3b))['forEach'](_0x1a94b6=>{const _0x20730c=this['_getDocumentRangeForReplyChanges'](_0x28595b['replyId'],_0x1a94b6);_0x20730c&&'$graveyard'!=_0x20730c['range']['root']['rootName']?(_0x4fb117['setChangeGroupState'](_0x1a94b6,'accepted'),void 0x0!==_0x28595b['partIndex']&&this['_scrollToSuggestionRange'](_0x20730c['range'],!0x1,_0x20730c['targetEditor'])):_0x4fb117['setChangeGroupState'](_0x1a94b6,'outdated');});const _0x3bed7a={},_0x5a32f4=_0x4ea788['reduce']((_0x1543da,_0x576a4b)=>('outdated'===_0x576a4b['state']||(_0x1543da[_0x576a4b['documentId']]=[..._0x1543da[_0x576a4b['documentId']]||[],_0x576a4b],_0x3bed7a[_0x576a4b['documentId']]=[..._0x3bed7a[_0x576a4b['documentId']]||[],_0x4fb117['changeGroups']['indexOf'](_0x576a4b)]),_0x1543da),{});for(const [_0x111fc9,_0x5badb5]of Object['entries'](_0x5a32f4)){const _0x5f287d=_0x5badb5[0x0]['editor'];if(!_0x5f287d['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x5f287d});continue;}const _0x2c3293=Es({'reply':_0x4fb117,'interaction':_0x1998ff,'groups':_0x5badb5,'transform':!0x0,'documentCompare':_0x488502,'documentCompareOptions':{'anchor':_0x5badb5[0x0]['rootName'],'markDeletions':!0x0}});let _0x129c1a;_0x5f287d['model']['change'](_0x46bee6=>{_0x129c1a=_0x46bee6['batch'],_0x5f287d['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2c3293),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x129c1a,{'interactionId':_0x1998ff['id'],'replyId':_0x4fb117['id'],'indexes':_0x3bed7a[_0x111fc9]});}this['_updateRatings'](_0x4fb117);}['_applySuggestion'](_0x2715f9){const _0x2484ed=this['context']['plugins']['get'](_0x1289fc),{reply:_0x1bc2ca,interaction:_0x3e2dee}=this['getInteractionAndReplyById'](_0x2715f9['replyId']),_0x4bc892=void 0x0!==_0x2715f9['partIndex']?[_0x1bc2ca['changeGroups'][_0x2715f9['partIndex']]]:_0x1bc2ca['changeGroups']['filter'](_0x1d1d71=>'pending'==_0x1d1d71['state']);_0x4bc892['map'](_0x423a0d=>_0x1bc2ca['changeGroups']['indexOf'](_0x423a0d))['forEach'](_0x1cf4fa=>{const _0x3c9ee9=this['_getDocumentRangeForReplyChanges'](_0x2715f9['replyId'],_0x1cf4fa);_0x3c9ee9&&'$graveyard'!=_0x3c9ee9['range']['root']['rootName']?(_0x1bc2ca['setChangeGroupState'](_0x1cf4fa,'accepted'),void 0x0!==_0x2715f9['partIndex']&&this['_scrollToSuggestionRange'](_0x3c9ee9['range'],!0x1,_0x3c9ee9['targetEditor'])):_0x1bc2ca['setChangeGroupState'](_0x1cf4fa,'outdated');});const _0x4a3221={},_0x8c50d5=_0x4bc892['reduce']((_0x1f690b,_0x3d0b1a)=>('outdated'===_0x3d0b1a['state']||(_0x1f690b[_0x3d0b1a['documentId']]=[..._0x1f690b[_0x3d0b1a['documentId']]||[],_0x3d0b1a],_0x4a3221[_0x3d0b1a['documentId']]=[..._0x4a3221[_0x3d0b1a['documentId']]||[],_0x1bc2ca['changeGroups']['indexOf'](_0x3d0b1a)]),_0x1f690b),{});for(const [_0x1b1c12,_0x1a0c0e]of Object['entries'](_0x8c50d5)){const _0x24f896=Es({'reply':_0x1bc2ca,'interaction':_0x3e2dee,'groups':_0x1a0c0e,'transform':!0x0,'documentCompare':_0x2484ed,'documentCompareOptions':{'anchor':_0x1a0c0e[0x0]['rootName'],'markDeletions':!0x1}});let _0x2a9305;const _0x38ce83=_0x1a0c0e[0x0]['editor'];_0x38ce83['model']['change'](_0x445b4a=>{_0x2a9305=_0x445b4a['batch'];for(const _0x968512 of _0x24f896)_0x968512['baseVersion']=_0x38ce83['model']['document']['version'],Ts(_0x38ce83,_0x968512),_0x445b4a['batch']['addOperation'](_0x968512),_0x38ce83['model']['applyOperation'](_0x968512);}),this['_batchToChanges']['set'](_0x2a9305,{'interactionId':_0x3e2dee['id'],'replyId':_0x1bc2ca['id'],'indexes':_0x4a3221[_0x1b1c12]});}this['_updateRatings'](_0x1bc2ca);}['_rejectSuggestion'](_0x43b26f){const {reply:_0x2ca375}=this['getInteractionAndReplyById'](_0x43b26f['replyId']);_0x2ca375['setChangeGroupState'](_0x43b26f['partIndex'],'rejected');}['_openBalloonFor'](_0x79519b,_0x3eb1ea){if(!this['_hasAIChatBalloon'])return;const {reply:_0x403eff}=this['getInteractionAndReplyById'](_0x79519b),_0x6b9d2e=_0x403eff['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x6b9d2e['length'])return;let _0xe7d240,_0x443d79;if(void 0x0!==_0x3eb1ea?(_0x443d79=_0x6b9d2e['find'](_0x15fc61=>_0x15fc61['index']==_0x3eb1ea),_0xe7d240=_0x443d79?.['index']):(_0x443d79=_0x6b9d2e[0x0],_0xe7d240=_0x443d79['index']),!_0x443d79)return void _0x403eff['setChangeGroupState'](_0x3eb1ea??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x79519b&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0xe7d240)return;const _0x36f129=this['_getUserPresentableContentPartDocumentRange'](_0x79519b,_0x403eff,_0x443d79),_0x42c7da=_0x403eff['changeGroups']['find'](_0x380f4d=>_0x380f4d['index']==_0xe7d240)['editor'],_0x439732=_0x42c7da['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x439732&&this['_activeBalloon']['close'](),!_0x36f129)return _0x439732['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x439732,this['_currentPreviewedChangeGroup']={'replyId':_0x79519b,'partIndex':_0xe7d240},this['_scrollToSuggestionRange'](_0x36f129,!0x0,_0x42c7da);const _0x2b2371=this['_getPresentableSiblingContentPartIndex'](_0x79519b,_0xe7d240,'next');_0x439732['clearContent'](),_0x439732['updateContent']({'part':_0x443d79,'renderingStrategy':'static'}),_0x439732['open']({'index':_0xe7d240,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0xe7d240+0x1)['toString']()),'showRotator':null!==_0x2b2371,'ranges':[_0x36f129],'areActionsDisabled':_0x403eff['areActionsDisabled'],'targetEditor':_0x42c7da}),_0x439732['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x79519b,_0xe7d240),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x79519b,'index':_0xe7d240,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x559e7f,_0x14010f,_0x431696){const {reply:_0x2e06e0}=this['getInteractionAndReplyById'](_0x559e7f),_0x1b9cbc=_0x2e06e0['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x1b9cbc['length'])return null;const _0x43c636='next'==_0x431696?0x1:-0x1;function _0x41f051(_0x5c20fb){const _0xa6ca88=(_0x5c20fb+_0x43c636+_0x1b9cbc['length'])%_0x1b9cbc['length'];return{'siblingIndex':_0xa6ca88,'siblingPart':_0x1b9cbc[_0xa6ca88]};}const _0x468051=_0x1b9cbc['findIndex'](_0x2ad704=>_0x2ad704['index']==_0x14010f);let {siblingIndex:_0x19f2ff,siblingPart:_0x225882}=_0x41f051(_0x468051);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x559e7f,_0x2e06e0,_0x225882);)if({siblingIndex:_0x19f2ff,siblingPart:_0x225882}=_0x41f051(_0x19f2ff),_0x19f2ff===_0x468051)return null;return _0x225882['index'];}['_getUserPresentableContentPartDocumentRange'](_0xd5eb1e,_0x112392,_0x3d06a1){const _0x57c5fe=_0x112392['changeGroups'];if(!_0x3d06a1['hasChanges'])return null;const _0x4ea4fe=_0x57c5fe['find'](_0x2f8331=>_0x2f8331['index']==_0x3d06a1['index']);if('pending'!==_0x4ea4fe?.['state'])return null;if('destroyed'===_0x4ea4fe?.['editor']['state'])return _0x112392['setChangeGroupState'](_0x3d06a1['index'],'outdated'),null;const _0x2f39f6=this['_getDocumentRangeForReplyChanges'](_0xd5eb1e,_0x3d06a1['index']);if(!_0x2f39f6)return _0x112392['setChangeGroupState'](_0x3d06a1['index'],'outdated'),null;const {range:_0x5edd98,currentIndex:_0x1307ed}=_0x2f39f6;return'$graveyard'==_0x5edd98['root']['rootName']?(_0x112392['setChangeGroupState'](_0x1307ed,'outdated'),null):_0x2f39f6['range'];}['_getDocumentRangeForReplyChanges'](_0x9521e5,_0xfee0f){const {reply:_0xc32dd4,interaction:_0x2dda37}=this['getInteractionAndReplyById'](_0x9521e5),_0x59b5ff=_0xc32dd4['changeGroups']['filter'](_0x24804f=>'pending'==_0x24804f['state']),_0x149aa0=_0x59b5ff['map'](_0x2df43f=>_0xc32dd4['changeGroups']['indexOf'](_0x2df43f));void 0x0===_0xfee0f&&(_0xfee0f=_0x149aa0[0x0]);const _0x2cc86e=_0x149aa0['indexOf'](_0xfee0f);if(-0x1==_0x2cc86e)return null;const _0x1ab132=_0x59b5ff[_0x2cc86e],_0x2db98d=_0x1ab132['editor'];if('destroyed'===_0x2db98d['state'])return null;const _0x43b4cc=_0xc32dd4['documentContextContent']['get'](_0x1ab132['documentId']),_0x2ac287=new _0x49fb06([]),_0x146578=new _0x49fb06([]);for(const _0x1a4d5a of _0x1ab132['changes'])if('removed'!=_0x1a4d5a['type']&&_0x146578['children']['push'](_0x1a4d5a['node']['cloneNode'](!0x0)),'new'!=_0x1a4d5a['type']){const _0x352662=_0x2605ec(_0x78c4f8=>Xi(_0x78c4f8,'data-id')==_0x1a4d5a['id'],_0x43b4cc,!0x0);_0x2ac287['children']['push'](_0x352662['cloneNode'](!0x0));}if(0x0==_0x2ac287['children']['length']){if(_0x1ab132['changes'][0x0]['anchorId']){const _0xc15e52=Yi('data-id',_0x1ab132['changes'][0x0]['anchorId'],_0x43b4cc);_0x2ac287['children']['unshift'](_0xc15e52['cloneNode'](!0x0)),_0x146578['children']['unshift'](_0xc15e52['cloneNode'](!0x0)),_0xc15e52['nextSibling']&&(_0x2ac287['children']['push'](_0xc15e52['nextSibling']['cloneNode'](!0x0)),_0x146578['children']['push'](_0xc15e52['nextSibling']['cloneNode'](!0x0)));}else{const _0x4437ff=_0x43b4cc['children'][0x0];if(!_0x4437ff)return null;_0x2ac287['children']['push'](_0x4437ff['cloneNode'](!0x0)),_0x146578['children']['push'](_0x4437ff['cloneNode'](!0x0));}}const _0x210cb0=_0x2dda37['getDocumentContext'](),_0x4aa85d=_0x210cb0['content']||_0x210cb0['documents']['find'](_0x460ec3=>_0x460ec3['id']==_0x1ab132['documentId'])['content'],_0x2f9cb3=_0x2db98d['model']['document']['getRoot'](_0x1ab132['rootName']),_0x44e357=_0x2db98d['data']['parse'](_0x4aa85d,_0x2f9cb3),_0x37ae13=Ki(_0x2ac287),_0x5941a9=_0x2db98d['data']['parse'](_0x37ae13,_0x2f9cb3),_0x29c5fd=_0x2db98d['data']['parse'](_0x37ae13,_0x2f9cb3),_0x5b30c4=_0x2db98d['model']['createPositionAt'](_0x5941a9,0x0),_0x8dc6cf=Ki(_0x146578),_0x447ddf={'targetEditor':_0x2db98d,'anchor':_0x5b30c4,'markDeletions':!0x1},_0x581066=_0x2db98d['plugins']['get'](_0x1289fc)['getDiff'](_0x37ae13,_0x8dc6cf,_0x447ddf)['getOperations']();if(!_0x581066['length'])return null;_0x2db98d['model']['change'](_0x182a7a=>{for(const _0x53082e of _0x581066)if('remove'==_0x53082e['type']){const _0x530473=_0x53082e['sourcePosition'],_0x5f433a=_0x53082e['howMany'],_0xdfa990=new _0x2b0abe(_0x530473,_0x5f433a);_0x182a7a['batch']['addOperation'](_0xdfa990),_0x2db98d['model']['applyOperation'](_0xdfa990);}else'marker'!==_0x53082e['type']&&(_0x53082e['baseVersion']=null,_0x53082e['isDocumentOperation']=!0x1,_0x182a7a['batch']['addOperation'](_0x53082e),_0x2db98d['model']['applyOperation'](_0x53082e));});const _0x58195a=cs(_0x2db98d,_0x581066,_0x5941a9);us(_0x2db98d['model'],_0x58195a);const _0x42322d=_0x58195a['getFirstRange']()['start']['path']['slice'](),_0x47bf76=_0x58195a['getFirstRange']()['end']['path']['slice'](),_0x3fead5=[];let _0x21e1ba=_0x5941a9,_0x1a7bf6=_0x29c5fd;for(let _0x2d7397=0x0;_0x2d7397<_0x47bf76['length'];_0x2d7397++){const _0x313dc2=_0x21e1ba['maxOffset']-_0x47bf76[_0x2d7397];_0x3fead5[_0x2d7397]=_0x1a7bf6['maxOffset']-_0x313dc2,_0x21e1ba=_0x21e1ba['getChildAtOffset'](_0x47bf76[_0x2d7397]),_0x1a7bf6=_0x1a7bf6['getChildAtOffset'](_0x3fead5[_0x2d7397]);}const _0x598a87=_0x2db98d['model']['createRange'](_0x2db98d['model']['createPositionFromPath'](_0x29c5fd,_0x42322d),_0x2db98d['model']['createPositionFromPath'](_0x29c5fd,_0x3fead5)),_0x3231cd=_0x29c5fd['getChild'](0x0)['getAttribute'](_0x9b10fa),_0x3804fb=Array['from'](_0x44e357['getChildren']())['find'](_0x1adce1=>_0x1adce1['getAttribute'](_0x9b10fa)==_0x3231cd)['getPath'](),_0x2847b5=_0x598a87['start']['path']['slice'](),_0x32647e=_0x598a87['end']['path']['slice']();_0x2847b5[0x0]=_0x3804fb[0x0]+_0x2847b5[0x0],_0x32647e[0x0]=_0x3804fb[0x0]+_0x32647e[0x0];let _0x1c88dc=_0x2db98d['model']['createRange'](_0x2db98d['model']['createPositionFromPath'](_0x2db98d['model']['document']['getRoot'](_0x1ab132['rootName']),_0x2847b5),_0x2db98d['model']['createPositionFromPath'](_0x2db98d['model']['document']['getRoot'](_0x1ab132['rootName']),_0x32647e));const _0x54e5f2=_0x210cb0['documents']['find'](_0xa9cd80=>_0xa9cd80['id']==_0x1ab132['documentId'])['version'],_0x8174a4=_0x2db98d['model']['document']['history']['getOperations'](_0x54e5f2);for(const _0x14aab6 of _0x8174a4)_0x1c88dc=_0x805f9a['_createFromRanges'](_0x1c88dc['getTransformedByOperation'](_0x14aab6));return{'range':_0x1c88dc,'currentIndex':_0xfee0f,'targetEditor':_0x2db98d};}['_integrateEditorBalloon'](_0x13b891){if(!_0x13b891['plugins']['has']('AIChatBalloon'))return;const _0x25f479=_0x13b891['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x25f479['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x25f479,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x4991f6,partIndex:_0x441b79}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x549cea}=this['getInteractionAndReplyById'](_0x4991f6),_0xf3a2a9=_0x549cea['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x441b79});_0x25f479['updateContent']({'part':_0xf3a2a9[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x25f479,'applySuggestion',()=>{const {replyId:_0x3b5a3a,partIndex:_0x5e35f2}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3b5a3a,'partIndex':_0x5e35f2}),_0x25f479['setState']('accepted');}),this['listenTo'](_0x25f479,'insertSuggestion',()=>{const {replyId:_0xdf06d,partIndex:_0x582de1}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0xdf06d,'partIndex':_0x582de1}),_0x25f479['setState']('accepted');}),this['listenTo'](_0x25f479,'rejectSuggestion',()=>{const {replyId:_0x186dc2,partIndex:_0x575310}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x186dc2,'partIndex':_0x575310}),_0x25f479['setState']('rejected');}),this['listenTo'](_0x25f479,'showNext',()=>{const {replyId:_0x2f7564,partIndex:_0x38b0b3}=this['_currentPreviewedChangeGroup'],_0x691ec9=this['_getPresentableSiblingContentPartIndex'](_0x2f7564,_0x38b0b3,'next');null!==_0x691ec9&&this['_openBalloonFor'](_0x2f7564,_0x691ec9);}),this['listenTo'](_0x25f479,'showPrevious',()=>{const {replyId:_0x13008b,partIndex:_0x26ba9d}=this['_currentPreviewedChangeGroup'],_0x562423=this['_getPresentableSiblingContentPartIndex'](_0x13008b,_0x26ba9d,'previous');null!==_0x562423&&this['_openBalloonFor'](_0x13008b,_0x562423);}),this['listenTo'](_0x25f479,'dialogClosed',(_0x45f754,{id:_0x46dd7f})=>{if('aiChatBalloon'!==_0x46dd7f)return;const {replyId:_0x32e56d,partIndex:_0x3dd35a}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x32e56d,'index':_0x3dd35a,'isActive':!0x1}),this['_activeBalloon']===_0x25f479&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x200fcc){if(this['_channelsToEditors']['set'](_0x200fcc['config']['get']('collaboration.channelId'),_0x200fcc),this['_integrateEditorBalloon'](_0x200fcc),this['addCurrentDocumentToChatContext'](),_0x200fcc['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x200fcc['plugins']['has']('Undo')){const _0x858f1=_0x200fcc['commands']['get']('undo'),_0x4dfacf=_0x200fcc['commands']['get']('redo');this['listenTo'](_0x858f1,'revert',(_0x394958,_0x263101,_0x4220da)=>{const _0x5498e2=this['_batchToChanges']['get'](_0x263101);if(!_0x5498e2)return;const _0x300f04=this['activeConversation']['getInteraction'](_0x5498e2['interactionId']),_0x53aabf=_0x300f04?.['getReply'](_0x5498e2['replyId']);this['_batchToChanges']['delete'](_0x263101),_0x300f04&&_0x53aabf&&(_0x5498e2['indexes']['forEach'](_0x51142f=>_0x53aabf['setChangeGroupState'](_0x51142f,'pending')),this['_batchToChanges']['set'](_0x4220da,_0x5498e2));}),this['listenTo'](_0x4dfacf,'revert',(_0x2030c0,_0x40f344,_0x3d3d33)=>{const _0x45acb3=this['_batchToChanges']['get'](_0x40f344);if(!_0x45acb3)return;const _0x44c2bf=this['activeConversation']['getInteraction'](_0x45acb3['interactionId']),_0x180c42=_0x44c2bf?.['getReply'](_0x45acb3['replyId']);this['_batchToChanges']['delete'](_0x40f344),_0x44c2bf&&_0x180c42&&(_0x45acb3['indexes']['forEach'](_0x10dff9=>_0x180c42['setChangeGroupState'](_0x10dff9,'accepted')),this['_batchToChanges']['set'](_0x3d3d33,_0x45acb3));});}const _0xe32fcb=_0x200fcc['config']['get']('ai.chat.context');_0xe32fcb['alwaysAddSelection']&&_0xe32fcb['document']['enabled']&&this['listenTo'](_0x200fcc['model']['document']['selection'],'change:range',(_0x584004,_0x319226)=>{if(!_0x319226['directChange'])return;'chat'===_0x200fcc['plugins']['get']('AITabs')['view']['activeTab']&&(_0x200fcc['model']['hasContent'](_0x200fcc['model']['document']['selection'])?this['addSelectionToChatContext'](_0x200fcc):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x6e37bc=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x137603=await _0x6e37bc['getConversations']();return _0x137603['length']?_0x137603[0x0]['id']:'new';}catch(_0x438a1b){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x438a1b})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x5f4550={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x5f4550);}catch(_0x5bac15){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5f4550['id']||at()}),console['error'](_0x5bac15),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x11beeb,modelId:_0x4a0b8c}={}){this['_closeActiveBalloon']();let _0x4a67dc=_0x4a0b8c;_0x4a67dc||(_0x11beeb||!this['activeConversation']?_0x4a67dc=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x4a67dc=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x5a91c0=this['getGroupId'](),_0x126b4f=_0x11beeb||at();let _0x2c5ffe;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x4a67dc,'conversationId':_0x126b4f,'group':_0x5a91c0,'locale':this['context']['locale'],'isFromHistory':!!_0x11beeb,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x314585=>this['_aiEditing']['getSessionId'](_0x314585)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0xadf469,_0x2b696f)=>{this['_aiChatUi']['createConversation'](_0x2b696f),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x11beeb||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x13a474,_0x21562d)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x21562d['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x301c5f=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x301c5f);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x5d8bb2=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x5d8bb2);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x6409a9,_0x163f7e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x163f7e,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x5c4833,_0x5e18b9)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x5e18b9,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['listenTo'](this['activeConversation'],'interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['listenTo'](this['activeConversation'],'interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['listenTo'](this['activeConversation'],'interactionDestroyed',(_0x5ea951,_0x35afe0)=>{this['_aiChatUi']['removeFeedInteraction'](_0x35afe0['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x4de2f2,_0x5c1a61,_0x2d3ad0)=>{this['_updateConversationTitle'](_0x5c1a61,_0x2d3ad0);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x2cb815,_0x22664b)=>{void 0x0!==_0x2c5ffe&&_0x2c5ffe!==_0x22664b['id']&&this['_updateReplyContentThrottled']['flush'](),_0x2c5ffe=_0x22664b['id'],_0x22664b['isFromHistory']?await this['_updateReplyContent']({'reply':_0x22664b}):await this['_updateReplyContentThrottled']({'reply':_0x22664b});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x5506f2,{reply:_0x56a60c,index:_0x522a40,state:_0x18c698})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x56a60c['id'],'index':_0x522a40,'state':_0x18c698}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x56a60c['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x522a40&&this['_activeBalloon']?.['setState'](_0x18c698);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x296c3a,_0x309dde)=>{if(this['_aiChatUi']['addContextItem'](_0x309dde['contextItem'],_0x309dde['isLoading']),'selection'===_0x309dde['contextItem']['type']){const _0x2877b3=ps(this['context']),_0x528b7a=[..._0x2877b3['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2877b3,'ranges':_0x528b7a,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x11fd81,_0x1c90be)=>{this['_aiChatUi']['removeContextItem'](_0x1c90be['uiId']),'current-document'==_0x1c90be['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x1c90be['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x4317af,_0x20df2e)=>{this['_aiChatUi']['setContextItemLoading'](_0x20df2e['contextItem']['uiId'],_0x20df2e['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x283ab1,_0x4ffbc8)=>{this['_aiChatUi']['setConversationContext'](_0x4ffbc8['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x30d5c2,_0x4463c7)=>{this['_aiChatUi']['setAddContextOptions'](_0x4463c7['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1ae522,_0x2f2e5b)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x2f2e5b['sourceId'],_0x2f2e5b['source'],_0x2f2e5b['resources'],_0x2f2e5b['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x15d391,_0x329929)=>{this['_aiChatUi']['updateResourceState'](_0x329929['sourceId'],_0x329929['resourceId'],_0x329929['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x4dc429,_0x5513b8)=>{this['_aiChatUi']['updateCapabilities'](_0x5513b8);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x550281,_0x1bc485)=>{const _0x81fceb=(await this['_aiChatModels']['getAll']())['find'](_0x1f7fde=>_0x1f7fde['id']===_0x1bc485['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x81fceb,_0x1bc485['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x1a97f1,{error:_0x2b7a58,interactionId:_0x2e30e6,fileName:_0x4abebf,url:_0x25d584,sourceId:_0x131d24,sourceLabel:_0x5aad72})=>{const _0x50444d=_0x2e30e6?_0x2e30e6+':'+at():at();_0x2b7a58['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x50444d}):_0x2b7a58['message']['startsWith']('ai-chat-conversation-init-failed')||_0x2b7a58['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x4abebf),'id':_0x50444d}):_0x2b7a58['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x25d584),'id':_0x50444d}):_0x2b7a58['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x50444d}):_0x2b7a58['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x50444d}):_0x2b7a58['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x131d24&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x131d24),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x5aad72||'source'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):_0x2b7a58['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x50444d}),this['_logError'](_0x2b7a58)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x50444d}),this['_logError'](_0x2b7a58));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x11beeb||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0xd73c29,attributes:_0x2f444c}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3a683a=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3a683a);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0xd73c29,'attributes':_0x2f444c});}['_logError'](_0x426249){Ct(_0x426249['message'],_0x426249['data']);}['_removeFromContext'](_0x41c483){this['activeConversation']?.['removeFromContext'](_0x41c483);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x51eabe){const [_0x448027,_0x2946e6]=_0x51eabe['split'](':'),_0x1cf0fc=this['activeConversation']['getInteraction'](_0x448027),_0x46eba4=_0x1cf0fc['getReply'](_0x2946e6);return{'interaction':_0x1cf0fc,'reply':_0x46eba4};}['_scrollToSuggestionRange'](_0x10c3c8,_0x2b7f5f=!0x1,_0x11e8ee){const _0x519d61={'target':_0x11e8ee['editing']['view']['domConverter']['viewRangeToDom'](_0x11e8ee['editing']['mapper']['toViewRange'](_0x10c3c8)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x2b7f5f};_0x2b7f5f&&(_0x519d61['alignToTop']=!0x0),Tt(_0x519d61);}['_updateConversationTitle'](_0x524d5f,_0x2e7b4f=!0x1){this['_aiChatUi']['setConversationTitle'](_0x524d5f||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x2e7b4f);}['_addFeedItemReply'](_0xe4572a){'text'===_0xe4572a['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xe4572a):this['_aiChatUi']['addFeedItemAISuggestion'](_0xe4572a);}async['_updateReplyContent']({reply:_0x40dd5f,renderingStrategy:_0x59ebac}){const {id:_0x1bfa84,interactionId:_0x2ae5a7,isDone:_0x3827b7,type:_0x418f06,parsedContent:_0xf1ee4a}=_0x40dd5f,_0x5b55e1=_0x2ae5a7+':'+_0x1bfa84;if('modification'===_0x418f06){const _0xb1e95d=_0x40dd5f['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5b55e1,'parts':_0xb1e95d,'isDone':_0x3827b7,'skipLoadingEffects':_0x40dd5f['isFromHistory']});}else'text'===_0x418f06&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x5b55e1,'parsedContent':_0xf1ee4a['get']('text'),'renderingStrategy':_0x59ebac,'isDone':_0x3827b7});_0x3827b7&&_0x40dd5f['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x5b55e1,_0x40dd5f['sources']);}['_updateReplyContentThrottled']=_0x3efce3(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x235975=this['activeConversation']?.['lastInteraction'];_0x235975&&(_0x235975['stop'](),this['_aiChatUi']['stopInteraction'](_0x235975)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x4e3b47=this['activeConversation']?.['lastInteraction'];if(_0x4e3b47){for await(const _0x29d0ac of _0x4e3b47['replies'])this['_aiChatUi']['hasFeedItem'](_0x29d0ac['id'])||this['_addFeedItemReply'](_0x29d0ac),await this['_updateReplyContent']({'reply':_0x29d0ac,'renderingStrategy':'static'});}}['_updateRatings'](_0x584416){const _0x5a53f5={'positiveCount':_0x584416['changeGroups']['filter'](_0x1c4709=>'accepted'===_0x1c4709['state'])['length'],'totalCount':_0x584416['changeGroups']['length'],'modificationId':_0x584416['id']},_0x2d52b7=this['activeConversation']['getInteraction'](_0x584416['interactionId'])['messageId'];_0x2d52b7&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x2d52b7,_0x5a53f5);}['_getAIChatFeedAPI'](_0x15a370){const _0x212de0=this['_aiChatUi'],_0x55ac0e=()=>{_0x15a370['resetWebSearchState'](),_0x15a370['resetReasoningState'](),_0x212de0['clearLoadingMessage']();},_0x11110c=()=>{_0x15a370['currentReply']&&(_0x15a370['currentReply']['done'](),_0x15a370['currentReply']=void 0x0);};return{'insertTextReply':(_0x2c88bd,_0x4c9287)=>{_0x11110c(),_0x55ac0e();const _0x1821df=_0x15a370['currentReply']=_0x15a370['createReply']({'type':'text','interactionId':_0x15a370['id'],'id':_0x4c9287||at(),'channelsToEditors':this['_channelsToEditors']});return _0x1821df['appendContent'](_0x2c88bd),_0x11110c(),_0x1821df;},'insertCustomElement':async(_0x5099c1,_0x14a699)=>(_0x11110c(),_0x55ac0e(),_0x212de0['addFeedItemCustomElement'](_0x5099c1,_0x14a699||at())),'setLoadingMessage':_0x5d2dcd=>{_0x212de0['setLoadingMessage'](_0x5d2dcd);},'clearLoadingMessage':()=>{_0x212de0['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ms(this['context'])['find'](_0x5025d2=>'destroyed'!==_0x5025d2['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const Rs='ai-selection',bs=['br'];class AIEditing extends _0x2e5d09{constructor(_0x54279){super(_0x54279),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x3a15e4){let _0x56161e=this['_sessionIdByEditor']['get'](_0x3a15e4);return!_0x56161e&&(_0x56161e=_0x3a15e4['plugins']['has']('RealTimeCollaborationClient')&&_0x3a15e4['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x3a15e4,_0x56161e)),_0x56161e;}async['getDocumentData'](){const _0x89e9cb=ms(this['context']);if(!_0x89e9cb['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x1eeaa6=[],_0x77c0b6=new Set();for(const _0x54ec37 of _0x89e9cb){const _0x288c8a=_0x54ec37['config']['get']('roots')||{};for(const _0x5dd5b5 of _0x54ec37['model']['document']['getRoots']()){if('$graveyard'===_0x5dd5b5['rootName'])continue;const _0xbb83b4=await this['_getDocumentDataForEditorRoot'](_0x54ec37,_0x5dd5b5,_0x77c0b6),_0xbb4993=_0x288c8a[_0x5dd5b5['rootName']];let _0xd7173e;_0xbb4993?.['label']?_0xd7173e=_0xbb4993['label']:(wt('ai-document-root-missing-label',{'editor':_0x54ec37,'rootConfig':_0xbb4993}),_0xd7173e=_0x5dd5b5['rootName']),_0x1eeaa6['push']({'editor':_0x54ec37,'rootName':_0x5dd5b5['rootName'],'content':_0xbb83b4['content'],'version':_0xbb83b4['version'],'sessionId':this['getSessionId'](_0x54ec37),'channelId':_0x54ec37['config']['get']('collaboration.channelId'),'selections':_0xbb83b4['selections'],'name':_0xd7173e,'description':_0xbb4993?.['description']});}}return _0x1eeaa6;}async['_getDocumentDataForEditorRoot'](_0x1df74e,_0x1fa8ce,_0x14e8fe){const _0x2159b8=_0x1df74e['data']['toView'](_0x1fa8ce,{'convertAiChatSelectionMarker':!0x0}),_0x26564e=new _0x4fdba0(_0x1df74e['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x2159b8,_0x26564e,_0x14e8fe);let _0x13644e=await this['_getDocumentDataStringFromView'](_0x2159b8,_0x1df74e);const _0x58a5c4=this['_getMarkersInDocumentOrder'](_0x1df74e,_0x1fa8ce),_0x54a82d=[];for(const _0x160c4a of _0x58a5c4){const _0x1a3911='<'+_0x160c4a['name']+':start></'+_0x160c4a['name']+':start>',_0x2e7851=_0x13644e['indexOf'](_0x1a3911);_0x13644e=_0x13644e['substring'](0x0,_0x2e7851)+_0x13644e['substring'](_0x2e7851+_0x1a3911['length']);const _0x4a2f5a='<'+_0x160c4a['name']+':end></'+_0x160c4a['name']+':end>',_0x3ffc71=_0x13644e['indexOf'](_0x4a2f5a);_0x13644e=_0x13644e['substring'](0x0,_0x3ffc71)+_0x13644e['substring'](_0x3ffc71+_0x4a2f5a['length']),_0x54a82d['push']({'markerName':_0x160c4a['name'],'start':_0x2e7851,'end':_0x3ffc71,'htmlFragment':_0x13644e['substring'](_0x2e7851,_0x3ffc71)});}return{'content':_0x13644e,'version':_0x1df74e['model']['document']['version'],'selections':_0x54a82d};}['afterInit'](){this['context']instanceof _0x435807?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2ac1da,_0x2c874c)=>{_0x2c874c['on']('ready',()=>{this['_integrateEditor'](_0x2c874c);});});}['_setOutputDataProcessor'](_0x5436c8){this['_outputDataProcessor']=_0x5436c8;}async['_getDocumentDataStringFromView'](_0x5ad339,_0x4e5bde){let _0x3b7b38;if(this['_outputDataProcessor']){const _0x53fdd4=_0x4e5bde['data']['processor']['domConverter']['viewToDom'](_0x5ad339),_0x5ba63d=await this['_outputDataProcessor'](_0x53fdd4);_0x3b7b38=_0x4e5bde['data']['processor']['htmlWriter']['getHtml'](_0x5ba63d);}else _0x3b7b38=_0x4e5bde['data']['processor']['toData'](_0x5ad339);return _0x3b7b38;}['_integrateEditor'](_0x38d75b){if(!_0x38d75b['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x38d75b);_0x38d75b['ui']['focusTracker']['on']('change:isFocused',(_0x4210b1,_0x2d7010,_0x4d96c9)=>{_0x4d96c9&&(this['_lastContentFocusedEditor']=_0x38d75b);}),_0x38d75b['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x38d75b&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x38d75b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Rs,'view':({markerName:_0x484f88})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x484f88['split'](':')[0x1]],'priority':0xc})}),_0x38d75b['conversion']['for']('dataDowncast')['markerToElement']({'model':Rs+':context','view':(_0x1143a,{writer:_0x5a4990,options:_0xf8dd07})=>_0xf8dd07['convertAiChatSelectionMarker']?_0x5a4990['createUIElement'](_0x1143a['markerName']+':'+(_0x1143a['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x1ea4f6){const _0x12fcaf=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x1ea4f6);const _0xbc49c0=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x12fcaf,_0xbc49c0);}['hideFakeVisualSelection'](_0x14b22f){const _0x24b68c=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x14b22f);const _0x10fc70=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x24b68c,_0x10fc70);}async['modelToDataWithIds'](_0x308eb0,_0x2713a1){const _0x503f1a=_0x2713a1['data']['toView'](_0x308eb0),_0x3edcd2=new _0x4fdba0(_0x2713a1['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x503f1a,_0x3edcd2),this['_getDocumentDataStringFromView'](_0x503f1a,_0x2713a1);}['_setDataIdsOnChildren'](_0x58f1cb,_0x258c59,_0x3688b3=new Set()){let _0x1f19d1=!0x1;for(const _0x1c2207 of _0x58f1cb['getChildren']()){if(!_0x1c2207['is']('view:element')||bs['includes'](_0x1c2207['name']))continue;const _0x29f304=_0x1c2207['is']('view:containerElement'),_0x1166c=_0x1c2207['is']('view:emptyElement'),_0x3104ef=_0x1c2207['is']('view:rawElement'),_0x37a563=this['_setDataIdsOnChildren'](_0x1c2207,_0x258c59,_0x3688b3);if(_0x1c2207['hasAttribute']('data-id')){_0x1f19d1=!0x0,_0x3688b3['add'](_0x1c2207['getAttribute']('data-id'));continue;}(_0x29f304||_0x1166c||_0x3104ef||_0x37a563)&&(_0x258c59['setAttribute']('data-id',this['_nextDataId'](_0x3688b3),_0x1c2207),_0x1f19d1=!0x0);}return _0x1f19d1;}['_nextDataId'](_0x355eed){let _0x127ddd;do{_0x127ddd='';for(let _0xd80c0e=0x0;_0xd80c0e<0x4;_0xd80c0e++)_0x127ddd+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x355eed['has'](_0x127ddd));return _0x355eed['add'](_0x127ddd),_0x127ddd;}['getSelectionText'](_0x34af85){const _0x8ce533=(_0x34af85?_0x34af85['model']:ps(this['context'])['model'])['document']['selection'],_0x28e941=[],_0x43e742=Array['from'](_0x8ce533['getRanges']());_0x43e742['sort']((_0x4be70d,_0x3ceeaf)=>_0x4be70d['start']['isBefore'](_0x3ceeaf['start'])?-0x1:0x1);for(const _0x117b4c of _0x43e742)for(const _0x55cdf9 of _0x117b4c['getItems']())_0x55cdf9['is']('$textProxy')?_0x28e941['push'](_0x55cdf9['data']):_0x55cdf9['is']('element')&&_0x28e941['length']>0x0&&'\x20'!==_0x28e941[_0x28e941['length']-0x1]&&_0x28e941['push']('\x20');return _0x28e941['length']?'\x22'+_0x28e941['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x4b3704){for(let _0x597adb=0x0;_0x597adb<this['_fakeSelections']['length'];_0x597adb++)if(this['_fakeSelections'][_0x597adb]['id']==_0x4b3704)return void this['_fakeSelections']['splice'](_0x597adb,0x1);}['_addFakeSelection'](_0x39b662){this['_removeFakeSelectionById'](_0x39b662['id']),ft(this['_fakeSelections'],_0x39b662);}['_refreshFakeSelection'](_0x4afa94,_0x2fac66){if(_0x4afa94==_0x2fac66)return;const _0xc44ea2=_0x4afa94?_0x4afa94['editor']:null,_0x20fee8=_0x2fac66?_0x2fac66['editor']:null,_0x236997=(_0xbcb095,_0x1fb79a)=>{const _0x270d76=_0x1fb79a['model']['markers']['getMarkersGroup'](Rs);for(const _0x2b6269 of _0x270d76)_0xbcb095['removeMarker'](_0x2b6269);},_0x31afd1=(_0x346014,_0xfa56d6,_0x5214b4)=>{const _0x2cd6bb=_0xfa56d6['model'];for(let _0x37bf95=0x0;_0x37bf95<_0x5214b4['ranges']['length'];_0x37bf95++){let _0x7a58a0=_0x5214b4['ranges'][_0x37bf95];const _0x423385=Rs+':'+_0x5214b4['id']+':'+_0x37bf95;if(_0x7a58a0['start']['isAtEnd']){const _0x2b9676=_0x7a58a0['start']['getLastMatchingPosition'](({item:_0x1d501b})=>!_0x2cd6bb['schema']['isContent'](_0x1d501b),{'boundaries':_0x7a58a0});_0x7a58a0=_0x346014['createRange'](_0x2b9676,_0x7a58a0['end']);}_0x346014['addMarker'](_0x423385,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x7a58a0});}};_0xc44ea2&&_0x20fee8&&_0xc44ea2===_0x20fee8&&_0x2fac66?_0xc44ea2['model']['change'](_0xe01930=>{_0x236997(_0xe01930,_0xc44ea2),_0x31afd1(_0xe01930,_0x20fee8,_0x2fac66);}):(_0xc44ea2&&_0xc44ea2['model']['change'](_0x1294fe=>_0x236997(_0x1294fe,_0xc44ea2)),_0x20fee8&&_0x2fac66&&_0x20fee8['model']['change'](_0x1481f3=>_0x31afd1(_0x1481f3,_0x20fee8,_0x2fac66)));}['_getMarkersInDocumentOrder'](_0x59b521,_0x16e2db){const _0x4b7225=Array['from'](_0x59b521['model']['markers']['getMarkersGroup'](Rs+':context'));return(_0x16e2db?_0x4b7225['filter'](_0x3ec629=>{const _0x3e75b1=_0x3ec629['getRange']();return _0x3e75b1&&_0x3e75b1['root']['rootName']===_0x16e2db['rootName'];}):_0x4b7225)['sort']((_0x4d7d6d,_0x2aef45)=>_0x4d7d6d['getStart']()['isBefore'](_0x2aef45['getStart']())?-0x1:_0x4d7d6d['getStart']()['isAfter'](_0x2aef45['getStart']())?0x1:0x0);}}const Ss=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Os=[...Ss,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function vs(_0x377006){const _0x29ea55=new AbortController();return{'promise':new Promise((_0x453e4c,_0x2f97ae)=>{const _0x5a3a94=setTimeout(_0x453e4c,_0x377006);_0x29ea55['signal']['addEventListener']('abort',()=>{clearTimeout(_0x5a3a94),_0x2f97ae();});}),'abortController':_0x29ea55};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x399302){this['options']={'delay':_0x399302?.['delay']??0xa,'textNodeStyle':_0x399302?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x14c9ca,targetElement:_0x4af802,abortSignal:_0x54bc6a}){this['isStreaming']&&this['stop'](),_0x54bc6a?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x3777a6(_0x14c9ca,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x5c40e5=0x0;_0x5c40e5<this['currentIndex'];_0x5c40e5++)this['nodesList'][_0x5c40e5]['shouldBeStreamed']=!0x0;do{const _0x5a5bac=Date['now'](),_0x5aed57=this['nodesList'][this['currentIndex']],_0x552a35=_0x5a5bac-this['lastUpdateTime'];if(_0x5aed57){_0x5aed57['shouldBeStreamed']=!0x0;let _0x431a23=_0x5aed57['parent'];for(;_0x431a23;)_0x431a23['shouldBeStreamed']=!0x0,_0x431a23=_0x431a23['parent'];}if(_0x552a35<this['options']['delay'])try{const {promise:_0xc298d5,abortController:_0x9f47ef}=vs(this['options']['delay']-_0x552a35);this['timeoutAbortController']=_0x9f47ef,await _0xc298d5;}catch(_0x40cab5){return;}_0x5e167d(_0x4af802,'<'+_0x4af802['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x4af802['tagName']+'>',{'childrenOnly':!0x0}),this['currentIndex']++,this['lastUpdateTime']=Date['now']();}while(this['currentIndex']<this['nodesList']['length']);this['currentIndex']=this['nodesList']['length'],this['isStreaming']=!0x1;}['reset'](){this['isStreaming']=!0x1,this['document']=null,this['nodesList']=[],this['currentIndex']=0x0,this['timeoutAbortController']=null;}['cleanUpAnimations']({targetElement:_0x44c22f}){Array['from'](_0x44c22f['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x5f370c=>{_0x5f370c['replaceWith'](_0x5f370c['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x17aac2){let _0x5afd8c='';if(function(_0x283692){return _0x1ace06(_0x283692);}(_0x17aac2)){for(const _0x35a545 of _0x17aac2['children'])_0x5afd8c+=this['renderNode'](_0x35a545);}else{if(Ns(_0x17aac2)){if(!_0x17aac2['shouldBeStreamed'])return'';const _0x51ae17=_0x17aac2,_0xdd6724=Object['entries'](_0x51ae17['attribs'])['map'](([_0x58749b,_0x1ab0ef])=>_0x58749b+'=\x22'+_0x1ab0ef+'\x22')['join']('\x20');_0x5afd8c+='<'+_0x51ae17['tagName']+(_0xdd6724?'\x20'+_0xdd6724:'')+'>';for(const _0x3eeb2b of _0x30df0e(_0x51ae17))_0x5afd8c+=this['renderNode'](_0x3eeb2b);_0x5afd8c+='</'+_0x51ae17['tagName']+'>';}else{if(!ys(_0x17aac2))return'';if(!_0x17aac2['shouldBeStreamed'])return'';!function(_0x255c9b){if(!_0x255c9b['parent']||!Ns(_0x255c9b['parent']))return!0x1;if(!ks['includes'](_0x255c9b['parent']['tagName']))return!0x1;return!ti(_0x255c9b)['match'](/^\s*[<>]\s*$/);}(_0x17aac2)?_0x5afd8c+=_0x5d6d16(_0x17aac2):_0x5afd8c+=_0x5d6d16(new _0x2f80a7('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x17aac2]));}}return _0x5afd8c;}['getParsedDocumentNodeList'](){const _0x3611e0=[];return function(_0x18159c,_0x4e0526){const _0x582da6=_0x69f73=>{if(_0x4e0526(_0x69f73),_0x69f73 instanceof _0x4e770c)for(let _0x56bc63=0x0;_0x56bc63<_0x69f73['children']['length'];_0x56bc63++){const _0x44ec2b=_0x69f73['children'][_0x56bc63];_0x582da6(_0x44ec2b);}};for(let _0x2766f4=0x0;_0x2766f4<_0x18159c['children']['length'];_0x2766f4++)_0x582da6(_0x18159c['children'][_0x2766f4]);}(this['document'],_0x4f744a=>{if(ys(_0x4f744a)){const _0x44bddd=this['splitTextNodeIntoWordNodes'](_0x4f744a);_0x44bddd['length']&&_0x3611e0['push'](..._0x44bddd);}_0x4f744a['isWordSplitSource']||_0x4f744a['isWordSplitResult']||_0x3611e0['push'](_0x4f744a);}),_0x3611e0;}['splitTextNodeIntoWordNodes'](_0x3f725a){if(_0x3f725a['isWordSplitSource']||_0x3f725a['isWordSplitResult'])return[];const _0x23a36d=ti(_0x3f725a)['match'](/(?:\s*\S+\s*)/g),_0x58fb77=[];if(_0x23a36d&&_0x23a36d['length']>0x1){for(const _0x430afd of _0x23a36d){const _0x34c97b=new _0x2c0b48(_0x430afd);_0x34c97b['isWordSplitResult']=!0x0,_0x151fab(_0x3f725a,_0x34c97b),_0x58fb77['push'](_0x34c97b);}_0x3f725a['isWordSplitSource']=!0x0,_0x1aae33(_0x3f725a);}return _0x58fb77;}}const ks=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ys(_0xe7394e){return _0x29bd03(_0xe7394e);}function Ns(_0x22a420){return _0x2ff01e(_0x22a420);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x5bb3b7){super();const _0x5d3d21=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x5bb3b7,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x5d3d21['if']('isDone','ck-ai-chat__feed__item_done'),_0x5d3d21['if']('isVisible','ck-hidden',_0x252ba7=>!_0x252ba7),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x5da73f=>{_0x5da73f['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x94c18a,_0x711c6e,_0x2df310){await this['htmlStreamer']['stream']({'document':_0x94c18a,'targetElement':_0x711c6e,'abortSignal':_0x2df310});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0xa1a30,_0x21f034){super(_0xa1a30),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0xa1a30),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0xa1a30,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x21f034['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x293a1f=>_0x293a1f?_0x9a19f:_0x54b721),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x223b10=new Lt();_0x223b10['content']=_0xdbabf8,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x21f034['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x223b10,{'tag':'span','children':[Mi(_0xa1a30,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const xs={'accepted':_0x4fb4f5,'rejected':_0x2ba020,'outdated':_0x2ba020};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x161701){super(_0x161701);const _0x31d2a7=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x31d2a7['to']('state',_0x2644a8=>'ck-ai-suggestion__content-part-state_'+_0x2644a8),_0x31d2a7['if']('isVisible','ck-hidden',_0x396986=>!_0x396986)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x31d2a7['to']('state',_0x3c092f=>{switch(_0x3c092f){case'accepted':return Mi(_0x161701,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x161701,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x161701,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x349f3b){this['state']=_0x349f3b;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=xs[this['state']],this['on']('change:state',()=>{this['content']=xs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x4d4686,_0x256d21,_0x1c862a){super(_0x4d4686);const _0x1f0d96=Boolean(_0x1c862a);this['set']('isEnabled',!_0x1f0d96),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x49dfb4=[];if(_0x1f0d96){const _0x5e02b=new yt(_0x4d4686);_0x5e02b['set']({'label':Mi(_0x4d4686,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2a9ed6}),_0x5e02b['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x49dfb4['push'](_0x5e02b);}else{_0x256d21['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x4d4686),this['_applyButton']['set']({'label':Mi(_0x4d4686,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4fb4f5}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x4afe51=>!_0x4afe51),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x49dfb4['push'](this['_applyButton'])),_0x256d21['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x4d4686),this['_suggestButton']['set']({'label':Mi(_0x4d4686,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x452d46}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x49dfb4['push'](this['_suggestButton']));const _0x1aa62a=new yt(_0x4d4686);_0x1aa62a['set']({'label':Mi(_0x4d4686,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2ba020}),_0x1aa62a['bind']('isEnabled')['to'](this),_0x1aa62a['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x49dfb4['push'](_0x1aa62a);}this['items']['addMany'](_0x49dfb4);const _0x5c5470=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x5c5470['if']('isVisible','ck-hidden',_0x521d94=>!_0x521d94)]}});}['setButtonsVisibility']({showApplyButton:_0x4b2218,showSuggestButton:_0x5edde7}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x4b2218),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x5edde7);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x3b52e2,{part:_0x1b7bb7,uiIndex:_0xe361eb,availableActions:_0x4c4393,areActionsDisabled:_0x6df776}){super(_0x3b52e2),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x3b52e2,_0x4c4393,_0x6df776),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x1b7bb7['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x1b7bb7['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x1b7bb7['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x3b52e2),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x3b52e2,_0xe361eb),this['children']=this['createCollection'](),this['children']['addMany']([this['titleLabelView'],this['toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-suggestion__body__content-part__title']},'children':this['children']}),this['on']('change:state',(_0x57a09d,_0x2cd25e,_0x5c9c01,_0x22683b)=>{'pending'===_0x22683b?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x5c9c01?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x5c9c01),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x3755de,_0x763ec0){super(_0x3755de),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x3755de,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x763ec0['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x277c9d){super(_0x277c9d),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x4e0043,renderingStrategy:_0x19a753,abortSignal:_0xd5c334}){const _0x16bccc=_0x3777a6(_0x4e0043['content'],!0x0);for(const _0x5ed024 of qi(_0x16bccc))_0x1aae33(_0x5ed024);'streaming'===_0x19a753?await this['htmlStreamer']['stream']({'document':_0x16bccc,'targetElement':this['element'],'abortSignal':_0xd5c334}):_0x5e167d(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x16bccc)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x3d2cbd,{part:_0xadc8f5,uiIndex:_0x4f914f,areActionsDisabled:_0x3e30b9,availableActions:_0x4954ce}){super(_0x3d2cbd);const _0x2d5130=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x45e494=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x3e30b9;};this['on']('change:state',_0x45e494),this['on']('change:isDone',_0x45e494),_0x45e494(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x3d2cbd,{'part':_0xadc8f5,'uiIndex':_0x4f914f,'availableActions':_0x4954ce,'areActionsDisabled':_0x3e30b9}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Ss)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x3d2cbd),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x2d5130['to']('state',_0xa5c6f8=>'ck-ai-suggestion__body__content-part_'+_0xa5c6f8),_0x2d5130['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x2d5130['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x2d5130['if']('isVisible','ck-hidden',_0x25f169=>!_0x25f169)]},'children':this['_children'],'on':{'mouseenter':_0x2d5130['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0xadc8f5['index']});}),'mouseleave':_0x2d5130['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0xadc8f5['index']});}),'click':_0x2d5130['to'](_0x2fdb65=>{const _0x2494ac=_0x2fdb65['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2494ac)&&this['fire']('showChangeInText',{'index':_0xadc8f5['index']});})}});}async['updateContent']({part:_0x116b12,showUnchangedParts:_0x4432e4=!0x1,abortSignal:_0x34c680}){this['partDefinition']=_0x116b12,this['isVisible']=this['partDefinition']['hasChanges']||_0x4432e4,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x116b12,'renderingStrategy':'static','abortSignal':_0x34c680});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x14bd1a,_0xbaa3e7){super(_0x14bd1a),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3e87a4=>!_0x3e87a4)]},'children':this['_createSkeletonItems'](_0xbaa3e7)});}['_createSkeletonItems'](_0x44c26f){const _0x58adbb=['ck','ck-ai-skeleton__item'];return _0x44c26f['map'](_0x877146=>{let _0x29ad4f='';switch(_0x877146['attributes']['align']){case'right':_0x29ad4f='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x29ad4f='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x29ad4f='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x877146['tag'],'attributes':{'class':[..._0x58adbb,_0x877146['attributes']['class']?_0x877146['attributes']['class']:''],'style':'width:\x20'+_0x877146['attributes']['width']+';\x20height:\x20'+_0x877146['attributes']['height']+';'+_0x29ad4f}};});}}const Ls={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Ps(0x5,'100%','44px','right'),'aiChatResources':Ps(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Ps(_0x478990,_0x4a7034,_0x551a8a,_0x4bceb8){return new Array(_0x478990)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4a7034,'height':_0x551a8a,'align':_0x4bceb8}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x4f8d2b){const _0x501559=this['createTask'](_0x4f8d2b);return this['queue']['push'](_0x501559),this['_processQueue'](),_0x501559['completePromise'];}['abort'](){this['isProcessing']&&(this['_abortController']['abort'](),this['_abortController']=void 0x0,this['queue']=[],this['fire']('_queueEmpty'),this['isProcessing']=!0x1);}get['queueEmptyPromise'](){return this['queue']['length']||this['isProcessing']?new Promise(_0x456933=>{this['once']('_queueEmpty',()=>{_0x456933();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x301fd0=this['queue']['shift']();try{await _0x301fd0['callback'](this['_abortController']['signal']),_0x301fd0['resolve']();}catch(_0x57650d){_0x301fd0['reject'](_0x57650d);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x537c53){let _0x59c155,_0x336d3e;const _0x1800a1=new Promise((_0x2864d1,_0x4d1b57)=>{_0x59c155=_0x2864d1,_0x336d3e=_0x4d1b57;});return{'callback':_0x537c53,'resolve':_0x59c155,'reject':_0x336d3e,'completePromise':_0x1800a1};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x266dca){super(_0x266dca),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x266dca['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x4e627b){this['element']['innerHTML']=_0x4e627b;}}const Ds=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x2496b1,_0x5aef6d=[...Ds],_0x2df6c8){super(_0x2496b1);const _0x19e7f7=this['bindTemplate'],_0x21b37c=Boolean(_0x2df6c8);if(this['set']('isEnabled',!_0x21b37c),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x21b37c){const _0x285d33=new yt(_0x2496b1);_0x285d33['set']({'label':Mi(_0x2496b1,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2a9ed6}),_0x285d33['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x484caa=new Nt(_0x2496b1);_0x484caa['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x2496b1,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x285d33]}]}),this['children']['add'](_0x484caa);}else this['_applyChangesButton']=new yt(_0x2496b1),this['_applyChangesButton']['set']({'label':Mi(_0x2496b1,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5aef6d['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x2496b1),this['_insertSuggestionsButton']['set']({'label':Mi(_0x2496b1,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5aef6d['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2fc7ee=>{_0x2fc7ee['bind']('isEnabled')['to'](this);}),this['children']['addMany']([this['_applyChangesButton'],this['_insertSuggestionsButton']]);this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__ai-suggestion__actions',_0x19e7f7['if']('isVisible','ck-hidden',_0x21d791=>!_0x21d791)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x4ffeb5){this['isVisible']=_0x4ffeb5;}['_switchButtonLabelsPlurality'](_0x3dffdd){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x3dffdd?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x5f30c1,_0x150615){super(_0x5f30c1),this['bodyCollection']=_0x150615,this['children']=this['createCollection'](),this['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources',this['bindTemplate']['if']('isVisible','ck-hidden',_0x1cbec1=>!_0x1cbec1)]},'children':this['children']});const _0x1635ea=new Nt(this['locale']),_0x1a8a2c=new Lt();_0x1a8a2c['content']=_0x5da227,_0x1635ea['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x1a8a2c,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x1635ea),this['_setupBalloonPanel'](_0x5f30c1);}['addSource'](_0x4c4ff7){this['children']['add'](new AIWebSourceView(this['locale'],_0x4c4ff7,this['balloonPanelView']));}['_setupBalloonPanel'](_0x293d50){this['balloonPanelView']=new zt(_0x293d50),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x902933,_0x2889a8,_0x37fc54){super(_0x902933),this['source']=_0x2889a8,this['balloonPanelView']=_0x37fc54,this['set']({'label':_0x2889a8['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x53381d=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x53381d['to'](()=>{window['open'](_0x2889a8['url'],'_blank');}),'mouseenter':_0x53381d['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x53381d['to'](()=>{this['_hideTooltip']();})}}),_0x2889a8['favicon']){const _0x296120=new Nt(_0x902933);_0x296120['setTemplate']({'tag':'img','attributes':{'src':_0x2889a8['favicon']||_0x5da227,'alt':_0x2889a8['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x296120);}else this['set']('icon',_0x5da227);}['_createTooltipContentView'](_0x3aef45,_0x1c02ac){const _0x3adb18=new Nt(_0x3aef45),_0x364ceb=[];let _0x52d8b1;_0x1c02ac?.['favicon']?(_0x52d8b1=new Nt(_0x3aef45),_0x52d8b1['setTemplate']({'tag':'img','attributes':{'src':_0x1c02ac['favicon'],'alt':_0x1c02ac['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x52d8b1=new Lt(),_0x52d8b1['content']=_0x5da227,_0x52d8b1['extendTemplate']({'attributes':{'alt':_0x1c02ac['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x364ceb['push'](_0x52d8b1);const _0x1b072d=new Nt(_0x3aef45);_0x1b072d['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x1c02ac['url']},'children':[{'text':new URL(_0x1c02ac['url'])?.['hostname']}]}),_0x364ceb['push'](_0x1b072d);const _0x4cc334=new Nt(_0x3aef45);_0x4cc334['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x364ceb});const _0xde4a1a=new Nt(_0x3aef45);return _0xde4a1a['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x1c02ac['title']['length']>0x190?_0x1c02ac['title']['substring'](0x0,0x190)+'...':_0x1c02ac['title']}]}),_0x3adb18['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x4cc334,_0xde4a1a]}),_0x3adb18;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0xdf140f=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0xdf140f);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x5b0594(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x5bb26a,_0x379291){super(_0x5bb26a);const {areActionsDisabled:_0xa9b721,showUnchangedParts:_0x270a51,availableActions:_0x4c9bcf}=_0x379291;this['_areActionsDisabled']=_0xa9b721,this['_showUnchangedParts']=_0x270a51,this['_availableActions']=_0x4c9bcf,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x5bb26a,Ls['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x5bb26a,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x5bb26a,_0x379291['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x379291['bodyCollection']),_0x379291['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Ss)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0xbeefd5=>_0xbeefd5 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x5ec14a,abortSignal:_0x1a7087,skipLoadingEffects:_0x4952c4}){this['_cachedContentParts']['length']?_0x5ec14a['forEach'](_0x521ddb=>{const _0x5a1d49=this['_cachedContentParts']['findIndex'](_0x3ba33f=>_0x3ba33f['index']==_0x521ddb['index']);-0x1===_0x5a1d49?this['_cachedContentParts']['push'](_0x521ddb):this['_cachedContentParts'][_0x5a1d49]=_0x521ddb;}):this['_cachedContentParts']=_0x5ec14a;const _0x174efd=this['_showUnchangedParts']?_0x5ec14a:_0x5ec14a['filter'](_0x468fc0=>_0x468fc0['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x174efd['length']>0x1),_0x4952c4&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x12402a of _0x174efd)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x42fa40=>{let _0x59838f=this['getPartView'](_0x12402a['index']);if(!_0x59838f){if(_0x59838f=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x12402a,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x59838f['delegate'](...Ss)['to'](this),_0x59838f['bind']('isTrackChangesOn')['to'](this),!_0x4952c4&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x42fa40),_0x42fa40['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x59838f,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x4952c4||this['_showSkeletonDebounced']();}await _0x59838f['updateContent']({'part':_0x12402a,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x42fa40}),_0x59838f['markAsDone']();});return _0x1a7087?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x1cd81d,_0x47ac5d){const _0xd3051e=this['getPartView'](_0x1cd81d);_0xd3051e&&(_0xd3051e['state']=_0x47ac5d),this['hasPendingParts']='pending'==_0x47ac5d||this['_contentPartViews']['some'](_0x1e658c=>'pending'==_0x1e658c['state']);}['setPartActive'](_0x5939c0,_0x3d1df1){if(!0x1===_0x5939c0){for(const _0x338e57 of this['_contentPartViews'])_0x338e57['isActive']=!0x1;}else{const _0x434e40=this['getPartView'](_0x5939c0);_0x434e40&&(_0x434e40['isActive']=_0x3d1df1);}}['updateSources'](_0x3ae7e9){_0x3ae7e9['forEach'](_0x3f11d0=>this['_sourcesView']['addSource'](_0x3f11d0)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x18519a){return this['_contentPartViews']['find'](_0x2d603b=>_0x2d603b['partDefinition']['index']==_0x18519a)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x4ffcd8=!this['_cachedContentParts']['find'](({hasChanges:_0x37a972})=>_0x37a972),_0x4e3c5d=!!this['_cachedContentParts']['find'](({hasChanges:_0x3887c6})=>!_0x3887c6);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x4e3c5d,_0x4ffcd8?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x12a603=>_0x12a603['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x21f0c9){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x4f1382=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x4f1382>0x0){const {promise:_0x2396e6,abortController:_0x5e184d}=vs(_0x4f1382);_0x21f0c9?.['addEventListener']('abort',()=>_0x5e184d['abort']()),await _0x2396e6['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x429142=>_0x429142['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4900bd,_0x5bb452,_0x117035){super(_0x4900bd);const {showDiff:_0x3bdfc0,areActionsDisabled:_0x5e6599,showUnchangedParts:_0x2cf51b,availableActions:_0x5c1073}=_0x5bb452;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4900bd,{'showDiff':_0x3bdfc0}),this['headerView']['on']('toggleShowChanges',(_0x612505,_0x371ebb)=>{this['areChangesVisible']=_0x371ebb['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x371ebb['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4900bd,{'areActionsDisabled':_0x5e6599,'showUnchangedParts':!!_0x2cf51b,'availableActions':_0x5c1073,'bodyCollection':_0x117035}),this['bodyView']['delegate'](...Ss)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x1c24ee){await this['bodyView']['updateContentParts'](_0x1c24ee);}['updateSources'](_0x58b78c){this['bodyView']['updateSources'](_0x58b78c);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x567fea,_0x535fec,_0x1c38db){super(_0x535fec),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x567fea,{'showDiff':_0x535fec['showDiff'],'areActionsDisabled':_0x535fec['areActionsDisabled'],'availableActions':_0x535fec['availableActions']},_0x1c38db),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x3ef6f4,_0x4159e4)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4159e4['showDiff']});}),this['containerView']['bind']('isTrackChangesOn')['to'](this),this['containerView']['on']('like',()=>{this['fire']('like',{'replyId':this['options']['id']});}),this['containerView']['on']('dislike',()=>{this['fire']('dislike',{'replyId':this['options']['id']});}),this['containerView']['on']('showChangeInText',(_0x195dec,{index:_0x43ebe2})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x43ebe2});}),this['containerView']['on']('applySuggestion',(_0x586892,{index:_0x35bf58}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x35bf58});}),this['containerView']['on']('insertSuggestion',(_0x2c71cd,{index:_0x495eba}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x495eba});}),this['containerView']['on']('rejectSuggestion',(_0x7283ce,{index:_0x35e23d})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x35e23d});}),this['containerView']['on']('mouseOverSuggestion',(_0x1e127e,{index:_0x449e98})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x449e98});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x139a86,{index:_0x1ffe03})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1ffe03});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x51f270){await this['containerView']['updateContent'](_0x51f270);}['updatePartState'](_0x4be1b1,_0xbd83b8){this['containerView']['bodyView']['updatePartState'](_0x4be1b1,_0xbd83b8);}['setPartActive'](_0xf41ca8,_0x148d7d){!0x1===_0xf41ca8?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0xf41ca8,_0x148d7d);}['updateSources'](_0xc6acb1){this['containerView']['updateSources'](_0xc6acb1);}['getPartView'](_0x41ffc6){return this['containerView']['bodyView']['getPartView'](_0x41ffc6);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x178ddb,_0x81ff6d,_0x3eb6e3){super(_0x81ff6d),this['_bodyCollection']=_0x3eb6e3,this['locale']=_0x178ddb,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x1da2b9,renderingStrategy:_0x164d3d,abortSignal:_0x108674}){'streaming'===_0x164d3d?await this['streamIntoElement'](_0x1da2b9,this['replyContainer']['element'],_0x108674):this['replyContainer']['element']['innerHTML']=_0x5d6d16(_0x1da2b9);}['updateSources'](_0x45d1ef){const _0x3cc793=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x3cc793['children']['addMany'](_0x45d1ef['map'](_0x12b82b=>new AIWebSourceView(this['locale'],_0x12b82b,_0x3cc793['balloonPanelView']))),_0x3cc793['isVisible']=!0x0,this['children']['add'](_0x3cc793);}}class AISpinnerView extends xt{constructor(_0x1b6dc0=void 0x0){super();const _0x5a4902=_0x1b6dc0?'ck-ai-spinner_'+_0x1b6dc0:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x5a4902]}});}}const Vs={'file':_0x15039b,'image':_0xb6dd68,'document':_0xdbabf8,'web-resource':_0x35b63e,'text':_0x15039b,'selection':_0x474b74,'mcp-tool-context':_0xdbabf8},Hs='ck-ai-chat-context-chip',Ms='ck-ai-chat-context-chip_wide',Us='ck-ai-chat-context-chip_document',Bs='ck-ai-chat-context-chip__label',Gs='ck-ai-chat-context-chip__type-icon',Fs='ck-ai-chat-context-controls__chip-tooltip',Ws='n';class AIChatContextItemButtonView extends yt{constructor(_0x5bc33a,_0x215b88,_0x309873,_0x4c6ff3,_0x11e499=!0x1){super(_0x5bc33a),this['_isAnimationOnEnterEnabled']=_0x4c6ff3,this['_initializeProperties'](_0x215b88,_0x309873,_0x11e499),this['_setupTemplate']();}['render'](){super['render'](),this['_isAnimationOnEnterEnabled']&&this['element']&&(this['element']['classList']['add']('ck-ai-chat-context-chip_new-chip'),this['_handleAnimationEndOnce'](this['element'],()=>{this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}));}['disableAnimationOnEnter'](){this['_isAnimationOnEnterEnabled']=!0x1,this['element']&&this['element']['classList']['remove']('ck-ai-chat-context-chip_new-chip');}['_initializeProperties'](_0x36a457,_0x49d971,_0x495d0a){this['set']('label',_0x36a457['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x36a457['type']),this['set']('id',_0x36a457['uiId']),this['set']('readonly',_0x49d971),this['set']('isLoading',_0x495d0a);}['_setupTemplate'](){const _0xaeb3a6=this['_createIconView'](),_0x69fc45=this['_createRemoveButton'](),_0xe1df01=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0xe1df01),'children':this['_createTemplateChildren'](_0xaeb3a6,_0x69fc45,_0xe1df01)});}['_createTemplateAttributes'](_0x541062){return{'class':[Hs,_0x541062['if']('itemType',Us,_0x4f0e04=>'document'==_0x4f0e04),_0x541062['if']('itemType',Ms,_0xed2786=>'selection'==_0xed2786)],'data-cke-tooltip-text':_0x541062['to']('label',Ks),'data-cke-tooltip-position':Ws,'data-cke-tooltip-class':Fs};}['_createTemplateChildren'](_0x511765,_0x447809,_0x17eedf){const _0x1761cf=this['_createLabelElement'](_0x17eedf),_0x261f03=this['_createLoaderIcon']();return this['readonly']?[_0x511765,_0x1761cf]:[_0x511765,_0x261f03,_0x1761cf,_0x447809];}['_createLabelElement'](_0x20b40c){return{'tag':'span','attributes':{'class':Bs},'children':[{'text':_0x20b40c['to']('label')}]};}['_createRemoveButton'](){const _0x320ca1=new yt(this['locale']);return _0x320ca1['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x395853}),this['_setupRemoveButtonEvent'](_0x320ca1),_0x320ca1;}['_setupRemoveButtonEvent'](_0x2b0c23){_0x2b0c23['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x5945eb=this['bindTemplate'],_0x207b4f=new Lt();return _0x207b4f['content']=Vs[this['itemType']],_0x207b4f['extendTemplate']({'attributes':{'class':[Gs,_0x5945eb['if']('isLoading','ck-hidden',_0x2c057a=>_0x2c057a)]}}),_0x207b4f;}['_handleAnimationEndOnce'](_0x723085,_0x2d8a86){if(!_0x723085)return;const _0xc80b39=()=>{_0x2d8a86(),_0x723085['removeEventListener']('animationend',_0xc80b39),_0x723085['removeEventListener']('webkitAnimationEnd',_0xc80b39);};_0x723085['addEventListener']('animationend',_0xc80b39),_0x723085['addEventListener']('webkitAnimationEnd',_0xc80b39);}['_createLoaderIcon'](){const _0x2c596d=new AISpinnerView('small');return _0x2c596d['bind']('isVisible')['to'](this,'isLoading',_0x1176b7=>_0x1176b7),_0x2c596d;}}function Ks(_0x2bc5a8){if(!_0x2bc5a8)return _0x2bc5a8;if(_0x2bc5a8['length']<=0x78)return _0x2bc5a8;const _0x223d19=_0x2bc5a8['slice'](0x0,0x78),_0x4bed8f=_0x223d19['lastIndexOf']('\x20');return(_0x4bed8f>0x0?_0x223d19['slice'](0x0,_0x4bed8f):_0x223d19)+'…';}const Ys={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},$s='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x1de481,_0x1eccf7,_0x535bc5,_0x38d96e,_0x21ec8d){this['_locale']=_0x1de481,this['_visibleChips']=_0x1eccf7,this['_config']={...Ys,..._0x535bc5,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x535bc5['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x38d96e,this['_parentView']=_0x21ec8d||null;}['setContainerElement'](_0x5b5a24){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x5b5a24,this['_setupVisibilityObserver']();}get['showMoreButtonView'](){return this['_showMoreButtonView'];}get['overflowChips'](){return this['_overflowChips'];}['reorganizeChips'](){requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});}['showBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_updateBalloonContent'](),this['_showMoreButtonView']['isOn']=!0x0,this['_showMoreBalloonPanelView']['show'](),this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')}));}['hideBalloonPanel'](){this['_showMoreButtonView']&&this['_showMoreBalloonPanelView']&&(this['_showMoreButtonView']['isOn']=!0x1,this['_showMoreBalloonPanelView']['hide']());}['clear'](){this['_overflowChips']['clear'](),this['hideBalloonPanel'](),this['_updateShowMoreButtonVisibility'](),this['_showMoreButtonView']&&(this['_showMoreButtonView']['label']=''),this['_showMoreBalloonPanelView']&&this['_showMoreBalloonPanelView']['content']['clear']();}['destroy'](){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_showMoreButtonView']&&(this['_showMoreButtonView']['destroy'](),this['_showMoreButtonView']=null),this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['destroy'](),this['_showMoreBalloonPanelView']=null);}['_checkAndHandleOverflow'](){if(!this['_containerElement'])return;if(!this['_isContainerVisible']())return void(this['_pendingCalculation']=!0x0);this['_pendingCalculation']=!0x1;const _0x1997f4=[...this['_visibleChips'],...this['_overflowChips']],_0x3c93f0=this['_createCalculationContainer'](),_0x309050=this['_calculateOverflowInContainer'](_0x3c93f0,_0x1997f4),_0x3dd9f9=_0x3c93f0['_ancestorsToRestore'];_0x3dd9f9&&this['_restoreAncestorVisibility'](_0x3dd9f9),_0x3c93f0['remove'](),this['_applyOverflowResults'](_0x1997f4,_0x309050);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x16dc48=new yt(this['_locale']);_0x16dc48['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x11a53f=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x11a53f['push'](this['_config']['cssClasses']['controlsButton']),_0x16dc48['extendTemplate']({'attributes':{'class':_0x11a53f}}),_0x16dc48;}['_createShowMoreBalloonPanelView'](){const _0x5ecade=new zt(this['_locale']);return _0x5ecade['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x5ecade),_0x5ecade;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x57a274=>{_0x57a274['disableAnimationOnEnter']();});const _0x2af40f=new Nt(this['_locale']);_0x2af40f['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2af40f);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x1ec7c0=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x1ec7c0?'':'none');}['_repinBalloonPanel'](){this['_showMoreButtonView']?.['isOn']&&this['_showMoreBalloonPanelView']?.['isVisible']&&this['_showMoreButtonView']['element']&&this['_showMoreBalloonPanelView']['pin']({'target':this['_showMoreButtonView']['element'],'limiter':document['querySelector']('.ck-ai-chat')});}['_findTargetContainer'](_0x139c5f){const _0x4818cb=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x2a045a=this['_containerElement']?.['classList'];if(_0x2a045a){const _0x50b6d7=_0x2a045a[0x0]||'',_0x2fa925=_0x139c5f['querySelector']('.'+_0x50b6d7),_0xdf949b=_0x139c5f['querySelector'](_0x4818cb);return _0x2fa925||_0xdf949b||_0x139c5f;}return _0x139c5f['querySelector'](_0x4818cb)||_0x139c5f;}['_calculateContainerWidth'](){const _0x31eed3=this['_parentView']?.['element']||this['_containerElement'];if(!_0x31eed3)return $s;const _0x44b8ab=window['getComputedStyle'](_0x31eed3)['width'];if('auto'===_0x44b8ab||'0px'===_0x44b8ab||!_0x44b8ab){const _0x119be0=_0x31eed3['parentElement'];if(_0x119be0){const _0x36d39f=window['getComputedStyle'](_0x119be0);return'auto'!==_0x36d39f['width']?_0x36d39f['width']:$s;}return $s;}return _0x44b8ab;}['_applyCalculationStyles'](_0x97cd12,_0x7084ac){this['_config']['cssClasses']['calculationContainer']&&_0x97cd12['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x97cd12['style']['width']=_0x7084ac,_0x97cd12['style']['position']='absolute',_0x97cd12['style']['top']='-9999px',_0x97cd12['style']['left']='-9999px',_0x97cd12['style']['opacity']='0',_0x97cd12['style']['pointerEvents']='none',_0x97cd12['style']['zIndex']='-1',_0x97cd12['style']['visibility']='visible\x20!important',_0x97cd12['style']['display']='block\x20!important',_0x97cd12['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x2efe42){_0x2efe42['forEach'](({element:_0x4b09d4,originalDisplay:_0x36b366,originalVisibility:_0x56811c})=>{_0x4b09d4['style']['display']=_0x36b366,_0x4b09d4['style']['visibility']=_0x56811c;});}['_makeAncestorsVisible'](_0x583f80){const _0x31fe07=[];let _0x25893d=_0x583f80;for(;_0x25893d&&_0x25893d!==document['body'];){const _0x21c565=window['getComputedStyle'](_0x25893d);'none'!==_0x21c565['display']&&'hidden'!==_0x21c565['visibility']||(_0x31fe07['push']({'element':_0x25893d,'originalDisplay':_0x25893d['style']['display'],'originalVisibility':_0x25893d['style']['visibility']}),_0x25893d['style']['display']='block',_0x25893d['style']['visibility']='visible'),_0x25893d=_0x25893d['parentElement'];}return _0x31fe07;}['_createContainerElements'](){let _0x45f7fb,_0x1aa3d4;return this['_parentView']?.['element']?(_0x45f7fb=this['_parentView']['element']['cloneNode'](!0x0),_0x1aa3d4=this['_findTargetContainer'](_0x45f7fb)):(_0x45f7fb=document['createElement']('div'),_0x1aa3d4=_0x45f7fb),{'calculationContainer':_0x45f7fb,'targetContainer':_0x1aa3d4};}['_createCalculationContainer'](){const {calculationContainer:_0x5cebd5,targetContainer:_0x203cac}=this['_createContainerElements'](),_0x3698e2=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x5cebd5,_0x3698e2);const _0xb68630=this['_parentView']?.['element']||this['_containerElement'],_0x5bbe2c=_0xb68630?.['parentElement'];_0x5bbe2c?_0x5bbe2c['appendChild'](_0x5cebd5):document['body']['appendChild'](_0x5cebd5),_0x5cebd5['_targetContainer']=_0x203cac;const _0x906809=this['_makeAncestorsVisible'](_0x5bbe2c||null);return _0x5cebd5['offsetWidth'],_0x5cebd5['_ancestorsToRestore']=_0x906809,_0x5cebd5;}['_calculateOverflowInContainer'](_0x11ea9a,_0x1086ee){const _0x224d90=_0x11ea9a['_targetContainer']||_0x11ea9a,_0x592186=[],{rowCount:_0x479f5c}=this['_renderChipsAndCountRows'](_0x224d90,_0x1086ee);if(_0x479f5c<=this['_config']['maxVisibleRows'])return _0x592186;const _0x4888c7=_0x1086ee['slice']();for(;_0x4888c7['length']>0x0;){if(this['_testButtonFit'](_0x11ea9a,_0x224d90,_0x4888c7)){const _0x1b2433=_0x1086ee['filter'](_0x19d99b=>!_0x4888c7['includes'](_0x19d99b));_0x592186['push'](..._0x1b2433);break;}if(!_0x4888c7['pop']())break;}return _0x592186;}['_renderChipsAndCountRows'](_0x4ce441,_0x4541bd){_0x4ce441['innerHTML']='',_0x4541bd['forEach'](_0x42517d=>{if(_0x42517d['element']){const _0x46cf72=_0x42517d['element']['cloneNode'](!0x0);_0x4ce441['appendChild'](_0x46cf72);}}),_0x4ce441['offsetWidth'];const _0x143e35=_0x4ce441['children'],_0x3928e6=[];return Array['from'](_0x143e35)['forEach'](_0x1e4ba9=>{const _0x35b820=_0x1e4ba9['getBoundingClientRect']()['top'];_0x3928e6['some'](_0x2678c0=>Math['abs'](_0x2678c0-_0x35b820)<this['_config']['rowDetectionTolerance'])||_0x3928e6['push'](_0x35b820);}),{'rowCount':_0x3928e6['length']};}['_createMockButton'](){const _0x5bb24c=document['createElement']('button');return _0x5bb24c['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x5bb24c['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x5bb24c['textContent']='+\x201',_0x5bb24c;}['_testButtonFit'](_0x66b042,_0x40db99,_0x43ec27){this['_renderChipsAndCountRows'](_0x40db99,_0x43ec27);const _0x18ae62=this['_createMockButton']();_0x66b042['appendChild'](_0x18ae62),_0x66b042['offsetWidth'];const _0x2fa3d9=[..._0x40db99['children'],_0x18ae62],_0x5b45ac=[];_0x2fa3d9['forEach'](_0x57b5b6=>{const _0x1839a4=_0x57b5b6['getBoundingClientRect']()['top'];_0x5b45ac['some'](_0x4dc102=>Math['abs'](_0x4dc102-_0x1839a4)<this['_config']['rowDetectionTolerance'])||_0x5b45ac['push'](_0x1839a4);});const _0x5b5ee5=_0x5b45ac['length'];return _0x18ae62['remove'](),_0x5b5ee5<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x1a3be6,_0x572579){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x1a3be6['forEach'](_0x424d8f=>{_0x572579['includes'](_0x424d8f)?this['_overflowChips']['add'](_0x424d8f):this['_visibleChips']['add'](_0x424d8f);});}['_updateOverflowUI'](_0xa2e1df){if(_0xa2e1df>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0xa2e1df>0x0&&this['_showMoreButtonView']){const _0x1cc24f=''+this['_config']['showMoreLabelPrefix']+(_0xa2e1df<0x63?_0xa2e1df:'99');this['_showMoreButtonView']['label']=_0x1cc24f;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x482c2d,_0xd4b579){this['_distributeChips'](_0x482c2d,_0xd4b579),this['_updateOverflowUI'](_0xd4b579['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x501574=>{_0x501574[0x0]['isIntersecting']&&this['_pendingCalculation']&&requestAnimationFrame(()=>{this['_checkAndHandleOverflow']();});},{'threshold':0.01,'rootMargin':'50px'}),this['_intersectionObserver']['observe'](this['_containerElement']));}['_isContainerVisible'](){if(!this['_containerElement'])return!0x1;if(!this['_containerElement']['isConnected'])return!0x1;const _0x2263e8=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x2263e8['width']||0x0===_0x2263e8['height'])return!0x1;const _0x24e804=window['innerHeight']||document['documentElement']['clientHeight'],_0x1226c7=window['innerWidth']||document['documentElement']['clientWidth'],_0x540dee=0xc8;return _0x2263e8['bottom']>=-0xc8&&_0x2263e8['top']<=_0x24e804+_0x540dee&&_0x2263e8['right']>=-0xc8&&_0x2263e8['left']<=_0x1226c7+_0x540dee;}}const qs='ck-ai-chat__feed__context-chips',Qs='ck-ai-chat-context-chips-wrapper',Xs='ck-ai-chat-context-chips-wrapper-balloon',zs='ck-ai-chat-controls-button',js='ck-ai-chat-controls_context_show-more-button',Js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x897494,_0x563db5,_0x25382c){super(_0x897494),this['_bodyCollection']=_0x25382c,this['_createContextChips'](_0x563db5);const _0x45dd76={'cssClasses':{'showMoreButton':js+'\x20'+Gi,'showMoreBalloon':Js,'overflowContainer':Xs,'controlsButton':zs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x897494,this['_contextChips'],_0x45dd76,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[qs,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x5a57df=this['element']['querySelector']('.'+Qs);_0x5a57df&&(this['_overflowManager']['setContainerElement'](_0x5a57df),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x4f37e0){for(const _0x2b55fe of _0x4f37e0){const _0x455010=new AIChatContextItemButtonView(this['locale'],_0x2b55fe,!0x0,!0x1);this['_contextChips']['add'](_0x455010);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x42007b,_0x2807c1,_0x2fb7c2){super(_0x2807c1),this['_locale']=_0x42007b,this['_bodyCollection']=_0x2fb7c2,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x264362=>!_0x264362['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x5a123b,_0xe5dba7){super(_0xe5dba7);const {isWebSearchEnabled:_0x118e3b,isReasoningEnabled:_0x53dd44}=_0xe5dba7['capabilities'],_0x3c99f0=[];let _0x27d8c8='';_0x118e3b&&_0x53dd44?(_0x27d8c8=Mi(_0x5a123b,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x3c99f0['push'](Zs(_0x5da227)),_0x3c99f0['push'](Zs(_0x295154))):_0x118e3b?(_0x27d8c8=Mi(_0x5a123b,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x3c99f0['push'](Zs(_0x5da227))):_0x53dd44&&(_0x27d8c8=Mi(_0x5a123b,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x3c99f0['push'](Zs(_0x295154))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x27d8c8?'':'ck-hidden']}});const _0x38557b=new Nt();_0x38557b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x3c99f0,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x27d8c8]}]}),this['children']['add'](_0x38557b),this['capabilities']=_0xe5dba7['capabilities'];}}function Zs(_0x421b10){const _0x4d7a57=new Lt();return _0x4d7a57['content']=_0x421b10,_0x4d7a57;}const tn=['wheel','touchstart','pointerdown','keydown'],en=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x5bb03c){this['element']=_0x5bb03c,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x11a022 of tn){const _0x3bb703='keydown'!==_0x11a022;this['element']['addEventListener'](_0x11a022,this['_onUserEvent']['bind'](this),{'passive':_0x3bb703,'signal':this['abortController']['signal']});}}['start']({smooth:_0xe336a=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xe336a?'smooth':'auto',this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}['stop'](){requestAnimationFrame(()=>{this['_stop']();});}['destroy'](){this['_stop'](),this['abortController']['abort']();}['_stop'](){null!==this['animationFrameId']&&(cancelAnimationFrame(this['animationFrameId']),this['animationFrameId']=null),this['isRunning']&&(this['isRunning']=!0x1),this['isUserPaused']=!0x1;}['_onUserEvent'](_0xf9e117){if(this['isRunning']){if('keydown'===_0xf9e117['type']){const _0x143d53=_0xf9e117['key'];if(!en['includes'](_0x143d53))return;}_0xf9e117 instanceof WheelEvent?_0xf9e117['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x5ad47c,scrollHeight:_0x2ef5bf,clientHeight:_0x44d08e}=this['element'];return _0x2ef5bf-_0x5ad47c-_0x44d08e<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x35d4e3){super(_0x35d4e3),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0xea2afb,_0x16b49a){super(_0xea2afb),this['_bodyCollection']=_0x16b49a,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Os)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x3ce214,_0x474f6b){let _0x3efffd;return'ai-reply'===_0x3ce214?_0x3efffd=new AIChatFeedReplyItemView(this['locale'],_0x474f6b,this['_bodyCollection']):'ai-suggestion-reply'===_0x3ce214?(_0x3efffd=new AIChatFeedSuggestionItemView(this['locale'],_0x474f6b,this['_bodyCollection']),_0x3efffd['bind']('isTrackChangesOn')['to'](this)):_0x3efffd='user-message'===_0x3ce214?new AIChatFeedUserMessageItemView(this['locale'],_0x474f6b,this['_bodyCollection']):'interaction-header'===_0x3ce214?new AIChatFeedInteractionHeaderView(this['locale'],_0x474f6b):'custom-element'===_0x3ce214?new AIChatFeedCustomElementView(_0x474f6b):new AIChatFeedErrorItemView(_0x474f6b),this['children']['add'](_0x3efffd),_0x3efffd;}async['updateReplyItem']({id:_0x553341,parsedContent:_0x25cd54,renderingStrategy:_0x1fb0ba,abortSignal:_0x1e81cb}){const _0x320e68=this['getItemById'](_0x553341);if(!(_0x320e68 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x320e68,'id':_0x553341,'parsedContent':_0x25cd54});await _0x320e68['updateContent']({'parsedContent':_0x25cd54,'renderingStrategy':_0x1fb0ba,'abortSignal':_0x1e81cb});}async['updateWebSources'](_0x1f718e,_0x185de4){const _0x51da45=this['getItemById'](_0x1f718e);if(_0x51da45 instanceof AIChatFeedSuggestionItemView)_0x51da45['updateSources'](_0x185de4);else{if(!(_0x51da45 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x51da45,'id':_0x1f718e,'sources':_0x185de4});_0x51da45['updateSources'](_0x185de4);}}async['updateSuggestionItem']({id:_0x270bd9,parts:_0x205ea3,abortSignal:_0x5a766b,skipLoadingEffects:_0x23246e}){const _0x3d3acf=this['getItemById'](_0x270bd9);if(!(_0x3d3acf instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x3d3acf,'id':_0x270bd9,'parts':_0x205ea3});await _0x3d3acf['updateContent']({'parts':_0x205ea3,'abortSignal':_0x5a766b,'skipLoadingEffects':_0x23246e});}['updateSuggestionPartState']({id:_0x532c54,index:_0x4087ec,state:_0x20171a}){const _0x2936b0=this['getItemById'](_0x532c54);if(!(_0x2936b0 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x532c54});_0x2936b0['updatePartState'](_0x4087ec,_0x20171a);}['setSuggestionPartActive']({id:_0x41dbad,index:_0x21369e,isActive:_0x4db9bf}){const _0x29860e=this['getItemById'](_0x41dbad);if(!(_0x29860e instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x41dbad});this['children']['filter'](_0xee1feb=>_0xee1feb instanceof AIChatFeedSuggestionItemView)['forEach'](_0x2feabc=>{_0x2feabc['setPartActive'](!0x1);}),_0x29860e['setPartActive'](_0x21369e,_0x4db9bf);}['markItemAsDone'](_0x5012da){this['getItemById'](_0x5012da)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x534e0e=>_0x534e0e['options']['id']);}['removeItem'](_0x167cb0){this['children']['remove'](this['getItemById'](_0x167cb0));}['hasItem'](_0x2f4343){return!!this['children']['find'](_0x1258d1=>_0x1258d1['options']['id']['includes'](_0x2f4343));}['scrollToSuggestion'](_0x5d9d78,_0x5b5889){const _0x5ecd10=this['getItemById'](_0x5d9d78);if(!(_0x5ecd10 instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x5d9d78,'partIndex':_0x5b5889});const _0x1216dc=_0x5ecd10['getPartView'](_0x5b5889);_0x1216dc?Rt(_0x1216dc['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x5d9d78,'partIndex':_0x5b5889});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x55bf91=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x55bf91,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x96d95f=new AISkeletonView(this['locale'],Ls['aiFeed']);return _0x96d95f['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x96d95f;}['_createFeedItems'](){const _0x132370=new Nt(this['locale']);return _0x132370['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x132370;}['_createFeedLoader'](){const _0x6bf77a=new Nt(this['locale']);return _0x6bf77a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x529174=>!_0x529174)]},'children':this['_createLoaderChildren']()}),_0x6bf77a;}['_createLoaderChildren'](){const _0x4e25a2=new AISpinnerView();return _0x4e25a2['isVisible']=!0x0,[_0x4e25a2,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x4c02a9){const _0x5c9692=this['children']['find'](_0x237f57=>_0x237f57['options']['id']['includes'](_0x4c02a9));if(!_0x5c9692)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x4c02a9});return _0x5c9692;}['setLoadingMessage'](_0x23385a){this['set']('loadingMessage',_0x23385a);}['toggleLoadingSkeleton'](_0x3ce254){this['set']('isLoadingSkeletonVisible',_0x3ce254);}['startAutoScroll'](_0xd9a250={}){this['scrollManager']['start'](_0xd9a250);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x26eb01=0x0;for(const _0x3e40a7 of this['items'])_0x26eb01+=_0x3e40a7['items']['length'];return{'resultsCount':_0x26eb01,'totalItemsCount':_0x26eb01};}}function sn(_0xd544d7){const _0x543fa4=[];let _0x308172=!0x1;for(const _0x5224d1 of Array['from'](_0xd544d7['items'])){if('file'!==_0x5224d1['kind'])continue;const _0x368968=_0x5224d1['webkitGetAsEntry']();if(_0x368968?.['isDirectory']){_0x308172=!0x0;continue;}const _0xb1f573=_0x5224d1['getAsFile']();_0xb1f573&&_0x543fa4['push'](_0xb1f573);}return{'files':_0x543fa4,'hasDirectory':_0x308172};}const nn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x346d2d,_0x4e5f32){super(_0x346d2d,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x346d2d),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x4e5f32,this['_queryViewResizeObserver']=null,this['queryView']['fieldView']['minRows']=AIChatPromptInputView['MIN_ROWS'],this['queryView']['fieldView']['maxRows']=AIChatPromptInputView['MAX_ROWS'],this['queryView']['fieldWrapperChildren']['add'](this['_addContextButtonView']),this['_setUpAddContextButtonPositioning'](),this['extendTemplate']({'attributes':{'class':['ck','ck-ai-chat__prompt-input']}}),this['submitButtonView']=this['_createSubmitButton'](),this['submitButtonView']['bind']('isEnabled')['to'](this,'isEmpty',this,'isUploadInProgress',(_0x58d06d,_0x20e62c)=>!_0x58d06d&&!_0x20e62c),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x474981,_0x7d07d7)=>{this['isUploadInProgress']||this['isEmpty']||_0x474981['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x7d07d7());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x218e7d=>this['_handlePaste'](_0x218e7d)),this['element']['addEventListener']('drop',_0x3fa0d9=>this['_handleDrop'](_0x3fa0d9));}['_handlePaste'](_0x325738){const _0x210143=_0x325738['clipboardData'];if(!_0x210143)return;const {files:_0x183f20,hasDirectory:_0x6e80a7}=sn(_0x210143),_0x3d738c={'files':_0x183f20,'plainText':_0x210143['getData']('text/plain'),'hasDirectory':_0x6e80a7,'forceTextAttachment':!0x1,'preventDefault':()=>_0x325738['preventDefault']()};this['fire']('promptInputPaste',_0x3d738c);}['_handleDrop'](_0x3b487d){const _0x249f44=_0x3b487d['dataTransfer'];if(!_0x249f44)return;const _0x54d08d={'files':[],'plainText':_0x249f44['getData']('text/uri-list')||_0x249f44['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x3b487d['preventDefault']()};this['fire']('promptInputPaste',_0x54d08d);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x4a8039=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x4a8039)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x2b4ce2=_0x5d498f(_0x4a8039);this['fire']('sendUserMessage',_0x2b4ce2),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x27f3a9){this['queryView']['fieldView']['set']('placeholder',_0x27f3a9);}['focus'](_0x19ddc4=!0x1){super['focus'](),_0x19ddc4&&(this['element']['classList']['contains'](nn)||(this['element']['classList']['add'](nn),setTimeout(()=>{this['element']['classList']['remove'](nn);},0x320)));}['_createSubmitButton'](){const _0x2c4477=new yt(this['locale']);return _0x2c4477['set']({'icon':_0x1bfbe9,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x2c4477['on']('execute',()=>{this['submit']();}),_0x2c4477;}['setIsUploadInProgress'](_0x22c380){this['isUploadInProgress']=_0x22c380;}['_setUpAddContextButtonPositioning'](){const _0x3e871c=this['locale'],_0x1fd630=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x50f7d5=new dt(this['queryView']['fieldView']['element']),_0x2aab2f=new dt(this['_addContextButtonView']['element']),_0x4102c0=_0x50f7d5['width'],_0x34ea91='rtl'===_0x3e871c['uiLanguageDirection']?'right':'left';_0x50f7d5['excludeScrollbarsAndBorders']();const _0x9e5dad=_0x4102c0-_0x50f7d5['width']+0x1;this['_addContextButtonView']['element']['style'][_0x34ea91]='calc('+(_0x4102c0-_0x2aab2f['width']-_0x9e5dad)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x1fd630),this['on']('render',()=>{_0x1fd630(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x1fd630();});});}}class AIChatDropZoneView extends Nt{constructor(_0x416c25){super(_0x416c25);const _0x2199bc=new Lt();_0x2199bc['content']=_0x15039b,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x2199bc,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x416c25,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x453855){let _0x154176=0x0;_0x453855['addEventListener']('dragenter',_0x3e9039=>{_0x3e9039['dataTransfer']&&(_0x154176++,0x1===_0x154176&&this['fire']('dragEnter'),_0x453855['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x453855['addEventListener']('dragover',_0x4d60c2=>{_0x4d60c2['dataTransfer']&&_0x4d60c2['preventDefault']();}),_0x453855['addEventListener']('dragleave',()=>{--_0x154176<=0x0&&(_0x154176=0x0,_0x453855['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x453855['addEventListener']('drop',_0x330b0e=>{_0x330b0e['preventDefault'](),_0x154176=0x0,_0x453855['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x330b0e);});}['_handleDrop'](_0x120c11){const _0x2fc03b=_0x120c11['dataTransfer'];if(!_0x2fc03b)return;const {files:_0x425fd0,hasDirectory:_0x1791a2}=sn(_0x2fc03b),_0x4f6a6c={'files':_0x425fd0,'plainText':_0x2fc03b['getData']('text/uri-list')||_0x2fc03b['getData']('text/plain'),'hasDirectory':_0x1791a2,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x4f6a6c);}}const rn='ck-ai-chat__prompt-capabilities',on='ck-ai-chat-controls-button',an='ck-ai-chat-controls-button--commands',hn='ck-ai-chat-controls__model-selection',cn='ck-ai-chat-controls__model-selection__item-name',ln='ck-ai-chat-controls__model-selection__item-description',un='ck-ai-chat-controls__model-selection__item-capabilities',dn='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x1bff5c){super(_0x1bff5c),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x17dc9c=>'selector'===_0x17dc9c),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x2208fc=>_0x2208fc?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x19c75a=>_0x19c75a),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x569fc9=>_0x569fc9),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x367db6=>Mi(this['locale'],_0x367db6?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x20b6bd=>_0x20b6bd),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x386468=>Mi(this['locale'],_0x386468?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[rn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x4c01a6,_0x171eb2){if(_0x171eb2)this['set']('modelDisplayMode','hidden');else{const _0x5eb425=0x1===_0x4c01a6['length'];this['set']('modelDisplayMode',_0x5eb425?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x4c01a6?.['length'])for(const _0x39bf11 of _0x4c01a6){const _0xa2be4a=new Zt({'label':_0x39bf11['name'],'withText':!0x0,'role':'menuitemradio','id':_0x39bf11['id'],'model':_0x39bf11});_0xa2be4a['bind']('isOn')['to'](this,'activeModelId',_0x5d16a6=>_0x5d16a6===_0x39bf11['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0xa2be4a,'labelView':new _n(this['locale'],_0x39bf11)});}}['setWebSearch'](_0x186455){this['set']('webSearchActive',_0x186455);}['setReasoning'](_0x26a1b1){this['set']('reasoningActive',_0x26a1b1);}['setModel'](_0x474c8c){if(!_0x474c8c)return;this['activeModelId']=_0x474c8c['id'],this['activeModelName']=_0x474c8c['name']||_0x474c8c['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x474c8c['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x474c8c['name']);const _0x10c351=_0x474c8c['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x10c351),this['_webSearchButton']['set']('isVisible',_0x10c351);const _0x2921e2=_0x474c8c['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x2921e2),this['_reasoningButton']['set']('isVisible',_0x2921e2);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x1dc5eb){this['set']('modelSelectorEnabled',!0x1),_0x1dc5eb&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0xa82e5d=new yt();return _0xa82e5d['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x5da227,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0xa82e5d['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0xa82e5d;}['_createReasoningButton'](){const _0x3a3bba=new yt();return _0x3a3bba['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x295154,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x3a3bba['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x3a3bba;}['_createCommandsButton'](){const _0x2d6981=new yt();return _0x2d6981['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x2bcdb8,'withText':!0x0,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':dn}),_0x2d6981['extendTemplate']({'attributes':{'class':[an]}}),_0x2d6981['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x2d6981;}['_createModelSelectionDropdown'](){const _0x132e58=Ft(this['locale']);return _0x132e58['set']({'panelPosition':'ne','class':[hn]}),_0x132e58['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':dn,'class':Gi}),this['listenTo'](_0x132e58,'execute',_0xb745b3=>{this['fire']('selectModel',_0xb745b3['source']['model']);}),_0x132e58;}['_createModelNameView'](){const _0x1e0fd0=new In(this['locale']);return _0x1e0fd0['bind']('text')['to'](this,'activeModelName',_0x5bf03f=>_0x5bf03f??''),_0x1e0fd0['bind']('isVisible')['to'](this,'modelDisplayMode',_0x13c524=>'name'===_0x13c524),_0x1e0fd0;}}let _n=class ModelButtonLabelView extends Mt{constructor(_0x1938a2,_0x1b79dc){super();const _0x94fbec=this['bindTemplate'],_0x17c0da=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x94fbec['to']('style'),'id':_0x94fbec['to']('id')},'children':[{'tag':'div','attributes':{'class':[cn]},'children':[{'text':_0x94fbec['to']('text')}]},{'tag':'div','attributes':{'class':[ln]},'children':[{'tag':'span','children':[{'text':_0x1b79dc['description']}]}]},{'tag':'div','attributes':{'class':[un]},'children':_0x17c0da}]}),_0x17c0da['addMany'](this['_getCapabilityParts'](_0x1938a2,_0x5da227,'AI_CHAT_SEARCH_WEB',_0x1b79dc['capabilities']['webSearch']?.['enabled']??!0x1)),_0x17c0da['addMany'](this['_getCapabilityParts'](_0x1938a2,_0x295154,'AI_CHAT_REASONING',_0x1b79dc['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x2b78d7,_0x258028,_0x11e7e5,_0x383faf){const _0x597b9f=new Lt();_0x597b9f['content']=_0x258028;const _0x3374c8=new Nt(_0x2b78d7);_0x3374c8['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2b78d7,_0x11e7e5)+':\x20'}]});const _0x1040d7=new Nt(_0x2b78d7);return _0x1040d7['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2b78d7,_0x383faf?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x597b9f,_0x3374c8,_0x1040d7];}},In=class ModelNameView extends Nt{constructor(_0x351895){super(_0x351895),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x4f1b0b=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x4f1b0b['if']('isVisible','ck-hidden',_0x3618d6=>!_0x3618d6)]},'children':[{'text':_0x4f1b0b['to']('text')}]});}};const An='ck-ai-chat-context-controls__url-form',gn='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x378a09){super(_0x378a09),this['focusTracker']=new It(),this['keystrokes']=new At(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x5539dd=>{this['focusTracker']['add'](_0x5539dd['element']),this['keystrokes']['listenTo'](_0x5539dd['element']);}),te({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x5ae3f1){this['urlInputField']['errorText']=_0x5ae3f1,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x1b3c98=new yt(this['locale']);return _0x1b3c98['set']({'icon':_0x361218,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x1ff1b1,_0x236324,_0x12175f)=>{_0x1b3c98['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x12175f?'':'\x20ck-hidden')]});}),_0x1b3c98;}['_createUrlInputField'](){const _0x1e34b7=new _0x1d7af5(this['locale'],_0x246673);return _0x1e34b7['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x1e34b7['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x1e34b7;}['_createConfirmButton'](){const _0x23ad49=new yt(this['locale']);return _0x23ad49['set']({'icon':_0x36337b,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x23ad49;}['_setupTemplate'](){const _0xe413b3=new _0x351f99(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0xe413b3['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':An,'tabindex':'-1'},'children':[_0xe413b3,{'tag':'div','attributes':{'class':gn},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x45a145=>{_0x45a145['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x31dbcf,_0x50367f)=>{this['clear'](),this['fire']('cancel'),_0x50367f();});}['_handleSubmit'](){const _0x394c3d=this['getValue']()['trim']();_0x394c3d?this['_isValidUrl'](_0x394c3d)?(this['clearError'](),this['fire']('submitUrl',_0x394c3d)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x2bcfc0=this['getValue']()['trim'](),_0x20f784=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x2bcfc0['length']>0x0&&!_0x20f784;}['_isValidUrl'](_0x3d9d50){try{return!!new URL(_0x3d9d50);}catch{return!0x1;}}}const wn='ck-ai-chat-resources__item',Cn='ck-ai-chat-resources__item--in-context',mn='ck-ai-chat-resources__item-title',pn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x2ccb19,_0x2a676d){super(_0x2ccb19),this['resource']=_0x2a676d,this['set']('isInContext',!!_0x2a676d['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x4b646f){if(_0x4b646f['isInContext'])return _0x36337b;switch(_0x4b646f['type']){case'document':return _0xdbabf8;case'web-resource':return _0x35b63e;case'file':case'text':return _0x15039b;default:return _0x238dc8;}}['highlightText'](_0x446cdb){if(!_0x446cdb||''===_0x446cdb['trim']())return void this['_titleView']['highlightText'](null);const _0x295076=new RegExp(_0x3e499a(_0x446cdb),'gi');this['_titleView']['highlightText'](_0x295076);}['updateResourceState'](_0x4d1259){this['resource']['isInContext']=_0x4d1259,this['isInContext']=_0x4d1259,this['_updateIcon']();}['_createTitleView'](){const _0x498759=new _0xb413a6();return _0x498759['text']=this['resource']['label'],_0x498759['extendTemplate']({'tag':'span','attributes':{'class':[mn]}}),_0x498759;}['_createIconView'](){const _0x5510aa=new Lt();return _0x5510aa['content']=this['getResourceIcon'](this['resource']),_0x5510aa;}['_setupTemplate'](){const _0xf0a0d6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[wn,_0xf0a0d6['if']('isVisible','ck-hidden',_0xb465d8=>!_0xb465d8),_0xf0a0d6['if']('isInContext',Cn)]},'children':[{'tag':'div','attributes':{'class':[pn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0xf0a0d6['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const En='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0xe8eba7,_0x100c27){super(_0xe8eba7),this['_source']=_0x100c27,this['extendTemplate']({'attributes':{'class':[En]}});}['setResources'](_0x2739dd,_0x1ba92e){this['items']['clear']();let _0x16abf8=_0x2739dd;if(this['_source']['useDefaultFiltering']&&_0x1ba92e&&''!==_0x1ba92e['trim']()){const _0xcf0ba1=new RegExp(_0x1ba92e['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x16abf8=_0x2739dd['filter'](_0x181ab1=>_0xcf0ba1['test'](_0x181ab1['label']));}for(const _0x4c6419 of _0x16abf8){const _0x11d1b9=new AIChatResourceListItemView(this['locale'],_0x4c6419);_0x11d1b9['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x4c6419);}),this['items']['add'](_0x11d1b9);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x1ba92e);}['highlightText'](_0x1dd78d){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x3791dd=>{_0x3791dd['highlightText'](_0x1dd78d);});}['updateResourceState'](_0x91d8,_0x2c8c7e){for(const _0x5a7994 of this['items']){const _0x1347f1=_0x5a7994;_0x1347f1['resource']['id']===_0x91d8&&_0x1347f1['updateResourceState'](_0x2c8c7e);}}['_handleResourceSelection'](_0x370802,_0x13af6f){this['fire']('addResourceToContext',{'source':_0x370802,'resource':_0x13af6f});}}class AIChatContextResourcesSearchInputView extends _0x1d7af5{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x301ee2){const t=_0x301ee2['t'],_0x55db40={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x246673,'label':Mi(_0x301ee2,'AI_CHAT_SEARCH_RESOURCES')};super(_0x301ee2,_0x55db40['creator']),this['label']=_0x55db40['label'],this['_viewConfig']=_0x55db40,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x301ee2,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x371e6f){this['fire']('search',_0x371e6f);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x6c2312,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x526192,t){this['resetButtonView']=new yt(_0x526192),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x395853,'class':'ck-search__reset','isVisible':!0x1,'tooltip':!0x0}),this['resetButtonView']['on']('execute',()=>{this['reset'](),this['focus'](),this['fire']('reset');}),this['resetButtonView']['bind']('isVisible')['to'](this['fieldView'],'isEmpty',_0x11eac1=>!_0x11eac1),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x13673b,_0x9b1032){super(_0x13673b),this['_source']=_0x9b1032['source'],this['_searchInputVisibleFrom']=_0x9b1032['searchInputVisibleFrom']??0x7,this['set']('isLoading',!0x0),this['_searchView']=this['_createSearchView'](),this['_searchSection']=this['_createSearchSection'](),this['_resourcesListView']=this['_createResourcesListView'](),this['_skeletonLoader']=this['_createSkeletonView'](),this['children']=new _0x3207b0([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0xa3810e=new Nt(this['locale']);return _0xa3810e['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x190a72,_0x1472da)=>{this['loadResources'](_0x1472da),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x1472da);}),_0xa3810e;}['_createResourcesListView'](){const _0x5ac65f=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x5ac65f['delegate']('addResourceToContext')['to'](this),_0x5ac65f['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x5ac65f;}['_createSkeletonView'](){const _0x357e56=new AISkeletonView(this['locale'],Ls['aiChatResources']);return _0x357e56['bind']('isVisible')['to'](this,'isLoading'),_0x357e56;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1a66e9){const _0xdf312f=at();this['_latestLoadResourcesUid']=_0xdf312f,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1a66e9,'uid':_0xdf312f}),this['isLoading']=!0x0;}['setResources'](_0x1c8519,_0x539cf7){if(_0x539cf7&&_0x539cf7!==this['_latestLoadResourcesUid'])return;const _0x4bad13=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x1c8519,_0x4bad13),_0x1c8519['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x4231fb,_0x780171){this['_resourcesListView']['updateResourceState'](_0x4231fb,_0x780171);}}const Tn='ck-ai-chat-context-controls__source-balloon-panel',fn='ck-button-icon\x20ck-button-back',Rn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x372be5,_0x58758c,_0x1b3a4d){this['_locale']=_0x372be5,this['_bodyCollection']=_0x58758c,this['_config']=_0x1b3a4d;}['showSourceResourcesBalloon']({source:_0x46876d,withBackButton:_0x149781}){let _0x354a25=this['_sourceResourceBalloons']['get'](_0x46876d['id']);_0x354a25||(_0x354a25=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x46876d['id'],_0x354a25),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x354a25)),this['_addSourceResourceContent']({'balloonPanel':_0x354a25,'source':_0x46876d,'withBackButton':_0x149781}),_0x354a25['show']();const _0x8b6d51=this['_config']['getTargetElement']();_0x8b6d51&&_0x354a25['pin']({'target':_0x8b6d51,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x559956,_0x455d8c,_0x131ea3){const _0x3e12fc=this['_sourceResourceBalloons']['get'](_0x559956);if(!_0x3e12fc)return;const _0x2e87b8=this['_getResourcesViewFromBalloon'](_0x3e12fc);_0x2e87b8&&(_0x2e87b8['setResources'](_0x455d8c,_0x131ea3),_0x2e87b8['once']('change:isLoading',()=>{_0x3e12fc['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x4f06e2){const _0x22fc8a=this['_sourceResourceBalloons']['get'](_0x4f06e2);_0x22fc8a&&requestAnimationFrame(()=>{_0x22fc8a['hide'](),this['_sourceResourceBalloons']['delete'](_0x4f06e2),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x776d98 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x776d98);}['isAnyResourceBalloonVisible'](){for(const _0x3cfc05 of this['_sourceResourceBalloons']['values']())if(_0x3cfc05['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x308d1e,_0x463e63,_0x804e2c){const _0x59b25e=this['_sourceResourceBalloons']['get'](_0x308d1e);if(!_0x59b25e||!_0x59b25e['isVisible'])return;const _0x3ba6f7=this['_config']['getTargetElement']();if(!_0x3ba6f7)return;_0x59b25e['pin']({'target':_0x3ba6f7,'limiter':this['_config']['getLimiterElement']()});const _0x1f4ad3=this['_getResourcesViewFromBalloon'](_0x59b25e);_0x1f4ad3&&_0x1f4ad3['updateResourceState'](_0x463e63,_0x804e2c);}['destroy'](){for(const _0x52ffda of this['_sourceResourceBalloons']['values']())_0x52ffda['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x47ccb9=new zt(this['_locale']);return _0x47ccb9['extendTemplate']({'attributes':{'class':Tn}}),this['_bodyCollection']['add'](_0x47ccb9),_0x47ccb9;}['_addSourceResourceContent']({balloonPanel:_0x539a19,source:_0x378bf7,withBackButton:_0x40aea3}){_0x539a19['content']['clear']();const _0x319f0b=this['_createBalloonHeader']({'balloonPanel':_0x539a19,'source':_0x378bf7,'withBackButton':_0x40aea3});_0x539a19['content']['add'](_0x319f0b);const _0x1c36b2=this['_createBalloonResourcesView'](_0x378bf7);_0x539a19['content']['add'](_0x1c36b2);}['_createBalloonHeader']({balloonPanel:_0x1f5753,source:_0x2a42d5,withBackButton:_0x5da6db}){const _0x281889=new _0x351f99(this['_locale'],{'label':_0x2a42d5['label'],'class':Rn});return _0x5da6db&&_0x281889['children']['add'](this['_createBackButton'](_0x1f5753),0x0),_0x281889;}['_createBackButton'](_0x223fab){const _0x47052e=new yt(this['_locale']);return _0x47052e['set']({'icon':_0x361218,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':fn}),_0x47052e['on']('execute',()=>{_0x223fab['hide'](),this['_config']['onBackToContext']();}),_0x47052e;}['_createBalloonResourcesView'](_0x1eab6a){const _0x3db9a7=new AIChatContextResourcesView(this['_locale'],{'source':_0x1eab6a,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x3db9a7['on']('loadSourceResources',(_0x24062a,_0x40deb5)=>{this['_config']['onLoadSourceResources'](_0x40deb5);}),_0x3db9a7['on']('addResourceToContext',(_0x403b4c,_0x23a61c)=>{this['_config']['onResourceSelected'](_0x23a61c['source'],_0x23a61c['resource']),this['closeSourceResourceBalloon'](_0x1eab6a['id']);}),_0x3db9a7;}['_getResourcesViewFromBalloon'](_0x1a8b27){const _0x3d42c3=_0x1a8b27['content']['get'](0x1);return _0x3d42c3 instanceof AIChatContextResourcesView?_0x3d42c3:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x45d590){jt({'emitter':_0x45d590,'contextElements':[_0x45d590['element']],'callback':()=>{_0x45d590['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x45d590['isVisible']});}}const bn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Sn='ck-ai-chat-context-controls',On='ck-ai-chat-context-controls__pending-contexts',vn='ck-ai-chat-context-controls__add-context-balloon-panel',kn='ck-ai-chat-context-controls__add-context-button',yn='ck-ai-chat-context-controls__url-balloon-panel',Nn='ck-ai-chat-context-controls__balloon-button',xn='ck-ai-chat-context-controls__balloon-button-source',Ln='ck-ai-chat-controls-button',Pn='ck-ai-chat-context-chips-wrapper-balloon',Dn='ck-ai-chat-controls_context_show-more-button',Vn='ck-ai-chat-context-controls__show-more-balloon-panel',Hn='ck-ai-chat',Mn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x41b92c,_0x5c98bc){super(_0x41b92c),this['bodyCollection']=_0x5c98bc['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x41b92c),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x41b92c),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x41b92c),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x41b92c,_0x5c98bc);const _0x196b60={'cssClasses':{'showMoreButton':Dn+'\x20'+Gi,'showMoreBalloon':Vn,'overflowContainer':Pn,'controlsButton':Ln}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x41b92c,this['_currentContextsChips'],_0x196b60,this['bodyCollection'],this),this['_addContextBalloonConfig']={'buttonView':this['addContextButtonView'],'balloonView':this['_addContextBalloonPanelView'],'hideMethod':this['hideAddContextBalloonPanel']['bind'](this),'showMethod':this['showAddContextBalloonPanel']['bind'](this)},this['_setupTemplate'](),this['_bindEventHandlers']();}['render'](){super['render'](),this['_setupAllBalloonClickOutsideHandlers'](),this['_overflowManager']['setContainerElement'](this['element']),this['_overflowManager']['reorganizeChips']();}['destroy'](){super['destroy'](),this['_overflowManager']['destroy'](),this['_resourcesBalloonView']['destroy']();}['addContextItem'](_0x4f2bfa,_0x10b999){const _0x5c191c=this['_createContextButton'](_0x4f2bfa,'current',!0x0,_0x10b999);this['_addContextToCollection'](_0x5c191c,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x86daa7){this['_removeContextFromCollection'](_0x86daa7,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x86daa7,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x40c334,_0x27369b){let _0x8cb6c7=this['_currentContextsChips']['find'](_0xd400af=>_0xd400af['id']===_0x40c334);_0x8cb6c7||(_0x8cb6c7=this['_overflowManager']['overflowChips']['find'](_0x4c6e4f=>_0x4c6e4f['id']===_0x40c334)),_0x8cb6c7&&(_0x8cb6c7['isLoading']=_0x27369b);}['setConversationContext'](_0x1ad88){this['_conversationContextsChips']['clear']();for(const _0x47585d of _0x1ad88){const _0x1028c5=this['_createContextButton'](_0x47585d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x1028c5,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x58d623,_0x74301b,_0x8c7e06){this['_resourcesBalloonView']['updateResourceState'](_0x58d623,_0x74301b,_0x8c7e06);}['hideAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x1);}['showAddContextBalloonPanel'](){this['_toggleAddContextBalloon'](!0x0);}['hideUrlBalloonPanel'](){this['_urlBalloonPanelView']['hide'](),this['addContextButtonView']['isOn']=!0x1,this['_urlInputView']&&this['_urlInputView']['clear']();}['showUrlBalloonPanel'](){this['_urlBalloonPanelView']['show'](),this['addContextButtonView']['isOn']=!0x0;}['hideAllBalloons'](){this['hideAddContextBalloonPanel'](),this['hideUrlBalloonPanel'](),this['_resourcesBalloonView']['closeAll']();}['_showSourceResourcesBalloon']({source:_0xc6bc33,withBackButton:_0x4edd1c}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0xc6bc33,'withBackButton':_0x4edd1c}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x4698f7,_0x307737,_0x48103b,_0x570274){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x4698f7,_0x48103b,_0x570274);}['closeSourceResourceBalloon'](_0x3c52bf){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x3c52bf),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x3abbcf){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x3abbcf),this['_setAddContextButtonEnabled'](_0x3abbcf);}['_setAddContextButtonEnabled'](_0x197a72){const _0x21ba79=!_0x197a72['document']['isHidden']&&_0x197a72['document']['enabled'],_0x3b56d8=_0x197a72['urls']['enabled'],_0x1b69d5=_0x197a72['files']['enabled'],_0x278d02=_0x197a72['sources']['length']>0x0,_0x54b5c6=_0x197a72['customItems']&&_0x197a72['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x21ba79||_0x3b56d8||_0x1b69d5||_0x278d02||_0x54b5c6;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Sn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':On},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x18aa2c){const _0x2de6f7=new yt(_0x18aa2c);return _0x2de6f7['set']({'label':Mi(_0x18aa2c,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ln+'\x20'+kn+'\x20'+Gi,'icon':_0x14b7d9,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x2de6f7;}['_createAddContextBalloonPanelView'](_0x2b8ad0){return this['_createBaseBalloonPanel'](_0x2b8ad0,vn);}['_createUrlBalloonPanelView'](_0x3a32a2){const _0x3dc7f2=this['_createBaseBalloonPanel'](_0x3a32a2,yn);return this['_addUrlContent'](_0x3dc7f2,_0x3a32a2),_0x3dc7f2;}['_createResourcesBalloonView'](_0x507386,_0x26f9d5){const _0x5f4fea={'searchInputVisibleFrom':_0x26f9d5['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});},'onResourceSelected':(_0x1fd5f8,_0x4f9b8e)=>{this['fire']('addResourceToContext',{'source':_0x1fd5f8,'resource':_0x4f9b8e});},'onLoadSourceResources':_0x1daf27=>{this['fire']('loadSourceResources',_0x1daf27);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x507386,_0x26f9d5['bodyCollection'],_0x5f4fea);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Hn)||document['body'];}['_createBaseBalloonPanel'](_0x719836,_0x44fe0b){const _0x5a3d86=new zt(_0x719836);return _0x5a3d86['extendTemplate']({'attributes':{'class':_0x44fe0b}}),this['bodyCollection']['add'](_0x5a3d86),_0x5a3d86;}['_setBalloonPanelContent'](_0x50a5de,_0xcac6ce,_0x2190ad){if(_0x50a5de['content']['clear'](),!_0x2190ad['document']['isHidden']&&_0x2190ad['document']['enabled']){const _0x3aea3b=this['_createBalloonButton'](_0xcac6ce,{'label':Mi(_0xcac6ce,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0xdbabf8});_0x3aea3b['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x50a5de['content']['add'](_0x3aea3b);}if(_0x2190ad['urls']['enabled']){const _0x2a8e77=this['_createBalloonButton'](_0xcac6ce,{'label':Mi(_0xcac6ce,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x35b63e});_0x2a8e77['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_urlInputView']['focus']();}),_0x50a5de['content']['add'](_0x2a8e77);}if(_0x2190ad['files']['enabled']){const _0x5cfb96=new _0x8276b5(_0xcac6ce);_0x5cfb96['set']({'label':Mi(_0xcac6ce,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x258b14,'withText':!0x0,'tooltip':!0x0,'class':Nn,'allowMultipleFiles':!0x0}),_0x5cfb96['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x5cfb96['on']('done',(_0x2df6bc,_0x5c2e96)=>{this['fire']('addFileToContext',_0x5c2e96);}),_0x5cfb96['tooltip']=!0x0,_0x50a5de['content']['add'](_0x5cfb96);}for(const _0x4b59d7 of _0x2190ad['sources']){const _0x389a17=this['_createBalloonButton'](_0xcac6ce,{'label':_0x4b59d7['label'],'icon':_0x4b59d7['icon']||_0x238dc8,'type':'source'});_0x50a5de['content']['add'](_0x389a17),_0x389a17['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x4b59d7,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x2df4ef of _0x2190ad['customItems']||[]){const _0x3edd45=this['_createBalloonButton'](_0xcac6ce,{'label':_0x2df4ef['label'],'icon':_0x2df4ef['icon']||_0x238dc8,'type':'customItem'});_0x50a5de['content']['add'](_0x3edd45),_0x3edd45['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x2df4ef);});}this['_hasExactlyOneSource']=0x1===_0x50a5de['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x115de8,_0x3ebb36){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x3ebb36),this['_urlInputView']['on']('submitUrl',(_0x1f5aa4,_0x3bf677)=>{this['_handleUrlSubmit'](_0x3bf677);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});}),_0x115de8['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x5ceec9,_0x529319){const _0x4b43b6='source'===_0x529319['type']?new SourcesBalloonButtonView(_0x5ceec9):new yt(_0x5ceec9);return _0x4b43b6['set']({'label':_0x529319['label'],'icon':_0x529319['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Nn}),_0x4b43b6;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x5e12b2){const _0x3f0bc4=this['_addContextBalloonConfig'];_0x3f0bc4['buttonView']['isOn']=_0x5e12b2,_0x5e12b2?_0x3f0bc4['balloonView']['show']():_0x3f0bc4['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x4a2394,buttonView:_0x45ceb5,hideMethod:_0x23da11}=this['_addContextBalloonConfig'];jt({'emitter':_0x4a2394,'contextElements':[_0x4a2394['element'],_0x45ceb5['element']],'callback':()=>{_0x23da11();},'activator':()=>_0x45ceb5['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x1eaf1d,_0x2f007d,_0x157150=!0x1,_0x197531=!0x1){const _0x505943='conversation'===_0x2f007d||!0x0===_0x1eaf1d['isReadOnly'],_0x20d07d=new AIChatContextItemButtonView(this['locale'],_0x1eaf1d,_0x505943,_0x157150,_0x197531);return _0x505943||_0x20d07d['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x20d07d['id']);}),_0x20d07d;}['_addContextToCollection'](_0x3fb628,_0x53d0f2){_0x53d0f2['add'](_0x3fb628,0x0);}['_removeContextFromCollection'](_0x9e952b,_0x15b35f){const _0x2cbdc6=_0x15b35f['find'](_0x5e0a68=>_0x5e0a68['id']===_0x9e952b);_0x2cbdc6&&_0x15b35f['remove'](_0x2cbdc6);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x42c841){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x42c841);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x32223c){super(_0x32223c),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[xn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x277268=new Lt();return _0x277268['content']=_0x248521,_0x277268['extendTemplate']({'attributes':{'class':xn+'__arrow'}}),_0x277268;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x54ef8f){super(_0x54ef8f),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_loaderView']=this['_createLoaderView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-loader-wrapper','ck-reset_all']},'children':[this['_loaderView'],this['_cancelButtonView']]});}['_createCancelButtonView'](){const _0x453bbe=new yt(this['locale']);return _0x453bbe['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x5b2e11}),_0x453bbe['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x453bbe;}['_createLoaderView'](){const _0x4e63b0=new Nt(this['locale']);return _0x4e63b0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x4e63b0;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x269b5b,_0x34d9a7){super(_0x269b5b),this['_filesEnabled']=_0x34d9a7['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x269b5b,{'bodyCollection':_0x34d9a7['bodyCollection'],'searchInputVisibleFrom':_0x34d9a7['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x269b5b),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x269b5b),this['_loaderView']=this['_createLoaderView'](_0x269b5b),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x269b5b),this['_dropZoneView']=new AIChatDropZoneView(_0x269b5b),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...bn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x1b7e53=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x1b7e53['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x1b7e53['if']('isLoading','ck-hidden',_0x4fe20e=>_0x4fe20e||!this['isModelAvailable']),_0x1b7e53['if']('isModelAvailable','ck-hidden',_0x1e06a4=>!_0x1e06a4||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x1b7e53['if']('isLoading','ck-hidden',_0x1a5acb=>!_0x1a5acb)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x1b7e53['if']('isModelAvailable','ck-hidden',_0xb3057a=>_0xb3057a)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}['_createContextPanelView'](_0x2b6c13,_0x44dace){return new AIChatContextPanelView(_0x2b6c13,_0x44dace);}['_createPromptInputView'](_0x4d4ba4){return new AIChatPromptInputView(_0x4d4ba4,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x294d6){return new AIChatPromptCapabilitiesView(_0x294d6);}['_createLoaderView'](_0x39d4c2){return new AIChatControlsLoaderView(_0x39d4c2);}['_createModelUnavailableMessageView'](_0x30ef4d){const _0x2ce329=new AIChatModelUnavailableMessageView(_0x30ef4d);return _0x2ce329['delegate']('startConversation')['to'](this),_0x2ce329;}['_handlePromptInputFocus'](_0x3ede7b,_0x539ed3,_0x1cf62b){_0x1cf62b?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x227e56,_0x537271){this['_contextPanelView']['addContextItem'](_0x227e56,_0x537271);}['removeContextItem'](_0x5f1fcb){this['_contextPanelView']['removeContextItem'](_0x5f1fcb);}['setContextItemLoading'](_0x2bfe69,_0x33cb4a){this['_contextPanelView']['setContextItemLoading'](_0x2bfe69,_0x33cb4a);}['setIsUploadInProgress'](_0x12af4a){this['_promptInputView']['setIsUploadInProgress'](_0x12af4a);}['setConversationContext'](_0x27b974){this['_contextPanelView']['setConversationContext'](_0x27b974);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x1063f0,_0x1cb19e,_0x4a5a36){this['_contextPanelView']['updateResourceState'](_0x1063f0,_0x1cb19e,_0x4a5a36);}['setWebSearch'](_0x55f256){this['_promptCapabilitiesView']['setWebSearch'](_0x55f256);}['setReasoning'](_0x2f81da){this['_promptCapabilitiesView']['setReasoning'](_0x2f81da);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x5d424c){this['_contextPanelView']['setAddContextOptions'](_0x5d424c);}['setInputPlaceholder'](_0x3dcd80){this['_promptInputView']['setPlaceholderText'](_0x3dcd80);}['setModelList'](_0x596ac1,_0x4da265){this['_promptCapabilitiesView']['setModelList'](_0x596ac1,_0x4da265);}['setModel'](_0x3b21e7){_0x3b21e7?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x3b21e7)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x354cba){this['_promptCapabilitiesView']['disableModelSelector'](_0x354cba);}['populateSourceResourceBalloon'](_0x105ef5,_0x1cf539,_0x46efca,_0x59d998){this['_contextPanelView']['populateSourceResourceBalloon'](_0x105ef5,_0x1cf539,_0x46efca,_0x59d998);}['closeSourceResourceBalloon'](_0x4fd89d){this['_contextPanelView']['closeSourceResourceBalloon'](_0x4fd89d);}['focusPromptInput'](_0x18453f=!0x1){this['_promptInputView']['focus'](_0x18453f);}['setPromptInputValue'](_0x4f51ed){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x4f51ed;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x25cc40){super(_0x25cc40);const _0x290cce=new yt(_0x25cc40);_0x290cce['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x290cce['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x290cce]}]});}}class AIHeaderView extends _0x351f99{['resizeButton'];constructor(_0x32a3f2,_0x191787){super(_0x32a3f2,{'label':_0x191787['label'],'class':'ck-ai-header\x20'+_0x191787['class'],'icon':_0x191787['icon']}),this['set']('isMaximized',!0x1),_0x191787['content']&&this['children']['add'](_0x191787['content']),_0x191787['showResizeButton']&&(this['resizeButton']=Fi(_0x32a3f2,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x20fb9b){super(_0x20fb9b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x20fb9b,'AI_DISCLAIMER_TEXT')}]}]});}}function Un(_0x4286dd,_0xd4cbf4){const _0x29ddd6=new yt(_0x4286dd);return _0x29ddd6['set']({'label':Mi(_0x4286dd,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x39b836,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x29ddd6['on']('execute',()=>{_0xd4cbf4['fire']('startConversation');}),_0x29ddd6;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x785988,_0x17171c){super(_0x785988),this['_bodyCollection']=new Xt(_0x785988),this['_bodyCollection']['attachToDom']();const _0x41bead=Un(_0x785988,this);this['chatHeader']=new AIHeaderView(_0x785988,{'label':Mi(_0x785988,'AI_CHAT_HEADING'),'icon':_0x5ef127,'class':'ck-ai-header_chat','content':_0x41bead,'showResizeButton':_0x17171c['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x785988,this['_bodyCollection']),this['chatFeed']['delegate'](...Os)['to'](this),this['chatControls']=new AIChatControlsView(_0x785988,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x17171c['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x17171c['filesEnabled']}),this['chatControls']['delegate'](...Os)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x785988),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x785988['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x1a2e91,_0x3b8502,_0x3d0262,_0x1f7e8f){this['chatControls']['populateSourceResourceBalloon'](_0x1a2e91,_0x3b8502,_0x3d0262,_0x1f7e8f);}['closeSourceResourceBalloon'](_0x35937d){this['chatControls']['closeSourceResourceBalloon'](_0x35937d);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x2e5d09{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x4dcc43){super(_0x4dcc43);const _0x33e6eb=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x33e6eb['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled')}),this['_view']['delegate']('resizeTabs')['to'](_0x33e6eb),this['_view']['delegate'](...Os)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x3fb8c7,{showDiff:_0x45cde8})=>{this['showDiff']=_0x45cde8;}),this['disableControls'](),_0x33e6eb['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x5ef127,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x33e6eb['view'],'isMaximized',_0x140411=>_0x140411),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x528a24=>_0x528a24),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x457a35){const _0x33c8fd=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x457a35['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x33c8fd}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x572d1c,staticMessage:_0x2b4e24}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x572d1c,'initialContent':'<p>'+_0x2b4e24+'</p>'});});}async['addFeedItemUserMessage'](_0x4663f2){const _0x4d86a9=_0x4663f2['attributes']?.['displayedPrompt']||_0x4663f2['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x4663f2['contextItems']['values']()),'initialContent':'<p>'+_0x4d86a9+'</p>','id':_0x4663f2['id']});});}async['addFeedItemError']({errorMessage:_0x5af10d,id:_0x15a438}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x5af10d+'</p>','id':_0x15a438});});}async['addFeedItemAIReply'](_0x4d6982){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4d6982['interactionId']+':'+_0x4d6982['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x225590){const _0x34783f=ms(this['context']),_0x3ebdfc=_0x34783f['map'](_0x470dfb=>_0x470dfb['config']['get']('ai.availableReplyActions')||[...Ds]);let _0x5dce3d=_0x3ebdfc['reduce']((_0x18dcd1,_0x1b7b39)=>_0x18dcd1['filter'](_0x2e9ab8=>_0x1b7b39['includes'](_0x2e9ab8)),_0x3ebdfc[0x0]||[...Ds]);const _0x5dbc9a=_0x34783f['every'](_0x2369a9=>_0x2369a9['plugins']['has']('TrackChanges')),_0x2dcc91=_0x34783f['map'](_0xdce9e9=>_0xdce9e9['commands']['get']('trackChanges'));return _0x5dbc9a?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x2dcc91,'value',(..._0x582b56)=>_0x582b56['some'](_0x36a96b=>_0x36a96b))):_0x5dce3d=_0x5dce3d['filter'](_0x40963e=>'insertSuggestion'!=_0x40963e),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x225590['interactionId']+':'+_0x225590['id'],'areActionsDisabled':_0x225590['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x5dce3d}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x477749,_0x4f3c1c){return this['_promiseQueue']['enqueue'](async()=>{const _0x55937c=this['_view']['chatFeed']['children']['last'];if(_0x55937c instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x55937c),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x477749['id'],'capabilities':{'isWebSearchEnabled':_0x55937c['capabilities']['isWebSearchEnabled']||_0x4f3c1c['isWebSearchEnabled'],'isReasoningEnabled':_0x55937c['capabilities']['isReasoningEnabled']||_0x4f3c1c['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x477749['id'],'capabilities':_0x4f3c1c});});}async['addFeedItemCustomElement'](_0x179ade,_0x2e64aa){let _0x7bc1b4;return await this['_promiseQueue']['enqueue'](async()=>{_0x7bc1b4=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x179ade,'id':_0x2e64aa});}),_0x7bc1b4;}['removeFeedItem'](_0x26bf64){this['_view']['chatFeed']['removeItem'](_0x26bf64);}['hasFeedItem'](_0x5ba95b){return this['_view']['chatFeed']['hasItem'](_0x5ba95b);}['updateFeedInteractionHeader'](_0x42bf16){const _0x2ac920=this['_view']['chatFeed']['children']['find'](_0x29a464=>_0x29a464['options']['id']==_0x42bf16['id']&&_0x29a464 instanceof AIChatFeedInteractionHeaderView);_0x2ac920&&_0x2ac920['set']('isVisible',_0x42bf16['isVisible']);}async['updateFeedItemAIReplyContent'](_0x5cb6f8){const _0x5c5f7c=_0x5cb6f8['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1b2abf=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x5cb6f8,'abortSignal':_0x1b2abf,'renderingStrategy':_0x5c5f7c}),_0x5cb6f8['isDone']&&this['markFeedItemAsDone'](_0x5cb6f8['id']);});}['updateFeedItemAIReplySources'](_0x98ef4b,_0x4570a4){this['_view']['chatFeed']['updateWebSources'](_0x98ef4b,_0x4570a4);}async['updateFeedItemAIReplySuggestionContent'](_0x378825){return this['_promiseQueue']['enqueue'](async _0x25ff01=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x378825,'abortSignal':_0x25ff01}),_0x378825['isDone']&&this['markFeedItemAsDone'](_0x378825['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x50b75a){this['_view']['chatFeed']['updateSuggestionPartState'](_0x50b75a);}['setFeedItemAIReplySuggestionPartActive'](_0x5c5c27){this['_view']['chatFeed']['setSuggestionPartActive'](_0x5c5c27);}['markFeedItemAsDone'](_0x8c7d26){this['_view']['chatFeed']['markItemAsDone'](_0x8c7d26);}['removeFeedInteraction'](_0x42025f){this['_view']['chatFeed']['getItemIds']()['filter'](_0x547778=>_0x547778['startsWith'](_0x42025f))['forEach'](_0x5f0617=>this['_view']['chatFeed']['removeItem'](_0x5f0617));}['startInteraction'](){const _0x402e61=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x402e61),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x8015ec){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x5ace74=>_0x5ace74['startsWith'](_0x8015ec['id']))['forEach'](_0x3075f0=>this['markFeedItemAsDone'](_0x3075f0)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x88b016,_0x3804d8){this['_view']['chatControls']['addContextItem'](_0x88b016,_0x3804d8);}['removeContextItem'](_0x1347bd){this['_view']['chatControls']['removeContextItem'](_0x1347bd);}['setContextItemLoading'](_0x17528c,_0x182a68){this['_view']['chatControls']['setContextItemLoading'](_0x17528c,_0x182a68);}['setIsUploadInProgress'](_0x144338){this['_view']['chatControls']['setIsUploadInProgress'](_0x144338);}['setConversationContext'](_0x367ba0){this['_view']['chatControls']['setConversationContext'](_0x367ba0);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x21de4e,_0xe71dd1,_0x19b638){this['_view']['chatControls']['updateResourceState'](_0x21de4e,_0xe71dd1,_0x19b638);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x4bb112){this['_view']['chatControls']['setAddContextOptions'](_0x4bb112);}['updateCapabilities'](_0x32f663){this['_view']['chatControls']['setWebSearch'](_0x32f663['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x32f663['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x32f663));}['setSelectedModel'](_0x52a16c,_0x3af036){this['_view']['chatControls']['setModel'](_0x52a16c),_0x3af036&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x26eae9){this['feedItemRenderingStrategy']=_0x26eae9;}['toggleLoadingSkeleton'](_0x55263c){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x55263c);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x192662,_0x4b02c6=!0x1){if(_0x4b02c6&&!St()&&_0x192662['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x192662);this['_view']['chatHeader']['label']=_0x192662;}['setLoadingMessage'](_0x5289e7){this['_view']['chatFeed']['setLoadingMessage'](_0x5289e7);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x450c37){let _0x3cbd40=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x450c37[_0x3cbd40],_0x3cbd40++,_0x3cbd40===_0x450c37['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x468dad){return _0x468dad['isWebSearchEnabled']&&_0x468dad['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x468dad['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x468dad['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x504ac7){return _0x504ac7?_0x504ac7['isWebSearchEnabled']&&_0x504ac7['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x504ac7['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x504ac7['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x32c466,_0x247b89,_0x31c53d,_0x98db29){this['_view']['populateSourceResourceBalloon'](_0x32c466,_0x247b89,_0x31c53d,_0x98db29);}['closeSourceResourceBalloon'](_0x62bb96){this['_view']['closeSourceResourceBalloon'](_0x62bb96);}['setPromptInputValue'](_0x1b7dc4){this['_view']['chatControls']['setPromptInputValue'](_0x1b7dc4);}['focusPromptInput'](_0x5da766=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x5da766);}['scrollFeedToSuggestion'](_0x2c3ff4,_0x81204a){this['_view']['chatFeed']['scrollToSuggestion'](_0x2c3ff4,_0x81204a);}['startAutoScroll'](_0x3157e7={}){this['_view']['chatFeed']['startAutoScroll'](_0x3157e7);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x5ef811,_0x48b95e){super(_0x5ef811),this['sections']=_0x48b95e,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x2ba8cc){let _0x56d7c4=0x0,_0x403269=0x0;for(const _0x18ee1d of this['sections']){const {resultsCount:_0x5d76db,totalItemsCount:_0x1a0ac2}=_0x18ee1d['filter'](_0x2ba8cc);_0x56d7c4+=_0x5d76db,_0x403269+=_0x1a0ac2;}return{'resultsCount':_0x56d7c4,'totalItemsCount':_0x403269};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x39a9b8,{title:_0x231b7d,items:_0x549ab7}){super(_0x39a9b8);const _0x2c8767=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x231b7d,this['itemsViews']=_0x549ab7;const _0x16c261=new Nt(_0x39a9b8);_0x16c261['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x39a9b8),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x2c8767['if']('isVisible','ck-hidden',_0x4d2657=>!_0x4d2657)]},'children':[_0x16c261,this['_itemsListView']]});}['filter'](_0x30b3ea){const _0x3db827=this['itemsViews']['length'];let _0x3e6ec3=0x0;for(const _0x4a4739 of this['itemsViews']){if(_0x30b3ea){const _0x6a12f2=_0x4a4739['isMatching'](_0x30b3ea);_0x4a4739['isVisible']=!!_0x6a12f2,_0x4a4739['highlightText'](_0x30b3ea);}else _0x4a4739['isVisible']=!0x0,_0x4a4739['highlightText'](null);_0x4a4739['isVisible']&&_0x3e6ec3++;}return this['isVisible']=_0x3e6ec3>0x0,{'resultsCount':_0x3e6ec3,'totalItemsCount':_0x3db827};}['getItem'](_0x8ee23e){return this['itemsViews']['find'](_0x4b1dad=>_0x4b1dad['id']===_0x8ee23e);}['removeItem'](_0x2e1a2e){const _0x3f4811=this['itemsViews']['indexOf'](_0x2e1a2e);-0x1!==_0x3f4811&&(this['itemsViews']['splice'](_0x3f4811,0x1),this['_itemsListView']['items']['remove'](_0x2e1a2e));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
|
|
27
|
+
_0x452051(Ht){['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x1df4f3,_0x126685){super(_0x1df4f3);const _0x9f4483=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x126685['pinned']),this['set']('loadingState',null),this['set']('title',_0x126685['title']),this['id']=_0x126685['id'];const {createdAt:_0x68fdc1,active:_0x438085=!0x1}=_0x126685;this['_titleView']=new _0xb413a6(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x19557f=this['_createCheckView'](),_0x27f3d9=this['_createPinButtonView'](_0x1df4f3),_0xd3c259=this['_createMenuDropdownView'](),_0x5a4cf0=this['_createEditInputView'](_0x1df4f3),_0xa306b8=this['_createAcceptEditButtonView'](_0x1df4f3,_0x5a4cf0),_0xbe0d57=this['_createCancelEditButtonView'](_0x1df4f3);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x27f3d9),this['actions']['add'](_0xd3c259),this['on']('change:isEdit',(_0x10e81d,_0x389989,_0xcf7dfa)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0xcf7dfa?(this['actions']['add'](_0xa306b8),this['actions']['add'](_0xbe0d57),this['mainContent']['add'](_0x5a4cf0),_0x5a4cf0['element']['value']=this['title']||'',_0x5a4cf0['element']['focus']()):(this['actions']['add'](_0x27f3d9),this['actions']['add'](_0xd3c259),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x438085?'ck-ai-chat-history__item--active':'',_0x9f4483['if']('isVisible','ck-hidden',_0x3b7f51=>!_0x3b7f51),_0x9f4483['if']('isEdit','ck-ai-chat-history__item--edit')],'role':'listitem'},'children':[{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-check-container']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-check',_0x9f4483['if']('loadingState','ck-hidden',_0x19bd12=>!!_0x19bd12)]},'children':_0x438085?[_0x19557f]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x9f4483['if']('loadingState','ck-hidden',_0x398bb8=>!_0x398bb8)]},'children':[this['_createSpinnerView']()]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-row']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-content']},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-title-container',_0x9f4483['if']('loadingState','ck-hidden',_0x351d93=>!!_0x351d93)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x9f4483['if']('loadingState','ck-hidden',_0x28835a=>!_0x28835a)]},'children':[{'text':_0x9f4483['to']('loadingState',_0x14f16a=>_0x14f16a?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x14f16a]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x68fdc1]}]},{'tag':'div','attributes':{'class':['ck-ai-chat-history__item-actions']},'children':this['actions']}]}]}),this['on']('click',()=>{this['isEdit']||this['fire']('selectConversation',{'id':this['id']});});}['updateTitle'](_0x5e8231){this['set']('title',_0x5e8231);}['updateLoadingState'](_0x2ccd1c,_0x29f6b5){this['set']('loadingState',_0x29f6b5?_0x2ccd1c:null);}['_createCheckView'](){const _0x525afd=new Lt();return _0x525afd['set']({'content':_0x36337b}),_0x525afd;}['_createPinButtonView'](_0x55a3eb){const _0xca9829=new yt(_0x55a3eb);return _0xca9829['set']({'label':Mi(_0x55a3eb,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0xe1d023,'withText':!0x1,'tooltip':!0x0}),_0xca9829['bind']('isOn')['to'](this,'pinned'),_0xca9829['on']('execute',()=>{const _0x5dda71=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x5dda71});}),_0xca9829;}['_createMenuDropdownView'](){const _0x3d7022=Ft(this['locale']),_0x13b2cf=_0x3d7022['panelView']['children'];_0x3d7022['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x45860d}),_0x3d7022['panelPosition']='sw';const _0xf9e77e=new yt(this['locale']);_0xf9e77e['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xf9e77e['withText']=!0x0,_0xf9e77e['on']('execute',()=>{this['isEdit']=!0x0;});const _0x1ea950=new yt(this['locale']);_0x1ea950['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x1ea950['withText']=!0x0,_0x1ea950['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x4f2583=new Dt(this['locale']),_0x909489=new Ht(this['locale']);_0x909489['children']['add'](_0xf9e77e);const _0xd7d864=new Ht(this['locale']);return _0xd7d864['children']['add'](_0x1ea950),_0x4f2583['items']['addMany']([_0x909489,_0xd7d864]),_0x13b2cf['add'](_0x4f2583),_0x3d7022;}['_createEditInputView'](_0xd482c8){const _0x210e9a=new _0x28c3c2(_0xd482c8),_0x51a287=_0x210e9a['bindTemplate'];return _0x210e9a['extendTemplate']({'on':{'keydown':_0x51a287['to'](_0x34e4c2=>{'Enter'==_0x34e4c2['key']&&this['_commitEditInputValue'](_0x210e9a);})}}),_0x210e9a;}['_createAcceptEditButtonView'](_0x3ca988,_0x25c8f0){const _0x5d538e=new yt(_0x3ca988);return _0x5d538e['set']({'icon':_0x36337b,'withText':!0x1,'tooltip':Mi(_0x3ca988,'AI_CHAT_HISTORY_ACCEPT')}),_0x5d538e['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5d538e['on']('execute',()=>{this['_commitEditInputValue'](_0x25c8f0);}),_0x5d538e;}['_commitEditInputValue'](_0x2fe705){const _0x4302c5=_0x2fe705['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x4302c5});}['_createCancelEditButtonView'](_0x3f8f35){const _0x4a5df6=new yt(_0x3f8f35);return _0x4a5df6['set']({'icon':_0x395853,'withText':!0x1,'tooltip':Mi(_0x3f8f35,'AI_CHAT_HISTORY_CANCEL')}),_0x4a5df6['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x4a5df6['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x4a5df6;}['_createSpinnerView'](){const _0x3fb245=new AISpinnerView('tiny');return _0x3fb245['isVisible']=!0x0,_0x3fb245;}['isMatching'](_0x484af4){return'string'==typeof this['title']&&this['title']['match'](_0x484af4)?{'title':!0x0}:null;}['highlightText'](_0x433c92){this['_titleView']['highlightText'](_0x433c92);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x15f109,_0x245b35){super(_0x15f109),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x3c4bcd=Un(_0x15f109,this);this['headerView']=new AIHeaderView(_0x15f109,{'label':Mi(_0x15f109,'AI_CHAT_HISTORY_HEADING'),'icon':_0x105978,'class':'ck-ai-header_history','content':_0x3c4bcd,'showResizeButton':_0x245b35}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x15f109,[]),this['sectionsView']['delegate'](...Bn)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x4d1087=>!_0x4d1087)]}}),this['on']('change:isLoading',()=>this['_updateViewVisibility']()),this['on']('change:hasItems',()=>this['_updateViewVisibility']()),this['on']('change:errorMessage',()=>this['_updateViewVisibility']()),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat-history','ck-rounded-corners'],'dir':'ltr'},'children':[this['headerView'],{'tag':'div','attributes':{'class':['ck-ai-chat-history__content']},'children':[this['skeletonView'],this['mainErrorView'],this['emptyView'],this['searchView']]}]});}['_updateViewVisibility'](){this['isSearchViewVisible']=!this['isLoading']&&this['hasItems'],this['isEmptyViewVisible']=!this['isLoading']&&!this['hasItems']&&!this['errorMessage'],this['isMainErrorViewVisible']=!this['isSearchViewVisible']&&!!this['errorMessage'];}['_createSearchView'](){const _0x3cd7dc=new _0x5ebf54(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x1de9e7=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x1de9e7),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x259892=this['_createErrorView']();return _0x259892['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x38d2da=>!_0x38d2da)]}}),_0x3cd7dc['on']('render',()=>{_0x3cd7dc['children']['add'](_0x259892,0x1);}),_0x3cd7dc['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x399f28=>!_0x399f28)]}}),_0x3cd7dc;}['_createSkeletonView'](){const _0x303fe1=new AISkeletonView(this['locale'],Ls['aiHistory']);return _0x303fe1['bind']('isVisible')['to'](this,'isLoading'),_0x303fe1;}['_createErrorView'](){const _0x5df799=new Nt(this['locale']),_0x829ff2=new yt(this['locale']);_0x829ff2['set']({'withText':!0x1,'icon':_0x395853,'class':'ck-ai-notification_error__dismiss-button'}),_0x829ff2['bind']('isVisible')['to'](this,'hasItems',_0x22b4ea=>!!_0x22b4ea),_0x829ff2['on']('execute',()=>{this['errorMessage']='';});const _0x4fb7ac=this['bindTemplate'];return _0x5df799['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x4fb7ac['to']('errorMessage')}]},_0x829ff2]}),_0x5df799;}['_createEmptyStateView'](){const _0x4601fd=new Nt(this['locale']);return _0x4601fd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x446547=>!_0x446547)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x4601fd;}['_createListItemViews'](_0x2d3103,_0x3ee067){const _0x520f76=[];for(const _0x11fa54 of _0x2d3103){const _0x5b49ca=new AIChatHistoryListItemView(_0x3ee067,_0x11fa54);_0x5b49ca['delegate'](...Bn)['to'](this),_0x520f76['push'](_0x5b49ca);}return _0x520f76;}['updateHistoryItemsWithCategories'](_0x54fc42){const _0x43674a=this['locale']||'en',_0x18ea41=[];for(const _0x4af66f of _0x54fc42){const _0x56ae27=this['_createListItemViews'](_0x4af66f['items'],_0x43674a);_0x18ea41['push'](new AIChatHistoryListView(_0x43674a,{'title':_0x4af66f['title'],'items':_0x56ae27}));}this['sectionsView']['sections']=_0x18ea41,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x18ea41),this['hasItems']=_0x54fc42['some'](_0x4601a0=>_0x4601a0['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x51fdfa){for(const _0x29833 of this['sectionsView']['sections']){const _0x3b5b9e=_0x29833['getItem'](_0x51fdfa);if(_0x3b5b9e){if(_0x29833['removeItem'](_0x3b5b9e),0x0===_0x29833['itemsViews']['length']){const _0x5a7f44=this['sectionsView']['sections']['indexOf'](_0x29833);-0x1!==_0x5a7f44&&(this['sectionsView']['sections']['splice'](_0x5a7f44,0x1),this['sectionsView']['items']['remove'](_0x29833));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x5a258d,_0x28a668){for(const _0x15e754 of this['sectionsView']['sections']){const _0x4b00f0=_0x15e754['getItem'](_0x5a258d);if(_0x4b00f0){_0x4b00f0['updateTitle'](_0x28a668);break;}}}['updateItemLoadingState'](_0x2bbf22,_0x115c00,_0x437ef4){for(const _0x43b8df of this['sectionsView']['sections']){const _0x41bcc1=_0x43b8df['getItem'](_0x2bbf22);if(_0x41bcc1){_0x41bcc1['updateLoadingState'](_0x115c00,_0x437ef4);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x73a383=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x73a383);}}}const Bn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x2e5d09{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x144f29){super(_0x144f29);const _0x34bced=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x34bced['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x34bced),this['_historyView']['delegate'](...Bn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x34bced['view'],'isMaximized',_0x469442=>_0x469442),_0x34bced['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x105978,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x17f737){this['_historyView']['removeHistoryItem'](_0x17f737);}['updateItems'](_0x5f0a50){this['_historyView']['updateHistoryItemsWithCategories'](_0x5f0a50);}['updateItemTitle'](_0x3c4747,_0x205ea9){this['_historyView']['updateItemTitle'](_0x3c4747,_0x205ea9);}['updateItemLoadingState'](_0x550a28,_0x27b27d,_0x43ea6b){this['_historyView']['updateItemLoadingState'](_0x550a28,_0x27b27d,_0x43ea6b);}['setLoadingSkeleton'](_0xfdcb7b){this['_historyView']['isLoading']=_0xfdcb7b;}['showError'](_0x4241d4){this['_historyView']['errorMessage']=_0x4241d4;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x2dfa3b,title:_0x25c906,createdAt:_0x306c5c,updatedAt:_0x138973,pinned:_0x24b2bb}){super(),this['id']=_0x2dfa3b,this['createdAt']=new Date(_0x306c5c),this['set']('title',_0x25c906),this['set']('updatedAt',_0x138973?new Date(_0x138973):null),this['set']('pinned',_0x24b2bb||!0x1);}['updateTitle'](_0x25040d){this['set']('title',_0x25040d),this['updatedAt']=new Date();}['updatePinned'](_0x4aee2e){this['set']('pinned',_0x4aee2e),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x131306,group:_0x33ac8a}){super(),this['connector']=_0x131306,this['group']=_0x33ac8a;}async['init'](){try{const _0x1f70c5=this['connector']['fetchConversations'](this['group']),_0x1bdfc0=await _0x1f70c5['getConversations']();this['loadItems'](_0x1bdfc0);}catch(_0x1c3b96){this['fire']('error',{'error':_0x1c3b96,'operation':'init'});}}['addItem'](_0x2a94a3){this['items']['push'](_0x2a94a3);}async['removeItem'](_0x35c5a1){const _0x15063f=this['items']['findIndex'](_0x15271f=>_0x15271f['id']===_0x35c5a1);if(-0x1===_0x15063f)return!0x1;try{return await this['connector']['deleteConversation'](_0x35c5a1)['execute'](),this['items']['splice'](_0x15063f,0x1),this['fire']('itemRemoved',{'itemId':_0x35c5a1}),!0x0;}catch(_0x4f97a6){return this['fire']('error',{'error':_0x4f97a6,'operation':'removeItem','itemId':_0x35c5a1}),!0x1;}}['getItem'](_0x1b2072){return this['items']['find'](_0x53d64f=>_0x53d64f['id']===_0x1b2072);}async['updateItemTitle'](_0x589377,_0x426754){const _0x54dbb5=this['getItem'](_0x589377);if(!_0x54dbb5)return!0x1;try{return await this['connector']['updateConversation'](_0x589377,{'title':_0x426754})['getResult'](),_0x54dbb5['updateTitle'](_0x426754),this['fire']('itemUpdated',{'itemId':_0x589377,'updates':{'title':_0x426754}}),!0x0;}catch(_0x2b0f20){return this['fire']('error',{'error':_0x2b0f20,'operation':'updateItemTitle','itemId':_0x589377}),!0x1;}}async['updateItemPinned'](_0x54b9ed,_0x501a9f){const _0x5c6a2e=this['getItem'](_0x54b9ed);if(!_0x5c6a2e)return!0x1;try{return await this['connector']['updateConversation'](_0x54b9ed,{'pinned':_0x501a9f})['getResult'](),_0x5c6a2e['updatePinned'](_0x501a9f),this['fire']('itemUpdated',{'itemId':_0x54b9ed,'updates':{'pinned':_0x501a9f}}),!0x0;}catch(_0x2cc074){return this['fire']('error',{'error':_0x2cc074,'operation':'updateItemPinned','itemId':_0x54b9ed}),!0x1;}}['loadItems'](_0x53b27d){try{this['items']=[],_0x53b27d['map'](_0x4d6674=>{this['addItem'](new AIChatHistoryItem(_0x4d6674));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x5a4b83){this['fire']('error',{'error':_0x5a4b83,'operation':'loadItems'});}}['getItems'](_0x4b6635={}){const _0x3a3a4f=void 0x0!==_0x4b6635['pinned']&&_0x4b6635['pinned'],_0x18ab06=_0x4b6635['from']?new Date(_0x4b6635['from']['getFullYear'](),_0x4b6635['from']['getMonth'](),_0x4b6635['from']['getDate']()):null,_0x10ab92=_0x4b6635['to']?new Date(_0x4b6635['to']['getFullYear'](),_0x4b6635['to']['getMonth'](),_0x4b6635['to']['getDate']()):null;return this['items']['filter'](_0x53df5d=>{if(_0x53df5d['pinned']!==_0x3a3a4f)return!0x1;if(_0x10ab92){const _0x5f1186=new Date(_0x53df5d['createdAt']['getFullYear'](),_0x53df5d['createdAt']['getMonth'](),_0x53df5d['createdAt']['getDate']());return _0x18ab06?_0x18ab06['getTime']()===_0x10ab92['getTime']()?_0x5f1186['getTime']()===_0x18ab06['getTime']():_0x5f1186<_0x10ab92&&_0x5f1186>=_0x18ab06:_0x5f1186<_0x10ab92;}return!0x0;});}}class AIChatHistoryController extends _0x2e5d09{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0xfb5db3=this['context']['plugins']['get'](AITabs);try{const _0x297d71=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x297d71}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x3b402d,_0x2ea17f)=>{this['_setItemLoading'](_0x2ea17f['id'],'remove'),this['_handleRemove'](_0x2ea17f['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x54152a,_0x592124)=>{this['_setItemLoading'](_0x592124['id'],'rename'),this['_handleEditTitle'](_0x592124['id'],_0x592124['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x9c6a8d,_0x2e8e23)=>{void 0x0!==_0x2e8e23['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x2e8e23['itemId'],_0x2e8e23['updates']['title']),void 0x0!==_0x2e8e23['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x2e8e23['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x195888,_0x1d9ced)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1d9ced['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1d9ced['itemId']),this['_clearItemLoading'](_0x1d9ced['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x55733c,_0x222edb)=>{this['_handleHistoryErrorUI'](_0x222edb['error'],_0x222edb['operation'],_0x222edb['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0xe30e5d,_0x44aace)=>{this['_handleSelectConversation'](_0x44aace['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x264c23,_0x41cce1)=>{const _0x1c2e58=_0x41cce1['pinned']?'pin':'unpin';this['_setItemLoading'](_0x41cce1['id'],_0x1c2e58),this['_handleTogglePin'](_0x41cce1['id'],_0x41cce1['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0xfb5db3['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0xfb5db3['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x3d76fc){this['_handleHistoryErrorUI'](_0x3d76fc,'init');}}async['_handleEditTitle'](_0x3d0d88,_0x4836c7){await this['history']['updateItemTitle'](_0x3d0d88,_0x4836c7);}async['_handleTogglePin'](_0x11f273,_0x4ce5b3){await this['history']['updateItemPinned'](_0x11f273,_0x4ce5b3);}async['_handleRemove'](_0x53f027){await this['history']['removeItem'](_0x53f027);}async['_handleSelectConversation'](_0x1f2ced){await this['_aiChatController']['loadConversation'](_0x1f2ced);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x57b310=this['_aiChatController']['activeConversation']?.['id'],_0x3c04d7=this['_getCategorizedItems']()['map'](_0x3eba06=>({'title':_0x3eba06['title'],'items':_0x3eba06['items']['map'](_0x450377=>({'id':_0x450377['id'],'title':_0x450377['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x450377['createdAt'])['toLocaleDateString'](),'active':_0x450377['id']===_0x57b310,'pinned':_0x450377['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x3c04d7);}['_setItemLoading'](_0x4d3612,_0x2fb376){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4d3612,_0x2fb376,!0x0);}['_clearItemLoading'](_0x3a21d8){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3a21d8,null,!0x1);}['_handleHistoryErrorUI'](_0x17f128,_0x2bd5c5,_0x2d770d){const _0x43769b=this['_generateErrorMessage'](_0x2bd5c5,_0x2d770d);this['_aiChatHistoryUi']['showError'](_0x43769b),_0x2d770d&&this['_clearItemLoading'](_0x2d770d),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x439424,_0x188a77){const _0x4134a4=_0x188a77?this['history']['getItem'](_0x188a77):null,_0x19bd54=_0x4134a4?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x439424){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x19bd54);case'updateItemPinned':{const _0x667b53=Mi(this['context']['locale'],_0x4134a4?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x667b53,_0x19bd54]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x19bd54);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x31ebc1=new Date(),_0x23ea23=new Date(_0x31ebc1['getFullYear'](),_0x31ebc1['getMonth'](),_0x31ebc1['getDate']()),_0x34c06c=new Date(_0x23ea23);_0x34c06c['setDate'](_0x34c06c['getDate']()-0x1);const _0x4ad8b6=new Date(_0x23ea23);_0x4ad8b6['setDate'](_0x4ad8b6['getDate']()-0xe);const _0x54b35c=this['history']['getItems']({'pinned':!0x0}),_0x475eb4=this['history']['getItems']({'from':_0x23ea23,'to':_0x23ea23}),_0x456df9=this['history']['getItems']({'from':_0x34c06c,'to':_0x34c06c}),_0x50d1a4=this['history']['getItems']({'from':_0x4ad8b6,'to':_0x34c06c}),_0x5e6fa7=this['history']['getItems']({'to':_0x4ad8b6}),_0x474835=[];return _0x54b35c['length']>0x0&&_0x474835['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x54b35c}),_0x475eb4['length']>0x0&&_0x474835['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x475eb4}),_0x456df9['length']>0x0&&_0x474835['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x456df9}),_0x50d1a4['length']>0x0&&_0x474835['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x50d1a4}),_0x5e6fa7['length']>0x0&&_0x474835['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x5e6fa7}),_0x474835;}}class AIChatHistory extends _0x2e5d09{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x2e5d09{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x46dcdf){super(_0x46dcdf),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends yt{['id'];constructor(_0x27e2f5,_0x2ecb23){super(_0x27e2f5);const {id:_0x25def1,type:_0xb8e8d2,icon:_0x19ec0d}=_0x2ecb23;this['id']=_0x25def1,this['set']({'label':_0x2ecb23['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x2ecb23['id']}}),_0x19ec0d?this['icon']=_0x19ec0d:'chat'===_0xb8e8d2?this['icon']=_0x5ef127:'review'===_0xb8e8d2?this['icon']=_0x268514:'translate'===_0xb8e8d2&&(this['icon']=_0x260bc9);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x584de4,_0x21f23d){super(_0x584de4),this['set']('isEnabled',!0x0);const _0x5e6850=_0x21f23d['map'](_0x2cfa2b=>{const _0x40ef21=new Ht(this['locale']),_0x57cee8=new AIChatShortcutView(this['locale'],_0x2cfa2b);return _0x57cee8['bind']('isEnabled')['to'](this),_0x40ef21['children']['add'](_0x57cee8),_0x57cee8['delegate']('execute')['to'](this),_0x40ef21;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x5e6850),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Gn='chat-shortcuts';class AIChatShortcuts extends _0x2e5d09{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x24e8ab=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x24fe20=_0x24e8ab['activeConversation'];_0x24fe20['isFromHistory']||this['_injectShortcuts'](_0x24fe20);}),this['listenTo'](_0x24e8ab,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x33809a=['chat','review','translate'];this['_shortcuts']['forEach'](_0x5c5716=>{let _0x8741c4=!0x0;if(_0x5c5716['id']&&_0x5c5716['label']&&_0x33809a['includes'](_0x5c5716['type'])?'chat'===_0x5c5716['type']&&(_0x8741c4='string'==typeof _0x5c5716['prompt']):_0x8741c4=!0x1,!_0x8741c4)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x5c5716});});}['_injectShortcuts'](_0x428e1c){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Gn),this['_shortcutsView']['on']('execute',_0x1b19d7=>{const _0x3f10fb=_0x1b19d7['source']['id'];this['_executeShortcut'](_0x3f10fb);}),this['_listenedConversation']=_0x428e1c,this['listenTo'](_0x428e1c,'uploadProgressChanged',(_0x4e0de4,_0x1fe300)=>{this['_shortcutsView']['isEnabled']=!_0x1fe300['isUploadInProgress'];});}['_removeShortcuts'](){const _0x2418dc=this['context']['plugins']['get'](AIChatUI);_0x2418dc['hasFeedItem'](Gn)&&_0x2418dc['removeFeedItem'](Gn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x5113c6){const _0x5b407e=this['_shortcuts']['find'](_0x244a5f=>_0x244a5f['id']===_0x5113c6),_0xe67732=_0x5b407e['type'];'chat'===_0xe67732?this['_runChatShortcut'](_0x5b407e):'review'===_0xe67732?_0x5b407e['commandId']?this['_runReviewShortcut'](_0x5b407e):this['_switchTab']('reviewMode'):'translate'===_0xe67732&&(_0x5b407e['language']?this['_runTranslateShortcut'](_0x5b407e):this['_switchTab']('translate'));}['_switchTab'](_0x293eb5){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x293eb5});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x293eb5);}async['_runChatShortcut']({prompt:_0x53348,draftMode:_0x220027,useWebSearch:_0x44431c=!0x1,useReasoning:_0x275e6f=!0x1,model:_0x543ee4}){const _0x170087=this['context']['plugins']['get']('AIChatController'),_0x28d89d=_0x170087['activeConversation'];let _0x5437f4;_0x5437f4=_0x543ee4?await _0x28d89d['chatModels']['getModel'](_0x543ee4):await _0x28d89d['chatModels']['getDefault'](),_0x5437f4&&await _0x28d89d['setModel'](_0x5437f4),_0x28d89d['setWebSearch'](_0x44431c),_0x28d89d['setReasoning'](_0x275e6f),_0x170087['addCurrentDocumentToChatContext'](),_0x220027?(this['_aiChatUI']['setPromptInputValue'](_0x53348),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x170087['sendMessage']({'message':_0x53348});}['_runReviewShortcut']({commandId:_0x5382ef,model:_0x32915a,prompt:_0x374f8d,params:_0x72f715}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x93b53f={'id':_0x5382ef,'isCustom':'custom'===_0x5382ef};_0x32915a&&_0x374f8d&&(_0x93b53f['args']={'model':_0x32915a,'prompt':_0x374f8d}),_0x72f715&&(_0x93b53f['params']=_0x72f715),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x93b53f);}['_runTranslateShortcut']({language:_0xc90df2}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0xc90df2,'args':{'language':_0xc90df2}});}}class ToggleAICommand extends _0xd5099f{constructor(_0x44ecb4){super(_0x44ecb4);const _0x398fbc=_0x44ecb4['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x398fbc,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x1a30ae=this['editor']['plugins']['get']('AITabs')['view'];_0x1a30ae['isVisible']=!_0x1a30ae['isVisible'];}}class AIToggleButtonUI extends _0x41a2d8{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1c6b4a=this['editor'];_0x1c6b4a['commands']['add']('toggleAi',new ToggleAICommand(_0x1c6b4a)),_0x1c6b4a['ui']['componentFactory']['add']('toggleAi',()=>{const _0x863f91=this['_createAIUIButton'](yt);return _0x863f91['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x863f91;}),_0x1c6b4a['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1f76b0=this['_createAIUIButton'](Yt);return _0x1f76b0['set']({'role':'menuitemcheckbox'}),_0x1f76b0;});}['_createAIUIButton'](_0x12c533){const _0xc77b4f=this['editor'],_0x38e74f=_0xc77b4f['commands']['get']('toggleAi'),_0x119095=new _0x12c533(_0xc77b4f['locale']);return _0x119095['set']({'label':Mi(_0xc77b4f['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0xc998,'isToggleable':!0x0}),_0x119095['bind']('isEnabled')['to'](_0x38e74f),_0x119095['bind']('isOn')['to'](_0x38e74f,'value',_0x42b938=>!!_0x42b938),this['listenTo'](_0x119095,'execute',()=>{_0x38e74f['execute']();}),_0x119095;}}const Fn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x520a3f){super(_0x520a3f),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x392674){this['showError'](_0x392674);}['showError'](_0x2210b7){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x2210b7,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x4759aa=new Nt(this['locale']),_0x1111e4=new Nt(this['locale']);return _0x1111e4['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x4759aa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2c5974=>!_0x2c5974)]},'children':[_0x1111e4]}),_0x4759aa;}}const Wn=0xa;class AIBalloon extends _0x2e5d09{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0xde0851){const {id:_0x15424b}=this['_currentConfig']??{};this['_currentConfig']=_0xde0851,this['_editor']=_0xde0851['targetEditor'];const {id:_0x2a337a}=this['_currentConfig'];this['isOpen']&&_0x15424b===_0x2a337a?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x27047a=this['_editor'];if(!_0x27047a)return;const _0x19de80=_0x27047a['plugins']['get']('Dialog');_0x19de80['isOpen']&&this['_currentConfig']&&_0x19de80['id']===this['_currentConfig']['id']&&_0x19de80['hide']();}['_updateDialog'](){const _0x3b4161=this['_editor']['plugins']['get']('Dialog'),{icon:_0x3b2e37,title:_0x5aedfe}=this['_currentConfig'];_0x3b4161['view']?.['headerView']&&(_0x3b4161['view']['headerView']['label']=_0x5aedfe,_0x3b4161['view']['headerView']['iconView']&&_0x3b2e37&&(_0x3b4161['view']['headerView']['iconView']['content']=_0x3b2e37)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x3b4161['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x2e1905=this['_editor']['plugins']['get']('Dialog'),{id:_0x3582de,title:_0x50b445,icon:_0x19e66d,class:_0x2d34f5,mainView:_0x4dd10f}=this['_currentConfig'];_0x4dd10f['delegate'](...Fn)['to'](this),_0x2e1905['show']({'title':_0x50b445,'icon':_0x19e66d,'hasCloseButton':!0x0,'id':_0x3582de,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x2d34f5||''),'content':_0x4dd10f,'onShow':_0x12f0c2=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x12f0c2['view']?.['updatePosition']();const _0x227f09=this['_getSelectionElements']();_0x227f09&&_0x227f09[0x0]&&Tt({'target':_0x227f09[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x12f0c2['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x3582de});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x3582de}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x4602fb,_0x328709){if(!_0x328709){const _0x542bb5=this['_getTargetRootDomRect']();if(!_0x542bb5)return null;_0x328709=_0x542bb5;}const _0x1d4885=this['_getSelectionElements']();if(!_0x1d4885||0x0===_0x1d4885['length'])return{'left':Math['round'](_0x328709['left']+_0x328709['width']/0x2-_0x4602fb['width']/0x2),'top':Math['round'](_0x328709['top']+_0x328709['height']/0x2-_0x4602fb['height']/0x2)};const _0x3d9257=Math['round'](_0x328709['left']+_0x328709['width']/0x2-_0x4602fb['width']/0x2),_0x52eb69=_0x1d4885['map'](_0x5adf15=>new dt(_0x5adf15)),_0x313be5=_0x4602fb['height'];return{'left':_0x3d9257,'top':this['_calculateOptimalTopPosition'](_0x52eb69,_0x313be5,_0x328709)};}['_calculateOptimalTopPosition'](_0x5dbe0d,_0x45300e,_0xb10156){const _0x4eb82f=new dt(lt['window']),_0x9ff1ed=_0x5dbe0d['map'](_0x4faa04=>_0x4faa04['getVisible']())['filter'](_0x3b9d63=>_0x3b9d63),_0xa511af=dt['getBoundingRect'](_0x9ff1ed);if(!_0xa511af)return Math['round'](_0xb10156['top']+_0xb10156['height']/0x2);const _0x325c71=_0x4eb82f['getIntersection'](_0xa511af);if(!_0x325c71)return Math['round'](_0xb10156['top']+_0xb10156['height']/0x2);const _0x14963d=_0xb10156['getVisible'](),_0x310bd8=_0x14963d&&_0xa511af['height']>_0x14963d['height'],_0x4cdd92=_0x325c71['top'],_0x50d040=_0x325c71['bottom'];if(_0x310bd8){const _0x42f4c8=(_0x14963d||_0x4eb82f)['height']/0x2-_0x45300e/0x2,_0x194c7e=_0x4cdd92-Wn-_0xb10156['top'],_0x10f3ab=_0xb10156['bottom']-_0x50d040-Wn;return _0x194c7e>=_0x45300e?Math['max'](Wn,_0x4cdd92-_0x45300e-Wn):_0x10f3ab>=_0x45300e?_0x50d040+Wn:Math['max'](Wn,_0x42f4c8);}const _0x5096e1=_0x4cdd92-_0x45300e,_0x2c3ee3=_0xb10156['bottom']-_0x50d040-Wn,_0x4af412=_0x4cdd92-Wn-_0xb10156['top'];let _0x3d14f9;if(_0x2c3ee3>=_0x45300e)_0x3d14f9=_0x50d040+Wn;else{if(_0x4af412>=_0x45300e)_0x3d14f9=_0x5096e1-Wn;else _0x3d14f9=_0x4cdd92+_0xa511af['height']/0x2-_0x45300e/0x2;}return _0x3d14f9;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x2a4492=this['_editor'];this['listenTo'](_0x2a4492['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x260999,data:{newRange:_0x47a6e9}}of _0x2a4492['model']['document']['differ']['getChangedMarkers']())if(_0x260999['startsWith'](Rs+':')&&(_0x47a6e9&&(_0x47a6e9['start']['isEqual'](_0x47a6e9['end'])||'$graveyard'==_0x47a6e9['root']['rootName'])||null==_0x47a6e9)){const _0x23048c=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x23048c),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x299cad=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x299cad['model']['document']);}['_getSelectionElements'](){const _0x578611=this['_editor'];return _0x2bcd44(_0x578611['editing'],[..._0x578611['model']['markers']['getMarkersGroup']('ai-selection'),..._0x578611['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0xfd3906=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0xfd3906)return null;const _0x432667=this['_editor'],_0x4718e4=_0x432667['editing']['view']['document']['getRoot'](_0xfd3906['rootName']);if(!_0x4718e4)return null;const _0x419039=_0x432667['editing']['view']['domConverter']['mapViewToDom'](_0x4718e4);return _0x419039&&_0x419039 instanceof HTMLElement?new dt(_0x419039):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x512543,_0x4b7cd3={}){super(_0x512543),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x4b7cd3};const _0x55a347=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x55a347?'ck-ai-mini-toolbar\x20ck-hidden':'ck-ai-mini-toolbar',this['_config']['showCopy']&&(this['_setupCopyButton'](),this['items']['add'](this['copyButton'])),this['_config']['showChanges']&&(this['_setupShowChangesButton'](),this['items']['add'](this['showChangesButton'])),this['_setupRatingButtons'](),this['_config']['showLike']&&this['items']['add'](this['likeButton']),this['_config']['showDislike']&&this['items']['add'](this['dislikeButton']),this['_config']['customView']&&this['items']['addMany'](this['_config']['customView']);}['toggleShowChangesEnabled'](_0x552914){this['showChangesButton']['isEnabled']=_0x552914;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x27d385,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0x1b1546,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x51f25e,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x8963bb=new Lt();_0x8963bb['set']({'content':_0x36337b}),_0x8963bb['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x8963bb);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x54b721,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x31ffbb=>_0x31ffbb?_0x9a19f:_0x54b721),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x438eca,_0x350349){super(_0x438eca);const _0x29a123=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x350349,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x438eca),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x438eca,_0x350349['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x350349),this['_stateView']=new AISuggestionContentPartStateView(_0x438eca),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x438eca,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x438eca,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x3db550,_0x5c77c3,_0x155f0f,_0x3e7a8f)=>{let _0x970fab,_0x10fb45;'pending'===_0x3e7a8f?(_0x970fab=this['_partToolbarView'],_0x10fb45=this['_stateView']):(_0x970fab=this['_stateView'],_0x10fb45=this['_partToolbarView']),this['_stateView']['setState'](_0x155f0f),_0x970fab['isVisible']=!0x1,_0x10fb45['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x29a123['to']('_state',_0x36180a=>'ck-ai-chat-balloon-main_state_'+_0x36180a)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x350349);});}['render'](){super['render'](),this['nextButtonView']['render'](),this['previousButtonView']['render'](),this['_focusTracker']['add'](this['element']),this['_focusTracker']['add'](this['nextButtonView']),this['_focusTracker']['add'](this['previousButtonView']),this['_focusTracker']['add'](this['_miniToolbarView']),this['_focusTracker']['add'](this['_partToolbarView']),this['_keystrokes']['listenTo'](this['element']),this['_keystrokes']['listenTo'](this['nextButtonView']['element']),this['_keystrokes']['listenTo'](this['previousButtonView']['element']),this['_focusables']['addMany']([this['nextButtonView'],this['previousButtonView'],this['_partToolbarView'],this['_miniToolbarView']]);}['destroy'](){super['destroy'](),this['previousButtonView']['destroy'](),this['nextButtonView']['destroy']();}['focus'](){this['focusCycler']['focusFirst']();}['focusLast'](){this['focusCycler']['focusLast']();}async['updateContent'](_0x53e103){_0x53e103?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x53e103);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x17501a){this['_state']=_0x17501a;}['showError'](_0xc072f8){super['showError'](_0xc072f8),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0xe598fb){super['showBlockingError'](_0xe598fb),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x50ef24){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x50ef24;}['togglePartToolbarEnabled'](_0x547ffc){this['_partToolbarView']['isEnabled']=_0x547ffc;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x1232af,showSuggestButton:_0x2436d8}){_0x1232af=_0x1232af&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2436d8=_0x2436d8&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x1232af,'showSuggestButton':_0x2436d8});}['_createNextButtonView'](){const _0x1f5813=new yt(this['locale']);return _0x1f5813['set']({'icon':_0x7a6e23,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x1f5813['on']('execute',()=>{this['fire']('showNext');}),_0x1f5813;}['_createPreviousButtonView'](){const _0x2b6109=new yt(this['locale']);return _0x2b6109['set']({'icon':_0xbe2f13,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x2b6109['on']('execute',()=>{this['fire']('showPrevious');}),_0x2b6109;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x361f91,_0xdfe3a2){super(_0x361f91),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0xdfe3a2});}}class AIChatBalloon extends _0x41a2d8{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x130770){super(_0x130770),this['set']('showDiff',!0x1);}['open'](_0x32bcbd){const _0x16a64e=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x16a64e['plugins']['get']('AIBalloon')['open']({..._0x32bcbd,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x32bcbd['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x32bcbd['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x3e2309){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x3e2309);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x5ad034){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x5ad034);}['_createChatBalloonView'](){const _0x2b1229=this['editor'],_0x3a9f38=_0x2b1229['plugins']['get']('AIBalloon'),_0x22f028=_0x2b1229['commands']['get']('trackChanges');let _0x58a4ba=_0x2b1229['config']['get']('ai.availableReplyActions')||[...Ds];_0x2b1229['plugins']['has']('TrackChanges')||(_0x58a4ba=_0x58a4ba['filter'](_0x353514=>'insertSuggestion'!=_0x353514));const _0x13763a=new AIChatBalloonView(_0x2b1229['locale'],{'availableActions':_0x58a4ba,'showApplyButton':!0x0,'showSuggestButton':!!_0x22f028});return _0x13763a['bind']('showDiff')['to'](this),_0x13763a['delegate'](...Ss)['to'](this),_0x13763a['delegate']('showPrevious','showNext')['to'](this),_0x3a9f38['delegate']('dialogClosed')['to'](this),_0x13763a['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x13763a['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x13763a['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x22f028&&_0x13763a['bind']('isTrackChangesOn')['to'](_0x22f028,'value'),_0x13763a['render'](),_0x13763a;}['_toggleRotatorButtonsInDialogHeader'](_0x2a45d6){const _0x48e175=this['editor'],_0x10bbf4=_0x48e175['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x2a45d6),_0x10bbf4['has'](this['_chatBalloonView']['previousButtonView'])||(_0x10bbf4['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x48e175['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x10bbf4['remove'](this['_chatBalloonView']['previousButtonView']),_0x10bbf4['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x41a2d8{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x34d276];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Kn(_0x30dab1){const {editor:_0x5f3862,action:_0x3bcc0d,withText:_0xba1ca3=!0x1,withIcon:_0x4a8232=!0x0,isInDropdown:_0x40c8ba=!0x0,shouldPreventFocus:_0x17c49d=!0x1,actionButtons:_0x3ca5d1}=_0x30dab1;return()=>{const _0x535a14=_0x5f3862['locale'],_0x4724d9=new yt(_0x535a14),_0x34e652=_0x4724d9['bindTemplate'];_0x40c8ba&&_0x4724d9['extendTemplate']({'on':{'mouseenter':_0x34e652['to'](()=>{_0x17c49d&&_0x17c49d()||_0x4724d9['focus']();})}}),_0x3ca5d1['push']({'buttonView':_0x4724d9,'action':_0x3bcc0d});const _0x1b2baf=_0x3bcc0d['icon']??_0x3bcc0d['parent']?.['icon'];return _0x4724d9['set']({'label':_0x3bcc0d['label'],'withText':_0xba1ca3,'role':'menuitem','icon':_0x4a8232?_0x1b2baf??_0xbc7ee5:void 0x0,'tooltip':!_0xba1ca3,'class':'ck-ai-quick-actions-button','isEnabled':_0x3bcc0d['isEnabled']}),_0x4724d9['on']('execute',()=>{_0x5f3862['editing']['view']['focus'](),_0x5f3862['commands']['execute']('aiQuickAction',_0x3bcc0d);}),_0x4724d9;};}class DropdownMenuButtonWithHighlightView extends _0x3c53e5{['arrowView'];constructor(_0x33354b,_0x43e7e3){super(_0x33354b,_0x43e7e3);const _0x1479d6=this['bindTemplate'];this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':['ck-dropdown-menu-list__nested-menu__button'],'aria-haspopup':!0x0,'aria-expanded':this['bindTemplate']['to']('isOn',_0x12f51c=>String(_0x12f51c)),'data-cke-tooltip-disabled':_0x1479d6['to']('isOn')},'on':{'mouseenter':_0x1479d6['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0xe7c960=new Lt();return _0xe7c960['content']=_0x248521,_0xe7c960['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0xe7c960;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x45a0f0,_0x49ae68,_0x47e40e){super(_0x45a0f0),this['_allListItems']=_0x49ae68,this['_allSearchableItems']=_0x47e40e;}['filter'](_0x43f45d){if(!_0x43f45d)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x259d1b=_0x43f45d['source']['toLowerCase']()['trim'](),_0x4f2a22=this['_allSearchableItems']['filter'](_0x51449e=>(_0x51449e['groupLabel']?_0x51449e['label']+'\x20('+_0x51449e['groupLabel']+')':_0x51449e['label'])['toLowerCase']()['includes'](_0x259d1b));return this['items']['clear'](),this['items']['addMany'](_0x4f2a22['sort']((_0x56d49e,_0xd61fc8)=>{const _0x2c1f7d=_0x56d49e['groupLabel'],_0x413cf7=_0xd61fc8['groupLabel'];return _0x2c1f7d||_0x413cf7?_0x2c1f7d?0x1:-0x1:0x0;})['map'](_0x3dbc46=>_0x3dbc46['item'])),this['_highlightQuery'](_0x259d1b,_0x4f2a22),{'resultsCount':_0x4f2a22['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x638d88,_0x4b2d5c){if(!_0x638d88)return;const _0x489d11=new RegExp(_0x3e499a(_0x638d88),'gi');_0x4b2d5c['forEach'](_0x3954b0=>{_0x3954b0['highlightViews']&&_0x3954b0['highlightViews']['forEach'](_0x1a0af9=>{'function'==typeof _0x1a0af9['highlightText']&&_0x1a0af9['highlightText'](_0x489d11);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x13fe0b=>{_0x13fe0b['highlightViews']&&_0x13fe0b['highlightViews']['forEach'](_0x472bd7=>{'function'==typeof _0x472bd7['highlightText']&&_0x472bd7['highlightText'](null);});});}}const Yn='menu',$n='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x5bdd0b,_0x1f6810,_0x5e3645,_0x5690f1,_0x329f64=!0x1,_0x4924ab=[]){const _0x432c09=_0x5bdd0b['locale'];super(_0x432c09),this['_bodyCollection']=_0x5690f1,this['_hasSearch']=_0x329f64,this['_actionButtons']=_0x4924ab;const _0x6383ca=this['_createListItems'](_0x5bdd0b,_0x1f6810,_0x5e3645);this['optionsListView']=new AIQuickActionsFilteredListView(_0x432c09,_0x6383ca,this['_allSearchableItems']),this['optionsListView']['role']=Yn,this['optionsListView']['items']['addMany'](_0x6383ca),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x329f64&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x6383ca,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x329f64&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x416882=_0x329f64&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x3207b0(_0x416882),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x432c09['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x5ebf54(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x1e2735=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x1e2735);}['_createListItems'](_0x13819b,_0x38922c,_0x414c4f){const _0x5eeb14=new _0x3207b0();return _0x38922c['forEach'](_0x407994=>{if('actions'in _0x407994){const {listItem:_0x357f55}=this['_createActionGroupButton'](_0x13819b,_0x407994,_0x414c4f);_0x5eeb14['add'](_0x357f55),_0x407994['actions']['forEach'](_0x320083=>{const {listItem:_0x45619c,highlightViews:_0x1f129f}=this['_createSearchResultActionButton'](_0x13819b,_0x320083,_0x407994['label'],_0x407994['icon']);this['_allSearchableItems']['push']({'item':_0x45619c,'label':_0x320083['label'],'groupLabel':_0x407994['label'],'highlightViews':_0x1f129f});});}else{const {listItem:_0x58abed}=this['_createActionButton'](_0x13819b,_0x407994);_0x5eeb14['add'](_0x58abed);const _0x517966=_0x58abed['children']['first'];if(_0x517966){const {listItem:_0x4c47b9,highlightViews:_0xe73a6b}=this['_createSearchResultActionButton'](_0x13819b,_0x407994);this['_allSearchableItems']['push']({'item':_0x4c47b9,'label':_0x517966['label']||'','highlightViews':_0xe73a6b});}}}),_0x5eeb14;}['_createActionButton'](_0x5aeba5,_0x17d775,_0x1f0bb9,_0x2fd710){const _0x252938=new Ht(this['locale']);if(_0x1f0bb9&&_0x2fd710){const _0x3b6b3c=new yt(this['locale']),_0x1fa602=_0x3b6b3c['bindTemplate'],_0x4615c1=new _0xb413a6();_0x4615c1['text']=_0x17d775['label'];const _0xf94a42=new _0xb413a6();_0xf94a42['text']=_0x1f0bb9;const _0x58f3fe=new Lt();_0x58f3fe['content']=_0x2fd710,_0x58f3fe['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0xa39231=new Nt(this['locale']);_0xa39231['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x5e1942=new Nt(this['locale']);return _0x5e1942['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3b6b3c['set']({'label':_0x17d775['label']+'\x20('+_0x1f0bb9+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x17d775['isEnabled']}),_0x3b6b3c['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x1fa602['if']('isEnabled','ck-disabled',_0x425aa9=>!_0x425aa9)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4615c1,_0xa39231,_0x58f3fe,_0xf94a42,_0x5e1942],'on':{'mouseenter':_0x1fa602['to'](()=>{this['_isSearchFocused']()||_0x3b6b3c['focus']();}),'click':_0x1fa602['to'](()=>{_0x3b6b3c['fire']('execute');})}}),_0x3b6b3c['on']('execute',()=>{_0x3b6b3c['isEnabled']&&(_0x5aeba5['editing']['view']['focus'](),_0x5aeba5['commands']['execute']('aiQuickAction',_0x17d775));}),_0x252938['children']['add'](_0x3b6b3c),this['_actionButtons']['push']({'buttonView':_0x3b6b3c,'action':_0x17d775}),{'listItem':_0x252938,'highlightViews':[_0x4615c1,_0xf94a42]};}{const _0xd0853f=new _0x448772(),_0x142c7a=new yt(this['locale'],_0xd0853f),_0x546b66=_0x142c7a['bindTemplate'],_0xeed662=_0x17d775['icon']??_0x17d775['parent']?.['icon'],_0x116a69=void 0x0!==_0x17d775['icon'];return _0x142c7a['set']({'label':_0x17d775['label'],'withText':!0x0,'role':'menuitem','icon':_0x116a69?_0xeed662??_0xbc7ee5:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x17d775['isEnabled']}),_0x142c7a['extendTemplate']({'on':{'mouseenter':_0x546b66['to'](()=>{this['_isSearchFocused']()||_0x142c7a['focus']();})}}),_0x142c7a['on']('execute',()=>{_0x5aeba5['editing']['view']['focus'](),_0x5aeba5['commands']['execute']('aiQuickAction',_0x17d775);}),_0x252938['children']['add'](_0x142c7a),this['_actionButtons']['push']({'buttonView':_0x142c7a,'action':_0x17d775}),{'listItem':_0x252938,'highlightViews':[_0xd0853f]};}}['_createSearchResultActionButton'](_0x3729c9,_0x7692f7,_0x32d611,_0x185e98){return _0x32d611&&_0x185e98?this['_createSearchResultGroupedActionButton'](_0x3729c9,_0x7692f7,_0x32d611,_0x185e98):this['_createSearchResultIndividualActionButton'](_0x3729c9,_0x7692f7);}['_createSearchResultGroupedActionButton'](_0x51a86b,_0x46a4ed,_0x74eaf9,_0xfac648){const _0xbcc585=new Ht(this['locale']),_0xd28d6e=new yt(this['locale']),_0x121951=_0xd28d6e['bindTemplate'],{view:_0xde9266,highlightView:_0x4b88ff}=this['_createSearchResultGroupRow'](_0x74eaf9,_0xfac648),{view:_0x20019b,highlightView:_0x2e727a}=this['_createSearchResultActionRow'](_0x46a4ed['label']),_0xa4dda0=this['_createSearchResultContentView'](_0xde9266,_0x20019b);return _0xd28d6e['set']({'label':_0x46a4ed['label'],'withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button\x20ck-ai-quick-actions-search-result-button_with-group','tooltip':!0x1,'isEnabled':_0x46a4ed['isEnabled']}),_0xd28d6e['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-search-result-button','ck-ai-quick-actions-search-result-button_with-group',_0x121951['if']('isEnabled','ck-disabled',_0x535294=>!_0x535294)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0xa4dda0],'on':{'mouseenter':_0x121951['to'](()=>{this['_isSearchFocused']()||_0xd28d6e['focus']();}),'click':_0x121951['to'](()=>{this['_handleSearchResultButtonClick'](_0xd28d6e);})}}),this['_setupActionButtonExecution'](_0xd28d6e,_0x51a86b,_0x46a4ed),_0xbcc585['children']['add'](_0xd28d6e),this['_actionButtons']['push']({'buttonView':_0xd28d6e,'action':_0x46a4ed}),{'listItem':_0xbcc585,'highlightViews':[_0x4b88ff,_0x2e727a]};}['_createSearchResultIndividualActionButton'](_0x3a1a54,_0xaec831){const _0x2c9c27=new Ht(this['locale']),_0x420771=new _0x448772(),_0x15a118=new yt(this['locale'],_0x420771),_0x1b8d71=_0x15a118['bindTemplate'];return _0x15a118['set']({'label':_0xaec831['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0xaec831['isEnabled']}),_0x15a118['extendTemplate']({'on':{'mouseenter':_0x1b8d71['to'](()=>{this['_isSearchFocused']()||_0x15a118['focus']();})}}),this['_setupActionButtonExecution'](_0x15a118,_0x3a1a54,_0xaec831),_0x2c9c27['children']['add'](_0x15a118),this['_actionButtons']['push']({'buttonView':_0x15a118,'action':_0xaec831}),{'listItem':_0x2c9c27,'highlightViews':[_0x420771]};}['_createSearchResultGroupRow'](_0x312e1b,_0x5ab56a){const _0x352164=new Nt(this['locale']),_0x40f4d2=new Lt();_0x40f4d2['content']=_0x5ab56a,_0x40f4d2['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x56e63e=new _0xb413a6();return _0x56e63e['text']=_0x312e1b,_0x352164['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x40f4d2,_0x56e63e]}),{'view':_0x352164,'highlightView':_0x56e63e};}['_createSearchResultActionRow'](_0x5cfde8){const _0x3f5410=new Nt(this['locale']),_0x4fc3de=new _0xb413a6();return _0x4fc3de['text']=_0x5cfde8,_0x3f5410['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x4fc3de]}),{'view':_0x3f5410,'highlightView':_0x4fc3de};}['_createSearchResultContentView'](_0x503a26,_0x4c4332){const _0x448e9c=new Nt(this['locale']);return _0x448e9c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x503a26,_0x4c4332]}),_0x448e9c;}['_setupActionButtonExecution'](_0x5d648e,_0x36682a,_0x4a269f){_0x5d648e['on']('execute',()=>{_0x5d648e['isEnabled']&&(_0x36682a['editing']['view']['focus'](),_0x36682a['commands']['execute']('aiQuickAction',_0x4a269f));});}['_createActionGroupButton'](_0xe1eb38,_0x11358b,_0x2117ec){const _0x1e44d1=new Ht(this['locale']),_0x53401f=new _0x448772(),_0x5456b2=new DropdownMenuButtonWithHighlightView(this['locale'],_0x53401f),_0xf4b6b3=_0x5456b2['bindTemplate'],_0x58fcea=this['_getPanelKeystroke'](_0x2117ec),_0x19ec5e=this['_createGroupActionsList'](_0xe1eb38,_0x11358b['actions'],_0x2117ec);_0x5456b2['set']({'label':_0x11358b['label'],'withText':!0x0,'role':$n,'icon':_0x11358b['icon']??_0xbc7ee5,'isEnabled':_0x11358b['actions']['some'](_0x50aba4=>_0x50aba4['isEnabled'])}),_0x5456b2['extendTemplate']({'on':{'mouseenter':_0xf4b6b3['to'](()=>{this['_isSearchFocused']()||_0x5456b2['focus']();})}});const _0x3d9c20=new zt(this['locale']);return _0x3d9c20['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0xf4b6b3['to'](_0x267c89=>{this['_handlePanelKeydown'](_0x267c89,_0x58fcea,_0x5456b2,_0x3d9c20);})}}),_0x5456b2['bind']('isOn')['to'](_0x3d9c20,'isVisible'),this['_bodyCollection']['add'](_0x3d9c20),_0x3d9c20['content']['add'](_0x19ec5e),this['_setupGroupMenuBehavior'](_0x5456b2,_0x3d9c20),_0x1e44d1['children']['add'](_0x5456b2),this['_actionButtons']['push']({'buttonView':_0x5456b2,'action':_0x11358b}),{'listItem':_0x1e44d1,'highlightView':_0x53401f};}['_createGroupActionsList'](_0xde757e,_0x2d589c,_0x3b89d4){const _0x5ee72f=new Dt(this['locale']);return _0x5ee72f['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x2d589c['forEach'](_0x3c2074=>{const _0x147857=new Ht(this['locale']),_0x4d3689=Kn({'editor':_0xde757e,'action':_0x3c2074,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x147857['children']['add'](_0x4d3689),_0x3b89d4['focusTracker']['add'](_0x4d3689),_0x5ee72f['items']['add'](_0x147857);}),_0x5ee72f;}['_setupGroupMenuBehavior'](_0x4001ec,_0x140b2c){const _0x5b6d7b=_0x4001ec['bindTemplate'],_0x350dc9=this['_getButtonKeystroke'](_0x4001ec);_0x4001ec['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x5b6d7b['to'](()=>{this['_showNestedPanel'](_0x140b2c,_0x4001ec);}),'mouseleave':_0x5b6d7b['to'](_0x1cca80=>{const _0x491546=_0x1cca80['relatedTarget'];this['_isMovingToNestedMenu'](_0x491546,_0x140b2c)||this['_hideNestedPanel'](_0x140b2c);}),'keydown':_0x5b6d7b['to'](_0x29f97d=>{_0x29f97d['key']==_0x350dc9&&(this['_showNestedPanel'](_0x140b2c,_0x4001ec),_0x140b2c['content']['get'](0x0)['focus']());})}}),_0x140b2c['on']('render',()=>{_0x140b2c['element']?.['addEventListener']('mouseleave',_0x4d9c14=>{const _0x18997d=_0x4d9c14['relatedTarget'];_0x4001ec['element']?.['contains'](_0x18997d)||this['_isMovingToNestedMenu'](_0x18997d,_0x140b2c)||this['_hideNestedPanel'](_0x140b2c);});});}['_showNestedPanel'](_0x5b3f4a,_0x31022f){this['_openNestedPanels']['forEach'](_0xc1076f=>{_0xc1076f!==_0x5b3f4a&&_0xc1076f['isVisible']&&_0xc1076f['hide']();}),_0x5b3f4a['show'](),_0x5b3f4a['pin']({'positions':[_0x53f294['eastSouth']],'target':_0x31022f['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x5b3f4a);}['_hideNestedPanel'](_0x1d07cd){_0x1d07cd['hide'](),this['_openNestedPanels']['delete'](_0x1d07cd);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x85992b=>_0x85992b['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x40aa24,_0x1e8dfa){if(!_0x40aa24)return!0x1;if(_0x1e8dfa['element']?.['contains'](_0x40aa24))return!0x0;const _0x3f8ee9=_0x40aa24;return _0x3f8ee9['closest']&&(null!==_0x3f8ee9['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x3f8ee9['closest']('.ck-ai-quick-actions-group-list')||null!==_0x3f8ee9['closest']('.ck-ai-quick-actions-group-button'));}['resetSearch'](){this['_searchTextView']&&this['_searchTextView']['reset']();}['destroy'](){this['_hideAllNestedPanels'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['focus'](){this['_searchTextView']?this['_searchTextView']['focus']():this['optionsListView']['focus']();}['_getPanelKeystroke'](_0x3dad3f){return'rtl'===_0x3dad3f['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x178e77){return'rtl'===_0x178e77['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x288931,_0x13dc30,_0x263098,_0x2a7dfc){_0x288931['key']==_0x13dc30&&(_0x263098['focus'](),this['_hideNestedPanel'](_0x2a7dfc));}['_handleSearchResultButtonClick'](_0x3e8882){_0x3e8882['fire']('execute');}}function qn(_0x559728){const {editor:_0x537fd8,content:_0x40bb45,buttonDefinition:_0x420e04,bodyCollection:_0x4cecde,hasSearch:_0x15170d=!0x1,actionButtons:_0x417f4e}=_0x559728;return()=>{const _0x262e32=_0x537fd8['locale'],_0x414673=_0x537fd8['commands']['get']('aiQuickAction'),_0x2cc513=Ft(_0x262e32);_0x2cc513['bind']('isEnabled')['to'](_0x414673),_0x2cc513['buttonView']['set']({'icon':_0x420e04['icon']??_0xbc7ee5,'label':_0x420e04['label'],'tooltip':!0x0}),_0x2cc513['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x15aa74=new AIQuickActionsDropdownContentView(_0x537fd8,_0x40bb45,_0x2cc513,_0x4cecde,_0x15170d,_0x417f4e);return _0x2cc513['panelView']['children']['add'](_0x15aa74),_0x15170d&&_0x2cc513['on']('change:isOpen',(_0x33ba0d,_0x49e449,_0x2959cc)=>{if(_0x2959cc){if(_0x537fd8['plugins']['has']('AIEditing')){const _0x480d12=_0x537fd8['plugins']['get'](AIEditing),_0x995d8f=_0x537fd8['model']['document']['selection'],_0x43b3d9=Array['from'](_0x995d8f['getRanges']());_0x43b3d9['length']>0x0&&_0x480d12['showFakeVisualSelection']({'editor':_0x537fd8,'ranges':_0x43b3d9,'id':'quick-action','priority':0x14});}}else _0x537fd8['plugins']['has']('AIEditing')&&_0x537fd8['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x15aa74['resetSearch']();}),_0x2cc513;};}const Qn='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Xn='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',zn='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',jn=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x41a2d8{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x5e70f8,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1248ea=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x1248ea),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x6f8501){return function(_0x2b16ff){const _0x1a8fc=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x2b16ff['uiLanguage']),_0x319ed2=_0x1a8fc||'English',_0x2a928e=[{'id':'ask-ai','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x4fd1c},{'id':'chat-commands','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x4fd1c,'actions':[{'id':'explain','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Qn['replace']('%0',_0x319ed2),'type':'chat'},{'id':'summarize','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Xn['replace']('%0',_0x319ed2),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':zn['replace']('%0',_0x319ed2),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x247953},{'id':'continue','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x15599a},{'id':'fix-grammar','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x373739},{'id':'adjust-length','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x54f0eb,'actions':[{'id':'make-shorter','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0xa1345e,'actions':[{'id':'make-tone-casual','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x260bc9,'actions':[{'id':'translate-to-english','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x2b16ff,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x2a928e;}(_0x6f8501);}['_getDefaultAndCustomActions'](){const _0x5062ce=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3103a8=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x59ae1c=>({..._0x59ae1c,'type':'chat'===_0x59ae1c['type']?'chat':'action','icon':void 0x0}));return _0x5062ce['find'](_0x2f19f6=>'other'===_0x2f19f6['id'])['actions']['push'](..._0x3103a8),_0x5062ce;}async['_initActionTypeQuickActions'](){try{const _0x36aba6=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x4004ed=await _0x36aba6['getAll'](),_0x5efdba=(await _0x36aba6['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x5efdba),this['_enableButtonsByType']('action',_0x23b261=>!!_0x4004ed['find'](_0x15c954=>_0x15c954['id']===_0x23b261['model'])||void 0x0===_0x23b261['model']);}catch(_0xdc9489){const _0x10ec0d=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0xdc9489});Ct(_0x10ec0d['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x47890c=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x47890c,'change:isConversationReady',(_0xa942fc,_0x4a876b,_0x3c8116)=>{_0x3c8116&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x47890c['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x43b83f,_0x1ea70c){this['_quickActionsDefinition']['forEach'](_0x4876dd=>{'actions'in _0x4876dd?_0x4876dd['actions']['forEach'](_0x26b88e=>{_0x26b88e['type']===_0x43b83f&&(_0x26b88e['isEnabled']=_0x1ea70c(_0x26b88e));}):_0x4876dd['type']===_0x43b83f&&(_0x4876dd['isEnabled']=_0x1ea70c(_0x4876dd));}),this['_actionButtons']['forEach'](_0x4405df=>{if(Jn(_0x4405df['action']))return;if(_0x4405df['action']['type']!==_0x43b83f)return;const _0x224b48=_0x1ea70c(_0x4405df['action']);if(_0x4405df['action']['isEnabled']=_0x224b48,_0x4405df['buttonView']['isEnabled']=_0x224b48,!_0x224b48&&_0x4405df['action']['model']){const _0x3ffcfd=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x4405df['action']['id'],'modelId':_0x4405df['action']['model']});Ct(_0x3ffcfd['message']);}}),this['_actionButtons']['filter'](_0x3e85de=>Jn(_0x3e85de['action']))['forEach'](_0x5944c4=>{_0x5944c4['buttonView']['isEnabled']=_0x5944c4['action']['actions']['some'](_0x47884f=>_0x47884f['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x38413f,group:_0x549a46})=>{_0x38413f['isEnabled']=_0x549a46['actions']['some'](_0x20148f=>_0x20148f['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x54b1e7){this['_actionButtons']['forEach'](_0x28f326=>{Jn(_0x28f326['action'])||'action'===_0x28f326['action']['type']&&(_0x28f326['action']['model']||(_0x28f326['action']['model']=_0x54b1e7));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x15448c=new Xt(this['editor']['locale']);_0x15448c['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x15448c),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x15448c);}['_initializeQuickActionsDropdown'](_0x512000){const _0x3c041c=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',qn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0xbc7ee5,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x512000,'hasSearch':_0x3c041c,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0xbc5282){this['_quickActionsDefinition']=_0xbc5282['map'](_0x3ea0a9=>{if('actions'in _0x3ea0a9){const _0x58d1bc=_0x3ea0a9;return{..._0x58d1bc,'actions':_0x58d1bc['actions']['map'](_0x59af62=>{const {actions:_0x485660,..._0x143dc4}=_0x58d1bc;return{..._0x59af62,'isEnabled':!0x1,'parent':_0x143dc4};})['filter'](_0x1abfae=>this['_shouldIncludeAction'](_0x1abfae))};}return{..._0x3ea0a9,'isEnabled':!0x1};})['filter'](_0x2ef4a3=>'actions'in _0x2ef4a3?_0x2ef4a3['actions']['length']>0x0:this['_shouldIncludeAction'](_0x2ef4a3));}['_shouldIncludeAction'](_0x1831c7){const _0x22f411=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](jn[_0x1831c7['type']])&&!_0x22f411['includes'](_0x1831c7['id'])&&!('chat'===_0x1831c7['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x199cb1){this['_quickActionsDefinition']['forEach'](_0x3d9a12=>{if('actions'in _0x3d9a12){const _0x15a336=qn({'editor':this['editor'],'content':_0x3d9a12['actions'],'buttonDefinition':_0x3d9a12,'bodyCollection':_0x199cb1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3d9a12['id'],_0x15a336),_0x3d9a12['actions']['forEach'](_0x1b5c2c=>{const _0x3b9b0c=Kn({'editor':this['editor'],'action':_0x1b5c2c,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1b5c2c['id'],_0x3b9b0c);});}else{const _0x35a139=Kn({'editor':this['editor'],'action':_0x3d9a12,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3d9a12['id'],_0x35a139);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x558be1=>{const _0x39ef07=this['editor']['commands']['get']('aiQuickAction'),_0x2d7b7a=new Kt(_0x558be1),_0x381db5=Mi(_0x558be1,'AI_QUICK_ACTIONS_HEADING');_0x2d7b7a['buttonView']['set']({'label':_0x381db5,'icon':_0xbc7ee5});const _0x462ac7=new qt(_0x558be1);return _0x462ac7['set']({'ariaLabel':_0x381db5,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x6996af=>{if('actions'in _0x6996af){const _0x3d6375=_0x6996af,_0x27f890=new Qt(_0x558be1,_0x2d7b7a),_0x1579f4=new Kt(_0x558be1),_0x14b2d4=new qt(_0x558be1);_0x1579f4['buttonView']['set']({'label':_0x3d6375['label'],'icon':_0x3d6375['icon']}),_0x3d6375['actions']['forEach'](_0x318c5b=>{const _0x40867c=new Qt(_0x558be1,_0x1579f4),_0x1aeb07=new Yt(_0x558be1);_0x1aeb07['set']({'label':_0x318c5b['label'],'icon':_0x318c5b['icon'],'role':'menuitem','isEnabled':_0x318c5b['isEnabled']}),_0x1aeb07['on']('execute',()=>{this['_executeQuickAction'](_0x318c5b);}),this['_actionButtons']['push']({'buttonView':_0x1aeb07,'action':_0x318c5b}),_0x1aeb07['delegate']('execute')['to'](_0x1579f4),_0x40867c['children']['add'](_0x1aeb07),_0x14b2d4['items']['add'](_0x40867c);}),_0x1579f4['isEnabled']=_0x3d6375['actions']['some'](_0x1da2d1=>_0x1da2d1['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x1579f4,'group':_0x3d6375}),_0x1579f4['panelView']['children']['add'](_0x14b2d4),_0x27f890['children']['add'](_0x1579f4),_0x462ac7['items']['add'](_0x27f890);}else{const _0x4fe97c=_0x6996af,_0x12a82f=new Qt(_0x558be1,_0x2d7b7a),_0xd0f5c4=new Yt(_0x558be1);_0xd0f5c4['set']({'label':_0x4fe97c['label'],'icon':_0x4fe97c['icon'],'role':'menuitem','isEnabled':_0x4fe97c['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0xd0f5c4,'action':_0x4fe97c}),_0xd0f5c4['on']('execute',()=>{this['_executeQuickAction'](_0x4fe97c);}),_0xd0f5c4['delegate']('execute')['to'](_0x2d7b7a),_0x12a82f['children']['add'](_0xd0f5c4),_0x462ac7['items']['add'](_0x12a82f);}}),(Object['values'](jn)['some'](_0x107907=>this['editor']['plugins']['has'](_0x107907))?_0x2d7b7a['bind']('isEnabled')['to'](_0x39ef07):_0x2d7b7a['set']({'isEnabled':!0x1}),_0x2d7b7a['panelView']['children']['add'](_0x462ac7),_0x2d7b7a);});}['_executeQuickAction'](_0x720224){const _0x3fe47c=this['editor'];_0x3fe47c['editing']['view']['focus'](),_0x3fe47c['commands']['execute']('aiQuickAction',_0x720224);const _0x208143=_0x3fe47c['ui']['view']['menuBarView'];_0x208143&&_0x208143['close']&&_0x208143['close']();}}function Jn(_0xfd0b3){return'actions'in _0xfd0b3;}class AIQuickActionsCommand extends _0xd5099f{['execute'](_0x451163){switch(this['_expandSelectionIfCollapsed'](),_0x451163['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x1ed96d=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x1ed96d});}this['_handleAIChatAction'](_0x451163);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x13d50e=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x13d50e});}this['_handleAIActionsAction'](_0x451163);}}async['_handleAIChatAction'](_0x4b8164){const _0x1f7ead=this['editor']['plugins']['get']('AIChatController'),_0x349a1e=this['editor']['plugins']['get']('AITabs')['view'];if(_0x349a1e['isVisible']||(_0x349a1e['isVisible']=!0x0),'chat'!==_0x349a1e['activeTab']&&_0x349a1e['activateTab']('chat'),'ask-ai'===_0x4b8164['id'])_0x1f7ead['removeSelectionFromChatContext'](),_0x1f7ead['addSelectionToChatContext'](this['editor']),_0x1f7ead['focusPromptInput']();else await _0x1f7ead['startConversation']({'modelId':_0x4b8164['model']}),_0x1f7ead['removeSelectionFromChatContext'](),_0x1f7ead['addSelectionToChatContext'](this['editor']),_0x1f7ead['focusPromptInput'](),await _0x1f7ead['sendMessage']({'message':_0x4b8164['prompt']||_0x4b8164['displayedPrompt']||_0x4b8164['label'],'attributes':{'quickActionData':{'id':_0x4b8164['id']},'displayedPrompt':_0x4b8164['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x2dfb29=this['editor'],_0x515f3b=_0x2dfb29['model']['document']['selection'];if(!_0x515f3b['isCollapsed'])return;const _0x2f0e5e=gt(_0x515f3b['getSelectedBlocks']())||_0x2dfb29['model']['schema']['getLimitElement'](_0x515f3b);_0x2dfb29['model']['change'](_0x48c9e7=>{_0x48c9e7['setSelection'](_0x2f0e5e,'in');});}['_handleAIActionsActionLabel'](_0xd78d0d){return _0xd78d0d['parent']?.['label']&&'other'!==_0xd78d0d['parent']?.['id']?_0xd78d0d['parent']['label']+':\x20'+_0xd78d0d['label']:_0xd78d0d['label'];}async['_handleAIActionsAction'](_0xd1056b){const _0x6f9890=this['editor']['plugins']['get']('AIActions'),_0xa41da3=_0xd1056b['prompt']?{'userMessage':_0xd1056b['prompt'],'model':_0xd1056b['model']}:{'actionName':_0xd1056b['actionName']||_0xd1056b['id'],'args':_0xd1056b['args']},_0x27aa34=this['_handleAIActionsActionLabel'](_0xd1056b);await _0x6f9890['executeAction'](_0xa41da3,_0x27aa34,_0xd1056b['icon']);}}class AIQuickActionsEditing extends _0x41a2d8{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x32d556=this['editor'],_0x200f4b=new AIQuickActionsCommand(this['editor']);if(_0x32d556['commands']['add']('aiQuickAction',_0x200f4b),_0x32d556['plugins']['has']('AIChat')){const _0x5eb810=this['editor']['plugins']['get']('AIChatController');_0x32d556['model']['document']['selection']['on']('change:range',(_0x10dff1,_0x1bd87c)=>{_0x1bd87c['directChange']&&_0x5eb810['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x4ae48a,_0x8f39e2='text'){'modification'===this['type']&&'text'===_0x8f39e2&&(_0x8f39e2=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x4ae48a,_0x8f39e2);}['updateChangeGroups'](_0x253fe5){const _0x17d156=this['parsedContent']['get'](_0x253fe5)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x253fe5,_0x17d156),this['changeGroups']=[],0x0==_0x17d156['childNodes']['length'])return;rs(this['documentContextContent']['get'](_0x253fe5),this['parsedMergedContent']['get'](_0x253fe5));const _0x18de7b=this['documentContextContent']['get'](_0x253fe5)['children']['map'](_0x7f3927=>({'node':_0x7f3927,'id':Xi(_0x7f3927,'data-id')})),_0x3382f1=_0x17d156['children']['map'](_0x34f991=>({'node':_0x34f991,'id':Xi(_0x34f991,'data-id')||at()})),_0x5f4fb3=_0x4079c9(_0x18de7b,_0x3382f1,{'comparator':(_0x57a818,_0x75904d)=>_0x57a818['id']==_0x75904d['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x5f4fb3['length']&&_0x5f4fb3[_0x5f4fb3['length']-0x1]['removed'];)_0x5f4fb3['pop']();}const _0x59db4f=_0x5f4fb3['map'](_0x4cf949=>{const _0x4648ef=_0x4cf949['added']?'new':_0x4cf949['removed']?'removed':'modified';return{'node':_0x4cf949['value'][0x0]['node'],'type':_0x4648ef,'id':_0x4cf949['value'][0x0]['id']};}),_0x214741=this['_documentIdToSource']['get'](_0x253fe5);this['changeGroups']['push']({'changes':_0x59db4f,'state':'pending','index':this['changeGroups']['length'],'editor':_0x214741['editor'],'rootName':_0x214741['rootName'],'documentId':_0x253fe5});}['_getDifferentChangeGroups'](_0x30266a,_0x996480){return _0x996480;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x2e0ae1){super(_0x2e0ae1),this['content']=_0x2e0ae1['content'],this['version']=_0x2e0ae1['version'],this['editor']=_0x2e0ae1['editor'],this['rootName']=_0x2e0ae1['rootName'],this['actionName']=_0x2e0ae1['actionName'],this['args']=_0x2e0ae1['args'],this['userMessage']=_0x2e0ae1['userMessage'],this['model']=_0x2e0ae1['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x546b2f){const _0x264a11=this['editor']['config']['get']('collaboration.channelId'),_0x28d798=new AIActionsReply({..._0x546b2f,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x264a11,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x264a11,this['editor']]])});return this['replies']['push'](_0x28d798),_0x28d798['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x28d798),_0x28d798;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x4c39c9,_0x3a943c=!0x0,_0x1a6756=!0x0){super(_0x4c39c9),this['set']('isEnabled',!0x1),_0x3a943c&&(this['applyButton']=this['_createButton'](Mi(_0x4c39c9,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x1a6756&&(this['suggestButton']=this['_createButton'](Mi(_0x4c39c9,'AI_BALLOON_SUGGEST_BUTTON'),_0x3a943c?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x3a943c,'showSuggestButton':_0x1a6756}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x1226cd,showSuggestButton:_0x3e0201}){this['applyButton']&&(this['applyButton']['isVisible']=_0x1226cd),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x3e0201);}['_createButton'](_0x393784,_0x495511){const _0x5603b1=new yt(this['locale']);return _0x5603b1['set']({'label':_0x393784,'class':_0x495511,'isVisible':!0x0,'withText':!0x0}),_0x5603b1;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x2fad1c){super(_0x2fad1c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0x2fad1c,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x2d4fab){super(_0x2d4fab),this['set']('isVisible',!0x0);const _0x33b198=new AISpinnerView('small');_0x33b198['isVisible']=!0x0;const _0x558a84=new Nt(this['locale']);_0x558a84['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3a5eb5=>!_0x3a5eb5)]},'children':[_0x33b198,_0x558a84]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x8d33df,_0x1144ed){super(_0x8d33df),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x1144ed,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x3207b0(),this['_addContentWrapper'](_0x1144ed),this['_addDisclaimerView'](),this['_addToolbar'](_0x1144ed),this['_focusables']['clear'](),this['_focusables']['addMany']([this['_toolbarView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-main']},'children':this['_dialogContent']}),this['on']('change:isTrackChangesOn',()=>{this['_toggleToolbarButtonsVisibility'](_0x1144ed);});}['render'](){super['render']();for(const _0x33a628 of this['_focusables'])this['_focusTracker']['add'](_0x33a628['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x594ba0){-0x1===_0x594ba0?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x39271e){this['_isLoading']=_0x39271e;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x259266){super['showError'](_0x259266),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x2bbb4f){super['showBlockingError'](_0x2bbb4f),this['setErrorState']();}['addMiniToolbarItem'](_0x880a29){this['_miniToolbarView']['items']['has'](_0x880a29)||this['_miniToolbarView']['items']['add'](_0x880a29);}['removeMiniToolbarItem'](_0x1b8b30){this['_miniToolbarView']['items']['has'](_0x1b8b30)&&this['_miniToolbarView']['items']['remove'](_0x1b8b30);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x466826,showSuggestButton:_0x1151d2}){_0x466826=_0x466826&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x1151d2=_0x1151d2&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x466826,'showSuggestButton':_0x1151d2});}async['updateContent'](_0x1ed29c){await this['_streamableContentView']['update'](_0x1ed29c);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x3d4255){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x3d4255['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x30dc2a,showSuggestButton:_0x331ffa}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x30dc2a,_0x331ffa),this['_toolbarView']['applyButton']?.['on']('execute',()=>{this['fire']('applySuggestion');}),this['_toolbarView']['suggestButton']?.['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_toolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',this,'_hasError',(_0x514a66,_0xf39e6e,_0x557051)=>!(_0x514a66||_0xf39e6e||_0x557051)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x30dc2a,'showSuggestButton':_0x331ffa}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x5e385b){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x5e385b),this['_miniToolbarView']['delegate'](...Ss)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x20e69b,_0x5657f1)=>!(_0x20e69b||_0x5657f1)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x11864c=new yt(this['locale']),_0x287a79=new yt(this['locale']),_0x4159d7=new AIActionsBalloonNavigationCounterView(this['locale']),_0x2b9b6b=new yt(this['locale']);_0x11864c['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x287a79['set']({'icon':_0x361218,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x2b9b6b['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x11864c['bind']('isEnabled')['to'](this,'isBusy',_0x2f6c77=>!_0x2f6c77),_0x11864c['on']('execute',()=>{this['fire']('tryAgain');}),_0x287a79['bind']('isEnabled')['to'](this,'isBusy',_0x34185c=>!_0x34185c),_0x287a79['on']('execute',()=>{this['fire']('showPrevious');}),_0x2b9b6b['bind']('isEnabled')['to'](this,'isBusy',_0x3fbaab=>!_0x3fbaab),_0x2b9b6b['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x287a79,this['_navigationCounter']=_0x4159d7,this['_navigationNextButton']=_0x2b9b6b,this['_navigationTryAgainButton']=_0x11864c;}['updateMiniToolbarButtons'](_0x56c468,_0x98effe){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x32bc90=_0x56c468>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x32bc90){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0xe0c156=_0x56c468-_0x98effe;this['_navigationCounter']['setInteractionCount'](_0xe0c156+'/'+_0x56c468),this['_navigationPreviousButton']['isEnabled']=_0x98effe<_0x56c468-0x1,this['_navigationNextButton']['isEnabled']=_0x98effe>0x0;}else this['removeMiniToolbarItem'](this['_navigationPreviousButton']),this['removeMiniToolbarItem'](this['_navigationCounter']),this['removeMiniToolbarItem'](this['_navigationNextButton']);}['disableMiniToolbarButtons'](){this['_navigationTryAgainButton']['isEnabled']=!0x1,this['_navigationPreviousButton']['isEnabled']=!0x1,this['_navigationNextButton']['isEnabled']=!0x1;}['startAutoScroll'](){this['_initializeScrollManager'](),this['_scrollManager']&&this['_scrollManager']['start']();}['stopAutoScroll'](){this['_scrollManager']&&this['_scrollManager']['stop']();}['toggleIsLoading'](_0x53c027){this['_isLoading']=_0x53c027;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x56bffc=this['_getScrollableElement']();_0x56bffc&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x56bffc));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x4af449){super(_0x4af449);const _0x342d1a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x342d1a['to']('interactionCount')}]});}['setInteractionCount'](_0x20fd61){this['set']('interactionCount',_0x20fd61);}}class AIActions extends _0x41a2d8{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x1289fc];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x4fb94a){super(_0x4fb94a),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x1714f7,_0x557262,_0x1297eb){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x4d3c34,anchorData:_0x1e0dc9,root:_0x1df635}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x1714f7,_0x4d3c34,_0x1e0dc9,_0x1df635,_0x557262,_0x1297eb);}}const {modelFragment:_0x226a3f,anchorData:_0x435ee6,root:_0x2e6d96}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x1714f7,_0x226a3f,_0x435ee6,_0x2e6d96,_0x557262,_0x1297eb);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x51552f=this['editor']['plugins']['has']('TrackChanges');let _0x3c3feb=this['editor']['config']['get']('ai.availableReplyActions')||[...Ds];_0x51552f||(_0x3c3feb=_0x3c3feb['filter'](_0x5bc97a=>'insertSuggestion'!=_0x5bc97a));const _0x1cec5b=this['editor']['commands']['get']('trackChanges'),_0x35417b=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x51552f,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x3c3feb});return _0x35417b['bind']('isBusy')['to'](this),_0x1cec5b&&_0x35417b['bind']('isTrackChangesOn')['to'](_0x1cec5b,'value'),_0x35417b['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x35417b['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x35417b['on']('showNext',()=>{this['_navigateToNext']();}),_0x35417b;}['_normalizeSelectionStart'](){const _0x414466=this['editor']['model'],_0x3b7cf0=_0x414466['document']['selection'],_0x5d0b92=_0x3b7cf0['getFirstRange']();if(!_0x5d0b92||_0x5d0b92['isCollapsed'])return;const _0x5bb7f5=gt(_0x3b7cf0['getSelectedBlocks']());if(!_0x5bb7f5)return;const _0x1f95db=_0x414466['createPositionAt'](_0x5bb7f5,0x0);_0x1f95db['isAfter'](_0x5d0b92['start'])&&_0x414466['change'](_0x3db5e6=>{_0x3db5e6['setSelection'](_0x3db5e6['createRange'](_0x1f95db,_0x5d0b92['end']));});}['_getExecuteDataRegular'](){const _0x2c3661=this['editor']['model']['document']['selection'],_0x50b402=_0x2c3661['getFirstRange']()['start']['root'];if(_0x2c3661['isCollapsed']){const _0x1a98e0=gt(_0x2c3661['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x2c3661);this['editor']['model']['change'](_0x236b9a=>{_0x236b9a['setSelection'](_0x1a98e0,'in');});}this['_normalizeSelectionStart']();const _0x357e31=_0x2c3661['getFirstRange'](),_0x194402=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x2c3661),_0x357e31['start'],_0x357e31['end']);this['_copyMarkersToFragment'](_0x194402,_0x2c3661,{'isTableSelection':!0x1});const _0x33088e=_0x2c3661['getFirstRange']()['start'],_0x38ef2c=new Map();let _0x3a01e1=_0x194402;for(let _0x9d369b=0x0;_0x9d369b<_0x33088e['path']['length'];_0x9d369b++)_0x38ef2c['set'](_0x3a01e1,_0x33088e['path'][_0x9d369b]),_0x3a01e1=_0x3a01e1['getChild'](0x0);return{'modelFragment':_0x194402,'anchorData':_0x38ef2c,'root':_0x50b402};}['_getExecuteDataInTable'](){const _0x2b2a04=this['editor']['model']['document']['selection'],_0x5f29b6=this['editor']['plugins']['get']('TableSelection'),_0x51271f=_0x2b2a04['getFirstRange']()['start']['root'],_0x3a3c22=_0x5f29b6['getSelectionAsFragment'](),_0x30e138=_0x2b2a04['getFirstRange']()['start']['parent']['parent'],_0x59fdd7=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x30e138),this['editor']['model']['createPositionAfter'](_0x30e138)),_0x4609d6=this['_wrapWithCommonAncestors'](_0x3a3c22,_0x59fdd7['start'],_0x59fdd7['end']);this['_copyMarkersToFragment'](_0x4609d6,_0x2b2a04,{'isTableSelection':!0x0});const _0x2adc1b=_0x2b2a04['getFirstRange']()['start'],_0x3a6b37=new Map();let _0x93a6e8=_0x4609d6;for(let _0x443214=0x0;_0x443214<_0x2adc1b['path']['length'];_0x443214++)if(_0x3a6b37['set'](_0x93a6e8,_0x2adc1b['path'][_0x443214]),_0x443214<_0x2adc1b['path']['length']-0x1)_0x93a6e8=_0x93a6e8['getChild'](0x0);else{let _0x3a8ae0=_0x93a6e8['nextSibling'];for(;_0x3a8ae0;)_0x3a6b37['set'](_0x3a8ae0,_0x2adc1b['path'][_0x443214]),_0x3a8ae0=_0x3a8ae0['nextSibling'];}return{'modelFragment':_0x4609d6,'anchorData':_0x3a6b37,'root':_0x51271f};}async['_executeAction'](_0x263af7,_0x2990b4,_0xd9164d,_0xa45d51,_0x16e7f9,_0x1b3a84){const _0x47a609=this['editor']['plugins']['get'](AIEditing),_0x2f103b=this['editor']['plugins']['get'](AIBalloon),_0x32031a=this['editor']['model']['document']['selection'],_0x4ec8e1=await _0x47a609['modelToDataWithIds'](_0x2990b4,this['editor']),_0x23be82=this['editor']['model']['document']['version'],_0x9a5676=[..._0x32031a['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x2f103b['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x16e7f9,'icon':_0x1b3a84||_0xbc7ee5,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x9a5676,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2f103b),this['_interactionParams']={'action':_0x263af7,'content':_0x4ec8e1,'version':_0x23be82,'aiBalloon':_0x2f103b,'modelFragment':_0x2990b4,'anchorData':_0xd9164d,'root':_0xa45d51},this['_setupApplyListeners'](),this['listenTo'](_0x2f103b,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x2f103b,'dialogClosed',(_0x11c65e,{id:_0x9fc0bb})=>{if('aiActionsBalloon'===_0x9fc0bb){for(const _0x59f576 of this['_interactions']){if(0x0===_0x59f576['replies']['length']||_0x59f576['stoppedExplicitly'])continue;const _0x2fdea3=_0x59f576['replies'][_0x59f576['replies']['length']-0x1],_0x2cdc3e=_0x2fdea3['changeGroups'][0x0];_0x2cdc3e&&'pending'===_0x2cdc3e['state']&&_0x2fdea3['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x2f103b);}}),this['_createInteraction'](_0x4ec8e1,_0x23be82,_0x2f103b,_0x263af7);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x46c6bc,anchorData:_0xc4f9e6,root:_0x5e124c}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x46c6bc,_0xc4f9e6,_0x5e124c,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x46c6bc,_0xc4f9e6,_0x5e124c,!0x0);});}['_wrapWithCommonAncestors'](_0x1e6b26,_0x5309bf,_0x480d30){const _0x33416d=this['editor']['model']['createRange'](_0x5309bf,_0x480d30)['getCommonAncestor'](),_0x4a68d3=_0x33416d['is']('documentFragment')?[]:_0x33416d['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x4a68d3['length']){const _0x2621f7=_0x4a68d3['map'](_0x1c15c8=>_0x1c15c8['_clone'](!0x1));for(let _0x221c27=0x1;_0x221c27<_0x2621f7['length'];_0x221c27++)_0x2621f7[_0x221c27-0x1]['_appendChild'](_0x2621f7[_0x221c27]);return _0x2621f7[_0x2621f7['length']-0x1]['_appendChild'](_0x1e6b26),new _0x38ddee(_0x2621f7[0x0]);}return _0x1e6b26;}['_copyMarkersToFragment'](_0x34ebbb,_0x224de7,_0x970076={'isTableSelection':!0x1}){const _0x2567de=this['editor']['model'],_0x3ae05b=Array['from'](_0x224de7['getRanges']()),_0xc3f25f=_0x224de7['getFirstRange']()['start'];for(const _0x4c72a3 of _0x2567de['markers']){if(_0x4c72a3['name']['startsWith'](Rs)||!_0x4c72a3['affectsData'])continue;const _0x25c5be=_0x4c72a3['getRange']();if(!_0x3ae05b['some'](_0x557fe5=>_0x557fe5['containsRange'](_0x25c5be,!0x0)))continue;const _0x4327aa=this['_regularCalculateMarkerPath'](_0x25c5be['start'],_0xc3f25f,_0x970076['isTableSelection']),_0x4bd396=this['_regularCalculateMarkerPath'](_0x25c5be['end'],_0xc3f25f,_0x970076['isTableSelection']),_0x1edf02=_0x2567de['createPositionFromPath'](_0x34ebbb,_0x4327aa),_0x194941=_0x2567de['createPositionFromPath'](_0x34ebbb,_0x4bd396);if(!_0x1edf02['isEqual'](_0x194941)){const _0x373da4=_0x2567de['createRange'](_0x1edf02,_0x194941);_0x34ebbb['markers']['set'](_0x4c72a3['name'],_0x373da4);}}}['_regularCalculateMarkerPath'](_0x26e9fd,_0x16570d,_0x36c6e2=!0x1){const _0x35c5fa=[..._0x26e9fd['path']['slice']()];for(let _0xe5d1a4=0x0;_0xe5d1a4<Math['max'](_0x16570d['path']['length'],_0x26e9fd['path']['length']);_0xe5d1a4++){const _0x533d87=_0x16570d['path'][_0xe5d1a4]||0x0,_0x2809ad=(_0x26e9fd['path'][_0xe5d1a4]||0x0)-_0x533d87;if(_0x35c5fa[_0xe5d1a4]=_0x2809ad,0x0!==_0x2809ad&&!_0x36c6e2)break;}return _0x35c5fa;}async['_createInteraction'](_0x473e38,_0x145857,_0x2c2594,_0x2bca13){const _0x3b8a24=this['editor'],_0x1d4619=_0x3b8a24['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x2bca13,'content':_0x473e38,'version':_0x145857,'aiBalloon':_0x2c2594,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x1d4619});const _0x261b05=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x3b8a24['locale'],'content':_0x473e38,'version':_0x145857,'editor':_0x3b8a24,'rootName':_0x1d4619['rootName'],..._0x2bca13});this['_interactions']['push'](_0x261b05);const _0x5f2da1=(_0x588784,_0x3999a7=!0x1,_0x26e78b='streaming')=>this['_promiseQueue']['enqueue'](async _0x39d36a=>{try{const _0x22781a=os({'changeGroups':_0x588784['changeGroups'],'documentContextContent':_0x588784['documentContextContent'],'showDiff':_0x3999a7,'trimUnchanged':!0x1});_0x22781a['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x22781a[0x0],'renderingStrategy':_0x26e78b,'abortSignal':_0x39d36a});}catch(_0x37eb3e){if(this['_isAbortError'](_0x37eb3e))return;throw _0x37eb3e;}});_0x261b05['on']('replyCreated',(_0x39b632,_0x345ed3)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x5f2da1(_0x345ed3)['catch'](_0x174064=>{this['_isAbortError'](_0x174064)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x174064),this['_setErrorState'](_0x261b05));});}),_0x261b05['on']('replyContentUpdated',(_0x342c6e,_0x2711f5)=>{_0x5f2da1(_0x2711f5)['catch'](_0x13c6d5=>{this['_isAbortError'](_0x13c6d5)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x13c6d5),this['_setErrorState'](_0x261b05));});}),_0x261b05['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x29e08f){this['_isAbortError'](_0x29e08f)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x29e08f),this['_setErrorState'](_0x261b05));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x4ca455,{showDiff:_0x14daa})=>{try{this['_balloonShowDiff']=_0x14daa;const _0x36c7d6=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x36c7d6&&await _0x5f2da1(_0x36c7d6,_0x14daa,'static');}catch(_0x332bce){this['_isAbortError'](_0x332bce)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x332bce),this['_setErrorState'](_0x261b05));}}),_0x261b05['on']('replyChangeGroupStateUpdated',()=>{const _0xd8170e={'positiveCount':_0x261b05['replies']['reduce']((_0x5da0b4,_0xe2cdd6)=>_0x5da0b4+_0xe2cdd6['changeGroups']['filter'](_0x31a9df=>'accepted'===_0x31a9df['state'])['length'],0x0),'totalCount':_0x261b05['replies']['reduce']((_0x47b486,_0xda56b2)=>_0x47b486+_0xda56b2['changeGroups']['length'],0x0)},_0x237169=_0x261b05['actionCallId'],_0x334900=_0x261b05['actionName'];_0x334900?this['_aiConnector']['upsertAIActionRating'](_0x334900,_0x237169,_0xd8170e):this['_aiConnector']['upsertCustomAIActionRating'](_0x237169,_0xd8170e);}),this['_setLoadingState']();try{const _0x1adca9=await _0x261b05['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x1adca9;}catch(_0x218563){if(this['_isAbortError'](_0x218563))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x261b05);}}['_applyChanges'](_0x1e41c5,_0x25c03f,_0x86808d,_0x47d580){const _0x57f7a1=this['editor'];if(_0x47d580&&!_0x57f7a1['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x13a524=this['editor']['plugins']['get'](_0x1289fc),_0x25fcb6=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x25fcb6||!_0x25fcb6['replies']['length'])return;const _0x3e0568=_0x25fcb6['replies'][_0x25fcb6['replies']['length']-0x1],_0x494296=_0x3e0568['changeGroups'];_0x3e0568['setChangeGroupState'](0x0,'accepted');let _0x4f6953=Es({'reply':_0x3e0568,'interaction':_0x25fcb6,'groups':_0x494296,'transform':!0x1,'documentCompare':_0x13a524,'documentCompareOptions':{'anchor':_0x57f7a1['model']['createPositionAt'](_0x1e41c5,0x0),'markDeletions':_0x47d580}});_0x4f6953=this['_filterOperationsOutsideRange'](_0x4f6953,_0x25c03f);for(const _0x503a5d of _0x4f6953)this['_anchorOperation'](_0x25c03f,_0x503a5d,_0x86808d);const _0x2aca66=_0x25fcb6['getDocumentContext']()['documents'][0x0]['version'],_0x126ee7=_0x57f7a1['model']['document']['history']['getOperations'](_0x2aca66),_0x3a6e49={'document':_0x57f7a1['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x500688=_0x5d10bd(_0x4f6953,_0x126ee7,_0x3a6e49)['operationsA'];_0x57f7a1['model']['change'](_0x38eab7=>{if(_0x38eab7['setSelection'](_0x57f7a1['model']['document']['selection']['focus']),_0x47d580)_0x57f7a1['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x500688);else{for(const _0x27eb5a of _0x500688)_0x27eb5a['baseVersion']=_0x57f7a1['model']['document']['version'],Ts(_0x57f7a1,_0x27eb5a),_0x38eab7['batch']['addOperation'](_0x27eb5a),_0x57f7a1['model']['applyOperation'](_0x27eb5a);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x59129f,_0x2bc0a9){return _0x59129f['filter'](_0x5e1f80=>{if('rename'==_0x5e1f80['type']){const _0x39b7af=_0x5e1f80['position']['nodeAfter'];return!_0x2bc0a9['has'](_0x39b7af);}if(_0x5e1f80['type']['indexOf']('Attribute')>-0x1){const _0x82f344=_0x5e1f80['range']['start']['nodeAfter'];return!_0x2bc0a9['has'](_0x82f344);}return!0x0;});}['_anchorOperation'](_0x1a91a2,_0x1aca49,_0x1a3473){const _0x5d7e5d=_0x1aca49['clone']();for(const _0x203e0c in _0x1aca49){const _0x1cc856=_0x1aca49[_0x203e0c];_0x1cc856 instanceof _0x805f9a?_0x1aca49[_0x203e0c]=new _0x805f9a(_0x19f352(_0x1cc856['start']),_0x19f352(_0x1cc856['end'])):_0x1cc856 instanceof _0x47e467&&(_0x1aca49[_0x203e0c]=_0x19f352(_0x1cc856));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x5d7e5d['type'])){if(_0x5d7e5d['isDocumentOperation']=!0x1,_0x5d7e5d['baseVersion']=null,'remove'==_0x5d7e5d['type']){const _0x2c3fd1=_0x5d7e5d['sourcePosition'],_0x4d93f8=_0x5d7e5d['howMany'];new _0x2b0abe(_0x2c3fd1,_0x4d93f8)['_execute']();}else _0x5d7e5d['_execute']();}function _0x19f352(_0x4f86c9){if('$graveyard'==_0x4f86c9['root']['rootName'])return _0x4f86c9;const _0x3baa58=[];let _0x315a3c=_0x4f86c9['root'];for(let _0x13e0b3=0x0;_0x13e0b3<_0x4f86c9['path']['length'];_0x13e0b3++){const _0x342119=_0x1a91a2['get'](_0x315a3c)||0x0;_0x3baa58[_0x13e0b3]=_0x4f86c9['path'][_0x13e0b3]+_0x342119,_0x315a3c=_0x315a3c['getChildAtOffset'](_0x4f86c9['path'][_0x13e0b3]);}return new _0x47e467(_0x1a3473,_0x3baa58,_0x4f86c9['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x646c9a,content:_0x3142c1,version:_0x3b535f,aiBalloon:_0x2e7bfc}=this['_interactionParams'];this['_clearErrorState'](),this['_actionsBalloonView']['clearContent'](),this['_actionsBalloonView']['showLoader'](),this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),this['stopListening'](this['_actionsBalloonView']),this['_setupApplyListeners'](),this['_createInteraction'](_0x3142c1,_0x3b535f,_0x2e7bfc,_0x646c9a)['catch'](_0x53c57c=>{this['_isAbortError'](_0x53c57c)||console['error']('Error\x20refreshing\x20interaction:',_0x53c57c);});}['_isAbortError'](_0x1ebcfa){return!!_0x1ebcfa['message']&&_0x1ebcfa['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x4787c9=this['_interactions']['length'];this['_currentInteractionIndex']<_0x4787c9-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x4fc285){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4fc285;const _0x272f97=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x272f97)return;if(_0x272f97['hasError'])return this['_setErrorState'](_0x272f97),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x272f97['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x564af3=_0x272f97['replies'][_0x272f97['replies']['length']-0x1];if(_0x564af3)try{const _0x21d581=os({'changeGroups':_0x564af3['changeGroups'],'documentContextContent':_0x564af3['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0xc35a30=>setTimeout(_0xc35a30,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x21d581[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x2cfac2){this['_isAbortError'](_0x2cfac2)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x2cfac2);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x49b290){const _0x14072d=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x14072d),_0x49b290['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x41a2d8{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x44cb64){super(_0x44cb64),_0x44cb64['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x388bd7,_0x4777e9){super(_0x388bd7),this['id']=_0x4777e9,this['set']('status','pending'),this['set']('changeId',_0x4777e9),this['resultResponseView']=this['_createResultResponseView'](),this['acceptButtonView']=this['_createAcceptButtonView'](),this['dismissButtonView']=this['_createDismissButtonView'](),this['infoButtonView']=this['_createInfoButtonView'](),this['outdatedButtonView']=this['_createOutdatedButtonView'](),this['set']('isInfoToggleOn',!0x1),this['set']('isActive',!0x1),this['set']('showDiff',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-result',this['bindTemplate']['if']('isActive','ck-ai_review__check-run-result_active')]},'on':{'click':this['bindTemplate']['to']('click'),'mouseover':this['bindTemplate']['to']('mouseover'),'mouseout':this['bindTemplate']['to']('mouseout')},'children':[this['resultResponseView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-footer']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-run-result-action-buttons']},'children':[this['acceptButtonView'],this['dismissButtonView'],this['outdatedButtonView']]},this['infoButtonView']]}]}),this['on']('click',(_0x25322d,_0x2c6439)=>{_0x2c6439&&_0x2c6439['target']&&'A'===_0x2c6439['target']['tagName']&&_0x2c6439['preventDefault'](),this['fire']('activateChange',{'id':_0x4777e9,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4777e9,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4777e9,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x4b89b2=new Nt(this['locale']);return _0x4b89b2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x3ace1e=>!_0x3ace1e)]}}),_0x4b89b2;}['_createAcceptButtonView'](){const _0x3fff1c=new yt(this['locale']);return _0x3fff1c['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x3fff1c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4b6e9c=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x4b6e9c['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0xee1158=>'pending'!==_0xee1158&&'accepted'!==_0xee1158),this['bindTemplate']['if']('status',Bi,_0x4e6549=>'pending'===_0x4e6549),this['bindTemplate']['if']('status',Gi,_0x49acaa=>'pending'!==_0x49acaa),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x177a0d=>'accepted'===_0x177a0d)]}}),this['on']('change:status',(_0x4cdb47,_0x22137b,_0x4f2172)=>{_0x3fff1c['isEnabled']='pending'===_0x4f2172,'accepted'===_0x4f2172&&(_0x3fff1c['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x3fff1c['icon']=_0x36337b);}),_0x3fff1c;}['_createDismissButtonView'](){const _0x10dde5=new yt(this['locale']);return _0x10dde5['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x10dde5['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x16bfe5=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x16bfe5['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x36f6d6=>'pending'!==_0x36f6d6&&'rejected'!==_0x36f6d6),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x310f5b=>'pending'===_0x310f5b),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xe694a0=>'rejected'===_0xe694a0)]}}),this['on']('change:status',(_0x457222,_0xfc0376,_0xaee139)=>{_0x10dde5['isEnabled']='pending'===_0xaee139,'rejected'===_0xaee139&&(_0x10dde5['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x10dde5['icon']=_0x395853);}),_0x10dde5;}['_createInfoButtonView'](){const _0x489175=new yt(this['locale']);return _0x489175['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2a9ed6,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x489175['bind']('isOn')['to'](this,'isInfoToggleOn',_0x29cfb2=>_0x29cfb2),_0x489175['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x489175;}['_createOutdatedButtonView'](){const _0x37a7e3=new yt(this['locale']);return _0x37a7e3['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x37a7e3['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x1956e2=>'outdated'!==_0x1956e2)],'disabled':'disabled'}}),_0x37a7e3;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x176ad9,_0x33829b){super(_0x176ad9),this['set']({'isVisible':!0x1,'position':'arrow_se','class':null,'top':0x0,'left':0x0}),this['extendTemplate']({'tag':'div','attributes':{'class':['ck-reset'],'tabindex':'-1'}}),this['set']('isDiffActive',!0x1),this['content']['add'](this['_createContentView']()),_0x33829b['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x2e64ad){this['resultItemView']['changeId']=_0x2e64ad['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x2e64ad['contentDiffed'];}['showBalloon'](_0x5d70d9,_0x56ff10,_0x14cf4c,_0x215237,_0x4f1283,_0x3c8eb7){const _0x17f85e=_0x56ff10();if(!_0x17f85e)return;this['updateContent'](_0x5d70d9),this['show']();const _0x2448fa=Array['from'](_0x17f85e['getClientRects']())['reverse'](),_0x3fb00b=this['_getPointedRectIndexFromEvent'](_0x14cf4c,_0x2448fa),_0x513de0=_0x2448fa[_0x3fb00b??0x0];'click'===_0x215237?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x56ff10(),_0x3fb00b,_0x5d70d9['id'],_0x4f1283,_0x3c8eb7)||_0x513de0})):'hover'===_0x215237&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x56ff10(),_0x3fb00b,_0x5d70d9['id'])||_0x513de0}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0xba3f96=[this['element']];return this['_pinnedTargetElement']&&_0xba3f96['push'](this['_pinnedTargetElement']),_0xba3f96;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x5ee336=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5ee336['setTemplate']({'tag':'div','attributes':{'class':['ck-reset','ck-ai_review-balloon-panel-suggestion',this['bindTemplate']['if']('isDiffActive','ck-ai_review-balloon-panel-suggestion_diff-active')]},'children':[{'tag':'p','attributes':{'class':['ck-ai_review__suggestion-text']},'children':[this['resultItemView']]}]}),_0x5ee336;}['_getBestRectPositionOnClick'](_0x40647c,_0x5c481e,_0x5ae51c,_0x45f335,_0x449e96){if(!_0x40647c)return null;const _0x1609df=this['position']['replace']('arrow_',''),_0x26fb16=Array['from'](_0x40647c['getClientRects']());let _0x4cbc5b,_0x4f353e=_0x26fb16['reverse']();return void 0x0!==_0x5c481e&&this['_isPinnedRectVisible'](_0x4f353e[_0x5c481e],_0x45f335,_0x449e96)?(_0x4cbc5b=_0x4f353e[_0x5c481e],this['_pinnedRectIndex']=_0x5c481e):this['_isPinnedRectVisible'](_0x4f353e[0x0],_0x45f335,_0x449e96)&&void 0x0===_0x5c481e?_0x4cbc5b=_0x4f353e[0x0]:(_0x4f353e='s'==_0x1609df[0x0]?[..._0x26fb16]['reverse']():_0x26fb16,_0x4f353e['forEach'](_0x4ea25b=>{this['_isPinnedRectVisible'](_0x4ea25b,_0x45f335,_0x449e96)&&(_0x4cbc5b=_0x4ea25b);})),this['_pinnedTargetChangeId']=_0x5ae51c,this['_pinnedTargetElement']=_0x40647c,_0x4cbc5b||_0x40647c['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x4055d2,_0x5c9595,_0x40f4b1){if(!_0x4055d2)return null;const _0x3ab930=Array['from'](_0x4055d2['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x5c9595&&this['_pinnedTargetChangeId']!==_0x40f4b1)return this['_pinnedRectIndex']=_0x5c9595,this['_pinnedTargetElement']=_0x4055d2,this['_pinnedTargetChangeId']=_0x40f4b1,_0x3ab930[_0x5c9595];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x40f4b1){if(_0x4055d2!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x3ab930[this['_pinnedRectIndex']];}return void 0x0!==_0x5c9595&&this['_pinnedTargetChangeId']!==_0x40f4b1?(this['_pinnedRectIndex']=_0x5c9595,this['_pinnedTargetElement']=_0x4055d2,this['_pinnedTargetChangeId']=_0x40f4b1,_0x3ab930[_0x5c9595]):_0x4055d2['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x2896b9,_0xca14af){if(_0x2896b9)for(let _0x2f70c3=0x0;_0x2f70c3<_0xca14af['length'];_0x2f70c3++){const _0x5a1ac6=_0xca14af[_0x2f70c3];if(_0x2896b9['clientX']>=_0x5a1ac6['left']-0x3&&_0x2896b9['clientX']<=_0x5a1ac6['right']+0x3&&_0x2896b9['clientY']>=_0x5a1ac6['top']-0x3&&_0x2896b9['clientY']<=_0x5a1ac6['bottom']+0x3)return _0x2f70c3;}}['_isPinnedRectVisible'](_0x1ba9bc,_0x35e8f3,_0x435346){const _0x4fe11a=new dt(_0x1ba9bc),_0x333a3a=_0x35e8f3||document['documentElement'],_0xce08ba=_0x4fe11a['getIntersection'](Ot(_0x435346)),_0x50e3a4=new dt(_0x333a3a)['getIntersection'](_0x4fe11a);return!!(_0xce08ba&&_0x50e3a4&&_0x4fe11a['width']>0x0);}}const Zn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x2e5d09{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x59c07f){super(_0x59c07f),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Zn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4914cb=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4914cb);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x1b6b04){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x51b0b8=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x1b6b04,_0x51b0b8);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x4eef95){_0x4eef95&&('error-general'!==_0x4eef95['status']?'error-chunk'!==_0x4eef95['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0xd7b97a){this['_mainView']['addCheckRunResult'](_0xd7b97a);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x288244){this['_mainView']['showGeneralReviewCoreErrorView'](_0x288244??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x528c09,_0x950198){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x528c09,_0x950198);}['setActiveStateInResults'](_0x16343c){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x277990=>{_0x277990['id']===_0x16343c&&_0x277990['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x1594ec=>_0x1594ec['setItemAsInactive']());}['updateChangeState'](_0x257423,_0x3c0211){'accepted'===_0x3c0211||'rejected'===_0x3c0211||'outdated'===_0x3c0211?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x257423,_0x3c0211):this['_mainView']['reviewCheckResultsView']['showResult'](_0x257423,_0x3c0211);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x52bdc1,_0x4b899b,_0x359c05,_0x26ef3d,_0x3dfaba,_0x1ea30d){this['_balloonSuggestionView']['showBalloon'](_0x52bdc1,_0x4b899b,_0x359c05,_0x26ef3d,_0x3dfaba,_0x1ea30d);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x5210f9){const _0x5edc96=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x553818=>_0x553818['id']===_0x5210f9);return _0x5edc96?_0x5edc96['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x1c22de){super(_0x1c22de),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x326634=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x326634['if']('isVisible','ck-hidden',_0x543a05=>!_0x543a05)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x326634['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x6358c3,_0x3523e1){super(_0x6358c3),this['reviewCoreHeader']=_0x3523e1['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x6358c3),this['reviewCheckListView']=_0x3523e1['list'],this['reviewCheckListView']['delegate'](...Zn)['to'](this),this['reviewCheckResultsView']=_0x3523e1['results'],this['reviewCheckResultsView']['delegate'](...Zn)['to'](this),this['reviewCompletedView']=_0x3523e1['completed'],this['reviewCompletedView']['delegate']('finishReview')['to'](this),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isLoading',!0x1),this['reviewCheckResultsView']['set']('isResultReady',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-review','ck-rounded-corners'],'dir':'ltr'},'children':[this['reviewCoreHeader'],this['generalErrorView'],this['reviewCheckListView'],this['reviewCheckResultsView'],this['reviewCompletedView']]});}['showReviewCheckListView'](){this['reviewCheckListView']['resetAllParameterizedChecks'](),this['reviewCheckListView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x1);}['showReviewCheckResultsView'](){this['hideActionsWhenResultIsReady'](),this['reviewCheckResultsView']['resetErrorState'](),this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCheckResultsView']['clearResults'](),this['reviewCheckResultsView']['set']('isLoading',!0x0),this['reviewCheckResultsView']['set']('isCompleted',!0x1);}['addCheckRunResult'](_0x2a1388){this['reviewCheckResultsView']['addResult'](_0x2a1388),this['reviewCheckResultsView']['set']('isLoading',!0x1);}['showReviewCompletedView'](){this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isCompleted',!0x0),this['reviewCheckListView']['set']('isVisible',!0x1);}['showActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']?(this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x0),this['reviewCompletedView']['set']('isVisible',!0x1)):this['reviewCheckResultsView']['isResultReady']=!0x0;}['showNoChangesView'](){this['reviewCheckListView']['set']('isVisible',!0x1),this['reviewCheckResultsView']['set']('isVisible',!0x1),this['reviewCompletedView']['set']('isVisible',!0x0);}['hideActionsWhenResultIsReady'](){this['reviewCheckResultsView']['isResultReady']=!0x1;}['showGeneralReviewCoreErrorView'](_0x319b66){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x319b66;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x5a261b,_0x2db40a){super(_0x2db40a),this['set']({'label':_0x5a261b,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x2d1858,_0x1620b1){super(_0x2d1858),this['_contents']=_0x1620b1,this['_resultViews']=new _0x3207b0(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x2d1858),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x3e23d2=this['_createCombinedSkeletonLoader'](),_0x3f0426=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x3f0426['if']('isLoading','ck-ai_review__check-run_loading',_0x391333=>_0x391333),_0x3f0426['if']('isResultReady','ck-ai_review__check-run_ready',_0x4cda6f=>_0x4cda6f),_0x3f0426['if']('isVisible','ck-hidden',_0x169c8e=>!_0x169c8e)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x3e23d2,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x381c5f){const _0x4d642c=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x381c5f['id']);_0x4d642c['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x4d642c),_0x4d642c['resultResponseView']['element']['innerHTML']=_0x381c5f['contentDiffed'];}['hideResult'](_0x40b894,_0x32b73b){if('pending'===_0x32b73b)return;const _0x25bffe=this['_resultViews']['find'](_0x4805a9=>_0x4805a9['id']===_0x40b894);_0x25bffe&&(_0x25bffe['status']=_0x32b73b,_0x25bffe['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x54b9dc,_0x3936e5){if('pending'!==_0x3936e5)return;const _0x506fd6=this['_resultViews']['find'](_0x5883fe=>_0x5883fe['id']===_0x54b9dc);_0x506fd6&&(_0x506fd6['status']=_0x3936e5,_0x506fd6['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x1616f5,_0x3ecc61){this['headerTitle']=_0x1616f5,this['headerSubtitle']=_0x3ecc61||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],Ls['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x1fe5fa=new Nt(this['locale']),_0x24b30c=[];for(let _0x18e74a=0x0;_0x18e74a<0x10;_0x18e74a++){const _0x2b4c1e=this['_createSkeletonLoader']();_0x2b4c1e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x24b30c['push'](_0x2b4c1e);}return _0x1fe5fa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x7c121c=>!_0x7c121c)]},'children':_0x24b30c}),_0x1fe5fa;}['_createResultsBodyView'](){const _0x507258=new Nt(this['locale']);return _0x507258['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x233866=>_0x233866)]},'children':this['_resultViews']}),_0x507258;}['_createErrorView'](){const _0x445142=new Nt(this['locale']),_0x1e946e=new yt(this['locale']),t=this['locale']['t'];return _0x445142['delegate']('retryReview')['to'](this),_0x1e946e['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x1e946e['on']('execute',()=>{this['fire']('retryReview');}),_0x445142['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x26a493=>!_0x26a493),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x2475ac=>'chunk'===_0x2475ac)]},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error','ck-ai-notification__full-width','ck-ai_review__check-run-error-message',this['bindTemplate']['if']('errorType','ck-ai-notification_warning',_0x64974a=>'chunk'===_0x64974a)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3adfb8=>'general'!==_0x3adfb8)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x491023=>'chunk'!==_0x491023)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x1e946e]}),_0x445142;}['_createCancelButtonView'](){const _0x1fb28c=new yt(this['locale']);return _0x1fb28c['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x5b2e11}),_0x1fb28c['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4e43d2=>_0x4e43d2),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x17b6f1=>_0x17b6f1)]}}),_0x1fb28c['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1fb28c;}['_createToggleDiffButtonView'](){const _0xc00b2b=new yt(this['locale']);_0xc00b2b['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0xc00b2b['bind']('isEnabled')['to'](this,'isError',_0x5bcd29=>!_0x5bcd29),_0xc00b2b['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2805b0=>!_0x2805b0),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4507d6=>_0x4507d6)]}});const _0x483b06=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x69846=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0xc00b2b['bind']('isOn')['to'](this,'isToggleDiffOn',_0x55eb54=>_0x55eb54),_0xc00b2b['bind']('icon')['to'](this,'isToggleDiffOn',_0x564fed=>_0x564fed?nt:rt),_0xc00b2b['bind']('label')['to'](this,'isToggleDiffOn',_0x23da76=>_0x23da76?_0x483b06:_0x69846),_0xc00b2b['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0xc00b2b;}['_createAcceptAllButtonView'](){const _0x2e9263=new yt(this['locale']);return _0x2e9263['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2e9263['bind']('isEnabled')['to'](this,'isError',_0x1cfcbf=>!_0x1cfcbf),_0x2e9263['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4ffea8=>!_0x4ffea8),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x576191=>_0x576191)]}}),_0x2e9263['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2e9263;}['_createExitReviewButtonView'](){const _0x202b26=new yt(this['locale']);return _0x202b26['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x202b26['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5e5bbf=>!_0x5e5bbf),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x472245=>_0x472245)]}}),_0x202b26['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x202b26;}['_createResultHeaderView'](){const _0x43908f=new Nt(this['locale']),_0x5957c2=this['_createTitleView']();return _0x43908f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x62bb36=>_0x62bb36)]},'children':[_0x5957c2,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x490093=>!_0x490093)],'title':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x43908f;}['_createTitleView'](){const _0x1b6628=new Nt(this['locale']),_0x9067a4=new AISpinnerView();return _0x9067a4['bind']('isVisible')['to'](this,'isResultReady',_0x4d271b=>!_0x4d271b),_0x1b6628['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xa0d36a=>_0xa0d36a)]},'children':[_0x9067a4,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]}]}),_0x1b6628;}['_createFinishReviewButtonView'](){const _0x5a12b5=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x5a12b5['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2962f4=>!_0x2962f4)]}}),_0x5a12b5['delegate']('finishReview')['to'](this),_0x5a12b5;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x242e51,_0x354b78){super(_0x242e51),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x354b78['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x354b78['headerText']);const _0xc23c2b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0xc23c2b['if']('isVisible','ck-hidden',_0x28a3f7=>!_0x28a3f7)]},'children':[this['_resultsHeader'],{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-content-icon']},'children':[{'text':'👍'}]},{'tag':'p','attributes':{'class':['ck-ai_review__review-completed-content-text']},'children':[{'text':_0x354b78['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x598bad){const _0x58813e=new AIReviewCoreFinishReviewButtonView(_0x598bad,this['locale']);return _0x58813e['delegate']('finishReview')['to'](this),_0x58813e;}['_createResultHeaderView'](_0x411a93){const _0x3c6ccb=new Nt(this['locale']);return _0x3c6ccb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x411a93},'children':[{'text':_0x411a93}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3c6ccb;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x1947aa,_0x58d4e5){super(_0x1947aa),this['_defaultValue']=_0x58d4e5['default']||(_0x58d4e5['data']['length']>0x0?_0x58d4e5['data'][0x0]['id']:''),this['_defaultLabel']=_0x58d4e5['data']['find'](_0x1c55e3=>_0x1c55e3['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x5f3665=this['_prepareListOptions'](_0x58d4e5['data']);Jt(this['_dropdownView'],_0x5f3665,{'role':'menu','ariaLabel':_0x58d4e5['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2dd9c5=>{_0x2dd9c5['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x37a285=>{this['formValue']=_0x37a285['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x37a285['source']['model']['label'];}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai_review__check-list-item-parameterized-form-element','ck-ai_review__check-list-item-parameterized-form-element_dropdown']},'children':[this['_dropdownView']]});}['resetToDefault'](){this['formValue']=this['_defaultValue'],this['_dropdownView']['buttonView']['label']=this['_defaultLabel'];}['_prepareListOptions'](_0x5c2b07=[]){const _0x21f753=new _t();this['resetToDefault']();for(const _0x55b1bf of _0x5c2b07){const _0x38665d=new Zt({'label':_0x55b1bf['label'],'withText':!0x0,'role':'menuitemradio','id':_0x55b1bf['id'],'model':_0x55b1bf});_0x38665d['bind']('isOn')['to'](this,'formValue',_0x4ae8f2=>_0x4ae8f2===_0x38665d['id']);const _0x2b20cd={'type':'button','model':_0x38665d};_0x21f753['add'](_0x2b20cd);}return _0x21f753;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x2a822b,_0x3298b1,_0x58e1bc){super(_0x2a822b),this['argsKey']=_0x3298b1?.['argsKey'];if('dropdown'===_0x3298b1['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x3298b1);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x4c2e59=new _0x1b3812(this['locale'],{'children':[this['_formItem']],'class':[_0x58e1bc?'ck-form__row_with-submit':'']});_0x58e1bc&&_0x4c2e59['children']['add'](_0x58e1bc),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x4c2e59]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x4915e1{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0xb4880f){super(_0xb4880f),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x3207b0();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x397a75,_0x275377,_0x190b27=!0x1){super(_0x397a75),this['_check']=_0x275377,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x275377['defaultModel']?_0x275377['defaultModel']['id']:'',this['_defaultLabel']=_0x275377['defaultModel']?_0x275377['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x1d7af5(this['locale'],()=>new AIReviewCorePromptInputView(_0x397a75)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x190b27),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x1b3812(this['locale'],{'children':[this['promptInputView']]}),new _0x1b3812(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x4a6468,_0x346733)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x346733()):_0x346733();}),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x380421=>{this['_focusables']['add'](_0x380421),this['focusTracker']['add'](_0x380421['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x3db43e of this['_getFormValidators']()){const _0x50a2a7=_0x3db43e();if(_0x50a2a7)return this['promptInputView']['errorText']=_0x50a2a7,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x48dcbb=new yt(this['locale']),t=this['locale']['t'];return _0x48dcbb['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x48dcbb['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x48dcbb;}['_createCancelButtonView'](){const _0x129ffe=new yt(this['locale']),t=this['locale']['t'];return _0x129ffe['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x129ffe['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x24baa8=>{_0x24baa8['stopPropagation']();})}}),_0x129ffe['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x129ffe;}['_setModelList'](_0x4fc223){this['_modelSelectionDropdownItems']['clear']();const _0x519ed9=this['_check']['models'];if(_0x4fc223)this['set']('modelDisplayMode','hidden');else{const _0x166b12=0x1===_0x519ed9['length'];this['set']('modelDisplayMode',_0x166b12?'name':'selector');}if(this['resetToDefault'](),_0x519ed9?.['length']){0x1===_0x519ed9['length']&&this['set']('activeModelName',_0x519ed9[0x0]['name']||_0x519ed9[0x0]['id']);for(const _0x47c965 of _0x519ed9){const _0x300c93=new Zt({'label':_0x47c965['name'],'withText':!0x0,'role':'menuitemradio','id':_0x47c965['id'],'model':_0x47c965});_0x300c93['bind']('isOn')['to'](this,'modelId',_0x3e181e=>_0x3e181e===_0x47c965['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x300c93,'labelView':new ModelButtonLabelView(this['locale'],_0x47c965)});}}}['_createModelSelectionDropdown'](){const _0x39b580=Ft(this['locale']);return _0x39b580['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x39b580['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x39b580['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1b56c5=>'selector'===_0x1b56c5),this['listenTo'](_0x39b580,'execute',_0x3ed018=>{this['modelId']=_0x3ed018['source']['model']['id'],_0x39b580['buttonView']['label']=_0x3ed018['source']['label'];}),_0x39b580;}['_createModelNameView'](){const _0x2f3b4a=new ModelNameView(this['locale']);return _0x2f3b4a['bind']('text')['to'](this,'activeModelName',_0x899411=>_0x899411??''),_0x2f3b4a['bind']('isVisible')['to'](this,'modelDisplayMode',_0x52c706=>'name'===_0x52c706),_0x2f3b4a;}['_createActionsFooterView'](){const _0x30db6a=new Nt(this['locale']);return _0x30db6a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x30db6a;}}class ModelNameView extends Nt{constructor(_0x34fb9c){super(_0x34fb9c),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2c05bb=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x2c05bb['if']('isVisible','ck-hidden',_0x37e319=>!_0x37e319)]},'children':[{'text':_0x2c05bb['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x462f07,_0x27cf27){super();const _0x35e146=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x35e146['to']('style'),'id':_0x35e146['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x35e146['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x27cf27['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x3207b0();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x2b34a0,_0x1bb63b,_0xcca081,_0x4a2833=!0x1){super(_0x2b34a0),this['_hideModels']=_0x4a2833,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x1bb63b['isParameterized']);const _0x231ac1=this['_createIconView']();this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item',this['bindTemplate']['if']('isParametrizedViewOpen','ck-ai_review__check-list-item_selected',_0x1fd4ab=>_0x1fd4ab),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x47bf17=>_0x47bf17)],'style':{'--ck-ai-review-check-list-item-index':_0xcca081}},'on':{'click':this['bindTemplate']['to']('click')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-main-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-title']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-list-item-title-text']},'children':[{'text':_0x1bb63b['title']}]},_0x231ac1]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x1bb63b['description']?[{'text':_0x1bb63b['description']}]:[]}]}]},..._0x1bb63b['isParameterized']?[this['_createParameterizedView'](_0x1bb63b)]:[],...'custom'===_0x1bb63b['id']?[this['_createCustomView'](_0x1bb63b,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x1bb63b['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x1bb63b['id'],'args':_0x1bb63b['useArgs']?_0x1bb63b['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x1dffa5=>{_0x1dffa5['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x556252=new Lt();return _0x556252['content']=ot,_0x556252['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x556252;}['_createParameterizedView'](_0x4df074){const _0x303b19=new Nt(),_0x520ec6=this['_createFormView'](_0x4df074);return _0x303b19['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x11c331=>!_0x11c331)]},'children':[_0x520ec6]}),_0x303b19;}['_createFormView'](_0x4f2664){const _0x5a309d=new Nt(),_0x859ada=Array['isArray'](_0x4f2664['options'])?_0x4f2664['options']:[],_0x2df33c=new yt(this['locale']),t=this['locale']['t'];_0x2df33c['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x2df33c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x210a19=>{_0x210a19['stopPropagation']();})}}),_0x2df33c['on']('execute',()=>{const _0x2bdf34=[],_0x2c5871={};this['_formItemsCollection']['forEach'](_0x7ff2aa=>{_0x2bdf34['push'](_0x7ff2aa['value']),_0x4f2664['useArgs']&&_0x4f2664['options']&&(_0x2c5871[_0x7ff2aa['argsKey']]=_0x7ff2aa['value']);}),this['fire']('runReviewCheck',{'id':_0x4f2664['id'],'params':_0x2bdf34['length']?_0x2bdf34:void 0x0,'args':Object['keys'](_0x2c5871)['length']?_0x2c5871:void 0x0});});const _0x11f67d=_0x859ada['length'];return _0x859ada['forEach']((_0x3ae132,_0x32f089)=>{const _0x1e9ece=_0x32f089===_0x11f67d-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x3ae132,_0x1e9ece?_0x2df33c:null));}),_0x5a309d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x5a309d;}['_createCustomView'](_0x546945,_0xed13b6=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x546945,_0xed13b6),this['_customCheckView']['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-parameterized','ck-ai_review__check-list-item-parameterized_custom',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x4733a=>!_0x4733a)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0xe8a1c6,_0x150c46,_0x76c367)=>{_0x76c367||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x4e316a){super(_0x4e316a),this['_checkViews']=new _0x3207b0(),this['_setupTemplate']();}['setChecks'](_0x174d48,_0x3d94c5=!0x1){this['_checkViews']['clear']();for(const [_0x4f2b18,_0x317819]of _0x174d48['entries']()){const _0x32800e=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x317819,_0x4f2b18,_0x3d94c5);_0x32800e['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x32800e);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x23a439 of this['_checkViews'])_0x23a439 instanceof AIReviewCoreReviewCommandListItemView&&_0x23a439['resetToDefault']();}['_setupTemplate'](){const _0x2aa8cf=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x2aa8cf['if']('isVisible','ck-hidden',_0x21f8ba=>!_0x21f8ba)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x4f4cd7=this['context']['plugins']['get']('AITabs'),_0x4da8db=this['context']['locale'],_0x308678=new AIHeaderView(_0x4da8db,{'label':Mi(_0x4da8db,'AI_REVIEW_MODE'),'icon':_0x268514,'class':'ck-ai-header_review','showResizeButton':_0x4f4cd7['showResizeButton']});return _0x308678['delegate']('resizeTabs')['to'](_0x4f4cd7),_0x308678['bind']('isMaximized')['to'](_0x4f4cd7['view'],'isMaximized',_0x45460a=>_0x45460a),new AIReviewCoreView(this['context']['locale'],{'header':_0x308678,'list':new AIReviewCoreReviewCheckListView(_0x4da8db),'results':new AIReviewCoreUICheckResultsView(_0x4da8db,{'generalErrorText':Mi(_0x4da8db,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x4da8db,{'headerText':Mi(_0x4da8db,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x4da8db,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x4da8db,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x18d12b=this['context']['plugins']['get']('AITabs');_0x18d12b['view']['on']('activateTab',(_0x1eb11e,{newTab:_0xd45226,oldTab:_0x337ede})=>{'reviewMode'===_0xd45226?this['fire']('getReviewCheckList'):'reviewMode'===_0x337ede&&this['fire']('leaveReview');}),_0x18d12b['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x268514,'order':0x0,'content':this['_mainView']});}}const tr='review-',er=['softBreak'],ir=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x2e5d09{static get['requires'](){return[_0x1289fc,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x17d4f0){super(_0x17d4f0),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x4d8982=_0x320c00=>this['_scheduleAttachReviewEditingToEditor'](_0x320c00);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x435807)return void _0x4d8982(this['context']);const _0x5b98e0=this['context'];for(const _0x26e4a4 of _0x5b98e0['editors'])_0x4d8982(_0x26e4a4);this['listenTo'](_0x5b98e0['editors'],'add',(_0x1bfab3,_0xac6ee8)=>{_0x4d8982(_0xac6ee8);}),this['listenTo'](_0x5b98e0['editors'],'remove',(_0x8019ca,_0x4615c2)=>{for(const [_0x3943c0,_0x5e5869]of this['_markers'])_0x5e5869['editor']===_0x4615c2&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3943c0,'changeId':_0x5e5869['groupId']}),this['_markers']['delete'](_0x3943c0));});}['_scheduleAttachReviewEditingToEditor'](_0x488b5c){const _0x29a5ec=()=>{'destroyed'!==_0x488b5c['state']&&_0x488b5c['conversion']&&this['_attachReviewEditingToEditor'](_0x488b5c);};if('ready'===_0x488b5c['state'])return void _0x29a5ec();const _0xd6d0b1=()=>{this['stopListening'](_0x488b5c,'ready',_0xd6d0b1),_0x29a5ec();};this['listenTo'](_0x488b5c,'ready',_0xd6d0b1);}['_attachReviewEditingToEditor'](_0x241582){this['_reviewEditingAttachedEditors']['has'](_0x241582)||(_0x241582['conversion']['for']('editingDowncast')['markerToElement']({'model':tr+'insert','view':(_0x41a426,{writer:_0x4a2066})=>{const _0x11a037=this['_markers']['get'](_0x41a426['markerName']),_0x6a4695={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x11a037?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x41a426['markerName']};return _0x4a2066['createUIElement']('span',_0x6a4695,function(_0x4fc661){const _0x3943d9=this['toDomElement'](_0x4fc661);return _0x3943d9['innerHTML']=_0x11a037?.['content']?.['asString']||'',_0x3943d9;});}}),_0x241582['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-only','view':_0x30bc34=>{const _0x24c42d=this['_markers']['get'](_0x30bc34['markerName']),_0x2b2c19=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x24c42d?.['id']||'')&&_0x2b2c19['push']('ck-ai_review__change_active'),{'classes':_0x2b2c19,'attributes':{'data-marker-id':_0x30bc34['markerName']}};}}),_0x241582['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-context','view':_0x384841=>{const _0x1900e2=this['_markers']['get'](_0x384841['markerName']),_0xe795e3=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x1900e2?.['id']||'')&&_0xe795e3['push']('ck-ai_review__change_active'),{'classes':_0xe795e3,'attributes':{'data-marker-id':_0x384841['markerName']}};}}),_0x241582['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-text','view':_0xaa2735=>{const _0x59ad90=this['_markers']['get'](_0xaa2735['markerName']),_0x132b0c=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x59ad90?.['id']||'')&&_0x132b0c['push']('ck-ai_review__change_active'),{'classes':_0x132b0c,'attributes':{'data-marker-id':_0xaa2735['markerName']}};}}),_0x241582['conversion']['for']('dataDowncast')['markerToElement']({'model':tr+'suggestion-context','view':(_0x1f1d79,{writer:_0x5de232})=>_0x5de232['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x1f1d79['isOpening']?'start':'end')})}),_0x241582['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x9b10fa,'view':_0x412f54}),this['_updateMouseMarkerInteractionListeners'](_0x241582),this['listenTo'](_0x241582,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x241582),{'priority':'lowest'}),this['listenTo'](_0x241582,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x241582),{'priority':'lowest'}),_0x241582['model']['document']['registerPostFixer'](_0x2f8fd5=>this['_validateMarkers'](_0x241582,_0x2f8fd5)),_0x241582['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x241582)),this['_reviewEditingAttachedEditors']['add'](_0x241582));}['_updateMouseMarkerInteractionListeners'](_0x404fe0){let _0x45508a=this['_boundEditables']['get'](_0x404fe0);_0x45508a||(_0x45508a=new Map(),this['_boundEditables']['set'](_0x404fe0,_0x45508a));const _0x4fe888=new Set(_0x404fe0['ui']['getEditableElementsNames']());for(const _0x376e14 of _0x4fe888){if(_0x45508a['has'](_0x376e14))continue;const _0x15e610=_0x404fe0['ui']['getEditableElement'](_0x376e14);_0x45508a['set'](_0x376e14,_0x15e610),this['_attachMouseMarkerInteractionListeners'](_0x15e610);}for(const [_0x4e385b,_0x51ecac]of _0x45508a)_0x4fe888['has'](_0x4e385b)||(_0x45508a['delete'](_0x4e385b),this['_domEmitter']['stopListening'](_0x51ecac));}['_attachMouseMarkerInteractionListeners'](_0x5a2719){this['_domEmitter']['listenTo'](_0x5a2719,'mouseup',(_0x2cdc1c,_0x32414a)=>{const _0x3e58af=_0x32414a['target'],_0x43389f=this['_findMarkerElement'](_0x3e58af);if(!_0x43389f)return;const _0x33913e=_0x43389f['getAttribute']('data-marker-id'),_0x1329e8=_0x33913e['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x33913e,'changeId':_0x1329e8,'markerElement':()=>this['_findMarkerElementById'](_0x33913e),'domEvent':_0x32414a});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x5a2719,'mouseover',(_0x5e5543,_0x460c29)=>{const _0x1ecc02=_0x460c29['target'],_0x18c149=_0x460c29['relatedTarget'];let _0x2661ab=this['_findMarkerElement'](_0x1ecc02);if(!_0x2661ab&&_0x18c149&&(_0x2661ab=this['_findMarkerElement'](_0x18c149)),!_0x2661ab)return;const _0x2b3cbf=_0x2661ab['getAttribute']('data-marker-id'),_0x5418d2=_0x2b3cbf['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x5418d2,'markerElement':()=>this['_findMarkerElementById'](_0x2b3cbf),'domEvent':_0x460c29});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x5b0594((_0x5d0459,_0x214204)=>{const _0x4a5bd8=_0x214204['target'];if(this['_findMarkerElement'](_0x4a5bd8))return;_0x4a5bd8['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x596cca=this['context']['plugins']['get']('AIEditing'),_0xf903f6=ms(this['context']);if(!_0xf903f6['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x3dd7b7=new Set(),_0x4cd791=[],_0xc1bc47=new Map();for(const _0x5f2544 of _0xf903f6)for(const _0x2c9ac9 of _0x5f2544['model']['document']['getRoots']()){if('$graveyard'===_0x2c9ac9['rootName'])continue;const _0x38c632=this['_buildDocumentDataSliceForRoot'](_0x5f2544,_0x2c9ac9,_0x596cca,_0x3dd7b7);_0x4cd791['push'](_0x38c632['content']);for(const [_0x3ce929,_0x3d42f9]of _0x38c632['elements'])_0xc1bc47['set'](_0x3ce929,_0x3d42f9);}return{'elements':_0xc1bc47,'content':_0x4cd791['join']('')};}['_buildDocumentDataSliceForRoot'](_0x190cc7,_0x10e726,_0x281bfc,_0x5750b8){const _0x10834c=_0x190cc7['model'],_0x19bbe5=new _0x38ddee();for(const _0x1e266e of _0x10e726['getChildren']())_0x19bbe5['_appendChild'](_0x1e266e['_clone'](!0x0));for(const _0x1f5fd5 of _0x10834c['markers']){const _0x4181e1=_0x1f5fd5['getRange']();_0x4181e1&&_0x4181e1['root']['rootName']===_0x10e726['rootName']&&_0x19bbe5['markers']['set'](_0x1f5fd5['name'],this['_changeRangeOwnerDocument'](_0x4181e1['clone'](),_0x19bbe5));}const _0x4b75b6=new Map(),_0x290401=_0x10834c['document']['version'],_0x3e3e88=new _0x5c0e47({'ignoreElementEnd':!0x0,'startPosition':_0x10834c['createPositionAt'](_0x19bbe5,0x0)});for(const {item:_0x2da648}of _0x3e3e88){if(_0x2da648['is']('element')&&_0x2da648['name']&&ir['includes'](_0x2da648['name'])){const _0x317f20=this['_upsertDataId'](_0x2da648,()=>_0x281bfc['_nextDataId'](_0x5750b8));_0x5750b8['add'](_0x317f20);}if(!_0x2da648['is']('$textProxy'))continue;const _0x3b733d=_0x2da648['parent'];if(!_0x3b733d||!_0x3b733d['is']('element'))continue;const _0x49fe76=this['_upsertDataId'](_0x3b733d,()=>_0x281bfc['_nextDataId'](_0x5750b8));_0x5750b8['add'](_0x49fe76);for(const _0xf1565d of _0x3b733d['getChildren']())_0xf1565d['is']('element')&&(_0xf1565d['name']&&er['includes'](_0xf1565d['name'])||_0x5750b8['add'](this['_upsertDataId'](_0xf1565d,()=>_0x281bfc['_nextDataId'](_0x5750b8))));let _0x316e8a=_0x3b733d;for(;_0x316e8a['parent']&&!_0x316e8a['parent']['is']('documentFragment');)_0x316e8a=_0x316e8a['parent'],_0x316e8a['hasAttribute'](_0x9b10fa)&&_0x316e8a['_removeAttribute'](_0x9b10fa);_0x4b75b6['set'](_0x49fe76,{'editor':_0x190cc7,'rootName':_0x10e726['rootName'],'path':_0x3b733d['getPath'](),'documentVersion':_0x290401,'getContent':this['_createGetContentUsingDataIdFn'](_0x316e8a['_clone'](!0x0),_0x49fe76,_0x190cc7['data'])}),_0x3e3e88['jumpTo'](_0x10834c['createPositionAfter'](_0x3b733d));}return{'content':_0x190cc7['data']['processor']['toData'](_0x190cc7['data']['toView'](_0x19bbe5)),'elements':_0x4b75b6};}['diffContent'](_0xf5fae7,_0x1a9400,_0x3c8e8a,_0x14ca82=!0x1){const {contentInitial:_0x3243ba,contentNew:_0x1c882d}=this['_neutralizeChangesOnUnsupportedElements'](_0x1a9400,_0x3c8e8a),_0x268c8d=[],_0x4d7e10=_0xf5fae7['data']['parse'](_0x1c882d,'$documentFragment'),_0x2fbd49=_0xf5fae7['data']['parse'](_0x3243ba,'$documentFragment'),_0x4673b5=_0xf5fae7['model']['createPositionAt'](_0x2fbd49,0x0);if(this['_haveSingleTopLevelElement'](_0x4d7e10)){if(!this['_hasSameTopLevelElement'](_0x2fbd49,_0x4d7e10))return _0x268c8d;}else{const _0x4e1c4b=_0xf5fae7['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x2fbd49,_0x4e1c4b)||!this['_haveOnlyInlineContent'](_0x4d7e10,_0x4e1c4b))return _0x268c8d;}const _0x4817d6=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x3243ba,_0x1c882d,{'targetEditor':_0xf5fae7,'anchor':_0x4673b5,'markDeletions':!0x0})['getOperations']()['filter'](_0x498237=>'insert'===_0x498237['type']||'marker'===_0x498237['type']&&_0x498237['name']['startsWith']('$markedRemove')),_0x4e6ba5=this['_groupAdjacentOperations'](_0x4817d6),_0x2b8eeb=[];if(_0x14ca82){if(_0x4e6ba5['length']){const _0x3a621e=_0x4e6ba5[0x0]['operations'][0x0],_0x169253='insert'===_0x3a621e['type']?_0x3a621e['position']:_0x3a621e['newRange']['start'],_0x553a09=this['_getPositionLimitingRange'](_0x169253,_0xf5fae7,'inside'),_0x272f45=_0x553a09?_0x4d7e10['getChild'](0x0)['getChildren']():_0x4d7e10['getChildren'](),_0x5b428e=_0x553a09||_0xf5fae7['model']['createRangeIn'](_0x2fbd49),_0x1351eb=[new _0x394603('$markedRemove:synthetic'+at(),null,_0x5b428e,_0xf5fae7['model']['document']['model']['markers'],!0x0,_0xf5fae7['model']['document']['version']+0x1),new _0x51ba4d(_0x5b428e['end'],_0x272f45,_0xf5fae7['model']['document']['version']+0x2)];_0x2b8eeb['push']({'operations':_0x1351eb,'operationsIsolated':_0x1351eb,'groupOffset':0x0});}}else _0x2b8eeb['push'](..._0x4e6ba5);let _0x4b1f36=0x0;return _0xf5fae7['model']['change'](_0x3bed1c=>{for(let _0x212343=0x0;_0x212343<_0x2b8eeb['length'];_0x212343++){const _0x23a94e=_0x2b8eeb[_0x212343],_0x2ba69c=_0x3bed1c['createDocumentFragment']();for(const _0x4cdd48 of _0x2fbd49['getChildren']())_0x3bed1c['append'](_0x4cdd48['_clone'](!0x0),_0x2ba69c);for(const _0x3765ca of _0x23a94e['operationsIsolated'])if('insert'===_0x3765ca['type']){const _0x5c2465=_0x3765ca;_0x5c2465['baseVersion']=null,_0x5c2465['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x5c2465,_0x2ba69c),_0x3bed1c['batch']['addOperation'](_0x3765ca),_0xf5fae7['model']['applyOperation'](_0x3765ca);const _0x3d2584='suggestion:insertion:id:authorId:'+_0x4b1f36++,_0x5e50f1=_0xf5fae7['model']['createRange'](_0x5c2465['position'],_0x5c2465['position']['getShiftedBy'](_0x5c2465['howMany']));_0x2ba69c['markers']['set'](_0x3d2584,_0x5e50f1);}else{if('marker'===_0x3765ca['type']&&_0x3765ca['name']['startsWith']('$markedRemove')){const _0x2efadc=_0x3765ca,_0x405034='suggestion:deletion:id:authorId:'+_0x4b1f36++;this['_changeOperationOwnerDocument'](_0x2efadc,_0x2ba69c),_0x2ba69c['markers']['set'](_0x405034,_0x2efadc['newRange']);}}if(_0x14ca82)_0x268c8d['push']({..._0x23a94e,'context':this['_createGetContentFn'](_0x2fbd49,_0xf5fae7['data']),'content':this['_createGetContentFn'](_0x2fbd49,_0xf5fae7['data'])});else{const _0x554351=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x23a94e['operationsIsolated'][0x0]),_0x2ba69c),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x23a94e['operationsIsolated'][_0x23a94e['operationsIsolated']['length']-0x1]),_0x2ba69c),_0xf5fae7);_0x2ba69c['markers']['set'](tr+'suggestion-context',new _0x805f9a(_0x554351['start'],_0x554351['end'])),_0x268c8d['push']({..._0x23a94e,'context':this['_createGetContextFn'](_0x2ba69c,_0xf5fae7['data'],{'ellipsisBefore':_0x554351['hasContentBefore'],'ellipsisAfter':_0x554351['hasContentAfter']}),'content':this['_createGetContentFn'](_0x2ba69c,_0xf5fae7['data'])});}}}),_0x268c8d;}['markChangePositionInEditorContent'](_0x181737,_0x2185e4){if(!_0x181737['length'])return;const _0x9c7901=_0x181737[0x0]['parent']['id'],_0x16a83c=_0x2185e4['elements']['get'](_0x9c7901);if(!_0x16a83c)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x9c7901);const _0x260c7f=_0x16a83c['path'],_0x40f54a=_0x16a83c['editor'],_0x3ca298=_0x40f54a['model']['document']['getRoot'](_0x16a83c['rootName']);if(!_0x3ca298)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x16a83c['rootName']);const _0x493325=_0x40f54a['model']['document']['history']['getOperations'](_0x16a83c['documentVersion']),_0x5b899b=[];for(const _0xcd8698 of _0x181737){const _0x57cc3e=_0xcd8698['operationsIsolated']['map'](_0x52d5ed=>this['_translateOperationToEditorContent'](_0x52d5ed,_0x260c7f,_0x3ca298));if(!_0x57cc3e||!_0x57cc3e['length'])continue;const _0x52e04c=_0x57cc3e['every'](_0x1406d0=>'marker'===_0x1406d0['type']&&_0x1406d0['name']['startsWith']('$markedRemove')),_0x5ae788={'document':_0x40f54a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x3d52f4=_0x5d10bd(_0x57cc3e,_0x493325,_0x5ae788)['operationsA'];for(const _0xade2e2 of _0x3d52f4)if('insert'===_0xade2e2['type']){const _0x234c94=_0xade2e2,_0x468d45=_0x234c94['nodes'];_0x40f54a['model']['change'](_0x36ff6a=>{const _0x268b9a=_0x36ff6a['createDocumentFragment']();for(const _0x40241f of _0x468d45)_0x36ff6a['append'](_0x40241f['_clone'](!0x0),_0x268b9a);_0x5b899b['push']({'start':_0x234c94['position'],'end':_0x234c94['position'],'type':'insert','groupId':_0xcd8698['id'],'content':{'asString':this['_createGetContentFn'](_0x268b9a,_0x40f54a['data'])(),'asFragment':_0x268b9a}});});}else{if('marker'===_0xade2e2['type']&&_0xade2e2['name']['startsWith']('$markedRemove')){const _0x1e90e8=_0xade2e2;let _0x47084d='remove-text';if(_0x52e04c){const _0x3a7adc=this['_findAdjacentContextDistance'](_0x1e90e8['newRange']['start'],'backward',_0x40f54a['model']['schema']),_0x517c7c=this['_findAdjacentContextDistance'](_0x1e90e8['newRange']['end'],'forward',_0x40f54a['model']['schema']);if(_0x3a7adc||_0x517c7c){const _0x281128=_0x1e90e8['newRange']['start']['getShiftedBy'](-_0x3a7adc),_0x1b1a31=_0x1e90e8['newRange']['end']['getShiftedBy'](_0x517c7c);_0x5b899b['push']({'start':_0x281128,'end':_0x1b1a31,'groupId':_0xcd8698['id'],'type':'remove-context'});}else _0x47084d='remove-only';}_0x5b899b['push']({'start':_0x1e90e8['newRange']['start'],'end':_0x1e90e8['newRange']['end'],'groupId':_0xcd8698['id'],'type':_0x47084d});}}}this['_insertMarkers'](_0x5b899b,_0x40f54a);}['clearAllMarkers'](){const _0x558658=new Map();for(const _0xb72a29 of this['_markers']['keys']()){const _0x541647=this['_markers']['get'](_0xb72a29);_0x541647?.['editor']&&(_0x558658['has'](_0x541647['editor'])||_0x558658['set'](_0x541647['editor'],[]),_0x558658['get'](_0x541647['editor'])['push'](_0xb72a29));}for(const [_0x3dac8b,_0x1c99bc]of _0x558658)_0x3dac8b['model']['change'](_0x5ab875=>{for(const _0x39b0ee of _0x1c99bc)_0x3dac8b['model']['markers']['get'](_0x39b0ee)&&_0x5ab875['removeMarker'](_0x39b0ee);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x485d7d of ms(this['context']))_0x485d7d['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x335cab of ms(this['context']))_0x335cab['disableReadOnlyMode']('ai-review');}['applyChange'](_0x4f17c2){const _0xf23497=_0x4f17c2['map'](_0x43f181=>this['_getMarkersDataForGroup'](_0x43f181))['flat'](),_0x1fd2ed=new Map();for(const _0x35b51d of _0xf23497)_0x1fd2ed['has'](_0x35b51d['editor'])||_0x1fd2ed['set'](_0x35b51d['editor'],[]),_0x1fd2ed['get'](_0x35b51d['editor'])['push'](_0x35b51d);for(const [_0xbb55b2,_0x4bfa58]of _0x1fd2ed){const _0xad86a4=_0xbb55b2['model'];_0xad86a4['change'](_0x1b0056=>{for(const _0x5d71de of _0x4bfa58){const _0x11347a=_0xbb55b2['model']['markers']['get'](_0x5d71de['id']);if(_0x11347a){if('insert'===_0x5d71de['type']){if(!_0x5d71de['content'])continue;_0xad86a4['insertContent'](_0x5d71de['content']['asFragment']||null,_0x11347a['getRange']()['start']);}else'remove-text'!==_0x5d71de['type']&&'remove-only'!==_0x5d71de['type']||_0xad86a4['deleteContent'](_0xad86a4['createSelection'](_0x11347a['getRange']()));_0x1b0056['removeMarker'](_0x5d71de['id']),this['_markers']['delete'](_0x5d71de['id']);}}});}}['rejectChange'](_0x3c1edd){const _0x32b3fa=this['_getMarkersDataForGroup'](_0x3c1edd),_0x3e9060=new Map();for(const _0x5599ba of _0x32b3fa)_0x3e9060['has'](_0x5599ba['editor'])||_0x3e9060['set'](_0x5599ba['editor'],[]),_0x3e9060['get'](_0x5599ba['editor'])['push'](_0x5599ba);for(const [_0x5cf178,_0x44feb3]of _0x3e9060)_0x5cf178['model']['change'](_0x326dc2=>{for(const _0x566f99 of _0x44feb3)_0x326dc2['removeMarker'](_0x566f99['id']),this['_markers']['delete'](_0x566f99['id']);});}['getEditor'](){return ps(this['context']);}['getEditors'](){return ms(this['context']);}['getEditorForChange'](_0x131608){const _0x431e67=this['_getMarkersDataForGroup'](_0x131608);return _0x431e67[0x0]?.['editor'];}['getMarkerElementForChange'](_0x15a405){const _0x455926=Array['from'](this['_markers']['values']())['filter'](_0x2c5608=>_0x2c5608['groupId']===_0x15a405);if(!_0x455926['length'])return null;const _0x28598b=0x1===_0x455926['length']?_0x455926[0x0]:this['_sortMarkers'](_0x455926)[0x0],_0x456bab=_0x28598b['editor']['model']['markers']['get'](_0x28598b['id']);if(!_0x456bab)return null;return{'modelRange':_0x456bab['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x28598b['id'])};}['getContentElementForChange'](_0x5b19f3){const _0x2be4d2=Array['from'](this['_markers']['values']())['filter'](_0x256541=>_0x256541['groupId']===_0x5b19f3);if(!_0x2be4d2['length'])return null;const _0x287363=0x1===_0x2be4d2['length']?_0x2be4d2[0x0]:this['_sortMarkers'](_0x2be4d2)[0x0],_0x2f50c3=_0x287363['editor'],_0x27e9aa=_0x2f50c3['model']['markers']['get'](_0x287363['id']);if(!_0x27e9aa)return null;const _0x1c939c=_0x27e9aa['getRange'](),_0x194340=_0x2f50c3['editing']['view']['getDomRoot'](_0x1c939c['root']['rootName'])||_0x2f50c3['editing']['view']['getDomRoot']();if(!_0x194340||!_0x1c939c)return null;let _0x1d3ea5=_0x1c939c['start']['parent'];for(;_0x1d3ea5['parent']&&!_0x1d3ea5['parent']['is']('rootElement');)_0x1d3ea5=_0x1d3ea5['parent'];if(!_0x1d3ea5||!_0x1d3ea5['name'])return null;const _0x3ce2eb=_0x194340['querySelector']('[data-marker-id=\x22'+_0x287363['id']+'\x22]');if(!_0x3ce2eb)return null;let _0x663ba6=null;_0x2f50c3['model']['change'](_0x472852=>{_0x663ba6=_0x472852['createDocumentFragment'](),_0x472852['append'](_0x1d3ea5['_clone'](!0x0),_0x663ba6);});const _0x95d3c2=_0x2f50c3['data']['toView'](_0x663ba6)['getChild'](0x0);return _0x3ce2eb['closest'](_0x95d3c2['name']);}['reactivateMarkers'](_0x3b4440){const _0x20fa88=this['_getMarkersDataForGroup'](_0x3b4440);if(!_0x20fa88['length'])return;const _0x2293d9=Array['from'](this['_activeMarkers'])['sort'](),_0x50c23a=Array['from'](new Set(_0x20fa88['map'](_0x13439e=>_0x13439e['id'])))['sort']();_0x2293d9['join']('|')!==_0x50c23a['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x3b4440));}['setMarkersInElementAsActive'](_0xde92a7){const _0x143dae=this['_getMarkersDataForGroup'](_0xde92a7);if(!_0x143dae['length'])return;const _0xedd1bd=_0x143dae[0x0]['editor'],_0x4e8033=new Set(_0x143dae['map'](_0x253acc=>_0x253acc['id'])),_0x4433e4=Array['from'](_0x4e8033['values']())['map'](_0x1a8e13=>_0xedd1bd['model']['markers']['get'](_0x1a8e13))['filter'](_0x1fbc58=>!!_0x1fbc58);_0x4e8033['forEach'](_0x31ae3b=>{this['_activeMarkers']['add'](_0x31ae3b);}),_0xedd1bd['model']['change'](()=>{_0x4433e4['forEach'](_0x2fae6c=>{_0xedd1bd['editing']['reconvertMarker'](_0x2fae6c);});});}['setAllMarkersAsInactive'](){const _0x2c6e8c=Array['from'](this['_activeMarkers']);if(!_0x2c6e8c['length'])return;this['_activeMarkers']['clear']();const _0x17c6b2=new Map();for(const _0x1cb601 of _0x2c6e8c){const _0x225433=this['_markers']['get'](_0x1cb601);if(!_0x225433)continue;const _0x15ff2f=_0x225433['editor'],_0x2de422=_0x15ff2f['model']['markers']['get'](_0x1cb601);_0x2de422&&(_0x17c6b2['has'](_0x15ff2f)||_0x17c6b2['set'](_0x15ff2f,[]),_0x17c6b2['get'](_0x15ff2f)['push'](_0x2de422));}for(const [_0x2b61be,_0x527ae6]of _0x17c6b2)_0x2b61be['model']['change'](()=>{_0x527ae6['forEach'](_0x996ee4=>{_0x2b61be['editing']['reconvertMarker'](_0x996ee4);});});}['_getPositionLimitingRange'](_0x5b2116,_0x14cde8,_0x47572c='outside'){if(!_0x5b2116)return null;let _0x1978e4=_0x5b2116['parent'];for(;_0x1978e4&&_0x1978e4['parent']&&!_0x1978e4['parent']['is']('rootElement')&&!_0x14cde8['model']['schema']['isLimit'](_0x1978e4)&&!_0x14cde8['model']['schema']['isBlock'](_0x1978e4);)_0x1978e4=_0x1978e4['parent'];if(!_0x1978e4||!_0x1978e4['name']||_0x1978e4['is']('rootElement'))return null;let _0x370915=null;return _0x14cde8['model']['change'](_0x5c01d1=>{_0x370915='inside'===_0x47572c?_0x5c01d1['createRangeIn'](_0x1978e4):_0x5c01d1['createRangeOn'](_0x1978e4);}),_0x370915;}['_validateMarkers'](_0x3ffebc,_0x50dcc7){const _0x1b5898=Array['from'](this['_markers']['keys']()),_0x451221=new Map();for(const _0x1c09c0 of _0x1b5898){const _0x6727de=_0x3ffebc['model']['markers']['get'](_0x1c09c0);if(!_0x6727de)continue;const _0x430bc0=_0x6727de['getStart']()['root']['rootName']+':'+_0x6727de['getStart']()['path'][0x0];_0x451221['has'](_0x430bc0)||_0x451221['set'](_0x430bc0,[]),_0x451221['get'](_0x430bc0)['push'](_0x6727de);}const _0x3e9061=new Set();for(const _0x47faca of _0x3ffebc['model']['document']['differ']['getChanges']()){let _0x1a0b7d='',_0x5ae6fd=null;if('insert'===_0x47faca['type'])_0x5ae6fd=new _0x805f9a(_0x47faca['position'],_0x47faca['position']['getShiftedBy'](_0x47faca['length'])),_0x1a0b7d=_0x47faca['position']['root']['rootName']+':'+_0x47faca['position']['path'][0x0];else{if('remove'!==_0x47faca['type'])continue;_0x5ae6fd=new _0x805f9a(_0x47faca['position']),_0x1a0b7d=_0x47faca['position']['root']['rootName']+':'+_0x47faca['position']['path'][0x0];}const _0x415cb9=_0x451221['get'](_0x1a0b7d)||[];if(_0x415cb9['length']){for(const _0x1295af of _0x415cb9)if(_0x5ae6fd['root']['rootName']===_0x1295af['getRange']()['root']['rootName']&&('insert'!==_0x47faca['type']||!_0x5ae6fd['containsRange'](_0x1295af['getRange']()))&&(_0x5ae6fd['isIntersecting'](_0x1295af['getRange']())||_0x5ae6fd['start']['isTouching'](_0x1295af['getRange']()['end'])||_0x5ae6fd['end']['isTouching'](_0x1295af['getRange']()['start']))){const _0xac6d91=this['_parseMarkerName'](_0x1295af['name']);Array['from'](this['_markers']['values']())['filter'](_0x5c5f6d=>_0x5c5f6d['groupId']===_0xac6d91['groupId'])['forEach'](_0x46ddbf=>_0x3e9061['add'](_0x46ddbf['id']));}}}if(_0x3e9061['size']){for(const _0x1a248d of _0x3e9061)_0x50dcc7['removeMarker'](_0x1a248d);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x5c3989){for(const {name:_0x4665e2,data:_0xcc69c1}of _0x5c3989['model']['document']['differ']['getChangedMarkers']()){if(!_0x4665e2['startsWith'](tr))continue;const _0x25e3ca=_0xcc69c1['oldRange'],_0x3c84ab=_0xcc69c1['newRange'],_0x5d024d=_0x25e3ca&&'$graveyard'===_0x25e3ca['root']['rootName'],_0x368035=_0x3c84ab&&'$graveyard'===_0x3c84ab['root']['rootName'];if(_0x5d024d&&_0x368035)continue;const _0x3a849d=this['_parseMarkerName'](_0x4665e2);this['_markers']['get'](_0x4665e2)&&(_0x368035||!_0x3c84ab?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x4665e2,'changeId':_0x3a849d['groupId']}):_0x5d024d&&_0x3c84ab&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x4665e2,'changeId':_0x3a849d['groupId']}));}}['_parseMarkerName'](_0x3c0b82){const _0x31dd51=_0x3c0b82['split'](':'),_0x282a25=(_0x31dd51[0x1]||'')['split']('_');return{'prefix':_0x31dd51[0x0],'groupId':_0x282a25[0x0],'suffix':_0x282a25[0x1]};}['_translateOperationToEditorContent'](_0x5083f5,_0x2ad96b,_0x58f6e4){if('insert'===_0x5083f5['type']){const _0x255e6e=_0x5083f5;return new _0x51ba4d(this['_changePosition'](_0x2ad96b['concat'](_0x255e6e['position']['offset']),_0x58f6e4),_0x255e6e['nodes'],_0x255e6e['baseVersion']);}if('marker'===_0x5083f5['type']&&_0x5083f5['name']['startsWith']('$markedRemove')){const _0x46ccfe=_0x5083f5;return new _0x394603(_0x46ccfe['name'],_0x46ccfe['oldRange'],this['_changeRange'](_0x46ccfe['newRange'],_0x2ad96b['concat'](_0x46ccfe['newRange']['start']['offset']),_0x2ad96b['concat'](_0x46ccfe['newRange']['end']['offset']),_0x58f6e4),_0x46ccfe['_markers'],_0x46ccfe['affectsData'],_0x46ccfe['baseVersion']);}return _0x5083f5;}['_groupAdjacentOperations'](_0x2ddb75){if(!_0x2ddb75['length'])return[];const _0x399443=[];let _0x2dae12=0x0,_0xa4120b=0x0,_0x2de564=[];for(let _0x3c90f0=0x0;_0x3c90f0<=_0x2ddb75['length'];_0x3c90f0++){const _0x401291=_0x2ddb75[_0x3c90f0],_0x4f14ec=_0x2ddb75[_0x3c90f0-0x1];!_0x401291||_0x4f14ec&&!this['_getOperationEnd'](_0x4f14ec)['isTouching'](this['_getOperationStart'](_0x401291))?(_0x399443['push']({'operations':_0x2de564,'operationsIsolated':_0x2de564['map'](_0x295012=>this['_shiftOperation'](_0x295012['clone'](),-_0xa4120b)),'groupOffset':_0x2dae12}),_0x2de564=_0x401291?[_0x401291]:[],_0xa4120b+=_0x2dae12,_0x2dae12=0x0):_0x2de564['push'](_0x401291),_0x401291&&'insert'===_0x401291['type']&&(_0x2dae12+=_0x401291['howMany']);}return _0x399443;}['_findAdjacentContextDistance'](_0x16f3a2,_0x5b75d2,_0x1dd797,_0x3f9aa3=0x1){const _0xbf6890=new _0x5c0e47({'startPosition':_0x16f3a2,'direction':_0x5b75d2});let _0x417a3d=0x0;for(let _0x144419=0x0;_0x144419<_0x3f9aa3;_0x144419++){let _0x5221e7=0x0,_0x2d85b8=!0x1,_0x49d8eb='forward'===_0x5b75d2?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x2deac9}of _0xbf6890)if(_0x2deac9['is']('$textProxy')){const _0x53ebcf=_0x49d8eb['exec'](_0x2deac9['data']);if(_0x53ebcf&&_0x53ebcf['length']){if(_0x5221e7+='forward'===_0x5b75d2?_0x53ebcf['index']+_0x53ebcf[0x0]['length']:_0x2deac9['data']['length']-_0x53ebcf['index'],_0x53ebcf[0x0]['length']!==_0x2deac9['data']['length'])break;_0x2d85b8=!0x0,_0x49d8eb='forward'===_0x5b75d2?/^\w+/:/\w+$/;}else{if(_0x2d85b8)break;_0x5221e7+=_0x2deac9['offsetSize'];}}else{if(_0x2deac9['is']('element')){_0x1dd797['isInline'](_0x2deac9)&&!_0x2d85b8&&(_0x5221e7+=0x1);break;}}_0x417a3d+=_0x5221e7,_0xbf6890['jumpTo'](_0x16f3a2['getShiftedBy']('forward'===_0x5b75d2?_0x417a3d:-_0x417a3d));}return _0x417a3d;}['_getChangeContext'](_0x523ae9,_0x14012d,_0x59625c){const _0x409c5b=_0x59625c['model']['schema'],_0x261569=this['_findAdjacentContextDistance'](_0x523ae9,'backward',_0x409c5b,0x6),_0x3dd353=this['_findAdjacentContextDistance'](_0x14012d,'forward',_0x409c5b,0x6),_0x324cda=_0x523ae9['getShiftedBy'](-_0x261569),_0x3be3f6=_0x14012d['getShiftedBy'](_0x3dd353);return{'start':_0x324cda,'end':_0x3be3f6,'hasContentBefore':!_0x324cda['isAtStart'],'hasContentAfter':!_0x3be3f6['isAtEnd']};}['_insertMarkers'](_0x303be0,_0x2f8a45){const _0x7e5129=this['context']['plugins']['get']('AIEditing'),_0x2af573=new Set();_0x2f8a45['model']['change'](_0x5d5640=>{for(const _0x3d474a of _0x303be0){const _0x354086=''+tr+_0x3d474a['type']+':'+_0x3d474a['groupId']+'_'+_0x7e5129['_nextDataId'](_0x2af573);this['_markers']['set'](_0x354086,{'id':_0x354086,'groupId':_0x3d474a['groupId'],'type':_0x3d474a['type'],'content':_0x3d474a['content'],'editor':_0x2f8a45}),_0x5d5640['addMarker'](_0x354086,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5d5640['createRange'](_0x3d474a['start'],_0x3d474a['end'])});}});}['_createGetContextFn'](_0x4f8064,_0xf4c991,_0x699e4){let _0x27bc6c='';return()=>{if(!_0x27bc6c){const _0x20e7f0=_0xf4c991['toView'](_0x4f8064,{'showSuggestionHighlights':!0x0});let _0x24e180=_0x20e7f0['getChild'](0x0);if(_0x24e180['is']('containerElement')||(_0x24e180=_0x20e7f0),!_0x24e180)return'';let _0xfc7f62=!0x1;const _0x193ff3=[];for(const _0x3bbf76 of _0x24e180['getChildren']())_0x3bbf76['is']('element','span')&&_0x3bbf76['hasClass']('ck-ai_review-marker_context-end')&&(_0xfc7f62=!0x1),_0xfc7f62&&_0x193ff3['push'](_0x3bbf76),_0x3bbf76['is']('element','span')&&_0x3bbf76['hasClass']('ck-ai_review-marker_context-start')&&(_0xfc7f62=!0x0);_0x24e180['_removeChildren'](0x0,_0x24e180['childCount']),_0x699e4?.['ellipsisBefore']&&_0x24e180['_appendChild']('…'),_0x24e180['_appendChild'](_0x193ff3),_0x699e4?.['ellipsisAfter']&&_0x24e180['_appendChild']('…');const _0x23d921=_0xf4c991['htmlProcessor']['domConverter']['viewToDom'](_0x20e7f0),_0xe13dd2=_0xf4c991['htmlProcessor']['htmlWriter']['getHtml'](_0x23d921);_0x27bc6c=this['_removeUnsupportedElements'](_0xe13dd2);}return _0x27bc6c;};}['_createGetContentFn'](_0x251e62,_0x3dd031){let _0xa3733a='';return()=>(_0xa3733a||(_0xa3733a=this['_removeUnsupportedElements'](_0x3dd031['stringify'](_0x251e62,{'showSuggestionHighlights':!0x0}))),_0xa3733a);}['_createGetContentUsingDataIdFn'](_0x23c153,_0x143984,_0x82e801){let _0x1c168f='';return()=>{if(!_0x1c168f){const _0x5f1ef9=_0x82e801['toView'](new _0x38ddee(_0x23c153)),_0x534fd2=_0x82e801['htmlProcessor']['domConverter']['viewToDom'](_0x5f1ef9)['querySelector']('[data-id=\x22'+_0x143984+'\x22]');_0x1c168f=_0x534fd2?.['outerHTML']||'';}return _0x1c168f;};}['_removeUnsupportedElements'](_0x43e9c0){if(!_0x43e9c0)return'';const _0x280403=Wi(_0x43e9c0,{'decodeEntities':!0x1}),_0x572b96=qi(_0x280403);if(!_0x572b96['length'])return _0x43e9c0;for(const _0x54ae1d of _0x572b96)_0x1aae33(_0x54ae1d);return Ki(_0x280403,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x1363e6,_0x3a109f){const _0xd7eaaf=Wi(_0x1363e6,{'decodeEntities':!0x1}),_0x12e201=Wi(_0x3a109f,{'decodeEntities':!0x1}),_0x50b6fa=qi(_0xd7eaaf),_0x4fa832=qi(_0x12e201);if(!_0x50b6fa['length']&&!_0x4fa832['length'])return{'contentInitial':_0x1363e6,'contentNew':_0x3a109f};const _0x157b0c=new Map();for(const _0xf3a2dd of _0x50b6fa)_0x157b0c['set'](Xi(_0xf3a2dd,'data-id'),_0xf3a2dd);for(const _0x37589d of _0x4fa832){const _0x423420=Xi(_0x37589d,'data-id'),_0x107ec5=_0x423420?_0x157b0c['get'](_0x423420):void 0x0;_0x107ec5?_0x7545e8(_0x37589d,_0x3777a6(_0x107ec5,!0x0)):_0x1aae33(_0x37589d);}return{'contentInitial':Ki(_0xd7eaaf,{'encodeEntities':!0x1}),'contentNew':Ki(_0x12e201,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x4b64e4,_0x1d9ffc=0x5){let _0x590ee7=_0x4b64e4,_0xba894=null;for(let _0x514bf0=0x0;_0x514bf0<_0x1d9ffc&&_0x590ee7;_0x514bf0++){if(!_0x590ee7['className']){_0x590ee7=_0x590ee7['parentElement'];continue;}if(!(''+_0x590ee7['className'])['includes']('ck-ai_review-marker_')){_0x590ee7=_0x590ee7['parentElement'];continue;}if(!_0x590ee7['getAttribute']('data-marker-id'))break;_0xba894=_0x590ee7;break;}return _0xba894;}['_findMarkerElementById'](_0x42b965){const _0x4ac02d=this['_markers']['get'](_0x42b965);if(!_0x4ac02d)return null;const _0x460547=_0x4ac02d['editor']['model']['markers']['get'](_0x42b965);return _0x460547?_0x11ef4d(_0x4ac02d['editor']['editing'],_0x460547):null;}['_getMarkersDataForGroup'](_0x44df63){return Array['from'](this['_markers']['values']())['filter'](_0x4d1be=>_0x4d1be['groupId']===_0x44df63);}['_getOperationStart'](_0x5cb4f5){return'insert'===_0x5cb4f5['type']?_0x5cb4f5['position']:_0x5cb4f5['newRange']['start'];}['_getOperationEnd'](_0x466c75,_0x4e7b24=!0x1){return'insert'===_0x466c75['type']?_0x4e7b24?_0x466c75['position']:_0x466c75['position']['getShiftedBy'](_0x466c75['howMany']):_0x466c75['newRange']['end'];}['_shiftOperation'](_0x28abc8,_0x42e43e){return'insert'===_0x28abc8['type']?_0x28abc8['position']=_0x28abc8['position']['getShiftedBy'](_0x42e43e):'marker'===_0x28abc8['type']&&_0x28abc8['newRange']&&(_0x28abc8['newRange']=new _0x805f9a(_0x28abc8['newRange']['start']['getShiftedBy'](_0x42e43e),_0x28abc8['newRange']['end']['getShiftedBy'](_0x42e43e))),_0x28abc8;}['_changeOperationOwnerDocument'](_0x3d4595,_0x3ca1e1){'insert'===_0x3d4595['type']?_0x3d4595['position']=this['_changePositionOwnerDocument'](_0x3d4595['position'],_0x3ca1e1):'marker'===_0x3d4595['type']&&_0x3d4595['newRange']&&(_0x3d4595['newRange']=this['_changeRangeOwnerDocument'](_0x3d4595['newRange'],_0x3ca1e1));}['_changePositionOwnerDocument'](_0x2c7ac7,_0x134f9e){return new _0x47e467(_0x134f9e,_0x2c7ac7['path']);}['_changeRangeOwnerDocument'](_0x2d390a,_0x4fba65){return new _0x805f9a(this['_changePositionOwnerDocument'](_0x2d390a['start'],_0x4fba65),this['_changePositionOwnerDocument'](_0x2d390a['end'],_0x4fba65));}['_changePosition'](_0x3b470a,_0x64692e){return new _0x47e467(_0x64692e,[..._0x3b470a]);}['_changeRange'](_0x2b57d9,_0x20ad75,_0x459fd8,_0x301c4b){return new _0x805f9a(this['_changePosition'](_0x20ad75,_0x301c4b),this['_changePosition'](_0x459fd8,_0x301c4b));}['_sortMarkers'](_0x42d511){const _0x4c80dc=_0x346177=>{switch(_0x346177){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x42d511['sort']((_0x24211f,_0x38d075)=>_0x4c80dc(_0x24211f['type'])-_0x4c80dc(_0x38d075['type']));}['_hasSameTopLevelElement'](_0x65c87d,_0x3337ea){const _0x51630f=_0x65c87d['getChild'](0x0),_0x34fd9c=_0x3337ea['getChild'](0x0);return!(!_0x51630f||!_0x34fd9c)&&((!_0x51630f['is']('element')||!_0x34fd9c['is']('element')||_0x51630f['name']===_0x34fd9c['name'])&&!(_0x51630f['is']('element')&&!_0x34fd9c['is']('element')||!_0x51630f['is']('element')&&_0x34fd9c['is']('element')));}['_haveSingleTopLevelElement'](_0x5c4a29){return 0x1===_0x5c4a29['childCount'];}['_haveOnlyInlineContent'](_0xc8ec5b,_0x218a5d){for(const _0x5f23a9 of _0xc8ec5b['getChildren']())if(_0x5f23a9['is']('element')&&!_0x218a5d['isInline'](_0x5f23a9))return!0x1;return!0x0;}['_upsertDataId'](_0x52b817,_0x3599be){let _0x3f4f1b=_0x52b817['getAttribute'](_0x9b10fa);return _0x3f4f1b||(_0x3f4f1b=_0x3599be(),_0x52b817['_setAttribute'](_0x9b10fa,_0x3f4f1b)),_0x3f4f1b;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x1cc1ef,contentNew:_0x5d950a,contentInitial:_0x27ffb5,documentVersion:_0x106891}){super(),this['id']=_0x1cc1ef,this['contentNew']=_0x5d950a,this['contentInitial']=_0x27ffb5,this['documentVersion']=_0x106891;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x4e17b2,_0x572b6d,_0x5f0ef6){super(),this['id']=_0x4e17b2,this['parent']=_0x5f0ef6,this['_data']=_0x572b6d,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x180a55,_0x4377f5,_0x2d62c9,_0x361418,_0x337330){super(),this['_sourceCheck']=_0x4377f5,this['_documentData']=_0x180a55,this['_aiConnector']=_0x2d62c9,this['_reviewParams']=_0x361418,this['_reviewArgs']=_0x337330,this['on']('change:status',(_0x46f77f,_0x509d9c,_0x4047c3)=>{'aborted'==_0x4047c3&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x4047c3,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x590690=>'pending'===_0x590690['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x4dfe02){this['_documentData']=_0x4dfe02;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x251f45=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x30068a of _0x251f45)'unmodified'!==_0x30068a['data']['operation']&&('error'!==_0x30068a['data']['operation']?'review-metadata'!==_0x30068a['event']?this['_addReviewCheckResult'](_0x30068a['data']['dataId'],_0x30068a['data']['textDelta']):this['callId']=_0x30068a['data']['callId']:this['status']='error-chunk');'error-chunk'!==this['status']&&(0x0===this['_results']['size']||0x0===this['_changes']['length']?this['status']='unmodified':this['status']='ready');}catch(_0x112878){this['_currentError']=_0x112878,_0x112878 instanceof Error&&_0x112878['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x2ddf16,_0x292e40){const _0x1f087e=this['_results']['get'](_0x2ddf16);if(!_0x1f087e)return;if(0x0===_0x292e40['length'])return;const _0x2c6739=[];_0x292e40['forEach']((_0x362e44,_0x2a6516)=>{const _0x2735b2=new AIReviewCheckResultChange(_0x1f087e['id']+'-'+_0x2a6516,_0x362e44,_0x1f087e);_0x2735b2['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x2735b2,'status':_0x2735b2['status']});}),_0x2735b2['on']('change:isActivated',()=>{_0x2735b2['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x2735b2}):this['fire']('reviewCheckResultDeactivated',{'change':_0x2735b2});}),this['_changes']['push'](_0x2735b2),_0x2c6739['push'](_0x2735b2);}),this['fire']('reviewCheckResultReady',{'changes':_0x2c6739,'result':_0x1f087e,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x465786){const _0x3a5810=this['_changes']['find'](_0xb4c864=>_0xb4c864['id']===_0x465786);return!(!_0x3a5810||'pending'!==_0x3a5810['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x5329fd=>!0x0===_0x5329fd['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x357b37=>'pending'===_0x357b37['status']);}['getChangeById'](_0x4eb853){return this['_changes']['find'](_0x4547f4=>_0x4547f4['id']===_0x4eb853);}['markAllChangesAsAccepted'](){for(const _0x108797 of this['_changes'])'pending'===_0x108797['status']&&(_0x108797['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x418d67){const _0x518aba=this['_changes']['find'](_0x1d9ff9=>_0x1d9ff9['id']===_0x418d67);_0x518aba&&'pending'===_0x518aba['status']&&(_0x518aba['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x17a898){const _0x9bad0d=this['_changes']['find'](_0x426348=>_0x426348['id']===_0x17a898);_0x9bad0d&&'pending'===_0x9bad0d['status']&&(_0x9bad0d['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x5741db){const _0x37b4fa=this['_changes']['find'](_0x5ccdd5=>_0x5ccdd5['id']===_0x5741db);_0x37b4fa&&'pending'===_0x37b4fa['status']&&(_0x37b4fa['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x1cf32b){const _0x4b3cd6=this['_changes']['find'](_0x4b271f=>_0x4b271f['id']===_0x1cf32b);_0x4b3cd6&&'outdated'===_0x4b3cd6['status']&&(_0x4b3cd6['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x3d52f0){this['_changes']['filter'](_0xfc5ba9=>_0xfc5ba9['isActivated']&&_0xfc5ba9['id']!==_0x3d52f0)['forEach'](_0x4dfad5=>{_0x4dfad5['isActivated']=!0x1;});const _0xb8631c=this['_changes']['find'](_0x4586d9=>_0x4586d9['id']===_0x3d52f0);_0xb8631c&&'pending'===_0xb8631c['status']&&(_0xb8631c['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x36b442=>_0x36b442['isActivated'])['forEach'](_0x29766c=>{_0x29766c['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x22acc0){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x35cc32;if(_0x22acc0){const _0x42abe2=this['_changes']['find'](_0x5481ff=>_0x5481ff['id']===_0x22acc0);if(_0x42abe2&&_0x42abe2['isRated'])return;_0x42abe2&&(_0x35cc32=_0x42abe2['parent']['id'],_0x42abe2['isRated']=!0x0);}const _0x46de5d={'positiveCount':this['_changes']['filter'](_0x1a2f75=>'accepted'===_0x1a2f75['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x46de5d,this['callId'],_0x35cc32);}['_addReviewCheckResult'](_0x4ec05d,_0x1ea900){const _0x497e3d=this['_documentData']['elements']['get'](_0x4ec05d);if(!_0x497e3d)return;const _0x206da2=_0x497e3d['getContent']();if(_0x206da2===_0x1ea900)return;const _0x3efb9b=new AIReviewCheckResult({'id':_0x4ec05d,'contentInitial':_0x206da2,'contentNew':_0x1ea900,'documentVersion':_0x497e3d['documentVersion']});this['_results']['set'](_0x3efb9b['id'],_0x3efb9b),this['fire']('reviewCheckResultAdded',{'result':_0x3efb9b,'source':this,'editor':_0x497e3d['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0xb0cad3=>'pending'===_0xb0cad3['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x52b1be=>'pending'===_0x52b1be['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5e9c51=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x6c3be3=0x0;_0x6c3be3<this['_reviewParams']['length'];_0x6c3be3++){if(!this['_reviewParams'][_0x6c3be3]||!this['_sourceCheck']['options'][_0x6c3be3])continue;const _0x3767e5=this['_sourceCheck']['options'][_0x6c3be3],_0x24c8eb=_0x3767e5['data']?.['find'](_0x43534b=>_0x43534b['id']===this['_reviewParams'][_0x6c3be3]);_0x24c8eb&&_0x5e9c51['push'](_0x24c8eb['label']);}return _0x5e9c51['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x4e0dfa,_0x526d39,_0x4915f3){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x526d39,_0x4e0dfa,_0x4915f3);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x2e5d09{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async['_initAvailableReviewChecks'](){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}['_initUIListeners'](){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x3b8285,_0x22cac3)=>this['runCheck'](_0x22cac3)),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>this['abort']()),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x5a6ae2=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x5a6ae2['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x5a6ae2['map'](_0x17dadf=>_0x17dadf['id']));const _0xeb13c3=this['_currentReviewCheckRun'];_0xeb13c3['markAllChangesAsAccepted'](),_0xeb13c3['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x1774fd,_0x3cc890)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x3cc890['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x3cc890['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x3cc890['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x3cc890['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x4e9cbe,_0x30cce1)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x30cce1['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x30cce1['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x30cce1['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x30cce1['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x1f5798,_0x1318ed)=>{this['_onActivateChange'](_0x1318ed);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x20b2cf,_0xed1ee8)=>{this['_onDeactivateChange'](_0xed1ee8);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x123ac0,_0x56db4d)=>{this['_onChangeMarkerClicked'](_0x123ac0,_0x56db4d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x2237f2,_0x30f81e)=>{this['_onChangeMarkerHovered'](_0x2237f2,_0x30f81e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x1c494e,_0x484cb3)=>{this['_onChangeMarkerRemoved'](_0x1c494e,_0x484cb3);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x3b9b30,_0x33bfc6)=>{this['_onChangeMarkerRestored'](_0x3b9b30,_0x33bfc6);});}async['runCheck'](_0x43588c){if(!this['_availableReviewChecks'])return;const _0x3e0297=this['_availableReviewChecks']['find'](_0x108540=>_0x108540['id']===_0x43588c['id']);if(_0x3e0297){this['_onReviewCheckRun'](_0x43588c),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x43588c,_0x3e0297),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x57cbc4,_0x348fca)=>{switch(_0x348fca['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x348fca);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x348fca['status']&&'error-chunk'!==_0x348fca['status']&&'error-general'!==_0x348fca['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0xe3af03,_0x1e5d86)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x361c4f=this['_diffContent'](_0x1e5d86['editor'],_0x1e5d86['result']['contentInitial'],_0x1e5d86['result']['contentNew']);_0x1e5d86['source']['addResultChanges'](_0x1e5d86['result']['id'],_0x361c4f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x17bdf3,_0x3f9642)=>{for(const _0x217c39 of _0x3f9642['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x217c39);this['_markChangePositionInEditorContent'](_0x3f9642['changes'],_0x3f9642['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0xa6100,_0x5c3a81)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x5c3a81['change']['id'],_0x5c3a81['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x3125e4,_0x49988d)=>{this['_onReviewCheckResultActivated'](_0x49988d);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x2c5a69){_0x2c5a69 instanceof Error&&_0x2c5a69['message']['includes']('ai-request-aborted')||(_0x2c5a69 instanceof ht?this['_logError'](_0x2c5a69):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x2c5a69)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x43588c['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x34f037,_0x4f38f){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4f38f,this['_aiConnector'],_0x34f037['params'],_0x34f037['args']);}['_onChangeMarkerRemoved'](_0x1518e5,_0x6b9406){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x6b9406['changeId']);}['_onChangeMarkerRestored'](_0x3096be,_0x13ce47){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x13ce47['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x52075e=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x52075e&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x575382 of this['_aiReviewCoreEditing']['getEditors']())_0x575382['editing']['view']['change'](_0x12c53e=>{for(const _0x102291 of _0x575382['editing']['view']['document']['getRoots']())_0x12c53e['removeClass']('ck-ai_review-diff',_0x102291),_0x12c53e['removeClass']('ck-ai_review-highlights',_0x102291),_0x12c53e['removeClass']('ck-ai-translate-mode-content',_0x102291);});}['_logError'](_0x52005e,_0x2772b4=!0x1){Ct(_0x52005e['message']),_0x2772b4||(_0x52005e['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x36bc6f){if('content'===this['_changeActivationSource']){const _0x483082=this['_aiReviewCoreUi']['getChangeElement'](_0x36bc6f);_0x483082&&Rt(_0x483082['closest']('.ck-ai_review__check-run-result')||_0x483082);}else{if('panel'===this['_changeActivationSource']){const _0x386ed3=this['_getChangeContentElement'](_0x36bc6f);if(!_0x386ed3)return;Tt({'target':_0x386ed3,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x9ba23d,_0x48bc72,_0x33d250,_0x8a7bf7,_0x575d11){super(_0x33d250,_0x8a7bf7,_0x575d11),this['_prompt']=_0x9ba23d,this['_model']=_0x48bc72;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x442eec,_0x208a84,_0xdcf696){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x208a84,_0x442eec,_0xdcf696);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x2031cb){this['id']=_0x2031cb['id'],this['commandId']=_0x2031cb['commandId'],this['title']=_0x2031cb['title'],this['description']=_0x2031cb['description'],this['isParameterized']=_0x2031cb['isParameterized'],this['useArgs']=_0x2031cb['useArgs'],this['options']=_0x2031cb['options'],this['args']=_0x2031cb['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x48e474,_0x29e6d3,_0x431500){super(_0x48e474),this['prompt']=_0x48e474['prompt'],this['model']=_0x48e474['model'],this['model']?this['_defaultModel']=_0x29e6d3['find'](_0x3056e0=>_0x3056e0['id']===this['model'])||null:this['_defaultModel']=_0x431500;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x451508){this['_prompt']=_0x451508;}set['model'](_0x4eacff){this['_model']=_0x4eacff;}}class AIReviewCoreCheckRegistry extends _0x2e5d09{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const sr=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x240f2d){this['_checks']=_0x240f2d['map'](_0x3aadd5=>new AIReviewCheck(_0x3aadd5));}get['checks'](){return this['_checks'];}['getCheckById'](_0x516cc1){return this['checks']['find'](_0x2a73c8=>_0x2a73c8['id']===_0x516cc1);}['removeCheckById'](_0x141f03){this['_checks']=this['_checks']['filter'](_0x4f5274=>_0x4f5274['id']!==_0x141f03);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x12d3ec,_0x79004e,_0x4f8ec2){super(_0x12d3ec),this['_models']=_0x79004e,this['_defaultModel']=_0x4f8ec2;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x302efa,_0x1d6d35,_0x2a9a25){super(),this['_allModels']=_0x302efa,this['_recommendedModels']=_0x1d6d35,this['_defaultModel']=_0x2a9a25;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x10330d){this['_checks']=_0x10330d['map'](_0x2c3ef8=>!0x0===_0x2c3ef8['isExtra']?new AIReviewCheckExtra(_0x2c3ef8,this['_allModels'],this['_defaultModel']):'custom'===_0x2c3ef8['id']?new AIReviewCheckCustom(_0x2c3ef8,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x2c3ef8));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x542c92){super(_0x542c92),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x4c4dad=>({'id':_0x4c4dad['id'],'commandId':_0x4c4dad['id'],'title':_0x4c4dad['label'],'description':_0x4c4dad['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x4c4dad['prompt'],'model':_0x4c4dad['model']}));}async['_loadChecksList'](){const _0x3af27b=[...sr,...this['getExtraChecks']()]['map'](_0x4c15a6=>_0x4c15a6['isExtra']?_0x4c15a6:this['_translateReviewCheck'](_0x4c15a6)),_0x2040a1=await this['_getModels'](),_0x33f2c2=new AIReviewModeCheckList(_0x2040a1['all'],_0x2040a1['recommended'],_0x2040a1['default']);return _0x33f2c2['setupChecks'](_0x3af27b),_0x33f2c2;}async['_getModels'](){const _0x6cce8a=this['context']['plugins']['get']('AIConnector');try{const _0x4aff5c=new AIModels({'connector':_0x6cce8a,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x363cab={'all':await _0x4aff5c['getAll'](),'recommended':await _0x4aff5c['getAvailableModels'](),'default':await _0x4aff5c['getDefault']()};return this['_modelsLoadError']=null,_0x363cab;}catch(_0x32c24e){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x32c24e),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x219cc7){const _0x1fa392='AI_REVIEW_CHECK_'+_0x219cc7['id']['toUpperCase']()['replaceAll']('-','_'),_0x5ed103={..._0x219cc7,'title':this['_translate'](_0x1fa392+'_TITLE',_0x219cc7['title']),'description':this['_translate'](_0x1fa392+'_DESCRIPTION',_0x219cc7['description'])};return _0x219cc7['options']&&(_0x5ed103['options']=_0x219cc7['options']['map'](_0x5130fd=>({..._0x5130fd,'label':this['_translate'](_0x1fa392+'_OPTIONS_LABEL',_0x5130fd['label']||''),'data':_0x5130fd['data']?_0x5130fd['data']['map'](_0x39d141=>({..._0x39d141,'label':this['_translate'](_0x1fa392+'_OPTIONS_DATA_'+_0x39d141['id']['toUpperCase'](),_0x39d141['label'])})):void 0x0}))),_0x5ed103;}['_translate'](_0x40ed49,_0x2d126f){const _0x33df81=Mi(this['context']['locale'],_0x40ed49);return _0x33df81===_0x40ed49?_0x2d126f:_0x33df81;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x2389a8){super(_0x2389a8),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',sr['map'](_0x2e7fe1=>_0x2e7fe1['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x3c2a48,_0x1e8ca6)=>{this['_isDiffOn']=_0x1e8ca6['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x9d8ff2,_0x5b7597){if(_0x9d8ff2['isCustom'])return new AIReviewCustomCheckRun(_0x9d8ff2['args']['prompt'],_0x9d8ff2['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5b7597,this['_aiConnector']);if(_0x5b7597['isExtra']){const _0xfcb003=_0x5b7597;return new AIReviewExtraCheckRun(_0x9d8ff2['args']?.['prompt']??_0xfcb003['prompt'],_0x9d8ff2['args']?.['model']??_0xfcb003['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5b7597,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5b7597,this['_aiConnector'],_0x9d8ff2['params'],_0x9d8ff2['args']);}['_onReviewCheckResultActivated'](_0x1b4fb5){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1b4fb5['change']['id']),this['_scrollToChange'](_0x1b4fb5['change']['id']);const _0x5c8c34=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1b4fb5['change']['id']);if(!_0x5c8c34)return;const _0x3c4779=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1b4fb5['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1b4fb5['change'],()=>_0x5c8c34['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3c4779,_0x5c8c34['modelRange']['root']['rootName']),_0x3c4779?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1b4fb5['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x4d1d6f){this['_currentReviewCheckRun']&&'click'===_0x4d1d6f['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4d1d6f['id']));}['_onDeactivateChange'](_0x5067e9){this['_currentReviewCheckRun']&&'balloon'===_0x5067e9['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x57f23c,_0x3d78a1){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3d78a1['changeId']);const _0x1e897f=this['_currentReviewCheckRun']['getChangeById'](_0x3d78a1['changeId']);if(!_0x1e897f)return;const _0x1c8212=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3d78a1['changeId']),_0x49c4c4=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3d78a1['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1e897f,_0x3d78a1['markerElement'],_0x3d78a1['domEvent'],'click',this['_getBalloonDomRoot'](_0x49c4c4,_0x1c8212?.['modelRange']['root']['rootName']),_0x49c4c4?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x59d850,_0x30992a){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x16d4c7=this['_currentReviewCheckRun']['getChangeById'](_0x30992a['changeId']);if(!_0x16d4c7)return;const _0x104aa8=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x30992a['changeId']),_0x15855b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x30992a['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x16d4c7,_0x30992a['markerElement'],_0x30992a['domEvent'],'hover',this['_getBalloonDomRoot'](_0x15855b,_0x104aa8?.['modelRange']['root']['rootName']),_0x15855b?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0xa3398a){const _0x11120a=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xa3398a);return _0x11120a?_0x11120a['getElement']():null;}['_markChangePositionInEditorContent'](_0x7dc87,_0x165068){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x7dc87,_0x165068);}['_diffContent'](_0xbf9edf,_0xd9fe3b,_0x129a93){return this['_aiReviewCoreEditing']['diffContent'](_0xbf9edf,_0xd9fe3b,_0x129a93,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x4bd03f){_0x4bd03f?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x27e5b0 of this['_aiReviewCoreEditing']['getEditors']())_0x27e5b0['editing']['view']['change'](_0x172623=>{for(const _0x5db98e of _0x27e5b0['editing']['view']['document']['getRoots']()){for(const _0x4e9c48 of _0x5db98e['getClassNames']())_0x4e9c48['startsWith']('ck-ai_review-')&&_0x172623['removeClass'](_0x4e9c48,_0x5db98e);_0x172623['addClass'](_0x4bd03f?'ck-ai_review-diff':'ck-ai_review-highlights',_0x5db98e);}});}['_getBalloonDomRoot'](_0x5f94ce,_0x5e90f6){const _0x13b78b=_0x5f94ce['editing']['view'];if(_0x5e90f6){const _0x5e1d78=_0x13b78b['getDomRoot'](_0x5e90f6);if(_0x5e1d78)return _0x5e1d78;}return _0x13b78b['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x27f02a=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x146945=await _0x27f02a['getChecksList']();_0x27f02a['modelsLoadError']&&this['_logError'](_0x27f02a['modelsLoadError']);let _0x3968e3=_0x146945['checks'];const _0x377253=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x377253,_0x3968e3),this['_usesAvailableCommandsConfig']&&(_0x3968e3=_0x377253['map'](_0x3b5edd=>_0x3968e3['find'](_0x124c52=>_0x124c52['id']===_0x3b5edd))['filter'](_0x176e22=>!!_0x176e22)),this['_filterChecksWithMissingModel'](_0x3968e3);}['_logWarningForNonExistentChecks'](_0x5eecfe,_0x4cdd0a){const _0x4159ef=_0x5eecfe['filter'](_0x497102=>!_0x4cdd0a['some'](_0x490df0=>_0x490df0['id']===_0x497102));if(_0x4159ef['length']){const _0x21ab6a=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x4159ef['join'](',\x20')});wt(_0x21ab6a['message']);}}['_filterChecksWithMissingModel'](_0x5f417a){const _0x58c79a=[];return _0x5f417a['forEach'](_0x277340=>{(_0x277340 instanceof AIReviewCheckExtra&&!_0x277340['defaultModel']||_0x277340 instanceof AIReviewCheckCustom&&!_0x277340['models']['length'])&&_0x58c79a['push'](_0x277340['id']);}),_0x58c79a['length']&&_0x58c79a['forEach'](_0x48a22c=>{_0x5f417a=_0x5f417a['filter'](_0x186af5=>_0x186af5['id']!==_0x48a22c);const _0x2e1e76=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x48a22c});Ct(_0x2e1e76['message']);}),_0x5f417a;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x1972d9){this['_editor']=_0x1972d9['editor'],this['_rootName']=_0x1972d9['rootName'],this['_channelId']=_0x1972d9['channelId'],this['_sessionId']=_0x1972d9['sessionId'];}get['status'](){return this['_error']?'error':this['_isAborted']?'aborted':void 0x0!==this['_contentRawNew']?'completed':'initialized';}get['editor'](){return this['_editor'];}get['rootName'](){return this['_rootName'];}get['channelId'](){return this['_channelId'];}get['sessionId'](){return this['_sessionId'];}get['documentVersion'](){return this['_documentVersion'];}set['documentVersion'](_0x1e5401){this['_documentVersion']=_0x1e5401;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1372eb){this['_contentRawOld']=_0x1372eb;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x1d4a84){this['_contentRawNew']=_0x1d4a84;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x419433){this['_error']=_0x419433;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x46944a){return _0x46944a['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x1c2088){this['_affectedBlocks']=_0x1c2088;}}class AIGateway extends _0x2e5d09{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x2a8413,_0x555915){if('completed'!==_0x2a8413['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x2a8413['status']});const _0x2e6f24=_0x2a8413['editor'];if('suggest'===_0x555915&&!_0x2e6f24['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x4dac3e='suggest'===_0x555915,_0x8eeb9b=this['context']['plugins']['get'](_0x1289fc),_0x332a95=_0x2e6f24['model']['createPositionAt'](_0x2e6f24['model']['document']['getRoot'](),0x0),_0x2c9ae1=_0x8eeb9b['getDiff'](_0x2a8413['contentRawOld'],_0x2a8413['contentRawNew'],{'anchor':_0x332a95,'markDeletions':_0x4dac3e,'targetEditor':_0x2e6f24}),_0x59d2ad=_0x2e6f24['model']['document']['history']['getOperations'](_0x2a8413['documentVersion']),_0x1f7c04={'document':_0x2e6f24['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x13ef2e=_0x5d10bd(_0x2c9ae1['getOperations'](),_0x59d2ad,_0x1f7c04)['operationsA'];_0x2e6f24['model']['change'](_0x23356b=>{if(_0x4dac3e)_0x2e6f24['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x13ef2e);else{for(const _0x2c8506 of _0x13ef2e)_0x2c8506['baseVersion']=_0x2e6f24['model']['document']['version'],Ts(_0x2e6f24,_0x2c8506),_0x23356b['batch']['addOperation'](_0x2c8506),_0x2e6f24['model']['applyOperation'](_0x2c8506);}});}['mergeChangesIntoContent'](_0x5e6249,_0x1c4850,_0x2de0d8){const _0x31c70c=new AIResponseParser(),_0x2de1ab=new AIResponseApplier();let _0x27318c=_0x31c70c['parseAndNormalizeHTML'](_0x1c4850);for(const _0x2966f8 of _0x5e6249)try{const _0x1a3528=_0x31c70c['parseAndNormalizeHTML'](_0x2966f8['content']);_0x27318c=_0x2de1ab['merge'](_0x1a3528,_0x27318c,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x114f0f){throw new ht('ai-gateway-merge-failed',this,{..._0x2966f8},_0x114f0f);}return as(_0x2de0d8,_0x31c70c['parseAndNormalizeHTML'](_0x1c4850),_0x27318c,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x2e5d09{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0xb486f5=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0xb486f5['getChecksList']())['checks']['map'](_0x3a9642=>{const _0x3d5461={'id':_0x3a9642['id'],'title':_0x3a9642['title'],'description':_0x3a9642['description']};return'custom'!==_0x3a9642['id']&&_0x3a9642['options']?.['length']&&(_0x3d5461['parameters']=_0x3a9642['options'][0x0]['data']['map'](_0xc6c402=>({..._0xc6c402}))),_0x3d5461;});}async['getAvailableModels'](){const _0xb61549=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0xb61549,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x133fbf,_0x3652c0){return await this['_runReviewCheck'](_0x133fbf,()=>this['_createReviewCheckRun'](_0x133fbf,_0x3652c0?.['parameterId']),_0x3652c0?.['signal']);}async['runCustomReview'](_0x3b9ee7,_0x101d7a){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x3b9ee7,_0x101d7a?.['model']),_0x101d7a?.['signal']);}['applyReview'](_0x4dedb3,_0x47329f){this['context']['plugins']['get']('AIGateway')['apply'](_0x4dedb3,_0x47329f);}async['_runReviewCheck'](_0x1caefe,_0x6255b4,_0x418b0a){const _0x2d7b7d=ps(this['context']),_0x55c1db=new AIReviewRunResult({'editor':_0x2d7b7d,'rootName':_0x2d7b7d['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x2d7b7d['plugins']['get']('AIEditing')['getSessionId'](_0x2d7b7d)});let _0x26527d,_0x560997;if(_0x418b0a){if(_0x418b0a['aborted'])return _0x55c1db['abort'](),_0x55c1db;const _0x33bd99=()=>{_0x55c1db['error']||(_0x55c1db['abort'](),_0x26527d&&_0x26527d['abort']());};_0x418b0a['addEventListener']('abort',_0x33bd99),_0x560997=()=>_0x418b0a['removeEventListener']('abort',_0x33bd99);}try{_0x26527d=await _0x6255b4(),_0x55c1db['contentRawOld']=_0x26527d['documentData']['content'],_0x55c1db['documentVersion']=Array['from'](_0x26527d['documentData']['elements'])['find'](([,_0x4a633d])=>_0x4a633d['rootName']===_0x55c1db['rootName'])?.[0x1]['documentVersion']??0x1,_0x26527d['on']('reviewCheckRunUpdated',(_0x320232,_0x77202e)=>{'aborted'===_0x77202e['status']?_0x55c1db['abort']():'error-general'!==_0x77202e['status']&&'error-chunk'!==_0x77202e['status']||(_0x55c1db['error']=this['_normalizeError'](_0x77202e['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x1caefe}));}),'aborted'!==_0x55c1db['status']&&await _0x26527d['start']();}catch(_0xac6b39){_0x55c1db['error']=this['_normalizeError'](_0xac6b39,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x1caefe});}finally{_0x560997&&_0x560997();}if(!_0x26527d||'aborted'===_0x55c1db['status']||'error'===_0x55c1db['status'])return _0x55c1db;_0x55c1db['affectedBlocks']=_0x26527d['results']['map'](_0x5b50f3=>({'id':_0x5b50f3['id'],'content':_0x5b50f3['contentNew']}));try{_0x55c1db['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x55c1db['affectedBlocks'],_0x55c1db['contentRawOld'],_0x55c1db['editor']));}catch(_0x364d6f){_0x55c1db['error']=this['_normalizeError'](_0x364d6f,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x1caefe});}return _0x55c1db;}async['_createReviewCheckRun'](_0x37b706,_0x52558a){const _0x3049d2=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x53a2da=>_0x53a2da['id']===_0x37b706);if(!_0x3049d2)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x37b706});if(_0x3049d2 instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x37b706});const _0x57d87d=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x311388=this['context']['plugins']['get']('AIConnector');if(_0x3049d2 instanceof AIReviewCheckExtra){if(!_0x3049d2['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x37b706});return new AIReviewExtraCheckRun(_0x3049d2['prompt'],_0x3049d2['defaultModel']['id'],_0x57d87d,_0x3049d2,_0x311388);}return new AIReviewSystemCheckRun(_0x57d87d,_0x3049d2,_0x311388,_0x52558a?[_0x52558a]:void 0x0);}async['_createCustomReviewCheckRun'](_0x1692e9,_0x48749a,_0x4bd15d){const _0x2893f8=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x16b0d1=>_0x16b0d1['id']===_0x1692e9);if(!_0x2893f8)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x1692e9});if(!(_0x2893f8 instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x1692e9});const _0x7f6a7c=_0x4bd15d??_0x2893f8['defaultModel']?.['id'];if(!_0x48749a)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x1692e9});if(!_0x7f6a7c)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x1692e9});return new AIReviewCustomCheckRun(_0x48749a,_0x7f6a7c,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2893f8,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x540c97,_0x51b48c,_0x24f2a6){let _0x4fb1c3=_0x540c97;return _0x540c97 instanceof ht||(_0x4fb1c3=new ht(_0x51b48c,this,_0x24f2a6,_0x540c97)),_0x4fb1c3;}}class AIReviewMode extends _0x2e5d09{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x259dfa,_0x1797e9){if(this['assertStartReviewPreconditions'](_0x259dfa)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x259dfa});const _0x26b9da=this['context']['plugins']['get']('AIReviewModeController');await _0x26b9da['runCheck']({'id':_0x259dfa,'params':_0x1797e9?.['parameterId']?[_0x1797e9['parameterId']]:void 0x0});}async['startCustomReview'](_0x3848ce,_0x30648d){if(!_0x3848ce)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x3875df=sr['find'](_0x1dff8e=>'custom'===_0x1dff8e['commandId'])['id'],_0x22846e=this['assertStartReviewPreconditions'](_0x3875df),_0x451bf0=_0x30648d?.['model']??_0x22846e['defaultModel']?.['id'];if(!_0x451bf0)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x10d6f3=this['context']['plugins']['get']('AIReviewModeController');await _0x10d6f3['runCheck']({'id':_0x3875df,'isCustom':!0x0,'args':{'prompt':_0x3848ce,'model':_0x451bf0}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x3bb8d6=>{const _0x3c21bc={'id':_0x3bb8d6['id'],'title':_0x3bb8d6['title'],'description':_0x3bb8d6['description']};return'custom'!==_0x3bb8d6['id']&&_0x3bb8d6['options']?.['length']&&(_0x3c21bc['parameters']=_0x3bb8d6['options'][0x0]['data']['map'](_0xc5300d=>({..._0xc5300d}))),_0x3c21bc;});}['assertStartReviewPreconditions'](_0x12db05){const _0x437bdd=this['context']['plugins']['get']('AIReviewModeController');if(_0x437bdd['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x2396d3=_0x437bdd['getAvailableChecks']()['find'](_0x4bf83c=>_0x4bf83c['id']===_0x12db05);if(!_0x2396d3)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x12db05});const _0x4d3f74=this['context']['plugins']['get']('AITabs')['view'];return _0x4d3f74['isVisible']=!0x0,_0x4d3f74['activateTab']('reviewMode'),_0x2396d3;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x1e888a,_0xff008e,_0x53a4b3,_0x58203c,_0x53097d,_0x11bf7d){super(_0x1e888a,_0xff008e,_0x53a4b3,_0x53097d,_0x11bf7d),this['_title']=_0x58203c;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x392f23){this['_checks']=_0x392f23['map'](_0x3eecaa=>new AITranslateCheck(_0x3eecaa));}}const nr=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x31ac7a){super(_0x31ac7a),this['context']['config']['define']('ai.translate.languages',nr);}async['_loadChecksList'](){const _0x34aa10=[],_0x53d93c=this['context']['config']['get']('ai.translate.languages')||[];for(const _0xd55b88 of _0x53d93c)_0x34aa10['push']({'title':_0xd55b88['label'],'id':_0xd55b88['id'],'commandId':_0xd55b88['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0xd55b88['id']}});const _0x5b8f57=new AITranslateCheckList();return _0x5b8f57['setupChecks'](this['_translateChecks'](_0x34aa10)),_0x5b8f57;}['_translateChecks'](_0x5a2e18){const _0x15dfcc=this['context']['locale'];return _0x5a2e18['map'](_0x2efbe1=>{const _0x5a980b='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x2efbe1['title']['toUpperCase']()['replaceAll']('-','_'),_0x527f8b=Mi(_0x15dfcc,_0x5a980b);return{..._0x2efbe1,'title':_0x527f8b===_0x5a980b?_0x2efbe1['title']:_0x527f8b};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x473ccf,_0x449f15){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x449f15,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x473ccf['params'],_0x473ccf['args']);}['_onReviewCheckResultActivated'](_0x2f5772){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x2f5772['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x2f5772['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x33c076){this['_currentReviewCheckRun']&&('hover'===_0x33c076['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x33c076['id'])),'click'===_0x33c076['uiInteraction']&&this['_scrollToChange'](_0x33c076['id']));}['_onDeactivateChange'](_0x30e272){this['_currentReviewCheckRun']&&'panel'===_0x30e272['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x2622b3,_0x2aa7d1){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2aa7d1['changeId']),this['_scrollToChange'](_0x2aa7d1['changeId']));}['_onChangeMarkerHovered'](_0x3bf6c1,_0x5937e5){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5937e5['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x5937e5['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x3b79b5){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3b79b5);}['_markChangePositionInEditorContent'](_0xf92f77,_0x243e25){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0xf92f77,_0x243e25);}['_diffContent'](_0x259679,_0x3c5f6a,_0x2e7bdc){return this['_aiReviewCoreEditing']['diffContent'](_0x259679,_0x3c5f6a,_0x2e7bdc,!0x0);}['_onReviewCheckRun'](){for(const _0x3542ed of this['_aiReviewCoreEditing']['getEditors']())_0x3542ed['editing']['view']['change'](_0x150e2f=>{for(const _0x34eeb7 of _0x3542ed['editing']['view']['document']['getRoots']())_0x150e2f['addClass']('ck-ai-translate-mode-content',_0x34eeb7);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x507e08,_0xc6276d){super(_0x507e08,_0xc6276d),this['on']('set:isLoading',(_0x3086fc,_0x4ce6ab,_0x1db2a0)=>{_0x1db2a0&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x8d43dd,_0x3b73e3,_0x1a9635)=>{_0x1a9635&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x5dc710=super['_createAcceptAllButtonView']();return _0x5dc710['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x5dc710;}['_createExitReviewButtonView'](){const _0x25964f=super['_createExitReviewButtonView']();return _0x25964f['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x25964f;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x51243e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x51243e['if']('isVisible','ck-hidden',_0x33a470=>!_0x33a470)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x51243e['if']('isVisible','ck-hidden',_0x3b4221=>!_0x3b4221)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x5f3485=this['context']['plugins']['get']('AITabs'),_0x32b071=this['context']['locale'],_0x35e2f8=new AIHeaderView(_0x32b071,{'label':Mi(_0x32b071,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x260bc9,'class':'ck-ai-header_review-translate','showResizeButton':_0x5f3485['showResizeButton']});_0x35e2f8['delegate']('resizeTabs')['to'](_0x5f3485),_0x35e2f8['bind']('isMaximized')['to'](_0x5f3485['view'],'isMaximized',_0x43588b=>_0x43588b);const _0x5b1e07=new AIReviewCoreView(_0x32b071,{'header':_0x35e2f8,'list':new AITranslateCheckListView(_0x32b071),'results':new AITranslateCheckResultsView(_0x32b071,{'generalErrorText':Mi(_0x32b071,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x32b071,{'headerText':Mi(_0x32b071,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0x32b071,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x32b071,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x5b1e07['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x5b1e07;}['registerTab'](){const _0x453372=this['context']['plugins']['get']('AITabs');_0x453372['view']['on']('activateTab',(_0x50bdb1,{newTab:_0x166820,oldTab:_0x46dd79})=>{'translate'===_0x166820?this['fire']('getReviewCheckList'):'translate'===_0x46dd79&&this['fire']('leaveReview');}),_0x453372['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x260bc9,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x2e5d09{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};
|