@ckeditor/ckeditor5-ai 48.4.0-alpha.4 → 48.4.0-alpha.6
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 +19 -19
- 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 +29 -29
package/dist/index.js
CHANGED
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Command as _0x55187e,ContextPlugin as _0x2b8fcb,Editor as _0x5d4fbe,Plugin as _0x3e375b,rootAcceptsBlocks as _0x1e4a4c}from'@ckeditor/ckeditor5-core';import{IconAI as _0x2985d1,IconAIAdjustLength as _0x2c956b,IconAIAskAI as _0x56b3bc,IconAIChangeTone as _0x2bcd87,IconAIChat as _0x2abd52,IconAIChatCommands as _0x46bf06,IconAIContinueWriting as _0x1661e7,IconAIGrammarCheck as _0x30dda9,IconAIHistory as _0x36df57,IconAIImproveWriting as _0x1ab44b,IconAIOther as _0x3999fe,IconAIQuickActions as _0x5b0bbe,IconAIReview as _0xba7699,IconAITranslate as _0xa83078,IconBoxWithCheck as _0x97f812,IconBoxWithCross as _0x352379,IconBoxWithMarker as _0x823889,IconBrowseFiles as _0xbc7c6b,IconBulb as _0x3ab500,IconCancel as _0x2f23df,IconCheck as _0x884ad8,IconChevronDown as _0x3264af,IconChevronRight as _0x1fe7ce,IconChevronUp as _0x28ea88,IconCopy as _0x3cbf87,IconDocument as _0x2cf678,IconDocumentOutline as _0x551773,IconDropdownArrow as _0x1da0ec,IconError as _0x485df8,IconEye as _0x2db718,IconEyeCrossedOut as _0x3484b1,IconFileUpload as _0x1254ca,IconImage as _0x57bd7a,IconInfo as _0x5a892d,IconLink as _0xe2d1f3,IconLoupe as _0x2d30f0,IconMagicWand as _0xd68b96,IconMaximize as _0x63b38e,IconMinimize as _0x30b348,IconNextArrow as _0x59885d,IconOutdated as _0xf70950,IconPaperClip as _0x3298fd,IconPin as _0x9fd472,IconPlus as _0x304a27,IconPreviousArrow as _0x44f029,IconRefresh as _0x560f66,IconRevisionHistory as _0x4d50e7,IconRobotPencil as _0x2472d5,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,first as mt,getConstrainedViewportRect as Tt,global as wt,insertToPriorityArray as Ct,isVisible as ft,logError as bt,logWarning as St,scrollAncestorsToShowTarget as Rt,scrollViewportToShowTarget as Ot,toArray as vt,uid as kt,version as yt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as xt,BalloonToolbar as Lt,BodyCollection as Pt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Ht,ButtonView as Mt,Dialog as Ut,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Bt,FileDialogButtonView as Gt,FocusCycler as Ft,FormHeaderView as Kt,FormRowView as Wt,HighlightedTextView as Yt,IconView as $t,InputTextView as qt,LabeledFieldView as Qt,ListItemButtonView as Xt,ListItemGroupView as zt,ListItemView as jt,ListView as Jt,MenuBarMenuListItemButtonView as Zt,MenuBarMenuListItemView as te,MenuBarMenuListView as _0x35c22f,MenuBarMenuView as _0x1b3951,SearchTextView as _0x2e5362,SpinnerView as _0x4c01fe,Template as _0x2f5e20,TextareaView as _0x318d2a,ToolbarView as _0x372a41,UIModel as _0x30d699,View as _0x3faf4e,ViewCollection as _0x5b3174,addListToDropdown as _0x143f7a,addMenuToDropdown as _0x5b95fa,clickOutsideHandler as _0x5ccdd9,createDropdown as _0x48d908,createLabeledInputText as _0x5c944f,createLabeledTextarea as _0x5085d5,submitHandler as _0x42d489}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x277cd3,ClipboardPipeline as _0x1630e9}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x4e3f2b,MarkerOperation as _0x75501a,Matcher as _0x55c53a,ModelDocumentFragment as _0x43d2b2,ModelPosition as _0x546016,ModelRange as _0x244cab,ModelTreeWalker as _0x3bd289,ViewDataTransfer as _0x56cd34,ViewDocumentDomEventData as _0x18b9ad,ViewDowncastWriter as _0x17e18b,ViewUpcastWriter as _0xcda2eb,_DetachOperation as _0x10a40c,_insertIntoModelNodeList as _0x6c9cae,_removeFromModelNodeList as _0x21c658,transformOperationSets as _0x305f08}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x4fe0e8,debounce as _0x509cdb,escape as _0x1bdee6,escapeRegExp as _0x5f86da,omit as _0x2967b5,throttle as _0x3befdf,unescape as _0x2d4beb}from'es-toolkit/compat';import{createParser as _0xd409ef}from'eventsource-parser';import{CloudServices as _0x23f73e}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x3b90c9}from'htmlparser2';import{append as _0x221092,appendChild as _0x88365f,find as _0x353e7c,findAll as _0x150f20,findOne as _0x1478a8,getChildren as _0x38ca5b,getParent as _0x46534a,isComment as _0x259173,isTag as _0x1c00b6,prepend as ti,prependChild as _0x57b293,removeElement as _0x11f553,replaceElement as _0x3d1fd1,textContent as _0x3a5b3f}from'domutils';import _0x311e91 from'dom-serializer';import{Document as _0x2fcdd7,Element as _0x5ea3d9,NodeWithChildren as _0x49f808,Text as _0x2c88e6,cloneNode as _0x40285a,isDocument as _0x3f6391,isText as _0x56307a}from'domhandler';import{ConfirmMixin as _0x29a25b,DATA_ID_MODEL_ATTRIBUTE as _0x4e9c0c,DATA_ID_VIEW_ATTRIBUTE as _0x552fd8,DocumentCompare as _0x2cd097,PillView as _0x46d1c2,SuggestionsConversion as _0x4cc16e,fixElementSuggestionRange as _0x167f0b,getAllMarkersDomElementsSorted as _0x14fbe5,getMarkerDomElement as _0x417421,isInvalidAttributeOperation as _0x27f0ea}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x2b0b3a,MarkdownGfmMdToHtmlDefaultPlugins as _0x222f27}from'@ckeditor/ckeditor5-markdown-gfm';import _0x2ece53 from'rehype-sanitize';import _0x4ab719 from'morphdom';import{diffArrays as _0x4e9b8d}from'diff';const vi='_ungrouppedCommands';function ki(_0x3fce29,_0x7aa32f){const _0x2ff8ba=(0x0,_0x7aa32f['t'])('Other');return _0x3fce29['length']?'groupId'in _0x3fce29[0x0]?_0x3fce29:[{'groupId':vi,'groupLabel':_0x2ff8ba,'order':0x1/0x0,'commands':_0x3fce29}]:[{'groupId':vi,'groupLabel':_0x2ff8ba,'order':0x1/0x0,'commands':[]}];}const yi=globalThis['DataTransfer'],Ni='ai-ui';var xi=class extends _0x3e375b{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x45cf4b}=this,_0x2c1423=['ck-fake-ai-selection'];_0x45cf4b['config']['get']('ai.assistant.useTheme')&&_0x2c1423['push']('ck-ai-assistant-ui_theme'),_0x45cf4b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ni,'view':{'classes':_0x2c1423,'priority':0xc}}),_0x45cf4b['conversion']['for']('editingDowncast')['markerToElement']({'model':Ni,'view':(_0x444832,{writer:_0x411437})=>{if(!_0x444832['markerRange']['isCollapsed'])return null;const _0x3d9117=_0x411437['createUIElement']('span');return _0x411437['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3d9117),_0x3d9117;}});}afterInit(){!async function(_0x42279a){const _0x4b0921='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x4a6671=0x79188,_0x2883c9=window['Date']['now'](),_0x4d6ad7=_0x42279a['editor'],_0x8269e=new window['Promise'](_0x16b5ab=>{_0x4d6ad7['once']('ready',_0x16b5ab);}),_0x4a7d05={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x250a07=_0x4d6ad7['config']['get']('licenseKey');async function _0x1797b5(){let _0x367f4c,_0x40a510=null,_0x3aa146=null;try{return'GPL'==_0x250a07?'NotAllowed':(_0x367f4c=_0x35d69d(),_0x367f4c?(_0x367f4c['usageEndpoint']&&(_0x3aa146=_0x16083e(_0x367f4c['usageEndpoint'],_0x367f4c['jti'])),await _0x29e0db()?_0xdc4bb3()?_0x5411e1()?'Expired':_0x3d160d()?('evaluation'==_0x367f4c['licenseType']&&(_0x40a510=_0x3625dc('EvaluationLimit')),await _0x5e01cf()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x5411e1(){const _0x10aeef=['evaluation','trial']['includes'](_0x367f4c['licenseType'])?_0x2883c9/0x3e8:0xe10*_0x4a6671;return _0x367f4c['exp']<_0x10aeef;}function _0xdc4bb3(){const _0x4148f2=_0x367f4c['features'];return!!_0x4148f2&&(!!_0x4148f2['includes']('*')||!!_0x4148f2['includes']('AI'));}function _0x3d160d(){const _0x29071f=_0x367f4c['licensedHosts'];if(!_0x29071f||0x0==_0x29071f['length'])return!0x0;const {hostname:_0x530c94}=new URL(window['location']['href']);if(_0x29071f['includes'](_0x530c94))return!0x0;const _0x16af46=_0x530c94['split']('.');return _0x29071f['filter'](_0x591f43=>_0x591f43['includes']('*'))['map'](_0x1514e7=>_0x1514e7['split']('.'))['filter'](_0x49a505=>_0x49a505['length']<=_0x16af46['length'])['map'](_0x5b2b76=>Array(_0x16af46['length']-_0x5b2b76['length'])['fill']('*'===_0x5b2b76[0x0]?'*':'')['concat'](_0x5b2b76))['some'](_0x52da03=>_0x16af46['every']((_0x4119e6,_0x580f58)=>_0x52da03[_0x580f58]===_0x4119e6||'*'===_0x52da03[_0x580f58]));}function _0x5e01cf(){return _0x40a510&&_0x3aa146?new window['Promise']((_0x5bcde3,_0x237fd8)=>{_0x40a510['then'](_0x5bcde3,_0x237fd8),_0x3aa146['then'](_0x6806ac=>{'Valid'!=_0x6806ac&&_0x5bcde3(_0x6806ac);},_0x237fd8);}):_0x40a510||_0x3aa146||'Valid';}}function _0x16083e(_0x5d6fc1,_0x57ffb6){return new window['Promise'](_0x21054c=>{if(_0x5b781f())return _0x21054c('Valid');_0x4c4bc2(),_0x4d6ad7['decorate']('_sendUsageRequest');let _0x17bd5c=!0x1;const _0x534be8=kt();function _0x17396d(_0x8c473c){return!!_0x8c473c&&('object'==typeof _0x8c473c||'function'==typeof _0x8c473c)&&'function'==typeof _0x8c473c['then']&&'function'==typeof _0x8c473c['catch'];}function _0x99380c(_0x80eb6e){_0xe6035c(_0x80eb6e)['then'](_0x29df38=>_0x29df38&&'ok'==_0x29df38['status']?_0x21c9fe(_0x1bef5c(_0x534be8+_0x57ffb6))!=_0x29df38['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x1a1b05=>(_0x4a7d57(),_0x1a1b05),()=>{const _0x54810e=_0x57077e();return null==_0x54810e?(_0x4a7d57(),'Valid'):_0x2883c9-_0x54810e>0x240c8400?'UsageLimit':'Valid';})['then'](_0x21054c)['catch'](()=>{_0x21054c('UsageLimit');});const _0x46c2ea=0x36ee80;function _0x4a7d57(){const _0x1bcde0='llct-'+_0x21c9fe(_0x1bef5c(_0x5d6fc1)),_0x2bf208=_0x4a9044(_0x21c9fe(window['Math']['ceil'](_0x2883c9/_0x46c2ea)));window['localStorage']['setItem'](_0x1bcde0,_0x2bf208);}function _0x57077e(){const _0xd39f53='llct-'+_0x21c9fe(_0x1bef5c(_0x5d6fc1)),_0x1d6695=window['localStorage']['getItem'](_0xd39f53);return _0x1d6695?window['parseInt'](_0x4a9044(_0x1d6695),0x10)*_0x46c2ea:null;}function _0xe6035c(_0x4d193d){return new window['Promise']((_0x5ea416,_0x10eb95)=>{_0x4d193d['then'](_0x5ea416,_0x10eb95),window['setTimeout'](_0x10eb95,0x1d4c0);});}}_0x4d6ad7['on']('_sendUsageRequest',(_0x105ab1,_0x36707b)=>{if(_0x36707b[0x0]!=_0x5d6fc1)return _0x21054c('UsageLimit');_0x36707b[0x1]={..._0x36707b[0x1],'requestId':_0x534be8};},{'priority':'high'}),_0x4d6ad7['on']('_sendUsageRequest',_0x19ca43=>{_0x17396d(_0x19ca43['return'])&&(_0x17bd5c=!0x0,_0x99380c(_0x19ca43['return']));},{'priority':'low'}),_0x8269e['then'](()=>{_0x17bd5c||_0x21054c('UsageLimit');});});function _0x5b781f(){return'auto'==_0x4d6ad7['editing']['view']['_overlayModeHint'];}function _0x4c4bc2(){_0x4d6ad7['editing']['view']['_overlayModeHint']='auto';}}function _0x3625dc(_0x4ed94a){const _0x488e1a=[new window['Promise'](_0x45acb2=>setTimeout(_0x45acb2,0x93ecc)),_0x8269e['then'](()=>new window['Promise'](_0x1a4727=>{let _0x563010=0x0;_0x4d6ad7['model']['on']('applyOperation',(_0x540eee,_0x358541)=>{_0x358541[0x0]['isDocumentOperation']&&_0x563010++,0x5e8==_0x563010&&(_0x1a4727(),_0x540eee['off']());});}))];return window['Promise']['race'](_0x488e1a)['then'](()=>_0x4ed94a);}async function _0xcb3ab2(){await _0x8269e,_0x4d6ad7['model']['change']=_0x1921fb,_0x4d6ad7['model']['enqueueChange']=_0x1921fb,_0x4d6ad7['enableReadOnlyMode']('model');}function _0x138af7(_0xad0b5){const _0x2f6562=_0x2b59a2();_0x4d6ad7[_0x2f6562]='aiLicenseKey'+_0xad0b5,'Valid'!=_0xad0b5&&_0xcb3ab2();}function _0x2b59a2(){const _0x2cfdc9=window['String'](window['performance']['now']())['replace']('.','');let _0x428cde='n';for(let _0x596b8f=0x0;_0x596b8f<_0x2cfdc9['length'];_0x596b8f+=0x2){let _0x5200c2=window['parseInt'](_0x2cfdc9['substring'](_0x596b8f,_0x596b8f+0x2));_0x5200c2>=0x3e&&(_0x5200c2-=0x3e),_0x428cde+=_0x4b0921[_0x5200c2];}return _0x428cde;}function _0x35d69d(){const _0x26e054=_0x250a07['split']('.');if(0x3!=_0x26e054['length'])return null;return _0x240227(_0x26e054[0x1]);function _0x240227(_0x8fe0bb){const _0xf62659=_0x31880c(_0x8fe0bb);return _0xf62659&&_0x33839b()?_0xf62659:null;function _0x33839b(){const _0x5041df=_0xf62659['jti'],_0x2a0e15=window['parseInt'](_0x5041df['substring'](_0x5041df['length']-0x8),0x10),_0x1c955a={..._0xf62659,'jti':_0x5041df['substring'](0x0,_0x5041df['length']-0x8)};return delete _0x1c955a['vc'],_0x1bef5c(_0x1c955a)==_0x2a0e15;}}}async function _0x29e0db(){let _0x3a9ee6=!0x0;try{const [_0x30e856,_0x508e93,_0x17d821]=_0x250a07['split']('.');return _0x42f62e(_0x30e856),await _0x2d4059(_0x30e856,_0x508e93,_0x17d821),_0x3a9ee6;}catch{return!0x1;}function _0x42f62e(_0x27155f){const _0x3180ea=_0x31880c(_0x27155f);_0x3180ea&&'ES256'==_0x3180ea['alg']||(_0x3a9ee6=!0x1);}async function _0x2d4059(_0x28b58c,_0x49861f,_0x518514){const _0x411ad6=window['Uint8Array']['from'](_0x2f71b3(_0x518514),_0x2b0113=>_0x2b0113['charCodeAt'](0x0)),_0x4cb1b1=new window['TextEncoder']()['encode'](_0x28b58c+'.'+_0x49861f),_0x5eec08=window['crypto']['subtle'];if(!_0x5eec08)return;const _0x323b5e=await _0x5eec08['importKey']('jwk',_0x4a7d05,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x5eec08['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x323b5e,_0x411ad6,_0x4cb1b1)||(_0x3a9ee6=!0x1);}}function _0x31880c(_0x173075){return _0x173075['startsWith']('ey')?JSON['parse'](_0x2f71b3(_0x173075)):null;}function _0x2f71b3(_0x4f6369){return window['atob'](_0x4f6369['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x1bef5c(_0x2b3256){let _0x4381ed=0x1505;function _0x4eff00(_0x50c048){for(let _0x4bd31e=0x0;_0x4bd31e<_0x50c048['length'];_0x4bd31e++){const _0x5ae5bd=_0x50c048['charCodeAt'](_0x4bd31e);_0x4381ed=(_0x4381ed<<0x5)+_0x4381ed+_0x5ae5bd,_0x4381ed&=_0x4381ed;}}function _0x539482(_0x1084a5){Array['isArray'](_0x1084a5)?_0x1084a5['forEach'](_0x539482):_0x1084a5&&'object'==typeof _0x1084a5?Object['entries'](_0x1084a5)['sort']()['forEach'](([_0x1ed407,_0x1e77ae])=>{_0x4eff00(_0x1ed407),_0x539482(_0x1e77ae);}):_0x4eff00(window['String'](_0x1084a5));}return _0x539482(_0x2b3256),_0x4381ed>>>0x0;}function _0x21c9fe(_0x29a8b7){return _0x29a8b7['toString'](0x10)['padStart'](0x8,'0');}function _0x4a9044(_0x551e5c){return _0x551e5c['split']('')['reverse']()['join']('');}function _0x1921fb(){}_0x138af7(await _0x1797b5());}(this);}showFakeVisualSelection(){const _0x4d3638=this['editor']['model'];_0x4d3638['change'](_0x4a32c6=>{const _0x5bc67d=_0x4d3638['document']['selection']['getRanges']();let _0x14c0c8=0x0;for(const _0x2418f5 of _0x5bc67d){const _0x2374ae=Ni+':'+_0x14c0c8;if(_0x4d3638['markers']['has'](_0x2374ae))_0x4a32c6['updateMarker'](_0x2374ae,{'range':_0x2418f5});else{if(_0x2418f5['start']['isAtEnd']){const _0x20b2e0=_0x2418f5['start']['getLastMatchingPosition'](({item:_0x3fa8e4})=>!_0x4d3638['schema']['isContent'](_0x3fa8e4),{'boundaries':_0x2418f5});_0x4a32c6['addMarker'](_0x2374ae,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4a32c6['createRange'](_0x20b2e0,_0x2418f5['end'])});}else _0x4a32c6['addMarker'](_0x2374ae,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2418f5});}_0x14c0c8++;}});}hideFakeVisualSelection(){const _0x511960=this['editor']['model'],_0x1ef412=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ni));_0x1ef412['length']&&_0x511960['change'](_0x1e7e84=>{_0x1ef412['forEach'](_0x2b61b0=>{_0x1e7e84['removeMarker'](_0x2b61b0);});});}insertContent(_0x59ed60,_0x67b962){const _0x183a6a=this['_getAISelection'](),_0xbd2ff1=_0x67b962||_0x183a6a['getFirstRange']();this['editor']['model']['canEditAt'](_0xbd2ff1)&&this['editor']['model']['change'](_0x358e14=>{this['hideFakeVisualSelection'](),_0x67b962||this['_resetContentOfSelectedTableCells'](_0x358e14,_0x183a6a),this['_pasteHTMLUsingClipboard']({'insertAt':_0xbd2ff1,'writer':_0x358e14,'html':_0x59ed60});});}insertContentBelow(_0x198146){const {model:_0x33f33b}=this['editor'],_0x45e20a=this['_getAISelection']();_0x33f33b['change'](()=>{const _0x4c63bc=this['_prepareTableInsertBelowPosition'](_0x198146,_0x45e20a)||this['_getDefaultInsertBelowPosition'](_0x45e20a);this['insertContent'](_0x198146,_0x4c63bc);});}_getAISelection(){const _0x83084f=this['editor']['model'],_0x80d20c=Array['from'](_0x83084f['markers']['getMarkersGroup'](Ni))['map'](_0x4ea360=>_0x4ea360['getRange']());return _0x83084f['createSelection'](_0x80d20c);}_pasteHTMLUsingClipboard({writer:_0x1c1586,html:_0x49d47a,insertAt:_0x1f2da3}){const {view:_0x255801}=this['editor']['editing'],_0x181e8e=this['editor']['plugins']['get'](_0x1630e9),_0x11f5b4=new yi();_0x11f5b4['setData']('text/html',_0x49d47a);const _0x59d288=new _0x18b9ad(_0x255801,new ClipboardEvent('paste',{'clipboardData':_0x11f5b4}),{'dataTransfer':new _0x56cd34(_0x11f5b4)});_0x1c1586['setSelection'](_0x1f2da3);const _0x5459b4=(_0xa4d3f,_0x1e468d)=>{_0x1e468d['resultRange']&&_0x1c1586['setSelection'](_0x1e468d['resultRange']);};_0x181e8e['once']('contentInsertion',_0x5459b4,{'priority':'lowest'}),_0x255801['document']['fire']('paste',_0x59d288),_0x181e8e['off']('contentInsertion',_0x5459b4);}_getDefaultInsertBelowPosition(_0x3303ae){const {model:_0x4ac9f2}=this['editor'],_0x577d48=Array['from'](_0x3303ae['getSelectedBlocks']());return _0x577d48['length']?_0x4ac9f2['createPositionAfter'](_0x577d48['pop']()):_0x3303ae['getLastPosition']();}_prepareTableInsertBelowPosition(_0x370259,_0x344f07){const {model:_0x31bfea,plugins:_0x7c1f2f}=this['editor'];if(_0x7c1f2f['has']('TableUtils')){const _0x10fd7e=_0x7c1f2f['get']('TableUtils')['getSelectedTableCells'](_0x344f07);if(_0x10fd7e['length']){const _0x52fb97=this['_getTableRowCountFromContent'](_0x370259),_0x3e7c5c=this['_createEmptyTableRows'](_0x10fd7e,_0x52fb97);return _0x31bfea['createPositionAt'](_0x3e7c5c,0x0);}}return null;}_getTableRowCountFromContent(_0x2ac7a3){const _0x45968e=this['editor']['plugins']['get']('TableUtils'),_0x56c596=this['editor']['data']['parse'](_0x2ac7a3,'$documentFragment'),_0x31f3cd=Array['from'](_0x56c596['getChildren']())['filter'](_0x7d9050=>_0x7d9050['is']('element','table'));let _0x5f53e4=0x0;return _0x31f3cd['forEach'](_0x227fb2=>{_0x5f53e4+=_0x45968e['getRows'](_0x227fb2);}),_0x5f53e4;}_createEmptyTableRows(_0x5e8a4f,_0x12cab6){const _0x22b51e=this['editor']['plugins']['get']('TableUtils'),_0x4df054=_0x22b51e['getRowIndexes'](_0x5e8a4f),_0x475e80=_0x22b51e['getColumnIndexes'](_0x5e8a4f),_0x418925=_0x4df054['last']+0x1,_0x5cad21=_0x475e80['first'],_0x4d60b7=_0x5e8a4f[0x0]['findAncestor']('table');for(let _0x4e135b=0x0;_0x4e135b<_0x12cab6;_0x4e135b++)_0x22b51e['insertRows'](_0x4d60b7,{'at':_0x418925});return _0x4d60b7['getChild'](_0x418925)['getChild'](_0x5cad21);}_resetContentOfSelectedTableCells(_0x109e0f,_0x410395){const {plugins:_0x1f687c}=this['editor'],{model:_0x31ab6d}=_0x109e0f;_0x1f687c['has']('TableUtils')&&_0x1f687c['get']('TableUtils')['getSelectedTableCells'](_0x410395)['length']&&_0x31ab6d['deleteContent'](_0x410395);}},Li=class extends _0x3e375b{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Pi=class extends Error{constructor(_0x2a75e5){super(_0x2a75e5),this['name']='AIRequestError';}};function Di(_0xc0cbd5,_0x45d309,_0x18a00d){const t=_0xc0cbd5['t'];switch(_0x45d309){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',_0x18a00d);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x18a00d);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'},_0x18a00d);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 _0x45d309;}}var Hi=class extends _0x55187e{_commandDefinitions;constructor(_0x915758,_0x14ac5d){super(_0x915758),this['_commandDefinitions']=_0x14ac5d,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x221387,_0x5b1e8b,_0x449f2c)=>{this['isEnabled']&&(this['enabledCommandsIds']=Mi(this['_commandDefinitions'],_0x449f2c));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x292a17,_0xc74f6c,_0x2500d7)=>{this['enabledCommandsIds']=_0x2500d7?Mi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x4846ad=this['editor']['model'];this['_hasContext']=function(_0x9adf87){const _0x5ba160=_0x9adf87['document']['selection'];return _0x5ba160['isCollapsed']?0x0!==[..._0x5ba160['getSelectedBlocks']()]['length']&&![..._0x5ba160['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x9adf87['hasContent'](_0x5ba160['getFirstRange']());}(_0x4846ad);const _0x26dfe5=_0x4846ad['document']['selection'],_0x16fe34=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x5f0981 of _0x26dfe5['getRanges']())for(const _0x4ffe81 of _0x5f0981['getItems']())if(_0x4ffe81['is']('element')&&_0x16fe34['includes'](_0x4ffe81['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x4fc1f6='',_0x186ea4='',_0x4768b8='custom'){this['editor']['plugins']['get'](ts)['showUI'](_0x4fc1f6,_0x186ea4,_0x4768b8);}};function Mi(_0x5e5746,_0x2bdd07){const _0x76b09=new Set();for(const _0xe8764c of _0x5e5746['values']())(_0x2bdd07||!0x1===_0xe8764c['requiresContent'])&&_0x76b09['add'](_0xe8764c['id']);return Array['from'](_0x76b09);}const Ui=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Vi=/* #__PURE__ -- @preserve */
|
|
24
|
-
At();var Bi=class extends Vi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x3d3d46,_0x473165,_0x3f4981){super(),this['editor']=_0x3d3d46,this['textAdapter']=_0x473165,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x3f4981,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x174d9d,_0x469f21,_0xcd789)=>{this['view']['value']=this['_sanitizeHTML'](_0xcd789);}),this['listenTo'](this['view'],'submitPrompt',(_0x1db552,_0x372c7a)=>{const _0x32f9da=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x372c7a,_0x32f9da,'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:_0x3af556,query:_0x1b55df,htmlContent:_0x1c841a,label:_0x4a4da4,mainActionLabel:_0x550848}){this['view']['prompt']=_0x4a4da4,this['view']['mainAction']=_0x550848,this['initialContext']=_0x1c841a,_0x1b55df&&(this['view']['isRendered']?this['_handleQuery'](_0x1b55df,_0x1c841a,_0x3af556,_0x4a4da4):this['view']['once']('render',()=>{this['_handleQuery'](_0x1b55df,_0x1c841a,_0x3af556,_0x4a4da4);}));}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'](_0xf274ba,_0x4ccaf5,_0x354559,_0x4b11f6){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x4ccaf5,this['previousQuery']=_0xf274ba,this['previousLabel']=_0x4b11f6||_0xf274ba,this['previousActionId']=_0x354559,new Promise(_0x33dea1=>{this['textAdapter']['makeRequest']({'query':_0xf274ba,'context':_0x4ccaf5,'onData':_0x1b5505=>{this['currentResponse']=_0x1b5505,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x354559})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x401790=>{_0x401790 instanceof Pi?this['view']['handleError'](_0x401790['message']):this['view']['handleError'](),_0x33dea1();})['finally'](()=>{this['stopProcessing'](),_0x33dea1();});});}_parseAndNormalizeContent(_0x47bddb,_0x36414f=!0x1){const _0x5e39dc=Ui['exec'](_0x47bddb);_0x47bddb=_0x5e39dc?_0x47bddb['substring'](_0x5e39dc[0x1]['length']):_0x47bddb['length']<0x64&&!_0x36414f?'':this['_stripMarkdownSyntax'](_0x47bddb);const _0x1b0676=this['_domParser']['parseFromString'](_0x47bddb,'text/html');if(_0x5e39dc){const _0x25a6bf=Array['from'](_0x1b0676['body']['childNodes']);_0x25a6bf['reverse']();for(const _0x4c1027 of _0x25a6bf){if(_0x4c1027['nodeType']==Node['ELEMENT_NODE'])break;_0x4c1027['remove']();}}const _0xf64f20=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x1b0676['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0xf64f20);const _0x317cb9=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x49cb2c=this['editor']['data']['toModel'](_0xf64f20);return _0x317cb9||_0x49cb2c['markers']['clear'](),this['editor']['data']['stringify'](_0x49cb2c);}['_normalizeResponseHeadings'](_0x44b16c){const _0xe2f9a3=new _0xcda2eb(this['editor']['editing']['view']['document']),_0x2284cd=new _0x55c53a({'name':/^h[1-5]$/}),_0x2963a3=[];let _0x2a81d2=!0x1;for(const _0x3f0b4d of _0x44b16c)_0x3f0b4d['is']('element')&&_0x2284cd['match'](_0x3f0b4d)&&(_0x2963a3['push'](_0x3f0b4d),'h1'==_0x3f0b4d['name']&&(_0x2a81d2=!0x0));if(_0x2a81d2){for(const _0x413ced of _0x2963a3)_0xe2f9a3['rename']('h'+(parseInt(_0x413ced['name'][0x1])+0x1),_0x413ced);}}_isH1TagSupportEnabled(){const {data:_0x4ee14c,editing:_0x25722a}=this['editor'],_0x5b9a13=_0x4ee14c['htmlProcessor']['toView']('<h1></h1>'),_0x12d54c=_0x4ee14c['toView'](_0x4ee14c['toModel'](_0x5b9a13));return!!_0x25722a['view']['domConverter']['viewToDom'](_0x12d54c)['querySelector']('h1');}_sanitizeHTML(_0x230840){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x230840),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x24eb91){const _0x3bfac3=_0x24eb91['trim']();return _0x3bfac3['startsWith']('```html')?_0x3bfac3['endsWith']('```')?_0x3bfac3['substring'](0x7,_0x3bfac3['length']-0x3):_0x3bfac3['substring'](0x7):_0x24eb91;}};const Gi={'REPLACE':'replace','INSERT':'insert'};var Fi=class extends _0x372a41{constructor(_0x176a66){super(_0x176a66),this['set']('isVisible',!0x1),this['set']('mainAction',Gi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x58a494=>Di(_0x176a66,'AI_'+_0x58a494['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Di(_0x176a66,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Di(_0x176a66,'Try\x20again')),this['stopButton']=this['_createButton'](Di(_0x176a66,'Stop'));const _0x473b20=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x473b20['if']('isVisible','ck-hidden',_0x4602a4=>!_0x4602a4)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x59ce00,_0x33da26){const _0x4ed849=new Mt(this['locale']);return _0x4ed849['set']({'label':_0x59ce00,'class':_0x33da26||'','isVisible':!0x0,'withText':!0x0}),_0x4ed849;}},Ki=class extends _0x3faf4e{contentFieldView;copyButtonView;constructor(_0xc8541d,_0x251afe=''){super(_0xc8541d),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x38af3c=this['bindTemplate'];this['contentFieldView']=new Wi(_0xc8541d,_0x251afe),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x38af3c['if']('isVisible','ck-hidden',_0x357e9f=>!_0x357e9f)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x38af3c['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 _0x3c552d=!0x1;this['on']('change:value',(_0x46694a,_0x4a7e18,_0x26c6f5)=>{const _0x51f6d5=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x26c6f5),this['isProcessing']&&_0x51f6d5&&!_0x3c552d&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x4f8472,_0xbf1b15,_0x1fb3ee)=>{_0x3c552d=!0x1,_0x1fb3ee?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x3c552d=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x3c552d=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x3aa03b=this['locale'],_0x1a9ad8=new Mt(this['locale']),_0x2df761='ck-ai-form__copy-button';return _0x1a9ad8['set']({'label':Di(_0x3aa03b,'Copy'),'icon':_0x3cbf87,'class':_0x2df761,'tooltip':!0x0}),_0x1a9ad8['bind']('isVisible')['to'](this,'value',_0x5e819e=>!!_0x5e819e),_0x1a9ad8['bind']('isEnabled')['to'](this,'isProcessing',_0x379053=>!_0x379053),_0x1a9ad8['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x1a9ad8['icon']=_0x884ad8,_0x1a9ad8['class']=_0x2df761+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x1a9ad8['icon']=_0x3cbf87,_0x1a9ad8['class']=_0x2df761;},0x3e8);}),_0x1a9ad8;}['_copyHTMLToClipboard'](_0x3391ea){const {window:_0x16bf3a,document:_0x3b8434}=wt;if(_0x16bf3a['ClipboardItem']){const {Blob:_0x27a7f3,ClipboardItem:_0x39b21d}=_0x16bf3a,_0x2bf901=[new _0x39b21d({'text/html':new _0x27a7f3([_0x3391ea['innerHTML']],{'type':'text/html'}),'text/plain':new _0x27a7f3([_0x3391ea['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x2bf901);}else{const _0x3ab183=_0x3b8434['createElement']('div');_0x3ab183['style']['position']='absolute',_0x3ab183['style']['left']='-9999px',_0x3ab183['innerHTML']='<span>[</span>'+_0x3391ea['innerHTML']+'<span>]</span>',_0x3b8434['body']['appendChild'](_0x3ab183);const _0x553001=_0x3b8434['createRange']();_0x553001['setStartAfter'](_0x3ab183['firstElementChild']),_0x553001['setEndBefore'](_0x3ab183['lastElementChild']);const _0x67480c=_0x16bf3a['getSelection']();_0x67480c['removeAllRanges'](),_0x67480c['addRange'](_0x553001),_0x3b8434['execCommand']('copy'),_0x3ab183['remove']();}}},Wi=class extends _0x3faf4e{constructor(_0x24a49d,_0x29205c=''){super(_0x24a49d),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x29205c,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x17df4e){this['element']['innerHTML']=_0x17df4e;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x2269b5=new _0x3faf4e(),_0x44a4bc=this['locale'],_0x41f735=new _0x4c01fe();return _0x41f735['isVisible']=!0x0,_0x2269b5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x41f735,{'text':Di(_0x44a4bc,'AI\x20is\x20writing...')}]}),_0x2269b5['render'](),_0x2269b5;}},Yi=class extends _0x3faf4e{constructor(_0x442657,_0x2c7110=''){super(_0x442657);const _0x368c1e=new $t(),_0x3d4a50=this['bindTemplate'];this['set']('text',_0x2c7110),_0x368c1e['content']=_0x485df8,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x368c1e,{'text':_0x3d4a50['to']('text')}]});}},$i=class extends Nt{submitButtonView;showHistoryButtonView;constructor(_0x1c6a94,_0x5686be){super(_0x1c6a94,_0x5686be),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',(_0x4c0c3d,_0x10dd68)=>{_0x4c0c3d['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x10dd68());});}_createSubmitButton(){const _0x4fd95c=new Mt(this['locale']),_0x1812b8=this['locale'];return _0x4fd95c['set']({'icon':nt,'label':Di(_0x1812b8,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x4fd95c['on']('execute',()=>{this['submit']();}),_0x4fd95c['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0xe59dd2,_0x304d9c)=>!_0xe59dd2&&_0x304d9c),_0x4fd95c;}_createShowHistoryButton(){const _0x10b0b7=new Mt(this['locale']),_0x312d87=this['resultsView'],_0x1fd038=this['locale'];_0x10b0b7['set']({'label':Di(_0x1fd038,'History'),'withText':!0x1,'icon':_0x36df57,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x10b0b7['bind']('isOn')['to'](_0x312d87,'isVisible'),_0x10b0b7['bind']('isEnabled')['to'](this,'isEnabled'),_0x10b0b7['on']('execute',()=>{_0x312d87['isVisible']=!_0x312d87['isVisible'],_0x312d87['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x55359f=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x352a25=new It(this['queryView']['fieldView']['element']),_0x13e3ea=_0x352a25['width'],_0xc3b41d='rtl'===_0x1fd038['uiLanguageDirection']?'left':'right';_0x352a25['excludeScrollbarsAndBorders'](),_0x10b0b7['element']['style'][_0xc3b41d]=_0x13e3ea-_0x352a25['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x55359f),this['on']('render',_0x55359f),_0x10b0b7;}submit(){const _0x40cdf7=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x40cdf7);}['focus'](_0x48191a){-0x1===_0x48191a?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},qi=class extends Jt{historyGroupView;clearHistoryButton;constructor(_0x5457a8){super(_0x5457a8),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Di(_0x5457a8,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x5c88c5=0x0;for(const _0x5bd263 of this['items'])_0x5c88c5+=_0x5bd263['items']['length'];return{'resultsCount':_0x5c88c5,'totalItemsCount':_0x5c88c5};}_createClearHistoryButton(){const _0x2d3251=this['locale'],_0x30b734=new Mt(this['locale']);return _0x30b734['set']({'label':'('+Di(_0x2d3251,'Clear')+')','withText':!0x0}),_0x30b734['on']('execute',()=>this['fire']('clearHistory')),_0x30b734;}},Qi=class extends jt{constructor(_0x212abc){super();const _0xd451c=new Dt(),_0xea35c7=new Mt(this['locale'],_0xd451c);this['children']['add'](_0xea35c7),_0xea35c7['set']({'label':_0x212abc['prompt'],'withText':!0x0}),_0xea35c7['on']('execute',()=>{this['fire']('execute',{'value':_0x2d4beb(_0x212abc['prompt'])});});}};const Xi='CKEditor/AIFormView/PromptHistory';var zi=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1f2875,_0x4926f8)=>{const _0x3a0c81=ji(_0x4926f8['prompt']);for(const _0x420ca5 of this)if(_0x420ca5!=_0x4926f8&&ji(_0x420ca5['prompt'])===_0x3a0c81){this['remove'](_0x420ca5);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x41cab4=sessionStorage['getItem'](Xi)||'[]';this['addMany'](JSON['parse'](_0x41cab4));}_saveToSessionStorage(){sessionStorage['setItem'](Xi,JSON['stringify'](this['map'](_0x1e102d=>_0x1e102d)));}};function ji(_0x290f29){return _0x290f29['toLowerCase']()['trim']();}var Ji=class extends _0x3faf4e{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x1613dc,_0x391b0a,_0x4382c0=''){super(_0x1613dc),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Gi['REPLACE']),this['_promptHistory']=new zi(),this['errorView']=new Yi(_0x1613dc),this['contentArea']=new Ki(_0x1613dc,_0x4382c0),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 _t(),this['keystrokes']=new gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ft({'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 _0xf8a903=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x391b0a],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xf8a903['if']('isError','ck-hidden',_0x26ad62=>!_0x26ad62)]},'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'](_0xe33b2e=0x1){-0x1===_0xe33b2e?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 _0x5a2f5a=this['locale'],_0x514ec9=new $i(_0x5a2f5a,{'queryView':{'label':Di(_0x5a2f5a,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x5085d5,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Di(_0x5a2f5a,'Empty\x20history'),'secondary':Di(_0x5a2f5a,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x514ec9['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2bb244,_0x44c1ef)=>_0x2bb244&&!_0x44c1ef),this['listenTo'](_0x514ec9,'submit',(_0x2a23e4,_0x223815)=>{this['prompt']=_0x223815;const _0x12292e=_0x1bdee6(_0x223815);this['fire']('submitPrompt',_0x12292e),_0x223815['trim']()&&this['_promptHistory']['add']({'prompt':_0x12292e},0x0);},{'priority':'high'}),_0x514ec9;}_createHistoryView(){const _0x4e9a7b=new qi(this['locale']);return _0x4e9a7b['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Qi),_0x4e9a7b['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x4e9a7b;}_createToolbar(){const _0x26e60e=new Fi(this['locale']);return _0x26e60e['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3f6987,_0x13925e,_0x1e377d)=>_0x3f6987&&!_0x13925e&&!!_0x1e377d),_0x26e60e['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x26e60e['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3d54e6,_0x17989a,_0x4de155)=>_0x3d54e6&&!_0x17989a&&!!_0x4de155),_0x26e60e['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x26e60e['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x869b55,_0x4319b1)=>_0x869b55&&!_0x4319b1),_0x26e60e['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x26e60e['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x26e60e['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x26e60e;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x1c0e8d=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Di(_0x1c0e8d,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x2df983){const _0x51f749=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x2df983||Di(_0x51f749,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Zi=globalThis['DataTransfer'];var ts=class extends _0x3e375b{['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[_0x277cd3,xi,Li,Ut];}constructor(_0x21b240){super(_0x21b240),_0x21b240['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x21b240['config']['define']('ai.assistant.contentAreaCssClass',''),_0x21b240['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x21b240['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x2ec437}=this;this['_aiAdapter']=_0x2ec437['plugins']['get'](Li),this['_dialog']=_0x2ec437['plugins']['get'](Ut),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x225e85=new Hi(_0x2ec437,Array['from'](this['_commandDefinitions']['values']()));_0x2ec437['commands']['add']('showAIAssistant',_0x225e85),_0x2ec437['ui']['componentFactory']['add']('aiCommands',_0x1199de=>{const _0x256b3e=_0x48d908(_0x1199de);return _0x256b3e['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x256b3e['buttonView']['set']({'label':Di(_0x1199de,'AI\x20Commands'),'icon':_0xd68b96,'tooltip':!0x0}),_0x256b3e['on']('execute',_0x4a89c3=>this['_onExecute'](_0x4a89c3['source']['id'])),_0x5b95fa(_0x256b3e,_0x2ec437['ui']['view']['body'],function(_0x508f88){const _0x39aa89=is(_0x508f88,ki(_0x508f88['config']['get']('ai.assistant.commands'),_0x508f88['locale']))['filter'](_0x3727b2=>_0x3727b2['commands']['length']);return 0x1===_0x39aa89['length']?is(_0x508f88,_0x39aa89[0x0]['commands'])['map'](_0x370ef5=>({'id':_0x370ef5['id'],'label':_0x370ef5['label']})):_0x39aa89['map'](_0x3acbd6=>{const {groupId:_0x56cf7a,groupLabel:_0x54ee83,commands:_0x3cb31d}=_0x3acbd6,_0x262965=is(_0x508f88,_0x3cb31d)['map'](_0x3ad992=>({'id':_0x3ad992['id'],'label':_0x3ad992['label']}));return{'id':_0x56cf7a,'menu':_0x54ee83||_0x56cf7a,'children':_0x262965};});}(_0x2ec437),{'ariaLabel':Di(_0x1199de,'AI\x20Commands')}),_0x256b3e['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x225e85['on']('change:enabledCommandsIds',_0x4d14f4),_0x256b3e['menuView']['once']('render',_0x4d14f4),_0x256b3e;function _0x4d14f4(){_0x256b3e['isEnabled']=_0x225e85['enabledCommandsIds']['length']>0x0;for(const _0x4259c3 of _0x256b3e['menuView']['buttons'])_0x4259c3['isEnabled']=_0x225e85['enabledCommandsIds']['includes'](_0x4259c3['id']);}}),_0x2ec437['ui']['componentFactory']['add']('menuBar:aiCommands',_0x53f1eb=>{const _0x3b5225=new _0x1b3951(_0x53f1eb);_0x3b5225['buttonView']['set']({'label':Di(_0x53f1eb,'AI\x20Commands'),'icon':_0xd68b96}),_0x3b5225['bind']('isEnabled')['to'](_0x225e85,'enabledCommandsIds',_0x17b47c=>_0x17b47c['length']>0x0);const _0x5dcc59=ki(_0x2ec437['config']['get']('ai.assistant.commands'),_0x53f1eb);return this['_populateMenuBarMenu'](_0x225e85,_0x3b5225,_0x5dcc59,_0x3e9a4f=>this['_onExecute'](_0x3e9a4f)),_0x3b5225;}),_0x2ec437['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x20b58=this['_createAIAssistantUIButton'](Mt);return _0x20b58['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x20b58;}),_0x2ec437['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x5c930b=this['_createAIAssistantUIButton'](Zt);return _0x5c930b['set']({'role':'menuitemcheckbox'}),_0x5c930b;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x49c957=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1e3657;for(const _0x1891bd in _0x49c957){const _0x29dbef=_0x1891bd,_0x353823=_0x49c957[_0x29dbef];if('aiLicenseKeyValid'==_0x353823||'aiLicenseKeyInvalid'==_0x353823||'aiLicenseKeyExpired'==_0x353823||'aiLicenseKeyDomainLimit'==_0x353823||'aiLicenseKeyNotAllowed'==_0x353823||'aiLicenseKeyEvaluationLimit'==_0x353823||'aiLicenseKeyUsageLimit'==_0x353823){delete _0x49c957[_0x29dbef],_0x1e3657=_0x353823,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1e3657&&_0x49c957['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1e3657&&_0x49c957['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1e3657&&_0x49c957['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1e3657&&_0x49c957['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1e3657&&_0x49c957['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1e3657&&_0x49c957['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x326148='',_0x2e0d5c='',_0x4bec01='custom'){const _0x1748a6=this['editor'],_0x41ac8c=_0x1748a6['editing']['view'],_0xbfca4e=_0x1748a6['plugins']['get'](xi),_0x24ec41=_0x1748a6['plugins']['get'](_0x277cd3);_0xbfca4e['showFakeVisualSelection']();const _0x3792c7=new Zi(),_0x1dc054=new ClipboardEvent('copy',{'clipboardData':_0x3792c7}),_0x34f081=new _0x56cd34(_0x3792c7),_0x28ccc7=new _0x18b9ad(_0x41ac8c,_0x1dc054,{'dataTransfer':_0x34f081});_0x24ec41['_forceMarkersCopy']('comment',()=>{_0x41ac8c['document']['fire']('copy',_0x28ccc7);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Bi(_0x1748a6,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x1e3145=_0x34f081['getData']('text/html');const _0x1b65d6=_0x1748a6['model']['document']['selection'],_0x580e94=Array['from'](_0x1b65d6['getRanges']());0x1===_0x580e94['length']&&_0x580e94[0x0]['isFlat']&&!_0x1b65d6['getSelectedElement']()&&''!==_0x1e3145['replace'](/ /g,'')['trim']()&&(_0x1e3145='<p>'+_0x1e3145+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x4bec01,'query':_0x326148,'htmlContent':_0x1e3145,'label':_0x2e0d5c,'mainActionLabel':Gi[_0x1748a6['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x2472d5,'title':Di(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0xbfca4e['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x28ca33=new Map(),_0x4899a7=ki(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x938238 of _0x4899a7)for(const _0x5b6056 of _0x938238['commands'])_0x28ca33['set'](_0x5b6056['id'],{..._0x5b6056,'groupId':_0x938238['groupId'],'groupLabel':_0x938238['groupLabel']||_0x938238['groupId']});return _0x28ca33;}_createAIAssistantUIButton(_0x37df50){const _0x4a06bb=this['editor'],_0x5a6c9a=_0x4a06bb['commands']['get']('showAIAssistant'),_0x1fe484=new _0x37df50(_0x4a06bb['locale']);return _0x1fe484['set']({'label':Di(_0x4a06bb['locale'],'AI\x20Assistant'),'icon':_0x2472d5,'isToggleable':!0x0}),_0x1fe484['bind']('isEnabled')['to'](_0x5a6c9a),_0x1fe484['bind']('isOn')['to'](this['_dialog'],'id',_0x15b041=>'aiAssistant'===_0x15b041),this['listenTo'](_0x1fe484,'execute',()=>{_0x1fe484['isOn']?this['hideUI']():_0x5a6c9a['execute']();}),_0x1fe484;}_initView(){const _0xcbe84b=this['editor']['plugins']['get'](xi);this['_formView']=new Ji(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',()=>{_0xcbe84b['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0xcbe84b['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x43bc91,ui:{ariaLiveAnnouncer:_0x5910c7}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x3b7108,_0x1b9317,_0x1a8101)=>{const _0x488bbc=this['_aiAssistantController']['currentContext'];_0x1a8101?_0x5910c7['announce'](Di(_0x43bc91,'AI\x20is\x20writing')):_0x488bbc&&_0x5910c7['announce'](Di(_0x43bc91,'Generated\x20content:\x20%0',_0x488bbc),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x5eda26,_0x537166,_0x2aa108)=>{if(_0x2aa108){const _0x14f4b6=this['_formView']['errorView']['text'];_0x5910c7['announce'](Di(_0x43bc91,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x14f4b6));}});}_onExecute(_0x429206){const _0x1a009c=this['_commandDefinitions']['get'](_0x429206),_0x60f415=this['editor'],_0x45be80=_0x60f415['model']['document']['selection'],_0x1fdb5f=_0x60f415['commands']['get']('showAIAssistant'),_0x4e0248=_0x60f415['plugins']['get'](xi),_0x405a63=''+('_ungrouppedCommands'!==_0x1a009c['groupId']?_0x1a009c['groupLabel']+':\x20':'')+_0x1a009c['label'];if(!0x1!==_0x1a009c['requiresContent']&&_0x45be80['isCollapsed']){const _0x5c2047=mt(_0x45be80['getSelectedBlocks']())||_0x60f415['model']['schema']['getLimitElement'](_0x45be80);_0x60f415['model']['change'](_0x5d022c=>{_0x5d022c['setSelection'](_0x5c2047,'in');});}_0x4e0248['showFakeVisualSelection'](),_0x1fdb5f['execute'](_0x1a009c['prompt'],_0x405a63,'command:'+_0x429206);}_populateMenuBarMenu(_0x4510cf,_0x5903c4,_0x41cd35,_0xbcaf18){const _0x350e9e=this['editor'],_0x433cc1=_0x350e9e['locale'],_0x231e88=new _0x35c22f(_0x433cc1),_0x89848a=is(_0x350e9e,_0x41cd35)['filter'](_0x26f7c4=>_0x26f7c4['commands']['length']);0x1===_0x89848a['length']?this['_getMenuBarGroupButtons']({'command':_0x4510cf,'commands':_0x89848a[0x0]['commands'],'parentMenuView':_0x5903c4,'onExecute':_0xbcaf18})['forEach'](_0x15e661=>_0x231e88['items']['add'](_0x15e661)):_0x89848a['forEach'](({groupId:_0x45c5b6,groupLabel:_0x3837eb,commands:_0x198f99})=>{const _0x499019=new te(_0x433cc1,_0x5903c4),_0x9035a3=new _0x1b3951(_0x433cc1),_0x40baf9=new _0x35c22f(_0x433cc1),_0x3029fa=this['_getMenuBarGroupButtons']({'command':_0x4510cf,'commands':_0x198f99,'parentMenuView':_0x9035a3,'onExecute':_0xbcaf18});_0x9035a3['buttonView']['set']({'label':_0x3837eb||_0x45c5b6}),_0x9035a3['delegate']('execute')['to'](_0x5903c4),_0x40baf9['items']['addMany'](_0x3029fa),_0x9035a3['panelView']['children']['add'](_0x40baf9),_0x499019['children']['add'](_0x9035a3),_0x231e88['items']['add'](_0x499019);}),_0x5903c4['panelView']['children']['add'](_0x231e88);}_getMenuBarGroupButtons({command:_0x1c3a08,commands:_0x1019af,parentMenuView:_0x263264,onExecute:_0x21ef66}){const _0x2cda9f=this['editor'],_0x3fbdb7=_0x2cda9f['locale'];return is(_0x2cda9f,_0x1019af)['map'](_0x2bd43e=>{const _0x1f48bd=new te(_0x3fbdb7,_0x263264),_0x2507a0=new Zt(_0x3fbdb7);return _0x2507a0['set']({'label':_0x2bd43e['label']}),_0x2507a0['delegate']('execute')['to'](_0x263264),_0x2507a0['on']('execute',()=>_0x21ef66(_0x2bd43e['id'])),_0x2507a0['bind']('isEnabled')['to'](_0x1c3a08,'enabledCommandsIds',_0x5b1600=>_0x5b1600['includes'](_0x2bd43e['id'])),_0x1f48bd['children']['add'](_0x2507a0),_0x1f48bd;});}};function es(_0xd21b2b,_0x2f267e){return void 0x0!==_0xd21b2b['order']&&void 0x0===_0x2f267e['order']?0x1:void 0x0===_0xd21b2b['order']&&void 0x0!==_0x2f267e['order']?-0x1:void 0x0!==_0xd21b2b['order']&&void 0x0!==_0x2f267e['order']?_0xd21b2b['order']-_0x2f267e['order']:0x0;}function is(_0x5e4d0e,_0x3bed63){_0x3bed63['sort'](es);const _0xe12f00={},_0x48b092=[];for(const _0x5d1342 of _0x3bed63)if(void 0x0!==_0x5d1342['order']){if(_0x5d1342['order']in _0xe12f00)throw new ct('ai-commands-config-order-collision',_0x5e4d0e,{'conflictingDefinitions':[_0x5d1342,_0xe12f00[_0x5d1342['order']]]});_0xe12f00[_0x5d1342['order']]=_0x5d1342,_0x48b092['splice'](_0x5d1342['order'],0x0,_0x5d1342);}else _0x48b092['push'](_0x5d1342);return _0x48b092;}var ss=class extends _0x3e375b{static get requires(){return[ts,xi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x37eb14){super(_0x37eb14);const _0xd18f50=_0x37eb14['config'],_0x5e030a=_0x37eb14['locale'];_0xd18f50['define']('ai.assistant.preserveComments',!0x0),_0xd18f50['define']('ai.assistant.commands',ns(_0x5e030a)),_0xd18f50['define']('ai.assistant.extraCommandGroups',[]),_0xd18f50['define']('ai.assistant.removeCommands',[]);let _0x2ab779=ki(_0xd18f50['get']('ai.assistant.commands'),_0x5e030a);const _0x2d52e2=_0xd18f50['get']('ai.assistant.extraCommandGroups'),_0x48c69c=_0xd18f50['get']('ai.assistant.removeCommands');_0x2d52e2['forEach'](_0x5f470e=>{const _0x3a42f7=_0x2ab779['find'](_0x583422=>_0x583422['groupId']===_0x5f470e['groupId']);_0x3a42f7?_0x3a42f7['commands']=_0x3a42f7['commands']['concat'](_0x5f470e['commands']):_0x2ab779['push'](_0x5f470e);}),_0x2ab779=_0x2ab779['filter'](_0x2a1a4b=>!_0x48c69c['includes'](_0x2a1a4b['groupId'])),_0x2ab779['forEach'](_0x16e220=>{_0x16e220['commands']=_0x16e220['commands']['filter'](_0x2b7f1f=>!_0x48c69c['includes'](_0x2b7f1f['id']));}),_0xd18f50['set']('ai.assistant.commands',_0x2ab779);}};function ns(_0x181b79){return[{'groupId':'editOrReview','groupLabel':Di(_0x181b79,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Di(_0x181b79,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Di(_0x181b79,'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':Di(_0x181b79,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Di(_0x181b79,'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':Di(_0x181b79,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Di(_0x181b79,'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':Di(_0x181b79,'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':Di(_0x181b79,'Change\x20tone'),'commands':[{'id':'professional','label':Di(_0x181b79,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Di(_0x181b79,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Di(_0x181b79,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Di(_0x181b79,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Di(_0x181b79,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Di(_0x181b79,'Change\x20style'),'commands':[{'id':'business','label':Di(_0x181b79,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Di(_0x181b79,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Di(_0x181b79,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Di(_0x181b79,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Di(_0x181b79,'Translate'),'commands':[{'id':'translateEnglish','label':Di(_0x181b79,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Di(_0x181b79,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Di(_0x181b79,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Di(_0x181b79,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Di(_0x181b79,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Di(_0x181b79,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Di(_0x181b79,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Di(_0x181b79,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var rs=class extends _0x3e375b{abortController;static get requires(){return[Li];}constructor(_0xc50958){super(_0xc50958),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Li)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x1c84a6){return this['sendRequest'](_0x1c84a6)['catch'](_0x2c53ef=>{if(_0x2c53ef instanceof Pi)return Promise['reject'](_0x2c53ef);if('AbortError'==_0x2c53ef['name'])return Promise['resolve']();throw console['error'](_0x2c53ef),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x470890,_0x134f87){const _0x52c719=this['editor']['locale'],_0xa53b4f={'Content-Type':'application/json'};if('object'==typeof _0x470890)Object['assign'](_0xa53b4f,_0x470890);else{if(_0x470890)try{const _0x1b52ac=await _0x470890(_0x134f87);Object['assign'](_0xa53b4f,_0x1b52ac);}catch{return Promise['reject'](new Pi(Di(_0x52c719,'AI_ERROR_GET_HEADERS')));}}return _0xa53b4f;}async _prepareRequestParameters(_0x37e7a5,_0x5d5b2e){const _0x49d6de=this['editor']['locale'];if('object'==typeof _0x37e7a5)return _0x37e7a5;try{return await _0x37e7a5(_0x5d5b2e);}catch{return Promise['reject'](new Pi(Di(_0x49d6de,'AI_ERROR_GET_PARAMETERS')));}}},os=class extends rs{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x51a2bb){super(_0x51a2bb),_0x51a2bb['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x51a2bb['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x51a2bb['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x51a2bb['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x51a2bb['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x51a2bb['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x32c21d,context:_0x1fa96b,onData:_0x1cee60,actionId:_0x23e998}){const _0x2edefa=this['editor']['locale'],_0x1e2aaf=await this['prepareMessages'](_0x32c21d,_0x1fa96b,_0x23e998),_0x2d3570=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x23e998),_0x2eb0bf=await this['_prepareRequestParameters'](this['_requestParameters'],_0x23e998),_0x42988f={'messages':_0x1e2aaf,..._0x2eb0bf},_0x101cbe={'method':'POST','headers':_0x2d3570,'body':JSON['stringify'](_0x42988f),'signal':this['abortController']['signal']},_0x38cdbf=await fetch(this['_apiUrl'],_0x101cbe);if(_0x38cdbf['ok'])return _0x2eb0bf['stream']?await this['_readStreamableResponse'](_0x38cdbf,_0x1cee60):await this['_readStaticResponse'](_0x38cdbf,_0x1cee60),Promise['resolve']();{const _0x54824c=await _0x38cdbf['text']();return _0x54824c['includes']('context_length_exceeded')?Promise['reject'](new Pi(Di(_0x2edefa,'AI_ERROR_CONTEXT_LENGTH'))):_0x54824c['includes']('Moderation')?Promise['reject'](new Pi(Di(_0x2edefa,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x54824c));}}async['prepareMessages'](_0x4f9c88,_0x4913bf,_0x18c0ac){let _0x1beca6,_0x853cb5;return _0x4913bf?(_0x1beca6='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.',_0x853cb5='Instruction:\x0a'+_0x4f9c88+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x4913bf):(_0x1beca6='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.',_0x853cb5=_0x4f9c88),[{'role':'system','content':_0x1beca6},{'role':'user','content':_0x853cb5}];}async _readStreamableResponse(_0x57716d,_0x108655){const _0x22d418=_0x57716d['body']['getReader'](),_0x22937e=new TextDecoder();let _0x2c0960='',_0x16d69a='',_0x104e0b='',_0x4de3fa=!0x1;for(;!_0x4de3fa;){const {done:_0x51bdcf,value:_0x17213c}=await _0x22d418['read'](),_0x5e202c=_0x2c0960+_0x22937e['decode'](_0x17213c);let _0x3b0daf;_0x4de3fa=_0x51bdcf;try{_0x3b0daf=this['_cleanUpData'](_0x5e202c),_0x2c0960='';}catch{_0x2c0960=_0x5e202c;continue;}_0x16d69a+=_0x3b0daf,!_0x4de3fa&&this['_isBufferIncomplete'](_0x16d69a)||_0x16d69a&&(_0x104e0b+=_0x16d69a,_0x16d69a='',_0x108655(_0x104e0b));}return Promise['resolve']();}async _readStaticResponse(_0x34c52d,_0x5a8128){return _0x5a8128((await _0x34c52d['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x2f703a){const _0x41053f=_0x2f703a['split']('<')['length']!==_0x2f703a['split']('>')['length'],_0x16d34=_0x2f703a['length']<0x1e;return _0x41053f&&_0x16d34;}_cleanUpData(_0x1dd0e2){return _0x1dd0e2['split'](/\n(?![^{]*\})/g)['map'](_0x92eefc=>_0x92eefc['replace']('data:\x20',''))['filter'](_0x5849d9=>_0x5849d9&&_0x5849d9['length']>0x0&&'[DONE]'!==_0x5849d9)['map'](_0x25ea0c=>{const {choices:_0x34d4f3}=JSON['parse'](_0x25ea0c);if(_0x34d4f3[0x0]?.['delta']?.['content'])return _0x34d4f3[0x0]['delta']['content'];})['filter'](_0x42f4c5=>_0x42f4c5)['join']('');}},as=class extends rs{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),St('ai-aws-adapter-not-supported');}async sendRequest(_0x1a6ea5){throw bt('ai-aws-adapter-not-supported'),new Pi(Di(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},hs=class extends Mt{constructor(_0x4463f4,_0x13f6f5={}){super(_0x4463f4),this['isToggleable']=!0x0,this['set']('side',_0x13f6f5['side']||'top');const _0x3e3fcc=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...vt(_0x13f6f5['class']||[]),_0x3e3fcc['to']('side',_0xb7a7f9=>'ck-tab-button_'+_0xb7a7f9),_0x3e3fcc['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},cs=class extends _0x3faf4e{['children'];constructor(_0xd0708f,_0x5157b7={}){super(_0xd0708f);const _0x1dbe2f=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...vt(_0x5157b7['class']||[]),_0x1dbe2f['to']('class'),_0x1dbe2f['if']('isVisible','ck-hidden',_0x511027=>!_0x511027)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ls=class extends _0x3faf4e{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x1fb919,_0x4e5592={}){super(_0x1fb919),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x4e5592['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x4e5592['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x392edb,_0x4cae56)=>_0x392edb&&!_0x4cae56);const _0x292236=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...vt(_0x4e5592['class']||[]),_0x292236['to']('side',_0x156456=>'ck-tabs_'+_0x156456),_0x292236['to']('class'),_0x292236['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x292236['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x292236['to']('side',_0x334db4=>'ck-tabs__buttons-container_'+_0x334db4)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x292236['to']('side',_0x52de6f=>'ck-tabs__panels-container_'+_0x52de6f)]},'children':this['panelViews']},...vt(_0x4e5592['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0xc81696){const _0x3ecd34=this['_tabs']['get'](_0xc81696);return _0x3ecd34||null;}['addTab'](_0x123afa){const _0x430fcd=this['_setupButton']({'id':_0x123afa['id'],'label':_0x123afa['buttonLabel'],'icon':_0x123afa['buttonIcon'],'order':_0x123afa['order']}),_0x671b92=new cs(this['locale']);return _0x671b92['render'](),_0x123afa['content']&&_0x671b92['children']['add'](_0x123afa['content']),this['panelViews']['add'](_0x671b92),this['_tabs']['set'](_0x123afa['id'],{'button':_0x430fcd,'panel':_0x671b92,'order':void 0x0!==_0x123afa['order']?_0x123afa['order']:null}),this['fire']('addTab:'+_0x123afa['id'],{'id':_0x123afa['id'],'button':_0x430fcd,'panel':_0x671b92}),null===this['activeTab']?this['activateTab'](_0x123afa['id']):this['_hidePanel'](_0x123afa['id']),{'button':_0x430fcd,'panel':_0x671b92};}activateTab(_0x45f1c0){if(null!==_0x45f1c0&&!this['getTab'](_0x45f1c0))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x45f1c0});if(this['isCollapsed']=!0x1,this['activeTab']===_0x45f1c0)return;const _0x101a79=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x45f1c0,_0x45f1c0&&this['_showPanel'](_0x45f1c0),this['fire']('activateTab:'+_0x45f1c0,{'newTab':_0x45f1c0,'oldTab':_0x101a79});}toggleTabPanel(_0x37672f){this['activeTab']===_0x37672f?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x37672f);}['showTab'](_0x1d47f6){if(!this['getTab'](_0x1d47f6))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1d47f6});this['_showPanel'](_0x1d47f6),this['_showButton'](_0x1d47f6),this['fire']('show:'+_0x1d47f6,_0x1d47f6);}['hideTab'](_0x4942dc){if(!this['getTab'](_0x4942dc))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4942dc});const _0xc556d5=this['activeTab'];this['_hidePanel'](_0x4942dc),this['_hideButton'](_0x4942dc);const _0x775122=this['getTabIds']();_0xc556d5===_0x4942dc&&_0x775122['length']>0x1&&this['activateTab'](_0x775122['find'](_0xa7f4d9=>_0xa7f4d9!==_0x4942dc)),this['fire']('hide:'+_0x4942dc,_0x4942dc);}_getPanel(_0x4ab8c6){const _0x3ee8ff=this['_tabs']['get'](_0x4ab8c6);return _0x3ee8ff?_0x3ee8ff['panel']:null;}['_showPanel'](_0x1d3eba){null!==this['activeTab']&&this['activeTab']!==_0x1d3eba||this['_getPanel'](_0x1d3eba)['show']();}['_hidePanel'](_0x401dfb){const _0x382fdb=this['_getPanel'](_0x401dfb);_0x382fdb['isVisible']&&(this['activeTab']===_0x401dfb&&(this['activeTab']=null),_0x382fdb['hide']());}_getButton(_0x2741e6){const _0x597b8a=this['_tabs']['get'](_0x2741e6);return _0x597b8a?_0x597b8a['button']:null;}_showButton(_0x530b8d){this['_getButton'](_0x530b8d)['show']();}_hideButton(_0x534f48){this['_getButton'](_0x534f48)['hide']();}_setupButton(_0x226744){const _0x568080=new hs(this['locale'],{'side':this['side']}),_0x76516b=this['buttonViews'];if(_0x568080['set']({'label':_0x226744['label'],'icon':_0x226744['icon'],'tooltip':!0x0,'withText':!0x0}),_0x568080['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x26a0be,_0x1529d6)=>_0x26a0be===_0x226744['id']&&!_0x1529d6),_0x568080['bind']('side')['to'](this,'side'),_0x226744['order']){const _0x1c5e22=[...this['_tabs']]['reduce']((_0x419268,_0x5fb11e)=>{const _0x40f005=_0x5fb11e[0x0],{order:_0x1b793d}=_0x5fb11e[0x1];return!_0x1b793d||_0x1b793d>_0x226744['order']?_0x419268:_0x1b793d>=_0x419268['order']?{'id':_0x40f005,'order':_0x1b793d}:_0x419268;},{'id':'','order':0x0}),_0x49fd72=_0x76516b['getIndex'](this['_getButton'](_0x1c5e22['id']));_0x76516b['add'](_0x568080,_0x49fd72+0x1);}else _0x76516b['add'](_0x568080);return _0x568080['on']('execute',()=>{this['toggleTabPanel'](_0x226744['id']);}),_0x568080;}};const us=['overlay','sidebar','custom'],ds=['left','right'];var _s=class extends ls{constructor(_0x20a8f6,_0x27c4ee={}){super(_0x20a8f6,_0x27c4ee),this['set']('type',_0x27c4ee['type']||'sidebar'),this['set']('side',_0x27c4ee['side']||'right'),this['set']('isVisible',_0x27c4ee['visibleByDefault']??!0x0);const _0x4414ac=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x4414ac['if']('type','ck-ai-tabs__overlay',_0x7f3005=>'overlay'===_0x7f3005),_0x4414ac['if']('type','ck-ai-tabs__sidebar',_0xc74da7=>'sidebar'===_0xc74da7),_0x4414ac['if']('isVisible','ck-hidden',_0x55a75b=>!_0x55a75b)]}}),this['buttonViews']['on']('add',(_0x3ad52d,_0x4fe008)=>{_0x4fe008['set']('withText',!0x1);});}},gs=class extends _0x2b8fcb{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x42328e){if(super(_0x42328e),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x57a8e9=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x57a8e9['showResizeButton']&&(this['showResizeButton']=_0x57a8e9['showResizeButton']),'sidebar'!==_0x57a8e9['type']&&'overlay'!==_0x57a8e9['type']||_0x57a8e9['side']&&(this['side']=_0x57a8e9['side']),'sidebar'===_0x57a8e9['type']){if(this['container']=_0x57a8e9['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x57a8e9['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new _s(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x57a8e9['visibleByDefault'],'collapsible':_0x57a8e9['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 _0x5d4fbe&&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(_0x5355d3){if(_0x5355d3&&this['type']!==_0x5355d3){if(!us['includes'](_0x5355d3))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x5355d3;}}switchSide(_0x2a1871){if(_0x2a1871&&this['side']!==_0x2a1871){if(!ds['includes'](_0x2a1871))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x2a1871;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function As(_0xe1066e){return{..._0xe1066e,'type':'context'};}var Is=class extends _0x2b8fcb{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x23f73e];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x360950){if(super(_0x360950),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x302732=this['context']['plugins']['get'](_0x23f73e);if(!_0x302732['token'])throw new ct('ai-missing-token',this);this['_token']=_0x302732['token'];}_getExtraHttpHeaders(){const _0x16e8dc=this['context']['config']['get']('ai.extraHttpHeaders'),_0xd3e850='function'==typeof _0x16e8dc?_0x16e8dc():_0x16e8dc;if(Array['isArray'](_0xd3e850)&&_0xd3e850['length'])return Object['fromEntries'](_0xd3e850['map'](({domain:_0x1c873f,headers:_0x4af7f3})=>[_0x1c873f,_0x4af7f3]));}startConversation(_0x5b01e5,_0x56adeb){const _0x22d673=this['_sendApiRequest']('/conversations','POST',{'id':_0x5b01e5,'group':_0x56adeb});return{'getConversation':async()=>(await _0x22d673['request'])['json'](),'abortController':_0x22d673['abortController']};}queryAssistant({message:_0x199ddf,conversationId:_0x347c36,parts:_0x4f45f1,capabilities:_0x4f56e7,model:_0x51df0d,attributes:_0x3658e7}){const _0x5ee87b=this['_getExtraHttpHeaders'](),_0xa697b0={..._0x199ddf&&{'prompt':_0x199ddf},'content':_0x4f45f1,'model':_0x51df0d,..._0x4f56e7&&{'capabilities':_0x4f56e7},..._0x3658e7&&{'attributes':_0x3658e7},..._0x5ee87b&&{'extraHttpHeaders':_0x5ee87b}},_0x316873=this['_sendApiRequest']('/conversations/'+_0x347c36+'/messages','POST',_0xa697b0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2642b6=(await _0x316873['request'])['body'];return this['_getStreamReader'](_0x2642b6);},'abortController':_0x316873['abortController']};}executeCustomAction({content:_0x2488bc,message:_0x23d44f,model:_0x393b6a,outputFormat:_0xeda15c,contexts:_0xde69f5}){const _0x1d7b31={'content':[{'type':'text','content':_0x2488bc}],..._0x23d44f&&{'prompt':_0x23d44f},'model':_0x393b6a,'outputFormat':_0xeda15c,...ps(_0xde69f5)},_0x20b703=this['_sendApiRequest']('/actions/custom/calls','POST',_0x1d7b31);return{'getStream':async()=>{const _0x8e6795=(await _0x20b703['request'])['body'];return this['_getStreamReader'](_0x8e6795);},'abortController':_0x20b703['abortController']};}executeAction({actionName:_0x19a2d5,content:_0x159420,args:_0x4c83d9,contexts:_0xdd677d}){const _0x159fa9={'content':[{'type':'text','content':_0x159420}],'args':_0x4c83d9,...ps(_0xdd677d)},_0x568a02=this['_sendApiRequest']('/actions/system/'+_0x19a2d5+'/calls','POST',_0x159fa9);return{'getStream':async()=>{const _0x36f134=(await _0x568a02['request'])['body'];return this['_getStreamReader'](_0x36f134);},'abortController':_0x568a02['abortController']};}['uploadFile'](_0x2effa0,_0x48f798,_0x294e93){const _0x288a4f=new FormData();_0x288a4f['append']('file',_0x48f798,_0x48f798['name']),_0x294e93&&_0x288a4f['append']('attributes',JSON['stringify'](_0x294e93));const _0x4f3eef=this['_sendApiRequest']('/conversations/'+_0x2effa0+'/files','POST',_0x288a4f);return{'getId':async()=>(await _0x4f3eef['request'])['json'](),'abortController':_0x4f3eef['abortController']};}uploadDocuments(_0x106793,_0x262e7d){const _0x5ccf16={'documents':_0x262e7d['map'](_0x242289=>({'content':_0x242289['content'],'attributes':{'version':_0x242289['version'],'sessionId':_0x242289['sessionId'],'channelId':_0x242289['channelId'],'rootName':_0x242289['rootName'],'selections':_0x242289['selections']},...void 0x0!==_0x242289['name']?{'name':_0x242289['name']}:{},...void 0x0!==_0x242289['description']?{'description':_0x242289['description']}:{}}))},_0x6ec9d6=this['_sendApiRequest']('/conversations/'+_0x106793+'/documents/batch','POST',_0x5ccf16);return{'getIds':async()=>(await _0x6ec9d6['request'])['json'](),'abortController':_0x6ec9d6['abortController']};}fetchDocuments(_0x18211d,_0xb10a43){const _0x328fe3=new URLSearchParams();_0x328fe3['append']('documentIds',_0xb10a43['join'](','));const _0x238d3a=this['_sendApiRequest']('/conversations/'+_0x18211d+'/documents/batch?'+_0x328fe3['toString'](),'GET');return{'getDocuments':async()=>(await _0x238d3a['request'])['json'](),'abortController':_0x238d3a['abortController']};}fetchConversations(_0x49d35c,_0x2bd4e3={}){const _0x769115=new URLSearchParams();_0x769115['append']('group',_0x49d35c),_0x769115['append']('excludeEmpty',!0x1!==_0x2bd4e3['excludeEmpty']?'true':'false'),_0x769115['append']('limit',_0x2bd4e3['limit']?_0x2bd4e3['limit']['toString']():0x64['toString']()),_0x769115['append']('sortBy',_0x2bd4e3['sortBy']?_0x2bd4e3['sortBy']:'createdAt'),_0x769115['append']('order',_0x2bd4e3['order']?_0x2bd4e3['order']:'desc');const _0x44784b=this['_sendApiRequest']('/conversations?'+_0x769115['toString'](),'GET');return{'getConversations':async()=>(await(await _0x44784b['request'])['json']())['items'],'abortController':_0x44784b['abortController']};}deleteConversation(_0x1c14fb){const _0x5282d3=this['_sendApiRequest']('/conversations/'+_0x1c14fb,'DELETE');return{'execute':async()=>{await _0x5282d3['request'];},'abortController':_0x5282d3['abortController']};}updateConversation(_0x4c8ba3,_0x1a3366){const _0x4d2270=this['_sendApiRequest']('/conversations/'+_0x4c8ba3,'PATCH',_0x1a3366);return{'getResult':async()=>(await _0x4d2270['request'],_0x1a3366),'abortController':_0x4d2270['abortController']};}fetchConversation(_0xe1c675){const _0x4991cc=this['_sendApiRequest']('/conversations/'+_0xe1c675,'GET');return{'getConversation':async()=>(await _0x4991cc['request'])['json'](),'abortController':_0x4991cc['abortController']};}fetchConversationMessages(_0x1a640c){const _0xf4f79=this['_sendApiRequest']('/conversations/'+_0x1a640c+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0xf4f79['request'])['json']())['items'],'abortController':_0xf4f79['abortController']};}['uploadUrl'](_0x52d5c7,_0x201b2d,_0x327e5a){const _0x555855=this['_sendApiRequest']('/conversations/'+_0x52d5c7+'/web-resources','POST',{'url':_0x201b2d,'attributes':_0x327e5a});return{'getId':async()=>(await _0x555855['request'])['json'](),'abortController':_0x555855['abortController']};}getModels(_0x356304='en'){const _0x4ce7db=new URLSearchParams();_0x4ce7db['append']('language',_0x356304);const _0x531b6a='/models/1?'+_0x4ce7db['toString'](),_0x3f6735=this['_sendApiRequest'](_0x531b6a,'GET');return{'list':async()=>await(await _0x3f6735['request'])['json'](),'abortController':_0x3f6735['abortController']};}listContexts(_0x1806a7={}){const _0x1b86c3=new URLSearchParams();_0x1b86c3['append']('limit',_0x1806a7['limit']?_0x1806a7['limit']['toString']():0x64['toString']()),_0x1806a7['cursor']&&_0x1b86c3['append']('cursor',_0x1806a7['cursor']),_0x1806a7['order']&&_0x1b86c3['append']('order',_0x1806a7['order']);const _0x36a433=this['_sendApiRequest']('/contexts?'+_0x1b86c3['toString'](),'GET');return{'getContexts':async()=>(await(await _0x36a433['request'])['json']())['items'],'abortController':_0x36a433['abortController']};}deleteFile(_0x52709b,_0x5b910c){const _0x235997=this['_sendApiRequest']('/conversations/'+_0x52709b+'/files/'+_0x5b910c,'DELETE');return{'execute':async()=>{await _0x235997['request'];},'abortController':_0x235997['abortController']};}deleteDocument(_0x4997ea,_0x27cf17){const _0x573ae4=this['_sendApiRequest']('/conversations/'+_0x4997ea+'/documents/'+_0x27cf17,'DELETE');return{'execute':async()=>{await _0x573ae4['request'];},'abortController':_0x573ae4['abortController']};}deleteWebResource(_0x89bc81,_0x3126d5){const _0x231c2b=this['_sendApiRequest']('/conversations/'+_0x89bc81+'/web-resources/'+_0x3126d5,'DELETE');return{'execute':async()=>{await _0x231c2b['request'];},'abortController':_0x231c2b['abortController']};}cancelStream(_0x1b0278,_0x56f6ab){const _0x12fac0=this['_sendApiRequest']('/conversations/'+_0x1b0278+'/messages/'+_0x56f6ab+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x12fac0['request'];},'abortController':_0x12fac0['abortController']};}resumeStream(_0x4259af,_0x44f3ba,_0x3cce4e='0-0'){const _0x32815f=new URLSearchParams({'lastEventId':_0x3cce4e}),_0x2a979f=this['_sendApiRequest']('/conversations/'+_0x4259af+'/messages/'+_0x44f3ba+'/stream?'+_0x32815f['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x556d0b=await _0x2a979f['request'];return this['_getStreamReader'](_0x556d0b['body']);},'abortController':_0x2a979f['abortController']};}callSystemReview({reviewName:_0x5f3e43,content:_0x1169a7,args:_0x3f7b87,contexts:_0x4cb35d}){const _0x1162cb=this['_sendApiRequest']('/reviews/system/'+_0x5f3e43+'/calls','POST',{'content':[{'type':'text','content':_0x1169a7}],'args':_0x3f7b87,...ps(_0x4cb35d)});return{'getStream':async()=>{const _0x52ae6a=(await _0x1162cb['request'])['body'];return this['_getStreamReader'](_0x52ae6a);},'abortController':_0x1162cb['abortController']};}processDocument({content:_0x46d69a,prompt:_0xb09e7c,model:_0x1003de,capabilities:_0x53fa5e,contexts:_0x2bee23}){const _0x53a0d6=this['_getExtraHttpHeaders'](),_0x19aeed=this['_sendApiRequest']('/documents/process','POST',{'content':_0x46d69a,'prompt':_0xb09e7c,'model':_0x1003de,..._0x53fa5e&&{'capabilities':_0x53fa5e},...ps(_0x2bee23),..._0x53a0d6&&{'extraHttpHeaders':_0x53a0d6}});return{'getResult':async()=>(await _0x19aeed['request'])['json'](),'abortController':_0x19aeed['abortController']};}callCustomReview({content:_0x206511,prompt:_0x4ac86f,model:_0x377d66,contexts:_0xb85854}){const _0x5690cd=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x206511}],..._0x4ac86f&&{'prompt':_0x4ac86f},'model':_0x377d66,...ps(_0xb85854)});return{'getStream':async()=>{const _0x21d81a=(await _0x5690cd['request'])['body'];return this['_getStreamReader'](_0x21d81a);},'abortController':_0x5690cd['abortController']};}upsertAIChatRating(_0x2f8a90,_0x478d30,_0x353a17){const _0x346855=this['_sendApiRequest']('/conversations/'+_0x2f8a90+'/messages/'+_0x478d30+'/ratings','PUT',{'positiveCount':_0x353a17['positiveCount'],'totalCount':_0x353a17['totalCount'],'modificationId':_0x353a17['modificationId']});return{'execute':async()=>{await _0x346855['request'];},'abortController':_0x346855['abortController']};}upsertAIActionRating(_0x366892,_0x2836cd,_0x532107){const _0x2e6aa1=this['_sendApiRequest']('/actions/system/'+_0x366892+'/calls/'+_0x2836cd+'/ratings','PUT',{'positiveCount':_0x532107['positiveCount'],'totalCount':_0x532107['totalCount']});return{'execute':async()=>{await _0x2e6aa1['request'];},'abortController':_0x2e6aa1['abortController']};}upsertCustomAIActionRating(_0x293742,_0x5d9a07){const _0x2baaed=this['_sendApiRequest']('/actions/custom/calls/'+_0x293742+'/ratings','PUT',{'positiveCount':_0x5d9a07['positiveCount'],'totalCount':_0x5d9a07['totalCount']});return{'execute':async()=>{await _0x2baaed['request'];},'abortController':_0x2baaed['abortController']};}upsertAIReviewRating(_0x26fd18,_0x49cc52,_0x12e0da,_0x4c773e){const _0x4db1ef=this['_sendApiRequest']('/reviews/system/'+_0x26fd18+'/calls/'+_0x49cc52+'/ratings','PUT',{'positiveCount':_0x12e0da['positiveCount'],'totalCount':_0x12e0da['totalCount'],'dataId':_0x4c773e});return{'execute':async()=>{await _0x4db1ef['request'];},'abortController':_0x4db1ef['abortController']};}upsertCustomAIReviewRating(_0x10b5ac,_0x1cd87f,_0x3c3e4f){const _0x51d737=this['_sendApiRequest']('/reviews/custom/calls/'+_0x10b5ac+'/ratings','PUT',{'positiveCount':_0x1cd87f['positiveCount'],'totalCount':_0x1cd87f['totalCount'],'dataId':_0x3c3e4f});return{'execute':async()=>{await _0x51d737['request'];},'abortController':_0x51d737['abortController']};}_sendApiRequest(_0x4edc8b,_0x3457b2,_0x26102d,_0xb237d3={}){const {apiUrl:_0x2b874d=this['_apiUrl']}=_0xb237d3,_0x533352=new AbortController(),_0x443997=_0x26102d instanceof FormData,_0x1acdd6={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':yt};_0x26102d&&!_0x443997&&(_0x1acdd6['Content-Type']='application/json');const _0x1e94c2={'method':_0x3457b2,'headers':_0x1acdd6,'signal':_0x533352['signal']};return _0x26102d&&(_0x1e94c2['body']=_0x443997?_0x26102d:JSON['stringify'](_0x26102d)),{'request':fetch(''+_0x2b874d+_0x4edc8b,_0x1e94c2)['catch'](_0x3c5256=>{this['_handleError'](_0x3c5256);})['then'](_0x3298e2=>_0x3298e2['ok']?_0x3298e2:_0x3298e2['json']()['then'](_0x53aade=>{throw{'url':_0x2b874d,'path':_0x4edc8b,'method':_0x3457b2,'body':_0x26102d,'status':(_0x3298e2||{})['status'],'statusText':(_0x3298e2||{})['statusText'],'code':_0x53aade['code'],'message':_0x53aade['message'],'traceId':_0x53aade['traceId'],'data':_0x53aade['data']};})),'abortController':_0x533352};}async *_getStreamReader(_0x4c3db3){const _0x33687a=[],_0x52baf5=_0x4c3db3['getReader'](),_0xf60ffe=_0xd409ef({'onError':_0x3b9300=>{this['_handleError'](_0x3b9300);},'onEvent':_0x3c3ae9=>{_0x3c3ae9['data']=JSON['parse'](_0x3c3ae9['data']),_0x33687a['push'](_0x3c3ae9);}});try{let _0x42b87d=!0x1;for(;!_0x42b87d;){const {done:_0x4d3aa9,value:_0x275a10}=await _0x52baf5['read']();_0x4d3aa9&&(_0x42b87d=!0x0),_0xf60ffe['feed'](this['_decoder']['decode'](_0x275a10,{'stream':!0x0})),yield*_0x33687a,_0x33687a['length']=0x0;}}catch(_0x21e88d){this['_handleError'](_0x21e88d);}finally{_0x52baf5['releaseLock'](),_0xf60ffe['reset']();}}['_handleError'](_0x49f5a3){if(_0x49f5a3 instanceof ct)throw _0x49f5a3;if(_0x49f5a3 instanceof Error&&'AbortError'===_0x49f5a3['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x49f5a3});throw new ct('ai-request-failed',this,{'originalError':_0x49f5a3});}};function ps(_0x27ffb2){return _0x27ffb2?.['length']?{'contexts':_0x27ffb2['map'](As)}:{};}function Es(_0x2f93b9,_0x2155ee,_0x34ee5d){const t=_0x2f93b9['t'];switch(_0x2155ee){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'},_0x34ee5d);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x34ee5d);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.'},_0x34ee5d);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x34ee5d);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'},_0x34ee5d);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x34ee5d);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'},_0x34ee5d);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.'},_0x34ee5d);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.'},_0x34ee5d);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.'},_0x34ee5d);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.'},_0x34ee5d);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'},_0x34ee5d);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.'},_0x34ee5d);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.'});default:return _0x2155ee;}}const ms=/* #__PURE__ -- @preserve */
|
|
25
|
-
dt();var Ts=class extends ms{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x4f7ebf,config:_0x514bc9,locale:_0x21021e}){super(),this['_connector']=_0x4f7ebf,this['_config']=_0x514bc9,this['_locale']=_0x21021e;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x2107fa=>{throw this['_modelsRequest']=null,_0x2107fa;})),this['_modelsRequest'];}async getAvailableModels(){const _0x3bf6df=await this['getAllModels']();let _0x18df93;return _0x18df93=this['_availableModels']?this['_filterModels'](_0x3bf6df,this['_availableModels']):_0x3bf6df['filter'](_0x38039c=>_0x38039c['recommended']),_0x18df93;}async['resolveModel'](_0x438650){const _0x177ebd=await this['getAllModels']();if(!_0x177ebd['length'])return null;if(_0x438650){const _0x1433ab=this['_getModelById'](_0x177ebd,_0x438650);if(_0x1433ab)return _0x1433ab;St('ai-chat-model-id-unrecognized',{'modelId':_0x438650,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x3e8a78=await this['getAvailableModels']();if(!_0x3e8a78['length'])return null;if(this['_defaultModelId']){const _0x532639=this['_getModelById'](_0x3e8a78,this['_defaultModelId']);if(_0x532639)return _0x532639;St('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x3e8a78[0x0]['id']});}return _0x3e8a78[0x0];}async['isAvailable'](_0x48546a){return(await this['getAvailableModels']())['some'](_0x99b292=>_0x99b292['name']===_0x48546a['name']&&_0x99b292['provider']===_0x48546a['provider']);}async getModel(_0x185adb){const _0x419712=await this['getAllModels']();return this['_getModelById'](_0x419712,_0x185adb)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x462fdb=this['_locale']['uiLanguage']||'en',_0x1a8767=await this['_connector']['getModels'](_0x462fdb)['list']();this['_modelList']=_0x1a8767['items']['map'](_0x986b30=>ws(_0x986b30)?{..._0x986b30,'name':Es(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x986b30);}return[...this['_modelList']];}_filterModels(_0x50dae5,_0x2634a0){let _0x4339d6;if(_0x2634a0){_0x4339d6=[];const _0x321556=new Set(),_0x2bd4ed='string'==typeof _0x2634a0?[_0x2634a0['toLocaleLowerCase']()]:_0x2634a0['map'](_0x852187=>_0x852187['toLocaleLowerCase']());for(const _0x28cb11 of _0x2bd4ed)for(const _0x5968d7 of _0x50dae5)!_0x321556['has'](_0x5968d7['id'])&&this['_isMatchingFilter'](_0x5968d7,_0x28cb11)&&(_0x4339d6['push'](_0x5968d7),_0x321556['add'](_0x5968d7['id']));}else _0x4339d6=_0x50dae5;return _0x4339d6;}_isMatchingFilter(_0x13d8bd,_0x5b3dce){const _0x34f8f8=_0x13d8bd['id']['toLocaleLowerCase'](),_0x5848c9=_0x13d8bd['name']['toLocaleLowerCase'](),_0x22c258=_0x13d8bd['provider']['toLocaleLowerCase']();return _0x34f8f8===_0x5b3dce||_0x5848c9===_0x5b3dce||ws(_0x13d8bd)&&'auto'===_0x5b3dce||_0x22c258===_0x5b3dce||_0x34f8f8['startsWith'](_0x5b3dce);}_getModelById(_0x492798,_0x2edf4b){return _0x492798['find'](_0x2832a0=>ws(_0x2832a0)&&'auto'===_0x2edf4b?_0x2832a0:_0x2832a0['id']===_0x2edf4b)||null;}};function ws(_0x23e52d){return _0x23e52d['id']['startsWith']('agent');}var Cs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x77ffac,defaultContext:_0x2c83cd}){this['_connector']=_0x77ffac,this['_defaultContext']=_0x2c83cd;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x1c16d4=>{throw this['_contextsRequest']=null,_0x1c16d4;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x1c6a2f=await this['getAllContexts'](),_0x37f5e5=new Set((this['_defaultContext']??[])['map'](_0x3c27d3=>_0x3c27d3['id']));return _0x1c6a2f['filter'](_0x2d892d=>!_0x37f5e5['has'](_0x2d892d['id']));}resolveContext({feature:_0x37e802,ids:_0x329cb8=[],extraContexts:_0x3967a2=[],idScopedOnly:_0x3b1f05=!0x1,context:_0x29e0c0}){const _0x495717=this['_resolveDefaultContext'](_0x37e802,_0x329cb8,_0x3b1f05);return _0x29e0c0['addDefaultContext']([..._0x495717,..._0x3967a2]),_0x29e0c0;}_resolveDefaultContext(_0x395383,_0x180ffa,_0x8ed223=!0x1){if(!this['_defaultContext'])return[];const _0xb80ddc=[];for(const _0x42f46f of this['_defaultContext'])this['_entryAppliesToFeature'](_0x42f46f['features'],_0x395383,_0x180ffa)&&(_0x8ed223&&this['_entryAppliesToFeature'](_0x42f46f['features'],_0x395383,[])||_0xb80ddc['push'](this['_toContextRef'](_0x42f46f)));return _0xb80ddc;}_toContextRef(_0x24250d){return'promptId'in _0x24250d?{'id':_0x24250d['id'],'promptId':_0x24250d['promptId']}:'fileId'in _0x24250d?{'id':_0x24250d['id'],'fileId':_0x24250d['fileId']}:{'id':_0x24250d['id']};}_entryAppliesToFeature(_0x218ae6,_0x51cd47,_0x2fa492){if(!_0x218ae6)return!0x0;const _0x251865=_0x218ae6[_0x51cd47];return!!_0x251865&&(!0x0===_0x251865||_0x2fa492['some'](_0x18c4bb=>_0x251865['test'](_0x18c4bb)));}},fs=class extends _0x2b8fcb{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Is];}init(){const _0x353091=this['context']['plugins']['get'](Is);this['models']=new Ts({'connector':_0x353091,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Cs({'connector':_0x353091,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function bs(_0x4c3e04){return _0x4c3e04?_0x4c3e04 instanceof _0x5d4fbe?[_0x4c3e04]:_0x4c3e04['editors']&&0x0!==_0x4c3e04['editors']['length']?Array['from'](_0x4c3e04['editors']):[]:[];}function Ss(_0x694619){const _0x38569f=bs(_0x694619);if(!_0x38569f['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x38569f['length'])return _0x38569f[0x0];const _0x125789=_0x38569f['find'](_0x19518f=>_0x19518f['ui']?.['focusTracker']?.['isFocused']);if(_0x125789)return _0x125789;const _0x1b852e=function(_0x334231){if(_0x334231 instanceof _0x5d4fbe)return;const _0x20e6b6=_0x334231;if(!_0x20e6b6['plugins']||!_0x20e6b6['plugins']['has']('AIEditing'))return;return _0x20e6b6['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x694619);return _0x1b852e&&_0x38569f['includes'](_0x1b852e)?_0x1b852e:_0x38569f[0x0];}function Rs(_0x308a2d,_0x121a1b){return _0x3b90c9(_0x308a2d,_0x121a1b);}function Os(_0x3438e2,_0x3b4f31){return _0x311e91(_0x3438e2,_0x3b4f31);}function vs(_0x4d349c,_0x421dc1,_0x485795){const _0x58b083=null!==_0x421dc1?_0x28281d=>_0x28281d['attribs'][_0x4d349c]===_0x421dc1:_0x5066fd=>Boolean(_0x5066fd['attribs'][_0x4d349c]);return _0x1478a8(_0x253ecb=>_0x1c00b6(_0x253ecb)&&_0x58b083(_0x253ecb),_0x485795);}function ks(_0x424ac5,_0x586f6c,_0x52a0f5){const _0x1e97e4=null!==_0x586f6c?_0x2c8ea6=>_0x2c8ea6['attribs'][_0x424ac5]===_0x586f6c:_0x475cde=>Boolean(_0x475cde['attribs'][_0x424ac5]);return _0x150f20(_0x2d2144=>_0x1c00b6(_0x2d2144)&&_0x1e97e4(_0x2d2144),_0x52a0f5);}function ys(_0x30325e){return _0x150f20(_0x4a53f4=>_0x1c00b6(_0x4a53f4)&&function(_0x2b1659){const _0x540105=_0x2b1659['toLowerCase']();return'script'===_0x540105||'style'===_0x540105||_0x540105['includes']('-');}(_0x4a53f4['name']),_0x30325e);}const Ns=['comment-start','comment-end','suggestion-start','suggestion-end'];function xs(_0x1f5208){return _0x1c00b6(_0x1f5208)&&Ns['includes'](_0x1f5208['name']['toLowerCase']());}function Ls(_0x407a55){return _0x353e7c(_0x494f0e=>_0x259173(_0x494f0e),_0x407a55,!0x0,0x1/0x0);}function Ps(_0x3b92ac,_0x170c7d){return _0x3b92ac&&_0x1c00b6(_0x3b92ac)?_0x3b92ac['attribs'][_0x170c7d]:null;}function Ds(_0x9bc3ce,_0x5f5a3e,_0x4cf0a1){_0x1c00b6(_0x9bc3ce)&&(null===_0x4cf0a1?delete _0x9bc3ce['attribs'][_0x5f5a3e]:_0x9bc3ce['attribs'][_0x5f5a3e]=_0x4cf0a1);}function Hs(_0x374dc5,_0x20d7eb,_0x57c85b){const _0x33b2af=_0x20d7eb['cloneNode'](!0x0);'beforebegin'===_0x57c85b?ti(_0x374dc5,_0x33b2af):'afterbegin'===_0x57c85b?_0x57b293(_0x374dc5,_0x33b2af):'beforeend'===_0x57c85b?_0x88365f(_0x374dc5,_0x33b2af):'afterend'===_0x57c85b&&_0x221092(_0x374dc5,_0x33b2af);}function Ms(_0x13c64e){const _0x466354=[];let _0x213c49=_0x13c64e;for(;_0x213c49;)_0x213c49=_0x46534a(_0x213c49),_0x213c49&&_0x466354['push'](_0x213c49);return _0x466354;}function Us(_0x299a45){return _0x299a45['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Vs(_0x58f658){let _0x4f6a24=0x0;for(;_0x58f658['parentNode'];)_0x58f658=_0x58f658['parentNode'],_0x4f6a24++;return _0x4f6a24;}function Bs(_0x500623){const _0x1decd5=[];let _0x25a7e3=_0x500623['nextSibling'];for(;_0x25a7e3;)_0x1decd5['push'](_0x25a7e3),_0x25a7e3=_0x25a7e3['nextSibling'];_0x1decd5['forEach'](_0x372a74=>{_0x11f553(_0x372a74);});}function Gs(_0xf29ae8,_0x7488d5){return!!_0xf29ae8['model']['document']['getRoot'](_0x7488d5)&&!_0x1e4a4c(_0xf29ae8,_0x7488d5);}function Fs(_0x15f9e7,_0x35fdeb){return'<p\x20data-id=\x22'+_0x35fdeb+'\x22>'+_0x15f9e7+'</p>';}function Ks(_0x4bf24e){return'p'===_0x4bf24e['name']['toLowerCase']()&&Boolean(_0x4bf24e['attribs']['data-id']);}function Ws(_0xd2d9c2){const _0x19734d=Rs(_0xd2d9c2)['children']['filter'](_0x1c00b6);return 0x1===_0x19734d['length']&&Ks(_0x19734d[0x0])?_0x19734d[0x0]['children']['map'](_0x42684b=>Os(_0x42684b))['join'](''):_0xd2d9c2;}function Ys(_0x2f8236,_0x1a0bcb){const _0x5bf5a2=function(_0x480b81){const _0x1fa4ae=_0x480b81['children']['filter'](_0x1c00b6);return 0x1===_0x1fa4ae['length']&&Ks(_0x1fa4ae[0x0])?_0x1fa4ae[0x0]['children']:_0x480b81['children'];}(_0x1a0bcb),{blockElements:_0x2ee60f}=_0x2f8236['editing']['view']['domConverter'],_0x252f7a=_0x570af7=>_0x570af7['some'](_0x1628f8=>_0x1c00b6(_0x1628f8)&&('p'!==_0x1628f8['name']['toLowerCase']()&&_0x2ee60f['includes'](_0x1628f8['name']['toLowerCase']())||_0x252f7a(_0x1628f8['children'])));if(_0x252f7a(_0x5bf5a2))return!0x1;const _0x3cbad2=_0x5bf5a2['map'](_0x360cfd=>Os(_0x360cfd))['join'](''),_0x373c81=_0x2f8236['data']['parse'](_0x3cbad2,'$root'),{schema:_0x33307d}=_0x2f8236['model'];let _0x521463=0x0;for(const {item:_0x1d5170}of _0x2f8236['model']['createRangeIn'](_0x373c81))if(_0x1d5170['is']('element')&&_0x33307d['isBlock'](_0x1d5170)&&(++_0x521463>0x1||'paragraph'!==_0x1d5170['name']))return!0x1;return!0x0;}function $s(_0x3eb119,_0xdf717d){const _0x2630a9=_0xdf717d['filter'](_0x63029a=>'new'!=_0x63029a['type'])['map'](_0x418482=>vs('data-id',_0x418482['id'],_0x3eb119))['filter'](_0x44d80b=>null!==_0x44d80b),_0x523bea=_0xdf717d['filter'](_0x3e3d8c=>'removed'!=_0x3e3d8c['type'])['map'](_0x4b25f4=>_0x4b25f4['node']['cloneNode'](!0x0));let _0x30a2a9=null;if(_0x2630a9['length']){_0x30a2a9=_0x2630a9[0x0]['previousSibling'];for(let _0x3efe28=0x0;_0x3efe28<_0x2630a9['length'];_0x3efe28++)_0x11f553(_0x2630a9[_0x3efe28]);}if(_0x523bea['length']){_0x30a2a9||(_0xdf717d[0x0]['anchorId']?_0x30a2a9=vs('data-id',_0xdf717d[0x0]['anchorId'],_0x3eb119):(_0x30a2a9=_0x523bea['shift'](),_0x57b293(_0x3eb119,_0x30a2a9)));for(let _0x2c731a=0x0;_0x2c731a<_0x523bea['length'];_0x2c731a++)_0x221092(_0x30a2a9,_0x523bea[_0x2c731a]),_0x30a2a9=_0x523bea[_0x2c731a];}}function qs(_0x52bcba,_0x500602){const _0x263400=new Set();for(const _0x52b36e of _0x52bcba){if(!_0x52b36e['editor']||'destroyed'===_0x52b36e['editor']['state']||!Gs(_0x52b36e['editor'],_0x52b36e['rootName']))continue;const _0x421a04=_0x500602['get'](_0x52b36e['documentId']);let _0x1641a2;_0x421a04?(_0x1641a2=_0x421a04['cloneNode'](!0x0),$s(_0x1641a2,_0x52b36e['changes'])):_0x1641a2=new _0x2fcdd7(_0x52b36e['changes']['filter'](_0xc98688=>'removed'!=_0xc98688['type'])['map'](_0x49ec29=>_0x49ec29['node']['cloneNode'](!0x0))),Ys(_0x52b36e['editor'],_0x1641a2)||_0x263400['add'](_0x52b36e['index']);}return _0x263400;}function Qs(_0x2c9b78,_0x18d530,_0x4f2e15,_0x1eb3d0){return Gs(_0x2c9b78,_0x18d530)?Ys(_0x2c9b78,Rs(_0x1eb3d0))?{'before':Ws(_0x4f2e15),'after':Ws(_0x1eb3d0)}:null:{'before':_0x4f2e15,'after':_0x1eb3d0};}function Xs(_0x367f96,_0x5bfece){return _0x2967b5(_0x367f96,_0x5bfece);}function zs(_0x55d55b,_0x4ca2ff){return _0x55d55b['map'](_0x4e1dc1=>null!==_0x4e1dc1&&'object'==typeof _0x4e1dc1?Xs(_0x4e1dc1,_0x4ca2ff):_0x4e1dc1);}const js=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],Js='ai-selection',Zs=['br'];var tn=class extends _0x2b8fcb{constructor(_0x59501e){super(_0x59501e),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x5f43b9){let _0x23a088=this['_sessionIdByEditor']['get'](_0x5f43b9);return _0x23a088||(_0x23a088=_0x5f43b9['plugins']['has']('RealTimeCollaborationClient')&&_0x5f43b9['plugins']['get']('RealTimeCollaborationClient')['sessionId']||kt(),this['_sessionIdByEditor']['set'](_0x5f43b9,_0x23a088)),_0x23a088;}async getDocumentData(_0x36374c){const _0x30783c=bs(this['context']),_0x234a58=[],_0x428305=new Set();for(const _0x19ec36 of _0x30783c){if(_0x36374c&&!_0x36374c['has'](_0x19ec36['config']['get']('collaboration.channelId')))continue;const _0x5a0b14=_0x19ec36['config']['get']('roots')||{},_0x17698a=this['_getEditorSelectionSignature'](_0x19ec36),_0x34283f=_0x19ec36['config']['get']('collaboration.channelId'),_0x2242b2=this['getSessionId'](_0x19ec36);for(const _0x103df9 of _0x19ec36['model']['document']['getRoots']()){if('$graveyard'===_0x103df9['rootName'])continue;const _0x29981e=await this['_getDocumentDataForEditorRoot'](_0x19ec36,_0x103df9,_0x428305),_0x280a8c=_0x5a0b14[_0x103df9['rootName']],_0x1028e2=_0x103df9['getAttribute']('$description')??_0x280a8c?.['description'];let _0x2579ac=_0x103df9['getAttribute']('$title')??_0x280a8c?.['title'];_0x2579ac||(_0x2579ac=_0x103df9['getAttribute']('$rootEditableOptions')?.['label']??_0x280a8c?.['label']),_0x2579ac||(St('ai-document-root-missing-title',{'editor':_0x19ec36,'rootName':_0x103df9['rootName']}),_0x2579ac=_0x103df9['rootName']),_0x234a58['push']({'editor':_0x19ec36,'rootName':_0x103df9['rootName'],'content':_0x29981e['content'],'version':_0x29981e['version'],'sessionId':_0x2242b2,'channelId':_0x34283f,'selections':_0x29981e['selections'],'selectionSignature':_0x17698a,'editorConfig':this['_getEditorConfig'](_0x19ec36),'name':_0x2579ac,'description':_0x1028e2});}}return _0x234a58;}getEditorsVersions(){const _0x239e38=bs(this['context']),_0x4e57b5=new Map();for(const _0x290ee4 of _0x239e38){const _0x4052d0=_0x290ee4['config']['get']('collaboration.channelId');_0x4e57b5['set'](_0x4052d0,_0x290ee4['model']['document']['version']);}return _0x4e57b5;}getEditorsSelections(){const _0x4eaa1b=bs(this['context']),_0x590086=new Map();for(const _0x1672d7 of _0x4eaa1b){const _0xe990a0=_0x1672d7['config']['get']('collaboration.channelId'),_0x620ad=this['_getEditorSelectionSignature'](_0x1672d7);_0x590086['set'](_0xe990a0,_0x620ad);}return _0x590086;}_getEditorSelectionSignature(_0x101140){return this['_getMarkersInDocumentOrder'](_0x101140)['map'](_0x30a05b=>{const _0x35fb9f=_0x30a05b['getRange']();return _0x35fb9f['root']['rootName']+':'+_0x35fb9f['start']['path']['join']('.')+'-'+_0x35fb9f['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0xb0b062,_0x582fc2,_0x2c7453){const _0x57c0ba=_0xb0b062['data']['toView'](_0x582fc2,{'convertAiChatSelectionMarker':!0x0}),_0x5d813e=new _0x17e18b(_0xb0b062['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x57c0ba,_0x5d813e,_0x2c7453);let _0x4efa1b=await this['_getDocumentDataStringFromView'](_0x57c0ba,_0xb0b062);Gs(_0xb0b062,_0x582fc2['rootName'])&&(_0x4efa1b=Fs(_0x4efa1b,this['_nextDataId'](_0x2c7453)));const _0x2858e7=this['_getMarkersInDocumentOrder'](_0xb0b062,_0x582fc2),_0x4b07c5=[];for(const _0x3e53b7 of _0x2858e7){const _0x5d715a='<'+_0x3e53b7['name']+':start></'+_0x3e53b7['name']+':start>',_0x419b21=_0x4efa1b['indexOf'](_0x5d715a);_0x4efa1b=_0x4efa1b['substring'](0x0,_0x419b21)+_0x4efa1b['substring'](_0x419b21+_0x5d715a['length']);const _0x2f0a9c='<'+_0x3e53b7['name']+':end></'+_0x3e53b7['name']+':end>',_0x179f80=_0x4efa1b['indexOf'](_0x2f0a9c);_0x4efa1b=_0x4efa1b['substring'](0x0,_0x179f80)+_0x4efa1b['substring'](_0x179f80+_0x2f0a9c['length']),_0x4b07c5['push']({'markerName':_0x3e53b7['name'],'start':_0x419b21,'end':_0x179f80,'htmlFragment':_0x4efa1b['substring'](_0x419b21,_0x179f80)});}return{'content':_0x4efa1b,'version':_0xb0b062['model']['document']['version'],'selections':_0x4b07c5};}afterInit(){this['context']instanceof _0x5d4fbe?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x26aa19,_0x3420f8)=>{_0x3420f8['on']('ready',()=>{this['_integrateEditor'](_0x3420f8);});});}_setOutputDataProcessor(_0x599626){this['_outputDataProcessor']=_0x599626;}async _getDocumentDataStringFromView(_0x1fba3f,_0x48bd74){let _0x122aa0;if(this['_outputDataProcessor']){const _0x3ee105=_0x48bd74['data']['processor']['domConverter']['viewToDom'](_0x1fba3f),_0x2b6357=await this['_outputDataProcessor'](_0x3ee105);_0x122aa0=_0x48bd74['data']['processor']['htmlWriter']['getHtml'](_0x2b6357);}else _0x122aa0=_0x48bd74['data']['processor']['toData'](_0x1fba3f);return _0x122aa0;}_integrateEditor(_0x184cb9){if(!_0x184cb9['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x184cb9);_0x184cb9['ui']['focusTracker']['on']('change:isFocused',(_0x25330a,_0x5b1033,_0xc0c6e0)=>{_0xc0c6e0&&(this['_lastContentFocusedEditor']=_0x184cb9);}),_0x184cb9['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x184cb9&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x184cb9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Js,'view':({markerName:_0x385806})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x385806['split'](':')[0x1]],'priority':0xc})}),_0x184cb9['conversion']['for']('dataDowncast')['markerToElement']({'model':Js+':context','view':(_0x580fef,{writer:_0x41d369,options:_0x27cb37})=>_0x27cb37['convertAiChatSelectionMarker']?_0x41d369['createUIElement'](_0x580fef['markerName']+':'+(_0x580fef['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x5c9725){const _0x365d42=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x5c9725);const _0x17d790=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x365d42,_0x17d790);}hideFakeVisualSelection(_0x12d789){const _0x37756a=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x12d789);const _0x5d836a=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x37756a,_0x5d836a);}async modelToDataWithIds(_0x12da3b,_0x2aa7e1,_0x1f4d81){const _0x4d369a=_0x2aa7e1['data']['toView'](_0x12da3b),_0x1538c8=new _0x17e18b(_0x2aa7e1['editing']['view']['document']),_0x5d97be=new Set();this['_setDataIdsOnChildren'](_0x4d369a,_0x1538c8,_0x5d97be);const _0x1bb87c=await this['_getDocumentDataStringFromView'](_0x4d369a,_0x2aa7e1);return _0x1f4d81&&Gs(_0x2aa7e1,_0x1f4d81)?Fs(_0x1bb87c,this['_nextDataId'](_0x5d97be)):_0x1bb87c;}_setDataIdsOnChildren(_0x389e6c,_0x211928,_0x25a142=new Set()){let _0x3989cf=!0x1;for(const _0x2d72b3 of _0x389e6c['getChildren']()){if(!_0x2d72b3['is']('view:element')||Zs['includes'](_0x2d72b3['name']))continue;const _0x1f2d19=_0x2d72b3['is']('view:containerElement'),_0x1592af=_0x2d72b3['is']('view:emptyElement'),_0x4a30e0=_0x2d72b3['is']('view:rawElement'),_0x1fd6f8=this['_setDataIdsOnChildren'](_0x2d72b3,_0x211928,_0x25a142);_0x2d72b3['hasAttribute']('data-id')?(_0x3989cf=!0x0,_0x25a142['add'](_0x2d72b3['getAttribute']('data-id'))):(_0x1f2d19||_0x1592af||_0x4a30e0||_0x1fd6f8)&&(_0x211928['setAttribute']('data-id',this['_nextDataId'](_0x25a142),_0x2d72b3),_0x3989cf=!0x0);}return _0x3989cf;}_nextDataId(_0x5cdc6e){let _0x3d0f99;do{_0x3d0f99='';for(let _0x252e32=0x0;_0x252e32<0x4;_0x252e32++)_0x3d0f99+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x5cdc6e['has'](_0x3d0f99));return _0x5cdc6e['add'](_0x3d0f99),_0x3d0f99;}getSelectionText(_0x148be3){const _0x136cea=(_0x148be3?_0x148be3['model']:Ss(this['context'])['model'])['document']['selection'],_0xcee0b0=[],_0xb16b5c=Array['from'](_0x136cea['getRanges']());_0xb16b5c['sort']((_0x361326,_0x19d69c)=>_0x361326['start']['isBefore'](_0x19d69c['start'])?-0x1:0x1);for(const _0x543d5d of _0xb16b5c)for(const _0x4d97bc of _0x543d5d['getItems']())_0x4d97bc['is']('$textProxy')?_0xcee0b0['push'](_0x4d97bc['data']):_0x4d97bc['is']('element')&&_0xcee0b0['length']>0x0&&'\x20'!==_0xcee0b0[_0xcee0b0['length']-0x1]&&_0xcee0b0['push']('\x20');return _0xcee0b0['length']?'\x22'+_0xcee0b0['join']('')['trim']()+'\x22':Es(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x1d0624){for(let _0x1d38c6=0x0;_0x1d38c6<this['_fakeSelections']['length'];_0x1d38c6++)if(this['_fakeSelections'][_0x1d38c6]['id']==_0x1d0624)return void this['_fakeSelections']['splice'](_0x1d38c6,0x1);}_addFakeSelection(_0x574ede){this['_removeFakeSelectionById'](_0x574ede['id']),Ct(this['_fakeSelections'],_0x574ede);}_refreshFakeSelection(_0x326ec7,_0x2e74c7){if(_0x326ec7==_0x2e74c7)return;const _0x28a255=_0x326ec7?_0x326ec7['editor']:null,_0x294842=_0x2e74c7?_0x2e74c7['editor']:null,_0x5cc841=(_0x2a3712,_0x1e424f)=>{const _0xf95164=_0x1e424f['model']['markers']['getMarkersGroup'](Js);for(const _0x3921c1 of _0xf95164)_0x2a3712['removeMarker'](_0x3921c1);},_0x4ad7ea=(_0x10a254,_0xaf9335,_0x1868c7)=>{const _0x2c4620=_0xaf9335['model'];for(let _0xcf1040=0x0;_0xcf1040<_0x1868c7['ranges']['length'];_0xcf1040++){let _0x17b0cc=_0x1868c7['ranges'][_0xcf1040];const _0x34bcf8=Js+':'+_0x1868c7['id']+':'+_0xcf1040;if(_0x17b0cc['start']['isAtEnd']){const _0x5b444d=_0x17b0cc['start']['getLastMatchingPosition'](({item:_0x4f9bd9})=>!_0x2c4620['schema']['isContent'](_0x4f9bd9),{'boundaries':_0x17b0cc});_0x17b0cc=_0x10a254['createRange'](_0x5b444d,_0x17b0cc['end']);}_0x10a254['addMarker'](_0x34bcf8,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x17b0cc});}};_0x28a255&&_0x294842&&_0x28a255===_0x294842&&_0x2e74c7?_0x28a255['model']['change'](_0x29ea75=>{_0x5cc841(_0x29ea75,_0x28a255),_0x4ad7ea(_0x29ea75,_0x294842,_0x2e74c7);}):(_0x28a255&&_0x28a255['model']['change'](_0x20b57a=>_0x5cc841(_0x20b57a,_0x28a255)),_0x294842&&_0x2e74c7&&_0x294842['model']['change'](_0x732b97=>_0x4ad7ea(_0x732b97,_0x294842,_0x2e74c7)));}_getMarkersInDocumentOrder(_0x12f095,_0x17cb4d){const _0x5235b1=Array['from'](_0x12f095['model']['markers']['getMarkersGroup'](Js+':context'));return(_0x17cb4d?_0x5235b1['filter'](_0x11cb50=>{const _0x93dcf8=_0x11cb50['getRange']();return _0x93dcf8&&_0x93dcf8['root']['rootName']===_0x17cb4d['rootName'];}):_0x5235b1)['sort']((_0x34b872,_0x581bc9)=>_0x34b872['getStart']()['isBefore'](_0x581bc9['getStart']())?-0x1:_0x34b872['getStart']()['isAfter'](_0x581bc9['getStart']())?0x1:0x0);}_getEditorConfig(_0x11d129){let _0x53665a=this['_editorsToConfigs']['get'](_0x11d129);return _0x53665a||(_0x53665a=function(_0x35493e){const _0x1f5fa6={};if(_0x35493e['plugins']['has']('AlignmentEditing')&&(_0x1f5fa6['alignment']=_0x35493e['config']['get']('alignment')),_0x35493e['plugins']['has']('CodeBlockEditing')&&(_0x1f5fa6['codeBlock']=_0x35493e['config']['get']('codeBlock')),_0x35493e['plugins']['has']('FontBackgroundColorEditing')&&(_0x1f5fa6['fontBackgroundColor']=Xs(_0x35493e['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x35493e['plugins']['has']('FontColorEditing')&&(_0x1f5fa6['fontColor']=Xs(_0x35493e['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x35493e['plugins']['has']('FontFamilyEditing')&&(_0x1f5fa6['fontFamily']=_0x35493e['config']['get']('fontFamily'),_0x1f5fa6['fontFamily']&&_0x1f5fa6['fontFamily']['options']&&(_0x1f5fa6['fontFamily']['options']=zs(_0x1f5fa6['fontFamily']['options'],['model','upcastAlso']))),_0x35493e['plugins']['has']('FontSizeEditing')&&(_0x1f5fa6['fontSize']=_0x35493e['config']['get']('fontSize'),_0x1f5fa6['fontSize']&&_0x1f5fa6['fontSize']['options']&&(_0x1f5fa6['fontSize']['options']=zs(_0x1f5fa6['fontSize']['options'],['upcastAlso']))),_0x35493e['plugins']['has']('FootnotesEditing')){const _0x18f03a=_0x35493e['config']['get']('footnotes')??{};_0x18f03a['footnotesProperties']&&'object'==typeof _0x18f03a['footnotesProperties']&&(_0x18f03a['footnotesProperties']=Xs(_0x18f03a['footnotesProperties'],['toolbar','listStyles'])),_0x1f5fa6['footnotes']=_0x18f03a;}if(_0x35493e['plugins']['has']('HeadingEditing')&&(_0x1f5fa6['heading']=_0x35493e['config']['get']('heading'),_0x1f5fa6['heading']&&_0x1f5fa6['heading']['options']&&(_0x1f5fa6['heading']['options']=zs(_0x1f5fa6['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x35493e['plugins']['has']('HighlightEditing')&&(_0x1f5fa6['highlight']=_0x35493e['config']['get']('highlight'),_0x1f5fa6['highlight']&&_0x1f5fa6['highlight']['options']&&(_0x1f5fa6['highlight']['options']=zs(_0x1f5fa6['highlight']['options'],['model','color']))),_0x35493e['plugins']['has']('ImageBlockEditing')||_0x35493e['plugins']['has']('ImageInlineEditing')){const _0x113230=Xs(_0x35493e['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x35493e['plugins']['has']('ImageResizeEditing')||delete _0x113230['resizeUnit'],_0x35493e['plugins']['has']('ImageStyleEditing')?_0x113230['styles']?.['options']&&(_0x113230['styles']['options']=zs(_0x113230['styles']['options'],['icon'])):delete _0x113230['styles'],_0x1f5fa6['image']=_0x113230;}if(_0x35493e['plugins']['has']('IndentBlock')&&(_0x1f5fa6['indentBlock']=_0x35493e['config']['get']('indentBlock')),_0x35493e['plugins']['has']('LineHeightEditing')&&(_0x1f5fa6['lineHeight']=_0x35493e['config']['get']('lineHeight'),_0x1f5fa6['lineHeight']&&(delete _0x1f5fa6['lineHeight']['supportAllValues'],_0x1f5fa6['lineHeight']['options']&&(_0x1f5fa6['lineHeight']['options']=zs(_0x1f5fa6['lineHeight']['options'],['model'])))),_0x35493e['plugins']['has']('LinkEditing')&&(_0x1f5fa6['link']=Xs(_0x35493e['config']['get']('link'),['toolbar'])),_0x35493e['plugins']['has']('ListEditing')){const _0x12fd64=_0x35493e['config']['get']('list')??{};delete _0x12fd64['enableListItemMarkerFormatting'],_0x35493e['plugins']['has']('ListPropertiesEditing')?_0x12fd64['properties']&&_0x12fd64['properties']['styles']&&'object'==typeof _0x12fd64['properties']['styles']&&(_0x12fd64['properties']['styles']=Xs(_0x12fd64['properties']['styles'],['listStyleTypes'])):delete _0x12fd64['properties'],_0x1f5fa6['list']=_0x12fd64;}if(_0x35493e['plugins']['has']('MediaEmbedEditing')&&(_0x1f5fa6['mediaEmbed']=_0x35493e['config']['get']('mediaEmbed'),_0x1f5fa6['mediaEmbed']&&(delete _0x1f5fa6['mediaEmbed']['toolbar'],_0x35493e['plugins']['has']('MediaEmbedResizeEditing')?_0x1f5fa6['mediaEmbed']['resizeOptions']&&(_0x1f5fa6['mediaEmbed']['resizeOptions']=_0x1f5fa6['mediaEmbed']['resizeOptions']['map'](_0x51e80b=>Xs(_0x51e80b,['icon','label']))):delete _0x1f5fa6['mediaEmbed']['resizeOptions'],_0x35493e['plugins']['has']('MediaEmbedStyleEditing')?_0x1f5fa6['mediaEmbed']['styles']&&_0x1f5fa6['mediaEmbed']['styles']['options']&&(_0x1f5fa6['mediaEmbed']['styles']['options']=zs(_0x1f5fa6['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x1f5fa6['mediaEmbed']['styles'])),_0x35493e['plugins']['has']('MultiLevelListEditing')&&(_0x1f5fa6['listMultiLevel']=_0x35493e['config']['get']('listMultiLevel')??{}),_0x35493e['plugins']['has']('MentionEditing')){const _0x16f9b6=Xs(_0x35493e['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x16f9b6['feeds']&&(_0x16f9b6['feeds']=_0x16f9b6['feeds']['map'](_0x3ba5df=>Xs(_0x3ba5df,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x1f5fa6['mention']=_0x16f9b6;}if(_0x35493e['plugins']['has']('MergeFieldsEditing')){const _0x31c5ef=Xs(_0x35493e['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x31c5ef['definitions'])&&(_0x31c5ef['definitions']=_0x31c5ef['definitions']['map'](_0x591ffc=>'groupId'in _0x591ffc?(Array['isArray'](_0x591ffc['definitions'])&&(_0x591ffc['definitions']=_0x591ffc['definitions']['map'](_0x542b35=>Xs(_0x542b35,['defaultValue']))),_0x591ffc):Xs(_0x591ffc,['defaultValue']))),_0x1f5fa6['mergeFields']=_0x31c5ef;}if(_0x35493e['plugins']['has']('StyleEditing')&&(_0x1f5fa6['style']=_0x35493e['config']['get']('style')),_0x35493e['plugins']['has']('TableEditing')){const _0x121c56=Xs(_0x35493e['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x35493e['plugins']['has']('TablePropertiesEditing')?_0x121c56['tableProperties']&&'object'==typeof _0x121c56['tableProperties']&&(_0x121c56['tableProperties']=Xs(_0x121c56['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x121c56['tableProperties'],_0x35493e['plugins']['has']('TableCellPropertiesEditing')?_0x121c56['tableCellProperties']&&'object'==typeof _0x121c56['tableCellProperties']&&(_0x121c56['tableCellProperties']=Xs(_0x121c56['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x121c56['tableCellProperties'],_0x35493e['plugins']['has']('TableLayoutEditing')?_0x121c56['tableLayout']||(_0x121c56['tableLayout']={}):delete _0x121c56['tableLayout'],_0x35493e['plugins']['has']('TableCaptionEditing')?_0x121c56['tableCaption']||(_0x121c56['tableCaption']={}):delete _0x121c56['tableCaption'],_0x1f5fa6['table']=_0x121c56;}_0x35493e['plugins']['has']('TextPartLanguageEditing')&&(_0x1f5fa6['textPartLanguage']=_0x35493e['config']['get']('language.textPartLanguage'));for(const [_0x276573,_0x3ebc4e]of js)_0x35493e['plugins']['has'](_0x276573)&&(_0x1f5fa6[_0x3ebc4e]={});return _0x1f5fa6;}(_0x11d129),this['_editorsToConfigs']['set'](_0x11d129,_0x53665a)),_0x53665a;}};const en=/* #__PURE__ -- @preserve */
|
|
26
|
-
At();var sn=class extends en{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x2a8830){super(),this['_generateUid']=_0x2a8830||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x36cadb,_0x15272e,_0x146361){this['_uidCounter']=0x0;const _0x5691f8=_0x36cadb['cloneNode'](!0x0);on(_0x15272e,_0x5691f8);const _0x5172b7=_0x5691f8['childNodes'],_0x4d7db3=Array['from'](_0x5172b7)['filter'](_0x44b31c=>!(0x3===_0x44b31c['nodeType']&&''===Os(_0x44b31c)['trim']())),_0x4c6efc=_0x4d7db3['length'];this['_existingDataIds']=new Set(ks('data-id',null,_0x15272e)['map'](_0x5e6a3c=>Ps(_0x5e6a3c,'data-id'))['filter'](_0x30fd7e=>!!_0x30fd7e));for(const _0x51c9c8 of _0x4d7db3)_0x51c9c8&&_0x1c00b6(_0x51c9c8)&&void 0x0===_0x51c9c8['attribs']['data-id']&&Ds(_0x51c9c8,'data-id','new-element');if(ks('data-id',null,_0x5691f8)['forEach'](_0x266a37=>{const _0xcd99d3=Ps(_0x266a37,'data-id');'new-element'===_0xcd99d3||this['_existingDataIds']['has'](_0xcd99d3)||Ds(_0x266a37,'data-id','new-element');}),0x0===_0x15272e['childNodes']['length']){const _0x28e0a9=[];return ks('data-id','new-element',_0x5691f8)['forEach'](_0x184c23=>{const _0x226c68=this['_generateUid']();Ds(_0x184c23,'data-id',_0x226c68),_0x28e0a9['push'](_0x226c68);}),this['_removeSpecialComments'](_0x5691f8),{'parsedContent':_0x5691f8,'newNodeIds':_0x28e0a9,'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();let _0x2da67f=-0x1,_0x5ad097=!0x1;for(let _0x45e755=0x0;_0x45e755<_0x4c6efc;_0x45e755++){const _0x38e53b=_0x4d7db3[_0x45e755],_0x2207c9=_0x4d7db3[_0x45e755+0x1];if(this['_isNewNode'](_0x38e53b)){if(-0x1===_0x2da67f&&(_0x2da67f=_0x45e755),this['_markWrappedElements'](_0x38e53b),!this['_isNewNode'](_0x2207c9)){const [_0x208126,_0x53833]=this['_findReferenceNode'](_0x38e53b,_0x5ad097,_0x15272e);if(_0x208126){const _0x1572a9=Array['from'](_0x4d7db3)['slice'](_0x2da67f,_0x45e755+0x1);this['_insertNodes'](_0x208126,_0x1572a9,_0x53833),_0x2da67f=-0x1;}}}else{if(this['_isExistingContentComment'](_0x38e53b))_0x5ad097=!0x0;else{if(this['_isExistingNode'](_0x38e53b)){const _0x512894=Ps(_0x38e53b,'data-id');if(_0x512894&&this['_existingDataIds']['has'](_0x512894)){this['_referencedExistingIds']['add'](_0x512894);const _0x4c91eb=vs('data-id',_0x512894,_0x15272e);this['_replaceNode'](_0x4c91eb,_0x38e53b);}}else{if(nn(_0x38e53b)){const _0x19210b=rn(_0x38e53b);vs('data-id',_0x19210b,_0x5691f8)||this['_touchedNodesState']['removedIds']['push'](_0x19210b);}}}}}for(const _0x4f67bc of this['_touchedNodesState']['removedIds']){const _0x10834a=vs('data-id',_0x4f67bc,_0x15272e);_0x10834a&&(this['_rescueUnwrappedElements'](_0x10834a),this['_removeNode'](_0x10834a,_0x4f67bc,_0x146361));}if(ks('data-id','new-element',_0x15272e)['forEach'](_0x1e3aab=>{const _0x585a00=this['_getUid'](_0x1e3aab);Ds(_0x1e3aab,'data-id',_0x585a00),this['_touchedNodesState']['newIds']['push'](_0x585a00);}),this['_removeSpecialComments'](_0x15272e),_0x146361&&_0x146361['cutAfterUnstable']){const _0x37f0f7=this['_findLastConfirmationPoint'](_0x4d7db3),_0x5cd825=this['_getLastStableElement'](_0x15272e,_0x37f0f7);this['_markUnstableElements'](_0x15272e,_0x5cd825);}if(this['_processWrappedElements'](_0x15272e,_0x146361),_0x146361&&_0x146361['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x381e50=ks('data-id',this['_touchedNodesState']['lastTouchedId'],_0x15272e);let _0x16b4f3=_0x381e50[_0x381e50['length']-0x1];for(;_0x16b4f3;)Bs(_0x16b4f3),_0x16b4f3=_0x16b4f3['parentNode'];}return{'parsedContent':_0x15272e,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x36b95f,_0x392da3,_0x15484c){for(const _0x33b8ff of _0x392da3){const _0x3436d3=this['_getUid'](_0x33b8ff);Ds(_0x33b8ff,'data-id',_0x3436d3),this['_touchedNodesState']['newIds']['push'](_0x3436d3),this['_touchedNodesState']['lastTouchedId']=_0x3436d3;}const _0x12b36f='afterbegin'===_0x15484c||'afterend'===_0x15484c?_0x392da3['reverse']():_0x392da3;for(const _0x3bd787 of _0x12b36f)Hs(_0x36b95f,_0x3bd787,_0x15484c);}['_replaceNode'](_0x3e87ce,_0xe9536d){if(!_0x3e87ce)return;if(_0x4412ef=_0xe9536d,Us(Os(_0x3e87ce))===Us(Os(_0x4412ef)))return;var _0x4412ef;const _0x2f5da2=Ps(_0x3e87ce,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x2f5da2),this['_touchedNodesState']['lastTouchedId']=_0x2f5da2,_0x3d1fd1(_0x3e87ce,_0xe9536d['cloneNode'](!0x0));}['_removeNode'](_0x20571f,_0xc161e7,_0x3b4f3e){if(_0x3b4f3e&&_0x3b4f3e['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0xc161e7;const _0x2247c2=_0x3b4f3e['replaceRemovedWith']['cloneNode'](!0x0);Ds(_0x2247c2,'data-id',_0xc161e7),Ds(_0x2247c2,'data-removed','true'),_0x3d1fd1(_0x20571f,_0x2247c2);}else _0x11f553(_0x20571f);}['_findReferenceNode'](_0x549670,_0x25758b,_0x2fd956){const _0x309bda=this['_findPrevElementWithDataId'](_0x549670,!0x1);if(_0x309bda){const _0x33998f=rn(_0x309bda),_0x42569a=vs('data-id',_0x33998f,_0x2fd956);if(_0x42569a)return[_0x42569a,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x33998f);}const _0x3b4405=this['_findNextElementWithDataId'](_0x549670,!0x1);if(_0x3b4405){const _0x2ed714=rn(_0x3b4405),_0x2c4da7=vs('data-id',_0x2ed714,_0x2fd956);if(_0x2c4da7)return[_0x2c4da7,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x2ed714);}return _0x25758b?_0x549670['nextSibling']?this['_findFallbackReferenceNode'](_0x549670,_0x2fd956):[_0x2fd956['childNodes'][_0x2fd956['childNodes']['length']-0x1],'afterend']:[_0x2fd956['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x582ff0,_0x301ad2){const _0x242b83=[],_0x17570b=this['_findPrevElementWithDataId'](_0x582ff0,!0x0);if(_0x17570b){const _0x36dbf5=vs('data-id',rn(_0x17570b),_0x301ad2);_0x36dbf5&&_0x242b83['push']([_0x36dbf5,'afterend']);}const _0x255233=this['_findNextElementWithDataId'](_0x582ff0,!0x0);if(_0x255233){const _0x69e877=vs('data-id',rn(_0x255233),_0x301ad2);_0x69e877&&_0x242b83['push']([_0x69e877,'beforebegin']);}return _0x242b83['length']>0x1?Vs(_0x242b83[0x0][0x0])<=Vs(_0x242b83[0x1][0x0])?_0x242b83[0x0]:_0x242b83[0x1]:0x1===_0x242b83['length']?_0x242b83[0x0]:[_0x301ad2['lastChild'],'afterend'];}_findNextElementWithDataId(_0x2c9843,_0x3fde27){let _0x31c22b=_0x2c9843['nextSibling'],_0x5131ed=null,_0x592fc0=!0x1;for(;_0x31c22b;){if(_0x259173(_0x31c22b)){if(nn(_0x31c22b)&&(_0x5131ed=_0x31c22b),this['_isExistingContentComment'](_0x31c22b)&&_0x3fde27&&!_0x592fc0){_0x592fc0=!0x0,_0x31c22b=_0x31c22b['nextSibling'];continue;}break;}const _0x189617=Ps(_0x31c22b,'data-id');if(_0x189617&&'new-element'!==_0x189617&&this['_existingDataIds']['has'](_0x189617)){_0x5131ed=_0x31c22b;break;}_0x31c22b=_0x31c22b['nextSibling'];}return _0x5131ed;}_findPrevElementWithDataId(_0x33f5f8,_0x5ce2e4){let _0x2d391e=_0x33f5f8['previousSibling'],_0x18d660=null,_0x27a0fa=!0x1;for(;_0x2d391e;){if(_0x259173(_0x2d391e)){if(nn(_0x2d391e)&&(_0x18d660=_0x2d391e),this['_isExistingContentComment'](_0x2d391e)&&_0x5ce2e4&&!_0x27a0fa){_0x27a0fa=!0x0,_0x2d391e=_0x2d391e['previousSibling'];continue;}break;}const _0x26ffad=Ps(_0x2d391e,'data-id');if(_0x26ffad&&'new-element'!==_0x26ffad&&this['_existingDataIds']['has'](_0x26ffad)){_0x18d660=_0x2d391e;break;}_0x2d391e=_0x2d391e['previousSibling'];}return _0x18d660;}_markWrappedElements(_0x139a92){_0x1c00b6(_0x139a92)&&ks('data-id',null,_0x139a92)['forEach'](_0x595b55=>{this['_isExistingNode'](_0x595b55)&&(Ds(_0x595b55,'data-wrapped-id',Ps(_0x595b55,'data-id')),Ds(_0x595b55,'data-id',null));});}_processWrappedElements(_0x33e199,_0x44e429){ks('data-wrapped-id',null,_0x33e199)['forEach'](_0x2dc39c=>{const _0x49c4d0=Ps(_0x2dc39c,'data-wrapped-id');if(this['_hasUnstableParent'](_0x2dc39c))return;const _0x5eb0ca=vs('data-id',_0x49c4d0,_0x33e199);Ds(_0x2dc39c,'data-id',_0x49c4d0),_0x5eb0ca&&(this['_removeNode'](_0x5eb0ca,_0x49c4d0,_0x44e429),this['_touchedNodesState']['removedIds']['push'](_0x49c4d0),this['_touchedNodesState']['lastTouchedId']=_0x49c4d0);});}_hasUnstableParent(_0x197809){let _0x312e56=_0x197809['parentNode'];for(;_0x312e56;){if(Ps(_0x312e56,'data-unstable'))return!0x0;_0x312e56=_0x312e56['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x308bf2){const _0x402307=new Set(this['_touchedNodesState']['removedIds']),_0x39e220=new Set(this['_touchedNodesState']['newIds']);ks('data-id',null,_0x308bf2)['forEach'](_0x4f90c3=>{const _0x12260a=Ps(_0x4f90c3,'data-id'),_0x32fa5a=!!_0x12260a&&this['_referencedExistingIds']['has'](_0x12260a),_0x55c8ea=!!_0x12260a&&_0x39e220['has'](_0x12260a);if(!_0x12260a||!_0x32fa5a&&!_0x55c8ea)return;if(_0x402307['has'](_0x12260a))return;let _0x169d7f=_0x4f90c3['parentNode'],_0x1e7536=!0x1;for(;_0x169d7f;){if(_0x169d7f===_0x308bf2){_0x1e7536=!0x0;break;}const _0x24854a=Ps(_0x169d7f,'data-id');if(_0x24854a&&(this['_referencedExistingIds']['has'](_0x24854a)||_0x39e220['has'](_0x24854a)))return;_0x169d7f=_0x169d7f['parentNode'];}if(_0x1e7536){if(ti(_0x308bf2,_0x4f90c3),_0x32fa5a){const _0x4e6197=this['_generateUid'](),_0x21064c=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x12260a);-0x1!==_0x21064c&&this['_touchedNodesState']['modifiedIds']['splice'](_0x21064c,0x1),Ds(_0x4f90c3,'data-unwrapped-id',_0x12260a),Ds(_0x4f90c3,'data-id',_0x4e6197),this['_touchedNodesState']['newIds']['push'](_0x4e6197),this['_touchedNodesState']['rescuedNewIds']['add'](_0x4e6197),this['_touchedNodesState']['lastTouchedId']=_0x4e6197;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x12260a),this['_touchedNodesState']['lastTouchedId']=_0x12260a;}});}_getUid(_0x426979){return this['_isExistingNode'](_0x426979)?Ps(_0x426979,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x2ec84e){Ls(_0x2ec84e)['filter'](_0x57131e=>nn(_0x57131e)||this['_isExistingContentComment'](_0x57131e))['forEach'](_0x5b29b4=>{_0x11f553(_0x5b29b4);});}_findLastConfirmationPoint(_0x23171e){let _0x21b4fc=null,_0x841910=null,_0x39ed94=null,_0x21a740=null;const _0x5d7612=_0x291bde=>{_0x291bde&&(_0x21b4fc=_0x291bde),_0x39ed94=null,_0x21a740=null;};for(let _0xb89663=0x0;_0xb89663<_0x23171e['length'];_0xb89663++){const _0x421b2a=_0x23171e[_0xb89663];if(this['_isExistingContentComment'](_0x421b2a)){_0x5d7612(_0x841910);continue;}if(_0x1c00b6(_0x421b2a)){const _0x281a95=Ps(_0x421b2a,'data-id'),_0x3514b6=_0xb89663===_0x23171e['length']-0x1;if(_0x281a95&&'new-element'!==_0x281a95&&this['_touchedNodesState']['modifiedIds']['includes'](_0x281a95)&&!_0x3514b6){_0x5d7612(_0x281a95),_0x841910=_0x281a95;continue;}}let _0x267cc2;const _0x4c511c=rn(_0x421b2a);if(_0x4c511c&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x4c511c))_0x841910=_0x4c511c;else{if(_0x4c511c&&this['_touchedNodesState']['newIds']['includes'](_0x4c511c))_0x267cc2='N';else{if(!nn(_0x421b2a))continue;_0x267cc2='R';}_0x267cc2===_0x21a740||null===_0x21a740?_0x21a740=_0x267cc2:null!==_0x39ed94?(_0x5d7612(_0x841910),_0x21a740=_0x267cc2):(_0x39ed94=_0x21a740,_0x21a740=_0x267cc2),_0x841910=_0x4c511c;}}const _0x1ed6b6=_0x23171e[_0x23171e['length']-0x1];return _0x1ed6b6&&!_0x1c00b6(_0x1ed6b6)&&!nn(_0x1ed6b6)&&_0x841910&&_0x5d7612(_0x841910),_0x21b4fc;}_getLastStableElement(_0x5bc2d9,_0x552ded){if(!_0x552ded)return null;const _0x2ec0f4=vs('data-id',_0x552ded,_0x5bc2d9);if(!_0x2ec0f4)return null;const _0x411976=[_0x2ec0f4,...Ms(_0x2ec0f4)]['at'](-0x2);if(_0x411976===_0x2ec0f4)return _0x2ec0f4;let _0x339697=_0x411976['previousSibling'];for(;_0x339697&&!_0x1c00b6(_0x339697);)_0x339697=_0x339697['previousSibling'];return _0x339697;}_markUnstableElements(_0x43d76a,_0x538c79){const _0x3f1a2d=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x33bca5=_0x538c79?_0x538c79['nextSibling']:_0x43d76a['firstChild'];for(;_0x33bca5;)_0x1c00b6(_0x33bca5)&&(_0x3f1a2d['has'](Ps(_0x33bca5,'data-id'))||ks('data-id',null,_0x33bca5)['some'](_0x5644ce=>_0x3f1a2d['has'](Ps(_0x5644ce,'data-id'))))&&Ds(_0x33bca5,'data-unstable','true'),_0x33bca5=_0x33bca5['nextSibling'];}['_isNewNode'](_0x51decd){return Boolean('new-element'===Ps(_0x51decd,'data-id'));}_isExistingNode(_0x58948d){return Boolean((Ps(_0x58948d,'data-id')||'')['length']>0x0&&'new-element'!==Ps(_0x58948d,'data-id'));}_isExistingContentComment(_0x518a9c){return Boolean(_0x259173(_0x518a9c)&&Os(_0x518a9c)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function nn(_0x22b527){return!!_0x22b527&&Boolean(_0x259173(_0x22b527)&&Os(_0x22b527)['match'](/removed[\s*-]data-id="[^"]+"/));}function rn(_0x581a0b){if(!_0x581a0b)return null;if(_0x1c00b6(_0x581a0b))return Ps(_0x581a0b,'data-id')??null;if(_0x259173(_0x581a0b)){const _0x5ad655=Os(_0x581a0b)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x5ad655&&_0x5ad655[0x1])return _0x5ad655[0x1];}return null;}function on(_0x4f76d9,_0x3cb88b){const _0x5f2e2c=new Map();for(const _0x42848f of ys(_0x4f76d9))xs(_0x42848f)||_0x5f2e2c['set'](Ps(_0x42848f,'data-id'),_0x42848f);const _0x33c3c8=new Set();for(const _0x4cba94 of ys(_0x3cb88b)){if(xs(_0x4cba94))continue;const _0x439022=Ps(_0x4cba94,'data-id'),_0x20ddbb=_0x439022?_0x5f2e2c['get'](_0x439022):void 0x0;_0x20ddbb?(_0x3d1fd1(_0x4cba94,_0x40285a(_0x20ddbb,!0x0)),_0x33c3c8['add'](_0x439022)):_0x11f553(_0x4cba94);}for(const _0x3d890e of Ls(_0x3cb88b))nn(_0x3d890e)&&_0x5f2e2c['has'](rn(_0x3d890e))&&_0x11f553(_0x3d890e);const _0x187ff2=new Set(ks('data-id',null,_0x3cb88b)['map'](_0x2ed106=>Ps(_0x2ed106,'data-id')));for(const [_0x536736,_0x40fdf2]of _0x5f2e2c){if(_0x33c3c8['has'](_0x536736))continue;let _0xd48577=_0x40fdf2['parent'],_0x445da7=null;for(;_0xd48577&&_0x1c00b6(_0xd48577);){const _0x37b2a3=Ps(_0xd48577,'data-id');if(_0x37b2a3&&_0x187ff2['has'](_0x37b2a3)){_0x445da7=_0x37b2a3;break;}_0xd48577=_0xd48577['parent'];}if(!_0x445da7)continue;const _0x552eff=vs('data-id',_0x445da7,_0x3cb88b);_0x552eff&&_0x88365f(_0x552eff,_0x40285a(_0x40fdf2,!0x0));}}const an=/* #__PURE__ -- @preserve */
|
|
27
|
-
At();var hn=class extends an{_m2html;constructor(){super();const _0x339e4c=Object['entries'](_0x222f27),_0x3031e4=_0x339e4c['findIndex'](([_0x23af3d])=>'rehypeDomRaw'===_0x23af3d);if(-0x1===_0x3031e4)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x339e4c['splice'](_0x3031e4+0x1,0x0,['rehypeSanitize',_0x2ece53]),this['_m2html']=new _0x2b0b3a({'plugins':Object['fromEntries'](_0x339e4c)});}convertMarkdownToHTML(_0x3c8fcf){const _0x2ad230=this['_m2html']['parse'](_0x3c8fcf);return this['parseAndNormalizeHTML'](_0x2ad230);}['parseAndNormalizeHTML'](_0x1e4c51){return this['_parseHTML'](_0x1e4c51);}['_parseHTML'](_0x75d404){const _0x203f44=Rs('<dummy>'+_0x75d404['replace'](/<[^>]*?$/g,'')+'</dummy>');return cn(_0x203f44),_0x203f44['children']=_0x203f44['children'][0x0]['children'],_0x203f44;}};function cn(_0x1ebdae){for(const _0x54a781 of _0x1ebdae['children'])_0x1c00b6(_0x54a781)?'pre'!==_0x54a781['name']&&cn(_0x54a781):_0x56307a(_0x54a781)&&(_0x54a781['data']=_0x54a781['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function ln({changeGroups:_0xcf67cc,documentContextContent:_0x5b0131,showDiff:_0xda945c,trimUnchanged:_0xfffdc4=!0x0}){const _0x92ee46=qs(_0xcf67cc,_0x5b0131);return _0xcf67cc['map'](_0x270d89=>{if(!_0x270d89['editor']||'destroyed'===_0x270d89['editor']['state'])return null;const _0x71fc18=Gs(_0x270d89['editor'],_0x270d89['rootName']),_0x30442b=new _0x2fcdd7([]),_0x48cdb3=new _0x2fcdd7([]),_0xc2c068=new Set();for(const _0x5869e3 of _0x270d89['changes'])'new'==_0x5869e3['type']&&ks('data-id',null,_0x5869e3['node'])['forEach'](_0x223cd0=>{_0xc2c068['add'](Ps(_0x223cd0,'data-id'));});for(const _0x41064c of _0x270d89['changes'])if('removed'!=_0x41064c['type']?_0x48cdb3['children']['push'](_0x41064c['node']['cloneNode'](!0x0)):_0xda945c||_0xc2c068['has'](_0x41064c['id'])||_0x48cdb3['children']['push'](_0x41064c['node']['cloneNode'](!0x0)),'new'!=_0x41064c['type']&&(_0xda945c||'removed'!=_0x41064c['type'])){const _0x2e27c4=_0x1478a8(_0x3497a6=>Ps(_0x3497a6,'data-id')==_0x41064c['id'],_0x5b0131['get'](_0x270d89['documentId']),!0x0);_0x2e27c4&&_0x30442b['children']['push'](_0x2e27c4['cloneNode'](!0x0));}if(_0x71fc18&&_0x92ee46['has'](_0x270d89['index']))return{'type':_0x270d89['changes'][0x0]['type'],'index':_0x270d89['index'],'state':_0x270d89['state'],'outdatedReason':_0x270d89['outdatedReason'],'content':new _0x2fcdd7([]),'hasChanges':!0x1};let _0x424987,_0x3bda45,_0x43c847;try{({content:_0x424987,hasChanges:_0x3bda45}=un(_0x270d89['editor'],_0x30442b,_0x48cdb3,_0xda945c,_0xfffdc4));}catch{return{'type':_0x270d89['changes'][0x0]['type'],'index':_0x270d89['index'],'state':_0x270d89['state'],'outdatedReason':_0x270d89['outdatedReason'],'content':new _0x2fcdd7([]),'hasChanges':!0x1};}if(_0x71fc18){_0x43c847=_0x270d89['editor']['ui']['getEditableElement'](_0x270d89['rootName'])?.['tagName']['toLowerCase']();const _0x409270=_0x424987['children']['filter'](_0x1c00b6);0x1===_0x409270['length']&&(_0x424987=new _0x2fcdd7(_0x409270[0x0]['children']));}return{'type':_0x270d89['changes'][0x0]['type'],'index':_0x270d89['index'],'state':_0x270d89['state'],'outdatedReason':_0x270d89['outdatedReason'],'content':_0x424987,'hasChanges':_0x3bda45,'wrapperTag':_0x43c847};})['filter'](_0x2f3820=>null!==_0x2f3820);}function un(_0x243c0d,_0x35861f,_0x3e6f4b,_0x43f730,_0x3ca007=!0x0){const _0x5ded37=_0x243c0d['plugins']['get']('DocumentCompare'),_0x31d647=Os(_0x35861f),_0x2bcf0c=Os(_0x3e6f4b),_0xe37e50=_0x243c0d['data']['parse'](_0x31d647,'$root'),_0x2a9309=_0x243c0d['model']['createPositionAt'](_0xe37e50,0x0),_0x814078=_0x5ded37['getDiff'](_0x31d647,_0x2bcf0c,{'anchor':_0x2a9309,'markDeletions':_0x43f730,'targetEditor':_0x243c0d})['getOperations']();if(0x0==_0x814078['length'])return{'content':_0x35861f['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x43f730?function(_0x47056c,_0x34a841,_0x4ae71b){if(0x0==_0x47056c['length'])return;const _0x359cad=_0x4ae71b['plugins']['get']('DocumentCompare'),_0x16df1a=_0x4ae71b['plugins']['get']('SuggestionsConversion');_0x4ae71b['model']['change'](_0xe504e=>{const _0x417245=new Set();for(let _0x3107dd=0x0;_0x3107dd<_0x47056c['length'];_0x3107dd++){const _0x118b57=_0x47056c[_0x3107dd];if(_0x118b57['baseVersion']=null,_0x118b57['isDocumentOperation']=!0x1,!_0x27f0ea(_0x118b57)){if(_0x359cad['isMarkedRemoveOperation'](_0x118b57)){const _0x5301ef=_0x167f0b(_0x118b57['newRange'],_0x4ae71b['model']),_0x249480='suggestion:deletion:'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x249480,_0x5301ef);}else switch(_0x118b57['type']){case'rename':{if(_0x118b57['oldName']==_0x118b57['newName'])break;_0xe504e['batch']['addOperation'](_0x118b57),_0x4ae71b['model']['applyOperation'](_0x118b57);const _0x37b6a0='$elementName',_0x505f54=_0x118b57['position'],_0x5436e5=_0x4ae71b['model']['createRange'](_0x505f54,_0x4ae71b['model']['createPositionAt'](_0x505f54['nodeAfter'],'end')),_0x5f4f4c='suggestion:attribute:'+_0x37b6a0+':'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x5f4f4c,_0x5436e5);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x118b57['oldValue']==_0x118b57['newValue'])break;_0xe504e['batch']['addOperation'](_0x118b57),_0x4ae71b['model']['applyOperation'](_0x118b57);const _0x218f77=_0x118b57['key'];if(!_0x16df1a['isRegisteredAttribute'](_0x218f77))break;const _0x98c12f=_0x167f0b(_0x118b57['range'],_0x4ae71b['model']),_0x1a8225='suggestion:attribute:'+_0x218f77+':'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x1a8225,_0x98c12f);break;}case'insert':{if(_0xe504e['batch']['addOperation'](_0x118b57),_0x4ae71b['model']['applyOperation'](_0x118b57),dn(_0x34a841,_0x118b57),_0x47056c[_0x3107dd+0x1]&&'move'==_0x47056c[_0x3107dd+0x1]['type'])break;const _0x55d914=_0x118b57['position'],_0x542387=_0x118b57['howMany'],_0x1bbfea=_0x167f0b(_0x4ae71b['model']['createRange'](_0x55d914,_0x55d914['getShiftedBy'](_0x542387)),_0x4ae71b['model']),_0x5a4626='suggestion:insertion:'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x5a4626,_0x1bbfea);break;}case'split':{_0xe504e['batch']['addOperation'](_0x118b57),_0x4ae71b['model']['applyOperation'](_0x118b57),dn(_0x34a841,_0x118b57);const _0x5d9fe4=_0x118b57['splitPosition'],_0x7b991=_0x118b57['moveTargetPosition'],_0xab7248=_0x4ae71b['model']['createRange'](_0x5d9fe4,_0x7b991),_0x5da1c3='suggestion:insertion:'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x5da1c3,_0xab7248);break;}case'move':{_0xe504e['batch']['addOperation'](_0x118b57),_0x4ae71b['model']['applyOperation'](_0x118b57),dn(_0x34a841,_0x118b57);const _0x3dc2d6=_0x118b57['getMovedRangeStart'](),_0x112510=_0x118b57['howMany'];for(let _0x4a78c0=0x0;_0x4a78c0<_0x112510;_0x4a78c0++){const _0x3d879f=_0x3dc2d6['getShiftedBy'](_0x4a78c0)['nodeAfter'];_0x417245['add'](_0x3d879f);}break;}case'remove':{const _0x1029fb=_0x118b57['sourcePosition'],_0x58f1bf=_0x118b57['howMany'],_0x2ffb62=new _0x10a40c(_0x1029fb,_0x58f1bf);_0xe504e['batch']['addOperation'](_0x2ffb62),_0x4ae71b['model']['applyOperation'](_0x2ffb62),dn(_0x34a841,_0x118b57);break;}}}}for(const _0x395f8a of _0x417245){const _0x551c9c=_0x4ae71b['model']['createRangeOn'](_0x395f8a),_0x20ed43='suggestion:formatBlock:$fakeWrap:'+kt()+':$aiSuggestion';_0x34a841['markers']['set'](_0x20ed43,_0x167f0b(_0x551c9c,_0x4ae71b['model']));}});}(_0x814078,_0xe37e50,_0x243c0d):_0x243c0d['model']['change'](_0x38dc33=>{for(const _0x58f18e of _0x814078)if(!_0x27f0ea(_0x58f18e)){if('remove'==_0x58f18e['type']){const _0x1b173c=_0x58f18e['sourcePosition'],_0xc4b333=_0x58f18e['howMany'],_0x4e2450=new _0x10a40c(_0x1b173c,_0xc4b333);_0x38dc33['batch']['addOperation'](_0x4e2450),_0x243c0d['model']['applyOperation'](_0x4e2450),dn(_0xe37e50,_0x58f18e);}else{if('marker'==_0x58f18e['type']){const _0x342579=_0x58f18e['name'],_0x3f4670=_0x58f18e['newRange'];null!==_0x3f4670?_0xe37e50['markers']['set'](_0x342579,_0x3f4670):_0xe37e50['markers']['delete'](_0x342579);}else _0x58f18e['baseVersion']=null,_0x58f18e['isDocumentOperation']=!0x1,_0x38dc33['batch']['addOperation'](_0x58f18e),_0x243c0d['model']['applyOperation'](_0x58f18e),dn(_0xe37e50,_0x58f18e);}}}),_0x3ca007){const _0x5e8066=_n(_0x243c0d,_0x814078,_0xe37e50);An(_0x243c0d['model'],_0x5e8066),function(_0x1c0565,_0xe80698){const _0x2c78fa=_0xe80698['getFirstRange']()['start'];let _0x52ce27=_0xe80698['getFirstRange']()['end'];const _0x4609cc=_0x2c78fa['root'];(_0x52ce27['textNode']||_0x52ce27['nodeAfter']&&_0x52ce27['nodeAfter']['is']('$text'))&&(_0x6c9cae(_0x52ce27,'...'),En(_0x4609cc,_0x52ce27,0x3),_0x52ce27=_0x52ce27['getShiftedBy'](0x3)),(_0x2c78fa['textNode']||_0x2c78fa['nodeBefore']&&_0x2c78fa['nodeBefore']['is']('$text'))&&(_0x6c9cae(_0x2c78fa,'...'),En(_0x4609cc,_0x2c78fa,0x3),_0x2c78fa['parent']==_0x52ce27['parent']&&(_0x52ce27=_0x52ce27['getShiftedBy'](0x3)));const _0x3ce022=_0x1c0565['createRange'](_0x1c0565['createPositionAt'](_0x4609cc,0x0),_0x2c78fa),_0x586efe=_0x1c0565['createRange'](_0x52ce27,_0x1c0565['createPositionAt'](_0x4609cc,'end')),_0x4e611b=[..._0x3ce022['getMinimalFlatRanges'](),..._0x586efe['getMinimalFlatRanges']()];_0x4e611b['reverse']();for(const _0x569864 of _0x4e611b)_0x21c658(_0x569864),pn(_0x4609cc,_0x569864);}(_0x243c0d['model'],_0x5e8066);}return{'content':Rs(_0x243c0d['data']['stringify'](_0xe37e50,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function dn(_0x343913,_0x464e55){for(const [_0x5e3dcb,_0x144469]of _0x343913['markers']){const _0x165cc9=_0x244cab['_createFromRanges'](_0x144469['getTransformedByOperation'](_0x464e55));_0x165cc9['root']==_0x343913?_0x343913['markers']['set'](_0x5e3dcb,_0x165cc9):_0x343913['markers']['delete'](_0x5e3dcb);}}function _n(_0x4cd29f,_0x6c4e95,_0x16aa3e){const _0x17e927=_0x4cd29f['plugins']['get']('DocumentCompare');let _0x21c6a0=_0x4cd29f['model']['createPositionAt'](_0x16aa3e,Number['POSITIVE_INFINITY']),_0x19065f=_0x4cd29f['model']['createPositionAt'](_0x16aa3e,0x0);for(const _0x439688 of _0x6c4e95){let _0x120824,_0x1e0dee;if(_0x17e927['isMarkedRemoveOperation'](_0x439688))_0x120824=_0x439688['newRange']['start'],_0x1e0dee=_0x439688['newRange']['end'];else switch(_0x21c6a0=gn(_0x21c6a0,_0x439688),_0x19065f=gn(_0x19065f,_0x439688),_0x439688['type']){case'rename':_0x120824=_0x439688['position'],_0x1e0dee=_0x120824['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x120824=_0x439688['range']['start'],_0x1e0dee=_0x439688['range']['end'];break;case'insert':_0x120824=_0x439688['position'],_0x1e0dee=_0x120824['getShiftedBy'](_0x439688['howMany']);break;case'split':_0x120824=_0x439688['splitPosition'],_0x1e0dee=_0x439688['moveTargetPosition'];break;case'merge':{const _0xd70373=_0x439688['targetPosition']['path']['slice'](0x0,-0x1);_0x120824=_0x4cd29f['model']['createPositionFromPath'](_0x16aa3e,_0xd70373),_0x1e0dee=_0x120824['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x5a997c=_0x439688['howMany'],_0x1efa3c=_0x439688['sourcePosition']['_getTransformedByInsertion'](_0x439688['targetPosition'],_0x5a997c),_0x312564=_0x439688['getMovedRangeStart']();'remove'==_0x439688['type']?(_0x120824=_0x1efa3c,_0x1e0dee=_0x1efa3c):(_0x120824=_0x312564,_0x1e0dee=_0x312564['getShiftedBy'](_0x5a997c));break;}}_0x120824&&_0x120824['isBefore'](_0x21c6a0)&&(_0x21c6a0=_0x120824['clone'](),_0x21c6a0['stickiness']='toNone'),_0x1e0dee&&_0x1e0dee['isAfter'](_0x19065f)&&(_0x19065f=_0x1e0dee['clone'](),_0x19065f['stickiness']='toNone');}return _0x4cd29f['model']['createSelection'](_0x4cd29f['model']['createRange'](_0x21c6a0,_0x19065f));}function gn(_0x42cf75,_0x44eab7){return'move'!=_0x44eab7['type']&&'remove'!=_0x44eab7['type']||_0x44eab7['sourceRange']['containsPosition'](_0x42cf75)&&((_0x42cf75=_0x44eab7['sourcePosition']['clone']())['stickiness']='toNone'),_0x42cf75['getTransformedByOperation'](_0x44eab7);}function An(_0x21b3a0,_0x38526c){In(_0x21b3a0,_0x38526c,'forward');const _0x3a021b=_0x38526c['getFirstRange']();_0x38526c['setTo']([]),_0x38526c['setTo'](_0x3a021b,{'backward':!0x0}),In(_0x21b3a0,_0x38526c,'backward');}function In(_0x40d3ca,_0xbaae2c,_0x17f76f){let _0x1756f7=0x14;for(;_0x1756f7;){_0x40d3ca['modifySelection'](_0xbaae2c,{'unit':'word','direction':_0x17f76f}),_0x1756f7--;const _0x4c0675=_0xbaae2c['focus']['forward'==_0x17f76f?'nodeBefore':'nodeAfter'];if(_0x4c0675&&_0x4c0675['is']('element')&&_0x40d3ca['schema']['isBlock'](_0x4c0675)&&_0x40d3ca['schema']['isObject'](_0x4c0675))break;}}function pn(_0x5bcc6f,_0x5eb6a9){for(const [_0x154dd0,_0x280bdc]of _0x5bcc6f['markers']){const _0x483d7c=_0x280bdc['_getTransformedByDeletion'](_0x5eb6a9['start'],_0x5eb6a9['end']['offset']-_0x5eb6a9['start']['offset']);null!=_0x483d7c?_0x5bcc6f['markers']['set'](_0x154dd0,_0x483d7c):_0x5bcc6f['markers']['delete'](_0x154dd0);}}function En(_0x34d68e,_0x451e7c,_0x1fd1fa){for(let [_0x339ba2,_0x112a1b]of _0x34d68e['markers'])_0x112a1b=_0x112a1b['_getTransformedByInsertion'](_0x451e7c,_0x1fd1fa,!0x1)[0x0],_0x34d68e['markers']['set'](_0x339ba2,_0x112a1b);}function mn(_0x36f7dc,_0x333625){for(const _0x3ad527 of _0x36f7dc)'noop'!==_0x3ad527['type']&&(_0x3ad527['_aiSource']=_0x333625);}var Tn=class extends _0x2b8fcb{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x2cd097,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x4b6980,_0x593e7d){const {applyMethod:_0x4690e6,roots:_0x31a516}=_0x593e7d,_0x4c0749='suggest'===_0x4690e6;if(_0x4b6980['error']||!_0x4b6980['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x4b6980['status']});if(_0x31a516){if(0x0===_0x31a516['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0xe3e0ba,rootName:_0x255d34}of _0x31a516)if(!_0x4b6980['results']['some'](_0x4bf11a=>_0x4bf11a['channelId']===_0xe3e0ba&&_0x4bf11a['rootName']===_0x255d34))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0xe3e0ba,'rootName':_0x255d34});}const _0x1692a5=_0x4b6980['results']['reduce']((_0x1df4aa,_0xc8873c)=>{if(_0x31a516&&!_0x31a516['some'](_0x29ef09=>_0x29ef09['channelId']===_0xc8873c['channelId']&&_0x29ef09['rootName']===_0xc8873c['rootName']))return _0x1df4aa;if('completed'!==_0xc8873c['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0xc8873c['status'],'channelId':_0xc8873c['channelId'],'rootName':_0xc8873c['rootName']});if(_0x4c0749&&!_0xc8873c['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0xc8873c['channelId'],'rootName':_0xc8873c['rootName']});let _0x598587=_0x1df4aa['get'](_0xc8873c['editor']);return _0x598587||(_0x598587=[],_0x1df4aa['set'](_0xc8873c['editor'],_0x598587)),_0x598587['push'](_0xc8873c),_0x1df4aa;},new Map()),_0x2fbc1f=this['context']['plugins']['get'](_0x2cd097);for(const [_0x2d2b24,_0xb234d1]of _0x1692a5){const _0x22554d=_0xb234d1['map'](_0x1ab1a0=>{const _0x26172f=_0x2d2b24['model']['createPositionAt'](_0x2d2b24['model']['document']['getRoot'](_0x1ab1a0['rootName']),0x0),_0x4df8f8=Qs(_0x2d2b24,_0x1ab1a0['rootName'],_0x1ab1a0['contentRawOld'],_0x1ab1a0['contentRawNew']);if(!_0x4df8f8)return _0x1ab1a0['droppedUnsupportedInlineChange']=!0x0,null;const _0x329f19=_0x2fbc1f['getDiff'](_0x4df8f8['before'],_0x4df8f8['after'],{'anchor':_0x26172f,'markDeletions':_0x4c0749,'targetEditor':_0x2d2b24}),_0x30776b=_0x2d2b24['model']['document']['history']['getOperations'](_0x1ab1a0['documentVersion']),_0x27c3a6={'document':_0x2d2b24['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4e1a75=_0x305f08(_0x329f19['getOperations'](),_0x30776b,_0x27c3a6)['operationsA'];return mn(_0x4e1a75,_0x593e7d['aiSource']??'api'),_0x4e1a75;});_0x2d2b24['model']['change'](_0x27b105=>{for(const _0x22f7e8 of _0x22554d)_0x22f7e8&&(_0x4c0749?_0x2d2b24['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x22f7e8):_0x2fbc1f['applyOperations'](_0x27b105,_0x22f7e8));});}}mergeChangesIntoContent(_0x86ee3b,_0x302b9b,_0x47282b){const _0x25cfe9=new hn(),_0x7549f7=new sn();let _0x3d3d01=_0x25cfe9['parseAndNormalizeHTML'](_0x302b9b);for(const _0x53a19c of _0x86ee3b)try{const _0x1a14fd=_0x25cfe9['parseAndNormalizeHTML'](_0x53a19c['content']);_0x3d3d01=_0x7549f7['merge'](_0x1a14fd,_0x3d3d01,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x25f455){throw new ct('ai-gateway-merge-failed',this,{..._0x53a19c},_0x25f455);}return un(_0x47282b,_0x25cfe9['parseAndNormalizeHTML'](_0x302b9b),_0x3d3d01,!0x1,!0x1)['content'];}};const wn=/* #__PURE__ -- @preserve */
|
|
28
|
-
dt(),
|
|
29
|
-
At();var
|
|
30
|
-
dt(),
|
|
31
|
-
At();var Yn=class AIContext extends Wn{['_refs'];constructor(_0x13c79c=[]){super(),this['_refs']=[..._0x13c79c];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x3fe304){return new AIContext([...this['_refs'],..._0x3fe304]);}addDefaultContext(_0xfd0936){this['_refs']=[...this['_refs'],..._0xfd0936];}toRequestParts(_0x14c8c2=[]){return[...this['_refs']['map'](As),..._0x14c8c2];}toMessageAttributes(_0x10c88c){return this['isEmpty']?_0x10c88c:{..._0x10c88c,[Kn]:[...new Set(this['_refs']['map'](_0x5340b0=>_0x5340b0['id']))]};}static getDefaultContextIds(_0x136a0f){const _0xb915a2=_0x136a0f&&_0x136a0f[Kn];return new Set(Array['isArray'](_0xb915a2)?_0xb915a2:[]);}};const $n=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']]),qn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Qn=class AIChatContext extends Yn{_connector;['_config'];['_ownerId'];constructor({connector:_0x128724,config:_0x244b47,ownerId:_0x5919f5}){super(),this['_connector']=_0x128724,this['_config']=_0x244b47,this['_ownerId']=_0x5919f5;}init(){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}getPendingContextItems(){return new Map(this['_pendingContextItems']);}async populateFromMessage(_0x195e4b,_0x5007c8,_0x6751b8=new Set()){const _0x139917=new Map(),{contextItem:_0x541aab,unmatchedDocumentIds:_0x2ff739}=await this['_populateDocumentContextItem'](_0x195e4b,_0x5007c8);_0x541aab&&_0x139917['set'](_0x541aab['id'],_0x541aab);for(const _0x4bb9ca of _0x195e4b){if('document'===_0x4bb9ca['type'])continue;const _0x439f8a=await this['_createContextItemFromContent'](_0x4bb9ca,_0x6751b8);'context'!==_0x439f8a['type']&&this['_addToConversationContextItem'](_0x439f8a),_0x139917['set'](_0x439f8a['id'],_0x439f8a);}return{'contextItems':_0x139917,'hasUnmatched':_0x2ff739['size']>0x0,'unmatchedDocumentIds':_0x2ff739};}async _populateDocumentContextItem(_0x3272d2,_0x26923e){const _0x5c5600=_0x3272d2['filter'](_0x446979=>'document'===_0x446979['type']);if(0x0===_0x5c5600['length'])return{'unmatchedDocumentIds':new Set()};const _0x5d9806=_0x5c5600['map'](_0x2c0e13=>_0x2c0e13['id']),_0x398a84=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x5d9806)['getDocuments'](),_0x1317a9=new Map(_0x398a84['map'](_0x22d8fc=>[_0x22d8fc['id'],_0x22d8fc])),_0x30e360=[],_0x28f030=new Set();for(const _0x53d20b of _0x5c5600){const _0xe18445=_0x1317a9['get'](_0x53d20b['id']);_0xe18445&&(this['_matchDocumentToRoot'](_0xe18445,_0x26923e)||_0x28f030['add'](_0xe18445['id']),_0x30e360['push']({'id':_0xe18445['id'],'content':_0xe18445['content'],'version':_0xe18445['attributes']?.['version']??0x0,'sessionId':_0xe18445['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0xe18445['attributes']?.['channelId']??_0x26923e[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0xe18445['attributes']?.['rootName']??_0x26923e[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x53d20b['editorConfig']}));}const _0x25ef1a={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x30e360};return this['_addToConversationContextItem'](_0x25ef1a),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x25ef1a,'unmatchedDocumentIds':_0x28f030};}_matchDocumentToRoot(_0x5d819b,_0x4caff8){const _0x2b66e7=_0x5d819b['attributes']?.['channelId'],_0x5cf03c=_0x5d819b['attributes']?.['rootName'];if(_0x2b66e7&&_0x5cf03c){for(const _0x1797b0 of _0x4caff8)if(_0x1797b0['config']['get']('collaboration.channelId')===_0x2b66e7){for(const _0x4d3806 of _0x1797b0['model']['document']['getRoots']())if('$graveyard'!==_0x4d3806['rootName']&&_0x4d3806['rootName']===_0x5cf03c)return{'editor':_0x1797b0,'rootName':_0x4d3806['rootName']};}}}async _createContextItemFromContent(_0x4efdc9,_0x50ee0f=new Set()){return'mcp-tool-context'===_0x4efdc9['type']?{'id':_0x4efdc9['id'],'uiId':_0x4efdc9['id'],'label':_0x4efdc9['data']?.['label']||_0x4efdc9['id'],'type':'mcp-tool-context','mcpServerName':_0x4efdc9['mcpServerName'],'toolName':_0x4efdc9['toolName'],'data':_0x4efdc9['data']||{}}:{'id':_0x4efdc9['id'],'uiId':_0x4efdc9['id'],'label':_0x4efdc9['attributes']?.['label']||_0x4efdc9['name']||_0x4efdc9['url']||_0x4efdc9['id'],'type':_0x4efdc9['type'],..._0x4efdc9?.['attributes']?.['resourceId']?{'resourceId':_0x4efdc9['attributes']?.['resourceId']}:{},...'context'===_0x4efdc9['type']&&_0x50ee0f['has'](_0x4efdc9['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x41ab7b){this['_pendingContextItems']['get'](_0x41ab7b)?.['isReadOnly']||this['_removeContextItem'](_0x41ab7b);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x2ed20c of this['_pendingContextItems']['values']())'context'!==_0x2ed20c['type']&&this['_removeContextItem'](_0x2ed20c['uiId']);const _0x37913c=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x37913c&&this['_addContextItem']({..._0x37913c,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x1e68a4){for(const _0x5ed071 of _0x1e68a4['values']())'context'!==_0x5ed071['type']&&this['_addToConversationContextItem'](_0x5ed071);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(_0x33524c){return Array['from'](_0x33524c['values']())['flatMap'](_0xdfad6a=>this['_mapContextItemToRequestData'](_0xdfad6a));}async addFilesToContext(_0x4fe8c9,_0x3c28cd,_0x1c36a0='file'){const _0x5ea48c='files-'+kt();this['_startUploadOperation'](_0x5ea48c);try{await Promise['all'](_0x4fe8c9['map'](async _0x1f4cd2=>{const _0x399e36='file-'+kt(),_0x5b14dc=_0x1bdee6(_0x1f4cd2['name']),_0x2e85e9='file'===_0x1c36a0&&_0x1f4cd2['type']['startsWith']('image/')?'image':_0x1c36a0;try{this['_addContextItem']({'type':_0x2e85e9,'label':_0x3c28cd?.['label']||_0x5b14dc,'uiId':_0x399e36,'resourceId':_0x3c28cd?.['resourceId']},!0x0);const _0x11bc63=this['_connector']['uploadFile'](this['_ownerId'],_0x1f4cd2,_0x3c28cd);this['_ongoingUploads']['set'](_0x399e36,_0x11bc63['abortController']);const {id:_0x1fc0ed}=await _0x11bc63['getId']();this['_ongoingUploads']['delete'](_0x399e36),this['_finishContextItemLoading']({'type':_0x2e85e9,'id':_0x1fc0ed,'label':_0x3c28cd?.['label']||_0x5b14dc,'uiId':_0x399e36,'resourceId':_0x3c28cd?.['resourceId']},!0x1);}catch(_0x2bbd9b){if(this['_ongoingUploads']['delete'](_0x399e36),!kn(_0x2bbd9b)){const _0x3ab52e=new yn({'code':$n['get'](_0x2bbd9b['code'])||'ai-chat-file-upload-failed','cause':_0x2bbd9b,'context':{'fileName':_0x5b14dc}});this['fire']('error',{'error':_0x3ab52e});}this['_removeContextItem'](_0x399e36);}}));}finally{this['_finishUploadOperation'](_0x5ea48c);}}addCurrentDocumentToContext(_0x32971a){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x526336={'type':'document','uiId':'current-document','label':_0x32971a,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x526336);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x10fcb6,_0x18fef5){const _0x2e2f4f=this['getCurrentDocumentContext']();if(!_0x2e2f4f)return;_0x10fcb6['length']>0x1&&_0x10fcb6['some'](_0x5a01a6=>!_0x5a01a6['description'])&&St('ai-chat-documents-missing-description');try{const _0xb702e0=(_0x2e2f4f['documents']||[])['filter'](_0x5b710b=>_0x18fef5['has'](_0x5b710b['channelId']));if(!_0x10fcb6['length'])return void(_0x2e2f4f['documents']=_0xb702e0);const _0x1f5983=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x10fcb6)['getIds']();if(_0x1f5983['length']!==_0x10fcb6['length']||_0x1f5983['some'](_0x51312c=>!_0x51312c?.['id'])){const _0x3abbf4=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x3abbf4});}const _0x527849=_0x10fcb6['map']((_0x885074,_0x496945)=>{return{'id':_0x1f5983[_0x496945]['id'],'content':_0x885074['content'],'version':_0x885074['version'],'sessionId':_0x885074['sessionId'],'selection':(_0x1317c9=_0x885074['selections'],_0x1317c9?_0x1317c9['map'](_0x3e6b54=>({'start':_0x3e6b54['start'],'end':_0x3e6b54['end']})):[]),'selectionSignature':_0x885074['selectionSignature'],'channelId':_0x885074['channelId'],'rootName':_0x885074['rootName'],'editorConfig':_0x885074['editorConfig']};var _0x1317c9;});_0x2e2f4f['documents']=[..._0xb702e0,..._0x527849];}catch(_0x1a6e26){throw new yn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x1a6e26});}}addSelectionToContext(_0x1863ec){this['_addContextItem']({'type':'selection','label':_0x1863ec,'uiId':'selection','content':_0x1863ec});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x49bb4c,_0x5b4209){const _0x335b52='url-'+kt();this['_startUploadOperation'](_0x335b52);const _0x2a20ba='url-'+kt();try{this['_addContextItem']({'type':'web-resource','label':_0x5b4209?.['label']||_0x49bb4c,'uiId':_0x2a20ba,'resourceId':_0x5b4209?.['resourceId']},!0x0);const _0x3e6773=this['_connector']['uploadUrl'](this['_ownerId'],_0x49bb4c,_0x5b4209);this['_ongoingUploads']['set'](_0x2a20ba,_0x3e6773['abortController']);const {id:_0xe5562}=await _0x3e6773['getId']();this['_ongoingUploads']['delete'](_0x2a20ba),this['_finishContextItemLoading']({'type':'web-resource','id':_0xe5562,'label':_0x5b4209?.['label']||_0x49bb4c,'uiId':_0x2a20ba,'resourceId':_0x5b4209?.['resourceId']},!0x1);}catch(_0xffd34f){this['_ongoingUploads']['delete'](_0x2a20ba),kn(_0xffd34f)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x49bb4c,'originalError':_0xffd34f}),'url':_0x49bb4c}),this['_removeContextItem'](_0x2a20ba);}finally{this['_finishUploadOperation'](_0x335b52);}}addToolItemToContext(_0x26d611){_0x26d611['id']=_0x26d611['id']??kt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x26d611['uiId'],_0x26d611),this['fire']('contextItemAdded',{'contextItem':_0x26d611,'isLoading':!0x1});}async['loadSourceResources'](_0x14083a,_0x5ceb31,_0x2760ab){const _0x270e83=this['_addContextOptionsState']['sources']['find'](_0x556fb2=>_0x556fb2['id']===_0x14083a);if(!_0x270e83)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x14083a}),'sourceId':_0x14083a}),[];try{const _0x4716bc=(await _0x270e83['getResources'](_0x5ceb31))['map'](_0x4d1844=>{const _0x11a1be=this['_isResourceInContext'](_0x4d1844['id']);return{..._0x4d1844,'isInContext':_0x11a1be};});return _0x270e83['resources']=_0x4716bc,this['fire']('sourceResourcesLoaded',{'sourceId':_0x14083a,'source':_0x270e83,'resources':_0x4716bc,'uid':_0x2760ab}),_0x4716bc;}catch(_0x3eb944){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x14083a,'originalError':_0x3eb944}),'sourceId':_0x14083a,'sourceLabel':_0x270e83['label']}),[];}}async addResourceToContext(_0x3f424f,_0x28c6f8){if(this['_isResourceInContext'](_0x28c6f8['id']))return;if('context'===_0x28c6f8['type'])return void this['_addContextItem']({'type':'context','id':_0x28c6f8['id'],'label':_0x28c6f8['label'],'uiId':'context-'+kt(),'resourceId':_0x28c6f8['id']});let _0xd54919=_0x28c6f8['data'];if(!_0xd54919&&_0x3f424f['getData'])try{_0xd54919=await _0x3f424f['getData'](_0x28c6f8['id']);}catch(_0x14e934){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id'],'originalError':_0x14e934}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});}if(_0xd54919)switch(_0x28c6f8['type']){case'web-resource':if('string'!=typeof _0xd54919)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id'],'expectedType':'string','actualType':typeof _0xd54919}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});await this['addUrlToContext'](_0xd54919,{'label':_0x28c6f8['label'],'resourceId':_0x28c6f8['id']});break;case'file':if(!(_0xd54919 instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id'],'expectedType':'File','actualType':typeof _0xd54919}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});await this['addFilesToContext']([_0xd54919],{'label':_0x28c6f8['label'],'resourceId':_0x28c6f8['id']});break;case'text':if('object'!=typeof _0xd54919||!('content'in _0xd54919)||!('type'in _0xd54919))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0xd54919}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});_0xd54919=AIChatContext['_convertTextResourceToFile'](_0xd54919,_0x28c6f8['label']),await this['addFilesToContext']([_0xd54919],{'label':_0x28c6f8['label'],'resourceId':_0x28c6f8['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id'],'resourceType':_0x28c6f8['type']}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']}),'resourceId':_0x28c6f8['id'],'sourceId':_0x3f424f['id']});}addContextSource(_0x3a669f){this['_addContextOptionsState']['sources']['some'](_0x605f9f=>_0x605f9f['id']===_0x3a669f['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x3a669f,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0xf8191a){if(void 0x0!==_0xf8191a)this['_addContextOptionsState']['document']['isHidden']=!_0xf8191a;else{const _0x1bd0d9=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x1bd0d9;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x17fd56,_0x507808){switch(_0x17fd56['type']){case'markdown':return new File([_0x17fd56['content']],_0x507808,{'type':'text/markdown'});case'html':return new File([_0x17fd56['content']],_0x507808,{'type':'text/html'});default:return new File([_0x17fd56['content']],_0x507808,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x420880){switch(_0x420880['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x420880['id']}];case'web-resource':return[{'type':'web-resource','id':_0x420880['id']}];case'context':return[{'type':'context','id':_0x420880['id']}];case'document':return _0x420880['documents']?.['length']?_0x420880['documents']['map'](({id:_0x3e6fa0,editorConfig:_0x5c6649,selection:_0x2f4fa7})=>({'type':'document','id':_0x3e6fa0,..._0x5c6649&&{'editorConfig':_0x5c6649},..._0x2f4fa7?.['length']&&{'selection':_0x2f4fa7}})):[];case'mcp-tool-context':{const _0x212b0b=_0x420880;return[{'type':'mcp-tool-context','mcpServerName':_0x212b0b['mcpServerName'],'toolName':_0x212b0b['toolName'],'data':{..._0x212b0b['data'],'label':_0x212b0b['label']||_0x212b0b['data']?.['label']||_0x212b0b['id']},'id':_0x212b0b['id']}];}default:return[];}}_addContextItem(_0x466e6e,_0x417232=!0x1){if(this['_pendingContextItems']['set'](_0x466e6e['uiId'],_0x466e6e),_0x466e6e['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x466e6e,'isLoading':_0x417232}),'current-document'===_0x466e6e['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x466e6e['resourceId']){const _0x56749b=this['_findSourceIdsByResourceId'](_0x466e6e['resourceId']);_0x56749b&&_0x56749b['forEach'](_0x339dd8=>{this['_updateResourceInContextState'](_0x339dd8,_0x466e6e['resourceId'],!0x0);});}}_removeContextItem(_0x4d2dcd){const _0x9b7c71=this['_pendingContextItems']['get'](_0x4d2dcd),_0x288914=this['_ongoingUploads']['get'](_0x4d2dcd);if(_0x288914&&(_0x288914['abort'](),this['_ongoingUploads']['delete'](_0x4d2dcd)),_0x9b7c71?.['resourceId']){const _0x134f31=this['_findSourceIdsByResourceId'](_0x9b7c71['resourceId']);_0x134f31&&_0x134f31['forEach'](_0x420939=>{this['_updateResourceInContextState'](_0x420939,_0x9b7c71['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x4d2dcd),this['fire']('contextItemRemoved',{'uiId':_0x4d2dcd,'type':_0x9b7c71?.['type']}),'current-document'===_0x4d2dcd&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x418c9b,_0x2b7ed6){if(this['_pendingContextItems']['has'](_0x418c9b['uiId'])&&(this['_pendingContextItems']['set'](_0x418c9b['uiId'],_0x418c9b),this['fire']('contextItemLoadingEnded',{'contextItem':_0x418c9b,'isLoading':_0x2b7ed6}),_0x418c9b['resourceId'])){const _0x15fc01=this['_findSourceIdsByResourceId'](_0x418c9b['resourceId']);_0x15fc01&&_0x15fc01['forEach'](_0x10aad5=>{this['_updateResourceInContextState'](_0x10aad5,_0x418c9b['resourceId'],!0x0);});}}_addToConversationContextItem(_0xf7bd1c){this['_conversationContextItems']['set'](_0xf7bd1c['uiId'],_0xf7bd1c);}_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'](_0x52bb58=>({..._0x52bb58,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x427fc5=>({..._0x427fc5,'resources':[]}))??[];}_isResourceInContext(_0x2364e8){for(const _0xc943cb of this['_pendingContextItems']['values']())if(_0xc943cb['resourceId']===_0x2364e8)return!0x0;for(const _0x3705d3 of this['_conversationContextItems']['values']())if(_0x3705d3['resourceId']===_0x2364e8)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2fec17){const _0x5555b8=[];for(const _0x4e67b7 of this['_addContextOptionsState']['sources'])_0x4e67b7['resources']['find'](_0x3096ec=>_0x3096ec['id']===_0x2fec17)&&_0x5555b8['push'](_0x4e67b7['id']);return 0x0===_0x5555b8['length']?null:_0x5555b8;}_updateResourceInContextState(_0x243108,_0x5b8bfa,_0x44687f){const _0x2ce2aa=this['_addContextOptionsState']['sources']['find'](_0x2111a5=>_0x2111a5['id']===_0x243108);if(!_0x2ce2aa)return;const _0x146037=_0x2ce2aa['resources']['find'](_0x1a8ba3=>_0x1a8ba3['id']===_0x5b8bfa);_0x146037&&(_0x146037['isInContext']=_0x44687f,this['fire']('resourceStateChanged',{'sourceId':_0x243108,'resourceId':_0x5b8bfa,'isInContext':_0x44687f}));}_startUploadOperation(_0x436c33){this['_ongoingUploadOperations']['set'](_0x436c33,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x3ff069){this['_ongoingUploadOperations']['delete'](_0x3ff069),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},Xn=class extends Fn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x23a175){super(_0x23a175),this['conversationId']=_0x23a175['conversationId'],this['contextItems']=_0x23a175['contextItems'],this['capabilities']=_0x23a175['capabilities'],this['userMessage']=_0x23a175['userMessage'],this['model']=_0x23a175['model'],this['attributes']=_0x23a175['attributes'],this['context']=_0x23a175['context']??new Yn();}sendRequest(){const _0x1eb504=Qn['mapContextItemsToRequestData'](this['contextItems']),_0x3d4c5f=this['context']['toRequestParts'](_0x1eb504);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x3d4c5f,'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const zn=/* #__PURE__ -- @preserve */
|
|
32
|
-
dt();var jn=class extends zn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x253e09){super(),this['options']=_0x253e09,this['connector']=_0x253e09['connector'],this['chatModels']=_0x253e09['chatModels'],this['id']=_0x253e09['conversationId'],this['isFromHistory']=_0x253e09['isFromHistory'],this['_channelsToEditors']=_0x253e09['channelsToEditors'],this['_getSessionId']=_0x253e09['getSessionId'];}async init(_0x2ee9b2){try{this['chatContext']=new Qn({'connector':this['connector'],'config':_0x2ee9b2,'ownerId':this['id']}),this['chatContext']['delegate'](...qn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x250af4=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x250af4});const _0x4b9928=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x4b9928&&await this['setModel'](_0x4b9928);}catch(_0x4c9c52){const _0x29c857=new yn({'code':'ai-chat-conversation-init-failed','cause':_0x4c9c52,'type':'network'});this['fire']('error',{'error':_0x29c857});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x266667}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x266667,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x587647){const _0x324b31=new yn({'code':'ai-chat-conversation-start-failed','cause':_0x587647,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x324b31}),_0x324b31;}}async['load'](_0x49a693){try{const _0x4489ed=await this['connector']['fetchConversation'](_0x49a693)['getConversation'](),_0x16c210=await this['connector']['fetchConversationMessages'](_0x49a693)['getMessages'](),_0x8d6b46=_0x16c210[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x4489ed['id'],'title'in _0x4489ed?this['fire']('setConversationTitle',_0x4489ed['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x8d6b46)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x3ff9db}=await this['_processMessagesToInteractions'](_0x16c210,_0x8d6b46);return _0x3ff9db&&this['currentInteraction']?this['_resumeStream'](_0x3ff9db):this['currentInteraction']=void 0x0,this;}catch(_0x463fbd){const _0x12213f=new yn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x463fbd,'type':'network','context':{'conversationId':_0x49a693}});throw this['fire']('error',{'error':_0x12213f}),_0x12213f;}}async _processMessagesToInteractions(_0x32f918,_0x239d3e){let _0x1a73bf,_0x18462b,_0x2c2fcd=new Set();for(const _0x4b2be8 of _0x32f918)if('user'===_0x4b2be8['role']){const {contextItems:_0x535bb0,unmatchedDocumentIds:_0x2cc09e}=await this['_extractContextItems'](_0x4b2be8);_0x2c2fcd=_0x2cc09e;const _0x3e067e={'isReasoningEnabled':Object['hasOwn'](_0x4b2be8['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x4b2be8['capabilities'],'webSearch')};_0x1a73bf=this['createInteraction']({'userMessage':_0x4b2be8['prompt'],'contextItems':_0x535bb0,'capabilities':_0x3e067e,'modelId':_0x239d3e,'attributes':_0x4b2be8['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x1a73bf,_0x18462b=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x4b2be8['role']&&_0x1a73bf){if('streaming'===_0x4b2be8['status']){_0x18462b=_0x4b2be8['id'];continue;}if('error'===_0x4b2be8['status'])continue;const _0x2f0ae6=[];for(const _0x1194ab of _0x4b2be8['content'])switch(_0x1194ab['type']){case'text':case'modification':{const _0x38e343=_0x1a73bf['getDocumentContext'](),_0x474c4b=this['_getOutdatedReasonsByDocumentId'](_0x38e343,_0x2c2fcd),_0x23259a=_0x38e343?.['documents']??[],_0x5dbc33=_0x23259a['length']>0x0&&_0x23259a['every'](_0x3f1c42=>_0x474c4b['has'](_0x3f1c42['id']));_0x1a73bf['currentReply']?.['type']!==_0x1194ab['type']&&(_0x1a73bf['currentReply']=_0x1a73bf['createReply']({'type':_0x1194ab['type'],'isDone':!0x0,'interactionId':_0x1a73bf['id'],'areActionsDisabled':_0x5dbc33,'outdatedReasonByDocumentId':_0x474c4b,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x2f0ae6['length']>0x0&&(_0x1a73bf['currentReply']['sources']=_0x2f0ae6['splice'](0x0))),_0x1a73bf['currentReply']['appendContent'](_0x1194ab['content'],_0x1194ab['documentId']);break;}case'url':_0x2f0ae6['push'](_0x1194ab);break;case'mcp-tool-result':{const {data:_0x2df605,attributes:_0x25de46}=JSON['parse'](_0x1194ab['content']);_0x1a73bf['_handleToolResultData']({'toolName':_0x1194ab['toolName'],'data':_0x2df605,'attributes':_0x25de46});break;}}'cancelled'===_0x4b2be8['status']&&this['fire']('error',{'interactionId':_0x1a73bf['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x18462b};}async _resumeStream(_0x2cc035){if(this['currentInteraction'])try{const _0x36b22c=this['connector']['resumeStream'](this['id'],_0x2cc035);await this['currentInteraction']['resume'](_0x36b22c);}catch(_0x234e54){_0x234e54 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x234e54});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x1c673c){return _0x1c673c['content']?this['chatContext']['populateFromMessage'](_0x1c673c['content'],Array['from'](this['_channelsToEditors']['values']()),Yn['getDefaultContextIds'](_0x1c673c['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x383f20,attributes:_0x31aea2}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4c6b1e=new Map(this['getPendingContextItems']()),_0x1836c2=this['chatCapabilities']['getCapabilitiesConfig'](),_0x32a014=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x383f20,'contextItems':_0x4c6b1e,'capabilities':_0x1836c2,'modelId':_0x32a014,'attributes':_0x31aea2,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x26dd2b){if(_0x26dd2b instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x26dd2b});else{const _0x37bd24=$n['get'](_0x26dd2b['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x37bd24,null,{'error':_0x26dd2b})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x1ddfd9,contextItems:_0x996a13,capabilities:_0x30d03d,modelId:_0x42628e,attributes:_0x37b7cd,channelsToEditors:_0x4e4545}){const _0x25ae6b=new Xn({'userMessage':_0x1ddfd9,'contextItems':_0x996a13,'capabilities':_0x30d03d,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x42628e,'attributes':_0x37b7cd,'channelsToEditors':_0x4e4545,'context':this['chatContext']['isEmpty']?void 0x0:new Yn(this['chatContext']['refs'])});return _0x25ae6b['delegate'](...Gn)['to'](this),this['interactions']['push'](_0x25ae6b),this['fire']('interactionCreated',_0x25ae6b),_0x25ae6b;}getInteraction(_0x3d471d){return this['interactions']['find'](_0x4f3b9a=>_0x4f3b9a['id']===_0x3d471d);}removeInteraction(_0xd8d835){const _0x425727=this['getInteraction'](_0xd8d835);_0x425727&&(_0x425727['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x425727),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0xbb1881=this['lastInteraction'];_0xbb1881?.['conversationId']&&_0xbb1881['messageId']&&this['connector']['cancelStream'](_0xbb1881['conversationId'],_0xbb1881['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x3ab3a5){this['chatContext']['addCurrentDocumentToContext'](_0x3ab3a5);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0xfb8cd9,unchangedIds:_0x4d5537}=this['_compareEditorStateWithDocumentContext'](),_0x1c64b0=new Promise((_0x3e156d,_0x37a2f8)=>{this['_abortReject']=()=>_0x37a2f8(new ct('ai-request-aborted',this));}),_0x2345dc=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0xfb8cd9),_0x1c64b0]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x2345dc,_0x4d5537),_0x1c64b0]);}_compareEditorStateWithDocumentContext(){const _0x11f9f6=new Set(),_0x4923fe=new Set(),_0x1c693d=this['options']['aiEditing']['getEditorsVersions'](),_0x29e376=this['options']['aiEditing']['getEditorsSelections'](),_0x232a00=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x189fd0=new Map(_0x232a00['map'](({channelId:_0x5790f1,version:_0x903495})=>[_0x5790f1,_0x903495])),_0x5db401=new Map(_0x232a00['map'](({channelId:_0x143b0a,selectionSignature:_0x2eeb6b})=>[_0x143b0a,_0x2eeb6b]));for(const [_0x1d3038,_0x30a7b6]of _0x1c693d){const _0x416a42=_0x29e376['get'](_0x1d3038);_0x189fd0['get'](_0x1d3038)!=_0x30a7b6||_0x5db401['get'](_0x1d3038)!=_0x416a42?_0x11f9f6['add'](_0x1d3038):_0x189fd0['has'](_0x1d3038)&&_0x4923fe['add'](_0x1d3038);}return{'changedIds':_0x11f9f6,'unchangedIds':_0x4923fe};}toggleAddCurrentDocumentOptionVisibility(_0xc9ef3){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xc9ef3);}_getOutdatedReasonsByDocumentId(_0x143a1b,_0x37eb68){const _0x23e1b1=new Map();if(!_0x143a1b||!_0x143a1b['documents'])return _0x23e1b1;for(const _0x715ad1 of _0x143a1b['documents']){const _0x2cc966=this['_channelsToEditors']['get'](_0x715ad1['channelId']);_0x2cc966&&'destroyed'!==_0x2cc966['state']?_0x715ad1['sessionId']!==this['_getSessionId'](_0x2cc966)?_0x23e1b1['set'](_0x715ad1['id'],'session-changed'):_0x37eb68['has'](_0x715ad1['id'])&&_0x23e1b1['set'](_0x715ad1['id'],'content-removed'):_0x23e1b1['set'](_0x715ad1['id'],'editor-removed');}return _0x23e1b1;}addSelectionToContext(_0x1986db){this['chatContext']['addSelectionToContext'](_0x1986db);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x2e374e){this['chatContext']['addFilesToContext'](_0x2e374e);}addUrlToContext(_0x59b760){this['chatContext']['addUrlToContext'](_0x59b760);}addToolItemToContext(_0x1936f0){this['chatContext']['addToolItemToContext'](_0x1936f0);}addResourceToContext(_0x35fd93,_0x359ba0){this['chatContext']['addResourceToContext'](_0x35fd93,_0x359ba0);}['loadSourceResources'](_0x3c7a14,_0x1dd10d,_0x5061d9){return this['chatContext']['loadSourceResources'](_0x3c7a14,_0x1dd10d,_0x5061d9);}removeFromContext(_0x469871){this['chatContext']['removeFromContext'](_0x469871);}setWebSearch(_0x2b0bf4){this['chatCapabilities']['setWebSearch'](_0x2b0bf4);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x2e7d00){this['chatCapabilities']['setReasoning'](_0x2e7d00);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x43cb3e){_0x43cb3e['length']&&this['chatContext']['addDefaultContext'](_0x43cb3e);}async setModel(_0x28c9d3){_0x28c9d3?!0x1===await this['chatModels']['isAvailable'](_0x28c9d3)&&(St('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x28c9d3}),_0x28c9d3=(await this['chatModels']['getAvailableModels']())[0x0]):(St('ai-chat-conversation-set-model-null',{'conversation':this}),_0x28c9d3=(await this['chatModels']['getAvailableModels']())[0x0]),_0x28c9d3['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x28c9d3,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x28c9d3}));}};function Jn({documentSuggestions:_0x5a49b8,transform:_0x47d61c,documentCompare:_0x20b976,documentCompareOptions:_0x5d7162}){const _0x3b9be8=new Map();for(const [_0x433df7,{groups:_0x2611c6,documentContext:_0x54b751,documentContent:_0x3cbfc8,editor:_0xcd004d}]of _0x5a49b8){const _0x39989e=_0x54b751['content'],_0x225329=_0x54b751['version'],_0x232b4e=_0x3cbfc8['cloneNode'](!0x0);for(const {changes:_0x17303d}of _0x2611c6)$s(_0x232b4e,_0x17303d);const _0x9d852e=Os(_0x232b4e),_0x5e7c34=Qs(_0xcd004d,_0x54b751['rootName'],_0x39989e,_0x9d852e);if(!_0x5e7c34)continue;const _0x58ec2e=_0x20b976['getDiff'](_0x5e7c34['before'],_0x5e7c34['after'],{'targetEditor':_0xcd004d,'anchor':_0x54b751['rootName'],..._0x5d7162})['getOperations']();if(_0x47d61c){const _0x3f17b3=_0xcd004d['model']['document']['history']['getOperations'](_0x225329),_0xeadfcc={'document':_0xcd004d['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x3b9be8['set'](_0x433df7,_0x305f08(_0x58ec2e,_0x3f17b3,_0xeadfcc)['operationsA']);}else _0x3b9be8['set'](_0x433df7,_0x58ec2e);}return _0x3b9be8;}function Zn({groups:_0x1e4e96,documentContextContent:_0x48f08c,documents:_0x20a323}){const _0x199688=new Map();for(const _0x2aa09f of _0x1e4e96){const {documentId:_0x5c13aa}=_0x2aa09f,_0x53f4df=_0x199688['get'](_0x5c13aa);if(_0x53f4df)_0x53f4df['groups']['push'](_0x2aa09f),_0x53f4df['indexes']['push'](_0x2aa09f['index']);else{const _0x24f711=_0x20a323['find'](_0x107554=>_0x107554['id']===_0x5c13aa),_0x3afe5c=_0x48f08c['get'](_0x5c13aa);if(!_0x24f711||!_0x3afe5c)continue;_0x199688['set'](_0x5c13aa,{'groups':[_0x2aa09f],'documentContext':_0x24f711,'documentContent':_0x3afe5c,'editor':_0x2aa09f['editor'],'indexes':[_0x2aa09f['index']]});}}return _0x199688;}function tr(_0x1fdf59,_0xa72ebd){const _0x1a7864=_0x1fdf59['files']['length']>0x0&&_0x1fdf59['files']['every'](_0x2bce45=>_0x2bce45['type']['startsWith']('image/')),_0x1b3b4c=_0x1fdf59['plainText']['trim']()['length']>0x0;if(_0x1fdf59['files']['length']>0x0&&_0xa72ebd['filesEnabled']&&(!_0x1a7864||!_0x1b3b4c)){const _0x29b545=_0x1fdf59['files']['filter'](_0x44a806=>_0x44a806['name']);return _0x29b545['length']>0x0?{'type':'file','files':_0x29b545}:null;}if(_0xa72ebd['urlsEnabled']){const _0xd7ad0c=function(_0x26cd55){const _0x146969=_0x26cd55['trim']();if(/\s/['test'](_0x146969))return null;try{const _0x1e73d9=new URL(_0x146969);return'http:'!==_0x1e73d9['protocol']&&'https:'!==_0x1e73d9['protocol']?null:_0x1e73d9['toString']();}catch{return null;}}(_0x1fdf59['plainText']);if(_0xd7ad0c)return{'type':'url','url':_0xd7ad0c};}const _0x158442=_0x1fdf59['forceTextAttachment']?0x1:_0xa72ebd['longTextThreshold']??0x1/0x0;if(_0x1fdf59['plainText']['length']>=Math['max'](_0x158442,0x1)&&_0xa72ebd['filesEnabled']){const _0x38b5cf=_0xa72ebd['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x1fdf59['plainText']],_0x38b5cf,{'type':'text/plain'})]};}return null;}var er=class extends _0x2b8fcb{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Is,Nn,_0x2cd097,fs];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Mn(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichat'),this['_aiModels']=this['context']['plugins']['get'](fs)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](fs)['contextLibrary'];const _0x23c00a=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x5544f9,_0x21d925)=>{this['sendMessage']({'message':_0x21d925});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x23c00a['view'],'change:activeTab',(_0x544b62,_0x15d4f3,_0x44a471)=>{'chat'!==_0x44a471&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x5121ee,_0x499d7b)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x499d7b));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x523c70,_0x2ae821)=>{this['activeConversation']?.['addUrlToContext'](_0x2ae821);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x1eaf77,_0x918a0a)=>{const _0x32064d=this['activeConversation'];if(!_0x32064d)return;_0x918a0a['hasDirectory']&&(_0x918a0a['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+kt()}));const _0x280544=tr(_0x918a0a,{'pastedTextLabel':Es(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')});_0x280544&&(_0x918a0a['preventDefault'](),'url'===_0x280544['type']?_0x32064d['addUrlToContext'](_0x280544['url']):_0x32064d['chatContext']['addFilesToContext'](_0x280544['files'],void 0x0,_0x280544['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x33d82d,_0x5f585c)=>{_0x5f585c['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x480bf4,_0x22b6ce)=>{this['activeConversation']?.['addResourceToContext'](_0x22b6ce['source'],_0x22b6ce['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x34b568,_0x462fa7)=>{this['_removeFromContext'](_0x462fa7);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0xe8815a,_0x339b1c)=>{this['activeConversation']?.['loadSourceResources'](_0x339b1c['sourceId'],_0x339b1c['query'],_0x339b1c['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x2b0590,_0x529db3)=>{this['activeConversation']?.['setModel'](_0x529db3);}),this['listenTo'](this['_aiChatUi'],'like',(_0x2f7563,{replyId:_0x1678cd})=>{console['log']('Liked\x20response',_0x1678cd);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0xde68c4,{replyId:_0x169138})=>{console['log']('Disliked\x20response',_0x169138);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x154c4f,_0x27a940)=>{this['_insertSuggestion'](_0x27a940);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x5cb2fd,{replyId:_0x2f1f25,partIndex:_0x2d70eb})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x2f1f25,_0x2d70eb);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x5df5bc,{replyId:_0x3fcaf1,partIndex:_0x2af890})=>{const _0x36b46e=this['_getDocumentRangeForReplyChanges'](_0x3fcaf1,_0x2af890);if(!_0x36b46e)return;const {reply:_0x2cc0d1}=this['getInteractionAndReplyById'](_0x3fcaf1);'$graveyard'!=_0x36b46e['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x2cc0d1['changeGroups'][_0x2af890]['editor'],'ranges':[_0x36b46e['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x76caec,_0x139714)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x139714);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x419a5d,{replyId:_0x4b7ff0,showDiff:_0x487c67})=>{const {interaction:_0x13a000,reply:_0x4e3a2c}=this['getInteractionAndReplyById'](_0x4b7ff0),_0x51f1a0=_0x4e3a2c['getContentParts']({'showDiff':_0x487c67});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x13a000['id']+':'+_0x4e3a2c['id'],'parts':_0x51f1a0});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0xa4e564,{replyId:_0x3160f3,partIndex:_0x2043d8})=>{this['_rejectSuggestion']({'replyId':_0x3160f3,'partIndex':_0x2043d8}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0xd8a2aa,_0x104ead)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x104ead);}),this['on']('replyCreated',(_0x4cfdbd,_0x15b916)=>{this['_addFeedItemReply'](_0x15b916);});}afterInit(){this['context']instanceof _0x5d4fbe?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x18176e,_0x2ffd5e)=>{_0x2ffd5e['on']('ready',()=>{this['_integrateEditor'](_0x2ffd5e);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x396787=this['context']['config']['get']('ai.chat.initialConversation');let _0x28523f=_0x396787;('lastCreated'!=_0x396787||(_0x28523f=await this['_getLastCreatedConversationId'](),_0x28523f))&&('new'==_0x28523f?await this['_startConversationSafely']():await this['loadConversation'](_0x28523f));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x15a082){this['_closeActiveBalloon'](),this['context']['plugins']['get'](gs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x15a082)['getConversation'](),await this['_startConversationSafely']({'id':_0x15a082}),await this['activeConversation']['load'](_0x15a082),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x14b80b){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x15a082}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x14b80b),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x338dcd){let _0x417f2e=null,_0x54c9c3=null;this['on']('toolDataReceived',(_0x3e0465,_0x4172d9,_0x557df4)=>{_0x557df4['id']!==_0x417f2e&&(_0x417f2e=_0x557df4['id'],_0x54c9c3=this['_getAIChatFeedAPI'](_0x557df4)),_0x338dcd(_0x4172d9,_0x54c9c3);});}addCurrentDocumentToChatContext(){bs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Es(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x47aef5){const _0x5c1139=this['_aiEditing']['getSelectionText'](_0x47aef5);this['activeConversation']?.['addSelectionToContext'](_0x5c1139),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x2ad5fb){await this['_startConversationSafely']({'modelId':_0x2ad5fb?.['modelId'],'contexts':_0x2ad5fb?.['contexts']});}async['sendMessage']({message:_0x437e37,attributes:_0x380501}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0x437e37,'attributes':_0x380501}));}getGroupId(){const _0x502add=this['context']['config']['get']('collaboration.channelId');if(!_0x502add)throw new ct('ai-missing-channel-id',this);return _0x502add;}_handleRemovedConversation(_0xdd3114){this['activeConversation']['id']===_0xdd3114&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x23334a){return!(!_0x23334a['editor']||'destroyed'===_0x23334a['editor']['state']||!_0x23334a['editor']['isReadOnly']);}_isGroupWriteable(_0x5eb959){return!(!_0x5eb959['editor']||'destroyed'===_0x5eb959['editor']['state']||_0x5eb959['editor']['isReadOnly']);}_computeSuggestionGating(_0x470417){const _0x5cc59c=new Map();for(const _0x399dca of _0x470417['changeGroups'])_0x5cc59c['set'](_0x399dca['index'],this['_isGroupReadOnly'](_0x399dca));const _0x49fa2a=new Set(_0x470417['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x30a542=>_0x30a542['hasChanges'])['map'](_0x442bcd=>_0x442bcd['index']));return{'readOnlyByIndex':_0x5cc59c,'isAcceptAllEnabled':_0x470417['changeGroups']['some'](_0x30da04=>'pending'===_0x30da04['state']&&this['_isGroupWriteable'](_0x30da04)&&_0x49fa2a['has'](_0x30da04['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x11eb75 of this['activeConversation']['interactions'])for(const _0x366746 of _0x11eb75['replies'])'modification'===_0x366746['type']&&this['_aiChatUi']['hasFeedItem'](_0x366746['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x366746['id'],this['_computeSuggestionGating'](_0x366746));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x3e1eaa}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x186309=_0x3e1eaa['changeGroups']['find'](_0x23c6dd=>_0x23c6dd['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x186309&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x186309));}}_prepareDocumentSuggestions(_0x270261){const {reply:_0x31deca,interaction:_0x460053}=this['getInteractionAndReplyById'](_0x270261['replyId']),_0x59d8ec=void 0x0!==_0x270261['partIndex']?[_0x31deca['changeGroups'][_0x270261['partIndex']]]:_0x31deca['changeGroups']['filter'](_0x3d0815=>'pending'===_0x3d0815['state']&&!this['_isGroupReadOnly'](_0x3d0815)),_0x4d46a8=_0x59d8ec['map'](_0x547d97=>_0x31deca['changeGroups']['indexOf'](_0x547d97)),_0x161560=qs(_0x31deca['changeGroups'],_0x31deca['documentContextContent']);return _0x4d46a8['forEach'](_0xee3a2a=>{if(_0x161560['has'](_0xee3a2a))return;const _0x300c56=this['_getDocumentRangeForReplyChanges'](_0x270261['replyId'],_0xee3a2a);_0x300c56&&'$graveyard'!=_0x300c56['range']['root']['rootName']?(_0x31deca['setChangeGroupState'](_0xee3a2a,'accepted'),void 0x0!==_0x270261['partIndex']&&this['_scrollToSuggestionRange'](_0x300c56['range'],!0x1,_0x300c56['targetEditor'])):_0x31deca['setChangeGroupState'](_0xee3a2a,'outdated',this['_getOutdatedReason'](_0x31deca['changeGroups'][_0xee3a2a]));}),Zn({'groups':_0x59d8ec['filter'](_0x166c92=>'accepted'===_0x166c92['state']),'documentContextContent':_0x31deca['documentContextContent'],'documents':_0x460053['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x50857b){const _0x1ed63d=this['context']['plugins']['get'](_0x2cd097),{reply:_0x582e16,interaction:_0x37fbd4}=this['getInteractionAndReplyById'](_0x50857b['replyId']),_0x62fffa=this['_prepareDocumentSuggestions'](_0x50857b),_0x40e598=Jn({'documentSuggestions':_0x62fffa,'transform':!0x0,'documentCompare':_0x1ed63d,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x263245,_0x8f4c80]of _0x40e598){const {editor:_0x3b58ce,indexes:_0x4ae424}=_0x62fffa['get'](_0x263245);if(!_0x3b58ce['plugins']['has']('TrackChanges')){St('ai-no-track-changes',{'editor':_0x3b58ce});continue;}let _0x394e5b;mn(_0x8f4c80,'chat'),_0x3b58ce['model']['change'](_0x56fa4c=>{_0x394e5b=_0x56fa4c['batch'],_0x3b58ce['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x8f4c80),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x394e5b,{'interactionId':_0x37fbd4['id'],'replyId':_0x582e16['id'],'indexes':_0x4ae424});}this['_updateRatings'](_0x582e16);}_applySuggestion(_0x1af7aa){const _0x2f897c=this['context']['plugins']['get'](_0x2cd097),{reply:_0x441365,interaction:_0x405ceb}=this['getInteractionAndReplyById'](_0x1af7aa['replyId']),_0x5742b8=this['_prepareDocumentSuggestions'](_0x1af7aa),_0x3227cb=Jn({'documentSuggestions':_0x5742b8,'transform':!0x0,'documentCompare':_0x2f897c,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x59cee5,_0x383587]of _0x3227cb){const {editor:_0x1d9600,indexes:_0x265081}=_0x5742b8['get'](_0x59cee5);let _0x3b637b;mn(_0x383587,'chat');try{_0x1d9600['model']['change'](_0x3f2f2d=>{_0x3b637b=_0x3f2f2d['batch'],_0x2f897c['applyOperations'](_0x3f2f2d,_0x383587);}),this['_batchToChanges']['set'](_0x3b637b,{'interactionId':_0x405ceb['id'],'replyId':_0x441365['id'],'indexes':_0x265081});}catch(_0x465f84){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x465f84})),_0x465f84;}}this['_updateRatings'](_0x441365);}_rejectSuggestion(_0x443457){const {reply:_0x3a6072}=this['getInteractionAndReplyById'](_0x443457['replyId']);_0x3a6072['setChangeGroupState'](_0x443457['partIndex'],'rejected');}['_openBalloonFor'](_0x5a60bf,_0x5d2d57){if(!this['_hasAIChatBalloon'])return;const {reply:_0x4f71c1}=this['getInteractionAndReplyById'](_0x5a60bf),_0x5dffc4=_0x4f71c1['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x5dffc4['length'])return;let _0x144bc1,_0x50f069;if(void 0x0!==_0x5d2d57?(_0x50f069=_0x5dffc4['find'](_0x7b83f=>_0x7b83f['index']==_0x5d2d57),_0x144bc1=_0x50f069?.['index']):(_0x50f069=_0x5dffc4[0x0],_0x144bc1=_0x50f069['index']),!_0x50f069)return void _0x4f71c1['setChangeGroupState'](_0x5d2d57??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x5a60bf&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x144bc1)return;const _0x2356b0=this['_getUserPresentableContentPartDocumentRange'](_0x5a60bf,_0x4f71c1,_0x50f069),_0x295971=_0x4f71c1['changeGroups']['find'](_0x1c51b4=>_0x1c51b4['index']==_0x144bc1),_0x7fae43=_0x295971['editor'],_0x304c49=_0x7fae43['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x304c49&&this['_activeBalloon']['close'](),!_0x2356b0)return _0x304c49['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x304c49,this['_currentPreviewedChangeGroup']={'replyId':_0x5a60bf,'partIndex':_0x144bc1},this['_scrollToSuggestionRange'](_0x2356b0,!0x0,_0x7fae43);const _0x170231=this['_getPresentableSiblingContentPartIndex'](_0x5a60bf,_0x144bc1,'next');_0x304c49['clearContent'](),_0x304c49['updateContent']({'part':_0x50f069,'renderingStrategy':'static'}),_0x304c49['open']({'index':_0x144bc1,'title':Es(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x144bc1+0x1)['toString']()),'showRotator':null!==_0x170231,'ranges':[_0x2356b0],'areActionsDisabled':_0x4f71c1['areActionsDisabled'],'targetEditor':_0x7fae43,'isTargetReadOnly':this['_isGroupReadOnly'](_0x295971)}),_0x304c49['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x5a60bf,_0x144bc1),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x5a60bf,'index':_0x144bc1,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x2c2fb0,_0x91ab01,_0x4f91d4){const {reply:_0x241bb2}=this['getInteractionAndReplyById'](_0x2c2fb0),_0x1ca0c4=_0x241bb2['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x1ca0c4['length'])return null;const _0x12784c='next'==_0x4f91d4?0x1:-0x1;function _0x351c8f(_0x52220b){const _0x357190=(_0x52220b+_0x12784c+_0x1ca0c4['length'])%_0x1ca0c4['length'];return{'siblingIndex':_0x357190,'siblingPart':_0x1ca0c4[_0x357190]};}const _0x57fe73=_0x1ca0c4['findIndex'](_0x190abe=>_0x190abe['index']==_0x91ab01);let {siblingIndex:_0x3af367,siblingPart:_0x3d1ee1}=_0x351c8f(_0x57fe73);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x2c2fb0,_0x241bb2,_0x3d1ee1);)if({siblingIndex:_0x3af367,siblingPart:_0x3d1ee1}=_0x351c8f(_0x3af367),_0x3af367===_0x57fe73)return null;return _0x3d1ee1['index'];}_getOutdatedReason(_0x40e120){return _0x40e120?.['editor']&&'destroyed'!==_0x40e120['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x4e50f8,_0x992113,_0x4963de){const _0x2e0c15=_0x992113['changeGroups'];if(!_0x4963de['hasChanges'])return null;const _0x1a10c1=_0x2e0c15['find'](_0x1408cf=>_0x1408cf['index']==_0x4963de['index']);if('pending'!==_0x1a10c1?.['state'])return null;if(!_0x1a10c1?.['editor']||'destroyed'===_0x1a10c1['editor']['state'])return _0x992113['setChangeGroupState'](_0x4963de['index'],'outdated',this['_getOutdatedReason'](_0x1a10c1)),null;const _0x1f4bf8=this['_getDocumentRangeForReplyChanges'](_0x4e50f8,_0x4963de['index']);if(!_0x1f4bf8)return _0x992113['setChangeGroupState'](_0x4963de['index'],'outdated',this['_getOutdatedReason'](_0x1a10c1)),null;const {range:_0x4c3076,currentIndex:_0x3b6204}=_0x1f4bf8;return'$graveyard'==_0x4c3076['root']['rootName']?(_0x992113['setChangeGroupState'](_0x3b6204,'outdated',this['_getOutdatedReason'](_0x1a10c1)),null):_0x1f4bf8['range'];}_getDocumentRangeForReplyChanges(_0x5c636f,_0x18da4d){const {reply:_0x57c565,interaction:_0x28ab7c}=this['getInteractionAndReplyById'](_0x5c636f),_0x3d4240=_0x57c565['changeGroups']['filter'](_0x2c9853=>'pending'==_0x2c9853['state']),_0x55bd91=_0x3d4240['map'](_0xceb97b=>_0x57c565['changeGroups']['indexOf'](_0xceb97b));void 0x0===_0x18da4d&&(_0x18da4d=_0x55bd91[0x0]);const _0x2a0477=_0x55bd91['indexOf'](_0x18da4d);if(-0x1==_0x2a0477)return null;const _0x5d0d95=_0x3d4240[_0x2a0477],_0x440009=_0x5d0d95['editor'];if(!_0x440009||'destroyed'===_0x440009['state'])return null;const _0x1f57b8=Gs(_0x440009,_0x5d0d95['rootName']),_0x24703e=_0x57c565['documentContextContent']['get'](_0x5d0d95['documentId']),_0x1024b0=new _0x2fcdd7([]),_0x521233=new _0x2fcdd7([]);for(const _0x293a8c of _0x5d0d95['changes'])if('removed'!=_0x293a8c['type']&&_0x521233['children']['push'](_0x293a8c['node']['cloneNode'](!0x0)),'new'!=_0x293a8c['type']){const _0x3fb66c=_0x1478a8(_0x434859=>Ps(_0x434859,'data-id')==_0x293a8c['id'],_0x24703e,!0x0);_0x1024b0['children']['push'](_0x3fb66c['cloneNode'](!0x0));}if(0x0==_0x1024b0['children']['length']){if(_0x5d0d95['changes'][0x0]['anchorId']){const _0x24630e=vs('data-id',_0x5d0d95['changes'][0x0]['anchorId'],_0x24703e);_0x1024b0['children']['unshift'](_0x24630e['cloneNode'](!0x0)),_0x521233['children']['unshift'](_0x24630e['cloneNode'](!0x0)),_0x24630e['nextSibling']&&(_0x1024b0['children']['push'](_0x24630e['nextSibling']['cloneNode'](!0x0)),_0x521233['children']['push'](_0x24630e['nextSibling']['cloneNode'](!0x0)));}else{const _0x63e7d6=_0x24703e['children'][0x0];if(!_0x63e7d6)return null;_0x1024b0['children']['push'](_0x63e7d6['cloneNode'](!0x0)),_0x521233['children']['push'](_0x63e7d6['cloneNode'](!0x0));}}if(_0x1f57b8&&qs(_0x57c565['changeGroups'],_0x57c565['documentContextContent'])['has'](_0x5d0d95['index']))return null;const _0x141cdb=_0x28ab7c['getDocumentContext'](),_0x189603=_0x141cdb['documents']['find'](_0xa2fb7f=>_0xa2fb7f['id']==_0x5d0d95['documentId'])['content'],_0x4e5d45=_0x440009['model']['document']['getRoot'](_0x5d0d95['rootName']),_0x24a723=_0x440009['data']['parse'](_0x189603,_0x4e5d45),_0xf77d8a=_0x1f57b8?Ws(Os(_0x1024b0)):Os(_0x1024b0),_0x229b98=_0x440009['data']['parse'](_0xf77d8a,_0x4e5d45),_0xd9bdea=_0x440009['data']['parse'](_0xf77d8a,_0x4e5d45),_0x2db02c=_0x440009['model']['createPositionAt'](_0x229b98,0x0),_0x245982=_0x1f57b8?Ws(Os(_0x521233)):Os(_0x521233),_0x276e79={'targetEditor':_0x440009,'anchor':_0x2db02c,'markDeletions':!0x1};let _0x5cab0e;try{_0x5cab0e=_0x440009['plugins']['get'](_0x2cd097)['getDiff'](_0xf77d8a,_0x245982,_0x276e79)['getOperations']();}catch(_0x4792cf){return this['_reporter']['reportError'](new yn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x4792cf,'context':{'replyId':_0x5c636f,'partIndex':_0x18da4d}})),null;}if(!_0x5cab0e['length'])return null;_0x440009['model']['change'](_0x150080=>{for(const _0x4745d7 of _0x5cab0e)if(!_0x27f0ea(_0x4745d7)){if('remove'==_0x4745d7['type']){const _0x1cc3eb=_0x4745d7['sourcePosition'],_0x4f7d84=_0x4745d7['howMany'],_0x3cc81d=new _0x10a40c(_0x1cc3eb,_0x4f7d84);_0x150080['batch']['addOperation'](_0x3cc81d),_0x440009['model']['applyOperation'](_0x3cc81d);}else'marker'!==_0x4745d7['type']&&(_0x4745d7['baseVersion']=null,_0x4745d7['isDocumentOperation']=!0x1,_0x150080['batch']['addOperation'](_0x4745d7),_0x440009['model']['applyOperation'](_0x4745d7));}});const _0x19c9db=_n(_0x440009,_0x5cab0e,_0x229b98);An(_0x440009['model'],_0x19c9db);const _0x442894=_0x19c9db['getFirstRange']()['start']['path']['slice'](),_0xaebc12=_0x19c9db['getFirstRange']()['end']['path']['slice'](),_0x1c4e8e=[];let _0x439ffc=_0x229b98,_0x13496e=_0xd9bdea;for(let _0x55b29c=0x0;_0x55b29c<_0xaebc12['length'];_0x55b29c++){const _0x8a76da=_0x439ffc['maxOffset']-_0xaebc12[_0x55b29c];_0x1c4e8e[_0x55b29c]=_0x13496e['maxOffset']-_0x8a76da,_0x439ffc=_0x439ffc['getChildAtOffset'](_0xaebc12[_0x55b29c]),_0x13496e=_0x13496e['getChildAtOffset'](_0x1c4e8e[_0x55b29c]);}const _0x5a7d68=_0x440009['model']['createRange'](_0x440009['model']['createPositionFromPath'](_0xd9bdea,_0x442894),_0x440009['model']['createPositionFromPath'](_0xd9bdea,_0x1c4e8e)),_0xa3740c=_0x5a7d68['start']['path']['slice'](),_0x3351d5=_0x5a7d68['end']['path']['slice']();if(!_0x1f57b8){const _0xd39ca2=_0xd9bdea['getChild'](0x0)['getAttribute'](_0x4e9c0c),_0x388b5d=Array['from'](_0x24a723['getChildren']())['find'](_0x13e75c=>_0x13e75c['getAttribute'](_0x4e9c0c)==_0xd39ca2)['getPath']();_0xa3740c[0x0]=_0x388b5d[0x0]+_0xa3740c[0x0],_0x3351d5[0x0]=_0x388b5d[0x0]+_0x3351d5[0x0];}let _0x2745df=_0x440009['model']['createRange'](_0x440009['model']['createPositionFromPath'](_0x440009['model']['document']['getRoot'](_0x5d0d95['rootName']),_0xa3740c),_0x440009['model']['createPositionFromPath'](_0x440009['model']['document']['getRoot'](_0x5d0d95['rootName']),_0x3351d5));const _0x2a1b66=_0x141cdb['documents']['find'](_0x5775ac=>_0x5775ac['id']==_0x5d0d95['documentId'])['version'],_0x3c4f43=_0x440009['model']['document']['history']['getOperations'](_0x2a1b66);for(const _0x4dce67 of _0x3c4f43)_0x2745df=_0x244cab['_createFromRanges'](_0x2745df['getTransformedByOperation'](_0x4dce67));return{'range':_0x2745df,'currentIndex':_0x18da4d,'targetEditor':_0x440009};}_integrateEditorBalloon(_0x4f58a7){if(!_0x4f58a7['plugins']['has']('AIChatBalloon'))return;const _0x19afbf=_0x4f58a7['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x19afbf['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x19afbf,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x1cdba6,partIndex:_0x43cbe5}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x3910d2}=this['getInteractionAndReplyById'](_0x1cdba6),_0x2c8445=_0x3910d2['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x43cbe5});_0x19afbf['updateContent']({'part':_0x2c8445[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x19afbf,'applySuggestion',()=>{const {replyId:_0x189690,partIndex:_0x576733}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x189690,'partIndex':_0x576733}),_0x19afbf['setState']('accepted');}),this['listenTo'](_0x19afbf,'insertSuggestion',()=>{const {replyId:_0x2aa143,partIndex:_0x5ea6be}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x2aa143,'partIndex':_0x5ea6be}),_0x19afbf['setState']('accepted');}),this['listenTo'](_0x19afbf,'rejectSuggestion',()=>{const {replyId:_0x2fa6f5,partIndex:_0xdb8c38}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x2fa6f5,'partIndex':_0xdb8c38}),_0x19afbf['setState']('rejected');}),this['listenTo'](_0x19afbf,'showNext',()=>{const {replyId:_0x1bd0e0,partIndex:_0x45591d}=this['_currentPreviewedChangeGroup'],_0x1a191d=this['_getPresentableSiblingContentPartIndex'](_0x1bd0e0,_0x45591d,'next');null!==_0x1a191d&&this['_openBalloonFor'](_0x1bd0e0,_0x1a191d);}),this['listenTo'](_0x19afbf,'showPrevious',()=>{const {replyId:_0x533361,partIndex:_0x271d44}=this['_currentPreviewedChangeGroup'],_0x364356=this['_getPresentableSiblingContentPartIndex'](_0x533361,_0x271d44,'previous');null!==_0x364356&&this['_openBalloonFor'](_0x533361,_0x364356);}),this['listenTo'](_0x19afbf,'dialogClosed',(_0x5d61aa,{id:_0x53a3ee})=>{if('aiChatBalloon'!==_0x53a3ee)return;const {replyId:_0x56117e,partIndex:_0x12ca33}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x56117e,'index':_0x12ca33,'isActive':!0x1}),this['_activeBalloon']===_0x19afbf&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x9acaaf){if(this['_channelsToEditors']['set'](_0x9acaaf['config']['get']('collaboration.channelId'),_0x9acaaf),this['_integrateEditorBalloon'](_0x9acaaf),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x9acaaf,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x9acaaf['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x9acaaf['plugins']['has']('Undo')){const _0x502581=_0x9acaaf['commands']['get']('undo'),_0x57cf80=_0x9acaaf['commands']['get']('redo');this['listenTo'](_0x502581,'revert',(_0x42bcf6,_0xb9a99d,_0x407b29)=>{const _0xfb6823=this['_batchToChanges']['get'](_0xb9a99d);if(!_0xfb6823)return;const _0x300690=this['activeConversation']['getInteraction'](_0xfb6823['interactionId']),_0x4abc84=_0x300690?.['getReply'](_0xfb6823['replyId']);this['_batchToChanges']['delete'](_0xb9a99d),_0x300690&&_0x4abc84&&(_0xfb6823['indexes']['forEach'](_0x15a612=>_0x4abc84['setChangeGroupState'](_0x15a612,'pending')),this['_batchToChanges']['set'](_0x407b29,_0xfb6823));}),this['listenTo'](_0x57cf80,'revert',(_0x372949,_0x1b1bb5,_0x3e7a99)=>{const _0x2cb054=this['_batchToChanges']['get'](_0x1b1bb5);if(!_0x2cb054)return;const _0x558dd9=this['activeConversation']['getInteraction'](_0x2cb054['interactionId']),_0x4de421=_0x558dd9?.['getReply'](_0x2cb054['replyId']);this['_batchToChanges']['delete'](_0x1b1bb5),_0x558dd9&&_0x4de421&&(_0x2cb054['indexes']['forEach'](_0x2a98bd=>_0x4de421['setChangeGroupState'](_0x2a98bd,'accepted')),this['_batchToChanges']['set'](_0x3e7a99,_0x2cb054));});}const _0x28bd5d=_0x9acaaf['config']['get']('ai.chat.context');_0x28bd5d['alwaysAddSelection']&&_0x28bd5d['document']['enabled']&&this['listenTo'](_0x9acaaf['model']['document']['selection'],'change:range',(_0x4a10d6,_0x555bb7)=>{_0x555bb7['directChange']&&'chat'===_0x9acaaf['plugins']['get']('AITabs')['view']['activeTab']&&(_0x9acaaf['model']['hasContent'](_0x9acaaf['model']['document']['selection'])?this['addSelectionToChatContext'](_0x9acaaf):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x26c35d=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x3b3650=await _0x26c35d['getConversations']();return _0x3b3650['length']?_0x3b3650[0x0]['id']:'new';}catch(_0x157b3a){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':kt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x157b3a})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x17fe43={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x17fe43),_0x17fe43['id']||this['set']('isConversationReady',!0x0);}catch(_0x297493){this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x17fe43['id']||kt()}),this['_reporter']['logError'](_0x297493),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x24b07d,modelId:_0x3b5079,contexts:_0x26f99c}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x4f5a1d=_0x3b5079;_0x4f5a1d||(_0x24b07d||!this['activeConversation']?_0x4f5a1d=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x4f5a1d=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x575396=this['getGroupId'](),_0x157845=_0x24b07d||kt(),_0x317cd6=await this['_aiModels']['getAvailableModels']();let _0x17081f;this['activeConversation']=new jn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x4f5a1d,'conversationId':_0x157845,'group':_0x575396,'locale':this['context']['locale'],'isFromHistory':!!_0x24b07d,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x26f99c,'getSessionId':_0x412ac6=>this['_aiEditing']['getSessionId'](_0x412ac6),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x317cd6}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x24b07d||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x56e456,_0x441733)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x441733['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x2a1cca=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x2a1cca);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x5caf6d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x5caf6d);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x23df40,_0xacd640)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xacd640,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x162746,_0xc07131)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xc07131,{'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',(_0x5cc2fb,_0x22fd2a)=>{this['_aiChatUi']['removeFeedInteraction'](_0x22fd2a['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x1fbaf7,_0x565118,_0x1ce2a7)=>{this['_updateConversationTitle'](_0x565118,_0x1ce2a7);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x3d430b,_0x3a0bc8)=>{void 0x0!==_0x17081f&&_0x17081f!==_0x3a0bc8['id']&&this['_updateReplyContentThrottled']['flush'](),_0x17081f=_0x3a0bc8['id'],_0x3a0bc8['isFromHistory']?await this['_updateReplyContent']({'reply':_0x3a0bc8}):await this['_updateReplyContentThrottled']({'reply':_0x3a0bc8});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x40b76b,{reply:_0x43bab6,index:_0x19beba,state:_0x10e1fe,outdatedReason:_0x2bade7})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x43bab6['id'],'index':_0x19beba,'state':_0x10e1fe,'outdatedReason':_0x2bade7}),this['_aiChatUi']['hasFeedItem'](_0x43bab6['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x43bab6['id'],this['_computeSuggestionGating'](_0x43bab6)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x43bab6['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x19beba&&this['_activeBalloon']?.['setState'](_0x10e1fe,_0x2bade7);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x2d23a2,_0x45654f)=>{if(this['_aiChatUi']['addContextItem'](_0x45654f['contextItem'],_0x45654f['isLoading']),'selection'===_0x45654f['contextItem']['type']){const _0x258173=Ss(this['context']),_0x4ba203=[..._0x258173['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x258173,'ranges':_0x4ba203,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x4ed4ec,_0x553e20)=>{this['_aiChatUi']['removeContextItem'](_0x553e20['uiId']),'current-document'==_0x553e20['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x553e20['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x3a7392,_0x46227a)=>{this['_aiChatUi']['setContextItemLoading'](_0x46227a['contextItem']['uiId'],_0x46227a['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x411571,_0xcf04e7)=>{this['_aiChatUi']['setConversationContext'](_0xcf04e7['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x56074f,_0x1a2c04)=>{this['_aiChatUi']['setAddContextOptions'](_0x1a2c04['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x3770ad,_0x26f79f)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x26f79f['sourceId'],_0x26f79f['source'],_0x26f79f['resources'],_0x26f79f['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x56a2fd,_0x2d65fe)=>{this['_aiChatUi']['updateResourceState'](_0x2d65fe['sourceId'],_0x2d65fe['resourceId'],_0x2d65fe['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x36aaa7,_0x163612)=>{this['_aiChatUi']['updateCapabilities'](_0x163612);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x29cb20,_0x30391e)=>{this['_aiChatUi']['setSelectedModel'](_0x30391e['selectedModel']??null,_0x30391e['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x1d19ff,{error:_0x2f5033,interactionId:_0x3c5335,fileName:_0x59d0b9,url:_0x308658,sourceId:_0x54f33a,sourceLabel:_0x128117})=>{let _0x44b500;const _0x1309a6=_0x3c5335?_0x3c5335+':'+kt():kt();this['_reporter']['reportError'](_0x2f5033),this['_aiChatUi']['startAutoScroll'](),_0x2f5033['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x44b500=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Es(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x1309a6})):_0x2f5033['message']['startsWith']('ai-chat-conversation-init-failed')||_0x2f5033['message']['startsWith']('ai-chat-conversation-start-failed')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-file-upload-failed')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x59d0b9),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-url-upload-failed')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x308658),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-invalid-data')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-unsupported-type')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x54f33a&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x54f33a),_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x128117||'source'),'id':_0x1309a6})):_0x2f5033['message']['startsWith']('ai-chat-resource-load-failed')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-invalid-request')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-file-too-large')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x1309a6}):_0x2f5033['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x1309a6}):(this['_cancelProcessing'](),_0x44b500=this['_aiChatUi']['addFeedItemError']({'errorMessage':Es(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x1309a6}));try{await Promise['race']([_0x44b500,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x24b07d||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x564f6c=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x564f6c,'sources':[..._0x564f6c?.['sources']??[],this['_contextLibrarySource']]}:_0x564f6c;}async _setUpContextLibrarySource(){const _0x28fee6=await this['_createContextLibrarySource']();_0x28fee6&&(this['_contextLibrarySource']=_0x28fee6,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x28fee6));}async _createContextLibrarySource(){let _0x172201;try{_0x172201=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x172201['length'])return null;const _0x5772ea=_0x172201['map'](_0x185bd7=>({'id':_0x185bd7['id'],'type':'context','label':_0x185bd7['name']||_0x185bd7['id']}));return{'id':'ck-ai-context-library','label':Es(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x5772ea)};}_removeFromContext(_0x3f6a60){this['activeConversation']?.['removeFromContext'](_0x3f6a60);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x33c09d){const [_0x3950ec,_0x1304c9]=_0x33c09d['split'](':'),_0x20d09a=this['activeConversation']['getInteraction'](_0x3950ec);return{'interaction':_0x20d09a,'reply':_0x20d09a['getReply'](_0x1304c9)};}_scrollToSuggestionRange(_0x20592a,_0x1ed3c8=!0x1,_0x137ba9){const _0x401c0f={'target':_0x137ba9['editing']['view']['domConverter']['viewRangeToDom'](_0x137ba9['editing']['mapper']['toViewRange'](_0x20592a)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x1ed3c8};_0x1ed3c8&&(_0x401c0f['alignToTop']=!0x0),Ot(_0x401c0f);}_updateConversationTitle(_0x3cb4a4,_0x254882=!0x1){this['_aiChatUi']['setConversationTitle'](_0x3cb4a4||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x254882);}_addFeedItemReply(_0x505a95){'text'===_0x505a95['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x505a95):this['_aiChatUi']['addFeedItemAISuggestion'](_0x505a95);}async _updateReplyContent({reply:_0x407bc0,renderingStrategy:_0x259687}){const {id:_0x5b5c4b,interactionId:_0x224591,isDone:_0x1ae9d9,type:_0x4afaaf,parsedContent:_0x4711ef}=_0x407bc0,_0x4ca6fc=_0x224591+':'+_0x5b5c4b;if('modification'===_0x4afaaf){const _0x2b2ce9=_0x407bc0['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4ca6fc,'parts':_0x2b2ce9,'isDone':_0x1ae9d9,'skipLoadingEffects':_0x407bc0['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x407bc0['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x407bc0['id'],this['_computeSuggestionGating'](_0x407bc0));}else'text'===_0x4afaaf&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x4ca6fc,'parsedContent':_0x4711ef['get']('text'),'renderingStrategy':_0x259687,'isDone':_0x1ae9d9});_0x1ae9d9&&_0x407bc0['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x4ca6fc,_0x407bc0['sources']);}_updateReplyContentThrottled=_0x3befdf(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x73fc98=this['activeConversation']?.['lastInteraction'];if(_0x73fc98){for await(const _0x3e0a92 of _0x73fc98['replies'])this['_aiChatUi']['hasFeedItem'](_0x3e0a92['id'])||this['_addFeedItemReply'](_0x3e0a92),await this['_updateReplyContent']({'reply':_0x3e0a92,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x327f1f){const _0x3f2855={'positiveCount':_0x327f1f['changeGroups']['filter'](_0x4ca653=>'accepted'===_0x4ca653['state'])['length'],'totalCount':_0x327f1f['changeGroups']['length'],'modificationId':_0x327f1f['id']},_0xca452=this['activeConversation']['getInteraction'](_0x327f1f['interactionId'])['messageId'];_0xca452&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0xca452,_0x3f2855);}_getAIChatFeedAPI(_0x15fc18){const _0x8754da=this['_aiChatUi'],_0x44db7e=()=>{_0x15fc18['resetWebSearchState'](),_0x15fc18['resetReasoningState'](),_0x8754da['clearLoadingMessage']();},_0x2934c1=()=>{_0x15fc18['currentReply']&&(_0x15fc18['currentReply']['done'](),_0x15fc18['currentReply']=void 0x0);};return{'insertTextReply':(_0x5d61a5,_0x539b9c)=>{_0x2934c1(),_0x44db7e();const _0x3eb11c=_0x15fc18['currentReply']=_0x15fc18['createReply']({'type':'text','interactionId':_0x15fc18['id'],'id':_0x539b9c||kt(),'channelsToEditors':this['_channelsToEditors']});return _0x3eb11c['appendContent'](_0x5d61a5),_0x2934c1(),_0x3eb11c;},'insertCustomElement':async(_0x5c5773,_0x5b3ea8)=>(_0x2934c1(),_0x44db7e(),_0x8754da['addFeedItemCustomElement'](_0x5c5773,_0x5b3ea8||kt())),'setLoadingMessage':_0x127c06=>{_0x8754da['setLoadingMessage'](_0x127c06);},'clearLoadingMessage':()=>{_0x8754da['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){bs(this['context'])['find'](_0x1d6fd0=>'destroyed'!==_0x1d6fd0['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const ir=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],sr=[...ir,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function nr(_0x265cb4){const _0x46fecd=new AbortController();return{'promise':new Promise((_0xee3e23,_0x38d828)=>{const _0x398f73=setTimeout(_0xee3e23,_0x265cb4);_0x46fecd['signal']['addEventListener']('abort',()=>{clearTimeout(_0x398f73),_0x38d828();});}),'abortController':_0x46fecd};}var rr=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x4631b4){this['options']={'delay':_0x4631b4?.['delay']??0xa,'textNodeStyle':_0x4631b4?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x550715,targetElement:_0x37a5d2,abortSignal:_0x9d3a8f}){this['isStreaming']&&this['stop'](),_0x9d3a8f?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x40285a(_0x550715,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x54f140=0x0;_0x54f140<this['currentIndex'];_0x54f140++)this['nodesList'][_0x54f140]['shouldBeStreamed']=!0x0;do{const _0xc80cdf=Date['now'](),_0x253053=this['nodesList'][this['currentIndex']],_0x21c180=_0xc80cdf-this['lastUpdateTime'];if(_0x253053){_0x253053['shouldBeStreamed']=!0x0;let _0x5cd06c=_0x253053['parent'];for(;_0x5cd06c;)_0x5cd06c['shouldBeStreamed']=!0x0,_0x5cd06c=_0x5cd06c['parent'];}if(_0x21c180<this['options']['delay'])try{const {promise:_0x35299f,abortController:_0x590831}=nr(this['options']['delay']-_0x21c180);this['timeoutAbortController']=_0x590831,await _0x35299f;}catch(_0x5544ee){return;}_0x4ab719(_0x37a5d2,'<'+_0x37a5d2['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x37a5d2['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:_0x3cd633}){Array['from'](_0x3cd633['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x3835d4=>{_0x3835d4['replaceWith'](_0x3835d4['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x48259b){let _0x8713db='';if(function(_0x187a03){return _0x3f6391(_0x187a03);}(_0x48259b)){for(const _0x2bc336 of _0x48259b['children'])_0x8713db+=this['renderNode'](_0x2bc336);}else{if(hr(_0x48259b)){if(!_0x48259b['shouldBeStreamed'])return'';const _0x4763f2=_0x48259b,_0x3cf79c=Object['entries'](_0x4763f2['attribs'])['map'](([_0x587d34,_0x22ff36])=>_0x587d34+'=\x22'+_0x22ff36+'\x22')['join']('\x20');_0x8713db+='<'+_0x4763f2['tagName']+(_0x3cf79c?'\x20'+_0x3cf79c:'')+'>';for(const _0x396d4c of _0x38ca5b(_0x4763f2))_0x8713db+=this['renderNode'](_0x396d4c);_0x8713db+='</'+_0x4763f2['tagName']+'>';}else{if(!ar(_0x48259b))return'';if(!_0x48259b['shouldBeStreamed'])return'';!function(_0x30055b){return!(!_0x30055b['parent']||!hr(_0x30055b['parent']))&&(!!or['includes'](_0x30055b['parent']['tagName'])&&!_0x3a5b3f(_0x30055b)['match'](/^\s*[<>]\s*$/));}(_0x48259b)?_0x8713db+=_0x311e91(_0x48259b):_0x8713db+=_0x311e91(new _0x5ea3d9('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x48259b]));}}return _0x8713db;}getParsedDocumentNodeList(){const _0x10c74d=[];return function(_0x93d037,_0xf0156d){const _0x111c82=_0x4319b2=>{if(_0xf0156d(_0x4319b2),_0x4319b2 instanceof _0x49f808)for(let _0x4a18dc=0x0;_0x4a18dc<_0x4319b2['children']['length'];_0x4a18dc++){const _0x464be7=_0x4319b2['children'][_0x4a18dc];_0x111c82(_0x464be7);}};for(let _0x2bd4c4=0x0;_0x2bd4c4<_0x93d037['children']['length'];_0x2bd4c4++)_0x111c82(_0x93d037['children'][_0x2bd4c4]);}(this['document'],_0x1b40b8=>{if(ar(_0x1b40b8)){const _0x300cbb=this['splitTextNodeIntoWordNodes'](_0x1b40b8);_0x300cbb['length']&&_0x10c74d['push'](..._0x300cbb);}_0x1b40b8['isWordSplitSource']||_0x1b40b8['isWordSplitResult']||_0x10c74d['push'](_0x1b40b8);}),_0x10c74d;}splitTextNodeIntoWordNodes(_0x1725fc){if(_0x1725fc['isWordSplitSource']||_0x1725fc['isWordSplitResult'])return[];const _0x456068=_0x3a5b3f(_0x1725fc)['match'](/(?:\s*\S+\s*)/g),_0x201493=[];if(_0x456068&&_0x456068['length']>0x1){for(const _0x1c65f7 of _0x456068){const _0x3afdb8=new _0x2c88e6(_0x1c65f7);_0x3afdb8['isWordSplitResult']=!0x0,ti(_0x1725fc,_0x3afdb8),_0x201493['push'](_0x3afdb8);}_0x1725fc['isWordSplitSource']=!0x0,_0x11f553(_0x1725fc);}return _0x201493;}};const or=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ar(_0x3a6d0f){return _0x56307a(_0x3a6d0f);}function hr(_0x181a6e){return _0x1c00b6(_0x181a6e);}function cr(_0x7c6ce4,_0x2e1087){_0x7c6ce4['cleanUpAnimations']({'targetElement':_0x2e1087}),_0x2e1087['querySelectorAll']('[data-id]')['forEach'](_0x588f19=>{_0x588f19['removeAttribute']('data-id');});}var lr=class extends _0x3faf4e{options;content='';htmlStreamer;['children'];constructor(_0x24b9f3){super();const _0x50f46b=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new rr(),this['options']=_0x24b9f3,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x50f46b['if']('isDone','ck-ai-chat__feed__item_done'),_0x50f46b['if']('isVisible','ck-hidden',_0x20be58=>!_0x20be58),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){cr(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x496314,_0x4ca6a4,_0x2a315e){await this['htmlStreamer']['stream']({'document':_0x496314,'targetElement':_0x4ca6a4,'abortSignal':_0x2a315e});}},ur=class extends _0x3faf4e{['showChangesToggleView'];constructor(_0x2561ef,_0xd33511){super(_0x2561ef),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new dr(_0x2561ef),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Dn,'label':Es(_0x2561ef,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xd33511['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x5f1333=>_0x5f1333?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x315431=new $t();_0x315431['content']=_0x2cf678,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xd33511['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x315431,{'tag':'span','children':[Es(_0x2561ef,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},dr=class extends Mt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const _r={'accepted':_0x884ad8,'rejected':_0x2f23df,'outdated':_0x4d50e7};var gr=class extends _0x3faf4e{statePillView;constructor(_0x35f2e7){super(_0x35f2e7);const _0x3aaee5=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x46d1c2(_0x35f2e7),this['statePillView']['bind']('label')['to'](this,'state',_0x308f89=>function(_0x791652,_0x381565){return Es(_0x791652,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x381565['toUpperCase']());}(_0x35f2e7,_0x308f89)),this['statePillView']['bind']('icon')['to'](this,'state',_0x529699=>_r[_0x529699]),this['statePillView']['bind']('class')['to'](this,'state',_0x3b1d1f=>'ck-pill_'+_0x3b1d1f),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x2e7762,_0x41a09e)=>function(_0x2424f6,_0x2c2228,_0x61494e){if('outdated'!==_0x2c2228)return;return Es(_0x2424f6,_0x61494e?Ar[_0x61494e]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x35f2e7,_0x2e7762,_0x41a09e)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x3aaee5['if']('isVisible','ck-hidden',_0x5a52ac=>!_0x5a52ac)]},'children':[this['statePillView']]});}setState(_0x4ff91b,_0x4188f8){this['state']=_0x4ff91b,this['outdatedReason']='outdated'===_0x4ff91b?_0x4188f8:void 0x0;}};const Ar={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Ir=class extends _0x372a41{_applyButton;_suggestButton;constructor(_0x42ea30,_0x42ece8,_0x238e62){super(_0x42ea30);const _0xd46336=Boolean(_0x238e62);this['set']('isEnabled',!_0xd46336),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x3501f6=[];if(!_0xd46336){_0x42ece8['includes']('applySuggestion')&&(this['_applyButton']=new Mt(_0x42ea30),this['_applyButton']['set']({'label':Es(_0x42ea30,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x97f812}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x310500,_0x57b596)=>_0x310500&&!_0x57b596),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x2a0b1c=>!_0x2a0b1c),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x3501f6['push'](this['_applyButton'])),_0x42ece8['includes']('insertSuggestion')&&(this['_suggestButton']=new Mt(_0x42ea30),this['_suggestButton']['set']({'label':Es(_0x42ea30,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x823889}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x11e224,_0x122f32)=>_0x11e224&&!_0x122f32),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x3501f6['push'](this['_suggestButton']));const _0x19fa8e=new Mt(_0x42ea30);_0x19fa8e['set']({'label':Es(_0x42ea30,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x352379}),_0x19fa8e['bind']('isEnabled')['to'](this),_0x19fa8e['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x3501f6['push'](_0x19fa8e);}this['items']['addMany'](_0x3501f6);const _0x2c3cf4=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x2c3cf4['if']('isVisible','ck-hidden',_0x4a13e5=>!_0x4a13e5)]}});}setButtonsVisibility({showApplyButton:_0x2e1522,showSuggestButton:_0x4abb12}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x2e1522),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x4abb12);}},pr=class extends _0x3faf4e{toolbarView;stateView;titleLabelView;['children'];constructor(_0x36c6ff,{part:_0x18c5b4,uiIndex:_0xe5535e,availableActions:_0x45c55d,areActionsDisabled:_0xeaeb95}){super(_0x36c6ff),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Ir(_0x36c6ff,_0x45c55d,_0xeaeb95),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x18c5b4['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x18c5b4['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x18c5b4['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new gr(_0x36c6ff),this['titleLabelView']=new Er(_0x36c6ff,_0xe5535e),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',(_0x52a1ad,_0x2dc5d6,_0x1fe3ca,_0x4972ab)=>{'pending'===_0x4972ab?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x1fe3ca?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x1fe3ca,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Er=class extends _0x3faf4e{constructor(_0x3f2522,_0x53215b){super(_0x3f2522),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Es(_0x3f2522,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x53215b['toString']())]});}},mr=class extends _0x3faf4e{htmlStreamer;constructor(_0x3bf0f7){super(_0x3bf0f7),this['htmlStreamer']=new rr(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x2a91ef,renderingStrategy:_0x1c9aa0,abortSignal:_0x59bb86}){this['_ensureHostElementTag'](_0x2a91ef['wrapperTag']||'div');const _0xe20fea=_0x40285a(_0x2a91ef['content'],!0x0);for(const _0x4f27e3 of ys(_0xe20fea))_0x11f553(_0x4f27e3);'streaming'===_0x1c9aa0?await this['htmlStreamer']['stream']({'document':_0xe20fea,'targetElement':this['element'],'abortSignal':_0x59bb86}):_0x4ab719(this['element'],'<'+this['element']['tagName']+'>'+Os(_0xe20fea)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){cr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x2d3949){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x2d3949)return;const _0x31db71=new _0x2f5e20({'tag':_0x2d3949,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x31db71),this['element']=_0x31db71;}},Tr=class extends _0x3faf4e{['_children'];['_headerView'];_streamableContentView;constructor(_0x59093d,{part:_0x11f2ce,uiIndex:_0xa56e1,areActionsDisabled:_0x1e9c31,availableActions:_0x496725}){super(_0x59093d);const _0x23bb7f=this['bindTemplate'];this['set']('state',_0x11f2ce['state']),this['set']('outdatedReason',_0x11f2ce['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0x149b59=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x1e9c31;};this['on']('change:state',_0x149b59),this['on']('change:isDone',_0x149b59),_0x149b59(),this['_children']=this['createCollection'](),this['_headerView']=new pr(_0x59093d,{'part':_0x11f2ce,'uiIndex':_0xa56e1,'availableActions':_0x496725,'areActionsDisabled':_0x1e9c31}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...ir)['to'](this),this['_streamableContentView']=new mr(_0x59093d),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x23bb7f['to']('state',_0x1d15e7=>'ck-ai-suggestion__body__content-part_'+_0x1d15e7),_0x23bb7f['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x23bb7f['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x23bb7f['if']('isVisible','ck-hidden',_0x1a9d55=>!_0x1a9d55)]},'children':this['_children'],'on':{'mouseenter':_0x23bb7f['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x11f2ce['index']});}),'mouseleave':_0x23bb7f['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x11f2ce['index']});}),'click':_0x23bb7f['to'](_0x1909f4=>{const _0x1f9c90=_0x1909f4['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x1f9c90)&&this['fire']('showChangeInText',{'index':_0x11f2ce['index']});})}});}async updateContent({part:_0x4456fb,showUnchangedParts:_0x21894e=!0x1,abortSignal:_0x1dd8e9}){this['partDefinition']=_0x4456fb,this['isVisible']=this['partDefinition']['hasChanges']||_0x21894e,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x4456fb,'renderingStrategy':'static','abortSignal':_0x1dd8e9});}['markAsDone'](){this['isDone']=!0x0;}},wr=class extends _0x3faf4e{constructor(_0x5c52c3,_0x59fac1){super(_0x5c52c3),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5c2bea=>!_0x5c2bea)]},'children':this['_createSkeletonItems'](_0x59fac1)});}_createSkeletonItems(_0x5d2334){const _0x4c140c=['ck','ck-ai-skeleton__item'];return _0x5d2334['map'](_0x359ce7=>{let _0xe6b33e='';switch(_0x359ce7['attributes']['align']){case'right':_0xe6b33e='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0xe6b33e='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0xe6b33e='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x359ce7['tag'],'attributes':{'class':[..._0x4c140c,_0x359ce7['attributes']['class']?_0x359ce7['attributes']['class']:''],'style':'width:\x20'+_0x359ce7['attributes']['width']+';\x20height:\x20'+_0x359ce7['attributes']['height']+';'+_0xe6b33e}};});}};const Cr={'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':fr(0x5,'100%','44px','right'),'aiChatResources':fr(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 fr(_0x1ccc32,_0x4baf29,_0x334a34,_0x404c5e){return new Array(_0x1ccc32)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4baf29,'height':_0x334a34,'align':_0x404c5e}}));}const br=/* #__PURE__ -- @preserve */
|
|
33
|
-
dt();var Sr=class extends br{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x56c975){const _0x5072bd=this['createTask'](_0x56c975);return this['queue']['push'](_0x5072bd),this['_processQueue'](),_0x5072bd['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(_0x1838b3=>{this['once']('_queueEmpty',()=>{_0x1838b3();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x5c39a5=this['queue']['shift']();try{await _0x5c39a5['callback'](this['_abortController']['signal']),_0x5c39a5['resolve']();}catch(_0x69075c){_0x5c39a5['reject'](_0x69075c);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x4c42e7){let _0xb122c6,_0x988144;const _0x4bdd0b=new Promise((_0x974659,_0x181c99)=>{_0xb122c6=_0x974659,_0x988144=_0x181c99;});return{'callback':_0x4c42e7,'resolve':_0xb122c6,'reject':_0x988144,'completePromise':_0x4bdd0b};}},Rr=class extends lr{constructor(_0x1c008f){super(_0x1c008f),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x1c008f['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x55a620){this['element']['innerHTML']=_0x55a620;}};const Or=['applySuggestion','insertSuggestion'];var vr=class extends _0x3faf4e{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0xcaac36,_0x1e0057=[...Or],_0x4d3721){super(_0xcaac36);const _0x383b87=this['bindTemplate'],_0x48013f=Boolean(_0x4d3721);this['set']('isEnabled',!_0x48013f),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x48013f||(this['_applyChangesButton']=new Mt(_0xcaac36),this['_applyChangesButton']['set']({'label':Es(_0xcaac36,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1e0057['includes']('applySuggestion'),'class':Ln}),this['_insertSuggestionsButton']=new Mt(_0xcaac36),this['_insertSuggestionsButton']['set']({'label':Es(_0xcaac36,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1e0057['includes']('insertSuggestion'),'class':Pn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2ff837=>{_0x2ff837['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',_0x383b87['if']('isVisible','ck-hidden',_0x362559=>!_0x362559)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x16abfc){this['isVisible']=_0x16abfc;}_switchButtonLabelsPlurality(_0x1fe2ef){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x1fe2ef?(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Es(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},kr=class extends _0x3faf4e{['children'];['balloonPanelView'];bodyCollection;constructor(_0x4f326d,_0x4b6071){super(_0x4f326d),this['bodyCollection']=_0x4b6071,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',_0x36689e=>!_0x36689e)]},'children':this['children']});const _0x5735e4=new _0x3faf4e(this['locale']),_0x3be488=new $t();_0x3be488['content']=ht,_0x5735e4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3be488,{'tag':'span','children':[{'text':Es(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x5735e4),this['_setupBalloonPanel'](_0x4f326d);}['addSource'](_0x51e0b0){this['children']['add'](new yr(this['locale'],_0x51e0b0,this['balloonPanelView']));}_setupBalloonPanel(_0x58f585){this['balloonPanelView']=new xt(_0x58f585),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},yr=class extends Mt{['balloonPanelView'];['source'];constructor(_0x3ae103,_0x38a5df,_0x227aea){super(_0x3ae103),this['source']=_0x38a5df,this['balloonPanelView']=_0x227aea,this['set']({'label':_0x38a5df['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x64f498=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x64f498['to'](()=>{window['open'](_0x38a5df['url'],'_blank');}),'mouseenter':_0x64f498['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x64f498['to'](()=>{this['_hideTooltip']();})}}),_0x38a5df['favicon']){const _0x2adec0=new _0x3faf4e(_0x3ae103);_0x2adec0['setTemplate']({'tag':'img','attributes':{'src':_0x38a5df['favicon']||ht,'alt':_0x38a5df['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x2adec0);}else this['set']('icon',ht);}_createTooltipContentView(_0x18e790,_0x3659dd){const _0x308671=new _0x3faf4e(_0x18e790),_0x17d59f=[];let _0x313ffb;_0x3659dd?.['favicon']?(_0x313ffb=new _0x3faf4e(_0x18e790),_0x313ffb['setTemplate']({'tag':'img','attributes':{'src':_0x3659dd['favicon'],'alt':_0x3659dd['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x313ffb=new $t(),_0x313ffb['content']=ht,_0x313ffb['extendTemplate']({'attributes':{'alt':_0x3659dd['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x17d59f['push'](_0x313ffb);const _0x1c33a2=new _0x3faf4e(_0x18e790);_0x1c33a2['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x3659dd['url']},'children':[{'text':new URL(_0x3659dd['url'])?.['hostname']}]}),_0x17d59f['push'](_0x1c33a2);const _0x29f0e1=new _0x3faf4e(_0x18e790);_0x29f0e1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x17d59f});const _0x2601d9=new _0x3faf4e(_0x18e790);return _0x2601d9['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x3659dd['title']['length']>0x190?_0x3659dd['title']['substring'](0x0,0x190)+'...':_0x3659dd['title']}]}),_0x308671['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x29f0e1,_0x2601d9]}),_0x308671;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthWest'],xt['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 _0x52bfca=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x52bfca);}},Nr=class extends _0x3faf4e{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x509cdb(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x4be0c1,_0x547081){super(_0x4be0c1);const {areActionsDisabled:_0x2c8668,showUnchangedParts:_0x3f082a,availableActions:_0x15c393}=_0x547081;this['_areActionsDisabled']=_0x2c8668,this['_showUnchangedParts']=_0x3f082a,this['_availableActions']=_0x15c393,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new wr(_0x4be0c1,Cr['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Sr(),this['_emptyPartsWarningView']=new Rr({'id':'empty-parts-warning','initialContent':Es(_0x4be0c1,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new vr(_0x4be0c1,_0x547081['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new kr(this['locale'],_0x547081['bodyCollection']),_0x547081['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...ir)['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'](_0x3f92b4=>_0x3f92b4 instanceof Tr);}async updateContentParts({parts:_0x19d1e2,abortSignal:_0x2a8c42,skipLoadingEffects:_0xe6b9c6}){this['_cachedContentParts']['length']?_0x19d1e2['forEach'](_0x55b9c8=>{const _0x590c1d=this['_cachedContentParts']['findIndex'](_0x104c16=>_0x104c16['index']==_0x55b9c8['index']);-0x1===_0x590c1d?this['_cachedContentParts']['push'](_0x55b9c8):this['_cachedContentParts'][_0x590c1d]=_0x55b9c8;}):this['_cachedContentParts']=_0x19d1e2;const _0x5e53c8=this['_showUnchangedParts']?_0x19d1e2:_0x19d1e2['filter'](_0x2cf17d=>_0x2cf17d['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x5e53c8['length']>0x1),_0xe6b9c6&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x1b90f3 of _0x19d1e2)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x1b0aa0=>{let _0x41ecb6=this['getPartView'](_0x1b90f3['index']);if(_0x41ecb6||_0x1b90f3['hasChanges']||this['_showUnchangedParts']){if(!_0x41ecb6){if(_0x41ecb6=new Tr(this['locale'],{'part':_0x1b90f3,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x41ecb6['delegate'](...ir)['to'](this),_0x41ecb6['bind']('isTrackChangesOn')['to'](this),!_0xe6b9c6&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x1b0aa0),_0x1b0aa0['aborted']))return;_0x41ecb6['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x1b90f3['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x41ecb6,this['_children']['length']-0x1),_0xe6b9c6||this['_showSkeletonDebounced']();}await _0x41ecb6['updateContent']({'part':_0x1b90f3,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x1b0aa0}),_0x41ecb6['markAsDone']();}});return _0x2a8c42?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x5c326f,_0x3ace95,_0x43b0ef){const _0x22c3e9=this['getPartView'](_0x5c326f);_0x22c3e9&&(_0x22c3e9['outdatedReason']=_0x43b0ef,_0x22c3e9['state']=_0x3ace95);}setGating({readOnlyByIndex:_0x1f4b9b,isAcceptAllEnabled:_0x155131}){this['_readOnlyByIndex']=_0x1f4b9b,this['isAcceptAllEnabled']=_0x155131;for(const _0x59fec6 of this['_contentPartViews'])_0x59fec6['isTargetReadOnly']=_0x1f4b9b['get'](_0x59fec6['partDefinition']['index'])??!0x1;}setPartActive(_0x3af5d1,_0x43f334){if(!0x1===_0x3af5d1){for(const _0x489c42 of this['_contentPartViews'])_0x489c42['isActive']=!0x1;}else{const _0x1e327c=this['getPartView'](_0x3af5d1);_0x1e327c&&(_0x1e327c['isActive']=_0x43f334);}}updateSources(_0x4f27b9){_0x4f27b9['forEach'](_0x1acb2e=>this['_sourcesView']['addSource'](_0x1acb2e)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x368389){return this['_contentPartViews']['find'](_0x477d63=>_0x477d63['partDefinition']['index']==_0x368389)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x1a9131=!this['_cachedContentParts']['find'](({hasChanges:_0x3766f5})=>_0x3766f5),_0x6827df=!!this['_cachedContentParts']['find'](({hasChanges:_0x31ddea})=>!_0x31ddea);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x6827df,_0x1a9131?this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Es(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0xc41309=>_0xc41309['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x169905){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x39a5d8=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x39a5d8>0x0){const {promise:_0x4ad5c7,abortController:_0x45d628}=nr(_0x39a5d8);_0x169905?.['addEventListener']('abort',()=>_0x45d628['abort']()),await _0x4ad5c7['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x2ca269=>_0x2ca269['partDefinition']['hasChanges'])['length']>0x0;}},xr=class extends _0x3faf4e{['bodyView'];['children'];['headerView'];constructor(_0x12b52c,_0x32c0ad,_0x185a78){super(_0x12b52c);const {showDiff:_0x41c36e,areActionsDisabled:_0x4e82e6,showUnchangedParts:_0x39f01e,availableActions:_0x62f001}=_0x32c0ad;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new ur(_0x12b52c,{'showDiff':_0x41c36e}),this['headerView']['on']('toggleShowChanges',(_0x5c4e60,_0x245d37)=>{this['areChangesVisible']=_0x245d37['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x245d37['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Nr(_0x12b52c,{'areActionsDisabled':_0x4e82e6,'showUnchangedParts':!!_0x39f01e,'availableActions':_0x62f001,'bodyCollection':_0x185a78}),this['bodyView']['delegate'](...ir)['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(_0x4c3b1e){await this['bodyView']['updateContentParts'](_0x4c3b1e);}updateSources(_0x1a2d07){this['bodyView']['updateSources'](_0x1a2d07);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Lr=class extends lr{containerView;constructor(_0x2d3e7f,_0x597d24,_0xf120b9){super(_0x597d24),this['set']('isTrackChangesOn',!0x1),this['containerView']=new xr(_0x2d3e7f,{'showDiff':_0x597d24['showDiff'],'areActionsDisabled':_0x597d24['areActionsDisabled'],'availableActions':_0x597d24['availableActions']},_0xf120b9),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x5d4a15,_0x1ac223)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x1ac223['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',(_0x5906b0,{index:_0x1755c2})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1755c2});}),this['containerView']['on']('applySuggestion',(_0x13f7d2,{index:_0x327644}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x327644});}),this['containerView']['on']('insertSuggestion',(_0x419d6e,{index:_0x51aa8b}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x51aa8b});}),this['containerView']['on']('rejectSuggestion',(_0x5e6735,{index:_0x36cb67})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x36cb67});}),this['containerView']['on']('mouseOverSuggestion',(_0xaaaa91,{index:_0x73271b})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x73271b});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x10c94c,{index:_0x1fa87f})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1fa87f});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x3f3a14){await this['containerView']['updateContent'](_0x3f3a14);}updatePartState(_0xd0d6c,_0x29da45,_0x195bdb){this['containerView']['bodyView']['updatePartState'](_0xd0d6c,_0x29da45,_0x195bdb);}setPartActive(_0x1a6524,_0x489ce7){!0x1===_0x1a6524?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x1a6524,_0x489ce7);}updateSources(_0xd522b7){this['containerView']['updateSources'](_0xd522b7);}getPartView(_0x182c83){return this['containerView']['bodyView']['getPartView'](_0x182c83);}setGating(_0x122bcd){this['containerView']['bodyView']['setGating'](_0x122bcd);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Pr=class extends lr{replyContainer;_bodyCollection;constructor(_0x21377f,_0x397ea9,_0x4f5574){super(_0x397ea9),this['_bodyCollection']=_0x4f5574,this['locale']=_0x21377f,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x3faf4e(),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':Rs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x12b867,renderingStrategy:_0xdb93c6,abortSignal:_0x1e8c87}){'streaming'===_0xdb93c6?await this['streamIntoElement'](_0x12b867,this['replyContainer']['element'],_0x1e8c87):this['replyContainer']['element']['innerHTML']=_0x311e91(_0x12b867);}updateSources(_0x571dc9){const _0x523a83=new kr(this['locale'],this['_bodyCollection']);_0x523a83['children']['addMany'](_0x571dc9['map'](_0x256310=>new yr(this['locale'],_0x256310,_0x523a83['balloonPanelView']))),_0x523a83['isVisible']=!0x0,this['children']['add'](_0x523a83);}},Dr=class extends _0x4c01fe{constructor(_0x2483c3=void 0x0){super();const _0x21f27c=_0x2483c3?'ck-ai-spinner_'+_0x2483c3:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x21f27c]}});}};const Hr={'file':_0x1254ca,'image':_0x57bd7a,'document':_0x2cf678,'web-resource':_0xe2d1f3,'text':_0x1254ca,'selection':tt,'mcp-tool-context':_0x2cf678,'context':_0x2cf678},Mr='ck-ai-chat-context-chip',Ur='ck-ai-chat-context-chip_wide',Vr='ck-ai-chat-context-chip_document',Br='ck-ai-chat-context-chip__label',Gr='ck-ai-chat-context-chip__type-icon',Fr='ck-ai-chat-context-controls__chip-tooltip',Kr='n';var Wr=class extends Mt{constructor(_0x55983b,_0x5bc749,_0x5c3984,_0x1ef731,_0x18b6fd=!0x1){super(_0x55983b),this['_isAnimationOnEnterEnabled']=_0x1ef731,this['_initializeProperties'](_0x5bc749,_0x5c3984,_0x18b6fd),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(_0x3d9d15,_0x13e326,_0x2870d9){this['set']('label',_0x3d9d15['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x3d9d15['type']),this['set']('id',_0x3d9d15['uiId']),this['set']('readonly',_0x13e326),this['set']('isLoading',_0x2870d9);}_setupTemplate(){const _0x1f433f=this['_createIconView'](),_0x484c1e=this['_createRemoveButton'](),_0x4b1606=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4b1606),'children':this['_createTemplateChildren'](_0x1f433f,_0x484c1e,_0x4b1606)});}_createTemplateAttributes(_0x2c4162){return{'class':[Mr,_0x2c4162['if']('itemType',Vr,_0x430cd9=>'document'==_0x430cd9),_0x2c4162['if']('itemType',Ur,_0xb4e282=>'selection'==_0xb4e282)],'data-cke-tooltip-text':_0x2c4162['to']('label',Yr),'data-cke-tooltip-position':Kr,'data-cke-tooltip-class':Fr};}_createTemplateChildren(_0x19d982,_0x4c9b83,_0x328ab3){const _0x51fd73=this['_createLabelElement'](_0x328ab3),_0x59cad6=this['_createLoaderIcon']();return this['readonly']?[_0x19d982,_0x51fd73]:[_0x19d982,_0x59cad6,_0x51fd73,_0x4c9b83];}_createLabelElement(_0x201fcd){return{'tag':'span','attributes':{'class':Br},'children':[{'text':_0x201fcd['to']('label')}]};}_createRemoveButton(){const _0x4a922c=new Mt(this['locale']);return _0x4a922c['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x2f23df}),this['_setupRemoveButtonEvent'](_0x4a922c),_0x4a922c;}_setupRemoveButtonEvent(_0x2c1aba){_0x2c1aba['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x55953b=this['bindTemplate'],_0x5a7223=new $t();return _0x5a7223['content']=Hr[this['itemType']],_0x5a7223['extendTemplate']({'attributes':{'class':[Gr,_0x55953b['if']('isLoading','ck-hidden',_0x1bf832=>_0x1bf832)]}}),_0x5a7223;}_handleAnimationEndOnce(_0x520f98,_0x4cbcab){if(!_0x520f98)return;const _0x4fd30c=()=>{_0x4cbcab(),_0x520f98['removeEventListener']('animationend',_0x4fd30c),_0x520f98['removeEventListener']('webkitAnimationEnd',_0x4fd30c);};_0x520f98['addEventListener']('animationend',_0x4fd30c),_0x520f98['addEventListener']('webkitAnimationEnd',_0x4fd30c);}_createLoaderIcon(){const _0xd3ab40=new Dr('small');return _0xd3ab40['bind']('isVisible')['to'](this,'isLoading',_0x41cd6a=>_0x41cd6a),_0xd3ab40;}};function Yr(_0x2b9aae){if(!_0x2b9aae)return _0x2b9aae;if(_0x2b9aae['length']<=0x78)return _0x2b9aae;const _0x470187=_0x2b9aae['slice'](0x0,0x78),_0x41143d=_0x470187['lastIndexOf']('\x20');return(_0x41143d>0x0?_0x470187['slice'](0x0,_0x41143d):_0x470187)+'…';}const $r={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},qr='300px';var Qr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x111d61,_0x26bab1,_0x249ac1,_0x377641,_0x5461f8){this['_locale']=_0x111d61,this['_visibleChips']=_0x26bab1,this['_config']={...$r,..._0x249ac1,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x249ac1['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x377641,this['_parentView']=_0x5461f8||null;}setContainerElement(_0x144174){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x144174,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 _0x4a0e79=[...this['_visibleChips'],...this['_overflowChips']],_0x3ccf88=this['_createCalculationContainer'](),_0x5a1835=this['_calculateOverflowInContainer'](_0x3ccf88,_0x4a0e79),_0xd9ee37=_0x3ccf88['_ancestorsToRestore'];_0xd9ee37&&this['_restoreAncestorVisibility'](_0xd9ee37),_0x3ccf88['remove'](),this['_applyOverflowResults'](_0x4a0e79,_0x5a1835);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x5ccdd9({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x442cef=new Mt(this['_locale']);_0x442cef['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x1d90ff=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x1d90ff['push'](this['_config']['cssClasses']['controlsButton']),_0x442cef['extendTemplate']({'attributes':{'class':_0x1d90ff}}),_0x442cef;}_createShowMoreBalloonPanelView(){const _0x181d70=new xt(this['_locale']);return _0x181d70['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x181d70),_0x181d70;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x40d793=>{_0x40d793['disableAnimationOnEnter']();});const _0x1bb571=new _0x3faf4e(this['_locale']);_0x1bb571['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x1bb571);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0xd8d25b=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0xd8d25b?'':'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(_0x239eed){const _0xfbe4da=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x24c6f4=this['_containerElement']?.['classList'];if(_0x24c6f4){const _0x3eb71b=_0x24c6f4[0x0]||'',_0x27ae42=_0x239eed['querySelector']('.'+_0x3eb71b),_0x2a09d2=_0x239eed['querySelector'](_0xfbe4da);return _0x27ae42||_0x2a09d2||_0x239eed;}return _0x239eed['querySelector'](_0xfbe4da)||_0x239eed;}_calculateContainerWidth(){const _0x2881a9=this['_parentView']?.['element']||this['_containerElement'];if(!_0x2881a9)return qr;const _0xa5998c=window['getComputedStyle'](_0x2881a9)['width'];if('auto'===_0xa5998c||'0px'===_0xa5998c||!_0xa5998c){const _0x4f6010=_0x2881a9['parentElement'];if(_0x4f6010){const _0x23dde2=window['getComputedStyle'](_0x4f6010);return'auto'!==_0x23dde2['width']?_0x23dde2['width']:qr;}return qr;}return _0xa5998c;}_applyCalculationStyles(_0x4b5ca8,_0x1da5bf){this['_config']['cssClasses']['calculationContainer']&&_0x4b5ca8['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x4b5ca8['style']['width']=_0x1da5bf,_0x4b5ca8['style']['position']='absolute',_0x4b5ca8['style']['top']='-9999px',_0x4b5ca8['style']['left']='-9999px',_0x4b5ca8['style']['opacity']='0',_0x4b5ca8['style']['pointerEvents']='none',_0x4b5ca8['style']['zIndex']='-1',_0x4b5ca8['style']['visibility']='visible\x20!important',_0x4b5ca8['style']['display']='block\x20!important',_0x4b5ca8['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x169ea3){_0x169ea3['forEach'](({element:_0x5ea395,originalDisplay:_0x359694,originalVisibility:_0x40c58e})=>{_0x5ea395['style']['display']=_0x359694,_0x5ea395['style']['visibility']=_0x40c58e;});}_makeAncestorsVisible(_0x249067){const _0x5b4cfe=[];let _0x340fa2=_0x249067;for(;_0x340fa2&&_0x340fa2!==document['body'];){const _0x3ad9a7=window['getComputedStyle'](_0x340fa2);'none'!==_0x3ad9a7['display']&&'hidden'!==_0x3ad9a7['visibility']||(_0x5b4cfe['push']({'element':_0x340fa2,'originalDisplay':_0x340fa2['style']['display'],'originalVisibility':_0x340fa2['style']['visibility']}),_0x340fa2['style']['display']='block',_0x340fa2['style']['visibility']='visible'),_0x340fa2=_0x340fa2['parentElement'];}return _0x5b4cfe;}_createContainerElements(){let _0x470e2b,_0x3e1292;return this['_parentView']?.['element']?(_0x470e2b=this['_parentView']['element']['cloneNode'](!0x0),_0x3e1292=this['_findTargetContainer'](_0x470e2b)):(_0x470e2b=document['createElement']('div'),_0x3e1292=_0x470e2b),{'calculationContainer':_0x470e2b,'targetContainer':_0x3e1292};}_createCalculationContainer(){const {calculationContainer:_0x2875f7,targetContainer:_0x404da5}=this['_createContainerElements'](),_0x411f0a=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x2875f7,_0x411f0a);const _0x1512de=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x1512de?_0x1512de['appendChild'](_0x2875f7):document['body']['appendChild'](_0x2875f7),_0x2875f7['_targetContainer']=_0x404da5;const _0x5a6959=this['_makeAncestorsVisible'](_0x1512de||null);return _0x2875f7['offsetWidth'],_0x2875f7['_ancestorsToRestore']=_0x5a6959,_0x2875f7;}_calculateOverflowInContainer(_0x4ae1aa,_0x5cc04a){const _0xe9a3f0=_0x4ae1aa['_targetContainer']||_0x4ae1aa,_0x2d6b31=[],{rowCount:_0x268f1e}=this['_renderChipsAndCountRows'](_0xe9a3f0,_0x5cc04a);if(_0x268f1e<=this['_config']['maxVisibleRows'])return _0x2d6b31;const _0x2caddd=_0x5cc04a['slice']();for(;_0x2caddd['length']>0x0;){if(this['_testButtonFit'](_0x4ae1aa,_0xe9a3f0,_0x2caddd)){const _0x13edfb=_0x5cc04a['filter'](_0x29636d=>!_0x2caddd['includes'](_0x29636d));_0x2d6b31['push'](..._0x13edfb);break;}if(!_0x2caddd['pop']())break;}return _0x2d6b31;}_renderChipsAndCountRows(_0xb52ede,_0x488baa){_0xb52ede['innerHTML']='',_0x488baa['forEach'](_0x37d029=>{if(_0x37d029['element']){const _0x189e0b=_0x37d029['element']['cloneNode'](!0x0);_0xb52ede['appendChild'](_0x189e0b);}}),_0xb52ede['offsetWidth'];const _0x29a420=_0xb52ede['children'],_0x1a96ef=[];return Array['from'](_0x29a420)['forEach'](_0x40f613=>{const _0x1036cc=_0x40f613['getBoundingClientRect']()['top'];_0x1a96ef['some'](_0x40b59f=>Math['abs'](_0x40b59f-_0x1036cc)<this['_config']['rowDetectionTolerance'])||_0x1a96ef['push'](_0x1036cc);}),{'rowCount':_0x1a96ef['length']};}_createMockButton(){const _0x4c10b9=document['createElement']('button');return _0x4c10b9['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x4c10b9['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x4c10b9['textContent']='+\x201',_0x4c10b9;}_testButtonFit(_0x590a13,_0x57b370,_0xa0b653){this['_renderChipsAndCountRows'](_0x57b370,_0xa0b653);const _0x1cf2d4=this['_createMockButton']();_0x590a13['appendChild'](_0x1cf2d4),_0x590a13['offsetWidth'];const _0x59d329=[..._0x57b370['children'],_0x1cf2d4],_0x556478=[];_0x59d329['forEach'](_0x263935=>{const _0x45520c=_0x263935['getBoundingClientRect']()['top'];_0x556478['some'](_0x509f55=>Math['abs'](_0x509f55-_0x45520c)<this['_config']['rowDetectionTolerance'])||_0x556478['push'](_0x45520c);});const _0x5c2bef=_0x556478['length'];return _0x1cf2d4['remove'](),_0x5c2bef<=this['_config']['maxVisibleRows'];}_distributeChips(_0x47ddeb,_0xb6d335){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x47ddeb['forEach'](_0x176d52=>{_0xb6d335['includes'](_0x176d52)?this['_overflowChips']['add'](_0x176d52):this['_visibleChips']['add'](_0x176d52);});}_updateOverflowUI(_0x4b3c89){if(_0x4b3c89>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x4b3c89>0x0&&this['_showMoreButtonView']){const _0x177961=''+this['_config']['showMoreLabelPrefix']+(_0x4b3c89<0x63?_0x4b3c89:'99');this['_showMoreButtonView']['label']=_0x177961;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x1f356d,_0xa0ec62){this['_distributeChips'](_0x1f356d,_0xa0ec62),this['_updateOverflowUI'](_0xa0ec62['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x408ab5=>{_0x408ab5[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 _0x3d1212=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x3d1212['width']||0x0===_0x3d1212['height'])return!0x1;const _0x5bbbab=window['innerHeight']||document['documentElement']['clientHeight'],_0x5aeb20=window['innerWidth']||document['documentElement']['clientWidth'];return _0x3d1212['bottom']>=-0xc8&&_0x3d1212['top']<=_0x5bbbab+0xc8&&_0x3d1212['right']>=-0xc8&&_0x3d1212['left']<=_0x5aeb20+0xc8;}};const Xr='ck-ai-chat__feed__context-chips',zr='ck-ai-chat-context-chips-wrapper',jr='ck-ai-chat-context-chips-wrapper-balloon',Jr='ck-ai-chat-controls-button',Zr='ck-ai-chat-controls_context_show-more-button',to='ck-ai-chat-context-controls__show-more-balloon-panel';var eo=class extends _0x3faf4e{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x1712eb,_0x19bdcc,_0x24f80e){super(_0x1712eb),this['_bodyCollection']=_0x24f80e,this['_createContextChips'](_0x19bdcc);const _0x17aaca={'cssClasses':{'showMoreButton':Zr+'\x20'+Dn,'showMoreBalloon':to,'overflowContainer':jr,'controlsButton':Jr}};this['_overflowManager']=new Qr(_0x1712eb,this['_contextChips'],_0x17aaca,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Xr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':zr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x46b66c=this['element']['querySelector']('.'+zr);_0x46b66c&&(this['_overflowManager']['setContainerElement'](_0x46b66c),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x552488){for(const _0x2d9a57 of _0x552488){const _0x4d1f32=new Wr(this['locale'],_0x2d9a57,!0x0,!0x1);this['_contextChips']['add'](_0x4d1f32);}}},io=class extends lr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x23d34,_0xecbc07,_0x2a18b6){super(_0xecbc07),this['_locale']=_0x23d34,this['_bodyCollection']=_0x2a18b6,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 eo(this['_locale'],this['options']['contextItems']['filter'](_0x5d43e5=>!_0x5d43e5['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x3faf4e(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']();}},so=class extends lr{capabilities;constructor(_0x26cb18,_0xb835f9){super(_0xb835f9);const {isWebSearchEnabled:_0x38ce86,isReasoningEnabled:_0x5518f9}=_0xb835f9['capabilities'],_0x58dace=[];let _0x373eed='';_0x38ce86&&_0x5518f9?(_0x373eed=Es(_0x26cb18,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x58dace['push'](no(ht)),_0x58dace['push'](no(_0x3ab500))):_0x38ce86?(_0x373eed=Es(_0x26cb18,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x58dace['push'](no(ht))):_0x5518f9&&(_0x373eed=Es(_0x26cb18,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x58dace['push'](no(_0x3ab500))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x373eed?'':'ck-hidden']}});const _0x303b2b=new _0x3faf4e();_0x303b2b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x58dace,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x373eed]}]}),this['children']['add'](_0x303b2b),this['capabilities']=_0xb835f9['capabilities'];}};function no(_0x1ef184){const _0x5df9c4=new $t();return _0x5df9c4['content']=_0x1ef184,_0x5df9c4;}const ro=['wheel','touchstart','pointerdown','keydown'],oo=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var ao=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x360d5f){this['element']=_0x360d5f,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x5904e0 of ro){const _0x3f2af4='keydown'!==_0x5904e0;this['element']['addEventListener'](_0x5904e0,this['_onUserEvent']['bind'](this),{'passive':_0x3f2af4,'signal':this['abortController']['signal']});}}start({smooth:_0xc9c6eb=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xc9c6eb?'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(_0x2ff56a){if(this['isRunning']){if('keydown'===_0x2ff56a['type']){const _0x494231=_0x2ff56a['key'];if(!oo['includes'](_0x494231))return;}_0x2ff56a instanceof WheelEvent?_0x2ff56a['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x286fdd,scrollHeight:_0x576e5b,clientHeight:_0x504340}=this['element'];return _0x576e5b-_0x286fdd-_0x504340<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},ho=class extends lr{constructor(_0x554331){super(_0x554331),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']);}},co=class extends _0x3faf4e{['children'];['scrollManager'];_bodyCollection;constructor(_0x4455e7,_0x28104e){super(_0x4455e7),this['_bodyCollection']=_0x28104e,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...sr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ao(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x1c1a36,_0x12703a){let _0x1937e6;return'ai-reply'===_0x1c1a36?_0x1937e6=new Pr(this['locale'],_0x12703a,this['_bodyCollection']):'ai-suggestion-reply'===_0x1c1a36?(_0x1937e6=new Lr(this['locale'],_0x12703a,this['_bodyCollection']),_0x1937e6['bind']('isTrackChangesOn')['to'](this)):_0x1937e6='user-message'===_0x1c1a36?new io(this['locale'],_0x12703a,this['_bodyCollection']):'interaction-header'===_0x1c1a36?new so(this['locale'],_0x12703a):'custom-element'===_0x1c1a36?new ho(_0x12703a):new Rr(_0x12703a),this['children']['add'](_0x1937e6),_0x1937e6;}async updateReplyItem({id:_0x3ba0e5,parsedContent:_0x18bd28,renderingStrategy:_0x4dfc66,abortSignal:_0x27badf}){const _0x5eaa4c=this['getItemById'](_0x3ba0e5);if(!(_0x5eaa4c instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x5eaa4c,'id':_0x3ba0e5,'parsedContent':_0x18bd28});await _0x5eaa4c['updateContent']({'parsedContent':_0x18bd28,'renderingStrategy':_0x4dfc66,'abortSignal':_0x27badf});}async updateWebSources(_0x5ca65d,_0x331f72){const _0x50ea19=this['getItemById'](_0x5ca65d);if(_0x50ea19 instanceof Lr)_0x50ea19['updateSources'](_0x331f72);else{if(!(_0x50ea19 instanceof Pr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x50ea19,'id':_0x5ca65d,'sources':_0x331f72});_0x50ea19['updateSources'](_0x331f72);}}async updateSuggestionItem({id:_0x8ed12,parts:_0x17ec69,abortSignal:_0x12db97,skipLoadingEffects:_0xc7b079}){const _0x3b2a9b=this['getItemById'](_0x8ed12);if(!(_0x3b2a9b instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x3b2a9b,'id':_0x8ed12,'parts':_0x17ec69});await _0x3b2a9b['updateContent']({'parts':_0x17ec69,'abortSignal':_0x12db97,'skipLoadingEffects':_0xc7b079});}updateSuggestionPartState({id:_0x1382f3,index:_0x5470eb,state:_0xfcd935,outdatedReason:_0x43c90d}){const _0x4ad7f4=this['getItemById'](_0x1382f3);if(!(_0x4ad7f4 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1382f3});_0x4ad7f4['updatePartState'](_0x5470eb,_0xfcd935,_0x43c90d);}updateSuggestionGating(_0x4131d4,_0x5cdcea){const _0x52ebc3=this['getItemById'](_0x4131d4);if(!(_0x52ebc3 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4131d4});_0x52ebc3['setGating'](_0x5cdcea);}setSuggestionPartActive({id:_0x25a6c8,index:_0x201dac,isActive:_0x1fdd74}){const _0x42a367=this['getItemById'](_0x25a6c8);if(!(_0x42a367 instanceof Lr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x25a6c8});this['children']['filter'](_0x38351f=>_0x38351f instanceof Lr)['forEach'](_0x3fb138=>{_0x3fb138['setPartActive'](!0x1);}),_0x42a367['setPartActive'](_0x201dac,_0x1fdd74);}markItemAsDone(_0xea9577){this['getItemById'](_0xea9577)['markAsDone']();}getItemIds(){return this['children']['map'](_0x4503c0=>_0x4503c0['options']['id']);}removeItem(_0x116c2c){this['children']['remove'](this['getItemById'](_0x116c2c));}hasItem(_0x537167){return!!this['children']['find'](_0x2858e5=>_0x2858e5['options']['id']['includes'](_0x537167));}scrollToSuggestion(_0x13d575,_0x58610b){const _0x159f80=this['getItemById'](_0x13d575);if(!(_0x159f80 instanceof Lr))return void St('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x13d575,'partIndex':_0x58610b});const _0x42e990=_0x159f80['getPartView'](_0x58610b);_0x42e990?Rt(_0x42e990['element'],0x14,this['element']['parentElement'],!0x0,!0x0):St('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x13d575,'partIndex':_0x58610b});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x45c1ad=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x45c1ad,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x5a34c3=new wr(this['locale'],Cr['aiFeed']);return _0x5a34c3['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x5a34c3;}_createFeedItems(){const _0x324b0d=new _0x3faf4e(this['locale']);return _0x324b0d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x324b0d;}_createFeedLoader(){const _0x1748fa=new _0x3faf4e(this['locale']);return _0x1748fa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x2bbdc4=>!_0x2bbdc4)]},'children':this['_createLoaderChildren']()}),_0x1748fa;}_createLoaderChildren(){const _0x322d1d=new Dr();return _0x322d1d['isVisible']=!0x0,[_0x322d1d,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0xae0477){const _0x2699d3=this['children']['find'](_0xb82849=>_0xb82849['options']['id']['includes'](_0xae0477));if(!_0x2699d3)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0xae0477});return _0x2699d3;}setLoadingMessage(_0x4f49ef){this['set']('loadingMessage',_0x4f49ef);}toggleLoadingSkeleton(_0x491141){this['set']('isLoadingSkeletonVisible',_0x491141);}startAutoScroll(_0x5d2371={}){this['scrollManager']['start'](_0x5d2371);}stopAutoScroll(){this['scrollManager']['stop']();}},lo=class extends Jt{filter(){let _0x477df0=0x0;for(const _0x22637d of this['items'])_0x477df0+=_0x22637d['items']['length'];return{'resultsCount':_0x477df0,'totalItemsCount':_0x477df0};}};function uo(_0x7bedbb){const _0x2b8550=[];let _0x2cb055=!0x1;for(const _0x162ae3 of Array['from'](_0x7bedbb['items'])){if('file'!==_0x162ae3['kind'])continue;if(_0x162ae3['webkitGetAsEntry']()?.['isDirectory']){_0x2cb055=!0x0;continue;}const _0x10e9b2=_0x162ae3['getAsFile']();_0x10e9b2&&_0x2b8550['push'](_0x10e9b2);}return{'files':_0x2b8550,'hasDirectory':_0x2cb055};}const _o='ck-ai-chat__prompt-input_highlighted';var go=class AIChatPromptInputView extends Nt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x322bcc,_0x48628c){super(_0x322bcc,{'queryView':{'label':'','creator':_0x5085d5,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new lo(_0x322bcc),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x48628c,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',(_0x624b20,_0x139606)=>!_0x624b20&&!_0x139606),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x4ff4e0,_0x2f19ca)=>{this['isUploadInProgress']||this['isEmpty']||_0x4ff4e0['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2f19ca());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x1dfe46=>this['_handlePaste'](_0x1dfe46)),this['element']['addEventListener']('drop',_0x1e537c=>this['_handleDrop'](_0x1e537c));}_handlePaste(_0x4aa6f2){const _0x5c36b2=_0x4aa6f2['clipboardData'];if(!_0x5c36b2)return;const {files:_0x3f0bc0,hasDirectory:_0x53b49e}=uo(_0x5c36b2),_0x448350={'files':_0x3f0bc0,'plainText':_0x5c36b2['getData']('text/plain'),'hasDirectory':_0x53b49e,'forceTextAttachment':!0x1,'preventDefault':()=>_0x4aa6f2['preventDefault']()};this['fire']('promptInputPaste',_0x448350);}['_handleDrop'](_0x3a88b3){const _0x56fdb8=_0x3a88b3['dataTransfer'];if(!_0x56fdb8)return;const _0x4413ad={'files':[],'plainText':_0x56fdb8['getData']('text/uri-list')||_0x56fdb8['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x3a88b3['preventDefault']()};this['fire']('promptInputPaste',_0x4413ad);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0xf2ba72=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0xf2ba72)return this['queryView']['errorText']=Es(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x5087d3=_0x1bdee6(_0xf2ba72);this['fire']('sendUserMessage',_0x5087d3),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x1ee8e5){this['queryView']['fieldView']['set']('placeholder',_0x1ee8e5);}['focus'](_0xff6957=!0x1){super['focus'](),_0xff6957&&(this['element']['classList']['contains'](_o)||(this['element']['classList']['add'](_o),setTimeout(()=>{this['element']['classList']['remove'](_o);},0x320)));}_createSubmitButton(){const _0x5cf9fe=new Mt(this['locale']);return _0x5cf9fe['set']({'icon':nt,'label':Es(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ln,'isEnabled':!0x1}),_0x5cf9fe['on']('execute',()=>{this['submit']();}),_0x5cf9fe;}setIsUploadInProgress(_0x269178){this['isUploadInProgress']=_0x269178;}_setUpAddContextButtonPositioning(){const _0x388248=this['locale'],_0x37918b=()=>{wt['window']['requestAnimationFrame'](()=>{if(ft(this['element'])){const _0x356cf5=new It(this['queryView']['fieldView']['element']),_0x34d9b2=new It(this['_addContextButtonView']['element']),_0x4e2908=_0x356cf5['width'],_0x4328d6='rtl'===_0x388248['uiLanguageDirection']?'right':'left';_0x356cf5['excludeScrollbarsAndBorders']();const _0x593c47=_0x4e2908-_0x356cf5['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4328d6]='calc('+(_0x4e2908-_0x34d9b2['width']-_0x593c47)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x37918b),this['on']('render',()=>{_0x37918b(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x37918b();});});}},Ao=class extends _0x3faf4e{constructor(_0x2d6be2){super(_0x2d6be2),this['set']('isEnabled',!0x0);const _0x23b80c=new $t();_0x23b80c['content']=_0x1254ca,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x23b80c,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Es(_0x2d6be2,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x88a93f){let _0x4e8843=0x0;const _0x4f6489=()=>{_0x88a93f['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x4e8843>0x0);};this['on']('change:isEnabled',(_0x9a9530,_0x4dcff5,_0x186faf)=>{_0x186faf&&_0x4e8843>0x0&&this['fire']('dragEnter'),_0x4f6489();}),_0x88a93f['addEventListener']('dragenter',_0x229ff8=>{_0x229ff8['dataTransfer']&&(_0x4e8843++,0x1===_0x4e8843&&this['isEnabled']&&this['fire']('dragEnter'),_0x4f6489());}),_0x88a93f['addEventListener']('dragover',_0x563ab0=>{_0x563ab0['dataTransfer']&&_0x563ab0['preventDefault']();}),_0x88a93f['addEventListener']('dragleave',()=>{--_0x4e8843<0x0&&(_0x4e8843=0x0),_0x4f6489();}),_0x88a93f['addEventListener']('drop',_0x2f113d=>{_0x2f113d['preventDefault'](),_0x4e8843=0x0,_0x4f6489(),this['isEnabled']&&this['_handleDrop'](_0x2f113d);});}['_handleDrop'](_0x418be9){const _0x13760f=_0x418be9['dataTransfer'];if(!_0x13760f)return;const {files:_0x3ab7d0,hasDirectory:_0x3cbbe2}=uo(_0x13760f),_0x2fe188={'files':_0x3ab7d0,'plainText':_0x13760f['getData']('text/uri-list')||_0x13760f['getData']('text/plain'),'hasDirectory':_0x3cbbe2,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x2fe188);}},Io=class extends _0x3faf4e{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x11fd5b,_0x433fc8){super(_0x11fd5b),this['_config']=_0x433fc8,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x143f7a(this['dropdownView'],this['_items']),this['nameView']=new po(_0x11fd5b,_0x433fc8['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x31cdbe=>_0x31cdbe??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1a7b67=>'name'===_0x1a7b67),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x55c49a,_0x179456){var _0x5d19f6;this['set']('modelDisplayMode',(_0x5d19f6=_0x55c49a['length'],_0x179456?0x1===_0x5d19f6?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x55c49a['length']&&this['set']('activeModelName',_0x55c49a[0x0]['name']||_0x55c49a[0x0]['id']);for(const _0x89bce1 of _0x55c49a){const _0x46e655=new _0x30d699({'label':_0x89bce1['name'],'withText':!0x0,'role':'menuitemradio','id':_0x89bce1['id'],'model':_0x89bce1});_0x46e655['bind']('isOn')['to'](this,'activeModelId',_0x1e8545=>_0x1e8545===_0x89bce1['id']),this['_items']['add']({'type':'button','model':_0x46e655,'labelView':new Eo(this['locale'],_0x89bce1,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?mo(this['locale'],_0x89bce1):void 0x0})});}}setSelectedModel(_0x25d33c){this['set']('activeModelId',_0x25d33c?_0x25d33c['id']:null),this['set']('activeModelName',_0x25d33c?_0x25d33c['name']||_0x25d33c['id']:null);}_createDropdown(){const _0x247961=_0x48d908(this['locale']);return _0x247961['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x247961['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Dn}),_0x247961['buttonView']['bind']('label')['to'](this,'activeModelName',_0x182daf=>_0x182daf??this['_config']['defaultLabel']??''),_0x247961['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x2ad2e5,_0x5ceb5d)=>!_0x5ceb5d&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x2ad2e5??this['_config']['defaultLabel']??''),_0x247961['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x383592=>'selector'===_0x383592),_0x247961['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x247961,'execute',_0x3a2eda=>{this['fire']('selectModel',_0x3a2eda['source']['model']);}),_0x247961;}},po=class extends _0x3faf4e{constructor(_0x1e59a3,_0x514f58){super(_0x1e59a3),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x580cc3=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x514f58,_0x580cc3['if']('isVisible','ck-hidden',_0x1edc3d=>!_0x1edc3d)]},'children':[{'text':_0x580cc3['to']('text')}]});}},Eo=class extends Dt{constructor(_0x4b14aa,_0x1c9da0,_0x2ec897){super();const _0x49bf65=this['bindTemplate'],_0x31015b=[{'tag':'div','attributes':{'class':[_0x2ec897['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x49bf65['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x2ec897['descriptionClass']]},'children':[{'tag':'span','children':[_0x1c9da0['description']||'']}]}];_0x2ec897['extraContent']?.['length']&&_0x2ec897['capabilitiesClass']&&_0x31015b['push']({'tag':'div','attributes':{'class':[_0x2ec897['capabilitiesClass']]},'children':_0x2ec897['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x49bf65['to']('style'),'id':_0x49bf65['to']('id')},'children':_0x31015b});}};function mo(_0x200708,_0x3fae14){return[...To(_0x200708,ht,'AI_CHAT_SEARCH_WEB',_0x3fae14['capabilities']['webSearch']?.['enabled']??!0x1),...To(_0x200708,_0x3ab500,'AI_CHAT_REASONING',_0x3fae14['capabilities']['reasoning']?.['enabled']??!0x1)];}function To(_0x44a982,_0x2c529e,_0x4cd0cc,_0x526b4b){const _0x5920bb=new $t();_0x5920bb['content']=_0x2c529e;const _0x3dba89=new _0x3faf4e(_0x44a982);_0x3dba89['setTemplate']({'tag':'span','children':[{'text':Es(_0x44a982,_0x4cd0cc)+':\x20'}]});const _0x345e31=new _0x3faf4e(_0x44a982);return _0x345e31['setTemplate']({'tag':'span','children':[{'text':Es(_0x44a982,_0x526b4b?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x5920bb,_0x3dba89,_0x345e31];}const wo='ck-ai-chat__prompt-capabilities',Co='ck-ai-chat-controls-button',fo='ck-ai-chat-controls-button--commands',bo='ck-ai-chat-controls__model-selection',So='ck-ai-chat-controls__model-selection__item-name',Ro='ck-ai-chat-controls__model-selection__item-description',Oo='ck-ai-chat-controls__model-selection__item-capabilities',vo='n';var ko=class extends _0x3faf4e{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0xaf1c11){super(_0xaf1c11),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x5e35e5){return new Io(_0x5e35e5,{'panelPosition':'ne','dropdownClass':[bo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':So,'description':Ro,'capabilities':Oo},'defaultLabel':Es(_0x5e35e5,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Es(_0x5e35e5,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':vo,'showCapabilities':!0x0});}(_0xaf1c11),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x170b78=>_0x170b78),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x3b4fe8=>_0x3b4fe8),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0xfe08f2=>Es(this['locale'],_0xfe08f2?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0xaf3401=>_0xaf3401),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x5e5729=>Es(this['locale'],_0x5e5729?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[wo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x31c3be){this['set']('webSearchActive',_0x31c3be);}setReasoning(_0x12d47c){this['set']('reasoningActive',_0x12d47c);}setModelList(_0x210f13,_0x3631e5){this['_modelSelector']['setModels'](_0x210f13,!_0x3631e5);}setModel(_0x2e96b9){if(!_0x2e96b9)return;this['_modelSelector']['setSelectedModel'](_0x2e96b9);const _0x4bb34c=_0x2e96b9['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x4bb34c),this['_webSearchButton']['set']('isVisible',_0x4bb34c);const _0x3465be=_0x2e96b9['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3465be),this['_reasoningButton']['set']('isVisible',_0x3465be);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x5c2fe1){this['set']('modelSelectorEnabled',!0x1),_0x5c2fe1&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x3b9596=new Mt();return _0x3b9596['set']({'label':Es(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x3b9596['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x3b9596;}_createReasoningButton(){const _0x4b297e=new Mt();return _0x4b297e['set']({'label':Es(this['locale'],'AI_CHAT_REASONING'),'icon':_0x3ab500,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltipPosition':vo}),_0x4b297e['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x4b297e;}_createCommandsButton(){const _0x3f9202=new Mt();return _0x3f9202['set']({'label':Es(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x2985d1,'withText':!0x0,'class':Co+'\x20'+Dn,'isToggleable':!0x0,'tooltip':Es(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':vo}),_0x3f9202['extendTemplate']({'attributes':{'class':[fo]}}),_0x3f9202['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x3f9202;}};const yo='ck-ai-chat-context-controls__url-form',No='ck-ai-chat-context-controls__url-input-section';var xo=class extends _0x3faf4e{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x5f3fa){super(_0x5f3fa),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 Ft({'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'](_0x712b1b=>{this['focusTracker']['add'](_0x712b1b['element']),this['keystrokes']['listenTo'](_0x712b1b['element']);}),_0x42d489({'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(_0x56336a){this['urlInputField']['errorText']=_0x56336a,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x49435b=new Mt(this['locale']);return _0x49435b['set']({'icon':_0x44f029,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x1bbd88,_0x4759c5,_0x31e6c8)=>{_0x49435b['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x31e6c8?'':'\x20ck-hidden')]});}),_0x49435b;}_createUrlInputField(){const _0x4c7af9=new Qt(this['locale'],_0x5c944f);return _0x4c7af9['set']({'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x4c7af9['fieldView']['set']({'placeholder':Es(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x4c7af9;}_createConfirmButton(){const _0x3087ba=new Mt(this['locale']);return _0x3087ba['set']({'icon':_0x884ad8,'tooltip':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x3087ba;}_setupTemplate(){const _0x4c7e19=new Kt(this['locale'],{'label':Es(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x4c7e19['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':yo,'tabindex':'-1'},'children':[_0x4c7e19,{'tag':'div','attributes':{'class':No},'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',_0x457033=>{_0x457033['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x8a5d8d,_0x57ebb3)=>{this['clear'](),this['fire']('cancel'),_0x57ebb3();});}_handleSubmit(){const _0x56564a=this['getValue']()['trim']();_0x56564a?this['_isValidUrl'](_0x56564a)?(this['clearError'](),this['fire']('submitUrl',_0x56564a)):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Es(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x373985=this['getValue']()['trim'](),_0x35b252=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x373985['length']>0x0&&!_0x35b252;}['_isValidUrl'](_0x43ac5c){try{return!!new URL(_0x43ac5c);}catch{return!0x1;}}};const Lo='ck-ai-chat-resources__item',Po='ck-ai-chat-resources__item--in-context',Do='ck-ai-chat-resources__item-title',Ho='ck-ai-chat-resources__item__icon';var Mo=class extends jt{['resource'];_titleView;['_iconView'];constructor(_0x5c8cfa,_0x51acac){super(_0x5c8cfa),this['resource']=_0x51acac,this['set']('isInContext',!!_0x51acac['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x373f8b){if(_0x373f8b['isInContext'])return _0x884ad8;switch(_0x373f8b['type']){case'document':return _0x2cf678;case'web-resource':return _0xe2d1f3;case'file':case'text':return _0x1254ca;default:return _0x551773;}}highlightText(_0x43bbf8){if(!_0x43bbf8||''===_0x43bbf8['trim']())return void this['_titleView']['highlightText'](null);const _0x439dff=new RegExp(_0x5f86da(_0x43bbf8),'gi');this['_titleView']['highlightText'](_0x439dff);}updateResourceState(_0x209bd9){this['resource']['isInContext']=_0x209bd9,this['isInContext']=_0x209bd9,this['_updateIcon']();}_createTitleView(){const _0x5c1b67=new Yt();return _0x5c1b67['text']=this['resource']['label'],_0x5c1b67['extendTemplate']({'tag':'span','attributes':{'class':[Do]}}),_0x5c1b67;}_createIconView(){const _0x2ef4eb=new $t();return _0x2ef4eb['content']=this['getResourceIcon'](this['resource']),_0x2ef4eb;}_setupTemplate(){const _0x6cf8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Lo,_0x6cf8['if']('isVisible','ck-hidden',_0x189f9f=>!_0x189f9f),_0x6cf8['if']('isInContext',Po)]},'children':[{'tag':'div','attributes':{'class':[Ho]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x6cf8['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Uo='ck-ai-chat-resources__list';var Vo=class extends Jt{['_source'];constructor(_0x373256,_0x473da8){super(_0x373256),this['_source']=_0x473da8,this['extendTemplate']({'attributes':{'class':[Uo]}});}setResources(_0x553716,_0x1336fa){this['items']['clear']();let _0x39b0f9=_0x553716;if(this['_source']['useDefaultFiltering']&&_0x1336fa&&''!==_0x1336fa['trim']()){const _0x5a59af=new RegExp(_0x1336fa['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x39b0f9=_0x553716['filter'](_0x2c5c4a=>_0x5a59af['test'](_0x2c5c4a['label']));}for(const _0x226795 of _0x39b0f9){const _0x223c4e=new Mo(this['locale'],_0x226795);_0x223c4e['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x226795);}),this['items']['add'](_0x223c4e);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x1336fa);}highlightText(_0x76a223){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x4be1c9=>{_0x4be1c9['highlightText'](_0x76a223);});}updateResourceState(_0x240b38,_0x1de459){for(const _0x350132 of this['items']){const _0x669954=_0x350132;_0x669954['resource']['id']===_0x240b38&&_0x669954['updateResourceState'](_0x1de459);}}_handleResourceSelection(_0x30ac7c,_0x1a6008){this['fire']('addResourceToContext',{'source':_0x30ac7c,'resource':_0x1a6008});}},Bo=class extends Qt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x274199){const t=_0x274199['t'],_0x10745a={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x5c944f,'label':Es(_0x274199,'AI_CHAT_SEARCH_RESOURCES')};super(_0x274199,_0x10745a['creator']),this['label']=_0x10745a['label'],this['_viewConfig']=_0x10745a,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x274199,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x170990){this['fire']('search',_0x170990);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new $t(),this['iconView']['content']=_0x2d30f0,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x316cde,t){this['resetButtonView']=new Mt(_0x316cde),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x2f23df,'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',_0x4a9951=>!_0x4a9951),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);}},Go=class extends _0x3faf4e{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x536239,_0x428e2d){super(_0x536239),this['_source']=_0x428e2d['source'],this['_searchInputVisibleFrom']=_0x428e2d['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 _0x5b3174([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Bo(this['locale']);}_createSearchSection(){const _0x8ef510=new _0x3faf4e(this['locale']);return _0x8ef510['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x46552a,_0x20560d)=>{this['loadResources'](_0x20560d),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x20560d);}),_0x8ef510;}_createResourcesListView(){const _0x596077=new Vo(this['locale'],this['_source']);return _0x596077['delegate']('addResourceToContext')['to'](this),_0x596077['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x596077;}_createSkeletonView(){const _0xac21fa=new wr(this['locale'],Cr['aiChatResources']);return _0xac21fa['bind']('isVisible')['to'](this,'isLoading'),_0xac21fa;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x3da24a){const _0xa5a946=kt();this['_latestLoadResourcesUid']=_0xa5a946,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x3da24a,'uid':_0xa5a946}),this['isLoading']=!0x0;}setResources(_0x39a7aa,_0x4a080c){if(_0x4a080c&&_0x4a080c!==this['_latestLoadResourcesUid'])return;const _0x2d0622=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x39a7aa,_0x2d0622),_0x39a7aa['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x556632,_0x3bd3e5){this['_resourcesListView']['updateResourceState'](_0x556632,_0x3bd3e5);}};const Fo='ck-ai-chat-context-controls__source-balloon-panel',Ko='ck-button-icon\x20ck-button-back',Wo='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Yo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0x5a986b,_0x3efb4b,_0x1a7f3b){this['_locale']=_0x5a986b,this['_bodyCollection']=_0x3efb4b,this['_config']=_0x1a7f3b;}['showSourceResourcesBalloon']({source:_0x785a55,withBackButton:_0x2251ab}){let _0x1e805b=this['_sourceResourceBalloons']['get'](_0x785a55['id']);_0x1e805b||(_0x1e805b=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x785a55['id'],_0x1e805b),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x1e805b)),this['_addSourceResourceContent']({'balloonPanel':_0x1e805b,'source':_0x785a55,'withBackButton':_0x2251ab}),_0x1e805b['show']();const _0x413564=this['_config']['getTargetElement']();_0x413564&&_0x1e805b['pin']({'target':_0x413564,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x33e914,_0x160eaa,_0x2d62d3){const _0x2da2e5=this['_sourceResourceBalloons']['get'](_0x33e914);if(!_0x2da2e5)return;const _0x5d8b28=this['_getResourcesViewFromBalloon'](_0x2da2e5);_0x5d8b28&&(_0x5d8b28['setResources'](_0x160eaa,_0x2d62d3),_0x5d8b28['once']('change:isLoading',()=>{_0x2da2e5['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x43d972){const _0x1377da=this['_sourceResourceBalloons']['get'](_0x43d972);_0x1377da&&requestAnimationFrame(()=>{_0x1377da['hide'](),this['_sourceResourceBalloons']['delete'](_0x43d972),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x380b11 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x380b11);}['isAnyResourceBalloonVisible'](){for(const _0x38ff89 of this['_sourceResourceBalloons']['values']())if(_0x38ff89['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x59e117,_0x24d15c,_0x2eed7b){const _0x2c8faf=this['_sourceResourceBalloons']['get'](_0x59e117);if(!_0x2c8faf||!_0x2c8faf['isVisible'])return;const _0x7db978=this['_config']['getTargetElement']();if(!_0x7db978)return;_0x2c8faf['pin']({'target':_0x7db978,'limiter':this['_config']['getLimiterElement']()});const _0x53abb6=this['_getResourcesViewFromBalloon'](_0x2c8faf);_0x53abb6&&_0x53abb6['updateResourceState'](_0x24d15c,_0x2eed7b);}destroy(){for(const _0x51629c of this['_sourceResourceBalloons']['values']())_0x51629c['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x2af612=new xt(this['_locale']);return _0x2af612['extendTemplate']({'attributes':{'class':Fo}}),this['_bodyCollection']['add'](_0x2af612),_0x2af612;}_addSourceResourceContent({balloonPanel:_0x41da71,source:_0x5d12ce,withBackButton:_0x19191e}){_0x41da71['content']['clear']();const _0x255cdf=this['_createBalloonHeader']({'balloonPanel':_0x41da71,'source':_0x5d12ce,'withBackButton':_0x19191e});_0x41da71['content']['add'](_0x255cdf);const _0x2b144e=this['_createBalloonResourcesView'](_0x5d12ce);_0x41da71['content']['add'](_0x2b144e);}_createBalloonHeader({balloonPanel:_0x1474b2,source:_0x3202c8,withBackButton:_0x566dd1}){const _0x4f241d=new Kt(this['_locale'],{'label':_0x3202c8['label'],'class':Wo});return _0x566dd1&&_0x4f241d['children']['add'](this['_createBackButton'](_0x1474b2),0x0),_0x4f241d;}_createBackButton(_0x2c8601){const _0x314d4f=new Mt(this['_locale']);return _0x314d4f['set']({'icon':_0x44f029,'tooltip':Es(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ko}),_0x314d4f['on']('execute',()=>{_0x2c8601['hide'](),this['_config']['onBackToContext']();}),_0x314d4f;}_createBalloonResourcesView(_0x2d05e6){const _0x2bcdf6=new Go(this['_locale'],{'source':_0x2d05e6,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x2bcdf6['on']('loadSourceResources',(_0x677587,_0xc939dc)=>{this['_config']['onLoadSourceResources'](_0xc939dc);}),_0x2bcdf6['on']('addResourceToContext',(_0x2a38b8,_0x17eaab)=>{this['_config']['onResourceSelected'](_0x17eaab['source'],_0x17eaab['resource']),this['closeSourceResourceBalloon'](_0x2d05e6['id']);}),_0x2bcdf6;}_getResourcesViewFromBalloon(_0x10450a){const _0x14893d=_0x10450a['content']['get'](0x1);return _0x14893d instanceof Go?_0x14893d:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x338f9f){_0x5ccdd9({'emitter':_0x338f9f,'contextElements':[_0x338f9f['element']],'callback':()=>{_0x338f9f['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x338f9f['isVisible']});}};const $o=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],qo='ck-ai-chat-context-controls',Qo='ck-ai-chat-context-controls__pending-contexts',Xo='ck-ai-chat-context-controls__add-context-balloon-panel',zo='ck-ai-chat-context-controls__add-context-button',jo='ck-ai-chat-context-controls__url-balloon-panel',Jo='ck-ai-chat-context-controls__balloon-button',Zo='ck-ai-chat-context-controls__balloon-button-source',ta='ck-ai-chat-controls-button',ea='ck-ai-chat-context-chips-wrapper-balloon',ia='ck-ai-chat-controls_context_show-more-button',sa='ck-ai-chat-context-controls__show-more-balloon-panel',na='ck-ai-chat',ra=[xt['defaultPositions']['northArrowSouthWest'],xt['defaultPositions']['northArrowSouth'],xt['defaultPositions']['northArrowSouthEast'],xt['defaultPositions']['southArrowNorthWest'],xt['defaultPositions']['southArrowNorth'],xt['defaultPositions']['southArrowNorthEast']];var oa=class extends _0x3faf4e{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x364d44,_0x32b5c8){super(_0x364d44),this['bodyCollection']=_0x32b5c8['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x364d44),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x364d44),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x364d44),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x364d44,_0x32b5c8);const _0x2fbf48={'cssClasses':{'showMoreButton':ia+'\x20'+Dn,'showMoreBalloon':sa,'overflowContainer':ea,'controlsButton':ta}};this['_overflowManager']=new Qr(_0x364d44,this['_currentContextsChips'],_0x2fbf48,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(_0x3908b3,_0x4d8060){const _0x6060d3=this['_createContextButton'](_0x3908b3,'current',!0x0,_0x4d8060);this['_addContextToCollection'](_0x6060d3,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x4759e3){this['_removeContextFromCollection'](_0x4759e3,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x4759e3,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x144fb3,_0x3e2d2b){let _0x129a26=this['_currentContextsChips']['find'](_0x33d9e3=>_0x33d9e3['id']===_0x144fb3);_0x129a26||(_0x129a26=this['_overflowManager']['overflowChips']['find'](_0x39b102=>_0x39b102['id']===_0x144fb3)),_0x129a26&&(_0x129a26['isLoading']=_0x3e2d2b);}setConversationContext(_0x2519e1){this['_conversationContextsChips']['clear']();for(const _0x1d6e25 of _0x2519e1){const _0x300fa2=this['_createContextButton'](_0x1d6e25,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x300fa2,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x1fc168,_0x5805bb,_0x2c37e0){this['_resourcesBalloonView']['updateResourceState'](_0x1fc168,_0x5805bb,_0x2c37e0);}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:_0x24e9b1,withBackButton:_0x4a2515}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x24e9b1,'withBackButton':_0x4a2515}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x4edd91,_0x36da71,_0x1840a3,_0x8b1413){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x4edd91,_0x1840a3,_0x8b1413);}['closeSourceResourceBalloon'](_0x254a52){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x254a52),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x5f2bb3){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x5f2bb3),this['_setAddContextButtonEnabled'](_0x5f2bb3);}_setAddContextButtonEnabled(_0x11dc51){const _0xa9854c=!_0x11dc51['document']['isHidden']&&_0x11dc51['document']['enabled'],_0x18b16d=_0x11dc51['urls']['enabled'],_0x255af5=_0x11dc51['files']['enabled'],_0x23d69e=_0x11dc51['sources']['length']>0x0,_0x54ea92=_0x11dc51['customItems']&&_0x11dc51['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0xa9854c||_0x18b16d||_0x255af5||_0x23d69e||_0x54ea92;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[qo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Qo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x56d200){const _0x27cec5=new Mt(_0x56d200);return _0x27cec5['set']({'label':Es(_0x56d200,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ta+'\x20'+zo+'\x20'+Dn,'icon':_0x3298fd,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x27cec5;}_createAddContextBalloonPanelView(_0x120555){return this['_createBaseBalloonPanel'](_0x120555,Xo);}_createUrlBalloonPanelView(_0x568149){const _0xaef8d9=this['_createBaseBalloonPanel'](_0x568149,jo);return this['_addUrlContent'](_0xaef8d9,_0x568149),_0xaef8d9;}_createResourcesBalloonView(_0x1d3e69,_0x48f2ce){const _0x1ffbfc={'searchInputVisibleFrom':_0x48f2ce['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});},'onResourceSelected':(_0x45f073,_0x1ea301)=>{this['fire']('addResourceToContext',{'source':_0x45f073,'resource':_0x1ea301});},'onLoadSourceResources':_0x4dab3c=>{this['fire']('loadSourceResources',_0x4dab3c);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Yo(_0x1d3e69,_0x48f2ce['bodyCollection'],_0x1ffbfc);}_getLimiterElement(){return this['element']?.['closest']('.'+na)||document['body'];}_createBaseBalloonPanel(_0x3a0cce,_0x5c5b4a){const _0x4e826e=new xt(_0x3a0cce);return _0x4e826e['extendTemplate']({'attributes':{'class':_0x5c5b4a}}),this['bodyCollection']['add'](_0x4e826e),_0x4e826e;}_setBalloonPanelContent(_0x49a2f6,_0x37598f,_0x755470){if(_0x49a2f6['content']['clear'](),!_0x755470['document']['isHidden']&&_0x755470['document']['enabled']){const _0x5db880=this['_createBalloonButton'](_0x37598f,{'label':Es(_0x37598f,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x2cf678});_0x5db880['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x49a2f6['content']['add'](_0x5db880);}if(_0x755470['urls']['enabled']){const _0x256d69=this['_createBalloonButton'](_0x37598f,{'label':Es(_0x37598f,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0xe2d1f3});_0x256d69['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_urlInputView']['focus']();}),_0x49a2f6['content']['add'](_0x256d69);}if(_0x755470['files']['enabled']){const _0x769da1=new Gt(_0x37598f);_0x769da1['set']({'label':Es(_0x37598f,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0xbc7c6b,'withText':!0x0,'tooltip':!0x0,'class':Jo,'allowMultipleFiles':!0x0}),_0x769da1['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x769da1['on']('done',(_0x32366b,_0xf42db9)=>{this['fire']('addFileToContext',_0xf42db9);}),_0x769da1['tooltip']=!0x0,_0x49a2f6['content']['add'](_0x769da1);}for(const _0x5468da of _0x755470['sources']){const _0x2662f4=this['_createBalloonButton'](_0x37598f,{'label':_0x5468da['label'],'icon':_0x5468da['icon']||_0x551773,'type':'source'});_0x49a2f6['content']['add'](_0x2662f4),_0x2662f4['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x5468da,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x35c63d of _0x755470['customItems']||[]){const _0x72bdad=this['_createBalloonButton'](_0x37598f,{'label':_0x35c63d['label'],'icon':_0x35c63d['icon']||_0x551773,'type':'customItem'});_0x49a2f6['content']['add'](_0x72bdad),_0x72bdad['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x35c63d);});}this['_hasExactlyOneSource']=0x1===_0x49a2f6['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x196c99,_0x357bec){this['_urlInputView']=new xo(_0x357bec),this['_urlInputView']['on']('submitUrl',(_0x281abf,_0x3d9279)=>{this['_handleUrlSubmit'](_0x3d9279);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra});}),_0x196c99['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x36867d,_0x5f409b){const _0x46cb84='source'===_0x5f409b['type']?new aa(_0x36867d):new Mt(_0x36867d);return _0x46cb84['set']({'label':_0x5f409b['label'],'icon':_0x5f409b['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Jo}),_0x46cb84;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x5ccdd9({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x128b9a){const _0x187d44=this['_addContextBalloonConfig'];_0x187d44['buttonView']['isOn']=_0x128b9a,_0x128b9a?_0x187d44['balloonView']['show']():_0x187d44['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0xf31238,buttonView:_0x263b5f,hideMethod:_0x582aac}=this['_addContextBalloonConfig'];_0x5ccdd9({'emitter':_0xf31238,'contextElements':[_0xf31238['element'],_0x263b5f['element']],'callback':()=>{_0x582aac();},'activator':()=>_0x263b5f['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x215abc,_0x11a623,_0xb2d073=!0x1,_0x41c493=!0x1){const _0x4ce7f5='conversation'===_0x11a623||!0x0===_0x215abc['isReadOnly'],_0x48f950=new Wr(this['locale'],_0x215abc,_0x4ce7f5,_0xb2d073,_0x41c493);return _0x4ce7f5||_0x48f950['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x48f950['id']);}),_0x48f950;}_addContextToCollection(_0x32f52a,_0xdf84ba){_0xdf84ba['add'](_0x32f52a,0x0);}_removeContextFromCollection(_0x3dadb2,_0x47a4ba){const _0x269ec0=_0x47a4ba['find'](_0x3fe764=>_0x3fe764['id']===_0x3dadb2);_0x269ec0&&_0x47a4ba['remove'](_0x269ec0);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ra}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x13cf04){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x13cf04);}},aa=class extends Mt{['arrowView'];constructor(_0x3ea2ee){super(_0x3ea2ee),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Zo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x44610b=new $t();return _0x44610b['content']=_0x1da0ec,_0x44610b['extendTemplate']({'attributes':{'class':Zo+'__arrow'}}),_0x44610b;}},ha=class extends _0x3faf4e{_cancelButtonView;['_loaderView'];constructor(_0x4b5886){super(_0x4b5886),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 _0x8f1022=new Mt(this['locale']);return _0x8f1022['set']({'label':Es(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Pn+'\x20ck-ai-button-stop-generating','icon':st}),_0x8f1022['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x8f1022;}_createLoaderView(){const _0x4ab579=new _0x3faf4e(this['locale']);return _0x4ab579['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':Es(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x4ab579;}},ca=class extends _0x3faf4e{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x2d8940,_0x18b488){super(_0x2d8940),this['_filesEnabled']=_0x18b488['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x2d8940,{'bodyCollection':_0x18b488['bodyCollection'],'searchInputVisibleFrom':_0x18b488['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x2d8940),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x2d8940),this['_loaderView']=this['_createLoaderView'](_0x2d8940),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x2d8940),this['_dropZoneView']=new Ao(_0x2d8940),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0xd8baa3=>!_0xd8baa3),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'](...$o)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x571eea=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x571eea['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x571eea['if']('isLoading','ck-hidden',_0x1e189b=>_0x1e189b||!this['isModelAvailable']),_0x571eea['if']('isModelAvailable','ck-hidden',_0x506439=>!_0x506439||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x571eea['if']('isLoading','ck-hidden',_0x261b82=>!_0x261b82)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x571eea['if']('isModelAvailable','ck-hidden',_0x1ce439=>_0x1ce439)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x5ccdd9({'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(_0x21303e,_0x25540e){return new oa(_0x21303e,_0x25540e);}_createPromptInputView(_0x47fd0c){return new go(_0x47fd0c,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x395696){return new ko(_0x395696);}_createLoaderView(_0x1f4076){return new ha(_0x1f4076);}_createModelUnavailableMessageView(_0x34f9eb){const _0x1e15a3=new la(_0x34f9eb);return _0x1e15a3['delegate']('startConversation')['to'](this),_0x1e15a3;}_handlePromptInputFocus(_0x378497,_0x1d5ebe,_0x1c0aa7){_0x1c0aa7?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x41de1f,_0x1c024f){this['_contextPanelView']['addContextItem'](_0x41de1f,_0x1c024f);}removeContextItem(_0x3ec4b2){this['_contextPanelView']['removeContextItem'](_0x3ec4b2);}setContextItemLoading(_0x86b817,_0x2102a0){this['_contextPanelView']['setContextItemLoading'](_0x86b817,_0x2102a0);}setIsUploadInProgress(_0x249074){this['_promptInputView']['setIsUploadInProgress'](_0x249074);}setConversationContext(_0x1cc10f){this['_contextPanelView']['setConversationContext'](_0x1cc10f);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x427d92,_0x2794f5,_0x31ff57){this['_contextPanelView']['updateResourceState'](_0x427d92,_0x2794f5,_0x31ff57);}setWebSearch(_0x3274e8){this['_promptCapabilitiesView']['setWebSearch'](_0x3274e8);}setReasoning(_0x36aa5a){this['_promptCapabilitiesView']['setReasoning'](_0x36aa5a);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x20908b){this['_contextPanelView']['setAddContextOptions'](_0x20908b);}setInputPlaceholder(_0x35050b){this['_promptInputView']['setPlaceholderText'](_0x35050b);}setModelList(_0x20c276,_0x2538a0){this['_promptCapabilitiesView']['setModelList'](_0x20c276,_0x2538a0);}setModel(_0x1e1bca){_0x1e1bca?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x1e1bca)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x80ee8){this['_promptCapabilitiesView']['disableModelSelector'](_0x80ee8);}populateSourceResourceBalloon(_0x2cf6c9,_0x1d4e08,_0x535db2,_0x95c6b8){this['_contextPanelView']['populateSourceResourceBalloon'](_0x2cf6c9,_0x1d4e08,_0x535db2,_0x95c6b8);}['closeSourceResourceBalloon'](_0x44e724){this['_contextPanelView']['closeSourceResourceBalloon'](_0x44e724);}focusPromptInput(_0x5daab2=!0x1){this['_promptInputView']['focus'](_0x5daab2);}setPromptInputValue(_0x1b04af){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x1b04af;}},la=class extends _0x3faf4e{constructor(_0x2c6bf0){super(_0x2c6bf0);const _0x2d81b6=new Mt(_0x2c6bf0);_0x2d81b6['set']({'label':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x2d81b6['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Es(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x2d81b6]}]});}},ua=class extends Kt{resizeButton;constructor(_0x4ca49a,_0x277c74){super(_0x4ca49a,{'label':_0x277c74['label'],'class':'ck-ai-header\x20'+_0x277c74['class'],'icon':_0x277c74['icon']}),this['set']('isMaximized',!0x1),_0x277c74['content']&&this['children']['add'](_0x277c74['content']),_0x277c74['showResizeButton']&&(this['resizeButton']=Hn(_0x4ca49a,this),this['children']['add'](this['resizeButton']));}},da=class extends _0x3faf4e{constructor(_0x5bdb6a){super(_0x5bdb6a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Es(_0x5bdb6a,'AI_DISCLAIMER_TEXT')}]}]});}};function _a(_0x2ec7c1,_0x3cca84){const _0x3453bf=new Mt(_0x2ec7c1);return _0x3453bf['set']({'label':Es(_0x2ec7c1,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x304a27,'class':'ck-ai-chat__start-conversation\x20'+Pn}),_0x3453bf['on']('execute',()=>{_0x3cca84['fire']('startConversation');}),_0x3453bf;}var ga=class extends _0x3faf4e{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x52d686,_0x5e8ec7){super(_0x52d686),this['_bodyCollection']=Mn(_0x52d686);const _0x506ca5=_a(_0x52d686,this);this['chatHeader']=new ua(_0x52d686,{'label':Es(_0x52d686,'AI_CHAT_HEADING'),'icon':_0x2abd52,'class':'ck-ai-header_chat','content':_0x506ca5,'showResizeButton':_0x5e8ec7['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new co(_0x52d686,this['_bodyCollection']),this['chatFeed']['delegate'](...sr)['to'](this),this['chatControls']=new ca(_0x52d686,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x5e8ec7['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x5e8ec7['filesEnabled']}),this['chatControls']['delegate'](...sr)['to'](this),this['chatDisclaimer']=new da(_0x52d686),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x52d686['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x3da4c9,_0x39a869,_0x5006eb,_0x188b4a){this['chatControls']['populateSourceResourceBalloon'](_0x3da4c9,_0x39a869,_0x5006eb,_0x188b4a);}['closeSourceResourceBalloon'](_0xeee678){this['chatControls']['closeSourceResourceBalloon'](_0xeee678);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Aa=class extends _0x2b8fcb{static get requires(){return[gs];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0xcc1cf6){super(_0xcc1cf6);const _0x3bc78e=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Sr(),this['_view']=new ga(this['context']['locale'],{'showResizeButton':_0x3bc78e['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'](_0x3bc78e),this['_view']['delegate'](...sr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x5d8765,{showDiff:_0x4a7d21})=>{this['showDiff']=_0x4a7d21;}),this['disableControls'](),_0x3bc78e['view']['addTab']({'id':'chat','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x2abd52,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x3bc78e['view'],'isMaximized',_0x48e439=>_0x48e439),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x109cfb=>_0x109cfb),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x104166}){const _0x338f1d=this['context']['config']['get']('ai.chat.welcomeMessage')??Es(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x104166,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x338f1d}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x5b2d7c,staticMessage:_0x2bc7e9}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5b2d7c,'initialContent':'<p>'+_0x2bc7e9+'</p>'});});}async addFeedItemUserMessage(_0xa7e2ad){const _0x3cc89c=_0xa7e2ad['attributes']?.['displayedPrompt']||_0xa7e2ad['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xa7e2ad['contextItems']['values']()),'initialContent':'<p>'+_0x3cc89c+'</p>','id':_0xa7e2ad['id']});});}async addFeedItemError({errorMessage:_0x486ee7,id:_0x32c913}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x486ee7+'</p>','id':_0x32c913});});}async addFeedItemAIReply(_0x233f6f){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x233f6f['interactionId']+':'+_0x233f6f['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x51fd5e){const _0x167b10=bs(this['context']),_0x5badde=_0x167b10['map'](_0x5e7dda=>_0x5e7dda['config']['get']('ai.availableReplyActions')||[...Or]);let _0x31d97c=_0x5badde['reduce']((_0x3214b3,_0x19ac5c)=>_0x3214b3['filter'](_0x9641f=>_0x19ac5c['includes'](_0x9641f)),_0x5badde[0x0]||[...Or]);const _0x1d9727=_0x167b10['every'](_0x3dd2d8=>_0x3dd2d8['plugins']['has']('TrackChanges')),_0xc8d7d5=_0x167b10['map'](_0x9a19ac=>_0x9a19ac['commands']['get']('trackChanges'));return _0x1d9727?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0xc8d7d5,'value',(..._0x30bf07)=>_0x30bf07['some'](_0x1f7244=>_0x1f7244))):_0x31d97c=_0x31d97c['filter'](_0x3b824e=>'insertSuggestion'!=_0x3b824e),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x51fd5e['interactionId']+':'+_0x51fd5e['id'],'areActionsDisabled':_0x51fd5e['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x31d97c}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x1c2eda,_0x23e0d5){return this['_promiseQueue']['enqueue'](async()=>{const _0x12fa46=this['_view']['chatFeed']['children']['last'];if(_0x12fa46 instanceof so)return this['_view']['chatFeed']['children']['remove'](_0x12fa46),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1c2eda['id'],'capabilities':{'isWebSearchEnabled':_0x12fa46['capabilities']['isWebSearchEnabled']||_0x23e0d5['isWebSearchEnabled'],'isReasoningEnabled':_0x12fa46['capabilities']['isReasoningEnabled']||_0x23e0d5['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1c2eda['id'],'capabilities':_0x23e0d5});});}async addFeedItemCustomElement(_0x1d59be,_0x339af3){let _0x31de03;return await this['_promiseQueue']['enqueue'](async()=>{_0x31de03=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x1d59be,'id':_0x339af3});}),_0x31de03;}removeFeedItem(_0x468db8){this['_view']['chatFeed']['removeItem'](_0x468db8);}hasFeedItem(_0x30e8ed){return this['_view']['chatFeed']['hasItem'](_0x30e8ed);}updateFeedInteractionHeader(_0x4cf243){const _0xd5bdf4=this['_view']['chatFeed']['children']['find'](_0x4e615e=>_0x4e615e['options']['id']==_0x4cf243['id']&&_0x4e615e instanceof so);_0xd5bdf4&&_0xd5bdf4['set']('isVisible',_0x4cf243['isVisible']);}async updateFeedItemAIReplyContent(_0x38d19a){const _0x33a3ec=_0x38d19a['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x8fa5f2=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x38d19a,'abortSignal':_0x8fa5f2,'renderingStrategy':_0x33a3ec}),_0x38d19a['isDone']&&this['markFeedItemAsDone'](_0x38d19a['id']);});}updateFeedItemAIReplySources(_0x2db55d,_0x6625dc){this['_view']['chatFeed']['updateWebSources'](_0x2db55d,_0x6625dc);}async updateFeedItemAIReplySuggestionContent(_0x23a81c){return this['_promiseQueue']['enqueue'](async _0x207afc=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x23a81c,'abortSignal':_0x207afc}),_0x23a81c['isDone']&&this['markFeedItemAsDone'](_0x23a81c['id']);});}updateFeedItemAIReplySuggestionPartState(_0x5c3f65){this['_view']['chatFeed']['updateSuggestionPartState'](_0x5c3f65);}setSuggestionGating(_0x42b4ca,_0x1fa27d){this['_view']['chatFeed']['updateSuggestionGating'](_0x42b4ca,_0x1fa27d);}setFeedItemAIReplySuggestionPartActive(_0x529dbf){this['_view']['chatFeed']['setSuggestionPartActive'](_0x529dbf);}markFeedItemAsDone(_0x589340){this['_view']['chatFeed']['markItemAsDone'](_0x589340);}removeFeedInteraction(_0x376db0){this['_view']['chatFeed']['getItemIds']()['filter'](_0x567a0d=>_0x567a0d['startsWith'](_0x376db0))['forEach'](_0x22f302=>this['_view']['chatFeed']['removeItem'](_0x22f302));}startInteraction(){const _0x275ece=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x275ece),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x33eea5){this['_promiseQueue']['abort'](),_0x33eea5&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x7cb24d=>_0x7cb24d['startsWith'](_0x33eea5['id']))['forEach'](_0x3ac195=>this['markFeedItemAsDone'](_0x3ac195)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x5d1dea,_0x583599){this['_view']['chatControls']['addContextItem'](_0x5d1dea,_0x583599);}removeContextItem(_0xb620f){this['_view']['chatControls']['removeContextItem'](_0xb620f);}setContextItemLoading(_0x1af195,_0x533b42){this['_view']['chatControls']['setContextItemLoading'](_0x1af195,_0x533b42);}setIsUploadInProgress(_0x3c2cb8){this['_view']['chatControls']['setIsUploadInProgress'](_0x3c2cb8);}setConversationContext(_0x358147){this['_view']['chatControls']['setConversationContext'](_0x358147);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x17df14,_0x12d60f,_0x4b41ad){this['_view']['chatControls']['updateResourceState'](_0x17df14,_0x12d60f,_0x4b41ad);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x425949){this['_view']['chatControls']['setAddContextOptions'](_0x425949);}updateCapabilities(_0x40a728){this['_view']['chatControls']['setWebSearch'](_0x40a728['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x40a728['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x40a728));}setSelectedModel(_0x567402,_0x2b351e){this['_view']['chatControls']['setModel'](_0x567402),_0x2b351e&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x570aa0){this['feedItemRenderingStrategy']=_0x570aa0;}toggleLoadingSkeleton(_0x470886){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x470886);}resetConversationTitle(){this['setConversationTitle'](Es(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x46480e,_0x439c53=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x439c53&&!Et()&&_0x46480e['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x46480e);this['_view']['chatHeader']['label']=_0x46480e;}setLoadingMessage(_0x490364){this['_view']['chatFeed']['setLoadingMessage'](_0x490364);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x252e05){let _0x26a0dc=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x252e05[_0x26a0dc],_0x26a0dc++,_0x26a0dc===_0x252e05['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x7b3c16){return _0x7b3c16['isWebSearchEnabled']&&_0x7b3c16['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x7b3c16['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x7b3c16['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Es(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0xcc9980){return _0xcc9980?_0xcc9980['isWebSearchEnabled']&&_0xcc9980['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0xcc9980['isWebSearchEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0xcc9980['isReasoningEnabled']?Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Es(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x25c336,_0x1c83c9,_0x34e725,_0x37a421){this['_view']['populateSourceResourceBalloon'](_0x25c336,_0x1c83c9,_0x34e725,_0x37a421);}['closeSourceResourceBalloon'](_0x3501eb){this['_view']['closeSourceResourceBalloon'](_0x3501eb);}setPromptInputValue(_0x5ec4ae){this['_view']['chatControls']['setPromptInputValue'](_0x5ec4ae);}focusPromptInput(_0x78d98f=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x78d98f);}scrollFeedToSuggestion(_0x2959e4,_0x5b1389){this['_view']['chatFeed']['scrollToSuggestion'](_0x2959e4,_0x5b1389);}startAutoScroll(_0x19dc20={}){this['_view']['chatFeed']['startAutoScroll'](_0x19dc20);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x5ce11f){_0x5ce11f?(this['isBusy']=_0x5ce11f,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ia=class extends Jt{sections;constructor(_0x159c92,_0x158b6e){super(_0x159c92),this['sections']=_0x158b6e,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x3bcce4){let _0x44e3fa=0x0,_0x596ad9=0x0;for(const _0x4bdd98 of this['sections']){const {resultsCount:_0x2d47e0,totalItemsCount:_0x5bad31}=_0x4bdd98['filter'](_0x3bcce4);_0x44e3fa+=_0x2d47e0,_0x596ad9+=_0x5bad31;}return{'resultsCount':_0x44e3fa,'totalItemsCount':_0x596ad9};}},pa=class extends jt{title;itemsViews;_itemsListView;constructor(_0x1d626c,{title:_0x1e3aa2,items:_0x335e38}){super(_0x1d626c);const _0xb8073b=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x1e3aa2,this['itemsViews']=_0x335e38;const _0x568aeb=new _0x3faf4e(_0x1d626c);_0x568aeb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Jt(_0x1d626c),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0xb8073b['if']('isVisible','ck-hidden',_0x3a6274=>!_0x3a6274)]},'children':[_0x568aeb,this['_itemsListView']]});}filter(_0xa7c75){const _0x1455ff=this['itemsViews']['length'];let _0x5512d2=0x0;for(const _0x451653 of this['itemsViews'])_0xa7c75?(_0x451653['isVisible']=!!_0x451653['isMatching'](_0xa7c75),_0x451653['highlightText'](_0xa7c75)):(_0x451653['isVisible']=!0x0,_0x451653['highlightText'](null)),_0x451653['isVisible']&&_0x5512d2++;return this['isVisible']=_0x5512d2>0x0,{'resultsCount':_0x5512d2,'totalItemsCount':_0x1455ff};}getItem(_0x500d0f){return this['itemsViews']['find'](_0x404a06=>_0x404a06['id']===_0x500d0f);}removeItem(_0x5eb0cc){const _0x42d2be=this['itemsViews']['indexOf'](_0x5eb0cc);-0x1!==_0x42d2be&&(this['itemsViews']['splice'](_0x42d2be,0x1),this['_itemsListView']['items']['remove'](_0x5eb0cc));}};const Ea=/* #__PURE__ -- @preserve */
|
|
34
|
-
_0x29a25b(jt);var ma=class AIChatHistoryListItemView extends Ea{['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(_0x406783,_0x39eb23){super(_0x406783);const _0x42d02b=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x39eb23['pinned']),this['set']('loadingState',null),this['set']('title',_0x39eb23['title']),this['id']=_0x39eb23['id'];const {createdAt:_0x4a54f4,active:_0x9a585f=!0x1}=_0x39eb23;this['_titleView']=new Yt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x18e5eb=this['_createCheckView'](),_0x185c79=this['_createPinButtonView'](_0x406783),_0x141d8c=this['_createMenuDropdownView'](),_0x4dcf23=this['_createEditInputView'](_0x406783),_0x44b33b=this['_createAcceptEditButtonView'](_0x406783,_0x4dcf23),_0x573031=this['_createCancelEditButtonView'](_0x406783);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x185c79),this['actions']['add'](_0x141d8c),this['on']('change:isEdit',(_0xaf19cc,_0x99b8a1,_0x4d8126)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4d8126?(this['actions']['add'](_0x44b33b),this['actions']['add'](_0x573031),this['mainContent']['add'](_0x4dcf23),_0x4dcf23['element']['value']=this['title']||'',_0x4dcf23['element']['focus']()):(this['actions']['add'](_0x185c79),this['actions']['add'](_0x141d8c),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x9a585f?'ck-ai-chat-history__item--active':'',_0x42d02b['if']('isVisible','ck-hidden',_0x4ee842=>!_0x4ee842),_0x42d02b['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',_0x42d02b['if']('loadingState','ck-hidden',_0x2e1ac5=>!!_0x2e1ac5)]},'children':_0x9a585f?[_0x18e5eb]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x42d02b['if']('loadingState','ck-hidden',_0x535f80=>!_0x535f80)]},'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',_0x42d02b['if']('loadingState','ck-hidden',_0x3dda6c=>!!_0x3dda6c)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x42d02b['if']('loadingState','ck-hidden',_0x4c3a10=>!_0x4c3a10)]},'children':[{'text':_0x42d02b['to']('loadingState',_0x260b7f=>_0x260b7f?Es(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x260b7f]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4a54f4]}]},{'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(_0x228d6b){this['set']('title',_0x228d6b);}updateLoadingState(_0x313928,_0xfb1026){this['set']('loadingState',_0xfb1026?_0x313928:null);}_createCheckView(){const _0x6bd912=new $t();return _0x6bd912['set']({'content':_0x884ad8}),_0x6bd912;}_createPinButtonView(_0x7ed641){const _0x357f85=new Mt(_0x7ed641);return _0x357f85['set']({'label':Es(_0x7ed641,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x9fd472,'withText':!0x1,'tooltip':!0x0}),_0x357f85['bind']('isOn')['to'](this,'pinned'),_0x357f85['on']('execute',()=>{const _0xa440a3=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0xa440a3});}),_0x357f85;}_createMenuDropdownView(){const _0x1154f0=_0x48d908(this['locale']),_0x1b0132=_0x1154f0['panelView']['children'];_0x1154f0['buttonView']['set']({'label':Es(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x1154f0['panelPosition']='sw';const _0x47086f=new Mt(this['locale']);_0x47086f['label']=Es(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x47086f['withText']=!0x0,_0x47086f['on']('execute',()=>{this['isEdit']=!0x0;});const _0x5712c2=new Mt(this['locale']);_0x5712c2['label']=Es(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x5712c2['withText']=!0x0,_0x5712c2['on']('execute',()=>{this['showConfirm'](Es(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x3f7408=new Jt(this['locale']),_0x505100=new jt(this['locale']);_0x505100['children']['add'](_0x47086f);const _0x5022ad=new jt(this['locale']);return _0x5022ad['children']['add'](_0x5712c2),_0x3f7408['items']['addMany']([_0x505100,_0x5022ad]),_0x1b0132['add'](_0x3f7408),_0x1154f0;}_createEditInputView(_0x520cc8){const _0x335d0e=new qt(_0x520cc8),_0x35005b=_0x335d0e['bindTemplate'];return _0x335d0e['extendTemplate']({'on':{'keydown':_0x35005b['to'](_0xee0d6c=>{'Enter'==_0xee0d6c['key']&&this['_commitEditInputValue'](_0x335d0e);})}}),_0x335d0e;}_createAcceptEditButtonView(_0x218cea,_0x3c9668){const _0x2f0e97=new Mt(_0x218cea);return _0x2f0e97['set']({'icon':_0x884ad8,'withText':!0x1,'tooltip':Es(_0x218cea,'AI_CHAT_HISTORY_ACCEPT')}),_0x2f0e97['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x2f0e97['on']('execute',()=>{this['_commitEditInputValue'](_0x3c9668);}),_0x2f0e97;}_commitEditInputValue(_0x35ab60){const _0x2e9aa6=_0x35ab60['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x2e9aa6});}_createCancelEditButtonView(_0x4e9489){const _0x378657=new Mt(_0x4e9489);return _0x378657['set']({'icon':_0x2f23df,'withText':!0x1,'tooltip':Es(_0x4e9489,'AI_CHAT_HISTORY_CANCEL')}),_0x378657['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x378657['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x378657;}_createSpinnerView(){const _0x55f311=new Dr('tiny');return _0x55f311['isVisible']=!0x0,_0x55f311;}isMatching(_0x2603cb){return'string'==typeof this['title']&&this['title']['match'](_0x2603cb)?{'title':!0x0}:null;}highlightText(_0x31abb8){this['_titleView']['highlightText'](_0x31abb8);}},Ta=class extends _0x3faf4e{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x2889f0,_0x385cca){super(_0x2889f0),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x4c12ff=_a(_0x2889f0,this);this['headerView']=new ua(_0x2889f0,{'label':Es(_0x2889f0,'AI_CHAT_HISTORY_HEADING'),'icon':_0x36df57,'class':'ck-ai-header_history','content':_0x4c12ff,'showResizeButton':_0x385cca}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ia(_0x2889f0,[]),this['sectionsView']['delegate'](...wa)['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',_0xc9a3df=>!_0xc9a3df)]}}),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 _0x37cf7f=new _0x2e5362(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x52f150=>Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x52f150),'secondary':Es(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x23ddc1=this['_createErrorView']();return _0x23ddc1['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x7bb999=>!_0x7bb999)]}}),_0x37cf7f['on']('render',()=>{_0x37cf7f['children']['add'](_0x23ddc1,0x1);}),_0x37cf7f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x24c7e2=>!_0x24c7e2)]}}),_0x37cf7f;}_createSkeletonView(){const _0x4eb8f5=new wr(this['locale'],Cr['aiHistory']);return _0x4eb8f5['bind']('isVisible')['to'](this,'isLoading'),_0x4eb8f5;}_createErrorView(){const _0x9e75f5=new _0x3faf4e(this['locale']),_0x473bbf=new Mt(this['locale']);_0x473bbf['set']({'withText':!0x1,'icon':_0x2f23df,'class':'ck-ai-notification_error__dismiss-button'}),_0x473bbf['bind']('isVisible')['to'](this,'hasItems',_0x4fe1f5=>!!_0x4fe1f5),_0x473bbf['on']('execute',()=>{this['errorMessage']='';});const _0x48740a=this['bindTemplate'];return _0x9e75f5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x48740a['to']('errorMessage')}]},_0x473bbf]}),_0x9e75f5;}_createEmptyStateView(){const _0x350d15=new _0x3faf4e(this['locale']);return _0x350d15['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x2801ff=>!_0x2801ff)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Es(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x350d15;}_createListItemViews(_0xfa9486,_0x1fb326){const _0x4821ac=[];for(const _0x19d82d of _0xfa9486){const _0x54e0b7=new ma(_0x1fb326,_0x19d82d);_0x54e0b7['delegate'](...wa)['to'](this),_0x4821ac['push'](_0x54e0b7);}return _0x4821ac;}updateHistoryItemsWithCategories(_0x19edfe){const _0x1920a2=this['locale']||'en',_0x204813=[];for(const _0x5a1aaa of _0x19edfe){const _0x2177e1=this['_createListItemViews'](_0x5a1aaa['items'],_0x1920a2);_0x204813['push'](new pa(_0x1920a2,{'title':_0x5a1aaa['title'],'items':_0x2177e1}));}this['sectionsView']['sections']=_0x204813,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x204813),this['hasItems']=_0x19edfe['some'](_0x1372ca=>_0x1372ca['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x5a862e){for(const _0x19604c of this['sectionsView']['sections']){const _0x3f1baf=_0x19604c['getItem'](_0x5a862e);if(_0x3f1baf){if(_0x19604c['removeItem'](_0x3f1baf),0x0===_0x19604c['itemsViews']['length']){const _0x19ec09=this['sectionsView']['sections']['indexOf'](_0x19604c);-0x1!==_0x19ec09&&(this['sectionsView']['sections']['splice'](_0x19ec09,0x1),this['sectionsView']['items']['remove'](_0x19604c));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x43a414,_0x58e941){for(const _0x11753e of this['sectionsView']['sections']){const _0x487c73=_0x11753e['getItem'](_0x43a414);if(_0x487c73){_0x487c73['updateTitle'](_0x58e941);break;}}}updateItemLoadingState(_0x1349a7,_0x5201df,_0x30292a){for(const _0x9d3077 of this['sectionsView']['sections']){const _0x3183d2=_0x9d3077['getItem'](_0x1349a7);if(_0x3183d2){_0x3183d2['updateLoadingState'](_0x5201df,_0x30292a);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x13f0a3=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x13f0a3);}}};const wa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ca=class extends _0x2b8fcb{static get requires(){return[gs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5d2707){super(_0x5d2707);const _0x236676=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ta(this['context']['locale'],_0x236676['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x236676),this['_historyView']['delegate'](...wa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x236676['view'],'isMaximized',_0x371cb1=>_0x371cb1),_0x236676['view']['addTab']({'id':'history','buttonLabel':Es(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x36df57,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x9d3d51){this['_historyView']['removeHistoryItem'](_0x9d3d51);}updateItems(_0x5bd7ad){this['_historyView']['updateHistoryItemsWithCategories'](_0x5bd7ad);}updateItemTitle(_0x42b910,_0x5955d){this['_historyView']['updateItemTitle'](_0x42b910,_0x5955d);}updateItemLoadingState(_0x3fd9f9,_0x1003c4,_0x1600cb){this['_historyView']['updateItemLoadingState'](_0x3fd9f9,_0x1003c4,_0x1600cb);}setLoadingSkeleton(_0x40e592){this['_historyView']['isLoading']=_0x40e592;}['showError'](_0x6d8f5a){this['_historyView']['errorMessage']=_0x6d8f5a;}['hideError'](){this['_historyView']['errorMessage']='';}};const fa=/* #__PURE__ -- @preserve */
|
|
35
|
-
At();var
|
|
36
|
-
dt();var Ra=class extends Sa{items=[];connector;['group'];constructor({connector:_0x5f0a51,group:_0x4828c4}){super(),this['connector']=_0x5f0a51,this['group']=_0x4828c4;}async init(){try{const _0x2b1224=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x2b1224);}catch(_0xcf3105){this['fire']('error',{'error':_0xcf3105,'operation':'init'});}}addItem(_0x597adc){this['items']['push'](_0x597adc);}async removeItem(_0x1d2a34){const _0x50d896=this['items']['findIndex'](_0x4c8948=>_0x4c8948['id']===_0x1d2a34);if(-0x1===_0x50d896)return!0x1;try{return await this['connector']['deleteConversation'](_0x1d2a34)['execute'](),this['items']['splice'](_0x50d896,0x1),this['fire']('itemRemoved',{'itemId':_0x1d2a34}),!0x0;}catch(_0x14cab0){return this['fire']('error',{'error':_0x14cab0,'operation':'removeItem','itemId':_0x1d2a34}),!0x1;}}getItem(_0x5efa71){return this['items']['find'](_0x5cd4f4=>_0x5cd4f4['id']===_0x5efa71);}async updateItemTitle(_0x3db1bc,_0x5bf68b){const _0x532219=this['getItem'](_0x3db1bc);if(!_0x532219)return!0x1;try{return await this['connector']['updateConversation'](_0x3db1bc,{'title':_0x5bf68b})['getResult'](),_0x532219['updateTitle'](_0x5bf68b),this['fire']('itemUpdated',{'itemId':_0x3db1bc,'updates':{'title':_0x5bf68b}}),!0x0;}catch(_0x463dd2){return this['fire']('error',{'error':_0x463dd2,'operation':'updateItemTitle','itemId':_0x3db1bc}),!0x1;}}async updateItemPinned(_0x432bd,_0x5ab4f5){const _0x4f90da=this['getItem'](_0x432bd);if(!_0x4f90da)return!0x1;try{return await this['connector']['updateConversation'](_0x432bd,{'pinned':_0x5ab4f5})['getResult'](),_0x4f90da['updatePinned'](_0x5ab4f5),this['fire']('itemUpdated',{'itemId':_0x432bd,'updates':{'pinned':_0x5ab4f5}}),!0x0;}catch(_0x38b0a1){return this['fire']('error',{'error':_0x38b0a1,'operation':'updateItemPinned','itemId':_0x432bd}),!0x1;}}loadItems(_0x2bf702){try{this['items']=[],_0x2bf702['map'](_0x146b58=>{this['addItem'](new ba(_0x146b58));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x211cb5){this['fire']('error',{'error':_0x211cb5,'operation':'loadItems'});}}getItems(_0x60c0ca={}){const _0x5d83ff=void 0x0!==_0x60c0ca['pinned']&&_0x60c0ca['pinned'],_0x1fdc8d=_0x60c0ca['from']?new Date(_0x60c0ca['from']['getFullYear'](),_0x60c0ca['from']['getMonth'](),_0x60c0ca['from']['getDate']()):null,_0x2360e8=_0x60c0ca['to']?new Date(_0x60c0ca['to']['getFullYear'](),_0x60c0ca['to']['getMonth'](),_0x60c0ca['to']['getDate']()):null;return this['items']['filter'](_0x4b6840=>{if(_0x4b6840['pinned']!==_0x5d83ff)return!0x1;if(_0x2360e8){const _0x27fe6d=new Date(_0x4b6840['createdAt']['getFullYear'](),_0x4b6840['createdAt']['getMonth'](),_0x4b6840['createdAt']['getDate']());return _0x1fdc8d?_0x1fdc8d['getTime']()===_0x2360e8['getTime']()?_0x27fe6d['getTime']()===_0x1fdc8d['getTime']():_0x27fe6d<_0x2360e8&&_0x27fe6d>=_0x1fdc8d:_0x27fe6d<_0x2360e8;}return!0x0;});}},Oa=class extends _0x2b8fcb{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Is,Nn,er,Ca,gs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Is),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Ca),this['_aiChatController']=this['context']['plugins']['get'](er),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aichathistory');const _0x16e86c=this['context']['plugins']['get'](gs);try{const _0x2309d2=this['_aiChatController']['getGroupId']();this['history']=new Ra({'connector':this['_aiConnector'],'group':_0x2309d2}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x20dc8d,_0x4a462b)=>{this['_setItemLoading'](_0x4a462b['id'],'remove'),this['_handleRemove'](_0x4a462b['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x5e546a,_0x37867d)=>{this['_setItemLoading'](_0x37867d['id'],'rename'),this['_handleEditTitle'](_0x37867d['id'],_0x37867d['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x31562a,_0x309d0e)=>{void 0x0!==_0x309d0e['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x309d0e['itemId'],_0x309d0e['updates']['title']),void 0x0!==_0x309d0e['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x309d0e['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x53e2f9,_0x275e6b)=>{this['_aiChatController']['_handleRemovedConversation'](_0x275e6b['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x275e6b['itemId']),this['_clearItemLoading'](_0x275e6b['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x599dea,_0x165449)=>{this['_handleHistoryErrorUI'](_0x165449['error'],_0x165449['operation'],_0x165449['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x15ae8d,_0x1866eb)=>{this['_handleSelectConversation'](_0x1866eb['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x6929af,_0x31c417)=>{const _0x301772=_0x31c417['pinned']?'pin':'unpin';this['_setItemLoading'](_0x31c417['id'],_0x301772),this['_handleTogglePin'](_0x31c417['id'],_0x31c417['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x16e86c['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x16e86c['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x393ad4){this['_handleHistoryErrorUI'](_0x393ad4,'init');}}async _handleEditTitle(_0x59d0f2,_0x324689){await this['history']['updateItemTitle'](_0x59d0f2,_0x324689);}async['_handleTogglePin'](_0x34162a,_0x491147){await this['history']['updateItemPinned'](_0x34162a,_0x491147);}async['_handleRemove'](_0xcf8dd8){await this['history']['removeItem'](_0xcf8dd8);}async _handleSelectConversation(_0x5c246d){await this['_aiChatController']['loadConversation'](_0x5c246d);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x187ae5=this['_aiChatController']['activeConversation']?.['id'],_0xeb4767=this['_getCategorizedItems']()['map'](_0x12bd6a=>({'title':_0x12bd6a['title'],'items':_0x12bd6a['items']['map'](_0x4b99c3=>({'id':_0x4b99c3['id'],'title':_0x4b99c3['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x4b99c3['createdAt'])['toLocaleDateString'](),'active':_0x4b99c3['id']===_0x187ae5,'pinned':_0x4b99c3['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0xeb4767);}_setItemLoading(_0x5a4a51,_0x5330a7){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x5a4a51,_0x5330a7,!0x0);}_clearItemLoading(_0xcbdab2){this['_aiChatHistoryUi']['updateItemLoadingState'](_0xcbdab2,null,!0x1);}_handleHistoryErrorUI(_0x197a9f,_0x226abd,_0x4ce240){const _0x235c26=this['_generateErrorMessage'](_0x226abd,_0x4ce240);this['_aiChatHistoryUi']['showError'](_0x235c26),this['_reporter']['reportError'](_0x197a9f,{'context':{'operation':_0x226abd}}),_0x4ce240&&this['_clearItemLoading'](_0x4ce240),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x120ea8,_0x37b30b){const _0x442298=_0x37b30b?this['history']['getItem'](_0x37b30b):null,_0x4a1cdd=_0x442298?.['title']||Es(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x120ea8){case'updateItemTitle':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x4a1cdd);case'updateItemPinned':{const _0x26b955=Es(this['context']['locale'],_0x442298?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x26b955,_0x4a1cdd]);}case'removeItem':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x4a1cdd);case'init':case'loadItems':return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Es(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x140a2f=new Date(),_0x4838e6=new Date(_0x140a2f['getFullYear'](),_0x140a2f['getMonth'](),_0x140a2f['getDate']()),_0x3e472f=new Date(_0x4838e6);_0x3e472f['setDate'](_0x3e472f['getDate']()-0x1);const _0x17f445=new Date(_0x4838e6);_0x17f445['setDate'](_0x17f445['getDate']()-0xe);const _0x260966=this['history']['getItems']({'pinned':!0x0}),_0x59cbc0=this['history']['getItems']({'from':_0x4838e6,'to':_0x4838e6}),_0x2e9906=this['history']['getItems']({'from':_0x3e472f,'to':_0x3e472f}),_0x40ac02=this['history']['getItems']({'from':_0x17f445,'to':_0x3e472f}),_0x18a8b7=this['history']['getItems']({'to':_0x17f445}),_0x2d558e=[];return _0x260966['length']>0x0&&_0x2d558e['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x260966}),_0x59cbc0['length']>0x0&&_0x2d558e['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x59cbc0}),_0x2e9906['length']>0x0&&_0x2d558e['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x2e9906}),_0x40ac02['length']>0x0&&_0x2d558e['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x40ac02}),_0x18a8b7['length']>0x0&&_0x2d558e['push']({'title':Es(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x18a8b7}),_0x2d558e;}},va=class extends _0x2b8fcb{static get requires(){return[Oa,Ca];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ka=class extends _0x2b8fcb{static get requires(){return[er,tn,Aa,va,vn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x321df6){super(_0x321df6),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ya=class extends Mt{['id'];constructor(_0x52d165,_0x2d8f8f){super(_0x52d165);const {id:_0x455bcc,type:_0x9eafa8,icon:_0x5ab14f}=_0x2d8f8f;this['id']=_0x455bcc,this['set']({'label':_0x2d8f8f['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x2d8f8f['id']}}),_0x5ab14f?this['icon']=_0x5ab14f:'chat'===_0x9eafa8?this['icon']=_0x2abd52:'review'===_0x9eafa8?this['icon']=_0xba7699:'translate'===_0x9eafa8&&(this['icon']=_0xa83078);}},Na=class extends _0x3faf4e{listView;constructor(_0x123c56,_0x417162){super(_0x123c56),this['set']('isEnabled',!0x0);const _0x212b7e=_0x417162['map'](_0x5813f5=>{const _0x12d54d=new jt(this['locale']),_0x399923=new ya(this['locale'],_0x5813f5);return _0x399923['bind']('isEnabled')['to'](this),_0x12d54d['children']['add'](_0x399923),_0x399923['delegate']('execute')['to'](this),_0x12d54d;});this['listView']=new Jt(this['locale']),this['listView']['items']['addMany'](_0x212b7e),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const xa='chat-shortcuts';var La=class extends _0x2b8fcb{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[Aa,fs];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](Aa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x20d4b5=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x188893=_0x20d4b5['activeConversation'];_0x188893['isFromHistory']||this['_injectShortcuts'](_0x188893);}),this['listenTo'](_0x20d4b5,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x1470b0=['chat','review','translate'];this['_shortcuts']['forEach'](_0x5988d0=>{let _0x102c50=!0x0;if(_0x5988d0['id']&&_0x5988d0['label']&&_0x1470b0['includes'](_0x5988d0['type'])?'chat'===_0x5988d0['type']&&(_0x102c50='string'==typeof _0x5988d0['prompt']):_0x102c50=!0x1,!_0x102c50)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x5988d0});});}_injectShortcuts(_0x4046af){this['_removeShortcuts'](),this['_shortcutsView']=new Na(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],xa),this['_shortcutsView']['on']('execute',_0x4f47fa=>{const _0x33ee65=_0x4f47fa['source']['id'];this['_executeShortcut'](_0x33ee65);}),this['_listenedConversation']=_0x4046af,this['listenTo'](_0x4046af,'uploadProgressChanged',(_0x56aece,_0x52df01)=>{this['_shortcutsView']['isEnabled']=!_0x52df01['isUploadInProgress'];});}_removeShortcuts(){const _0x45b567=this['context']['plugins']['get'](Aa);_0x45b567['hasFeedItem'](xa)&&_0x45b567['removeFeedItem'](xa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x3bda0b){const _0x2ef874=this['_shortcuts']['find'](_0x46ec12=>_0x46ec12['id']===_0x3bda0b),_0x5b7b71=_0x2ef874['type'];'chat'===_0x5b7b71?this['_runChatShortcut'](_0x2ef874):'review'===_0x5b7b71?_0x2ef874['commandId']?this['_runReviewShortcut'](_0x2ef874):this['_switchTab']('reviewMode'):'translate'===_0x5b7b71&&(_0x2ef874['language']?this['_runTranslateShortcut'](_0x2ef874):this['_switchTab']('translate'));}_switchTab(_0x2b17f4){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x2b17f4});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x2b17f4);}async _runChatShortcut({id:_0x34d0a8,prompt:_0x50609b,draftMode:_0x2d79ea,useWebSearch:_0x5377b3=!0x1,useReasoning:_0x17f315=!0x1,model:_0x2bcabb}){const _0x47a7ed=this['context']['plugins']['get']('AIChatController'),_0x765768=_0x47a7ed['activeConversation'],_0x49d51d=this['context']['plugins']['get'](fs),_0x3be021=await _0x49d51d['models']['resolveModel'](_0x2bcabb);_0x3be021&&await _0x765768['setModel'](_0x3be021),_0x765768['setWebSearch'](_0x5377b3),_0x765768['setReasoning'](_0x17f315);const _0x11d643=_0x49d51d['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x34d0a8],'idScopedOnly':!0x0,'context':new Yn()});_0x765768['addDefaultContext'](_0x11d643['refs']),_0x47a7ed['addCurrentDocumentToChatContext'](),_0x2d79ea?(this['_aiChatUI']['setPromptInputValue'](_0x50609b),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x47a7ed['sendMessage']({'message':_0x50609b});}_runReviewShortcut({commandId:_0x8d17ca,model:_0x4f66e5,prompt:_0x4b7659,params:_0x468ab4}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x43ad6c={'id':_0x8d17ca,'isCustom':'custom'===_0x8d17ca};_0x4f66e5&&_0x4b7659&&(_0x43ad6c['args']={'model':_0x4f66e5,'prompt':_0x4b7659}),_0x468ab4&&(_0x43ad6c['params']=_0x468ab4),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x43ad6c);}_runTranslateShortcut({language:_0x3fddea}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x3fddea,'args':{'language':_0x3fddea}});}},Pa=class extends _0x55187e{constructor(_0x2134c1){super(_0x2134c1);const _0x53d44c=_0x2134c1['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x53d44c,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x1bc1e9=this['editor']['plugins']['get']('AITabs')['view'];_0x1bc1e9['isVisible']=!_0x1bc1e9['isVisible'];}},Da=class extends _0x3e375b{static get requires(){return[gs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x8f2c59=this['editor'];_0x8f2c59['commands']['add']('toggleAi',new Pa(_0x8f2c59)),_0x8f2c59['ui']['componentFactory']['add']('toggleAi',()=>{const _0x11c267=this['_createAIUIButton'](Mt);return _0x11c267['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x11c267;}),_0x8f2c59['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x57b992=this['_createAIUIButton'](Zt);return _0x57b992['set']({'role':'menuitemcheckbox'}),_0x57b992;});}_createAIUIButton(_0xc473e4){const _0x5de5ee=this['editor'],_0xbb73e1=_0x5de5ee['commands']['get']('toggleAi'),_0x374130=new _0xc473e4(_0x5de5ee['locale']);return _0x374130['set']({'label':Es(_0x5de5ee['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x56b3bc,'isToggleable':!0x0}),_0x374130['bind']('isEnabled')['to'](_0xbb73e1),_0x374130['bind']('isOn')['to'](_0xbb73e1,'value',_0x23eb9d=>!!_0x23eb9d),this['listenTo'](_0x374130,'execute',()=>{_0xbb73e1['execute']();}),_0x374130;}};const Ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Ma=class extends _0x3faf4e{['_errorView'];constructor(_0x187001){super(_0x187001),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x2542ac){this['showError'](_0x2542ac);}['showError'](_0xf95815){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xf95815,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x496e6a=new _0x3faf4e(this['locale']),_0x2ca2f7=new _0x3faf4e(this['locale']);return _0x2ca2f7['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x496e6a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0xfea200=>!_0xfea200)]},'children':[_0x2ca2f7]}),_0x496e6a;}};const Ua=0xa;var Va=class extends _0x2b8fcb{static get requires(){return[tn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x296ce9){const {id:_0x2e2d5c}=this['_currentConfig']??{};this['_currentConfig']=_0x296ce9,this['_editor']=_0x296ce9['targetEditor'];const {id:_0x5bd278}=this['_currentConfig'];this['isOpen']&&_0x2e2d5c===_0x5bd278?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x4dd41c=this['_editor'];if(!_0x4dd41c)return;const _0x3226d3=_0x4dd41c['plugins']['get']('Dialog');_0x3226d3['isOpen']&&this['_currentConfig']&&_0x3226d3['id']===this['_currentConfig']['id']&&_0x3226d3['hide']();}_updateDialog(){const _0x986f39=this['_editor']['plugins']['get']('Dialog'),{icon:_0x31187b,title:_0x2ab7e8}=this['_currentConfig'];_0x986f39['view']?.['headerView']&&(_0x986f39['view']['headerView']['label']=_0x2ab7e8,_0x986f39['view']['headerView']['iconView']&&_0x31187b&&(_0x986f39['view']['headerView']['iconView']['content']=_0x31187b)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x986f39['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](tn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](tn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x53f348=this['_editor']['plugins']['get']('Dialog'),{id:_0xc0a25e,title:_0x369253,icon:_0x17822c,class:_0x409441,mainView:_0x4f2394}=this['_currentConfig'];_0x4f2394['delegate'](...Ha)['to'](this),_0x53f348['show']({'title':_0x369253,'icon':_0x17822c,'hasCloseButton':!0x0,'id':_0xc0a25e,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x409441||''),'content':_0x4f2394,'onShow':_0x1babd9=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x1babd9['view']?.['updatePosition']();const _0x4a6704=this['_getSelectionElements']();_0x4a6704&&_0x4a6704[0x0]&&Ot({'target':_0x4a6704[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x1babd9['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0xc0a25e});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0xc0a25e}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x1c20b7,_0x3da522,_0x5c3b03){const _0x5a31d6=_0x3da522||_0x5c3b03;if(!_0x5a31d6)return null;const _0x199fc8=this['_getSelectionElements']();if(!_0x199fc8||0x0===_0x199fc8['length'])return{'left':Math['round'](_0x5a31d6['left']+_0x5a31d6['width']/0x2-_0x1c20b7['width']/0x2),'top':Math['round'](_0x5a31d6['top']+_0x5a31d6['height']/0x2-_0x1c20b7['height']/0x2)};const _0x4daca4=Math['round'](_0x5a31d6['left']+_0x5a31d6['width']/0x2-_0x1c20b7['width']/0x2),_0x41feaa=_0x199fc8['map'](_0x4bbdce=>new It(_0x4bbdce)),_0x4cacc5=_0x1c20b7['height'];return{'left':_0x4daca4,'top':this['_calculateOptimalTopPosition'](_0x41feaa,_0x4cacc5,_0x5a31d6)};}_calculateOptimalTopPosition(_0xff782b,_0x3c948c,_0x2d97b6){const _0xda4ce8=new It(wt['window']),_0x2ac0e4=_0xff782b['map'](_0x4aa6cb=>_0x4aa6cb['getVisible']())['filter'](_0x2e3477=>_0x2e3477),_0x46e4ed=It['getBoundingRect'](_0x2ac0e4);if(!_0x46e4ed)return Math['round'](_0x2d97b6['top']+_0x2d97b6['height']/0x2);const _0x367f2a=_0xda4ce8['getIntersection'](_0x46e4ed);if(!_0x367f2a)return Math['round'](_0x2d97b6['top']+_0x2d97b6['height']/0x2);const _0x3cc0e9=_0x2d97b6['getVisible'](),_0x3da7ed=_0x3cc0e9&&_0x46e4ed['height']>_0x3cc0e9['height'],_0xa96745=_0x367f2a['top'],_0x2eb0f9=_0x367f2a['bottom'];if(_0x3da7ed){const _0x4005e9=_0xda4ce8['top']+_0xda4ce8['height']/0x2-_0x3c948c/0x2,_0x29c1a6=_0xa96745-Ua-_0xda4ce8['top'],_0x48ba34=_0xda4ce8['bottom']-_0x2eb0f9-Ua;return _0x29c1a6>=_0x3c948c?Math['max'](Ua,_0xa96745-_0x3c948c-Ua):_0x48ba34>=_0x3c948c?_0x2eb0f9+Ua:Math['max'](Ua,_0x4005e9);}const _0x43e62b=_0xa96745-_0x3c948c,_0x534927=_0xda4ce8['bottom']-_0x2eb0f9-Ua,_0x1831ee=_0xa96745-Ua-_0xda4ce8['top'];let _0x3a59df;return _0x3a59df=_0x534927>=_0x3c948c?_0x2eb0f9+Ua:_0x1831ee>=_0x3c948c?_0x43e62b-Ua:_0xa96745+_0x46e4ed['height']/0x2-_0x3c948c/0x2,_0x3a59df;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x4dcf9c=this['_editor'];this['listenTo'](_0x4dcf9c['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x4f8e54,data:{newRange:_0x50f16c}}of _0x4dcf9c['model']['document']['differ']['getChangedMarkers']())if(_0x4f8e54['startsWith']('ai-selection:')&&(_0x50f16c&&(_0x50f16c['start']['isEqual'](_0x50f16c['end'])||'$graveyard'==_0x50f16c['root']['rootName'])||null==_0x50f16c)){const _0x2414de=Es(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x2414de),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0xecd14=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0xecd14['model']['document']);}_getSelectionElements(){const _0x501e1c=this['_editor'];return _0x14fbe5(_0x501e1c['editing'],[..._0x501e1c['model']['markers']['getMarkersGroup']('ai-selection'),..._0x501e1c['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x54a530=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x54a530&&_0x54a530['rootName']?_0x54a530['rootName']:null;}},Ba=class extends _0x372a41{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0xde5ed0,_0x57dff5={}){super(_0xde5ed0),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x57dff5};const _0x1b9491=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1b9491?'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(_0xbd1f31){this['showChangesButton']['isEnabled']=_0xbd1f31;}_setupRatingButtons(){this['likeButton']=new Mt(this['locale']),this['likeButton']['set']({'icon':at,'label':Es(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Dn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Mt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Es(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Dn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Mt(this['locale']),this['copyButton']['set']({'icon':_0x3cbf87,'label':Es(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Dn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x55be8b=new $t();_0x55be8b['set']({'content':_0x884ad8}),_0x55be8b['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'+Dn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Dn;},0x7d0);}),this['copyButton']['children']['add'](_0x55be8b);}_setupShowChangesButton(){this['showChangesButton']=new Mt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Es(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Dn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x28372e=>_0x28372e?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ga=class extends Ma{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x15edea,_0x20099c){super(_0x15edea);const _0x2e21e4=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x20099c,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new mr(_0x15edea),this['_partToolbarView']=new Ir(_0x15edea,_0x20099c['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x43128a,_0x42d72d)=>!_0x43128a&&!_0x42d72d),this['_togglePartToolbarButtonsVisibility'](_0x20099c),this['_stateView']=new gr(_0x15edea),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Ba(_0x15edea,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Fa(_0x15edea,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x20c721,_0x402579,_0x53d434,_0xfd819b)=>{let _0x3b5396,_0x5029f8;'pending'===_0xfd819b?(_0x3b5396=this['_partToolbarView'],_0x5029f8=this['_stateView']):(_0x3b5396=this['_stateView'],_0x5029f8=this['_partToolbarView']),this['_stateView']['setState'](_0x53d434,this['_outdatedReason']),_0x3b5396['isVisible']=!0x1,_0x5029f8['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x2e21e4['to']('_state',_0xfa5d19=>'ck-ai-chat-balloon-main_state_'+_0xfa5d19)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x20099c);});}['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(_0x4951d5){_0x4951d5?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x4951d5);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x463bcd,_0x34427d){this['_outdatedReason']=_0x34427d,this['_state']=_0x463bcd;}['showError'](_0x3a8539){super['showError'](_0x3a8539),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x4151db){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x4151db;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x45fdb4,showSuggestButton:_0x341a8a}){_0x45fdb4=_0x45fdb4&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x341a8a=_0x341a8a&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x45fdb4,'showSuggestButton':_0x341a8a});}_createNextButtonView(){const _0x27894e=new Mt(this['locale']);return _0x27894e['set']({'icon':_0x3264af,'label':Es(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x27894e['on']('execute',()=>{this['fire']('showNext');}),_0x27894e;}_createPreviousButtonView(){const _0x140773=new Mt(this['locale']);return _0x140773['set']({'icon':_0x28ea88,'label':Es(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x140773['on']('execute',()=>{this['fire']('showPrevious');}),_0x140773;}},Fa=class extends _0x3faf4e{constructor(_0x553dca,_0xedb6b8){super(_0x553dca),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0xedb6b8});}},Ka=class extends _0x3e375b{static get requires(){return[Ut,Va];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x48355e){super(_0x48355e),this['set']('showDiff',!0x1);}['open'](_0x8043af){const _0x308df9=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x308df9['plugins']['get']('AIBalloon')['open']({..._0x8043af,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x8043af['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x8043af['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x8043af['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x4371ac){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x4371ac);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x1ccca1,_0x4e1410){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x1ccca1,_0x4e1410);}setTargetReadOnly(_0xae6a47){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0xae6a47);}_createChatBalloonView(){const _0x5c60ec=this['editor'],_0xda7dbe=_0x5c60ec['plugins']['get']('AIBalloon'),_0xb1f1e1=_0x5c60ec['commands']['get']('trackChanges');let _0x4e1b10=_0x5c60ec['config']['get']('ai.availableReplyActions')||[...Or];_0x5c60ec['plugins']['has']('TrackChanges')||(_0x4e1b10=_0x4e1b10['filter'](_0x296e51=>'insertSuggestion'!=_0x296e51));const _0x5897a1=new Ga(_0x5c60ec['locale'],{'availableActions':_0x4e1b10,'showApplyButton':!0x0,'showSuggestButton':!!_0xb1f1e1});return _0x5897a1['bind']('showDiff')['to'](this),_0x5897a1['delegate'](...ir)['to'](this),_0x5897a1['delegate']('showPrevious','showNext')['to'](this),_0xda7dbe['delegate']('dialogClosed')['to'](this),_0x5897a1['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5897a1['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5897a1['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xb1f1e1&&_0x5897a1['bind']('isTrackChangesOn')['to'](_0xb1f1e1,'value'),_0x5897a1['render'](),_0x5897a1;}_toggleRotatorButtonsInDialogHeader(_0x224899){const _0x2af1a7=this['editor'],_0x5e7680=_0x2af1a7['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x224899),_0x5e7680['has'](this['_chatBalloonView']['previousButtonView'])||(_0x5e7680['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2af1a7['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x5e7680['remove'](this['_chatBalloonView']['previousButtonView']),_0x5e7680['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},Wa=class extends _0x3e375b{static get requires(){return[Da,Ka,_0x4cc16e];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ya(_0x36ea2b){const {editor:_0x5d9980,action:_0x3b1906,withText:_0x203711=!0x1,withIcon:_0x1bcbd4=!0x0,isInDropdown:_0x1db1e6=!0x0,shouldPreventFocus:_0xfba4e0=!0x1,actionButtons:_0x1ff493}=_0x36ea2b;return()=>{const _0x4a8019=_0x5d9980['locale'],_0x794a3d=new Mt(_0x4a8019),_0x1a9d75=_0x794a3d['bindTemplate'];_0x1db1e6&&_0x794a3d['extendTemplate']({'on':{'mouseenter':_0x1a9d75['to'](()=>{_0xfba4e0&&_0xfba4e0()||_0x794a3d['focus']();})}}),_0x1ff493['push']({'buttonView':_0x794a3d,'action':_0x3b1906});const _0x314a65=_0x3b1906['icon']??_0x3b1906['parent']?.['icon'];return _0x794a3d['set']({'label':_0x3b1906['label'],'withText':_0x203711,'role':'menuitem','icon':_0x1bcbd4?_0x314a65??_0x5b0bbe:void 0x0,'tooltip':!_0x203711,'class':'ck-ai-quick-actions-button','isEnabled':_0x3b1906['isEnabled']}),_0x794a3d['on']('execute',()=>{_0x5d9980['editing']['view']['focus'](),_0x5d9980['commands']['execute']('aiQuickAction',_0x3b1906);}),_0x794a3d;};}var $a=class extends Xt{['arrowView'];constructor(_0x24d699,_0x11a5b8){super(_0x24d699,_0x11a5b8);const _0x130a2d=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',_0x19603a=>String(_0x19603a)),'data-cke-tooltip-disabled':_0x130a2d['to']('isOn')},'on':{'mouseenter':_0x130a2d['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x39da5e=new $t();return _0x39da5e['content']=_0x1da0ec,_0x39da5e['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x39da5e;}},qa=class extends Jt{_allListItems;_allSearchableItems;constructor(_0x4c2fe5,_0x41baf4,_0x445c18){super(_0x4c2fe5),this['_allListItems']=_0x41baf4,this['_allSearchableItems']=_0x445c18;}filter(_0x188865){if(!_0x188865)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4d25dc=_0x188865['source']['toLowerCase']()['trim'](),_0x3dde76=this['_allSearchableItems']['filter'](_0xf48ebe=>(_0xf48ebe['groupLabel']?_0xf48ebe['label']+'\x20('+_0xf48ebe['groupLabel']+')':_0xf48ebe['label'])['toLowerCase']()['includes'](_0x4d25dc));return this['items']['clear'](),this['items']['addMany'](_0x3dde76['sort']((_0x3b67ac,_0x2f08ad)=>{const _0x157ef9=_0x3b67ac['groupLabel'],_0xeca7b0=_0x2f08ad['groupLabel'];return _0x157ef9||_0xeca7b0?_0x157ef9?0x1:-0x1:0x0;})['map'](_0x5520c7=>_0x5520c7['item'])),this['_highlightQuery'](_0x4d25dc,_0x3dde76),{'resultsCount':_0x3dde76['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x199760,_0x17f128){if(!_0x199760)return;const _0x3c5623=new RegExp(_0x5f86da(_0x199760),'gi');_0x17f128['forEach'](_0x2a2ab1=>{_0x2a2ab1['highlightViews']&&_0x2a2ab1['highlightViews']['forEach'](_0x1cc878=>{'function'==typeof _0x1cc878['highlightText']&&_0x1cc878['highlightText'](_0x3c5623);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x2e2d86=>{_0x2e2d86['highlightViews']&&_0x2e2d86['highlightViews']['forEach'](_0x4a21ad=>{'function'==typeof _0x4a21ad['highlightText']&&_0x4a21ad['highlightText'](null);});});}};const Qa='menu',Xa='menuitem';var za=class extends _0x3faf4e{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x26b0cc,_0x31f746,_0x514b8f,_0x2c3681,_0x502321=!0x1,_0x447ba4=[]){const _0x12a63e=_0x26b0cc['locale'];super(_0x12a63e),this['_bodyCollection']=_0x2c3681,this['_hasSearch']=_0x502321,this['_actionButtons']=_0x447ba4;const _0x5c67fd=this['_createListItems'](_0x26b0cc,_0x31f746,_0x514b8f);this['optionsListView']=new qa(_0x12a63e,_0x5c67fd,this['_allSearchableItems']),this['optionsListView']['role']=Qa,this['optionsListView']['items']['addMany'](_0x5c67fd),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x502321&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x5c67fd,this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x502321&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x5eb62f=_0x502321&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x5b3174(_0x5eb62f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x12a63e['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x2e5362(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Es(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x4f2f2b=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x4f2f2b);}_createListItems(_0x1bd907,_0x10ee6b,_0x20d0d5){const _0x45f420=new _0x5b3174();return _0x10ee6b['forEach'](_0x4385dd=>{if('actions'in _0x4385dd){const {listItem:_0xb5da6c}=this['_createActionGroupButton'](_0x1bd907,_0x4385dd,_0x20d0d5);_0x45f420['add'](_0xb5da6c),_0x4385dd['actions']['forEach'](_0x2dfc50=>{const {listItem:_0x47a55d,highlightViews:_0x2aadd8}=this['_createSearchResultActionButton'](_0x1bd907,_0x2dfc50,_0x4385dd['label'],_0x4385dd['icon']);this['_allSearchableItems']['push']({'item':_0x47a55d,'label':_0x2dfc50['label'],'groupLabel':_0x4385dd['label'],'highlightViews':_0x2aadd8});});}else{const {listItem:_0x3cc613}=this['_createActionButton'](_0x1bd907,_0x4385dd);_0x45f420['add'](_0x3cc613);const _0x4aa43e=_0x3cc613['children']['first'];if(_0x4aa43e){const {listItem:_0x552ab4,highlightViews:_0x5699f5}=this['_createSearchResultActionButton'](_0x1bd907,_0x4385dd);this['_allSearchableItems']['push']({'item':_0x552ab4,'label':_0x4aa43e['label']||'','highlightViews':_0x5699f5});}}}),_0x45f420;}_createActionButton(_0x12856e,_0x5550f1,_0x3ad203,_0x4c75aa){const _0x52d8a3=new jt(this['locale']);if(_0x3ad203&&_0x4c75aa){const _0x1cac55=new Mt(this['locale']),_0x4683a7=_0x1cac55['bindTemplate'],_0x1ff282=new Yt();_0x1ff282['text']=_0x5550f1['label'];const _0x16c408=new Yt();_0x16c408['text']=_0x3ad203;const _0x16843b=new $t();_0x16843b['content']=_0x4c75aa,_0x16843b['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5f42af=new _0x3faf4e(this['locale']);_0x5f42af['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x1f9795=new _0x3faf4e(this['locale']);return _0x1f9795['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x1cac55['set']({'label':_0x5550f1['label']+'\x20('+_0x3ad203+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x5550f1['isEnabled']}),_0x1cac55['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x4683a7['if']('isEnabled','ck-disabled',_0x232c4e=>!_0x232c4e)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1ff282,_0x5f42af,_0x16843b,_0x16c408,_0x1f9795],'on':{'mouseenter':_0x4683a7['to'](()=>{this['_isSearchFocused']()||_0x1cac55['focus']();}),'click':_0x4683a7['to'](()=>{_0x1cac55['fire']('execute');})}}),_0x1cac55['on']('execute',()=>{_0x1cac55['isEnabled']&&(_0x12856e['editing']['view']['focus'](),_0x12856e['commands']['execute']('aiQuickAction',_0x5550f1));}),_0x52d8a3['children']['add'](_0x1cac55),this['_actionButtons']['push']({'buttonView':_0x1cac55,'action':_0x5550f1}),{'listItem':_0x52d8a3,'highlightViews':[_0x1ff282,_0x16c408]};}{const _0x425ed3=new Ht(),_0x130742=new Mt(this['locale'],_0x425ed3),_0x341ac3=_0x130742['bindTemplate'],_0x2167f0=_0x5550f1['icon']??_0x5550f1['parent']?.['icon'],_0x1e586c=void 0x0!==_0x5550f1['icon'];return _0x130742['set']({'label':_0x5550f1['label'],'withText':!0x0,'role':'menuitem','icon':_0x1e586c?_0x2167f0??_0x5b0bbe:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x5550f1['isEnabled']}),_0x130742['extendTemplate']({'on':{'mouseenter':_0x341ac3['to'](()=>{this['_isSearchFocused']()||_0x130742['focus']();})}}),_0x130742['on']('execute',()=>{_0x12856e['editing']['view']['focus'](),_0x12856e['commands']['execute']('aiQuickAction',_0x5550f1);}),_0x52d8a3['children']['add'](_0x130742),this['_actionButtons']['push']({'buttonView':_0x130742,'action':_0x5550f1}),{'listItem':_0x52d8a3,'highlightViews':[_0x425ed3]};}}_createSearchResultActionButton(_0x2fa5dc,_0x2ae83c,_0x1e5dc0,_0x5cb495){return _0x1e5dc0&&_0x5cb495?this['_createSearchResultGroupedActionButton'](_0x2fa5dc,_0x2ae83c,_0x1e5dc0,_0x5cb495):this['_createSearchResultIndividualActionButton'](_0x2fa5dc,_0x2ae83c);}_createSearchResultGroupedActionButton(_0x3e324e,_0x428ef3,_0x318ae1,_0x13b858){const _0x1ad142=new jt(this['locale']),_0x400060=new Mt(this['locale']),_0x179cda=_0x400060['bindTemplate'],{view:_0x21db9c,highlightView:_0x312adf}=this['_createSearchResultGroupRow'](_0x318ae1,_0x13b858),{view:_0x512d52,highlightView:_0x1d24f9}=this['_createSearchResultActionRow'](_0x428ef3['label']),_0x243646=this['_createSearchResultContentView'](_0x21db9c,_0x512d52);return _0x400060['set']({'label':_0x428ef3['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':_0x428ef3['isEnabled']}),_0x400060['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',_0x179cda['if']('isEnabled','ck-disabled',_0x8fb5c4=>!_0x8fb5c4)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x243646],'on':{'mouseenter':_0x179cda['to'](()=>{this['_isSearchFocused']()||_0x400060['focus']();}),'click':_0x179cda['to'](()=>{this['_handleSearchResultButtonClick'](_0x400060);})}}),this['_setupActionButtonExecution'](_0x400060,_0x3e324e,_0x428ef3),_0x1ad142['children']['add'](_0x400060),this['_actionButtons']['push']({'buttonView':_0x400060,'action':_0x428ef3}),{'listItem':_0x1ad142,'highlightViews':[_0x312adf,_0x1d24f9]};}_createSearchResultIndividualActionButton(_0x5da1fc,_0xdb3d55){const _0x149abc=new jt(this['locale']),_0x26a967=new Ht(),_0x2a07d3=new Mt(this['locale'],_0x26a967),_0x1dbc4f=_0x2a07d3['bindTemplate'];return _0x2a07d3['set']({'label':_0xdb3d55['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0xdb3d55['isEnabled']}),_0x2a07d3['extendTemplate']({'on':{'mouseenter':_0x1dbc4f['to'](()=>{this['_isSearchFocused']()||_0x2a07d3['focus']();})}}),this['_setupActionButtonExecution'](_0x2a07d3,_0x5da1fc,_0xdb3d55),_0x149abc['children']['add'](_0x2a07d3),this['_actionButtons']['push']({'buttonView':_0x2a07d3,'action':_0xdb3d55}),{'listItem':_0x149abc,'highlightViews':[_0x26a967]};}_createSearchResultGroupRow(_0x52bc18,_0xf70aa2){const _0x4872fb=new _0x3faf4e(this['locale']),_0x3a8877=new $t();_0x3a8877['content']=_0xf70aa2,_0x3a8877['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2cc84d=new Yt();return _0x2cc84d['text']=_0x52bc18,_0x4872fb['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x3a8877,_0x2cc84d]}),{'view':_0x4872fb,'highlightView':_0x2cc84d};}_createSearchResultActionRow(_0x1da80a){const _0x40e222=new _0x3faf4e(this['locale']),_0x219d02=new Yt();return _0x219d02['text']=_0x1da80a,_0x40e222['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x219d02]}),{'view':_0x40e222,'highlightView':_0x219d02};}_createSearchResultContentView(_0x11edf3,_0x535c18){const _0x56e3b9=new _0x3faf4e(this['locale']);return _0x56e3b9['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x11edf3,_0x535c18]}),_0x56e3b9;}_setupActionButtonExecution(_0xa81c07,_0x16896d,_0x5c5b5d){_0xa81c07['on']('execute',()=>{_0xa81c07['isEnabled']&&(_0x16896d['editing']['view']['focus'](),_0x16896d['commands']['execute']('aiQuickAction',_0x5c5b5d));});}_createActionGroupButton(_0x8deb43,_0x505403,_0x289423){const _0x1d4214=new jt(this['locale']),_0x386665=new Ht(),_0x59f146=new $a(this['locale'],_0x386665),_0x44f401=_0x59f146['bindTemplate'],_0x193251=this['_getPanelKeystroke'](_0x289423),_0x1fef27=this['_createGroupActionsList'](_0x8deb43,_0x505403['actions'],_0x289423);_0x59f146['set']({'label':_0x505403['label'],'withText':!0x0,'role':Xa,'icon':_0x505403['icon']??_0x5b0bbe,'isEnabled':_0x505403['actions']['some'](_0xdfbe0c=>_0xdfbe0c['isEnabled'])}),_0x59f146['extendTemplate']({'on':{'mouseenter':_0x44f401['to'](()=>{this['_isSearchFocused']()||_0x59f146['focus']();})}});const _0xf2268=new xt(this['locale']);return _0xf2268['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x44f401['to'](_0x715856=>{this['_handlePanelKeydown'](_0x715856,_0x193251,_0x59f146,_0xf2268);})}}),_0x59f146['bind']('isOn')['to'](_0xf2268,'isVisible'),this['_bodyCollection']['add'](_0xf2268),_0xf2268['content']['add'](_0x1fef27),this['_setupGroupMenuBehavior'](_0x59f146,_0xf2268),_0x1d4214['children']['add'](_0x59f146),this['_actionButtons']['push']({'buttonView':_0x59f146,'action':_0x505403}),{'listItem':_0x1d4214,'highlightView':_0x386665};}_createGroupActionsList(_0x10623e,_0x1e5ab2,_0x3abb21){const _0x304d4a=new Jt(this['locale']);return _0x304d4a['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x1e5ab2['forEach'](_0x30b295=>{const _0xea8426=new jt(this['locale']),_0x58ba82=Ya({'editor':_0x10623e,'action':_0x30b295,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0xea8426['children']['add'](_0x58ba82),_0x3abb21['focusTracker']['add'](_0x58ba82),_0x304d4a['items']['add'](_0xea8426);}),_0x304d4a;}_setupGroupMenuBehavior(_0x19f63e,_0x1d2a48){const _0x5c78ed=_0x19f63e['bindTemplate'],_0x3ed535=this['_getButtonKeystroke'](_0x19f63e);_0x19f63e['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x5c78ed['to'](()=>{this['_showNestedPanel'](_0x1d2a48,_0x19f63e);}),'mouseleave':_0x5c78ed['to'](_0x27259b=>{const _0x3298a7=_0x27259b['relatedTarget'];this['_isMovingToNestedMenu'](_0x3298a7,_0x1d2a48)||this['_hideNestedPanel'](_0x1d2a48);}),'keydown':_0x5c78ed['to'](_0x2d513f=>{_0x2d513f['key']==_0x3ed535&&(this['_showNestedPanel'](_0x1d2a48,_0x19f63e),_0x1d2a48['content']['get'](0x0)['focus']());})}}),_0x1d2a48['on']('render',()=>{_0x1d2a48['element']?.['addEventListener']('mouseleave',_0x3435fe=>{const _0x2567f5=_0x3435fe['relatedTarget'];_0x19f63e['element']?.['contains'](_0x2567f5)||this['_isMovingToNestedMenu'](_0x2567f5,_0x1d2a48)||this['_hideNestedPanel'](_0x1d2a48);});});}_showNestedPanel(_0x5f759e,_0x41a2da){this['_openNestedPanels']['forEach'](_0x4f9ff3=>{_0x4f9ff3!==_0x5f759e&&_0x4f9ff3['isVisible']&&_0x4f9ff3['hide']();}),_0x5f759e['show'](),_0x5f759e['pin']({'positions':[Bt['eastSouth']],'target':_0x41a2da['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x5f759e);}_hideNestedPanel(_0x44f2ee){_0x44f2ee['hide'](),this['_openNestedPanels']['delete'](_0x44f2ee);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x35df60=>_0x35df60['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0xc7f43e,_0x2f478b){if(!_0xc7f43e)return!0x1;if(_0x2f478b['element']?.['contains'](_0xc7f43e))return!0x0;const _0x4d7bd3=_0xc7f43e;return _0x4d7bd3['closest']&&(null!==_0x4d7bd3['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x4d7bd3['closest']('.ck-ai-quick-actions-group-list')||null!==_0x4d7bd3['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(_0x142739){return'rtl'===_0x142739['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x2635c2){return'rtl'===_0x2635c2['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x2aff99,_0x4347f8,_0x467f4b,_0x3a2887){_0x2aff99['key']==_0x4347f8&&(_0x467f4b['focus'](),this['_hideNestedPanel'](_0x3a2887));}_handleSearchResultButtonClick(_0x14898d){_0x14898d['fire']('execute');}};function ja(_0x50a7b4){const {editor:_0x25d4a4,content:_0x5e0942,buttonDefinition:_0xef6a37,bodyCollection:_0x35c083,hasSearch:_0x2f0770=!0x1,actionButtons:_0x3e8a4c}=_0x50a7b4;return()=>{const _0x2cdaef=_0x25d4a4['locale'],_0x5d9d0a=_0x25d4a4['commands']['get']('aiQuickAction'),_0x2895a9=_0x48d908(_0x2cdaef);_0x2895a9['bind']('isEnabled')['to'](_0x5d9d0a),_0x2895a9['buttonView']['set']({'icon':_0xef6a37['icon']??_0x5b0bbe,'label':_0xef6a37['label'],'tooltip':!0x0}),_0x2895a9['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x36402c=new za(_0x25d4a4,_0x5e0942,_0x2895a9,_0x35c083,_0x2f0770,_0x3e8a4c);return _0x2895a9['panelView']['children']['add'](_0x36402c),_0x2f0770&&_0x2895a9['on']('change:isOpen',(_0x154a89,_0x30927f,_0x26d41d)=>{if(_0x26d41d){if(_0x25d4a4['plugins']['has']('AIEditing')){const _0xa20a7b=_0x25d4a4['plugins']['get'](tn),_0x4074c7=_0x25d4a4['model']['document']['selection'],_0x2c8762=Array['from'](_0x4074c7['getRanges']());_0x2c8762['length']>0x0&&_0xa20a7b['showFakeVisualSelection']({'editor':_0x25d4a4,'ranges':_0x2c8762,'id':'quick-action','priority':0x14});}}else _0x25d4a4['plugins']['has']('AIEditing')&&_0x25d4a4['plugins']['get'](tn)['hideFakeVisualSelection']('quick-action'),_0x36402c['resetSearch']();}),_0x2895a9;};}const Ja='<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>',Za='<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>',th='<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>',eh=/* #__PURE__ -- @preserve */
|
|
37
|
-
((()=>({'chat':'AIChat','action':'AIActions'}))());var ih=class AIQuickActionsUI extends _0x3e375b{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Lt,Is,Nn,fs];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiquickactions');const _0x47a5ea=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x47a5ea),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x518c78){return function(_0x1337ef){const _0x47f33f=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x1337ef['uiLanguage'])||'English';return[{'id':'ask-ai','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x46bf06},{'id':'chat-commands','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x46bf06,'actions':[{'id':'explain','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Es(_0x1337ef,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Ja['replace']('%0',_0x47f33f),'type':'chat'},{'id':'summarize','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Es(_0x1337ef,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Za['replace']('%0',_0x47f33f),'type':'chat'},{'id':'highlight-key-points','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Es(_0x1337ef,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':th['replace']('%0',_0x47f33f),'type':'chat'}]},{'id':'improve-writing','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x1ab44b},{'id':'continue','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x1661e7},{'id':'fix-grammar','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x30dda9},{'id':'adjust-length','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2c956b,'actions':[{'id':'make-shorter','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2bcd87,'actions':[{'id':'make-tone-casual','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0xa83078,'actions':[{'id':'translate-to-english','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Es(_0x1337ef,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x3999fe,'actions':[]}];}(_0x518c78);}_getDefaultAndCustomActions(){const _0x331204=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x5d304e=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x54e6f3=>({..._0x54e6f3,'type':'chat'===_0x54e6f3['type']?'chat':'action','icon':void 0x0}));return _0x331204['find'](_0x4653af=>'other'===_0x4653af['id'])['actions']['push'](..._0x5d304e),_0x331204;}async _initActionTypeQuickActions(){try{const _0x3a4203=this['editor']['plugins']['get'](fs),_0x2c9789=await _0x3a4203['models']['getAllModels'](),_0x26c544=(await _0x3a4203['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x26c544),this['_enableButtonsByType']('action',_0x4aaaf8=>!!_0x2c9789['find'](_0x588f36=>_0x588f36['id']===_0x4aaaf8['model'])||void 0x0===_0x4aaaf8['model']);}catch(_0x62b90f){const _0xe930fa=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x62b90f});this['_reporter']['logError'](_0xe930fa);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x4505d7=this['editor']['plugins']['get']('AIChatController'),_0x42d20d=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x4505d7,'change:isConversationReady',(_0xc14a40,_0x212c8f,_0x25a420)=>{this['_enableButtonsByType']('chat',()=>_0x25a420&&!_0x42d20d?.['isBusy']);}),_0x42d20d&&this['listenTo'](_0x42d20d,'change:isBusy',(_0x21be57,_0x42292c,_0x5dca39)=>{this['_enableButtonsByType']('chat',()=>_0x4505d7['isConversationReady']&&!_0x5dca39);}),this['_enableButtonsByType']('chat',()=>_0x4505d7['isConversationReady']&&!_0x42d20d?.['isBusy']);}_enableButtonsByType(_0x1f25b0,_0x5631a6){this['_quickActionsDefinition']['forEach'](_0x10e0f5=>{'actions'in _0x10e0f5?_0x10e0f5['actions']['forEach'](_0x3db9b4=>{_0x3db9b4['type']===_0x1f25b0&&(_0x3db9b4['isEnabled']=_0x5631a6(_0x3db9b4));}):_0x10e0f5['type']===_0x1f25b0&&(_0x10e0f5['isEnabled']=_0x5631a6(_0x10e0f5));}),this['_actionButtons']['forEach'](_0x532e04=>{if(sh(_0x532e04['action']))return;if(_0x532e04['action']['type']!==_0x1f25b0)return;const _0x17d87d=_0x5631a6(_0x532e04['action']);if(_0x532e04['action']['isEnabled']=_0x17d87d,_0x532e04['buttonView']['isEnabled']=_0x17d87d,'action'===_0x1f25b0&&!_0x17d87d&&_0x532e04['action']['model']){const _0x195611=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x532e04['action']['id'],'modelId':_0x532e04['action']['model']});this['_reporter']['logError'](_0x195611);}}),this['_actionButtons']['filter'](_0x3273b7=>sh(_0x3273b7['action']))['forEach'](_0x520cbb=>{_0x520cbb['buttonView']['isEnabled']=_0x520cbb['action']['actions']['some'](_0x2ddbfd=>_0x2ddbfd['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x3be6dc,group:_0x494cca})=>{_0x3be6dc['isEnabled']=_0x494cca['actions']['some'](_0x2f7df6=>_0x2f7df6['isEnabled']);});}_enableButtonById(_0x195f1b,_0x254552){this['_quickActionsDefinition']['forEach'](_0x5f0162=>{'actions'in _0x5f0162?_0x5f0162['actions']['forEach'](_0x2c46e0=>{_0x2c46e0['id']===_0x195f1b&&(_0x2c46e0['isEnabled']=_0x254552(_0x2c46e0));}):_0x5f0162['id']===_0x195f1b&&(_0x5f0162['isEnabled']=_0x254552(_0x5f0162));}),this['_actionButtons']['forEach'](_0x446605=>{if(sh(_0x446605['action']))return;if(_0x446605['action']['id']!==_0x195f1b)return;const _0x32f702=_0x254552(_0x446605['action']);_0x446605['action']['isEnabled']=_0x32f702,_0x446605['buttonView']['isEnabled']=_0x32f702;});}_assignDefaultModelToCustomActions(_0x3280c1){this['_actionButtons']['forEach'](_0x3c8bf9=>{sh(_0x3c8bf9['action'])||'action'===_0x3c8bf9['action']['type']&&(_0x3c8bf9['action']['model']||(_0x3c8bf9['action']['model']=_0x3280c1));});}_initializeQuickActionsComponentsAndCommands(){const _0x227789=new Pt(this['editor']['locale']);_0x227789['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x227789),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x227789);}_initializeQuickActionsDropdown(_0x556a86){const _0x28cafa=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',ja({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x5b0bbe,'label':Es(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x556a86,'hasSearch':_0x28cafa,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x18fe93){this['_quickActionsDefinition']=_0x18fe93['map'](_0x5b69c4=>{if('actions'in _0x5b69c4){const _0xe7a0dc=_0x5b69c4;return{..._0xe7a0dc,'actions':_0xe7a0dc['actions']['map'](_0x2c2f91=>{const {actions:_0x4463cf,..._0x1e82fc}=_0xe7a0dc;return{..._0x2c2f91,'isEnabled':!0x1,'parent':_0x1e82fc};})['filter'](_0x465d71=>this['_shouldIncludeAction'](_0x465d71))};}return{..._0x5b69c4,'isEnabled':!0x1};})['filter'](_0x5aa20b=>'actions'in _0x5aa20b?_0x5aa20b['actions']['length']>0x0:this['_shouldIncludeAction'](_0x5aa20b));}_shouldIncludeAction(_0x1aff07){const _0x3eef16=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](eh[_0x1aff07['type']])&&!_0x3eef16['includes'](_0x1aff07['id'])&&!('chat'===_0x1aff07['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0xcfc60e){this['_quickActionsDefinition']['forEach'](_0x3c7d86=>{if('actions'in _0x3c7d86){const _0x4094f0=ja({'editor':this['editor'],'content':_0x3c7d86['actions'],'buttonDefinition':_0x3c7d86,'bodyCollection':_0xcfc60e,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3c7d86['id'],_0x4094f0),_0x3c7d86['actions']['forEach'](_0x20b677=>{const _0x47f8a2=Ya({'editor':this['editor'],'action':_0x20b677,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x20b677['id'],_0x47f8a2);});}else{const _0x70fd9c=Ya({'editor':this['editor'],'action':_0x3c7d86,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3c7d86['id'],_0x70fd9c);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0xf2f853=>{const _0x485bf0=this['editor']['commands']['get']('aiQuickAction'),_0x44da15=new _0x1b3951(_0xf2f853),_0x1ac710=Es(_0xf2f853,'AI_QUICK_ACTIONS_HEADING');_0x44da15['buttonView']['set']({'label':_0x1ac710,'icon':_0x5b0bbe});const _0x249d27=new _0x35c22f(_0xf2f853);return _0x249d27['set']({'ariaLabel':_0x1ac710,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x334525=>{if('actions'in _0x334525){const _0x1ede8a=_0x334525,_0x324ca5=new te(_0xf2f853,_0x44da15),_0x1fbde3=new _0x1b3951(_0xf2f853),_0x309229=new _0x35c22f(_0xf2f853);_0x1fbde3['buttonView']['set']({'label':_0x1ede8a['label'],'icon':_0x1ede8a['icon']}),_0x1ede8a['actions']['forEach'](_0x5329ca=>{const _0x42e0a1=new te(_0xf2f853,_0x1fbde3),_0x3a2b26=new Zt(_0xf2f853);_0x3a2b26['set']({'label':_0x5329ca['label'],'icon':_0x5329ca['icon'],'role':'menuitem','isEnabled':_0x5329ca['isEnabled']}),_0x3a2b26['on']('execute',()=>{this['_executeQuickAction'](_0x5329ca);}),this['_actionButtons']['push']({'buttonView':_0x3a2b26,'action':_0x5329ca}),_0x3a2b26['delegate']('execute')['to'](_0x1fbde3),_0x42e0a1['children']['add'](_0x3a2b26),_0x309229['items']['add'](_0x42e0a1);}),_0x1fbde3['isEnabled']=_0x1ede8a['actions']['some'](_0x2f4789=>_0x2f4789['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x1fbde3,'group':_0x1ede8a}),_0x1fbde3['panelView']['children']['add'](_0x309229),_0x324ca5['children']['add'](_0x1fbde3),_0x249d27['items']['add'](_0x324ca5);}else{const _0x2ad955=_0x334525,_0x4b3523=new te(_0xf2f853,_0x44da15),_0x53f77f=new Zt(_0xf2f853);_0x53f77f['set']({'label':_0x2ad955['label'],'icon':_0x2ad955['icon'],'role':'menuitem','isEnabled':_0x2ad955['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x53f77f,'action':_0x2ad955}),_0x53f77f['on']('execute',()=>{this['_executeQuickAction'](_0x2ad955);}),_0x53f77f['delegate']('execute')['to'](_0x44da15),_0x4b3523['children']['add'](_0x53f77f),_0x249d27['items']['add'](_0x4b3523);}}),Object['values'](eh)['some'](_0x466b5f=>this['editor']['plugins']['has'](_0x466b5f))?_0x44da15['bind']('isEnabled')['to'](_0x485bf0):_0x44da15['set']({'isEnabled':!0x1}),_0x44da15['panelView']['children']['add'](_0x249d27),_0x44da15;});}_executeQuickAction(_0x24ec3b){const _0x5b2f39=this['editor'];_0x5b2f39['editing']['view']['focus'](),_0x5b2f39['commands']['execute']('aiQuickAction',_0x24ec3b);const _0x3f5b52=_0x5b2f39['ui']['view']['menuBarView'];_0x3f5b52&&_0x3f5b52['close']&&_0x3f5b52['close']();}};function sh(_0x1a28fc){return'actions'in _0x1a28fc;}function nh(_0x49f6ff,_0x16a9dc){const _0x52ef75=_0x49f6ff['plugins']['get']('AITabs')['view'];_0x52ef75['isVisible']=!0x0,_0x52ef75['activateTab'](_0x16a9dc);}var rh=class extends _0x55187e{execute(_0x554224){switch(this['_expandSelectionIfCollapsed'](),_0x554224['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x4f906e=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x4f906e});}this['_handleAIChatAction'](_0x554224);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x5ca973=Es(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5ca973});}this['_handleAIActionsAction'](_0x554224);}}async _handleAIChatAction(_0x20d523){const _0x162a0b=this['editor']['plugins']['get']('AIChatController');if(nh(this['editor'],'chat'),'ask-ai'===_0x20d523['id'])_0x162a0b['removeSelectionFromChatContext'](),_0x162a0b['addSelectionToChatContext'](this['editor']),_0x162a0b['focusPromptInput']();else await _0x162a0b['startConversation']({'modelId':_0x20d523['model'],'contexts':this['_resolveActionContexts'](_0x20d523)}),_0x162a0b['removeSelectionFromChatContext'](),_0x162a0b['addSelectionToChatContext'](this['editor']),_0x162a0b['focusPromptInput'](),await _0x162a0b['sendMessage']({'message':_0x20d523['prompt']||_0x20d523['displayedPrompt']||_0x20d523['label'],'attributes':{'quickActionData':{'id':_0x20d523['id']},'displayedPrompt':_0x20d523['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x39cea9=this['editor'],_0x492140=_0x39cea9['model']['document']['selection'];if(!_0x492140['isCollapsed'])return;const _0x306efd=mt(_0x492140['getSelectedBlocks']())||_0x39cea9['model']['schema']['getLimitElement'](_0x492140);_0x39cea9['model']['change'](_0x5684fa=>{_0x5684fa['setSelection'](_0x306efd,'in');});}_handleAIActionsActionLabel(_0x2ac42f){return _0x2ac42f['parent']?.['label']&&'other'!==_0x2ac42f['parent']?.['id']?_0x2ac42f['parent']['label']+':\x20'+_0x2ac42f['label']:_0x2ac42f['label'];}async _handleAIActionsAction(_0xb3d31c){const _0x50a9c6=this['editor']['plugins']['get']('AIActions'),_0x2598b3=this['_resolveActionContexts'](_0xb3d31c);let _0x25e380;_0x25e380=_0xb3d31c['prompt']?{'userMessage':_0xb3d31c['prompt'],'model':_0xb3d31c['model'],'contexts':_0x2598b3}:_0xb3d31c['context']?{'model':_0xb3d31c['model'],'contexts':_0x2598b3}:{'actionName':_0xb3d31c['actionName']||_0xb3d31c['id'],'args':_0xb3d31c['args'],'contexts':_0x2598b3};const _0x48e4e0=this['_handleAIActionsActionLabel'](_0xb3d31c);await _0x50a9c6['executeAction'](_0x25e380,_0x48e4e0,_0xb3d31c['icon']);}_resolveActionContexts(_0xadd669){const _0x1908d8=_0xadd669['parent']?.['id']?[_0xadd669['id'],_0xadd669['parent']['id']]:[_0xadd669['id']];return this['editor']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x1908d8,'extraContexts':_0xadd669['context']?[_0xadd669['context']]:[],'context':new Yn()})['refs'];}},oh=class extends _0x3e375b{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x18ced5=this['editor'],_0x1b3e5e=new rh(this['editor']);if(_0x18ced5['commands']['add']('aiQuickAction',_0x1b3e5e),_0x18ced5['plugins']['has']('AIChat')){const _0x10ca27=this['editor']['plugins']['get']('AIChatController');_0x18ced5['model']['document']['selection']['on']('change:range',(_0x3eca69,_0x4cd89f)=>{_0x4cd89f['directChange']&&_0x10ca27['removeSelectionFromChatContext']();});}}},ah=class extends Vn{appendContent(_0x4be2b9,_0x5cd84a='text'){'modification'===this['type']&&'text'===_0x5cd84a&&(_0x5cd84a=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x4be2b9,_0x5cd84a);}updateChangeGroups(_0x4f47ca){const _0x3e8f15=this['parsedContent']['get'](_0x4f47ca)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x4f47ca,_0x3e8f15),this['changeGroups']=[],0x0==_0x3e8f15['childNodes']['length'])return;on(this['documentContextContent']['get'](_0x4f47ca),this['parsedMergedContent']['get'](_0x4f47ca));const _0x23a351=_0x4e9b8d(this['documentContextContent']['get'](_0x4f47ca)['children']['map'](_0x10679e=>({'node':_0x10679e,'id':Ps(_0x10679e,'data-id')})),_0x3e8f15['children']['map'](_0x3d2168=>({'node':_0x3d2168,'id':Ps(_0x3d2168,'data-id')||kt()})),{'comparator':(_0x2a8270,_0x38f90e)=>_0x2a8270['id']==_0x38f90e['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x23a351['length']&&_0x23a351[_0x23a351['length']-0x1]['removed'];)_0x23a351['pop']();}const _0x5beeec=_0x23a351['map'](_0x3f5b8d=>{const _0x5cbfee=_0x3f5b8d['added']?'new':_0x3f5b8d['removed']?'removed':'modified';return{'node':_0x3f5b8d['value'][0x0]['node'],'type':_0x5cbfee,'id':_0x3f5b8d['value'][0x0]['id']};}),_0x361565=this['_documentIdToSource']['get'](_0x4f47ca);this['changeGroups']['push']({'changes':_0x5beeec,'state':'pending','index':this['changeGroups']['length'],'editor':_0x361565['editor'],'rootName':_0x361565['rootName'],'documentId':_0x4f47ca});}_getDifferentChangeGroups(_0x34e43f,_0x2ccc4d){return _0x2ccc4d;}},hh=class extends Fn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x46a583){super(_0x46a583),this['content']=_0x46a583['content'],this['version']=_0x46a583['version'],this['editor']=_0x46a583['editor'],this['rootName']=_0x46a583['rootName'],this['actionName']=_0x46a583['actionName'],this['args']=_0x46a583['args'],this['userMessage']=_0x46a583['userMessage'],this['model']=_0x46a583['model'],this['contexts']=_0x46a583['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':kt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x1d993d){const _0x2262c5=this['editor']['config']['get']('collaboration.channelId'),_0x25b355=new ah({..._0x1d993d,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x2262c5,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x2262c5,this['editor']]])});return this['replies']['push'](_0x25b355),_0x25b355['delegate'](...Gn)['to'](this),this['fire']('replyCreated',_0x25b355),_0x25b355;}},ch=class extends _0x372a41{constructor(_0x4046ef,_0x3a1d0c=!0x0,_0x3a765c=!0x0){super(_0x4046ef),this['set']('isEnabled',!0x1),_0x3a1d0c&&(this['applyButton']=this['_createButton'](Es(_0x4046ef,'AI_BALLOON_APPLY_BUTTON'),Ln),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x3a765c&&(this['suggestButton']=this['_createButton'](Es(_0x4046ef,'AI_BALLOON_SUGGEST_BUTTON'),_0x3a1d0c?Pn:Ln),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x3a1d0c,'showSuggestButton':_0x3a765c}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x57256a,showSuggestButton:_0x4e7643}){this['applyButton']&&(this['applyButton']['isVisible']=_0x57256a),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x4e7643);}_createButton(_0x5338c2,_0x1f14c8){const _0x2b225d=new Mt(this['locale']);return _0x2b225d['set']({'label':_0x5338c2,'class':_0x1f14c8,'isVisible':!0x0,'withText':!0x0}),_0x2b225d;}},lh=class extends _0x3faf4e{constructor(_0x2bc3c7){super(_0x2bc3c7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Es(_0x2bc3c7,'AI_DISCLAIMER_TEXT')}]}]});}},uh=class extends _0x3faf4e{constructor(_0x10ea9b){super(_0x10ea9b),this['set']('isVisible',!0x0);const _0x270e53=new Dr('small');_0x270e53['isVisible']=!0x0;const _0x1d971e=new _0x3faf4e(this['locale']);_0x1d971e['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Es(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x367711=>!_0x367711)]},'children':[_0x270e53,_0x1d971e]});}},dh=class extends Ma{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x3753e5,_0x2bae1a){super(_0x3753e5),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x2bae1a,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x5b3174(),this['_addContentWrapper'](_0x2bae1a),this['_addDisclaimerView'](),this['_addToolbar'](_0x2bae1a),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'](_0x2bae1a);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x143652 of this['_focusables'])this['_focusTracker']['add'](_0x143652['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x2067f2){-0x1===_0x2067f2?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x446fd6){this['_isLoading']=_0x446fd6;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x105d9d){super['showError'](_0x105d9d),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x3627b1){super['showBlockingError'](_0x3627b1),this['setErrorState']();}addMiniToolbarItem(_0x201ea1){this['_miniToolbarView']['items']['has'](_0x201ea1)||this['_miniToolbarView']['items']['add'](_0x201ea1);}removeMiniToolbarItem(_0xaab7d5){this['_miniToolbarView']['items']['has'](_0xaab7d5)&&this['_miniToolbarView']['items']['remove'](_0xaab7d5);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x3fec55,showSuggestButton:_0x2137c7}){_0x3fec55=_0x3fec55&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2137c7=_0x2137c7&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x3fec55,'showSuggestButton':_0x2137c7});}async updateContent(_0x44ecdd){await this['_streamableContentView']['update'](_0x44ecdd);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x420644){this['_contentWrapper']=new _0x3faf4e(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x420644['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new lh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x33f4e4,showSuggestButton:_0x4ed265}){this['_toolbarView']=new ch(this['locale'],_0x33f4e4,_0x4ed265),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',this,'isTargetReadOnly',(_0x3b2c7e,_0x3e4d1c,_0x1053f5,_0x5a9f58)=>!(_0x3b2c7e||_0x3e4d1c||_0x1053f5||_0x5a9f58)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x33f4e4,'showSuggestButton':_0x4ed265}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x735450){return this['_miniToolbarView']=new Ba(this['locale'],_0x735450),this['_miniToolbarView']['delegate'](...ir)['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',(_0x2fdd1f,_0xee29f6)=>!(_0x2fdd1f||_0xee29f6)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new uh(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new mr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x2c9d6d=new Mt(this['locale']),_0x5cfb2f=new Mt(this['locale']),_0x32a66c=new _h(this['locale']),_0xacaa2a=new Mt(this['locale']);_0x2c9d6d['set']({'icon':_0x560f66,'label':Es(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Dn}),_0x5cfb2f['set']({'icon':_0x44f029,'tooltip':Es(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Dn}),_0xacaa2a['set']({'icon':_0x59885d,'tooltip':Es(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Dn}),_0x2c9d6d['bind']('isEnabled')['to'](this,'isBusy',_0x17e126=>!_0x17e126),_0x2c9d6d['on']('execute',()=>{this['fire']('tryAgain');}),_0x5cfb2f['bind']('isEnabled')['to'](this,'isBusy',_0x29436b=>!_0x29436b),_0x5cfb2f['on']('execute',()=>{this['fire']('showPrevious');}),_0xacaa2a['bind']('isEnabled')['to'](this,'isBusy',_0x52ba28=>!_0x52ba28),_0xacaa2a['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x5cfb2f,this['_navigationCounter']=_0x32a66c,this['_navigationNextButton']=_0xacaa2a,this['_navigationTryAgainButton']=_0x2c9d6d;}updateMiniToolbarButtons(_0x415726,_0x5700a5){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x1334b4=_0x415726>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x1334b4){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x299fdd=_0x415726-_0x5700a5;this['_navigationCounter']['setInteractionCount'](_0x299fdd+'/'+_0x415726),this['_navigationPreviousButton']['isEnabled']=_0x5700a5<_0x415726-0x1,this['_navigationNextButton']['isEnabled']=_0x5700a5>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(_0x14bfc4){this['_isLoading']=_0x14bfc4;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x2e3e7f=this['_streamableContentView']['element'],_0x21cc10=this['_miniToolbarView']['element'],_0x467a1f=()=>{wt['window']['requestAnimationFrame'](()=>{const _0xa1abc4=_0x2e3e7f['offsetWidth']-_0x2e3e7f['clientWidth'];_0x21cc10['style']['right']='calc('+_0xa1abc4+'px\x20+\x20var(--ck-spacing-large))';});};_0x467a1f(),this['_miniToolbarResizeObserver']=new pt(_0x2e3e7f,()=>{_0x467a1f();});}_initializeScrollManager(){const _0x8744eb=this['_getScrollableElement']();_0x8744eb&&!this['_scrollManager']&&(this['_scrollManager']=new ao(_0x8744eb));}_getScrollableElement(){return this['_streamableContentView']['element'];}},_h=class extends _0x3faf4e{constructor(_0x4bfc88){super(_0x4bfc88);const _0x3753e9=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x3753e9['to']('interactionCount')}]});}setInteractionCount(_0x5019d5){this['set']('interactionCount',_0x5019d5);}},gh=class extends _0x3e375b{static get requires(){return[Is,Nn,Ut,tn,Va,_0x2cd097];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_aiConnector;_interactions=[];_currentInteractionIndex=0x0;_interactionParams;['_balloonShowDiff']=!0x1;['_promiseQueue'];get _interaction(){return this['_interactions'][this['_interactions']['length']-0x1];}_actionsBalloonView;_reporter;constructor(_0x535e65){super(_0x535e65),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Sr();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x44588c,_0x3d0e9f,_0x4cfd8a){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x22bb24,anchorData:_0x3c3cbd,root:_0x3413bf}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x44588c,_0x22bb24,_0x3c3cbd,_0x3413bf,_0x3d0e9f,_0x4cfd8a);}const {modelFragment:_0x2c11b6,anchorData:_0x63b2d,root:_0x24c697}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x44588c,_0x2c11b6,_0x63b2d,_0x24c697,_0x3d0e9f,_0x4cfd8a);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0xa3ba8f=this['editor']['plugins']['has']('TrackChanges');let _0x364181=this['editor']['config']['get']('ai.availableReplyActions')||[...Or];_0xa3ba8f||(_0x364181=_0x364181['filter'](_0x1b90bc=>'insertSuggestion'!=_0x1b90bc));const _0x11d4a0=this['editor']['commands']['get']('trackChanges'),_0x13679f=new dh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0xa3ba8f,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x364181});return _0x13679f['bind']('isBusy')['to'](this),_0x13679f['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x11d4a0&&_0x13679f['bind']('isTrackChangesOn')['to'](_0x11d4a0,'value'),_0x13679f['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x13679f['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x13679f['on']('showNext',()=>{this['_navigateToNext']();}),_0x13679f;}_normalizeSelectionStart(){const _0x5bc91e=this['editor']['model'],_0xeba7a0=_0x5bc91e['document']['selection'],_0x3b94f1=_0xeba7a0['getFirstRange']();if(!_0x3b94f1||_0x3b94f1['isCollapsed'])return;const _0x361390=mt(_0xeba7a0['getSelectedBlocks']());if(!_0x361390)return;const _0x176f4b=_0x5bc91e['createPositionAt'](_0x361390,0x0);_0x176f4b['isAfter'](_0x3b94f1['start'])&&_0x5bc91e['change'](_0x521832=>{_0x521832['setSelection'](_0x521832['createRange'](_0x176f4b,_0x3b94f1['end']));});}_getExecuteDataRegular(){const _0x25dfeb=this['editor']['model']['document']['selection'],_0x23df65=_0x25dfeb['getFirstRange']()['start']['root'];if(_0x25dfeb['isCollapsed']){const _0x3de7cb=mt(_0x25dfeb['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x25dfeb);this['editor']['model']['change'](_0x279dd9=>{_0x279dd9['setSelection'](_0x3de7cb,'in');});}this['_normalizeSelectionStart']();const _0x1ecb99=_0x25dfeb['getFirstRange'](),_0x671d89=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x25dfeb),_0x1ecb99['start'],_0x1ecb99['end']);this['_copyMarkersToFragment'](_0x671d89,_0x25dfeb,{'isTableSelection':!0x1});const _0x3d6e1a=_0x25dfeb['getFirstRange']()['start'],_0x85484=new Map();let _0x414ab4=_0x671d89;for(let _0x1b8c6c=0x0;_0x1b8c6c<_0x3d6e1a['path']['length'];_0x1b8c6c++)_0x85484['set'](_0x414ab4,_0x3d6e1a['path'][_0x1b8c6c]),_0x414ab4=_0x414ab4['getChild'](0x0);return{'modelFragment':_0x671d89,'anchorData':_0x85484,'root':_0x23df65};}_getExecuteDataInTable(){const _0x239b85=this['editor']['model']['document']['selection'],_0x4645ec=this['editor']['plugins']['get']('TableSelection'),_0x31bee2=_0x239b85['getFirstRange']()['start']['root'],_0x1bc6a4=_0x4645ec['getSelectionAsFragment'](),_0x5e13dc=_0x239b85['getFirstRange']()['start']['parent']['parent'],_0x41ef9f=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x5e13dc),this['editor']['model']['createPositionAfter'](_0x5e13dc)),_0x12aeb5=this['_wrapWithCommonAncestors'](_0x1bc6a4,_0x41ef9f['start'],_0x41ef9f['end']);this['_copyMarkersToFragment'](_0x12aeb5,_0x239b85,{'isTableSelection':!0x0});const _0x2e2a90=_0x239b85['getFirstRange']()['start'],_0x5ef0ef=new Map();let _0x3ff521=_0x12aeb5;for(let _0x4f7957=0x0;_0x4f7957<_0x2e2a90['path']['length'];_0x4f7957++)if(_0x5ef0ef['set'](_0x3ff521,_0x2e2a90['path'][_0x4f7957]),_0x4f7957<_0x2e2a90['path']['length']-0x1)_0x3ff521=_0x3ff521['getChild'](0x0);else{let _0x12da48=_0x3ff521['nextSibling'];for(;_0x12da48;)_0x5ef0ef['set'](_0x12da48,_0x2e2a90['path'][_0x4f7957]),_0x12da48=_0x12da48['nextSibling'];}return{'modelFragment':_0x12aeb5,'anchorData':_0x5ef0ef,'root':_0x31bee2};}async _executeAction(_0x2042ae,_0x4ef1e6,_0x57421f,_0x22a9ea,_0x52aea3,_0x5c31ce){const _0x5420ab=this['editor']['plugins']['get'](tn),_0x23f09c=this['editor']['plugins']['get'](Va),_0x243861=this['editor']['model']['document']['selection'],_0x3c735f=await _0x5420ab['modelToDataWithIds'](_0x4ef1e6,this['editor'],_0x22a9ea['rootName']),_0x44f200=this['editor']['model']['document']['version'],_0x495e1f=[..._0x243861['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x23f09c['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x52aea3,'icon':_0x5c31ce||_0x5b0bbe,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x495e1f,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x23f09c),this['_interactionParams']={'action':_0x2042ae,'content':_0x3c735f,'version':_0x44f200,'aiBalloon':_0x23f09c,'modelFragment':_0x4ef1e6,'anchorData':_0x57421f,'root':_0x22a9ea},this['_setupApplyListeners'](),this['listenTo'](_0x23f09c,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x23f09c,'dialogClosed',(_0xb8fd00,{id:_0x31f336})=>{if('aiActionsBalloon'===_0x31f336){for(const _0xa67779 of this['_interactions']){if(0x0===_0xa67779['replies']['length']||_0xa67779['stoppedExplicitly'])continue;const _0x3804f8=_0xa67779['replies'][_0xa67779['replies']['length']-0x1],_0xbd8974=_0x3804f8['changeGroups'][0x0];_0xbd8974&&'pending'===_0xbd8974['state']&&_0x3804f8['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x23f09c);}}),this['_createInteraction'](_0x3c735f,_0x44f200,_0x23f09c,_0x2042ae);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x30b371,anchorData:_0xec8db3,root:_0x3e29ce}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x30b371,_0xec8db3,_0x3e29ce,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x30b371,_0xec8db3,_0x3e29ce,!0x0);});}_wrapWithCommonAncestors(_0x445cac,_0x14015b,_0x526f1b){const _0x49a280=this['editor']['model']['createRange'](_0x14015b,_0x526f1b)['getCommonAncestor'](),_0x2738ed=_0x49a280['is']('documentFragment')?[]:_0x49a280['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x2738ed['length']){const _0x374c71=_0x2738ed['map'](_0x437040=>_0x437040['_clone'](!0x1));for(let _0x3daf03=0x1;_0x3daf03<_0x374c71['length'];_0x3daf03++)_0x374c71[_0x3daf03-0x1]['_appendChild'](_0x374c71[_0x3daf03]);return _0x374c71[_0x374c71['length']-0x1]['_appendChild'](_0x445cac),new _0x43d2b2(_0x374c71[0x0]);}return _0x445cac;}_copyMarkersToFragment(_0x2e2e1f,_0xf7c672,_0x1ef57e={'isTableSelection':!0x1}){const _0x436152=this['editor']['model'],_0x5ec02e=Array['from'](_0xf7c672['getRanges']()),_0x156924=_0xf7c672['getFirstRange']()['start'];for(const _0x692639 of _0x436152['markers']){if(_0x692639['name']['startsWith']('ai-selection')||!_0x692639['affectsData'])continue;const _0x4d90e8=_0x692639['getRange']();if(!_0x5ec02e['some'](_0x25fa53=>_0x25fa53['containsRange'](_0x4d90e8,!0x0)))continue;const _0x254bd=this['_regularCalculateMarkerPath'](_0x4d90e8['start'],_0x156924,_0x1ef57e['isTableSelection']),_0xaa7ca3=this['_regularCalculateMarkerPath'](_0x4d90e8['end'],_0x156924,_0x1ef57e['isTableSelection']),_0x45eaf6=_0x436152['createPositionFromPath'](_0x2e2e1f,_0x254bd),_0x1670dc=_0x436152['createPositionFromPath'](_0x2e2e1f,_0xaa7ca3);if(!_0x45eaf6['isEqual'](_0x1670dc)){const _0x39f5ac=_0x436152['createRange'](_0x45eaf6,_0x1670dc);_0x2e2e1f['markers']['set'](_0x692639['name'],_0x39f5ac);}}}_regularCalculateMarkerPath(_0x216d34,_0x1dc479,_0x3202f8=!0x1){const _0x553b95=[..._0x216d34['path']['slice']()];for(let _0x569600=0x0;_0x569600<Math['max'](_0x1dc479['path']['length'],_0x216d34['path']['length']);_0x569600++){const _0x4f3302=_0x1dc479['path'][_0x569600]||0x0,_0x367d0a=(_0x216d34['path'][_0x569600]||0x0)-_0x4f3302;if(_0x553b95[_0x569600]=_0x367d0a,0x0!==_0x367d0a&&!_0x3202f8)break;}return _0x553b95;}async _createInteraction(_0x5bc0cd,_0xe9bb97,_0x501472,_0x203886){const _0x32cf65=this['editor'],_0x36ca70=_0x32cf65['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x203886,'content':_0x5bc0cd,'version':_0xe9bb97,'aiBalloon':_0x501472,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x36ca70});const _0x5d329c=new hh({'connector':this['_aiConnector'],'locale':_0x32cf65['locale'],'content':_0x5bc0cd,'version':_0xe9bb97,'editor':_0x32cf65,'rootName':_0x36ca70['rootName'],..._0x203886});this['_interactions']['push'](_0x5d329c);const _0x28d147=(_0x2da439,_0x4725c8=!0x1,_0x6a5fe6='streaming')=>{const {isDone:_0x5ab3da}=_0x2da439;return this['_promiseQueue']['enqueue'](async _0x1fb916=>{try{if(this['_isUnsupportedInlineRootChange'](_0x2da439,_0x36ca70))return this['_actionsBalloonView']['showBlockingError'](Es(_0x32cf65['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x5ab3da&&this['_actionsBalloonView']['finalizeContent']());const _0x3ea461=ln({'changeGroups':_0x2da439['changeGroups'],'documentContextContent':_0x2da439['documentContextContent'],'showDiff':_0x4725c8,'trimUnchanged':!0x1});_0x3ea461['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x3ea461[0x0],'renderingStrategy':_0x6a5fe6,'abortSignal':_0x1fb916}),_0x5ab3da&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x1a19dc){if(kn(_0x1a19dc))return;throw _0x1a19dc;}});};_0x5d329c['on']('replyCreated',(_0x53ec7b,_0x2608af)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x28d147(_0x2608af)['catch'](_0xf453d8=>{this['_reporter']['logError'](_0xf453d8,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x5d329c,_0xf453d8);});}),_0x5d329c['on']('replyContentUpdated',(_0x230815,_0x2be7c5)=>{_0x28d147(_0x2be7c5)['catch'](_0x53f416=>{this['_reporter']['logError'](_0x53f416,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x5d329c,_0x53f416);});}),_0x5d329c['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x49e00f){this['_reporter']['logError'](_0x49e00f,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x5d329c,_0x49e00f);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x2013ea,{showDiff:_0x3b7ed9})=>{try{this['_balloonShowDiff']=_0x3b7ed9;const _0xefd7c2=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xefd7c2&&await _0x28d147(_0xefd7c2,_0x3b7ed9,'static');}catch(_0x49a126){this['_reporter']['logError'](_0x49a126,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x5d329c,_0x49a126);}}),_0x5d329c['on']('replyChangeGroupStateUpdated',()=>{const _0x27d4eb={'positiveCount':_0x5d329c['replies']['reduce']((_0x2833b2,_0x317467)=>_0x2833b2+_0x317467['changeGroups']['filter'](_0x1637fa=>'accepted'===_0x1637fa['state'])['length'],0x0),'totalCount':_0x5d329c['replies']['reduce']((_0x14e435,_0x86d83a)=>_0x14e435+_0x86d83a['changeGroups']['length'],0x0)},_0x502dbd=_0x5d329c['actionCallId'],_0x25e5b8=_0x5d329c['actionName'];_0x25e5b8?this['_aiConnector']['upsertAIActionRating'](_0x25e5b8,_0x502dbd,_0x27d4eb):this['_aiConnector']['upsertCustomAIActionRating'](_0x502dbd,_0x27d4eb);}),this['_setLoadingState']();try{const _0x434fa3=await _0x5d329c['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x434fa3;}catch(_0x3954ba){kn(_0x3954ba)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x3954ba,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x5d329c,_0x3954ba);}}_isUnsupportedInlineRootChange(_0x17ccab,_0x115f1b){const _0xa66e19=this['editor'];return!!Gs(_0xa66e19,_0x115f1b['rootName'])&&!Ys(_0xa66e19,new _0x2fcdd7((_0x17ccab['changeGroups'][0x0]?.['changes']??[])['filter'](_0x3ea9ed=>'removed'!==_0x3ea9ed['type'])['map'](_0x2eee18=>_0x2eee18['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x50ec5b,_0xc90782,_0x11d2ac,_0x4a1388){const _0x272026=this['editor'];if(_0x4a1388&&!_0x272026['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x43be6=this['editor']['plugins']['get'](_0x2cd097),_0x5ef023=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5ef023||!_0x5ef023['replies']['length'])return;const _0x21eea4=_0x5ef023['replies'][_0x5ef023['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x21eea4,_0x11d2ac))return void this['_actionsBalloonView']['showBlockingError'](Es(_0x272026['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x21eea4['setChangeGroupState'](0x0,'accepted');const _0x4e0f94=Jn({'documentSuggestions':Zn({'groups':[_0x21eea4['changeGroups'][0x0]],'documentContextContent':_0x21eea4['documentContextContent'],'documents':_0x5ef023['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x43be6,'documentCompareOptions':{'anchor':_0x272026['model']['createPositionAt'](_0x50ec5b,0x0),'markDeletions':_0x4a1388}})['values']()['next']()['value']??[],_0xdf31de=this['_filterOperationsOutsideRange'](_0x4e0f94,_0xc90782);for(const _0x2cd0b3 of _0xdf31de)this['_anchorOperation'](_0xc90782,_0x2cd0b3,_0x11d2ac);const _0x49942f=_0x5ef023['getDocumentContext']()['documents'][0x0]['version'],_0x508d2c=_0x305f08(_0xdf31de,_0x272026['model']['document']['history']['getOperations'](_0x49942f),{'document':_0x272026['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];mn(_0x508d2c,'quickActions');try{_0x272026['model']['change'](_0x1ef41a=>{_0x1ef41a['setSelection'](_0x272026['model']['document']['selection']['focus']),_0x4a1388?_0x272026['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x508d2c):_0x43be6['applyOperations'](_0x1ef41a,_0x508d2c);});}catch(_0xf28168){throw this['_reporter']['logError'](new yn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0xf28168})),_0xf28168;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x56579f,_0x4f1506){return _0x56579f['filter'](_0x4da2a0=>{if('rename'==_0x4da2a0['type']){const _0x216b00=_0x4da2a0['position']['nodeAfter'];return!_0x4f1506['has'](_0x216b00);}if(_0x4da2a0['type']['indexOf']('Attribute')>-0x1){const _0x16dfdd=_0x4da2a0['range']['start']['nodeAfter'];return!_0x4f1506['has'](_0x16dfdd);}return!0x0;});}_anchorOperation(_0x2f5adc,_0x343bd1,_0x3ccbc4){const _0x152867=_0x343bd1['clone']();for(const _0x36523e in _0x343bd1){const _0x3dba04=_0x343bd1[_0x36523e];_0x3dba04 instanceof _0x244cab?_0x343bd1[_0x36523e]=new _0x244cab(_0x2d70d5(_0x3dba04['start']),_0x2d70d5(_0x3dba04['end'])):_0x3dba04 instanceof _0x546016&&(_0x343bd1[_0x36523e]=_0x2d70d5(_0x3dba04));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x152867['type'])){if(_0x152867['isDocumentOperation']=!0x1,_0x152867['baseVersion']=null,'remove'==_0x152867['type']){const _0x1ef137=_0x152867['sourcePosition'],_0x41ab4b=_0x152867['howMany'];new _0x10a40c(_0x1ef137,_0x41ab4b)['_execute']();}else _0x152867['_execute']();}function _0x2d70d5(_0x44c8ff){if('$graveyard'==_0x44c8ff['root']['rootName'])return _0x44c8ff;const _0x2b92a8=[];let _0xb8f09d=_0x44c8ff['root'];for(let _0x1f94b3=0x0;_0x1f94b3<_0x44c8ff['path']['length'];_0x1f94b3++){const _0x1c0af6=_0x2f5adc['get'](_0xb8f09d)||0x0;_0x2b92a8[_0x1f94b3]=_0x44c8ff['path'][_0x1f94b3]+_0x1c0af6,_0xb8f09d=_0xb8f09d['getChildAtOffset'](_0x44c8ff['path'][_0x1f94b3]);}return new _0x546016(_0x3ccbc4,_0x2b92a8,_0x44c8ff['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1f27e3,content:_0x30f595,version:_0x2d98c4,aiBalloon:_0x15ffcf}=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'](_0x30f595,_0x2d98c4,_0x15ffcf,_0x1f27e3)['catch'](_0x53dbd6=>{this['_reporter']['logError'](_0x53dbd6,{'context':{'operation':'refresh-interaction'}});});}_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 _0x29fe0=this['_interactions']['length'];this['_currentInteractionIndex']<_0x29fe0-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x588872){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x588872;const _0x2f4dc9=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x2f4dc9)return;if(_0x2f4dc9['hasError'])return this['_setErrorState'](_0x2f4dc9),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x2f4dc9['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x1382f8=_0x2f4dc9['replies'][_0x2f4dc9['replies']['length']-0x1];if(_0x1382f8)try{const _0x3ee966=ln({'changeGroups':_0x1382f8['changeGroups'],'documentContextContent':_0x1382f8['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x4cd88c=>setTimeout(_0x4cd88c,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x3ee966[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3f5a6e){this['_reporter']['logError'](_0x3f5a6e,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x5c3f3c,_0x1cc4bc){if(void 0x0!==_0x1cc4bc&&kn(_0x1cc4bc))return;const _0xfe6e84=Es(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0xfe6e84),_0x5c3f3c['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);}},Ah=class extends _0x3e375b{static get requires(){return[ih,oh,gh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x471693){super(_0x471693),_0x471693['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ih=class extends _0x3faf4e{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x31893c,_0xfe9cbc){super(_0x31893c),this['id']=_0xfe9cbc,this['set']('status','pending'),this['set']('changeId',_0xfe9cbc),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',(_0xc757d6,_0x3b8f72)=>{_0x3b8f72&&_0x3b8f72['target']&&'A'===_0x3b8f72['target']['tagName']&&_0x3b8f72['preventDefault'](),this['fire']('activateChange',{'id':_0xfe9cbc,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0xfe9cbc,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0xfe9cbc,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x509765=new _0x3faf4e(this['locale']);return _0x509765['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x509765;}updateResponseContent(_0x1a57ed,_0x3caaca){const _0x1ef388=_0x3caaca||'div',_0x481917=this['resultResponseView']['element'];if(_0x481917['tagName']['toLowerCase']()!==_0x1ef388){const _0x4b04a0=new _0x2f5e20({'tag':_0x1ef388,'attributes':{'class':_0x481917['className']}})['render']();_0x481917['replaceWith'](_0x4b04a0),this['resultResponseView']['element']=_0x4b04a0,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x1a57ed;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x5e440=new Mt(this['locale']);return _0x5e440['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x5e440['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x31f5e1=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x31f5e1['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x4963cc=>'pending'!==_0x4963cc&&'accepted'!==_0x4963cc),this['bindTemplate']['if']('status',Pn,_0x57696d=>'pending'===_0x57696d),this['bindTemplate']['if']('status',Dn,_0x279c7d=>'pending'!==_0x279c7d),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x39e380=>'accepted'===_0x39e380)]}}),this['on']('change:status',(_0x53687d,_0x18a41e,_0x45ea0b)=>{_0x5e440['isEnabled']='pending'===_0x45ea0b,'accepted'===_0x45ea0b&&(_0x5e440['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x5e440['icon']=_0x884ad8);}),_0x5e440;}_createDismissButtonView(){const _0x571419=new Mt(this['locale']);return _0x571419['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x571419['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x538585=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x538585['stopPropagation']();})},'attributes':{'class':[Dn,this['bindTemplate']['if']('status','ck-hidden',_0x310481=>'pending'!==_0x310481&&'rejected'!==_0x310481),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x260ff5=>'pending'===_0x260ff5),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x5b1072=>'rejected'===_0x5b1072)]}}),this['on']('change:status',(_0x14aa1d,_0x59f0b5,_0x324239)=>{_0x571419['isEnabled']='pending'===_0x324239,'rejected'===_0x324239&&(_0x571419['label']=Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x571419['icon']=_0x2f23df);}),_0x571419;}_createInfoButtonView(){const _0x37cb67=new Mt(this['locale']);return _0x37cb67['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x5a892d,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Dn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x37cb67['bind']('isOn')['to'](this,'isInfoToggleOn',_0x4eebca=>_0x4eebca),_0x37cb67['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x37cb67;}_createOutdatedButtonView(){const _0x3ccce9=new Mt(this['locale']);return _0x3ccce9['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0xf70950,'withText':!0x0,'isEnabled':!0x1}),_0x3ccce9['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x4df0ce=>'outdated'!==_0x4df0ce)],'disabled':'disabled'}}),_0x3ccce9;}},ph=class extends xt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x434eab,_0x18513a){super(_0x434eab),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']()),_0x18513a['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x469620){this['resultItemView']['changeId']=_0x469620['id'],this['resultItemView']['updateResponseContent'](_0x469620['contentDiffed'],_0x469620['wrapperTag']);}['showBalloon'](_0x520be9,_0x36d14e,_0xadde33,_0x568082,_0x3f5a56,_0x485eb0){const _0x38d97b=_0x36d14e();if(!_0x38d97b)return;this['updateContent'](_0x520be9),this['show']();const _0x4bd4ea=Array['from'](_0x38d97b['getClientRects']())['reverse'](),_0x3ff1fb=this['_getPointedRectIndexFromEvent'](_0xadde33,_0x4bd4ea),_0x4ccf2c=_0x4bd4ea[_0x3ff1fb??0x0];'click'===_0x568082?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x36d14e(),_0x3ff1fb,_0x520be9['id'],_0x3f5a56,_0x485eb0)||_0x4ccf2c})):'hover'===_0x568082&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x36d14e(),_0x3ff1fb,_0x520be9['id'])||_0x4ccf2c}));}['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(){_0x5ccdd9({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x357568=[this['element']];return this['_pinnedTargetElement']&&_0x357568['push'](this['_pinnedTargetElement']),_0x357568;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x5f0b4c=new _0x3faf4e();return this['resultItemView']=new Ih(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x5f0b4c['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']]}]}),_0x5f0b4c;}_getBestRectPositionOnClick(_0x3d52f2,_0x35f3a4,_0x4856b3,_0x5d56d6,_0x108f7b){if(!_0x3d52f2)return null;const _0x3ae76e=this['position']['replace']('arrow_',''),_0x5cbf5a=Array['from'](_0x3d52f2['getClientRects']());let _0x568314,_0x51f2d1=_0x5cbf5a['reverse']();return void 0x0!==_0x35f3a4&&this['_isPinnedRectVisible'](_0x51f2d1[_0x35f3a4],_0x5d56d6,_0x108f7b)?(_0x568314=_0x51f2d1[_0x35f3a4],this['_pinnedRectIndex']=_0x35f3a4):this['_isPinnedRectVisible'](_0x51f2d1[0x0],_0x5d56d6,_0x108f7b)&&void 0x0===_0x35f3a4?_0x568314=_0x51f2d1[0x0]:(_0x51f2d1='s'==_0x3ae76e[0x0]?[..._0x5cbf5a]['reverse']():_0x5cbf5a,_0x51f2d1['forEach'](_0x19073d=>{this['_isPinnedRectVisible'](_0x19073d,_0x5d56d6,_0x108f7b)&&(_0x568314=_0x19073d);})),this['_pinnedTargetChangeId']=_0x4856b3,this['_pinnedTargetElement']=_0x3d52f2,_0x568314||_0x3d52f2['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x3a1a7f,_0x227a43,_0x18f94c){if(!_0x3a1a7f)return null;const _0x162a19=Array['from'](_0x3a1a7f['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x227a43&&this['_pinnedTargetChangeId']!==_0x18f94c?(this['_pinnedRectIndex']=_0x227a43,this['_pinnedTargetElement']=_0x3a1a7f,this['_pinnedTargetChangeId']=_0x18f94c,_0x162a19[_0x227a43]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x18f94c?_0x3a1a7f!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x162a19[this['_pinnedRectIndex']]:void 0x0!==_0x227a43&&this['_pinnedTargetChangeId']!==_0x18f94c?(this['_pinnedRectIndex']=_0x227a43,this['_pinnedTargetElement']=_0x3a1a7f,this['_pinnedTargetChangeId']=_0x18f94c,_0x162a19[_0x227a43]):_0x3a1a7f['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x52d743,_0x398916){if(_0x52d743)for(let _0xb5f615=0x0;_0xb5f615<_0x398916['length'];_0xb5f615++){const _0x32b2da=_0x398916[_0xb5f615];if(_0x52d743['clientX']>=_0x32b2da['left']-0x3&&_0x52d743['clientX']<=_0x32b2da['right']+0x3&&_0x52d743['clientY']>=_0x32b2da['top']-0x3&&_0x52d743['clientY']<=_0x32b2da['bottom']+0x3)return _0xb5f615;}}_isPinnedRectVisible(_0x34b94d,_0x27f7ea,_0x28eef3){const _0xd92f7e=new It(_0x34b94d),_0x13ad30=_0x27f7ea||document['documentElement'],_0x30f61c=_0xd92f7e['getIntersection'](Tt(_0x28eef3)),_0x33b130=new It(_0x13ad30)['getIntersection'](_0xd92f7e);return!!(_0x30f61c&&_0x33b130&&_0xd92f7e['width']>0x0);}};const Eh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var mh=class extends _0x2b8fcb{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[gs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b90db){super(_0x3b90db),this['_bodyCollection']=Mn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Eh)['to'](this),this['_balloonSuggestionView']=new ph(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x321c29=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x321c29);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x386b34){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x1953d4=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x386b34,_0x1953d4);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x2c5ccd){_0x2c5ccd&&('error-general'!==_0x2c5ccd['status']?'error-chunk'!==_0x2c5ccd['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x351202){this['_mainView']['addCheckRunResult'](_0x351202);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x1a922a){this['_mainView']['showGeneralReviewCoreErrorView'](_0x1a922a??Es(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x19e6fc,_0x3429ac){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x19e6fc,_0x3429ac);}setAcceptAllEnabled(_0x1c8ae4){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x1c8ae4);}setActiveStateInResults(_0x3a4ce8){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x2cca68=>{_0x2cca68['id']===_0x3a4ce8&&_0x2cca68['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x494094=>_0x494094['setItemAsInactive']());}updateChangeState(_0x374930,_0x5ab139){'accepted'===_0x5ab139||'rejected'===_0x5ab139||'outdated'===_0x5ab139?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x374930,_0x5ab139):this['_mainView']['reviewCheckResultsView']['showResult'](_0x374930,_0x5ab139);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x2c2a77,_0x34233d,_0xa9bb11,_0x2a1b0e,_0x252c63,_0x602b82){this['_balloonSuggestionView']['showBalloon'](_0x2c2a77,_0x34233d,_0xa9bb11,_0x2a1b0e,_0x252c63,_0x602b82);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x476ce9){const _0x3bcd3d=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x29fa63=>_0x29fa63['id']===_0x476ce9);return _0x3bcd3d?_0x3bcd3d['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Th=class extends _0x3faf4e{constructor(_0x4e8ba7){super(_0x4e8ba7),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x3f697a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x3f697a['if']('isVisible','ck-hidden',_0x13af06=>!_0x13af06)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x3f697a['to']('errorMessage')}]}]});}},wh=class extends _0x3faf4e{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x3f3739,_0x586df7){super(_0x3f3739),this['reviewCoreHeader']=_0x586df7['header'],this['generalErrorView']=new Th(_0x3f3739),this['reviewCheckListView']=_0x586df7['list'],this['reviewCheckListView']['delegate'](...Eh)['to'](this),this['reviewCheckResultsView']=_0x586df7['results'],this['reviewCheckResultsView']['delegate'](...Eh)['to'](this),this['reviewCompletedView']=_0x586df7['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(_0x36deac){this['reviewCheckResultsView']['addResult'](_0x36deac),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'](_0x39fdb2){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x39fdb2;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},Ch=class extends Mt{constructor(_0xdc8979,_0x5f83f7){super(_0x5f83f7),this['set']({'label':_0xdc8979,'withText':!0x0,'class':Ln}),this['on']('execute',()=>{this['fire']('finishReview');});}},fh=class extends jt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x49f2cd,_0x436397){super(_0x49f2cd),this['_contents']=_0x436397,this['_resultViews']=new _0x5b3174(),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 da(_0x49f2cd),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x91c507,_0x307c17)=>_0x91c507&&!_0x307c17);const _0x2c6b7d=this['_createCombinedSkeletonLoader'](),_0x3af186=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x3af186['if']('isLoading','ck-ai_review__check-run_loading',_0x1f7a4c=>_0x1f7a4c),_0x3af186['if']('isResultReady','ck-ai_review__check-run_ready',_0x31feb5=>_0x31feb5),_0x3af186['if']('isVisible','ck-hidden',_0x9523da=>!_0x9523da)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x2c6b7d,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x42057e){const _0x4eda76=new Ih(this['locale'],_0x42057e['id']);_0x4eda76['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x4eda76),_0x4eda76['updateResponseContent'](_0x42057e['contentDiffed'],_0x42057e['wrapperTag']);}hideResult(_0x109afd,_0x75a1ec){if('pending'===_0x75a1ec)return;const _0x3b5234=this['_resultViews']['find'](_0x267a13=>_0x267a13['id']===_0x109afd);_0x3b5234&&(_0x3b5234['status']=_0x75a1ec,_0x3b5234['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x412214,_0x26711e){if('pending'!==_0x26711e)return;const _0x5c49ee=this['_resultViews']['find'](_0x45e9f2=>_0x45e9f2['id']===_0x412214);_0x5c49ee&&(_0x5c49ee['status']=_0x26711e,_0x5c49ee['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x221694,_0x494cee){this['headerTitle']=_0x221694,this['headerSubtitle']=_0x494cee||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x380c77){this['isAcceptAllEnabled']=_0x380c77;}_createSkeletonLoader(){return new wr(this['locale'],Cr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x3c9658=new _0x3faf4e(this['locale']),_0xa63566=[];for(let _0x13959e=0x0;_0x13959e<0x10;_0x13959e++){const _0xcf2053=this['_createSkeletonLoader']();_0xcf2053['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0xa63566['push'](_0xcf2053);}return _0x3c9658['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x5b4f30=>!_0x5b4f30)]},'children':_0xa63566}),_0x3c9658;}_createResultsBodyView(){const _0x26d6ba=new _0x3faf4e(this['locale']);return _0x26d6ba['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1c00b1=>_0x1c00b1)]},'children':this['_resultViews']}),_0x26d6ba;}_createErrorView(){const _0x2e9dfd=new _0x3faf4e(this['locale']),_0x377ec1=new Mt(this['locale']),t=this['locale']['t'];return _0x2e9dfd['delegate']('retryReview')['to'](this),_0x377ec1['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Pn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x377ec1['on']('execute',()=>{this['fire']('retryReview');}),_0x2e9dfd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x57c38d=>!_0x57c38d),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x39924c=>'chunk'===_0x39924c)]},'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',_0x337d4b=>'chunk'===_0x337d4b||'unsupported-inline'===_0x337d4b)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x4f27ba=>'general'!==_0x4f27ba)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x255ae4=>'chunk'!==_0x255ae4)]},'children':[{'text':Es(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x4ec62c=>'unsupported-inline'!==_0x4ec62c)]},'children':[{'text':Es(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x377ec1]}),_0x2e9dfd;}_createCancelButtonView(){const _0x5ef7f0=new Mt(this['locale']);return _0x5ef7f0['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Pn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x5ef7f0['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5e0cfd=>_0x5e0cfd),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1f8631=>_0x1f8631)]}}),_0x5ef7f0['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x5ef7f0;}_createToggleDiffButtonView(){const _0x8a599b=new Mt(this['locale']);_0x8a599b['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x8a599b['bind']('isEnabled')['to'](this,'isError',_0x53fcca=>!_0x53fcca),_0x8a599b['extendTemplate']({'attributes':{'class':[Pn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3fb6da=>!_0x3fb6da),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1d03c3=>_0x1d03c3)]}});const _0x25b5e8=Es(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x5042a9=Es(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x8a599b['bind']('isOn')['to'](this,'isToggleDiffOn',_0x15b5b4=>_0x15b5b4),_0x8a599b['bind']('icon')['to'](this,'isToggleDiffOn',_0x2f27c3=>_0x2f27c3?_0x2db718:_0x3484b1),_0x8a599b['bind']('label')['to'](this,'isToggleDiffOn',_0x2bdc38=>_0x2bdc38?_0x25b5e8:_0x5042a9),_0x8a599b['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x8a599b;}_createAcceptAllButtonView(){const _0x2d22a4=new Mt(this['locale']);return _0x2d22a4['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2d22a4['extendTemplate']({'attributes':{'class':[Ln,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0xf2c09a=>!_0xf2c09a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x474725=>_0x474725)]}}),_0x2d22a4['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2d22a4;}_createExitReviewButtonView(){const _0x95e86f=new Mt(this['locale']);return _0x95e86f['set']({'label':Es(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x95e86f['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x103bc9=>!_0x103bc9),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x54c06a=>_0x54c06a)]}}),_0x95e86f['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x95e86f;}_createResultHeaderView(){const _0x59c462=new _0x3faf4e(this['locale']),_0x5beb58=this['_createTitleView']();return _0x59c462['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x23e4f5=>_0x23e4f5)]},'children':[_0x5beb58,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2c6478=>!_0x2c6478)],'title':Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Es(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']]}]}),_0x59c462;}_createTitleView(){const _0xbf4319=new _0x3faf4e(this['locale']),_0x400c65=new Dr();return _0x400c65['bind']('isVisible')['to'](this,'isResultReady',_0xb52ca7=>!_0xb52ca7),_0xbf4319['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x21a5ad=>_0x21a5ad)]},'children':[_0x400c65,{'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')}]}]}]}),_0xbf4319;}_createFinishReviewButtonView(){const _0x364762=new Ch(Es(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x364762['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2d5ba2=>!_0x2d5ba2)]}}),_0x364762['delegate']('finishReview')['to'](this),_0x364762;}},bh=class extends jt{_resultsHeader;_finishReviewButtonView;constructor(_0x3cecb6,_0x82ec25){super(_0x3cecb6),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x82ec25['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x82ec25['headerText']);const _0x445096=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x445096['if']('isVisible','ck-hidden',_0x12bdbf=>!_0x12bdbf)]},'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':_0x82ec25['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x10b748){const _0x50c05e=new Ch(_0x10b748,this['locale']);return _0x50c05e['delegate']('finishReview')['to'](this),_0x50c05e;}_createResultHeaderView(_0x5335ec){const _0x52e85c=new _0x3faf4e(this['locale']);return _0x52e85c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x5335ec},'children':[{'text':_0x5335ec}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x52e85c;}},Sh=class extends _0x3faf4e{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x42134b,_0x42b929){super(_0x42134b),this['_defaultValue']=_0x42b929['default']||(_0x42b929['data']['length']>0x0?_0x42b929['data'][0x0]['id']:''),this['_defaultLabel']=_0x42b929['data']['find'](_0xc4db4a=>_0xc4db4a['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x48d908(this['locale']);const _0x46bdc9=this['_prepareListOptions'](_0x42b929['data']);_0x143f7a(this['_dropdownView'],_0x46bdc9,{'role':'menu','ariaLabel':_0x42b929['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3d5cc0=>{_0x3d5cc0['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x5b5d7c=>{this['formValue']=_0x5b5d7c['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x5b5d7c['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(_0x25beda=[]){const _0x547b07=new lt();this['resetToDefault']();for(const _0x29d30d of _0x25beda){const _0x4c4734=new _0x30d699({'label':_0x29d30d['label'],'withText':!0x0,'role':'menuitemradio','id':_0x29d30d['id'],'model':_0x29d30d});_0x4c4734['bind']('isOn')['to'](this,'formValue',_0x235da4=>_0x235da4===_0x4c4734['id']);const _0x5859cb={'type':'button','model':_0x4c4734};_0x547b07['add'](_0x5859cb);}return _0x547b07;}},Rh=class extends jt{_formItem=null;constructor(_0x5275e3,_0x8c1091,_0x2228bb){if(super(_0x5275e3),this['argsKey']=_0x8c1091?.['argsKey'],'dropdown'===_0x8c1091['formType'])this['_formItem']=new Sh(this['locale'],_0x8c1091);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x5b5bb2=new Wt(this['locale'],{'children':[this['_formItem']],'class':[_0x2228bb?'ck-form__row_with-submit':'']});_0x2228bb&&_0x5b5bb2['children']['add'](_0x2228bb),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x5b5bb2]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Oh=class AIReviewCorePromptInputView extends _0x318d2a{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0xfde83b){super(_0xfde83b),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},vh=class extends _0x3faf4e{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x5b3174();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x38534d,_0x285763,_0x306c5b=!0x1){super(_0x38534d),this['_check']=_0x285763,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new Qt(this['locale'],()=>new Oh(_0x38534d)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Io(_0x38534d,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x1959eb,_0x2e996a)=>{this['modelId']=_0x2e996a['id'],this['_modelSelector']['setSelectedModel'](_0x2e996a);}),this['_setModelList'](_0x306c5b),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Wt(this['locale'],{'children':[this['promptInputView']]}),new Wt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x51d0d2,_0x9ea99a)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x9ea99a()):_0x9ea99a();}),this['focusCycler']=new Ft({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x1133d7=>{this['_focusables']['add'](_0x1133d7),this['focusTracker']['add'](_0x1133d7['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x1750b8 of this['_getFormValidators']()){const _0x4fe4c6=_0x1750b8();if(_0x4fe4c6)return this['promptInputView']['errorText']=_0x4fe4c6,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Es(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0x71d0d0=new Mt(this['locale']),t=this['locale']['t'];return _0x71d0d0['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x71d0d0['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x71d0d0;}_createCancelButtonView(){const _0x5aa0df=new Mt(this['locale']),t=this['locale']['t'];return _0x5aa0df['set']({'label':t('Cancel'),'withText':!0x0,'class':Dn}),_0x5aa0df['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2a25cb=>{_0x2a25cb['stopPropagation']();})}}),_0x5aa0df['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x5aa0df;}_setModelList(_0x3e1ef0){this['_modelSelector']['setModels'](this['_check']['models'],!_0x3e1ef0),this['resetToDefault']();}_createActionsFooterView(){const _0x18dab0=new _0x3faf4e(this['locale']);return _0x18dab0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x18dab0;}},kh=class extends jt{_formItemsCollection=new _0x5b3174();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x270610,_0xab1fe3,_0x38c757,_0x6f10f8=!0x1){super(_0x270610),this['_hideModels']=_0x6f10f8,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0xab1fe3['isParameterized']);const _0x4b05fa=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',_0x9fe517=>_0x9fe517),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x3f22e3=>_0x3f22e3)],'style':{'--ck-ai-review-check-list-item-index':_0x38c757}},'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':_0xab1fe3['title']}]},_0x4b05fa]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0xab1fe3['description']?[{'text':_0xab1fe3['description']}]:[]}]}]},..._0xab1fe3['isParameterized']?[this['_createParameterizedView'](_0xab1fe3)]:[],...'custom'===_0xab1fe3['id']?[this['_createCustomView'](_0xab1fe3,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0xab1fe3['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0xab1fe3['id'],'args':_0xab1fe3['useArgs']?_0xab1fe3['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x5ccdd9({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x2f7799=>{_0x2f7799['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x2dd02c=new $t();return _0x2dd02c['content']=_0x1fe7ce,_0x2dd02c['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x2dd02c;}_createParameterizedView(_0x24ff98){const _0x20f2bc=new _0x3faf4e(),_0x5052e6=this['_createFormView'](_0x24ff98);return _0x20f2bc['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x1f7ca0=>!_0x1f7ca0)]},'children':[_0x5052e6]}),_0x20f2bc;}_createFormView(_0x2b777e){const _0x29c8c1=new _0x3faf4e(),_0x2230ca=Array['isArray'](_0x2b777e['options'])?_0x2b777e['options']:[],_0x1ccfa7=new Mt(this['locale']),t=this['locale']['t'];_0x1ccfa7['set']({'label':t('Submit'),'withText':!0x0,'class':Ln}),_0x1ccfa7['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1a0815=>{_0x1a0815['stopPropagation']();})}}),_0x1ccfa7['on']('execute',()=>{const _0x1944d7=[],_0x3b32f9={};this['_formItemsCollection']['forEach'](_0x2b2b3f=>{_0x1944d7['push'](_0x2b2b3f['value']),_0x2b777e['useArgs']&&_0x2b777e['options']&&(_0x3b32f9[_0x2b2b3f['argsKey']]=_0x2b2b3f['value']);}),this['fire']('runReviewCheck',{'id':_0x2b777e['id'],'params':_0x1944d7['length']?_0x1944d7:void 0x0,'args':Object['keys'](_0x3b32f9)['length']?_0x3b32f9:void 0x0});});const _0x457c2e=_0x2230ca['length'];return _0x2230ca['forEach']((_0x3bfc7c,_0x1f4359)=>{const _0x2d8ac1=_0x1f4359===_0x457c2e-0x1;this['_formItemsCollection']['add'](new Rh(this['locale'],_0x3bfc7c,_0x2d8ac1?_0x1ccfa7:null));}),_0x29c8c1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x29c8c1;}_createCustomView(_0x13e4d4,_0x4272ff=!0x1){return this['_customCheckView']=new vh(this['locale'],_0x13e4d4,_0x4272ff),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',_0x3856d8=>!_0x3856d8)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x227b73,_0x2b980e,_0x69357d)=>{_0x69357d||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},yh=class extends jt{['_checkViews'];constructor(_0x1917bf){super(_0x1917bf),this['_checkViews']=new _0x5b3174(),this['_setupTemplate']();}setChecks(_0x17923c,_0x922310=!0x1){this['_checkViews']['clear']();for(const [_0x425d91,_0x71144a]of _0x17923c['entries']()){const _0x8c8970=new kh(this['locale'],_0x71144a,_0x425d91,_0x922310);_0x8c8970['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x8c8970);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x151aa3 of this['_checkViews'])_0x151aa3 instanceof kh&&_0x151aa3['resetToDefault']();}_setupTemplate(){const _0xe5e564=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0xe5e564['if']('isVisible','ck-hidden',_0x1270d5=>!_0x1270d5)]},'children':this['_checkViews']});}},Nh=class extends mh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0xb45a8c=this['context']['plugins']['get']('AITabs'),_0x4dfbdc=this['context']['locale'],_0x5415b5=new ua(_0x4dfbdc,{'label':Es(_0x4dfbdc,'AI_REVIEW_MODE'),'icon':_0xba7699,'class':'ck-ai-header_review','showResizeButton':_0xb45a8c['showResizeButton']});return _0x5415b5['delegate']('resizeTabs')['to'](_0xb45a8c),_0x5415b5['bind']('isMaximized')['to'](_0xb45a8c['view'],'isMaximized',_0x4ead91=>_0x4ead91),new wh(this['context']['locale'],{'header':_0x5415b5,'list':new yh(_0x4dfbdc),'results':new fh(_0x4dfbdc,{'generalErrorText':Es(_0x4dfbdc,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x4dfbdc,{'headerText':Es(_0x4dfbdc,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Es(_0x4dfbdc,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x4dfbdc,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x410371=this['context']['plugins']['get']('AITabs');_0x410371['view']['on']('activateTab',(_0x20845b,{newTab:_0x1ef59a,oldTab:_0x7b977e})=>{'reviewMode'===_0x1ef59a?this['fire']('getReviewCheckList'):'reviewMode'===_0x7b977e&&this['fire']('leaveReview');}),_0x410371['view']['addTab']({'id':'reviewMode','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0xba7699,'order':0x0,'content':this['_mainView']});}},xh=class extends Sn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x3dacd1){this['_affectedBlocks']=_0x3dacd1;}};const Lh='review-',Ph=['softBreak'],Dh=['htmlScript','htmlStyle','htmlCustomElement'];var Hh=class extends _0x2b8fcb{static get requires(){return[_0x2cd097,tn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x10be7a){super(_0x10be7a),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x5e732e=_0x42147e=>this['_scheduleAttachReviewEditingToEditor'](_0x42147e);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x5d4fbe)return void _0x5e732e(this['context']);const _0x57ee0f=this['context'];for(const _0x53ee70 of _0x57ee0f['editors'])_0x5e732e(_0x53ee70);this['listenTo'](_0x57ee0f['editors'],'add',(_0xfde955,_0x4a2166)=>{_0x5e732e(_0x4a2166);}),this['listenTo'](_0x57ee0f['editors'],'remove',(_0x30de84,_0x13e6f7)=>{for(const [_0x592806,_0x38c02d]of this['_markers'])_0x38c02d['editor']===_0x13e6f7&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x592806,'changeId':_0x38c02d['groupId']}),this['_markers']['delete'](_0x592806));});}_scheduleAttachReviewEditingToEditor(_0x134bed){const _0x1846da=()=>{'destroyed'!==_0x134bed['state']&&_0x134bed['conversion']&&this['_attachReviewEditingToEditor'](_0x134bed);};if('ready'===_0x134bed['state'])return void _0x1846da();const _0x3163c7=()=>{this['stopListening'](_0x134bed,'ready',_0x3163c7),_0x1846da();};this['listenTo'](_0x134bed,'ready',_0x3163c7);}_attachReviewEditingToEditor(_0x9adab){this['_reviewEditingAttachedEditors']['has'](_0x9adab)||(_0x9adab['conversion']['for']('editingDowncast')['markerToElement']({'model':Lh+'insert','view':(_0x329f5c,{writer:_0x226137})=>{const _0x38c983=this['_markers']['get'](_0x329f5c['markerName']),_0x4ba34f={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x38c983?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x329f5c['markerName']};return _0x226137['createUIElement']('span',_0x4ba34f,function(_0x25f495){const _0x392e99=this['toDomElement'](_0x25f495);return _0x392e99['innerHTML']=_0x38c983?.['content']?.['asString']||'',_0x392e99;});}}),_0x9adab['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-only','view':_0x47fd41=>{const _0x260f0c=this['_markers']['get'](_0x47fd41['markerName']),_0xa9cf7a=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x260f0c?.['id']||'')&&_0xa9cf7a['push']('ck-ai_review__change_active'),{'classes':_0xa9cf7a,'attributes':{'data-marker-id':_0x47fd41['markerName']}};}}),_0x9adab['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-context','view':_0x148d77=>{const _0x520b40=this['_markers']['get'](_0x148d77['markerName']),_0x49d8a1=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x520b40?.['id']||'')&&_0x49d8a1['push']('ck-ai_review__change_active'),{'classes':_0x49d8a1,'attributes':{'data-marker-id':_0x148d77['markerName']}};}}),_0x9adab['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Lh+'remove-text','view':_0x1024a5=>{const _0x5e1e23=this['_markers']['get'](_0x1024a5['markerName']),_0x46a472=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x5e1e23?.['id']||'')&&_0x46a472['push']('ck-ai_review__change_active'),{'classes':_0x46a472,'attributes':{'data-marker-id':_0x1024a5['markerName']}};}}),_0x9adab['conversion']['for']('dataDowncast')['markerToElement']({'model':Lh+'suggestion-context','view':(_0x43c35f,{writer:_0x276f6e})=>_0x276f6e['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x43c35f['isOpening']?'start':'end')})}),_0x9adab['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4e9c0c,'view':_0x552fd8}),this['_updateMouseMarkerInteractionListeners'](_0x9adab),this['listenTo'](_0x9adab,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x9adab),{'priority':'lowest'}),this['listenTo'](_0x9adab,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x9adab),{'priority':'lowest'}),_0x9adab['model']['document']['registerPostFixer'](_0x34a62b=>this['_validateMarkers'](_0x9adab,_0x34a62b)),_0x9adab['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x9adab)),this['_reviewEditingAttachedEditors']['add'](_0x9adab));}_updateMouseMarkerInteractionListeners(_0x40e544){let _0x468d71=this['_boundEditables']['get'](_0x40e544);_0x468d71||(_0x468d71=new Map(),this['_boundEditables']['set'](_0x40e544,_0x468d71));const _0x56f606=new Set(_0x40e544['ui']['getEditableElementsNames']());for(const _0x409403 of _0x56f606){if(_0x468d71['has'](_0x409403))continue;const _0x297040=_0x40e544['ui']['getEditableElement'](_0x409403);_0x468d71['set'](_0x409403,_0x297040),this['_attachMouseMarkerInteractionListeners'](_0x297040);}for(const [_0x56cdd7,_0x8e290b]of _0x468d71)_0x56f606['has'](_0x56cdd7)||(_0x468d71['delete'](_0x56cdd7),this['_domEmitter']['stopListening'](_0x8e290b));}_attachMouseMarkerInteractionListeners(_0x14f47b){this['_domEmitter']['listenTo'](_0x14f47b,'mouseup',(_0x41dd6a,_0x587f8d)=>{const _0x580572=_0x587f8d['target'],_0x52f95c=this['_findMarkerElement'](_0x580572);if(!_0x52f95c)return;const _0x3c867f=_0x52f95c['getAttribute']('data-marker-id'),_0x41d37f=_0x3c867f['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x3c867f,'changeId':_0x41d37f,'markerElement':()=>this['_findMarkerElementById'](_0x3c867f),'domEvent':_0x587f8d});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x14f47b,'mouseover',(_0x379f34,_0x57eeb9)=>{const _0x4d66d5=_0x57eeb9['target'],_0x49c540=_0x57eeb9['relatedTarget'];let _0x35a507=this['_findMarkerElement'](_0x4d66d5);if(!_0x35a507&&_0x49c540&&(_0x35a507=this['_findMarkerElement'](_0x49c540)),!_0x35a507)return;const _0x1824c5=_0x35a507['getAttribute']('data-marker-id'),_0x1fa607=_0x1824c5['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x1fa607,'markerElement':()=>this['_findMarkerElementById'](_0x1824c5),'domEvent':_0x57eeb9});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x509cdb((_0x17f20f,_0x407427)=>{const _0x144779=_0x407427['target'];this['_findMarkerElement'](_0x144779)||_0x144779['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x53503b){const _0x2f022c=this['context']['plugins']['get']('AIEditing'),_0x44aa47=bs(this['context']);if(!_0x44aa47['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x4a9e84=_0x53503b?.['roots'];if(_0x4a9e84&&0x0===_0x4a9e84['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x28f6b6=_0x4a9e84?new Set(_0x4a9e84['map'](_0x20a4b9=>_0x20a4b9['channelId']+'\x00'+_0x20a4b9['rootName'])):null,_0x326477=_0x28f6b6?new Set():null,_0x33294f=new Set(),_0x481f3d=[],_0xbb8107=new Map(),_0x55ab0c=[];for(const _0x23d222 of _0x44aa47){const _0x26955d=_0x23d222['config']['get']('collaboration.channelId');for(const _0x547fa6 of _0x23d222['model']['document']['getRoots']()){const _0x52410e=_0x26955d+'\x00'+_0x547fa6['rootName'];if(_0x28f6b6&&!_0x28f6b6['has'](_0x52410e))continue;const _0x58c73f=this['_buildDocumentDataSliceForRoot'](_0x23d222,_0x547fa6,_0x2f022c,_0x33294f);_0x481f3d['push'](_0x58c73f['content']);for(const [_0x5d8155,_0x1039cd]of _0x58c73f['elements'])_0xbb8107['set'](_0x5d8155,_0x1039cd);_0x55ab0c['push']({'channelId':_0x26955d,'rootName':_0x547fa6['rootName']}),_0x326477?.['add'](_0x52410e);}}if(_0x4a9e84&&_0x326477['size']!==_0x28f6b6['size']){const _0x1c47c3=_0x4a9e84['find'](_0x2abb51=>!_0x326477['has'](_0x2abb51['channelId']+'\x00'+_0x2abb51['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x1c47c3['channelId'],'rootName':_0x1c47c3['rootName']});}return{'elements':_0xbb8107,'content':_0x481f3d['join'](''),'roots':_0x55ab0c};}async['runCheck'](_0x3935c5,_0x86e9fd){const _0xaffe63=new On(),_0xef0c73=_0x86e9fd?.['signal'];let _0x3b6565;const _0x36cec2=()=>{_0xaffe63['abort'](),_0x3935c5['abort']();};if(_0xef0c73){if(_0xef0c73['aborted'])return _0x36cec2(),_0xaffe63;_0xef0c73['addEventListener']('abort',_0x36cec2),_0x3b6565=()=>_0xef0c73['removeEventListener']('abort',_0x36cec2);}const _0x510328={'apiId':_0x3935c5['sourceCheck']['apiId']};try{_0x3935c5['on']('reviewCheckRunUpdated',(_0x206578,_0x441d12)=>{'aborted'===_0x441d12['status']?_0xaffe63['abort']():'error-general'!==_0x441d12['status']&&'error-chunk'!==_0x441d12['status']||(_0xaffe63['error']=bn(_0x441d12['error'],'ai-reviewcoreediting-check-run-failed',this,_0x510328));}),'aborted'!==_0xaffe63['status']&&await _0x3935c5['start']();}catch(_0x3b1673){_0xaffe63['error']=bn(_0x3b1673,'ai-reviewcoreediting-check-run-failed',this,_0x510328);}finally{_0x3b6565&&_0x3b6565();}return'error'===_0xaffe63['status']||'aborted'===_0xaffe63['status']||(_0xaffe63['addResult'](...this['_buildPerRootResults'](_0x3935c5)),_0xaffe63['status']='completed'),_0xaffe63;}buildErrorContext(_0x18750e){return{'apiId':_0x18750e['sourceCheck']['apiId']};}_buildPerRootResults(_0x48521e){const _0xe2bd08=this['buildErrorContext'](_0x48521e),_0x19fc57=this['context']['plugins']['get']('AIEditing'),_0x5cf394=this['context']['plugins']['get']('AIGateway'),_0x9c5e60=this['_groupElementsByRoot'](_0x48521e['documentData']['elements']),_0x10dd53=new Map();for(const _0x3a2ddb of bs(this['context']))_0x10dd53['set'](_0x3a2ddb['config']['get']('collaboration.channelId'),_0x3a2ddb);return _0x48521e['documentData']['roots']['map'](({channelId:_0x48b5e9,rootName:_0x1b590e})=>{const _0x400923=_0x10dd53['get'](_0x48b5e9),_0x5c5c39=new xh({'editor':_0x400923,'rootName':_0x1b590e,'channelId':_0x48b5e9,'sessionId':_0x19fc57['getSessionId'](_0x400923)}),_0x2dc3c2=_0x9c5e60['get'](_0x5c5c39['editor'])?.['get'](_0x5c5c39['rootName'])??[];_0x5c5c39['contentRawOld']=_0x2dc3c2['map'](_0xb24f31=>_0xb24f31['getContent']())['join'](''),_0x5c5c39['documentVersion']=_0x2dc3c2[0x0]?.['documentVersion']??0x1;const _0x3f4216=this['_collectResultAffectedBlocks'](_0x5c5c39,_0x48521e['results'],_0x48521e['documentData']['elements']);_0x5c5c39['affectedBlocks']=_0x3f4216;try{_0x5c5c39['contentRawNew']=Os(_0x5cf394['mergeChangesIntoContent'](_0x3f4216,_0x5c5c39['contentRawOld'],_0x5c5c39['editor']));}catch(_0x4eb5b1){_0x5c5c39['error']=bn(_0x4eb5b1,'ai-reviewcoreediting-check-run-failed',this,_0xe2bd08);}return _0x5c5c39;});}_collectResultAffectedBlocks(_0x3b6125,_0x3c59a8,_0x1cdffe){return _0x3c59a8['filter'](_0x13bf2d=>{const _0x5f1a40=_0x1cdffe['get'](_0x13bf2d['id']);return!!_0x5f1a40&&_0x5f1a40['editor']===_0x3b6125['editor']&&_0x5f1a40['rootName']===_0x3b6125['rootName'];})['map'](_0xbb388f=>({'id':_0xbb388f['id'],'content':_0xbb388f['contentNew']}));}_groupElementsByRoot(_0x58687f){const _0x1fe403=new Map();for(const _0x292753 of _0x58687f['values']()){let _0x5dbbcf=_0x1fe403['get'](_0x292753['editor']);_0x5dbbcf||(_0x5dbbcf=new Map(),_0x1fe403['set'](_0x292753['editor'],_0x5dbbcf));let _0x2b23c1=_0x5dbbcf['get'](_0x292753['rootName']);_0x2b23c1||(_0x2b23c1=[],_0x5dbbcf['set'](_0x292753['rootName'],_0x2b23c1)),_0x2b23c1['push'](_0x292753);}return _0x1fe403;}_buildDocumentDataSliceForRoot(_0x911041,_0x144e7a,_0x21c9b3,_0x187bc1){const _0x9b7a70=_0x911041['model'],_0x290020=new _0x43d2b2();for(const _0x2f6b6c of _0x144e7a['getChildren']())_0x290020['_appendChild'](_0x2f6b6c['_clone'](!0x0));for(const _0xaa6d97 of _0x9b7a70['markers']){const _0x1ff334=_0xaa6d97['getRange']();_0x1ff334&&_0x1ff334['root']['rootName']===_0x144e7a['rootName']&&_0x290020['markers']['set'](_0xaa6d97['name'],this['_changeRangeOwnerDocument'](_0x1ff334['clone'](),_0x290020));}const _0x3ae67c=new Map(),_0x53e52e=_0x9b7a70['document']['version'];if(Gs(_0x911041,_0x144e7a['rootName'])){let _0x611abc=this['_inlineRootDataIds']['get'](_0x144e7a);_0x611abc?_0x187bc1['add'](_0x611abc):(_0x611abc=_0x21c9b3['_nextDataId'](_0x187bc1),this['_inlineRootDataIds']['set'](_0x144e7a,_0x611abc));const _0xa894b7=Fs(_0x911041['data']['processor']['toData'](_0x911041['data']['toView'](_0x290020)),_0x611abc);return _0x3ae67c['set'](_0x611abc,{'editor':_0x911041,'rootName':_0x144e7a['rootName'],'path':[],'documentVersion':_0x53e52e,'getContent':()=>_0xa894b7}),{'content':_0xa894b7,'elements':_0x3ae67c};}const _0x4fecda=new _0x3bd289({'ignoreElementEnd':!0x0,'startPosition':_0x9b7a70['createPositionAt'](_0x290020,0x0)});for(const {item:_0x1bbe8c}of _0x4fecda){if(_0x1bbe8c['is']('element')&&_0x1bbe8c['name']&&Dh['includes'](_0x1bbe8c['name'])){const _0x28f9e0=this['_upsertDataId'](_0x1bbe8c,()=>_0x21c9b3['_nextDataId'](_0x187bc1));_0x187bc1['add'](_0x28f9e0);}if(!_0x1bbe8c['is']('$textProxy'))continue;const _0x5b1313=_0x1bbe8c['parent'];if(!_0x5b1313||!_0x5b1313['is']('element'))continue;const _0x449ebb=this['_upsertDataId'](_0x5b1313,()=>_0x21c9b3['_nextDataId'](_0x187bc1));_0x187bc1['add'](_0x449ebb);for(const _0x3bd6de of _0x5b1313['getChildren']())_0x3bd6de['is']('element')&&(_0x3bd6de['name']&&Ph['includes'](_0x3bd6de['name'])||_0x187bc1['add'](this['_upsertDataId'](_0x3bd6de,()=>_0x21c9b3['_nextDataId'](_0x187bc1))));let _0x1335a4=_0x5b1313;for(;_0x1335a4['parent']&&!_0x1335a4['parent']['is']('documentFragment');)_0x1335a4=_0x1335a4['parent'],_0x1335a4['hasAttribute'](_0x4e9c0c)&&_0x1335a4['_removeAttribute'](_0x4e9c0c);_0x3ae67c['set'](_0x449ebb,{'editor':_0x911041,'rootName':_0x144e7a['rootName'],'path':_0x5b1313['getPath'](),'documentVersion':_0x53e52e,'getContent':this['_createGetContentUsingDataIdFn'](_0x1335a4['_clone'](!0x0),_0x449ebb,_0x911041['data'])}),_0x4fecda['jumpTo'](_0x9b7a70['createPositionAfter'](_0x5b1313));}return{'content':_0x911041['data']['processor']['toData'](_0x911041['data']['toView'](_0x290020)),'elements':_0x3ae67c};}diffContent(_0x5da542,_0x2bdb06,_0x3c0ac8,_0x39d94f=!0x1){const {contentInitial:_0x30751b,contentNew:_0x1f260a}=this['_neutralizeChangesOnUnsupportedElements'](_0x2bdb06,_0x3c0ac8),_0x38c9fe=[],_0x1aa231=_0x5da542['data']['parse'](_0x1f260a,'$documentFragment'),_0x501274=_0x5da542['data']['parse'](_0x30751b,'$documentFragment'),_0x4dccf4=_0x5da542['model']['createPositionAt'](_0x501274,0x0);if(this['_haveSingleTopLevelElement'](_0x1aa231)){if(!this['_hasSameTopLevelElement'](_0x501274,_0x1aa231))return _0x38c9fe;}else{const _0xc1c395=_0x5da542['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x501274,_0xc1c395)||!this['_haveOnlyInlineContent'](_0x1aa231,_0xc1c395))return _0x38c9fe;}const _0x545bb1=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x30751b,_0x1f260a,{'targetEditor':_0x5da542,'anchor':_0x4dccf4,'markDeletions':!0x0})['getOperations']()['filter'](_0x128832=>'insert'===_0x128832['type']||'marker'===_0x128832['type']&&_0x128832['name']['startsWith']('$markedRemove')),_0x30d8fb=this['_groupAdjacentOperations'](_0x545bb1),_0x118358=[];if(_0x39d94f){if(_0x30d8fb['length']){const _0x164b58=_0x30d8fb[0x0]['operations'][0x0],_0x53e1f7='insert'===_0x164b58['type']?_0x164b58['position']:_0x164b58['newRange']['start'],_0x5d675e=this['_getPositionLimitingRange'](_0x53e1f7,_0x5da542,'inside'),_0x3c2601=_0x5d675e?_0x1aa231['getChild'](0x0)['getChildren']():_0x1aa231['getChildren'](),_0x1070b7=_0x5d675e||_0x5da542['model']['createRangeIn'](_0x501274),_0x28fde1=[new _0x75501a('$markedRemove:synthetic'+kt(),null,_0x1070b7,_0x5da542['model']['document']['model']['markers'],!0x0,_0x5da542['model']['document']['version']+0x1),new _0x4e3f2b(_0x1070b7['end'],_0x3c2601,_0x5da542['model']['document']['version']+0x2)];_0x118358['push']({'operations':_0x28fde1,'operationsIsolated':_0x28fde1,'groupOffset':0x0});}}else _0x118358['push'](..._0x30d8fb);let _0x1cc638=0x0;return _0x5da542['model']['change'](_0x178185=>{for(let _0x450cb0=0x0;_0x450cb0<_0x118358['length'];_0x450cb0++){const _0x2b2047=_0x118358[_0x450cb0],_0x40bff6=_0x178185['createDocumentFragment']();for(const _0x59f291 of _0x501274['getChildren']())_0x178185['append'](_0x59f291['_clone'](!0x0),_0x40bff6);for(const _0x33d366 of _0x2b2047['operationsIsolated'])if('insert'===_0x33d366['type']){const _0x184a1a=_0x33d366;_0x184a1a['baseVersion']=null,_0x184a1a['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x184a1a,_0x40bff6),_0x178185['batch']['addOperation'](_0x33d366),_0x5da542['model']['applyOperation'](_0x33d366);const _0x413151='suggestion:insertion:id:authorId:'+_0x1cc638++,_0x2acdfe=_0x5da542['model']['createRange'](_0x184a1a['position'],_0x184a1a['position']['getShiftedBy'](_0x184a1a['howMany']));_0x40bff6['markers']['set'](_0x413151,_0x2acdfe);}else{if('marker'===_0x33d366['type']&&_0x33d366['name']['startsWith']('$markedRemove')){const _0x29887b=_0x33d366,_0x41c929='suggestion:deletion:id:authorId:'+_0x1cc638++;this['_changeOperationOwnerDocument'](_0x29887b,_0x40bff6),_0x40bff6['markers']['set'](_0x41c929,_0x29887b['newRange']);}}if(_0x39d94f)_0x38c9fe['push']({..._0x2b2047,'context':this['_createGetContentFn'](_0x501274,_0x5da542['data']),'content':this['_createGetContentFn'](_0x501274,_0x5da542['data'])});else{const _0x5410c2=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x2b2047['operationsIsolated'][0x0]),_0x40bff6),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x2b2047['operationsIsolated'][_0x2b2047['operationsIsolated']['length']-0x1]),_0x40bff6),_0x5da542);_0x40bff6['markers']['set'](Lh+'suggestion-context',new _0x244cab(_0x5410c2['start'],_0x5410c2['end'])),_0x38c9fe['push']({..._0x2b2047,'context':this['_createGetContextFn'](_0x40bff6,_0x5da542['data'],{'ellipsisBefore':_0x5410c2['hasContentBefore'],'ellipsisAfter':_0x5410c2['hasContentAfter']}),'content':this['_createGetContentFn'](_0x40bff6,_0x5da542['data'])});}}}),_0x38c9fe;}markChangePositionInEditorContent(_0x22b4d1,_0x78bedb){if(!_0x22b4d1['length'])return;const _0x14ec37=_0x22b4d1[0x0]['parent']['id'],_0x51a9f5=_0x78bedb['elements']['get'](_0x14ec37);if(!_0x51a9f5)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x14ec37);const _0x5f5895=_0x51a9f5['path'],_0x258bc1=_0x51a9f5['editor'],_0x4e513a=_0x258bc1['model']['document']['getRoot'](_0x51a9f5['rootName']);if(!_0x4e513a)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x51a9f5['rootName']);const _0x3f4211=_0x258bc1['model']['document']['history']['getOperations'](_0x51a9f5['documentVersion']),_0x35e71e=[];for(const _0x95cd6d of _0x22b4d1){const _0x419409=_0x95cd6d['operationsIsolated']['map'](_0x1cb351=>this['_translateOperationToEditorContent'](_0x1cb351,_0x5f5895,_0x4e513a));if(!_0x419409||!_0x419409['length'])continue;const _0x1180a4=_0x419409['every'](_0x1e931c=>'marker'===_0x1e931c['type']&&_0x1e931c['name']['startsWith']('$markedRemove')),_0xb8ed30=_0x305f08(_0x419409,_0x3f4211,{'document':_0x258bc1['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x37f76e of _0xb8ed30)if('insert'===_0x37f76e['type']){const _0x138d88=_0x37f76e,_0x43ca6e=_0x138d88['nodes'];_0x258bc1['model']['change'](_0x4fc4ec=>{const _0x5f2048=_0x4fc4ec['createDocumentFragment']();for(const _0xf35894 of _0x43ca6e)_0x4fc4ec['append'](_0xf35894['_clone'](!0x0),_0x5f2048);_0x35e71e['push']({'start':_0x138d88['position'],'end':_0x138d88['position'],'type':'insert','groupId':_0x95cd6d['id'],'content':{'asString':this['_createGetContentFn'](_0x5f2048,_0x258bc1['data'])(),'asFragment':_0x5f2048}});});}else{if('marker'===_0x37f76e['type']&&_0x37f76e['name']['startsWith']('$markedRemove')){const _0x2979b5=_0x37f76e;let _0x44f27e='remove-text';if(_0x1180a4){const _0x53a365=this['_findAdjacentContextDistance'](_0x2979b5['newRange']['start'],'backward',_0x258bc1['model']['schema']),_0x3e3eb3=this['_findAdjacentContextDistance'](_0x2979b5['newRange']['end'],'forward',_0x258bc1['model']['schema']);if(_0x53a365||_0x3e3eb3){const _0x1a15af=_0x2979b5['newRange']['start']['getShiftedBy'](-_0x53a365),_0x2eb83d=_0x2979b5['newRange']['end']['getShiftedBy'](_0x3e3eb3);_0x35e71e['push']({'start':_0x1a15af,'end':_0x2eb83d,'groupId':_0x95cd6d['id'],'type':'remove-context'});}else _0x44f27e='remove-only';}_0x35e71e['push']({'start':_0x2979b5['newRange']['start'],'end':_0x2979b5['newRange']['end'],'groupId':_0x95cd6d['id'],'type':_0x44f27e});}}}this['_insertMarkers'](_0x35e71e,_0x258bc1);}['clearAllMarkers'](){const _0x231865=new Map();for(const _0x35a326 of this['_markers']['keys']()){const _0x15f34b=this['_markers']['get'](_0x35a326);_0x15f34b?.['editor']&&(_0x231865['has'](_0x15f34b['editor'])||_0x231865['set'](_0x15f34b['editor'],[]),_0x231865['get'](_0x15f34b['editor'])['push'](_0x35a326));}for(const [_0x174270,_0x19ccff]of _0x231865)_0x174270['model']['change'](_0x54edfb=>{for(const _0x40d8b1 of _0x19ccff)_0x174270['model']['markers']['get'](_0x40d8b1)&&_0x54edfb['removeMarker'](_0x40d8b1);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x11b54e of this['getEditors']())_0x11b54e['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x16aa69 of this['getEditors']())_0x16aa69['disableReadOnlyMode']('ai-review');}['applyChange'](_0x41bbdd,_0x1d2a64=null){const _0x264b06=_0x41bbdd['map'](_0x538f93=>this['_getMarkersDataForGroup'](_0x538f93))['flat'](),_0x2db78e=new Map();for(const _0x3051d0 of _0x264b06)_0x2db78e['has'](_0x3051d0['editor'])||_0x2db78e['set'](_0x3051d0['editor'],[]),_0x2db78e['get'](_0x3051d0['editor'])['push'](_0x3051d0);for(const [_0x50f16d,_0x4300b7]of _0x2db78e){const _0x5f6925=_0x50f16d['model'],_0x14eaca=_0x50f16d['plugins']['has']('TrackChangesEditing')?_0x50f16d['plugins']['get']('TrackChangesEditing'):null,_0x543336=_0x1d2a64&&_0x14eaca?new Set(_0x14eaca['getSuggestions']()['map'](_0x25b3d9=>_0x25b3d9['id'])):null;_0x5f6925['change'](_0x5512dc=>{const _0x2833c8=_0x5512dc['batch']['operations']['length'];for(const _0x196d8e of _0x4300b7){const _0x57d0b5=_0x50f16d['model']['markers']['get'](_0x196d8e['id']);if(_0x57d0b5){if('insert'===_0x196d8e['type']){if(!_0x196d8e['content'])continue;_0x5f6925['insertContent'](_0x196d8e['content']['asFragment']||null,_0x57d0b5['getRange']()['start']);}else'remove-text'!==_0x196d8e['type']&&'remove-only'!==_0x196d8e['type']||_0x5f6925['deleteContent'](_0x5f6925['createSelection'](_0x57d0b5['getRange']()));_0x5512dc['removeMarker'](_0x196d8e['id']),this['_markers']['delete'](_0x196d8e['id']);}}if(_0x1d2a64&&(mn(_0x5512dc['batch']['operations']['slice'](_0x2833c8),_0x1d2a64),_0x14eaca)){for(const _0x2e6daa of _0x14eaca['getSuggestions']())_0x543336['has'](_0x2e6daa['id'])||_0x2e6daa['setAttribute']('@ai',{'type':_0x1d2a64});}});}}rejectChange(_0x15c679){const _0x46b0be=this['_getMarkersDataForGroup'](_0x15c679),_0x45f8d6=new Map();for(const _0x51b576 of _0x46b0be)_0x45f8d6['has'](_0x51b576['editor'])||_0x45f8d6['set'](_0x51b576['editor'],[]),_0x45f8d6['get'](_0x51b576['editor'])['push'](_0x51b576);for(const [_0x2d0950,_0x384700]of _0x45f8d6)_0x2d0950['model']['change'](_0x11c790=>{for(const _0x2f43ca of _0x384700)_0x11c790['removeMarker'](_0x2f43ca['id']),this['_markers']['delete'](_0x2f43ca['id']);});}getEditor(){return Ss(this['context']);}getEditors(){return bs(this['context']);}getEditorForChange(_0x360d88){return this['_getMarkersDataForGroup'](_0x360d88)[0x0]?.['editor'];}getMarkerElementForChange(_0x8b36ef){const _0xa3287=Array['from'](this['_markers']['values']())['filter'](_0x4384d3=>_0x4384d3['groupId']===_0x8b36ef);if(!_0xa3287['length'])return null;const _0xed6f9c=0x1===_0xa3287['length']?_0xa3287[0x0]:this['_sortMarkers'](_0xa3287)[0x0],_0x3ba4a7=_0xed6f9c['editor']['model']['markers']['get'](_0xed6f9c['id']);return _0x3ba4a7?{'modelRange':_0x3ba4a7['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0xed6f9c['id'])}:null;}getContentElementForChange(_0x19ab0e){const _0xa0f95d=Array['from'](this['_markers']['values']())['filter'](_0x5f5b5d=>_0x5f5b5d['groupId']===_0x19ab0e);if(!_0xa0f95d['length'])return null;const _0x277a0c=0x1===_0xa0f95d['length']?_0xa0f95d[0x0]:this['_sortMarkers'](_0xa0f95d)[0x0],_0xe8afcc=_0x277a0c['editor'],_0x1193a1=_0xe8afcc['model']['markers']['get'](_0x277a0c['id']);if(!_0x1193a1)return null;const _0x393692=_0x1193a1['getRange'](),_0x11ad7b=_0xe8afcc['editing']['view']['getDomRoot'](_0x393692['root']['rootName'])||_0xe8afcc['editing']['view']['getDomRoot']();if(!_0x11ad7b||!_0x393692)return null;let _0x419578=_0x393692['start']['parent'];for(;_0x419578['parent']&&!_0x419578['parent']['is']('rootElement');)_0x419578=_0x419578['parent'];if(!_0x419578||!_0x419578['name'])return null;const _0x4106b3=_0x11ad7b['querySelector']('[data-marker-id=\x22'+_0x277a0c['id']+'\x22]');if(!_0x4106b3)return null;if(_0x419578['is']('rootElement'))return _0x4106b3;let _0x434d04=null;_0xe8afcc['model']['change'](_0x257197=>{_0x434d04=_0x257197['createDocumentFragment'](),_0x257197['append'](_0x419578['_clone'](!0x0),_0x434d04);});const _0x5db5c9=_0xe8afcc['data']['toView'](_0x434d04)['getChild'](0x0);return _0x4106b3['closest'](_0x5db5c9['name']);}reactivateMarkers(_0x22fc66){const _0x36d987=this['_getMarkersDataForGroup'](_0x22fc66);if(!_0x36d987['length'])return;const _0x4c0d97=Array['from'](this['_activeMarkers'])['sort'](),_0x84ce4a=Array['from'](new Set(_0x36d987['map'](_0x5a94a4=>_0x5a94a4['id'])))['sort']();_0x4c0d97['join']('|')!==_0x84ce4a['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x22fc66));}setMarkersInElementAsActive(_0x1eb108){const _0x131b9d=this['_getMarkersDataForGroup'](_0x1eb108);if(!_0x131b9d['length'])return;const _0x42d4a0=_0x131b9d[0x0]['editor'],_0x295bb6=new Set(_0x131b9d['map'](_0x12e698=>_0x12e698['id'])),_0x1d64c9=Array['from'](_0x295bb6['values']())['map'](_0x91da91=>_0x42d4a0['model']['markers']['get'](_0x91da91))['filter'](_0x3aa0b9=>!!_0x3aa0b9);_0x295bb6['forEach'](_0x2d92c0=>{this['_activeMarkers']['add'](_0x2d92c0);}),_0x42d4a0['model']['change'](()=>{_0x1d64c9['forEach'](_0x481ab7=>{_0x42d4a0['editing']['reconvertMarker'](_0x481ab7);});});}setAllMarkersAsInactive(){const _0x4de3ae=Array['from'](this['_activeMarkers']);if(!_0x4de3ae['length'])return;this['_activeMarkers']['clear']();const _0x2d69b6=new Map();for(const _0x47b923 of _0x4de3ae){const _0x319890=this['_markers']['get'](_0x47b923);if(!_0x319890)continue;const _0x130c47=_0x319890['editor'],_0x29c4e9=_0x130c47['model']['markers']['get'](_0x47b923);_0x29c4e9&&(_0x2d69b6['has'](_0x130c47)||_0x2d69b6['set'](_0x130c47,[]),_0x2d69b6['get'](_0x130c47)['push'](_0x29c4e9));}for(const [_0x143fa9,_0x17c448]of _0x2d69b6)_0x143fa9['model']['change'](()=>{_0x17c448['forEach'](_0x1c9057=>{_0x143fa9['editing']['reconvertMarker'](_0x1c9057);});});}_getPositionLimitingRange(_0x52d761,_0x514265,_0x2c4238='outside'){if(!_0x52d761)return null;let _0x4454e3=_0x52d761['parent'];for(;_0x4454e3&&_0x4454e3['parent']&&!_0x4454e3['parent']['is']('rootElement')&&!_0x514265['model']['schema']['isLimit'](_0x4454e3)&&!_0x514265['model']['schema']['isBlock'](_0x4454e3);)_0x4454e3=_0x4454e3['parent'];if(!_0x4454e3||!_0x4454e3['name']||_0x4454e3['is']('rootElement'))return null;let _0x4333af=null;return _0x514265['model']['change'](_0x404b3a=>{_0x4333af='inside'===_0x2c4238?_0x404b3a['createRangeIn'](_0x4454e3):_0x404b3a['createRangeOn'](_0x4454e3);}),_0x4333af;}_validateMarkers(_0xd32662,_0xd6445f){const _0x413361=Array['from'](this['_markers']['keys']()),_0x5d6c47=new Map();for(const _0x54c9a8 of _0x413361){const _0x35870d=_0xd32662['model']['markers']['get'](_0x54c9a8);if(!_0x35870d)continue;const _0x1293e4=_0x35870d['getStart']()['root']['rootName']+':'+_0x35870d['getStart']()['path'][0x0];_0x5d6c47['has'](_0x1293e4)||_0x5d6c47['set'](_0x1293e4,[]),_0x5d6c47['get'](_0x1293e4)['push'](_0x35870d);}const _0x2c1a38=new Set();for(const _0x53b266 of _0xd32662['model']['document']['differ']['getChanges']()){let _0x251524,_0xd112e0;if('insert'===_0x53b266['type'])_0xd112e0=new _0x244cab(_0x53b266['position'],_0x53b266['position']['getShiftedBy'](_0x53b266['length'])),_0x251524=_0x53b266['position']['root']['rootName']+':'+_0x53b266['position']['path'][0x0];else{if('remove'!==_0x53b266['type'])continue;_0xd112e0=new _0x244cab(_0x53b266['position']),_0x251524=_0x53b266['position']['root']['rootName']+':'+_0x53b266['position']['path'][0x0];}const _0x4bb715=_0x5d6c47['get'](_0x251524)||[];if(_0x4bb715['length']){for(const _0x876608 of _0x4bb715)if(_0xd112e0['root']['rootName']===_0x876608['getRange']()['root']['rootName']&&('insert'!==_0x53b266['type']||!_0xd112e0['containsRange'](_0x876608['getRange']()))&&(_0xd112e0['isIntersecting'](_0x876608['getRange']())||_0xd112e0['start']['isTouching'](_0x876608['getRange']()['end'])||_0xd112e0['end']['isTouching'](_0x876608['getRange']()['start']))){const _0x3d86eb=this['_parseMarkerName'](_0x876608['name']);Array['from'](this['_markers']['values']())['filter'](_0x5aa127=>_0x5aa127['groupId']===_0x3d86eb['groupId'])['forEach'](_0x43189c=>_0x2c1a38['add'](_0x43189c['id']));}}}if(_0x2c1a38['size']){for(const _0xdc2138 of _0x2c1a38)_0xd6445f['removeMarker'](_0xdc2138);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x53c170){for(const {name:_0x577eeb,data:_0x44641d}of _0x53c170['model']['document']['differ']['getChangedMarkers']()){if(!_0x577eeb['startsWith'](Lh))continue;const _0x37c038=_0x44641d['oldRange'],_0x114334=_0x44641d['newRange'],_0x45fe2b=_0x37c038&&'$graveyard'===_0x37c038['root']['rootName'],_0x32993b=_0x114334&&'$graveyard'===_0x114334['root']['rootName'];if(_0x45fe2b&&_0x32993b)continue;const _0x565b17=this['_parseMarkerName'](_0x577eeb);this['_markers']['get'](_0x577eeb)&&(_0x32993b||!_0x114334?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x577eeb,'changeId':_0x565b17['groupId']}):_0x45fe2b&&_0x114334&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x577eeb,'changeId':_0x565b17['groupId']}));}}['_parseMarkerName'](_0x5b7f60){const _0x459c56=_0x5b7f60['split'](':'),_0x5803bf=(_0x459c56[0x1]||'')['split']('_');return{'prefix':_0x459c56[0x0],'groupId':_0x5803bf[0x0],'suffix':_0x5803bf[0x1]};}_translateOperationToEditorContent(_0x26b2df,_0x50326c,_0x372a7b){if('insert'===_0x26b2df['type']){const _0x5acc83=_0x26b2df;return new _0x4e3f2b(this['_changePosition'](_0x50326c['concat'](_0x5acc83['position']['offset']),_0x372a7b),_0x5acc83['nodes'],_0x5acc83['baseVersion']);}if('marker'===_0x26b2df['type']&&_0x26b2df['name']['startsWith']('$markedRemove')){const _0x213843=_0x26b2df;return new _0x75501a(_0x213843['name'],_0x213843['oldRange'],this['_changeRange'](_0x213843['newRange'],_0x50326c['concat'](_0x213843['newRange']['start']['offset']),_0x50326c['concat'](_0x213843['newRange']['end']['offset']),_0x372a7b),_0x213843['_markers'],_0x213843['affectsData'],_0x213843['baseVersion']);}return _0x26b2df;}_groupAdjacentOperations(_0x220983){if(!_0x220983['length'])return[];const _0x494fe1=[];let _0x42280d=0x0,_0xaf6011=0x0,_0x1b2a4f=[];for(let _0xa8f78b=0x0;_0xa8f78b<=_0x220983['length'];_0xa8f78b++){const _0x882f7e=_0x220983[_0xa8f78b],_0x5e6e96=_0x220983[_0xa8f78b-0x1];!_0x882f7e||_0x5e6e96&&!this['_getOperationEnd'](_0x5e6e96)['isTouching'](this['_getOperationStart'](_0x882f7e))?(_0x494fe1['push']({'operations':_0x1b2a4f,'operationsIsolated':_0x1b2a4f['map'](_0x531389=>this['_shiftOperation'](_0x531389['clone'](),-_0xaf6011)),'groupOffset':_0x42280d}),_0x1b2a4f=_0x882f7e?[_0x882f7e]:[],_0xaf6011+=_0x42280d,_0x42280d=0x0):_0x1b2a4f['push'](_0x882f7e),_0x882f7e&&'insert'===_0x882f7e['type']&&(_0x42280d+=_0x882f7e['howMany']);}return _0x494fe1;}_findAdjacentContextDistance(_0x1927e2,_0x274e8e,_0x6ea711,_0x38b6a6=0x1){const _0x41cfa5=new _0x3bd289({'startPosition':_0x1927e2,'direction':_0x274e8e});let _0x539882=0x0;for(let _0x194251=0x0;_0x194251<_0x38b6a6;_0x194251++){let _0x44f209=0x0,_0x566b8c=!0x1,_0x269387='forward'===_0x274e8e?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x40ab64}of _0x41cfa5)if(_0x40ab64['is']('$textProxy')){const _0xbc2e8e=_0x269387['exec'](_0x40ab64['data']);if(_0xbc2e8e&&_0xbc2e8e['length']){if(_0x44f209+='forward'===_0x274e8e?_0xbc2e8e['index']+_0xbc2e8e[0x0]['length']:_0x40ab64['data']['length']-_0xbc2e8e['index'],_0xbc2e8e[0x0]['length']!==_0x40ab64['data']['length'])break;_0x566b8c=!0x0,_0x269387='forward'===_0x274e8e?/^\w+/:/\w+$/;}else{if(_0x566b8c)break;_0x44f209+=_0x40ab64['offsetSize'];}}else{if(_0x40ab64['is']('element')){_0x6ea711['isInline'](_0x40ab64)&&!_0x566b8c&&(_0x44f209+=0x1);break;}}_0x539882+=_0x44f209,_0x41cfa5['jumpTo'](_0x1927e2['getShiftedBy']('forward'===_0x274e8e?_0x539882:-_0x539882));}return _0x539882;}_getChangeContext(_0x3503db,_0x4d3182,_0x306850){const _0x244cc3=_0x306850['model']['schema'],_0x4e2c2c=this['_findAdjacentContextDistance'](_0x3503db,'backward',_0x244cc3,0x6),_0x27aaff=this['_findAdjacentContextDistance'](_0x4d3182,'forward',_0x244cc3,0x6),_0x398423=_0x3503db['getShiftedBy'](-_0x4e2c2c),_0x1c1e91=_0x4d3182['getShiftedBy'](_0x27aaff);return{'start':_0x398423,'end':_0x1c1e91,'hasContentBefore':!_0x398423['isAtStart'],'hasContentAfter':!_0x1c1e91['isAtEnd']};}_insertMarkers(_0x17197e,_0x56c1cf){const _0x1fc008=this['context']['plugins']['get']('AIEditing'),_0x4ab87a=new Set();_0x56c1cf['model']['change'](_0x1410b4=>{for(const _0x522d22 of _0x17197e){const _0x8ba5fa=''+Lh+_0x522d22['type']+':'+_0x522d22['groupId']+'_'+_0x1fc008['_nextDataId'](_0x4ab87a);this['_markers']['set'](_0x8ba5fa,{'id':_0x8ba5fa,'groupId':_0x522d22['groupId'],'type':_0x522d22['type'],'content':_0x522d22['content'],'editor':_0x56c1cf}),_0x1410b4['addMarker'](_0x8ba5fa,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1410b4['createRange'](_0x522d22['start'],_0x522d22['end'])});}});}_createGetContextFn(_0x64090,_0x3edb47,_0x304c57){let _0x3c88f='';return()=>{if(!_0x3c88f){const _0x5c7bd8=_0x3edb47['toView'](_0x64090,{'showSuggestionHighlights':!0x0});let _0x45d43f=_0x5c7bd8['getChild'](0x0);if(_0x45d43f['is']('containerElement')||(_0x45d43f=_0x5c7bd8),!_0x45d43f)return'';let _0x26b0b9=!0x1;const _0x2f8bbb=[];for(const _0x47a329 of _0x45d43f['getChildren']())_0x47a329['is']('element','span')&&_0x47a329['hasClass']('ck-ai_review-marker_context-end')&&(_0x26b0b9=!0x1),_0x26b0b9&&_0x2f8bbb['push'](_0x47a329),_0x47a329['is']('element','span')&&_0x47a329['hasClass']('ck-ai_review-marker_context-start')&&(_0x26b0b9=!0x0);_0x45d43f['_removeChildren'](0x0,_0x45d43f['childCount']),_0x304c57?.['ellipsisBefore']&&_0x45d43f['_appendChild']('…'),_0x45d43f['_appendChild'](_0x2f8bbb),_0x304c57?.['ellipsisAfter']&&_0x45d43f['_appendChild']('…');const _0x22dc44=_0x3edb47['htmlProcessor']['domConverter']['viewToDom'](_0x5c7bd8),_0x4fbfb9=_0x3edb47['htmlProcessor']['htmlWriter']['getHtml'](_0x22dc44);_0x3c88f=this['_removeUnsupportedElements'](_0x4fbfb9);}return _0x3c88f;};}_createGetContentFn(_0x3ee106,_0x4c756f){let _0x48aee1='';return()=>(_0x48aee1||(_0x48aee1=this['_removeUnsupportedElements'](_0x4c756f['stringify'](_0x3ee106,{'showSuggestionHighlights':!0x0}))),_0x48aee1);}_createGetContentUsingDataIdFn(_0xa35541,_0x3f6834,_0x4afc8f){let _0x115258='';return()=>{if(!_0x115258){const _0x2d43ad=_0x4afc8f['toView'](new _0x43d2b2(_0xa35541));_0x115258=_0x4afc8f['htmlProcessor']['domConverter']['viewToDom'](_0x2d43ad)['querySelector']('[data-id=\x22'+_0x3f6834+'\x22]')?.['outerHTML']||'';}return _0x115258;};}_removeUnsupportedElements(_0x168183){if(!_0x168183)return'';const _0x3efdf6=Rs(_0x168183,{'decodeEntities':!0x1}),_0x33d7c7=ys(_0x3efdf6);if(!_0x33d7c7['length'])return _0x168183;for(const _0x110eaa of _0x33d7c7)_0x11f553(_0x110eaa);return Os(_0x3efdf6,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x4afb56,_0x20ea94){const _0x56f427=Rs(_0x4afb56,{'decodeEntities':!0x1}),_0x4573dd=Rs(_0x20ea94,{'decodeEntities':!0x1}),_0x2dbeae=ys(_0x56f427),_0x2df301=ys(_0x4573dd);if(!_0x2dbeae['length']&&!_0x2df301['length'])return{'contentInitial':_0x4afb56,'contentNew':_0x20ea94};const _0x5db40c=new Map(),_0x455ab8=new Map();for(const _0x2a827c of _0x2dbeae){const _0x295f93=Ps(_0x2a827c,'data-id');if(_0x295f93)_0x5db40c['set'](_0x295f93,_0x2a827c);else{const _0x4dd32f=Os(_0x2a827c,{'encodeEntities':!0x1}),_0x4421ea=_0x455ab8['get'](_0x4dd32f);_0x4421ea?_0x4421ea['push'](_0x2a827c):_0x455ab8['set'](_0x4dd32f,[_0x2a827c]);}}for(const _0xa6df07 of _0x2df301){const _0x277158=Ps(_0xa6df07,'data-id');let _0x2b7923;if(_0x277158)_0x2b7923=_0x5db40c['get'](_0x277158);else{const _0x494ada=_0x455ab8['get'](Os(_0xa6df07,{'encodeEntities':!0x1}));_0x2b7923=_0x494ada&&_0x494ada['length']?_0x494ada['shift']():void 0x0;}_0x2b7923?_0x3d1fd1(_0xa6df07,_0x40285a(_0x2b7923,!0x0)):_0x11f553(_0xa6df07);}return{'contentInitial':Os(_0x56f427,{'encodeEntities':!0x1}),'contentNew':Os(_0x4573dd,{'encodeEntities':!0x1})};}_findMarkerElement(_0x177971,_0x4a1ecb=0x5){let _0x5aa667=_0x177971,_0xadb0e9=null;for(let _0x2d7b97=0x0;_0x2d7b97<_0x4a1ecb&&_0x5aa667;_0x2d7b97++)if(_0x5aa667['className']){if((''+_0x5aa667['className'])['includes']('ck-ai_review-marker_')){if(!_0x5aa667['getAttribute']('data-marker-id'))break;_0xadb0e9=_0x5aa667;break;}_0x5aa667=_0x5aa667['parentElement'];}else _0x5aa667=_0x5aa667['parentElement'];return _0xadb0e9;}_findMarkerElementById(_0x165479){const _0x1dea00=this['_markers']['get'](_0x165479);if(!_0x1dea00)return null;const _0x40020f=_0x1dea00['editor']['model']['markers']['get'](_0x165479);return _0x40020f?_0x417421(_0x1dea00['editor']['editing'],_0x40020f):null;}_getMarkersDataForGroup(_0x12b414){return Array['from'](this['_markers']['values']())['filter'](_0x297d2d=>_0x297d2d['groupId']===_0x12b414);}_getOperationStart(_0x1d3c48){return'insert'===_0x1d3c48['type']?_0x1d3c48['position']:_0x1d3c48['newRange']['start'];}_getOperationEnd(_0x4ce757,_0x3f588a=!0x1){return'insert'===_0x4ce757['type']?_0x3f588a?_0x4ce757['position']:_0x4ce757['position']['getShiftedBy'](_0x4ce757['howMany']):_0x4ce757['newRange']['end'];}_shiftOperation(_0x5919d4,_0x5c0270){return'insert'===_0x5919d4['type']?_0x5919d4['position']=_0x5919d4['position']['getShiftedBy'](_0x5c0270):'marker'===_0x5919d4['type']&&_0x5919d4['newRange']&&(_0x5919d4['newRange']=new _0x244cab(_0x5919d4['newRange']['start']['getShiftedBy'](_0x5c0270),_0x5919d4['newRange']['end']['getShiftedBy'](_0x5c0270))),_0x5919d4;}_changeOperationOwnerDocument(_0x3c0f93,_0x109ffb){'insert'===_0x3c0f93['type']?_0x3c0f93['position']=this['_changePositionOwnerDocument'](_0x3c0f93['position'],_0x109ffb):'marker'===_0x3c0f93['type']&&_0x3c0f93['newRange']&&(_0x3c0f93['newRange']=this['_changeRangeOwnerDocument'](_0x3c0f93['newRange'],_0x109ffb));}_changePositionOwnerDocument(_0xf12c86,_0x1ce1fd){return new _0x546016(_0x1ce1fd,_0xf12c86['path']);}_changeRangeOwnerDocument(_0x958fd7,_0x335b50){return new _0x244cab(this['_changePositionOwnerDocument'](_0x958fd7['start'],_0x335b50),this['_changePositionOwnerDocument'](_0x958fd7['end'],_0x335b50));}_changePosition(_0x1cb886,_0x112e2){return new _0x546016(_0x112e2,[..._0x1cb886]);}['_changeRange'](_0xda501f,_0xe08983,_0x3fceda,_0x1a55dc){return new _0x244cab(this['_changePosition'](_0xe08983,_0x1a55dc),this['_changePosition'](_0x3fceda,_0x1a55dc));}_sortMarkers(_0x2f7299){const _0x163de5=_0x9bc942=>{switch(_0x9bc942){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x2f7299['sort']((_0x2c62a0,_0x3fbc1b)=>_0x163de5(_0x2c62a0['type'])-_0x163de5(_0x3fbc1b['type']));}_hasSameTopLevelElement(_0x19ae4a,_0x559312){const _0x364b7c=_0x19ae4a['getChild'](0x0),_0x16b241=_0x559312['getChild'](0x0);return!(!_0x364b7c||!_0x16b241)&&((!_0x364b7c['is']('element')||!_0x16b241['is']('element')||_0x364b7c['name']===_0x16b241['name'])&&!(_0x364b7c['is']('element')&&!_0x16b241['is']('element')||!_0x364b7c['is']('element')&&_0x16b241['is']('element')));}_haveSingleTopLevelElement(_0xe1e130){return 0x1===_0xe1e130['childCount'];}_haveOnlyInlineContent(_0x4c7dbd,_0x58ad3c){for(const _0x47d363 of _0x4c7dbd['getChildren']())if(_0x47d363['is']('element')&&!_0x58ad3c['isInline'](_0x47d363))return!0x1;return!0x0;}_upsertDataId(_0x146316,_0x57d8f9){let _0x401543=_0x146316['getAttribute'](_0x4e9c0c);return _0x401543||(_0x401543=_0x57d8f9(),_0x146316['_setAttribute'](_0x4e9c0c,_0x401543)),_0x401543;}};const Mh=/* #__PURE__ -- @preserve */
|
|
38
|
-
dt();var
|
|
39
|
-
At();var
|
|
40
|
-
At();var Fh=class extends Gh{['id']=kt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0x11ac9c,_0x404b3f,_0x3a25cf,_0x2a53b3,_0x20e5c8,_0x7e02ad){super(),this['_sourceCheck']=_0x404b3f,this['_documentData']=_0x11ac9c,this['_aiConnector']=_0x3a25cf,this['_reviewParams']=_0x2a53b3,this['_reviewArgs']=_0x20e5c8,this['_contexts']=_0x7e02ad,this['on']('change:status',(_0x50ead7,_0x4207e7,_0x8225f0)=>{'aborted'==_0x8225f0&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x8225f0,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x50f19c=>'pending'===_0x50f19c['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x1198c8){this['_documentData']=_0x1198c8;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x4c8dee=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x537c31 of _0x4c8dee)'unmodified'!==_0x537c31['data']['operation']&&('error'!==_0x537c31['data']['operation']?'review-metadata'!==_0x537c31['event']?this['_addReviewCheckResult'](_0x537c31['data']['dataId'],_0x537c31['data']['textDelta']):this['callId']=_0x537c31['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(_0x35c7d0){this['_currentError']=_0x35c7d0,kn(_0x35c7d0)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x34165e,_0x42924f){const _0x1503d9=this['_results']['get'](_0x34165e);if(!_0x1503d9)return;if(0x0===_0x42924f['length'])return;const _0x295c78=this['_documentData']['elements']['get'](_0x34165e);if(!_0x295c78)return;const _0x517c92=[];_0x42924f['forEach']((_0x2937da,_0x383aec)=>{const _0x14cd3c=new Bh(_0x1503d9['id']+'-'+_0x383aec,_0x2937da,_0x1503d9,_0x295c78['editor']);_0x14cd3c['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x14cd3c,'status':_0x14cd3c['status']});}),_0x14cd3c['on']('change:isActivated',()=>{_0x14cd3c['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x14cd3c}):this['fire']('reviewCheckResultDeactivated',{'change':_0x14cd3c});}),this['_changes']['push'](_0x14cd3c),_0x517c92['push'](_0x14cd3c);}),this['fire']('reviewCheckResultReady',{'changes':_0x517c92,'result':_0x1503d9,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x5cee94){const _0x400585=this['_changes']['find'](_0x4b6dda=>_0x4b6dda['id']===_0x5cee94);return!(!_0x400585||'pending'!==_0x400585['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x1015a3=>!0x0===_0x1015a3['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0xef545e=>'pending'===_0xef545e['status']);}getChangeById(_0x5a8db7){return this['_changes']['find'](_0x4bc840=>_0x4bc840['id']===_0x5a8db7);}markAllChangesAsAccepted(){for(const _0xc17391 of this['_changes'])'pending'===_0xc17391['status']&&(_0xc17391['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x70101f){const _0x55a929=this['_changes']['find'](_0x3afb9c=>_0x3afb9c['id']===_0x70101f);_0x55a929&&'pending'===_0x55a929['status']&&(_0x55a929['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x543242){const _0x59a2b0=this['_changes']['find'](_0x31e471=>_0x31e471['id']===_0x543242);_0x59a2b0&&'pending'===_0x59a2b0['status']&&(_0x59a2b0['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x4be660){const _0x3ac3bb=this['_changes']['find'](_0xf95937=>_0xf95937['id']===_0x4be660);_0x3ac3bb&&'pending'===_0x3ac3bb['status']&&(_0x3ac3bb['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x54e408){const _0x2bf515=this['_changes']['find'](_0x2d1857=>_0x2d1857['id']===_0x54e408);_0x2bf515&&'outdated'===_0x2bf515['status']&&(_0x2bf515['status']='pending'),this['_checkIfFinished']();}activateChange(_0x3f7ad4){this['_changes']['filter'](_0x49f541=>_0x49f541['isActivated']&&_0x49f541['id']!==_0x3f7ad4)['forEach'](_0x1139aa=>{_0x1139aa['isActivated']=!0x1;});const _0x2d6101=this['_changes']['find'](_0x4536a0=>_0x4536a0['id']===_0x3f7ad4);_0x2d6101&&'pending'===_0x2d6101['status']&&(_0x2d6101['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x5f45be=>_0x5f45be['isActivated'])['forEach'](_0x57bbaf=>{_0x57bbaf['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x5a2090){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x51e323;if(_0x5a2090){const _0x5286bf=this['_changes']['find'](_0x499247=>_0x499247['id']===_0x5a2090);if(_0x5286bf&&_0x5286bf['isRated'])return;_0x5286bf&&(_0x51e323=_0x5286bf['parent']['id'],_0x5286bf['isRated']=!0x0);}const _0x5a79e5={'positiveCount':this['_changes']['filter'](_0x359cb2=>'accepted'===_0x359cb2['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x5a79e5,this['callId'],_0x51e323);}_addReviewCheckResult(_0x1745e8,_0x595bcd){const _0x4372fe=this['_documentData']['elements']['get'](_0x1745e8);if(!_0x4372fe)return;if(Gs(_0x4372fe['editor'],_0x4372fe['rootName'])&&!Ys(_0x4372fe['editor'],Rs(_0x595bcd)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x2959e9=_0x4372fe['getContent']();if(_0x2959e9===_0x595bcd)return;const _0x147812=new Uh({'id':_0x1745e8,'contentInitial':_0x2959e9,'contentNew':_0x595bcd,'documentVersion':_0x4372fe['documentVersion']});this['_results']['set'](_0x147812['id'],_0x147812),this['fire']('reviewCheckResultAdded',{'result':_0x147812,'source':this,'editor':_0x4372fe['editor'],'rootName':_0x4372fe['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x768e51=>'pending'===_0x768e51['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x56e4cd=>'pending'===_0x56e4cd['status'])['length']&&(this['status']='finished');}},Kh=class extends Fh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x19ebab=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x58659a=0x0;_0x58659a<this['_reviewParams']['length'];_0x58659a++){if(!this['_reviewParams'][_0x58659a]||!this['_sourceCheck']['options'][_0x58659a])continue;const _0x2930f1=this['_sourceCheck']['options'][_0x58659a]['data']?.['find'](_0x33a6a0=>_0x33a6a0['id']===this['_reviewParams'][_0x58659a]);_0x2930f1&&_0x19ebab['push'](_0x2930f1['label']);}return _0x19ebab['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x4b1631,_0x56ee51,_0xc37b8f){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x56ee51,_0x4b1631,_0xc37b8f);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Wh=class extends _0x2b8fcb{_aiConnector;['_aiReviewCoreUi'];_aiReviewCoreEditing;['_availableReviewChecks'];_reporter;_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',(_0x56d1a4,_0x5bbcd3)=>this['runCheck'](_0x5bbcd3)),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 _0x229394=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x229394['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x229394['map'](_0x5554d1=>_0x5554d1['id']),this['_aiSource']);const _0x2ae347=this['_currentReviewCheckRun'];_0x2ae347['markAllChangesAsAccepted'](),_0x2ae347['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x418030,_0x1cf9eb)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1cf9eb['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x1cf9eb['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x1cf9eb['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1cf9eb['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x3846b4,_0x4665a1)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4665a1['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x4665a1['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x4665a1['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4665a1['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x51bf0c,_0x4bb24a)=>{this['_onActivateChange'](_0x4bb24a);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x5d7c85,_0x543955)=>{this['_onDeactivateChange'](_0x543955);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x22e009,_0x2a7ad6)=>{this['_onChangeMarkerClicked'](_0x22e009,_0x2a7ad6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0xaa0014,_0x276fa0)=>{this['_onChangeMarkerHovered'](_0xaa0014,_0x276fa0);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x17b728,_0x586035)=>{this['_onChangeMarkerRemoved'](_0x17b728,_0x586035);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x15ed3d,_0x3605c9)=>{this['_onChangeMarkerRestored'](_0x15ed3d,_0x3605c9);});}async['runCheck'](_0x490100){if(!this['_availableReviewChecks'])return;const _0x8a4222=this['_availableReviewChecks']['find'](_0x151373=>_0x151373['id']===_0x490100['id']);if(!_0x8a4222)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x490100['id']}));this['_onReviewCheckRun'](_0x490100),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x4da691=this['context']['plugins']['get'](fs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x490100['id']],'context':new Yn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x490100,_0x8a4222,_0x4da691);const _0x513e3f=this['_currentReviewCheckRun'];_0x513e3f['on']('reviewCheckResultChangeStatusUpdated',(_0x1f3d67,_0x251bc6)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x251bc6['change']['id'],_0x251bc6['status']),this['_pushAcceptAllEnabled'](_0x513e3f);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x2f2af5,_0x5a8c9d)=>{switch(_0x5a8c9d['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x5a8c9d);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0x5a8c9d['status']&&'error-chunk'!==_0x5a8c9d['status']&&'error-general'!==_0x5a8c9d['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x3cf72a,_0x2c91b4)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x33a8d1=Gs(_0x2c91b4['editor'],_0x2c91b4['rootName']);let _0x55e792=_0x2c91b4['result']['contentInitial'],_0x4c92f4=_0x2c91b4['result']['contentNew'];_0x33a8d1&&(_0x55e792=Ws(_0x55e792),_0x4c92f4=Ws(_0x4c92f4));const _0x15b056=this['_diffContent'](_0x2c91b4['editor'],_0x55e792,_0x4c92f4);if(_0x33a8d1){const _0x68b9e7=_0x2c91b4['editor']['ui']['getEditableElement'](_0x2c91b4['rootName'])?.['tagName']['toLowerCase']();for(const _0x3e849d of _0x15b056)_0x3e849d['wrapperTag']=_0x68b9e7;}_0x2c91b4['source']['addResultChanges'](_0x2c91b4['result']['id'],_0x15b056);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x28230f,_0x40feeb)=>{for(const _0x557fad of _0x40feeb['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x557fad);this['_pushAcceptAllEnabled'](_0x40feeb['source']),this['_markChangePositionInEditorContent'](_0x40feeb['changes'],_0x40feeb['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0xf9f8f,_0x12d8fe)=>{this['_onReviewCheckResultActivated'](_0x12d8fe);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x13704d){if(kn(_0x13704d))return;_0x13704d instanceof ct?this['_logError'](_0x13704d):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x13704d));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x491760){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x491760['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x1fcd2e,_0x58247b,_0x42fa3f=new Yn()){return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x58247b,this['_aiConnector'],_0x1fcd2e['params'],_0x1fcd2e['args'],_0x42fa3f['refs']);}['_onChangeMarkerRemoved'](_0x3bf503,_0x1c6bcf){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x1c6bcf['changeId']);}_onChangeMarkerRestored(_0x400a41,_0xd0f0e9){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0xd0f0e9['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0xa4dc11=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0xa4dc11&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1128be of this['_aiReviewCoreEditing']['getEditors']())_0x1128be['editing']['view']['change'](_0x2738fa=>{for(const _0x1bf2a5 of _0x1128be['editing']['view']['document']['getRoots']())_0x2738fa['removeClass']('ck-ai_review-diff',_0x1bf2a5),_0x2738fa['removeClass']('ck-ai_review-highlights',_0x1bf2a5),_0x2738fa['removeClass']('ck-ai-translate-mode-content',_0x1bf2a5);});}['_logError'](_0x54fe41){this['_reporter']['logError'](_0x54fe41),'ai-review-mode-models-unable-to-retrieve'===function(_0x1c3154){return _0x1c3154 instanceof yn?_0x1c3154['code']:_0x1c3154 instanceof Error?_0x1c3154['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x54fe41)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x4b967d){if('content'===this['_changeActivationSource']){const _0x42e84e=this['_aiReviewCoreUi']['getChangeElement'](_0x4b967d);_0x42e84e&&Rt(_0x42e84e['closest']('.ck-ai_review__check-run-result')||_0x42e84e);}else{if('panel'===this['_changeActivationSource']){const _0x56dc9f=this['_getChangeContentElement'](_0x4b967d);if(!_0x56dc9f)return;Ot({'target':_0x56dc9f,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},Yh=class extends Fh{_prompt;['_model'];constructor(_0x50860f,_0x4f5f96,_0x11b9be,_0x231040,_0x2c0f86,_0x5f3c95){super(_0x11b9be,_0x231040,_0x2c0f86,void 0x0,void 0x0,_0x5f3c95),this['_prompt']=_0x50860f,this['_model']=_0x4f5f96;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0x4e84a0,_0x331059,_0x23c38c){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x331059,_0x4e84a0,_0x23c38c);}},$h=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x70c4cb){this['id']=_0x70c4cb['id'],this['commandId']=_0x70c4cb['commandId'],this['title']=_0x70c4cb['title'],this['description']=_0x70c4cb['description'],this['isParameterized']=_0x70c4cb['isParameterized'],this['useArgs']=_0x70c4cb['useArgs'],this['options']=_0x70c4cb['options'],this['args']=_0x70c4cb['args'];}},qh=class extends $h{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x1a1a4f,_0x1c629b,_0x28a0ec){super(_0x1a1a4f),this['prompt']=_0x1a1a4f['prompt'],this['context']=_0x1a1a4f['context'],this['model']=_0x1a1a4f['model'],this['model']?this['_defaultModel']=_0x1c629b['find'](_0x131eab=>_0x131eab['id']===this['model'])||null:this['_defaultModel']=_0x28a0ec;}get defaultModel(){return this['_defaultModel'];}},Qh=class extends Yh{get subTitle(){return'';}set prompt(_0x2ad14c){this['_prompt']=_0x2ad14c;}set['model'](_0x8c64c5){this['_model']=_0x8c64c5;}},Xh=class extends _0x2b8fcb{static get requires(){return[Is,Nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];_reporter;init(){this['_reporter']=this['context']['plugins']['get'](Nn)['createReporter']('aireview');}getChecksList(){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const zh=[{'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'}]}]}],jh=/* #__PURE__ -- @preserve */
|
|
41
|
-
At();var Jh=class extends jh{['_checks']=[];setupChecks(_0x321823){this['_checks']=_0x321823['map'](_0x28f578=>new $h(_0x28f578));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x5af778){return this['checks']['find'](_0x2c2197=>_0x2c2197['id']===_0x5af778);}['removeCheckById'](_0x6c2523){this['_checks']=this['_checks']['filter'](_0x4679d0=>_0x4679d0['id']!==_0x6c2523);}},Zh=class extends $h{['_models']=[];_defaultModel=null;constructor(_0x2958a1,_0x765178,_0x54fd9d){super(_0x2958a1),this['_models']=_0x765178,this['_defaultModel']=_0x54fd9d;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},tc=class extends Jh{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x2f13e8,_0xaf3bb6,_0x1b3f5d){super(),this['_allModels']=_0x2f13e8,this['_recommendedModels']=_0xaf3bb6,this['_defaultModel']=_0x1b3f5d;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x32c98a){this['_checks']=_0x32c98a['map'](_0x2327d6=>!0x0===_0x2327d6['isExtra']?new qh(_0x2327d6,this['_allModels'],this['_defaultModel']):'custom'===_0x2327d6['id']?new Zh(_0x2327d6,this['_recommendedModels'],this['_defaultModel']):new $h(_0x2327d6));}},ec=class extends Xh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Is,Nn,fs];}['_modelsLoadError']=null;constructor(_0x2a08b3){super(_0x2a08b3),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x1f86bb=>({'id':_0x1f86bb['id'],'commandId':_0x1f86bb['id'],'title':_0x1f86bb['label'],'description':_0x1f86bb['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x1f86bb['prompt'],'context':_0x1f86bb['context'],'model':_0x1f86bb['model']}));}async _loadChecksList(){const _0x475bfe=[...zh,...this['getExtraChecks']()]['map'](_0x417d7b=>_0x417d7b['isExtra']?_0x417d7b:this['_translateReviewCheck'](_0x417d7b)),_0x3f51b0=this['context']['plugins']['get'](fs);let _0x3c41dd;try{_0x3c41dd=new tc(await _0x3f51b0['models']['getAllModels'](),await _0x3f51b0['models']['getAvailableModels'](),await _0x3f51b0['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x120f80){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x120f80),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x3c41dd=new tc([],[],null);}return _0x3c41dd['setupChecks'](_0x475bfe),_0x3c41dd;}_translateReviewCheck(_0x33bbe6){const _0x151791='AI_REVIEW_CHECK_'+_0x33bbe6['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x2590b5={..._0x33bbe6,'title':this['_translate'](_0x151791+'_TITLE',_0x33bbe6['title']),'description':this['_translate'](_0x151791+'_DESCRIPTION',_0x33bbe6['description'])};return _0x33bbe6['options']&&(_0x2590b5['options']=_0x33bbe6['options']['map'](_0x513ae9=>({..._0x513ae9,'label':this['_translate'](_0x151791+'_OPTIONS_LABEL',_0x513ae9['label']||''),'data':_0x513ae9['data']?_0x513ae9['data']['map'](_0xecd235=>({..._0xecd235,'label':this['_translate'](_0x151791+'_OPTIONS_DATA_'+_0xecd235['id']['toUpperCase'](),_0xecd235['label'])})):void 0x0}))),_0x2590b5;}_translate(_0x170cef,_0xa14d9b){const _0x51e742=Es(this['context']['locale'],_0x170cef);return _0x51e742===_0x170cef?_0xa14d9b:_0x51e742;}},ic=class extends Wh{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Nn,ec,fs];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x3a8752){super(_0x3a8752),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',zh['map'](_0x2217e4=>_0x2217e4['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x1899b4,_0x395023)=>{this['_isDiffOn']=_0x395023['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x3c14ad,_0x299292,_0x595219=new Yn()){if(_0x3c14ad['isCustom'])return new Yh(_0x3c14ad['args']['prompt'],_0x3c14ad['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x299292,this['_aiConnector'],_0x595219['refs']);if(_0x299292['isExtra']){const _0x312632=_0x299292,_0x30c94a=_0x312632['context']?_0x595219['cloneWith'](_0x312632['context'])['refs']:_0x595219['refs'];return new Qh(_0x3c14ad['args']?.['prompt']??_0x312632['prompt'],_0x3c14ad['args']?.['model']??_0x312632['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x299292,this['_aiConnector'],_0x30c94a);}return new Kh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x299292,this['_aiConnector'],_0x3c14ad['params'],_0x3c14ad['args'],_0x595219['refs']);}_onReviewCheckResultActivated(_0x2ebf98){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x2ebf98['change']['id']),this['_scrollToChange'](_0x2ebf98['change']['id']);const _0x220d16=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2ebf98['change']['id']);if(!_0x220d16)return;const _0x1858c8=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2ebf98['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x2ebf98['change'],()=>_0x220d16['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x1858c8,_0x220d16['modelRange']['root']['rootName']),_0x1858c8?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x2ebf98['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x26d740){this['_currentReviewCheckRun']&&'click'===_0x26d740['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x26d740['id']));}_onDeactivateChange(_0x3994ed){this['_currentReviewCheckRun']&&'balloon'===_0x3994ed['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x34dd0d,_0x5dd8af){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5dd8af['changeId']);const _0x11ae0e=this['_currentReviewCheckRun']['getChangeById'](_0x5dd8af['changeId']);if(!_0x11ae0e)return;const _0x38014a=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5dd8af['changeId']),_0x2fcf5e=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5dd8af['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x11ae0e,_0x5dd8af['markerElement'],_0x5dd8af['domEvent'],'click',this['_getBalloonDomRoot'](_0x2fcf5e,_0x38014a?.['modelRange']['root']['rootName']),_0x2fcf5e?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x1c4e55,_0x51b08b){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x45e43d=this['_currentReviewCheckRun']['getChangeById'](_0x51b08b['changeId']);if(!_0x45e43d)return;const _0x4bea46=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x51b08b['changeId']),_0x4a4c3b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x51b08b['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x45e43d,_0x51b08b['markerElement'],_0x51b08b['domEvent'],'hover',this['_getBalloonDomRoot'](_0x4a4c3b,_0x4bea46?.['modelRange']['root']['rootName']),_0x4a4c3b?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x6504dd){const _0x1d1710=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x6504dd);return _0x1d1710?_0x1d1710['getElement']():null;}_markChangePositionInEditorContent(_0x237479,_0x1b82c1){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x237479,_0x1b82c1);}_diffContent(_0xb87ac5,_0x36d60a,_0x833372){return this['_aiReviewCoreEditing']['diffContent'](_0xb87ac5,_0x36d60a,_0x833372,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2309f6){_0x2309f6?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x2a8cd2 of this['_aiReviewCoreEditing']['getEditors']())_0x2a8cd2['editing']['view']['change'](_0x5899f5=>{for(const _0x4dd109 of _0x2a8cd2['editing']['view']['document']['getRoots']()){for(const _0x597320 of _0x4dd109['getClassNames']())_0x597320['startsWith']('ck-ai_review-')&&_0x5899f5['removeClass'](_0x597320,_0x4dd109);_0x5899f5['addClass'](_0x2309f6?'ck-ai_review-diff':'ck-ai_review-highlights',_0x4dd109);}});}_getBalloonDomRoot(_0x1c38c1,_0x1349c2){const _0x548636=_0x1c38c1['editing']['view'];if(_0x1349c2){const _0x151749=_0x548636['getDomRoot'](_0x1349c2);if(_0x151749)return _0x151749;}return _0x548636['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x260f87=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x3d4c96=await _0x260f87['getChecksList']();_0x260f87['modelsLoadError']&&this['_logError'](_0x260f87['modelsLoadError']);let _0x426cc1=_0x3d4c96['checks'];const _0x58ec0c=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x58ec0c,_0x426cc1),this['_usesAvailableCommandsConfig']&&(_0x426cc1=_0x58ec0c['map'](_0x43bc12=>_0x426cc1['find'](_0x87c651=>_0x87c651['id']===_0x43bc12))['filter'](_0x12595a=>!!_0x12595a)),this['_filterChecksWithMissingModel'](_0x426cc1);}_logWarningForNonExistentChecks(_0x5aeb2e,_0x1cb55a){const _0x2cdb4c=_0x5aeb2e['filter'](_0x1bc05d=>!_0x1cb55a['some'](_0x477a59=>_0x477a59['id']===_0x1bc05d));_0x2cdb4c['length']&&this['_reporter']['logError'](new yn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2cdb4c['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x35c57d){const _0x166fb8=[];return _0x35c57d['forEach'](_0x560f5e=>{(_0x560f5e instanceof qh&&!_0x560f5e['defaultModel']||_0x560f5e instanceof Zh&&!_0x560f5e['models']['length'])&&_0x166fb8['push'](_0x560f5e['id']);}),_0x166fb8['length']&&_0x166fb8['forEach'](_0x1818bd=>{_0x35c57d=_0x35c57d['filter'](_0x337daf=>_0x337daf['id']!==_0x1818bd),this['_reporter']['logError'](new yn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x1818bd}}));}),_0x35c57d;}},sc=class extends _0x2b8fcb{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Hh,ec,Is,tn,Tn,fs];}get['models'](){return this['context']['plugins']['get'](fs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x36d554=>{const _0x45f920={'id':_0x36d554['id'],'title':_0x36d554['title'],'description':_0x36d554['description']};return'custom'!==_0x36d554['id']&&_0x36d554['options']?.['length']&&(_0x45f920['parameters']=_0x36d554['options'][0x0]['data']['map'](_0x181fb6=>({..._0x181fb6}))),_0x45f920;});}async['runReview'](_0x2fdf01,_0x2de00a){const _0x22aef4=await this['_resolveReviewCheck'](_0x2fdf01),_0x1d1438=this['context']['plugins']['get']('AIReviewCoreEditing'),_0xfe1ae7=this['context']['plugins']['get']('AIConnector'),_0x2e2e95=_0x1d1438['getDocumentData']({'roots':_0x2de00a?.['roots']}),_0x4e823f=this['_createReviewCheckRun'](_0x22aef4,_0x2e2e95,_0xfe1ae7,_0x2de00a?.['parameterId'],_0x2de00a?.['contexts']);return _0x1d1438['runCheck'](_0x4e823f,{'signal':_0x2de00a?.['signal']});}async runCustomReview(_0x1450d3,_0x4c65ba){const {reviewCheck:_0x590f40,resolvedModel:_0x525497}=await this['_resolveCustomReviewCheck'](_0x1450d3,_0x4c65ba?.['model']),_0x3fe428=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x1d8381=this['context']['plugins']['get']('AIConnector'),_0x504af1=new Yh(_0x1450d3,_0x525497,_0x3fe428['getDocumentData']({'roots':_0x4c65ba?.['roots']}),_0x590f40,_0x1d8381,_0x4c65ba?.['contexts']);return _0x3fe428['runCheck'](_0x504af1,{'signal':_0x4c65ba?.['signal']});}['applyReview'](_0xbd226e,_0x2b3be2){this['context']['plugins']['get']('AIGateway')['apply'](_0xbd226e,{'aiSource':'review',..._0x2b3be2});}async['_resolveReviewCheck'](_0x3d223c){const _0x5a881b=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x176886=>_0x176886['id']===_0x3d223c);if(!_0x5a881b)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x3d223c});if(_0x5a881b instanceof Zh)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x3d223c});if(_0x5a881b instanceof qh&&!_0x5a881b['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x3d223c});return _0x5a881b;}async _resolveCustomReviewCheck(_0x24a74e,_0x6a2cde){const _0x4e2fad='custom',_0x15f34c=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x42a6db=>_0x42a6db['id']===_0x4e2fad);if(!_0x15f34c)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x4e2fad});if(!(_0x15f34c instanceof Zh))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x4e2fad});if(!_0x24a74e)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x4e2fad});const _0x30ee09=_0x6a2cde??_0x15f34c['defaultModel']?.['id'];if(!_0x30ee09)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x4e2fad});return{'reviewCheck':_0x15f34c,'resolvedModel':_0x30ee09};}_createReviewCheckRun(_0x2865f7,_0x4b26d1,_0x5756a3,_0x393f31,_0x3fdc5=[]){if(_0x2865f7 instanceof qh){const _0x26d534=_0x2865f7['context']?[..._0x3fdc5,_0x2865f7['context']]:_0x3fdc5;return new Qh(_0x2865f7['prompt'],_0x2865f7['defaultModel']['id'],_0x4b26d1,_0x2865f7,_0x5756a3,_0x26d534);}return new Kh(_0x4b26d1,_0x2865f7,_0x5756a3,_0x393f31?[_0x393f31]:void 0x0,void 0x0,_0x3fdc5);}},nc=class extends _0x2b8fcb{static get requires(){return[ic,Nh,Hh,sc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x501ab8,_0x2bf460){if(this['assertStartReviewPreconditions'](_0x501ab8)instanceof Zh)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x501ab8});nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x501ab8,'params':_0x2bf460?.['parameterId']?[_0x2bf460['parameterId']]:void 0x0});}async startCustomReview(_0x4e1510,_0x5463c7){if(!_0x4e1510)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x2be966=zh['find'](_0x523914=>'custom'===_0x523914['commandId'])['id'],_0x53d850=this['assertStartReviewPreconditions'](_0x2be966),_0x32f985=_0x5463c7?.['model']??_0x53d850['defaultModel']?.['id'];if(!_0x32f985)throw new ct('ai-reviewmode-missing-custom-command-model',this);nh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x2be966,'isCustom':!0x0,'args':{'prompt':_0x4e1510,'model':_0x32f985}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0xbb9f92=>{const _0x4feb80={'id':_0xbb9f92['id'],'title':_0xbb9f92['title'],'description':_0xbb9f92['description']};return'custom'!==_0xbb9f92['id']&&_0xbb9f92['options']?.['length']&&(_0x4feb80['parameters']=_0xbb9f92['options'][0x0]['data']['map'](_0x51f335=>({..._0x51f335}))),_0x4feb80;});}assertStartReviewPreconditions(_0x2da72f){const _0x3d55d3=this['context']['plugins']['get']('AIReviewModeController');if(_0x3d55d3['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x1b1dc3=_0x3d55d3['getAvailableChecks']()['find'](_0x55d447=>_0x55d447['id']===_0x2da72f);if(!_0x1b1dc3)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x2da72f});return _0x1b1dc3;}},rc=class extends Kh{_title;constructor(_0x5008fa,_0x276131,_0x25fda8,_0x5ac75c,_0x242bba,_0x68e9b1,_0x24d672){super(_0x5008fa,_0x276131,_0x25fda8,_0x242bba,_0x68e9b1,_0x24d672),this['_title']=_0x5ac75c;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},oc=class extends $h{get['apiId'](){return'translate';}},ac=class extends Jh{setupChecks(_0x3a0f31){this['_checks']=_0x3a0f31['map'](_0x24207c=>new oc(_0x24207c));}};const hc=[{'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'}];var cc=class extends Xh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x4ec9d0){super(_0x4ec9d0),this['context']['config']['define']('ai.translate.languages',hc);}async _loadChecksList(){const _0x1554ff=[],_0x33ffa8=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x118efa of _0x33ffa8)_0x1554ff['push']({'title':_0x118efa['label'],'id':_0x118efa['id'],'commandId':_0x118efa['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x118efa['id']}});const _0x2e1fc2=new ac();return _0x2e1fc2['setupChecks'](this['_translateChecks'](_0x1554ff)),_0x2e1fc2;}_translateChecks(_0x1ff4c7){const _0x252200=this['context']['locale'];return _0x1ff4c7['map'](_0x365a2c=>{const _0x499175='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x365a2c['title']['toUpperCase']()['replaceAll']('-','_'),_0x2e5e26=Es(_0x252200,_0x499175);return{..._0x365a2c,'title':_0x2e5e26===_0x499175?_0x365a2c['title']:_0x2e5e26};});}},lc=class extends Wh{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Nn,cc,fs];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x348935,_0x28fc2c,_0x4f9d38){return new rc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x28fc2c,this['_aiConnector'],Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x348935['params'],_0x348935['args'],_0x4f9d38?.['refs']);}_onReviewCheckResultActivated(_0x5e41b0){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5e41b0['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5e41b0['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x4127f4){this['_currentReviewCheckRun']&&('hover'===_0x4127f4['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4127f4['id'])),'click'===_0x4127f4['uiInteraction']&&this['_scrollToChange'](_0x4127f4['id']));}_onDeactivateChange(_0x209a00){this['_currentReviewCheckRun']&&'panel'===_0x209a00['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x2a55b6,_0x4cd1a5){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4cd1a5['changeId']),this['_scrollToChange'](_0x4cd1a5['changeId']));}['_onChangeMarkerHovered'](_0x3470fe,_0x1d2afb){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1d2afb['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x1d2afb['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x2a9608){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x2a9608);}_markChangePositionInEditorContent(_0x57511c,_0xc63b96){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x57511c,_0xc63b96);}_diffContent(_0x3d1aef,_0x55f94e,_0x58c129){return this['_aiReviewCoreEditing']['diffContent'](_0x3d1aef,_0x55f94e,_0x58c129,!0x0);}['_onReviewCheckRun'](){for(const _0x48e761 of this['_aiReviewCoreEditing']['getEditors']())_0x48e761['editing']['view']['change'](_0x26a9b7=>{for(const _0x49ea9d of _0x48e761['editing']['view']['document']['getRoots']())_0x26a9b7['addClass']('ck-ai-translate-mode-content',_0x49ea9d);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},uc=class extends fh{constructor(_0x2d178c,_0x52dcaa){super(_0x2d178c,_0x52dcaa),this['on']('set:isLoading',(_0x1e2c99,_0x1855be,_0x53ac28)=>{_0x53ac28&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x420b2a,_0x31c022,_0x39993d)=>{_0x39993d&&(this['headerTitle']=Es(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x512bb0=super['_createAcceptAllButtonView']();return _0x512bb0['set']('label',Es(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x512bb0;}_createExitReviewButtonView(){const _0x549499=super['_createExitReviewButtonView']();return _0x549499['set']('label',Es(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x549499;}},dc=class extends yh{_setupTemplate(){const _0x4a646e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x4a646e['if']('isVisible','ck-hidden',_0x4df12e=>!_0x4df12e)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Es(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x4a646e['if']('isVisible','ck-hidden',_0x2866a6=>!_0x2866a6)]},'children':this['_checkViews']}]});}},_c=class extends mh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x23a188=this['context']['plugins']['get']('AITabs'),_0x3ef72b=this['context']['locale'],_0xbe9994=new ua(_0x3ef72b,{'label':Es(_0x3ef72b,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0xa83078,'class':'ck-ai-header_review-translate','showResizeButton':_0x23a188['showResizeButton']});_0xbe9994['delegate']('resizeTabs')['to'](_0x23a188),_0xbe9994['bind']('isMaximized')['to'](_0x23a188['view'],'isMaximized',_0x24581d=>_0x24581d);const _0x3ac44e=new wh(_0x3ef72b,{'header':_0xbe9994,'list':new dc(_0x3ef72b),'results':new uc(_0x3ef72b,{'generalErrorText':Es(_0x3ef72b,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new bh(_0x3ef72b,{'headerText':Es(_0x3ef72b,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Es(_0x3ef72b,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Es(_0x3ef72b,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x3ac44e['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x3ac44e;}registerTab(){const _0x369c79=this['context']['plugins']['get']('AITabs');_0x369c79['view']['on']('activateTab',(_0x57af41,{newTab:_0x74d734,oldTab:_0x5a3ba6})=>{'translate'===_0x74d734?this['fire']('getReviewCheckList'):'translate'===_0x5a3ba6&&this['fire']('leaveReview');}),_0x369c79['view']['addTab']({'id':'translate','buttonLabel':Es(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0xa83078,'order':0x0,'content':this['_mainView']});}},gc=class extends _0x2b8fcb{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Hh,Is,tn,Tn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x71a79,_0x201e07){const _0x4cf952=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x46ace8=this['context']['plugins']['get']('AIConnector'),_0x5dc867=new oc({'id':_0x71a79,'commandId':_0x71a79,'title':_0x71a79,'description':'','isParameterized':!0x1}),_0x5eb621=new Kh(_0x4cf952['getDocumentData']({'roots':_0x201e07?.['roots']}),_0x5dc867,_0x46ace8,void 0x0,{'language':_0x71a79},_0x201e07?.['contexts']);return _0x4cf952['runCheck'](_0x5eb621,{'signal':_0x201e07?.['signal']});}applyTranslate(_0x53b256,_0x4e402c){this['context']['plugins']['get']('AIGateway')['apply'](_0x53b256,_0x4e402c);}},Ac=class extends _0x2b8fcb{static get requires(){return[lc,_c,Hh,gc];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x65c532){const _0x6a0084=this['assertStartTranslatePreconditions'](_0x65c532);nh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x6a0084['id'],'args':_0x6a0084['useArgs']?_0x6a0084['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1da512=>({'id':_0x1da512['id'],'label':_0x1da512['title']}));}assertStartTranslatePreconditions(_0x55ad59){const _0x496882=this['context']['plugins']['get']('AITranslateController');if(_0x496882['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0xb5cd81=_0x496882['getAvailableChecks']()['find'](_0x8f136e=>_0x8f136e['id']===_0x55ad59);if(!_0xb5cd81)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x55ad59});return _0xb5cd81;}};export{gh as AIActions,Li as AIAdapter,ss as AIAssistant,ts as AIAssistantUI,Va as AIBalloon,ka as AIChat,er as AIChatController,ho as AIChatFeedCustomElementView,va as AIChatHistory,Oa as AIChatHistoryController,Ca as AIChatHistoryUI,Xn as AIChatInteraction,La as AIChatShortcuts,Aa as AIChatUI,xh as AICheckRunSingleRootResult,Is as AIConnector,Yn as AIContext,Cs as AIContextLibrary,fs as AICore,yn as AICoreError,vn as AIDocumentProcessingGateway,Rn as AIDocumentProcessingRunResult,tn as AIEditing,Wa as AIEditorIntegration,xn as AIErrorReporter,Nn as AIErrorSink,Tn as AIGateway,Fn as AIInteraction,Ts as AIModels,Ah as AIQuickActions,ih as AIQuickActionsUI,Vn as AIReply,Pi as AIRequestError,$h as AIReviewCheck,Uh as AIReviewCheckResult,Bh as AIReviewCheckResultChange,Fh as AIReviewCheckRun,sc as AIReviewGateway,nc as AIReviewMode,Wh as AIReviewModeController,Hh as AIReviewModeEditing,Nh as AIReviewModeUI,On as AIRunResult,Sn as AIRunSingleRootResult,gs as AITabs,_s as AITabsMainView,ls as AITabsView,rs as AITextAdapter,Da as AIToggleButtonUI,Ac as AITranslate,lc as AITranslateController,gc as AITranslateGateway,_c as AITranslateUI,as as AWSTextAdapter,os as OpenAITextAdapter,Hi as ShowAIAssistantCommand,Pa as ToggleAICommand,Hn as createResizeButton,ns as getDefaultAICommands,mn as markOperationsAsAI};
|
|
23
|
+
import{Command as _0x4045df,ContextPlugin as _0x22445f,Editor as _0x46bd64,Plugin as _0x46e624,rootAcceptsBlocks as _0x1f1c63}from'@ckeditor/ckeditor5-core';import{IconAI as _0x495b19,IconAIAdjustLength as _0x54087e,IconAIAskAI as _0x2e6222,IconAIChangeTone as _0x1389f4,IconAIChat as _0x124b53,IconAIChatCommands as _0x12b372,IconAIContinueWriting as _0x1abbfe,IconAIGrammarCheck as _0xb41f6f,IconAIHistory as _0x4879bc,IconAIImproveWriting as _0x1a8f4f,IconAIOther as _0x1de49e,IconAIQuickActions as _0x3e8565,IconAIReview as _0xceba15,IconAITranslate as _0x2165a0,IconBoxWithCheck as _0xf297ae,IconBoxWithCross as _0x34cc7e,IconBoxWithMarker as _0x2f52f1,IconBrowseFiles as _0xdabe5e,IconBulb as _0x1b0d06,IconCancel as _0x566e32,IconCheck as _0x8456a1,IconChevronDown as _0x2cf145,IconChevronRight as _0x527231,IconChevronUp as _0x1b3c5d,IconCopy as _0x3b88cb,IconDocument as _0x2f3b78,IconDocumentOutline as _0x2cd05d,IconDropdownArrow as _0x222309,IconError as _0x32aaf6,IconEye as _0x1dd131,IconEyeCrossedOut as _0x5d0880,IconFileUpload as _0x4bb3b0,IconImage as _0xb6322a,IconInfo as _0x1fe15f,IconLink as _0x935068,IconLoupe as _0x19d494,IconMagicWand as _0x448e9d,IconMaximize as _0x36ebd0,IconMinimize as _0x55f6f7,IconNextArrow as _0x2e4748,IconOutdated as _0x47ab83,IconPaperClip as _0x47094d,IconPin as _0x3306fa,IconPlus as _0x424bea,IconPreviousArrow as _0x48d93b,IconRefresh as _0x5c57af,IconRevisionHistory as _0x11df23,IconRobotPencil as _0x27eab1,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,decodeLicenseKey as mt,first as Tt,getConstrainedViewportRect as wt,global as Ct,insertToPriorityArray as ft,isFeatureBlockedByLicenseKey as bt,isVisible as St,logError as Rt,logWarning as Ot,scrollAncestorsToShowTarget as vt,scrollViewportToShowTarget as kt,toArray as yt,uid as Nt,version as xt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Lt,BalloonPanelView as Pt,BalloonToolbar as Dt,BodyCollection as Ht,ButtonLabelView as Mt,ButtonLabelWithHighlightView as Ut,ButtonView as Vt,Dialog as Bt,DialogViewPosition as Gt,DropdownMenuPanelPositioningFunctions as Ft,FileDialogButtonView as Kt,FocusCycler as Wt,FormHeaderView as Yt,FormRowView as $t,HighlightedTextView as qt,IconView as Qt,InputTextView as Xt,LabeledFieldView as zt,ListItemButtonView as jt,ListItemGroupView as Jt,ListItemView as Zt,ListView as te,MenuBarMenuListItemButtonView as _0x5a4190,MenuBarMenuListItemView as _0x1a3b09,MenuBarMenuListView as _0x2fab50,MenuBarMenuView as _0x135eb0,SearchTextView as _0x3bf48d,SpinnerView as _0x5ad72d,Template as _0x5a9c07,TextareaView as _0x3c3562,ToolbarView as _0x5b0bf4,UIModel as _0x27fe92,View as _0x20e82c,ViewCollection as _0x261c11,addListToDropdown as _0x534621,addMenuToDropdown as _0x28d5d1,clickOutsideHandler as _0x317702,createDropdown as _0x28f0f7,createLabeledInputText as _0x3fee4b,createLabeledTextarea as _0x545d11,submitHandler as _0x34e1b6}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x5cb03c,ClipboardPipeline as _0x978459}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x5cd7cc,MarkerOperation as _0x14b1b9,Matcher as _0x28b3be,ModelDocumentFragment as _0x230b9b,ModelPosition as _0x273953,ModelRange as _0x5a312a,ModelTreeWalker as _0x16c553,ViewDataTransfer as _0x3423bb,ViewDocumentDomEventData as _0x346fb5,ViewDowncastWriter as _0xe49d24,ViewUpcastWriter as _0xe37cb8,_DetachOperation as _0x4a9b8c,_insertIntoModelNodeList as _0x326122,_removeFromModelNodeList as _0x46eb59,transformOperationSets as _0x371d73}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x23d12f,debounce as _0x41febd,escape as _0x4150e0,escapeRegExp as _0x5b1451,omit as _0x45d313,throttle as _0x147a08,unescape as _0x64883}from'es-toolkit/compat';import{createParser as _0x5201cf}from'eventsource-parser';import{CloudServices as _0x36025b}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x4a6a03}from'htmlparser2';import{append as _0x4fa092,appendChild as _0x44faed,find as _0x4ff60b,findAll as _0x4f9d25,findOne as _0x2bff0b,getChildren as _0x546497,getParent as _0x2073f4,isComment as ti,isTag as _0x5431e6,prepend as _0xed3d66,prependChild as _0x53ea60,removeElement as _0x539e1a,replaceElement as _0x3fd27e,textContent as _0x3bd5ab}from'domutils';import _0x54291f from'dom-serializer';import{Document as _0x56ff8a,Element as _0x28af91,NodeWithChildren as _0x2eddce,Text as _0x2e8b1a,cloneNode as _0x355d5c,isDocument as _0x36d647,isText as _0x8b9a17}from'domhandler';import{ConfirmMixin as _0x3a3fce,DATA_ID_MODEL_ATTRIBUTE as _0x3ebabe,DATA_ID_VIEW_ATTRIBUTE as _0x1caeff,DocumentCompare as _0xc19772,PillView as _0x5b20b6,SuggestionsConversion as _0x2bcf6c,fixElementSuggestionRange as _0x5604a5,getAllMarkersDomElementsSorted as _0x305ebf,getMarkerDomElement as _0x18ff2b,isInvalidAttributeOperation as _0x48583f}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x136925,MarkdownGfmMdToHtmlDefaultPlugins as _0x1bf1db}from'@ckeditor/ckeditor5-markdown-gfm';import _0x386673 from'rehype-sanitize';import _0x357904 from'morphdom';import{diffArrays as _0x5283bd}from'diff';const yi='_ungrouppedCommands';function Ni(_0x13a779,_0x1551af){const _0x5e00f6=(0x0,_0x1551af['t'])('Other');return _0x13a779['length']?'groupId'in _0x13a779[0x0]?_0x13a779:[{'groupId':yi,'groupLabel':_0x5e00f6,'order':0x1/0x0,'commands':_0x13a779}]:[{'groupId':yi,'groupLabel':_0x5e00f6,'order':0x1/0x0,'commands':[]}];}const xi=globalThis['DataTransfer'],Li='ai-ui';var Pi=class extends _0x46e624{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x139351}=this,_0x338a53=['ck-fake-ai-selection'];_0x139351['config']['get']('ai.assistant.useTheme')&&_0x338a53['push']('ck-ai-assistant-ui_theme'),_0x139351['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Li,'view':{'classes':_0x338a53,'priority':0xc}}),_0x139351['conversion']['for']('editingDowncast')['markerToElement']({'model':Li,'view':(_0x79fdc5,{writer:_0x3b1bb3})=>{if(!_0x79fdc5['markerRange']['isCollapsed'])return null;const _0x527dcd=_0x3b1bb3['createUIElement']('span');return _0x3b1bb3['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x527dcd),_0x527dcd;}});}afterInit(){this['_blockIfRemovedByLicenseKey'](),async function(_0x4b8186){const _0x17e19b='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x254d37=0x791b8,_0x5652c3=window['Date']['now'](),_0x4b5323=_0x4b8186['editor'],_0x1851c8=new window['Promise'](_0x2de3ef=>{_0x4b5323['once']('ready',_0x2de3ef);}),_0x3894d4={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x2cc90a=_0x4b5323['config']['get']('licenseKey');async function _0x14ccba(){let _0x289885,_0x7bec14=null,_0xf618e=null;try{return'GPL'==_0x2cc90a?'NotAllowed':(_0x289885=_0x3b99db(),_0x289885?(_0x289885['usageEndpoint']&&(_0xf618e=_0x298fea(_0x289885['usageEndpoint'],_0x289885['jti'])),await _0x5dec3f()?_0x4178d1()?_0x226e9a()?'Expired':_0x559bde()?('evaluation'==_0x289885['licenseType']&&(_0x7bec14=_0x2b300e('EvaluationLimit')),await _0x325c1c()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x226e9a(){const _0x25734f=['evaluation','trial']['includes'](_0x289885['licenseType'])?_0x5652c3/0x3e8:0xe10*_0x254d37;return _0x289885['exp']<_0x25734f;}function _0x4178d1(){const _0x59af97=_0x289885['features'];return!!_0x59af97&&(!!_0x59af97['includes']('*')||!!_0x59af97['includes']('AI'));}function _0x559bde(){const _0x2ee3f7=_0x289885['licensedHosts'];if(!_0x2ee3f7||0x0==_0x2ee3f7['length'])return!0x0;const {hostname:_0x2a0dbf}=new URL(window['location']['href']);if(_0x2ee3f7['includes'](_0x2a0dbf))return!0x0;const _0x41a61f=_0x2a0dbf['split']('.');return _0x2ee3f7['filter'](_0x3be9e7=>_0x3be9e7['includes']('*'))['map'](_0x5b0948=>_0x5b0948['split']('.'))['filter'](_0x3d0e49=>_0x3d0e49['length']<=_0x41a61f['length'])['map'](_0x8a1ab1=>Array(_0x41a61f['length']-_0x8a1ab1['length'])['fill']('*'===_0x8a1ab1[0x0]?'*':'')['concat'](_0x8a1ab1))['some'](_0x338831=>_0x41a61f['every']((_0x1f600a,_0x56a8b0)=>_0x338831[_0x56a8b0]===_0x1f600a||'*'===_0x338831[_0x56a8b0]));}function _0x325c1c(){return _0x7bec14&&_0xf618e?new window['Promise']((_0x2a281f,_0x16704e)=>{_0x7bec14['then'](_0x2a281f,_0x16704e),_0xf618e['then'](_0x450af0=>{'Valid'!=_0x450af0&&_0x2a281f(_0x450af0);},_0x16704e);}):_0x7bec14||_0xf618e||'Valid';}}function _0x298fea(_0x3ef0e3,_0x1b797b){return new window['Promise'](_0x51d7a6=>{if(_0x29df09())return _0x51d7a6('Valid');_0x2f2854(),_0x4b5323['decorate']('_sendUsageRequest');let _0x3cc9ef=!0x1;const _0x2e3c08=Nt();function _0xbf33d5(_0x28e7d0){return!!_0x28e7d0&&('object'==typeof _0x28e7d0||'function'==typeof _0x28e7d0)&&'function'==typeof _0x28e7d0['then']&&'function'==typeof _0x28e7d0['catch'];}function _0x180342(_0x471177){_0x172267(_0x471177)['then'](_0x519442=>_0x519442&&'ok'==_0x519442['status']?_0x5c134f(_0x475b30(_0x2e3c08+_0x1b797b))!=_0x519442['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x2bbcd5=>(_0x44391d(),_0x2bbcd5),()=>{const _0x1c521f=_0x39d7fd();return null==_0x1c521f?(_0x44391d(),'Valid'):_0x5652c3-_0x1c521f>0x240c8400?'UsageLimit':'Valid';})['then'](_0x51d7a6)['catch'](()=>{_0x51d7a6('UsageLimit');});const _0xe17b9b=0x36ee80;function _0x44391d(){const _0x530fbf='llct-'+_0x5c134f(_0x475b30(_0x3ef0e3)),_0x140fe5=_0x13b8da(_0x5c134f(window['Math']['ceil'](_0x5652c3/_0xe17b9b)));window['localStorage']['setItem'](_0x530fbf,_0x140fe5);}function _0x39d7fd(){const _0xc72c15='llct-'+_0x5c134f(_0x475b30(_0x3ef0e3)),_0x11ceef=window['localStorage']['getItem'](_0xc72c15);return _0x11ceef?window['parseInt'](_0x13b8da(_0x11ceef),0x10)*_0xe17b9b:null;}function _0x172267(_0x2a4822){return new window['Promise']((_0x44047a,_0x338174)=>{_0x2a4822['then'](_0x44047a,_0x338174),window['setTimeout'](_0x338174,0x1d4c0);});}}_0x4b5323['on']('_sendUsageRequest',(_0x5e5521,_0x4bb16b)=>{if(_0x4bb16b[0x0]!=_0x3ef0e3)return _0x51d7a6('UsageLimit');_0x4bb16b[0x1]={..._0x4bb16b[0x1],'requestId':_0x2e3c08};},{'priority':'high'}),_0x4b5323['on']('_sendUsageRequest',_0x1c5328=>{_0xbf33d5(_0x1c5328['return'])&&(_0x3cc9ef=!0x0,_0x180342(_0x1c5328['return']));},{'priority':'low'}),_0x1851c8['then'](()=>{_0x3cc9ef||_0x51d7a6('UsageLimit');});});function _0x29df09(){return'auto'==_0x4b5323['editing']['view']['_overlayModeHint'];}function _0x2f2854(){_0x4b5323['editing']['view']['_overlayModeHint']='auto';}}function _0x2b300e(_0x18c629){const _0x568582=[new window['Promise'](_0x3329dd=>setTimeout(_0x3329dd,0x93ecc)),_0x1851c8['then'](()=>new window['Promise'](_0x1373d6=>{let _0x3dfdd4=0x0;_0x4b5323['model']['on']('applyOperation',(_0x4c2a81,_0x4ae0bf)=>{_0x4ae0bf[0x0]['isDocumentOperation']&&_0x3dfdd4++,0x5e8==_0x3dfdd4&&(_0x1373d6(),_0x4c2a81['off']());});}))];return window['Promise']['race'](_0x568582)['then'](()=>_0x18c629);}async function _0x47056e(){await _0x1851c8,_0x4b5323['model']['change']=_0x9f8211,_0x4b5323['model']['enqueueChange']=_0x9f8211,_0x4b5323['enableReadOnlyMode']('model');}function _0x461180(_0x1eeceb){const _0x30fb65=_0x3b6fd7();_0x4b5323[_0x30fb65]='aiLicenseKey'+_0x1eeceb,'Valid'!=_0x1eeceb&&_0x47056e();}function _0x3b6fd7(){const _0x14ee1e=window['String'](window['performance']['now']())['replace']('.','');let _0x18dee2='n';for(let _0x3af28d=0x0;_0x3af28d<_0x14ee1e['length'];_0x3af28d+=0x2){let _0x7468a2=window['parseInt'](_0x14ee1e['substring'](_0x3af28d,_0x3af28d+0x2));_0x7468a2>=0x3e&&(_0x7468a2-=0x3e),_0x18dee2+=_0x17e19b[_0x7468a2];}return _0x18dee2;}function _0x3b99db(){const _0x41b94a=_0x2cc90a['split']('.');if(0x3!=_0x41b94a['length'])return null;return _0x1dff42(_0x41b94a[0x1]);function _0x1dff42(_0x54db00){const _0x422a97=_0x14caaf(_0x54db00);return _0x422a97&&_0x1819e0()?_0x422a97:null;function _0x1819e0(){const _0x2dfb7c=_0x422a97['jti'],_0x2d328f=window['parseInt'](_0x2dfb7c['substring'](_0x2dfb7c['length']-0x8),0x10),_0x36624e={..._0x422a97,'jti':_0x2dfb7c['substring'](0x0,_0x2dfb7c['length']-0x8)};return delete _0x36624e['vc'],_0x475b30(_0x36624e)==_0x2d328f;}}}async function _0x5dec3f(){let _0x39187b=!0x0;try{const [_0x18e0ea,_0x401be7,_0x3eb8df]=_0x2cc90a['split']('.');return _0xf935fd(_0x18e0ea),await _0x556ffa(_0x18e0ea,_0x401be7,_0x3eb8df),_0x39187b;}catch{return!0x1;}function _0xf935fd(_0x4433a7){const _0x12f49d=_0x14caaf(_0x4433a7);_0x12f49d&&'ES256'==_0x12f49d['alg']||(_0x39187b=!0x1);}async function _0x556ffa(_0x1c62ef,_0x37f2c9,_0x1099b4){const _0x13c070=window['Uint8Array']['from'](_0x31a018(_0x1099b4),_0x25b95=>_0x25b95['charCodeAt'](0x0)),_0x242afe=new window['TextEncoder']()['encode'](_0x1c62ef+'.'+_0x37f2c9),_0x5aed66=window['crypto']['subtle'];if(!_0x5aed66)return;const _0x18a9f8=await _0x5aed66['importKey']('jwk',_0x3894d4,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x5aed66['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x18a9f8,_0x13c070,_0x242afe)||(_0x39187b=!0x1);}}function _0x14caaf(_0x2df188){return _0x2df188['startsWith']('ey')?JSON['parse'](_0x31a018(_0x2df188)):null;}function _0x31a018(_0x3eae2d){return window['atob'](_0x3eae2d['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x475b30(_0x29b2e5){let _0x451c1c=0x1505;function _0x9fb487(_0xeef372){for(let _0x4301fa=0x0;_0x4301fa<_0xeef372['length'];_0x4301fa++){const _0x17fbcf=_0xeef372['charCodeAt'](_0x4301fa);_0x451c1c=(_0x451c1c<<0x5)+_0x451c1c+_0x17fbcf,_0x451c1c&=_0x451c1c;}}function _0x2e926f(_0x8c7fc1){Array['isArray'](_0x8c7fc1)?_0x8c7fc1['forEach'](_0x2e926f):_0x8c7fc1&&'object'==typeof _0x8c7fc1?Object['entries'](_0x8c7fc1)['sort']()['forEach'](([_0x12dab5,_0x33ac59])=>{_0x9fb487(_0x12dab5),_0x2e926f(_0x33ac59);}):_0x9fb487(window['String'](_0x8c7fc1));}return _0x2e926f(_0x29b2e5),_0x451c1c>>>0x0;}function _0x5c134f(_0x1382c4){return _0x1382c4['toString'](0x10)['padStart'](0x8,'0');}function _0x13b8da(_0x2688fa){return _0x2688fa['split']('')['reverse']()['join']('');}function _0x9f8211(){}_0x461180(await _0x14ccba());}(this);}['_blockIfRemovedByLicenseKey'](){const _0x5bc66c=this['editor'],_0x56afb4=mt(_0x5bc66c['config']['get']('licenseKey'));_0x56afb4&&bt(_0x56afb4,'AI')&&(_0x5bc66c['enableReadOnlyMode'](Symbol('invalidLicense')),_0x5bc66c['_showLicenseError']('featureNotAllowed','AIAssistant'));}showFakeVisualSelection(){const _0x48209a=this['editor']['model'];_0x48209a['change'](_0x2b9d8b=>{const _0x52efb1=_0x48209a['document']['selection']['getRanges']();let _0x57a2b3=0x0;for(const _0x17dcb6 of _0x52efb1){const _0x79b8bd=Li+':'+_0x57a2b3;if(_0x48209a['markers']['has'](_0x79b8bd))_0x2b9d8b['updateMarker'](_0x79b8bd,{'range':_0x17dcb6});else{if(_0x17dcb6['start']['isAtEnd']){const _0x26a7a2=_0x17dcb6['start']['getLastMatchingPosition'](({item:_0x3ea2e0})=>!_0x48209a['schema']['isContent'](_0x3ea2e0),{'boundaries':_0x17dcb6});_0x2b9d8b['addMarker'](_0x79b8bd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2b9d8b['createRange'](_0x26a7a2,_0x17dcb6['end'])});}else _0x2b9d8b['addMarker'](_0x79b8bd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x17dcb6});}_0x57a2b3++;}});}hideFakeVisualSelection(){const _0x2bfc4d=this['editor']['model'],_0x1eae8f=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Li));_0x1eae8f['length']&&_0x2bfc4d['change'](_0x3bbac8=>{_0x1eae8f['forEach'](_0x176ff1=>{_0x3bbac8['removeMarker'](_0x176ff1);});});}insertContent(_0x173dcf,_0x5a65f2){const _0x87d331=this['_getAISelection'](),_0x471dc0=_0x5a65f2||_0x87d331['getFirstRange']();this['editor']['model']['canEditAt'](_0x471dc0)&&this['editor']['model']['change'](_0xa55323=>{this['hideFakeVisualSelection'](),_0x5a65f2||this['_resetContentOfSelectedTableCells'](_0xa55323,_0x87d331),this['_pasteHTMLUsingClipboard']({'insertAt':_0x471dc0,'writer':_0xa55323,'html':_0x173dcf});});}insertContentBelow(_0x220221){const {model:_0x8e66cc}=this['editor'],_0x4d09a4=this['_getAISelection']();_0x8e66cc['change'](()=>{const _0x3f29ad=this['_prepareTableInsertBelowPosition'](_0x220221,_0x4d09a4)||this['_getDefaultInsertBelowPosition'](_0x4d09a4);this['insertContent'](_0x220221,_0x3f29ad);});}_getAISelection(){const _0x3fc983=this['editor']['model'],_0xdf6caf=Array['from'](_0x3fc983['markers']['getMarkersGroup'](Li))['map'](_0x566cb4=>_0x566cb4['getRange']());return _0x3fc983['createSelection'](_0xdf6caf);}_pasteHTMLUsingClipboard({writer:_0x3abb4e,html:_0x1aae5e,insertAt:_0x1fdf49}){const {view:_0x44d0ef}=this['editor']['editing'],_0x3697d2=this['editor']['plugins']['get'](_0x978459),_0x257770=new xi();_0x257770['setData']('text/html',_0x1aae5e);const _0x4d5d32=new _0x346fb5(_0x44d0ef,new ClipboardEvent('paste',{'clipboardData':_0x257770}),{'dataTransfer':new _0x3423bb(_0x257770)});_0x3abb4e['setSelection'](_0x1fdf49);const _0x3faad4=(_0x1076a4,_0x14cc24)=>{_0x14cc24['resultRange']&&_0x3abb4e['setSelection'](_0x14cc24['resultRange']);};_0x3697d2['once']('contentInsertion',_0x3faad4,{'priority':'lowest'}),_0x44d0ef['document']['fire']('paste',_0x4d5d32),_0x3697d2['off']('contentInsertion',_0x3faad4);}_getDefaultInsertBelowPosition(_0x564e90){const {model:_0x49c960}=this['editor'],_0x2e1c6c=Array['from'](_0x564e90['getSelectedBlocks']());return _0x2e1c6c['length']?_0x49c960['createPositionAfter'](_0x2e1c6c['pop']()):_0x564e90['getLastPosition']();}_prepareTableInsertBelowPosition(_0x279b79,_0x28bdbe){const {model:_0x1e4eae,plugins:_0x563fa7}=this['editor'];if(_0x563fa7['has']('TableUtils')){const _0x12ef7f=_0x563fa7['get']('TableUtils')['getSelectedTableCells'](_0x28bdbe);if(_0x12ef7f['length']){const _0x566374=this['_getTableRowCountFromContent'](_0x279b79),_0x1c2ca8=this['_createEmptyTableRows'](_0x12ef7f,_0x566374);return _0x1e4eae['createPositionAt'](_0x1c2ca8,0x0);}}return null;}_getTableRowCountFromContent(_0x109a27){const _0xb232d=this['editor']['plugins']['get']('TableUtils'),_0x472d55=this['editor']['data']['parse'](_0x109a27,'$documentFragment'),_0x418329=Array['from'](_0x472d55['getChildren']())['filter'](_0xa6abef=>_0xa6abef['is']('element','table'));let _0x322df3=0x0;return _0x418329['forEach'](_0x18c28f=>{_0x322df3+=_0xb232d['getRows'](_0x18c28f);}),_0x322df3;}_createEmptyTableRows(_0x58043a,_0x2f2462){const _0x298ac6=this['editor']['plugins']['get']('TableUtils'),_0x37ae01=_0x298ac6['getRowIndexes'](_0x58043a),_0x43c9a6=_0x298ac6['getColumnIndexes'](_0x58043a),_0x51be5d=_0x37ae01['last']+0x1,_0x490e3f=_0x43c9a6['first'],_0x397e3b=_0x58043a[0x0]['findAncestor']('table');for(let _0x550368=0x0;_0x550368<_0x2f2462;_0x550368++)_0x298ac6['insertRows'](_0x397e3b,{'at':_0x51be5d});return _0x397e3b['getChild'](_0x51be5d)['getChild'](_0x490e3f);}_resetContentOfSelectedTableCells(_0x477990,_0x34b9f2){const {plugins:_0x4b7a43}=this['editor'],{model:_0x4e3487}=_0x477990;_0x4b7a43['has']('TableUtils')&&_0x4b7a43['get']('TableUtils')['getSelectedTableCells'](_0x34b9f2)['length']&&_0x4e3487['deleteContent'](_0x34b9f2);}},Di=class extends _0x46e624{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Hi=class extends Error{constructor(_0x53d641){super(_0x53d641),this['name']='AIRequestError';}};function Mi(_0x3f42b8,_0x3b7bdc,_0x289ebf){const t=_0x3f42b8['t'];switch(_0x3b7bdc){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',_0x289ebf);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x289ebf);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'},_0x289ebf);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 _0x3b7bdc;}}var Ui=class extends _0x4045df{_commandDefinitions;constructor(_0x961ddb,_0x57e7e4){super(_0x961ddb),this['_commandDefinitions']=_0x57e7e4,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x1d0932,_0x43a21d,_0x3eae6f)=>{this['isEnabled']&&(this['enabledCommandsIds']=Vi(this['_commandDefinitions'],_0x3eae6f));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x25de6d,_0x8edeef,_0x4beaef)=>{this['enabledCommandsIds']=_0x4beaef?Vi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2f16c9=this['editor']['model'];this['_hasContext']=function(_0x49c7f5){const _0x52135d=_0x49c7f5['document']['selection'];return _0x52135d['isCollapsed']?0x0!==[..._0x52135d['getSelectedBlocks']()]['length']&&![..._0x52135d['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x49c7f5['hasContent'](_0x52135d['getFirstRange']());}(_0x2f16c9);const _0x3b6bd1=_0x2f16c9['document']['selection'],_0x316bbf=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x69c3bb of _0x3b6bd1['getRanges']())for(const _0x5e45ee of _0x69c3bb['getItems']())if(_0x5e45ee['is']('element')&&_0x316bbf['includes'](_0x5e45ee['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x26be5c='',_0x2026bb='',_0x3d29bd='custom'){this['editor']['plugins']['get'](is)['showUI'](_0x26be5c,_0x2026bb,_0x3d29bd);}};function Vi(_0x46c86c,_0x323bcc){const _0x35aa5d=new Set();for(const _0x241ec0 of _0x46c86c['values']())(_0x323bcc||!0x1===_0x241ec0['requiresContent'])&&_0x35aa5d['add'](_0x241ec0['id']);return Array['from'](_0x35aa5d);}const Bi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Gi=/* #__PURE__ -- @preserve */
|
|
24
|
+
At();var Fi=class extends Gi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x5bb916,_0x3a211d,_0x5163a0){super(),this['editor']=_0x5bb916,this['textAdapter']=_0x3a211d,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x5163a0,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x217840,_0x3a6308,_0x2c6c40)=>{this['view']['value']=this['_sanitizeHTML'](_0x2c6c40);}),this['listenTo'](this['view'],'submitPrompt',(_0x21872b,_0x52eaad)=>{const _0x1f7c27=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x52eaad,_0x1f7c27,'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:_0x1c43de,query:_0x1b8c66,htmlContent:_0x91cf94,label:_0x2e8a86,mainActionLabel:_0x923959}){this['view']['prompt']=_0x2e8a86,this['view']['mainAction']=_0x923959,this['initialContext']=_0x91cf94,_0x1b8c66&&(this['view']['isRendered']?this['_handleQuery'](_0x1b8c66,_0x91cf94,_0x1c43de,_0x2e8a86):this['view']['once']('render',()=>{this['_handleQuery'](_0x1b8c66,_0x91cf94,_0x1c43de,_0x2e8a86);}));}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'](_0x13792f,_0x392eab,_0x56231c,_0x126112){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x392eab,this['previousQuery']=_0x13792f,this['previousLabel']=_0x126112||_0x13792f,this['previousActionId']=_0x56231c,new Promise(_0x1677ec=>{this['textAdapter']['makeRequest']({'query':_0x13792f,'context':_0x392eab,'onData':_0x24c8cc=>{this['currentResponse']=_0x24c8cc,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x56231c})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x2b0b68=>{_0x2b0b68 instanceof Hi?this['view']['handleError'](_0x2b0b68['message']):this['view']['handleError'](),_0x1677ec();})['finally'](()=>{this['stopProcessing'](),_0x1677ec();});});}_parseAndNormalizeContent(_0x500c9e,_0x5d1808=!0x1){const _0x732bd4=Bi['exec'](_0x500c9e);_0x500c9e=_0x732bd4?_0x500c9e['substring'](_0x732bd4[0x1]['length']):_0x500c9e['length']<0x64&&!_0x5d1808?'':this['_stripMarkdownSyntax'](_0x500c9e);const _0x33e44c=this['_domParser']['parseFromString'](_0x500c9e,'text/html');if(_0x732bd4){const _0x34a2f5=Array['from'](_0x33e44c['body']['childNodes']);_0x34a2f5['reverse']();for(const _0x40cf17 of _0x34a2f5){if(_0x40cf17['nodeType']==Node['ELEMENT_NODE'])break;_0x40cf17['remove']();}}const _0x3d5ec0=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x33e44c['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x3d5ec0);const _0x4c7f0e=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x42f40f=this['editor']['data']['toModel'](_0x3d5ec0);return _0x4c7f0e||_0x42f40f['markers']['clear'](),this['editor']['data']['stringify'](_0x42f40f);}['_normalizeResponseHeadings'](_0x4f0581){const _0x415b67=new _0xe37cb8(this['editor']['editing']['view']['document']),_0x273f7f=new _0x28b3be({'name':/^h[1-5]$/}),_0x2ed36e=[];let _0x443b16=!0x1;for(const _0x50238f of _0x4f0581)_0x50238f['is']('element')&&_0x273f7f['match'](_0x50238f)&&(_0x2ed36e['push'](_0x50238f),'h1'==_0x50238f['name']&&(_0x443b16=!0x0));if(_0x443b16){for(const _0x11b270 of _0x2ed36e)_0x415b67['rename']('h'+(parseInt(_0x11b270['name'][0x1])+0x1),_0x11b270);}}_isH1TagSupportEnabled(){const {data:_0x410392,editing:_0x231503}=this['editor'],_0x2409c0=_0x410392['htmlProcessor']['toView']('<h1></h1>'),_0x165310=_0x410392['toView'](_0x410392['toModel'](_0x2409c0));return!!_0x231503['view']['domConverter']['viewToDom'](_0x165310)['querySelector']('h1');}_sanitizeHTML(_0x223e4c){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x223e4c),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x28e313){const _0x56d6a7=_0x28e313['trim']();return _0x56d6a7['startsWith']('```html')?_0x56d6a7['endsWith']('```')?_0x56d6a7['substring'](0x7,_0x56d6a7['length']-0x3):_0x56d6a7['substring'](0x7):_0x28e313;}};const Ki={'REPLACE':'replace','INSERT':'insert'};var Wi=class extends _0x5b0bf4{constructor(_0x120600){super(_0x120600),this['set']('isVisible',!0x1),this['set']('mainAction',Ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x2d50ca=>Mi(_0x120600,'AI_'+_0x2d50ca['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Mi(_0x120600,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Mi(_0x120600,'Try\x20again')),this['stopButton']=this['_createButton'](Mi(_0x120600,'Stop'));const _0x29e3ff=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x29e3ff['if']('isVisible','ck-hidden',_0x12796f=>!_0x12796f)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x55db01,_0x14636f){const _0x846619=new Vt(this['locale']);return _0x846619['set']({'label':_0x55db01,'class':_0x14636f||'','isVisible':!0x0,'withText':!0x0}),_0x846619;}},Yi=class extends _0x20e82c{contentFieldView;copyButtonView;constructor(_0x2da4ce,_0x1d4b2b=''){super(_0x2da4ce),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x1cc90d=this['bindTemplate'];this['contentFieldView']=new $i(_0x2da4ce,_0x1d4b2b),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x1cc90d['if']('isVisible','ck-hidden',_0x2d8b1e=>!_0x2d8b1e)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x1cc90d['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 _0x338d02=!0x1;this['on']('change:value',(_0x259a57,_0x29b4bb,_0x4debe3)=>{const _0x3c32f7=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x4debe3),this['isProcessing']&&_0x3c32f7&&!_0x338d02&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xe81d64,_0x252c34,_0xb03562)=>{_0x338d02=!0x1,_0xb03562?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x338d02=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x338d02=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x5bad34=this['locale'],_0x566893=new Vt(this['locale']),_0x582bcf='ck-ai-form__copy-button';return _0x566893['set']({'label':Mi(_0x5bad34,'Copy'),'icon':_0x3b88cb,'class':_0x582bcf,'tooltip':!0x0}),_0x566893['bind']('isVisible')['to'](this,'value',_0x58a5a7=>!!_0x58a5a7),_0x566893['bind']('isEnabled')['to'](this,'isProcessing',_0x46fdc8=>!_0x46fdc8),_0x566893['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x566893['icon']=_0x8456a1,_0x566893['class']=_0x582bcf+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x566893['icon']=_0x3b88cb,_0x566893['class']=_0x582bcf;},0x3e8);}),_0x566893;}['_copyHTMLToClipboard'](_0x3212da){const {window:_0x344ff1,document:_0x16a541}=Ct;if(_0x344ff1['ClipboardItem']){const {Blob:_0xf1aee4,ClipboardItem:_0x570518}=_0x344ff1,_0xfcedad=[new _0x570518({'text/html':new _0xf1aee4([_0x3212da['innerHTML']],{'type':'text/html'}),'text/plain':new _0xf1aee4([_0x3212da['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0xfcedad);}else{const _0x438ef4=_0x16a541['createElement']('div');_0x438ef4['style']['position']='absolute',_0x438ef4['style']['left']='-9999px',_0x438ef4['innerHTML']='<span>[</span>'+_0x3212da['innerHTML']+'<span>]</span>',_0x16a541['body']['appendChild'](_0x438ef4);const _0x1e8cb6=_0x16a541['createRange']();_0x1e8cb6['setStartAfter'](_0x438ef4['firstElementChild']),_0x1e8cb6['setEndBefore'](_0x438ef4['lastElementChild']);const _0x22a5da=_0x344ff1['getSelection']();_0x22a5da['removeAllRanges'](),_0x22a5da['addRange'](_0x1e8cb6),_0x16a541['execCommand']('copy'),_0x438ef4['remove']();}}},$i=class extends _0x20e82c{constructor(_0x54d9cc,_0x264b7a=''){super(_0x54d9cc),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x264b7a,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x1b1c1b){this['element']['innerHTML']=_0x1b1c1b;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x5d048b=new _0x20e82c(),_0x2644cb=this['locale'],_0x13de47=new _0x5ad72d();return _0x13de47['isVisible']=!0x0,_0x5d048b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x13de47,{'text':Mi(_0x2644cb,'AI\x20is\x20writing...')}]}),_0x5d048b['render'](),_0x5d048b;}},qi=class extends _0x20e82c{constructor(_0x55aa49,_0x3d5e0c=''){super(_0x55aa49);const _0x50b5b6=new Qt(),_0xb3ca92=this['bindTemplate'];this['set']('text',_0x3d5e0c),_0x50b5b6['content']=_0x32aaf6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x50b5b6,{'text':_0xb3ca92['to']('text')}]});}},Qi=class extends Lt{submitButtonView;showHistoryButtonView;constructor(_0x5d0700,_0x5723e3){super(_0x5d0700,_0x5723e3),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',(_0x188f2d,_0x72010a)=>{_0x188f2d['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x72010a());});}_createSubmitButton(){const _0x2d07d0=new Vt(this['locale']),_0x380489=this['locale'];return _0x2d07d0['set']({'icon':nt,'label':Mi(_0x380489,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x2d07d0['on']('execute',()=>{this['submit']();}),_0x2d07d0['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x134387,_0x1c89b1)=>!_0x134387&&_0x1c89b1),_0x2d07d0;}_createShowHistoryButton(){const _0x4ebf1e=new Vt(this['locale']),_0x2b57e0=this['resultsView'],_0x274203=this['locale'];_0x4ebf1e['set']({'label':Mi(_0x274203,'History'),'withText':!0x1,'icon':_0x4879bc,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4ebf1e['bind']('isOn')['to'](_0x2b57e0,'isVisible'),_0x4ebf1e['bind']('isEnabled')['to'](this,'isEnabled'),_0x4ebf1e['on']('execute',()=>{_0x2b57e0['isVisible']=!_0x2b57e0['isVisible'],_0x2b57e0['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x50ebe7=()=>{Ct['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0x6e4e4=new It(this['queryView']['fieldView']['element']),_0x4f5973=_0x6e4e4['width'],_0x1dd71d='rtl'===_0x274203['uiLanguageDirection']?'left':'right';_0x6e4e4['excludeScrollbarsAndBorders'](),_0x4ebf1e['element']['style'][_0x1dd71d]=_0x4f5973-_0x6e4e4['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x50ebe7),this['on']('render',_0x50ebe7),_0x4ebf1e;}submit(){const _0x906893=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x906893);}['focus'](_0x186168){-0x1===_0x186168?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Xi=class extends te{historyGroupView;clearHistoryButton;constructor(_0x426388){super(_0x426388),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Jt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Mi(_0x426388,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x26f01c=0x0;for(const _0xd77aa1 of this['items'])_0x26f01c+=_0xd77aa1['items']['length'];return{'resultsCount':_0x26f01c,'totalItemsCount':_0x26f01c};}_createClearHistoryButton(){const _0x4d1845=this['locale'],_0x46e61a=new Vt(this['locale']);return _0x46e61a['set']({'label':'('+Mi(_0x4d1845,'Clear')+')','withText':!0x0}),_0x46e61a['on']('execute',()=>this['fire']('clearHistory')),_0x46e61a;}},zi=class extends Zt{constructor(_0x40f838){super();const _0x11ca48=new Mt(),_0x4b9d5b=new Vt(this['locale'],_0x11ca48);this['children']['add'](_0x4b9d5b),_0x4b9d5b['set']({'label':_0x40f838['prompt'],'withText':!0x0}),_0x4b9d5b['on']('execute',()=>{this['fire']('execute',{'value':_0x64883(_0x40f838['prompt'])});});}};const ji='CKEditor/AIFormView/PromptHistory';var Ji=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x4f9317,_0x37f892)=>{const _0xf3f0ab=Zi(_0x37f892['prompt']);for(const _0x4221df of this)if(_0x4221df!=_0x37f892&&Zi(_0x4221df['prompt'])===_0xf3f0ab){this['remove'](_0x4221df);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x4a789b=sessionStorage['getItem'](ji)||'[]';this['addMany'](JSON['parse'](_0x4a789b));}_saveToSessionStorage(){sessionStorage['setItem'](ji,JSON['stringify'](this['map'](_0x3aeb2a=>_0x3aeb2a)));}};function Zi(_0x594986){return _0x594986['toLowerCase']()['trim']();}var ts=class extends _0x20e82c{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x46fc75,_0x21fdc7,_0x277c2a=''){super(_0x46fc75),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 Ji(),this['errorView']=new qi(_0x46fc75),this['contentArea']=new Yi(_0x46fc75,_0x277c2a),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 _t(),this['keystrokes']=new gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Wt({'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 _0x2950b5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x21fdc7],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x2950b5['if']('isError','ck-hidden',_0x40f9f8=>!_0x40f9f8)]},'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'](_0x5db8a5=0x1){-0x1===_0x5db8a5?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 _0x11c6cc=this['locale'],_0x1a72fe=new Qi(_0x11c6cc,{'queryView':{'label':Mi(_0x11c6cc,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x545d11,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Mi(_0x11c6cc,'Empty\x20history'),'secondary':Mi(_0x11c6cc,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x1a72fe['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2cb8f8,_0x2ecc00)=>_0x2cb8f8&&!_0x2ecc00),this['listenTo'](_0x1a72fe,'submit',(_0x1bf0a8,_0x38bbc4)=>{this['prompt']=_0x38bbc4;const _0x1b6c80=_0x4150e0(_0x38bbc4);this['fire']('submitPrompt',_0x1b6c80),_0x38bbc4['trim']()&&this['_promptHistory']['add']({'prompt':_0x1b6c80},0x0);},{'priority':'high'}),_0x1a72fe;}_createHistoryView(){const _0x2b91bd=new Xi(this['locale']);return _0x2b91bd['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](zi),_0x2b91bd['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2b91bd;}_createToolbar(){const _0x331f85=new Wi(this['locale']);return _0x331f85['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x5a7b58,_0x29f7e9,_0x1c2d2b)=>_0x5a7b58&&!_0x29f7e9&&!!_0x1c2d2b),_0x331f85['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x331f85['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xa59224,_0x872c7,_0x188710)=>_0xa59224&&!_0x872c7&&!!_0x188710),_0x331f85['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x331f85['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x344480,_0x15a50b)=>_0x344480&&!_0x15a50b),_0x331f85['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x331f85['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x331f85['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x331f85;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3e229c=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Mi(_0x3e229c,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x5c9298){const _0x8c0401=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x5c9298||Mi(_0x8c0401,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const es=globalThis['DataTransfer'];var is=class extends _0x46e624{['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[_0x5cb03c,Pi,Di,Bt];}constructor(_0x1a98c5){super(_0x1a98c5),_0x1a98c5['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x1a98c5['config']['define']('ai.assistant.contentAreaCssClass',''),_0x1a98c5['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x1a98c5['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x3cec6d}=this;this['_aiAdapter']=_0x3cec6d['plugins']['get'](Di),this['_dialog']=_0x3cec6d['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5879a4=new Ui(_0x3cec6d,Array['from'](this['_commandDefinitions']['values']()));_0x3cec6d['commands']['add']('showAIAssistant',_0x5879a4),_0x3cec6d['ui']['componentFactory']['add']('aiCommands',_0x297825=>{const _0x48c868=_0x28f0f7(_0x297825);return _0x48c868['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x48c868['buttonView']['set']({'label':Mi(_0x297825,'AI\x20Commands'),'icon':_0x448e9d,'tooltip':!0x0}),_0x48c868['on']('execute',_0x35484d=>this['_onExecute'](_0x35484d['source']['id'])),_0x28d5d1(_0x48c868,_0x3cec6d['ui']['view']['body'],function(_0x4926f8){const _0xe084fa=ns(_0x4926f8,Ni(_0x4926f8['config']['get']('ai.assistant.commands'),_0x4926f8['locale']))['filter'](_0x2c462a=>_0x2c462a['commands']['length']);return 0x1===_0xe084fa['length']?ns(_0x4926f8,_0xe084fa[0x0]['commands'])['map'](_0x3b1a1=>({'id':_0x3b1a1['id'],'label':_0x3b1a1['label']})):_0xe084fa['map'](_0x40242c=>{const {groupId:_0x11cad1,groupLabel:_0x5f100c,commands:_0x119e7c}=_0x40242c,_0x41eb31=ns(_0x4926f8,_0x119e7c)['map'](_0x320f39=>({'id':_0x320f39['id'],'label':_0x320f39['label']}));return{'id':_0x11cad1,'menu':_0x5f100c||_0x11cad1,'children':_0x41eb31};});}(_0x3cec6d),{'ariaLabel':Mi(_0x297825,'AI\x20Commands')}),_0x48c868['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5879a4['on']('change:enabledCommandsIds',_0x1c6134),_0x48c868['menuView']['once']('render',_0x1c6134),_0x48c868;function _0x1c6134(){_0x48c868['isEnabled']=_0x5879a4['enabledCommandsIds']['length']>0x0;for(const _0x4c50af of _0x48c868['menuView']['buttons'])_0x4c50af['isEnabled']=_0x5879a4['enabledCommandsIds']['includes'](_0x4c50af['id']);}}),_0x3cec6d['ui']['componentFactory']['add']('menuBar:aiCommands',_0x2f8332=>{const _0x5f2c96=new _0x135eb0(_0x2f8332);_0x5f2c96['buttonView']['set']({'label':Mi(_0x2f8332,'AI\x20Commands'),'icon':_0x448e9d}),_0x5f2c96['bind']('isEnabled')['to'](_0x5879a4,'enabledCommandsIds',_0x2be0c3=>_0x2be0c3['length']>0x0);const _0x19253d=Ni(_0x3cec6d['config']['get']('ai.assistant.commands'),_0x2f8332);return this['_populateMenuBarMenu'](_0x5879a4,_0x5f2c96,_0x19253d,_0xabb7ee=>this['_onExecute'](_0xabb7ee)),_0x5f2c96;}),_0x3cec6d['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x5cf928=this['_createAIAssistantUIButton'](Vt);return _0x5cf928['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x5cf928;}),_0x3cec6d['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x44b8ec=this['_createAIAssistantUIButton'](_0x5a4190);return _0x44b8ec['set']({'role':'menuitemcheckbox'}),_0x44b8ec;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x1cf019=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1e068f;for(const _0x170d57 in _0x1cf019){const _0x2e5511=_0x170d57,_0x1da95f=_0x1cf019[_0x2e5511];if('aiLicenseKeyValid'==_0x1da95f||'aiLicenseKeyInvalid'==_0x1da95f||'aiLicenseKeyExpired'==_0x1da95f||'aiLicenseKeyDomainLimit'==_0x1da95f||'aiLicenseKeyNotAllowed'==_0x1da95f||'aiLicenseKeyEvaluationLimit'==_0x1da95f||'aiLicenseKeyUsageLimit'==_0x1da95f){delete _0x1cf019[_0x2e5511],_0x1e068f=_0x1da95f,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1e068f&&_0x1cf019['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1e068f&&_0x1cf019['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1e068f&&_0x1cf019['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1e068f&&_0x1cf019['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1e068f&&_0x1cf019['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1e068f&&_0x1cf019['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x48cebe='',_0x252fc9='',_0x56940f='custom'){const _0x1e34a2=this['editor'],_0x3da692=_0x1e34a2['editing']['view'],_0x156e9d=_0x1e34a2['plugins']['get'](Pi),_0x376723=_0x1e34a2['plugins']['get'](_0x5cb03c);_0x156e9d['showFakeVisualSelection']();const _0x34f488=new es(),_0x32643a=new ClipboardEvent('copy',{'clipboardData':_0x34f488}),_0x43626b=new _0x3423bb(_0x34f488),_0x49ff34=new _0x346fb5(_0x3da692,_0x32643a,{'dataTransfer':_0x43626b});_0x376723['_forceMarkersCopy']('comment',()=>{_0x3da692['document']['fire']('copy',_0x49ff34);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Fi(_0x1e34a2,this['_aiAdapter']['textAdapter'],this['_formView']));let _0xf37727=_0x43626b['getData']('text/html');const _0x173064=_0x1e34a2['model']['document']['selection'],_0x9b5a8e=Array['from'](_0x173064['getRanges']());0x1===_0x9b5a8e['length']&&_0x9b5a8e[0x0]['isFlat']&&!_0x173064['getSelectedElement']()&&''!==_0xf37727['replace'](/ /g,'')['trim']()&&(_0xf37727='<p>'+_0xf37727+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x56940f,'query':_0x48cebe,'htmlContent':_0xf37727,'label':_0x252fc9,'mainActionLabel':Ki[_0x1e34a2['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x27eab1,'title':Mi(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Gt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x156e9d['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x1f73fa=new Map(),_0x500e4a=Ni(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x541859 of _0x500e4a)for(const _0x15b141 of _0x541859['commands'])_0x1f73fa['set'](_0x15b141['id'],{..._0x15b141,'groupId':_0x541859['groupId'],'groupLabel':_0x541859['groupLabel']||_0x541859['groupId']});return _0x1f73fa;}_createAIAssistantUIButton(_0x15153b){const _0x334e6a=this['editor'],_0x167460=_0x334e6a['commands']['get']('showAIAssistant'),_0xbfafba=new _0x15153b(_0x334e6a['locale']);return _0xbfafba['set']({'label':Mi(_0x334e6a['locale'],'AI\x20Assistant'),'icon':_0x27eab1,'isToggleable':!0x0}),_0xbfafba['bind']('isEnabled')['to'](_0x167460),_0xbfafba['bind']('isOn')['to'](this['_dialog'],'id',_0x102eee=>'aiAssistant'===_0x102eee),this['listenTo'](_0xbfafba,'execute',()=>{_0xbfafba['isOn']?this['hideUI']():_0x167460['execute']();}),_0xbfafba;}_initView(){const _0x432071=this['editor']['plugins']['get'](Pi);this['_formView']=new ts(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',()=>{_0x432071['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x432071['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x304974,ui:{ariaLiveAnnouncer:_0x2af69e}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x4bedf5,_0x2862b7,_0x509e2c)=>{const _0x534d10=this['_aiAssistantController']['currentContext'];_0x509e2c?_0x2af69e['announce'](Mi(_0x304974,'AI\x20is\x20writing')):_0x534d10&&_0x2af69e['announce'](Mi(_0x304974,'Generated\x20content:\x20%0',_0x534d10),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x28f4f7,_0x4be01e,_0x479027)=>{if(_0x479027){const _0xe0604a=this['_formView']['errorView']['text'];_0x2af69e['announce'](Mi(_0x304974,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0xe0604a));}});}_onExecute(_0x48dea3){const _0x37c042=this['_commandDefinitions']['get'](_0x48dea3),_0x269486=this['editor'],_0x1107d7=_0x269486['model']['document']['selection'],_0x375844=_0x269486['commands']['get']('showAIAssistant'),_0x1998ab=_0x269486['plugins']['get'](Pi),_0x23d9fa=''+('_ungrouppedCommands'!==_0x37c042['groupId']?_0x37c042['groupLabel']+':\x20':'')+_0x37c042['label'];if(!0x1!==_0x37c042['requiresContent']&&_0x1107d7['isCollapsed']){const _0x4c8dd3=Tt(_0x1107d7['getSelectedBlocks']())||_0x269486['model']['schema']['getLimitElement'](_0x1107d7);_0x269486['model']['change'](_0x3ba956=>{_0x3ba956['setSelection'](_0x4c8dd3,'in');});}_0x1998ab['showFakeVisualSelection'](),_0x375844['execute'](_0x37c042['prompt'],_0x23d9fa,'command:'+_0x48dea3);}_populateMenuBarMenu(_0x2b527a,_0x3dd786,_0x56c7c2,_0x1f1128){const _0x1ede68=this['editor'],_0x2880d4=_0x1ede68['locale'],_0x34ef8e=new _0x2fab50(_0x2880d4),_0x5d478e=ns(_0x1ede68,_0x56c7c2)['filter'](_0x58273c=>_0x58273c['commands']['length']);0x1===_0x5d478e['length']?this['_getMenuBarGroupButtons']({'command':_0x2b527a,'commands':_0x5d478e[0x0]['commands'],'parentMenuView':_0x3dd786,'onExecute':_0x1f1128})['forEach'](_0x41bdf0=>_0x34ef8e['items']['add'](_0x41bdf0)):_0x5d478e['forEach'](({groupId:_0x1df4b9,groupLabel:_0x3e0353,commands:_0x220cf2})=>{const _0x365bb2=new _0x1a3b09(_0x2880d4,_0x3dd786),_0x39c459=new _0x135eb0(_0x2880d4),_0x542d8a=new _0x2fab50(_0x2880d4),_0x56f041=this['_getMenuBarGroupButtons']({'command':_0x2b527a,'commands':_0x220cf2,'parentMenuView':_0x39c459,'onExecute':_0x1f1128});_0x39c459['buttonView']['set']({'label':_0x3e0353||_0x1df4b9}),_0x39c459['delegate']('execute')['to'](_0x3dd786),_0x542d8a['items']['addMany'](_0x56f041),_0x39c459['panelView']['children']['add'](_0x542d8a),_0x365bb2['children']['add'](_0x39c459),_0x34ef8e['items']['add'](_0x365bb2);}),_0x3dd786['panelView']['children']['add'](_0x34ef8e);}_getMenuBarGroupButtons({command:_0x4cc1c0,commands:_0xb4348,parentMenuView:_0x1501fd,onExecute:_0x1d248c}){const _0x31927f=this['editor'],_0x5e10fb=_0x31927f['locale'];return ns(_0x31927f,_0xb4348)['map'](_0x3ae29d=>{const _0xb0a7ff=new _0x1a3b09(_0x5e10fb,_0x1501fd),_0x18b039=new _0x5a4190(_0x5e10fb);return _0x18b039['set']({'label':_0x3ae29d['label']}),_0x18b039['delegate']('execute')['to'](_0x1501fd),_0x18b039['on']('execute',()=>_0x1d248c(_0x3ae29d['id'])),_0x18b039['bind']('isEnabled')['to'](_0x4cc1c0,'enabledCommandsIds',_0x20b86a=>_0x20b86a['includes'](_0x3ae29d['id'])),_0xb0a7ff['children']['add'](_0x18b039),_0xb0a7ff;});}};function ss(_0x3803ea,_0xec588e){return void 0x0!==_0x3803ea['order']&&void 0x0===_0xec588e['order']?0x1:void 0x0===_0x3803ea['order']&&void 0x0!==_0xec588e['order']?-0x1:void 0x0!==_0x3803ea['order']&&void 0x0!==_0xec588e['order']?_0x3803ea['order']-_0xec588e['order']:0x0;}function ns(_0xd46e41,_0x424313){_0x424313['sort'](ss);const _0x33d414={},_0x411f19=[];for(const _0x309ed0 of _0x424313)if(void 0x0!==_0x309ed0['order']){if(_0x309ed0['order']in _0x33d414)throw new ct('ai-commands-config-order-collision',_0xd46e41,{'conflictingDefinitions':[_0x309ed0,_0x33d414[_0x309ed0['order']]]});_0x33d414[_0x309ed0['order']]=_0x309ed0,_0x411f19['splice'](_0x309ed0['order'],0x0,_0x309ed0);}else _0x411f19['push'](_0x309ed0);return _0x411f19;}var rs=class extends _0x46e624{static get requires(){return[is,Pi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4f6159){super(_0x4f6159);const _0x15b44c=_0x4f6159['config'],_0x405b1a=_0x4f6159['locale'];_0x15b44c['define']('ai.assistant.preserveComments',!0x0),_0x15b44c['define']('ai.assistant.commands',os(_0x405b1a)),_0x15b44c['define']('ai.assistant.extraCommandGroups',[]),_0x15b44c['define']('ai.assistant.removeCommands',[]);let _0x24ae8e=Ni(_0x15b44c['get']('ai.assistant.commands'),_0x405b1a);const _0x3350b1=_0x15b44c['get']('ai.assistant.extraCommandGroups'),_0x411d2a=_0x15b44c['get']('ai.assistant.removeCommands');_0x3350b1['forEach'](_0x2913a5=>{const _0x47f217=_0x24ae8e['find'](_0x5b86b0=>_0x5b86b0['groupId']===_0x2913a5['groupId']);_0x47f217?_0x47f217['commands']=_0x47f217['commands']['concat'](_0x2913a5['commands']):_0x24ae8e['push'](_0x2913a5);}),_0x24ae8e=_0x24ae8e['filter'](_0x2bef65=>!_0x411d2a['includes'](_0x2bef65['groupId'])),_0x24ae8e['forEach'](_0x46f413=>{_0x46f413['commands']=_0x46f413['commands']['filter'](_0x5a47f0=>!_0x411d2a['includes'](_0x5a47f0['id']));}),_0x15b44c['set']('ai.assistant.commands',_0x24ae8e);}};function os(_0x39ab0c){return[{'groupId':'editOrReview','groupLabel':Mi(_0x39ab0c,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Mi(_0x39ab0c,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Mi(_0x39ab0c,'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':Mi(_0x39ab0c,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Mi(_0x39ab0c,'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':Mi(_0x39ab0c,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Mi(_0x39ab0c,'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':Mi(_0x39ab0c,'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':Mi(_0x39ab0c,'Change\x20tone'),'commands':[{'id':'professional','label':Mi(_0x39ab0c,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Mi(_0x39ab0c,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Mi(_0x39ab0c,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Mi(_0x39ab0c,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Mi(_0x39ab0c,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Mi(_0x39ab0c,'Change\x20style'),'commands':[{'id':'business','label':Mi(_0x39ab0c,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Mi(_0x39ab0c,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Mi(_0x39ab0c,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Mi(_0x39ab0c,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Mi(_0x39ab0c,'Translate'),'commands':[{'id':'translateEnglish','label':Mi(_0x39ab0c,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Mi(_0x39ab0c,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Mi(_0x39ab0c,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Mi(_0x39ab0c,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Mi(_0x39ab0c,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Mi(_0x39ab0c,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Mi(_0x39ab0c,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Mi(_0x39ab0c,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var as=class extends _0x46e624{abortController;static get requires(){return[Di];}constructor(_0x2e25ec){super(_0x2e25ec),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Di)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x2ab010){return this['sendRequest'](_0x2ab010)['catch'](_0x3fb1c2=>{if(_0x3fb1c2 instanceof Hi)return Promise['reject'](_0x3fb1c2);if('AbortError'==_0x3fb1c2['name'])return Promise['resolve']();throw console['error'](_0x3fb1c2),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x28d6ea,_0x2a0314){const _0x40dba8=this['editor']['locale'],_0x396ea4={'Content-Type':'application/json'};if('object'==typeof _0x28d6ea)Object['assign'](_0x396ea4,_0x28d6ea);else{if(_0x28d6ea)try{const _0x2fa5da=await _0x28d6ea(_0x2a0314);Object['assign'](_0x396ea4,_0x2fa5da);}catch{return Promise['reject'](new Hi(Mi(_0x40dba8,'AI_ERROR_GET_HEADERS')));}}return _0x396ea4;}async _prepareRequestParameters(_0x51e702,_0x5a246e){const _0x1c0115=this['editor']['locale'];if('object'==typeof _0x51e702)return _0x51e702;try{return await _0x51e702(_0x5a246e);}catch{return Promise['reject'](new Hi(Mi(_0x1c0115,'AI_ERROR_GET_PARAMETERS')));}}},hs=class extends as{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x19e766){super(_0x19e766),_0x19e766['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x19e766['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x19e766['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x19e766['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x19e766['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x19e766['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x3cc5f3,context:_0x398fff,onData:_0x285357,actionId:_0x3a4a30}){const _0x18dab3=this['editor']['locale'],_0x5cb8c2=await this['prepareMessages'](_0x3cc5f3,_0x398fff,_0x3a4a30),_0x65611e=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x3a4a30),_0x229323=await this['_prepareRequestParameters'](this['_requestParameters'],_0x3a4a30),_0xc62a08={'messages':_0x5cb8c2,..._0x229323},_0x5283f0={'method':'POST','headers':_0x65611e,'body':JSON['stringify'](_0xc62a08),'signal':this['abortController']['signal']},_0x5a66ef=await fetch(this['_apiUrl'],_0x5283f0);if(_0x5a66ef['ok'])return _0x229323['stream']?await this['_readStreamableResponse'](_0x5a66ef,_0x285357):await this['_readStaticResponse'](_0x5a66ef,_0x285357),Promise['resolve']();{const _0x9fa5c=await _0x5a66ef['text']();return _0x9fa5c['includes']('context_length_exceeded')?Promise['reject'](new Hi(Mi(_0x18dab3,'AI_ERROR_CONTEXT_LENGTH'))):_0x9fa5c['includes']('Moderation')?Promise['reject'](new Hi(Mi(_0x18dab3,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x9fa5c));}}async['prepareMessages'](_0x1831e6,_0x2a0386,_0x4148c4){let _0x427166,_0x24b817;return _0x2a0386?(_0x427166='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.',_0x24b817='Instruction:\x0a'+_0x1831e6+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2a0386):(_0x427166='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.',_0x24b817=_0x1831e6),[{'role':'system','content':_0x427166},{'role':'user','content':_0x24b817}];}async _readStreamableResponse(_0x12e202,_0x2632bf){const _0x2916f4=_0x12e202['body']['getReader'](),_0x2307f0=new TextDecoder();let _0x509e1b='',_0x9e1c1a='',_0x2d8fba='',_0x22a428=!0x1;for(;!_0x22a428;){const {done:_0x2737ba,value:_0xe7cdd7}=await _0x2916f4['read'](),_0x1a4a09=_0x509e1b+_0x2307f0['decode'](_0xe7cdd7);let _0x37a000;_0x22a428=_0x2737ba;try{_0x37a000=this['_cleanUpData'](_0x1a4a09),_0x509e1b='';}catch{_0x509e1b=_0x1a4a09;continue;}_0x9e1c1a+=_0x37a000,!_0x22a428&&this['_isBufferIncomplete'](_0x9e1c1a)||_0x9e1c1a&&(_0x2d8fba+=_0x9e1c1a,_0x9e1c1a='',_0x2632bf(_0x2d8fba));}return Promise['resolve']();}async _readStaticResponse(_0x817027,_0x5302fa){return _0x5302fa((await _0x817027['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x49ba2b){const _0x5f2843=_0x49ba2b['split']('<')['length']!==_0x49ba2b['split']('>')['length'],_0x533d1c=_0x49ba2b['length']<0x1e;return _0x5f2843&&_0x533d1c;}_cleanUpData(_0x282a48){return _0x282a48['split'](/\n(?![^{]*\})/g)['map'](_0x31e6ad=>_0x31e6ad['replace']('data:\x20',''))['filter'](_0x3f20c1=>_0x3f20c1&&_0x3f20c1['length']>0x0&&'[DONE]'!==_0x3f20c1)['map'](_0x2ad3b6=>{const {choices:_0x1d3751}=JSON['parse'](_0x2ad3b6);if(_0x1d3751[0x0]?.['delta']?.['content'])return _0x1d3751[0x0]['delta']['content'];})['filter'](_0x3c080c=>_0x3c080c)['join']('');}},cs=class extends as{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),Ot('ai-aws-adapter-not-supported');}async sendRequest(_0x32f45a){throw Rt('ai-aws-adapter-not-supported'),new Hi(Mi(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ls=class extends Vt{constructor(_0x162bcc,_0x3b6774={}){super(_0x162bcc),this['isToggleable']=!0x0,this['set']('side',_0x3b6774['side']||'top');const _0x142cc0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...yt(_0x3b6774['class']||[]),_0x142cc0['to']('side',_0x9cbaf2=>'ck-tab-button_'+_0x9cbaf2),_0x142cc0['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},us=class extends _0x20e82c{['children'];constructor(_0x118f66,_0x22d90d={}){super(_0x118f66);const _0xf9331d=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...yt(_0x22d90d['class']||[]),_0xf9331d['to']('class'),_0xf9331d['if']('isVisible','ck-hidden',_0x4c6adf=>!_0x4c6adf)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ds=class extends _0x20e82c{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x3f8773,_0x376a10={}){super(_0x3f8773),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x376a10['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x376a10['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x59e295,_0xe859f6)=>_0x59e295&&!_0xe859f6);const _0x23ce6d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...yt(_0x376a10['class']||[]),_0x23ce6d['to']('side',_0x59b0e7=>'ck-tabs_'+_0x59b0e7),_0x23ce6d['to']('class'),_0x23ce6d['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x23ce6d['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x23ce6d['to']('side',_0x5ab8ef=>'ck-tabs__buttons-container_'+_0x5ab8ef)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x23ce6d['to']('side',_0x51f3f4=>'ck-tabs__panels-container_'+_0x51f3f4)]},'children':this['panelViews']},...yt(_0x376a10['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x2663a7){const _0x172d7d=this['_tabs']['get'](_0x2663a7);return _0x172d7d||null;}['addTab'](_0x2b79cb){const _0x1575f7=this['_setupButton']({'id':_0x2b79cb['id'],'label':_0x2b79cb['buttonLabel'],'icon':_0x2b79cb['buttonIcon'],'order':_0x2b79cb['order']}),_0x1bd52b=new us(this['locale']);return _0x1bd52b['render'](),_0x2b79cb['content']&&_0x1bd52b['children']['add'](_0x2b79cb['content']),this['panelViews']['add'](_0x1bd52b),this['_tabs']['set'](_0x2b79cb['id'],{'button':_0x1575f7,'panel':_0x1bd52b,'order':void 0x0!==_0x2b79cb['order']?_0x2b79cb['order']:null}),this['fire']('addTab:'+_0x2b79cb['id'],{'id':_0x2b79cb['id'],'button':_0x1575f7,'panel':_0x1bd52b}),null===this['activeTab']?this['activateTab'](_0x2b79cb['id']):this['_hidePanel'](_0x2b79cb['id']),{'button':_0x1575f7,'panel':_0x1bd52b};}activateTab(_0x4a4a37){if(null!==_0x4a4a37&&!this['getTab'](_0x4a4a37))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4a4a37});if(this['isCollapsed']=!0x1,this['activeTab']===_0x4a4a37)return;const _0x53c949=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x4a4a37,_0x4a4a37&&this['_showPanel'](_0x4a4a37),this['fire']('activateTab:'+_0x4a4a37,{'newTab':_0x4a4a37,'oldTab':_0x53c949});}toggleTabPanel(_0x4c120c){this['activeTab']===_0x4c120c?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x4c120c);}['showTab'](_0x30772f){if(!this['getTab'](_0x30772f))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x30772f});this['_showPanel'](_0x30772f),this['_showButton'](_0x30772f),this['fire']('show:'+_0x30772f,_0x30772f);}['hideTab'](_0x44c7c5){if(!this['getTab'](_0x44c7c5))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x44c7c5});const _0x311c18=this['activeTab'];this['_hidePanel'](_0x44c7c5),this['_hideButton'](_0x44c7c5);const _0x47bf06=this['getTabIds']();_0x311c18===_0x44c7c5&&_0x47bf06['length']>0x1&&this['activateTab'](_0x47bf06['find'](_0x1c7652=>_0x1c7652!==_0x44c7c5)),this['fire']('hide:'+_0x44c7c5,_0x44c7c5);}_getPanel(_0x3db71b){const _0x236109=this['_tabs']['get'](_0x3db71b);return _0x236109?_0x236109['panel']:null;}['_showPanel'](_0x494d14){null!==this['activeTab']&&this['activeTab']!==_0x494d14||this['_getPanel'](_0x494d14)['show']();}['_hidePanel'](_0x4efe79){const _0x12f2e9=this['_getPanel'](_0x4efe79);_0x12f2e9['isVisible']&&(this['activeTab']===_0x4efe79&&(this['activeTab']=null),_0x12f2e9['hide']());}_getButton(_0x2993d6){const _0x3f03b8=this['_tabs']['get'](_0x2993d6);return _0x3f03b8?_0x3f03b8['button']:null;}_showButton(_0x398ece){this['_getButton'](_0x398ece)['show']();}_hideButton(_0xd68859){this['_getButton'](_0xd68859)['hide']();}_setupButton(_0x3093ef){const _0x426512=new ls(this['locale'],{'side':this['side']}),_0x4fadcd=this['buttonViews'];if(_0x426512['set']({'label':_0x3093ef['label'],'icon':_0x3093ef['icon'],'tooltip':!0x0,'withText':!0x0}),_0x426512['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x578274,_0x2a113f)=>_0x578274===_0x3093ef['id']&&!_0x2a113f),_0x426512['bind']('side')['to'](this,'side'),_0x3093ef['order']){const _0x48b33d=[...this['_tabs']]['reduce']((_0x1d0c07,_0x1ff676)=>{const _0x504538=_0x1ff676[0x0],{order:_0x478944}=_0x1ff676[0x1];return!_0x478944||_0x478944>_0x3093ef['order']?_0x1d0c07:_0x478944>=_0x1d0c07['order']?{'id':_0x504538,'order':_0x478944}:_0x1d0c07;},{'id':'','order':0x0}),_0x247abc=_0x4fadcd['getIndex'](this['_getButton'](_0x48b33d['id']));_0x4fadcd['add'](_0x426512,_0x247abc+0x1);}else _0x4fadcd['add'](_0x426512);return _0x426512['on']('execute',()=>{this['toggleTabPanel'](_0x3093ef['id']);}),_0x426512;}};const _s=['overlay','sidebar','custom'],gs=['left','right'];var As=class extends ds{constructor(_0x12fbbe,_0x4403ac={}){super(_0x12fbbe,_0x4403ac),this['set']('type',_0x4403ac['type']||'sidebar'),this['set']('side',_0x4403ac['side']||'right'),this['set']('isVisible',_0x4403ac['visibleByDefault']??!0x0);const _0x23583b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x23583b['if']('type','ck-ai-tabs__overlay',_0x4809dc=>'overlay'===_0x4809dc),_0x23583b['if']('type','ck-ai-tabs__sidebar',_0x28c5ce=>'sidebar'===_0x28c5ce),_0x23583b['if']('isVisible','ck-hidden',_0x3549c0=>!_0x3549c0)]}}),this['buttonViews']['on']('add',(_0x5bb723,_0x53054)=>{_0x53054['set']('withText',!0x1);});}},Is=class extends _0x22445f{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1efdf1){if(super(_0x1efdf1),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x23bfe0=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x23bfe0['showResizeButton']&&(this['showResizeButton']=_0x23bfe0['showResizeButton']),'sidebar'!==_0x23bfe0['type']&&'overlay'!==_0x23bfe0['type']||_0x23bfe0['side']&&(this['side']=_0x23bfe0['side']),'sidebar'===_0x23bfe0['type']){if(this['container']=_0x23bfe0['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x23bfe0['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new As(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x23bfe0['visibleByDefault'],'collapsible':_0x23bfe0['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 _0x46bd64&&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(_0x302877){if(_0x302877&&this['type']!==_0x302877){if(!_s['includes'](_0x302877))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x302877;}}switchSide(_0x3cab2b){if(_0x3cab2b&&this['side']!==_0x3cab2b){if(!gs['includes'](_0x3cab2b))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x3cab2b;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function ps(_0x525c82){return{..._0x525c82,'type':'context'};}var Es=class extends _0x22445f{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x36025b];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xa1458f){if(super(_0xa1458f),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x40a3e2=this['context']['plugins']['get'](_0x36025b);if(!_0x40a3e2['token'])throw new ct('ai-missing-token',this);this['_token']=_0x40a3e2['token'];}_getExtraHttpHeaders(){const _0x177142=this['context']['config']['get']('ai.extraHttpHeaders'),_0x261b9d='function'==typeof _0x177142?_0x177142():_0x177142;if(Array['isArray'](_0x261b9d)&&_0x261b9d['length'])return Object['fromEntries'](_0x261b9d['map'](({domain:_0x29902f,headers:_0x5061b8})=>[_0x29902f,_0x5061b8]));}startConversation(_0x1185fc,_0x4f023b){const _0x1a8ca4=this['_sendApiRequest']('/conversations','POST',{'id':_0x1185fc,'group':_0x4f023b});return{'getConversation':async()=>(await _0x1a8ca4['request'])['json'](),'abortController':_0x1a8ca4['abortController']};}queryAssistant({message:_0xe0aecf,conversationId:_0x4e6ffe,parts:_0x139514,capabilities:_0x4cad90,model:_0x4674b5,attributes:_0x2d97f6}){const _0x384680=this['_getExtraHttpHeaders'](),_0x39e427={..._0xe0aecf&&{'prompt':_0xe0aecf},'content':_0x139514,'model':_0x4674b5,..._0x4cad90&&{'capabilities':_0x4cad90},..._0x2d97f6&&{'attributes':_0x2d97f6},..._0x384680&&{'extraHttpHeaders':_0x384680}},_0x1bc921=this['_sendApiRequest']('/conversations/'+_0x4e6ffe+'/messages','POST',_0x39e427,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x1c9cdf=(await _0x1bc921['request'])['body'];return this['_getStreamReader'](_0x1c9cdf);},'abortController':_0x1bc921['abortController']};}executeCustomAction({content:_0x18d5c9,message:_0x2f1771,model:_0x71132f,outputFormat:_0x345c02,contexts:_0x4394e0}){const _0xa9b179={'content':[{'type':'text','content':_0x18d5c9}],..._0x2f1771&&{'prompt':_0x2f1771},'model':_0x71132f,'outputFormat':_0x345c02,...ms(_0x4394e0)},_0x42227b=this['_sendApiRequest']('/actions/custom/calls','POST',_0xa9b179);return{'getStream':async()=>{const _0x4308f4=(await _0x42227b['request'])['body'];return this['_getStreamReader'](_0x4308f4);},'abortController':_0x42227b['abortController']};}executeAction({actionName:_0x5e570e,content:_0x25f945,args:_0x1a5100,contexts:_0x7552f7}){const _0x1efa52={'content':[{'type':'text','content':_0x25f945}],'args':_0x1a5100,...ms(_0x7552f7)},_0x55bd44=this['_sendApiRequest']('/actions/system/'+_0x5e570e+'/calls','POST',_0x1efa52);return{'getStream':async()=>{const _0x2b9669=(await _0x55bd44['request'])['body'];return this['_getStreamReader'](_0x2b9669);},'abortController':_0x55bd44['abortController']};}['uploadFile'](_0x2dd636,_0xe3123,_0xaa948){const _0x586d49=new FormData();_0x586d49['append']('file',_0xe3123,_0xe3123['name']),_0xaa948&&_0x586d49['append']('attributes',JSON['stringify'](_0xaa948));const _0x1d5dd5=this['_sendApiRequest']('/conversations/'+_0x2dd636+'/files','POST',_0x586d49);return{'getId':async()=>(await _0x1d5dd5['request'])['json'](),'abortController':_0x1d5dd5['abortController']};}uploadDocuments(_0x4e922b,_0x2ac5e3){const _0x1b72cc={'documents':_0x2ac5e3['map'](_0x4f087d=>({'content':_0x4f087d['content'],'attributes':{'version':_0x4f087d['version'],'sessionId':_0x4f087d['sessionId'],'channelId':_0x4f087d['channelId'],'rootName':_0x4f087d['rootName'],'selections':_0x4f087d['selections']},...void 0x0!==_0x4f087d['name']?{'name':_0x4f087d['name']}:{},...void 0x0!==_0x4f087d['description']?{'description':_0x4f087d['description']}:{}}))},_0x4726da=this['_sendApiRequest']('/conversations/'+_0x4e922b+'/documents/batch','POST',_0x1b72cc);return{'getIds':async()=>(await _0x4726da['request'])['json'](),'abortController':_0x4726da['abortController']};}fetchDocuments(_0x309ce8,_0x5887b2){const _0x21e889=new URLSearchParams();_0x21e889['append']('documentIds',_0x5887b2['join'](','));const _0x56674a=this['_sendApiRequest']('/conversations/'+_0x309ce8+'/documents/batch?'+_0x21e889['toString'](),'GET');return{'getDocuments':async()=>(await _0x56674a['request'])['json'](),'abortController':_0x56674a['abortController']};}fetchConversations(_0x3cf516,_0x398204={}){const _0x3bff5b=new URLSearchParams();_0x3bff5b['append']('group',_0x3cf516),_0x3bff5b['append']('excludeEmpty',!0x1!==_0x398204['excludeEmpty']?'true':'false'),_0x3bff5b['append']('limit',_0x398204['limit']?_0x398204['limit']['toString']():0x64['toString']()),_0x3bff5b['append']('sortBy',_0x398204['sortBy']?_0x398204['sortBy']:'createdAt'),_0x3bff5b['append']('order',_0x398204['order']?_0x398204['order']:'desc');const _0xb293fc=this['_sendApiRequest']('/conversations?'+_0x3bff5b['toString'](),'GET');return{'getConversations':async()=>(await(await _0xb293fc['request'])['json']())['items'],'abortController':_0xb293fc['abortController']};}deleteConversation(_0x2cf99c){const _0x4f18ac=this['_sendApiRequest']('/conversations/'+_0x2cf99c,'DELETE');return{'execute':async()=>{await _0x4f18ac['request'];},'abortController':_0x4f18ac['abortController']};}updateConversation(_0x26bb10,_0x25fc30){const _0x5ab3a7=this['_sendApiRequest']('/conversations/'+_0x26bb10,'PATCH',_0x25fc30);return{'getResult':async()=>(await _0x5ab3a7['request'],_0x25fc30),'abortController':_0x5ab3a7['abortController']};}fetchConversation(_0x54feda){const _0x11a07e=this['_sendApiRequest']('/conversations/'+_0x54feda,'GET');return{'getConversation':async()=>(await _0x11a07e['request'])['json'](),'abortController':_0x11a07e['abortController']};}fetchConversationMessages(_0x4579e6){const _0x5f17d4=this['_sendApiRequest']('/conversations/'+_0x4579e6+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x5f17d4['request'])['json']())['items'],'abortController':_0x5f17d4['abortController']};}['uploadUrl'](_0xc35b5a,_0x23e91b,_0x41a1e5){const _0x7174b2=this['_sendApiRequest']('/conversations/'+_0xc35b5a+'/web-resources','POST',{'url':_0x23e91b,'attributes':_0x41a1e5});return{'getId':async()=>(await _0x7174b2['request'])['json'](),'abortController':_0x7174b2['abortController']};}getModels(_0x1bcab4='en'){const _0x54b48d=new URLSearchParams();_0x54b48d['append']('language',_0x1bcab4);const _0x152b4a='/models/1?'+_0x54b48d['toString'](),_0x398ca4=this['_sendApiRequest'](_0x152b4a,'GET');return{'list':async()=>await(await _0x398ca4['request'])['json'](),'abortController':_0x398ca4['abortController']};}listContexts(_0x5d007d={}){const _0x2bb07c=new URLSearchParams();_0x2bb07c['append']('limit',_0x5d007d['limit']?_0x5d007d['limit']['toString']():0x64['toString']()),_0x5d007d['cursor']&&_0x2bb07c['append']('cursor',_0x5d007d['cursor']),_0x5d007d['order']&&_0x2bb07c['append']('order',_0x5d007d['order']);const _0x41d95b=this['_sendApiRequest']('/contexts?'+_0x2bb07c['toString'](),'GET');return{'getContexts':async()=>(await(await _0x41d95b['request'])['json']())['items'],'abortController':_0x41d95b['abortController']};}deleteFile(_0x5d1dd4,_0x206919){const _0x168e9b=this['_sendApiRequest']('/conversations/'+_0x5d1dd4+'/files/'+_0x206919,'DELETE');return{'execute':async()=>{await _0x168e9b['request'];},'abortController':_0x168e9b['abortController']};}deleteDocument(_0x4e2418,_0x1a8bb4){const _0x252848=this['_sendApiRequest']('/conversations/'+_0x4e2418+'/documents/'+_0x1a8bb4,'DELETE');return{'execute':async()=>{await _0x252848['request'];},'abortController':_0x252848['abortController']};}deleteWebResource(_0x39c20f,_0xee3734){const _0x1c67af=this['_sendApiRequest']('/conversations/'+_0x39c20f+'/web-resources/'+_0xee3734,'DELETE');return{'execute':async()=>{await _0x1c67af['request'];},'abortController':_0x1c67af['abortController']};}cancelStream(_0x209e3a,_0x12074e){const _0x168e94=this['_sendApiRequest']('/conversations/'+_0x209e3a+'/messages/'+_0x12074e+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x168e94['request'];},'abortController':_0x168e94['abortController']};}resumeStream(_0x8c9da0,_0x4ec8ff,_0x4b6f9b='0-0'){const _0xf4e869=new URLSearchParams({'lastEventId':_0x4b6f9b}),_0x4f6b02=this['_sendApiRequest']('/conversations/'+_0x8c9da0+'/messages/'+_0x4ec8ff+'/stream?'+_0xf4e869['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x44e67c=await _0x4f6b02['request'];return this['_getStreamReader'](_0x44e67c['body']);},'abortController':_0x4f6b02['abortController']};}callSystemReview({reviewName:_0x1893e1,content:_0x553a00,args:_0x10492a,contexts:_0x51783c}){const _0x996cf6=this['_sendApiRequest']('/reviews/system/'+_0x1893e1+'/calls','POST',{'content':[{'type':'text','content':_0x553a00}],'args':_0x10492a,...ms(_0x51783c)});return{'getStream':async()=>{const _0x5d08b9=(await _0x996cf6['request'])['body'];return this['_getStreamReader'](_0x5d08b9);},'abortController':_0x996cf6['abortController']};}processDocument({content:_0x1ed5e6,prompt:_0x1f6d92,model:_0x20f5e0,capabilities:_0x21254d,contexts:_0x2dd6e6}){const _0xcab6ef=this['_getExtraHttpHeaders'](),_0x1403ae=this['_sendApiRequest']('/documents/process','POST',{'content':_0x1ed5e6,'prompt':_0x1f6d92,'model':_0x20f5e0,..._0x21254d&&{'capabilities':_0x21254d},...ms(_0x2dd6e6),..._0xcab6ef&&{'extraHttpHeaders':_0xcab6ef}});return{'getResult':async()=>(await _0x1403ae['request'])['json'](),'abortController':_0x1403ae['abortController']};}callCustomReview({content:_0x404bff,prompt:_0x2e0871,model:_0x54d12f,contexts:_0x5e7966}){const _0x114e9b=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x404bff}],..._0x2e0871&&{'prompt':_0x2e0871},'model':_0x54d12f,...ms(_0x5e7966)});return{'getStream':async()=>{const _0x3a5039=(await _0x114e9b['request'])['body'];return this['_getStreamReader'](_0x3a5039);},'abortController':_0x114e9b['abortController']};}upsertAIChatRating(_0x4548f2,_0x33ccdf,_0xe4214a){const _0x582689=this['_sendApiRequest']('/conversations/'+_0x4548f2+'/messages/'+_0x33ccdf+'/ratings','PUT',{'positiveCount':_0xe4214a['positiveCount'],'totalCount':_0xe4214a['totalCount'],'modificationId':_0xe4214a['modificationId']});return{'execute':async()=>{await _0x582689['request'];},'abortController':_0x582689['abortController']};}upsertAIActionRating(_0x1f3589,_0x832c77,_0x276e86){const _0x2f48cd=this['_sendApiRequest']('/actions/system/'+_0x1f3589+'/calls/'+_0x832c77+'/ratings','PUT',{'positiveCount':_0x276e86['positiveCount'],'totalCount':_0x276e86['totalCount']});return{'execute':async()=>{await _0x2f48cd['request'];},'abortController':_0x2f48cd['abortController']};}upsertCustomAIActionRating(_0x2e8139,_0x47393a){const _0x4d4bba=this['_sendApiRequest']('/actions/custom/calls/'+_0x2e8139+'/ratings','PUT',{'positiveCount':_0x47393a['positiveCount'],'totalCount':_0x47393a['totalCount']});return{'execute':async()=>{await _0x4d4bba['request'];},'abortController':_0x4d4bba['abortController']};}upsertAIReviewRating(_0x5c52cc,_0xb77a35,_0x21b82e,_0x35741f){const _0x236ccc=this['_sendApiRequest']('/reviews/system/'+_0x5c52cc+'/calls/'+_0xb77a35+'/ratings','PUT',{'positiveCount':_0x21b82e['positiveCount'],'totalCount':_0x21b82e['totalCount'],'dataId':_0x35741f});return{'execute':async()=>{await _0x236ccc['request'];},'abortController':_0x236ccc['abortController']};}upsertCustomAIReviewRating(_0x2a10b8,_0x3811bc,_0x479cbf){const _0x3b06d0=this['_sendApiRequest']('/reviews/custom/calls/'+_0x2a10b8+'/ratings','PUT',{'positiveCount':_0x3811bc['positiveCount'],'totalCount':_0x3811bc['totalCount'],'dataId':_0x479cbf});return{'execute':async()=>{await _0x3b06d0['request'];},'abortController':_0x3b06d0['abortController']};}_sendApiRequest(_0x2b9df0,_0x193aa1,_0x36347e,_0x5ca194={}){const {apiUrl:_0x3a5d0d=this['_apiUrl']}=_0x5ca194,_0x3e63a1=new AbortController(),_0x4c69e8=_0x36347e instanceof FormData,_0x400be1={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':xt};_0x36347e&&!_0x4c69e8&&(_0x400be1['Content-Type']='application/json');const _0x998dbd={'method':_0x193aa1,'headers':_0x400be1,'signal':_0x3e63a1['signal']};return _0x36347e&&(_0x998dbd['body']=_0x4c69e8?_0x36347e:JSON['stringify'](_0x36347e)),{'request':fetch(''+_0x3a5d0d+_0x2b9df0,_0x998dbd)['catch'](_0xfe50bf=>{this['_handleError'](_0xfe50bf);})['then'](_0x505470=>_0x505470['ok']?_0x505470:_0x505470['json']()['then'](_0xc69011=>{throw{'url':_0x3a5d0d,'path':_0x2b9df0,'method':_0x193aa1,'body':_0x36347e,'status':(_0x505470||{})['status'],'statusText':(_0x505470||{})['statusText'],'code':_0xc69011['code'],'message':_0xc69011['message'],'traceId':_0xc69011['traceId'],'data':_0xc69011['data']};})),'abortController':_0x3e63a1};}async *_getStreamReader(_0x17c855){const _0x1ab80c=[],_0x2398ac=_0x17c855['getReader'](),_0x42004b=_0x5201cf({'onError':_0x5a2c00=>{this['_handleError'](_0x5a2c00);},'onEvent':_0x4dad32=>{_0x4dad32['data']=JSON['parse'](_0x4dad32['data']),_0x1ab80c['push'](_0x4dad32);}});try{let _0x961c60=!0x1;for(;!_0x961c60;){const {done:_0x1096d8,value:_0x135703}=await _0x2398ac['read']();_0x1096d8&&(_0x961c60=!0x0),_0x42004b['feed'](this['_decoder']['decode'](_0x135703,{'stream':!0x0})),yield*_0x1ab80c,_0x1ab80c['length']=0x0;}}catch(_0x14bca9){this['_handleError'](_0x14bca9);}finally{_0x2398ac['releaseLock'](),_0x42004b['reset']();}}['_handleError'](_0x571ff1){if(_0x571ff1 instanceof ct)throw _0x571ff1;if(_0x571ff1 instanceof Error&&'AbortError'===_0x571ff1['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x571ff1});throw new ct('ai-request-failed',this,{'originalError':_0x571ff1});}};function ms(_0x1217cd){return _0x1217cd?.['length']?{'contexts':_0x1217cd['map'](ps)}:{};}function Ts(_0x5a8eea,_0x1ead40,_0x380129){const t=_0x5a8eea['t'];switch(_0x1ead40){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'},_0x380129);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x380129);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.'},_0x380129);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x380129);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'},_0x380129);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x380129);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'},_0x380129);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.'},_0x380129);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.'},_0x380129);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.'},_0x380129);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.'},_0x380129);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'},_0x380129);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.'},_0x380129);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.'});default:return _0x1ead40;}}const ws=/* #__PURE__ -- @preserve */
|
|
25
|
+
dt();var Cs=class extends ws{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x4d689e,config:_0x49c5c3,locale:_0x5c2597}){super(),this['_connector']=_0x4d689e,this['_config']=_0x49c5c3,this['_locale']=_0x5c2597;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x5736db=>{throw this['_modelsRequest']=null,_0x5736db;})),this['_modelsRequest'];}async getAvailableModels(){const _0x38ea13=await this['getAllModels']();let _0x580204;return _0x580204=this['_availableModels']?this['_filterModels'](_0x38ea13,this['_availableModels']):_0x38ea13['filter'](_0x254ac0=>_0x254ac0['recommended']),_0x580204;}async['resolveModel'](_0x479108){const _0x54f8f3=await this['getAllModels']();if(!_0x54f8f3['length'])return null;if(_0x479108){const _0x1d5d5a=this['_getModelById'](_0x54f8f3,_0x479108);if(_0x1d5d5a)return _0x1d5d5a;Ot('ai-chat-model-id-unrecognized',{'modelId':_0x479108,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0xa6bfef=await this['getAvailableModels']();if(!_0xa6bfef['length'])return null;if(this['_defaultModelId']){const _0x302de7=this['_getModelById'](_0xa6bfef,this['_defaultModelId']);if(_0x302de7)return _0x302de7;Ot('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0xa6bfef[0x0]['id']});}return _0xa6bfef[0x0];}async['isAvailable'](_0x419168){return(await this['getAvailableModels']())['some'](_0x14a798=>_0x14a798['name']===_0x419168['name']&&_0x14a798['provider']===_0x419168['provider']);}async getModel(_0x1cd32f){const _0x11e64b=await this['getAllModels']();return this['_getModelById'](_0x11e64b,_0x1cd32f)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x303525=this['_locale']['uiLanguage']||'en',_0x314eea=await this['_connector']['getModels'](_0x303525)['list']();this['_modelList']=_0x314eea['items']['map'](_0x204b01=>fs(_0x204b01)?{..._0x204b01,'name':Ts(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x204b01);}return[...this['_modelList']];}_filterModels(_0x43431e,_0x40a3a3){let _0x5e4d14;if(_0x40a3a3){_0x5e4d14=[];const _0x44ccf3=new Set(),_0x13ef70='string'==typeof _0x40a3a3?[_0x40a3a3['toLocaleLowerCase']()]:_0x40a3a3['map'](_0x5c64ca=>_0x5c64ca['toLocaleLowerCase']());for(const _0x5c00c5 of _0x13ef70)for(const _0x5cc7e6 of _0x43431e)!_0x44ccf3['has'](_0x5cc7e6['id'])&&this['_isMatchingFilter'](_0x5cc7e6,_0x5c00c5)&&(_0x5e4d14['push'](_0x5cc7e6),_0x44ccf3['add'](_0x5cc7e6['id']));}else _0x5e4d14=_0x43431e;return _0x5e4d14;}_isMatchingFilter(_0x2e689a,_0x46a05e){const _0x3703be=_0x2e689a['id']['toLocaleLowerCase'](),_0x3eece5=_0x2e689a['name']['toLocaleLowerCase'](),_0x46fc33=_0x2e689a['provider']['toLocaleLowerCase']();return _0x3703be===_0x46a05e||_0x3eece5===_0x46a05e||fs(_0x2e689a)&&'auto'===_0x46a05e||_0x46fc33===_0x46a05e||_0x3703be['startsWith'](_0x46a05e);}_getModelById(_0x561885,_0x2a5b8b){return _0x561885['find'](_0x5f0dec=>fs(_0x5f0dec)&&'auto'===_0x2a5b8b?_0x5f0dec:_0x5f0dec['id']===_0x2a5b8b)||null;}};function fs(_0x2bc7b8){return _0x2bc7b8['id']['startsWith']('agent');}var bs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x9bce5,defaultContext:_0xe7c084}){this['_connector']=_0x9bce5,this['_defaultContext']=_0xe7c084;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x33a835=>{throw this['_contextsRequest']=null,_0x33a835;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x38bdcc=await this['getAllContexts'](),_0xa6ad15=new Set((this['_defaultContext']??[])['map'](_0x2fd0d6=>_0x2fd0d6['id']));return _0x38bdcc['filter'](_0x14946e=>!_0xa6ad15['has'](_0x14946e['id']));}resolveContext({feature:_0x3fd394,ids:_0x256d84=[],extraContexts:_0xb6e935=[],idScopedOnly:_0x195d3d=!0x1,context:_0x341f55}){const _0xefd177=this['_resolveDefaultContext'](_0x3fd394,_0x256d84,_0x195d3d);return _0x341f55['addDefaultContext']([..._0xefd177,..._0xb6e935]),_0x341f55;}_resolveDefaultContext(_0x2e572a,_0x3bc9c7,_0x1127d9=!0x1){if(!this['_defaultContext'])return[];const _0x5d31df=[];for(const _0x23f2cb of this['_defaultContext'])this['_entryAppliesToFeature'](_0x23f2cb['features'],_0x2e572a,_0x3bc9c7)&&(_0x1127d9&&this['_entryAppliesToFeature'](_0x23f2cb['features'],_0x2e572a,[])||_0x5d31df['push'](this['_toContextRef'](_0x23f2cb)));return _0x5d31df;}_toContextRef(_0x3d7ffe){return'promptId'in _0x3d7ffe?{'id':_0x3d7ffe['id'],'promptId':_0x3d7ffe['promptId']}:'fileId'in _0x3d7ffe?{'id':_0x3d7ffe['id'],'fileId':_0x3d7ffe['fileId']}:{'id':_0x3d7ffe['id']};}_entryAppliesToFeature(_0xece216,_0x152f28,_0x502719){if(!_0xece216)return!0x0;const _0xf07907=_0xece216[_0x152f28];return!!_0xf07907&&(!0x0===_0xf07907||_0x502719['some'](_0x159a21=>_0xf07907['test'](_0x159a21)));}},Ss=class extends _0x22445f{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Es];}init(){const _0x3f66ba=this['context']['plugins']['get'](Es);this['models']=new Cs({'connector':_0x3f66ba,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new bs({'connector':_0x3f66ba,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function Rs(_0xfaae3d){return _0xfaae3d?_0xfaae3d instanceof _0x46bd64?[_0xfaae3d]:_0xfaae3d['editors']&&0x0!==_0xfaae3d['editors']['length']?Array['from'](_0xfaae3d['editors']):[]:[];}function Os(_0x2c8ffb){const _0x5d26fa=Rs(_0x2c8ffb);if(!_0x5d26fa['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x5d26fa['length'])return _0x5d26fa[0x0];const _0x47fce4=_0x5d26fa['find'](_0x1c5a46=>_0x1c5a46['ui']?.['focusTracker']?.['isFocused']);if(_0x47fce4)return _0x47fce4;const _0x55de63=function(_0x3c679b){if(_0x3c679b instanceof _0x46bd64)return;const _0x5180c7=_0x3c679b;if(!_0x5180c7['plugins']||!_0x5180c7['plugins']['has']('AIEditing'))return;return _0x5180c7['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x2c8ffb);return _0x55de63&&_0x5d26fa['includes'](_0x55de63)?_0x55de63:_0x5d26fa[0x0];}function vs(_0x562c14,_0x54c1fd){return _0x4a6a03(_0x562c14,_0x54c1fd);}function ks(_0x17a705,_0x1a9603){return _0x54291f(_0x17a705,_0x1a9603);}function ys(_0x1bb18a,_0x304650,_0x2c58b4){const _0x35b960=null!==_0x304650?_0x55a332=>_0x55a332['attribs'][_0x1bb18a]===_0x304650:_0x5b07e0=>Boolean(_0x5b07e0['attribs'][_0x1bb18a]);return _0x2bff0b(_0x32de7=>_0x5431e6(_0x32de7)&&_0x35b960(_0x32de7),_0x2c58b4);}function Ns(_0x280afb,_0x6ef2e3,_0x4201a9){const _0x407344=null!==_0x6ef2e3?_0x487d1c=>_0x487d1c['attribs'][_0x280afb]===_0x6ef2e3:_0x55c34f=>Boolean(_0x55c34f['attribs'][_0x280afb]);return _0x4f9d25(_0x4d56e9=>_0x5431e6(_0x4d56e9)&&_0x407344(_0x4d56e9),_0x4201a9);}function xs(_0x2bb9ec){return _0x4f9d25(_0x4834a7=>_0x5431e6(_0x4834a7)&&function(_0xb2d044){const _0x192f58=_0xb2d044['toLowerCase']();return'script'===_0x192f58||'style'===_0x192f58||_0x192f58['includes']('-');}(_0x4834a7['name']),_0x2bb9ec);}const Ls=['comment-start','comment-end','suggestion-start','suggestion-end'];function Ps(_0x2c5b7e){return _0x5431e6(_0x2c5b7e)&&Ls['includes'](_0x2c5b7e['name']['toLowerCase']());}function Ds(_0x27aac5){return _0x4ff60b(_0x44bcfa=>ti(_0x44bcfa),_0x27aac5,!0x0,0x1/0x0);}function Hs(_0x3b1e4a,_0x1738dd){return _0x3b1e4a&&_0x5431e6(_0x3b1e4a)?_0x3b1e4a['attribs'][_0x1738dd]:null;}function Ms(_0x17a778,_0x2aa583,_0x5773be){_0x5431e6(_0x17a778)&&(null===_0x5773be?delete _0x17a778['attribs'][_0x2aa583]:_0x17a778['attribs'][_0x2aa583]=_0x5773be);}function Us(_0xc9595c,_0x46d383,_0x5cf57f){const _0x3eccb2=_0x46d383['cloneNode'](!0x0);'beforebegin'===_0x5cf57f?_0xed3d66(_0xc9595c,_0x3eccb2):'afterbegin'===_0x5cf57f?_0x53ea60(_0xc9595c,_0x3eccb2):'beforeend'===_0x5cf57f?_0x44faed(_0xc9595c,_0x3eccb2):'afterend'===_0x5cf57f&&_0x4fa092(_0xc9595c,_0x3eccb2);}function Vs(_0x1a76d5){const _0x1b257d=[];let _0x12dfc9=_0x1a76d5;for(;_0x12dfc9;)_0x12dfc9=_0x2073f4(_0x12dfc9),_0x12dfc9&&_0x1b257d['push'](_0x12dfc9);return _0x1b257d;}function Bs(_0x54373a){return _0x54373a['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Gs(_0x22dbd7){let _0x5ea6f8=0x0;for(;_0x22dbd7['parentNode'];)_0x22dbd7=_0x22dbd7['parentNode'],_0x5ea6f8++;return _0x5ea6f8;}function Fs(_0x4ba0e4){const _0x3b39a4=[];let _0x185484=_0x4ba0e4['nextSibling'];for(;_0x185484;)_0x3b39a4['push'](_0x185484),_0x185484=_0x185484['nextSibling'];_0x3b39a4['forEach'](_0x2ab088=>{_0x539e1a(_0x2ab088);});}function Ks(_0x43f38c,_0x22f680){return!!_0x43f38c['model']['document']['getRoot'](_0x22f680)&&!_0x1f1c63(_0x43f38c,_0x22f680);}function Ws(_0x10f78f,_0x2d9d31){return'<p\x20data-id=\x22'+_0x2d9d31+'\x22>'+_0x10f78f+'</p>';}function Ys(_0x55f3d4){return'p'===_0x55f3d4['name']['toLowerCase']()&&Boolean(_0x55f3d4['attribs']['data-id']);}function $s(_0x53de81){const _0x2d37fd=vs(_0x53de81)['children']['filter'](_0x5431e6);return 0x1===_0x2d37fd['length']&&Ys(_0x2d37fd[0x0])?_0x2d37fd[0x0]['children']['map'](_0x45aa42=>ks(_0x45aa42))['join'](''):_0x53de81;}function qs(_0x347c0a,_0x4da9d6){const _0x1af62c=function(_0x2951e1){const _0x402078=_0x2951e1['children']['filter'](_0x5431e6);return 0x1===_0x402078['length']&&Ys(_0x402078[0x0])?_0x402078[0x0]['children']:_0x2951e1['children'];}(_0x4da9d6),{blockElements:_0x390727}=_0x347c0a['editing']['view']['domConverter'],_0x98789f=_0x41885d=>_0x41885d['some'](_0x202632=>_0x5431e6(_0x202632)&&('p'!==_0x202632['name']['toLowerCase']()&&_0x390727['includes'](_0x202632['name']['toLowerCase']())||_0x98789f(_0x202632['children'])));if(_0x98789f(_0x1af62c))return!0x1;const _0x27e9c2=_0x1af62c['map'](_0x1d0044=>ks(_0x1d0044))['join'](''),_0x65ef81=_0x347c0a['data']['parse'](_0x27e9c2,'$root'),{schema:_0x14457e}=_0x347c0a['model'];let _0x3a62dd=0x0;for(const {item:_0x41b003}of _0x347c0a['model']['createRangeIn'](_0x65ef81))if(_0x41b003['is']('element')&&_0x14457e['isBlock'](_0x41b003)&&(++_0x3a62dd>0x1||'paragraph'!==_0x41b003['name']))return!0x1;return!0x0;}function Qs(_0x1b6603,_0x3af07a){const _0x3f1a72=_0x3af07a['filter'](_0x353d46=>'new'!=_0x353d46['type'])['map'](_0x12b3ec=>ys('data-id',_0x12b3ec['id'],_0x1b6603))['filter'](_0x5370e5=>null!==_0x5370e5),_0x364ce5=_0x3af07a['filter'](_0xc0ce2c=>'removed'!=_0xc0ce2c['type'])['map'](_0x48dee=>_0x48dee['node']['cloneNode'](!0x0));let _0x28d44d=null;if(_0x3f1a72['length']){_0x28d44d=_0x3f1a72[0x0]['previousSibling'];for(let _0x7d3d6b=0x0;_0x7d3d6b<_0x3f1a72['length'];_0x7d3d6b++)_0x539e1a(_0x3f1a72[_0x7d3d6b]);}if(_0x364ce5['length']){_0x28d44d||(_0x3af07a[0x0]['anchorId']?_0x28d44d=ys('data-id',_0x3af07a[0x0]['anchorId'],_0x1b6603):(_0x28d44d=_0x364ce5['shift'](),_0x53ea60(_0x1b6603,_0x28d44d)));for(let _0x4068ec=0x0;_0x4068ec<_0x364ce5['length'];_0x4068ec++)_0x4fa092(_0x28d44d,_0x364ce5[_0x4068ec]),_0x28d44d=_0x364ce5[_0x4068ec];}}function Xs(_0x4804c3,_0x42fbb9){const _0x3e109a=new Set();for(const _0x10bb6b of _0x4804c3){if(!_0x10bb6b['editor']||'destroyed'===_0x10bb6b['editor']['state']||!Ks(_0x10bb6b['editor'],_0x10bb6b['rootName']))continue;const _0x5b4290=_0x42fbb9['get'](_0x10bb6b['documentId']);let _0x2ac2a9;_0x5b4290?(_0x2ac2a9=_0x5b4290['cloneNode'](!0x0),Qs(_0x2ac2a9,_0x10bb6b['changes'])):_0x2ac2a9=new _0x56ff8a(_0x10bb6b['changes']['filter'](_0x2f449f=>'removed'!=_0x2f449f['type'])['map'](_0x53a612=>_0x53a612['node']['cloneNode'](!0x0))),qs(_0x10bb6b['editor'],_0x2ac2a9)||_0x3e109a['add'](_0x10bb6b['index']);}return _0x3e109a;}function zs(_0x2fb2f6,_0x55b3f3,_0x3153df,_0x5bfd62){return Ks(_0x2fb2f6,_0x55b3f3)?qs(_0x2fb2f6,vs(_0x5bfd62))?{'before':$s(_0x3153df),'after':$s(_0x5bfd62)}:null:{'before':_0x3153df,'after':_0x5bfd62};}function js(_0x1f4c02,_0x526edc){return _0x45d313(_0x1f4c02,_0x526edc);}function Js(_0x68dbf0,_0x229fcd){return _0x68dbf0['map'](_0x475450=>null!==_0x475450&&'object'==typeof _0x475450?js(_0x475450,_0x229fcd):_0x475450);}const Zs=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],tn='ai-selection',en=['br'];var sn=class extends _0x22445f{constructor(_0x169524){super(_0x169524),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0xf1591){let _0x24cdb9=this['_sessionIdByEditor']['get'](_0xf1591);return _0x24cdb9||(_0x24cdb9=_0xf1591['plugins']['has']('RealTimeCollaborationClient')&&_0xf1591['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Nt(),this['_sessionIdByEditor']['set'](_0xf1591,_0x24cdb9)),_0x24cdb9;}async getDocumentData(_0x2fad03){const _0x3389a9=Rs(this['context']),_0x465fb4=[],_0x29eaa2=new Set();for(const _0x4c60a4 of _0x3389a9){if(_0x2fad03&&!_0x2fad03['has'](_0x4c60a4['config']['get']('collaboration.channelId')))continue;const _0x45aac5=_0x4c60a4['config']['get']('roots')||{},_0x309805=this['_getEditorSelectionSignature'](_0x4c60a4),_0x385acd=_0x4c60a4['config']['get']('collaboration.channelId'),_0x2e855f=this['getSessionId'](_0x4c60a4);for(const _0x29102f of _0x4c60a4['model']['document']['getRoots']()){if('$graveyard'===_0x29102f['rootName'])continue;const _0x4dbebd=await this['_getDocumentDataForEditorRoot'](_0x4c60a4,_0x29102f,_0x29eaa2),_0x4f7b51=_0x45aac5[_0x29102f['rootName']],_0x43f28a=_0x29102f['getAttribute']('$description')??_0x4f7b51?.['description'];let _0x2e04f4=_0x29102f['getAttribute']('$title')??_0x4f7b51?.['title'];_0x2e04f4||(_0x2e04f4=_0x29102f['getAttribute']('$rootEditableOptions')?.['label']??_0x4f7b51?.['label']),_0x2e04f4||(Ot('ai-document-root-missing-title',{'editor':_0x4c60a4,'rootName':_0x29102f['rootName']}),_0x2e04f4=_0x29102f['rootName']),_0x465fb4['push']({'editor':_0x4c60a4,'rootName':_0x29102f['rootName'],'content':_0x4dbebd['content'],'version':_0x4dbebd['version'],'sessionId':_0x2e855f,'channelId':_0x385acd,'selections':_0x4dbebd['selections'],'selectionSignature':_0x309805,'editorConfig':this['_getEditorConfig'](_0x4c60a4),'name':_0x2e04f4,'description':_0x43f28a});}}return _0x465fb4;}getEditorsVersions(){const _0x2befbf=Rs(this['context']),_0x283dd9=new Map();for(const _0x432509 of _0x2befbf){const _0x9af3c8=_0x432509['config']['get']('collaboration.channelId');_0x283dd9['set'](_0x9af3c8,_0x432509['model']['document']['version']);}return _0x283dd9;}getEditorsSelections(){const _0x169d1b=Rs(this['context']),_0x229b4f=new Map();for(const _0x3a61ea of _0x169d1b){const _0x1716a8=_0x3a61ea['config']['get']('collaboration.channelId'),_0x30f41b=this['_getEditorSelectionSignature'](_0x3a61ea);_0x229b4f['set'](_0x1716a8,_0x30f41b);}return _0x229b4f;}_getEditorSelectionSignature(_0x23bd93){return this['_getMarkersInDocumentOrder'](_0x23bd93)['map'](_0x439e5b=>{const _0x587c1d=_0x439e5b['getRange']();return _0x587c1d['root']['rootName']+':'+_0x587c1d['start']['path']['join']('.')+'-'+_0x587c1d['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x5d1a99,_0x5e6e7d,_0x13558a){const _0x721d57=_0x5d1a99['data']['toView'](_0x5e6e7d,{'convertAiChatSelectionMarker':!0x0}),_0x1cf366=new _0xe49d24(_0x5d1a99['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x721d57,_0x1cf366,_0x13558a);let _0x447ff5=await this['_getDocumentDataStringFromView'](_0x721d57,_0x5d1a99);Ks(_0x5d1a99,_0x5e6e7d['rootName'])&&(_0x447ff5=Ws(_0x447ff5,this['_nextDataId'](_0x13558a)));const _0x37af4d=this['_getMarkersInDocumentOrder'](_0x5d1a99,_0x5e6e7d),_0x1d988e=[];for(const _0x523ac9 of _0x37af4d){const _0x45c0ff='<'+_0x523ac9['name']+':start></'+_0x523ac9['name']+':start>',_0x5197de=_0x447ff5['indexOf'](_0x45c0ff);_0x447ff5=_0x447ff5['substring'](0x0,_0x5197de)+_0x447ff5['substring'](_0x5197de+_0x45c0ff['length']);const _0x130f1f='<'+_0x523ac9['name']+':end></'+_0x523ac9['name']+':end>',_0x483050=_0x447ff5['indexOf'](_0x130f1f);_0x447ff5=_0x447ff5['substring'](0x0,_0x483050)+_0x447ff5['substring'](_0x483050+_0x130f1f['length']),_0x1d988e['push']({'markerName':_0x523ac9['name'],'start':_0x5197de,'end':_0x483050,'htmlFragment':_0x447ff5['substring'](_0x5197de,_0x483050)});}return{'content':_0x447ff5,'version':_0x5d1a99['model']['document']['version'],'selections':_0x1d988e};}afterInit(){this['context']instanceof _0x46bd64?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x286307,_0x5d11f7)=>{_0x5d11f7['on']('ready',()=>{this['_integrateEditor'](_0x5d11f7);});});}_setOutputDataProcessor(_0x53ceba){this['_outputDataProcessor']=_0x53ceba;}async _getDocumentDataStringFromView(_0x19dec8,_0x5707e9){let _0x441b12;if(this['_outputDataProcessor']){const _0x32d9e9=_0x5707e9['data']['processor']['domConverter']['viewToDom'](_0x19dec8),_0x423cf1=await this['_outputDataProcessor'](_0x32d9e9);_0x441b12=_0x5707e9['data']['processor']['htmlWriter']['getHtml'](_0x423cf1);}else _0x441b12=_0x5707e9['data']['processor']['toData'](_0x19dec8);return _0x441b12;}_integrateEditor(_0x4b4cbd){if(!_0x4b4cbd['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x4b4cbd);_0x4b4cbd['ui']['focusTracker']['on']('change:isFocused',(_0x790237,_0x19a762,_0x26d0b2)=>{_0x26d0b2&&(this['_lastContentFocusedEditor']=_0x4b4cbd);}),_0x4b4cbd['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x4b4cbd&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x4b4cbd['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tn,'view':({markerName:_0x39967a})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x39967a['split'](':')[0x1]],'priority':0xc})}),_0x4b4cbd['conversion']['for']('dataDowncast')['markerToElement']({'model':tn+':context','view':(_0x39c4f7,{writer:_0x247950,options:_0x3eb5bc})=>_0x3eb5bc['convertAiChatSelectionMarker']?_0x247950['createUIElement'](_0x39c4f7['markerName']+':'+(_0x39c4f7['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x247872){const _0x47fe29=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x247872);const _0x243526=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x47fe29,_0x243526);}hideFakeVisualSelection(_0x4d170d){const _0x342b29=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x4d170d);const _0x499678=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x342b29,_0x499678);}async modelToDataWithIds(_0x45eb8e,_0x38b76e,_0x2e8dcc){const _0x48388b=_0x38b76e['data']['toView'](_0x45eb8e),_0x1d1187=new _0xe49d24(_0x38b76e['editing']['view']['document']),_0x719072=new Set();this['_setDataIdsOnChildren'](_0x48388b,_0x1d1187,_0x719072);const _0x357f6c=await this['_getDocumentDataStringFromView'](_0x48388b,_0x38b76e);return _0x2e8dcc&&Ks(_0x38b76e,_0x2e8dcc)?Ws(_0x357f6c,this['_nextDataId'](_0x719072)):_0x357f6c;}_setDataIdsOnChildren(_0x3e0d78,_0x4b354e,_0x411336=new Set()){let _0x21fea5=!0x1;for(const _0x531108 of _0x3e0d78['getChildren']()){if(!_0x531108['is']('view:element')||en['includes'](_0x531108['name']))continue;const _0xc98de3=_0x531108['is']('view:containerElement'),_0x5a7ce2=_0x531108['is']('view:emptyElement'),_0x4de6ab=_0x531108['is']('view:rawElement'),_0x3ad2da=this['_setDataIdsOnChildren'](_0x531108,_0x4b354e,_0x411336);_0x531108['hasAttribute']('data-id')?(_0x21fea5=!0x0,_0x411336['add'](_0x531108['getAttribute']('data-id'))):(_0xc98de3||_0x5a7ce2||_0x4de6ab||_0x3ad2da)&&(_0x4b354e['setAttribute']('data-id',this['_nextDataId'](_0x411336),_0x531108),_0x21fea5=!0x0);}return _0x21fea5;}_nextDataId(_0x40cb04){let _0x1c6943;do{_0x1c6943='';for(let _0x11526e=0x0;_0x11526e<0x4;_0x11526e++)_0x1c6943+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x40cb04['has'](_0x1c6943));return _0x40cb04['add'](_0x1c6943),_0x1c6943;}getSelectionText(_0x83ceb4){const _0x5e012d=(_0x83ceb4?_0x83ceb4['model']:Os(this['context'])['model'])['document']['selection'],_0x59be0d=[],_0x2448aa=Array['from'](_0x5e012d['getRanges']());_0x2448aa['sort']((_0xe3517a,_0x35e50f)=>_0xe3517a['start']['isBefore'](_0x35e50f['start'])?-0x1:0x1);for(const _0x2e50c1 of _0x2448aa)for(const _0x3f8a80 of _0x2e50c1['getItems']())_0x3f8a80['is']('$textProxy')?_0x59be0d['push'](_0x3f8a80['data']):_0x3f8a80['is']('element')&&_0x59be0d['length']>0x0&&'\x20'!==_0x59be0d[_0x59be0d['length']-0x1]&&_0x59be0d['push']('\x20');return _0x59be0d['length']?'\x22'+_0x59be0d['join']('')['trim']()+'\x22':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x7383eb){for(let _0xeeb65f=0x0;_0xeeb65f<this['_fakeSelections']['length'];_0xeeb65f++)if(this['_fakeSelections'][_0xeeb65f]['id']==_0x7383eb)return void this['_fakeSelections']['splice'](_0xeeb65f,0x1);}_addFakeSelection(_0x24a2b1){this['_removeFakeSelectionById'](_0x24a2b1['id']),ft(this['_fakeSelections'],_0x24a2b1);}_refreshFakeSelection(_0x364542,_0x4e8f20){if(_0x364542==_0x4e8f20)return;const _0x3f320c=_0x364542?_0x364542['editor']:null,_0x40c676=_0x4e8f20?_0x4e8f20['editor']:null,_0x2f4b93=(_0x4126b7,_0x402b8d)=>{const _0x2d8b01=_0x402b8d['model']['markers']['getMarkersGroup'](tn);for(const _0x52df4f of _0x2d8b01)_0x4126b7['removeMarker'](_0x52df4f);},_0x505007=(_0x27becc,_0x1f7bc8,_0x1e62ca)=>{const _0x636644=_0x1f7bc8['model'];for(let _0x50fb71=0x0;_0x50fb71<_0x1e62ca['ranges']['length'];_0x50fb71++){let _0x361e74=_0x1e62ca['ranges'][_0x50fb71];const _0x261478=tn+':'+_0x1e62ca['id']+':'+_0x50fb71;if(_0x361e74['start']['isAtEnd']){const _0x2e1cad=_0x361e74['start']['getLastMatchingPosition'](({item:_0x32e450})=>!_0x636644['schema']['isContent'](_0x32e450),{'boundaries':_0x361e74});_0x361e74=_0x27becc['createRange'](_0x2e1cad,_0x361e74['end']);}_0x27becc['addMarker'](_0x261478,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x361e74});}};_0x3f320c&&_0x40c676&&_0x3f320c===_0x40c676&&_0x4e8f20?_0x3f320c['model']['change'](_0x5d93b1=>{_0x2f4b93(_0x5d93b1,_0x3f320c),_0x505007(_0x5d93b1,_0x40c676,_0x4e8f20);}):(_0x3f320c&&_0x3f320c['model']['change'](_0x3cd7e=>_0x2f4b93(_0x3cd7e,_0x3f320c)),_0x40c676&&_0x4e8f20&&_0x40c676['model']['change'](_0x2750f8=>_0x505007(_0x2750f8,_0x40c676,_0x4e8f20)));}_getMarkersInDocumentOrder(_0x442917,_0x26fbcd){const _0x411667=Array['from'](_0x442917['model']['markers']['getMarkersGroup'](tn+':context'));return(_0x26fbcd?_0x411667['filter'](_0x60bbb8=>{const _0x41dfbc=_0x60bbb8['getRange']();return _0x41dfbc&&_0x41dfbc['root']['rootName']===_0x26fbcd['rootName'];}):_0x411667)['sort']((_0x3481ff,_0x310ffb)=>_0x3481ff['getStart']()['isBefore'](_0x310ffb['getStart']())?-0x1:_0x3481ff['getStart']()['isAfter'](_0x310ffb['getStart']())?0x1:0x0);}_getEditorConfig(_0x5c977b){let _0x428e1f=this['_editorsToConfigs']['get'](_0x5c977b);return _0x428e1f||(_0x428e1f=function(_0x2a0715){const _0x43cbce={};if(_0x2a0715['plugins']['has']('AlignmentEditing')&&(_0x43cbce['alignment']=_0x2a0715['config']['get']('alignment')),_0x2a0715['plugins']['has']('CodeBlockEditing')&&(_0x43cbce['codeBlock']=_0x2a0715['config']['get']('codeBlock')),_0x2a0715['plugins']['has']('FontBackgroundColorEditing')&&(_0x43cbce['fontBackgroundColor']=js(_0x2a0715['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x2a0715['plugins']['has']('FontColorEditing')&&(_0x43cbce['fontColor']=js(_0x2a0715['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x2a0715['plugins']['has']('FontFamilyEditing')&&(_0x43cbce['fontFamily']=_0x2a0715['config']['get']('fontFamily'),_0x43cbce['fontFamily']&&_0x43cbce['fontFamily']['options']&&(_0x43cbce['fontFamily']['options']=Js(_0x43cbce['fontFamily']['options'],['model','upcastAlso']))),_0x2a0715['plugins']['has']('FontSizeEditing')&&(_0x43cbce['fontSize']=_0x2a0715['config']['get']('fontSize'),_0x43cbce['fontSize']&&_0x43cbce['fontSize']['options']&&(_0x43cbce['fontSize']['options']=Js(_0x43cbce['fontSize']['options'],['upcastAlso']))),_0x2a0715['plugins']['has']('FootnotesEditing')){const _0x3e14ad=_0x2a0715['config']['get']('footnotes')??{};_0x3e14ad['footnotesProperties']&&'object'==typeof _0x3e14ad['footnotesProperties']&&(_0x3e14ad['footnotesProperties']=js(_0x3e14ad['footnotesProperties'],['toolbar','listStyles'])),_0x43cbce['footnotes']=_0x3e14ad;}if(_0x2a0715['plugins']['has']('HeadingEditing')&&(_0x43cbce['heading']=_0x2a0715['config']['get']('heading'),_0x43cbce['heading']&&_0x43cbce['heading']['options']&&(_0x43cbce['heading']['options']=Js(_0x43cbce['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x2a0715['plugins']['has']('HighlightEditing')&&(_0x43cbce['highlight']=_0x2a0715['config']['get']('highlight'),_0x43cbce['highlight']&&_0x43cbce['highlight']['options']&&(_0x43cbce['highlight']['options']=Js(_0x43cbce['highlight']['options'],['model','color']))),_0x2a0715['plugins']['has']('ImageBlockEditing')||_0x2a0715['plugins']['has']('ImageInlineEditing')){const _0x140bcc=js(_0x2a0715['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x2a0715['plugins']['has']('ImageResizeEditing')||delete _0x140bcc['resizeUnit'],_0x2a0715['plugins']['has']('ImageStyleEditing')?_0x140bcc['styles']?.['options']&&(_0x140bcc['styles']['options']=Js(_0x140bcc['styles']['options'],['icon'])):delete _0x140bcc['styles'],_0x43cbce['image']=_0x140bcc;}if(_0x2a0715['plugins']['has']('IndentBlock')&&(_0x43cbce['indentBlock']=_0x2a0715['config']['get']('indentBlock')),_0x2a0715['plugins']['has']('LineHeightEditing')&&(_0x43cbce['lineHeight']=_0x2a0715['config']['get']('lineHeight'),_0x43cbce['lineHeight']&&(delete _0x43cbce['lineHeight']['supportAllValues'],_0x43cbce['lineHeight']['options']&&(_0x43cbce['lineHeight']['options']=Js(_0x43cbce['lineHeight']['options'],['model'])))),_0x2a0715['plugins']['has']('LinkEditing')&&(_0x43cbce['link']=js(_0x2a0715['config']['get']('link'),['toolbar'])),_0x2a0715['plugins']['has']('ListEditing')){const _0x2ad516=_0x2a0715['config']['get']('list')??{};delete _0x2ad516['enableListItemMarkerFormatting'],_0x2a0715['plugins']['has']('ListPropertiesEditing')?_0x2ad516['properties']&&_0x2ad516['properties']['styles']&&'object'==typeof _0x2ad516['properties']['styles']&&(_0x2ad516['properties']['styles']=js(_0x2ad516['properties']['styles'],['listStyleTypes'])):delete _0x2ad516['properties'],_0x43cbce['list']=_0x2ad516;}if(_0x2a0715['plugins']['has']('MediaEmbedEditing')&&(_0x43cbce['mediaEmbed']=_0x2a0715['config']['get']('mediaEmbed'),_0x43cbce['mediaEmbed']&&(delete _0x43cbce['mediaEmbed']['toolbar'],_0x2a0715['plugins']['has']('MediaEmbedResizeEditing')?_0x43cbce['mediaEmbed']['resizeOptions']&&(_0x43cbce['mediaEmbed']['resizeOptions']=_0x43cbce['mediaEmbed']['resizeOptions']['map'](_0x3b68e7=>js(_0x3b68e7,['icon','label']))):delete _0x43cbce['mediaEmbed']['resizeOptions'],_0x2a0715['plugins']['has']('MediaEmbedStyleEditing')?_0x43cbce['mediaEmbed']['styles']&&_0x43cbce['mediaEmbed']['styles']['options']&&(_0x43cbce['mediaEmbed']['styles']['options']=Js(_0x43cbce['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x43cbce['mediaEmbed']['styles'])),_0x2a0715['plugins']['has']('MultiLevelListEditing')&&(_0x43cbce['listMultiLevel']=_0x2a0715['config']['get']('listMultiLevel')??{}),_0x2a0715['plugins']['has']('MentionEditing')){const _0x43b5fd=js(_0x2a0715['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x43b5fd['feeds']&&(_0x43b5fd['feeds']=_0x43b5fd['feeds']['map'](_0x338890=>js(_0x338890,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x43cbce['mention']=_0x43b5fd;}if(_0x2a0715['plugins']['has']('MergeFieldsEditing')){const _0x2819ef=js(_0x2a0715['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x2819ef['definitions'])&&(_0x2819ef['definitions']=_0x2819ef['definitions']['map'](_0x4ed260=>'groupId'in _0x4ed260?(Array['isArray'](_0x4ed260['definitions'])&&(_0x4ed260['definitions']=_0x4ed260['definitions']['map'](_0x4a6760=>js(_0x4a6760,['defaultValue']))),_0x4ed260):js(_0x4ed260,['defaultValue']))),_0x43cbce['mergeFields']=_0x2819ef;}if(_0x2a0715['plugins']['has']('StyleEditing')&&(_0x43cbce['style']=_0x2a0715['config']['get']('style')),_0x2a0715['plugins']['has']('TableEditing')){const _0x4cf54a=js(_0x2a0715['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x2a0715['plugins']['has']('TablePropertiesEditing')?_0x4cf54a['tableProperties']&&'object'==typeof _0x4cf54a['tableProperties']&&(_0x4cf54a['tableProperties']=js(_0x4cf54a['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x4cf54a['tableProperties'],_0x2a0715['plugins']['has']('TableCellPropertiesEditing')?_0x4cf54a['tableCellProperties']&&'object'==typeof _0x4cf54a['tableCellProperties']&&(_0x4cf54a['tableCellProperties']=js(_0x4cf54a['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x4cf54a['tableCellProperties'],_0x2a0715['plugins']['has']('TableLayoutEditing')?_0x4cf54a['tableLayout']||(_0x4cf54a['tableLayout']={}):delete _0x4cf54a['tableLayout'],_0x2a0715['plugins']['has']('TableCaptionEditing')?_0x4cf54a['tableCaption']||(_0x4cf54a['tableCaption']={}):delete _0x4cf54a['tableCaption'],_0x43cbce['table']=_0x4cf54a;}_0x2a0715['plugins']['has']('TextPartLanguageEditing')&&(_0x43cbce['textPartLanguage']=_0x2a0715['config']['get']('language.textPartLanguage'));for(const [_0x1d45f1,_0x5c6a80]of Zs)_0x2a0715['plugins']['has'](_0x1d45f1)&&(_0x43cbce[_0x5c6a80]={});return _0x43cbce;}(_0x5c977b),this['_editorsToConfigs']['set'](_0x5c977b,_0x428e1f)),_0x428e1f;}};const nn=/* #__PURE__ -- @preserve */
|
|
26
|
+
At();var rn=class extends nn{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x308e5b){super(),this['_generateUid']=_0x308e5b||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x1427e8,_0x21cecd,_0x1ce20e){this['_uidCounter']=0x0;const _0x4ee3d7=_0x1427e8['cloneNode'](!0x0);hn(_0x21cecd,_0x4ee3d7);const _0x353982=_0x4ee3d7['childNodes'],_0x2eaf2c=Array['from'](_0x353982)['filter'](_0x54338b=>!(0x3===_0x54338b['nodeType']&&''===ks(_0x54338b)['trim']())),_0x1afd50=_0x2eaf2c['length'];this['_existingDataIds']=new Set(Ns('data-id',null,_0x21cecd)['map'](_0x2c0056=>Hs(_0x2c0056,'data-id'))['filter'](_0x499957=>!!_0x499957));for(const _0x1697ca of _0x2eaf2c)_0x1697ca&&_0x5431e6(_0x1697ca)&&void 0x0===_0x1697ca['attribs']['data-id']&&Ms(_0x1697ca,'data-id','new-element');if(Ns('data-id',null,_0x4ee3d7)['forEach'](_0x4b4ef1=>{const _0x5ac079=Hs(_0x4b4ef1,'data-id');'new-element'===_0x5ac079||this['_existingDataIds']['has'](_0x5ac079)||Ms(_0x4b4ef1,'data-id','new-element');}),0x0===_0x21cecd['childNodes']['length']){const _0xd56f=[];return Ns('data-id','new-element',_0x4ee3d7)['forEach'](_0x576e7c=>{const _0x189124=this['_generateUid']();Ms(_0x576e7c,'data-id',_0x189124),_0xd56f['push'](_0x189124);}),this['_removeSpecialComments'](_0x4ee3d7),{'parsedContent':_0x4ee3d7,'newNodeIds':_0xd56f,'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();let _0x11ca09=-0x1,_0x1b3071=!0x1;for(let _0xe7cec9=0x0;_0xe7cec9<_0x1afd50;_0xe7cec9++){const _0x553cdf=_0x2eaf2c[_0xe7cec9],_0x2e8217=_0x2eaf2c[_0xe7cec9+0x1];if(this['_isNewNode'](_0x553cdf)){if(-0x1===_0x11ca09&&(_0x11ca09=_0xe7cec9),this['_markWrappedElements'](_0x553cdf),!this['_isNewNode'](_0x2e8217)){const [_0x287db2,_0x17501a]=this['_findReferenceNode'](_0x553cdf,_0x1b3071,_0x21cecd);if(_0x287db2){const _0x198f46=Array['from'](_0x2eaf2c)['slice'](_0x11ca09,_0xe7cec9+0x1);this['_insertNodes'](_0x287db2,_0x198f46,_0x17501a),_0x11ca09=-0x1;}}}else{if(this['_isExistingContentComment'](_0x553cdf))_0x1b3071=!0x0;else{if(this['_isExistingNode'](_0x553cdf)){const _0x1bb760=Hs(_0x553cdf,'data-id');if(_0x1bb760&&this['_existingDataIds']['has'](_0x1bb760)){this['_referencedExistingIds']['add'](_0x1bb760);const _0x1c96d6=ys('data-id',_0x1bb760,_0x21cecd);this['_replaceNode'](_0x1c96d6,_0x553cdf);}}else{if(on(_0x553cdf)){const _0xe69b3f=an(_0x553cdf);ys('data-id',_0xe69b3f,_0x4ee3d7)||this['_touchedNodesState']['removedIds']['push'](_0xe69b3f);}}}}}for(const _0x59aaaa of this['_touchedNodesState']['removedIds']){const _0xd3d835=ys('data-id',_0x59aaaa,_0x21cecd);_0xd3d835&&(this['_rescueUnwrappedElements'](_0xd3d835),this['_removeNode'](_0xd3d835,_0x59aaaa,_0x1ce20e));}if(Ns('data-id','new-element',_0x21cecd)['forEach'](_0xdb32a0=>{const _0x1bcc62=this['_getUid'](_0xdb32a0);Ms(_0xdb32a0,'data-id',_0x1bcc62),this['_touchedNodesState']['newIds']['push'](_0x1bcc62);}),this['_removeSpecialComments'](_0x21cecd),_0x1ce20e&&_0x1ce20e['cutAfterUnstable']){const _0x539dfe=this['_findLastConfirmationPoint'](_0x2eaf2c),_0x33a1c8=this['_getLastStableElement'](_0x21cecd,_0x539dfe);this['_markUnstableElements'](_0x21cecd,_0x33a1c8);}if(this['_processWrappedElements'](_0x21cecd,_0x1ce20e),_0x1ce20e&&_0x1ce20e['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x1f46f9=Ns('data-id',this['_touchedNodesState']['lastTouchedId'],_0x21cecd);let _0x35634c=_0x1f46f9[_0x1f46f9['length']-0x1];for(;_0x35634c;)Fs(_0x35634c),_0x35634c=_0x35634c['parentNode'];}return{'parsedContent':_0x21cecd,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x10805c,_0x23c71f,_0x2337a6){for(const _0x150f4d of _0x23c71f){const _0x35ff21=this['_getUid'](_0x150f4d);Ms(_0x150f4d,'data-id',_0x35ff21),this['_touchedNodesState']['newIds']['push'](_0x35ff21),this['_touchedNodesState']['lastTouchedId']=_0x35ff21;}const _0x5b34cf='afterbegin'===_0x2337a6||'afterend'===_0x2337a6?_0x23c71f['reverse']():_0x23c71f;for(const _0x27f13b of _0x5b34cf)Us(_0x10805c,_0x27f13b,_0x2337a6);}['_replaceNode'](_0x137111,_0x534feb){if(!_0x137111)return;if(_0x991f83=_0x534feb,Bs(ks(_0x137111))===Bs(ks(_0x991f83)))return;var _0x991f83;const _0x406da1=Hs(_0x137111,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x406da1),this['_touchedNodesState']['lastTouchedId']=_0x406da1,_0x3fd27e(_0x137111,_0x534feb['cloneNode'](!0x0));}['_removeNode'](_0x5d05db,_0xe59018,_0x6b82d6){if(_0x6b82d6&&_0x6b82d6['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0xe59018;const _0x5c0be7=_0x6b82d6['replaceRemovedWith']['cloneNode'](!0x0);Ms(_0x5c0be7,'data-id',_0xe59018),Ms(_0x5c0be7,'data-removed','true'),_0x3fd27e(_0x5d05db,_0x5c0be7);}else _0x539e1a(_0x5d05db);}['_findReferenceNode'](_0x269d84,_0x2bfe42,_0xc0533a){const _0x3c3cef=this['_findPrevElementWithDataId'](_0x269d84,!0x1);if(_0x3c3cef){const _0x252397=an(_0x3c3cef),_0x20731a=ys('data-id',_0x252397,_0xc0533a);if(_0x20731a)return[_0x20731a,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x252397);}const _0x2ff1d2=this['_findNextElementWithDataId'](_0x269d84,!0x1);if(_0x2ff1d2){const _0x1cf735=an(_0x2ff1d2),_0x230478=ys('data-id',_0x1cf735,_0xc0533a);if(_0x230478)return[_0x230478,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1cf735);}return _0x2bfe42?_0x269d84['nextSibling']?this['_findFallbackReferenceNode'](_0x269d84,_0xc0533a):[_0xc0533a['childNodes'][_0xc0533a['childNodes']['length']-0x1],'afterend']:[_0xc0533a['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x1476b5,_0x36d6f8){const _0x406261=[],_0x1a85e6=this['_findPrevElementWithDataId'](_0x1476b5,!0x0);if(_0x1a85e6){const _0x16ade4=ys('data-id',an(_0x1a85e6),_0x36d6f8);_0x16ade4&&_0x406261['push']([_0x16ade4,'afterend']);}const _0x462dbc=this['_findNextElementWithDataId'](_0x1476b5,!0x0);if(_0x462dbc){const _0x79770d=ys('data-id',an(_0x462dbc),_0x36d6f8);_0x79770d&&_0x406261['push']([_0x79770d,'beforebegin']);}return _0x406261['length']>0x1?Gs(_0x406261[0x0][0x0])<=Gs(_0x406261[0x1][0x0])?_0x406261[0x0]:_0x406261[0x1]:0x1===_0x406261['length']?_0x406261[0x0]:[_0x36d6f8['lastChild'],'afterend'];}_findNextElementWithDataId(_0x296794,_0x2a5781){let _0x520368=_0x296794['nextSibling'],_0x58b905=null,_0x1b3e11=!0x1;for(;_0x520368;){if(ti(_0x520368)){if(on(_0x520368)&&(_0x58b905=_0x520368),this['_isExistingContentComment'](_0x520368)&&_0x2a5781&&!_0x1b3e11){_0x1b3e11=!0x0,_0x520368=_0x520368['nextSibling'];continue;}break;}const _0x7d10ba=Hs(_0x520368,'data-id');if(_0x7d10ba&&'new-element'!==_0x7d10ba&&this['_existingDataIds']['has'](_0x7d10ba)){_0x58b905=_0x520368;break;}_0x520368=_0x520368['nextSibling'];}return _0x58b905;}_findPrevElementWithDataId(_0x123c85,_0xd60e71){let _0x2a79a6=_0x123c85['previousSibling'],_0x4dc324=null,_0x1f293=!0x1;for(;_0x2a79a6;){if(ti(_0x2a79a6)){if(on(_0x2a79a6)&&(_0x4dc324=_0x2a79a6),this['_isExistingContentComment'](_0x2a79a6)&&_0xd60e71&&!_0x1f293){_0x1f293=!0x0,_0x2a79a6=_0x2a79a6['previousSibling'];continue;}break;}const _0x352149=Hs(_0x2a79a6,'data-id');if(_0x352149&&'new-element'!==_0x352149&&this['_existingDataIds']['has'](_0x352149)){_0x4dc324=_0x2a79a6;break;}_0x2a79a6=_0x2a79a6['previousSibling'];}return _0x4dc324;}_markWrappedElements(_0xc3cbcc){_0x5431e6(_0xc3cbcc)&&Ns('data-id',null,_0xc3cbcc)['forEach'](_0x54f0c0=>{this['_isExistingNode'](_0x54f0c0)&&(Ms(_0x54f0c0,'data-wrapped-id',Hs(_0x54f0c0,'data-id')),Ms(_0x54f0c0,'data-id',null));});}_processWrappedElements(_0xd4d75c,_0x243984){Ns('data-wrapped-id',null,_0xd4d75c)['forEach'](_0x30bb6f=>{const _0x1df055=Hs(_0x30bb6f,'data-wrapped-id');if(this['_hasUnstableParent'](_0x30bb6f))return;const _0x3d9241=ys('data-id',_0x1df055,_0xd4d75c);Ms(_0x30bb6f,'data-id',_0x1df055),_0x3d9241&&(this['_removeNode'](_0x3d9241,_0x1df055,_0x243984),this['_touchedNodesState']['removedIds']['push'](_0x1df055),this['_touchedNodesState']['lastTouchedId']=_0x1df055);});}_hasUnstableParent(_0x55234e){let _0x1e0007=_0x55234e['parentNode'];for(;_0x1e0007;){if(Hs(_0x1e0007,'data-unstable'))return!0x0;_0x1e0007=_0x1e0007['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x166194){const _0x241012=new Set(this['_touchedNodesState']['removedIds']),_0x3f4976=new Set(this['_touchedNodesState']['newIds']);Ns('data-id',null,_0x166194)['forEach'](_0x51ccef=>{const _0x1efdd3=Hs(_0x51ccef,'data-id'),_0x5074ea=!!_0x1efdd3&&this['_referencedExistingIds']['has'](_0x1efdd3),_0x3b417a=!!_0x1efdd3&&_0x3f4976['has'](_0x1efdd3);if(!_0x1efdd3||!_0x5074ea&&!_0x3b417a)return;if(_0x241012['has'](_0x1efdd3))return;let _0x8643b7=_0x51ccef['parentNode'],_0x36f125=!0x1;for(;_0x8643b7;){if(_0x8643b7===_0x166194){_0x36f125=!0x0;break;}const _0x21d36a=Hs(_0x8643b7,'data-id');if(_0x21d36a&&(this['_referencedExistingIds']['has'](_0x21d36a)||_0x3f4976['has'](_0x21d36a)))return;_0x8643b7=_0x8643b7['parentNode'];}if(_0x36f125){if(_0xed3d66(_0x166194,_0x51ccef),_0x5074ea){const _0x18168a=this['_generateUid'](),_0x321751=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x1efdd3);-0x1!==_0x321751&&this['_touchedNodesState']['modifiedIds']['splice'](_0x321751,0x1),Ms(_0x51ccef,'data-unwrapped-id',_0x1efdd3),Ms(_0x51ccef,'data-id',_0x18168a),this['_touchedNodesState']['newIds']['push'](_0x18168a),this['_touchedNodesState']['rescuedNewIds']['add'](_0x18168a),this['_touchedNodesState']['lastTouchedId']=_0x18168a;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x1efdd3),this['_touchedNodesState']['lastTouchedId']=_0x1efdd3;}});}_getUid(_0x375924){return this['_isExistingNode'](_0x375924)?Hs(_0x375924,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x68f377){Ds(_0x68f377)['filter'](_0x2a04c2=>on(_0x2a04c2)||this['_isExistingContentComment'](_0x2a04c2))['forEach'](_0x525655=>{_0x539e1a(_0x525655);});}_findLastConfirmationPoint(_0x47da5a){let _0x4a9139=null,_0x2ebcfd=null,_0x296c42=null,_0x452550=null;const _0x21752b=_0x529c79=>{_0x529c79&&(_0x4a9139=_0x529c79),_0x296c42=null,_0x452550=null;};for(let _0x371e23=0x0;_0x371e23<_0x47da5a['length'];_0x371e23++){const _0x20a4c3=_0x47da5a[_0x371e23];if(this['_isExistingContentComment'](_0x20a4c3)){_0x21752b(_0x2ebcfd);continue;}if(_0x5431e6(_0x20a4c3)){const _0xd3c2b7=Hs(_0x20a4c3,'data-id'),_0x36cb95=_0x371e23===_0x47da5a['length']-0x1;if(_0xd3c2b7&&'new-element'!==_0xd3c2b7&&this['_touchedNodesState']['modifiedIds']['includes'](_0xd3c2b7)&&!_0x36cb95){_0x21752b(_0xd3c2b7),_0x2ebcfd=_0xd3c2b7;continue;}}let _0x3e64f2;const _0x582e85=an(_0x20a4c3);if(_0x582e85&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x582e85))_0x2ebcfd=_0x582e85;else{if(_0x582e85&&this['_touchedNodesState']['newIds']['includes'](_0x582e85))_0x3e64f2='N';else{if(!on(_0x20a4c3))continue;_0x3e64f2='R';}_0x3e64f2===_0x452550||null===_0x452550?_0x452550=_0x3e64f2:null!==_0x296c42?(_0x21752b(_0x2ebcfd),_0x452550=_0x3e64f2):(_0x296c42=_0x452550,_0x452550=_0x3e64f2),_0x2ebcfd=_0x582e85;}}const _0x5ec879=_0x47da5a[_0x47da5a['length']-0x1];return _0x5ec879&&!_0x5431e6(_0x5ec879)&&!on(_0x5ec879)&&_0x2ebcfd&&_0x21752b(_0x2ebcfd),_0x4a9139;}_getLastStableElement(_0x395380,_0x892a7a){if(!_0x892a7a)return null;const _0x2bb6a5=ys('data-id',_0x892a7a,_0x395380);if(!_0x2bb6a5)return null;const _0x2ea70f=[_0x2bb6a5,...Vs(_0x2bb6a5)]['at'](-0x2);if(_0x2ea70f===_0x2bb6a5)return _0x2bb6a5;let _0x5625c2=_0x2ea70f['previousSibling'];for(;_0x5625c2&&!_0x5431e6(_0x5625c2);)_0x5625c2=_0x5625c2['previousSibling'];return _0x5625c2;}_markUnstableElements(_0x1a865,_0x204ff8){const _0x489df3=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5da24c=_0x204ff8?_0x204ff8['nextSibling']:_0x1a865['firstChild'];for(;_0x5da24c;)_0x5431e6(_0x5da24c)&&(_0x489df3['has'](Hs(_0x5da24c,'data-id'))||Ns('data-id',null,_0x5da24c)['some'](_0x11ae63=>_0x489df3['has'](Hs(_0x11ae63,'data-id'))))&&Ms(_0x5da24c,'data-unstable','true'),_0x5da24c=_0x5da24c['nextSibling'];}['_isNewNode'](_0x2fe74d){return Boolean('new-element'===Hs(_0x2fe74d,'data-id'));}_isExistingNode(_0x25c8c2){return Boolean((Hs(_0x25c8c2,'data-id')||'')['length']>0x0&&'new-element'!==Hs(_0x25c8c2,'data-id'));}_isExistingContentComment(_0x2f4e9b){return Boolean(ti(_0x2f4e9b)&&ks(_0x2f4e9b)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function on(_0x215dd2){return!!_0x215dd2&&Boolean(ti(_0x215dd2)&&ks(_0x215dd2)['match'](/removed[\s*-]data-id="[^"]+"/));}function an(_0x368e72){if(!_0x368e72)return null;if(_0x5431e6(_0x368e72))return Hs(_0x368e72,'data-id')??null;if(ti(_0x368e72)){const _0x5e6d23=ks(_0x368e72)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x5e6d23&&_0x5e6d23[0x1])return _0x5e6d23[0x1];}return null;}function hn(_0x114b57,_0x7e61cb){const _0x596a80=new Map();for(const _0x4f0e7c of xs(_0x114b57))Ps(_0x4f0e7c)||_0x596a80['set'](Hs(_0x4f0e7c,'data-id'),_0x4f0e7c);const _0x23115c=new Set();for(const _0x376b07 of xs(_0x7e61cb)){if(Ps(_0x376b07))continue;const _0x22c968=Hs(_0x376b07,'data-id'),_0x10eb27=_0x22c968?_0x596a80['get'](_0x22c968):void 0x0;_0x10eb27?(_0x3fd27e(_0x376b07,_0x355d5c(_0x10eb27,!0x0)),_0x23115c['add'](_0x22c968)):_0x539e1a(_0x376b07);}for(const _0x344bf3 of Ds(_0x7e61cb))on(_0x344bf3)&&_0x596a80['has'](an(_0x344bf3))&&_0x539e1a(_0x344bf3);const _0x4e4ecb=new Set(Ns('data-id',null,_0x7e61cb)['map'](_0x5f2ac1=>Hs(_0x5f2ac1,'data-id')));for(const [_0xcbd8e2,_0xfc549f]of _0x596a80){if(_0x23115c['has'](_0xcbd8e2))continue;let _0x3f8dad=_0xfc549f['parent'],_0x350b15=null;for(;_0x3f8dad&&_0x5431e6(_0x3f8dad);){const _0x3a28bb=Hs(_0x3f8dad,'data-id');if(_0x3a28bb&&_0x4e4ecb['has'](_0x3a28bb)){_0x350b15=_0x3a28bb;break;}_0x3f8dad=_0x3f8dad['parent'];}if(!_0x350b15)continue;const _0x3d44a9=ys('data-id',_0x350b15,_0x7e61cb);_0x3d44a9&&_0x44faed(_0x3d44a9,_0x355d5c(_0xfc549f,!0x0));}}const cn=/* #__PURE__ -- @preserve */
|
|
27
|
+
At();var ln=class extends cn{_m2html;constructor(){super();const _0x1734b5=Object['entries'](_0x1bf1db),_0x40179f=_0x1734b5['findIndex'](([_0x548ad5])=>'rehypeDomRaw'===_0x548ad5);if(-0x1===_0x40179f)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x1734b5['splice'](_0x40179f+0x1,0x0,['rehypeSanitize',_0x386673]),this['_m2html']=new _0x136925({'plugins':Object['fromEntries'](_0x1734b5)});}convertMarkdownToHTML(_0x50251d){const _0x53a217=this['_m2html']['parse'](_0x50251d);return this['parseAndNormalizeHTML'](_0x53a217);}['parseAndNormalizeHTML'](_0x31ed75){return this['_parseHTML'](_0x31ed75);}['_parseHTML'](_0x4201f8){const _0x22951e=vs('<dummy>'+_0x4201f8['replace'](/<[^>]*?$/g,'')+'</dummy>');return un(_0x22951e),_0x22951e['children']=_0x22951e['children'][0x0]['children'],_0x22951e;}};function un(_0x4fea70){for(const _0x1d7bdd of _0x4fea70['children'])_0x5431e6(_0x1d7bdd)?'pre'!==_0x1d7bdd['name']&&un(_0x1d7bdd):_0x8b9a17(_0x1d7bdd)&&(_0x1d7bdd['data']=_0x1d7bdd['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function dn({changeGroups:_0x519282,documentContextContent:_0x1c0bd6,showDiff:_0x2029ed,trimUnchanged:_0x35f9ee=!0x0}){const _0x4c949b=Xs(_0x519282,_0x1c0bd6);return _0x519282['map'](_0x4ebfd5=>{if(!_0x4ebfd5['editor']||'destroyed'===_0x4ebfd5['editor']['state'])return null;const _0x4a4179=Ks(_0x4ebfd5['editor'],_0x4ebfd5['rootName']),_0x30cc79=new _0x56ff8a([]),_0x2581ad=new _0x56ff8a([]),_0x7fdc7b=new Set();for(const _0x478095 of _0x4ebfd5['changes'])'new'==_0x478095['type']&&Ns('data-id',null,_0x478095['node'])['forEach'](_0x58bb47=>{_0x7fdc7b['add'](Hs(_0x58bb47,'data-id'));});for(const _0x15a182 of _0x4ebfd5['changes'])if('removed'!=_0x15a182['type']?_0x2581ad['children']['push'](_0x15a182['node']['cloneNode'](!0x0)):_0x2029ed||_0x7fdc7b['has'](_0x15a182['id'])||_0x2581ad['children']['push'](_0x15a182['node']['cloneNode'](!0x0)),'new'!=_0x15a182['type']&&(_0x2029ed||'removed'!=_0x15a182['type'])){const _0x5c4a85=_0x2bff0b(_0x59ca09=>Hs(_0x59ca09,'data-id')==_0x15a182['id'],_0x1c0bd6['get'](_0x4ebfd5['documentId']),!0x0);_0x5c4a85&&_0x30cc79['children']['push'](_0x5c4a85['cloneNode'](!0x0));}if(_0x4a4179&&_0x4c949b['has'](_0x4ebfd5['index']))return{'type':_0x4ebfd5['changes'][0x0]['type'],'index':_0x4ebfd5['index'],'state':_0x4ebfd5['state'],'outdatedReason':_0x4ebfd5['outdatedReason'],'content':new _0x56ff8a([]),'hasChanges':!0x1};let _0x426917,_0x2b0dfb,_0x162b5b;try{({content:_0x426917,hasChanges:_0x2b0dfb}=_n(_0x4ebfd5['editor'],_0x30cc79,_0x2581ad,_0x2029ed,_0x35f9ee));}catch{return{'type':_0x4ebfd5['changes'][0x0]['type'],'index':_0x4ebfd5['index'],'state':_0x4ebfd5['state'],'outdatedReason':_0x4ebfd5['outdatedReason'],'content':new _0x56ff8a([]),'hasChanges':!0x1};}if(_0x4a4179){_0x162b5b=_0x4ebfd5['editor']['ui']['getEditableElement'](_0x4ebfd5['rootName'])?.['tagName']['toLowerCase']();const _0x5ee351=_0x426917['children']['filter'](_0x5431e6);0x1===_0x5ee351['length']&&(_0x426917=new _0x56ff8a(_0x5ee351[0x0]['children']));}return{'type':_0x4ebfd5['changes'][0x0]['type'],'index':_0x4ebfd5['index'],'state':_0x4ebfd5['state'],'outdatedReason':_0x4ebfd5['outdatedReason'],'content':_0x426917,'hasChanges':_0x2b0dfb,'wrapperTag':_0x162b5b};})['filter'](_0x345cd4=>null!==_0x345cd4);}function _n(_0x2e40f3,_0x355ac9,_0x1cea3,_0x284388,_0x2d3b80=!0x0){const _0x14ad47=_0x2e40f3['plugins']['get']('DocumentCompare'),_0x3be04b=ks(_0x355ac9),_0x3e6636=ks(_0x1cea3),_0x1afc6e=_0x2e40f3['data']['parse'](_0x3be04b,'$root'),_0x348f62=_0x2e40f3['model']['createPositionAt'](_0x1afc6e,0x0),_0x48c74f=_0x14ad47['getDiff'](_0x3be04b,_0x3e6636,{'anchor':_0x348f62,'markDeletions':_0x284388,'targetEditor':_0x2e40f3})['getOperations']();if(0x0==_0x48c74f['length'])return{'content':_0x355ac9['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x284388?function(_0x15df76,_0x49d4e3,_0x1a256c){if(0x0==_0x15df76['length'])return;const _0x3dc641=_0x1a256c['plugins']['get']('DocumentCompare'),_0x312123=_0x1a256c['plugins']['get']('SuggestionsConversion');_0x1a256c['model']['change'](_0x200f21=>{const _0x5615b8=new Set();for(let _0x42546f=0x0;_0x42546f<_0x15df76['length'];_0x42546f++){const _0x5ab758=_0x15df76[_0x42546f];if(_0x5ab758['baseVersion']=null,_0x5ab758['isDocumentOperation']=!0x1,!_0x48583f(_0x5ab758)){if(_0x3dc641['isMarkedRemoveOperation'](_0x5ab758)){const _0xdef508=_0x5604a5(_0x5ab758['newRange'],_0x1a256c['model']),_0x58c7f6='suggestion:deletion:'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0x58c7f6,_0xdef508);}else switch(_0x5ab758['type']){case'rename':{if(_0x5ab758['oldName']==_0x5ab758['newName'])break;_0x200f21['batch']['addOperation'](_0x5ab758),_0x1a256c['model']['applyOperation'](_0x5ab758);const _0x5ad658='$elementName',_0x5b1fc7=_0x5ab758['position'],_0xceb7a4=_0x1a256c['model']['createRange'](_0x5b1fc7,_0x1a256c['model']['createPositionAt'](_0x5b1fc7['nodeAfter'],'end')),_0x7374a3='suggestion:attribute:'+_0x5ad658+':'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0x7374a3,_0xceb7a4);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x5ab758['oldValue']==_0x5ab758['newValue'])break;_0x200f21['batch']['addOperation'](_0x5ab758),_0x1a256c['model']['applyOperation'](_0x5ab758);const _0x19ad3b=_0x5ab758['key'];if(!_0x312123['isRegisteredAttribute'](_0x19ad3b))break;const _0x41e049=_0x5604a5(_0x5ab758['range'],_0x1a256c['model']),_0x3b53cb='suggestion:attribute:'+_0x19ad3b+':'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0x3b53cb,_0x41e049);break;}case'insert':{if(_0x200f21['batch']['addOperation'](_0x5ab758),_0x1a256c['model']['applyOperation'](_0x5ab758),gn(_0x49d4e3,_0x5ab758),_0x15df76[_0x42546f+0x1]&&'move'==_0x15df76[_0x42546f+0x1]['type'])break;const _0x54b0da=_0x5ab758['position'],_0x283e85=_0x5ab758['howMany'],_0x5734a4=_0x5604a5(_0x1a256c['model']['createRange'](_0x54b0da,_0x54b0da['getShiftedBy'](_0x283e85)),_0x1a256c['model']),_0x690fb6='suggestion:insertion:'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0x690fb6,_0x5734a4);break;}case'split':{_0x200f21['batch']['addOperation'](_0x5ab758),_0x1a256c['model']['applyOperation'](_0x5ab758),gn(_0x49d4e3,_0x5ab758);const _0x55d22d=_0x5ab758['splitPosition'],_0x394b2d=_0x5ab758['moveTargetPosition'],_0x142110=_0x1a256c['model']['createRange'](_0x55d22d,_0x394b2d),_0x46cb47='suggestion:insertion:'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0x46cb47,_0x142110);break;}case'move':{_0x200f21['batch']['addOperation'](_0x5ab758),_0x1a256c['model']['applyOperation'](_0x5ab758),gn(_0x49d4e3,_0x5ab758);const _0x23a8d3=_0x5ab758['getMovedRangeStart'](),_0x3aa35f=_0x5ab758['howMany'];for(let _0x26c2f7=0x0;_0x26c2f7<_0x3aa35f;_0x26c2f7++){const _0x39c1b7=_0x23a8d3['getShiftedBy'](_0x26c2f7)['nodeAfter'];_0x5615b8['add'](_0x39c1b7);}break;}case'remove':{const _0x402b66=_0x5ab758['sourcePosition'],_0x5d6ef5=_0x5ab758['howMany'],_0xa4b0b7=new _0x4a9b8c(_0x402b66,_0x5d6ef5);_0x200f21['batch']['addOperation'](_0xa4b0b7),_0x1a256c['model']['applyOperation'](_0xa4b0b7),gn(_0x49d4e3,_0x5ab758);break;}}}}for(const _0x63ddbf of _0x5615b8){const _0x512989=_0x1a256c['model']['createRangeOn'](_0x63ddbf),_0xd28c9d='suggestion:formatBlock:$fakeWrap:'+Nt()+':$aiSuggestion';_0x49d4e3['markers']['set'](_0xd28c9d,_0x5604a5(_0x512989,_0x1a256c['model']));}});}(_0x48c74f,_0x1afc6e,_0x2e40f3):_0x2e40f3['model']['change'](_0x51094c=>{for(const _0x1cdc89 of _0x48c74f)if(!_0x48583f(_0x1cdc89)){if('remove'==_0x1cdc89['type']){const _0x2ed8ea=_0x1cdc89['sourcePosition'],_0x170a5d=_0x1cdc89['howMany'],_0x39b811=new _0x4a9b8c(_0x2ed8ea,_0x170a5d);_0x51094c['batch']['addOperation'](_0x39b811),_0x2e40f3['model']['applyOperation'](_0x39b811),gn(_0x1afc6e,_0x1cdc89);}else{if('marker'==_0x1cdc89['type']){const _0x27a4d9=_0x1cdc89['name'],_0x35b8e2=_0x1cdc89['newRange'];null!==_0x35b8e2?_0x1afc6e['markers']['set'](_0x27a4d9,_0x35b8e2):_0x1afc6e['markers']['delete'](_0x27a4d9);}else _0x1cdc89['baseVersion']=null,_0x1cdc89['isDocumentOperation']=!0x1,_0x51094c['batch']['addOperation'](_0x1cdc89),_0x2e40f3['model']['applyOperation'](_0x1cdc89),gn(_0x1afc6e,_0x1cdc89);}}}),_0x2d3b80){const _0x25438d=An(_0x2e40f3,_0x48c74f,_0x1afc6e);pn(_0x2e40f3['model'],_0x25438d),function(_0x4c660b,_0x4cd2e0){const _0x57cee9=_0x4cd2e0['getFirstRange']()['start'];let _0x417fb7=_0x4cd2e0['getFirstRange']()['end'];const _0x1d46fc=_0x57cee9['root'];(_0x417fb7['textNode']||_0x417fb7['nodeAfter']&&_0x417fb7['nodeAfter']['is']('$text'))&&(_0x326122(_0x417fb7,'...'),Tn(_0x1d46fc,_0x417fb7,0x3),_0x417fb7=_0x417fb7['getShiftedBy'](0x3)),(_0x57cee9['textNode']||_0x57cee9['nodeBefore']&&_0x57cee9['nodeBefore']['is']('$text'))&&(_0x326122(_0x57cee9,'...'),Tn(_0x1d46fc,_0x57cee9,0x3),_0x57cee9['parent']==_0x417fb7['parent']&&(_0x417fb7=_0x417fb7['getShiftedBy'](0x3)));const _0x3d4338=_0x4c660b['createRange'](_0x4c660b['createPositionAt'](_0x1d46fc,0x0),_0x57cee9),_0x2fbacf=_0x4c660b['createRange'](_0x417fb7,_0x4c660b['createPositionAt'](_0x1d46fc,'end')),_0xd47294=[..._0x3d4338['getMinimalFlatRanges'](),..._0x2fbacf['getMinimalFlatRanges']()];_0xd47294['reverse']();for(const _0x92763 of _0xd47294)_0x46eb59(_0x92763),mn(_0x1d46fc,_0x92763);}(_0x2e40f3['model'],_0x25438d);}return{'content':vs(_0x2e40f3['data']['stringify'](_0x1afc6e,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function gn(_0x555a89,_0x29545c){for(const [_0xf236bd,_0x382307]of _0x555a89['markers']){const _0xcb30ef=_0x5a312a['_createFromRanges'](_0x382307['getTransformedByOperation'](_0x29545c));_0xcb30ef['root']==_0x555a89?_0x555a89['markers']['set'](_0xf236bd,_0xcb30ef):_0x555a89['markers']['delete'](_0xf236bd);}}function An(_0x279ca4,_0x4d0295,_0x569c08){const _0x4a55d3=_0x279ca4['plugins']['get']('DocumentCompare');let _0x5a6df5=_0x279ca4['model']['createPositionAt'](_0x569c08,Number['POSITIVE_INFINITY']),_0x4bc598=_0x279ca4['model']['createPositionAt'](_0x569c08,0x0);for(const _0x4db608 of _0x4d0295){let _0xd70bc3,_0x557c76;if(_0x4a55d3['isMarkedRemoveOperation'](_0x4db608))_0xd70bc3=_0x4db608['newRange']['start'],_0x557c76=_0x4db608['newRange']['end'];else switch(_0x5a6df5=In(_0x5a6df5,_0x4db608),_0x4bc598=In(_0x4bc598,_0x4db608),_0x4db608['type']){case'rename':_0xd70bc3=_0x4db608['position'],_0x557c76=_0xd70bc3['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0xd70bc3=_0x4db608['range']['start'],_0x557c76=_0x4db608['range']['end'];break;case'insert':_0xd70bc3=_0x4db608['position'],_0x557c76=_0xd70bc3['getShiftedBy'](_0x4db608['howMany']);break;case'split':_0xd70bc3=_0x4db608['splitPosition'],_0x557c76=_0x4db608['moveTargetPosition'];break;case'merge':{const _0x5d5299=_0x4db608['targetPosition']['path']['slice'](0x0,-0x1);_0xd70bc3=_0x279ca4['model']['createPositionFromPath'](_0x569c08,_0x5d5299),_0x557c76=_0xd70bc3['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x26cc7b=_0x4db608['howMany'],_0x327113=_0x4db608['sourcePosition']['_getTransformedByInsertion'](_0x4db608['targetPosition'],_0x26cc7b),_0x372264=_0x4db608['getMovedRangeStart']();'remove'==_0x4db608['type']?(_0xd70bc3=_0x327113,_0x557c76=_0x327113):(_0xd70bc3=_0x372264,_0x557c76=_0x372264['getShiftedBy'](_0x26cc7b));break;}}_0xd70bc3&&_0xd70bc3['isBefore'](_0x5a6df5)&&(_0x5a6df5=_0xd70bc3['clone'](),_0x5a6df5['stickiness']='toNone'),_0x557c76&&_0x557c76['isAfter'](_0x4bc598)&&(_0x4bc598=_0x557c76['clone'](),_0x4bc598['stickiness']='toNone');}return _0x279ca4['model']['createSelection'](_0x279ca4['model']['createRange'](_0x5a6df5,_0x4bc598));}function In(_0x11f114,_0x5f05e8){return'move'!=_0x5f05e8['type']&&'remove'!=_0x5f05e8['type']||_0x5f05e8['sourceRange']['containsPosition'](_0x11f114)&&((_0x11f114=_0x5f05e8['sourcePosition']['clone']())['stickiness']='toNone'),_0x11f114['getTransformedByOperation'](_0x5f05e8);}function pn(_0x83b1e8,_0x2d340e){En(_0x83b1e8,_0x2d340e,'forward');const _0x2af665=_0x2d340e['getFirstRange']();_0x2d340e['setTo']([]),_0x2d340e['setTo'](_0x2af665,{'backward':!0x0}),En(_0x83b1e8,_0x2d340e,'backward');}function En(_0x544e4e,_0x2dd31a,_0x511fec){let _0x3d0044=0x14;for(;_0x3d0044;){_0x544e4e['modifySelection'](_0x2dd31a,{'unit':'word','direction':_0x511fec}),_0x3d0044--;const _0x200f01=_0x2dd31a['focus']['forward'==_0x511fec?'nodeBefore':'nodeAfter'];if(_0x200f01&&_0x200f01['is']('element')&&_0x544e4e['schema']['isBlock'](_0x200f01)&&_0x544e4e['schema']['isObject'](_0x200f01))break;}}function mn(_0x319c5c,_0x245434){for(const [_0x4e73b7,_0x1a6929]of _0x319c5c['markers']){const _0x29a71d=_0x1a6929['_getTransformedByDeletion'](_0x245434['start'],_0x245434['end']['offset']-_0x245434['start']['offset']);null!=_0x29a71d?_0x319c5c['markers']['set'](_0x4e73b7,_0x29a71d):_0x319c5c['markers']['delete'](_0x4e73b7);}}function Tn(_0x1ead72,_0x1fdab6,_0x37d497){for(let [_0x40627c,_0x370295]of _0x1ead72['markers'])_0x370295=_0x370295['_getTransformedByInsertion'](_0x1fdab6,_0x37d497,!0x1)[0x0],_0x1ead72['markers']['set'](_0x40627c,_0x370295);}function wn(_0x30dcd9,_0x3e6af4){for(const _0x125221 of _0x30dcd9)'noop'!==_0x125221['type']&&(_0x125221['_aiSource']=_0x3e6af4);}var Cn=class extends _0x22445f{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0xc19772,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x31d51f,_0x45a935){const {applyMethod:_0x360b83,roots:_0x572581}=_0x45a935,_0x391a03='suggest'===_0x360b83;if(_0x31d51f['error']||!_0x31d51f['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x31d51f['status']});if(_0x572581){if(0x0===_0x572581['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x46c445,rootName:_0x1cad9f}of _0x572581)if(!_0x31d51f['results']['some'](_0x348754=>_0x348754['channelId']===_0x46c445&&_0x348754['rootName']===_0x1cad9f))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x46c445,'rootName':_0x1cad9f});}const _0x425116=_0x31d51f['results']['reduce']((_0x4fd45c,_0x6d0cf3)=>{if(_0x572581&&!_0x572581['some'](_0x2c6404=>_0x2c6404['channelId']===_0x6d0cf3['channelId']&&_0x2c6404['rootName']===_0x6d0cf3['rootName']))return _0x4fd45c;if('completed'!==_0x6d0cf3['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x6d0cf3['status'],'channelId':_0x6d0cf3['channelId'],'rootName':_0x6d0cf3['rootName']});if(_0x391a03&&!_0x6d0cf3['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x6d0cf3['channelId'],'rootName':_0x6d0cf3['rootName']});let _0xc5ff8a=_0x4fd45c['get'](_0x6d0cf3['editor']);return _0xc5ff8a||(_0xc5ff8a=[],_0x4fd45c['set'](_0x6d0cf3['editor'],_0xc5ff8a)),_0xc5ff8a['push'](_0x6d0cf3),_0x4fd45c;},new Map()),_0x16f0f7=this['context']['plugins']['get'](_0xc19772);for(const [_0x207a52,_0x3bfb7c]of _0x425116){const _0x231a46=_0x3bfb7c['map'](_0x30fca8=>{const _0x235540=_0x207a52['model']['createPositionAt'](_0x207a52['model']['document']['getRoot'](_0x30fca8['rootName']),0x0),_0x499db1=zs(_0x207a52,_0x30fca8['rootName'],_0x30fca8['contentRawOld'],_0x30fca8['contentRawNew']);if(!_0x499db1)return _0x30fca8['droppedUnsupportedInlineChange']=!0x0,null;const _0x10b20b=_0x16f0f7['getDiff'](_0x499db1['before'],_0x499db1['after'],{'anchor':_0x235540,'markDeletions':_0x391a03,'targetEditor':_0x207a52}),_0x3ca1c8=_0x207a52['model']['document']['history']['getOperations'](_0x30fca8['documentVersion']),_0x4b0043={'document':_0x207a52['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0xe471b6=_0x371d73(_0x10b20b['getOperations'](),_0x3ca1c8,_0x4b0043)['operationsA'];return wn(_0xe471b6,_0x45a935['aiSource']??'api'),_0xe471b6;});_0x207a52['model']['change'](_0x2ddd6b=>{for(const _0x5e7205 of _0x231a46)_0x5e7205&&(_0x391a03?_0x207a52['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5e7205):_0x16f0f7['applyOperations'](_0x2ddd6b,_0x5e7205));});}}mergeChangesIntoContent(_0x5b3133,_0x202f83,_0x359199){const _0x3c642f=new ln(),_0x5e6d72=new rn();let _0x819faa=_0x3c642f['parseAndNormalizeHTML'](_0x202f83);for(const _0x27c374 of _0x5b3133)try{const _0x4ec377=_0x3c642f['parseAndNormalizeHTML'](_0x27c374['content']);_0x819faa=_0x5e6d72['merge'](_0x4ec377,_0x819faa,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x560593){throw new ct('ai-gateway-merge-failed',this,{..._0x27c374},_0x560593);}return _n(_0x359199,_0x3c642f['parseAndNormalizeHTML'](_0x202f83),_0x819faa,!0x1,!0x1)['content'];}};const fn=/* #__PURE__ -- @preserve */
|
|
28
|
+
dt(),bn=['capabilitiesUpdated'];var Sn=class extends fn{['_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(_0x25a569){const _0x471824={};if(!_0x25a569)return _0x471824;('isWebSearchEnabled'in _0x25a569?_0x25a569['isWebSearchEnabled']:_0x25a569['webSearch'])&&(_0x471824['webSearch']={});const _0x2cbd4a='isReasoningEnabled'in _0x25a569?_0x25a569['isReasoningEnabled']:_0x25a569['reasoning'];return _0x2cbd4a&&(_0x471824['reasoning']='string'==typeof _0x2cbd4a?{'level':_0x2cbd4a}:{}),_0x471824;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x40921b){_0x40921b!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x40921b,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x5d4c69){_0x5d4c69!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x5d4c69,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function Rn(_0x19a504,_0x436110,_0x3d1d28,_0x31bf32){if(_0x19a504 instanceof ct)return _0x19a504;const _0x5b25d9=_0x19a504?.['data'];return new ct(_0x436110,_0x3d1d28,void 0x0!==_0x5b25d9?{..._0x31bf32,'backendData':_0x5b25d9}:_0x31bf32,_0x19a504);}var On=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x4bf1d1){this['_editor']=_0x4bf1d1['editor'],this['_rootName']=_0x4bf1d1['rootName'],this['_channelId']=_0x4bf1d1['channelId'],this['_sessionId']=_0x4bf1d1['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(_0x3fd6b6){this['_documentVersion']=_0x3fd6b6;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0xbbc82){this['_contentRawOld']=_0xbbc82;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x110e54){this['_contentRawNew']=_0x110e54;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x5485e7){this['_error']=_0x5485e7;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x15af6c){this['_droppedUnsupportedInlineChange']=_0x15af6c;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x313ae6){return _0x313ae6['replace'](/ data-id="[a-z0-9]+"/g,'');}},vn=class extends On{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x32303b){this['_summary']=_0x32303b;}},kn=class{_results;constructor(_0x19d460=[]){this['_results']=_0x19d460;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0xf5e860){this['_status']=_0xf5e860;}get['error'](){return this['_error'];}set['error'](_0xc1d3e7){this['_status']='error',this['_error']=_0xc1d3e7;}get results(){return this['_results'];}addResult(..._0x510d1c){this['_results']['push'](..._0x510d1c);}},yn=class extends _0x22445f{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get requires(){return[Es,sn,Cn,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async processDocument(_0x49f317,_0x1fef8a){if(!_0x49f317)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x1a995d=await this['context']['plugins']['get'](sn)['getDocumentData'](),_0x1603a0=_0x1fef8a['roots'];if(0x0===(_0x1603a0??_0x1a995d)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x1603a0){for(const _0x3b4563 of _0x1603a0)if(!_0x1a995d['some'](_0x326964=>_0x326964['rootName']===_0x3b4563['rootName']&&_0x326964['channelId']===_0x3b4563['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x3b4563['channelId'],'rootName':_0x3b4563['rootName']});}const _0x4222bc=_0x1603a0?_0x1a995d['filter'](_0x48ea0e=>_0x1603a0['some'](_0x27b62f=>_0x27b62f['rootName']===_0x48ea0e['rootName']&&_0x27b62f['channelId']===_0x48ea0e['channelId'])):_0x1a995d,_0x5e6921=[],_0x347a6e=[];for(const _0x18690e of _0x4222bc){const _0x77257e={'editor':_0x18690e['editor'],'rootName':_0x18690e['rootName'],'sessionId':_0x18690e['sessionId'],'channelId':_0x18690e['channelId'],'contentRawOld':_0x18690e['content'],'documentVersion':_0x18690e['version']};_0x5e6921['push'](_0x77257e),_0x347a6e['push']({'type':'document','content':_0x77257e['contentRawOld']});}const _0x2bc859=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x347a6e,'prompt':_0x49f317,'model':_0x1fef8a['model'],'capabilities':Sn['getCapabilitiesRequestData'](_0x1fef8a['capabilities']),'contexts':_0x1fef8a['contexts']});let _0x7a16e9;if(_0x1fef8a?.['signal']){_0x1fef8a['signal']['aborted']&&_0x2bc859['abortController']['abort']();const _0x58406d=_0x1fef8a['signal'],_0xc7f016=()=>_0x2bc859['abortController']['abort']();_0x58406d['addEventListener']('abort',_0xc7f016),_0x7a16e9=()=>_0x58406d['removeEventListener']('abort',_0xc7f016);}const _0x1f4a24=new kn();let _0x54deb8=[];try{if(_0x54deb8=(await _0x2bc859['getResult']())['documents'],!(_0x54deb8&&_0x54deb8['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x54deb8['length']!==_0x347a6e['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x347a6e['length'],'received':_0x54deb8['length']});const _0x1a9c02=_0x54deb8['findIndex'](({document:_0x531765})=>!_0x531765['length']);if(-0x1!==_0x1a9c02){const _0xddd68=_0x5e6921[_0x1a9c02];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0xddd68['channelId'],'rootName':_0xddd68['rootName']});}_0x1f4a24['status']='completed';}catch(_0x5506c8){_0x5506c8 instanceof Error&&_0x5506c8['message']['includes']('ai-request-aborted')?_0x1f4a24['abort']():_0x1f4a24['error']=Rn(_0x5506c8,'ai-documentprocessinggateway-run-failed',this);}finally{_0x7a16e9&&_0x7a16e9();}if('completed'===_0x1f4a24['status'])for(const [_0x38990f,_0x3a13b2]of _0x5e6921['entries']()){const {channelId:_0x42b0f7,contentRawOld:_0x330a3d,documentVersion:_0x439fa9,editor:_0x3e1570,rootName:_0x5727ee,sessionId:_0x5ace4d}=_0x3a13b2,_0x2b0f2d=new vn({'channelId':_0x42b0f7,'editor':_0x3e1570,'rootName':_0x5727ee,'sessionId':_0x5ace4d});_0x2b0f2d['contentRawOld']=_0x330a3d,_0x2b0f2d['documentVersion']=_0x439fa9,_0x2b0f2d['contentRawNew']=_0x54deb8[_0x38990f]['document'],_0x2b0f2d['summary']=_0x54deb8[_0x38990f]['summary'],_0x1f4a24['addResult'](_0x2b0f2d);}return _0x1f4a24;}applyResult(_0x56df51,_0x2641fd){this['context']['plugins']['get']('AIGateway')['apply'](_0x56df51,_0x2641fd);}};function Nn(_0x17accb){return _0x17accb instanceof Error&&('AbortError'===_0x17accb['name']||('AICoreError'===_0x17accb['name']?!0x0===_0x17accb['isAbort']:_0x17accb['message']['startsWith']('ai-request-aborted')));}var xn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x542a0e){super(_0x542a0e['code'],_0x542a0e['cause']instanceof Error?{'cause':_0x542a0e['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x542a0e['code'],this['severity']=_0x542a0e['severity']??'error',this['type']=_0x542a0e['type']??'system',this['context']=_0x542a0e['context'],this['isAbort']=_0x542a0e['isAbort']??Nn(_0x542a0e['cause']);}},Ln=class extends _0x22445f{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x39a7dd){return new Pn(this,_0x39a7dd);}},Pn=class{['_sink'];_component;constructor(_0x55e62a,_0x3ba1f3){this['_sink']=_0x55e62a,this['_component']=_0x3ba1f3;}['logError'](_0x541896,_0x27cf91={}){this['_emit'](_0x541896,_0x27cf91),this['_defaultLog'](_0x541896);}reportError(_0x33d307,_0x3af972={}){this['_emit'](_0x33d307,_0x3af972);}_emit(_0x486a05,_0x2f4d54){Nn(_0x486a05)||this['_sink']['fire']('error',{'error':_0x486a05,'component':this['_component'],'context':_0x2f4d54['context']});}_defaultLog(_0x1f5a66){if(!Nn(_0x1f5a66)){if(_0x1f5a66 instanceof xn){if('user'===_0x1f5a66['type']||'network'===_0x1f5a66['type'])return;if('warning'===_0x1f5a66['severity'])return void console['warn'](this['_component'],_0x1f5a66);}console['error'](this['_component'],_0x1f5a66);}}};const Dn='ck-ai-button-primary',Hn='ck-ai-button-secondary',Mn='ck-ai-button-tertiary';function Un(_0x49da2e,_0x4bb764){const _0x21b717=new Vt(_0x49da2e),_0x400e04=Ts(_0x49da2e,'AI_TABS_LABEL_MINIMIZE'),_0x112a10=Ts(_0x49da2e,'AI_TABS_LABEL_MAXIMIZE');return _0x21b717['set']({'withText':!0x1,'icon':_0x36ebd0,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Mn}),_0x21b717['bind']('label')['to'](_0x4bb764,'isMaximized',_0x572e4e=>_0x572e4e?_0x400e04:_0x112a10),_0x21b717['bind']('icon')['to'](_0x4bb764,'isMaximized',_0x4d3ad7=>_0x4d3ad7?_0x55f6f7:_0x36ebd0),_0x21b717['bind']('isOn')['to'](_0x4bb764,'isMaximized'),_0x21b717['on']('execute',()=>{_0x4bb764['fire']('resizeTabs');}),_0x21b717;}function Vn(_0x33aef7){const _0x24db98=new Ht(_0x33aef7);return _0x24db98['attachToDom'](),_0x24db98['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x24db98;}const Bn=/* #__PURE__ -- @preserve */
|
|
29
|
+
At();var Gn=class extends Bn{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:_0x237646,isDone:_0x31db00=!0x1,isComplete:_0x48ec95,interactionId:_0x33c9d0,areActionsDisabled:_0x3c223c,outdatedReasonByDocumentId:_0x3a4b16,isFromHistory:_0x376110=!0x1,documentContextContent:_0x3c22f6,locale:_0x1c08a5,id:_0xadf140,channelsToEditors:_0x5a1856}){super(),this['id']=_0xadf140||Nt(),this['interactionId']=_0x33c9d0,this['type']=_0x237646,this['areActionsDisabled']=!!_0x3c223c,this['_outdatedReasonByDocumentId']=_0x3a4b16,this['isFromHistory']=_0x376110,this['locale']=_0x1c08a5,this['aiResponseParser']=new ln(),this['aiResponseApplier']=new rn(),this['documentContextContent']=new Map(_0x3c22f6?.['map'](_0x45aa31=>[_0x45aa31['id'],vs(_0x45aa31['content'])])||[]),this['_documentIdToSource']=new Map(_0x3c22f6?.['map'](_0x203dc3=>[_0x203dc3['id'],{'editor':_0x5a1856['get'](_0x203dc3['channelId']),'rootName':_0x203dc3['rootName']}])||[]),this['set']('isDone',_0x31db00),this['set']('isComplete',_0x48ec95??_0x31db00),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x2daf94,_0x523bfc){const _0x25f8e5='text'===this['type']?'text':_0x523bfc;this['content']['has'](_0x25f8e5)||this['content']['set'](_0x25f8e5,''),this['content']['set'](_0x25f8e5,this['content']['get'](_0x25f8e5)+_0x2daf94),this['onContentChange'](_0x25f8e5);}['done'](_0x3da56a=!0x0){this['isComplete']=_0x3da56a,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0xcce984,_0x1d3e44,_0x20614b){this['changeGroups'][_0xcce984]['state']=_0x1d3e44,this['changeGroups'][_0xcce984]['outdatedReason']=_0x20614b,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0xcce984,'state':_0x1d3e44,'outdatedReason':_0x20614b});}getContentParts({showDiff:_0x2cb80d,groupIndex:_0x2c3aea}){const _0xed4652=this['_getCachedContentParts'](_0x2cb80d,_0x2c3aea);if(_0xed4652)return _0xed4652;let _0x4dd1bb;if(void 0x0===_0x2c3aea)_0x4dd1bb=this['changeGroups'];else{const _0x841062=this['changeGroups']['find'](({index:_0x570e13})=>_0x570e13===_0x2c3aea);if(!_0x841062)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x2c3aea});_0x4dd1bb=[_0x841062];}const _0x3ea826=dn({'showDiff':_0x2cb80d,'changeGroups':_0x4dd1bb,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x2cb80d,_0x3ea826),_0x3ea826;}_getCachedContentParts(_0x10f27c,_0xf6bb40){const _0x215a41=_0x10f27c?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x215a41]['length'])return null;const _0x5d2795=this['cachedSuggestionContentParts'][_0x215a41];if(void 0x0===_0xf6bb40)return _0x5d2795['length']>0x0&&_0x5d2795['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x10f27c,null),null):_0x23d12f(_0x5d2795);{const _0x40bf91=_0x5d2795['find'](({index:_0x37a175})=>_0x37a175===_0xf6bb40);if(_0x40bf91)return[_0x23d12f(_0x40bf91)];}return null;}_setCachedContentParts(_0x5e56d5,_0x3c4c58){const _0x329a1f=_0x5e56d5?'withDiff':'withoutDiff';_0x3c4c58?_0x3c4c58['forEach'](_0x3488dd=>{const _0x1906e8=this['cachedSuggestionContentParts'][_0x329a1f],_0x348532=_0x1906e8['find'](({index:_0x2fd88c})=>_0x2fd88c===_0x3488dd['index']);if(_0x348532){const _0x49866f=_0x1906e8['indexOf'](_0x348532);_0x1906e8['splice'](_0x49866f,0x1,_0x3488dd);}else _0x1906e8['push'](_0x3488dd);}):this['cachedSuggestionContentParts'][_0x329a1f]['length']=0x0;}onContentChange(_0x4de56f){if('modification'===this['type']){if(_0x4de56f)this['parsedContent']['set'](_0x4de56f,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x4de56f)));else{for(const [_0xa67e61,_0x343209]of this['content'])this['parsedContent']['set'](_0xa67e61,this['aiResponseParser']['parseAndNormalizeHTML'](_0x343209));}const _0x3e59cd=this['changeGroups'];for(const _0x1b71d1 of this['content']['keys']())this['updateChangeGroups'](_0x1b71d1);const _0x3fc3ed=this['_getDifferentChangeGroups'](_0x3e59cd,this['changeGroups']);(_0x3fc3ed['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x3fc3ed),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(_0x336fa2,_0x4b8333){const _0x9c5e76=[];for(const _0x1cc8b5 of _0x4b8333){const _0x12395a=_0x336fa2[_0x1cc8b5['index']];_0x12395a?_0x12395a['changes']['length']!==_0x1cc8b5['changes']['length']?_0x9c5e76['push'](_0x1cc8b5):_0x12395a['changes']['forEach']((_0xda9a70,_0x197a15)=>{const _0x242fcb=_0x1cc8b5['changes'][_0x197a15];_0xda9a70['id']!==_0x242fcb['id']&&_0x9c5e76['push'](_0x1cc8b5);}):_0x9c5e76['push'](_0x1cc8b5);}return _0x9c5e76;}updateChangeGroups(_0x5856ad){const _0x11a49f=this['documentContextContent']['get'](_0x5856ad),_0x59c9bf=this['parsedContent']['get'](_0x5856ad);if(!_0x11a49f||!_0x59c9bf)return;const _0x3fc06f=new _0x28af91('p',{},[new _0x28af91('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x2e8b1a(Ts(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x4150be=this['aiResponseApplier']['merge'](_0x59c9bf,_0x11a49f['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x3fc06f});this['parsedMergedContent']['set'](_0x5856ad,_0x4150be['parsedContent']);let _0x511ac0=[];if(_0x4f9d25(_0x198a60=>{const _0xbbc840=Hs(_0x198a60,'data-id');if(!_0xbbc840||!_0x23faca(_0xbbc840))return!0x1;const _0x5472fe=[_0x198a60,...Vs(_0x198a60)]['at'](-0x2);if(_0x198a60!=_0x5472fe){const _0x254362=Hs(_0x5472fe,'data-id');_0x23faca(_0x254362)||(_0x511ac0['push']({'node':_0x5472fe,'id':_0x254362,'type':'modified'}),_0x4150be['modifiedNodeIds']['push'](_0x254362));}else _0x4150be['modifiedNodeIds']['includes'](_0xbbc840)?_0x511ac0['push']({'node':_0x198a60,'type':'modified','id':_0xbbc840}):_0x4150be['newNodeIds']['includes'](_0xbbc840)?_0x511ac0['push']({'node':_0x198a60,'type':'new','id':_0xbbc840,'anchorId':Hs(_0x198a60['previousSibling'],'data-id')}):_0x511ac0['push']({'node':_0x198a60,'type':'removed','id':_0xbbc840});return!0x0;},this['parsedMergedContent']['get'](_0x5856ad)),_0x511ac0=_0x511ac0['filter'](({node:_0x527a51})=>[...Vs(_0x527a51),_0x527a51]['every'](_0x2c04d4=>!Hs(_0x2c04d4,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x14f1f0=>_0x14f1f0['documentId']!==_0x5856ad),0x0==_0x511ac0['length'])return;const _0xf73167=[[_0x511ac0[0x0]]];for(let _0x3df6aa=0x1;_0x3df6aa<_0x511ac0['length'];_0x3df6aa++){const _0x1a50ae=_0xf73167[_0xf73167['length']-0x1],_0x272a4f=_0x1a50ae[_0x1a50ae['length']-0x1];_0x511ac0[_0x3df6aa]['node']['previousSibling']==_0x272a4f['node']&&'modified'!=_0x511ac0[_0x3df6aa]['type']&&'modified'!=_0x272a4f['type']?_0x1a50ae['push'](_0x511ac0[_0x3df6aa]):_0xf73167['push']([_0x511ac0[_0x3df6aa]]);}for(const _0x4730c6 of _0xf73167){const _0x5c4a78=_0x4730c6[0x0],_0xf5ec51=_0x4730c6[_0x4730c6['length']-0x1],_0x426436=_0x5a7829(_0x5c4a78['node']['previousSibling']);_0x426436&&_0x4730c6['unshift'](_0x426436);const _0x462ca6=_0x5a7829(_0xf5ec51['node']['nextSibling']);_0x462ca6&&_0x4730c6['push'](_0x462ca6);}Ns('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x5856ad))['forEach'](_0x2c1bfc=>{Ms(_0x2c1bfc,'data-wrapped-id',null);});const _0x19f5a3=new Map();Ns('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x5856ad))['forEach'](_0x46b3f5=>{const _0x434fb5=Hs(_0x46b3f5,'data-unwrapped-id'),_0x228ff1=Hs(_0x46b3f5,'data-id');_0x19f5a3['set'](_0x228ff1,_0x434fb5),Ms(_0x46b3f5,'data-id',_0x434fb5),Ms(_0x46b3f5,'data-unwrapped-id',null);});for(const _0x4cfbde of _0x511ac0){const _0x31e8f0=_0x19f5a3['get'](_0x4cfbde['id']);_0x31e8f0&&(_0x4cfbde['id']=_0x31e8f0);}this['changeGroups']['push'](..._0xf73167['map']((_0x213f46,_0x12b4db)=>{const _0x16c357=this['_documentIdToSource']['get'](_0x5856ad),_0x53afd5=this['_outdatedReasonByDocumentId']?.['get'](_0x5856ad),_0x589bc4=this['areActionsDisabled']||void 0x0!==_0x53afd5;return{'changes':_0x213f46,'state':_0x589bc4?'outdated':'pending','outdatedReason':_0x589bc4?_0x53afd5:void 0x0,'index':_0x12b4db,'editor':_0x16c357['editor'],'rootName':_0x16c357['rootName'],'documentId':_0x5856ad};}));const _0x5d46ae=Array['from'](this['documentContextContent']['keys']());function _0x23faca(_0x55f729){return _0x4150be['modifiedNodeIds']['includes'](_0x55f729)||_0x4150be['newNodeIds']['includes'](_0x55f729)||_0x4150be['removedNodeIds']['includes'](_0x55f729);}function _0x5a7829(_0x1e0cd0){if(_0x1e0cd0&&Hs(_0x1e0cd0,'data-id')&&!Hs(_0x1e0cd0,'data-unstable')){const _0x515231=Hs(_0x1e0cd0,'data-id');if(!_0x23faca(_0x515231))return{'node':_0x1e0cd0,'type':'context','id':_0x515231};}return null;}this['changeGroups']['sort']((_0x3a56a3,_0x57089f)=>_0x5d46ae['indexOf'](_0x3a56a3['documentId'])-_0x5d46ae['indexOf'](_0x57089f['documentId'])),this['changeGroups']['forEach']((_0x5e8e1f,_0x5b9b43)=>{_0x5e8e1f['index']=_0x5b9b43;});}};const Fn=/* #__PURE__ -- @preserve */
|
|
30
|
+
dt(),Kn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var Wn=class extends Fn{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:_0x1eba1c,locale:_0x444ec1,channelsToEditors:_0x24583f}){super(),this['id']=Nt(),this['connector']=_0x1eba1c,this['isStopped']=!0x0,this['locale']=_0x444ec1,this['_channelsToEditors']=_0x24583f||new Map();}async start(){await this['_run']();}async['resume'](_0x56a580){await this['_run'](_0x56a580);}async['_run'](_0x1d5714){const _0x11225a=[];let _0xa4ff74,_0x1264ae,_0x392260,_0x2591e2=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x1d5714||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x311cae=await this['currentRequest']['getStream']();for await(const _0x2bc6ab of _0x311cae){if(this['isStopped'])return;if('error'==_0x2bc6ab['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x2bc6ab['event']){case'message-metadata':this['messageId']=_0x2bc6ab['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x2bc6ab['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x2bc6ab['data']['conversationTitle'],!0x0);break;case'source':_0x11225a['push'](_0x2bc6ab['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'](),_0xa4ff74='modification-delta'==_0x2bc6ab['event']?'modification':'text',_0x1264ae='modification-delta'==_0x2bc6ab['event']?_0x2bc6ab['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0xa4ff74&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0xa4ff74,'interactionId':this['id'],'id':_0x1264ae,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x2bc6ab['event']&&{'documentId':_0x2bc6ab['data']['documentId']}}),'modification'==_0xa4ff74&&(this['currentReply']['sources']=_0x11225a['splice'](0x0))),this['currentReply']['appendContent'](_0x2bc6ab['data']['textDelta'],_0x2bc6ab['data']['documentId']);break;case'mcp-tool-result':_0x392260=JSON['parse'](_0x2bc6ab['data']['result']),this['_handleToolResultData']({'toolName':_0x2bc6ab['data']['toolName'],'data':_0x392260['data'],'attributes':_0x392260['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x2bc6ab['data']['toolName'],'data':_0x2bc6ab['data']['data']});}}_0x2591e2=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x11225a['length']>0x0&&(this['currentReply']['sources']=_0x11225a['splice'](0x0)),this['_finalizeInteraction'](_0x2591e2),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0x27ebf3){return this['replies']['find'](_0x2b5a4c=>_0x2b5a4c['id']===_0x27ebf3);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0xfcc132=>_0xfcc132['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x582801){const _0x5966ee=this['getDocumentContext'](),_0x5aca61=new Gn({'locale':this['locale'],'documentContextContent':_0x5966ee?.['documents'],..._0x582801});return this['replies']['push'](_0x5aca61),_0x5aca61['delegate'](...Kn)['to'](this),this['fire']('replyCreated',_0x5aca61),_0x5aca61;}setConversationTitle(_0xa5314f,_0xbf6e7d=!0x1){this['fire']('setConversationTitle',_0xa5314f,_0xbf6e7d);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x47dbeb){this['fire']('toolDataReceived',{'type':'result','toolName':_0x47dbeb['toolName'],'data':structuredClone(_0x47dbeb['data']||{}),'attributes':structuredClone(_0x47dbeb['attributes']||{})},this);}_handleToolNotificationData(_0x4a2c9a){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x4a2c9a['toolName'],'data':structuredClone(_0x4a2c9a['data'])},this);}_finalizeInteraction(_0x48cea7=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x48cea7),this['currentRequest']=this['currentReply']=void 0x0;}};const Yn='defaultContextIds',$n=/* #__PURE__ -- @preserve */
|
|
31
|
+
At();var qn=class AIContext extends $n{['_refs'];constructor(_0x4b0fb5=[]){super(),this['_refs']=[..._0x4b0fb5];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x2f4ce0){return new AIContext([...this['_refs'],..._0x2f4ce0]);}addDefaultContext(_0x6c5729){this['_refs']=[...this['_refs'],..._0x6c5729];}toRequestParts(_0x1feff7=[]){return[...this['_refs']['map'](ps),..._0x1feff7];}toMessageAttributes(_0x15a7cc){return this['isEmpty']?_0x15a7cc:{..._0x15a7cc,[Yn]:[...new Set(this['_refs']['map'](_0x57d5ea=>_0x57d5ea['id']))]};}static getDefaultContextIds(_0x397c58){const _0x41ecef=_0x397c58&&_0x397c58[Yn];return new Set(Array['isArray'](_0x41ecef)?_0x41ecef:[]);}};const Qn=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']]),Xn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var zn=class AIChatContext extends qn{_connector;['_config'];['_ownerId'];constructor({connector:_0x432fbd,config:_0x10d1d8,ownerId:_0x4d4824}){super(),this['_connector']=_0x432fbd,this['_config']=_0x10d1d8,this['_ownerId']=_0x4d4824;}init(){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}getPendingContextItems(){return new Map(this['_pendingContextItems']);}async populateFromMessage(_0x2e10ea,_0x5e0b82,_0x907733=new Set()){const _0x4abf0d=new Map(),{contextItem:_0x113766,unmatchedDocumentIds:_0x3ebb41}=await this['_populateDocumentContextItem'](_0x2e10ea,_0x5e0b82);_0x113766&&_0x4abf0d['set'](_0x113766['id'],_0x113766);for(const _0x41cf89 of _0x2e10ea){if('document'===_0x41cf89['type'])continue;const _0x4e4e9f=await this['_createContextItemFromContent'](_0x41cf89,_0x907733);'context'!==_0x4e4e9f['type']&&this['_addToConversationContextItem'](_0x4e4e9f),_0x4abf0d['set'](_0x4e4e9f['id'],_0x4e4e9f);}return{'contextItems':_0x4abf0d,'hasUnmatched':_0x3ebb41['size']>0x0,'unmatchedDocumentIds':_0x3ebb41};}async _populateDocumentContextItem(_0xbed545,_0x125252){const _0x41cc67=_0xbed545['filter'](_0x20eec5=>'document'===_0x20eec5['type']);if(0x0===_0x41cc67['length'])return{'unmatchedDocumentIds':new Set()};const _0x3b24b4=_0x41cc67['map'](_0x368bca=>_0x368bca['id']),_0x4a56e1=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x3b24b4)['getDocuments'](),_0x51ddce=new Map(_0x4a56e1['map'](_0x4f117c=>[_0x4f117c['id'],_0x4f117c])),_0x30ae8c=[],_0x35a831=new Set();for(const _0x4a5940 of _0x41cc67){const _0x2f73a7=_0x51ddce['get'](_0x4a5940['id']);_0x2f73a7&&(this['_matchDocumentToRoot'](_0x2f73a7,_0x125252)||_0x35a831['add'](_0x2f73a7['id']),_0x30ae8c['push']({'id':_0x2f73a7['id'],'content':_0x2f73a7['content'],'version':_0x2f73a7['attributes']?.['version']??0x0,'sessionId':_0x2f73a7['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x2f73a7['attributes']?.['channelId']??_0x125252[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x2f73a7['attributes']?.['rootName']??_0x125252[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x4a5940['editorConfig']}));}const _0x1fdea1={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x30ae8c};return this['_addToConversationContextItem'](_0x1fdea1),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x1fdea1,'unmatchedDocumentIds':_0x35a831};}_matchDocumentToRoot(_0x10614c,_0x25c309){const _0x54ceea=_0x10614c['attributes']?.['channelId'],_0x32cbc0=_0x10614c['attributes']?.['rootName'];if(_0x54ceea&&_0x32cbc0){for(const _0x58e875 of _0x25c309)if(_0x58e875['config']['get']('collaboration.channelId')===_0x54ceea){for(const _0x37ded9 of _0x58e875['model']['document']['getRoots']())if('$graveyard'!==_0x37ded9['rootName']&&_0x37ded9['rootName']===_0x32cbc0)return{'editor':_0x58e875,'rootName':_0x37ded9['rootName']};}}}async _createContextItemFromContent(_0x296c94,_0x431524=new Set()){return'mcp-tool-context'===_0x296c94['type']?{'id':_0x296c94['id'],'uiId':_0x296c94['id'],'label':_0x296c94['data']?.['label']||_0x296c94['id'],'type':'mcp-tool-context','mcpServerName':_0x296c94['mcpServerName'],'toolName':_0x296c94['toolName'],'data':_0x296c94['data']||{}}:{'id':_0x296c94['id'],'uiId':_0x296c94['id'],'label':_0x296c94['attributes']?.['label']||_0x296c94['name']||_0x296c94['url']||_0x296c94['id'],'type':_0x296c94['type'],..._0x296c94?.['attributes']?.['resourceId']?{'resourceId':_0x296c94['attributes']?.['resourceId']}:{},...'context'===_0x296c94['type']&&_0x431524['has'](_0x296c94['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x40352f){this['_pendingContextItems']['get'](_0x40352f)?.['isReadOnly']||this['_removeContextItem'](_0x40352f);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x2c982c of this['_pendingContextItems']['values']())'context'!==_0x2c982c['type']&&this['_removeContextItem'](_0x2c982c['uiId']);const _0x37ac43=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x37ac43&&this['_addContextItem']({..._0x37ac43,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x273fa6){for(const _0x57a5da of _0x273fa6['values']())'context'!==_0x57a5da['type']&&this['_addToConversationContextItem'](_0x57a5da);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(_0x457621){return Array['from'](_0x457621['values']())['flatMap'](_0x2aad9c=>this['_mapContextItemToRequestData'](_0x2aad9c));}async addFilesToContext(_0x4c1c31,_0x508c0c,_0x1c51e9='file'){const _0x50fa18='files-'+Nt();this['_startUploadOperation'](_0x50fa18);try{await Promise['all'](_0x4c1c31['map'](async _0x213bbe=>{const _0x2229b3='file-'+Nt(),_0x267e92=_0x4150e0(_0x213bbe['name']),_0x1f4b31='file'===_0x1c51e9&&_0x213bbe['type']['startsWith']('image/')?'image':_0x1c51e9;try{this['_addContextItem']({'type':_0x1f4b31,'label':_0x508c0c?.['label']||_0x267e92,'uiId':_0x2229b3,'resourceId':_0x508c0c?.['resourceId']},!0x0);const _0x49986a=this['_connector']['uploadFile'](this['_ownerId'],_0x213bbe,_0x508c0c);this['_ongoingUploads']['set'](_0x2229b3,_0x49986a['abortController']);const {id:_0x43aad6}=await _0x49986a['getId']();this['_ongoingUploads']['delete'](_0x2229b3),this['_finishContextItemLoading']({'type':_0x1f4b31,'id':_0x43aad6,'label':_0x508c0c?.['label']||_0x267e92,'uiId':_0x2229b3,'resourceId':_0x508c0c?.['resourceId']},!0x1);}catch(_0x26ea8b){if(this['_ongoingUploads']['delete'](_0x2229b3),!Nn(_0x26ea8b)){const _0x347477=new xn({'code':Qn['get'](_0x26ea8b['code'])||'ai-chat-file-upload-failed','cause':_0x26ea8b,'context':{'fileName':_0x267e92}});this['fire']('error',{'error':_0x347477});}this['_removeContextItem'](_0x2229b3);}}));}finally{this['_finishUploadOperation'](_0x50fa18);}}addCurrentDocumentToContext(_0x395094){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x7e3ce1={'type':'document','uiId':'current-document','label':_0x395094,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x7e3ce1);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x31e110,_0x4c5f9c){const _0x6e124=this['getCurrentDocumentContext']();if(!_0x6e124)return;_0x31e110['length']>0x1&&_0x31e110['some'](_0x571d83=>!_0x571d83['description'])&&Ot('ai-chat-documents-missing-description');try{const _0x11af34=(_0x6e124['documents']||[])['filter'](_0x42846c=>_0x4c5f9c['has'](_0x42846c['channelId']));if(!_0x31e110['length'])return void(_0x6e124['documents']=_0x11af34);const _0x21cf62=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x31e110)['getIds']();if(_0x21cf62['length']!==_0x31e110['length']||_0x21cf62['some'](_0x949e43=>!_0x949e43?.['id'])){const _0x5bc221=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x5bc221});}const _0x5b207d=_0x31e110['map']((_0x37c045,_0x4619ed)=>{return{'id':_0x21cf62[_0x4619ed]['id'],'content':_0x37c045['content'],'version':_0x37c045['version'],'sessionId':_0x37c045['sessionId'],'selection':(_0x19fe59=_0x37c045['selections'],_0x19fe59?_0x19fe59['map'](_0x2ceebd=>({'start':_0x2ceebd['start'],'end':_0x2ceebd['end']})):[]),'selectionSignature':_0x37c045['selectionSignature'],'channelId':_0x37c045['channelId'],'rootName':_0x37c045['rootName'],'editorConfig':_0x37c045['editorConfig']};var _0x19fe59;});_0x6e124['documents']=[..._0x11af34,..._0x5b207d];}catch(_0x2855e1){throw new xn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x2855e1});}}addSelectionToContext(_0x2a836d){this['_addContextItem']({'type':'selection','label':_0x2a836d,'uiId':'selection','content':_0x2a836d});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x5c89d6,_0x11cc0f){const _0x548a54='url-'+Nt();this['_startUploadOperation'](_0x548a54);const _0x4690dc='url-'+Nt();try{this['_addContextItem']({'type':'web-resource','label':_0x11cc0f?.['label']||_0x5c89d6,'uiId':_0x4690dc,'resourceId':_0x11cc0f?.['resourceId']},!0x0);const _0x211e8b=this['_connector']['uploadUrl'](this['_ownerId'],_0x5c89d6,_0x11cc0f);this['_ongoingUploads']['set'](_0x4690dc,_0x211e8b['abortController']);const {id:_0x571c88}=await _0x211e8b['getId']();this['_ongoingUploads']['delete'](_0x4690dc),this['_finishContextItemLoading']({'type':'web-resource','id':_0x571c88,'label':_0x11cc0f?.['label']||_0x5c89d6,'uiId':_0x4690dc,'resourceId':_0x11cc0f?.['resourceId']},!0x1);}catch(_0x29380c){this['_ongoingUploads']['delete'](_0x4690dc),Nn(_0x29380c)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x5c89d6,'originalError':_0x29380c}),'url':_0x5c89d6}),this['_removeContextItem'](_0x4690dc);}finally{this['_finishUploadOperation'](_0x548a54);}}addToolItemToContext(_0x20eeff){_0x20eeff['id']=_0x20eeff['id']??Nt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x20eeff['uiId'],_0x20eeff),this['fire']('contextItemAdded',{'contextItem':_0x20eeff,'isLoading':!0x1});}async['loadSourceResources'](_0x1772da,_0x18f4c9,_0x4bc927){const _0x510934=this['_addContextOptionsState']['sources']['find'](_0x272aea=>_0x272aea['id']===_0x1772da);if(!_0x510934)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x1772da}),'sourceId':_0x1772da}),[];try{const _0x1eb02a=(await _0x510934['getResources'](_0x18f4c9))['map'](_0x4b3fe3=>{const _0x2d9eda=this['_isResourceInContext'](_0x4b3fe3['id']);return{..._0x4b3fe3,'isInContext':_0x2d9eda};});return _0x510934['resources']=_0x1eb02a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x1772da,'source':_0x510934,'resources':_0x1eb02a,'uid':_0x4bc927}),_0x1eb02a;}catch(_0x2091ca){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x1772da,'originalError':_0x2091ca}),'sourceId':_0x1772da,'sourceLabel':_0x510934['label']}),[];}}async addResourceToContext(_0x1582eb,_0x119199){if(this['_isResourceInContext'](_0x119199['id']))return;if('context'===_0x119199['type'])return void this['_addContextItem']({'type':'context','id':_0x119199['id'],'label':_0x119199['label'],'uiId':'context-'+Nt(),'resourceId':_0x119199['id']});let _0x1f9654=_0x119199['data'];if(!_0x1f9654&&_0x1582eb['getData'])try{_0x1f9654=await _0x1582eb['getData'](_0x119199['id']);}catch(_0x3f7d9d){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id'],'originalError':_0x3f7d9d}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});}if(_0x1f9654)switch(_0x119199['type']){case'web-resource':if('string'!=typeof _0x1f9654)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id'],'expectedType':'string','actualType':typeof _0x1f9654}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});await this['addUrlToContext'](_0x1f9654,{'label':_0x119199['label'],'resourceId':_0x119199['id']});break;case'file':if(!(_0x1f9654 instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id'],'expectedType':'File','actualType':typeof _0x1f9654}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});await this['addFilesToContext']([_0x1f9654],{'label':_0x119199['label'],'resourceId':_0x119199['id']});break;case'text':if('object'!=typeof _0x1f9654||!('content'in _0x1f9654)||!('type'in _0x1f9654))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x1f9654}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});_0x1f9654=AIChatContext['_convertTextResourceToFile'](_0x1f9654,_0x119199['label']),await this['addFilesToContext']([_0x1f9654],{'label':_0x119199['label'],'resourceId':_0x119199['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id'],'resourceType':_0x119199['type']}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']}),'resourceId':_0x119199['id'],'sourceId':_0x1582eb['id']});}addContextSource(_0x510d95){this['_addContextOptionsState']['sources']['some'](_0xe364df=>_0xe364df['id']===_0x510d95['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x510d95,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x339b2f){if(void 0x0!==_0x339b2f)this['_addContextOptionsState']['document']['isHidden']=!_0x339b2f;else{const _0xf1c4b0=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0xf1c4b0;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x3282b6,_0x386c80){switch(_0x3282b6['type']){case'markdown':return new File([_0x3282b6['content']],_0x386c80,{'type':'text/markdown'});case'html':return new File([_0x3282b6['content']],_0x386c80,{'type':'text/html'});default:return new File([_0x3282b6['content']],_0x386c80,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x81964){switch(_0x81964['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x81964['id']}];case'web-resource':return[{'type':'web-resource','id':_0x81964['id']}];case'context':return[{'type':'context','id':_0x81964['id']}];case'document':return _0x81964['documents']?.['length']?_0x81964['documents']['map'](({id:_0x2c7ead,editorConfig:_0x30777b,selection:_0x3ba3c0})=>({'type':'document','id':_0x2c7ead,..._0x30777b&&{'editorConfig':_0x30777b},..._0x3ba3c0?.['length']&&{'selection':_0x3ba3c0}})):[];case'mcp-tool-context':{const _0x719c2a=_0x81964;return[{'type':'mcp-tool-context','mcpServerName':_0x719c2a['mcpServerName'],'toolName':_0x719c2a['toolName'],'data':{..._0x719c2a['data'],'label':_0x719c2a['label']||_0x719c2a['data']?.['label']||_0x719c2a['id']},'id':_0x719c2a['id']}];}default:return[];}}_addContextItem(_0x375923,_0x4c1192=!0x1){if(this['_pendingContextItems']['set'](_0x375923['uiId'],_0x375923),_0x375923['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x375923,'isLoading':_0x4c1192}),'current-document'===_0x375923['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x375923['resourceId']){const _0x30397e=this['_findSourceIdsByResourceId'](_0x375923['resourceId']);_0x30397e&&_0x30397e['forEach'](_0xc0ef4e=>{this['_updateResourceInContextState'](_0xc0ef4e,_0x375923['resourceId'],!0x0);});}}_removeContextItem(_0x284e51){const _0x26888e=this['_pendingContextItems']['get'](_0x284e51),_0x137bf9=this['_ongoingUploads']['get'](_0x284e51);if(_0x137bf9&&(_0x137bf9['abort'](),this['_ongoingUploads']['delete'](_0x284e51)),_0x26888e?.['resourceId']){const _0x4cd3b1=this['_findSourceIdsByResourceId'](_0x26888e['resourceId']);_0x4cd3b1&&_0x4cd3b1['forEach'](_0x4d0d42=>{this['_updateResourceInContextState'](_0x4d0d42,_0x26888e['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x284e51),this['fire']('contextItemRemoved',{'uiId':_0x284e51,'type':_0x26888e?.['type']}),'current-document'===_0x284e51&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x138a92,_0x4f5e25){if(this['_pendingContextItems']['has'](_0x138a92['uiId'])&&(this['_pendingContextItems']['set'](_0x138a92['uiId'],_0x138a92),this['fire']('contextItemLoadingEnded',{'contextItem':_0x138a92,'isLoading':_0x4f5e25}),_0x138a92['resourceId'])){const _0x190aa9=this['_findSourceIdsByResourceId'](_0x138a92['resourceId']);_0x190aa9&&_0x190aa9['forEach'](_0xd1e286=>{this['_updateResourceInContextState'](_0xd1e286,_0x138a92['resourceId'],!0x0);});}}_addToConversationContextItem(_0x7618cc){this['_conversationContextItems']['set'](_0x7618cc['uiId'],_0x7618cc);}_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'](_0x450087=>({..._0x450087,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x3edf52=>({..._0x3edf52,'resources':[]}))??[];}_isResourceInContext(_0x114a75){for(const _0x17d49e of this['_pendingContextItems']['values']())if(_0x17d49e['resourceId']===_0x114a75)return!0x0;for(const _0x37fb05 of this['_conversationContextItems']['values']())if(_0x37fb05['resourceId']===_0x114a75)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2dc78e){const _0x9be51f=[];for(const _0x18f959 of this['_addContextOptionsState']['sources'])_0x18f959['resources']['find'](_0x127efb=>_0x127efb['id']===_0x2dc78e)&&_0x9be51f['push'](_0x18f959['id']);return 0x0===_0x9be51f['length']?null:_0x9be51f;}_updateResourceInContextState(_0x24d59e,_0x556e78,_0x349bb2){const _0x3f5977=this['_addContextOptionsState']['sources']['find'](_0x5e87ea=>_0x5e87ea['id']===_0x24d59e);if(!_0x3f5977)return;const _0x49a851=_0x3f5977['resources']['find'](_0x1d0818=>_0x1d0818['id']===_0x556e78);_0x49a851&&(_0x49a851['isInContext']=_0x349bb2,this['fire']('resourceStateChanged',{'sourceId':_0x24d59e,'resourceId':_0x556e78,'isInContext':_0x349bb2}));}_startUploadOperation(_0x973364){this['_ongoingUploadOperations']['set'](_0x973364,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x566f00){this['_ongoingUploadOperations']['delete'](_0x566f00),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},jn=class extends Wn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x11c228){super(_0x11c228),this['conversationId']=_0x11c228['conversationId'],this['contextItems']=_0x11c228['contextItems'],this['capabilities']=_0x11c228['capabilities'],this['userMessage']=_0x11c228['userMessage'],this['model']=_0x11c228['model'],this['attributes']=_0x11c228['attributes'],this['context']=_0x11c228['context']??new qn();}sendRequest(){const _0x3d5eb9=zn['mapContextItemsToRequestData'](this['contextItems']),_0x22a39a=this['context']['toRequestParts'](_0x3d5eb9);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x22a39a,'capabilities':Sn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const Jn=/* #__PURE__ -- @preserve */
|
|
32
|
+
dt();var Zn=class extends Jn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x3a97e0){super(),this['options']=_0x3a97e0,this['connector']=_0x3a97e0['connector'],this['chatModels']=_0x3a97e0['chatModels'],this['id']=_0x3a97e0['conversationId'],this['isFromHistory']=_0x3a97e0['isFromHistory'],this['_channelsToEditors']=_0x3a97e0['channelsToEditors'],this['_getSessionId']=_0x3a97e0['getSessionId'];}async init(_0xc63409){try{this['chatContext']=new zn({'connector':this['connector'],'config':_0xc63409,'ownerId':this['id']}),this['chatContext']['delegate'](...Xn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new Sn(),this['chatCapabilities']['delegate'](...bn)['to'](this),this['chatCapabilities']['init']();const _0x394e76=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x394e76});const _0x4754a1=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x4754a1&&await this['setModel'](_0x4754a1);}catch(_0xb35dba){const _0x257724=new xn({'code':'ai-chat-conversation-init-failed','cause':_0xb35dba,'type':'network'});this['fire']('error',{'error':_0x257724});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0xbde1f1}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0xbde1f1,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x40c748){const _0x33f380=new xn({'code':'ai-chat-conversation-start-failed','cause':_0x40c748,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x33f380}),_0x33f380;}}async['load'](_0x2a7c7b){try{const _0x31fa8a=await this['connector']['fetchConversation'](_0x2a7c7b)['getConversation'](),_0x353fc6=await this['connector']['fetchConversationMessages'](_0x2a7c7b)['getMessages'](),_0x1b37d6=_0x353fc6[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x31fa8a['id'],'title'in _0x31fa8a?this['fire']('setConversationTitle',_0x31fa8a['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x1b37d6)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0xc94104}=await this['_processMessagesToInteractions'](_0x353fc6,_0x1b37d6);return _0xc94104&&this['currentInteraction']?this['_resumeStream'](_0xc94104):this['currentInteraction']=void 0x0,this;}catch(_0xc029eb){const _0x2fe7bf=new xn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0xc029eb,'type':'network','context':{'conversationId':_0x2a7c7b}});throw this['fire']('error',{'error':_0x2fe7bf}),_0x2fe7bf;}}async _processMessagesToInteractions(_0x431c49,_0x37d56b){let _0x3830ae,_0x420135,_0x132da1=new Set();for(const _0x804438 of _0x431c49)if('user'===_0x804438['role']){const {contextItems:_0x11792e,unmatchedDocumentIds:_0x4f1345}=await this['_extractContextItems'](_0x804438);_0x132da1=_0x4f1345;const _0x42170a={'isReasoningEnabled':Object['hasOwn'](_0x804438['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x804438['capabilities'],'webSearch')};_0x3830ae=this['createInteraction']({'userMessage':_0x804438['prompt'],'contextItems':_0x11792e,'capabilities':_0x42170a,'modelId':_0x37d56b,'attributes':_0x804438['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x3830ae,_0x420135=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x804438['role']&&_0x3830ae){if('streaming'===_0x804438['status']){_0x420135=_0x804438['id'];continue;}if('error'===_0x804438['status'])continue;const _0x2c4dd1=[];for(const _0x17a24f of _0x804438['content'])switch(_0x17a24f['type']){case'text':case'modification':{const _0x267c5d=_0x3830ae['getDocumentContext'](),_0x1e2bb7=this['_getOutdatedReasonsByDocumentId'](_0x267c5d,_0x132da1),_0x17bf71=_0x267c5d?.['documents']??[],_0x5a98b8=_0x17bf71['length']>0x0&&_0x17bf71['every'](_0x59e39b=>_0x1e2bb7['has'](_0x59e39b['id']));_0x3830ae['currentReply']?.['type']!==_0x17a24f['type']&&(_0x3830ae['currentReply']=_0x3830ae['createReply']({'type':_0x17a24f['type'],'isDone':!0x0,'interactionId':_0x3830ae['id'],'areActionsDisabled':_0x5a98b8,'outdatedReasonByDocumentId':_0x1e2bb7,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x2c4dd1['length']>0x0&&(_0x3830ae['currentReply']['sources']=_0x2c4dd1['splice'](0x0))),_0x3830ae['currentReply']['appendContent'](_0x17a24f['content'],_0x17a24f['documentId']);break;}case'url':_0x2c4dd1['push'](_0x17a24f);break;case'mcp-tool-result':{const {data:_0x30e91d,attributes:_0x4ffdc9}=JSON['parse'](_0x17a24f['content']);_0x3830ae['_handleToolResultData']({'toolName':_0x17a24f['toolName'],'data':_0x30e91d,'attributes':_0x4ffdc9});break;}}'cancelled'===_0x804438['status']&&this['fire']('error',{'interactionId':_0x3830ae['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x420135};}async _resumeStream(_0x5a06e4){if(this['currentInteraction'])try{const _0x2f7d21=this['connector']['resumeStream'](this['id'],_0x5a06e4);await this['currentInteraction']['resume'](_0x2f7d21);}catch(_0x52a0c6){_0x52a0c6 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x52a0c6});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x182ec9){return _0x182ec9['content']?this['chatContext']['populateFromMessage'](_0x182ec9['content'],Array['from'](this['_channelsToEditors']['values']()),qn['getDefaultContextIds'](_0x182ec9['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x2e41dc,attributes:_0x316172}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4bbf54=new Map(this['getPendingContextItems']()),_0x9a386=this['chatCapabilities']['getCapabilitiesConfig'](),_0xf1600a=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x2e41dc,'contextItems':_0x4bbf54,'capabilities':_0x9a386,'modelId':_0xf1600a,'attributes':_0x316172,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x2d7250){if(_0x2d7250 instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x2d7250});else{const _0xc6b28=Qn['get'](_0x2d7250['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0xc6b28,null,{'error':_0x2d7250})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x99d1e5,contextItems:_0x6a2977,capabilities:_0x500a0a,modelId:_0x136085,attributes:_0xec12c7,channelsToEditors:_0x14da90}){const _0x56db8b=new jn({'userMessage':_0x99d1e5,'contextItems':_0x6a2977,'capabilities':_0x500a0a,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x136085,'attributes':_0xec12c7,'channelsToEditors':_0x14da90,'context':this['chatContext']['isEmpty']?void 0x0:new qn(this['chatContext']['refs'])});return _0x56db8b['delegate'](...Kn)['to'](this),this['interactions']['push'](_0x56db8b),this['fire']('interactionCreated',_0x56db8b),_0x56db8b;}getInteraction(_0x265f95){return this['interactions']['find'](_0x221869=>_0x221869['id']===_0x265f95);}removeInteraction(_0x174828){const _0x1e105c=this['getInteraction'](_0x174828);_0x1e105c&&(_0x1e105c['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x1e105c),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x4d01dc=this['lastInteraction'];_0x4d01dc?.['conversationId']&&_0x4d01dc['messageId']&&this['connector']['cancelStream'](_0x4d01dc['conversationId'],_0x4d01dc['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x5564d0){this['chatContext']['addCurrentDocumentToContext'](_0x5564d0);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x458cf2,unchangedIds:_0x3b8b55}=this['_compareEditorStateWithDocumentContext'](),_0x3c3d06=new Promise((_0x5b9a24,_0x313491)=>{this['_abortReject']=()=>_0x313491(new ct('ai-request-aborted',this));}),_0x508a36=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x458cf2),_0x3c3d06]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x508a36,_0x3b8b55),_0x3c3d06]);}_compareEditorStateWithDocumentContext(){const _0x135d57=new Set(),_0x5b2845=new Set(),_0x60e1f3=this['options']['aiEditing']['getEditorsVersions'](),_0x54add3=this['options']['aiEditing']['getEditorsSelections'](),_0x5ed387=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x37caae=new Map(_0x5ed387['map'](({channelId:_0x347c5f,version:_0x302387})=>[_0x347c5f,_0x302387])),_0xc24342=new Map(_0x5ed387['map'](({channelId:_0x339182,selectionSignature:_0x2b2dec})=>[_0x339182,_0x2b2dec]));for(const [_0x36ce43,_0x50a1f9]of _0x60e1f3){const _0x3cfb50=_0x54add3['get'](_0x36ce43);_0x37caae['get'](_0x36ce43)!=_0x50a1f9||_0xc24342['get'](_0x36ce43)!=_0x3cfb50?_0x135d57['add'](_0x36ce43):_0x37caae['has'](_0x36ce43)&&_0x5b2845['add'](_0x36ce43);}return{'changedIds':_0x135d57,'unchangedIds':_0x5b2845};}toggleAddCurrentDocumentOptionVisibility(_0x5665d0){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x5665d0);}_getOutdatedReasonsByDocumentId(_0x365651,_0x3fd2d3){const _0x6a72a1=new Map();if(!_0x365651||!_0x365651['documents'])return _0x6a72a1;for(const _0x5b54ef of _0x365651['documents']){const _0x247bd5=this['_channelsToEditors']['get'](_0x5b54ef['channelId']);_0x247bd5&&'destroyed'!==_0x247bd5['state']?_0x5b54ef['sessionId']!==this['_getSessionId'](_0x247bd5)?_0x6a72a1['set'](_0x5b54ef['id'],'session-changed'):_0x3fd2d3['has'](_0x5b54ef['id'])&&_0x6a72a1['set'](_0x5b54ef['id'],'content-removed'):_0x6a72a1['set'](_0x5b54ef['id'],'editor-removed');}return _0x6a72a1;}addSelectionToContext(_0x2b92a3){this['chatContext']['addSelectionToContext'](_0x2b92a3);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x367e89){this['chatContext']['addFilesToContext'](_0x367e89);}addUrlToContext(_0x1c592f){this['chatContext']['addUrlToContext'](_0x1c592f);}addToolItemToContext(_0x23bd8b){this['chatContext']['addToolItemToContext'](_0x23bd8b);}addResourceToContext(_0x7c8678,_0x2bf88a){this['chatContext']['addResourceToContext'](_0x7c8678,_0x2bf88a);}['loadSourceResources'](_0x3cde6b,_0x21ee66,_0x2fe165){return this['chatContext']['loadSourceResources'](_0x3cde6b,_0x21ee66,_0x2fe165);}removeFromContext(_0xbcd55f){this['chatContext']['removeFromContext'](_0xbcd55f);}setWebSearch(_0x194158){this['chatCapabilities']['setWebSearch'](_0x194158);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x3b655f){this['chatCapabilities']['setReasoning'](_0x3b655f);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x558295){_0x558295['length']&&this['chatContext']['addDefaultContext'](_0x558295);}async setModel(_0x3ff6ef){_0x3ff6ef?!0x1===await this['chatModels']['isAvailable'](_0x3ff6ef)&&(Ot('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x3ff6ef}),_0x3ff6ef=(await this['chatModels']['getAvailableModels']())[0x0]):(Ot('ai-chat-conversation-set-model-null',{'conversation':this}),_0x3ff6ef=(await this['chatModels']['getAvailableModels']())[0x0]),_0x3ff6ef['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x3ff6ef,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x3ff6ef}));}};function tr({documentSuggestions:_0x1cccfa,transform:_0x2fcd5f,documentCompare:_0x338c10,documentCompareOptions:_0x62fc73}){const _0x48a84c=new Map();for(const [_0x5912ca,{groups:_0xe1b778,documentContext:_0x2a4dd8,documentContent:_0x5bb6a1,editor:_0x1b0a86}]of _0x1cccfa){const _0x4b1482=_0x2a4dd8['content'],_0x5516cc=_0x2a4dd8['version'],_0x37249f=_0x5bb6a1['cloneNode'](!0x0);for(const {changes:_0xc57f0d}of _0xe1b778)Qs(_0x37249f,_0xc57f0d);const _0x17241a=ks(_0x37249f),_0x14aacb=zs(_0x1b0a86,_0x2a4dd8['rootName'],_0x4b1482,_0x17241a);if(!_0x14aacb)continue;const _0x42d7c5=_0x338c10['getDiff'](_0x14aacb['before'],_0x14aacb['after'],{'targetEditor':_0x1b0a86,'anchor':_0x2a4dd8['rootName'],..._0x62fc73})['getOperations']();if(_0x2fcd5f){const _0x1c26aa=_0x1b0a86['model']['document']['history']['getOperations'](_0x5516cc),_0x1266aa={'document':_0x1b0a86['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x48a84c['set'](_0x5912ca,_0x371d73(_0x42d7c5,_0x1c26aa,_0x1266aa)['operationsA']);}else _0x48a84c['set'](_0x5912ca,_0x42d7c5);}return _0x48a84c;}function er({groups:_0x36a3c6,documentContextContent:_0xf82abd,documents:_0xe9bc0b}){const _0x29879c=new Map();for(const _0x51fbe6 of _0x36a3c6){const {documentId:_0xe66ab5}=_0x51fbe6,_0x4c21f9=_0x29879c['get'](_0xe66ab5);if(_0x4c21f9)_0x4c21f9['groups']['push'](_0x51fbe6),_0x4c21f9['indexes']['push'](_0x51fbe6['index']);else{const _0x10453b=_0xe9bc0b['find'](_0x3fd48e=>_0x3fd48e['id']===_0xe66ab5),_0x373980=_0xf82abd['get'](_0xe66ab5);if(!_0x10453b||!_0x373980)continue;_0x29879c['set'](_0xe66ab5,{'groups':[_0x51fbe6],'documentContext':_0x10453b,'documentContent':_0x373980,'editor':_0x51fbe6['editor'],'indexes':[_0x51fbe6['index']]});}}return _0x29879c;}function ir(_0x46cf4e,_0x1b71ec){const _0x463f84=_0x46cf4e['files']['length']>0x0&&_0x46cf4e['files']['every'](_0xdc7d0c=>_0xdc7d0c['type']['startsWith']('image/')),_0x5431f0=_0x46cf4e['plainText']['trim']()['length']>0x0;if(_0x46cf4e['files']['length']>0x0&&_0x1b71ec['filesEnabled']&&(!_0x463f84||!_0x5431f0)){const _0x4c1a16=_0x46cf4e['files']['filter'](_0x2dceb0=>_0x2dceb0['name']);return _0x4c1a16['length']>0x0?{'type':'file','files':_0x4c1a16}:null;}if(_0x1b71ec['urlsEnabled']){const _0x1ca896=function(_0x1e5795){const _0x4f259e=_0x1e5795['trim']();if(/\s/['test'](_0x4f259e))return null;try{const _0x2fb187=new URL(_0x4f259e);return'http:'!==_0x2fb187['protocol']&&'https:'!==_0x2fb187['protocol']?null:_0x2fb187['toString']();}catch{return null;}}(_0x46cf4e['plainText']);if(_0x1ca896)return{'type':'url','url':_0x1ca896};}const _0x3177ef=_0x46cf4e['forceTextAttachment']?0x1:_0x1b71ec['longTextThreshold']??0x1/0x0;if(_0x46cf4e['plainText']['length']>=Math['max'](_0x3177ef,0x1)&&_0x1b71ec['filesEnabled']){const _0x4a7b1a=_0x1b71ec['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x46cf4e['plainText']],_0x4a7b1a,{'type':'text/plain'})]};}return null;}var sr=class extends _0x22445f{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Es,Ln,_0xc19772,Ss];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Vn(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aichat'),this['_aiModels']=this['context']['plugins']['get'](Ss)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](Ss)['contextLibrary'];const _0x2db292=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x50ec7c,_0x3aa371)=>{this['sendMessage']({'message':_0x3aa371});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x2db292['view'],'change:activeTab',(_0x19ae33,_0x50b440,_0x50b7d4)=>{'chat'!==_0x50b7d4&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x56ce37,_0x2fd1f1)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x2fd1f1));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x43c08a,_0x138fa2)=>{this['activeConversation']?.['addUrlToContext'](_0x138fa2);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x3d3d30,_0x5158ad)=>{const _0x5240ff=this['activeConversation'];if(!_0x5240ff)return;_0x5158ad['hasDirectory']&&(_0x5158ad['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Nt()}));const _0x23fdbc=ir(_0x5158ad,{'pastedTextLabel':Ts(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')});_0x23fdbc&&(_0x5158ad['preventDefault'](),'url'===_0x23fdbc['type']?_0x5240ff['addUrlToContext'](_0x23fdbc['url']):_0x5240ff['chatContext']['addFilesToContext'](_0x23fdbc['files'],void 0x0,_0x23fdbc['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x1a325e,_0xd69455)=>{_0xd69455['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x2139c,_0x12a674)=>{this['activeConversation']?.['addResourceToContext'](_0x12a674['source'],_0x12a674['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x597b12,_0x28091a)=>{this['_removeFromContext'](_0x28091a);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x1af215,_0x202c0a)=>{this['activeConversation']?.['loadSourceResources'](_0x202c0a['sourceId'],_0x202c0a['query'],_0x202c0a['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x53e1c4,_0x1c4104)=>{this['activeConversation']?.['setModel'](_0x1c4104);}),this['listenTo'](this['_aiChatUi'],'like',(_0xf30840,{replyId:_0x47b84b})=>{console['log']('Liked\x20response',_0x47b84b);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x4dd3f1,{replyId:_0x27c8f8})=>{console['log']('Disliked\x20response',_0x27c8f8);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4f8dc3,_0x2d2c4b)=>{this['_insertSuggestion'](_0x2d2c4b);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x19bf48,{replyId:_0xba3565,partIndex:_0x341a74})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0xba3565,_0x341a74);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x39c094,{replyId:_0x1d1dd3,partIndex:_0x54e2ad})=>{const _0x4654de=this['_getDocumentRangeForReplyChanges'](_0x1d1dd3,_0x54e2ad);if(!_0x4654de)return;const {reply:_0x36a23b}=this['getInteractionAndReplyById'](_0x1d1dd3);'$graveyard'!=_0x4654de['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x36a23b['changeGroups'][_0x54e2ad]['editor'],'ranges':[_0x4654de['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x407ab8,_0x27a34a)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x27a34a);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0xd3b809,{replyId:_0xe8a2d6,showDiff:_0x352c15})=>{const {interaction:_0x1275ab,reply:_0x46c465}=this['getInteractionAndReplyById'](_0xe8a2d6),_0x227f72=_0x46c465['getContentParts']({'showDiff':_0x352c15});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1275ab['id']+':'+_0x46c465['id'],'parts':_0x227f72});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x13b7ab,{replyId:_0x5c0704,partIndex:_0x33114a})=>{this['_rejectSuggestion']({'replyId':_0x5c0704,'partIndex':_0x33114a}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x1a39f3,_0x3e6af6)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x3e6af6);}),this['on']('replyCreated',(_0x547748,_0xdf8f12)=>{this['_addFeedItemReply'](_0xdf8f12);});}afterInit(){this['context']instanceof _0x46bd64?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xd8d2fc,_0x594669)=>{_0x594669['on']('ready',()=>{this['_integrateEditor'](_0x594669);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x39a8aa=this['context']['config']['get']('ai.chat.initialConversation');let _0x2cf5dd=_0x39a8aa;('lastCreated'!=_0x39a8aa||(_0x2cf5dd=await this['_getLastCreatedConversationId'](),_0x2cf5dd))&&('new'==_0x2cf5dd?await this['_startConversationSafely']():await this['loadConversation'](_0x2cf5dd));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x368ec1){this['_closeActiveBalloon'](),this['context']['plugins']['get'](Is)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x368ec1)['getConversation'](),await this['_startConversationSafely']({'id':_0x368ec1}),await this['activeConversation']['load'](_0x368ec1),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0xd47597){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x368ec1}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0xd47597),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x4da13e){let _0x582ab0=null,_0x3ee55c=null;this['on']('toolDataReceived',(_0x37cfdb,_0x45cc84,_0x337f70)=>{_0x337f70['id']!==_0x582ab0&&(_0x582ab0=_0x337f70['id'],_0x3ee55c=this['_getAIChatFeedAPI'](_0x337f70)),_0x4da13e(_0x45cc84,_0x3ee55c);});}addCurrentDocumentToChatContext(){Rs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Ts(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x11229e){const _0x5a5a2d=this['_aiEditing']['getSelectionText'](_0x11229e);this['activeConversation']?.['addSelectionToContext'](_0x5a5a2d),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x1a4d98){await this['_startConversationSafely']({'modelId':_0x1a4d98?.['modelId'],'contexts':_0x1a4d98?.['contexts']});}async['sendMessage']({message:_0x44a30e,attributes:_0x1b4675}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0x44a30e,'attributes':_0x1b4675}));}getGroupId(){const _0x132fb2=this['context']['config']['get']('collaboration.channelId');if(!_0x132fb2)throw new ct('ai-missing-channel-id',this);return _0x132fb2;}_handleRemovedConversation(_0x2f49f9){this['activeConversation']['id']===_0x2f49f9&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x38e065){return!(!_0x38e065['editor']||'destroyed'===_0x38e065['editor']['state']||!_0x38e065['editor']['isReadOnly']);}_isGroupWriteable(_0x3c9f18){return!(!_0x3c9f18['editor']||'destroyed'===_0x3c9f18['editor']['state']||_0x3c9f18['editor']['isReadOnly']);}_computeSuggestionGating(_0x2a0793){const _0x35d833=new Map();for(const _0x333e71 of _0x2a0793['changeGroups'])_0x35d833['set'](_0x333e71['index'],this['_isGroupReadOnly'](_0x333e71));const _0x3eee3f=new Set(_0x2a0793['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x417dd2=>_0x417dd2['hasChanges'])['map'](_0x38a3a4=>_0x38a3a4['index']));return{'readOnlyByIndex':_0x35d833,'isAcceptAllEnabled':_0x2a0793['changeGroups']['some'](_0x4c821e=>'pending'===_0x4c821e['state']&&this['_isGroupWriteable'](_0x4c821e)&&_0x3eee3f['has'](_0x4c821e['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x12a610 of this['activeConversation']['interactions'])for(const _0x155c60 of _0x12a610['replies'])'modification'===_0x155c60['type']&&this['_aiChatUi']['hasFeedItem'](_0x155c60['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x155c60['id'],this['_computeSuggestionGating'](_0x155c60));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x1c3868}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x3ba6a5=_0x1c3868['changeGroups']['find'](_0x32041c=>_0x32041c['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x3ba6a5&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x3ba6a5));}}_prepareDocumentSuggestions(_0x11a67c){const {reply:_0x5e0d0f,interaction:_0x1faaf3}=this['getInteractionAndReplyById'](_0x11a67c['replyId']),_0x33cc63=void 0x0!==_0x11a67c['partIndex']?[_0x5e0d0f['changeGroups'][_0x11a67c['partIndex']]]:_0x5e0d0f['changeGroups']['filter'](_0x372d3b=>'pending'===_0x372d3b['state']&&!this['_isGroupReadOnly'](_0x372d3b)),_0x37400b=_0x33cc63['map'](_0x2f2bbd=>_0x5e0d0f['changeGroups']['indexOf'](_0x2f2bbd)),_0x433aab=Xs(_0x5e0d0f['changeGroups'],_0x5e0d0f['documentContextContent']);return _0x37400b['forEach'](_0x30a742=>{if(_0x433aab['has'](_0x30a742))return;const _0x52fa89=this['_getDocumentRangeForReplyChanges'](_0x11a67c['replyId'],_0x30a742);_0x52fa89&&'$graveyard'!=_0x52fa89['range']['root']['rootName']?(_0x5e0d0f['setChangeGroupState'](_0x30a742,'accepted'),void 0x0!==_0x11a67c['partIndex']&&this['_scrollToSuggestionRange'](_0x52fa89['range'],!0x1,_0x52fa89['targetEditor'])):_0x5e0d0f['setChangeGroupState'](_0x30a742,'outdated',this['_getOutdatedReason'](_0x5e0d0f['changeGroups'][_0x30a742]));}),er({'groups':_0x33cc63['filter'](_0x315abc=>'accepted'===_0x315abc['state']),'documentContextContent':_0x5e0d0f['documentContextContent'],'documents':_0x1faaf3['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x556dca){const _0x575f9e=this['context']['plugins']['get'](_0xc19772),{reply:_0x471f58,interaction:_0x3631b7}=this['getInteractionAndReplyById'](_0x556dca['replyId']),_0x51983f=this['_prepareDocumentSuggestions'](_0x556dca),_0x3f6e67=tr({'documentSuggestions':_0x51983f,'transform':!0x0,'documentCompare':_0x575f9e,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x52b26f,_0x3e527f]of _0x3f6e67){const {editor:_0xf83af4,indexes:_0x11db37}=_0x51983f['get'](_0x52b26f);if(!_0xf83af4['plugins']['has']('TrackChanges')){Ot('ai-no-track-changes',{'editor':_0xf83af4});continue;}let _0x172305;wn(_0x3e527f,'chat'),_0xf83af4['model']['change'](_0x3bf1b1=>{_0x172305=_0x3bf1b1['batch'],_0xf83af4['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x3e527f),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x172305,{'interactionId':_0x3631b7['id'],'replyId':_0x471f58['id'],'indexes':_0x11db37});}this['_updateRatings'](_0x471f58);}_applySuggestion(_0x6f44d0){const _0x52370a=this['context']['plugins']['get'](_0xc19772),{reply:_0x1fd843,interaction:_0x330131}=this['getInteractionAndReplyById'](_0x6f44d0['replyId']),_0x23e36=this['_prepareDocumentSuggestions'](_0x6f44d0),_0x15186f=tr({'documentSuggestions':_0x23e36,'transform':!0x0,'documentCompare':_0x52370a,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x38cefd,_0x1e81f1]of _0x15186f){const {editor:_0x2259e7,indexes:_0x36ae3d}=_0x23e36['get'](_0x38cefd);let _0x31e9e6;wn(_0x1e81f1,'chat');try{_0x2259e7['model']['change'](_0x176228=>{_0x31e9e6=_0x176228['batch'],_0x52370a['applyOperations'](_0x176228,_0x1e81f1);}),this['_batchToChanges']['set'](_0x31e9e6,{'interactionId':_0x330131['id'],'replyId':_0x1fd843['id'],'indexes':_0x36ae3d});}catch(_0x30e683){throw this['_reporter']['logError'](new xn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x30e683})),_0x30e683;}}this['_updateRatings'](_0x1fd843);}_rejectSuggestion(_0x23d932){const {reply:_0xcc86d9}=this['getInteractionAndReplyById'](_0x23d932['replyId']);_0xcc86d9['setChangeGroupState'](_0x23d932['partIndex'],'rejected');}['_openBalloonFor'](_0x1fb031,_0x5ef66d){if(!this['_hasAIChatBalloon'])return;const {reply:_0x56be27}=this['getInteractionAndReplyById'](_0x1fb031),_0x46f414=_0x56be27['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x46f414['length'])return;let _0x45a6ad,_0x1c2d72;if(void 0x0!==_0x5ef66d?(_0x1c2d72=_0x46f414['find'](_0x5d79a4=>_0x5d79a4['index']==_0x5ef66d),_0x45a6ad=_0x1c2d72?.['index']):(_0x1c2d72=_0x46f414[0x0],_0x45a6ad=_0x1c2d72['index']),!_0x1c2d72)return void _0x56be27['setChangeGroupState'](_0x5ef66d??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x1fb031&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x45a6ad)return;const _0x3853d7=this['_getUserPresentableContentPartDocumentRange'](_0x1fb031,_0x56be27,_0x1c2d72),_0x25304c=_0x56be27['changeGroups']['find'](_0x53a385=>_0x53a385['index']==_0x45a6ad),_0xb0a872=_0x25304c['editor'],_0x3ab654=_0xb0a872['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x3ab654&&this['_activeBalloon']['close'](),!_0x3853d7)return _0x3ab654['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x3ab654,this['_currentPreviewedChangeGroup']={'replyId':_0x1fb031,'partIndex':_0x45a6ad},this['_scrollToSuggestionRange'](_0x3853d7,!0x0,_0xb0a872);const _0x16da7a=this['_getPresentableSiblingContentPartIndex'](_0x1fb031,_0x45a6ad,'next');_0x3ab654['clearContent'](),_0x3ab654['updateContent']({'part':_0x1c2d72,'renderingStrategy':'static'}),_0x3ab654['open']({'index':_0x45a6ad,'title':Ts(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x45a6ad+0x1)['toString']()),'showRotator':null!==_0x16da7a,'ranges':[_0x3853d7],'areActionsDisabled':_0x56be27['areActionsDisabled'],'targetEditor':_0xb0a872,'isTargetReadOnly':this['_isGroupReadOnly'](_0x25304c)}),_0x3ab654['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x1fb031,_0x45a6ad),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x1fb031,'index':_0x45a6ad,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x255f3a,_0x79b228,_0x40970c){const {reply:_0x65311e}=this['getInteractionAndReplyById'](_0x255f3a),_0x5717d2=_0x65311e['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x5717d2['length'])return null;const _0xc28e9d='next'==_0x40970c?0x1:-0x1;function _0x47da5f(_0x25319e){const _0x25eb03=(_0x25319e+_0xc28e9d+_0x5717d2['length'])%_0x5717d2['length'];return{'siblingIndex':_0x25eb03,'siblingPart':_0x5717d2[_0x25eb03]};}const _0x3f980a=_0x5717d2['findIndex'](_0x182a41=>_0x182a41['index']==_0x79b228);let {siblingIndex:_0x5ccefc,siblingPart:_0x10c58f}=_0x47da5f(_0x3f980a);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x255f3a,_0x65311e,_0x10c58f);)if({siblingIndex:_0x5ccefc,siblingPart:_0x10c58f}=_0x47da5f(_0x5ccefc),_0x5ccefc===_0x3f980a)return null;return _0x10c58f['index'];}_getOutdatedReason(_0x86b9e9){return _0x86b9e9?.['editor']&&'destroyed'!==_0x86b9e9['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x59587b,_0x2fe07b,_0x221918){const _0x442e2d=_0x2fe07b['changeGroups'];if(!_0x221918['hasChanges'])return null;const _0x1e6609=_0x442e2d['find'](_0x5a5b33=>_0x5a5b33['index']==_0x221918['index']);if('pending'!==_0x1e6609?.['state'])return null;if(!_0x1e6609?.['editor']||'destroyed'===_0x1e6609['editor']['state'])return _0x2fe07b['setChangeGroupState'](_0x221918['index'],'outdated',this['_getOutdatedReason'](_0x1e6609)),null;const _0x382381=this['_getDocumentRangeForReplyChanges'](_0x59587b,_0x221918['index']);if(!_0x382381)return _0x2fe07b['setChangeGroupState'](_0x221918['index'],'outdated',this['_getOutdatedReason'](_0x1e6609)),null;const {range:_0x514c96,currentIndex:_0x4c2164}=_0x382381;return'$graveyard'==_0x514c96['root']['rootName']?(_0x2fe07b['setChangeGroupState'](_0x4c2164,'outdated',this['_getOutdatedReason'](_0x1e6609)),null):_0x382381['range'];}_getDocumentRangeForReplyChanges(_0x3cd6fb,_0x43f1fd){const {reply:_0x5138d5,interaction:_0x3c2cf3}=this['getInteractionAndReplyById'](_0x3cd6fb),_0xa583f1=_0x5138d5['changeGroups']['filter'](_0x444ce5=>'pending'==_0x444ce5['state']),_0x218504=_0xa583f1['map'](_0x2c4318=>_0x5138d5['changeGroups']['indexOf'](_0x2c4318));void 0x0===_0x43f1fd&&(_0x43f1fd=_0x218504[0x0]);const _0x57f4f1=_0x218504['indexOf'](_0x43f1fd);if(-0x1==_0x57f4f1)return null;const _0x5ca572=_0xa583f1[_0x57f4f1],_0x281d24=_0x5ca572['editor'];if(!_0x281d24||'destroyed'===_0x281d24['state'])return null;const _0x360de5=Ks(_0x281d24,_0x5ca572['rootName']),_0x2bc343=_0x5138d5['documentContextContent']['get'](_0x5ca572['documentId']),_0x18790e=new _0x56ff8a([]),_0x169f67=new _0x56ff8a([]);for(const _0x57967a of _0x5ca572['changes'])if('removed'!=_0x57967a['type']&&_0x169f67['children']['push'](_0x57967a['node']['cloneNode'](!0x0)),'new'!=_0x57967a['type']){const _0x27ad7d=_0x2bff0b(_0x51e9ff=>Hs(_0x51e9ff,'data-id')==_0x57967a['id'],_0x2bc343,!0x0);_0x18790e['children']['push'](_0x27ad7d['cloneNode'](!0x0));}if(0x0==_0x18790e['children']['length']){if(_0x5ca572['changes'][0x0]['anchorId']){const _0x12bf6e=ys('data-id',_0x5ca572['changes'][0x0]['anchorId'],_0x2bc343);_0x18790e['children']['unshift'](_0x12bf6e['cloneNode'](!0x0)),_0x169f67['children']['unshift'](_0x12bf6e['cloneNode'](!0x0)),_0x12bf6e['nextSibling']&&(_0x18790e['children']['push'](_0x12bf6e['nextSibling']['cloneNode'](!0x0)),_0x169f67['children']['push'](_0x12bf6e['nextSibling']['cloneNode'](!0x0)));}else{const _0x1bae31=_0x2bc343['children'][0x0];if(!_0x1bae31)return null;_0x18790e['children']['push'](_0x1bae31['cloneNode'](!0x0)),_0x169f67['children']['push'](_0x1bae31['cloneNode'](!0x0));}}if(_0x360de5&&Xs(_0x5138d5['changeGroups'],_0x5138d5['documentContextContent'])['has'](_0x5ca572['index']))return null;const _0x46e6f7=_0x3c2cf3['getDocumentContext'](),_0x4f8d87=_0x46e6f7['documents']['find'](_0x3d9883=>_0x3d9883['id']==_0x5ca572['documentId'])['content'],_0x2bb88e=_0x281d24['model']['document']['getRoot'](_0x5ca572['rootName']),_0x11c0d0=_0x281d24['data']['parse'](_0x4f8d87,_0x2bb88e),_0x2f9f77=_0x360de5?$s(ks(_0x18790e)):ks(_0x18790e),_0x1dd660=_0x281d24['data']['parse'](_0x2f9f77,_0x2bb88e),_0x36fd49=_0x281d24['data']['parse'](_0x2f9f77,_0x2bb88e),_0x566b14=_0x281d24['model']['createPositionAt'](_0x1dd660,0x0),_0x32ca9f=_0x360de5?$s(ks(_0x169f67)):ks(_0x169f67),_0x399a00={'targetEditor':_0x281d24,'anchor':_0x566b14,'markDeletions':!0x1};let _0xdb1337;try{_0xdb1337=_0x281d24['plugins']['get'](_0xc19772)['getDiff'](_0x2f9f77,_0x32ca9f,_0x399a00)['getOperations']();}catch(_0x3cabee){return this['_reporter']['reportError'](new xn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x3cabee,'context':{'replyId':_0x3cd6fb,'partIndex':_0x43f1fd}})),null;}if(!_0xdb1337['length'])return null;_0x281d24['model']['change'](_0x42d8f9=>{for(const _0x19d19f of _0xdb1337)if(!_0x48583f(_0x19d19f)){if('remove'==_0x19d19f['type']){const _0x1e5337=_0x19d19f['sourcePosition'],_0x52242a=_0x19d19f['howMany'],_0x36cee1=new _0x4a9b8c(_0x1e5337,_0x52242a);_0x42d8f9['batch']['addOperation'](_0x36cee1),_0x281d24['model']['applyOperation'](_0x36cee1);}else'marker'!==_0x19d19f['type']&&(_0x19d19f['baseVersion']=null,_0x19d19f['isDocumentOperation']=!0x1,_0x42d8f9['batch']['addOperation'](_0x19d19f),_0x281d24['model']['applyOperation'](_0x19d19f));}});const _0x148ec1=An(_0x281d24,_0xdb1337,_0x1dd660);pn(_0x281d24['model'],_0x148ec1);const _0x21ccf8=_0x148ec1['getFirstRange']()['start']['path']['slice'](),_0x1e9650=_0x148ec1['getFirstRange']()['end']['path']['slice'](),_0x12324a=[];let _0x320272=_0x1dd660,_0x18b673=_0x36fd49;for(let _0xb97a8a=0x0;_0xb97a8a<_0x1e9650['length'];_0xb97a8a++){const _0x5cbe95=_0x320272['maxOffset']-_0x1e9650[_0xb97a8a];_0x12324a[_0xb97a8a]=_0x18b673['maxOffset']-_0x5cbe95,_0x320272=_0x320272['getChildAtOffset'](_0x1e9650[_0xb97a8a]),_0x18b673=_0x18b673['getChildAtOffset'](_0x12324a[_0xb97a8a]);}const _0x3057e5=_0x281d24['model']['createRange'](_0x281d24['model']['createPositionFromPath'](_0x36fd49,_0x21ccf8),_0x281d24['model']['createPositionFromPath'](_0x36fd49,_0x12324a)),_0x46938b=_0x3057e5['start']['path']['slice'](),_0x373820=_0x3057e5['end']['path']['slice']();if(!_0x360de5){const _0x38f118=_0x36fd49['getChild'](0x0)['getAttribute'](_0x3ebabe),_0x168293=Array['from'](_0x11c0d0['getChildren']())['find'](_0x5905b4=>_0x5905b4['getAttribute'](_0x3ebabe)==_0x38f118)['getPath']();_0x46938b[0x0]=_0x168293[0x0]+_0x46938b[0x0],_0x373820[0x0]=_0x168293[0x0]+_0x373820[0x0];}let _0x31264a=_0x281d24['model']['createRange'](_0x281d24['model']['createPositionFromPath'](_0x281d24['model']['document']['getRoot'](_0x5ca572['rootName']),_0x46938b),_0x281d24['model']['createPositionFromPath'](_0x281d24['model']['document']['getRoot'](_0x5ca572['rootName']),_0x373820));const _0x4ec447=_0x46e6f7['documents']['find'](_0x190c81=>_0x190c81['id']==_0x5ca572['documentId'])['version'],_0x14b82b=_0x281d24['model']['document']['history']['getOperations'](_0x4ec447);for(const _0x670c8f of _0x14b82b)_0x31264a=_0x5a312a['_createFromRanges'](_0x31264a['getTransformedByOperation'](_0x670c8f));return{'range':_0x31264a,'currentIndex':_0x43f1fd,'targetEditor':_0x281d24};}_integrateEditorBalloon(_0x5d3885){if(!_0x5d3885['plugins']['has']('AIChatBalloon'))return;const _0x29be69=_0x5d3885['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x29be69['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x29be69,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x3ddaaa,partIndex:_0x4c17dd}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x1cf789}=this['getInteractionAndReplyById'](_0x3ddaaa),_0x77bf63=_0x1cf789['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x4c17dd});_0x29be69['updateContent']({'part':_0x77bf63[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x29be69,'applySuggestion',()=>{const {replyId:_0x5ebca7,partIndex:_0x5d1f7b}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x5ebca7,'partIndex':_0x5d1f7b}),_0x29be69['setState']('accepted');}),this['listenTo'](_0x29be69,'insertSuggestion',()=>{const {replyId:_0x486eb6,partIndex:_0x486e8e}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x486eb6,'partIndex':_0x486e8e}),_0x29be69['setState']('accepted');}),this['listenTo'](_0x29be69,'rejectSuggestion',()=>{const {replyId:_0x23dea2,partIndex:_0x56b1e9}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x23dea2,'partIndex':_0x56b1e9}),_0x29be69['setState']('rejected');}),this['listenTo'](_0x29be69,'showNext',()=>{const {replyId:_0x411b7c,partIndex:_0x2e6ede}=this['_currentPreviewedChangeGroup'],_0x5c428a=this['_getPresentableSiblingContentPartIndex'](_0x411b7c,_0x2e6ede,'next');null!==_0x5c428a&&this['_openBalloonFor'](_0x411b7c,_0x5c428a);}),this['listenTo'](_0x29be69,'showPrevious',()=>{const {replyId:_0x191141,partIndex:_0x258912}=this['_currentPreviewedChangeGroup'],_0x29b125=this['_getPresentableSiblingContentPartIndex'](_0x191141,_0x258912,'previous');null!==_0x29b125&&this['_openBalloonFor'](_0x191141,_0x29b125);}),this['listenTo'](_0x29be69,'dialogClosed',(_0x3cb906,{id:_0x504620})=>{if('aiChatBalloon'!==_0x504620)return;const {replyId:_0x24340a,partIndex:_0x33038b}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x24340a,'index':_0x33038b,'isActive':!0x1}),this['_activeBalloon']===_0x29be69&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x4f3b52){if(this['_channelsToEditors']['set'](_0x4f3b52['config']['get']('collaboration.channelId'),_0x4f3b52),this['_integrateEditorBalloon'](_0x4f3b52),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x4f3b52,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x4f3b52['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x4f3b52['plugins']['has']('Undo')){const _0x5c40df=_0x4f3b52['commands']['get']('undo'),_0xac5b92=_0x4f3b52['commands']['get']('redo');this['listenTo'](_0x5c40df,'revert',(_0xc3a80b,_0x1cff9d,_0x59e0ed)=>{const _0x157cff=this['_batchToChanges']['get'](_0x1cff9d);if(!_0x157cff)return;const _0x5d8653=this['activeConversation']['getInteraction'](_0x157cff['interactionId']),_0x5053d0=_0x5d8653?.['getReply'](_0x157cff['replyId']);this['_batchToChanges']['delete'](_0x1cff9d),_0x5d8653&&_0x5053d0&&(_0x157cff['indexes']['forEach'](_0xe2562f=>_0x5053d0['setChangeGroupState'](_0xe2562f,'pending')),this['_batchToChanges']['set'](_0x59e0ed,_0x157cff));}),this['listenTo'](_0xac5b92,'revert',(_0x459d65,_0xd88c78,_0x57ad4a)=>{const _0x16ffce=this['_batchToChanges']['get'](_0xd88c78);if(!_0x16ffce)return;const _0x40c5d3=this['activeConversation']['getInteraction'](_0x16ffce['interactionId']),_0x6b346=_0x40c5d3?.['getReply'](_0x16ffce['replyId']);this['_batchToChanges']['delete'](_0xd88c78),_0x40c5d3&&_0x6b346&&(_0x16ffce['indexes']['forEach'](_0x4899d7=>_0x6b346['setChangeGroupState'](_0x4899d7,'accepted')),this['_batchToChanges']['set'](_0x57ad4a,_0x16ffce));});}const _0x2d926c=_0x4f3b52['config']['get']('ai.chat.context');_0x2d926c['alwaysAddSelection']&&_0x2d926c['document']['enabled']&&this['listenTo'](_0x4f3b52['model']['document']['selection'],'change:range',(_0x17aac6,_0x4e13a1)=>{_0x4e13a1['directChange']&&'chat'===_0x4f3b52['plugins']['get']('AITabs')['view']['activeTab']&&(_0x4f3b52['model']['hasContent'](_0x4f3b52['model']['document']['selection'])?this['addSelectionToChatContext'](_0x4f3b52):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x49a312=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x29789f=await _0x49a312['getConversations']();return _0x29789f['length']?_0x29789f[0x0]['id']:'new';}catch(_0x3bfdf3){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':Nt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x3bfdf3})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x216b20={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x216b20),_0x216b20['id']||this['set']('isConversationReady',!0x0);}catch(_0x11d120){this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x216b20['id']||Nt()}),this['_reporter']['logError'](_0x11d120),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x1d026e,modelId:_0x5355ca,contexts:_0x271ce0}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x1dbd88=_0x5355ca;_0x1dbd88||(_0x1d026e||!this['activeConversation']?_0x1dbd88=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x1dbd88=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x551ea0=this['getGroupId'](),_0x4f40df=_0x1d026e||Nt(),_0x32bce0=await this['_aiModels']['getAvailableModels']();let _0x5b3416;this['activeConversation']=new Zn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x1dbd88,'conversationId':_0x4f40df,'group':_0x551ea0,'locale':this['context']['locale'],'isFromHistory':!!_0x1d026e,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x271ce0,'getSessionId':_0x155f70=>this['_aiEditing']['getSessionId'](_0x155f70),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x32bce0}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x1d026e||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x3dd75f,_0xaadc18)=>{this['_aiChatUi']['setIsUploadInProgress'](_0xaadc18['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x2f1732=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x2f1732);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x13637f=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x13637f);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x353a69,_0x8addfb)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x8addfb,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x24e7e8,_0x1c880a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x1c880a,{'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',(_0x3dcf3d,_0x277f9b)=>{this['_aiChatUi']['removeFeedInteraction'](_0x277f9b['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x1955f6,_0x15899f,_0x153b42)=>{this['_updateConversationTitle'](_0x15899f,_0x153b42);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x11637e,_0xd858fd)=>{void 0x0!==_0x5b3416&&_0x5b3416!==_0xd858fd['id']&&this['_updateReplyContentThrottled']['flush'](),_0x5b3416=_0xd858fd['id'],_0xd858fd['isFromHistory']?await this['_updateReplyContent']({'reply':_0xd858fd}):await this['_updateReplyContentThrottled']({'reply':_0xd858fd});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x1c0fd0,{reply:_0x59d386,index:_0x13abd2,state:_0x131e09,outdatedReason:_0x43a7b5})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x59d386['id'],'index':_0x13abd2,'state':_0x131e09,'outdatedReason':_0x43a7b5}),this['_aiChatUi']['hasFeedItem'](_0x59d386['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x59d386['id'],this['_computeSuggestionGating'](_0x59d386)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x59d386['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x13abd2&&this['_activeBalloon']?.['setState'](_0x131e09,_0x43a7b5);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x134c47,_0x43728e)=>{if(this['_aiChatUi']['addContextItem'](_0x43728e['contextItem'],_0x43728e['isLoading']),'selection'===_0x43728e['contextItem']['type']){const _0x5b423e=Os(this['context']),_0x15877f=[..._0x5b423e['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x5b423e,'ranges':_0x15877f,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x5e62ad,_0x3fc1fa)=>{this['_aiChatUi']['removeContextItem'](_0x3fc1fa['uiId']),'current-document'==_0x3fc1fa['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x3fc1fa['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x2dc816,_0x107a18)=>{this['_aiChatUi']['setContextItemLoading'](_0x107a18['contextItem']['uiId'],_0x107a18['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x36e4a5,_0x436604)=>{this['_aiChatUi']['setConversationContext'](_0x436604['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x541903,_0x481275)=>{this['_aiChatUi']['setAddContextOptions'](_0x481275['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x3bd822,_0x163955)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x163955['sourceId'],_0x163955['source'],_0x163955['resources'],_0x163955['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x4e9b51,_0x3eb6f8)=>{this['_aiChatUi']['updateResourceState'](_0x3eb6f8['sourceId'],_0x3eb6f8['resourceId'],_0x3eb6f8['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x39f935,_0x4adfba)=>{this['_aiChatUi']['updateCapabilities'](_0x4adfba);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x459391,_0x1505d1)=>{this['_aiChatUi']['setSelectedModel'](_0x1505d1['selectedModel']??null,_0x1505d1['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x34a58b,{error:_0x1d00e1,interactionId:_0x26e74d,fileName:_0xe5169a,url:_0x5087e2,sourceId:_0x17b81a,sourceLabel:_0x280f52})=>{let _0x9857fe;const _0x4bbf29=_0x26e74d?_0x26e74d+':'+Nt():Nt();this['_reporter']['reportError'](_0x1d00e1),this['_aiChatUi']['startAutoScroll'](),_0x1d00e1['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x9857fe=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Ts(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x4bbf29})):_0x1d00e1['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1d00e1['message']['startsWith']('ai-chat-conversation-start-failed')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-file-upload-failed')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0xe5169a),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-url-upload-failed')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x5087e2),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-invalid-data')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-unsupported-type')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x17b81a&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x17b81a),_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x280f52||'source'),'id':_0x4bbf29})):_0x1d00e1['message']['startsWith']('ai-chat-resource-load-failed')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-invalid-request')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-file-too-large')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x4bbf29}):_0x1d00e1['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x4bbf29}):(this['_cancelProcessing'](),_0x9857fe=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x4bbf29}));try{await Promise['race']([_0x9857fe,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x1d026e||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x259600=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x259600,'sources':[..._0x259600?.['sources']??[],this['_contextLibrarySource']]}:_0x259600;}async _setUpContextLibrarySource(){const _0x48f588=await this['_createContextLibrarySource']();_0x48f588&&(this['_contextLibrarySource']=_0x48f588,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x48f588));}async _createContextLibrarySource(){let _0x30da65;try{_0x30da65=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x30da65['length'])return null;const _0x3114e5=_0x30da65['map'](_0x469ef3=>({'id':_0x469ef3['id'],'type':'context','label':_0x469ef3['name']||_0x469ef3['id']}));return{'id':'ck-ai-context-library','label':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x3114e5)};}_removeFromContext(_0x3552b6){this['activeConversation']?.['removeFromContext'](_0x3552b6);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x50c447){const [_0x2a361b,_0x4c1925]=_0x50c447['split'](':'),_0x4a7704=this['activeConversation']['getInteraction'](_0x2a361b);return{'interaction':_0x4a7704,'reply':_0x4a7704['getReply'](_0x4c1925)};}_scrollToSuggestionRange(_0x48f637,_0x2f8fa3=!0x1,_0x4dbe9f){const _0x2e4f36={'target':_0x4dbe9f['editing']['view']['domConverter']['viewRangeToDom'](_0x4dbe9f['editing']['mapper']['toViewRange'](_0x48f637)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x2f8fa3};_0x2f8fa3&&(_0x2e4f36['alignToTop']=!0x0),kt(_0x2e4f36);}_updateConversationTitle(_0x225c62,_0x2cd802=!0x1){this['_aiChatUi']['setConversationTitle'](_0x225c62||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x2cd802);}_addFeedItemReply(_0x521580){'text'===_0x521580['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x521580):this['_aiChatUi']['addFeedItemAISuggestion'](_0x521580);}async _updateReplyContent({reply:_0x52be7f,renderingStrategy:_0x3eb9f7}){const {id:_0x4b0018,interactionId:_0x211c0a,isDone:_0x36a257,type:_0x23fa42,parsedContent:_0x28062f}=_0x52be7f,_0x3f342f=_0x211c0a+':'+_0x4b0018;if('modification'===_0x23fa42){const _0x4de8a1=_0x52be7f['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3f342f,'parts':_0x4de8a1,'isDone':_0x36a257,'skipLoadingEffects':_0x52be7f['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x52be7f['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x52be7f['id'],this['_computeSuggestionGating'](_0x52be7f));}else'text'===_0x23fa42&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x3f342f,'parsedContent':_0x28062f['get']('text'),'renderingStrategy':_0x3eb9f7,'isDone':_0x36a257});_0x36a257&&_0x52be7f['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x3f342f,_0x52be7f['sources']);}_updateReplyContentThrottled=_0x147a08(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x1dbbb8=this['activeConversation']?.['lastInteraction'];if(_0x1dbbb8){for await(const _0x3c86e6 of _0x1dbbb8['replies'])this['_aiChatUi']['hasFeedItem'](_0x3c86e6['id'])||this['_addFeedItemReply'](_0x3c86e6),await this['_updateReplyContent']({'reply':_0x3c86e6,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x28554d){const _0xb5842a={'positiveCount':_0x28554d['changeGroups']['filter'](_0x335a3c=>'accepted'===_0x335a3c['state'])['length'],'totalCount':_0x28554d['changeGroups']['length'],'modificationId':_0x28554d['id']},_0x25ef49=this['activeConversation']['getInteraction'](_0x28554d['interactionId'])['messageId'];_0x25ef49&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x25ef49,_0xb5842a);}_getAIChatFeedAPI(_0x120153){const _0x2a4f0e=this['_aiChatUi'],_0x23e24a=()=>{_0x120153['resetWebSearchState'](),_0x120153['resetReasoningState'](),_0x2a4f0e['clearLoadingMessage']();},_0x58e09a=()=>{_0x120153['currentReply']&&(_0x120153['currentReply']['done'](),_0x120153['currentReply']=void 0x0);};return{'insertTextReply':(_0x29f729,_0x26f933)=>{_0x58e09a(),_0x23e24a();const _0x75d86a=_0x120153['currentReply']=_0x120153['createReply']({'type':'text','interactionId':_0x120153['id'],'id':_0x26f933||Nt(),'channelsToEditors':this['_channelsToEditors']});return _0x75d86a['appendContent'](_0x29f729),_0x58e09a(),_0x75d86a;},'insertCustomElement':async(_0x55f567,_0x1227f)=>(_0x58e09a(),_0x23e24a(),_0x2a4f0e['addFeedItemCustomElement'](_0x55f567,_0x1227f||Nt())),'setLoadingMessage':_0x5ae18c=>{_0x2a4f0e['setLoadingMessage'](_0x5ae18c);},'clearLoadingMessage':()=>{_0x2a4f0e['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){Rs(this['context'])['find'](_0x2607b8=>'destroyed'!==_0x2607b8['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const nr=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],rr=[...nr,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function or(_0xabc43f){const _0x5642fe=new AbortController();return{'promise':new Promise((_0x4bc509,_0x555af8)=>{const _0x5ad171=setTimeout(_0x4bc509,_0xabc43f);_0x5642fe['signal']['addEventListener']('abort',()=>{clearTimeout(_0x5ad171),_0x555af8();});}),'abortController':_0x5642fe};}var ar=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x1d3aad){this['options']={'delay':_0x1d3aad?.['delay']??0xa,'textNodeStyle':_0x1d3aad?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x3954d8,targetElement:_0x4e0f79,abortSignal:_0x1c86f2}){this['isStreaming']&&this['stop'](),_0x1c86f2?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x355d5c(_0x3954d8,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x2f55ba=0x0;_0x2f55ba<this['currentIndex'];_0x2f55ba++)this['nodesList'][_0x2f55ba]['shouldBeStreamed']=!0x0;do{const _0x3abd73=Date['now'](),_0x5c6ca1=this['nodesList'][this['currentIndex']],_0x37648a=_0x3abd73-this['lastUpdateTime'];if(_0x5c6ca1){_0x5c6ca1['shouldBeStreamed']=!0x0;let _0xe474fc=_0x5c6ca1['parent'];for(;_0xe474fc;)_0xe474fc['shouldBeStreamed']=!0x0,_0xe474fc=_0xe474fc['parent'];}if(_0x37648a<this['options']['delay'])try{const {promise:_0x2a8715,abortController:_0x117134}=or(this['options']['delay']-_0x37648a);this['timeoutAbortController']=_0x117134,await _0x2a8715;}catch(_0x12cb75){return;}_0x357904(_0x4e0f79,'<'+_0x4e0f79['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x4e0f79['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:_0x3e517f}){Array['from'](_0x3e517f['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x28c713=>{_0x28c713['replaceWith'](_0x28c713['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x2d8a35){let _0x4a4559='';if(function(_0x4eaa8d){return _0x36d647(_0x4eaa8d);}(_0x2d8a35)){for(const _0x5f2e51 of _0x2d8a35['children'])_0x4a4559+=this['renderNode'](_0x5f2e51);}else{if(lr(_0x2d8a35)){if(!_0x2d8a35['shouldBeStreamed'])return'';const _0x29a8cc=_0x2d8a35,_0x16d093=Object['entries'](_0x29a8cc['attribs'])['map'](([_0x38b970,_0x5ca490])=>_0x38b970+'=\x22'+_0x5ca490+'\x22')['join']('\x20');_0x4a4559+='<'+_0x29a8cc['tagName']+(_0x16d093?'\x20'+_0x16d093:'')+'>';for(const _0x162d6b of _0x546497(_0x29a8cc))_0x4a4559+=this['renderNode'](_0x162d6b);_0x4a4559+='</'+_0x29a8cc['tagName']+'>';}else{if(!cr(_0x2d8a35))return'';if(!_0x2d8a35['shouldBeStreamed'])return'';!function(_0x99e1a4){return!(!_0x99e1a4['parent']||!lr(_0x99e1a4['parent']))&&(!!hr['includes'](_0x99e1a4['parent']['tagName'])&&!_0x3bd5ab(_0x99e1a4)['match'](/^\s*[<>]\s*$/));}(_0x2d8a35)?_0x4a4559+=_0x54291f(_0x2d8a35):_0x4a4559+=_0x54291f(new _0x28af91('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x2d8a35]));}}return _0x4a4559;}getParsedDocumentNodeList(){const _0x4d8f56=[];return function(_0x2a2f11,_0xf99784){const _0x230224=_0x68d25c=>{if(_0xf99784(_0x68d25c),_0x68d25c instanceof _0x2eddce)for(let _0x5e5d2f=0x0;_0x5e5d2f<_0x68d25c['children']['length'];_0x5e5d2f++){const _0x2b7e13=_0x68d25c['children'][_0x5e5d2f];_0x230224(_0x2b7e13);}};for(let _0x5d5268=0x0;_0x5d5268<_0x2a2f11['children']['length'];_0x5d5268++)_0x230224(_0x2a2f11['children'][_0x5d5268]);}(this['document'],_0x219be7=>{if(cr(_0x219be7)){const _0x317d31=this['splitTextNodeIntoWordNodes'](_0x219be7);_0x317d31['length']&&_0x4d8f56['push'](..._0x317d31);}_0x219be7['isWordSplitSource']||_0x219be7['isWordSplitResult']||_0x4d8f56['push'](_0x219be7);}),_0x4d8f56;}splitTextNodeIntoWordNodes(_0x6a59eb){if(_0x6a59eb['isWordSplitSource']||_0x6a59eb['isWordSplitResult'])return[];const _0x26f83c=_0x3bd5ab(_0x6a59eb)['match'](/(?:\s*\S+\s*)/g),_0x2d4796=[];if(_0x26f83c&&_0x26f83c['length']>0x1){for(const _0x30c8af of _0x26f83c){const _0x8fb71b=new _0x2e8b1a(_0x30c8af);_0x8fb71b['isWordSplitResult']=!0x0,_0xed3d66(_0x6a59eb,_0x8fb71b),_0x2d4796['push'](_0x8fb71b);}_0x6a59eb['isWordSplitSource']=!0x0,_0x539e1a(_0x6a59eb);}return _0x2d4796;}};const hr=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function cr(_0x7db059){return _0x8b9a17(_0x7db059);}function lr(_0x11b0ad){return _0x5431e6(_0x11b0ad);}function ur(_0x3374c6,_0x43333d){_0x3374c6['cleanUpAnimations']({'targetElement':_0x43333d}),_0x43333d['querySelectorAll']('[data-id]')['forEach'](_0x247af0=>{_0x247af0['removeAttribute']('data-id');});}var dr=class extends _0x20e82c{options;content='';htmlStreamer;['children'];constructor(_0x25b319){super();const _0xd10711=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new ar(),this['options']=_0x25b319,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0xd10711['if']('isDone','ck-ai-chat__feed__item_done'),_0xd10711['if']('isVisible','ck-hidden',_0x5caa7b=>!_0x5caa7b),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){ur(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x4a13ae,_0x4bd812,_0x36b8cb){await this['htmlStreamer']['stream']({'document':_0x4a13ae,'targetElement':_0x4bd812,'abortSignal':_0x36b8cb});}},_r=class extends _0x20e82c{['showChangesToggleView'];constructor(_0x4c13f3,_0xb80880){super(_0x4c13f3),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new gr(_0x4c13f3),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Mn,'label':Ts(_0x4c13f3,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xb80880['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x198ccc=>_0x198ccc?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x44797e=new Qt();_0x44797e['content']=_0x2f3b78,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xb80880['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x44797e,{'tag':'span','children':[Ts(_0x4c13f3,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},gr=class extends Vt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Ar={'accepted':_0x8456a1,'rejected':_0x566e32,'outdated':_0x11df23};var Ir=class extends _0x20e82c{statePillView;constructor(_0x2f1dab){super(_0x2f1dab);const _0x285d3e=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x5b20b6(_0x2f1dab),this['statePillView']['bind']('label')['to'](this,'state',_0xe8d38=>function(_0x3f951b,_0x40f235){return Ts(_0x3f951b,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x40f235['toUpperCase']());}(_0x2f1dab,_0xe8d38)),this['statePillView']['bind']('icon')['to'](this,'state',_0x525da2=>Ar[_0x525da2]),this['statePillView']['bind']('class')['to'](this,'state',_0x56e796=>'ck-pill_'+_0x56e796),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x619818,_0x1bfbb4)=>function(_0x3f2334,_0x1ea7ed,_0x581187){if('outdated'!==_0x1ea7ed)return;return Ts(_0x3f2334,_0x581187?pr[_0x581187]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x2f1dab,_0x619818,_0x1bfbb4)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x285d3e['if']('isVisible','ck-hidden',_0x10b63c=>!_0x10b63c)]},'children':[this['statePillView']]});}setState(_0x4ec33b,_0x4809d0){this['state']=_0x4ec33b,this['outdatedReason']='outdated'===_0x4ec33b?_0x4809d0:void 0x0;}};const pr={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Er=class extends _0x5b0bf4{_applyButton;_suggestButton;constructor(_0x4f5502,_0x4f2485,_0x4193d6){super(_0x4f5502);const _0xb7d39d=Boolean(_0x4193d6);this['set']('isEnabled',!_0xb7d39d),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x2c71de=[];if(!_0xb7d39d){_0x4f2485['includes']('applySuggestion')&&(this['_applyButton']=new Vt(_0x4f5502),this['_applyButton']['set']({'label':Ts(_0x4f5502,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xf297ae}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x97ab3a,_0x346a8b)=>_0x97ab3a&&!_0x346a8b),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x140a99=>!_0x140a99),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x2c71de['push'](this['_applyButton'])),_0x4f2485['includes']('insertSuggestion')&&(this['_suggestButton']=new Vt(_0x4f5502),this['_suggestButton']['set']({'label':Ts(_0x4f5502,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2f52f1}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x3dcedd,_0x2ed809)=>_0x3dcedd&&!_0x2ed809),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x2c71de['push'](this['_suggestButton']));const _0x6e7de=new Vt(_0x4f5502);_0x6e7de['set']({'label':Ts(_0x4f5502,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x34cc7e}),_0x6e7de['bind']('isEnabled')['to'](this),_0x6e7de['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x2c71de['push'](_0x6e7de);}this['items']['addMany'](_0x2c71de);const _0x34339e=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x34339e['if']('isVisible','ck-hidden',_0x4a3e2e=>!_0x4a3e2e)]}});}setButtonsVisibility({showApplyButton:_0x132f08,showSuggestButton:_0x4b7983}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x132f08),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x4b7983);}},mr=class extends _0x20e82c{toolbarView;stateView;titleLabelView;['children'];constructor(_0x15eb57,{part:_0x4401cf,uiIndex:_0x37489d,availableActions:_0xec924a,areActionsDisabled:_0x7e3495}){super(_0x15eb57),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Er(_0x15eb57,_0xec924a,_0x7e3495),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x4401cf['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x4401cf['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x4401cf['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new Ir(_0x15eb57),this['titleLabelView']=new Tr(_0x15eb57,_0x37489d),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',(_0x56dd09,_0x20915d,_0x1213f4,_0x46eced)=>{'pending'===_0x46eced?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x1213f4?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x1213f4,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Tr=class extends _0x20e82c{constructor(_0x403d2a,_0x1a2ea6){super(_0x403d2a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Ts(_0x403d2a,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x1a2ea6['toString']())]});}},wr=class extends _0x20e82c{htmlStreamer;constructor(_0x3365bb){super(_0x3365bb),this['htmlStreamer']=new ar(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x516b21,renderingStrategy:_0x312bc4,abortSignal:_0xef964a}){this['_ensureHostElementTag'](_0x516b21['wrapperTag']||'div');const _0x45fdb7=_0x355d5c(_0x516b21['content'],!0x0);for(const _0x3e1f98 of xs(_0x45fdb7))_0x539e1a(_0x3e1f98);'streaming'===_0x312bc4?await this['htmlStreamer']['stream']({'document':_0x45fdb7,'targetElement':this['element'],'abortSignal':_0xef964a}):_0x357904(this['element'],'<'+this['element']['tagName']+'>'+ks(_0x45fdb7)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){ur(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x54c035){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x54c035)return;const _0x1c252d=new _0x5a9c07({'tag':_0x54c035,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x1c252d),this['element']=_0x1c252d;}},Cr=class extends _0x20e82c{['_children'];['_headerView'];_streamableContentView;constructor(_0x3e93d0,{part:_0x5404a2,uiIndex:_0x4ef6a5,areActionsDisabled:_0x1a75a8,availableActions:_0xef65ef}){super(_0x3e93d0);const _0x47aef4=this['bindTemplate'];this['set']('state',_0x5404a2['state']),this['set']('outdatedReason',_0x5404a2['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0x1a45d7=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x1a75a8;};this['on']('change:state',_0x1a45d7),this['on']('change:isDone',_0x1a45d7),_0x1a45d7(),this['_children']=this['createCollection'](),this['_headerView']=new mr(_0x3e93d0,{'part':_0x5404a2,'uiIndex':_0x4ef6a5,'availableActions':_0xef65ef,'areActionsDisabled':_0x1a75a8}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...nr)['to'](this),this['_streamableContentView']=new wr(_0x3e93d0),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x47aef4['to']('state',_0x112a42=>'ck-ai-suggestion__body__content-part_'+_0x112a42),_0x47aef4['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x47aef4['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x47aef4['if']('isVisible','ck-hidden',_0x5de64c=>!_0x5de64c)]},'children':this['_children'],'on':{'mouseenter':_0x47aef4['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x5404a2['index']});}),'mouseleave':_0x47aef4['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x5404a2['index']});}),'click':_0x47aef4['to'](_0x17f571=>{const _0x179395=_0x17f571['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x179395)&&this['fire']('showChangeInText',{'index':_0x5404a2['index']});})}});}async updateContent({part:_0x2186db,showUnchangedParts:_0x3fd406=!0x1,abortSignal:_0x2130dd}){this['partDefinition']=_0x2186db,this['isVisible']=this['partDefinition']['hasChanges']||_0x3fd406,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x2186db,'renderingStrategy':'static','abortSignal':_0x2130dd});}['markAsDone'](){this['isDone']=!0x0;}},fr=class extends _0x20e82c{constructor(_0xced94f,_0x6305e){super(_0xced94f),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x35970f=>!_0x35970f)]},'children':this['_createSkeletonItems'](_0x6305e)});}_createSkeletonItems(_0x5bf68e){const _0x518af4=['ck','ck-ai-skeleton__item'];return _0x5bf68e['map'](_0x46c1aa=>{let _0x23b61c='';switch(_0x46c1aa['attributes']['align']){case'right':_0x23b61c='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x23b61c='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x23b61c='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x46c1aa['tag'],'attributes':{'class':[..._0x518af4,_0x46c1aa['attributes']['class']?_0x46c1aa['attributes']['class']:''],'style':'width:\x20'+_0x46c1aa['attributes']['width']+';\x20height:\x20'+_0x46c1aa['attributes']['height']+';'+_0x23b61c}};});}};const br={'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':Sr(0x5,'100%','44px','right'),'aiChatResources':Sr(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 Sr(_0x1dfed6,_0x229192,_0x11efd0,_0x5123f8){return new Array(_0x1dfed6)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x229192,'height':_0x11efd0,'align':_0x5123f8}}));}const Rr=/* #__PURE__ -- @preserve */
|
|
33
|
+
dt();var Or=class extends Rr{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x5e9317){const _0x59b550=this['createTask'](_0x5e9317);return this['queue']['push'](_0x59b550),this['_processQueue'](),_0x59b550['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(_0x50bf16=>{this['once']('_queueEmpty',()=>{_0x50bf16();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x578537=this['queue']['shift']();try{await _0x578537['callback'](this['_abortController']['signal']),_0x578537['resolve']();}catch(_0xc06adf){_0x578537['reject'](_0xc06adf);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x592d71){let _0x47221f,_0x3c008e;const _0x2fb020=new Promise((_0x4caa3d,_0x46a885)=>{_0x47221f=_0x4caa3d,_0x3c008e=_0x46a885;});return{'callback':_0x592d71,'resolve':_0x47221f,'reject':_0x3c008e,'completePromise':_0x2fb020};}},vr=class extends dr{constructor(_0x12c8a5){super(_0x12c8a5),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x12c8a5['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x1e1c97){this['element']['innerHTML']=_0x1e1c97;}};const kr=['applySuggestion','insertSuggestion'];var yr=class extends _0x20e82c{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x8e9c24,_0xfb3a1f=[...kr],_0x22edc2){super(_0x8e9c24);const _0x3f8bf6=this['bindTemplate'],_0x54508d=Boolean(_0x22edc2);this['set']('isEnabled',!_0x54508d),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x54508d||(this['_applyChangesButton']=new Vt(_0x8e9c24),this['_applyChangesButton']['set']({'label':Ts(_0x8e9c24,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0xfb3a1f['includes']('applySuggestion'),'class':Dn}),this['_insertSuggestionsButton']=new Vt(_0x8e9c24),this['_insertSuggestionsButton']['set']({'label':Ts(_0x8e9c24,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0xfb3a1f['includes']('insertSuggestion'),'class':Hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x470b75=>{_0x470b75['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',_0x3f8bf6['if']('isVisible','ck-hidden',_0xa0258f=>!_0xa0258f)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x2661e1){this['isVisible']=_0x2661e1;}_switchButtonLabelsPlurality(_0x4ce013){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x4ce013?(this['_applyChangesButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},Nr=class extends _0x20e82c{['children'];['balloonPanelView'];bodyCollection;constructor(_0xfdaccc,_0x32e301){super(_0xfdaccc),this['bodyCollection']=_0x32e301,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',_0x4f3131=>!_0x4f3131)]},'children':this['children']});const _0x1124e8=new _0x20e82c(this['locale']),_0x3e56b1=new Qt();_0x3e56b1['content']=ht,_0x1124e8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3e56b1,{'tag':'span','children':[{'text':Ts(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x1124e8),this['_setupBalloonPanel'](_0xfdaccc);}['addSource'](_0x5dd741){this['children']['add'](new xr(this['locale'],_0x5dd741,this['balloonPanelView']));}_setupBalloonPanel(_0x5d5a5c){this['balloonPanelView']=new Pt(_0x5d5a5c),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},xr=class extends Vt{['balloonPanelView'];['source'];constructor(_0x181cf1,_0x38c2e2,_0x54bc4f){super(_0x181cf1),this['source']=_0x38c2e2,this['balloonPanelView']=_0x54bc4f,this['set']({'label':_0x38c2e2['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0xd31269=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0xd31269['to'](()=>{window['open'](_0x38c2e2['url'],'_blank');}),'mouseenter':_0xd31269['to'](()=>{this['_showTooltip']();}),'mouseleave':_0xd31269['to'](()=>{this['_hideTooltip']();})}}),_0x38c2e2['favicon']){const _0x2047a0=new _0x20e82c(_0x181cf1);_0x2047a0['setTemplate']({'tag':'img','attributes':{'src':_0x38c2e2['favicon']||ht,'alt':_0x38c2e2['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x2047a0);}else this['set']('icon',ht);}_createTooltipContentView(_0x56b6e2,_0x28fcc7){const _0x6d0bee=new _0x20e82c(_0x56b6e2),_0x126b41=[];let _0x3ce168;_0x28fcc7?.['favicon']?(_0x3ce168=new _0x20e82c(_0x56b6e2),_0x3ce168['setTemplate']({'tag':'img','attributes':{'src':_0x28fcc7['favicon'],'alt':_0x28fcc7['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3ce168=new Qt(),_0x3ce168['content']=ht,_0x3ce168['extendTemplate']({'attributes':{'alt':_0x28fcc7['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x126b41['push'](_0x3ce168);const _0x46f3a4=new _0x20e82c(_0x56b6e2);_0x46f3a4['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x28fcc7['url']},'children':[{'text':new URL(_0x28fcc7['url'])?.['hostname']}]}),_0x126b41['push'](_0x46f3a4);const _0x985066=new _0x20e82c(_0x56b6e2);_0x985066['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x126b41});const _0xbcd0e8=new _0x20e82c(_0x56b6e2);return _0xbcd0e8['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x28fcc7['title']['length']>0x190?_0x28fcc7['title']['substring'](0x0,0x190)+'...':_0x28fcc7['title']}]}),_0x6d0bee['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x985066,_0xbcd0e8]}),_0x6d0bee;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthWest'],Pt['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 _0x3d3e95=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x3d3e95);}},Lr=class extends _0x20e82c{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x41febd(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x574c3b,_0x30d191){super(_0x574c3b);const {areActionsDisabled:_0x3c2267,showUnchangedParts:_0x570583,availableActions:_0x45c44a}=_0x30d191;this['_areActionsDisabled']=_0x3c2267,this['_showUnchangedParts']=_0x570583,this['_availableActions']=_0x45c44a,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new fr(_0x574c3b,br['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Or(),this['_emptyPartsWarningView']=new vr({'id':'empty-parts-warning','initialContent':Ts(_0x574c3b,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new yr(_0x574c3b,_0x30d191['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new Nr(this['locale'],_0x30d191['bodyCollection']),_0x30d191['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...nr)['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'](_0x1afbd4=>_0x1afbd4 instanceof Cr);}async updateContentParts({parts:_0x4b5157,abortSignal:_0x436798,skipLoadingEffects:_0x2d19c9}){this['_cachedContentParts']['length']?_0x4b5157['forEach'](_0x39d428=>{const _0x8d5616=this['_cachedContentParts']['findIndex'](_0x51179b=>_0x51179b['index']==_0x39d428['index']);-0x1===_0x8d5616?this['_cachedContentParts']['push'](_0x39d428):this['_cachedContentParts'][_0x8d5616]=_0x39d428;}):this['_cachedContentParts']=_0x4b5157;const _0x2f1912=this['_showUnchangedParts']?_0x4b5157:_0x4b5157['filter'](_0x2a985f=>_0x2a985f['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x2f1912['length']>0x1),_0x2d19c9&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x193888 of _0x4b5157)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x48320f=>{let _0x685952=this['getPartView'](_0x193888['index']);if(_0x685952||_0x193888['hasChanges']||this['_showUnchangedParts']){if(!_0x685952){if(_0x685952=new Cr(this['locale'],{'part':_0x193888,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x685952['delegate'](...nr)['to'](this),_0x685952['bind']('isTrackChangesOn')['to'](this),!_0x2d19c9&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x48320f),_0x48320f['aborted']))return;_0x685952['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x193888['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x685952,this['_children']['length']-0x1),_0x2d19c9||this['_showSkeletonDebounced']();}await _0x685952['updateContent']({'part':_0x193888,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x48320f}),_0x685952['markAsDone']();}});return _0x436798?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x24a9ed,_0x560797,_0x205969){const _0x2d2366=this['getPartView'](_0x24a9ed);_0x2d2366&&(_0x2d2366['outdatedReason']=_0x205969,_0x2d2366['state']=_0x560797);}setGating({readOnlyByIndex:_0x7ae779,isAcceptAllEnabled:_0x1068e2}){this['_readOnlyByIndex']=_0x7ae779,this['isAcceptAllEnabled']=_0x1068e2;for(const _0xe67256 of this['_contentPartViews'])_0xe67256['isTargetReadOnly']=_0x7ae779['get'](_0xe67256['partDefinition']['index'])??!0x1;}setPartActive(_0x3f26dd,_0x3c86b1){if(!0x1===_0x3f26dd){for(const _0x516f79 of this['_contentPartViews'])_0x516f79['isActive']=!0x1;}else{const _0x325dfc=this['getPartView'](_0x3f26dd);_0x325dfc&&(_0x325dfc['isActive']=_0x3c86b1);}}updateSources(_0x143aee){_0x143aee['forEach'](_0x358e25=>this['_sourcesView']['addSource'](_0x358e25)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x368505){return this['_contentPartViews']['find'](_0x1755ca=>_0x1755ca['partDefinition']['index']==_0x368505)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x13ed61=!this['_cachedContentParts']['find'](({hasChanges:_0x2efec6})=>_0x2efec6),_0x9f6b04=!!this['_cachedContentParts']['find'](({hasChanges:_0x1053f2})=>!_0x1053f2);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x9f6b04,_0x13ed61?this['_emptyPartsWarningView']['setContent'](Ts(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Ts(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x2e1393=>_0x2e1393['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x3db516){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x1d43c5=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x1d43c5>0x0){const {promise:_0x33f74b,abortController:_0x20a89a}=or(_0x1d43c5);_0x3db516?.['addEventListener']('abort',()=>_0x20a89a['abort']()),await _0x33f74b['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x321d9a=>_0x321d9a['partDefinition']['hasChanges'])['length']>0x0;}},Pr=class extends _0x20e82c{['bodyView'];['children'];['headerView'];constructor(_0x4ca8c6,_0x4e2d94,_0x500a62){super(_0x4ca8c6);const {showDiff:_0xc60161,areActionsDisabled:_0x184b54,showUnchangedParts:_0x15abac,availableActions:_0x103afa}=_0x4e2d94;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new _r(_0x4ca8c6,{'showDiff':_0xc60161}),this['headerView']['on']('toggleShowChanges',(_0x2deca2,_0x2be4b6)=>{this['areChangesVisible']=_0x2be4b6['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x2be4b6['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Lr(_0x4ca8c6,{'areActionsDisabled':_0x184b54,'showUnchangedParts':!!_0x15abac,'availableActions':_0x103afa,'bodyCollection':_0x500a62}),this['bodyView']['delegate'](...nr)['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(_0x3c2a8e){await this['bodyView']['updateContentParts'](_0x3c2a8e);}updateSources(_0x423671){this['bodyView']['updateSources'](_0x423671);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Dr=class extends dr{containerView;constructor(_0x2874bb,_0x18b840,_0x12b0a3){super(_0x18b840),this['set']('isTrackChangesOn',!0x1),this['containerView']=new Pr(_0x2874bb,{'showDiff':_0x18b840['showDiff'],'areActionsDisabled':_0x18b840['areActionsDisabled'],'availableActions':_0x18b840['availableActions']},_0x12b0a3),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x3b85a4,_0xc3ba80)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0xc3ba80['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',(_0x5a68b9,{index:_0x420386})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x420386});}),this['containerView']['on']('applySuggestion',(_0x47c1b4,{index:_0x282483}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x282483});}),this['containerView']['on']('insertSuggestion',(_0x77f38e,{index:_0x546982}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x546982});}),this['containerView']['on']('rejectSuggestion',(_0x2d6466,{index:_0x13a217})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x13a217});}),this['containerView']['on']('mouseOverSuggestion',(_0x22fa51,{index:_0x3b728e})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3b728e});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x2c3bb0,{index:_0x17881a})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x17881a});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x4c8dad){await this['containerView']['updateContent'](_0x4c8dad);}updatePartState(_0x273a57,_0x550f0c,_0x3d72aa){this['containerView']['bodyView']['updatePartState'](_0x273a57,_0x550f0c,_0x3d72aa);}setPartActive(_0x5d6096,_0xd6bc45){!0x1===_0x5d6096?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x5d6096,_0xd6bc45);}updateSources(_0x41aca0){this['containerView']['updateSources'](_0x41aca0);}getPartView(_0x330eb6){return this['containerView']['bodyView']['getPartView'](_0x330eb6);}setGating(_0x2865aa){this['containerView']['bodyView']['setGating'](_0x2865aa);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Hr=class extends dr{replyContainer;_bodyCollection;constructor(_0x3beb33,_0x2239aa,_0x323167){super(_0x2239aa),this['_bodyCollection']=_0x323167,this['locale']=_0x3beb33,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x20e82c(),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':vs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x4982c2,renderingStrategy:_0x26b387,abortSignal:_0x43a0cb}){'streaming'===_0x26b387?await this['streamIntoElement'](_0x4982c2,this['replyContainer']['element'],_0x43a0cb):this['replyContainer']['element']['innerHTML']=_0x54291f(_0x4982c2);}updateSources(_0x1b068c){const _0x581462=new Nr(this['locale'],this['_bodyCollection']);_0x581462['children']['addMany'](_0x1b068c['map'](_0x35b587=>new xr(this['locale'],_0x35b587,_0x581462['balloonPanelView']))),_0x581462['isVisible']=!0x0,this['children']['add'](_0x581462);}},Mr=class extends _0x5ad72d{constructor(_0x253be4=void 0x0){super();const _0x3bd5a8=_0x253be4?'ck-ai-spinner_'+_0x253be4:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x3bd5a8]}});}};const Ur={'file':_0x4bb3b0,'image':_0xb6322a,'document':_0x2f3b78,'web-resource':_0x935068,'text':_0x4bb3b0,'selection':tt,'mcp-tool-context':_0x2f3b78,'context':_0x2f3b78},Vr='ck-ai-chat-context-chip',Br='ck-ai-chat-context-chip_wide',Gr='ck-ai-chat-context-chip_document',Fr='ck-ai-chat-context-chip__label',Kr='ck-ai-chat-context-chip__type-icon',Wr='ck-ai-chat-context-controls__chip-tooltip',Yr='n';var $r=class extends Vt{constructor(_0x5b4df5,_0x4d9fac,_0x41238f,_0x345d63,_0x3ee60d=!0x1){super(_0x5b4df5),this['_isAnimationOnEnterEnabled']=_0x345d63,this['_initializeProperties'](_0x4d9fac,_0x41238f,_0x3ee60d),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(_0x8ff227,_0x3fd135,_0x419d71){this['set']('label',_0x8ff227['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x8ff227['type']),this['set']('id',_0x8ff227['uiId']),this['set']('readonly',_0x3fd135),this['set']('isLoading',_0x419d71);}_setupTemplate(){const _0x2bd227=this['_createIconView'](),_0x3a91e7=this['_createRemoveButton'](),_0x3bd82a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x3bd82a),'children':this['_createTemplateChildren'](_0x2bd227,_0x3a91e7,_0x3bd82a)});}_createTemplateAttributes(_0x38e516){return{'class':[Vr,_0x38e516['if']('itemType',Gr,_0x36a133=>'document'==_0x36a133),_0x38e516['if']('itemType',Br,_0x13500c=>'selection'==_0x13500c)],'data-cke-tooltip-text':_0x38e516['to']('label',qr),'data-cke-tooltip-position':Yr,'data-cke-tooltip-class':Wr};}_createTemplateChildren(_0x383f4f,_0x2ec0da,_0x224f58){const _0x2710e6=this['_createLabelElement'](_0x224f58),_0x1d8542=this['_createLoaderIcon']();return this['readonly']?[_0x383f4f,_0x2710e6]:[_0x383f4f,_0x1d8542,_0x2710e6,_0x2ec0da];}_createLabelElement(_0x17346e){return{'tag':'span','attributes':{'class':Fr},'children':[{'text':_0x17346e['to']('label')}]};}_createRemoveButton(){const _0x3faab4=new Vt(this['locale']);return _0x3faab4['set']({'label':Ts(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x566e32}),this['_setupRemoveButtonEvent'](_0x3faab4),_0x3faab4;}_setupRemoveButtonEvent(_0x333190){_0x333190['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x48f754=this['bindTemplate'],_0xfc4576=new Qt();return _0xfc4576['content']=Ur[this['itemType']],_0xfc4576['extendTemplate']({'attributes':{'class':[Kr,_0x48f754['if']('isLoading','ck-hidden',_0x46ed8e=>_0x46ed8e)]}}),_0xfc4576;}_handleAnimationEndOnce(_0x4436d7,_0x5bb460){if(!_0x4436d7)return;const _0x153b16=()=>{_0x5bb460(),_0x4436d7['removeEventListener']('animationend',_0x153b16),_0x4436d7['removeEventListener']('webkitAnimationEnd',_0x153b16);};_0x4436d7['addEventListener']('animationend',_0x153b16),_0x4436d7['addEventListener']('webkitAnimationEnd',_0x153b16);}_createLoaderIcon(){const _0x5050c4=new Mr('small');return _0x5050c4['bind']('isVisible')['to'](this,'isLoading',_0x1aa6b1=>_0x1aa6b1),_0x5050c4;}};function qr(_0x55618b){if(!_0x55618b)return _0x55618b;if(_0x55618b['length']<=0x78)return _0x55618b;const _0x2a7192=_0x55618b['slice'](0x0,0x78),_0x28ecf4=_0x2a7192['lastIndexOf']('\x20');return(_0x28ecf4>0x0?_0x2a7192['slice'](0x0,_0x28ecf4):_0x2a7192)+'…';}const Qr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Xr='300px';var zr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x3823f1,_0x423c46,_0x7ca19c,_0x1e5668,_0x4e5ca4){this['_locale']=_0x3823f1,this['_visibleChips']=_0x423c46,this['_config']={...Qr,..._0x7ca19c,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x7ca19c['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x1e5668,this['_parentView']=_0x4e5ca4||null;}setContainerElement(_0x4464a5){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x4464a5,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 _0x332a9f=[...this['_visibleChips'],...this['_overflowChips']],_0x2c9b1c=this['_createCalculationContainer'](),_0x2980c5=this['_calculateOverflowInContainer'](_0x2c9b1c,_0x332a9f),_0x912728=_0x2c9b1c['_ancestorsToRestore'];_0x912728&&this['_restoreAncestorVisibility'](_0x912728),_0x2c9b1c['remove'](),this['_applyOverflowResults'](_0x332a9f,_0x2980c5);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x317702({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x4576df=new Vt(this['_locale']);_0x4576df['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x35d710=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x35d710['push'](this['_config']['cssClasses']['controlsButton']),_0x4576df['extendTemplate']({'attributes':{'class':_0x35d710}}),_0x4576df;}_createShowMoreBalloonPanelView(){const _0x34cbd0=new Pt(this['_locale']);return _0x34cbd0['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x34cbd0),_0x34cbd0;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x562924=>{_0x562924['disableAnimationOnEnter']();});const _0xfd99b6=new _0x20e82c(this['_locale']);_0xfd99b6['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0xfd99b6);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x5c885d=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x5c885d?'':'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(_0x3d2eba){const _0x145356=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x3d8d60=this['_containerElement']?.['classList'];if(_0x3d8d60){const _0x29cd23=_0x3d8d60[0x0]||'',_0x462a1d=_0x3d2eba['querySelector']('.'+_0x29cd23),_0x5a11cc=_0x3d2eba['querySelector'](_0x145356);return _0x462a1d||_0x5a11cc||_0x3d2eba;}return _0x3d2eba['querySelector'](_0x145356)||_0x3d2eba;}_calculateContainerWidth(){const _0x4d6fb2=this['_parentView']?.['element']||this['_containerElement'];if(!_0x4d6fb2)return Xr;const _0x1aea69=window['getComputedStyle'](_0x4d6fb2)['width'];if('auto'===_0x1aea69||'0px'===_0x1aea69||!_0x1aea69){const _0xfaef7c=_0x4d6fb2['parentElement'];if(_0xfaef7c){const _0x33bdef=window['getComputedStyle'](_0xfaef7c);return'auto'!==_0x33bdef['width']?_0x33bdef['width']:Xr;}return Xr;}return _0x1aea69;}_applyCalculationStyles(_0x107b7a,_0x5ae558){this['_config']['cssClasses']['calculationContainer']&&_0x107b7a['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x107b7a['style']['width']=_0x5ae558,_0x107b7a['style']['position']='absolute',_0x107b7a['style']['top']='-9999px',_0x107b7a['style']['left']='-9999px',_0x107b7a['style']['opacity']='0',_0x107b7a['style']['pointerEvents']='none',_0x107b7a['style']['zIndex']='-1',_0x107b7a['style']['visibility']='visible\x20!important',_0x107b7a['style']['display']='block\x20!important',_0x107b7a['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x355545){_0x355545['forEach'](({element:_0x82634,originalDisplay:_0x188c3c,originalVisibility:_0x1af808})=>{_0x82634['style']['display']=_0x188c3c,_0x82634['style']['visibility']=_0x1af808;});}_makeAncestorsVisible(_0x306edb){const _0x3bad69=[];let _0x22ccca=_0x306edb;for(;_0x22ccca&&_0x22ccca!==document['body'];){const _0x416dfd=window['getComputedStyle'](_0x22ccca);'none'!==_0x416dfd['display']&&'hidden'!==_0x416dfd['visibility']||(_0x3bad69['push']({'element':_0x22ccca,'originalDisplay':_0x22ccca['style']['display'],'originalVisibility':_0x22ccca['style']['visibility']}),_0x22ccca['style']['display']='block',_0x22ccca['style']['visibility']='visible'),_0x22ccca=_0x22ccca['parentElement'];}return _0x3bad69;}_createContainerElements(){let _0x36e4bb,_0x1281d5;return this['_parentView']?.['element']?(_0x36e4bb=this['_parentView']['element']['cloneNode'](!0x0),_0x1281d5=this['_findTargetContainer'](_0x36e4bb)):(_0x36e4bb=document['createElement']('div'),_0x1281d5=_0x36e4bb),{'calculationContainer':_0x36e4bb,'targetContainer':_0x1281d5};}_createCalculationContainer(){const {calculationContainer:_0x3beb6b,targetContainer:_0x4a443b}=this['_createContainerElements'](),_0xd7eb6a=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3beb6b,_0xd7eb6a);const _0xe81fe=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0xe81fe?_0xe81fe['appendChild'](_0x3beb6b):document['body']['appendChild'](_0x3beb6b),_0x3beb6b['_targetContainer']=_0x4a443b;const _0x1da3e3=this['_makeAncestorsVisible'](_0xe81fe||null);return _0x3beb6b['offsetWidth'],_0x3beb6b['_ancestorsToRestore']=_0x1da3e3,_0x3beb6b;}_calculateOverflowInContainer(_0x215907,_0x230005){const _0x2d573a=_0x215907['_targetContainer']||_0x215907,_0x261b5d=[],{rowCount:_0x105346}=this['_renderChipsAndCountRows'](_0x2d573a,_0x230005);if(_0x105346<=this['_config']['maxVisibleRows'])return _0x261b5d;const _0x1bb521=_0x230005['slice']();for(;_0x1bb521['length']>0x0;){if(this['_testButtonFit'](_0x215907,_0x2d573a,_0x1bb521)){const _0x4291ac=_0x230005['filter'](_0x2ce8a2=>!_0x1bb521['includes'](_0x2ce8a2));_0x261b5d['push'](..._0x4291ac);break;}if(!_0x1bb521['pop']())break;}return _0x261b5d;}_renderChipsAndCountRows(_0x353f52,_0x276f0c){_0x353f52['innerHTML']='',_0x276f0c['forEach'](_0x99920d=>{if(_0x99920d['element']){const _0x5f0595=_0x99920d['element']['cloneNode'](!0x0);_0x353f52['appendChild'](_0x5f0595);}}),_0x353f52['offsetWidth'];const _0x5dd88c=_0x353f52['children'],_0x2db3c9=[];return Array['from'](_0x5dd88c)['forEach'](_0x5222c8=>{const _0x22d36e=_0x5222c8['getBoundingClientRect']()['top'];_0x2db3c9['some'](_0x38d134=>Math['abs'](_0x38d134-_0x22d36e)<this['_config']['rowDetectionTolerance'])||_0x2db3c9['push'](_0x22d36e);}),{'rowCount':_0x2db3c9['length']};}_createMockButton(){const _0x40488b=document['createElement']('button');return _0x40488b['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x40488b['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x40488b['textContent']='+\x201',_0x40488b;}_testButtonFit(_0x57d97b,_0x22888d,_0x3933d1){this['_renderChipsAndCountRows'](_0x22888d,_0x3933d1);const _0x26ed40=this['_createMockButton']();_0x57d97b['appendChild'](_0x26ed40),_0x57d97b['offsetWidth'];const _0x51eadb=[..._0x22888d['children'],_0x26ed40],_0x24ecf1=[];_0x51eadb['forEach'](_0x20efcb=>{const _0x383cff=_0x20efcb['getBoundingClientRect']()['top'];_0x24ecf1['some'](_0x34bca5=>Math['abs'](_0x34bca5-_0x383cff)<this['_config']['rowDetectionTolerance'])||_0x24ecf1['push'](_0x383cff);});const _0xcf9042=_0x24ecf1['length'];return _0x26ed40['remove'](),_0xcf9042<=this['_config']['maxVisibleRows'];}_distributeChips(_0x76193c,_0x506755){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x76193c['forEach'](_0x1d4087=>{_0x506755['includes'](_0x1d4087)?this['_overflowChips']['add'](_0x1d4087):this['_visibleChips']['add'](_0x1d4087);});}_updateOverflowUI(_0x420587){if(_0x420587>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x420587>0x0&&this['_showMoreButtonView']){const _0x38d544=''+this['_config']['showMoreLabelPrefix']+(_0x420587<0x63?_0x420587:'99');this['_showMoreButtonView']['label']=_0x38d544;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x574039,_0x5dd055){this['_distributeChips'](_0x574039,_0x5dd055),this['_updateOverflowUI'](_0x5dd055['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x4114d4=>{_0x4114d4[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 _0x5c655d=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x5c655d['width']||0x0===_0x5c655d['height'])return!0x1;const _0x18cc77=window['innerHeight']||document['documentElement']['clientHeight'],_0x21d649=window['innerWidth']||document['documentElement']['clientWidth'];return _0x5c655d['bottom']>=-0xc8&&_0x5c655d['top']<=_0x18cc77+0xc8&&_0x5c655d['right']>=-0xc8&&_0x5c655d['left']<=_0x21d649+0xc8;}};const jr='ck-ai-chat__feed__context-chips',Jr='ck-ai-chat-context-chips-wrapper',Zr='ck-ai-chat-context-chips-wrapper-balloon',to='ck-ai-chat-controls-button',eo='ck-ai-chat-controls_context_show-more-button',io='ck-ai-chat-context-controls__show-more-balloon-panel';var so=class extends _0x20e82c{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x5dfd81,_0x3df5fa,_0x1e3117){super(_0x5dfd81),this['_bodyCollection']=_0x1e3117,this['_createContextChips'](_0x3df5fa);const _0x4a0653={'cssClasses':{'showMoreButton':eo+'\x20'+Mn,'showMoreBalloon':io,'overflowContainer':Zr,'controlsButton':to}};this['_overflowManager']=new zr(_0x5dfd81,this['_contextChips'],_0x4a0653,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[jr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Jr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x55d2e5=this['element']['querySelector']('.'+Jr);_0x55d2e5&&(this['_overflowManager']['setContainerElement'](_0x55d2e5),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x59b721){for(const _0x2d1d7e of _0x59b721){const _0x1e1c17=new $r(this['locale'],_0x2d1d7e,!0x0,!0x1);this['_contextChips']['add'](_0x1e1c17);}}},no=class extends dr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x1d040a,_0x4d0999,_0x2baa21){super(_0x4d0999),this['_locale']=_0x1d040a,this['_bodyCollection']=_0x2baa21,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 so(this['_locale'],this['options']['contextItems']['filter'](_0x40d23d=>!_0x40d23d['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x20e82c(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']();}},ro=class extends dr{capabilities;constructor(_0x18f418,_0x2477a6){super(_0x2477a6);const {isWebSearchEnabled:_0x443b41,isReasoningEnabled:_0xbe881c}=_0x2477a6['capabilities'],_0x32183b=[];let _0x303d80='';_0x443b41&&_0xbe881c?(_0x303d80=Ts(_0x18f418,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x32183b['push'](oo(ht)),_0x32183b['push'](oo(_0x1b0d06))):_0x443b41?(_0x303d80=Ts(_0x18f418,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x32183b['push'](oo(ht))):_0xbe881c&&(_0x303d80=Ts(_0x18f418,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x32183b['push'](oo(_0x1b0d06))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x303d80?'':'ck-hidden']}});const _0x38e168=new _0x20e82c();_0x38e168['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x32183b,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x303d80]}]}),this['children']['add'](_0x38e168),this['capabilities']=_0x2477a6['capabilities'];}};function oo(_0x371c1d){const _0x44dc5b=new Qt();return _0x44dc5b['content']=_0x371c1d,_0x44dc5b;}const ao=['wheel','touchstart','pointerdown','keydown'],ho=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var co=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x47d81b){this['element']=_0x47d81b,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x3ac1a9 of ao){const _0x2c9e36='keydown'!==_0x3ac1a9;this['element']['addEventListener'](_0x3ac1a9,this['_onUserEvent']['bind'](this),{'passive':_0x2c9e36,'signal':this['abortController']['signal']});}}start({smooth:_0x2d2009=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x2d2009?'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(_0x148035){if(this['isRunning']){if('keydown'===_0x148035['type']){const _0x25f08d=_0x148035['key'];if(!ho['includes'](_0x25f08d))return;}_0x148035 instanceof WheelEvent?_0x148035['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x4454d8,scrollHeight:_0x354b70,clientHeight:_0x271829}=this['element'];return _0x354b70-_0x4454d8-_0x271829<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},lo=class extends dr{constructor(_0x323f90){super(_0x323f90),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']);}},uo=class extends _0x20e82c{['children'];['scrollManager'];_bodyCollection;constructor(_0x42851c,_0xa9fe44){super(_0x42851c),this['_bodyCollection']=_0xa9fe44,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...rr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new co(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x56ffab,_0x55d5b0){let _0x419edf;return'ai-reply'===_0x56ffab?_0x419edf=new Hr(this['locale'],_0x55d5b0,this['_bodyCollection']):'ai-suggestion-reply'===_0x56ffab?(_0x419edf=new Dr(this['locale'],_0x55d5b0,this['_bodyCollection']),_0x419edf['bind']('isTrackChangesOn')['to'](this)):_0x419edf='user-message'===_0x56ffab?new no(this['locale'],_0x55d5b0,this['_bodyCollection']):'interaction-header'===_0x56ffab?new ro(this['locale'],_0x55d5b0):'custom-element'===_0x56ffab?new lo(_0x55d5b0):new vr(_0x55d5b0),this['children']['add'](_0x419edf),_0x419edf;}async updateReplyItem({id:_0x4658f8,parsedContent:_0x3f6a2a,renderingStrategy:_0x5a4960,abortSignal:_0x3e7ff3}){const _0x905437=this['getItemById'](_0x4658f8);if(!(_0x905437 instanceof Hr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x905437,'id':_0x4658f8,'parsedContent':_0x3f6a2a});await _0x905437['updateContent']({'parsedContent':_0x3f6a2a,'renderingStrategy':_0x5a4960,'abortSignal':_0x3e7ff3});}async updateWebSources(_0x183c76,_0x9e820d){const _0x2760b1=this['getItemById'](_0x183c76);if(_0x2760b1 instanceof Dr)_0x2760b1['updateSources'](_0x9e820d);else{if(!(_0x2760b1 instanceof Hr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x2760b1,'id':_0x183c76,'sources':_0x9e820d});_0x2760b1['updateSources'](_0x9e820d);}}async updateSuggestionItem({id:_0x249061,parts:_0x3bec51,abortSignal:_0x4fa4b,skipLoadingEffects:_0x4f4e29}){const _0x4fb867=this['getItemById'](_0x249061);if(!(_0x4fb867 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x4fb867,'id':_0x249061,'parts':_0x3bec51});await _0x4fb867['updateContent']({'parts':_0x3bec51,'abortSignal':_0x4fa4b,'skipLoadingEffects':_0x4f4e29});}updateSuggestionPartState({id:_0x1e3b93,index:_0x2800cb,state:_0x1966ea,outdatedReason:_0x16169b}){const _0x4cd7f8=this['getItemById'](_0x1e3b93);if(!(_0x4cd7f8 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1e3b93});_0x4cd7f8['updatePartState'](_0x2800cb,_0x1966ea,_0x16169b);}updateSuggestionGating(_0x233a2a,_0x41d20d){const _0x3c003a=this['getItemById'](_0x233a2a);if(!(_0x3c003a instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x233a2a});_0x3c003a['setGating'](_0x41d20d);}setSuggestionPartActive({id:_0x320aef,index:_0x402fc3,isActive:_0xbcf6b}){const _0x255c31=this['getItemById'](_0x320aef);if(!(_0x255c31 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x320aef});this['children']['filter'](_0x207061=>_0x207061 instanceof Dr)['forEach'](_0x44f5cb=>{_0x44f5cb['setPartActive'](!0x1);}),_0x255c31['setPartActive'](_0x402fc3,_0xbcf6b);}markItemAsDone(_0xca8d88){this['getItemById'](_0xca8d88)['markAsDone']();}getItemIds(){return this['children']['map'](_0x49881d=>_0x49881d['options']['id']);}removeItem(_0x16af64){this['children']['remove'](this['getItemById'](_0x16af64));}hasItem(_0x34b049){return!!this['children']['find'](_0x229af1=>_0x229af1['options']['id']['includes'](_0x34b049));}scrollToSuggestion(_0x5b6e56,_0x4ee532){const _0x4be214=this['getItemById'](_0x5b6e56);if(!(_0x4be214 instanceof Dr))return void Ot('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x5b6e56,'partIndex':_0x4ee532});const _0x2fbd92=_0x4be214['getPartView'](_0x4ee532);_0x2fbd92?vt(_0x2fbd92['element'],0x14,this['element']['parentElement'],!0x0,!0x0):Ot('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x5b6e56,'partIndex':_0x4ee532});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x23e79d=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x23e79d,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x45a4ab=new fr(this['locale'],br['aiFeed']);return _0x45a4ab['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x45a4ab;}_createFeedItems(){const _0x3b9e2f=new _0x20e82c(this['locale']);return _0x3b9e2f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x3b9e2f;}_createFeedLoader(){const _0x73b18b=new _0x20e82c(this['locale']);return _0x73b18b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x42cb70=>!_0x42cb70)]},'children':this['_createLoaderChildren']()}),_0x73b18b;}_createLoaderChildren(){const _0x5d9b77=new Mr();return _0x5d9b77['isVisible']=!0x0,[_0x5d9b77,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x140df4){const _0x4b07b3=this['children']['find'](_0x28d418=>_0x28d418['options']['id']['includes'](_0x140df4));if(!_0x4b07b3)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x140df4});return _0x4b07b3;}setLoadingMessage(_0x58fefb){this['set']('loadingMessage',_0x58fefb);}toggleLoadingSkeleton(_0x1d469e){this['set']('isLoadingSkeletonVisible',_0x1d469e);}startAutoScroll(_0x2307e8={}){this['scrollManager']['start'](_0x2307e8);}stopAutoScroll(){this['scrollManager']['stop']();}},_o=class extends te{filter(){let _0x4fafd9=0x0;for(const _0x54d778 of this['items'])_0x4fafd9+=_0x54d778['items']['length'];return{'resultsCount':_0x4fafd9,'totalItemsCount':_0x4fafd9};}};function go(_0x3ece01){const _0x5751b0=[];let _0x486f3c=!0x1;for(const _0x1ad34d of Array['from'](_0x3ece01['items'])){if('file'!==_0x1ad34d['kind'])continue;if(_0x1ad34d['webkitGetAsEntry']()?.['isDirectory']){_0x486f3c=!0x0;continue;}const _0x38c32a=_0x1ad34d['getAsFile']();_0x38c32a&&_0x5751b0['push'](_0x38c32a);}return{'files':_0x5751b0,'hasDirectory':_0x486f3c};}const Ao='ck-ai-chat__prompt-input_highlighted';var Io=class AIChatPromptInputView extends Lt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x526785,_0x5086c9){super(_0x526785,{'queryView':{'label':'','creator':_0x545d11,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new _o(_0x526785),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5086c9,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',(_0x1e5c99,_0x16d26b)=>!_0x1e5c99&&!_0x16d26b),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x54a128,_0x3e2e55)=>{this['isUploadInProgress']||this['isEmpty']||_0x54a128['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3e2e55());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x22014c=>this['_handlePaste'](_0x22014c)),this['element']['addEventListener']('drop',_0x430ab0=>this['_handleDrop'](_0x430ab0));}_handlePaste(_0x1b70ce){const _0x574a1c=_0x1b70ce['clipboardData'];if(!_0x574a1c)return;const {files:_0x8e145d,hasDirectory:_0x5ae49d}=go(_0x574a1c),_0x5b0bf0={'files':_0x8e145d,'plainText':_0x574a1c['getData']('text/plain'),'hasDirectory':_0x5ae49d,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1b70ce['preventDefault']()};this['fire']('promptInputPaste',_0x5b0bf0);}['_handleDrop'](_0x3bbb6a){const _0x55a41b=_0x3bbb6a['dataTransfer'];if(!_0x55a41b)return;const _0x3f2950={'files':[],'plainText':_0x55a41b['getData']('text/uri-list')||_0x55a41b['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x3bbb6a['preventDefault']()};this['fire']('promptInputPaste',_0x3f2950);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x517dae=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x517dae)return this['queryView']['errorText']=Ts(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x16ae4e=_0x4150e0(_0x517dae);this['fire']('sendUserMessage',_0x16ae4e),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x5d5c0d){this['queryView']['fieldView']['set']('placeholder',_0x5d5c0d);}['focus'](_0x544f58=!0x1){super['focus'](),_0x544f58&&(this['element']['classList']['contains'](Ao)||(this['element']['classList']['add'](Ao),setTimeout(()=>{this['element']['classList']['remove'](Ao);},0x320)));}_createSubmitButton(){const _0x49042d=new Vt(this['locale']);return _0x49042d['set']({'icon':nt,'label':Ts(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Dn,'isEnabled':!0x1}),_0x49042d['on']('execute',()=>{this['submit']();}),_0x49042d;}setIsUploadInProgress(_0x334a01){this['isUploadInProgress']=_0x334a01;}_setUpAddContextButtonPositioning(){const _0x553e2b=this['locale'],_0x4a98ae=()=>{Ct['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0x335160=new It(this['queryView']['fieldView']['element']),_0x8ea54b=new It(this['_addContextButtonView']['element']),_0x45774c=_0x335160['width'],_0x131e77='rtl'===_0x553e2b['uiLanguageDirection']?'right':'left';_0x335160['excludeScrollbarsAndBorders']();const _0x2fd057=_0x45774c-_0x335160['width']+0x1;this['_addContextButtonView']['element']['style'][_0x131e77]='calc('+(_0x45774c-_0x8ea54b['width']-_0x2fd057)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x4a98ae),this['on']('render',()=>{_0x4a98ae(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x4a98ae();});});}},po=class extends _0x20e82c{constructor(_0x3561c1){super(_0x3561c1),this['set']('isEnabled',!0x0);const _0x56efd7=new Qt();_0x56efd7['content']=_0x4bb3b0,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x56efd7,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Ts(_0x3561c1,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x51cdf5){let _0x4c7b1c=0x0;const _0x482cb5=()=>{_0x51cdf5['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x4c7b1c>0x0);};this['on']('change:isEnabled',(_0x3f7125,_0x953b0d,_0xd30d5f)=>{_0xd30d5f&&_0x4c7b1c>0x0&&this['fire']('dragEnter'),_0x482cb5();}),_0x51cdf5['addEventListener']('dragenter',_0x115b30=>{_0x115b30['dataTransfer']&&(_0x4c7b1c++,0x1===_0x4c7b1c&&this['isEnabled']&&this['fire']('dragEnter'),_0x482cb5());}),_0x51cdf5['addEventListener']('dragover',_0x366558=>{_0x366558['dataTransfer']&&_0x366558['preventDefault']();}),_0x51cdf5['addEventListener']('dragleave',()=>{--_0x4c7b1c<0x0&&(_0x4c7b1c=0x0),_0x482cb5();}),_0x51cdf5['addEventListener']('drop',_0x11c7a0=>{_0x11c7a0['preventDefault'](),_0x4c7b1c=0x0,_0x482cb5(),this['isEnabled']&&this['_handleDrop'](_0x11c7a0);});}['_handleDrop'](_0x2a0859){const _0x4d7c88=_0x2a0859['dataTransfer'];if(!_0x4d7c88)return;const {files:_0x2a395d,hasDirectory:_0x2ae8ec}=go(_0x4d7c88),_0x4f06bc={'files':_0x2a395d,'plainText':_0x4d7c88['getData']('text/uri-list')||_0x4d7c88['getData']('text/plain'),'hasDirectory':_0x2ae8ec,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x4f06bc);}},Eo=class extends _0x20e82c{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x4cfd84,_0x1d5699){super(_0x4cfd84),this['_config']=_0x1d5699,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x534621(this['dropdownView'],this['_items']),this['nameView']=new mo(_0x4cfd84,_0x1d5699['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x45026b=>_0x45026b??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x19ebde=>'name'===_0x19ebde),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0xfe2954,_0x8a2c13){var _0x34fe4e;this['set']('modelDisplayMode',(_0x34fe4e=_0xfe2954['length'],_0x8a2c13?0x1===_0x34fe4e?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0xfe2954['length']&&this['set']('activeModelName',_0xfe2954[0x0]['name']||_0xfe2954[0x0]['id']);for(const _0x5ef65a of _0xfe2954){const _0x330ccf=new _0x27fe92({'label':_0x5ef65a['name'],'withText':!0x0,'role':'menuitemradio','id':_0x5ef65a['id'],'model':_0x5ef65a});_0x330ccf['bind']('isOn')['to'](this,'activeModelId',_0x728715=>_0x728715===_0x5ef65a['id']),this['_items']['add']({'type':'button','model':_0x330ccf,'labelView':new To(this['locale'],_0x5ef65a,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?wo(this['locale'],_0x5ef65a):void 0x0})});}}setSelectedModel(_0x4cccda){this['set']('activeModelId',_0x4cccda?_0x4cccda['id']:null),this['set']('activeModelName',_0x4cccda?_0x4cccda['name']||_0x4cccda['id']:null);}_createDropdown(){const _0x3557c5=_0x28f0f7(this['locale']);return _0x3557c5['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x3557c5['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Mn}),_0x3557c5['buttonView']['bind']('label')['to'](this,'activeModelName',_0x134dc6=>_0x134dc6??this['_config']['defaultLabel']??''),_0x3557c5['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x554e65,_0x2e06d5)=>!_0x2e06d5&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x554e65??this['_config']['defaultLabel']??''),_0x3557c5['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5b4bfe=>'selector'===_0x5b4bfe),_0x3557c5['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x3557c5,'execute',_0x488881=>{this['fire']('selectModel',_0x488881['source']['model']);}),_0x3557c5;}},mo=class extends _0x20e82c{constructor(_0x46df92,_0x516403){super(_0x46df92),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x416adb=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x516403,_0x416adb['if']('isVisible','ck-hidden',_0x47fad0=>!_0x47fad0)]},'children':[{'text':_0x416adb['to']('text')}]});}},To=class extends Mt{constructor(_0x155aa3,_0x35549e,_0x1aebf0){super();const _0x7748c3=this['bindTemplate'],_0x4a48b0=[{'tag':'div','attributes':{'class':[_0x1aebf0['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x7748c3['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x1aebf0['descriptionClass']]},'children':[{'tag':'span','children':[_0x35549e['description']||'']}]}];_0x1aebf0['extraContent']?.['length']&&_0x1aebf0['capabilitiesClass']&&_0x4a48b0['push']({'tag':'div','attributes':{'class':[_0x1aebf0['capabilitiesClass']]},'children':_0x1aebf0['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x7748c3['to']('style'),'id':_0x7748c3['to']('id')},'children':_0x4a48b0});}};function wo(_0x41b31c,_0x2de974){return[...Co(_0x41b31c,ht,'AI_CHAT_SEARCH_WEB',_0x2de974['capabilities']['webSearch']?.['enabled']??!0x1),...Co(_0x41b31c,_0x1b0d06,'AI_CHAT_REASONING',_0x2de974['capabilities']['reasoning']?.['enabled']??!0x1)];}function Co(_0x1dd80a,_0x59a06e,_0x1c9ce9,_0x2d6b5f){const _0x56237a=new Qt();_0x56237a['content']=_0x59a06e;const _0x5379bc=new _0x20e82c(_0x1dd80a);_0x5379bc['setTemplate']({'tag':'span','children':[{'text':Ts(_0x1dd80a,_0x1c9ce9)+':\x20'}]});const _0x8e20d1=new _0x20e82c(_0x1dd80a);return _0x8e20d1['setTemplate']({'tag':'span','children':[{'text':Ts(_0x1dd80a,_0x2d6b5f?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x56237a,_0x5379bc,_0x8e20d1];}const fo='ck-ai-chat__prompt-capabilities',bo='ck-ai-chat-controls-button',So='ck-ai-chat-controls-button--commands',Ro='ck-ai-chat-controls__model-selection',Oo='ck-ai-chat-controls__model-selection__item-name',vo='ck-ai-chat-controls__model-selection__item-description',ko='ck-ai-chat-controls__model-selection__item-capabilities',yo='n';var No=class extends _0x20e82c{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x5bc066){super(_0x5bc066),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x3d8e81){return new Eo(_0x3d8e81,{'panelPosition':'ne','dropdownClass':[Ro],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':Oo,'description':vo,'capabilities':ko},'defaultLabel':Ts(_0x3d8e81,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Ts(_0x3d8e81,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':yo,'showCapabilities':!0x0});}(_0x5bc066),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x432673=>_0x432673),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x173119=>_0x173119),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x2610ae=>Ts(this['locale'],_0x2610ae?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x2a0fe3=>_0x2a0fe3),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x42233d=>Ts(this['locale'],_0x42233d?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[fo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x5853bf){this['set']('webSearchActive',_0x5853bf);}setReasoning(_0x200a3c){this['set']('reasoningActive',_0x200a3c);}setModelList(_0x1e6692,_0x49a38c){this['_modelSelector']['setModels'](_0x1e6692,!_0x49a38c);}setModel(_0x36a78d){if(!_0x36a78d)return;this['_modelSelector']['setSelectedModel'](_0x36a78d);const _0x308876=_0x36a78d['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x308876),this['_webSearchButton']['set']('isVisible',_0x308876);const _0x5c8039=_0x36a78d['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x5c8039),this['_reasoningButton']['set']('isVisible',_0x5c8039);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x2f35cb){this['set']('modelSelectorEnabled',!0x1),_0x2f35cb&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x21b6f7=new Vt();return _0x21b6f7['set']({'label':Ts(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltipPosition':yo}),_0x21b6f7['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x21b6f7;}_createReasoningButton(){const _0x1fa3ad=new Vt();return _0x1fa3ad['set']({'label':Ts(this['locale'],'AI_CHAT_REASONING'),'icon':_0x1b0d06,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltipPosition':yo}),_0x1fa3ad['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x1fa3ad;}_createCommandsButton(){const _0x9fa4ed=new Vt();return _0x9fa4ed['set']({'label':Ts(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x495b19,'withText':!0x0,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltip':Ts(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':yo}),_0x9fa4ed['extendTemplate']({'attributes':{'class':[So]}}),_0x9fa4ed['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x9fa4ed;}};const xo='ck-ai-chat-context-controls__url-form',Lo='ck-ai-chat-context-controls__url-input-section';var Po=class extends _0x20e82c{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x113590){super(_0x113590),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 Wt({'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'](_0x5d53b7=>{this['focusTracker']['add'](_0x5d53b7['element']),this['keystrokes']['listenTo'](_0x5d53b7['element']);}),_0x34e1b6({'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(_0x59823c){this['urlInputField']['errorText']=_0x59823c,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x29a0bb=new Vt(this['locale']);return _0x29a0bb['set']({'icon':_0x48d93b,'tooltip':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x5daa0d,_0x2969c7,_0x3d46b1)=>{_0x29a0bb['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x3d46b1?'':'\x20ck-hidden')]});}),_0x29a0bb;}_createUrlInputField(){const _0x146c4e=new zt(this['locale'],_0x3fee4b);return _0x146c4e['set']({'label':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x146c4e['fieldView']['set']({'placeholder':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x146c4e;}_createConfirmButton(){const _0x43f893=new Vt(this['locale']);return _0x43f893['set']({'icon':_0x8456a1,'tooltip':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x43f893;}_setupTemplate(){const _0x3a2d5b=new Yt(this['locale'],{'label':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3a2d5b['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':xo,'tabindex':'-1'},'children':[_0x3a2d5b,{'tag':'div','attributes':{'class':Lo},'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',_0x1b7db=>{_0x1b7db['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x2eddd7,_0x3adfca)=>{this['clear'](),this['fire']('cancel'),_0x3adfca();});}_handleSubmit(){const _0x17afe6=this['getValue']()['trim']();_0x17afe6?this['_isValidUrl'](_0x17afe6)?(this['clearError'](),this['fire']('submitUrl',_0x17afe6)):this['setError'](Ts(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Ts(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x173de2=this['getValue']()['trim'](),_0x5348a0=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x173de2['length']>0x0&&!_0x5348a0;}['_isValidUrl'](_0xd4ba4c){try{return!!new URL(_0xd4ba4c);}catch{return!0x1;}}};const Do='ck-ai-chat-resources__item',Ho='ck-ai-chat-resources__item--in-context',Mo='ck-ai-chat-resources__item-title',Uo='ck-ai-chat-resources__item__icon';var Vo=class extends Zt{['resource'];_titleView;['_iconView'];constructor(_0x52a073,_0x36e514){super(_0x52a073),this['resource']=_0x36e514,this['set']('isInContext',!!_0x36e514['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0xce69a1){if(_0xce69a1['isInContext'])return _0x8456a1;switch(_0xce69a1['type']){case'document':return _0x2f3b78;case'web-resource':return _0x935068;case'file':case'text':return _0x4bb3b0;default:return _0x2cd05d;}}highlightText(_0x224e21){if(!_0x224e21||''===_0x224e21['trim']())return void this['_titleView']['highlightText'](null);const _0x23542a=new RegExp(_0x5b1451(_0x224e21),'gi');this['_titleView']['highlightText'](_0x23542a);}updateResourceState(_0x432acc){this['resource']['isInContext']=_0x432acc,this['isInContext']=_0x432acc,this['_updateIcon']();}_createTitleView(){const _0x427978=new qt();return _0x427978['text']=this['resource']['label'],_0x427978['extendTemplate']({'tag':'span','attributes':{'class':[Mo]}}),_0x427978;}_createIconView(){const _0x4ce8f3=new Qt();return _0x4ce8f3['content']=this['getResourceIcon'](this['resource']),_0x4ce8f3;}_setupTemplate(){const _0x133732=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Do,_0x133732['if']('isVisible','ck-hidden',_0x4286aa=>!_0x4286aa),_0x133732['if']('isInContext',Ho)]},'children':[{'tag':'div','attributes':{'class':[Uo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x133732['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Bo='ck-ai-chat-resources__list';var Go=class extends te{['_source'];constructor(_0x52157f,_0x4bedd7){super(_0x52157f),this['_source']=_0x4bedd7,this['extendTemplate']({'attributes':{'class':[Bo]}});}setResources(_0x220cc7,_0x2ed0e0){this['items']['clear']();let _0x34c2e8=_0x220cc7;if(this['_source']['useDefaultFiltering']&&_0x2ed0e0&&''!==_0x2ed0e0['trim']()){const _0x5c154c=new RegExp(_0x2ed0e0['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x34c2e8=_0x220cc7['filter'](_0x5943bd=>_0x5c154c['test'](_0x5943bd['label']));}for(const _0x2d7058 of _0x34c2e8){const _0x4dd3a5=new Vo(this['locale'],_0x2d7058);_0x4dd3a5['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x2d7058);}),this['items']['add'](_0x4dd3a5);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x2ed0e0);}highlightText(_0x4f0863){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x5ca78a=>{_0x5ca78a['highlightText'](_0x4f0863);});}updateResourceState(_0x1ccc89,_0x4faa56){for(const _0x55eed7 of this['items']){const _0x41c1b4=_0x55eed7;_0x41c1b4['resource']['id']===_0x1ccc89&&_0x41c1b4['updateResourceState'](_0x4faa56);}}_handleResourceSelection(_0x28002a,_0x1079f4){this['fire']('addResourceToContext',{'source':_0x28002a,'resource':_0x1079f4});}},Fo=class extends zt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x593259){const t=_0x593259['t'],_0x24cfc0={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x3fee4b,'label':Ts(_0x593259,'AI_CHAT_SEARCH_RESOURCES')};super(_0x593259,_0x24cfc0['creator']),this['label']=_0x24cfc0['label'],this['_viewConfig']=_0x24cfc0,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x593259,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x339f93){this['fire']('search',_0x339f93);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new Qt(),this['iconView']['content']=_0x19d494,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x245f3f,t){this['resetButtonView']=new Vt(_0x245f3f),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x566e32,'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',_0xa16d3a=>!_0xa16d3a),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);}},Ko=class extends _0x20e82c{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x257f5a,_0x139d5e){super(_0x257f5a),this['_source']=_0x139d5e['source'],this['_searchInputVisibleFrom']=_0x139d5e['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 _0x261c11([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Fo(this['locale']);}_createSearchSection(){const _0x3bcab4=new _0x20e82c(this['locale']);return _0x3bcab4['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x333402,_0x125adf)=>{this['loadResources'](_0x125adf),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x125adf);}),_0x3bcab4;}_createResourcesListView(){const _0x5ea9b0=new Go(this['locale'],this['_source']);return _0x5ea9b0['delegate']('addResourceToContext')['to'](this),_0x5ea9b0['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x5ea9b0;}_createSkeletonView(){const _0x55146b=new fr(this['locale'],br['aiChatResources']);return _0x55146b['bind']('isVisible')['to'](this,'isLoading'),_0x55146b;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x39514a){const _0x35cde5=Nt();this['_latestLoadResourcesUid']=_0x35cde5,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x39514a,'uid':_0x35cde5}),this['isLoading']=!0x0;}setResources(_0x5b3ae1,_0x40df10){if(_0x40df10&&_0x40df10!==this['_latestLoadResourcesUid'])return;const _0x4706ff=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5b3ae1,_0x4706ff),_0x5b3ae1['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x2fe87c,_0x31c190){this['_resourcesListView']['updateResourceState'](_0x2fe87c,_0x31c190);}};const Wo='ck-ai-chat-context-controls__source-balloon-panel',Yo='ck-button-icon\x20ck-button-back',$o='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var qo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0x4b6921,_0x4e809e,_0x3f8f25){this['_locale']=_0x4b6921,this['_bodyCollection']=_0x4e809e,this['_config']=_0x3f8f25;}['showSourceResourcesBalloon']({source:_0x135750,withBackButton:_0x2007e7}){let _0x52ff90=this['_sourceResourceBalloons']['get'](_0x135750['id']);_0x52ff90||(_0x52ff90=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x135750['id'],_0x52ff90),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x52ff90)),this['_addSourceResourceContent']({'balloonPanel':_0x52ff90,'source':_0x135750,'withBackButton':_0x2007e7}),_0x52ff90['show']();const _0x2ff9f7=this['_config']['getTargetElement']();_0x2ff9f7&&_0x52ff90['pin']({'target':_0x2ff9f7,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x17c952,_0xb70d5e,_0x5a965d){const _0x1ca47e=this['_sourceResourceBalloons']['get'](_0x17c952);if(!_0x1ca47e)return;const _0x3845be=this['_getResourcesViewFromBalloon'](_0x1ca47e);_0x3845be&&(_0x3845be['setResources'](_0xb70d5e,_0x5a965d),_0x3845be['once']('change:isLoading',()=>{_0x1ca47e['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x45bf7b){const _0x4287d5=this['_sourceResourceBalloons']['get'](_0x45bf7b);_0x4287d5&&requestAnimationFrame(()=>{_0x4287d5['hide'](),this['_sourceResourceBalloons']['delete'](_0x45bf7b),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x2a9638 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x2a9638);}['isAnyResourceBalloonVisible'](){for(const _0x29ae81 of this['_sourceResourceBalloons']['values']())if(_0x29ae81['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x2e89e3,_0x5f0a85,_0x47c002){const _0x58ff87=this['_sourceResourceBalloons']['get'](_0x2e89e3);if(!_0x58ff87||!_0x58ff87['isVisible'])return;const _0x7377a9=this['_config']['getTargetElement']();if(!_0x7377a9)return;_0x58ff87['pin']({'target':_0x7377a9,'limiter':this['_config']['getLimiterElement']()});const _0x1f895c=this['_getResourcesViewFromBalloon'](_0x58ff87);_0x1f895c&&_0x1f895c['updateResourceState'](_0x5f0a85,_0x47c002);}destroy(){for(const _0xa8a154 of this['_sourceResourceBalloons']['values']())_0xa8a154['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0xf5e6f=new Pt(this['_locale']);return _0xf5e6f['extendTemplate']({'attributes':{'class':Wo}}),this['_bodyCollection']['add'](_0xf5e6f),_0xf5e6f;}_addSourceResourceContent({balloonPanel:_0xe32637,source:_0x143c2d,withBackButton:_0x520d9c}){_0xe32637['content']['clear']();const _0x50b8fe=this['_createBalloonHeader']({'balloonPanel':_0xe32637,'source':_0x143c2d,'withBackButton':_0x520d9c});_0xe32637['content']['add'](_0x50b8fe);const _0x1ae197=this['_createBalloonResourcesView'](_0x143c2d);_0xe32637['content']['add'](_0x1ae197);}_createBalloonHeader({balloonPanel:_0x413be5,source:_0x57ff55,withBackButton:_0x581a3a}){const _0x464280=new Yt(this['_locale'],{'label':_0x57ff55['label'],'class':$o});return _0x581a3a&&_0x464280['children']['add'](this['_createBackButton'](_0x413be5),0x0),_0x464280;}_createBackButton(_0x232afa){const _0x4321c5=new Vt(this['_locale']);return _0x4321c5['set']({'icon':_0x48d93b,'tooltip':Ts(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Yo}),_0x4321c5['on']('execute',()=>{_0x232afa['hide'](),this['_config']['onBackToContext']();}),_0x4321c5;}_createBalloonResourcesView(_0x2320a5){const _0x45de82=new Ko(this['_locale'],{'source':_0x2320a5,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x45de82['on']('loadSourceResources',(_0x3fe261,_0xe3d82b)=>{this['_config']['onLoadSourceResources'](_0xe3d82b);}),_0x45de82['on']('addResourceToContext',(_0x503e5c,_0x56e1b6)=>{this['_config']['onResourceSelected'](_0x56e1b6['source'],_0x56e1b6['resource']),this['closeSourceResourceBalloon'](_0x2320a5['id']);}),_0x45de82;}_getResourcesViewFromBalloon(_0x194f3a){const _0x407986=_0x194f3a['content']['get'](0x1);return _0x407986 instanceof Ko?_0x407986:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x27f058){_0x317702({'emitter':_0x27f058,'contextElements':[_0x27f058['element']],'callback':()=>{_0x27f058['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x27f058['isVisible']});}};const Qo=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Xo='ck-ai-chat-context-controls',zo='ck-ai-chat-context-controls__pending-contexts',jo='ck-ai-chat-context-controls__add-context-balloon-panel',Jo='ck-ai-chat-context-controls__add-context-button',Zo='ck-ai-chat-context-controls__url-balloon-panel',ta='ck-ai-chat-context-controls__balloon-button',ea='ck-ai-chat-context-controls__balloon-button-source',ia='ck-ai-chat-controls-button',sa='ck-ai-chat-context-chips-wrapper-balloon',na='ck-ai-chat-controls_context_show-more-button',ra='ck-ai-chat-context-controls__show-more-balloon-panel',oa='ck-ai-chat',aa=[Pt['defaultPositions']['northArrowSouthWest'],Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthEast'],Pt['defaultPositions']['southArrowNorthWest'],Pt['defaultPositions']['southArrowNorth'],Pt['defaultPositions']['southArrowNorthEast']];var ha=class extends _0x20e82c{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x368abb,_0x31a28e){super(_0x368abb),this['bodyCollection']=_0x31a28e['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x368abb),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x368abb),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x368abb),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x368abb,_0x31a28e);const _0x4e79bb={'cssClasses':{'showMoreButton':na+'\x20'+Mn,'showMoreBalloon':ra,'overflowContainer':sa,'controlsButton':ia}};this['_overflowManager']=new zr(_0x368abb,this['_currentContextsChips'],_0x4e79bb,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(_0x1f4860,_0x59890e){const _0x1f5523=this['_createContextButton'](_0x1f4860,'current',!0x0,_0x59890e);this['_addContextToCollection'](_0x1f5523,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x2eb49d){this['_removeContextFromCollection'](_0x2eb49d,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x2eb49d,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x351b9e,_0x160ff9){let _0x4f2b34=this['_currentContextsChips']['find'](_0x157b96=>_0x157b96['id']===_0x351b9e);_0x4f2b34||(_0x4f2b34=this['_overflowManager']['overflowChips']['find'](_0x1aefd3=>_0x1aefd3['id']===_0x351b9e)),_0x4f2b34&&(_0x4f2b34['isLoading']=_0x160ff9);}setConversationContext(_0x4d498e){this['_conversationContextsChips']['clear']();for(const _0x771694 of _0x4d498e){const _0x23e75f=this['_createContextButton'](_0x771694,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x23e75f,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x43367a,_0x586efb,_0x40208f){this['_resourcesBalloonView']['updateResourceState'](_0x43367a,_0x586efb,_0x40208f);}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:_0x14a360,withBackButton:_0x2fe44d}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x14a360,'withBackButton':_0x2fe44d}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x3af490,_0x2e25cc,_0x44101d,_0x5befd9){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x3af490,_0x44101d,_0x5befd9);}['closeSourceResourceBalloon'](_0x1d8a1d){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x1d8a1d),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x4929b8){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x4929b8),this['_setAddContextButtonEnabled'](_0x4929b8);}_setAddContextButtonEnabled(_0x14dcdb){const _0x56345a=!_0x14dcdb['document']['isHidden']&&_0x14dcdb['document']['enabled'],_0x4eefd4=_0x14dcdb['urls']['enabled'],_0x53ed12=_0x14dcdb['files']['enabled'],_0x5644ce=_0x14dcdb['sources']['length']>0x0,_0x16e3de=_0x14dcdb['customItems']&&_0x14dcdb['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x56345a||_0x4eefd4||_0x53ed12||_0x5644ce||_0x16e3de;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[Xo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':zo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x3a192b){const _0xc1ca15=new Vt(_0x3a192b);return _0xc1ca15['set']({'label':Ts(_0x3a192b,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ia+'\x20'+Jo+'\x20'+Mn,'icon':_0x47094d,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0xc1ca15;}_createAddContextBalloonPanelView(_0x3ced62){return this['_createBaseBalloonPanel'](_0x3ced62,jo);}_createUrlBalloonPanelView(_0x3e1f89){const _0x333d97=this['_createBaseBalloonPanel'](_0x3e1f89,Zo);return this['_addUrlContent'](_0x333d97,_0x3e1f89),_0x333d97;}_createResourcesBalloonView(_0x341cf6,_0x434d1a){const _0x4a3655={'searchInputVisibleFrom':_0x434d1a['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa});},'onResourceSelected':(_0x1b5365,_0x53a898)=>{this['fire']('addResourceToContext',{'source':_0x1b5365,'resource':_0x53a898});},'onLoadSourceResources':_0xe417a6=>{this['fire']('loadSourceResources',_0xe417a6);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new qo(_0x341cf6,_0x434d1a['bodyCollection'],_0x4a3655);}_getLimiterElement(){return this['element']?.['closest']('.'+oa)||document['body'];}_createBaseBalloonPanel(_0xd56831,_0x362dce){const _0x302532=new Pt(_0xd56831);return _0x302532['extendTemplate']({'attributes':{'class':_0x362dce}}),this['bodyCollection']['add'](_0x302532),_0x302532;}_setBalloonPanelContent(_0x11ba40,_0x1b3a45,_0x3f73aa){if(_0x11ba40['content']['clear'](),!_0x3f73aa['document']['isHidden']&&_0x3f73aa['document']['enabled']){const _0x187e4=this['_createBalloonButton'](_0x1b3a45,{'label':Ts(_0x1b3a45,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x2f3b78});_0x187e4['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x11ba40['content']['add'](_0x187e4);}if(_0x3f73aa['urls']['enabled']){const _0x55e17a=this['_createBalloonButton'](_0x1b3a45,{'label':Ts(_0x1b3a45,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x935068});_0x55e17a['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}),this['_urlInputView']['focus']();}),_0x11ba40['content']['add'](_0x55e17a);}if(_0x3f73aa['files']['enabled']){const _0x2e6dd3=new Kt(_0x1b3a45);_0x2e6dd3['set']({'label':Ts(_0x1b3a45,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0xdabe5e,'withText':!0x0,'tooltip':!0x0,'class':ta,'allowMultipleFiles':!0x0}),_0x2e6dd3['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x2e6dd3['on']('done',(_0x295fc2,_0x2a5422)=>{this['fire']('addFileToContext',_0x2a5422);}),_0x2e6dd3['tooltip']=!0x0,_0x11ba40['content']['add'](_0x2e6dd3);}for(const _0x1eed88 of _0x3f73aa['sources']){const _0x3a6ae6=this['_createBalloonButton'](_0x1b3a45,{'label':_0x1eed88['label'],'icon':_0x1eed88['icon']||_0x2cd05d,'type':'source'});_0x11ba40['content']['add'](_0x3a6ae6),_0x3a6ae6['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x1eed88,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x15d22b of _0x3f73aa['customItems']||[]){const _0x33f7d2=this['_createBalloonButton'](_0x1b3a45,{'label':_0x15d22b['label'],'icon':_0x15d22b['icon']||_0x2cd05d,'type':'customItem'});_0x11ba40['content']['add'](_0x33f7d2),_0x33f7d2['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x15d22b);});}this['_hasExactlyOneSource']=0x1===_0x11ba40['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x17986a,_0x605e9f){this['_urlInputView']=new Po(_0x605e9f),this['_urlInputView']['on']('submitUrl',(_0x33edbe,_0x32e819)=>{this['_handleUrlSubmit'](_0x32e819);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa});}),_0x17986a['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x5e0c9b,_0x4afe05){const _0x526d1e='source'===_0x4afe05['type']?new ca(_0x5e0c9b):new Vt(_0x5e0c9b);return _0x526d1e['set']({'label':_0x4afe05['label'],'icon':_0x4afe05['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':ta}),_0x526d1e;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x317702({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0xfc8a18){const _0x257b3f=this['_addContextBalloonConfig'];_0x257b3f['buttonView']['isOn']=_0xfc8a18,_0xfc8a18?_0x257b3f['balloonView']['show']():_0x257b3f['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0xa3af32,buttonView:_0x5c02e1,hideMethod:_0x41d70b}=this['_addContextBalloonConfig'];_0x317702({'emitter':_0xa3af32,'contextElements':[_0xa3af32['element'],_0x5c02e1['element']],'callback':()=>{_0x41d70b();},'activator':()=>_0x5c02e1['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x3453c3,_0x38dd6b,_0x2184b5=!0x1,_0x2b39bc=!0x1){const _0x114edb='conversation'===_0x38dd6b||!0x0===_0x3453c3['isReadOnly'],_0xb1eb00=new $r(this['locale'],_0x3453c3,_0x114edb,_0x2184b5,_0x2b39bc);return _0x114edb||_0xb1eb00['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0xb1eb00['id']);}),_0xb1eb00;}_addContextToCollection(_0x391a29,_0x3789f0){_0x3789f0['add'](_0x391a29,0x0);}_removeContextFromCollection(_0x4db452,_0x195a4d){const _0x1be155=_0x195a4d['find'](_0x54d70b=>_0x54d70b['id']===_0x4db452);_0x1be155&&_0x195a4d['remove'](_0x1be155);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0xf4d8f){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0xf4d8f);}},ca=class extends Vt{['arrowView'];constructor(_0x48b692){super(_0x48b692),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[ea]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x4717ad=new Qt();return _0x4717ad['content']=_0x222309,_0x4717ad['extendTemplate']({'attributes':{'class':ea+'__arrow'}}),_0x4717ad;}},la=class extends _0x20e82c{_cancelButtonView;['_loaderView'];constructor(_0x5e5fd4){super(_0x5e5fd4),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 _0x3c2857=new Vt(this['locale']);return _0x3c2857['set']({'label':Ts(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Hn+'\x20ck-ai-button-stop-generating','icon':st}),_0x3c2857['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x3c2857;}_createLoaderView(){const _0x476d25=new _0x20e82c(this['locale']);return _0x476d25['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':Ts(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x476d25;}},ua=class extends _0x20e82c{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x26bce0,_0x2b78ed){super(_0x26bce0),this['_filesEnabled']=_0x2b78ed['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x26bce0,{'bodyCollection':_0x2b78ed['bodyCollection'],'searchInputVisibleFrom':_0x2b78ed['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x26bce0),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x26bce0),this['_loaderView']=this['_createLoaderView'](_0x26bce0),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x26bce0),this['_dropZoneView']=new po(_0x26bce0),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x133126=>!_0x133126),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'](...Qo)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x1bdb26=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x1bdb26['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x1bdb26['if']('isLoading','ck-hidden',_0x1e9996=>_0x1e9996||!this['isModelAvailable']),_0x1bdb26['if']('isModelAvailable','ck-hidden',_0xc01b0c=>!_0xc01b0c||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x1bdb26['if']('isLoading','ck-hidden',_0x2f0e41=>!_0x2f0e41)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x1bdb26['if']('isModelAvailable','ck-hidden',_0x35c1e0=>_0x35c1e0)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x317702({'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(_0x59fccc,_0x538653){return new ha(_0x59fccc,_0x538653);}_createPromptInputView(_0x4d8b86){return new Io(_0x4d8b86,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x565fb8){return new No(_0x565fb8);}_createLoaderView(_0x337df4){return new la(_0x337df4);}_createModelUnavailableMessageView(_0x513976){const _0x5668f0=new da(_0x513976);return _0x5668f0['delegate']('startConversation')['to'](this),_0x5668f0;}_handlePromptInputFocus(_0x273744,_0x54a330,_0x3468ea){_0x3468ea?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x2159b7,_0x2484e6){this['_contextPanelView']['addContextItem'](_0x2159b7,_0x2484e6);}removeContextItem(_0x4fdbc6){this['_contextPanelView']['removeContextItem'](_0x4fdbc6);}setContextItemLoading(_0x471b1d,_0x819df6){this['_contextPanelView']['setContextItemLoading'](_0x471b1d,_0x819df6);}setIsUploadInProgress(_0x144069){this['_promptInputView']['setIsUploadInProgress'](_0x144069);}setConversationContext(_0x536f8b){this['_contextPanelView']['setConversationContext'](_0x536f8b);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x222fd6,_0x44037e,_0x58c907){this['_contextPanelView']['updateResourceState'](_0x222fd6,_0x44037e,_0x58c907);}setWebSearch(_0x31fdfe){this['_promptCapabilitiesView']['setWebSearch'](_0x31fdfe);}setReasoning(_0x1686d0){this['_promptCapabilitiesView']['setReasoning'](_0x1686d0);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0xf5af45){this['_contextPanelView']['setAddContextOptions'](_0xf5af45);}setInputPlaceholder(_0x1f3e11){this['_promptInputView']['setPlaceholderText'](_0x1f3e11);}setModelList(_0x12a1e9,_0x6a742){this['_promptCapabilitiesView']['setModelList'](_0x12a1e9,_0x6a742);}setModel(_0x39b38e){_0x39b38e?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x39b38e)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x5bdba8){this['_promptCapabilitiesView']['disableModelSelector'](_0x5bdba8);}populateSourceResourceBalloon(_0x5ea4a6,_0x323988,_0x387482,_0xfacb55){this['_contextPanelView']['populateSourceResourceBalloon'](_0x5ea4a6,_0x323988,_0x387482,_0xfacb55);}['closeSourceResourceBalloon'](_0x350ff2){this['_contextPanelView']['closeSourceResourceBalloon'](_0x350ff2);}focusPromptInput(_0x45e30b=!0x1){this['_promptInputView']['focus'](_0x45e30b);}setPromptInputValue(_0x3ebd1e){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x3ebd1e;}},da=class extends _0x20e82c{constructor(_0xecf659){super(_0xecf659);const _0x185a11=new Vt(_0xecf659);_0x185a11['set']({'label':Ts(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x185a11['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Ts(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x185a11]}]});}},_a=class extends Yt{resizeButton;constructor(_0xa9f531,_0x484c0b){super(_0xa9f531,{'label':_0x484c0b['label'],'class':'ck-ai-header\x20'+_0x484c0b['class'],'icon':_0x484c0b['icon']}),this['set']('isMaximized',!0x1),_0x484c0b['content']&&this['children']['add'](_0x484c0b['content']),_0x484c0b['showResizeButton']&&(this['resizeButton']=Un(_0xa9f531,this),this['children']['add'](this['resizeButton']));}},ga=class extends _0x20e82c{constructor(_0xf6f779){super(_0xf6f779),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Ts(_0xf6f779,'AI_DISCLAIMER_TEXT')}]}]});}};function Aa(_0x195646,_0x2d8b9e){const _0x393869=new Vt(_0x195646);return _0x393869['set']({'label':Ts(_0x195646,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x424bea,'class':'ck-ai-chat__start-conversation\x20'+Hn}),_0x393869['on']('execute',()=>{_0x2d8b9e['fire']('startConversation');}),_0x393869;}var Ia=class extends _0x20e82c{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x39c18e,_0x4ebfcf){super(_0x39c18e),this['_bodyCollection']=Vn(_0x39c18e);const _0x308b86=Aa(_0x39c18e,this);this['chatHeader']=new _a(_0x39c18e,{'label':Ts(_0x39c18e,'AI_CHAT_HEADING'),'icon':_0x124b53,'class':'ck-ai-header_chat','content':_0x308b86,'showResizeButton':_0x4ebfcf['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new uo(_0x39c18e,this['_bodyCollection']),this['chatFeed']['delegate'](...rr)['to'](this),this['chatControls']=new ua(_0x39c18e,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x4ebfcf['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x4ebfcf['filesEnabled']}),this['chatControls']['delegate'](...rr)['to'](this),this['chatDisclaimer']=new ga(_0x39c18e),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x39c18e['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x2e9944,_0x3463f4,_0x5d20d5,_0x5b2ae9){this['chatControls']['populateSourceResourceBalloon'](_0x2e9944,_0x3463f4,_0x5d20d5,_0x5b2ae9);}['closeSourceResourceBalloon'](_0x3b12d1){this['chatControls']['closeSourceResourceBalloon'](_0x3b12d1);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},pa=class extends _0x22445f{static get requires(){return[Is];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0x4048d5){super(_0x4048d5);const _0x5576c8=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Or(),this['_view']=new Ia(this['context']['locale'],{'showResizeButton':_0x5576c8['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'](_0x5576c8),this['_view']['delegate'](...rr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x2497a5,{showDiff:_0x5944ff})=>{this['showDiff']=_0x5944ff;}),this['disableControls'](),_0x5576c8['view']['addTab']({'id':'chat','buttonLabel':Ts(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x124b53,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5576c8['view'],'isMaximized',_0x100afe=>_0x100afe),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x1b0172=>_0x1b0172),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x61651a}){const _0x8a7ba5=this['context']['config']['get']('ai.chat.welcomeMessage')??Ts(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x61651a,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x8a7ba5}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x374715,staticMessage:_0x1cdebc}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x374715,'initialContent':'<p>'+_0x1cdebc+'</p>'});});}async addFeedItemUserMessage(_0xcebc1d){const _0x2a5395=_0xcebc1d['attributes']?.['displayedPrompt']||_0xcebc1d['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xcebc1d['contextItems']['values']()),'initialContent':'<p>'+_0x2a5395+'</p>','id':_0xcebc1d['id']});});}async addFeedItemError({errorMessage:_0xa1f5b2,id:_0x108ef3}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0xa1f5b2+'</p>','id':_0x108ef3});});}async addFeedItemAIReply(_0x5dd686){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5dd686['interactionId']+':'+_0x5dd686['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x5a3fbf){const _0x8320c1=Rs(this['context']),_0x3de620=_0x8320c1['map'](_0x109f89=>_0x109f89['config']['get']('ai.availableReplyActions')||[...kr]);let _0x27053e=_0x3de620['reduce']((_0x9fded1,_0x50eb85)=>_0x9fded1['filter'](_0x135ee7=>_0x50eb85['includes'](_0x135ee7)),_0x3de620[0x0]||[...kr]);const _0x552483=_0x8320c1['every'](_0x99cbd4=>_0x99cbd4['plugins']['has']('TrackChanges')),_0xb41b21=_0x8320c1['map'](_0x282b9a=>_0x282b9a['commands']['get']('trackChanges'));return _0x552483?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0xb41b21,'value',(..._0x49107a)=>_0x49107a['some'](_0x15f745=>_0x15f745))):_0x27053e=_0x27053e['filter'](_0x385227=>'insertSuggestion'!=_0x385227),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x5a3fbf['interactionId']+':'+_0x5a3fbf['id'],'areActionsDisabled':_0x5a3fbf['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x27053e}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x389e1b,_0x152640){return this['_promiseQueue']['enqueue'](async()=>{const _0xd68a6b=this['_view']['chatFeed']['children']['last'];if(_0xd68a6b instanceof ro)return this['_view']['chatFeed']['children']['remove'](_0xd68a6b),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x389e1b['id'],'capabilities':{'isWebSearchEnabled':_0xd68a6b['capabilities']['isWebSearchEnabled']||_0x152640['isWebSearchEnabled'],'isReasoningEnabled':_0xd68a6b['capabilities']['isReasoningEnabled']||_0x152640['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x389e1b['id'],'capabilities':_0x152640});});}async addFeedItemCustomElement(_0x387a94,_0x1c05c4){let _0x1e12ce;return await this['_promiseQueue']['enqueue'](async()=>{_0x1e12ce=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x387a94,'id':_0x1c05c4});}),_0x1e12ce;}removeFeedItem(_0x5e453b){this['_view']['chatFeed']['removeItem'](_0x5e453b);}hasFeedItem(_0x55bbed){return this['_view']['chatFeed']['hasItem'](_0x55bbed);}updateFeedInteractionHeader(_0x50d4bc){const _0x4ce7e7=this['_view']['chatFeed']['children']['find'](_0x5ed358=>_0x5ed358['options']['id']==_0x50d4bc['id']&&_0x5ed358 instanceof ro);_0x4ce7e7&&_0x4ce7e7['set']('isVisible',_0x50d4bc['isVisible']);}async updateFeedItemAIReplyContent(_0x328ceb){const _0x4b2f7e=_0x328ceb['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x49879c=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x328ceb,'abortSignal':_0x49879c,'renderingStrategy':_0x4b2f7e}),_0x328ceb['isDone']&&this['markFeedItemAsDone'](_0x328ceb['id']);});}updateFeedItemAIReplySources(_0x379f52,_0x5dc5ea){this['_view']['chatFeed']['updateWebSources'](_0x379f52,_0x5dc5ea);}async updateFeedItemAIReplySuggestionContent(_0x29afc0){return this['_promiseQueue']['enqueue'](async _0x436953=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x29afc0,'abortSignal':_0x436953}),_0x29afc0['isDone']&&this['markFeedItemAsDone'](_0x29afc0['id']);});}updateFeedItemAIReplySuggestionPartState(_0x300788){this['_view']['chatFeed']['updateSuggestionPartState'](_0x300788);}setSuggestionGating(_0x53c8b9,_0x3bb596){this['_view']['chatFeed']['updateSuggestionGating'](_0x53c8b9,_0x3bb596);}setFeedItemAIReplySuggestionPartActive(_0x1d9693){this['_view']['chatFeed']['setSuggestionPartActive'](_0x1d9693);}markFeedItemAsDone(_0x458530){this['_view']['chatFeed']['markItemAsDone'](_0x458530);}removeFeedInteraction(_0x27cf9a){this['_view']['chatFeed']['getItemIds']()['filter'](_0x17bcc4=>_0x17bcc4['startsWith'](_0x27cf9a))['forEach'](_0x4b4753=>this['_view']['chatFeed']['removeItem'](_0x4b4753));}startInteraction(){const _0x23e463=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x23e463),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x12f09d){this['_promiseQueue']['abort'](),_0x12f09d&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x3e6a90=>_0x3e6a90['startsWith'](_0x12f09d['id']))['forEach'](_0x3fc96a=>this['markFeedItemAsDone'](_0x3fc96a)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x276cc0,_0x469fbe){this['_view']['chatControls']['addContextItem'](_0x276cc0,_0x469fbe);}removeContextItem(_0x47ffa2){this['_view']['chatControls']['removeContextItem'](_0x47ffa2);}setContextItemLoading(_0x10c48c,_0x5bd418){this['_view']['chatControls']['setContextItemLoading'](_0x10c48c,_0x5bd418);}setIsUploadInProgress(_0x5d0a36){this['_view']['chatControls']['setIsUploadInProgress'](_0x5d0a36);}setConversationContext(_0x50a194){this['_view']['chatControls']['setConversationContext'](_0x50a194);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x3d54bd,_0x55b754,_0x369a65){this['_view']['chatControls']['updateResourceState'](_0x3d54bd,_0x55b754,_0x369a65);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x4f4e90){this['_view']['chatControls']['setAddContextOptions'](_0x4f4e90);}updateCapabilities(_0x7a6093){this['_view']['chatControls']['setWebSearch'](_0x7a6093['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x7a6093['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x7a6093));}setSelectedModel(_0x4d4e98,_0x410c33){this['_view']['chatControls']['setModel'](_0x4d4e98),_0x410c33&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x140908){this['feedItemRenderingStrategy']=_0x140908;}toggleLoadingSkeleton(_0x575d8f){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x575d8f);}resetConversationTitle(){this['setConversationTitle'](Ts(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x85b8e1,_0x5c7336=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x5c7336&&!Et()&&_0x85b8e1['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x85b8e1);this['_view']['chatHeader']['label']=_0x85b8e1;}setLoadingMessage(_0xab8439){this['_view']['chatFeed']['setLoadingMessage'](_0xab8439);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x4d220e){let _0x10fd4f=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x4d220e[_0x10fd4f],_0x10fd4f++,_0x10fd4f===_0x4d220e['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x25a812){return _0x25a812['isWebSearchEnabled']&&_0x25a812['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x25a812['isWebSearchEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x25a812['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x5be2d6){return _0x5be2d6?_0x5be2d6['isWebSearchEnabled']&&_0x5be2d6['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x5be2d6['isWebSearchEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x5be2d6['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x23587,_0xc14026,_0x5ca544,_0x983b83){this['_view']['populateSourceResourceBalloon'](_0x23587,_0xc14026,_0x5ca544,_0x983b83);}['closeSourceResourceBalloon'](_0x234b8a){this['_view']['closeSourceResourceBalloon'](_0x234b8a);}setPromptInputValue(_0x1e2223){this['_view']['chatControls']['setPromptInputValue'](_0x1e2223);}focusPromptInput(_0x24bb72=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x24bb72);}scrollFeedToSuggestion(_0x33fdb5,_0x9ae138){this['_view']['chatFeed']['scrollToSuggestion'](_0x33fdb5,_0x9ae138);}startAutoScroll(_0x527e1c={}){this['_view']['chatFeed']['startAutoScroll'](_0x527e1c);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x1df56b){_0x1df56b?(this['isBusy']=_0x1df56b,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ea=class extends te{sections;constructor(_0x190ecb,_0x5d5598){super(_0x190ecb),this['sections']=_0x5d5598,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x26d3ee){let _0x198621=0x0,_0x4025f5=0x0;for(const _0x5b3262 of this['sections']){const {resultsCount:_0x3fa5ea,totalItemsCount:_0x416571}=_0x5b3262['filter'](_0x26d3ee);_0x198621+=_0x3fa5ea,_0x4025f5+=_0x416571;}return{'resultsCount':_0x198621,'totalItemsCount':_0x4025f5};}},ma=class extends Zt{title;itemsViews;_itemsListView;constructor(_0x43a3b2,{title:_0x524e5f,items:_0x470d09}){super(_0x43a3b2);const _0xfc6a73=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x524e5f,this['itemsViews']=_0x470d09;const _0x416b19=new _0x20e82c(_0x43a3b2);_0x416b19['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new te(_0x43a3b2),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0xfc6a73['if']('isVisible','ck-hidden',_0x4db7ad=>!_0x4db7ad)]},'children':[_0x416b19,this['_itemsListView']]});}filter(_0x42fb4b){const _0x3a29c2=this['itemsViews']['length'];let _0x1fb8ad=0x0;for(const _0x402885 of this['itemsViews'])_0x42fb4b?(_0x402885['isVisible']=!!_0x402885['isMatching'](_0x42fb4b),_0x402885['highlightText'](_0x42fb4b)):(_0x402885['isVisible']=!0x0,_0x402885['highlightText'](null)),_0x402885['isVisible']&&_0x1fb8ad++;return this['isVisible']=_0x1fb8ad>0x0,{'resultsCount':_0x1fb8ad,'totalItemsCount':_0x3a29c2};}getItem(_0x1022c9){return this['itemsViews']['find'](_0x2e8d9f=>_0x2e8d9f['id']===_0x1022c9);}removeItem(_0x3c5db0){const _0x25bf27=this['itemsViews']['indexOf'](_0x3c5db0);-0x1!==_0x25bf27&&(this['itemsViews']['splice'](_0x25bf27,0x1),this['_itemsListView']['items']['remove'](_0x3c5db0));}};const Ta=/* #__PURE__ -- @preserve */
|
|
34
|
+
_0x3a3fce(Zt);var wa=class AIChatHistoryListItemView extends Ta{['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(_0x39be62,_0x5c0953){super(_0x39be62);const _0x21e721=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x5c0953['pinned']),this['set']('loadingState',null),this['set']('title',_0x5c0953['title']),this['id']=_0x5c0953['id'];const {createdAt:_0x55b262,active:_0x248be9=!0x1}=_0x5c0953;this['_titleView']=new qt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x2ae153=this['_createCheckView'](),_0x44b9af=this['_createPinButtonView'](_0x39be62),_0x35e701=this['_createMenuDropdownView'](),_0x5d261b=this['_createEditInputView'](_0x39be62),_0x4c55f7=this['_createAcceptEditButtonView'](_0x39be62,_0x5d261b),_0x2f8bd8=this['_createCancelEditButtonView'](_0x39be62);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x44b9af),this['actions']['add'](_0x35e701),this['on']('change:isEdit',(_0x56a2f7,_0x397773,_0x4a6d1d)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4a6d1d?(this['actions']['add'](_0x4c55f7),this['actions']['add'](_0x2f8bd8),this['mainContent']['add'](_0x5d261b),_0x5d261b['element']['value']=this['title']||'',_0x5d261b['element']['focus']()):(this['actions']['add'](_0x44b9af),this['actions']['add'](_0x35e701),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x248be9?'ck-ai-chat-history__item--active':'',_0x21e721['if']('isVisible','ck-hidden',_0x24fcab=>!_0x24fcab),_0x21e721['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',_0x21e721['if']('loadingState','ck-hidden',_0x192c72=>!!_0x192c72)]},'children':_0x248be9?[_0x2ae153]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x21e721['if']('loadingState','ck-hidden',_0x3bfecc=>!_0x3bfecc)]},'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',_0x21e721['if']('loadingState','ck-hidden',_0x4e4f1f=>!!_0x4e4f1f)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x21e721['if']('loadingState','ck-hidden',_0x29af67=>!_0x29af67)]},'children':[{'text':_0x21e721['to']('loadingState',_0x28c662=>_0x28c662?Ts(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x28c662]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x55b262]}]},{'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(_0x93f527){this['set']('title',_0x93f527);}updateLoadingState(_0x477f3d,_0xb5406e){this['set']('loadingState',_0xb5406e?_0x477f3d:null);}_createCheckView(){const _0x436d43=new Qt();return _0x436d43['set']({'content':_0x8456a1}),_0x436d43;}_createPinButtonView(_0x1450f9){const _0x47389c=new Vt(_0x1450f9);return _0x47389c['set']({'label':Ts(_0x1450f9,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x3306fa,'withText':!0x1,'tooltip':!0x0}),_0x47389c['bind']('isOn')['to'](this,'pinned'),_0x47389c['on']('execute',()=>{const _0x56b574=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x56b574});}),_0x47389c;}_createMenuDropdownView(){const _0x4cb66e=_0x28f0f7(this['locale']),_0x513b6d=_0x4cb66e['panelView']['children'];_0x4cb66e['buttonView']['set']({'label':Ts(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x4cb66e['panelPosition']='sw';const _0xd010df=new Vt(this['locale']);_0xd010df['label']=Ts(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xd010df['withText']=!0x0,_0xd010df['on']('execute',()=>{this['isEdit']=!0x0;});const _0x1d1b15=new Vt(this['locale']);_0x1d1b15['label']=Ts(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x1d1b15['withText']=!0x0,_0x1d1b15['on']('execute',()=>{this['showConfirm'](Ts(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x314d6b=new te(this['locale']),_0x353319=new Zt(this['locale']);_0x353319['children']['add'](_0xd010df);const _0x53c32c=new Zt(this['locale']);return _0x53c32c['children']['add'](_0x1d1b15),_0x314d6b['items']['addMany']([_0x353319,_0x53c32c]),_0x513b6d['add'](_0x314d6b),_0x4cb66e;}_createEditInputView(_0xfa3ad2){const _0x21f11b=new Xt(_0xfa3ad2),_0x10bf8c=_0x21f11b['bindTemplate'];return _0x21f11b['extendTemplate']({'on':{'keydown':_0x10bf8c['to'](_0x470122=>{'Enter'==_0x470122['key']&&this['_commitEditInputValue'](_0x21f11b);})}}),_0x21f11b;}_createAcceptEditButtonView(_0x213392,_0xb66177){const _0x5991bc=new Vt(_0x213392);return _0x5991bc['set']({'icon':_0x8456a1,'withText':!0x1,'tooltip':Ts(_0x213392,'AI_CHAT_HISTORY_ACCEPT')}),_0x5991bc['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5991bc['on']('execute',()=>{this['_commitEditInputValue'](_0xb66177);}),_0x5991bc;}_commitEditInputValue(_0x458711){const _0x2f8e60=_0x458711['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x2f8e60});}_createCancelEditButtonView(_0x151471){const _0x5caeab=new Vt(_0x151471);return _0x5caeab['set']({'icon':_0x566e32,'withText':!0x1,'tooltip':Ts(_0x151471,'AI_CHAT_HISTORY_CANCEL')}),_0x5caeab['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x5caeab['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x5caeab;}_createSpinnerView(){const _0x1ba5b2=new Mr('tiny');return _0x1ba5b2['isVisible']=!0x0,_0x1ba5b2;}isMatching(_0x55530f){return'string'==typeof this['title']&&this['title']['match'](_0x55530f)?{'title':!0x0}:null;}highlightText(_0x305837){this['_titleView']['highlightText'](_0x305837);}},Ca=class extends _0x20e82c{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x75c486,_0x16ee07){super(_0x75c486),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x45fc85=Aa(_0x75c486,this);this['headerView']=new _a(_0x75c486,{'label':Ts(_0x75c486,'AI_CHAT_HISTORY_HEADING'),'icon':_0x4879bc,'class':'ck-ai-header_history','content':_0x45fc85,'showResizeButton':_0x16ee07}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ea(_0x75c486,[]),this['sectionsView']['delegate'](...fa)['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',_0x510a23=>!_0x510a23)]}}),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 _0x5dcbc1=new _0x3bf48d(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x5ef9f0=>Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x5ef9f0),'secondary':Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1da2cd=this['_createErrorView']();return _0x1da2cd['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0xff356=>!_0xff356)]}}),_0x5dcbc1['on']('render',()=>{_0x5dcbc1['children']['add'](_0x1da2cd,0x1);}),_0x5dcbc1['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x1e256d=>!_0x1e256d)]}}),_0x5dcbc1;}_createSkeletonView(){const _0x390dab=new fr(this['locale'],br['aiHistory']);return _0x390dab['bind']('isVisible')['to'](this,'isLoading'),_0x390dab;}_createErrorView(){const _0x3df105=new _0x20e82c(this['locale']),_0x3c0134=new Vt(this['locale']);_0x3c0134['set']({'withText':!0x1,'icon':_0x566e32,'class':'ck-ai-notification_error__dismiss-button'}),_0x3c0134['bind']('isVisible')['to'](this,'hasItems',_0x51b7c9=>!!_0x51b7c9),_0x3c0134['on']('execute',()=>{this['errorMessage']='';});const _0x58c4a3=this['bindTemplate'];return _0x3df105['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x58c4a3['to']('errorMessage')}]},_0x3c0134]}),_0x3df105;}_createEmptyStateView(){const _0x13a45c=new _0x20e82c(this['locale']);return _0x13a45c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0xc2c9bb=>!_0xc2c9bb)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Ts(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x13a45c;}_createListItemViews(_0x337e2d,_0x185bd7){const _0x398f31=[];for(const _0x4ad397 of _0x337e2d){const _0x435b87=new wa(_0x185bd7,_0x4ad397);_0x435b87['delegate'](...fa)['to'](this),_0x398f31['push'](_0x435b87);}return _0x398f31;}updateHistoryItemsWithCategories(_0xe3bec9){const _0x40b632=this['locale']||'en',_0x20beb7=[];for(const _0xab0801 of _0xe3bec9){const _0xc526d0=this['_createListItemViews'](_0xab0801['items'],_0x40b632);_0x20beb7['push'](new ma(_0x40b632,{'title':_0xab0801['title'],'items':_0xc526d0}));}this['sectionsView']['sections']=_0x20beb7,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x20beb7),this['hasItems']=_0xe3bec9['some'](_0x120634=>_0x120634['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x41474a){for(const _0x1999b8 of this['sectionsView']['sections']){const _0x1f6755=_0x1999b8['getItem'](_0x41474a);if(_0x1f6755){if(_0x1999b8['removeItem'](_0x1f6755),0x0===_0x1999b8['itemsViews']['length']){const _0x4fb4d7=this['sectionsView']['sections']['indexOf'](_0x1999b8);-0x1!==_0x4fb4d7&&(this['sectionsView']['sections']['splice'](_0x4fb4d7,0x1),this['sectionsView']['items']['remove'](_0x1999b8));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x2e7d2e,_0x2ff54a){for(const _0x166ebe of this['sectionsView']['sections']){const _0x3d5f0e=_0x166ebe['getItem'](_0x2e7d2e);if(_0x3d5f0e){_0x3d5f0e['updateTitle'](_0x2ff54a);break;}}}updateItemLoadingState(_0x22ba81,_0x3953d1,_0x5f582d){for(const _0x488b7a of this['sectionsView']['sections']){const _0x4b46b0=_0x488b7a['getItem'](_0x22ba81);if(_0x4b46b0){_0x4b46b0['updateLoadingState'](_0x3953d1,_0x5f582d);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x4e579e=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x4e579e);}}};const fa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var ba=class extends _0x22445f{static get requires(){return[Is];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x31cf36){super(_0x31cf36);const _0x2264c8=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ca(this['context']['locale'],_0x2264c8['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x2264c8),this['_historyView']['delegate'](...fa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x2264c8['view'],'isMaximized',_0x4d5583=>_0x4d5583),_0x2264c8['view']['addTab']({'id':'history','buttonLabel':Ts(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x4879bc,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x8c3766){this['_historyView']['removeHistoryItem'](_0x8c3766);}updateItems(_0xf3de0d){this['_historyView']['updateHistoryItemsWithCategories'](_0xf3de0d);}updateItemTitle(_0x42b535,_0x50254b){this['_historyView']['updateItemTitle'](_0x42b535,_0x50254b);}updateItemLoadingState(_0x22ce1b,_0x319a27,_0x29cc62){this['_historyView']['updateItemLoadingState'](_0x22ce1b,_0x319a27,_0x29cc62);}setLoadingSkeleton(_0xcd9f48){this['_historyView']['isLoading']=_0xcd9f48;}['showError'](_0x352691){this['_historyView']['errorMessage']=_0x352691;}['hideError'](){this['_historyView']['errorMessage']='';}};const Sa=/* #__PURE__ -- @preserve */
|
|
35
|
+
At();var Ra=class extends Sa{['id'];createdAt;constructor({id:_0x1a22b3,title:_0xb99093,createdAt:_0x36e722,updatedAt:_0x28f182,pinned:_0xee21ad}){super(),this['id']=_0x1a22b3,this['createdAt']=new Date(_0x36e722),this['set']('title',_0xb99093),this['set']('updatedAt',_0x28f182?new Date(_0x28f182):null),this['set']('pinned',_0xee21ad||!0x1);}updateTitle(_0x273431){this['set']('title',_0x273431),this['updatedAt']=new Date();}updatePinned(_0x6230ef){this['set']('pinned',_0x6230ef),this['updatedAt']=new Date();}};const Oa=/* #__PURE__ -- @preserve */
|
|
36
|
+
dt();var va=class extends Oa{items=[];connector;['group'];constructor({connector:_0xb02636,group:_0xe186ad}){super(),this['connector']=_0xb02636,this['group']=_0xe186ad;}async init(){try{const _0x54ea6b=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x54ea6b);}catch(_0x180834){this['fire']('error',{'error':_0x180834,'operation':'init'});}}addItem(_0xb0760b){this['items']['push'](_0xb0760b);}async removeItem(_0x30ae4d){const _0x275a04=this['items']['findIndex'](_0x482612=>_0x482612['id']===_0x30ae4d);if(-0x1===_0x275a04)return!0x1;try{return await this['connector']['deleteConversation'](_0x30ae4d)['execute'](),this['items']['splice'](_0x275a04,0x1),this['fire']('itemRemoved',{'itemId':_0x30ae4d}),!0x0;}catch(_0x3e6fc1){return this['fire']('error',{'error':_0x3e6fc1,'operation':'removeItem','itemId':_0x30ae4d}),!0x1;}}getItem(_0x1458b4){return this['items']['find'](_0x4a0c72=>_0x4a0c72['id']===_0x1458b4);}async updateItemTitle(_0x341811,_0x32141f){const _0x5e2f54=this['getItem'](_0x341811);if(!_0x5e2f54)return!0x1;try{return await this['connector']['updateConversation'](_0x341811,{'title':_0x32141f})['getResult'](),_0x5e2f54['updateTitle'](_0x32141f),this['fire']('itemUpdated',{'itemId':_0x341811,'updates':{'title':_0x32141f}}),!0x0;}catch(_0x3b91bf){return this['fire']('error',{'error':_0x3b91bf,'operation':'updateItemTitle','itemId':_0x341811}),!0x1;}}async updateItemPinned(_0x447e4e,_0x2827fe){const _0x4a4f71=this['getItem'](_0x447e4e);if(!_0x4a4f71)return!0x1;try{return await this['connector']['updateConversation'](_0x447e4e,{'pinned':_0x2827fe})['getResult'](),_0x4a4f71['updatePinned'](_0x2827fe),this['fire']('itemUpdated',{'itemId':_0x447e4e,'updates':{'pinned':_0x2827fe}}),!0x0;}catch(_0x2606e2){return this['fire']('error',{'error':_0x2606e2,'operation':'updateItemPinned','itemId':_0x447e4e}),!0x1;}}loadItems(_0x2361f6){try{this['items']=[],_0x2361f6['map'](_0xe3623e=>{this['addItem'](new Ra(_0xe3623e));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x270e9d){this['fire']('error',{'error':_0x270e9d,'operation':'loadItems'});}}getItems(_0x36c8c1={}){const _0x202ee4=void 0x0!==_0x36c8c1['pinned']&&_0x36c8c1['pinned'],_0x405d49=_0x36c8c1['from']?new Date(_0x36c8c1['from']['getFullYear'](),_0x36c8c1['from']['getMonth'](),_0x36c8c1['from']['getDate']()):null,_0x3ad726=_0x36c8c1['to']?new Date(_0x36c8c1['to']['getFullYear'](),_0x36c8c1['to']['getMonth'](),_0x36c8c1['to']['getDate']()):null;return this['items']['filter'](_0x5addb1=>{if(_0x5addb1['pinned']!==_0x202ee4)return!0x1;if(_0x3ad726){const _0x187ec8=new Date(_0x5addb1['createdAt']['getFullYear'](),_0x5addb1['createdAt']['getMonth'](),_0x5addb1['createdAt']['getDate']());return _0x405d49?_0x405d49['getTime']()===_0x3ad726['getTime']()?_0x187ec8['getTime']()===_0x405d49['getTime']():_0x187ec8<_0x3ad726&&_0x187ec8>=_0x405d49:_0x187ec8<_0x3ad726;}return!0x0;});}},ka=class extends _0x22445f{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Es,Ln,sr,ba,Is];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Es),this['_aiChatHistoryUi']=this['context']['plugins']['get'](ba),this['_aiChatController']=this['context']['plugins']['get'](sr),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aichathistory');const _0x1cf7ee=this['context']['plugins']['get'](Is);try{const _0x46bf47=this['_aiChatController']['getGroupId']();this['history']=new va({'connector':this['_aiConnector'],'group':_0x46bf47}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x30271d,_0x33b630)=>{this['_setItemLoading'](_0x33b630['id'],'remove'),this['_handleRemove'](_0x33b630['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x57d5d9,_0x223c2c)=>{this['_setItemLoading'](_0x223c2c['id'],'rename'),this['_handleEditTitle'](_0x223c2c['id'],_0x223c2c['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x545439,_0x457f1e)=>{void 0x0!==_0x457f1e['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x457f1e['itemId'],_0x457f1e['updates']['title']),void 0x0!==_0x457f1e['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x457f1e['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x2971da,_0x150b29)=>{this['_aiChatController']['_handleRemovedConversation'](_0x150b29['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x150b29['itemId']),this['_clearItemLoading'](_0x150b29['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x111b4c,_0x2a9715)=>{this['_handleHistoryErrorUI'](_0x2a9715['error'],_0x2a9715['operation'],_0x2a9715['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x332365,_0x2a8a18)=>{this['_handleSelectConversation'](_0x2a8a18['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x5189db,_0x594835)=>{const _0x56dfa3=_0x594835['pinned']?'pin':'unpin';this['_setItemLoading'](_0x594835['id'],_0x56dfa3),this['_handleTogglePin'](_0x594835['id'],_0x594835['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x1cf7ee['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x1cf7ee['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x4b321a){this['_handleHistoryErrorUI'](_0x4b321a,'init');}}async _handleEditTitle(_0x36b068,_0x94a96d){await this['history']['updateItemTitle'](_0x36b068,_0x94a96d);}async['_handleTogglePin'](_0xf5dfb,_0x2aa995){await this['history']['updateItemPinned'](_0xf5dfb,_0x2aa995);}async['_handleRemove'](_0x37adfc){await this['history']['removeItem'](_0x37adfc);}async _handleSelectConversation(_0x36fe08){await this['_aiChatController']['loadConversation'](_0x36fe08);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x387e4d=this['_aiChatController']['activeConversation']?.['id'],_0x1acafc=this['_getCategorizedItems']()['map'](_0x380824=>({'title':_0x380824['title'],'items':_0x380824['items']['map'](_0xcb6780=>({'id':_0xcb6780['id'],'title':_0xcb6780['title']||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0xcb6780['createdAt'])['toLocaleDateString'](),'active':_0xcb6780['id']===_0x387e4d,'pinned':_0xcb6780['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x1acafc);}_setItemLoading(_0x788ded,_0x5c6d07){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x788ded,_0x5c6d07,!0x0);}_clearItemLoading(_0x4344ca){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4344ca,null,!0x1);}_handleHistoryErrorUI(_0x407f51,_0x444e23,_0x2e316c){const _0x4a84e1=this['_generateErrorMessage'](_0x444e23,_0x2e316c);this['_aiChatHistoryUi']['showError'](_0x4a84e1),this['_reporter']['reportError'](_0x407f51,{'context':{'operation':_0x444e23}}),_0x2e316c&&this['_clearItemLoading'](_0x2e316c),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x1e3ad0,_0x322352){const _0x3da316=_0x322352?this['history']['getItem'](_0x322352):null,_0x41fe2a=_0x3da316?.['title']||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x1e3ad0){case'updateItemTitle':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x41fe2a);case'updateItemPinned':{const _0x369a06=Ts(this['context']['locale'],_0x3da316?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x369a06,_0x41fe2a]);}case'removeItem':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x41fe2a);case'init':case'loadItems':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x49903d=new Date(),_0x132724=new Date(_0x49903d['getFullYear'](),_0x49903d['getMonth'](),_0x49903d['getDate']()),_0x3fae64=new Date(_0x132724);_0x3fae64['setDate'](_0x3fae64['getDate']()-0x1);const _0x31198e=new Date(_0x132724);_0x31198e['setDate'](_0x31198e['getDate']()-0xe);const _0x242d26=this['history']['getItems']({'pinned':!0x0}),_0x8978ae=this['history']['getItems']({'from':_0x132724,'to':_0x132724}),_0x3b693e=this['history']['getItems']({'from':_0x3fae64,'to':_0x3fae64}),_0x4500cf=this['history']['getItems']({'from':_0x31198e,'to':_0x3fae64}),_0x4d2105=this['history']['getItems']({'to':_0x31198e}),_0x3ff44b=[];return _0x242d26['length']>0x0&&_0x3ff44b['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x242d26}),_0x8978ae['length']>0x0&&_0x3ff44b['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x8978ae}),_0x3b693e['length']>0x0&&_0x3ff44b['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x3b693e}),_0x4500cf['length']>0x0&&_0x3ff44b['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x4500cf}),_0x4d2105['length']>0x0&&_0x3ff44b['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x4d2105}),_0x3ff44b;}},ya=class extends _0x22445f{static get requires(){return[ka,ba];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},Na=class extends _0x22445f{static get requires(){return[sr,sn,pa,ya,yn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2da649){super(_0x2da649),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},xa=class extends Vt{['id'];constructor(_0x26ba18,_0x178a02){super(_0x26ba18);const {id:_0x4909af,type:_0x4cce12,icon:_0x3f948a}=_0x178a02;this['id']=_0x4909af,this['set']({'label':_0x178a02['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x178a02['id']}}),_0x3f948a?this['icon']=_0x3f948a:'chat'===_0x4cce12?this['icon']=_0x124b53:'review'===_0x4cce12?this['icon']=_0xceba15:'translate'===_0x4cce12&&(this['icon']=_0x2165a0);}},La=class extends _0x20e82c{listView;constructor(_0x461f28,_0x31f55a){super(_0x461f28),this['set']('isEnabled',!0x0);const _0x4c7fde=_0x31f55a['map'](_0x134e07=>{const _0x3a601e=new Zt(this['locale']),_0x181961=new xa(this['locale'],_0x134e07);return _0x181961['bind']('isEnabled')['to'](this),_0x3a601e['children']['add'](_0x181961),_0x181961['delegate']('execute')['to'](this),_0x3a601e;});this['listView']=new te(this['locale']),this['listView']['items']['addMany'](_0x4c7fde),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const Pa='chat-shortcuts';var Da=class extends _0x22445f{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[pa,Ss];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](pa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x2545fc=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x28adc1=_0x2545fc['activeConversation'];_0x28adc1['isFromHistory']||this['_injectShortcuts'](_0x28adc1);}),this['listenTo'](_0x2545fc,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x29eadd=['chat','review','translate'];this['_shortcuts']['forEach'](_0x15ed24=>{let _0x1e48ca=!0x0;if(_0x15ed24['id']&&_0x15ed24['label']&&_0x29eadd['includes'](_0x15ed24['type'])?'chat'===_0x15ed24['type']&&(_0x1e48ca='string'==typeof _0x15ed24['prompt']):_0x1e48ca=!0x1,!_0x1e48ca)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x15ed24});});}_injectShortcuts(_0x5b4750){this['_removeShortcuts'](),this['_shortcutsView']=new La(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Pa),this['_shortcutsView']['on']('execute',_0x519553=>{const _0x341264=_0x519553['source']['id'];this['_executeShortcut'](_0x341264);}),this['_listenedConversation']=_0x5b4750,this['listenTo'](_0x5b4750,'uploadProgressChanged',(_0x4bfec8,_0x47af96)=>{this['_shortcutsView']['isEnabled']=!_0x47af96['isUploadInProgress'];});}_removeShortcuts(){const _0x33868c=this['context']['plugins']['get'](pa);_0x33868c['hasFeedItem'](Pa)&&_0x33868c['removeFeedItem'](Pa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x336211){const _0x9de77e=this['_shortcuts']['find'](_0x590ea7=>_0x590ea7['id']===_0x336211),_0x513f48=_0x9de77e['type'];'chat'===_0x513f48?this['_runChatShortcut'](_0x9de77e):'review'===_0x513f48?_0x9de77e['commandId']?this['_runReviewShortcut'](_0x9de77e):this['_switchTab']('reviewMode'):'translate'===_0x513f48&&(_0x9de77e['language']?this['_runTranslateShortcut'](_0x9de77e):this['_switchTab']('translate'));}_switchTab(_0x4c0969){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x4c0969});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x4c0969);}async _runChatShortcut({id:_0x69c2d3,prompt:_0x1e50f8,draftMode:_0x19f14e,useWebSearch:_0x42a8b4=!0x1,useReasoning:_0x46973b=!0x1,model:_0x82e3e1}){const _0x22ee43=this['context']['plugins']['get']('AIChatController'),_0x55ec52=_0x22ee43['activeConversation'],_0x557474=this['context']['plugins']['get'](Ss),_0x31f339=await _0x557474['models']['resolveModel'](_0x82e3e1);_0x31f339&&await _0x55ec52['setModel'](_0x31f339),_0x55ec52['setWebSearch'](_0x42a8b4),_0x55ec52['setReasoning'](_0x46973b);const _0x52c3fd=_0x557474['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x69c2d3],'idScopedOnly':!0x0,'context':new qn()});_0x55ec52['addDefaultContext'](_0x52c3fd['refs']),_0x22ee43['addCurrentDocumentToChatContext'](),_0x19f14e?(this['_aiChatUI']['setPromptInputValue'](_0x1e50f8),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x22ee43['sendMessage']({'message':_0x1e50f8});}_runReviewShortcut({commandId:_0x275e07,model:_0x3414dc,prompt:_0x386896,params:_0x589363}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x253a8d={'id':_0x275e07,'isCustom':'custom'===_0x275e07};_0x3414dc&&_0x386896&&(_0x253a8d['args']={'model':_0x3414dc,'prompt':_0x386896}),_0x589363&&(_0x253a8d['params']=_0x589363),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x253a8d);}_runTranslateShortcut({language:_0x2f7404}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x2f7404,'args':{'language':_0x2f7404}});}},Ha=class extends _0x4045df{constructor(_0x598812){super(_0x598812);const _0x4cb9b0=_0x598812['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x4cb9b0,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x560eb2=this['editor']['plugins']['get']('AITabs')['view'];_0x560eb2['isVisible']=!_0x560eb2['isVisible'];}},Ma=class extends _0x46e624{static get requires(){return[Is];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x24e212=this['editor'];_0x24e212['commands']['add']('toggleAi',new Ha(_0x24e212)),_0x24e212['ui']['componentFactory']['add']('toggleAi',()=>{const _0x50377e=this['_createAIUIButton'](Vt);return _0x50377e['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x50377e;}),_0x24e212['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3779c9=this['_createAIUIButton'](_0x5a4190);return _0x3779c9['set']({'role':'menuitemcheckbox'}),_0x3779c9;});}_createAIUIButton(_0x4b0aa0){const _0x14c624=this['editor'],_0xe61940=_0x14c624['commands']['get']('toggleAi'),_0x483cf7=new _0x4b0aa0(_0x14c624['locale']);return _0x483cf7['set']({'label':Ts(_0x14c624['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x2e6222,'isToggleable':!0x0}),_0x483cf7['bind']('isEnabled')['to'](_0xe61940),_0x483cf7['bind']('isOn')['to'](_0xe61940,'value',_0x56d083=>!!_0x56d083),this['listenTo'](_0x483cf7,'execute',()=>{_0xe61940['execute']();}),_0x483cf7;}};const Ua=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Va=class extends _0x20e82c{['_errorView'];constructor(_0x126bde){super(_0x126bde),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x497d48){this['showError'](_0x497d48);}['showError'](_0x416115){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x416115,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x1549c0=new _0x20e82c(this['locale']),_0xc21ada=new _0x20e82c(this['locale']);return _0xc21ada['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x1549c0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x492b76=>!_0x492b76)]},'children':[_0xc21ada]}),_0x1549c0;}};const Ba=0xa;var Ga=class extends _0x22445f{static get requires(){return[sn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x6dd3f7){const {id:_0x2ba210}=this['_currentConfig']??{};this['_currentConfig']=_0x6dd3f7,this['_editor']=_0x6dd3f7['targetEditor'];const {id:_0x253be7}=this['_currentConfig'];this['isOpen']&&_0x2ba210===_0x253be7?this['_updateDialog']():this['_showDialog']();}['close'](){const _0xba96cf=this['_editor'];if(!_0xba96cf)return;const _0x2f3758=_0xba96cf['plugins']['get']('Dialog');_0x2f3758['isOpen']&&this['_currentConfig']&&_0x2f3758['id']===this['_currentConfig']['id']&&_0x2f3758['hide']();}_updateDialog(){const _0x69a3f6=this['_editor']['plugins']['get']('Dialog'),{icon:_0xdc5cdd,title:_0x5bc4ca}=this['_currentConfig'];_0x69a3f6['view']?.['headerView']&&(_0x69a3f6['view']['headerView']['label']=_0x5bc4ca,_0x69a3f6['view']['headerView']['iconView']&&_0xdc5cdd&&(_0x69a3f6['view']['headerView']['iconView']['content']=_0xdc5cdd)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x69a3f6['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](sn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](sn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0xd5c82=this['_editor']['plugins']['get']('Dialog'),{id:_0x2adbed,title:_0x55d67b,icon:_0xf67642,class:_0x16c635,mainView:_0x36bc6e}=this['_currentConfig'];_0x36bc6e['delegate'](...Ua)['to'](this),_0xd5c82['show']({'title':_0x55d67b,'icon':_0xf67642,'hasCloseButton':!0x0,'id':_0x2adbed,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x16c635||''),'content':_0x36bc6e,'onShow':_0x38e913=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x38e913['view']?.['updatePosition']();const _0x112607=this['_getSelectionElements']();_0x112607&&_0x112607[0x0]&&kt({'target':_0x112607[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x38e913['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x2adbed});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x2adbed}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x2e9132,_0x595b5a,_0x4026bf){const _0x360765=_0x595b5a||_0x4026bf;if(!_0x360765)return null;const _0x3ac5c3=this['_getSelectionElements']();if(!_0x3ac5c3||0x0===_0x3ac5c3['length'])return{'left':Math['round'](_0x360765['left']+_0x360765['width']/0x2-_0x2e9132['width']/0x2),'top':Math['round'](_0x360765['top']+_0x360765['height']/0x2-_0x2e9132['height']/0x2)};const _0x7a2883=Math['round'](_0x360765['left']+_0x360765['width']/0x2-_0x2e9132['width']/0x2),_0xbb5774=_0x3ac5c3['map'](_0x1a1ff6=>new It(_0x1a1ff6)),_0x2017c8=_0x2e9132['height'];return{'left':_0x7a2883,'top':this['_calculateOptimalTopPosition'](_0xbb5774,_0x2017c8,_0x360765)};}_calculateOptimalTopPosition(_0x2a1aa3,_0x15ad16,_0x4bf1fe){const _0x13e437=new It(Ct['window']),_0x3d5227=_0x2a1aa3['map'](_0x21e601=>_0x21e601['getVisible']())['filter'](_0x1222a0=>_0x1222a0),_0x385797=It['getBoundingRect'](_0x3d5227);if(!_0x385797)return Math['round'](_0x4bf1fe['top']+_0x4bf1fe['height']/0x2);const _0x243a7e=_0x13e437['getIntersection'](_0x385797);if(!_0x243a7e)return Math['round'](_0x4bf1fe['top']+_0x4bf1fe['height']/0x2);const _0x1e1ec3=_0x4bf1fe['getVisible'](),_0x1a8738=_0x1e1ec3&&_0x385797['height']>_0x1e1ec3['height'],_0xb91eed=_0x243a7e['top'],_0x2c450a=_0x243a7e['bottom'];if(_0x1a8738){const _0x3a3295=_0x13e437['top']+_0x13e437['height']/0x2-_0x15ad16/0x2,_0x56ae0f=_0xb91eed-Ba-_0x13e437['top'],_0x42635b=_0x13e437['bottom']-_0x2c450a-Ba;return _0x56ae0f>=_0x15ad16?Math['max'](Ba,_0xb91eed-_0x15ad16-Ba):_0x42635b>=_0x15ad16?_0x2c450a+Ba:Math['max'](Ba,_0x3a3295);}const _0x284b03=_0xb91eed-_0x15ad16,_0x4e1bb1=_0x13e437['bottom']-_0x2c450a-Ba,_0x8c2b29=_0xb91eed-Ba-_0x13e437['top'];let _0x2a0bc8;return _0x2a0bc8=_0x4e1bb1>=_0x15ad16?_0x2c450a+Ba:_0x8c2b29>=_0x15ad16?_0x284b03-Ba:_0xb91eed+_0x385797['height']/0x2-_0x15ad16/0x2,_0x2a0bc8;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x52b426=this['_editor'];this['listenTo'](_0x52b426['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x540a64,data:{newRange:_0x2bb025}}of _0x52b426['model']['document']['differ']['getChangedMarkers']())if(_0x540a64['startsWith']('ai-selection:')&&(_0x2bb025&&(_0x2bb025['start']['isEqual'](_0x2bb025['end'])||'$graveyard'==_0x2bb025['root']['rootName'])||null==_0x2bb025)){const _0x1001a8=Ts(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x1001a8),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x200ec2=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x200ec2['model']['document']);}_getSelectionElements(){const _0x3cf3c8=this['_editor'];return _0x305ebf(_0x3cf3c8['editing'],[..._0x3cf3c8['model']['markers']['getMarkersGroup']('ai-selection'),..._0x3cf3c8['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x32695e=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x32695e&&_0x32695e['rootName']?_0x32695e['rootName']:null;}},Fa=class extends _0x5b0bf4{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0xebf6e1,_0xdd29e6={}){super(_0xebf6e1),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0xdd29e6};const _0x27dd00=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x27dd00?'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(_0x51b6e7){this['showChangesButton']['isEnabled']=_0x51b6e7;}_setupRatingButtons(){this['likeButton']=new Vt(this['locale']),this['likeButton']['set']({'icon':at,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Mn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Vt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Mn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Vt(this['locale']),this['copyButton']['set']({'icon':_0x3b88cb,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Mn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x4e31ee=new Qt();_0x4e31ee['set']({'content':_0x8456a1}),_0x4e31ee['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'+Mn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Mn;},0x7d0);}),this['copyButton']['children']['add'](_0x4e31ee);}_setupShowChangesButton(){this['showChangesButton']=new Vt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Ts(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Mn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x1d19ef=>_0x1d19ef?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ka=class extends Va{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0xcec56f,_0x4e0b7c){super(_0xcec56f);const _0x57334d=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x4e0b7c,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new wr(_0xcec56f),this['_partToolbarView']=new Er(_0xcec56f,_0x4e0b7c['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x58d794,_0x269fae)=>!_0x58d794&&!_0x269fae),this['_togglePartToolbarButtonsVisibility'](_0x4e0b7c),this['_stateView']=new Ir(_0xcec56f),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Fa(_0xcec56f,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Wa(_0xcec56f,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x2ccbb,_0x248363,_0x4b398d,_0x48372c)=>{let _0x240e3c,_0x24914b;'pending'===_0x48372c?(_0x240e3c=this['_partToolbarView'],_0x24914b=this['_stateView']):(_0x240e3c=this['_stateView'],_0x24914b=this['_partToolbarView']),this['_stateView']['setState'](_0x4b398d,this['_outdatedReason']),_0x240e3c['isVisible']=!0x1,_0x24914b['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x57334d['to']('_state',_0x4888d0=>'ck-ai-chat-balloon-main_state_'+_0x4888d0)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x4e0b7c);});}['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(_0x55cfc3){_0x55cfc3?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x55cfc3);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x44c6e0,_0x3cfb7f){this['_outdatedReason']=_0x3cfb7f,this['_state']=_0x44c6e0;}['showError'](_0x3fd273){super['showError'](_0x3fd273),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x122da5){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x122da5;}_togglePartToolbarButtonsVisibility({showApplyButton:_0x294f6f,showSuggestButton:_0x28dcd2}){_0x294f6f=_0x294f6f&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x28dcd2=_0x28dcd2&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x294f6f,'showSuggestButton':_0x28dcd2});}_createNextButtonView(){const _0x531ccb=new Vt(this['locale']);return _0x531ccb['set']({'icon':_0x2cf145,'label':Ts(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x531ccb['on']('execute',()=>{this['fire']('showNext');}),_0x531ccb;}_createPreviousButtonView(){const _0x4e84f1=new Vt(this['locale']);return _0x4e84f1['set']({'icon':_0x1b3c5d,'label':Ts(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x4e84f1['on']('execute',()=>{this['fire']('showPrevious');}),_0x4e84f1;}},Wa=class extends _0x20e82c{constructor(_0x421471,_0x1be6c4){super(_0x421471),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x1be6c4});}},Ya=class extends _0x46e624{static get requires(){return[Bt,Ga];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x454d95){super(_0x454d95),this['set']('showDiff',!0x1);}['open'](_0x368cf4){const _0x32b301=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x32b301['plugins']['get']('AIBalloon')['open']({..._0x368cf4,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x368cf4['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x368cf4['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x368cf4['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x162d2c){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x162d2c);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x262b8b,_0x9ade1a){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x262b8b,_0x9ade1a);}setTargetReadOnly(_0x403f16){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x403f16);}_createChatBalloonView(){const _0x334fb7=this['editor'],_0x3fa8f1=_0x334fb7['plugins']['get']('AIBalloon'),_0xfb53b7=_0x334fb7['commands']['get']('trackChanges');let _0x1a78a0=_0x334fb7['config']['get']('ai.availableReplyActions')||[...kr];_0x334fb7['plugins']['has']('TrackChanges')||(_0x1a78a0=_0x1a78a0['filter'](_0x5b8618=>'insertSuggestion'!=_0x5b8618));const _0x27efb9=new Ka(_0x334fb7['locale'],{'availableActions':_0x1a78a0,'showApplyButton':!0x0,'showSuggestButton':!!_0xfb53b7});return _0x27efb9['bind']('showDiff')['to'](this),_0x27efb9['delegate'](...nr)['to'](this),_0x27efb9['delegate']('showPrevious','showNext')['to'](this),_0x3fa8f1['delegate']('dialogClosed')['to'](this),_0x27efb9['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x27efb9['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x27efb9['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xfb53b7&&_0x27efb9['bind']('isTrackChangesOn')['to'](_0xfb53b7,'value'),_0x27efb9['render'](),_0x27efb9;}_toggleRotatorButtonsInDialogHeader(_0x513ea8){const _0x49e3d3=this['editor'],_0x403c60=_0x49e3d3['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x513ea8),_0x403c60['has'](this['_chatBalloonView']['previousButtonView'])||(_0x403c60['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x49e3d3['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x403c60['remove'](this['_chatBalloonView']['previousButtonView']),_0x403c60['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},$a=class extends _0x46e624{static get requires(){return[Ma,Ya,_0x2bcf6c];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function qa(_0x71da94){const {editor:_0x3d2a8e,action:_0x4cce27,withText:_0x4fdff8=!0x1,withIcon:_0x1893ff=!0x0,isInDropdown:_0x4afe35=!0x0,shouldPreventFocus:_0x4d3250=!0x1,actionButtons:_0x332dfb}=_0x71da94;return()=>{const _0x43b1b3=_0x3d2a8e['locale'],_0x46aa95=new Vt(_0x43b1b3),_0x1a7f50=_0x46aa95['bindTemplate'];_0x4afe35&&_0x46aa95['extendTemplate']({'on':{'mouseenter':_0x1a7f50['to'](()=>{_0x4d3250&&_0x4d3250()||_0x46aa95['focus']();})}}),_0x332dfb['push']({'buttonView':_0x46aa95,'action':_0x4cce27});const _0x3b9348=_0x4cce27['icon']??_0x4cce27['parent']?.['icon'];return _0x46aa95['set']({'label':_0x4cce27['label'],'withText':_0x4fdff8,'role':'menuitem','icon':_0x1893ff?_0x3b9348??_0x3e8565:void 0x0,'tooltip':!_0x4fdff8,'class':'ck-ai-quick-actions-button','isEnabled':_0x4cce27['isEnabled']}),_0x46aa95['on']('execute',()=>{_0x3d2a8e['editing']['view']['focus'](),_0x3d2a8e['commands']['execute']('aiQuickAction',_0x4cce27);}),_0x46aa95;};}var Qa=class extends jt{['arrowView'];constructor(_0x489fdd,_0x334d66){super(_0x489fdd,_0x334d66);const _0x5ccc61=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',_0x2e56ac=>String(_0x2e56ac)),'data-cke-tooltip-disabled':_0x5ccc61['to']('isOn')},'on':{'mouseenter':_0x5ccc61['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x1a51a2=new Qt();return _0x1a51a2['content']=_0x222309,_0x1a51a2['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x1a51a2;}},Xa=class extends te{_allListItems;_allSearchableItems;constructor(_0x460cd4,_0x17d521,_0x301bc6){super(_0x460cd4),this['_allListItems']=_0x17d521,this['_allSearchableItems']=_0x301bc6;}filter(_0x8e0b38){if(!_0x8e0b38)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x3bfadb=_0x8e0b38['source']['toLowerCase']()['trim'](),_0x452563=this['_allSearchableItems']['filter'](_0x57d3d2=>(_0x57d3d2['groupLabel']?_0x57d3d2['label']+'\x20('+_0x57d3d2['groupLabel']+')':_0x57d3d2['label'])['toLowerCase']()['includes'](_0x3bfadb));return this['items']['clear'](),this['items']['addMany'](_0x452563['sort']((_0x3cc66c,_0x209827)=>{const _0x53b1d3=_0x3cc66c['groupLabel'],_0x5971c6=_0x209827['groupLabel'];return _0x53b1d3||_0x5971c6?_0x53b1d3?0x1:-0x1:0x0;})['map'](_0x429628=>_0x429628['item'])),this['_highlightQuery'](_0x3bfadb,_0x452563),{'resultsCount':_0x452563['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x2ac62f,_0x10f251){if(!_0x2ac62f)return;const _0x374f76=new RegExp(_0x5b1451(_0x2ac62f),'gi');_0x10f251['forEach'](_0x3c6179=>{_0x3c6179['highlightViews']&&_0x3c6179['highlightViews']['forEach'](_0xfb435d=>{'function'==typeof _0xfb435d['highlightText']&&_0xfb435d['highlightText'](_0x374f76);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x55977f=>{_0x55977f['highlightViews']&&_0x55977f['highlightViews']['forEach'](_0x197aee=>{'function'==typeof _0x197aee['highlightText']&&_0x197aee['highlightText'](null);});});}};const za='menu',ja='menuitem';var Ja=class extends _0x20e82c{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x3e1aaa,_0x1d0756,_0x23a00e,_0xa5f30f,_0x5260e2=!0x1,_0x4e0167=[]){const _0x27252e=_0x3e1aaa['locale'];super(_0x27252e),this['_bodyCollection']=_0xa5f30f,this['_hasSearch']=_0x5260e2,this['_actionButtons']=_0x4e0167;const _0x20b725=this['_createListItems'](_0x3e1aaa,_0x1d0756,_0x23a00e);this['optionsListView']=new Xa(_0x27252e,_0x20b725,this['_allSearchableItems']),this['optionsListView']['role']=za,this['optionsListView']['items']['addMany'](_0x20b725),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x5260e2&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x20b725,this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x5260e2&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x173210=_0x5260e2&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x261c11(_0x173210),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x27252e['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x3bf48d(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Ts(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Ts(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x545f9e=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x545f9e);}_createListItems(_0x43713f,_0x4751ff,_0x37efca){const _0x4acc65=new _0x261c11();return _0x4751ff['forEach'](_0x310150=>{if('actions'in _0x310150){const {listItem:_0x982947}=this['_createActionGroupButton'](_0x43713f,_0x310150,_0x37efca);_0x4acc65['add'](_0x982947),_0x310150['actions']['forEach'](_0x17ed14=>{const {listItem:_0xa5de6,highlightViews:_0x2b479e}=this['_createSearchResultActionButton'](_0x43713f,_0x17ed14,_0x310150['label'],_0x310150['icon']);this['_allSearchableItems']['push']({'item':_0xa5de6,'label':_0x17ed14['label'],'groupLabel':_0x310150['label'],'highlightViews':_0x2b479e});});}else{const {listItem:_0x2ad4bf}=this['_createActionButton'](_0x43713f,_0x310150);_0x4acc65['add'](_0x2ad4bf);const _0x56a63f=_0x2ad4bf['children']['first'];if(_0x56a63f){const {listItem:_0x2ac692,highlightViews:_0x6d0b50}=this['_createSearchResultActionButton'](_0x43713f,_0x310150);this['_allSearchableItems']['push']({'item':_0x2ac692,'label':_0x56a63f['label']||'','highlightViews':_0x6d0b50});}}}),_0x4acc65;}_createActionButton(_0x272223,_0xa71d85,_0x22bfe6,_0x268d65){const _0x34c58c=new Zt(this['locale']);if(_0x22bfe6&&_0x268d65){const _0x15dc4e=new Vt(this['locale']),_0x4d496c=_0x15dc4e['bindTemplate'],_0x35adb4=new qt();_0x35adb4['text']=_0xa71d85['label'];const _0x5c7c0c=new qt();_0x5c7c0c['text']=_0x22bfe6;const _0x1651fd=new Qt();_0x1651fd['content']=_0x268d65,_0x1651fd['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3964fe=new _0x20e82c(this['locale']);_0x3964fe['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x511af3=new _0x20e82c(this['locale']);return _0x511af3['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x15dc4e['set']({'label':_0xa71d85['label']+'\x20('+_0x22bfe6+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0xa71d85['isEnabled']}),_0x15dc4e['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x4d496c['if']('isEnabled','ck-disabled',_0xc55ec2=>!_0xc55ec2)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x35adb4,_0x3964fe,_0x1651fd,_0x5c7c0c,_0x511af3],'on':{'mouseenter':_0x4d496c['to'](()=>{this['_isSearchFocused']()||_0x15dc4e['focus']();}),'click':_0x4d496c['to'](()=>{_0x15dc4e['fire']('execute');})}}),_0x15dc4e['on']('execute',()=>{_0x15dc4e['isEnabled']&&(_0x272223['editing']['view']['focus'](),_0x272223['commands']['execute']('aiQuickAction',_0xa71d85));}),_0x34c58c['children']['add'](_0x15dc4e),this['_actionButtons']['push']({'buttonView':_0x15dc4e,'action':_0xa71d85}),{'listItem':_0x34c58c,'highlightViews':[_0x35adb4,_0x5c7c0c]};}{const _0x2d3b10=new Ut(),_0x2c78ad=new Vt(this['locale'],_0x2d3b10),_0x3031bf=_0x2c78ad['bindTemplate'],_0x4b0007=_0xa71d85['icon']??_0xa71d85['parent']?.['icon'],_0x227508=void 0x0!==_0xa71d85['icon'];return _0x2c78ad['set']({'label':_0xa71d85['label'],'withText':!0x0,'role':'menuitem','icon':_0x227508?_0x4b0007??_0x3e8565:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0xa71d85['isEnabled']}),_0x2c78ad['extendTemplate']({'on':{'mouseenter':_0x3031bf['to'](()=>{this['_isSearchFocused']()||_0x2c78ad['focus']();})}}),_0x2c78ad['on']('execute',()=>{_0x272223['editing']['view']['focus'](),_0x272223['commands']['execute']('aiQuickAction',_0xa71d85);}),_0x34c58c['children']['add'](_0x2c78ad),this['_actionButtons']['push']({'buttonView':_0x2c78ad,'action':_0xa71d85}),{'listItem':_0x34c58c,'highlightViews':[_0x2d3b10]};}}_createSearchResultActionButton(_0x3aa5d3,_0x13e58b,_0x45c83d,_0x311b8b){return _0x45c83d&&_0x311b8b?this['_createSearchResultGroupedActionButton'](_0x3aa5d3,_0x13e58b,_0x45c83d,_0x311b8b):this['_createSearchResultIndividualActionButton'](_0x3aa5d3,_0x13e58b);}_createSearchResultGroupedActionButton(_0x39768d,_0x4a1dd8,_0x20543f,_0x28d65b){const _0x3e69f7=new Zt(this['locale']),_0x276997=new Vt(this['locale']),_0x32cf6b=_0x276997['bindTemplate'],{view:_0x4cd03d,highlightView:_0x17ea63}=this['_createSearchResultGroupRow'](_0x20543f,_0x28d65b),{view:_0x222895,highlightView:_0x52468b}=this['_createSearchResultActionRow'](_0x4a1dd8['label']),_0x378814=this['_createSearchResultContentView'](_0x4cd03d,_0x222895);return _0x276997['set']({'label':_0x4a1dd8['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':_0x4a1dd8['isEnabled']}),_0x276997['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',_0x32cf6b['if']('isEnabled','ck-disabled',_0x953e9=>!_0x953e9)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x378814],'on':{'mouseenter':_0x32cf6b['to'](()=>{this['_isSearchFocused']()||_0x276997['focus']();}),'click':_0x32cf6b['to'](()=>{this['_handleSearchResultButtonClick'](_0x276997);})}}),this['_setupActionButtonExecution'](_0x276997,_0x39768d,_0x4a1dd8),_0x3e69f7['children']['add'](_0x276997),this['_actionButtons']['push']({'buttonView':_0x276997,'action':_0x4a1dd8}),{'listItem':_0x3e69f7,'highlightViews':[_0x17ea63,_0x52468b]};}_createSearchResultIndividualActionButton(_0x458cb9,_0x21518d){const _0x1b0970=new Zt(this['locale']),_0x340881=new Ut(),_0x4983c9=new Vt(this['locale'],_0x340881),_0x27c690=_0x4983c9['bindTemplate'];return _0x4983c9['set']({'label':_0x21518d['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x21518d['isEnabled']}),_0x4983c9['extendTemplate']({'on':{'mouseenter':_0x27c690['to'](()=>{this['_isSearchFocused']()||_0x4983c9['focus']();})}}),this['_setupActionButtonExecution'](_0x4983c9,_0x458cb9,_0x21518d),_0x1b0970['children']['add'](_0x4983c9),this['_actionButtons']['push']({'buttonView':_0x4983c9,'action':_0x21518d}),{'listItem':_0x1b0970,'highlightViews':[_0x340881]};}_createSearchResultGroupRow(_0x34cc63,_0x21d380){const _0x329e26=new _0x20e82c(this['locale']),_0x3f73c8=new Qt();_0x3f73c8['content']=_0x21d380,_0x3f73c8['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x287a46=new qt();return _0x287a46['text']=_0x34cc63,_0x329e26['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x3f73c8,_0x287a46]}),{'view':_0x329e26,'highlightView':_0x287a46};}_createSearchResultActionRow(_0x49e74f){const _0x204f9a=new _0x20e82c(this['locale']),_0xa4c1f0=new qt();return _0xa4c1f0['text']=_0x49e74f,_0x204f9a['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0xa4c1f0]}),{'view':_0x204f9a,'highlightView':_0xa4c1f0};}_createSearchResultContentView(_0x457d34,_0xa54c03){const _0xadf42e=new _0x20e82c(this['locale']);return _0xadf42e['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x457d34,_0xa54c03]}),_0xadf42e;}_setupActionButtonExecution(_0x4a1f63,_0x446287,_0xf338e2){_0x4a1f63['on']('execute',()=>{_0x4a1f63['isEnabled']&&(_0x446287['editing']['view']['focus'](),_0x446287['commands']['execute']('aiQuickAction',_0xf338e2));});}_createActionGroupButton(_0x1c8139,_0x456968,_0x95fe99){const _0x48a1b2=new Zt(this['locale']),_0x5936e6=new Ut(),_0x3e584b=new Qa(this['locale'],_0x5936e6),_0x11b6e7=_0x3e584b['bindTemplate'],_0x354542=this['_getPanelKeystroke'](_0x95fe99),_0x3e3091=this['_createGroupActionsList'](_0x1c8139,_0x456968['actions'],_0x95fe99);_0x3e584b['set']({'label':_0x456968['label'],'withText':!0x0,'role':ja,'icon':_0x456968['icon']??_0x3e8565,'isEnabled':_0x456968['actions']['some'](_0x529733=>_0x529733['isEnabled'])}),_0x3e584b['extendTemplate']({'on':{'mouseenter':_0x11b6e7['to'](()=>{this['_isSearchFocused']()||_0x3e584b['focus']();})}});const _0x1fc967=new Pt(this['locale']);return _0x1fc967['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x11b6e7['to'](_0x47d53a=>{this['_handlePanelKeydown'](_0x47d53a,_0x354542,_0x3e584b,_0x1fc967);})}}),_0x3e584b['bind']('isOn')['to'](_0x1fc967,'isVisible'),this['_bodyCollection']['add'](_0x1fc967),_0x1fc967['content']['add'](_0x3e3091),this['_setupGroupMenuBehavior'](_0x3e584b,_0x1fc967),_0x48a1b2['children']['add'](_0x3e584b),this['_actionButtons']['push']({'buttonView':_0x3e584b,'action':_0x456968}),{'listItem':_0x48a1b2,'highlightView':_0x5936e6};}_createGroupActionsList(_0x449e48,_0x3434d6,_0xcaf3ef){const _0x32d4df=new te(this['locale']);return _0x32d4df['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3434d6['forEach'](_0x496c65=>{const _0x511018=new Zt(this['locale']),_0x36ae38=qa({'editor':_0x449e48,'action':_0x496c65,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x511018['children']['add'](_0x36ae38),_0xcaf3ef['focusTracker']['add'](_0x36ae38),_0x32d4df['items']['add'](_0x511018);}),_0x32d4df;}_setupGroupMenuBehavior(_0x4c939e,_0x2badea){const _0x330ee5=_0x4c939e['bindTemplate'],_0x24a02f=this['_getButtonKeystroke'](_0x4c939e);_0x4c939e['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x330ee5['to'](()=>{this['_showNestedPanel'](_0x2badea,_0x4c939e);}),'mouseleave':_0x330ee5['to'](_0x33cfe9=>{const _0x2e44cf=_0x33cfe9['relatedTarget'];this['_isMovingToNestedMenu'](_0x2e44cf,_0x2badea)||this['_hideNestedPanel'](_0x2badea);}),'keydown':_0x330ee5['to'](_0x993f17=>{_0x993f17['key']==_0x24a02f&&(this['_showNestedPanel'](_0x2badea,_0x4c939e),_0x2badea['content']['get'](0x0)['focus']());})}}),_0x2badea['on']('render',()=>{_0x2badea['element']?.['addEventListener']('mouseleave',_0x17902c=>{const _0x5141ce=_0x17902c['relatedTarget'];_0x4c939e['element']?.['contains'](_0x5141ce)||this['_isMovingToNestedMenu'](_0x5141ce,_0x2badea)||this['_hideNestedPanel'](_0x2badea);});});}_showNestedPanel(_0x30e064,_0x2d7264){this['_openNestedPanels']['forEach'](_0x3c01f4=>{_0x3c01f4!==_0x30e064&&_0x3c01f4['isVisible']&&_0x3c01f4['hide']();}),_0x30e064['show'](),_0x30e064['pin']({'positions':[Ft['eastSouth']],'target':_0x2d7264['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x30e064);}_hideNestedPanel(_0x18af4c){_0x18af4c['hide'](),this['_openNestedPanels']['delete'](_0x18af4c);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x26ffc2=>_0x26ffc2['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x4ef2a8,_0x58e0c8){if(!_0x4ef2a8)return!0x1;if(_0x58e0c8['element']?.['contains'](_0x4ef2a8))return!0x0;const _0x49ffba=_0x4ef2a8;return _0x49ffba['closest']&&(null!==_0x49ffba['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x49ffba['closest']('.ck-ai-quick-actions-group-list')||null!==_0x49ffba['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(_0x5d39fb){return'rtl'===_0x5d39fb['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x26b270){return'rtl'===_0x26b270['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x4899cf,_0x26ff06,_0x4c5f69,_0x25d781){_0x4899cf['key']==_0x26ff06&&(_0x4c5f69['focus'](),this['_hideNestedPanel'](_0x25d781));}_handleSearchResultButtonClick(_0x184a76){_0x184a76['fire']('execute');}};function Za(_0x155360){const {editor:_0x2f9bff,content:_0x97e05,buttonDefinition:_0x148c0b,bodyCollection:_0x4173af,hasSearch:_0x3f1fe1=!0x1,actionButtons:_0x50e9e9}=_0x155360;return()=>{const _0x5e007b=_0x2f9bff['locale'],_0x4949fb=_0x2f9bff['commands']['get']('aiQuickAction'),_0x2f5d80=_0x28f0f7(_0x5e007b);_0x2f5d80['bind']('isEnabled')['to'](_0x4949fb),_0x2f5d80['buttonView']['set']({'icon':_0x148c0b['icon']??_0x3e8565,'label':_0x148c0b['label'],'tooltip':!0x0}),_0x2f5d80['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x5e5204=new Ja(_0x2f9bff,_0x97e05,_0x2f5d80,_0x4173af,_0x3f1fe1,_0x50e9e9);return _0x2f5d80['panelView']['children']['add'](_0x5e5204),_0x3f1fe1&&_0x2f5d80['on']('change:isOpen',(_0x291dc6,_0x4c1313,_0x1b3b1d)=>{if(_0x1b3b1d){if(_0x2f9bff['plugins']['has']('AIEditing')){const _0x1475d4=_0x2f9bff['plugins']['get'](sn),_0x49e141=_0x2f9bff['model']['document']['selection'],_0xa1455c=Array['from'](_0x49e141['getRanges']());_0xa1455c['length']>0x0&&_0x1475d4['showFakeVisualSelection']({'editor':_0x2f9bff,'ranges':_0xa1455c,'id':'quick-action','priority':0x14});}}else _0x2f9bff['plugins']['has']('AIEditing')&&_0x2f9bff['plugins']['get'](sn)['hideFakeVisualSelection']('quick-action'),_0x5e5204['resetSearch']();}),_0x2f5d80;};}const th='<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>',eh='<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>',ih='<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>',sh=/* #__PURE__ -- @preserve */
|
|
37
|
+
((()=>({'chat':'AIChat','action':'AIActions'}))());var nh=class AIQuickActionsUI extends _0x46e624{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Dt,Es,Ln,Ss];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_reporter']=this['editor']['plugins']['get'](Ln)['createReporter']('aiquickactions');const _0x511b62=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x511b62),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x1078eb){return function(_0x34a5bb){const _0x55aeed=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x34a5bb['uiLanguage'])||'English';return[{'id':'ask-ai','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x12b372},{'id':'chat-commands','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x12b372,'actions':[{'id':'explain','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':th['replace']('%0',_0x55aeed),'type':'chat'},{'id':'summarize','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':eh['replace']('%0',_0x55aeed),'type':'chat'},{'id':'highlight-key-points','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':ih['replace']('%0',_0x55aeed),'type':'chat'}]},{'id':'improve-writing','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x1a8f4f},{'id':'continue','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x1abbfe},{'id':'fix-grammar','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0xb41f6f},{'id':'adjust-length','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x54087e,'actions':[{'id':'make-shorter','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x1389f4,'actions':[{'id':'make-tone-casual','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x2165a0,'actions':[{'id':'translate-to-english','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Ts(_0x34a5bb,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x1de49e,'actions':[]}];}(_0x1078eb);}_getDefaultAndCustomActions(){const _0x6f998a=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x478b61=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x28afb6=>({..._0x28afb6,'type':'chat'===_0x28afb6['type']?'chat':'action','icon':void 0x0}));return _0x6f998a['find'](_0x5b4e14=>'other'===_0x5b4e14['id'])['actions']['push'](..._0x478b61),_0x6f998a;}async _initActionTypeQuickActions(){try{const _0x535e65=this['editor']['plugins']['get'](Ss),_0x71d3f1=await _0x535e65['models']['getAllModels'](),_0x33fc3a=(await _0x535e65['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x33fc3a),this['_enableButtonsByType']('action',_0x55e23f=>!!_0x71d3f1['find'](_0x56ce9b=>_0x56ce9b['id']===_0x55e23f['model'])||void 0x0===_0x55e23f['model']);}catch(_0x40ad5a){const _0xafae53=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x40ad5a});this['_reporter']['logError'](_0xafae53);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x4040f9=this['editor']['plugins']['get']('AIChatController'),_0x57bcdd=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x4040f9,'change:isConversationReady',(_0x358fc5,_0x5e5147,_0x103754)=>{this['_enableButtonsByType']('chat',()=>_0x103754&&!_0x57bcdd?.['isBusy']);}),_0x57bcdd&&this['listenTo'](_0x57bcdd,'change:isBusy',(_0x387b3e,_0x574967,_0x4892c3)=>{this['_enableButtonsByType']('chat',()=>_0x4040f9['isConversationReady']&&!_0x4892c3);}),this['_enableButtonsByType']('chat',()=>_0x4040f9['isConversationReady']&&!_0x57bcdd?.['isBusy']);}_enableButtonsByType(_0x4ec0d2,_0x55f589){this['_quickActionsDefinition']['forEach'](_0x28cbd7=>{'actions'in _0x28cbd7?_0x28cbd7['actions']['forEach'](_0x31a215=>{_0x31a215['type']===_0x4ec0d2&&(_0x31a215['isEnabled']=_0x55f589(_0x31a215));}):_0x28cbd7['type']===_0x4ec0d2&&(_0x28cbd7['isEnabled']=_0x55f589(_0x28cbd7));}),this['_actionButtons']['forEach'](_0x2ce8de=>{if(rh(_0x2ce8de['action']))return;if(_0x2ce8de['action']['type']!==_0x4ec0d2)return;const _0x224710=_0x55f589(_0x2ce8de['action']);if(_0x2ce8de['action']['isEnabled']=_0x224710,_0x2ce8de['buttonView']['isEnabled']=_0x224710,'action'===_0x4ec0d2&&!_0x224710&&_0x2ce8de['action']['model']){const _0x46a25e=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x2ce8de['action']['id'],'modelId':_0x2ce8de['action']['model']});this['_reporter']['logError'](_0x46a25e);}}),this['_actionButtons']['filter'](_0x47875b=>rh(_0x47875b['action']))['forEach'](_0x1ab3f8=>{_0x1ab3f8['buttonView']['isEnabled']=_0x1ab3f8['action']['actions']['some'](_0x2e1c2c=>_0x2e1c2c['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x5844ed,group:_0x58c076})=>{_0x5844ed['isEnabled']=_0x58c076['actions']['some'](_0x26a942=>_0x26a942['isEnabled']);});}_enableButtonById(_0x5cd433,_0x43d6bb){this['_quickActionsDefinition']['forEach'](_0x313200=>{'actions'in _0x313200?_0x313200['actions']['forEach'](_0x24f061=>{_0x24f061['id']===_0x5cd433&&(_0x24f061['isEnabled']=_0x43d6bb(_0x24f061));}):_0x313200['id']===_0x5cd433&&(_0x313200['isEnabled']=_0x43d6bb(_0x313200));}),this['_actionButtons']['forEach'](_0x131daf=>{if(rh(_0x131daf['action']))return;if(_0x131daf['action']['id']!==_0x5cd433)return;const _0x369072=_0x43d6bb(_0x131daf['action']);_0x131daf['action']['isEnabled']=_0x369072,_0x131daf['buttonView']['isEnabled']=_0x369072;});}_assignDefaultModelToCustomActions(_0x14231d){this['_actionButtons']['forEach'](_0x19bd50=>{rh(_0x19bd50['action'])||'action'===_0x19bd50['action']['type']&&(_0x19bd50['action']['model']||(_0x19bd50['action']['model']=_0x14231d));});}_initializeQuickActionsComponentsAndCommands(){const _0x3de9c3=new Ht(this['editor']['locale']);_0x3de9c3['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x3de9c3),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x3de9c3);}_initializeQuickActionsDropdown(_0x52da91){const _0x17d666=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Za({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x3e8565,'label':Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x52da91,'hasSearch':_0x17d666,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x114168){this['_quickActionsDefinition']=_0x114168['map'](_0x809875=>{if('actions'in _0x809875){const _0x38a126=_0x809875;return{..._0x38a126,'actions':_0x38a126['actions']['map'](_0x2e6b51=>{const {actions:_0x2899df,..._0x35e5dd}=_0x38a126;return{..._0x2e6b51,'isEnabled':!0x1,'parent':_0x35e5dd};})['filter'](_0xdd4223=>this['_shouldIncludeAction'](_0xdd4223))};}return{..._0x809875,'isEnabled':!0x1};})['filter'](_0x51051c=>'actions'in _0x51051c?_0x51051c['actions']['length']>0x0:this['_shouldIncludeAction'](_0x51051c));}_shouldIncludeAction(_0x30f079){const _0x5e7614=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](sh[_0x30f079['type']])&&!_0x5e7614['includes'](_0x30f079['id'])&&!('chat'===_0x30f079['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x25e16e){this['_quickActionsDefinition']['forEach'](_0x4e3b4a=>{if('actions'in _0x4e3b4a){const _0x13e1be=Za({'editor':this['editor'],'content':_0x4e3b4a['actions'],'buttonDefinition':_0x4e3b4a,'bodyCollection':_0x25e16e,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4e3b4a['id'],_0x13e1be),_0x4e3b4a['actions']['forEach'](_0x3cc76f=>{const _0x12d1a7=qa({'editor':this['editor'],'action':_0x3cc76f,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3cc76f['id'],_0x12d1a7);});}else{const _0x48857c=qa({'editor':this['editor'],'action':_0x4e3b4a,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4e3b4a['id'],_0x48857c);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x32465f=>{const _0x24c49a=this['editor']['commands']['get']('aiQuickAction'),_0x586bc8=new _0x135eb0(_0x32465f),_0x5b1de7=Ts(_0x32465f,'AI_QUICK_ACTIONS_HEADING');_0x586bc8['buttonView']['set']({'label':_0x5b1de7,'icon':_0x3e8565});const _0x4ae38d=new _0x2fab50(_0x32465f);return _0x4ae38d['set']({'ariaLabel':_0x5b1de7,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x5aa510=>{if('actions'in _0x5aa510){const _0x432b17=_0x5aa510,_0x38f375=new _0x1a3b09(_0x32465f,_0x586bc8),_0x44bb46=new _0x135eb0(_0x32465f),_0x1827b6=new _0x2fab50(_0x32465f);_0x44bb46['buttonView']['set']({'label':_0x432b17['label'],'icon':_0x432b17['icon']}),_0x432b17['actions']['forEach'](_0x381473=>{const _0x25e7f7=new _0x1a3b09(_0x32465f,_0x44bb46),_0x184151=new _0x5a4190(_0x32465f);_0x184151['set']({'label':_0x381473['label'],'icon':_0x381473['icon'],'role':'menuitem','isEnabled':_0x381473['isEnabled']}),_0x184151['on']('execute',()=>{this['_executeQuickAction'](_0x381473);}),this['_actionButtons']['push']({'buttonView':_0x184151,'action':_0x381473}),_0x184151['delegate']('execute')['to'](_0x44bb46),_0x25e7f7['children']['add'](_0x184151),_0x1827b6['items']['add'](_0x25e7f7);}),_0x44bb46['isEnabled']=_0x432b17['actions']['some'](_0x397688=>_0x397688['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x44bb46,'group':_0x432b17}),_0x44bb46['panelView']['children']['add'](_0x1827b6),_0x38f375['children']['add'](_0x44bb46),_0x4ae38d['items']['add'](_0x38f375);}else{const _0x29bdf1=_0x5aa510,_0x4b54aa=new _0x1a3b09(_0x32465f,_0x586bc8),_0x40146d=new _0x5a4190(_0x32465f);_0x40146d['set']({'label':_0x29bdf1['label'],'icon':_0x29bdf1['icon'],'role':'menuitem','isEnabled':_0x29bdf1['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x40146d,'action':_0x29bdf1}),_0x40146d['on']('execute',()=>{this['_executeQuickAction'](_0x29bdf1);}),_0x40146d['delegate']('execute')['to'](_0x586bc8),_0x4b54aa['children']['add'](_0x40146d),_0x4ae38d['items']['add'](_0x4b54aa);}}),Object['values'](sh)['some'](_0x1d084b=>this['editor']['plugins']['has'](_0x1d084b))?_0x586bc8['bind']('isEnabled')['to'](_0x24c49a):_0x586bc8['set']({'isEnabled':!0x1}),_0x586bc8['panelView']['children']['add'](_0x4ae38d),_0x586bc8;});}_executeQuickAction(_0x50a82d){const _0x2752a8=this['editor'];_0x2752a8['editing']['view']['focus'](),_0x2752a8['commands']['execute']('aiQuickAction',_0x50a82d);const _0x827731=_0x2752a8['ui']['view']['menuBarView'];_0x827731&&_0x827731['close']&&_0x827731['close']();}};function rh(_0x29dcc7){return'actions'in _0x29dcc7;}function oh(_0x3abf00,_0x39ab1b){const _0x1738b5=_0x3abf00['plugins']['get']('AITabs')['view'];_0x1738b5['isVisible']=!0x0,_0x1738b5['activateTab'](_0x39ab1b);}var ah=class extends _0x4045df{execute(_0x467165){switch(this['_expandSelectionIfCollapsed'](),_0x467165['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x26c5e6=Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x26c5e6});}this['_handleAIChatAction'](_0x467165);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x6319d1=Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x6319d1});}this['_handleAIActionsAction'](_0x467165);}}async _handleAIChatAction(_0x1b1337){const _0x498d03=this['editor']['plugins']['get']('AIChatController');if(oh(this['editor'],'chat'),'ask-ai'===_0x1b1337['id'])_0x498d03['removeSelectionFromChatContext'](),_0x498d03['addSelectionToChatContext'](this['editor']),_0x498d03['focusPromptInput']();else await _0x498d03['startConversation']({'modelId':_0x1b1337['model'],'contexts':this['_resolveActionContexts'](_0x1b1337)}),_0x498d03['removeSelectionFromChatContext'](),_0x498d03['addSelectionToChatContext'](this['editor']),_0x498d03['focusPromptInput'](),await _0x498d03['sendMessage']({'message':_0x1b1337['prompt']||_0x1b1337['displayedPrompt']||_0x1b1337['label'],'attributes':{'quickActionData':{'id':_0x1b1337['id']},'displayedPrompt':_0x1b1337['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x24f05e=this['editor'],_0x3e2f0e=_0x24f05e['model']['document']['selection'];if(!_0x3e2f0e['isCollapsed'])return;const _0x5991b0=Tt(_0x3e2f0e['getSelectedBlocks']())||_0x24f05e['model']['schema']['getLimitElement'](_0x3e2f0e);_0x24f05e['model']['change'](_0x5b7113=>{_0x5b7113['setSelection'](_0x5991b0,'in');});}_handleAIActionsActionLabel(_0x483040){return _0x483040['parent']?.['label']&&'other'!==_0x483040['parent']?.['id']?_0x483040['parent']['label']+':\x20'+_0x483040['label']:_0x483040['label'];}async _handleAIActionsAction(_0x34450e){const _0x5e3333=this['editor']['plugins']['get']('AIActions'),_0x569ecf=this['_resolveActionContexts'](_0x34450e);let _0x3e3c0c;_0x3e3c0c=_0x34450e['prompt']?{'userMessage':_0x34450e['prompt'],'model':_0x34450e['model'],'contexts':_0x569ecf}:_0x34450e['context']?{'model':_0x34450e['model'],'contexts':_0x569ecf}:{'actionName':_0x34450e['actionName']||_0x34450e['id'],'args':_0x34450e['args'],'contexts':_0x569ecf};const _0x4e1121=this['_handleAIActionsActionLabel'](_0x34450e);await _0x5e3333['executeAction'](_0x3e3c0c,_0x4e1121,_0x34450e['icon']);}_resolveActionContexts(_0x2b746e){const _0x4067c1=_0x2b746e['parent']?.['id']?[_0x2b746e['id'],_0x2b746e['parent']['id']]:[_0x2b746e['id']];return this['editor']['plugins']['get'](Ss)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x4067c1,'extraContexts':_0x2b746e['context']?[_0x2b746e['context']]:[],'context':new qn()})['refs'];}},hh=class extends _0x46e624{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3281c0=this['editor'],_0x2fe8ec=new ah(this['editor']);if(_0x3281c0['commands']['add']('aiQuickAction',_0x2fe8ec),_0x3281c0['plugins']['has']('AIChat')){const _0x54126d=this['editor']['plugins']['get']('AIChatController');_0x3281c0['model']['document']['selection']['on']('change:range',(_0x8e2c24,_0x4ef14a)=>{_0x4ef14a['directChange']&&_0x54126d['removeSelectionFromChatContext']();});}}},ch=class extends Gn{appendContent(_0x31e031,_0x1eb052='text'){'modification'===this['type']&&'text'===_0x1eb052&&(_0x1eb052=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x31e031,_0x1eb052);}updateChangeGroups(_0x9342a3){const _0x510358=this['parsedContent']['get'](_0x9342a3)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x9342a3,_0x510358),this['changeGroups']=[],0x0==_0x510358['childNodes']['length'])return;hn(this['documentContextContent']['get'](_0x9342a3),this['parsedMergedContent']['get'](_0x9342a3));const _0x53e1de=_0x5283bd(this['documentContextContent']['get'](_0x9342a3)['children']['map'](_0x19a242=>({'node':_0x19a242,'id':Hs(_0x19a242,'data-id')})),_0x510358['children']['map'](_0x328bea=>({'node':_0x328bea,'id':Hs(_0x328bea,'data-id')||Nt()})),{'comparator':(_0x4703af,_0x4c7c37)=>_0x4703af['id']==_0x4c7c37['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x53e1de['length']&&_0x53e1de[_0x53e1de['length']-0x1]['removed'];)_0x53e1de['pop']();}const _0x1a37ec=_0x53e1de['map'](_0xa620ae=>{const _0x421c91=_0xa620ae['added']?'new':_0xa620ae['removed']?'removed':'modified';return{'node':_0xa620ae['value'][0x0]['node'],'type':_0x421c91,'id':_0xa620ae['value'][0x0]['id']};}),_0x2ae3a5=this['_documentIdToSource']['get'](_0x9342a3);this['changeGroups']['push']({'changes':_0x1a37ec,'state':'pending','index':this['changeGroups']['length'],'editor':_0x2ae3a5['editor'],'rootName':_0x2ae3a5['rootName'],'documentId':_0x9342a3});}_getDifferentChangeGroups(_0x310f53,_0x3d2402){return _0x3d2402;}},lh=class extends Wn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x4b1ea1){super(_0x4b1ea1),this['content']=_0x4b1ea1['content'],this['version']=_0x4b1ea1['version'],this['editor']=_0x4b1ea1['editor'],this['rootName']=_0x4b1ea1['rootName'],this['actionName']=_0x4b1ea1['actionName'],this['args']=_0x4b1ea1['args'],this['userMessage']=_0x4b1ea1['userMessage'],this['model']=_0x4b1ea1['model'],this['contexts']=_0x4b1ea1['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':Nt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0xb229a4){const _0x497c38=this['editor']['config']['get']('collaboration.channelId'),_0x394455=new ch({..._0xb229a4,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x497c38,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x497c38,this['editor']]])});return this['replies']['push'](_0x394455),_0x394455['delegate'](...Kn)['to'](this),this['fire']('replyCreated',_0x394455),_0x394455;}},uh=class extends _0x5b0bf4{constructor(_0x21562e,_0x47222e=!0x0,_0x498f69=!0x0){super(_0x21562e),this['set']('isEnabled',!0x1),_0x47222e&&(this['applyButton']=this['_createButton'](Ts(_0x21562e,'AI_BALLOON_APPLY_BUTTON'),Dn),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x498f69&&(this['suggestButton']=this['_createButton'](Ts(_0x21562e,'AI_BALLOON_SUGGEST_BUTTON'),_0x47222e?Hn:Dn),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x47222e,'showSuggestButton':_0x498f69}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x23362d,showSuggestButton:_0x20a18b}){this['applyButton']&&(this['applyButton']['isVisible']=_0x23362d),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x20a18b);}_createButton(_0x1d578d,_0x1081ee){const _0xb7bae1=new Vt(this['locale']);return _0xb7bae1['set']({'label':_0x1d578d,'class':_0x1081ee,'isVisible':!0x0,'withText':!0x0}),_0xb7bae1;}},dh=class extends _0x20e82c{constructor(_0x5de9d4){super(_0x5de9d4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Ts(_0x5de9d4,'AI_DISCLAIMER_TEXT')}]}]});}},_h=class extends _0x20e82c{constructor(_0x4e22d3){super(_0x4e22d3),this['set']('isVisible',!0x0);const _0x16fa88=new Mr('small');_0x16fa88['isVisible']=!0x0;const _0x4bd775=new _0x20e82c(this['locale']);_0x4bd775['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Ts(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x328a60=>!_0x328a60)]},'children':[_0x16fa88,_0x4bd775]});}},gh=class extends Va{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x1c4ba7,_0x176e85){super(_0x1c4ba7),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x176e85,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x261c11(),this['_addContentWrapper'](_0x176e85),this['_addDisclaimerView'](),this['_addToolbar'](_0x176e85),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'](_0x176e85);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x3b4c3b of this['_focusables'])this['_focusTracker']['add'](_0x3b4c3b['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x5213c3){-0x1===_0x5213c3?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0xe58cd4){this['_isLoading']=_0xe58cd4;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0xe8d54c){super['showError'](_0xe8d54c),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x218fec){super['showBlockingError'](_0x218fec),this['setErrorState']();}addMiniToolbarItem(_0x2fa5f6){this['_miniToolbarView']['items']['has'](_0x2fa5f6)||this['_miniToolbarView']['items']['add'](_0x2fa5f6);}removeMiniToolbarItem(_0x381510){this['_miniToolbarView']['items']['has'](_0x381510)&&this['_miniToolbarView']['items']['remove'](_0x381510);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x234fa6,showSuggestButton:_0x5346bb}){_0x234fa6=_0x234fa6&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x5346bb=_0x5346bb&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x234fa6,'showSuggestButton':_0x5346bb});}async updateContent(_0x4f7149){await this['_streamableContentView']['update'](_0x4f7149);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x1c694e){this['_contentWrapper']=new _0x20e82c(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x1c694e['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new dh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x4542f,showSuggestButton:_0xb29134}){this['_toolbarView']=new uh(this['locale'],_0x4542f,_0xb29134),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',this,'isTargetReadOnly',(_0x14d668,_0x297588,_0x24d6ae,_0x16bdba)=>!(_0x14d668||_0x297588||_0x24d6ae||_0x16bdba)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x4542f,'showSuggestButton':_0xb29134}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x4cee3a){return this['_miniToolbarView']=new Fa(this['locale'],_0x4cee3a),this['_miniToolbarView']['delegate'](...nr)['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',(_0x30ca82,_0x1019b7)=>!(_0x30ca82||_0x1019b7)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new _h(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new wr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x418960=new Vt(this['locale']),_0x4cd70e=new Vt(this['locale']),_0x51165a=new Ah(this['locale']),_0x119ba6=new Vt(this['locale']);_0x418960['set']({'icon':_0x5c57af,'label':Ts(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Mn}),_0x4cd70e['set']({'icon':_0x48d93b,'tooltip':Ts(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Mn}),_0x119ba6['set']({'icon':_0x2e4748,'tooltip':Ts(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Mn}),_0x418960['bind']('isEnabled')['to'](this,'isBusy',_0x5b4c91=>!_0x5b4c91),_0x418960['on']('execute',()=>{this['fire']('tryAgain');}),_0x4cd70e['bind']('isEnabled')['to'](this,'isBusy',_0x59bf6c=>!_0x59bf6c),_0x4cd70e['on']('execute',()=>{this['fire']('showPrevious');}),_0x119ba6['bind']('isEnabled')['to'](this,'isBusy',_0x3ea287=>!_0x3ea287),_0x119ba6['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x4cd70e,this['_navigationCounter']=_0x51165a,this['_navigationNextButton']=_0x119ba6,this['_navigationTryAgainButton']=_0x418960;}updateMiniToolbarButtons(_0x5b5398,_0x145e14){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x1816a8=_0x5b5398>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x1816a8){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x144565=_0x5b5398-_0x145e14;this['_navigationCounter']['setInteractionCount'](_0x144565+'/'+_0x5b5398),this['_navigationPreviousButton']['isEnabled']=_0x145e14<_0x5b5398-0x1,this['_navigationNextButton']['isEnabled']=_0x145e14>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(_0x3ddbdd){this['_isLoading']=_0x3ddbdd;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x30925e=this['_streamableContentView']['element'],_0x224209=this['_miniToolbarView']['element'],_0x19d8e3=()=>{Ct['window']['requestAnimationFrame'](()=>{const _0x5e2be5=_0x30925e['offsetWidth']-_0x30925e['clientWidth'];_0x224209['style']['right']='calc('+_0x5e2be5+'px\x20+\x20var(--ck-spacing-large))';});};_0x19d8e3(),this['_miniToolbarResizeObserver']=new pt(_0x30925e,()=>{_0x19d8e3();});}_initializeScrollManager(){const _0x458e57=this['_getScrollableElement']();_0x458e57&&!this['_scrollManager']&&(this['_scrollManager']=new co(_0x458e57));}_getScrollableElement(){return this['_streamableContentView']['element'];}},Ah=class extends _0x20e82c{constructor(_0x237881){super(_0x237881);const _0x55eb92=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x55eb92['to']('interactionCount')}]});}setInteractionCount(_0x53724e){this['set']('interactionCount',_0x53724e);}},Ih=class extends _0x46e624{static get requires(){return[Es,Ln,Bt,sn,Ga,_0xc19772];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_aiConnector;_interactions=[];_currentInteractionIndex=0x0;_interactionParams;['_balloonShowDiff']=!0x1;['_promiseQueue'];get _interaction(){return this['_interactions'][this['_interactions']['length']-0x1];}_actionsBalloonView;_reporter;constructor(_0x7659c){super(_0x7659c),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Ln)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Or();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x9d4076,_0x5e109c,_0x2cd7a1){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x3f0a8a,anchorData:_0x354b17,root:_0xee82f4}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x9d4076,_0x3f0a8a,_0x354b17,_0xee82f4,_0x5e109c,_0x2cd7a1);}const {modelFragment:_0x3731af,anchorData:_0x53b992,root:_0x536834}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x9d4076,_0x3731af,_0x53b992,_0x536834,_0x5e109c,_0x2cd7a1);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x31d1bc=this['editor']['plugins']['has']('TrackChanges');let _0x5b97e6=this['editor']['config']['get']('ai.availableReplyActions')||[...kr];_0x31d1bc||(_0x5b97e6=_0x5b97e6['filter'](_0x2ef21a=>'insertSuggestion'!=_0x2ef21a));const _0x51f03b=this['editor']['commands']['get']('trackChanges'),_0x12cba5=new gh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x31d1bc,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x5b97e6});return _0x12cba5['bind']('isBusy')['to'](this),_0x12cba5['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x51f03b&&_0x12cba5['bind']('isTrackChangesOn')['to'](_0x51f03b,'value'),_0x12cba5['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x12cba5['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x12cba5['on']('showNext',()=>{this['_navigateToNext']();}),_0x12cba5;}_normalizeSelectionStart(){const _0x1dd7fe=this['editor']['model'],_0x50478d=_0x1dd7fe['document']['selection'],_0x16b472=_0x50478d['getFirstRange']();if(!_0x16b472||_0x16b472['isCollapsed'])return;const _0x49e3f5=Tt(_0x50478d['getSelectedBlocks']());if(!_0x49e3f5)return;const _0x4e9985=_0x1dd7fe['createPositionAt'](_0x49e3f5,0x0);_0x4e9985['isAfter'](_0x16b472['start'])&&_0x1dd7fe['change'](_0x410b9c=>{_0x410b9c['setSelection'](_0x410b9c['createRange'](_0x4e9985,_0x16b472['end']));});}_getExecuteDataRegular(){const _0x30e6c9=this['editor']['model']['document']['selection'],_0x56ff51=_0x30e6c9['getFirstRange']()['start']['root'];if(_0x30e6c9['isCollapsed']){const _0x18ca42=Tt(_0x30e6c9['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x30e6c9);this['editor']['model']['change'](_0x232453=>{_0x232453['setSelection'](_0x18ca42,'in');});}this['_normalizeSelectionStart']();const _0x14975f=_0x30e6c9['getFirstRange'](),_0x844328=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x30e6c9),_0x14975f['start'],_0x14975f['end']);this['_copyMarkersToFragment'](_0x844328,_0x30e6c9,{'isTableSelection':!0x1});const _0x5c2e9b=_0x30e6c9['getFirstRange']()['start'],_0x590fd5=new Map();let _0x2db40e=_0x844328;for(let _0x50abd4=0x0;_0x50abd4<_0x5c2e9b['path']['length'];_0x50abd4++)_0x590fd5['set'](_0x2db40e,_0x5c2e9b['path'][_0x50abd4]),_0x2db40e=_0x2db40e['getChild'](0x0);return{'modelFragment':_0x844328,'anchorData':_0x590fd5,'root':_0x56ff51};}_getExecuteDataInTable(){const _0x20d013=this['editor']['model']['document']['selection'],_0x264f02=this['editor']['plugins']['get']('TableSelection'),_0x60375=_0x20d013['getFirstRange']()['start']['root'],_0x3485ae=_0x264f02['getSelectionAsFragment'](),_0x798744=_0x20d013['getFirstRange']()['start']['parent']['parent'],_0x5d79e1=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x798744),this['editor']['model']['createPositionAfter'](_0x798744)),_0x1d5b7f=this['_wrapWithCommonAncestors'](_0x3485ae,_0x5d79e1['start'],_0x5d79e1['end']);this['_copyMarkersToFragment'](_0x1d5b7f,_0x20d013,{'isTableSelection':!0x0});const _0x10a2ef=_0x20d013['getFirstRange']()['start'],_0x4fe302=new Map();let _0x417b6f=_0x1d5b7f;for(let _0x3785ce=0x0;_0x3785ce<_0x10a2ef['path']['length'];_0x3785ce++)if(_0x4fe302['set'](_0x417b6f,_0x10a2ef['path'][_0x3785ce]),_0x3785ce<_0x10a2ef['path']['length']-0x1)_0x417b6f=_0x417b6f['getChild'](0x0);else{let _0x1b8533=_0x417b6f['nextSibling'];for(;_0x1b8533;)_0x4fe302['set'](_0x1b8533,_0x10a2ef['path'][_0x3785ce]),_0x1b8533=_0x1b8533['nextSibling'];}return{'modelFragment':_0x1d5b7f,'anchorData':_0x4fe302,'root':_0x60375};}async _executeAction(_0xbe2119,_0x10fc5d,_0x503bb8,_0x22cfc1,_0x5e9830,_0x241bda){const _0x35fe6c=this['editor']['plugins']['get'](sn),_0x27f045=this['editor']['plugins']['get'](Ga),_0x958013=this['editor']['model']['document']['selection'],_0x597a2a=await _0x35fe6c['modelToDataWithIds'](_0x10fc5d,this['editor'],_0x22cfc1['rootName']),_0x10ff9b=this['editor']['model']['document']['version'],_0x3d4a70=[..._0x958013['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x27f045['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x5e9830,'icon':_0x241bda||_0x3e8565,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x3d4a70,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x27f045),this['_interactionParams']={'action':_0xbe2119,'content':_0x597a2a,'version':_0x10ff9b,'aiBalloon':_0x27f045,'modelFragment':_0x10fc5d,'anchorData':_0x503bb8,'root':_0x22cfc1},this['_setupApplyListeners'](),this['listenTo'](_0x27f045,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x27f045,'dialogClosed',(_0x286ba8,{id:_0x28b64d})=>{if('aiActionsBalloon'===_0x28b64d){for(const _0x1185ea of this['_interactions']){if(0x0===_0x1185ea['replies']['length']||_0x1185ea['stoppedExplicitly'])continue;const _0x51360f=_0x1185ea['replies'][_0x1185ea['replies']['length']-0x1],_0x591d56=_0x51360f['changeGroups'][0x0];_0x591d56&&'pending'===_0x591d56['state']&&_0x51360f['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x27f045);}}),this['_createInteraction'](_0x597a2a,_0x10ff9b,_0x27f045,_0xbe2119);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x4eb32e,anchorData:_0x443308,root:_0x3d6314}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x4eb32e,_0x443308,_0x3d6314,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x4eb32e,_0x443308,_0x3d6314,!0x0);});}_wrapWithCommonAncestors(_0x37126a,_0x40d0a4,_0x4efba8){const _0x51b55f=this['editor']['model']['createRange'](_0x40d0a4,_0x4efba8)['getCommonAncestor'](),_0x321ec0=_0x51b55f['is']('documentFragment')?[]:_0x51b55f['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x321ec0['length']){const _0x5b8be2=_0x321ec0['map'](_0x3e13ee=>_0x3e13ee['_clone'](!0x1));for(let _0x536975=0x1;_0x536975<_0x5b8be2['length'];_0x536975++)_0x5b8be2[_0x536975-0x1]['_appendChild'](_0x5b8be2[_0x536975]);return _0x5b8be2[_0x5b8be2['length']-0x1]['_appendChild'](_0x37126a),new _0x230b9b(_0x5b8be2[0x0]);}return _0x37126a;}_copyMarkersToFragment(_0xd0d73d,_0x17a7db,_0x4b9eca={'isTableSelection':!0x1}){const _0x4fe1ef=this['editor']['model'],_0x71fe6e=Array['from'](_0x17a7db['getRanges']()),_0x313ee6=_0x17a7db['getFirstRange']()['start'];for(const _0x1f8407 of _0x4fe1ef['markers']){if(_0x1f8407['name']['startsWith']('ai-selection')||!_0x1f8407['affectsData'])continue;const _0x49ffb6=_0x1f8407['getRange']();if(!_0x71fe6e['some'](_0x402fd4=>_0x402fd4['containsRange'](_0x49ffb6,!0x0)))continue;const _0xc9524b=this['_regularCalculateMarkerPath'](_0x49ffb6['start'],_0x313ee6,_0x4b9eca['isTableSelection']),_0x3efdd4=this['_regularCalculateMarkerPath'](_0x49ffb6['end'],_0x313ee6,_0x4b9eca['isTableSelection']),_0x233f03=_0x4fe1ef['createPositionFromPath'](_0xd0d73d,_0xc9524b),_0x1dc570=_0x4fe1ef['createPositionFromPath'](_0xd0d73d,_0x3efdd4);if(!_0x233f03['isEqual'](_0x1dc570)){const _0xe1507d=_0x4fe1ef['createRange'](_0x233f03,_0x1dc570);_0xd0d73d['markers']['set'](_0x1f8407['name'],_0xe1507d);}}}_regularCalculateMarkerPath(_0x3c7727,_0xe1e18e,_0xad13ae=!0x1){const _0x7a9e49=[..._0x3c7727['path']['slice']()];for(let _0x3ae3b5=0x0;_0x3ae3b5<Math['max'](_0xe1e18e['path']['length'],_0x3c7727['path']['length']);_0x3ae3b5++){const _0x1e44b3=_0xe1e18e['path'][_0x3ae3b5]||0x0,_0x26340c=(_0x3c7727['path'][_0x3ae3b5]||0x0)-_0x1e44b3;if(_0x7a9e49[_0x3ae3b5]=_0x26340c,0x0!==_0x26340c&&!_0xad13ae)break;}return _0x7a9e49;}async _createInteraction(_0x19497f,_0x584245,_0x5ba230,_0x1314d0){const _0x4e2ab8=this['editor'],_0xcc0cf5=_0x4e2ab8['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x1314d0,'content':_0x19497f,'version':_0x584245,'aiBalloon':_0x5ba230,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0xcc0cf5});const _0x3d5c48=new lh({'connector':this['_aiConnector'],'locale':_0x4e2ab8['locale'],'content':_0x19497f,'version':_0x584245,'editor':_0x4e2ab8,'rootName':_0xcc0cf5['rootName'],..._0x1314d0});this['_interactions']['push'](_0x3d5c48);const _0x5ca8f9=(_0x48e951,_0x4fa3d3=!0x1,_0x58c220='streaming')=>{const {isDone:_0x1f2dd2}=_0x48e951;return this['_promiseQueue']['enqueue'](async _0x51c850=>{try{if(this['_isUnsupportedInlineRootChange'](_0x48e951,_0xcc0cf5))return this['_actionsBalloonView']['showBlockingError'](Ts(_0x4e2ab8['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x1f2dd2&&this['_actionsBalloonView']['finalizeContent']());const _0x4b6ea1=dn({'changeGroups':_0x48e951['changeGroups'],'documentContextContent':_0x48e951['documentContextContent'],'showDiff':_0x4fa3d3,'trimUnchanged':!0x1});_0x4b6ea1['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x4b6ea1[0x0],'renderingStrategy':_0x58c220,'abortSignal':_0x51c850}),_0x1f2dd2&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x2a38c6){if(Nn(_0x2a38c6))return;throw _0x2a38c6;}});};_0x3d5c48['on']('replyCreated',(_0x2e07f0,_0x557bdb)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x5ca8f9(_0x557bdb)['catch'](_0xa686ec=>{this['_reporter']['logError'](_0xa686ec,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x3d5c48,_0xa686ec);});}),_0x3d5c48['on']('replyContentUpdated',(_0x40720e,_0x24637d)=>{_0x5ca8f9(_0x24637d)['catch'](_0x37c4b2=>{this['_reporter']['logError'](_0x37c4b2,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x3d5c48,_0x37c4b2);});}),_0x3d5c48['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0xf4bdba){this['_reporter']['logError'](_0xf4bdba,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x3d5c48,_0xf4bdba);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x7ab5f9,{showDiff:_0x2f624a})=>{try{this['_balloonShowDiff']=_0x2f624a;const _0x1826bd=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x1826bd&&await _0x5ca8f9(_0x1826bd,_0x2f624a,'static');}catch(_0x58957b){this['_reporter']['logError'](_0x58957b,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x3d5c48,_0x58957b);}}),_0x3d5c48['on']('replyChangeGroupStateUpdated',()=>{const _0x515b4c={'positiveCount':_0x3d5c48['replies']['reduce']((_0x33e41f,_0x26b6ff)=>_0x33e41f+_0x26b6ff['changeGroups']['filter'](_0x12be14=>'accepted'===_0x12be14['state'])['length'],0x0),'totalCount':_0x3d5c48['replies']['reduce']((_0x1b3db3,_0x513d09)=>_0x1b3db3+_0x513d09['changeGroups']['length'],0x0)},_0x62fd84=_0x3d5c48['actionCallId'],_0x19af30=_0x3d5c48['actionName'];_0x19af30?this['_aiConnector']['upsertAIActionRating'](_0x19af30,_0x62fd84,_0x515b4c):this['_aiConnector']['upsertCustomAIActionRating'](_0x62fd84,_0x515b4c);}),this['_setLoadingState']();try{const _0x3306cd=await _0x3d5c48['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x3306cd;}catch(_0xe826cd){Nn(_0xe826cd)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0xe826cd,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x3d5c48,_0xe826cd);}}_isUnsupportedInlineRootChange(_0x4e5ab3,_0x490ea4){const _0x184a8b=this['editor'];return!!Ks(_0x184a8b,_0x490ea4['rootName'])&&!qs(_0x184a8b,new _0x56ff8a((_0x4e5ab3['changeGroups'][0x0]?.['changes']??[])['filter'](_0x3d073f=>'removed'!==_0x3d073f['type'])['map'](_0x14da52=>_0x14da52['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x2c030f,_0x149249,_0x50dc2c,_0x167555){const _0x46f06f=this['editor'];if(_0x167555&&!_0x46f06f['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x436e8d=this['editor']['plugins']['get'](_0xc19772),_0x263ba1=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x263ba1||!_0x263ba1['replies']['length'])return;const _0x4477ef=_0x263ba1['replies'][_0x263ba1['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x4477ef,_0x50dc2c))return void this['_actionsBalloonView']['showBlockingError'](Ts(_0x46f06f['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x4477ef['setChangeGroupState'](0x0,'accepted');const _0x1d764f=tr({'documentSuggestions':er({'groups':[_0x4477ef['changeGroups'][0x0]],'documentContextContent':_0x4477ef['documentContextContent'],'documents':_0x263ba1['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x436e8d,'documentCompareOptions':{'anchor':_0x46f06f['model']['createPositionAt'](_0x2c030f,0x0),'markDeletions':_0x167555}})['values']()['next']()['value']??[],_0x3b4c37=this['_filterOperationsOutsideRange'](_0x1d764f,_0x149249);for(const _0x2834d0 of _0x3b4c37)this['_anchorOperation'](_0x149249,_0x2834d0,_0x50dc2c);const _0x507e88=_0x263ba1['getDocumentContext']()['documents'][0x0]['version'],_0x11d1c8=_0x371d73(_0x3b4c37,_0x46f06f['model']['document']['history']['getOperations'](_0x507e88),{'document':_0x46f06f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];wn(_0x11d1c8,'quickActions');try{_0x46f06f['model']['change'](_0x325f8d=>{_0x325f8d['setSelection'](_0x46f06f['model']['document']['selection']['focus']),_0x167555?_0x46f06f['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x11d1c8):_0x436e8d['applyOperations'](_0x325f8d,_0x11d1c8);});}catch(_0x3dc305){throw this['_reporter']['logError'](new xn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x3dc305})),_0x3dc305;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x289f9d,_0x44972d){return _0x289f9d['filter'](_0x1f1121=>{if('rename'==_0x1f1121['type']){const _0x17d410=_0x1f1121['position']['nodeAfter'];return!_0x44972d['has'](_0x17d410);}if(_0x1f1121['type']['indexOf']('Attribute')>-0x1){const _0x4602b2=_0x1f1121['range']['start']['nodeAfter'];return!_0x44972d['has'](_0x4602b2);}return!0x0;});}_anchorOperation(_0x3b29c8,_0x37cf00,_0x528e67){const _0x387d7e=_0x37cf00['clone']();for(const _0x310c05 in _0x37cf00){const _0x1009f6=_0x37cf00[_0x310c05];_0x1009f6 instanceof _0x5a312a?_0x37cf00[_0x310c05]=new _0x5a312a(_0x4d4141(_0x1009f6['start']),_0x4d4141(_0x1009f6['end'])):_0x1009f6 instanceof _0x273953&&(_0x37cf00[_0x310c05]=_0x4d4141(_0x1009f6));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x387d7e['type'])){if(_0x387d7e['isDocumentOperation']=!0x1,_0x387d7e['baseVersion']=null,'remove'==_0x387d7e['type']){const _0x37cbe8=_0x387d7e['sourcePosition'],_0x404fb1=_0x387d7e['howMany'];new _0x4a9b8c(_0x37cbe8,_0x404fb1)['_execute']();}else _0x387d7e['_execute']();}function _0x4d4141(_0x3af041){if('$graveyard'==_0x3af041['root']['rootName'])return _0x3af041;const _0x124ccb=[];let _0x160263=_0x3af041['root'];for(let _0x21a61b=0x0;_0x21a61b<_0x3af041['path']['length'];_0x21a61b++){const _0x469359=_0x3b29c8['get'](_0x160263)||0x0;_0x124ccb[_0x21a61b]=_0x3af041['path'][_0x21a61b]+_0x469359,_0x160263=_0x160263['getChildAtOffset'](_0x3af041['path'][_0x21a61b]);}return new _0x273953(_0x528e67,_0x124ccb,_0x3af041['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x2636e2,content:_0x4f765f,version:_0x2b8cb3,aiBalloon:_0x53a16b}=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'](_0x4f765f,_0x2b8cb3,_0x53a16b,_0x2636e2)['catch'](_0x427951=>{this['_reporter']['logError'](_0x427951,{'context':{'operation':'refresh-interaction'}});});}_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 _0x34d8d7=this['_interactions']['length'];this['_currentInteractionIndex']<_0x34d8d7-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x4cae88){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4cae88;const _0x54d4e7=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x54d4e7)return;if(_0x54d4e7['hasError'])return this['_setErrorState'](_0x54d4e7),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x54d4e7['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0xddf543=_0x54d4e7['replies'][_0x54d4e7['replies']['length']-0x1];if(_0xddf543)try{const _0x3a4456=dn({'changeGroups':_0xddf543['changeGroups'],'documentContextContent':_0xddf543['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x40f04c=>setTimeout(_0x40f04c,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x3a4456[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3fa4bf){this['_reporter']['logError'](_0x3fa4bf,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x89324f,_0x2dbfc7){if(void 0x0!==_0x2dbfc7&&Nn(_0x2dbfc7))return;const _0x28cfaa=Ts(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x28cfaa),_0x89324f['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);}},ph=class extends _0x46e624{static get requires(){return[nh,hh,Ih];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x21aa00){super(_0x21aa00),_0x21aa00['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Eh=class extends _0x20e82c{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x151dbe,_0x2ff48a){super(_0x151dbe),this['id']=_0x2ff48a,this['set']('status','pending'),this['set']('changeId',_0x2ff48a),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',(_0x7872b7,_0x520cbe)=>{_0x520cbe&&_0x520cbe['target']&&'A'===_0x520cbe['target']['tagName']&&_0x520cbe['preventDefault'](),this['fire']('activateChange',{'id':_0x2ff48a,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x2ff48a,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x2ff48a,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x457432=new _0x20e82c(this['locale']);return _0x457432['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x457432;}updateResponseContent(_0x153e4d,_0x496a7a){const _0x3cb3c4=_0x496a7a||'div',_0x3d3713=this['resultResponseView']['element'];if(_0x3d3713['tagName']['toLowerCase']()!==_0x3cb3c4){const _0x3ecfa4=new _0x5a9c07({'tag':_0x3cb3c4,'attributes':{'class':_0x3d3713['className']}})['render']();_0x3d3713['replaceWith'](_0x3ecfa4),this['resultResponseView']['element']=_0x3ecfa4,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x153e4d;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0xb4945d=new Vt(this['locale']);return _0xb4945d['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0xb4945d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5d3f90=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x5d3f90['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0xb09114=>'pending'!==_0xb09114&&'accepted'!==_0xb09114),this['bindTemplate']['if']('status',Hn,_0x5b220c=>'pending'===_0x5b220c),this['bindTemplate']['if']('status',Mn,_0x56aa28=>'pending'!==_0x56aa28),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x315f29=>'accepted'===_0x315f29)]}}),this['on']('change:status',(_0x3d182b,_0x1f527c,_0x1bd78f)=>{_0xb4945d['isEnabled']='pending'===_0x1bd78f,'accepted'===_0x1bd78f&&(_0xb4945d['label']=Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0xb4945d['icon']=_0x8456a1);}),_0xb4945d;}_createDismissButtonView(){const _0x1a3211=new Vt(this['locale']);return _0x1a3211['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x1a3211['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x20219f=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x20219f['stopPropagation']();})},'attributes':{'class':[Mn,this['bindTemplate']['if']('status','ck-hidden',_0x171e0e=>'pending'!==_0x171e0e&&'rejected'!==_0x171e0e),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0xb11424=>'pending'===_0xb11424),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2b8d45=>'rejected'===_0x2b8d45)]}}),this['on']('change:status',(_0xcae8af,_0x16ab27,_0x57313f)=>{_0x1a3211['isEnabled']='pending'===_0x57313f,'rejected'===_0x57313f&&(_0x1a3211['label']=Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x1a3211['icon']=_0x566e32);}),_0x1a3211;}_createInfoButtonView(){const _0x419587=new Vt(this['locale']);return _0x419587['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x1fe15f,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Mn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x419587['bind']('isOn')['to'](this,'isInfoToggleOn',_0x55609b=>_0x55609b),_0x419587['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x419587;}_createOutdatedButtonView(){const _0x2da404=new Vt(this['locale']);return _0x2da404['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x47ab83,'withText':!0x0,'isEnabled':!0x1}),_0x2da404['extendTemplate']({'attributes':{'class':[Mn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x2ae66f=>'outdated'!==_0x2ae66f)],'disabled':'disabled'}}),_0x2da404;}},mh=class extends Pt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x23ce22,_0x57b9c7){super(_0x23ce22),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']()),_0x57b9c7['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x844f1e){this['resultItemView']['changeId']=_0x844f1e['id'],this['resultItemView']['updateResponseContent'](_0x844f1e['contentDiffed'],_0x844f1e['wrapperTag']);}['showBalloon'](_0x581e13,_0x409375,_0x321482,_0x525f03,_0x217f51,_0x41a727){const _0x596347=_0x409375();if(!_0x596347)return;this['updateContent'](_0x581e13),this['show']();const _0x9e2175=Array['from'](_0x596347['getClientRects']())['reverse'](),_0x35c140=this['_getPointedRectIndexFromEvent'](_0x321482,_0x9e2175),_0x1d6310=_0x9e2175[_0x35c140??0x0];'click'===_0x525f03?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x409375(),_0x35c140,_0x581e13['id'],_0x217f51,_0x41a727)||_0x1d6310})):'hover'===_0x525f03&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x409375(),_0x35c140,_0x581e13['id'])||_0x1d6310}));}['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(){_0x317702({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x1c9bfe=[this['element']];return this['_pinnedTargetElement']&&_0x1c9bfe['push'](this['_pinnedTargetElement']),_0x1c9bfe;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x378e10=new _0x20e82c();return this['resultItemView']=new Eh(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x378e10['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']]}]}),_0x378e10;}_getBestRectPositionOnClick(_0x4720cb,_0x187fb0,_0x553988,_0x367a9f,_0x3a81c7){if(!_0x4720cb)return null;const _0x11162f=this['position']['replace']('arrow_',''),_0xcc46fd=Array['from'](_0x4720cb['getClientRects']());let _0x4c15a7,_0x35cb8e=_0xcc46fd['reverse']();return void 0x0!==_0x187fb0&&this['_isPinnedRectVisible'](_0x35cb8e[_0x187fb0],_0x367a9f,_0x3a81c7)?(_0x4c15a7=_0x35cb8e[_0x187fb0],this['_pinnedRectIndex']=_0x187fb0):this['_isPinnedRectVisible'](_0x35cb8e[0x0],_0x367a9f,_0x3a81c7)&&void 0x0===_0x187fb0?_0x4c15a7=_0x35cb8e[0x0]:(_0x35cb8e='s'==_0x11162f[0x0]?[..._0xcc46fd]['reverse']():_0xcc46fd,_0x35cb8e['forEach'](_0x37b6a8=>{this['_isPinnedRectVisible'](_0x37b6a8,_0x367a9f,_0x3a81c7)&&(_0x4c15a7=_0x37b6a8);})),this['_pinnedTargetChangeId']=_0x553988,this['_pinnedTargetElement']=_0x4720cb,_0x4c15a7||_0x4720cb['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x18e82d,_0x10e979,_0xe1cdf0){if(!_0x18e82d)return null;const _0x4dc603=Array['from'](_0x18e82d['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x10e979&&this['_pinnedTargetChangeId']!==_0xe1cdf0?(this['_pinnedRectIndex']=_0x10e979,this['_pinnedTargetElement']=_0x18e82d,this['_pinnedTargetChangeId']=_0xe1cdf0,_0x4dc603[_0x10e979]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0xe1cdf0?_0x18e82d!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x4dc603[this['_pinnedRectIndex']]:void 0x0!==_0x10e979&&this['_pinnedTargetChangeId']!==_0xe1cdf0?(this['_pinnedRectIndex']=_0x10e979,this['_pinnedTargetElement']=_0x18e82d,this['_pinnedTargetChangeId']=_0xe1cdf0,_0x4dc603[_0x10e979]):_0x18e82d['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x271f60,_0x49510f){if(_0x271f60)for(let _0x33bd50=0x0;_0x33bd50<_0x49510f['length'];_0x33bd50++){const _0x21e57b=_0x49510f[_0x33bd50];if(_0x271f60['clientX']>=_0x21e57b['left']-0x3&&_0x271f60['clientX']<=_0x21e57b['right']+0x3&&_0x271f60['clientY']>=_0x21e57b['top']-0x3&&_0x271f60['clientY']<=_0x21e57b['bottom']+0x3)return _0x33bd50;}}_isPinnedRectVisible(_0x596f52,_0x4c9bdb,_0x449771){const _0x264a2b=new It(_0x596f52),_0xf50d23=_0x4c9bdb||document['documentElement'],_0x53d1de=_0x264a2b['getIntersection'](wt(_0x449771)),_0x50310e=new It(_0xf50d23)['getIntersection'](_0x264a2b);return!!(_0x53d1de&&_0x50310e&&_0x264a2b['width']>0x0);}};const Th=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var wh=class extends _0x22445f{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[Is];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x25f2bc){super(_0x25f2bc),this['_bodyCollection']=Vn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Th)['to'](this),this['_balloonSuggestionView']=new mh(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x3c3704=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x3c3704);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x2e4580){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x1d1894=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x2e4580,_0x1d1894);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x30737a){_0x30737a&&('error-general'!==_0x30737a['status']?'error-chunk'!==_0x30737a['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x3f227b){this['_mainView']['addCheckRunResult'](_0x3f227b);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x3e66d0){this['_mainView']['showGeneralReviewCoreErrorView'](_0x3e66d0??Ts(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x46de41,_0x108cb3){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x46de41,_0x108cb3);}setAcceptAllEnabled(_0x517dc3){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x517dc3);}setActiveStateInResults(_0x412e3a){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x340982=>{_0x340982['id']===_0x412e3a&&_0x340982['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x2a44fc=>_0x2a44fc['setItemAsInactive']());}updateChangeState(_0x4f2863,_0x32b4dc){'accepted'===_0x32b4dc||'rejected'===_0x32b4dc||'outdated'===_0x32b4dc?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x4f2863,_0x32b4dc):this['_mainView']['reviewCheckResultsView']['showResult'](_0x4f2863,_0x32b4dc);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x381bf6,_0x237e9e,_0x716bbe,_0x584a22,_0x37d4f2,_0x4faccd){this['_balloonSuggestionView']['showBalloon'](_0x381bf6,_0x237e9e,_0x716bbe,_0x584a22,_0x37d4f2,_0x4faccd);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x5b3adc){const _0x5a8138=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0xa22461=>_0xa22461['id']===_0x5b3adc);return _0x5a8138?_0x5a8138['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Ch=class extends _0x20e82c{constructor(_0xe89a78){super(_0xe89a78),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x5cb58e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x5cb58e['if']('isVisible','ck-hidden',_0x49a68c=>!_0x49a68c)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x5cb58e['to']('errorMessage')}]}]});}},fh=class extends _0x20e82c{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x55b161,_0x249688){super(_0x55b161),this['reviewCoreHeader']=_0x249688['header'],this['generalErrorView']=new Ch(_0x55b161),this['reviewCheckListView']=_0x249688['list'],this['reviewCheckListView']['delegate'](...Th)['to'](this),this['reviewCheckResultsView']=_0x249688['results'],this['reviewCheckResultsView']['delegate'](...Th)['to'](this),this['reviewCompletedView']=_0x249688['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(_0x3e5d0c){this['reviewCheckResultsView']['addResult'](_0x3e5d0c),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'](_0x3994ff){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x3994ff;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},bh=class extends Vt{constructor(_0x4a331c,_0x33d160){super(_0x33d160),this['set']({'label':_0x4a331c,'withText':!0x0,'class':Dn}),this['on']('execute',()=>{this['fire']('finishReview');});}},Sh=class extends Zt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x25a0a3,_0x54911e){super(_0x25a0a3),this['_contents']=_0x54911e,this['_resultViews']=new _0x261c11(),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 ga(_0x25a0a3),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x1ea4eb,_0xa7701f)=>_0x1ea4eb&&!_0xa7701f);const _0x190dd9=this['_createCombinedSkeletonLoader'](),_0x40894e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x40894e['if']('isLoading','ck-ai_review__check-run_loading',_0x37fc1d=>_0x37fc1d),_0x40894e['if']('isResultReady','ck-ai_review__check-run_ready',_0x3b9e7e=>_0x3b9e7e),_0x40894e['if']('isVisible','ck-hidden',_0x18be47=>!_0x18be47)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x190dd9,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x20dffe){const _0x3fa380=new Eh(this['locale'],_0x20dffe['id']);_0x3fa380['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x3fa380),_0x3fa380['updateResponseContent'](_0x20dffe['contentDiffed'],_0x20dffe['wrapperTag']);}hideResult(_0x108367,_0x10cb6f){if('pending'===_0x10cb6f)return;const _0x3ab4f6=this['_resultViews']['find'](_0x4a40d4=>_0x4a40d4['id']===_0x108367);_0x3ab4f6&&(_0x3ab4f6['status']=_0x10cb6f,_0x3ab4f6['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x3f2137,_0x31afd){if('pending'!==_0x31afd)return;const _0xca1d5a=this['_resultViews']['find'](_0x416c35=>_0x416c35['id']===_0x3f2137);_0xca1d5a&&(_0xca1d5a['status']=_0x31afd,_0xca1d5a['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x5d20b2,_0x557eee){this['headerTitle']=_0x5d20b2,this['headerSubtitle']=_0x557eee||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0xb5c638){this['isAcceptAllEnabled']=_0xb5c638;}_createSkeletonLoader(){return new fr(this['locale'],br['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x351d60=new _0x20e82c(this['locale']),_0x5106d6=[];for(let _0x3a94df=0x0;_0x3a94df<0x10;_0x3a94df++){const _0xfbd200=this['_createSkeletonLoader']();_0xfbd200['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x5106d6['push'](_0xfbd200);}return _0x351d60['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x46a310=>!_0x46a310)]},'children':_0x5106d6}),_0x351d60;}_createResultsBodyView(){const _0x4dbc5e=new _0x20e82c(this['locale']);return _0x4dbc5e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3ac323=>_0x3ac323)]},'children':this['_resultViews']}),_0x4dbc5e;}_createErrorView(){const _0x30587c=new _0x20e82c(this['locale']),_0xb63db3=new Vt(this['locale']),t=this['locale']['t'];return _0x30587c['delegate']('retryReview')['to'](this),_0xb63db3['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0xb63db3['on']('execute',()=>{this['fire']('retryReview');}),_0x30587c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x3f1225=>!_0x3f1225),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x2f545e=>'chunk'===_0x2f545e)]},'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',_0x2661a8=>'chunk'===_0x2661a8||'unsupported-inline'===_0x2661a8)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x567e9f=>'general'!==_0x567e9f)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3a2211=>'chunk'!==_0x3a2211)]},'children':[{'text':Ts(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2f350d=>'unsupported-inline'!==_0x2f350d)]},'children':[{'text':Ts(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0xb63db3]}),_0x30587c;}_createCancelButtonView(){const _0x1ab48f=new Vt(this['locale']);return _0x1ab48f['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Hn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x1ab48f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x19bfc9=>_0x19bfc9),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2cd94c=>_0x2cd94c)]}}),_0x1ab48f['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1ab48f;}_createToggleDiffButtonView(){const _0x2f66fe=new Vt(this['locale']);_0x2f66fe['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x2f66fe['bind']('isEnabled')['to'](this,'isError',_0x574495=>!_0x574495),_0x2f66fe['extendTemplate']({'attributes':{'class':[Hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5dc734=>!_0x5dc734),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1a0266=>_0x1a0266)]}});const _0x58ca50=Ts(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x121760=Ts(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x2f66fe['bind']('isOn')['to'](this,'isToggleDiffOn',_0x55a4d3=>_0x55a4d3),_0x2f66fe['bind']('icon')['to'](this,'isToggleDiffOn',_0x2e09f0=>_0x2e09f0?_0x1dd131:_0x5d0880),_0x2f66fe['bind']('label')['to'](this,'isToggleDiffOn',_0x3c6ad5=>_0x3c6ad5?_0x58ca50:_0x121760),_0x2f66fe['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x2f66fe;}_createAcceptAllButtonView(){const _0x5b482e=new Vt(this['locale']);return _0x5b482e['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x5b482e['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x34d1fa=>!_0x34d1fa),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x59d98e=>_0x59d98e)]}}),_0x5b482e['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x5b482e;}_createExitReviewButtonView(){const _0x79a532=new Vt(this['locale']);return _0x79a532['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x79a532['extendTemplate']({'attributes':{'class':[Mn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5154ad=>!_0x5154ad),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xcc88d0=>_0xcc88d0)]}}),_0x79a532['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x79a532;}_createResultHeaderView(){const _0x3f7044=new _0x20e82c(this['locale']),_0xfdd3c1=this['_createTitleView']();return _0x3f7044['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x2e3856=>_0x2e3856)]},'children':[_0xfdd3c1,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3f452c=>!_0x3f452c)],'title':Ts(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Ts(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']]}]}),_0x3f7044;}_createTitleView(){const _0x48957a=new _0x20e82c(this['locale']),_0x1a3dfe=new Mr();return _0x1a3dfe['bind']('isVisible')['to'](this,'isResultReady',_0x2efdfd=>!_0x2efdfd),_0x48957a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x393287=>_0x393287)]},'children':[_0x1a3dfe,{'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')}]}]}]}),_0x48957a;}_createFinishReviewButtonView(){const _0x112770=new bh(Ts(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x112770['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x25aa59=>!_0x25aa59)]}}),_0x112770['delegate']('finishReview')['to'](this),_0x112770;}},Rh=class extends Zt{_resultsHeader;_finishReviewButtonView;constructor(_0x3f94ec,_0x129c1f){super(_0x3f94ec),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x129c1f['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x129c1f['headerText']);const _0x496704=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x496704['if']('isVisible','ck-hidden',_0x4a3678=>!_0x4a3678)]},'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':_0x129c1f['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x38c6e7){const _0x5b562f=new bh(_0x38c6e7,this['locale']);return _0x5b562f['delegate']('finishReview')['to'](this),_0x5b562f;}_createResultHeaderView(_0x91375b){const _0x3597aa=new _0x20e82c(this['locale']);return _0x3597aa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x91375b},'children':[{'text':_0x91375b}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3597aa;}},Oh=class extends _0x20e82c{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x45ac20,_0x14764f){super(_0x45ac20),this['_defaultValue']=_0x14764f['default']||(_0x14764f['data']['length']>0x0?_0x14764f['data'][0x0]['id']:''),this['_defaultLabel']=_0x14764f['data']['find'](_0x573c71=>_0x573c71['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x28f0f7(this['locale']);const _0xbc513e=this['_prepareListOptions'](_0x14764f['data']);_0x534621(this['_dropdownView'],_0xbc513e,{'role':'menu','ariaLabel':_0x14764f['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1d5840=>{_0x1d5840['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x54f91a=>{this['formValue']=_0x54f91a['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x54f91a['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(_0x162008=[]){const _0x269a52=new lt();this['resetToDefault']();for(const _0x1a9974 of _0x162008){const _0x245d8e=new _0x27fe92({'label':_0x1a9974['label'],'withText':!0x0,'role':'menuitemradio','id':_0x1a9974['id'],'model':_0x1a9974});_0x245d8e['bind']('isOn')['to'](this,'formValue',_0x5a7a83=>_0x5a7a83===_0x245d8e['id']);const _0x4840a2={'type':'button','model':_0x245d8e};_0x269a52['add'](_0x4840a2);}return _0x269a52;}},vh=class extends Zt{_formItem=null;constructor(_0x563317,_0x129de6,_0x4ed8d5){if(super(_0x563317),this['argsKey']=_0x129de6?.['argsKey'],'dropdown'===_0x129de6['formType'])this['_formItem']=new Oh(this['locale'],_0x129de6);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x4fedd2=new $t(this['locale'],{'children':[this['_formItem']],'class':[_0x4ed8d5?'ck-form__row_with-submit':'']});_0x4ed8d5&&_0x4fedd2['children']['add'](_0x4ed8d5),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x4fedd2]});}resetToDefault(){this['_formItem']['resetToDefault']();}},kh=class AIReviewCorePromptInputView extends _0x3c3562{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x1d6f37){super(_0x1d6f37),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},yh=class extends _0x20e82c{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x261c11();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x37bfcc,_0x204428,_0xce4f1e=!0x1){super(_0x37bfcc),this['_check']=_0x204428,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new zt(this['locale'],()=>new kh(_0x37bfcc)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Eo(_0x37bfcc,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x43263b,_0x127ce4)=>{this['modelId']=_0x127ce4['id'],this['_modelSelector']['setSelectedModel'](_0x127ce4);}),this['_setModelList'](_0xce4f1e),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new $t(this['locale'],{'children':[this['promptInputView']]}),new $t(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x228118,_0x277eef)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x277eef()):_0x277eef();}),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x517fa8=>{this['_focusables']['add'](_0x517fa8),this['focusTracker']['add'](_0x517fa8['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x399ead of this['_getFormValidators']()){const _0x3a0410=_0x399ead();if(_0x3a0410)return this['promptInputView']['errorText']=_0x3a0410,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Ts(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0x3742f7=new Vt(this['locale']),t=this['locale']['t'];return _0x3742f7['set']({'label':t('Submit'),'withText':!0x0,'class':Dn}),_0x3742f7['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x3742f7;}_createCancelButtonView(){const _0x4b7b2d=new Vt(this['locale']),t=this['locale']['t'];return _0x4b7b2d['set']({'label':t('Cancel'),'withText':!0x0,'class':Mn}),_0x4b7b2d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2210d6=>{_0x2210d6['stopPropagation']();})}}),_0x4b7b2d['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x4b7b2d;}_setModelList(_0x23527a){this['_modelSelector']['setModels'](this['_check']['models'],!_0x23527a),this['resetToDefault']();}_createActionsFooterView(){const _0x9a8fb6=new _0x20e82c(this['locale']);return _0x9a8fb6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x9a8fb6;}},Nh=class extends Zt{_formItemsCollection=new _0x261c11();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x25b65f,_0x5a5034,_0x15b533,_0x57f289=!0x1){super(_0x25b65f),this['_hideModels']=_0x57f289,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x5a5034['isParameterized']);const _0x425263=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',_0x4926a9=>_0x4926a9),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x18ac88=>_0x18ac88)],'style':{'--ck-ai-review-check-list-item-index':_0x15b533}},'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':_0x5a5034['title']}]},_0x425263]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x5a5034['description']?[{'text':_0x5a5034['description']}]:[]}]}]},..._0x5a5034['isParameterized']?[this['_createParameterizedView'](_0x5a5034)]:[],...'custom'===_0x5a5034['id']?[this['_createCustomView'](_0x5a5034,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x5a5034['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x5a5034['id'],'args':_0x5a5034['useArgs']?_0x5a5034['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x317702({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x364f10=>{_0x364f10['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x3c343e=new Qt();return _0x3c343e['content']=_0x527231,_0x3c343e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x3c343e;}_createParameterizedView(_0x2c956c){const _0x2f8d94=new _0x20e82c(),_0x194b87=this['_createFormView'](_0x2c956c);return _0x2f8d94['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x566c66=>!_0x566c66)]},'children':[_0x194b87]}),_0x2f8d94;}_createFormView(_0x1b0799){const _0x1b7dce=new _0x20e82c(),_0x3187b0=Array['isArray'](_0x1b0799['options'])?_0x1b0799['options']:[],_0x511843=new Vt(this['locale']),t=this['locale']['t'];_0x511843['set']({'label':t('Submit'),'withText':!0x0,'class':Dn}),_0x511843['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3ee184=>{_0x3ee184['stopPropagation']();})}}),_0x511843['on']('execute',()=>{const _0x546b37=[],_0xec3eaa={};this['_formItemsCollection']['forEach'](_0xc9c25c=>{_0x546b37['push'](_0xc9c25c['value']),_0x1b0799['useArgs']&&_0x1b0799['options']&&(_0xec3eaa[_0xc9c25c['argsKey']]=_0xc9c25c['value']);}),this['fire']('runReviewCheck',{'id':_0x1b0799['id'],'params':_0x546b37['length']?_0x546b37:void 0x0,'args':Object['keys'](_0xec3eaa)['length']?_0xec3eaa:void 0x0});});const _0x1e0e0b=_0x3187b0['length'];return _0x3187b0['forEach']((_0x4895ce,_0x47c9bb)=>{const _0x257bd8=_0x47c9bb===_0x1e0e0b-0x1;this['_formItemsCollection']['add'](new vh(this['locale'],_0x4895ce,_0x257bd8?_0x511843:null));}),_0x1b7dce['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x1b7dce;}_createCustomView(_0x4f1d4c,_0x43fd4a=!0x1){return this['_customCheckView']=new yh(this['locale'],_0x4f1d4c,_0x43fd4a),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',_0x509516=>!_0x509516)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x19acd6,_0x346768,_0x1d6966)=>{_0x1d6966||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},xh=class extends Zt{['_checkViews'];constructor(_0x1b5a3e){super(_0x1b5a3e),this['_checkViews']=new _0x261c11(),this['_setupTemplate']();}setChecks(_0x5ba001,_0x26ebb8=!0x1){this['_checkViews']['clear']();for(const [_0x490eaf,_0x1067ec]of _0x5ba001['entries']()){const _0x1e497e=new Nh(this['locale'],_0x1067ec,_0x490eaf,_0x26ebb8);_0x1e497e['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x1e497e);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x2b2481 of this['_checkViews'])_0x2b2481 instanceof Nh&&_0x2b2481['resetToDefault']();}_setupTemplate(){const _0x336f04=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x336f04['if']('isVisible','ck-hidden',_0xd93426=>!_0xd93426)]},'children':this['_checkViews']});}},Lh=class extends wh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x3e5830=this['context']['plugins']['get']('AITabs'),_0x10b7e0=this['context']['locale'],_0x3316e7=new _a(_0x10b7e0,{'label':Ts(_0x10b7e0,'AI_REVIEW_MODE'),'icon':_0xceba15,'class':'ck-ai-header_review','showResizeButton':_0x3e5830['showResizeButton']});return _0x3316e7['delegate']('resizeTabs')['to'](_0x3e5830),_0x3316e7['bind']('isMaximized')['to'](_0x3e5830['view'],'isMaximized',_0x5e6533=>_0x5e6533),new fh(this['context']['locale'],{'header':_0x3316e7,'list':new xh(_0x10b7e0),'results':new Sh(_0x10b7e0,{'generalErrorText':Ts(_0x10b7e0,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Rh(_0x10b7e0,{'headerText':Ts(_0x10b7e0,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Ts(_0x10b7e0,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Ts(_0x10b7e0,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x1762ed=this['context']['plugins']['get']('AITabs');_0x1762ed['view']['on']('activateTab',(_0x213602,{newTab:_0x476b55,oldTab:_0x4c9955})=>{'reviewMode'===_0x476b55?this['fire']('getReviewCheckList'):'reviewMode'===_0x4c9955&&this['fire']('leaveReview');}),_0x1762ed['view']['addTab']({'id':'reviewMode','buttonLabel':Ts(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0xceba15,'order':0x0,'content':this['_mainView']});}},Ph=class extends On{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0xd7a1bf){this['_affectedBlocks']=_0xd7a1bf;}};const Dh='review-',Hh=['softBreak'],Mh=['htmlScript','htmlStyle','htmlCustomElement'];var Uh=class extends _0x22445f{static get requires(){return[_0xc19772,sn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x35e687){super(_0x35e687),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x49b1ae=_0x10f44d=>this['_scheduleAttachReviewEditingToEditor'](_0x10f44d);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x46bd64)return void _0x49b1ae(this['context']);const _0x5f9ee5=this['context'];for(const _0xd2b876 of _0x5f9ee5['editors'])_0x49b1ae(_0xd2b876);this['listenTo'](_0x5f9ee5['editors'],'add',(_0x20aa8f,_0x4a7d96)=>{_0x49b1ae(_0x4a7d96);}),this['listenTo'](_0x5f9ee5['editors'],'remove',(_0x638da2,_0x1f55d6)=>{for(const [_0x5e0ffc,_0x330146]of this['_markers'])_0x330146['editor']===_0x1f55d6&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x5e0ffc,'changeId':_0x330146['groupId']}),this['_markers']['delete'](_0x5e0ffc));});}_scheduleAttachReviewEditingToEditor(_0x4064e6){const _0x1313f8=()=>{'destroyed'!==_0x4064e6['state']&&_0x4064e6['conversion']&&this['_attachReviewEditingToEditor'](_0x4064e6);};if('ready'===_0x4064e6['state'])return void _0x1313f8();const _0x454b72=()=>{this['stopListening'](_0x4064e6,'ready',_0x454b72),_0x1313f8();};this['listenTo'](_0x4064e6,'ready',_0x454b72);}_attachReviewEditingToEditor(_0x4f9488){this['_reviewEditingAttachedEditors']['has'](_0x4f9488)||(_0x4f9488['conversion']['for']('editingDowncast')['markerToElement']({'model':Dh+'insert','view':(_0x212a84,{writer:_0x588f5b})=>{const _0x300c54=this['_markers']['get'](_0x212a84['markerName']),_0x412f5f={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x300c54?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x212a84['markerName']};return _0x588f5b['createUIElement']('span',_0x412f5f,function(_0x590d49){const _0x1a62f4=this['toDomElement'](_0x590d49);return _0x1a62f4['innerHTML']=_0x300c54?.['content']?.['asString']||'',_0x1a62f4;});}}),_0x4f9488['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-only','view':_0x10ee77=>{const _0x3a888a=this['_markers']['get'](_0x10ee77['markerName']),_0x401292=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x3a888a?.['id']||'')&&_0x401292['push']('ck-ai_review__change_active'),{'classes':_0x401292,'attributes':{'data-marker-id':_0x10ee77['markerName']}};}}),_0x4f9488['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-context','view':_0xd8e057=>{const _0x481a41=this['_markers']['get'](_0xd8e057['markerName']),_0x35587a=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x481a41?.['id']||'')&&_0x35587a['push']('ck-ai_review__change_active'),{'classes':_0x35587a,'attributes':{'data-marker-id':_0xd8e057['markerName']}};}}),_0x4f9488['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-text','view':_0x3a5c4d=>{const _0x1fb54a=this['_markers']['get'](_0x3a5c4d['markerName']),_0x4fc8f9=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x1fb54a?.['id']||'')&&_0x4fc8f9['push']('ck-ai_review__change_active'),{'classes':_0x4fc8f9,'attributes':{'data-marker-id':_0x3a5c4d['markerName']}};}}),_0x4f9488['conversion']['for']('dataDowncast')['markerToElement']({'model':Dh+'suggestion-context','view':(_0x50ff67,{writer:_0x3cf619})=>_0x3cf619['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x50ff67['isOpening']?'start':'end')})}),_0x4f9488['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x3ebabe,'view':_0x1caeff}),this['_updateMouseMarkerInteractionListeners'](_0x4f9488),this['listenTo'](_0x4f9488,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4f9488),{'priority':'lowest'}),this['listenTo'](_0x4f9488,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4f9488),{'priority':'lowest'}),_0x4f9488['model']['document']['registerPostFixer'](_0x58b83d=>this['_validateMarkers'](_0x4f9488,_0x58b83d)),_0x4f9488['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x4f9488)),this['_reviewEditingAttachedEditors']['add'](_0x4f9488));}_updateMouseMarkerInteractionListeners(_0x2a8c61){let _0x2bb385=this['_boundEditables']['get'](_0x2a8c61);_0x2bb385||(_0x2bb385=new Map(),this['_boundEditables']['set'](_0x2a8c61,_0x2bb385));const _0x17ead8=new Set(_0x2a8c61['ui']['getEditableElementsNames']());for(const _0x57f9f6 of _0x17ead8){if(_0x2bb385['has'](_0x57f9f6))continue;const _0x3e5ca6=_0x2a8c61['ui']['getEditableElement'](_0x57f9f6);_0x2bb385['set'](_0x57f9f6,_0x3e5ca6),this['_attachMouseMarkerInteractionListeners'](_0x3e5ca6);}for(const [_0x552049,_0x2f1e10]of _0x2bb385)_0x17ead8['has'](_0x552049)||(_0x2bb385['delete'](_0x552049),this['_domEmitter']['stopListening'](_0x2f1e10));}_attachMouseMarkerInteractionListeners(_0x37583e){this['_domEmitter']['listenTo'](_0x37583e,'mouseup',(_0x5ca825,_0x2a7f3e)=>{const _0x2c7045=_0x2a7f3e['target'],_0x3cd9c7=this['_findMarkerElement'](_0x2c7045);if(!_0x3cd9c7)return;const _0x36c183=_0x3cd9c7['getAttribute']('data-marker-id'),_0x22f7a3=_0x36c183['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x36c183,'changeId':_0x22f7a3,'markerElement':()=>this['_findMarkerElementById'](_0x36c183),'domEvent':_0x2a7f3e});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x37583e,'mouseover',(_0x52c5aa,_0x473505)=>{const _0x1409b2=_0x473505['target'],_0x53779e=_0x473505['relatedTarget'];let _0x347bdb=this['_findMarkerElement'](_0x1409b2);if(!_0x347bdb&&_0x53779e&&(_0x347bdb=this['_findMarkerElement'](_0x53779e)),!_0x347bdb)return;const _0x5a8f07=_0x347bdb['getAttribute']('data-marker-id'),_0x1345bd=_0x5a8f07['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x1345bd,'markerElement':()=>this['_findMarkerElementById'](_0x5a8f07),'domEvent':_0x473505});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x41febd((_0x20f06b,_0x644c6b)=>{const _0x309c8d=_0x644c6b['target'];this['_findMarkerElement'](_0x309c8d)||_0x309c8d['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0xc29913){const _0x46e220=this['context']['plugins']['get']('AIEditing'),_0xbdfa52=Rs(this['context']);if(!_0xbdfa52['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x508c3d=_0xc29913?.['roots'];if(_0x508c3d&&0x0===_0x508c3d['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x5417e3=_0x508c3d?new Set(_0x508c3d['map'](_0x3b478f=>_0x3b478f['channelId']+'\x00'+_0x3b478f['rootName'])):null,_0xa1c75=_0x5417e3?new Set():null,_0x15ae20=new Set(),_0x4212ba=[],_0x756dc1=new Map(),_0x1f9cdb=[];for(const _0x234390 of _0xbdfa52){const _0x2fff82=_0x234390['config']['get']('collaboration.channelId');for(const _0x5538b7 of _0x234390['model']['document']['getRoots']()){const _0x19c038=_0x2fff82+'\x00'+_0x5538b7['rootName'];if(_0x5417e3&&!_0x5417e3['has'](_0x19c038))continue;const _0x4ecb60=this['_buildDocumentDataSliceForRoot'](_0x234390,_0x5538b7,_0x46e220,_0x15ae20);_0x4212ba['push'](_0x4ecb60['content']);for(const [_0x85a737,_0x21433a]of _0x4ecb60['elements'])_0x756dc1['set'](_0x85a737,_0x21433a);_0x1f9cdb['push']({'channelId':_0x2fff82,'rootName':_0x5538b7['rootName']}),_0xa1c75?.['add'](_0x19c038);}}if(_0x508c3d&&_0xa1c75['size']!==_0x5417e3['size']){const _0x3c78cf=_0x508c3d['find'](_0x40cca9=>!_0xa1c75['has'](_0x40cca9['channelId']+'\x00'+_0x40cca9['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x3c78cf['channelId'],'rootName':_0x3c78cf['rootName']});}return{'elements':_0x756dc1,'content':_0x4212ba['join'](''),'roots':_0x1f9cdb};}async['runCheck'](_0x186e02,_0x48277f){const _0x68776c=new kn(),_0x5220c8=_0x48277f?.['signal'];let _0x4f774c;const _0xaf7c19=()=>{_0x68776c['abort'](),_0x186e02['abort']();};if(_0x5220c8){if(_0x5220c8['aborted'])return _0xaf7c19(),_0x68776c;_0x5220c8['addEventListener']('abort',_0xaf7c19),_0x4f774c=()=>_0x5220c8['removeEventListener']('abort',_0xaf7c19);}const _0x3b0d19={'apiId':_0x186e02['sourceCheck']['apiId']};try{_0x186e02['on']('reviewCheckRunUpdated',(_0x5e2053,_0x59cdd5)=>{'aborted'===_0x59cdd5['status']?_0x68776c['abort']():'error-general'!==_0x59cdd5['status']&&'error-chunk'!==_0x59cdd5['status']||(_0x68776c['error']=Rn(_0x59cdd5['error'],'ai-reviewcoreediting-check-run-failed',this,_0x3b0d19));}),'aborted'!==_0x68776c['status']&&await _0x186e02['start']();}catch(_0x41a492){_0x68776c['error']=Rn(_0x41a492,'ai-reviewcoreediting-check-run-failed',this,_0x3b0d19);}finally{_0x4f774c&&_0x4f774c();}return'error'===_0x68776c['status']||'aborted'===_0x68776c['status']||(_0x68776c['addResult'](...this['_buildPerRootResults'](_0x186e02)),_0x68776c['status']='completed'),_0x68776c;}buildErrorContext(_0x3a7656){return{'apiId':_0x3a7656['sourceCheck']['apiId']};}_buildPerRootResults(_0x3132e0){const _0x327ba7=this['buildErrorContext'](_0x3132e0),_0x47589d=this['context']['plugins']['get']('AIEditing'),_0x333260=this['context']['plugins']['get']('AIGateway'),_0x5c6285=this['_groupElementsByRoot'](_0x3132e0['documentData']['elements']),_0x37d75c=new Map();for(const _0x4bf91d of Rs(this['context']))_0x37d75c['set'](_0x4bf91d['config']['get']('collaboration.channelId'),_0x4bf91d);return _0x3132e0['documentData']['roots']['map'](({channelId:_0x57c112,rootName:_0x5d6208})=>{const _0x469b11=_0x37d75c['get'](_0x57c112),_0x53f47e=new Ph({'editor':_0x469b11,'rootName':_0x5d6208,'channelId':_0x57c112,'sessionId':_0x47589d['getSessionId'](_0x469b11)}),_0x12ef30=_0x5c6285['get'](_0x53f47e['editor'])?.['get'](_0x53f47e['rootName'])??[];_0x53f47e['contentRawOld']=_0x12ef30['map'](_0x3d75ed=>_0x3d75ed['getContent']())['join'](''),_0x53f47e['documentVersion']=_0x12ef30[0x0]?.['documentVersion']??0x1;const _0x369774=this['_collectResultAffectedBlocks'](_0x53f47e,_0x3132e0['results'],_0x3132e0['documentData']['elements']);_0x53f47e['affectedBlocks']=_0x369774;try{_0x53f47e['contentRawNew']=ks(_0x333260['mergeChangesIntoContent'](_0x369774,_0x53f47e['contentRawOld'],_0x53f47e['editor']));}catch(_0x5366a9){_0x53f47e['error']=Rn(_0x5366a9,'ai-reviewcoreediting-check-run-failed',this,_0x327ba7);}return _0x53f47e;});}_collectResultAffectedBlocks(_0x3be388,_0x1a52f8,_0x225079){return _0x1a52f8['filter'](_0x2a87cb=>{const _0x167b75=_0x225079['get'](_0x2a87cb['id']);return!!_0x167b75&&_0x167b75['editor']===_0x3be388['editor']&&_0x167b75['rootName']===_0x3be388['rootName'];})['map'](_0x36a347=>({'id':_0x36a347['id'],'content':_0x36a347['contentNew']}));}_groupElementsByRoot(_0x32ead5){const _0xfe0b98=new Map();for(const _0x2dfb92 of _0x32ead5['values']()){let _0x16906b=_0xfe0b98['get'](_0x2dfb92['editor']);_0x16906b||(_0x16906b=new Map(),_0xfe0b98['set'](_0x2dfb92['editor'],_0x16906b));let _0x1f42bd=_0x16906b['get'](_0x2dfb92['rootName']);_0x1f42bd||(_0x1f42bd=[],_0x16906b['set'](_0x2dfb92['rootName'],_0x1f42bd)),_0x1f42bd['push'](_0x2dfb92);}return _0xfe0b98;}_buildDocumentDataSliceForRoot(_0x419706,_0xdece5e,_0xa513ae,_0x4f3ceb){const _0x12d8d0=_0x419706['model'],_0x123442=new _0x230b9b();for(const _0x5b27e1 of _0xdece5e['getChildren']())_0x123442['_appendChild'](_0x5b27e1['_clone'](!0x0));for(const _0x6443bd of _0x12d8d0['markers']){const _0x4f9a44=_0x6443bd['getRange']();_0x4f9a44&&_0x4f9a44['root']['rootName']===_0xdece5e['rootName']&&_0x123442['markers']['set'](_0x6443bd['name'],this['_changeRangeOwnerDocument'](_0x4f9a44['clone'](),_0x123442));}const _0x485320=new Map(),_0x4585d1=_0x12d8d0['document']['version'];if(Ks(_0x419706,_0xdece5e['rootName'])){let _0x1f2d28=this['_inlineRootDataIds']['get'](_0xdece5e);_0x1f2d28?_0x4f3ceb['add'](_0x1f2d28):(_0x1f2d28=_0xa513ae['_nextDataId'](_0x4f3ceb),this['_inlineRootDataIds']['set'](_0xdece5e,_0x1f2d28));const _0x12079a=Ws(_0x419706['data']['processor']['toData'](_0x419706['data']['toView'](_0x123442)),_0x1f2d28);return _0x485320['set'](_0x1f2d28,{'editor':_0x419706,'rootName':_0xdece5e['rootName'],'path':[],'documentVersion':_0x4585d1,'getContent':()=>_0x12079a}),{'content':_0x12079a,'elements':_0x485320};}const _0x2a0929=new _0x16c553({'ignoreElementEnd':!0x0,'startPosition':_0x12d8d0['createPositionAt'](_0x123442,0x0)});for(const {item:_0xbe9631}of _0x2a0929){if(_0xbe9631['is']('element')&&_0xbe9631['name']&&Mh['includes'](_0xbe9631['name'])){const _0x2e4459=this['_upsertDataId'](_0xbe9631,()=>_0xa513ae['_nextDataId'](_0x4f3ceb));_0x4f3ceb['add'](_0x2e4459);}if(!_0xbe9631['is']('$textProxy'))continue;const _0x1dd4b0=_0xbe9631['parent'];if(!_0x1dd4b0||!_0x1dd4b0['is']('element'))continue;const _0x1e1687=this['_upsertDataId'](_0x1dd4b0,()=>_0xa513ae['_nextDataId'](_0x4f3ceb));_0x4f3ceb['add'](_0x1e1687);for(const _0x378fdb of _0x1dd4b0['getChildren']())_0x378fdb['is']('element')&&(_0x378fdb['name']&&Hh['includes'](_0x378fdb['name'])||_0x4f3ceb['add'](this['_upsertDataId'](_0x378fdb,()=>_0xa513ae['_nextDataId'](_0x4f3ceb))));let _0x3fd4e1=_0x1dd4b0;for(;_0x3fd4e1['parent']&&!_0x3fd4e1['parent']['is']('documentFragment');)_0x3fd4e1=_0x3fd4e1['parent'],_0x3fd4e1['hasAttribute'](_0x3ebabe)&&_0x3fd4e1['_removeAttribute'](_0x3ebabe);_0x485320['set'](_0x1e1687,{'editor':_0x419706,'rootName':_0xdece5e['rootName'],'path':_0x1dd4b0['getPath'](),'documentVersion':_0x4585d1,'getContent':this['_createGetContentUsingDataIdFn'](_0x3fd4e1['_clone'](!0x0),_0x1e1687,_0x419706['data'])}),_0x2a0929['jumpTo'](_0x12d8d0['createPositionAfter'](_0x1dd4b0));}return{'content':_0x419706['data']['processor']['toData'](_0x419706['data']['toView'](_0x123442)),'elements':_0x485320};}diffContent(_0x298b58,_0x12b5b2,_0x189774,_0x2b46d8=!0x1){const {contentInitial:_0x41b8d4,contentNew:_0x3b29f8}=this['_neutralizeChangesOnUnsupportedElements'](_0x12b5b2,_0x189774),_0x41fe7f=[],_0x29c78c=_0x298b58['data']['parse'](_0x3b29f8,'$documentFragment'),_0x2ddea4=_0x298b58['data']['parse'](_0x41b8d4,'$documentFragment'),_0x23a3fb=_0x298b58['model']['createPositionAt'](_0x2ddea4,0x0);if(this['_haveSingleTopLevelElement'](_0x29c78c)){if(!this['_hasSameTopLevelElement'](_0x2ddea4,_0x29c78c))return _0x41fe7f;}else{const _0x59f8a7=_0x298b58['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x2ddea4,_0x59f8a7)||!this['_haveOnlyInlineContent'](_0x29c78c,_0x59f8a7))return _0x41fe7f;}const _0x49b42d=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x41b8d4,_0x3b29f8,{'targetEditor':_0x298b58,'anchor':_0x23a3fb,'markDeletions':!0x0})['getOperations']()['filter'](_0x46d988=>'insert'===_0x46d988['type']||'marker'===_0x46d988['type']&&_0x46d988['name']['startsWith']('$markedRemove')),_0x105611=this['_groupAdjacentOperations'](_0x49b42d),_0x569709=[];if(_0x2b46d8){if(_0x105611['length']){const _0x50368a=_0x105611[0x0]['operations'][0x0],_0x268e51='insert'===_0x50368a['type']?_0x50368a['position']:_0x50368a['newRange']['start'],_0x4dbc27=this['_getPositionLimitingRange'](_0x268e51,_0x298b58,'inside'),_0x170112=_0x4dbc27?_0x29c78c['getChild'](0x0)['getChildren']():_0x29c78c['getChildren'](),_0x1a3164=_0x4dbc27||_0x298b58['model']['createRangeIn'](_0x2ddea4),_0x10ed19=[new _0x14b1b9('$markedRemove:synthetic'+Nt(),null,_0x1a3164,_0x298b58['model']['document']['model']['markers'],!0x0,_0x298b58['model']['document']['version']+0x1),new _0x5cd7cc(_0x1a3164['end'],_0x170112,_0x298b58['model']['document']['version']+0x2)];_0x569709['push']({'operations':_0x10ed19,'operationsIsolated':_0x10ed19,'groupOffset':0x0});}}else _0x569709['push'](..._0x105611);let _0x2f5e5b=0x0;return _0x298b58['model']['change'](_0x188916=>{for(let _0x5dd118=0x0;_0x5dd118<_0x569709['length'];_0x5dd118++){const _0x3eafa1=_0x569709[_0x5dd118],_0x1b5bda=_0x188916['createDocumentFragment']();for(const _0x492f9b of _0x2ddea4['getChildren']())_0x188916['append'](_0x492f9b['_clone'](!0x0),_0x1b5bda);for(const _0x252155 of _0x3eafa1['operationsIsolated'])if('insert'===_0x252155['type']){const _0x3a0941=_0x252155;_0x3a0941['baseVersion']=null,_0x3a0941['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x3a0941,_0x1b5bda),_0x188916['batch']['addOperation'](_0x252155),_0x298b58['model']['applyOperation'](_0x252155);const _0x14c88c='suggestion:insertion:id:authorId:'+_0x2f5e5b++,_0x52f1a9=_0x298b58['model']['createRange'](_0x3a0941['position'],_0x3a0941['position']['getShiftedBy'](_0x3a0941['howMany']));_0x1b5bda['markers']['set'](_0x14c88c,_0x52f1a9);}else{if('marker'===_0x252155['type']&&_0x252155['name']['startsWith']('$markedRemove')){const _0x4e6ed8=_0x252155,_0x5034c4='suggestion:deletion:id:authorId:'+_0x2f5e5b++;this['_changeOperationOwnerDocument'](_0x4e6ed8,_0x1b5bda),_0x1b5bda['markers']['set'](_0x5034c4,_0x4e6ed8['newRange']);}}if(_0x2b46d8)_0x41fe7f['push']({..._0x3eafa1,'context':this['_createGetContentFn'](_0x2ddea4,_0x298b58['data']),'content':this['_createGetContentFn'](_0x2ddea4,_0x298b58['data'])});else{const _0x437145=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x3eafa1['operationsIsolated'][0x0]),_0x1b5bda),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x3eafa1['operationsIsolated'][_0x3eafa1['operationsIsolated']['length']-0x1]),_0x1b5bda),_0x298b58);_0x1b5bda['markers']['set'](Dh+'suggestion-context',new _0x5a312a(_0x437145['start'],_0x437145['end'])),_0x41fe7f['push']({..._0x3eafa1,'context':this['_createGetContextFn'](_0x1b5bda,_0x298b58['data'],{'ellipsisBefore':_0x437145['hasContentBefore'],'ellipsisAfter':_0x437145['hasContentAfter']}),'content':this['_createGetContentFn'](_0x1b5bda,_0x298b58['data'])});}}}),_0x41fe7f;}markChangePositionInEditorContent(_0x1dcba3,_0x4c53a4){if(!_0x1dcba3['length'])return;const _0x555534=_0x1dcba3[0x0]['parent']['id'],_0x1e9c94=_0x4c53a4['elements']['get'](_0x555534);if(!_0x1e9c94)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x555534);const _0x479577=_0x1e9c94['path'],_0x2a8b27=_0x1e9c94['editor'],_0x3b7088=_0x2a8b27['model']['document']['getRoot'](_0x1e9c94['rootName']);if(!_0x3b7088)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x1e9c94['rootName']);const _0x348e88=_0x2a8b27['model']['document']['history']['getOperations'](_0x1e9c94['documentVersion']),_0x5658f2=[];for(const _0x5167be of _0x1dcba3){const _0xc439af=_0x5167be['operationsIsolated']['map'](_0x2c6ed8=>this['_translateOperationToEditorContent'](_0x2c6ed8,_0x479577,_0x3b7088));if(!_0xc439af||!_0xc439af['length'])continue;const _0x193d6b=_0xc439af['every'](_0x11c90c=>'marker'===_0x11c90c['type']&&_0x11c90c['name']['startsWith']('$markedRemove')),_0x46d978=_0x371d73(_0xc439af,_0x348e88,{'document':_0x2a8b27['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x354811 of _0x46d978)if('insert'===_0x354811['type']){const _0x37ceb2=_0x354811,_0x94e722=_0x37ceb2['nodes'];_0x2a8b27['model']['change'](_0x6dd024=>{const _0x5265aa=_0x6dd024['createDocumentFragment']();for(const _0x4fcc52 of _0x94e722)_0x6dd024['append'](_0x4fcc52['_clone'](!0x0),_0x5265aa);_0x5658f2['push']({'start':_0x37ceb2['position'],'end':_0x37ceb2['position'],'type':'insert','groupId':_0x5167be['id'],'content':{'asString':this['_createGetContentFn'](_0x5265aa,_0x2a8b27['data'])(),'asFragment':_0x5265aa}});});}else{if('marker'===_0x354811['type']&&_0x354811['name']['startsWith']('$markedRemove')){const _0x3e6d1a=_0x354811;let _0x563f84='remove-text';if(_0x193d6b){const _0x1887a9=this['_findAdjacentContextDistance'](_0x3e6d1a['newRange']['start'],'backward',_0x2a8b27['model']['schema']),_0x55c63b=this['_findAdjacentContextDistance'](_0x3e6d1a['newRange']['end'],'forward',_0x2a8b27['model']['schema']);if(_0x1887a9||_0x55c63b){const _0x3075cd=_0x3e6d1a['newRange']['start']['getShiftedBy'](-_0x1887a9),_0x3764ed=_0x3e6d1a['newRange']['end']['getShiftedBy'](_0x55c63b);_0x5658f2['push']({'start':_0x3075cd,'end':_0x3764ed,'groupId':_0x5167be['id'],'type':'remove-context'});}else _0x563f84='remove-only';}_0x5658f2['push']({'start':_0x3e6d1a['newRange']['start'],'end':_0x3e6d1a['newRange']['end'],'groupId':_0x5167be['id'],'type':_0x563f84});}}}this['_insertMarkers'](_0x5658f2,_0x2a8b27);}['clearAllMarkers'](){const _0x4a970b=new Map();for(const _0x1047c5 of this['_markers']['keys']()){const _0x79e0c1=this['_markers']['get'](_0x1047c5);_0x79e0c1?.['editor']&&(_0x4a970b['has'](_0x79e0c1['editor'])||_0x4a970b['set'](_0x79e0c1['editor'],[]),_0x4a970b['get'](_0x79e0c1['editor'])['push'](_0x1047c5));}for(const [_0x57c138,_0x3a61f5]of _0x4a970b)_0x57c138['model']['change'](_0x920951=>{for(const _0x60126c of _0x3a61f5)_0x57c138['model']['markers']['get'](_0x60126c)&&_0x920951['removeMarker'](_0x60126c);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x415c74 of this['getEditors']())_0x415c74['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x2edb17 of this['getEditors']())_0x2edb17['disableReadOnlyMode']('ai-review');}['applyChange'](_0x468b8b,_0xae5eef=null){const _0x4b2f86=_0x468b8b['map'](_0x359baf=>this['_getMarkersDataForGroup'](_0x359baf))['flat'](),_0x5af894=new Map();for(const _0x3a2d62 of _0x4b2f86)_0x5af894['has'](_0x3a2d62['editor'])||_0x5af894['set'](_0x3a2d62['editor'],[]),_0x5af894['get'](_0x3a2d62['editor'])['push'](_0x3a2d62);for(const [_0x7dd168,_0x1f09e5]of _0x5af894){const _0x1cbde8=_0x7dd168['model'],_0xd3f4d9=_0x7dd168['plugins']['has']('TrackChangesEditing')?_0x7dd168['plugins']['get']('TrackChangesEditing'):null,_0x1be2a3=_0xae5eef&&_0xd3f4d9?new Set(_0xd3f4d9['getSuggestions']()['map'](_0x1c1f28=>_0x1c1f28['id'])):null;_0x1cbde8['change'](_0x4da8bc=>{const _0x33f85e=_0x4da8bc['batch']['operations']['length'];for(const _0x38117a of _0x1f09e5){const _0x12fb9f=_0x7dd168['model']['markers']['get'](_0x38117a['id']);if(_0x12fb9f){if('insert'===_0x38117a['type']){if(!_0x38117a['content'])continue;_0x1cbde8['insertContent'](_0x38117a['content']['asFragment']||null,_0x12fb9f['getRange']()['start']);}else'remove-text'!==_0x38117a['type']&&'remove-only'!==_0x38117a['type']||_0x1cbde8['deleteContent'](_0x1cbde8['createSelection'](_0x12fb9f['getRange']()));_0x4da8bc['removeMarker'](_0x38117a['id']),this['_markers']['delete'](_0x38117a['id']);}}if(_0xae5eef&&(wn(_0x4da8bc['batch']['operations']['slice'](_0x33f85e),_0xae5eef),_0xd3f4d9)){for(const _0x3cecfa of _0xd3f4d9['getSuggestions']())_0x1be2a3['has'](_0x3cecfa['id'])||_0x3cecfa['setAttribute']('@ai',{'type':_0xae5eef});}});}}rejectChange(_0x1f9c0f){const _0x52914b=this['_getMarkersDataForGroup'](_0x1f9c0f),_0x107b10=new Map();for(const _0x3d84e1 of _0x52914b)_0x107b10['has'](_0x3d84e1['editor'])||_0x107b10['set'](_0x3d84e1['editor'],[]),_0x107b10['get'](_0x3d84e1['editor'])['push'](_0x3d84e1);for(const [_0x1d7101,_0x4489c6]of _0x107b10)_0x1d7101['model']['change'](_0x6d6a43=>{for(const _0x9d2ed1 of _0x4489c6)_0x6d6a43['removeMarker'](_0x9d2ed1['id']),this['_markers']['delete'](_0x9d2ed1['id']);});}getEditor(){return Os(this['context']);}getEditors(){return Rs(this['context']);}getEditorForChange(_0x2b18e9){return this['_getMarkersDataForGroup'](_0x2b18e9)[0x0]?.['editor'];}getMarkerElementForChange(_0x2e504c){const _0xb2ec52=Array['from'](this['_markers']['values']())['filter'](_0x238991=>_0x238991['groupId']===_0x2e504c);if(!_0xb2ec52['length'])return null;const _0x2cbc68=0x1===_0xb2ec52['length']?_0xb2ec52[0x0]:this['_sortMarkers'](_0xb2ec52)[0x0],_0xe980d7=_0x2cbc68['editor']['model']['markers']['get'](_0x2cbc68['id']);return _0xe980d7?{'modelRange':_0xe980d7['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x2cbc68['id'])}:null;}getContentElementForChange(_0x5886d7){const _0x4f630c=Array['from'](this['_markers']['values']())['filter'](_0xd5071=>_0xd5071['groupId']===_0x5886d7);if(!_0x4f630c['length'])return null;const _0x59fb3f=0x1===_0x4f630c['length']?_0x4f630c[0x0]:this['_sortMarkers'](_0x4f630c)[0x0],_0x36c31c=_0x59fb3f['editor'],_0x5761b2=_0x36c31c['model']['markers']['get'](_0x59fb3f['id']);if(!_0x5761b2)return null;const _0x5473c5=_0x5761b2['getRange'](),_0x69fa1a=_0x36c31c['editing']['view']['getDomRoot'](_0x5473c5['root']['rootName'])||_0x36c31c['editing']['view']['getDomRoot']();if(!_0x69fa1a||!_0x5473c5)return null;let _0x34ad2e=_0x5473c5['start']['parent'];for(;_0x34ad2e['parent']&&!_0x34ad2e['parent']['is']('rootElement');)_0x34ad2e=_0x34ad2e['parent'];if(!_0x34ad2e||!_0x34ad2e['name'])return null;const _0x42739e=_0x69fa1a['querySelector']('[data-marker-id=\x22'+_0x59fb3f['id']+'\x22]');if(!_0x42739e)return null;if(_0x34ad2e['is']('rootElement'))return _0x42739e;let _0xa6e226=null;_0x36c31c['model']['change'](_0x103d90=>{_0xa6e226=_0x103d90['createDocumentFragment'](),_0x103d90['append'](_0x34ad2e['_clone'](!0x0),_0xa6e226);});const _0x554794=_0x36c31c['data']['toView'](_0xa6e226)['getChild'](0x0);return _0x42739e['closest'](_0x554794['name']);}reactivateMarkers(_0x9dae18){const _0x7474c5=this['_getMarkersDataForGroup'](_0x9dae18);if(!_0x7474c5['length'])return;const _0x3cb66f=Array['from'](this['_activeMarkers'])['sort'](),_0x463da0=Array['from'](new Set(_0x7474c5['map'](_0x10a807=>_0x10a807['id'])))['sort']();_0x3cb66f['join']('|')!==_0x463da0['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x9dae18));}setMarkersInElementAsActive(_0x4be325){const _0x422a82=this['_getMarkersDataForGroup'](_0x4be325);if(!_0x422a82['length'])return;const _0xb04521=_0x422a82[0x0]['editor'],_0x48c979=new Set(_0x422a82['map'](_0x4c2375=>_0x4c2375['id'])),_0xa73320=Array['from'](_0x48c979['values']())['map'](_0x75296=>_0xb04521['model']['markers']['get'](_0x75296))['filter'](_0x474fef=>!!_0x474fef);_0x48c979['forEach'](_0x2a7d2e=>{this['_activeMarkers']['add'](_0x2a7d2e);}),_0xb04521['model']['change'](()=>{_0xa73320['forEach'](_0x5e9dd7=>{_0xb04521['editing']['reconvertMarker'](_0x5e9dd7);});});}setAllMarkersAsInactive(){const _0xcb9ef3=Array['from'](this['_activeMarkers']);if(!_0xcb9ef3['length'])return;this['_activeMarkers']['clear']();const _0x356981=new Map();for(const _0x283591 of _0xcb9ef3){const _0x561fdb=this['_markers']['get'](_0x283591);if(!_0x561fdb)continue;const _0x26a7c8=_0x561fdb['editor'],_0xc8372e=_0x26a7c8['model']['markers']['get'](_0x283591);_0xc8372e&&(_0x356981['has'](_0x26a7c8)||_0x356981['set'](_0x26a7c8,[]),_0x356981['get'](_0x26a7c8)['push'](_0xc8372e));}for(const [_0x4266ae,_0x5e965a]of _0x356981)_0x4266ae['model']['change'](()=>{_0x5e965a['forEach'](_0x315fde=>{_0x4266ae['editing']['reconvertMarker'](_0x315fde);});});}_getPositionLimitingRange(_0x24be3f,_0x56b17a,_0x7cccf3='outside'){if(!_0x24be3f)return null;let _0x29160e=_0x24be3f['parent'];for(;_0x29160e&&_0x29160e['parent']&&!_0x29160e['parent']['is']('rootElement')&&!_0x56b17a['model']['schema']['isLimit'](_0x29160e)&&!_0x56b17a['model']['schema']['isBlock'](_0x29160e);)_0x29160e=_0x29160e['parent'];if(!_0x29160e||!_0x29160e['name']||_0x29160e['is']('rootElement'))return null;let _0x43bfa3=null;return _0x56b17a['model']['change'](_0x597b78=>{_0x43bfa3='inside'===_0x7cccf3?_0x597b78['createRangeIn'](_0x29160e):_0x597b78['createRangeOn'](_0x29160e);}),_0x43bfa3;}_validateMarkers(_0x53bbad,_0x2a7ca2){const _0x450da7=Array['from'](this['_markers']['keys']()),_0xaa65c3=new Map();for(const _0x1fa3a1 of _0x450da7){const _0x444f82=_0x53bbad['model']['markers']['get'](_0x1fa3a1);if(!_0x444f82)continue;const _0x11943e=_0x444f82['getStart']()['root']['rootName']+':'+_0x444f82['getStart']()['path'][0x0];_0xaa65c3['has'](_0x11943e)||_0xaa65c3['set'](_0x11943e,[]),_0xaa65c3['get'](_0x11943e)['push'](_0x444f82);}const _0x587fb2=new Set();for(const _0x300cd8 of _0x53bbad['model']['document']['differ']['getChanges']()){let _0x372e56,_0x2a4cfb;if('insert'===_0x300cd8['type'])_0x2a4cfb=new _0x5a312a(_0x300cd8['position'],_0x300cd8['position']['getShiftedBy'](_0x300cd8['length'])),_0x372e56=_0x300cd8['position']['root']['rootName']+':'+_0x300cd8['position']['path'][0x0];else{if('remove'!==_0x300cd8['type'])continue;_0x2a4cfb=new _0x5a312a(_0x300cd8['position']),_0x372e56=_0x300cd8['position']['root']['rootName']+':'+_0x300cd8['position']['path'][0x0];}const _0x2d063c=_0xaa65c3['get'](_0x372e56)||[];if(_0x2d063c['length']){for(const _0x3e158f of _0x2d063c)if(_0x2a4cfb['root']['rootName']===_0x3e158f['getRange']()['root']['rootName']&&('insert'!==_0x300cd8['type']||!_0x2a4cfb['containsRange'](_0x3e158f['getRange']()))&&(_0x2a4cfb['isIntersecting'](_0x3e158f['getRange']())||_0x2a4cfb['start']['isTouching'](_0x3e158f['getRange']()['end'])||_0x2a4cfb['end']['isTouching'](_0x3e158f['getRange']()['start']))){const _0x9ba817=this['_parseMarkerName'](_0x3e158f['name']);Array['from'](this['_markers']['values']())['filter'](_0x2dba54=>_0x2dba54['groupId']===_0x9ba817['groupId'])['forEach'](_0x317c13=>_0x587fb2['add'](_0x317c13['id']));}}}if(_0x587fb2['size']){for(const _0x330379 of _0x587fb2)_0x2a7ca2['removeMarker'](_0x330379);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x508b4c){for(const {name:_0x2add4d,data:_0x46899e}of _0x508b4c['model']['document']['differ']['getChangedMarkers']()){if(!_0x2add4d['startsWith'](Dh))continue;const _0x25f668=_0x46899e['oldRange'],_0x4169f8=_0x46899e['newRange'],_0x385249=_0x25f668&&'$graveyard'===_0x25f668['root']['rootName'],_0x337da1=_0x4169f8&&'$graveyard'===_0x4169f8['root']['rootName'];if(_0x385249&&_0x337da1)continue;const _0x377389=this['_parseMarkerName'](_0x2add4d);this['_markers']['get'](_0x2add4d)&&(_0x337da1||!_0x4169f8?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x2add4d,'changeId':_0x377389['groupId']}):_0x385249&&_0x4169f8&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x2add4d,'changeId':_0x377389['groupId']}));}}['_parseMarkerName'](_0x47d6c9){const _0x5d198f=_0x47d6c9['split'](':'),_0xdcea24=(_0x5d198f[0x1]||'')['split']('_');return{'prefix':_0x5d198f[0x0],'groupId':_0xdcea24[0x0],'suffix':_0xdcea24[0x1]};}_translateOperationToEditorContent(_0x2ef9af,_0x1a0e9f,_0xcae05c){if('insert'===_0x2ef9af['type']){const _0x11832f=_0x2ef9af;return new _0x5cd7cc(this['_changePosition'](_0x1a0e9f['concat'](_0x11832f['position']['offset']),_0xcae05c),_0x11832f['nodes'],_0x11832f['baseVersion']);}if('marker'===_0x2ef9af['type']&&_0x2ef9af['name']['startsWith']('$markedRemove')){const _0x1bf5cb=_0x2ef9af;return new _0x14b1b9(_0x1bf5cb['name'],_0x1bf5cb['oldRange'],this['_changeRange'](_0x1bf5cb['newRange'],_0x1a0e9f['concat'](_0x1bf5cb['newRange']['start']['offset']),_0x1a0e9f['concat'](_0x1bf5cb['newRange']['end']['offset']),_0xcae05c),_0x1bf5cb['_markers'],_0x1bf5cb['affectsData'],_0x1bf5cb['baseVersion']);}return _0x2ef9af;}_groupAdjacentOperations(_0x9f7cd6){if(!_0x9f7cd6['length'])return[];const _0x474758=[];let _0x47f6ef=0x0,_0x110a72=0x0,_0xe9d718=[];for(let _0x485eae=0x0;_0x485eae<=_0x9f7cd6['length'];_0x485eae++){const _0x4b0120=_0x9f7cd6[_0x485eae],_0x4b682e=_0x9f7cd6[_0x485eae-0x1];!_0x4b0120||_0x4b682e&&!this['_getOperationEnd'](_0x4b682e)['isTouching'](this['_getOperationStart'](_0x4b0120))?(_0x474758['push']({'operations':_0xe9d718,'operationsIsolated':_0xe9d718['map'](_0xcf9eb9=>this['_shiftOperation'](_0xcf9eb9['clone'](),-_0x110a72)),'groupOffset':_0x47f6ef}),_0xe9d718=_0x4b0120?[_0x4b0120]:[],_0x110a72+=_0x47f6ef,_0x47f6ef=0x0):_0xe9d718['push'](_0x4b0120),_0x4b0120&&'insert'===_0x4b0120['type']&&(_0x47f6ef+=_0x4b0120['howMany']);}return _0x474758;}_findAdjacentContextDistance(_0x5976af,_0x3d2217,_0x220026,_0x5e4117=0x1){const _0x2733aa=new _0x16c553({'startPosition':_0x5976af,'direction':_0x3d2217});let _0x9e90fd=0x0;for(let _0x44b110=0x0;_0x44b110<_0x5e4117;_0x44b110++){let _0x1fae6f=0x0,_0x3b733b=!0x1,_0x4cbaf3='forward'===_0x3d2217?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x595b35}of _0x2733aa)if(_0x595b35['is']('$textProxy')){const _0x5ba69e=_0x4cbaf3['exec'](_0x595b35['data']);if(_0x5ba69e&&_0x5ba69e['length']){if(_0x1fae6f+='forward'===_0x3d2217?_0x5ba69e['index']+_0x5ba69e[0x0]['length']:_0x595b35['data']['length']-_0x5ba69e['index'],_0x5ba69e[0x0]['length']!==_0x595b35['data']['length'])break;_0x3b733b=!0x0,_0x4cbaf3='forward'===_0x3d2217?/^\w+/:/\w+$/;}else{if(_0x3b733b)break;_0x1fae6f+=_0x595b35['offsetSize'];}}else{if(_0x595b35['is']('element')){_0x220026['isInline'](_0x595b35)&&!_0x3b733b&&(_0x1fae6f+=0x1);break;}}_0x9e90fd+=_0x1fae6f,_0x2733aa['jumpTo'](_0x5976af['getShiftedBy']('forward'===_0x3d2217?_0x9e90fd:-_0x9e90fd));}return _0x9e90fd;}_getChangeContext(_0x33c074,_0x415739,_0x325040){const _0x330b57=_0x325040['model']['schema'],_0x5db292=this['_findAdjacentContextDistance'](_0x33c074,'backward',_0x330b57,0x6),_0x3a6269=this['_findAdjacentContextDistance'](_0x415739,'forward',_0x330b57,0x6),_0x554e75=_0x33c074['getShiftedBy'](-_0x5db292),_0x215239=_0x415739['getShiftedBy'](_0x3a6269);return{'start':_0x554e75,'end':_0x215239,'hasContentBefore':!_0x554e75['isAtStart'],'hasContentAfter':!_0x215239['isAtEnd']};}_insertMarkers(_0x1b73ca,_0x13a9a4){const _0x3a63f3=this['context']['plugins']['get']('AIEditing'),_0x135f8f=new Set();_0x13a9a4['model']['change'](_0x52e5d6=>{for(const _0xee9f5b of _0x1b73ca){const _0x3834a0=''+Dh+_0xee9f5b['type']+':'+_0xee9f5b['groupId']+'_'+_0x3a63f3['_nextDataId'](_0x135f8f);this['_markers']['set'](_0x3834a0,{'id':_0x3834a0,'groupId':_0xee9f5b['groupId'],'type':_0xee9f5b['type'],'content':_0xee9f5b['content'],'editor':_0x13a9a4}),_0x52e5d6['addMarker'](_0x3834a0,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x52e5d6['createRange'](_0xee9f5b['start'],_0xee9f5b['end'])});}});}_createGetContextFn(_0x5777b6,_0x26de4,_0x1a7b18){let _0x2652d9='';return()=>{if(!_0x2652d9){const _0x1ba255=_0x26de4['toView'](_0x5777b6,{'showSuggestionHighlights':!0x0});let _0x56af8a=_0x1ba255['getChild'](0x0);if(_0x56af8a['is']('containerElement')||(_0x56af8a=_0x1ba255),!_0x56af8a)return'';let _0x1e9ff2=!0x1;const _0x2e0f5f=[];for(const _0x3a6507 of _0x56af8a['getChildren']())_0x3a6507['is']('element','span')&&_0x3a6507['hasClass']('ck-ai_review-marker_context-end')&&(_0x1e9ff2=!0x1),_0x1e9ff2&&_0x2e0f5f['push'](_0x3a6507),_0x3a6507['is']('element','span')&&_0x3a6507['hasClass']('ck-ai_review-marker_context-start')&&(_0x1e9ff2=!0x0);_0x56af8a['_removeChildren'](0x0,_0x56af8a['childCount']),_0x1a7b18?.['ellipsisBefore']&&_0x56af8a['_appendChild']('…'),_0x56af8a['_appendChild'](_0x2e0f5f),_0x1a7b18?.['ellipsisAfter']&&_0x56af8a['_appendChild']('…');const _0x57301c=_0x26de4['htmlProcessor']['domConverter']['viewToDom'](_0x1ba255),_0x404e81=_0x26de4['htmlProcessor']['htmlWriter']['getHtml'](_0x57301c);_0x2652d9=this['_removeUnsupportedElements'](_0x404e81);}return _0x2652d9;};}_createGetContentFn(_0x13c311,_0x446317){let _0x3c8c33='';return()=>(_0x3c8c33||(_0x3c8c33=this['_removeUnsupportedElements'](_0x446317['stringify'](_0x13c311,{'showSuggestionHighlights':!0x0}))),_0x3c8c33);}_createGetContentUsingDataIdFn(_0x1049f3,_0x34f720,_0x87a374){let _0x569b50='';return()=>{if(!_0x569b50){const _0x5bca33=_0x87a374['toView'](new _0x230b9b(_0x1049f3));_0x569b50=_0x87a374['htmlProcessor']['domConverter']['viewToDom'](_0x5bca33)['querySelector']('[data-id=\x22'+_0x34f720+'\x22]')?.['outerHTML']||'';}return _0x569b50;};}_removeUnsupportedElements(_0x1592de){if(!_0x1592de)return'';const _0x1d30bf=vs(_0x1592de,{'decodeEntities':!0x1}),_0x532142=xs(_0x1d30bf);if(!_0x532142['length'])return _0x1592de;for(const _0x33ed8 of _0x532142)_0x539e1a(_0x33ed8);return ks(_0x1d30bf,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x30340c,_0x287ca5){const _0x403bac=vs(_0x30340c,{'decodeEntities':!0x1}),_0x3103c0=vs(_0x287ca5,{'decodeEntities':!0x1}),_0x5248d5=xs(_0x403bac),_0x8da839=xs(_0x3103c0);if(!_0x5248d5['length']&&!_0x8da839['length'])return{'contentInitial':_0x30340c,'contentNew':_0x287ca5};const _0xd383fe=new Map(),_0x4f128c=new Map();for(const _0x52f0b6 of _0x5248d5){const _0xf9120d=Hs(_0x52f0b6,'data-id');if(_0xf9120d)_0xd383fe['set'](_0xf9120d,_0x52f0b6);else{const _0x171f16=ks(_0x52f0b6,{'encodeEntities':!0x1}),_0x28886f=_0x4f128c['get'](_0x171f16);_0x28886f?_0x28886f['push'](_0x52f0b6):_0x4f128c['set'](_0x171f16,[_0x52f0b6]);}}for(const _0x18402c of _0x8da839){const _0x1a4fef=Hs(_0x18402c,'data-id');let _0x4f8560;if(_0x1a4fef)_0x4f8560=_0xd383fe['get'](_0x1a4fef);else{const _0x255d5f=_0x4f128c['get'](ks(_0x18402c,{'encodeEntities':!0x1}));_0x4f8560=_0x255d5f&&_0x255d5f['length']?_0x255d5f['shift']():void 0x0;}_0x4f8560?_0x3fd27e(_0x18402c,_0x355d5c(_0x4f8560,!0x0)):_0x539e1a(_0x18402c);}return{'contentInitial':ks(_0x403bac,{'encodeEntities':!0x1}),'contentNew':ks(_0x3103c0,{'encodeEntities':!0x1})};}_findMarkerElement(_0x20f4a9,_0x210701=0x5){let _0x3deb83=_0x20f4a9,_0x365d4f=null;for(let _0x38e46a=0x0;_0x38e46a<_0x210701&&_0x3deb83;_0x38e46a++)if(_0x3deb83['className']){if((''+_0x3deb83['className'])['includes']('ck-ai_review-marker_')){if(!_0x3deb83['getAttribute']('data-marker-id'))break;_0x365d4f=_0x3deb83;break;}_0x3deb83=_0x3deb83['parentElement'];}else _0x3deb83=_0x3deb83['parentElement'];return _0x365d4f;}_findMarkerElementById(_0x50c0ce){const _0xcc84a1=this['_markers']['get'](_0x50c0ce);if(!_0xcc84a1)return null;const _0x22437c=_0xcc84a1['editor']['model']['markers']['get'](_0x50c0ce);return _0x22437c?_0x18ff2b(_0xcc84a1['editor']['editing'],_0x22437c):null;}_getMarkersDataForGroup(_0x262710){return Array['from'](this['_markers']['values']())['filter'](_0x2bd613=>_0x2bd613['groupId']===_0x262710);}_getOperationStart(_0xdcc8ea){return'insert'===_0xdcc8ea['type']?_0xdcc8ea['position']:_0xdcc8ea['newRange']['start'];}_getOperationEnd(_0x224dea,_0x2e49ee=!0x1){return'insert'===_0x224dea['type']?_0x2e49ee?_0x224dea['position']:_0x224dea['position']['getShiftedBy'](_0x224dea['howMany']):_0x224dea['newRange']['end'];}_shiftOperation(_0x3a339d,_0x54e894){return'insert'===_0x3a339d['type']?_0x3a339d['position']=_0x3a339d['position']['getShiftedBy'](_0x54e894):'marker'===_0x3a339d['type']&&_0x3a339d['newRange']&&(_0x3a339d['newRange']=new _0x5a312a(_0x3a339d['newRange']['start']['getShiftedBy'](_0x54e894),_0x3a339d['newRange']['end']['getShiftedBy'](_0x54e894))),_0x3a339d;}_changeOperationOwnerDocument(_0x3f242a,_0x48fbd1){'insert'===_0x3f242a['type']?_0x3f242a['position']=this['_changePositionOwnerDocument'](_0x3f242a['position'],_0x48fbd1):'marker'===_0x3f242a['type']&&_0x3f242a['newRange']&&(_0x3f242a['newRange']=this['_changeRangeOwnerDocument'](_0x3f242a['newRange'],_0x48fbd1));}_changePositionOwnerDocument(_0x330669,_0x765a2a){return new _0x273953(_0x765a2a,_0x330669['path']);}_changeRangeOwnerDocument(_0x47c7dc,_0x433ced){return new _0x5a312a(this['_changePositionOwnerDocument'](_0x47c7dc['start'],_0x433ced),this['_changePositionOwnerDocument'](_0x47c7dc['end'],_0x433ced));}_changePosition(_0x1b7ba8,_0x2001ac){return new _0x273953(_0x2001ac,[..._0x1b7ba8]);}['_changeRange'](_0x24cc5e,_0x551af6,_0x24c888,_0x2c756a){return new _0x5a312a(this['_changePosition'](_0x551af6,_0x2c756a),this['_changePosition'](_0x24c888,_0x2c756a));}_sortMarkers(_0x141ec2){const _0x50e4a8=_0x224283=>{switch(_0x224283){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x141ec2['sort']((_0x3f8902,_0x2ea9cc)=>_0x50e4a8(_0x3f8902['type'])-_0x50e4a8(_0x2ea9cc['type']));}_hasSameTopLevelElement(_0x2d092e,_0x3a91b0){const _0x20c2ac=_0x2d092e['getChild'](0x0),_0x51dfb9=_0x3a91b0['getChild'](0x0);return!(!_0x20c2ac||!_0x51dfb9)&&((!_0x20c2ac['is']('element')||!_0x51dfb9['is']('element')||_0x20c2ac['name']===_0x51dfb9['name'])&&!(_0x20c2ac['is']('element')&&!_0x51dfb9['is']('element')||!_0x20c2ac['is']('element')&&_0x51dfb9['is']('element')));}_haveSingleTopLevelElement(_0x2f9e82){return 0x1===_0x2f9e82['childCount'];}_haveOnlyInlineContent(_0x4279c9,_0x50a000){for(const _0x41ff6f of _0x4279c9['getChildren']())if(_0x41ff6f['is']('element')&&!_0x50a000['isInline'](_0x41ff6f))return!0x1;return!0x0;}_upsertDataId(_0xf93aa6,_0x3e1c8b){let _0x46c65f=_0xf93aa6['getAttribute'](_0x3ebabe);return _0x46c65f||(_0x46c65f=_0x3e1c8b(),_0xf93aa6['_setAttribute'](_0x3ebabe,_0x46c65f)),_0x46c65f;}};const Vh=/* #__PURE__ -- @preserve */
|
|
38
|
+
dt();var Bh=class extends Vh{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x551e62,contentNew:_0x493ec8,contentInitial:_0x5baaa6,documentVersion:_0x328d19}){super(),this['id']=_0x551e62,this['contentNew']=_0x493ec8,this['contentInitial']=_0x5baaa6,this['documentVersion']=_0x328d19;}};const Gh=/* #__PURE__ -- @preserve */
|
|
39
|
+
At();var Fh=class extends Gh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x2ab972,_0x2612dd,_0x9608a3,_0x3366cd){super(),this['id']=_0x2ab972,this['parent']=_0x9608a3,this['editor']=_0x3366cd,this['_data']=_0x2612dd,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']['wrapperTag']?function(_0x131bed){const _0x2c7d54=vs(_0x131bed)['children']['filter'](_0x5431e6);return 0x1!==_0x2c7d54['length']?_0x131bed:_0x2c7d54[0x0]['children']['map'](_0x2f59bd=>ks(_0x2f59bd))['join']('');}(this['_data']['context']()):this['_data']['context']();}get['wrapperTag'](){return this['_data']['wrapperTag'];}get operations(){return this['_data']['operations']['slice']();}get operationsIsolated(){return this['_data']['operationsIsolated']['slice']();}};const Kh=/* #__PURE__ -- @preserve */
|
|
40
|
+
At();var Wh=class extends Kh{['id']=Nt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0xcf6743,_0x27808e,_0x4ade15,_0x1c8931,_0x39037f,_0x2f9f31){super(),this['_sourceCheck']=_0x27808e,this['_documentData']=_0xcf6743,this['_aiConnector']=_0x4ade15,this['_reviewParams']=_0x1c8931,this['_reviewArgs']=_0x39037f,this['_contexts']=_0x2f9f31,this['on']('change:status',(_0x3a59e2,_0x372e3b,_0x3cc335)=>{'aborted'==_0x3cc335&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x3cc335,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x1841a9=>'pending'===_0x1841a9['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x48f18a){this['_documentData']=_0x48f18a;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x4641b2=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x9a447f of _0x4641b2)'unmodified'!==_0x9a447f['data']['operation']&&('error'!==_0x9a447f['data']['operation']?'review-metadata'!==_0x9a447f['event']?this['_addReviewCheckResult'](_0x9a447f['data']['dataId'],_0x9a447f['data']['textDelta']):this['callId']=_0x9a447f['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(_0x450055){this['_currentError']=_0x450055,Nn(_0x450055)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x1b0a42,_0x5d61aa){const _0x55396a=this['_results']['get'](_0x1b0a42);if(!_0x55396a)return;if(0x0===_0x5d61aa['length'])return;const _0x3600e9=this['_documentData']['elements']['get'](_0x1b0a42);if(!_0x3600e9)return;const _0x12fad9=[];_0x5d61aa['forEach']((_0x439549,_0xc6fc4b)=>{const _0x46bb17=new Fh(_0x55396a['id']+'-'+_0xc6fc4b,_0x439549,_0x55396a,_0x3600e9['editor']);_0x46bb17['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x46bb17,'status':_0x46bb17['status']});}),_0x46bb17['on']('change:isActivated',()=>{_0x46bb17['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x46bb17}):this['fire']('reviewCheckResultDeactivated',{'change':_0x46bb17});}),this['_changes']['push'](_0x46bb17),_0x12fad9['push'](_0x46bb17);}),this['fire']('reviewCheckResultReady',{'changes':_0x12fad9,'result':_0x55396a,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x560e48){const _0x5635fc=this['_changes']['find'](_0x8170da=>_0x8170da['id']===_0x560e48);return!(!_0x5635fc||'pending'!==_0x5635fc['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x5408c0=>!0x0===_0x5408c0['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x509df0=>'pending'===_0x509df0['status']);}getChangeById(_0x3a7c41){return this['_changes']['find'](_0x5aae24=>_0x5aae24['id']===_0x3a7c41);}markAllChangesAsAccepted(){for(const _0x3317b0 of this['_changes'])'pending'===_0x3317b0['status']&&(_0x3317b0['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x201c98){const _0x52c6fb=this['_changes']['find'](_0x2b9ca8=>_0x2b9ca8['id']===_0x201c98);_0x52c6fb&&'pending'===_0x52c6fb['status']&&(_0x52c6fb['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x211b30){const _0x3b21a9=this['_changes']['find'](_0x6faa13=>_0x6faa13['id']===_0x211b30);_0x3b21a9&&'pending'===_0x3b21a9['status']&&(_0x3b21a9['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x2040de){const _0x274561=this['_changes']['find'](_0x5d634a=>_0x5d634a['id']===_0x2040de);_0x274561&&'pending'===_0x274561['status']&&(_0x274561['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x1bc0f9){const _0x51db72=this['_changes']['find'](_0x2e63fe=>_0x2e63fe['id']===_0x1bc0f9);_0x51db72&&'outdated'===_0x51db72['status']&&(_0x51db72['status']='pending'),this['_checkIfFinished']();}activateChange(_0x9a8254){this['_changes']['filter'](_0x2176ca=>_0x2176ca['isActivated']&&_0x2176ca['id']!==_0x9a8254)['forEach'](_0x2bea01=>{_0x2bea01['isActivated']=!0x1;});const _0x29822c=this['_changes']['find'](_0x38b927=>_0x38b927['id']===_0x9a8254);_0x29822c&&'pending'===_0x29822c['status']&&(_0x29822c['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x426bd0=>_0x426bd0['isActivated'])['forEach'](_0x56bad4=>{_0x56bad4['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x428762){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x2cde5d;if(_0x428762){const _0x1e4be0=this['_changes']['find'](_0x5ede26=>_0x5ede26['id']===_0x428762);if(_0x1e4be0&&_0x1e4be0['isRated'])return;_0x1e4be0&&(_0x2cde5d=_0x1e4be0['parent']['id'],_0x1e4be0['isRated']=!0x0);}const _0x4de4ef={'positiveCount':this['_changes']['filter'](_0x5eb651=>'accepted'===_0x5eb651['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x4de4ef,this['callId'],_0x2cde5d);}_addReviewCheckResult(_0x58cfa0,_0x995c01){const _0x43bf80=this['_documentData']['elements']['get'](_0x58cfa0);if(!_0x43bf80)return;if(Ks(_0x43bf80['editor'],_0x43bf80['rootName'])&&!qs(_0x43bf80['editor'],vs(_0x995c01)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x57a529=_0x43bf80['getContent']();if(_0x57a529===_0x995c01)return;const _0x2ddad9=new Bh({'id':_0x58cfa0,'contentInitial':_0x57a529,'contentNew':_0x995c01,'documentVersion':_0x43bf80['documentVersion']});this['_results']['set'](_0x2ddad9['id'],_0x2ddad9),this['fire']('reviewCheckResultAdded',{'result':_0x2ddad9,'source':this,'editor':_0x43bf80['editor'],'rootName':_0x43bf80['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x9b138f=>'pending'===_0x9b138f['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x161ea3=>'pending'===_0x161ea3['status'])['length']&&(this['status']='finished');}},Yh=class extends Wh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x4a2d0d=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x385fa8=0x0;_0x385fa8<this['_reviewParams']['length'];_0x385fa8++){if(!this['_reviewParams'][_0x385fa8]||!this['_sourceCheck']['options'][_0x385fa8])continue;const _0x37b2fe=this['_sourceCheck']['options'][_0x385fa8]['data']?.['find'](_0x5018d2=>_0x5018d2['id']===this['_reviewParams'][_0x385fa8]);_0x37b2fe&&_0x4a2d0d['push'](_0x37b2fe['label']);}return _0x4a2d0d['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x418684,_0x1b5898,_0x418aba){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x1b5898,_0x418684,_0x418aba);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},$h=class extends _0x22445f{_aiConnector;['_aiReviewCoreUi'];_aiReviewCoreEditing;['_availableReviewChecks'];_reporter;_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',(_0x890b7f,_0x11a91e)=>this['runCheck'](_0x11a91e)),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 _0xc01ba2=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0xc01ba2['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0xc01ba2['map'](_0x3a52e4=>_0x3a52e4['id']),this['_aiSource']);const _0x153d07=this['_currentReviewCheckRun'];_0x153d07['markAllChangesAsAccepted'](),_0x153d07['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x10ace0,_0x5b2c32)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5b2c32['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x5b2c32['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x5b2c32['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5b2c32['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x5854a2,_0x5d190c)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5d190c['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5d190c['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5d190c['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5d190c['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x556a0b,_0x2e3767)=>{this['_onActivateChange'](_0x2e3767);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x4cfdd9,_0x36a047)=>{this['_onDeactivateChange'](_0x36a047);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x10dd38,_0x2dd991)=>{this['_onChangeMarkerClicked'](_0x10dd38,_0x2dd991);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x46f88a,_0x2b68ba)=>{this['_onChangeMarkerHovered'](_0x46f88a,_0x2b68ba);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x2e9c3,_0x45ccc5)=>{this['_onChangeMarkerRemoved'](_0x2e9c3,_0x45ccc5);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x17e2d7,_0xd772ff)=>{this['_onChangeMarkerRestored'](_0x17e2d7,_0xd772ff);});}async['runCheck'](_0x4273e7){if(!this['_availableReviewChecks'])return;const _0x37b1d3=this['_availableReviewChecks']['find'](_0x130867=>_0x130867['id']===_0x4273e7['id']);if(!_0x37b1d3)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x4273e7['id']}));this['_onReviewCheckRun'](_0x4273e7),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x402707=this['context']['plugins']['get'](Ss)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x4273e7['id']],'context':new qn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4273e7,_0x37b1d3,_0x402707);const _0xcb21f4=this['_currentReviewCheckRun'];_0xcb21f4['on']('reviewCheckResultChangeStatusUpdated',(_0xffb234,_0x43afd2)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x43afd2['change']['id'],_0x43afd2['status']),this['_pushAcceptAllEnabled'](_0xcb21f4);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x257062,_0xbd2e5)=>{switch(_0xbd2e5['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0xbd2e5);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0xbd2e5['status']&&'error-chunk'!==_0xbd2e5['status']&&'error-general'!==_0xbd2e5['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x46afc0,_0x5d63ec)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x4064f8=Ks(_0x5d63ec['editor'],_0x5d63ec['rootName']);let _0x53f95e=_0x5d63ec['result']['contentInitial'],_0x257b16=_0x5d63ec['result']['contentNew'];_0x4064f8&&(_0x53f95e=$s(_0x53f95e),_0x257b16=$s(_0x257b16));const _0x52837b=this['_diffContent'](_0x5d63ec['editor'],_0x53f95e,_0x257b16);if(_0x4064f8){const _0x480e08=_0x5d63ec['editor']['ui']['getEditableElement'](_0x5d63ec['rootName'])?.['tagName']['toLowerCase']();for(const _0x59c789 of _0x52837b)_0x59c789['wrapperTag']=_0x480e08;}_0x5d63ec['source']['addResultChanges'](_0x5d63ec['result']['id'],_0x52837b);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0xe24bea,_0x2298a2)=>{for(const _0x33b122 of _0x2298a2['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x33b122);this['_pushAcceptAllEnabled'](_0x2298a2['source']),this['_markChangePositionInEditorContent'](_0x2298a2['changes'],_0x2298a2['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x4def46,_0x5b821c)=>{this['_onReviewCheckResultActivated'](_0x5b821c);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x5c293a){if(Nn(_0x5c293a))return;_0x5c293a instanceof ct?this['_logError'](_0x5c293a):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x5c293a));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x57fd34){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x57fd34['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x2d8835,_0x44452a,_0x4ef294=new qn()){return new Yh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x44452a,this['_aiConnector'],_0x2d8835['params'],_0x2d8835['args'],_0x4ef294['refs']);}['_onChangeMarkerRemoved'](_0x2016c9,_0x1d0869){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x1d0869['changeId']);}_onChangeMarkerRestored(_0x4a0e58,_0x10f15b){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x10f15b['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aireview');}['_onReviewRunLeave'](_0x4f92c3=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x4f92c3&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1d6222 of this['_aiReviewCoreEditing']['getEditors']())_0x1d6222['editing']['view']['change'](_0x45f10c=>{for(const _0x431413 of _0x1d6222['editing']['view']['document']['getRoots']())_0x45f10c['removeClass']('ck-ai_review-diff',_0x431413),_0x45f10c['removeClass']('ck-ai_review-highlights',_0x431413),_0x45f10c['removeClass']('ck-ai-translate-mode-content',_0x431413);});}['_logError'](_0x1fc09c){this['_reporter']['logError'](_0x1fc09c),'ai-review-mode-models-unable-to-retrieve'===function(_0x1c7193){return _0x1c7193 instanceof xn?_0x1c7193['code']:_0x1c7193 instanceof Error?_0x1c7193['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x1fc09c)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x4d0b35){if('content'===this['_changeActivationSource']){const _0x3a38e9=this['_aiReviewCoreUi']['getChangeElement'](_0x4d0b35);_0x3a38e9&&vt(_0x3a38e9['closest']('.ck-ai_review__check-run-result')||_0x3a38e9);}else{if('panel'===this['_changeActivationSource']){const _0x2d0df6=this['_getChangeContentElement'](_0x4d0b35);if(!_0x2d0df6)return;kt({'target':_0x2d0df6,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},qh=class extends Wh{_prompt;['_model'];constructor(_0x3cda2f,_0x379318,_0x452fa2,_0x54ef5a,_0x5eb7d5,_0x51a72b){super(_0x452fa2,_0x54ef5a,_0x5eb7d5,void 0x0,void 0x0,_0x51a72b),this['_prompt']=_0x3cda2f,this['_model']=_0x379318;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0xc20b65,_0x460fd3,_0x2304de){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x460fd3,_0xc20b65,_0x2304de);}},Qh=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x38de9a){this['id']=_0x38de9a['id'],this['commandId']=_0x38de9a['commandId'],this['title']=_0x38de9a['title'],this['description']=_0x38de9a['description'],this['isParameterized']=_0x38de9a['isParameterized'],this['useArgs']=_0x38de9a['useArgs'],this['options']=_0x38de9a['options'],this['args']=_0x38de9a['args'];}},Xh=class extends Qh{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0x1c4ef9,_0x1af146,_0x3dbefb){super(_0x1c4ef9),this['prompt']=_0x1c4ef9['prompt'],this['context']=_0x1c4ef9['context'],this['model']=_0x1c4ef9['model'],this['model']?this['_defaultModel']=_0x1af146['find'](_0x36d847=>_0x36d847['id']===this['model'])||null:this['_defaultModel']=_0x3dbefb;}get defaultModel(){return this['_defaultModel'];}},zh=class extends qh{get subTitle(){return'';}set prompt(_0x443508){this['_prompt']=_0x443508;}set['model'](_0xffd24f){this['_model']=_0xffd24f;}},jh=class extends _0x22445f{static get requires(){return[Es,Ln];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];_reporter;init(){this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aireview');}getChecksList(){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Jh=[{'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'}]}]}],Zh=/* #__PURE__ -- @preserve */
|
|
41
|
+
At();var tc=class extends Zh{['_checks']=[];setupChecks(_0x427af3){this['_checks']=_0x427af3['map'](_0x47d546=>new Qh(_0x47d546));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x16596a){return this['checks']['find'](_0x141bb3=>_0x141bb3['id']===_0x16596a);}['removeCheckById'](_0x5b8d1f){this['_checks']=this['_checks']['filter'](_0x5cbfd6=>_0x5cbfd6['id']!==_0x5b8d1f);}},ec=class extends Qh{['_models']=[];_defaultModel=null;constructor(_0x5a7f0e,_0x3ee5df,_0x270541){super(_0x5a7f0e),this['_models']=_0x3ee5df,this['_defaultModel']=_0x270541;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},ic=class extends tc{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x3fe4bd,_0x5b69af,_0x1b85f7){super(),this['_allModels']=_0x3fe4bd,this['_recommendedModels']=_0x5b69af,this['_defaultModel']=_0x1b85f7;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x277dae){this['_checks']=_0x277dae['map'](_0x590971=>!0x0===_0x590971['isExtra']?new Xh(_0x590971,this['_allModels'],this['_defaultModel']):'custom'===_0x590971['id']?new ec(_0x590971,this['_recommendedModels'],this['_defaultModel']):new Qh(_0x590971));}},sc=class extends jh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Es,Ln,Ss];}['_modelsLoadError']=null;constructor(_0x537a12){super(_0x537a12),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x4316e0=>({'id':_0x4316e0['id'],'commandId':_0x4316e0['id'],'title':_0x4316e0['label'],'description':_0x4316e0['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x4316e0['prompt'],'context':_0x4316e0['context'],'model':_0x4316e0['model']}));}async _loadChecksList(){const _0x5d44cf=[...Jh,...this['getExtraChecks']()]['map'](_0x471404=>_0x471404['isExtra']?_0x471404:this['_translateReviewCheck'](_0x471404)),_0x14e5e5=this['context']['plugins']['get'](Ss);let _0x346ca3;try{_0x346ca3=new ic(await _0x14e5e5['models']['getAllModels'](),await _0x14e5e5['models']['getAvailableModels'](),await _0x14e5e5['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0xb69caa){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0xb69caa),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x346ca3=new ic([],[],null);}return _0x346ca3['setupChecks'](_0x5d44cf),_0x346ca3;}_translateReviewCheck(_0x42f001){const _0x565217='AI_REVIEW_CHECK_'+_0x42f001['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x4d5c5e={..._0x42f001,'title':this['_translate'](_0x565217+'_TITLE',_0x42f001['title']),'description':this['_translate'](_0x565217+'_DESCRIPTION',_0x42f001['description'])};return _0x42f001['options']&&(_0x4d5c5e['options']=_0x42f001['options']['map'](_0xcb2eb1=>({..._0xcb2eb1,'label':this['_translate'](_0x565217+'_OPTIONS_LABEL',_0xcb2eb1['label']||''),'data':_0xcb2eb1['data']?_0xcb2eb1['data']['map'](_0x592714=>({..._0x592714,'label':this['_translate'](_0x565217+'_OPTIONS_DATA_'+_0x592714['id']['toUpperCase'](),_0x592714['label'])})):void 0x0}))),_0x4d5c5e;}_translate(_0x2b8cb4,_0x32e779){const _0xc9b36a=Ts(this['context']['locale'],_0x2b8cb4);return _0xc9b36a===_0x2b8cb4?_0x32e779:_0xc9b36a;}},nc=class extends $h{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Ln,sc,Ss];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x2f4cbd){super(_0x2f4cbd),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Jh['map'](_0x2e914f=>_0x2e914f['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x3b62cc,_0x32b954)=>{this['_isDiffOn']=_0x32b954['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x382c9e,_0x10663c,_0x272ab1=new qn()){if(_0x382c9e['isCustom'])return new qh(_0x382c9e['args']['prompt'],_0x382c9e['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x10663c,this['_aiConnector'],_0x272ab1['refs']);if(_0x10663c['isExtra']){const _0x4275f6=_0x10663c,_0x39ab5a=_0x4275f6['context']?_0x272ab1['cloneWith'](_0x4275f6['context'])['refs']:_0x272ab1['refs'];return new zh(_0x382c9e['args']?.['prompt']??_0x4275f6['prompt'],_0x382c9e['args']?.['model']??_0x4275f6['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x10663c,this['_aiConnector'],_0x39ab5a);}return new Yh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x10663c,this['_aiConnector'],_0x382c9e['params'],_0x382c9e['args'],_0x272ab1['refs']);}_onReviewCheckResultActivated(_0x1967a1){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1967a1['change']['id']),this['_scrollToChange'](_0x1967a1['change']['id']);const _0x102e4a=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1967a1['change']['id']);if(!_0x102e4a)return;const _0x3205fc=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1967a1['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1967a1['change'],()=>_0x102e4a['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3205fc,_0x102e4a['modelRange']['root']['rootName']),_0x3205fc?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1967a1['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x4a93e2){this['_currentReviewCheckRun']&&'click'===_0x4a93e2['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4a93e2['id']));}_onDeactivateChange(_0x57068c){this['_currentReviewCheckRun']&&'balloon'===_0x57068c['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x560804,_0x267cd9){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x267cd9['changeId']);const _0x599424=this['_currentReviewCheckRun']['getChangeById'](_0x267cd9['changeId']);if(!_0x599424)return;const _0x32939a=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x267cd9['changeId']),_0x3cc185=this['_aiReviewCoreEditing']['getEditorForChange'](_0x267cd9['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x599424,_0x267cd9['markerElement'],_0x267cd9['domEvent'],'click',this['_getBalloonDomRoot'](_0x3cc185,_0x32939a?.['modelRange']['root']['rootName']),_0x3cc185?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x521a90,_0x356b20){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x22310a=this['_currentReviewCheckRun']['getChangeById'](_0x356b20['changeId']);if(!_0x22310a)return;const _0x366b58=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x356b20['changeId']),_0x31750c=this['_aiReviewCoreEditing']['getEditorForChange'](_0x356b20['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x22310a,_0x356b20['markerElement'],_0x356b20['domEvent'],'hover',this['_getBalloonDomRoot'](_0x31750c,_0x366b58?.['modelRange']['root']['rootName']),_0x31750c?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x230d74){const _0x287eaa=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x230d74);return _0x287eaa?_0x287eaa['getElement']():null;}_markChangePositionInEditorContent(_0x18ba79,_0x3624bb){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x18ba79,_0x3624bb);}_diffContent(_0x218a40,_0x534733,_0x36263a){return this['_aiReviewCoreEditing']['diffContent'](_0x218a40,_0x534733,_0x36263a,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x56bcbe){_0x56bcbe?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x1d57b3 of this['_aiReviewCoreEditing']['getEditors']())_0x1d57b3['editing']['view']['change'](_0x3b29a8=>{for(const _0x4c9de4 of _0x1d57b3['editing']['view']['document']['getRoots']()){for(const _0x58007a of _0x4c9de4['getClassNames']())_0x58007a['startsWith']('ck-ai_review-')&&_0x3b29a8['removeClass'](_0x58007a,_0x4c9de4);_0x3b29a8['addClass'](_0x56bcbe?'ck-ai_review-diff':'ck-ai_review-highlights',_0x4c9de4);}});}_getBalloonDomRoot(_0x134886,_0x382d35){const _0x27f6e2=_0x134886['editing']['view'];if(_0x382d35){const _0x54ce87=_0x27f6e2['getDomRoot'](_0x382d35);if(_0x54ce87)return _0x54ce87;}return _0x27f6e2['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x527da4=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x4ea9f1=await _0x527da4['getChecksList']();_0x527da4['modelsLoadError']&&this['_logError'](_0x527da4['modelsLoadError']);let _0xf15c15=_0x4ea9f1['checks'];const _0x36cc4d=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x36cc4d,_0xf15c15),this['_usesAvailableCommandsConfig']&&(_0xf15c15=_0x36cc4d['map'](_0x1b9dac=>_0xf15c15['find'](_0x85fa4e=>_0x85fa4e['id']===_0x1b9dac))['filter'](_0x574de3=>!!_0x574de3)),this['_filterChecksWithMissingModel'](_0xf15c15);}_logWarningForNonExistentChecks(_0x23a6b4,_0x428310){const _0x42e5a9=_0x23a6b4['filter'](_0x4f3c2f=>!_0x428310['some'](_0x325b50=>_0x325b50['id']===_0x4f3c2f));_0x42e5a9['length']&&this['_reporter']['logError'](new xn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x42e5a9['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x2fb37f){const _0xb4dc90=[];return _0x2fb37f['forEach'](_0x2a6031=>{(_0x2a6031 instanceof Xh&&!_0x2a6031['defaultModel']||_0x2a6031 instanceof ec&&!_0x2a6031['models']['length'])&&_0xb4dc90['push'](_0x2a6031['id']);}),_0xb4dc90['length']&&_0xb4dc90['forEach'](_0x386d24=>{_0x2fb37f=_0x2fb37f['filter'](_0x3af995=>_0x3af995['id']!==_0x386d24),this['_reporter']['logError'](new xn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x386d24}}));}),_0x2fb37f;}},rc=class extends _0x22445f{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Uh,sc,Es,sn,Cn,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x20b7d4=>{const _0x40eb52={'id':_0x20b7d4['id'],'title':_0x20b7d4['title'],'description':_0x20b7d4['description']};return'custom'!==_0x20b7d4['id']&&_0x20b7d4['options']?.['length']&&(_0x40eb52['parameters']=_0x20b7d4['options'][0x0]['data']['map'](_0x22e12a=>({..._0x22e12a}))),_0x40eb52;});}async['runReview'](_0x3fd267,_0x3d1ed7){const _0x3c9043=await this['_resolveReviewCheck'](_0x3fd267),_0x2befc5=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x4c1743=this['context']['plugins']['get']('AIConnector'),_0x13ddb6=_0x2befc5['getDocumentData']({'roots':_0x3d1ed7?.['roots']}),_0x32749a=this['_createReviewCheckRun'](_0x3c9043,_0x13ddb6,_0x4c1743,_0x3d1ed7?.['parameterId'],_0x3d1ed7?.['contexts']);return _0x2befc5['runCheck'](_0x32749a,{'signal':_0x3d1ed7?.['signal']});}async runCustomReview(_0x394396,_0x208b47){const {reviewCheck:_0x57d8aa,resolvedModel:_0x4fa4a7}=await this['_resolveCustomReviewCheck'](_0x394396,_0x208b47?.['model']),_0x25c5a2=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x9f4f65=this['context']['plugins']['get']('AIConnector'),_0x5e8028=new qh(_0x394396,_0x4fa4a7,_0x25c5a2['getDocumentData']({'roots':_0x208b47?.['roots']}),_0x57d8aa,_0x9f4f65,_0x208b47?.['contexts']);return _0x25c5a2['runCheck'](_0x5e8028,{'signal':_0x208b47?.['signal']});}['applyReview'](_0x47b5f7,_0x581319){this['context']['plugins']['get']('AIGateway')['apply'](_0x47b5f7,{'aiSource':'review',..._0x581319});}async['_resolveReviewCheck'](_0x44d411){const _0x5f2b3b=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x112105=>_0x112105['id']===_0x44d411);if(!_0x5f2b3b)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x44d411});if(_0x5f2b3b instanceof ec)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x44d411});if(_0x5f2b3b instanceof Xh&&!_0x5f2b3b['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x44d411});return _0x5f2b3b;}async _resolveCustomReviewCheck(_0x19e28e,_0x24c307){const _0x4ea257='custom',_0x7f72f9=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x51a0dd=>_0x51a0dd['id']===_0x4ea257);if(!_0x7f72f9)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x4ea257});if(!(_0x7f72f9 instanceof ec))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x4ea257});if(!_0x19e28e)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x4ea257});const _0x3a40ef=_0x24c307??_0x7f72f9['defaultModel']?.['id'];if(!_0x3a40ef)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x4ea257});return{'reviewCheck':_0x7f72f9,'resolvedModel':_0x3a40ef};}_createReviewCheckRun(_0x21306d,_0x498d61,_0xc1d170,_0x4d0c1e,_0x5d53a2=[]){if(_0x21306d instanceof Xh){const _0x27f0f2=_0x21306d['context']?[..._0x5d53a2,_0x21306d['context']]:_0x5d53a2;return new zh(_0x21306d['prompt'],_0x21306d['defaultModel']['id'],_0x498d61,_0x21306d,_0xc1d170,_0x27f0f2);}return new Yh(_0x498d61,_0x21306d,_0xc1d170,_0x4d0c1e?[_0x4d0c1e]:void 0x0,void 0x0,_0x5d53a2);}},oc=class extends _0x22445f{static get requires(){return[nc,Lh,Uh,rc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0xd48717,_0x523a52){if(this['assertStartReviewPreconditions'](_0xd48717)instanceof ec)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0xd48717});oh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xd48717,'params':_0x523a52?.['parameterId']?[_0x523a52['parameterId']]:void 0x0});}async startCustomReview(_0x4fccef,_0x2cd93f){if(!_0x4fccef)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0xfbf317=Jh['find'](_0x2bc3fd=>'custom'===_0x2bc3fd['commandId'])['id'],_0x370e7f=this['assertStartReviewPreconditions'](_0xfbf317),_0x1e1414=_0x2cd93f?.['model']??_0x370e7f['defaultModel']?.['id'];if(!_0x1e1414)throw new ct('ai-reviewmode-missing-custom-command-model',this);oh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xfbf317,'isCustom':!0x0,'args':{'prompt':_0x4fccef,'model':_0x1e1414}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x467bef=>{const _0x289856={'id':_0x467bef['id'],'title':_0x467bef['title'],'description':_0x467bef['description']};return'custom'!==_0x467bef['id']&&_0x467bef['options']?.['length']&&(_0x289856['parameters']=_0x467bef['options'][0x0]['data']['map'](_0x451997=>({..._0x451997}))),_0x289856;});}assertStartReviewPreconditions(_0x10cc70){const _0x2491ae=this['context']['plugins']['get']('AIReviewModeController');if(_0x2491ae['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x29e976=_0x2491ae['getAvailableChecks']()['find'](_0x33eb13=>_0x33eb13['id']===_0x10cc70);if(!_0x29e976)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x10cc70});return _0x29e976;}},ac=class extends Yh{_title;constructor(_0x243d85,_0x5133f6,_0x3a4f5d,_0x11c136,_0x230e16,_0x33a81c,_0x9272b){super(_0x243d85,_0x5133f6,_0x3a4f5d,_0x230e16,_0x33a81c,_0x9272b),this['_title']=_0x11c136;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},hc=class extends Qh{get['apiId'](){return'translate';}},cc=class extends tc{setupChecks(_0x3b1d37){this['_checks']=_0x3b1d37['map'](_0x156178=>new hc(_0x156178));}};const lc=[{'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'}];var uc=class extends jh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x382dde){super(_0x382dde),this['context']['config']['define']('ai.translate.languages',lc);}async _loadChecksList(){const _0x1dad66=[],_0x96781=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x55ef74 of _0x96781)_0x1dad66['push']({'title':_0x55ef74['label'],'id':_0x55ef74['id'],'commandId':_0x55ef74['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x55ef74['id']}});const _0x4bc766=new cc();return _0x4bc766['setupChecks'](this['_translateChecks'](_0x1dad66)),_0x4bc766;}_translateChecks(_0x234ffe){const _0xf69386=this['context']['locale'];return _0x234ffe['map'](_0x5f3c68=>{const _0x189f3b='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x5f3c68['title']['toUpperCase']()['replaceAll']('-','_'),_0x304ae7=Ts(_0xf69386,_0x189f3b);return{..._0x5f3c68,'title':_0x304ae7===_0x189f3b?_0x5f3c68['title']:_0x304ae7};});}},dc=class extends $h{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Ln,uc,Ss];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x40cd6c,_0x38eca3,_0x1edc55){return new ac(this['_aiReviewCoreEditing']['getDocumentData'](),_0x38eca3,this['_aiConnector'],Ts(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x40cd6c['params'],_0x40cd6c['args'],_0x1edc55?.['refs']);}_onReviewCheckResultActivated(_0x38b377){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x38b377['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x38b377['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0xc3ef47){this['_currentReviewCheckRun']&&('hover'===_0xc3ef47['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0xc3ef47['id'])),'click'===_0xc3ef47['uiInteraction']&&this['_scrollToChange'](_0xc3ef47['id']));}_onDeactivateChange(_0x484e63){this['_currentReviewCheckRun']&&'panel'===_0x484e63['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x2d4bd8,_0x5153f0){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5153f0['changeId']),this['_scrollToChange'](_0x5153f0['changeId']));}['_onChangeMarkerHovered'](_0xb0b047,_0x126ab){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x126ab['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x126ab['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x3fb245){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3fb245);}_markChangePositionInEditorContent(_0x3c0b48,_0x2bc1b6){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3c0b48,_0x2bc1b6);}_diffContent(_0x1d3312,_0x3fbf53,_0x4265f6){return this['_aiReviewCoreEditing']['diffContent'](_0x1d3312,_0x3fbf53,_0x4265f6,!0x0);}['_onReviewCheckRun'](){for(const _0x556fd5 of this['_aiReviewCoreEditing']['getEditors']())_0x556fd5['editing']['view']['change'](_0x401da4=>{for(const _0x4a790e of _0x556fd5['editing']['view']['document']['getRoots']())_0x401da4['addClass']('ck-ai-translate-mode-content',_0x4a790e);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},_c=class extends Sh{constructor(_0x353520,_0x19f85e){super(_0x353520,_0x19f85e),this['on']('set:isLoading',(_0x3b4fc3,_0x101bd0,_0x251137)=>{_0x251137&&(this['headerTitle']=Ts(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x3990ce,_0x4453f0,_0x218599)=>{_0x218599&&(this['headerTitle']=Ts(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x55217c=super['_createAcceptAllButtonView']();return _0x55217c['set']('label',Ts(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x55217c;}_createExitReviewButtonView(){const _0x29ea62=super['_createExitReviewButtonView']();return _0x29ea62['set']('label',Ts(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x29ea62;}},gc=class extends xh{_setupTemplate(){const _0x2e3306=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x2e3306['if']('isVisible','ck-hidden',_0x3ee7f2=>!_0x3ee7f2)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Ts(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Ts(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x2e3306['if']('isVisible','ck-hidden',_0x59cd84=>!_0x59cd84)]},'children':this['_checkViews']}]});}},Ac=class extends wh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x22550d=this['context']['plugins']['get']('AITabs'),_0xcaff6=this['context']['locale'],_0x1e4a49=new _a(_0xcaff6,{'label':Ts(_0xcaff6,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x2165a0,'class':'ck-ai-header_review-translate','showResizeButton':_0x22550d['showResizeButton']});_0x1e4a49['delegate']('resizeTabs')['to'](_0x22550d),_0x1e4a49['bind']('isMaximized')['to'](_0x22550d['view'],'isMaximized',_0x930b38=>_0x930b38);const _0x34a29e=new fh(_0xcaff6,{'header':_0x1e4a49,'list':new gc(_0xcaff6),'results':new _c(_0xcaff6,{'generalErrorText':Ts(_0xcaff6,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Rh(_0xcaff6,{'headerText':Ts(_0xcaff6,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Ts(_0xcaff6,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Ts(_0xcaff6,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x34a29e['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x34a29e;}registerTab(){const _0xa153cf=this['context']['plugins']['get']('AITabs');_0xa153cf['view']['on']('activateTab',(_0xdcd6ea,{newTab:_0x3b3037,oldTab:_0x519626})=>{'translate'===_0x3b3037?this['fire']('getReviewCheckList'):'translate'===_0x519626&&this['fire']('leaveReview');}),_0xa153cf['view']['addTab']({'id':'translate','buttonLabel':Ts(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x2165a0,'order':0x0,'content':this['_mainView']});}},Ic=class extends _0x22445f{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Uh,Es,sn,Cn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x566993,_0x47b76c){const _0x3a6ab4=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x487819=this['context']['plugins']['get']('AIConnector'),_0x3c589f=new hc({'id':_0x566993,'commandId':_0x566993,'title':_0x566993,'description':'','isParameterized':!0x1}),_0x149acc=new Yh(_0x3a6ab4['getDocumentData']({'roots':_0x47b76c?.['roots']}),_0x3c589f,_0x487819,void 0x0,{'language':_0x566993},_0x47b76c?.['contexts']);return _0x3a6ab4['runCheck'](_0x149acc,{'signal':_0x47b76c?.['signal']});}applyTranslate(_0x45ab09,_0x1414f6){this['context']['plugins']['get']('AIGateway')['apply'](_0x45ab09,_0x1414f6);}},pc=class extends _0x22445f{static get requires(){return[dc,Ac,Uh,Ic];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x22b564){const _0x675ccb=this['assertStartTranslatePreconditions'](_0x22b564);oh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x675ccb['id'],'args':_0x675ccb['useArgs']?_0x675ccb['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x4224ae=>({'id':_0x4224ae['id'],'label':_0x4224ae['title']}));}assertStartTranslatePreconditions(_0x5eb220){const _0x55eb24=this['context']['plugins']['get']('AITranslateController');if(_0x55eb24['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x4ee93f=_0x55eb24['getAvailableChecks']()['find'](_0x311d7d=>_0x311d7d['id']===_0x5eb220);if(!_0x4ee93f)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x5eb220});return _0x4ee93f;}};export{Ih as AIActions,Di as AIAdapter,rs as AIAssistant,is as AIAssistantUI,Ga as AIBalloon,Na as AIChat,sr as AIChatController,lo as AIChatFeedCustomElementView,ya as AIChatHistory,ka as AIChatHistoryController,ba as AIChatHistoryUI,jn as AIChatInteraction,Da as AIChatShortcuts,pa as AIChatUI,Ph as AICheckRunSingleRootResult,Es as AIConnector,qn as AIContext,bs as AIContextLibrary,Ss as AICore,xn as AICoreError,yn as AIDocumentProcessingGateway,vn as AIDocumentProcessingRunResult,sn as AIEditing,$a as AIEditorIntegration,Pn as AIErrorReporter,Ln as AIErrorSink,Cn as AIGateway,Wn as AIInteraction,Cs as AIModels,ph as AIQuickActions,nh as AIQuickActionsUI,Gn as AIReply,Hi as AIRequestError,Qh as AIReviewCheck,Bh as AIReviewCheckResult,Fh as AIReviewCheckResultChange,Wh as AIReviewCheckRun,rc as AIReviewGateway,oc as AIReviewMode,$h as AIReviewModeController,Uh as AIReviewModeEditing,Lh as AIReviewModeUI,kn as AIRunResult,On as AIRunSingleRootResult,Is as AITabs,As as AITabsMainView,ds as AITabsView,as as AITextAdapter,Ma as AIToggleButtonUI,pc as AITranslate,dc as AITranslateController,Ic as AITranslateGateway,Ac as AITranslateUI,cs as AWSTextAdapter,hs as OpenAITextAdapter,Ui as ShowAIAssistantCommand,Ha as ToggleAICommand,Un as createResizeButton,os as getDefaultAICommands,wn as markOperationsAsAI};
|