@ckeditor/ckeditor5-ai 48.3.0-alpha.4 → 48.3.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.
Files changed (2) hide show
  1. package/dist/index.js +19 -19
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,22 +20,22 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x3738d1,ContextPlugin as _0x10611c,Editor as _0x1bce0a,Plugin as _0x2965bd,rootAcceptsBlocks as _0x4c4eb3}from'@ckeditor/ckeditor5-core';import{IconAI as _0x480be1,IconAIAdjustLength as _0x104e50,IconAIAskAI as _0x2ac5dd,IconAIChangeTone as _0x527cc5,IconAIChat as _0x36cf34,IconAIChatCommands as _0xf5b95c,IconAIContinueWriting as _0x9a7f60,IconAIGrammarCheck as _0x4049d0,IconAIHistory as _0x3b7460,IconAIImproveWriting as _0x46bad4,IconAIOther as _0x41d434,IconAIQuickActions as _0x4e19bd,IconAIReview as _0x247464,IconAITranslate as _0xc54aae,IconBoxWithCheck as _0x302b97,IconBoxWithCross as _0x2e3064,IconBoxWithMarker as _0x47396e,IconBrowseFiles as _0x357b59,IconBulb as _0x4150ef,IconCancel as _0x2c8364,IconCheck as _0x4bf74a,IconChevronDown as _0x55011b,IconChevronRight as _0x46b764,IconChevronUp as _0x1b6be5,IconCopy as _0x2d4376,IconDocument as _0x26e7cd,IconDocumentOutline as _0x50aab7,IconDropdownArrow as _0x53adfc,IconError as _0x4eead5,IconEye as _0x30f129,IconEyeCrossedOut as _0x3f6024,IconFileUpload as _0x5ed1b5,IconImage as _0x288b7a,IconInfo as _0x32d17f,IconLink as _0x45e544,IconLoupe as _0x3a593a,IconMagicWand as _0x54ec46,IconMaximize as _0x383e57,IconMinimize as _0x5c7ac2,IconNextArrow as _0xc715e6,IconOutdated as _0x25e1a5,IconPaperClip as _0x2f7747,IconPin as _0x2e604f,IconPlus as _0x534fb7,IconPreviousArrow as _0x396ec0,IconRefresh as _0x20d49b,IconRobotPencil as _0x467662,IconSelection as _0x44caf2,IconShowChangesOff as tt,IconShowChangesOn as et,IconStop as it,IconSubmit as st,IconThreeHorizontalDots as nt,IconThumbDown as rt,IconThumbUp as ot,IconWeb as at}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ht,Collection as ct,DomEmitterMixin as lt,EmitterMixin as ut,FocusTracker as dt,KeystrokeHandler as _t,ObservableMixin as gt,Rect as At,ResizeObserver as It,_isMotionReduced as pt,first as mt,getConstrainedViewportRect as Et,global as Tt,insertToPriorityArray as wt,isVisible as Ct,logError as ft,logWarning as bt,scrollAncestorsToShowTarget as St,scrollViewportToShowTarget as Rt,toArray as Ot,uid as vt,version as kt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as yt,BalloonToolbar as xt,BodyCollection as Lt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Pt,ButtonView as Ht,Dialog as Mt,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Ut,FileDialogButtonView as Bt,FocusCycler as Gt,FormHeaderView as Ft,FormRowView as Kt,HighlightedTextView as Wt,IconView as Yt,InputTextView as $t,LabeledFieldView as qt,ListItemButtonView as Qt,ListItemGroupView as Xt,ListItemView as zt,ListView as jt,MenuBarMenuListItemButtonView as Jt,MenuBarMenuListItemView as Zt,MenuBarMenuListView as te,MenuBarMenuView as _0x31c0cc,SearchTextView as _0xd993a2,SpinnerView as _0x421451,TextareaView as _0x68db3e,ToolbarView as _0x11c4f1,UIModel as _0x36985a,View as _0x5d2282,ViewCollection as _0x3c6d3b,addListToDropdown as _0x5d9db0,addMenuToDropdown as _0x301d52,clickOutsideHandler as _0xf7c0ab,createDropdown as _0x2959da,createLabeledInputText as _0x2926cc,createLabeledTextarea as _0x32d936,submitHandler as _0x452df3}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x352a3a,ClipboardPipeline as _0x47d931}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x5cbae7,MarkerOperation as _0x4a02b7,Matcher as _0x4018c2,ModelDocumentFragment as _0x3f99b4,ModelPosition as _0x584844,ModelRange as _0x2993a5,ModelTreeWalker as _0x81b4df,ViewDataTransfer as _0x51fa45,ViewDocumentDomEventData as _0x3b74eb,ViewDowncastWriter as _0x490a50,ViewUpcastWriter as _0x2b52c7,_DetachOperation as _0x495311,_insertIntoModelNodeList as _0x3972e3,_removeFromModelNodeList as _0x2d4116,transformOperationSets as _0x4506be}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x540de5,debounce as _0x3d5a0c,escape as _0x4495a6,escapeRegExp as _0x1e70d6,throttle as _0x175e83,unescape as _0x5e9ba5}from'es-toolkit/compat';import{createParser as _0x184d98}from'eventsource-parser';import{CloudServices as _0x3cb437}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x5bc6c6,DATA_ID_MODEL_ATTRIBUTE as _0x445414,DATA_ID_VIEW_ATTRIBUTE as _0x1e7972,DocumentCompare as _0x22fa17,SuggestionsConversion as _0x4e90fb,fixElementSuggestionRange as _0x3b2d8e,getAllMarkersDomElementsSorted as _0x5ca127,getMarkerDomElement as _0x214a83}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x26ee46}from'htmlparser2';import{append as _0x109382,appendChild as _0x37dfba,find as _0xd70512,findAll as _0xfbdc58,findOne as ti,getChildren as _0x2ebe7e,getParent as _0x18c81d,isComment as _0x4a8d03,isTag as _0x3a2d7f,prepend as _0x5c42a6,prependChild as _0x333b63,removeElement as _0x3cff82,replaceElement as _0x53788f,textContent as _0x389fc5}from'domutils';import _0x2c79e7 from'dom-serializer';import{Document as _0x52e1ed,Element as _0x4e03ab,NodeWithChildren as _0x125039,Text as _0xb034a,cloneNode as _0x26e4f2,isDocument as _0x19e5ed,isText as _0xa4c1f4}from'domhandler';import{MarkdownGfmMdToHtml as _0x4a71f8,MarkdownGfmMdToHtmlDefaultPlugins as _0x4452a7}from'@ckeditor/ckeditor5-markdown-gfm';import _0x41d136 from'rehype-sanitize';import _0x127c11 from'morphdom';import{diffArrays as _0x37330f}from'diff';const fi='_ungrouppedCommands';function bi(_0x170dc5,_0x38264c){const _0x5a0338=(0x0,_0x38264c['t'])('Other');return _0x170dc5['length']?'groupId'in _0x170dc5[0x0]?_0x170dc5:[{'groupId':fi,'groupLabel':_0x5a0338,'order':0x1/0x0,'commands':_0x170dc5}]:[{'groupId':fi,'groupLabel':_0x5a0338,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x2965bd{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x6cfb26}=this,_0x5488bd=['ck-fake-ai-selection'];_0x6cfb26['config']['get']('ai.assistant.useTheme')&&_0x5488bd['push']('ck-ai-assistant-ui_theme'),_0x6cfb26['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x5488bd,'priority':0xc}}),_0x6cfb26['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x39c052,{writer:_0x9be889})=>{if(!_0x39c052['markerRange']['isCollapsed'])return null;const _0x6a4a27=_0x9be889['createUIElement']('span');return _0x9be889['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x6a4a27),_0x6a4a27;}});}['afterInit'](){!async function(_0x558537){const _0x25b69e='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x5ad103=0x78e28,_0xb65156=window['Date']['now'](),_0x7e594a=_0x558537['editor'],_0x29d794=new window['Promise'](_0x385517=>{_0x7e594a['once']('ready',_0x385517);}),_0x4f1df3={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x4b28a1=_0x7e594a['config']['get']('licenseKey');async function _0x2143d6(){let _0x4e182f,_0x45dc39=null,_0x10ed86=null;try{return'GPL'==_0x4b28a1?'NotAllowed':(_0x4e182f=_0x3b55c8(),_0x4e182f?(_0x4e182f['usageEndpoint']&&(_0x10ed86=_0x2a08c2(_0x4e182f['usageEndpoint'],_0x4e182f['jti'])),await _0x41813e()?_0x4cd38c()?_0x3f9cd1()?'Expired':_0x44a8db()?('evaluation'==_0x4e182f['licenseType']&&(_0x45dc39=_0x2eedb3('EvaluationLimit')),await _0x2c4f24()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x3f9cd1(){const _0x32bb0f=['evaluation','trial']['includes'](_0x4e182f['licenseType'])?_0xb65156/0x3e8:0xe10*_0x5ad103;return _0x4e182f['exp']<_0x32bb0f;}function _0x4cd38c(){const _0x3d722d=_0x4e182f['features'];return!!_0x3d722d&&(!!_0x3d722d['includes']('*')||!!_0x3d722d['includes']('AI'));}function _0x44a8db(){const _0xd3968b=_0x4e182f['licensedHosts'];if(!_0xd3968b||0x0==_0xd3968b['length'])return!0x0;const {hostname:_0x43b9c6}=new URL(window['location']['href']);if(_0xd3968b['includes'](_0x43b9c6))return!0x0;const _0x115ea5=_0x43b9c6['split']('.');return _0xd3968b['filter'](_0x42a3c1=>_0x42a3c1['includes']('*'))['map'](_0x118138=>_0x118138['split']('.'))['filter'](_0x128135=>_0x128135['length']<=_0x115ea5['length'])['map'](_0x54348e=>Array(_0x115ea5['length']-_0x54348e['length'])['fill']('*'===_0x54348e[0x0]?'*':'')['concat'](_0x54348e))['some'](_0x24fdde=>_0x115ea5['every']((_0x54df2e,_0x306a27)=>_0x24fdde[_0x306a27]===_0x54df2e||'*'===_0x24fdde[_0x306a27]));}function _0x2c4f24(){return _0x45dc39&&_0x10ed86?new window['Promise']((_0x46275b,_0x44bebe)=>{_0x45dc39['then'](_0x46275b,_0x44bebe),_0x10ed86['then'](_0x4d94cf=>{'Valid'!=_0x4d94cf&&_0x46275b(_0x4d94cf);},_0x44bebe);}):_0x45dc39||_0x10ed86||'Valid';}}function _0x2a08c2(_0x6863c5,_0x11fec4){return new window['Promise'](_0x4cc939=>{if(_0x993b85())return _0x4cc939('Valid');_0x33739e(),_0x7e594a['decorate']('_sendUsageRequest');let _0x33b27b=!0x1;const _0x453d42=vt();function _0x575a06(_0x1ce236){return!!_0x1ce236&&('object'==typeof _0x1ce236||'function'==typeof _0x1ce236)&&'function'==typeof _0x1ce236['then']&&'function'==typeof _0x1ce236['catch'];}function _0x2c6830(_0x903648){_0x28eb80(_0x903648)['then'](_0x1a8f2c=>_0x1a8f2c&&'ok'==_0x1a8f2c['status']?_0x52a5af(_0x28074e(_0x453d42+_0x11fec4))!=_0x1a8f2c['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x5efaef=>(_0x2569d3(),_0x5efaef),()=>{const _0x3f84fd=_0x464bd3();return null==_0x3f84fd?(_0x2569d3(),'Valid'):_0xb65156-_0x3f84fd>0x240c8400?'UsageLimit':'Valid';})['then'](_0x4cc939)['catch'](()=>{_0x4cc939('UsageLimit');});const _0x3fc439=0x36ee80;function _0x2569d3(){const _0xf8b445='llct-'+_0x52a5af(_0x28074e(_0x6863c5)),_0x4e21c8=_0x4eb549(_0x52a5af(window['Math']['ceil'](_0xb65156/_0x3fc439)));window['localStorage']['setItem'](_0xf8b445,_0x4e21c8);}function _0x464bd3(){const _0x476a9b='llct-'+_0x52a5af(_0x28074e(_0x6863c5)),_0x54730a=window['localStorage']['getItem'](_0x476a9b);return _0x54730a?window['parseInt'](_0x4eb549(_0x54730a),0x10)*_0x3fc439:null;}function _0x28eb80(_0xe56555){return new window['Promise']((_0x148683,_0xa77c53)=>{_0xe56555['then'](_0x148683,_0xa77c53),window['setTimeout'](_0xa77c53,0x1d4c0);});}}_0x7e594a['on']('_sendUsageRequest',(_0x24ab94,_0x31383a)=>{if(_0x31383a[0x0]!=_0x6863c5)return _0x4cc939('UsageLimit');_0x31383a[0x1]={..._0x31383a[0x1],'requestId':_0x453d42};},{'priority':'high'}),_0x7e594a['on']('_sendUsageRequest',_0x1f44a2=>{_0x575a06(_0x1f44a2['return'])&&(_0x33b27b=!0x0,_0x2c6830(_0x1f44a2['return']));},{'priority':'low'}),_0x29d794['then'](()=>{_0x33b27b||_0x4cc939('UsageLimit');});});function _0x993b85(){return'auto'==_0x7e594a['editing']['view']['_overlayModeHint'];}function _0x33739e(){_0x7e594a['editing']['view']['_overlayModeHint']='auto';}}function _0x2eedb3(_0xe50a3a){const _0x516191=[new window['Promise'](_0x26d821=>setTimeout(_0x26d821,0x93ecc)),_0x29d794['then'](()=>new window['Promise'](_0x1eeca6=>{let _0x4cf947=0x0;_0x7e594a['model']['on']('applyOperation',(_0x53c706,_0x3469a3)=>{_0x3469a3[0x0]['isDocumentOperation']&&_0x4cf947++,0x5e8==_0x4cf947&&(_0x1eeca6(),_0x53c706['off']());});}))];return window['Promise']['race'](_0x516191)['then'](()=>_0xe50a3a);}async function _0x22681d(){await _0x29d794,_0x7e594a['model']['change']=_0x42fd32,_0x7e594a['model']['enqueueChange']=_0x42fd32,_0x7e594a['enableReadOnlyMode']('model');}function _0x4e300e(_0x438e63){const _0x368b86=_0xacd795();_0x7e594a[_0x368b86]='aiLicenseKey'+_0x438e63,'Valid'!=_0x438e63&&_0x22681d();}function _0xacd795(){const _0x405f83=window['String'](window['performance']['now']())['replace']('.','');let _0x531359='n';for(let _0x2529d1=0x0;_0x2529d1<_0x405f83['length'];_0x2529d1+=0x2){let _0x5d3e93=window['parseInt'](_0x405f83['substring'](_0x2529d1,_0x2529d1+0x2));_0x5d3e93>=0x3e&&(_0x5d3e93-=0x3e),_0x531359+=_0x25b69e[_0x5d3e93];}return _0x531359;}function _0x3b55c8(){const _0x178e76=_0x4b28a1['split']('.');if(0x3!=_0x178e76['length'])return null;return _0x154daf(_0x178e76[0x1]);function _0x154daf(_0x8591b4){const _0x36d8d7=_0xa157b1(_0x8591b4);return _0x36d8d7&&_0x460efb()?_0x36d8d7:null;function _0x460efb(){const _0x5bcde4=_0x36d8d7['jti'],_0x48b787=window['parseInt'](_0x5bcde4['substring'](_0x5bcde4['length']-0x8),0x10),_0x14a849={..._0x36d8d7,'jti':_0x5bcde4['substring'](0x0,_0x5bcde4['length']-0x8)};return delete _0x14a849['vc'],_0x28074e(_0x14a849)==_0x48b787;}}}async function _0x41813e(){let _0x4bd6d8=!0x0;try{const [_0x34bcdf,_0x489f2d,_0x2cfda4]=_0x4b28a1['split']('.');return _0xe5ee5a(_0x34bcdf),await _0x298963(_0x34bcdf,_0x489f2d,_0x2cfda4),_0x4bd6d8;}catch{return!0x1;}function _0xe5ee5a(_0x4e3517){const _0x26a513=_0xa157b1(_0x4e3517);_0x26a513&&'ES256'==_0x26a513['alg']||(_0x4bd6d8=!0x1);}async function _0x298963(_0x23d2fa,_0x546595,_0x368edb){const _0x4047ef=window['Uint8Array']['from'](_0x5159f6(_0x368edb),_0x2859c0=>_0x2859c0['charCodeAt'](0x0)),_0x1e5878=new window['TextEncoder']()['encode'](_0x23d2fa+'.'+_0x546595),_0x3dcba9=window['crypto']['subtle'];if(!_0x3dcba9)return;const _0x27a85f=await _0x3dcba9['importKey']('jwk',_0x4f1df3,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x3dcba9['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x27a85f,_0x4047ef,_0x1e5878)||(_0x4bd6d8=!0x1);}}function _0xa157b1(_0x4183d8){return _0x4183d8['startsWith']('ey')?JSON['parse'](_0x5159f6(_0x4183d8)):null;}function _0x5159f6(_0x450034){return window['atob'](_0x450034['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x28074e(_0x4940a2){let _0x4d97fc=0x1505;function _0x2ce3ba(_0x355a9d){for(let _0x388637=0x0;_0x388637<_0x355a9d['length'];_0x388637++){const _0x1f16c3=_0x355a9d['charCodeAt'](_0x388637);_0x4d97fc=(_0x4d97fc<<0x5)+_0x4d97fc+_0x1f16c3,_0x4d97fc&=_0x4d97fc;}}function _0x47f261(_0x60b1e1){Array['isArray'](_0x60b1e1)?_0x60b1e1['forEach'](_0x47f261):_0x60b1e1&&'object'==typeof _0x60b1e1?Object['entries'](_0x60b1e1)['sort']()['forEach'](([_0x3235ea,_0x427a92])=>{_0x2ce3ba(_0x3235ea),_0x47f261(_0x427a92);}):_0x2ce3ba(window['String'](_0x60b1e1));}return _0x47f261(_0x4940a2),_0x4d97fc>>>0x0;}function _0x52a5af(_0x510c3a){return _0x510c3a['toString'](0x10)['padStart'](0x8,'0');}function _0x4eb549(_0x427066){return _0x427066['split']('')['reverse']()['join']('');}function _0x42fd32(){}_0x4e300e(await _0x2143d6());}(this);}['showFakeVisualSelection'](){const _0x5b30fa=this['editor']['model'];_0x5b30fa['change'](_0x576df0=>{const _0x4edcc4=_0x5b30fa['document']['selection']['getRanges']();let _0x3ab6e5=0x0;for(const _0x365766 of _0x4edcc4){const _0x435be9=Ri+':'+_0x3ab6e5;if(_0x5b30fa['markers']['has'](_0x435be9))_0x576df0['updateMarker'](_0x435be9,{'range':_0x365766});else{if(_0x365766['start']['isAtEnd']){const _0x4b1bc4=_0x365766['start']['getLastMatchingPosition'](({item:_0x41d8a5})=>!_0x5b30fa['schema']['isContent'](_0x41d8a5),{'boundaries':_0x365766});_0x576df0['addMarker'](_0x435be9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x576df0['createRange'](_0x4b1bc4,_0x365766['end'])});}else _0x576df0['addMarker'](_0x435be9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x365766});}_0x3ab6e5++;}});}['hideFakeVisualSelection'](){const _0x4a0529=this['editor']['model'],_0x29db5c=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x29db5c['length']&&_0x4a0529['change'](_0x539bc4=>{_0x29db5c['forEach'](_0x43ff2b=>{_0x539bc4['removeMarker'](_0x43ff2b);});});}['insertContent'](_0x5b152a,_0x32edee){const _0x458276=this['_getAISelection'](),_0x9e683c=_0x32edee||_0x458276['getFirstRange']();this['editor']['model']['canEditAt'](_0x9e683c)&&this['editor']['model']['change'](_0x5122c8=>{this['hideFakeVisualSelection'](),_0x32edee||this['_resetContentOfSelectedTableCells'](_0x5122c8,_0x458276),this['_pasteHTMLUsingClipboard']({'insertAt':_0x9e683c,'writer':_0x5122c8,'html':_0x5b152a});});}['insertContentBelow'](_0x4e92fe){const {model:_0x138286}=this['editor'],_0x42257d=this['_getAISelection']();_0x138286['change'](()=>{const _0x4d1e33=this['_prepareTableInsertBelowPosition'](_0x4e92fe,_0x42257d)||this['_getDefaultInsertBelowPosition'](_0x42257d);this['insertContent'](_0x4e92fe,_0x4d1e33);});}['_getAISelection'](){const _0x41e96f=this['editor']['model'],_0x551d11=Array['from'](_0x41e96f['markers']['getMarkersGroup'](Ri))['map'](_0x18ac7e=>_0x18ac7e['getRange']());return _0x41e96f['createSelection'](_0x551d11);}['_pasteHTMLUsingClipboard']({writer:_0x24fc19,html:_0x1d7808,insertAt:_0x4013b7}){const {view:_0x493a4e}=this['editor']['editing'],_0x1f92ea=this['editor']['plugins']['get'](_0x47d931),_0x29cf0b=new Si();_0x29cf0b['setData']('text/html',_0x1d7808);const _0x580c0a=new _0x3b74eb(_0x493a4e,new ClipboardEvent('paste',{'clipboardData':_0x29cf0b}),{'dataTransfer':new _0x51fa45(_0x29cf0b)});_0x24fc19['setSelection'](_0x4013b7);const _0x4102fc=(_0x34e142,_0x42a890)=>{_0x42a890['resultRange']&&_0x24fc19['setSelection'](_0x42a890['resultRange']);};_0x1f92ea['once']('contentInsertion',_0x4102fc,{'priority':'lowest'}),_0x493a4e['document']['fire']('paste',_0x580c0a),_0x1f92ea['off']('contentInsertion',_0x4102fc);}['_getDefaultInsertBelowPosition'](_0x494ba0){const {model:_0x3d81cd}=this['editor'],_0x445aa4=Array['from'](_0x494ba0['getSelectedBlocks']());return _0x445aa4['length']?_0x3d81cd['createPositionAfter'](_0x445aa4['pop']()):_0x494ba0['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x54c949,_0x49eb7c){const {model:_0x5b49bd,plugins:_0x134066}=this['editor'];if(_0x134066['has']('TableUtils')){const _0x15b440=_0x134066['get']('TableUtils')['getSelectedTableCells'](_0x49eb7c);if(_0x15b440['length']){const _0x502260=this['_getTableRowCountFromContent'](_0x54c949),_0x5eba49=this['_createEmptyTableRows'](_0x15b440,_0x502260);return _0x5b49bd['createPositionAt'](_0x5eba49,0x0);}}return null;}['_getTableRowCountFromContent'](_0x4ab934){const _0x4e4eea=this['editor']['plugins']['get']('TableUtils'),_0x22e678=this['editor']['data']['parse'](_0x4ab934,'$documentFragment'),_0x576937=Array['from'](_0x22e678['getChildren']())['filter'](_0x3b874c=>_0x3b874c['is']('element','table'));let _0xa3194b=0x0;return _0x576937['forEach'](_0x5d7201=>{_0xa3194b+=_0x4e4eea['getRows'](_0x5d7201);}),_0xa3194b;}['_createEmptyTableRows'](_0x5bf8b7,_0x3d426e){const _0x447a65=this['editor']['plugins']['get']('TableUtils'),_0x16f1d0=_0x447a65['getRowIndexes'](_0x5bf8b7),_0x21a7b6=_0x447a65['getColumnIndexes'](_0x5bf8b7),_0x48178d=_0x16f1d0['last']+0x1,_0x2acaee=_0x21a7b6['first'],_0xdebdc7=_0x5bf8b7[0x0]['findAncestor']('table');for(let _0x2b3ca4=0x0;_0x2b3ca4<_0x3d426e;_0x2b3ca4++)_0x447a65['insertRows'](_0xdebdc7,{'at':_0x48178d});return _0xdebdc7['getChild'](_0x48178d)['getChild'](_0x2acaee);}['_resetContentOfSelectedTableCells'](_0x34804a,_0x3de981){const {plugins:_0x57659c}=this['editor'],{model:_0x1f1b3f}=_0x34804a;_0x57659c['has']('TableUtils')&&_0x57659c['get']('TableUtils')['getSelectedTableCells'](_0x3de981)['length']&&_0x1f1b3f['deleteContent'](_0x3de981);}},vi=class extends _0x2965bd{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}},ki=class extends Error{constructor(_0x2a7335){super(_0x2a7335),this['name']='AIRequestError';}};function Ni(_0x44177d,_0x13061f,_0x33dd50){const t=_0x44177d['t'];switch(_0x13061f){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',_0x33dd50);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x33dd50);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'},_0x33dd50);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 _0x13061f;}}var yi=class extends _0x3738d1{['_commandDefinitions'];constructor(_0x51d75e,_0x47d6b5){super(_0x51d75e),this['_commandDefinitions']=_0x47d6b5,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x46d412,_0x4d7131,_0x5a40ac)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0x5a40ac));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x39de14,_0x38ff42,_0x5c2932)=>{this['enabledCommandsIds']=_0x5c2932?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x5db67c=this['editor']['model'];this['_hasContext']=function(_0xc8210f){const _0x5e09c5=_0xc8210f['document']['selection'];return _0x5e09c5['isCollapsed']?0x0!==[..._0x5e09c5['getSelectedBlocks']()]['length']&&![..._0x5e09c5['getSelectedBlocks']()][0x0]['isEmpty']:!!_0xc8210f['hasContent'](_0x5e09c5['getFirstRange']());}(_0x5db67c);const _0x4a039a=_0x5db67c['document']['selection'],_0x378f63=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x10579b of _0x4a039a['getRanges']())for(const _0x443c59 of _0x10579b['getItems']())if(_0x443c59['is']('element')&&_0x378f63['includes'](_0x443c59['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x500f65='',_0x2da993='',_0x2463a7='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x500f65,_0x2da993,_0x2463a7);}};function xi(_0x135e9a,_0x3822f4){const _0x12cb45=new Set();for(const _0x33a066 of _0x135e9a['values']())(_0x3822f4||!0x1===_0x33a066['requiresContent'])&&_0x12cb45['add'](_0x33a066['id']);return Array['from'](_0x12cb45);}const Li=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Di=/* #__PURE__ -- @preserve */
24
- gt();var Pi=class extends Di{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x4918bf,_0x460d4c,_0x58824a){super(),this['editor']=_0x4918bf,this['textAdapter']=_0x460d4c,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x58824a,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x2e11cd,_0x5696da,_0x32b8ca)=>{this['view']['value']=this['_sanitizeHTML'](_0x32b8ca);}),this['listenTo'](this['view'],'submitPrompt',(_0x5f0e47,_0x2a948b)=>{const _0x1a84ff=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x2a948b,_0x1a84ff,'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:_0x1ea6a4,query:_0x524c3d,htmlContent:_0x5f4061,label:_0x4477e0,mainActionLabel:_0x325ed4}){this['view']['prompt']=_0x4477e0,this['view']['mainAction']=_0x325ed4,this['initialContext']=_0x5f4061,_0x524c3d&&(this['view']['isRendered']?this['_handleQuery'](_0x524c3d,_0x5f4061,_0x1ea6a4,_0x4477e0):this['view']['once']('render',()=>{this['_handleQuery'](_0x524c3d,_0x5f4061,_0x1ea6a4,_0x4477e0);}));}['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'](_0x33aef1,_0x2a11d3,_0x52a178,_0x1af54a){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x2a11d3,this['previousQuery']=_0x33aef1,this['previousLabel']=_0x1af54a||_0x33aef1,this['previousActionId']=_0x52a178,new Promise(_0x552fe9=>{this['textAdapter']['makeRequest']({'query':_0x33aef1,'context':_0x2a11d3,'onData':_0x51fbab=>{this['currentResponse']=_0x51fbab,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x52a178})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1d42d6=>{_0x1d42d6 instanceof ki?this['view']['handleError'](_0x1d42d6['message']):this['view']['handleError'](),_0x552fe9();})['finally'](()=>{this['stopProcessing'](),_0x552fe9();});});}['_parseAndNormalizeContent'](_0xcc6bba,_0x555657=!0x1){const _0x51a7dd=Li['exec'](_0xcc6bba);_0xcc6bba=_0x51a7dd?_0xcc6bba['substring'](_0x51a7dd[0x1]['length']):_0xcc6bba['length']<0x64&&!_0x555657?'':this['_stripMarkdownSyntax'](_0xcc6bba);const _0x735cdc=this['_domParser']['parseFromString'](_0xcc6bba,'text/html');if(_0x51a7dd){const _0x21054a=Array['from'](_0x735cdc['body']['childNodes']);_0x21054a['reverse']();for(const _0x33ee9f of _0x21054a){if(_0x33ee9f['nodeType']==Node['ELEMENT_NODE'])break;_0x33ee9f['remove']();}}const _0x53b34c=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x735cdc['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x53b34c);const _0x4ee040=this['editor']['config']['get']('ai.assistant.preserveComments'),_0xf73903=this['editor']['data']['toModel'](_0x53b34c);return _0x4ee040||_0xf73903['markers']['clear'](),this['editor']['data']['stringify'](_0xf73903);}['_normalizeResponseHeadings'](_0x4251d3){const _0x258d1f=new _0x2b52c7(this['editor']['editing']['view']['document']),_0x1f2775=new _0x4018c2({'name':/^h[1-5]$/}),_0x2d0f7a=[];let _0x28048a=!0x1;for(const _0x130ce8 of _0x4251d3)_0x130ce8['is']('element')&&_0x1f2775['match'](_0x130ce8)&&(_0x2d0f7a['push'](_0x130ce8),'h1'==_0x130ce8['name']&&(_0x28048a=!0x0));if(_0x28048a){for(const _0x1885c1 of _0x2d0f7a)_0x258d1f['rename']('h'+(parseInt(_0x1885c1['name'][0x1])+0x1),_0x1885c1);}}['_isH1TagSupportEnabled'](){const {data:_0x344303,editing:_0x4c2758}=this['editor'],_0x234baa=_0x344303['htmlProcessor']['toView']('<h1></h1>'),_0x2c9e73=_0x344303['toView'](_0x344303['toModel'](_0x234baa));return!!_0x4c2758['view']['domConverter']['viewToDom'](_0x2c9e73)['querySelector']('h1');}['_sanitizeHTML'](_0x38deb3){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x38deb3),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x12df94){const _0x3a3378=_0x12df94['trim']();return _0x3a3378['startsWith']('```html')?_0x3a3378['endsWith']('```')?_0x3a3378['substring'](0x7,_0x3a3378['length']-0x3):_0x3a3378['substring'](0x7):_0x12df94;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x11c4f1{constructor(_0x55536b){super(_0x55536b),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x22a846=>Ni(_0x55536b,'AI_'+_0x22a846['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x55536b,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x55536b,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x55536b,'Stop'));const _0x5ec08d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x5ec08d['if']('isVisible','ck-hidden',_0x5093ee=>!_0x5093ee)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x49091a,_0x29d814){const _0x3ac96a=new Ht(this['locale']);return _0x3ac96a['set']({'label':_0x49091a,'class':_0x29d814||'','isVisible':!0x0,'withText':!0x0}),_0x3ac96a;}},Vi=class extends _0x5d2282{['contentFieldView'];['copyButtonView'];constructor(_0x1f4bce,_0x5e7075=''){super(_0x1f4bce),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x524c56=this['bindTemplate'];this['contentFieldView']=new Ui(_0x1f4bce,_0x5e7075),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x524c56['if']('isVisible','ck-hidden',_0x175a07=>!_0x175a07)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x524c56['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 _0x3c2826=!0x1;this['on']('change:value',(_0x245666,_0x51f47f,_0x19db17)=>{const _0x1cec5b=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x19db17),this['isProcessing']&&_0x1cec5b&&!_0x3c2826&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5ea51e,_0x21248d,_0x4a9c1c)=>{_0x3c2826=!0x1,_0x4a9c1c?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x3c2826=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x3c2826=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x53e15f=this['locale'],_0x4322db=new Ht(this['locale']),_0x38e992='ck-ai-form__copy-button';return _0x4322db['set']({'label':Ni(_0x53e15f,'Copy'),'icon':_0x2d4376,'class':_0x38e992,'tooltip':!0x0}),_0x4322db['bind']('isVisible')['to'](this,'value',_0x31daf8=>!!_0x31daf8),_0x4322db['bind']('isEnabled')['to'](this,'isProcessing',_0x2b3d31=>!_0x2b3d31),_0x4322db['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x4322db['icon']=_0x4bf74a,_0x4322db['class']=_0x38e992+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x4322db['icon']=_0x2d4376,_0x4322db['class']=_0x38e992;},0x3e8);}),_0x4322db;}['_copyHTMLToClipboard'](_0x51107c){const {window:_0x45110b,document:_0x145fc0}=Tt;if(_0x45110b['ClipboardItem']){const {Blob:_0x4a6ad4,ClipboardItem:_0x2b3489}=_0x45110b,_0x353ede=[new _0x2b3489({'text/html':new _0x4a6ad4([_0x51107c['innerHTML']],{'type':'text/html'}),'text/plain':new _0x4a6ad4([_0x51107c['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x353ede);}else{const _0x57644b=_0x145fc0['createElement']('div');_0x57644b['style']['position']='absolute',_0x57644b['style']['left']='-9999px',_0x57644b['innerHTML']='<span>[</span>'+_0x51107c['innerHTML']+'<span>]</span>',_0x145fc0['body']['appendChild'](_0x57644b);const _0x3c9f37=_0x145fc0['createRange']();_0x3c9f37['setStartAfter'](_0x57644b['firstElementChild']),_0x3c9f37['setEndBefore'](_0x57644b['lastElementChild']);const _0x410548=_0x45110b['getSelection']();_0x410548['removeAllRanges'](),_0x410548['addRange'](_0x3c9f37),_0x145fc0['execCommand']('copy'),_0x57644b['remove']();}}},Ui=class extends _0x5d2282{constructor(_0x59645d,_0x3434bc=''){super(_0x59645d),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x3434bc,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1ef4c7){this['element']['innerHTML']=_0x1ef4c7;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x508a85=new _0x5d2282(),_0x295371=this['locale'],_0x13b987=new _0x421451();return _0x13b987['isVisible']=!0x0,_0x508a85['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x13b987,{'text':Ni(_0x295371,'AI\x20is\x20writing...')}]}),_0x508a85['render'](),_0x508a85;}},Bi=class extends _0x5d2282{constructor(_0x2490aa,_0x4a6271=''){super(_0x2490aa);const _0x5c015e=new Yt(),_0xbc63df=this['bindTemplate'];this['set']('text',_0x4a6271),_0x5c015e['content']=_0x4eead5,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5c015e,{'text':_0xbc63df['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x588db2,_0x3e58b3){super(_0x588db2,_0x3e58b3),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',(_0x44b63b,_0x2cc532)=>{_0x44b63b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2cc532());});}['_createSubmitButton'](){const _0x4145e2=new Ht(this['locale']),_0x1abafc=this['locale'];return _0x4145e2['set']({'icon':st,'label':Ni(_0x1abafc,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x4145e2['on']('execute',()=>{this['submit']();}),_0x4145e2['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x431be1,_0xacce7d)=>!_0x431be1&&_0xacce7d),_0x4145e2;}['_createShowHistoryButton'](){const _0x137c3a=new Ht(this['locale']),_0x3f55f4=this['resultsView'],_0xdcf10=this['locale'];_0x137c3a['set']({'label':Ni(_0xdcf10,'History'),'withText':!0x1,'icon':_0x3b7460,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x137c3a['bind']('isOn')['to'](_0x3f55f4,'isVisible'),_0x137c3a['bind']('isEnabled')['to'](this,'isEnabled'),_0x137c3a['on']('execute',()=>{_0x3f55f4['isVisible']=!_0x3f55f4['isVisible'],_0x3f55f4['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x354b17=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x418360=new At(this['queryView']['fieldView']['element']),_0x1d4291=_0x418360['width'],_0x58a7b2='rtl'===_0xdcf10['uiLanguageDirection']?'left':'right';_0x418360['excludeScrollbarsAndBorders'](),_0x137c3a['element']['style'][_0x58a7b2]=_0x1d4291-_0x418360['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x354b17),this['on']('render',_0x354b17),_0x137c3a;}['submit'](){const _0x11f332=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x11f332);}['focus'](_0x1bf385){-0x1===_0x1bf385?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x4afe07){super(_0x4afe07),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x4afe07,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x10a679=0x0;for(const _0xe8f09e of this['items'])_0x10a679+=_0xe8f09e['items']['length'];return{'resultsCount':_0x10a679,'totalItemsCount':_0x10a679};}['_createClearHistoryButton'](){const _0x348a97=this['locale'],_0x19ba1c=new Ht(this['locale']);return _0x19ba1c['set']({'label':'('+Ni(_0x348a97,'Clear')+')','withText':!0x0}),_0x19ba1c['on']('execute',()=>this['fire']('clearHistory')),_0x19ba1c;}},Ki=class extends zt{constructor(_0x333e1d){super();const _0x4ce65c=new Dt(),_0x1be61e=new Ht(this['locale'],_0x4ce65c);this['children']['add'](_0x1be61e),_0x1be61e['set']({'label':_0x333e1d['prompt'],'withText':!0x0}),_0x1be61e['on']('execute',()=>{this['fire']('execute',{'value':_0x5e9ba5(_0x333e1d['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x5cfa4e,_0x3ed87d)=>{const _0x37c91a=$i(_0x3ed87d['prompt']);for(const _0x2399e0 of this)if(_0x2399e0!=_0x3ed87d&&$i(_0x2399e0['prompt'])===_0x37c91a){this['remove'](_0x2399e0);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x4df2e0=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x4df2e0));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x79cfa6=>_0x79cfa6)));}};function $i(_0x1c9206){return _0x1c9206['toLowerCase']()['trim']();}var qi=class extends _0x5d2282{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x49f686,_0x4171e7,_0x35c655=''){super(_0x49f686),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Hi['REPLACE']),this['_promptHistory']=new Yi(),this['errorView']=new Bi(_0x49f686),this['contentArea']=new Vi(_0x49f686,_0x35c655),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 dt(),this['keystrokes']=new _t(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Gt({'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 _0x1656d8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x4171e7],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x1656d8['if']('isError','ck-hidden',_0xf7529b=>!_0xf7529b)]},'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'](_0x3c419f=0x1){-0x1===_0x3c419f?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 _0xc7725e=this['locale'],_0x50c106=new Gi(_0xc7725e,{'queryView':{'label':Ni(_0xc7725e,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x32d936,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0xc7725e,'Empty\x20history'),'secondary':Ni(_0xc7725e,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x50c106['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x44b36b,_0x45f702)=>_0x44b36b&&!_0x45f702),this['listenTo'](_0x50c106,'submit',(_0x3fddcf,_0x112824)=>{this['prompt']=_0x112824;const _0x141a65=_0x4495a6(_0x112824);this['fire']('submitPrompt',_0x141a65),_0x112824['trim']()&&this['_promptHistory']['add']({'prompt':_0x141a65},0x0);},{'priority':'high'}),_0x50c106;}['_createHistoryView'](){const _0x47eb19=new Fi(this['locale']);return _0x47eb19['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x47eb19['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x47eb19;}['_createToolbar'](){const _0x5664b5=new Mi(this['locale']);return _0x5664b5['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x59a513,_0x1de780,_0x1239a2)=>_0x59a513&&!_0x1de780&&!!_0x1239a2),_0x5664b5['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x5664b5['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4d9d51,_0x53899d,_0xf3c618)=>_0x4d9d51&&!_0x53899d&&!!_0xf3c618),_0x5664b5['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x5664b5['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x423abe,_0x170dfe)=>_0x423abe&&!_0x170dfe),_0x5664b5['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x5664b5['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x5664b5['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x5664b5;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x757b26=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x757b26,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x121e64){const _0x1d3f9e=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x121e64||Ni(_0x1d3f9e,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x2965bd{['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[_0x352a3a,Oi,vi,Mt];}constructor(_0x4aac8b){super(_0x4aac8b),_0x4aac8b['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x4aac8b['config']['define']('ai.assistant.contentAreaCssClass',''),_0x4aac8b['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x4aac8b['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x1eb080}=this;this['_aiAdapter']=_0x1eb080['plugins']['get'](vi),this['_dialog']=_0x1eb080['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x45015e=new yi(_0x1eb080,Array['from'](this['_commandDefinitions']['values']()));_0x1eb080['commands']['add']('showAIAssistant',_0x45015e),_0x1eb080['ui']['componentFactory']['add']('aiCommands',_0x4454ec=>{const _0x2669c7=_0x2959da(_0x4454ec);return _0x2669c7['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x2669c7['buttonView']['set']({'label':Ni(_0x4454ec,'AI\x20Commands'),'icon':_0x54ec46,'tooltip':!0x0}),_0x2669c7['on']('execute',_0x3ee3cd=>this['_onExecute'](_0x3ee3cd['source']['id'])),_0x301d52(_0x2669c7,_0x1eb080['ui']['view']['body'],function(_0x5f5209){const _0x9ae7fa=ji(_0x5f5209,bi(_0x5f5209['config']['get']('ai.assistant.commands'),_0x5f5209['locale']))['filter'](_0x5801c9=>_0x5801c9['commands']['length']);return 0x1===_0x9ae7fa['length']?ji(_0x5f5209,_0x9ae7fa[0x0]['commands'])['map'](_0x107e46=>({'id':_0x107e46['id'],'label':_0x107e46['label']})):_0x9ae7fa['map'](_0x2dc6a8=>{const {groupId:_0x4ace87,groupLabel:_0x156bcc,commands:_0x27c127}=_0x2dc6a8,_0x19fe81=ji(_0x5f5209,_0x27c127)['map'](_0x4d3189=>({'id':_0x4d3189['id'],'label':_0x4d3189['label']}));return{'id':_0x4ace87,'menu':_0x156bcc||_0x4ace87,'children':_0x19fe81};});}(_0x1eb080),{'ariaLabel':Ni(_0x4454ec,'AI\x20Commands')}),_0x2669c7['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x45015e['on']('change:enabledCommandsIds',_0x2f1bbf),_0x2669c7['menuView']['once']('render',_0x2f1bbf),_0x2669c7;function _0x2f1bbf(){_0x2669c7['isEnabled']=_0x45015e['enabledCommandsIds']['length']>0x0;for(const _0x423ead of _0x2669c7['menuView']['buttons'])_0x423ead['isEnabled']=_0x45015e['enabledCommandsIds']['includes'](_0x423ead['id']);}}),_0x1eb080['ui']['componentFactory']['add']('menuBar:aiCommands',_0x3a423e=>{const _0x490a37=new _0x31c0cc(_0x3a423e);_0x490a37['buttonView']['set']({'label':Ni(_0x3a423e,'AI\x20Commands'),'icon':_0x54ec46}),_0x490a37['bind']('isEnabled')['to'](_0x45015e,'enabledCommandsIds',_0xc26b24=>_0xc26b24['length']>0x0);const _0xff210a=bi(_0x1eb080['config']['get']('ai.assistant.commands'),_0x3a423e);return this['_populateMenuBarMenu'](_0x45015e,_0x490a37,_0xff210a,_0x499cfe=>this['_onExecute'](_0x499cfe)),_0x490a37;}),_0x1eb080['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x2a4775=this['_createAIAssistantUIButton'](Ht);return _0x2a4775['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x2a4775;}),_0x1eb080['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x28a50c=this['_createAIAssistantUIButton'](Jt);return _0x28a50c['set']({'role':'menuitemcheckbox'}),_0x28a50c;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x5df70c=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x594d9e;for(const _0x586391 in _0x5df70c){const _0x4903f4=_0x586391,_0x50567a=_0x5df70c[_0x4903f4];if('aiLicenseKeyValid'==_0x50567a||'aiLicenseKeyInvalid'==_0x50567a||'aiLicenseKeyExpired'==_0x50567a||'aiLicenseKeyDomainLimit'==_0x50567a||'aiLicenseKeyNotAllowed'==_0x50567a||'aiLicenseKeyEvaluationLimit'==_0x50567a||'aiLicenseKeyUsageLimit'==_0x50567a){delete _0x5df70c[_0x4903f4],_0x594d9e=_0x50567a,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x594d9e&&_0x5df70c['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x594d9e&&_0x5df70c['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x594d9e&&_0x5df70c['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x594d9e&&_0x5df70c['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x594d9e&&_0x5df70c['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x594d9e&&_0x5df70c['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x47d8c5='',_0x5b0b6e='',_0x461944='custom'){const _0x5cef46=this['editor'],_0x19a4ee=_0x5cef46['editing']['view'],_0x43da66=_0x5cef46['plugins']['get'](Oi),_0x24138f=_0x5cef46['plugins']['get'](_0x352a3a);_0x43da66['showFakeVisualSelection']();const _0x3773ca=new Qi(),_0x5b5ff2=new ClipboardEvent('copy',{'clipboardData':_0x3773ca}),_0x5c2329=new _0x51fa45(_0x3773ca),_0x409fe4=new _0x3b74eb(_0x19a4ee,_0x5b5ff2,{'dataTransfer':_0x5c2329});_0x24138f['_forceMarkersCopy']('comment',()=>{_0x19a4ee['document']['fire']('copy',_0x409fe4);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x5cef46,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x5c0114=_0x5c2329['getData']('text/html');const _0xbd460=_0x5cef46['model']['document']['selection'],_0xf56c2a=Array['from'](_0xbd460['getRanges']());0x1===_0xf56c2a['length']&&_0xf56c2a[0x0]['isFlat']&&!_0xbd460['getSelectedElement']()&&''!==_0x5c0114['replace'](/&nbsp;/g,'')['trim']()&&(_0x5c0114='<p>'+_0x5c0114+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x461944,'query':_0x47d8c5,'htmlContent':_0x5c0114,'label':_0x5b0b6e,'mainActionLabel':Hi[_0x5cef46['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x467662,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x43da66['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x24c249=new Map(),_0x113007=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0xae9e4b of _0x113007)for(const _0x5f1999 of _0xae9e4b['commands'])_0x24c249['set'](_0x5f1999['id'],{..._0x5f1999,'groupId':_0xae9e4b['groupId'],'groupLabel':_0xae9e4b['groupLabel']||_0xae9e4b['groupId']});return _0x24c249;}['_createAIAssistantUIButton'](_0x377d25){const _0xbb656f=this['editor'],_0x506afb=_0xbb656f['commands']['get']('showAIAssistant'),_0x5370cb=new _0x377d25(_0xbb656f['locale']);return _0x5370cb['set']({'label':Ni(_0xbb656f['locale'],'AI\x20Assistant'),'icon':_0x467662,'isToggleable':!0x0}),_0x5370cb['bind']('isEnabled')['to'](_0x506afb),_0x5370cb['bind']('isOn')['to'](this['_dialog'],'id',_0x4c5c5d=>'aiAssistant'===_0x4c5c5d),this['listenTo'](_0x5370cb,'execute',()=>{_0x5370cb['isOn']?this['hideUI']():_0x506afb['execute']();}),_0x5370cb;}['_initView'](){const _0x1281bb=this['editor']['plugins']['get'](Oi);this['_formView']=new qi(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',()=>{_0x1281bb['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x1281bb['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x25ce54,ui:{ariaLiveAnnouncer:_0x27b63c}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x586618,_0xefa5e9,_0x425894)=>{const _0x89faa7=this['_aiAssistantController']['currentContext'];_0x425894?_0x27b63c['announce'](Ni(_0x25ce54,'AI\x20is\x20writing')):_0x89faa7&&_0x27b63c['announce'](Ni(_0x25ce54,'Generated\x20content:\x20%0',_0x89faa7),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x33dc54,_0x4e95b8,_0x4c4297)=>{if(_0x4c4297){const _0x3709d0=this['_formView']['errorView']['text'];_0x27b63c['announce'](Ni(_0x25ce54,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3709d0));}});}['_onExecute'](_0x5d76d9){const _0x112813=this['_commandDefinitions']['get'](_0x5d76d9),_0x1d12ed=this['editor'],_0x3143dd=_0x1d12ed['model']['document']['selection'],_0x27b570=_0x1d12ed['commands']['get']('showAIAssistant'),_0x20100a=_0x1d12ed['plugins']['get'](Oi),_0x1d7884=''+('_ungrouppedCommands'!==_0x112813['groupId']?_0x112813['groupLabel']+':\x20':'')+_0x112813['label'];if(!0x1!==_0x112813['requiresContent']&&_0x3143dd['isCollapsed']){const _0x312fed=mt(_0x3143dd['getSelectedBlocks']())||_0x1d12ed['model']['schema']['getLimitElement'](_0x3143dd);_0x1d12ed['model']['change'](_0x110a1a=>{_0x110a1a['setSelection'](_0x312fed,'in');});}_0x20100a['showFakeVisualSelection'](),_0x27b570['execute'](_0x112813['prompt'],_0x1d7884,'command:'+_0x5d76d9);}['_populateMenuBarMenu'](_0x3f0ebf,_0x3cd349,_0x204f04,_0x2922ce){const _0x323183=this['editor'],_0xe76511=_0x323183['locale'],_0x30b4bb=new te(_0xe76511),_0x801f58=ji(_0x323183,_0x204f04)['filter'](_0x11ef3b=>_0x11ef3b['commands']['length']);0x1===_0x801f58['length']?this['_getMenuBarGroupButtons']({'command':_0x3f0ebf,'commands':_0x801f58[0x0]['commands'],'parentMenuView':_0x3cd349,'onExecute':_0x2922ce})['forEach'](_0x2adff7=>_0x30b4bb['items']['add'](_0x2adff7)):_0x801f58['forEach'](({groupId:_0x2209a7,groupLabel:_0x47ab7d,commands:_0x3fb654})=>{const _0x154a60=new Zt(_0xe76511,_0x3cd349),_0x2a1db9=new _0x31c0cc(_0xe76511),_0x4547f1=new te(_0xe76511),_0x4baa02=this['_getMenuBarGroupButtons']({'command':_0x3f0ebf,'commands':_0x3fb654,'parentMenuView':_0x2a1db9,'onExecute':_0x2922ce});_0x2a1db9['buttonView']['set']({'label':_0x47ab7d||_0x2209a7}),_0x2a1db9['delegate']('execute')['to'](_0x3cd349),_0x4547f1['items']['addMany'](_0x4baa02),_0x2a1db9['panelView']['children']['add'](_0x4547f1),_0x154a60['children']['add'](_0x2a1db9),_0x30b4bb['items']['add'](_0x154a60);}),_0x3cd349['panelView']['children']['add'](_0x30b4bb);}['_getMenuBarGroupButtons']({command:_0x5cc63f,commands:_0x26d085,parentMenuView:_0x27e888,onExecute:_0x1ff7c6}){const _0x2f1fe2=this['editor'],_0x2718af=_0x2f1fe2['locale'];return ji(_0x2f1fe2,_0x26d085)['map'](_0x42f364=>{const _0x21b150=new Zt(_0x2718af,_0x27e888),_0x3b5878=new Jt(_0x2718af);return _0x3b5878['set']({'label':_0x42f364['label']}),_0x3b5878['delegate']('execute')['to'](_0x27e888),_0x3b5878['on']('execute',()=>_0x1ff7c6(_0x42f364['id'])),_0x3b5878['bind']('isEnabled')['to'](_0x5cc63f,'enabledCommandsIds',_0x6f4a64=>_0x6f4a64['includes'](_0x42f364['id'])),_0x21b150['children']['add'](_0x3b5878),_0x21b150;});}};function zi(_0x4ac553,_0x594822){return void 0x0!==_0x4ac553['order']&&void 0x0===_0x594822['order']?0x1:void 0x0===_0x4ac553['order']&&void 0x0!==_0x594822['order']?-0x1:void 0x0!==_0x4ac553['order']&&void 0x0!==_0x594822['order']?_0x4ac553['order']-_0x594822['order']:0x0;}function ji(_0x357e95,_0x3f91a2){_0x3f91a2['sort'](zi);const _0xd9c273={},_0x52f684=[];for(const _0x25956d of _0x3f91a2)if(void 0x0!==_0x25956d['order']){if(_0x25956d['order']in _0xd9c273)throw new ht('ai-commands-config-order-collision',_0x357e95,{'conflictingDefinitions':[_0x25956d,_0xd9c273[_0x25956d['order']]]});_0xd9c273[_0x25956d['order']]=_0x25956d,_0x52f684['splice'](_0x25956d['order'],0x0,_0x25956d);}else _0x52f684['push'](_0x25956d);return _0x52f684;}var Ji=class extends _0x2965bd{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x429961){super(_0x429961);const _0x1fa261=_0x429961['config'],_0x3aeacd=_0x429961['locale'];_0x1fa261['define']('ai.assistant.preserveComments',!0x0),_0x1fa261['define']('ai.assistant.commands',Zi(_0x3aeacd)),_0x1fa261['define']('ai.assistant.extraCommandGroups',[]),_0x1fa261['define']('ai.assistant.removeCommands',[]);let _0x30df23=bi(_0x1fa261['get']('ai.assistant.commands'),_0x3aeacd);const _0x5eeeb2=_0x1fa261['get']('ai.assistant.extraCommandGroups'),_0x1fe641=_0x1fa261['get']('ai.assistant.removeCommands');_0x5eeeb2['forEach'](_0x311499=>{const _0x4f9150=_0x30df23['find'](_0x468dad=>_0x468dad['groupId']===_0x311499['groupId']);_0x4f9150?_0x4f9150['commands']=_0x4f9150['commands']['concat'](_0x311499['commands']):_0x30df23['push'](_0x311499);}),_0x30df23=_0x30df23['filter'](_0xc19abb=>!_0x1fe641['includes'](_0xc19abb['groupId'])),_0x30df23['forEach'](_0x4cce0f=>{_0x4cce0f['commands']=_0x4cce0f['commands']['filter'](_0x17b6b6=>!_0x1fe641['includes'](_0x17b6b6['id']));}),_0x1fa261['set']('ai.assistant.commands',_0x30df23);}};function Zi(_0xea2021){return[{'groupId':'editOrReview','groupLabel':Ni(_0xea2021,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0xea2021,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0xea2021,'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':Ni(_0xea2021,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0xea2021,'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':Ni(_0xea2021,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0xea2021,'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':Ni(_0xea2021,'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':Ni(_0xea2021,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0xea2021,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0xea2021,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0xea2021,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0xea2021,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0xea2021,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0xea2021,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0xea2021,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0xea2021,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0xea2021,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0xea2021,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0xea2021,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0xea2021,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0xea2021,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0xea2021,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0xea2021,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0xea2021,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0xea2021,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0xea2021,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0xea2021,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x2965bd{['abortController'];static get['requires'](){return[vi];}constructor(_0x3f5e7e){super(_0x3f5e7e),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](vi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x345603){return this['sendRequest'](_0x345603)['catch'](_0x2042a5=>{if(_0x2042a5 instanceof ki)return Promise['reject'](_0x2042a5);if('AbortError'==_0x2042a5['name'])return Promise['resolve']();throw console['error'](_0x2042a5),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x2f99cf,_0x32c4b0){const _0x20ecd2=this['editor']['locale'],_0x22e474={'Content-Type':'application/json'};if('object'==typeof _0x2f99cf)Object['assign'](_0x22e474,_0x2f99cf);else{if(_0x2f99cf)try{const _0x4acd5a=await _0x2f99cf(_0x32c4b0);Object['assign'](_0x22e474,_0x4acd5a);}catch{return Promise['reject'](new ki(Ni(_0x20ecd2,'AI_ERROR_GET_HEADERS')));}}return _0x22e474;}async['_prepareRequestParameters'](_0x2e6bf0,_0x1982f1){const _0x449bed=this['editor']['locale'];if('object'==typeof _0x2e6bf0)return _0x2e6bf0;try{return await _0x2e6bf0(_0x1982f1);}catch{return Promise['reject'](new ki(Ni(_0x449bed,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x37f32b){super(_0x37f32b),_0x37f32b['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x37f32b['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x37f32b['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x37f32b['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x37f32b['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x37f32b['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x2858e4,context:_0x21414e,onData:_0x4fd50c,actionId:_0x3d3fb4}){const _0x2eff6f=this['editor']['locale'],_0x2092dc=await this['prepareMessages'](_0x2858e4,_0x21414e,_0x3d3fb4),_0x2bc27e=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x3d3fb4),_0x4fba7b=await this['_prepareRequestParameters'](this['_requestParameters'],_0x3d3fb4),_0x30fd52={'messages':_0x2092dc,..._0x4fba7b},_0x242c41={'method':'POST','headers':_0x2bc27e,'body':JSON['stringify'](_0x30fd52),'signal':this['abortController']['signal']},_0x190b0f=await fetch(this['_apiUrl'],_0x242c41);if(_0x190b0f['ok'])return _0x4fba7b['stream']?await this['_readStreamableResponse'](_0x190b0f,_0x4fd50c):await this['_readStaticResponse'](_0x190b0f,_0x4fd50c),Promise['resolve']();{const _0x195a0c=await _0x190b0f['text']();return _0x195a0c['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x2eff6f,'AI_ERROR_CONTEXT_LENGTH'))):_0x195a0c['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x2eff6f,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x195a0c));}}async['prepareMessages'](_0x4c6fb5,_0x3c875c,_0x55bb2f){let _0x2aab09,_0x2d00b3;return _0x3c875c?(_0x2aab09='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.',_0x2d00b3='Instruction:\x0a'+_0x4c6fb5+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3c875c):(_0x2aab09='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.',_0x2d00b3=_0x4c6fb5),[{'role':'system','content':_0x2aab09},{'role':'user','content':_0x2d00b3}];}async['_readStreamableResponse'](_0x2cb45c,_0x19530b){const _0x2a2e90=_0x2cb45c['body']['getReader'](),_0x25ce06=new TextDecoder();let _0x589bb8='',_0x35eeab='',_0x54c734='',_0x5a0b4b=!0x1;for(;!_0x5a0b4b;){const {done:_0x57bbe3,value:_0x4c6fa4}=await _0x2a2e90['read'](),_0x2fedc3=_0x589bb8+_0x25ce06['decode'](_0x4c6fa4);let _0x355fe2='';_0x5a0b4b=_0x57bbe3;try{_0x355fe2=this['_cleanUpData'](_0x2fedc3),_0x589bb8='';}catch{_0x589bb8=_0x2fedc3;continue;}_0x35eeab+=_0x355fe2,!_0x5a0b4b&&this['_isBufferIncomplete'](_0x35eeab)||_0x35eeab&&(_0x54c734+=_0x35eeab,_0x35eeab='',_0x19530b(_0x54c734));}return Promise['resolve']();}async['_readStaticResponse'](_0x1e4456,_0x4fa466){return _0x4fa466((await _0x1e4456['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x1b6225){const _0x366f89=_0x1b6225['split']('<')['length']!==_0x1b6225['split']('>')['length'],_0x57449e=_0x1b6225['length']<0x1e;return _0x366f89&&_0x57449e;}['_cleanUpData'](_0x15932e){return _0x15932e['split'](/\n(?![^{]*\})/g)['map'](_0x54eaf0=>_0x54eaf0['replace']('data:\x20',''))['filter'](_0x51ba87=>_0x51ba87&&_0x51ba87['length']>0x0&&'[DONE]'!==_0x51ba87)['map'](_0x58cc21=>{const {choices:_0x2f6777}=JSON['parse'](_0x58cc21);if(_0x2f6777[0x0]?.['delta']?.['content'])return _0x2f6777[0x0]['delta']['content'];})['filter'](_0x28c5c0=>_0x28c5c0)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x1ed5c7){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x4d7f97,_0x1f6bd6={}){super(_0x4d7f97),this['isToggleable']=!0x0,this['set']('side',_0x1f6bd6['side']||'top');const _0x3f2403=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x1f6bd6['class']||[]),_0x3f2403['to']('side',_0x2163ab=>'ck-tab-button_'+_0x2163ab),_0x3f2403['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x5d2282{['children'];constructor(_0x6fd05a,_0x409761={}){super(_0x6fd05a);const _0x1dc431=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x409761['class']||[]),_0x1dc431['to']('class'),_0x1dc431['if']('isVisible','ck-hidden',_0x41972a=>!_0x41972a)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x5d2282{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x4df461,_0x567c02={}){super(_0x4df461),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x567c02['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x567c02['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x5493f0,_0x496fea)=>_0x5493f0&&!_0x496fea);const _0x15aa1e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x567c02['class']||[]),_0x15aa1e['to']('side',_0x2b4821=>'ck-tabs_'+_0x2b4821),_0x15aa1e['to']('class'),_0x15aa1e['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x15aa1e['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x15aa1e['to']('side',_0x254634=>'ck-tabs__buttons-container_'+_0x254634)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x15aa1e['to']('side',_0x17ff9b=>'ck-tabs__panels-container_'+_0x17ff9b)]},'children':this['panelViews']},...Ot(_0x567c02['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x8b20a){const _0x14bf69=this['_tabs']['get'](_0x8b20a);return _0x14bf69||null;}['addTab'](_0x39625c){const _0x2cd555=this['_setupButton']({'id':_0x39625c['id'],'label':_0x39625c['buttonLabel'],'icon':_0x39625c['buttonIcon'],'order':_0x39625c['order']}),_0x498021=new ns(this['locale']);return _0x498021['render'](),_0x39625c['content']&&_0x498021['children']['add'](_0x39625c['content']),this['panelViews']['add'](_0x498021),this['_tabs']['set'](_0x39625c['id'],{'button':_0x2cd555,'panel':_0x498021,'order':void 0x0!==_0x39625c['order']?_0x39625c['order']:null}),this['fire']('addTab:'+_0x39625c['id'],{'id':_0x39625c['id'],'button':_0x2cd555,'panel':_0x498021}),null===this['activeTab']?this['activateTab'](_0x39625c['id']):this['_hidePanel'](_0x39625c['id']),{'button':_0x2cd555,'panel':_0x498021};}['activateTab'](_0x2bfb45){if(null!==_0x2bfb45&&!this['getTab'](_0x2bfb45))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2bfb45});if(this['isCollapsed']=!0x1,this['activeTab']===_0x2bfb45)return;const _0x458321=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x2bfb45,_0x2bfb45&&this['_showPanel'](_0x2bfb45),this['fire']('activateTab:'+_0x2bfb45,{'newTab':_0x2bfb45,'oldTab':_0x458321});}['toggleTabPanel'](_0x967a1b){this['activeTab']===_0x967a1b?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x967a1b);}['showTab'](_0x5204d3){if(!this['getTab'](_0x5204d3))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5204d3});this['_showPanel'](_0x5204d3),this['_showButton'](_0x5204d3),this['fire']('show:'+_0x5204d3,_0x5204d3);}['hideTab'](_0x2868a6){if(!this['getTab'](_0x2868a6))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2868a6});const _0x296769=this['activeTab'];this['_hidePanel'](_0x2868a6),this['_hideButton'](_0x2868a6);const _0x561ddb=this['getTabIds']();_0x296769===_0x2868a6&&_0x561ddb['length']>0x1&&this['activateTab'](_0x561ddb['find'](_0x49024e=>_0x49024e!==_0x2868a6)),this['fire']('hide:'+_0x2868a6,_0x2868a6);}['_getPanel'](_0x5bac12){const _0x3f68a7=this['_tabs']['get'](_0x5bac12);return _0x3f68a7?_0x3f68a7['panel']:null;}['_showPanel'](_0x360760){null!==this['activeTab']&&this['activeTab']!==_0x360760||this['_getPanel'](_0x360760)['show']();}['_hidePanel'](_0x4fe1b8){const _0x5d6ac4=this['_getPanel'](_0x4fe1b8);_0x5d6ac4['isVisible']&&(this['activeTab']===_0x4fe1b8&&(this['activeTab']=null),_0x5d6ac4['hide']());}['_getButton'](_0x541fa3){const _0x1e8f74=this['_tabs']['get'](_0x541fa3);return _0x1e8f74?_0x1e8f74['button']:null;}['_showButton'](_0x7a1e99){this['_getButton'](_0x7a1e99)['show']();}['_hideButton'](_0x472ade){this['_getButton'](_0x472ade)['hide']();}['_setupButton'](_0x3510f0){const _0x473315=new ss(this['locale'],{'side':this['side']}),_0x2f6a13=this['buttonViews'];if(_0x473315['set']({'label':_0x3510f0['label'],'icon':_0x3510f0['icon'],'tooltip':!0x0,'withText':!0x0}),_0x473315['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x1e9941,_0x206c7a)=>_0x1e9941===_0x3510f0['id']&&!_0x206c7a),_0x473315['bind']('side')['to'](this,'side'),_0x3510f0['order']){const _0x2313ba=[...this['_tabs']]['reduce']((_0x2836b0,_0x3b4a20)=>{const _0x35da65=_0x3b4a20[0x0],{order:_0x7e01c1}=_0x3b4a20[0x1];return!_0x7e01c1||_0x7e01c1>_0x3510f0['order']?_0x2836b0:_0x7e01c1>=_0x2836b0['order']?{'id':_0x35da65,'order':_0x7e01c1}:_0x2836b0;},{'id':'','order':0x0}),_0x13e15c=_0x2f6a13['getIndex'](this['_getButton'](_0x2313ba['id']));_0x2f6a13['add'](_0x473315,_0x13e15c+0x1);}else _0x2f6a13['add'](_0x473315);return _0x473315['on']('execute',()=>{this['toggleTabPanel'](_0x3510f0['id']);}),_0x473315;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x1d9228,_0x201f87={}){super(_0x1d9228,_0x201f87),this['set']('type',_0x201f87['type']||'sidebar'),this['set']('side',_0x201f87['side']||'right'),this['set']('isVisible',_0x201f87['visibleByDefault']??!0x0);const _0x20c899=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x20c899['if']('type','ck-ai-tabs__overlay',_0x18c743=>'overlay'===_0x18c743),_0x20c899['if']('type','ck-ai-tabs__sidebar',_0x17ad74=>'sidebar'===_0x17ad74),_0x20c899['if']('isVisible','ck-hidden',_0x1ab14c=>!_0x1ab14c)]}}),this['buttonViews']['on']('add',(_0x60f04b,_0x282843)=>{_0x282843['set']('withText',!0x1);});}},cs=class extends _0x10611c{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x17f8ea){if(super(_0x17f8ea),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x482630=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x482630['showResizeButton']&&(this['showResizeButton']=_0x482630['showResizeButton']),'sidebar'!==_0x482630['type']&&'overlay'!==_0x482630['type']||_0x482630['side']&&(this['side']=_0x482630['side']),'sidebar'===_0x482630['type']){if(this['container']=_0x482630['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x482630['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new hs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x482630['visibleByDefault'],'collapsible':_0x482630['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 _0x1bce0a&&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'](_0x2eca28){if(_0x2eca28&&this['type']!==_0x2eca28){if(!os['includes'](_0x2eca28))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x2eca28;}}['switchSide'](_0x1c722f){if(_0x1c722f&&this['side']!==_0x1c722f){if(!as['includes'](_0x1c722f))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x1c722f;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x10611c{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x3cb437];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34a6b1){if(super(_0x34a6b1),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x1b3ea1=this['context']['plugins']['get'](_0x3cb437);if(!_0x1b3ea1['token'])throw new ht('ai-missing-token',this);this['_token']=_0x1b3ea1['token'];}['startConversation'](_0x398bfd,_0x484d0b){const _0x31b923=this['_sendApiRequest']('/conversations','POST',{'id':_0x398bfd,'group':_0x484d0b});return{'getConversation':async()=>(await _0x31b923['request'])['json'](),'abortController':_0x31b923['abortController']};}['queryAssistant']({message:_0x28ae36,conversationId:_0x534456,parts:_0x926447,capabilities:_0x513ca2,model:_0x12da2d,attributes:_0x5e83aa}){const _0x4f015f={'prompt':_0x28ae36,'content':_0x926447,'model':_0x12da2d,..._0x513ca2&&{'capabilities':_0x513ca2},..._0x5e83aa&&{'attributes':_0x5e83aa}},_0x253f13=this['_sendApiRequest']('/conversations/'+_0x534456+'/messages','POST',_0x4f015f,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x1ac533=(await _0x253f13['request'])['body'];return this['_getStreamReader'](_0x1ac533);},'abortController':_0x253f13['abortController']};}['executeCustomAction']({content:_0x27e0ed,message:_0x48f48b,model:_0x556c6f,outputFormat:_0x2b3d1e}){const _0x4b6a9b={'content':[{'type':'text','content':_0x27e0ed}],'prompt':_0x48f48b,'model':_0x556c6f,'outputFormat':_0x2b3d1e},_0x5c37a2=this['_sendApiRequest']('/actions/custom/calls','POST',_0x4b6a9b);return{'getStream':async()=>{const _0x3fa04d=(await _0x5c37a2['request'])['body'];return this['_getStreamReader'](_0x3fa04d);},'abortController':_0x5c37a2['abortController']};}['executeAction']({actionName:_0x278b78,content:_0x5b1b56,args:_0x25b781}){const _0x4ddb29={'content':[{'type':'text','content':_0x5b1b56}],'args':_0x25b781},_0x9e7334=this['_sendApiRequest']('/actions/system/'+_0x278b78+'/calls','POST',_0x4ddb29);return{'getStream':async()=>{const _0x5a9e60=(await _0x9e7334['request'])['body'];return this['_getStreamReader'](_0x5a9e60);},'abortController':_0x9e7334['abortController']};}['uploadFile'](_0x1d5971,_0x5b8c0,_0x2c4ede){const _0xeb2a73=new FormData();_0xeb2a73['append']('file',_0x5b8c0,_0x5b8c0['name']),_0x2c4ede&&_0xeb2a73['append']('attributes',JSON['stringify'](_0x2c4ede));const _0x26bc17=this['_sendApiRequest']('/conversations/'+_0x1d5971+'/files','POST',_0xeb2a73);return{'getId':async()=>(await _0x26bc17['request'])['json'](),'abortController':_0x26bc17['abortController']};}['uploadDocuments'](_0x447c05,_0x193c57){const _0x428496={'documents':_0x193c57['map'](_0x9475a2=>({'content':_0x9475a2['content'],'attributes':{'version':_0x9475a2['version'],'sessionId':_0x9475a2['sessionId'],'channelId':_0x9475a2['channelId'],'rootName':_0x9475a2['rootName'],'selections':_0x9475a2['selections']},...void 0x0!==_0x9475a2['name']?{'name':_0x9475a2['name']}:{},...void 0x0!==_0x9475a2['description']?{'description':_0x9475a2['description']}:{}}))},_0x39370=this['_sendApiRequest']('/conversations/'+_0x447c05+'/documents/batch','POST',_0x428496);return{'getIds':async()=>(await _0x39370['request'])['json'](),'abortController':_0x39370['abortController']};}['fetchDocuments'](_0x3b451a,_0xe7ac17){const _0xcfbe54=new URLSearchParams();_0xcfbe54['append']('documentIds',_0xe7ac17['join'](','));const _0x149645=this['_sendApiRequest']('/conversations/'+_0x3b451a+'/documents/batch?'+_0xcfbe54['toString'](),'GET');return{'getDocuments':async()=>(await _0x149645['request'])['json'](),'abortController':_0x149645['abortController']};}['fetchConversations'](_0x3e96f3,_0x59c809={}){const _0x43782c=new URLSearchParams();_0x43782c['append']('group',_0x3e96f3),_0x43782c['append']('excludeEmpty',!0x1!==_0x59c809['excludeEmpty']?'true':'false'),_0x43782c['append']('limit',_0x59c809['limit']?_0x59c809['limit']['toString']():'100'),_0x43782c['append']('sortBy',_0x59c809['sortBy']?_0x59c809['sortBy']:'createdAt'),_0x43782c['append']('order',_0x59c809['order']?_0x59c809['order']:'desc');const _0x1aa637=this['_sendApiRequest']('/conversations?'+_0x43782c['toString'](),'GET');return{'getConversations':async()=>(await(await _0x1aa637['request'])['json']())['items'],'abortController':_0x1aa637['abortController']};}['deleteConversation'](_0x218046){const _0x561599=this['_sendApiRequest']('/conversations/'+_0x218046,'DELETE');return{'execute':async()=>{await _0x561599['request'];},'abortController':_0x561599['abortController']};}['updateConversation'](_0x24ea59,_0x5526f2){const _0x1d019d=this['_sendApiRequest']('/conversations/'+_0x24ea59,'PATCH',_0x5526f2);return{'getResult':async()=>(await _0x1d019d['request'],_0x5526f2),'abortController':_0x1d019d['abortController']};}['fetchConversation'](_0x2afd3e){const _0x4d4b6e=this['_sendApiRequest']('/conversations/'+_0x2afd3e,'GET');return{'getConversation':async()=>(await _0x4d4b6e['request'])['json'](),'abortController':_0x4d4b6e['abortController']};}['fetchConversationMessages'](_0x58b1b0){const _0x51817a=this['_sendApiRequest']('/conversations/'+_0x58b1b0+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x51817a['request'])['json']())['items'],'abortController':_0x51817a['abortController']};}['uploadUrl'](_0x530978,_0x84b2f9,_0xa2dd0c){const _0x183cdf=this['_sendApiRequest']('/conversations/'+_0x530978+'/web-resources','POST',{'url':_0x84b2f9,'attributes':_0xa2dd0c});return{'getId':async()=>(await _0x183cdf['request'])['json'](),'abortController':_0x183cdf['abortController']};}['getModels'](_0x3cc41f='en'){const _0x52a5bb=new URLSearchParams();_0x52a5bb['append']('language',_0x3cc41f);const _0x1565b9='/models/1?'+_0x52a5bb['toString'](),_0x14220b=this['_sendApiRequest'](_0x1565b9,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x14220b['request'])['json'](),'abortController':_0x14220b['abortController']};}['deleteFile'](_0x4d5d53,_0x8e9e71){const _0x15efd6=this['_sendApiRequest']('/conversations/'+_0x4d5d53+'/files/'+_0x8e9e71,'DELETE');return{'execute':async()=>{await _0x15efd6['request'];},'abortController':_0x15efd6['abortController']};}['deleteDocument'](_0x28e3a7,_0xecac42){const _0x50717c=this['_sendApiRequest']('/conversations/'+_0x28e3a7+'/documents/'+_0xecac42,'DELETE');return{'execute':async()=>{await _0x50717c['request'];},'abortController':_0x50717c['abortController']};}['deleteWebResource'](_0x49b3b7,_0xf642a5){const _0x1f95be=this['_sendApiRequest']('/conversations/'+_0x49b3b7+'/web-resources/'+_0xf642a5,'DELETE');return{'execute':async()=>{await _0x1f95be['request'];},'abortController':_0x1f95be['abortController']};}['cancelStream'](_0x587099,_0x56e67e){const _0x170f8a=this['_sendApiRequest']('/conversations/'+_0x587099+'/messages/'+_0x56e67e+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x170f8a['request'];},'abortController':_0x170f8a['abortController']};}['resumeStream'](_0x46eb2d,_0x4540c0,_0x3a2492='0-0'){const _0x54ac6d=new URLSearchParams({'lastEventId':_0x3a2492}),_0x5d57d2=this['_sendApiRequest']('/conversations/'+_0x46eb2d+'/messages/'+_0x4540c0+'/stream?'+_0x54ac6d['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x4100f4=await _0x5d57d2['request'];return this['_getStreamReader'](_0x4100f4['body']);},'abortController':_0x5d57d2['abortController']};}['callSystemReview']({reviewName:_0x57e3d1,content:_0x1ab979,args:_0x1210f8}){const _0x5c2fe6=this['_sendApiRequest']('/reviews/system/'+_0x57e3d1+'/calls','POST',{'content':[{'type':'text','content':_0x1ab979}],'args':_0x1210f8});return{'getStream':async()=>{const _0x36dbdc=(await _0x5c2fe6['request'])['body'];return this['_getStreamReader'](_0x36dbdc);},'abortController':_0x5c2fe6['abortController']};}['processDocument']({document:_0x3e82d5,prompt:_0x2d8af1,model:_0xaed8df}){const _0x37ba4a=this['_sendApiRequest']('/documents/process','POST',{'document':_0x3e82d5,'prompt':_0x2d8af1,'model':_0xaed8df});return{'getResult':async()=>(await _0x37ba4a['request'])['json'](),'abortController':_0x37ba4a['abortController']};}['callCustomReview']({content:_0xad33b6,prompt:_0x56a015,model:_0x209a88}){const _0x49047f=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0xad33b6}],'prompt':_0x56a015,'model':_0x209a88});return{'getStream':async()=>{const _0x3de5f9=(await _0x49047f['request'])['body'];return this['_getStreamReader'](_0x3de5f9);},'abortController':_0x49047f['abortController']};}['upsertAIChatRating'](_0x8fbee,_0x117851,_0x3405f8){const _0x4c2c9a=this['_sendApiRequest']('/conversations/'+_0x8fbee+'/messages/'+_0x117851+'/ratings','PUT',{'positiveCount':_0x3405f8['positiveCount'],'totalCount':_0x3405f8['totalCount'],'modificationId':_0x3405f8['modificationId']});return{'execute':async()=>{await _0x4c2c9a['request'];},'abortController':_0x4c2c9a['abortController']};}['upsertAIActionRating'](_0x496e45,_0x5e37e1,_0x30b068){const _0x46d8ed=this['_sendApiRequest']('/actions/system/'+_0x496e45+'/calls/'+_0x5e37e1+'/ratings','PUT',{'positiveCount':_0x30b068['positiveCount'],'totalCount':_0x30b068['totalCount']});return{'execute':async()=>{await _0x46d8ed['request'];},'abortController':_0x46d8ed['abortController']};}['upsertCustomAIActionRating'](_0x2962cc,_0x37ee8e){const _0x5a79e=this['_sendApiRequest']('/actions/custom/calls/'+_0x2962cc+'/ratings','PUT',{'positiveCount':_0x37ee8e['positiveCount'],'totalCount':_0x37ee8e['totalCount']});return{'execute':async()=>{await _0x5a79e['request'];},'abortController':_0x5a79e['abortController']};}['upsertAIReviewRating'](_0x32ce0b,_0x18ecac,_0x37ebc8,_0x4ab7ce){const _0x23abb8=this['_sendApiRequest']('/reviews/system/'+_0x32ce0b+'/calls/'+_0x18ecac+'/ratings','PUT',{'positiveCount':_0x37ebc8['positiveCount'],'totalCount':_0x37ebc8['totalCount'],'dataId':_0x4ab7ce});return{'execute':async()=>{await _0x23abb8['request'];},'abortController':_0x23abb8['abortController']};}['upsertCustomAIReviewRating'](_0x12201a,_0x38bf7a,_0x232418){const _0x556c9a=this['_sendApiRequest']('/reviews/custom/calls/'+_0x12201a+'/ratings','PUT',{'positiveCount':_0x38bf7a['positiveCount'],'totalCount':_0x38bf7a['totalCount'],'dataId':_0x232418});return{'execute':async()=>{await _0x556c9a['request'];},'abortController':_0x556c9a['abortController']};}['_sendApiRequest'](_0x94a22a,_0x129b24,_0x39deae,_0x594ea3={}){const {useCache:_0x33483a=!0x1,apiUrl:_0x364ff=this['_apiUrl']}=_0x594ea3,_0x5c58b4=new AbortController(),_0x1c8c70=_0x33483a?_0x129b24+':'+_0x94a22a:null;if(_0x1c8c70){const _0x315bc5=this['_responseCache']['get'](_0x1c8c70);if(_0x315bc5)return{'request':_0x315bc5['then'](_0x2fe25d=>_0x2fe25d['clone']()),'abortController':_0x5c58b4};}const _0x277395=_0x39deae instanceof FormData,_0x5302e6={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x39deae&&!_0x277395&&(_0x5302e6['Content-Type']='application/json');const _0x1f3943={'method':_0x129b24,'headers':_0x5302e6,'signal':_0x5c58b4['signal']};_0x39deae&&(_0x1f3943['body']=_0x277395?_0x39deae:JSON['stringify'](_0x39deae));const _0x591a99=fetch(''+_0x364ff+_0x94a22a,_0x1f3943)['catch'](_0x16a146=>{_0x1c8c70&&this['_responseCache']['delete'](_0x1c8c70),this['_handleError'](_0x16a146);})['then'](_0x4fe13f=>_0x4fe13f['ok']?_0x4fe13f:_0x4fe13f['json']()['then'](_0x15feec=>{throw _0x1c8c70&&this['_responseCache']['delete'](_0x1c8c70),{'url':_0x364ff,'path':_0x94a22a,'method':_0x129b24,'body':_0x39deae,'status':(_0x4fe13f||{})['status'],'statusText':(_0x4fe13f||{})['statusText'],'code':_0x15feec['code'],'message':_0x15feec['message'],'traceId':_0x15feec['traceId']};}));return _0x1c8c70&&this['_responseCache']['set'](_0x1c8c70,_0x591a99['then'](_0x28c241=>_0x28c241['clone']())),{'request':_0x591a99,'abortController':_0x5c58b4};}async*['_getStreamReader'](_0x5f1894){const _0x218d46=[],_0x326b3a=_0x5f1894['getReader'](),_0x29ef2a=_0x184d98({'onError':_0x4b71d3=>{this['_handleError'](_0x4b71d3);},'onEvent':_0x1c733f=>{_0x1c733f['data']=JSON['parse'](_0x1c733f['data']),_0x218d46['push'](_0x1c733f);}});try{let _0x1b4921=!0x1;for(;!_0x1b4921;){const {done:_0x11a3af,value:_0x3ff291}=await _0x326b3a['read']();_0x11a3af&&(_0x1b4921=!0x0),_0x29ef2a['feed'](this['_decoder']['decode'](_0x3ff291,{'stream':!0x0})),yield*_0x218d46,_0x218d46['length']=0x0;}}catch(_0x45471a){this['_handleError'](_0x45471a);}finally{_0x326b3a['releaseLock'](),_0x29ef2a['reset']();}}['_handleError'](_0x4b66ca){if(_0x4b66ca instanceof ht)throw _0x4b66ca;if(_0x4b66ca instanceof Error&&'AbortError'===_0x4b66ca['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x4b66ca});throw new ht('ai-request-failed',this,{'originalError':_0x4b66ca});}};function us(_0x422704,_0x3ed84d,_0x4d0d2b){const t=_0x422704['t'];switch(_0x3ed84d){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'},_0x4d0d2b);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x4d0d2b);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.'},_0x4d0d2b);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x4d0d2b);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'},_0x4d0d2b);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x4d0d2b);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'},_0x4d0d2b);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.'},_0x4d0d2b);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.'},_0x4d0d2b);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.'},_0x4d0d2b);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.'},_0x4d0d2b);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'},_0x4d0d2b);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.'},_0x4d0d2b);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x3ed84d;}}function ds(_0x4c8613){return _0x4c8613?_0x4c8613 instanceof _0x1bce0a?[_0x4c8613]:_0x4c8613['editors']&&0x0!==_0x4c8613['editors']['length']?Array['from'](_0x4c8613['editors']):[]:[];}function _s(_0x1d571f){const _0x5a5941=ds(_0x1d571f);if(!_0x5a5941['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x5a5941['length'])return _0x5a5941[0x0];const _0x52da70=_0x5a5941['find'](_0x49b790=>_0x49b790['ui']?.['focusTracker']?.['isFocused']);if(_0x52da70)return _0x52da70;const _0x510d2e=function(_0x2ae294){if(_0x2ae294 instanceof _0x1bce0a)return;const _0x139e1e=_0x2ae294;if(!_0x139e1e['plugins']||!_0x139e1e['plugins']['has']('AIEditing'))return;return _0x139e1e['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x1d571f);return _0x510d2e&&_0x5a5941['includes'](_0x510d2e)?_0x510d2e:_0x5a5941[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x10611c{constructor(_0x303d3b){super(_0x303d3b),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x5228d4){let _0x2a194a=this['_sessionIdByEditor']['get'](_0x5228d4);return _0x2a194a||(_0x2a194a=_0x5228d4['plugins']['has']('RealTimeCollaborationClient')&&_0x5228d4['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x5228d4,_0x2a194a)),_0x2a194a;}async['getDocumentData'](){const _0x2a7cab=ds(this['context']);if(!_0x2a7cab['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x1e0686=[],_0x450bb2=new Set();for(const _0x25c5d0 of _0x2a7cab){const _0x568a77=_0x25c5d0['config']['get']('roots')||{};for(const _0x56e5aa of _0x25c5d0['model']['document']['getRoots']()){if('$graveyard'===_0x56e5aa['rootName'])continue;const _0x2fc4fe=await this['_getDocumentDataForEditorRoot'](_0x25c5d0,_0x56e5aa,_0x450bb2),_0x207379=_0x568a77[_0x56e5aa['rootName']],_0x50be12=_0x56e5aa['getAttribute']('$description')??_0x207379?.['description'];let _0x508320=_0x56e5aa['getAttribute']('$title')??_0x207379?.['title'];_0x508320||(_0x508320=_0x56e5aa['getAttribute']('$rootEditableOptions')?.['label']??_0x207379?.['label']),_0x508320||(bt('ai-document-root-missing-title',{'editor':_0x25c5d0,'rootName':_0x56e5aa['rootName']}),_0x508320=_0x56e5aa['rootName']),_0x1e0686['push']({'editor':_0x25c5d0,'rootName':_0x56e5aa['rootName'],'content':_0x2fc4fe['content'],'version':_0x2fc4fe['version'],'sessionId':this['getSessionId'](_0x25c5d0),'channelId':_0x25c5d0['config']['get']('collaboration.channelId'),'selections':_0x2fc4fe['selections'],'name':_0x508320,'description':_0x50be12});}}return _0x1e0686;}async['_getDocumentDataForEditorRoot'](_0x5ebfe9,_0x4afc69,_0x2c445d){const _0x225065=_0x5ebfe9['data']['toView'](_0x4afc69,{'convertAiChatSelectionMarker':!0x0}),_0x3c9139=new _0x490a50(_0x5ebfe9['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x225065,_0x3c9139,_0x2c445d);let _0x1ac01b=await this['_getDocumentDataStringFromView'](_0x225065,_0x5ebfe9);const _0x5c7602=this['_getMarkersInDocumentOrder'](_0x5ebfe9,_0x4afc69),_0x1e5459=[];for(const _0x46255a of _0x5c7602){const _0x17cfb9='<'+_0x46255a['name']+':start></'+_0x46255a['name']+':start>',_0x259469=_0x1ac01b['indexOf'](_0x17cfb9);_0x1ac01b=_0x1ac01b['substring'](0x0,_0x259469)+_0x1ac01b['substring'](_0x259469+_0x17cfb9['length']);const _0x33a51c='<'+_0x46255a['name']+':end></'+_0x46255a['name']+':end>',_0x29fd11=_0x1ac01b['indexOf'](_0x33a51c);_0x1ac01b=_0x1ac01b['substring'](0x0,_0x29fd11)+_0x1ac01b['substring'](_0x29fd11+_0x33a51c['length']),_0x1e5459['push']({'markerName':_0x46255a['name'],'start':_0x259469,'end':_0x29fd11,'htmlFragment':_0x1ac01b['substring'](_0x259469,_0x29fd11)});}return{'content':_0x1ac01b,'version':_0x5ebfe9['model']['document']['version'],'selections':_0x1e5459};}['afterInit'](){this['context']instanceof _0x1bce0a?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5de58d,_0x44dfd3)=>{_0x44dfd3['on']('ready',()=>{this['_integrateEditor'](_0x44dfd3);});});}['_setOutputDataProcessor'](_0x2eee17){this['_outputDataProcessor']=_0x2eee17;}async['_getDocumentDataStringFromView'](_0x2aa26c,_0x2e6b3f){let _0x42ecd6;if(this['_outputDataProcessor']){const _0x2fd311=_0x2e6b3f['data']['processor']['domConverter']['viewToDom'](_0x2aa26c),_0x12ab35=await this['_outputDataProcessor'](_0x2fd311);_0x42ecd6=_0x2e6b3f['data']['processor']['htmlWriter']['getHtml'](_0x12ab35);}else _0x42ecd6=_0x2e6b3f['data']['processor']['toData'](_0x2aa26c);return _0x42ecd6;}['_integrateEditor'](_0x22d754){if(!_0x22d754['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x22d754);_0x22d754['ui']['focusTracker']['on']('change:isFocused',(_0x3748a6,_0xb8fe,_0x3eb7d7)=>{_0x3eb7d7&&(this['_lastContentFocusedEditor']=_0x22d754);}),_0x22d754['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x22d754&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x22d754['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x4a4462})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x4a4462['split'](':')[0x1]],'priority':0xc})}),_0x22d754['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x2d20dd,{writer:_0x24ad14,options:_0x2a6583})=>_0x2a6583['convertAiChatSelectionMarker']?_0x24ad14['createUIElement'](_0x2d20dd['markerName']+':'+(_0x2d20dd['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x4aa8e7){const _0x59424f=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4aa8e7);const _0x214fc2=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x59424f,_0x214fc2);}['hideFakeVisualSelection'](_0x56a47c){const _0x17d215=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x56a47c);const _0x2fe74f=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x17d215,_0x2fe74f);}async['modelToDataWithIds'](_0xbf687e,_0x3d5cc5){const _0x436ee4=_0x3d5cc5['data']['toView'](_0xbf687e),_0x1f8ba3=new _0x490a50(_0x3d5cc5['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x436ee4,_0x1f8ba3),this['_getDocumentDataStringFromView'](_0x436ee4,_0x3d5cc5);}['_setDataIdsOnChildren'](_0x14e7c2,_0x4ac257,_0x2554a3=new Set()){let _0x3005b0=!0x1;for(const _0x2681cc of _0x14e7c2['getChildren']()){if(!_0x2681cc['is']('view:element')||As['includes'](_0x2681cc['name']))continue;const _0x391a6f=_0x2681cc['is']('view:containerElement'),_0x4d5e7b=_0x2681cc['is']('view:emptyElement'),_0x10013c=_0x2681cc['is']('view:rawElement'),_0x103cf2=this['_setDataIdsOnChildren'](_0x2681cc,_0x4ac257,_0x2554a3);_0x2681cc['hasAttribute']('data-id')?(_0x3005b0=!0x0,_0x2554a3['add'](_0x2681cc['getAttribute']('data-id'))):(_0x391a6f||_0x4d5e7b||_0x10013c||_0x103cf2)&&(_0x4ac257['setAttribute']('data-id',this['_nextDataId'](_0x2554a3),_0x2681cc),_0x3005b0=!0x0);}return _0x3005b0;}['_nextDataId'](_0x5e7c2d){let _0x15cbd2;do{_0x15cbd2='';for(let _0x38f89d=0x0;_0x38f89d<0x4;_0x38f89d++)_0x15cbd2+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x5e7c2d['has'](_0x15cbd2));return _0x5e7c2d['add'](_0x15cbd2),_0x15cbd2;}['getSelectionText'](_0x2e59bb){const _0xb292b4=(_0x2e59bb?_0x2e59bb['model']:_s(this['context'])['model'])['document']['selection'],_0x5b2217=[],_0x5606df=Array['from'](_0xb292b4['getRanges']());_0x5606df['sort']((_0x1a37c6,_0x2a966d)=>_0x1a37c6['start']['isBefore'](_0x2a966d['start'])?-0x1:0x1);for(const _0xfa7dd4 of _0x5606df)for(const _0x4221e0 of _0xfa7dd4['getItems']())_0x4221e0['is']('$textProxy')?_0x5b2217['push'](_0x4221e0['data']):_0x4221e0['is']('element')&&_0x5b2217['length']>0x0&&'\x20'!==_0x5b2217[_0x5b2217['length']-0x1]&&_0x5b2217['push']('\x20');return _0x5b2217['length']?'\x22'+_0x5b2217['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x4bdb3c){for(let _0x1545b5=0x0;_0x1545b5<this['_fakeSelections']['length'];_0x1545b5++)if(this['_fakeSelections'][_0x1545b5]['id']==_0x4bdb3c)return void this['_fakeSelections']['splice'](_0x1545b5,0x1);}['_addFakeSelection'](_0x248dc5){this['_removeFakeSelectionById'](_0x248dc5['id']),wt(this['_fakeSelections'],_0x248dc5);}['_refreshFakeSelection'](_0x3450aa,_0x4e1dbd){if(_0x3450aa==_0x4e1dbd)return;const _0x54b23d=_0x3450aa?_0x3450aa['editor']:null,_0x100729=_0x4e1dbd?_0x4e1dbd['editor']:null,_0x46357d=(_0xa17e93,_0x1a4a38)=>{const _0xe70fb7=_0x1a4a38['model']['markers']['getMarkersGroup'](gs);for(const _0x266bbb of _0xe70fb7)_0xa17e93['removeMarker'](_0x266bbb);},_0x77a686=(_0xca3fed,_0x14543d,_0x26ac8e)=>{const _0x66a5b3=_0x14543d['model'];for(let _0x5dcd37=0x0;_0x5dcd37<_0x26ac8e['ranges']['length'];_0x5dcd37++){let _0x133496=_0x26ac8e['ranges'][_0x5dcd37];const _0x364c85=gs+':'+_0x26ac8e['id']+':'+_0x5dcd37;if(_0x133496['start']['isAtEnd']){const _0x428ad0=_0x133496['start']['getLastMatchingPosition'](({item:_0x344df9})=>!_0x66a5b3['schema']['isContent'](_0x344df9),{'boundaries':_0x133496});_0x133496=_0xca3fed['createRange'](_0x428ad0,_0x133496['end']);}_0xca3fed['addMarker'](_0x364c85,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x133496});}};_0x54b23d&&_0x100729&&_0x54b23d===_0x100729&&_0x4e1dbd?_0x54b23d['model']['change'](_0x4e7e80=>{_0x46357d(_0x4e7e80,_0x54b23d),_0x77a686(_0x4e7e80,_0x100729,_0x4e1dbd);}):(_0x54b23d&&_0x54b23d['model']['change'](_0x5941c8=>_0x46357d(_0x5941c8,_0x54b23d)),_0x100729&&_0x4e1dbd&&_0x100729['model']['change'](_0x3bceea=>_0x77a686(_0x3bceea,_0x100729,_0x4e1dbd)));}['_getMarkersInDocumentOrder'](_0x359c50,_0x556712){const _0x94c1a6=Array['from'](_0x359c50['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x556712?_0x94c1a6['filter'](_0x8008af=>{const _0x3b81fe=_0x8008af['getRange']();return _0x3b81fe&&_0x3b81fe['root']['rootName']===_0x556712['rootName'];}):_0x94c1a6)['sort']((_0x53861a,_0x44ead8)=>_0x53861a['getStart']()['isBefore'](_0x44ead8['getStart']())?-0x1:_0x53861a['getStart']()['isAfter'](_0x44ead8['getStart']())?0x1:0x0);}};function ps(_0x28ec01,_0x59cab2){return _0x26ee46(_0x28ec01,_0x59cab2);}function ms(_0x38c17b,_0x35c883){return _0x2c79e7(_0x38c17b,_0x35c883);}function Es(_0x584f58,_0x1f11b6,_0x511914){const _0x57c67c=null!==_0x1f11b6?_0x2062a0=>_0x2062a0['attribs'][_0x584f58]===_0x1f11b6:_0x1bd6c1=>Boolean(_0x1bd6c1['attribs'][_0x584f58]);return ti(_0xd0ffd3=>_0x3a2d7f(_0xd0ffd3)&&_0x57c67c(_0xd0ffd3),_0x511914);}function Ts(_0x245ef9,_0x3ee96d,_0x3dbf64){const _0x76dc4e=null!==_0x3ee96d?_0xd7422d=>_0xd7422d['attribs'][_0x245ef9]===_0x3ee96d:_0xefbd61=>Boolean(_0xefbd61['attribs'][_0x245ef9]);return _0xfbdc58(_0x2bbcf0=>_0x3a2d7f(_0x2bbcf0)&&_0x76dc4e(_0x2bbcf0),_0x3dbf64);}function ws(_0x8161f7){return _0xfbdc58(_0x5ec13d=>_0x3a2d7f(_0x5ec13d)&&function(_0x20f465){const _0x1d8424=_0x20f465['toLowerCase']();return'script'===_0x1d8424||'style'===_0x1d8424||_0x1d8424['includes']('-');}(_0x5ec13d['name']),_0x8161f7);}function Cs(_0x2d4262){return _0xd70512(_0x238e11=>_0x4a8d03(_0x238e11),_0x2d4262,!0x0,0x1/0x0);}function fs(_0x26712f,_0x26c5fa){return _0x26712f&&_0x3a2d7f(_0x26712f)?_0x26712f['attribs'][_0x26c5fa]:null;}function bs(_0x2c6322,_0x184a3a,_0x34e2bd){_0x3a2d7f(_0x2c6322)&&(null===_0x34e2bd?delete _0x2c6322['attribs'][_0x184a3a]:_0x2c6322['attribs'][_0x184a3a]=_0x34e2bd);}function Ss(_0x592bcc,_0xba14d7,_0x5e2103){const _0x522ce1=_0xba14d7['cloneNode'](!0x0);'beforebegin'===_0x5e2103?_0x5c42a6(_0x592bcc,_0x522ce1):'afterbegin'===_0x5e2103?_0x333b63(_0x592bcc,_0x522ce1):'beforeend'===_0x5e2103?_0x37dfba(_0x592bcc,_0x522ce1):'afterend'===_0x5e2103&&_0x109382(_0x592bcc,_0x522ce1);}function Rs(_0x4a64ca){const _0x27bf4b=[];let _0x2e8b7a=_0x4a64ca;for(;_0x2e8b7a;)_0x2e8b7a=_0x18c81d(_0x2e8b7a),_0x2e8b7a&&_0x27bf4b['push'](_0x2e8b7a);return _0x27bf4b;}function Os(_0x723bd8){return _0x723bd8['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x2697e5){let _0x18cec0=0x0;for(;_0x2697e5['parentNode'];)_0x2697e5=_0x2697e5['parentNode'],_0x18cec0++;return _0x18cec0;}function ks(_0x5cf7f5){const _0x3318b2=[];let _0x5f3c48=_0x5cf7f5['nextSibling'];for(;_0x5f3c48;)_0x3318b2['push'](_0x5f3c48),_0x5f3c48=_0x5f3c48['nextSibling'];_0x3318b2['forEach'](_0x3ff162=>{_0x3cff82(_0x3ff162);});}function Ns({documentSuggestions:_0x51b23c,transform:_0x37e362,documentCompare:_0x494b90,documentCompareOptions:_0x3625eb}){const _0x5d0e1a=new Map();for(const [_0x2a31b0,{groups:_0x16b520,documentContext:_0xc43d77,documentContent:_0x5ed858,editor:_0x390215}]of _0x51b23c){const _0x884ff9=_0xc43d77['content'],_0x19e2b5=_0xc43d77['version'],_0x5a4ab9=_0x5ed858['cloneNode'](!0x0);for(const {changes:_0x1dacab}of _0x16b520){const _0x4a6a07=_0x1dacab['filter'](_0x4ce5ee=>'new'!=_0x4ce5ee['type'])['map'](_0x12f148=>Es('data-id',_0x12f148['id'],_0x5a4ab9))['filter'](_0x514c2f=>null!==_0x514c2f),_0x22eaf5=_0x1dacab['filter'](_0x15aebe=>'removed'!=_0x15aebe['type'])['map'](_0x147750=>_0x147750['node']['cloneNode'](!0x0));let _0x173242=null;if(_0x4a6a07['length']){_0x173242=_0x4a6a07[0x0]['previousSibling'];for(let _0x13a30c=0x0;_0x13a30c<_0x4a6a07['length'];_0x13a30c++)_0x3cff82(_0x4a6a07[_0x13a30c]);}if(_0x22eaf5['length']){_0x173242||(_0x1dacab[0x0]['anchorId']?_0x173242=Es('data-id',_0x1dacab[0x0]['anchorId'],_0x5a4ab9):(_0x173242=_0x22eaf5['shift'](),_0x333b63(_0x5a4ab9,_0x173242)));for(let _0x101abe=0x0;_0x101abe<_0x22eaf5['length'];_0x101abe++)_0x109382(_0x173242,_0x22eaf5[_0x101abe]),_0x173242=_0x22eaf5[_0x101abe];}}const _0x58160f=ms(_0x5a4ab9),_0x38778c=_0x494b90['getDiff'](_0x884ff9,_0x58160f,{'targetEditor':_0x390215,'anchor':_0xc43d77['rootName'],..._0x3625eb})['getOperations']();if(_0x37e362){const _0x27a5f0=_0x390215['model']['document']['history']['getOperations'](_0x19e2b5),_0x429990={'document':_0x390215['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x5d0e1a['set'](_0x2a31b0,_0x4506be(_0x38778c,_0x27a5f0,_0x429990)['operationsA']);}else _0x5d0e1a['set'](_0x2a31b0,_0x38778c);}return _0x5d0e1a;}function ys(_0x1a7595,_0x1b3aac){if('marker'!=_0x1b3aac['type'])return;const _0x46fe8d=_0x1a7595['model']['markers']['get'](_0x1b3aac['name']);_0x46fe8d&&(_0x1b3aac['oldRange']=_0x46fe8d['getRange']());}const xs=/* #__PURE__ -- @preserve */
25
- gt();var Ls=class extends xs{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x36b530){super(),this['_generateUid']=_0x36b530||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x2a9cb8,_0x35c3a9,_0x325a40){this['_uidCounter']=0x0;const _0x37830e=_0x2a9cb8['cloneNode'](!0x0);Hs(_0x35c3a9,_0x37830e);const _0x21de02=_0x37830e['childNodes'],_0x51735a=Array['from'](_0x21de02)['filter'](_0x47578e=>!(0x3===_0x47578e['nodeType']&&''===ms(_0x47578e)['trim']())),_0x4b3556=_0x51735a['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0x35c3a9)['map'](_0x2bfbe6=>fs(_0x2bfbe6,'data-id'))['filter'](_0xe00e35=>!!_0xe00e35));for(const _0x380f3a of _0x51735a)_0x380f3a&&_0x3a2d7f(_0x380f3a)&&void 0x0===_0x380f3a['attribs']['data-id']&&bs(_0x380f3a,'data-id','new-element');if(Ts('data-id',null,_0x37830e)['forEach'](_0x5180af=>{const _0x430242=fs(_0x5180af,'data-id');'new-element'===_0x430242||this['_existingDataIds']['has'](_0x430242)||bs(_0x5180af,'data-id','new-element');}),0x0===_0x35c3a9['childNodes']['length']){const _0x542aab=[];return Ts('data-id','new-element',_0x37830e)['forEach'](_0x550a18=>{const _0x438a4b=this['_generateUid']();bs(_0x550a18,'data-id',_0x438a4b),_0x542aab['push'](_0x438a4b);}),this['_removeSpecialComments'](_0x37830e),{'parsedContent':_0x37830e,'newNodeIds':_0x542aab,'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 _0x5c5789=-0x1,_0x161c96=!0x1;for(let _0x56ae88=0x0;_0x56ae88<_0x4b3556;_0x56ae88++){const _0x4a05d2=_0x51735a[_0x56ae88],_0x15ec98=_0x51735a[_0x56ae88+0x1];if(this['_isNewNode'](_0x4a05d2)){if(-0x1===_0x5c5789&&(_0x5c5789=_0x56ae88),this['_markWrappedElements'](_0x4a05d2),!this['_isNewNode'](_0x15ec98)){const [_0x5439a5,_0x57580d]=this['_findReferenceNode'](_0x4a05d2,_0x161c96,_0x35c3a9);if(_0x5439a5){const _0x1e17bb=Array['from'](_0x51735a)['slice'](_0x5c5789,_0x56ae88+0x1);this['_insertNodes'](_0x5439a5,_0x1e17bb,_0x57580d),_0x5c5789=-0x1;}}}else{if(this['_isExistingContentComment'](_0x4a05d2))_0x161c96=!0x0;else{if(this['_isExistingNode'](_0x4a05d2)){const _0x52dbdd=fs(_0x4a05d2,'data-id');if(_0x52dbdd&&this['_existingDataIds']['has'](_0x52dbdd)){this['_referencedExistingIds']['add'](_0x52dbdd);const _0x33a834=Es('data-id',_0x52dbdd,_0x35c3a9);this['_replaceNode'](_0x33a834,_0x4a05d2);}}else{if(Ds(_0x4a05d2)){const _0x164e4e=Ps(_0x4a05d2);Es('data-id',_0x164e4e,_0x37830e)||this['_touchedNodesState']['removedIds']['push'](_0x164e4e);}}}}}for(const _0x52fc53 of this['_touchedNodesState']['removedIds']){const _0x5e3f64=Es('data-id',_0x52fc53,_0x35c3a9);_0x5e3f64&&(this['_rescueUnwrappedElements'](_0x5e3f64),this['_removeNode'](_0x5e3f64,_0x52fc53,_0x325a40));}if(Ts('data-id','new-element',_0x35c3a9)['forEach'](_0x2738a4=>{const _0x2f7834=this['_getUid'](_0x2738a4);bs(_0x2738a4,'data-id',_0x2f7834),this['_touchedNodesState']['newIds']['push'](_0x2f7834);}),this['_removeSpecialComments'](_0x35c3a9),_0x325a40&&_0x325a40['cutAfterUnstable']){const _0x467de9=this['_findLastConfirmationPoint'](_0x51735a),_0x209ad6=this['_getLastStableElement'](_0x35c3a9,_0x467de9);this['_markUnstableElements'](_0x35c3a9,_0x209ad6);}if(this['_processWrappedElements'](_0x35c3a9,_0x325a40),_0x325a40&&_0x325a40['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x874f19=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0x35c3a9);let _0x16f416=_0x874f19[_0x874f19['length']-0x1];for(;_0x16f416;)ks(_0x16f416),_0x16f416=_0x16f416['parentNode'];}return{'parsedContent':_0x35c3a9,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x21fc9e,_0x4f0f66,_0x46af58){for(const _0x3c6b0b of _0x4f0f66){const _0x26851c=this['_getUid'](_0x3c6b0b);bs(_0x3c6b0b,'data-id',_0x26851c),this['_touchedNodesState']['newIds']['push'](_0x26851c),this['_touchedNodesState']['lastTouchedId']=_0x26851c;}const _0x2554f7='afterbegin'===_0x46af58||'afterend'===_0x46af58?_0x4f0f66['reverse']():_0x4f0f66;for(const _0xe20a95 of _0x2554f7)Ss(_0x21fc9e,_0xe20a95,_0x46af58);}['_replaceNode'](_0x24b22a,_0xee1112){if(!_0x24b22a)return;if(_0x4c4afb=_0xee1112,Os(ms(_0x24b22a))===Os(ms(_0x4c4afb)))return;var _0x4c4afb;const _0x2e23b6=fs(_0x24b22a,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x2e23b6),this['_touchedNodesState']['lastTouchedId']=_0x2e23b6,_0x53788f(_0x24b22a,_0xee1112['cloneNode'](!0x0));}['_removeNode'](_0x4ce66d,_0x45b268,_0x54accc){if(_0x54accc&&_0x54accc['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x45b268;const _0x57672f=_0x54accc['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x57672f,'data-id',_0x45b268),bs(_0x57672f,'data-removed','true'),_0x53788f(_0x4ce66d,_0x57672f);}else _0x3cff82(_0x4ce66d);}['_findReferenceNode'](_0x244d0a,_0x4c89b7,_0x355dd3){const _0x1975eb=this['_findPrevElementWithDataId'](_0x244d0a,!0x1);if(_0x1975eb){const _0x515751=Ps(_0x1975eb),_0x1e966e=Es('data-id',_0x515751,_0x355dd3);if(_0x1e966e)return[_0x1e966e,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x515751);}const _0x158989=this['_findNextElementWithDataId'](_0x244d0a,!0x1);if(_0x158989){const _0x5872e3=Ps(_0x158989),_0x3575e8=Es('data-id',_0x5872e3,_0x355dd3);if(_0x3575e8)return[_0x3575e8,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x5872e3);}return _0x4c89b7?_0x244d0a['nextSibling']?this['_findFallbackReferenceNode'](_0x244d0a,_0x355dd3):[_0x355dd3['childNodes'][_0x355dd3['childNodes']['length']-0x1],'afterend']:[_0x355dd3['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x32aca8,_0x1cfa99){const _0xd676b7=[],_0x195011=this['_findPrevElementWithDataId'](_0x32aca8,!0x0);if(_0x195011){const _0x4a70f8=Es('data-id',Ps(_0x195011),_0x1cfa99);_0x4a70f8&&_0xd676b7['push']([_0x4a70f8,'afterend']);}const _0x3f384f=this['_findNextElementWithDataId'](_0x32aca8,!0x0);if(_0x3f384f){const _0x402e74=Es('data-id',Ps(_0x3f384f),_0x1cfa99);_0x402e74&&_0xd676b7['push']([_0x402e74,'beforebegin']);}return _0xd676b7['length']>0x1?vs(_0xd676b7[0x0][0x0])<=vs(_0xd676b7[0x1][0x0])?_0xd676b7[0x0]:_0xd676b7[0x1]:0x1===_0xd676b7['length']?_0xd676b7[0x0]:[_0x1cfa99['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x174704,_0x1b9436){let _0x117884=_0x174704['nextSibling'],_0x5c37b6=null,_0x24effc=!0x1;for(;_0x117884;){if(_0x4a8d03(_0x117884)){if(Ds(_0x117884)&&(_0x5c37b6=_0x117884),this['_isExistingContentComment'](_0x117884)&&_0x1b9436&&!_0x24effc){_0x24effc=!0x0,_0x117884=_0x117884['nextSibling'];continue;}break;}const _0x394aeb=fs(_0x117884,'data-id');if(_0x394aeb&&'new-element'!==_0x394aeb&&this['_existingDataIds']['has'](_0x394aeb)){_0x5c37b6=_0x117884;break;}_0x117884=_0x117884['nextSibling'];}return _0x5c37b6;}['_findPrevElementWithDataId'](_0x24fd23,_0x5d9fe3){let _0x12e77c=_0x24fd23['previousSibling'],_0x9e2f9c=null,_0x1c6d5b=!0x1;for(;_0x12e77c;){if(_0x4a8d03(_0x12e77c)){if(Ds(_0x12e77c)&&(_0x9e2f9c=_0x12e77c),this['_isExistingContentComment'](_0x12e77c)&&_0x5d9fe3&&!_0x1c6d5b){_0x1c6d5b=!0x0,_0x12e77c=_0x12e77c['previousSibling'];continue;}break;}const _0x172d1d=fs(_0x12e77c,'data-id');if(_0x172d1d&&'new-element'!==_0x172d1d&&this['_existingDataIds']['has'](_0x172d1d)){_0x9e2f9c=_0x12e77c;break;}_0x12e77c=_0x12e77c['previousSibling'];}return _0x9e2f9c;}['_markWrappedElements'](_0x41e98a){_0x3a2d7f(_0x41e98a)&&Ts('data-id',null,_0x41e98a)['forEach'](_0x3ef974=>{this['_isExistingNode'](_0x3ef974)&&(bs(_0x3ef974,'data-wrapped-id',fs(_0x3ef974,'data-id')),bs(_0x3ef974,'data-id',null));});}['_processWrappedElements'](_0x55c845,_0x342e3e){Ts('data-wrapped-id',null,_0x55c845)['forEach'](_0x466c74=>{const _0x1dbaf5=fs(_0x466c74,'data-wrapped-id');if(this['_hasUnstableParent'](_0x466c74))return;const _0x4e39f0=Es('data-id',_0x1dbaf5,_0x55c845);bs(_0x466c74,'data-id',_0x1dbaf5),_0x4e39f0&&(this['_removeNode'](_0x4e39f0,_0x1dbaf5,_0x342e3e),this['_touchedNodesState']['removedIds']['push'](_0x1dbaf5),this['_touchedNodesState']['lastTouchedId']=_0x1dbaf5);});}['_hasUnstableParent'](_0x504302){let _0x19a4c5=_0x504302['parentNode'];for(;_0x19a4c5;){if(fs(_0x19a4c5,'data-unstable'))return!0x0;_0x19a4c5=_0x19a4c5['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x488ee1){const _0x1d9a38=new Set(this['_touchedNodesState']['removedIds']),_0x2c7c93=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x488ee1)['forEach'](_0x147463=>{const _0x1a1482=fs(_0x147463,'data-id'),_0x19eb7=!!_0x1a1482&&this['_referencedExistingIds']['has'](_0x1a1482),_0x2c8601=!!_0x1a1482&&_0x2c7c93['has'](_0x1a1482);if(!_0x1a1482||!_0x19eb7&&!_0x2c8601)return;if(_0x1d9a38['has'](_0x1a1482))return;let _0x194118=_0x147463['parentNode'],_0x2874b8=!0x1;for(;_0x194118;){if(_0x194118===_0x488ee1){_0x2874b8=!0x0;break;}const _0x1efbf0=fs(_0x194118,'data-id');if(_0x1efbf0&&(this['_referencedExistingIds']['has'](_0x1efbf0)||_0x2c7c93['has'](_0x1efbf0)))return;_0x194118=_0x194118['parentNode'];}if(_0x2874b8){if(_0x5c42a6(_0x488ee1,_0x147463),_0x19eb7){const _0x1d8c81=this['_generateUid'](),_0x435019=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x1a1482);-0x1!==_0x435019&&this['_touchedNodesState']['modifiedIds']['splice'](_0x435019,0x1),bs(_0x147463,'data-unwrapped-id',_0x1a1482),bs(_0x147463,'data-id',_0x1d8c81),this['_touchedNodesState']['newIds']['push'](_0x1d8c81),this['_touchedNodesState']['rescuedNewIds']['add'](_0x1d8c81),this['_touchedNodesState']['lastTouchedId']=_0x1d8c81;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x1a1482),this['_touchedNodesState']['lastTouchedId']=_0x1a1482;}});}['_getUid'](_0x1f2572){return this['_isExistingNode'](_0x1f2572)?fs(_0x1f2572,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x234997){Cs(_0x234997)['filter'](_0xbaffe2=>Ds(_0xbaffe2)||this['_isExistingContentComment'](_0xbaffe2))['forEach'](_0x404fdc=>{_0x3cff82(_0x404fdc);});}['_findLastConfirmationPoint'](_0x50e6c5){let _0x261aec=null,_0x5479f5=null,_0x1e3a76=null,_0x54b14a=null;const _0x2a0a7e=_0x352c3a=>{_0x352c3a&&(_0x261aec=_0x352c3a),_0x1e3a76=null,_0x54b14a=null;};for(let _0x196eda=0x0;_0x196eda<_0x50e6c5['length'];_0x196eda++){const _0x139c43=_0x50e6c5[_0x196eda];if(this['_isExistingContentComment'](_0x139c43)){_0x2a0a7e(_0x5479f5);continue;}if(_0x3a2d7f(_0x139c43)){const _0x4184d8=fs(_0x139c43,'data-id'),_0x1aa34a=_0x196eda===_0x50e6c5['length']-0x1;if(_0x4184d8&&'new-element'!==_0x4184d8&&this['_touchedNodesState']['modifiedIds']['includes'](_0x4184d8)&&!_0x1aa34a){_0x2a0a7e(_0x4184d8),_0x5479f5=_0x4184d8;continue;}}let _0x4fdced=null;const _0x2fa0a2=Ps(_0x139c43);if(_0x2fa0a2&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x2fa0a2))_0x5479f5=_0x2fa0a2;else{if(_0x2fa0a2&&this['_touchedNodesState']['newIds']['includes'](_0x2fa0a2))_0x4fdced='N';else{if(!Ds(_0x139c43))continue;_0x4fdced='R';}_0x4fdced===_0x54b14a||null===_0x54b14a?_0x54b14a=_0x4fdced:null!==_0x1e3a76?(_0x2a0a7e(_0x5479f5),_0x54b14a=_0x4fdced):(_0x1e3a76=_0x54b14a,_0x54b14a=_0x4fdced),_0x5479f5=_0x2fa0a2;}}const _0x41b6ee=_0x50e6c5[_0x50e6c5['length']-0x1];return _0x41b6ee&&!_0x3a2d7f(_0x41b6ee)&&!Ds(_0x41b6ee)&&_0x5479f5&&_0x2a0a7e(_0x5479f5),_0x261aec;}['_getLastStableElement'](_0x2bd908,_0x4d076e){if(!_0x4d076e)return null;const _0x3c0fe7=Es('data-id',_0x4d076e,_0x2bd908);if(!_0x3c0fe7)return null;const _0x1d06f1=[_0x3c0fe7,...Rs(_0x3c0fe7)]['at'](-0x2);if(_0x1d06f1===_0x3c0fe7)return _0x3c0fe7;let _0x1ee2ef=_0x1d06f1['previousSibling'];for(;_0x1ee2ef&&!_0x3a2d7f(_0x1ee2ef);)_0x1ee2ef=_0x1ee2ef['previousSibling'];return _0x1ee2ef;}['_markUnstableElements'](_0xfd0d6d,_0x38e5fd){const _0x2c95f5=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x37a095=_0x38e5fd?_0x38e5fd['nextSibling']:_0xfd0d6d['firstChild'];for(;_0x37a095;)_0x3a2d7f(_0x37a095)&&(_0x2c95f5['has'](fs(_0x37a095,'data-id'))||Ts('data-id',null,_0x37a095)['some'](_0x51f8f2=>_0x2c95f5['has'](fs(_0x51f8f2,'data-id'))))&&bs(_0x37a095,'data-unstable','true'),_0x37a095=_0x37a095['nextSibling'];}['_isNewNode'](_0x2b3637){return Boolean('new-element'===fs(_0x2b3637,'data-id'));}['_isExistingNode'](_0x166780){return Boolean((fs(_0x166780,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x166780,'data-id'));}['_isExistingContentComment'](_0x4edd74){return Boolean(_0x4a8d03(_0x4edd74)&&ms(_0x4edd74)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ds(_0x17dd46){return!!_0x17dd46&&Boolean(_0x4a8d03(_0x17dd46)&&ms(_0x17dd46)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ps(_0x203231){if(!_0x203231)return null;if(_0x3a2d7f(_0x203231))return fs(_0x203231,'data-id')??null;if(_0x4a8d03(_0x203231)){const _0x111d16=ms(_0x203231)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x111d16&&_0x111d16[0x1])return _0x111d16[0x1];}return null;}function Hs(_0x2fe5a2,_0x1ad748){const _0x508304=new Map();for(const _0xd23ad of ws(_0x2fe5a2))_0x508304['set'](fs(_0xd23ad,'data-id'),_0xd23ad);const _0x2b1581=new Set();for(const _0x3f5be2 of ws(_0x1ad748)){const _0x260d02=fs(_0x3f5be2,'data-id'),_0x4b35fd=_0x260d02?_0x508304['get'](_0x260d02):void 0x0;_0x4b35fd?(_0x53788f(_0x3f5be2,_0x26e4f2(_0x4b35fd,!0x0)),_0x2b1581['add'](_0x260d02)):_0x3cff82(_0x3f5be2);}for(const _0x552d5c of Cs(_0x1ad748))Ds(_0x552d5c)&&_0x508304['has'](Ps(_0x552d5c))&&_0x3cff82(_0x552d5c);const _0x5e8d65=new Set(Ts('data-id',null,_0x1ad748)['map'](_0xcdff42=>fs(_0xcdff42,'data-id')));for(const [_0x7499f2,_0x3244fe]of _0x508304){if(_0x2b1581['has'](_0x7499f2))continue;let _0xfb705a=_0x3244fe['parent'],_0x1c04a6=null;for(;_0xfb705a&&_0x3a2d7f(_0xfb705a);){const _0x289a10=fs(_0xfb705a,'data-id');if(_0x289a10&&_0x5e8d65['has'](_0x289a10)){_0x1c04a6=_0x289a10;break;}_0xfb705a=_0xfb705a['parent'];}if(!_0x1c04a6)continue;const _0x2f7969=Es('data-id',_0x1c04a6,_0x1ad748);_0x2f7969&&_0x37dfba(_0x2f7969,_0x26e4f2(_0x3244fe,!0x0));}}const Ms=/* #__PURE__ -- @preserve */
26
- gt();var Vs=class extends Ms{['_m2html'];constructor(){super();const _0x3438ad=Object['entries'](_0x4452a7),_0x4caadd=_0x3438ad['findIndex'](([_0x8c4643])=>'rehypeDomRaw'===_0x8c4643);if(-0x1===_0x4caadd)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x3438ad['splice'](_0x4caadd+0x1,0x0,['rehypeSanitize',_0x41d136]),this['_m2html']=new _0x4a71f8({'plugins':Object['fromEntries'](_0x3438ad)});}['convertMarkdownToHTML'](_0x5e86f1){const _0x91c195=this['_m2html']['parse'](_0x5e86f1);return this['parseAndNormalizeHTML'](_0x91c195);}['parseAndNormalizeHTML'](_0x1e7524){return this['_parseHTML'](_0x1e7524);}['_parseHTML'](_0x1dbb71){const _0x1922a6=ps('<dummy>'+_0x1dbb71['replace'](/<[^>]*?$/g,'')+'</dummy>');return Us(_0x1922a6),_0x1922a6['children']=_0x1922a6['children'][0x0]['children'],_0x1922a6;}};function Us(_0x38f92f){for(const _0x31a387 of _0x38f92f['children'])_0x3a2d7f(_0x31a387)?'pre'!==_0x31a387['name']&&Us(_0x31a387):_0xa4c1f4(_0x31a387)&&(_0x31a387['data']=_0x31a387['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Bs({changeGroups:_0x5a6c9d,documentContextContent:_0x280492,showDiff:_0x48cee2,trimUnchanged:_0xa2dca9=!0x0}){return _0x5a6c9d['map'](_0x4a4796=>{if(!_0x4a4796['editor']||'destroyed'===_0x4a4796['editor']['state'])return null;if(!_0x4c4eb3(_0x4a4796['editor'],_0x4a4796['rootName']))return{'type':_0x4a4796['changes'][0x0]['type'],'index':_0x4a4796['index'],'content':new _0x52e1ed([]),'hasChanges':!0x1};const _0x56731e=new _0x52e1ed([]),_0x2b043d=new _0x52e1ed([]),_0x384b91=new Set();for(const _0x250a87 of _0x4a4796['changes'])'new'==_0x250a87['type']&&Ts('data-id',null,_0x250a87['node'])['forEach'](_0xa53d1=>{_0x384b91['add'](fs(_0xa53d1,'data-id'));});for(const _0x238c41 of _0x4a4796['changes'])if('removed'!=_0x238c41['type']?_0x2b043d['children']['push'](_0x238c41['node']['cloneNode'](!0x0)):_0x48cee2||_0x384b91['has'](_0x238c41['id'])||_0x2b043d['children']['push'](_0x238c41['node']['cloneNode'](!0x0)),'new'!=_0x238c41['type']&&(_0x48cee2||'removed'!=_0x238c41['type'])){const _0x23269e=ti(_0x232769=>fs(_0x232769,'data-id')==_0x238c41['id'],_0x280492['get'](_0x4a4796['documentId']),!0x0);_0x23269e&&_0x56731e['children']['push'](_0x23269e['cloneNode'](!0x0));}let _0x52d8b3,_0x27f822;try{({content:_0x52d8b3,hasChanges:_0x27f822}=Gs(_0x4a4796['editor'],_0x56731e,_0x2b043d,_0x48cee2,_0xa2dca9));}catch{return{'type':_0x4a4796['changes'][0x0]['type'],'index':_0x4a4796['index'],'content':new _0x52e1ed([]),'hasChanges':!0x1};}return{'type':_0x4a4796['changes'][0x0]['type'],'index':_0x4a4796['index'],'content':_0x52d8b3,'hasChanges':_0x27f822};})['filter'](_0x4a0ce3=>null!==_0x4a0ce3);}function Gs(_0x4d44c7,_0x551df8,_0x4f8328,_0x28e234,_0x5e4af3=!0x0){const _0x17134d=_0x4d44c7['plugins']['get']('DocumentCompare'),_0x47ec98=ms(_0x551df8),_0x2f2fec=ms(_0x4f8328),_0x1bd565=_0x4d44c7['data']['parse'](_0x47ec98,'$root'),_0x4e0bc8=_0x4d44c7['model']['createPositionAt'](_0x1bd565,0x0),_0x5c2034=_0x17134d['getDiff'](_0x47ec98,_0x2f2fec,{'anchor':_0x4e0bc8,'markDeletions':_0x28e234,'targetEditor':_0x4d44c7})['getOperations']();if(0x0==_0x5c2034['length'])return{'content':_0x551df8['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x28e234?function(_0x15931c,_0x32f15,_0x2abdb4){if(0x0==_0x15931c['length'])return;const _0x12c8e2=_0x2abdb4['plugins']['get']('DocumentCompare'),_0x294781=_0x2abdb4['plugins']['get']('SuggestionsConversion');_0x2abdb4['model']['change'](_0x794cff=>{const _0x53f286=new Set();for(let _0x153a5d=0x0;_0x153a5d<_0x15931c['length'];_0x153a5d++){const _0x22f483=_0x15931c[_0x153a5d];if(_0x22f483['baseVersion']=null,_0x22f483['isDocumentOperation']=!0x1,_0x12c8e2['isMarkedRemoveOperation'](_0x22f483)){const _0x178297=_0x3b2d8e(_0x22f483['newRange'],_0x2abdb4['model']),_0xf96a37='suggestion:deletion:'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0xf96a37,_0x178297);}else switch(_0x22f483['type']){case'rename':{if(_0x22f483['oldName']==_0x22f483['newName'])break;_0x794cff['batch']['addOperation'](_0x22f483),_0x2abdb4['model']['applyOperation'](_0x22f483);const _0x192348='$elementName',_0x5bf66c=_0x22f483['position'],_0x2618f9=_0x2abdb4['model']['createRange'](_0x5bf66c,_0x2abdb4['model']['createPositionAt'](_0x5bf66c['nodeAfter'],'end')),_0x359458='suggestion:attribute:'+_0x192348+':'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0x359458,_0x2618f9);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x22f483['oldValue']==_0x22f483['newValue'])break;_0x794cff['batch']['addOperation'](_0x22f483),_0x2abdb4['model']['applyOperation'](_0x22f483);const _0x1e1a53=_0x22f483['key'];if(!_0x294781['isRegisteredAttribute'](_0x1e1a53))break;const _0xdb2bbf=_0x3b2d8e(_0x22f483['range'],_0x2abdb4['model']),_0x4100be='suggestion:attribute:'+_0x1e1a53+':'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0x4100be,_0xdb2bbf);break;}case'insert':{if(_0x794cff['batch']['addOperation'](_0x22f483),_0x2abdb4['model']['applyOperation'](_0x22f483),Fs(_0x32f15,_0x22f483),_0x15931c[_0x153a5d+0x1]&&'move'==_0x15931c[_0x153a5d+0x1]['type'])break;const _0x2e0e21=_0x22f483['position'],_0x4ac941=_0x22f483['howMany'],_0x18cfd5=_0x3b2d8e(_0x2abdb4['model']['createRange'](_0x2e0e21,_0x2e0e21['getShiftedBy'](_0x4ac941)),_0x2abdb4['model']),_0x5fcccf='suggestion:insertion:'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0x5fcccf,_0x18cfd5);break;}case'split':{_0x794cff['batch']['addOperation'](_0x22f483),_0x2abdb4['model']['applyOperation'](_0x22f483),Fs(_0x32f15,_0x22f483);const _0x4b9c3e=_0x22f483['splitPosition'],_0x114fd9=_0x22f483['moveTargetPosition'],_0x5ab8f6=_0x2abdb4['model']['createRange'](_0x4b9c3e,_0x114fd9),_0x45fb04='suggestion:insertion:'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0x45fb04,_0x5ab8f6);break;}case'move':{_0x794cff['batch']['addOperation'](_0x22f483),_0x2abdb4['model']['applyOperation'](_0x22f483),Fs(_0x32f15,_0x22f483);const _0x58449e=_0x22f483['getMovedRangeStart'](),_0x8cb3ad=_0x22f483['howMany'];for(let _0x39ab8d=0x0;_0x39ab8d<_0x8cb3ad;_0x39ab8d++){const _0x1317a6=_0x58449e['getShiftedBy'](_0x39ab8d)['nodeAfter'];_0x53f286['add'](_0x1317a6);}break;}case'remove':{const _0x15870c=_0x22f483['sourcePosition'],_0x31c0c3=_0x22f483['howMany'],_0x42e4ec=new _0x495311(_0x15870c,_0x31c0c3);_0x794cff['batch']['addOperation'](_0x42e4ec),_0x2abdb4['model']['applyOperation'](_0x42e4ec),Fs(_0x32f15,_0x22f483);break;}}}for(const _0x480c01 of _0x53f286){const _0x5116f9=_0x2abdb4['model']['createRangeOn'](_0x480c01),_0x318054='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0x32f15['markers']['set'](_0x318054,_0x3b2d8e(_0x5116f9,_0x2abdb4['model']));}});}(_0x5c2034,_0x1bd565,_0x4d44c7):_0x4d44c7['model']['change'](_0x5a3db5=>{for(const _0x125c68 of _0x5c2034)if('remove'==_0x125c68['type']){const _0x435e55=_0x125c68['sourcePosition'],_0x3d4aa6=_0x125c68['howMany'],_0x471e88=new _0x495311(_0x435e55,_0x3d4aa6);_0x5a3db5['batch']['addOperation'](_0x471e88),_0x4d44c7['model']['applyOperation'](_0x471e88),Fs(_0x1bd565,_0x125c68);}else{if('marker'==_0x125c68['type']){const _0x533ae2=_0x125c68['name'],_0x50d1c4=_0x125c68['newRange'];null!==_0x50d1c4?_0x1bd565['markers']['set'](_0x533ae2,_0x50d1c4):_0x1bd565['markers']['delete'](_0x533ae2);}else _0x125c68['baseVersion']=null,_0x125c68['isDocumentOperation']=!0x1,_0x5a3db5['batch']['addOperation'](_0x125c68),_0x4d44c7['model']['applyOperation'](_0x125c68),Fs(_0x1bd565,_0x125c68);}}),_0x5e4af3){const _0x108f21=Ks(_0x4d44c7,_0x5c2034,_0x1bd565);Ys(_0x4d44c7['model'],_0x108f21),function(_0x4043a8,_0x1606b3){const _0x3281a2=_0x1606b3['getFirstRange']()['start'];let _0xb683aa=_0x1606b3['getFirstRange']()['end'];const _0x10fe54=_0x3281a2['root'];(_0xb683aa['textNode']||_0xb683aa['nodeAfter']&&_0xb683aa['nodeAfter']['is']('$text'))&&(_0x3972e3(_0xb683aa,'...'),Qs(_0x10fe54,_0xb683aa,0x3),_0xb683aa=_0xb683aa['getShiftedBy'](0x3)),(_0x3281a2['textNode']||_0x3281a2['nodeBefore']&&_0x3281a2['nodeBefore']['is']('$text'))&&(_0x3972e3(_0x3281a2,'...'),Qs(_0x10fe54,_0x3281a2,0x3),_0x3281a2['parent']==_0xb683aa['parent']&&(_0xb683aa=_0xb683aa['getShiftedBy'](0x3)));const _0x9f312c=_0x4043a8['createRange'](_0x4043a8['createPositionAt'](_0x10fe54,0x0),_0x3281a2),_0x585198=_0x4043a8['createRange'](_0xb683aa,_0x4043a8['createPositionAt'](_0x10fe54,'end')),_0xd38d28=[..._0x9f312c['getMinimalFlatRanges'](),..._0x585198['getMinimalFlatRanges']()];_0xd38d28['reverse']();for(const _0xccb747 of _0xd38d28)_0x2d4116(_0xccb747),qs(_0x10fe54,_0xccb747);}(_0x4d44c7['model'],_0x108f21);}return{'content':ps(_0x4d44c7['data']['stringify'](_0x1bd565,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Fs(_0x365afb,_0xf7017f){for(const [_0x12bba3,_0x3e014d]of _0x365afb['markers']){const _0x399b39=_0x2993a5['_createFromRanges'](_0x3e014d['getTransformedByOperation'](_0xf7017f));_0x399b39['root']==_0x365afb?_0x365afb['markers']['set'](_0x12bba3,_0x399b39):_0x365afb['markers']['delete'](_0x12bba3);}}function Ks(_0x495fbd,_0x29ddba,_0x4b9f0a){const _0xbca2fe=_0x495fbd['plugins']['get']('DocumentCompare');let _0x60ad71=_0x495fbd['model']['createPositionAt'](_0x4b9f0a,Number['POSITIVE_INFINITY']),_0x53e472=_0x495fbd['model']['createPositionAt'](_0x4b9f0a,0x0);for(const _0x32374f of _0x29ddba){let _0x25b5e5,_0x4632f4;if(_0xbca2fe['isMarkedRemoveOperation'](_0x32374f))_0x25b5e5=_0x32374f['newRange']['start'],_0x4632f4=_0x32374f['newRange']['end'];else switch(_0x60ad71=Ws(_0x60ad71,_0x32374f),_0x53e472=Ws(_0x53e472,_0x32374f),_0x32374f['type']){case'rename':_0x25b5e5=_0x32374f['position'],_0x4632f4=_0x25b5e5['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x25b5e5=_0x32374f['range']['start'],_0x4632f4=_0x32374f['range']['end'];break;case'insert':_0x25b5e5=_0x32374f['position'],_0x4632f4=_0x25b5e5['getShiftedBy'](_0x32374f['howMany']);break;case'split':_0x25b5e5=_0x32374f['splitPosition'],_0x4632f4=_0x32374f['moveTargetPosition'];break;case'merge':{const _0x531f1c=_0x32374f['targetPosition']['path']['slice'](0x0,-0x1);_0x25b5e5=_0x495fbd['model']['createPositionFromPath'](_0x4b9f0a,_0x531f1c),_0x4632f4=_0x25b5e5['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x7b937a=_0x32374f['howMany'],_0x26a54a=_0x32374f['sourcePosition']['_getTransformedByInsertion'](_0x32374f['targetPosition'],_0x7b937a),_0x4ab9ab=_0x32374f['getMovedRangeStart']();'remove'==_0x32374f['type']?(_0x25b5e5=_0x26a54a,_0x4632f4=_0x26a54a):(_0x25b5e5=_0x4ab9ab,_0x4632f4=_0x4ab9ab['getShiftedBy'](_0x7b937a));break;}}_0x25b5e5&&_0x25b5e5['isBefore'](_0x60ad71)&&(_0x60ad71=_0x25b5e5['clone'](),_0x60ad71['stickiness']='toNone'),_0x4632f4&&_0x4632f4['isAfter'](_0x53e472)&&(_0x53e472=_0x4632f4['clone'](),_0x53e472['stickiness']='toNone');}return _0x495fbd['model']['createSelection'](_0x495fbd['model']['createRange'](_0x60ad71,_0x53e472));}function Ws(_0x475cc7,_0x3510a8){return'move'!=_0x3510a8['type']&&'remove'!=_0x3510a8['type']||_0x3510a8['sourceRange']['containsPosition'](_0x475cc7)&&((_0x475cc7=_0x3510a8['sourcePosition']['clone']())['stickiness']='toNone'),_0x475cc7['getTransformedByOperation'](_0x3510a8);}function Ys(_0x5be5f8,_0x4592b3){$s(_0x5be5f8,_0x4592b3,'forward');const _0x3ac169=_0x4592b3['getFirstRange']();_0x4592b3['setTo']([]),_0x4592b3['setTo'](_0x3ac169,{'backward':!0x0}),$s(_0x5be5f8,_0x4592b3,'backward');}function $s(_0x55d8a8,_0x40b6b4,_0x3df577){let _0x5c400d=0x14;for(;_0x5c400d;){_0x55d8a8['modifySelection'](_0x40b6b4,{'unit':'word','direction':_0x3df577}),_0x5c400d--;const _0x23921d=_0x40b6b4['focus']['forward'==_0x3df577?'nodeBefore':'nodeAfter'];if(_0x23921d&&_0x23921d['is']('element')&&_0x55d8a8['schema']['isBlock'](_0x23921d)&&_0x55d8a8['schema']['isObject'](_0x23921d))break;}}function qs(_0x5a51b2,_0x46e201){for(const [_0x2a96c8,_0x354ee1]of _0x5a51b2['markers']){const _0x2c116f=_0x354ee1['_getTransformedByDeletion'](_0x46e201['start'],_0x46e201['end']['offset']-_0x46e201['start']['offset']);null!=_0x2c116f?_0x5a51b2['markers']['set'](_0x2a96c8,_0x2c116f):_0x5a51b2['markers']['delete'](_0x2a96c8);}}function Qs(_0x58fc1e,_0x2b5fb4,_0x241665){for(let [_0x35cd73,_0x39f249]of _0x58fc1e['markers'])_0x39f249=_0x39f249['_getTransformedByInsertion'](_0x2b5fb4,_0x241665,!0x1)[0x0],_0x58fc1e['markers']['set'](_0x35cd73,_0x39f249);}const Xs=/* #__PURE__ -- @preserve */
27
- ut();var zs=class extends Xs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x4da08e,config:_0x5cdbc3,locale:_0x5d3408}){super(),this['_connector']=_0x4da08e,this['_config']=_0x5cdbc3,this['_locale']=_0x5d3408;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x5f4ccf=await this['getAll']();let _0x4e2f28;return _0x4e2f28=this['_availableModels']?this['_filterModels'](_0x5f4ccf,this['_availableModels']):_0x5f4ccf['filter'](_0x56eb6c=>_0x56eb6c['recommended']),_0x4e2f28;}async['getModel'](_0x1acf81){const _0x5c6a62=await this['getAll']();if(!_0x5c6a62['length'])return null;if(_0x1acf81){const _0x4ccd84=this['_getModelById'](_0x5c6a62,_0x1acf81);if(_0x4ccd84)return _0x4ccd84;bt('ai-chat-model-id-unrecognized',{'modelId':_0x1acf81,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x307bb5=await this['getAvailableModels']();if(!_0x307bb5['length'])return null;if(this['_defaultModelId']){const _0x5260e6=this['_getModelById'](_0x307bb5,this['_defaultModelId']);if(_0x5260e6)return _0x5260e6;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x307bb5[0x0]['id']});}return _0x307bb5[0x0];}async['isAvailable'](_0x57acd7){return(await this['getAvailableModels']())['some'](_0x43090e=>_0x43090e['name']===_0x57acd7['name']&&_0x43090e['provider']===_0x57acd7['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x32e187=this['_locale']['uiLanguage']||'en',_0x4ba38f=await this['_connector']['getModels'](_0x32e187)['list']();this['_modelList']=_0x4ba38f['items']['map'](_0x314a68=>js(_0x314a68)?{..._0x314a68,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x314a68);}return[...this['_modelList']];}['_filterModels'](_0x7f34ce,_0x39d6bf){let _0x169777;if(_0x39d6bf){_0x169777=[];const _0x4aa013=new Set(),_0x3e0e87='string'==typeof _0x39d6bf?[_0x39d6bf['toLocaleLowerCase']()]:_0x39d6bf['map'](_0x26391f=>_0x26391f['toLocaleLowerCase']());for(const _0x51434a of _0x3e0e87)for(const _0x57c84e of _0x7f34ce)!_0x4aa013['has'](_0x57c84e['id'])&&this['_isMatchingFilter'](_0x57c84e,_0x51434a)&&(_0x169777['push'](_0x57c84e),_0x4aa013['add'](_0x57c84e['id']));}else _0x169777=_0x7f34ce;return _0x169777;}['_isMatchingFilter'](_0x73eedf,_0xb97cca){const _0x10b31b=_0x73eedf['id']['toLocaleLowerCase'](),_0x3ec47c=_0x73eedf['name']['toLocaleLowerCase'](),_0x9803f2=_0x73eedf['provider']['toLocaleLowerCase']();return _0x10b31b===_0xb97cca||_0x3ec47c===_0xb97cca||js(_0x73eedf)&&'auto'===_0xb97cca||_0x9803f2===_0xb97cca||_0x10b31b['startsWith'](_0xb97cca);}['_getModelById'](_0x143eac,_0x56a552){return _0x143eac['find'](_0x4ea776=>js(_0x4ea776)&&'auto'===_0x56a552?_0x4ea776:_0x4ea776['id']===_0x56a552)||null;}};function js(_0x69ecef){return _0x69ecef['id']['startsWith']('agent');}function Js(_0x4e3887,_0x26d96e){for(const _0x5d0e34 of _0x4e3887)'noop'!==_0x5d0e34['type']&&(_0x5d0e34['_aiSource']=_0x26d96e);}var Zs=class extends _0x10611c{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x22fa17];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new zs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x22aed3,_0x5e6066){if('completed'!==_0x22aed3['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x22aed3['status']});const _0x48ef16=_0x22aed3['editor'],{applyMethod:_0x73864c}=_0x5e6066;if('suggest'===_0x73864c&&!_0x48ef16['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x1538bb='suggest'===_0x73864c,_0x3dd2a1=this['context']['plugins']['get'](_0x22fa17),_0x3fc2dd=_0x48ef16['model']['createPositionAt'](_0x48ef16['model']['document']['getRoot'](),0x0),_0x14e614=_0x3dd2a1['getDiff'](_0x22aed3['contentRawOld'],_0x22aed3['contentRawNew'],{'anchor':_0x3fc2dd,'markDeletions':_0x1538bb,'targetEditor':_0x48ef16}),_0x1a8d24=_0x48ef16['model']['document']['history']['getOperations'](_0x22aed3['documentVersion']),_0x5bac33={'document':_0x48ef16['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x143e0b=_0x4506be(_0x14e614['getOperations'](),_0x1a8d24,_0x5bac33)['operationsA'];Js(_0x143e0b,_0x5e6066['aiSource']??'api'),_0x48ef16['model']['change'](_0x5abd3d=>{if(_0x1538bb)_0x48ef16['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x143e0b);else{for(const _0x10da3d of _0x143e0b)_0x10da3d['baseVersion']=_0x48ef16['model']['document']['version'],ys(_0x48ef16,_0x10da3d),_0x5abd3d['batch']['addOperation'](_0x10da3d),_0x48ef16['model']['applyOperation'](_0x10da3d);}});}['mergeChangesIntoContent'](_0x23402a,_0xddd9bc,_0x35c2ab){const _0x14e3cb=new Vs(),_0x48590d=new Ls();let _0x3048b0=_0x14e3cb['parseAndNormalizeHTML'](_0xddd9bc);for(const _0x16a699 of _0x23402a)try{const _0x4b9dcc=_0x14e3cb['parseAndNormalizeHTML'](_0x16a699['content']);_0x3048b0=_0x48590d['merge'](_0x4b9dcc,_0x3048b0,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x1dcf62){throw new ht('ai-gateway-merge-failed',this,{..._0x16a699},_0x1dcf62);}return Gs(_0x35c2ab,_0x14e3cb['parseAndNormalizeHTML'](_0xddd9bc),_0x3048b0,!0x1,!0x1)['content'];}},tn=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x45f656){this['_editor']=_0x45f656['editor'],this['_rootName']=_0x45f656['rootName'],this['_channelId']=_0x45f656['channelId'],this['_sessionId']=_0x45f656['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'](_0x178288){this['_documentVersion']=_0x178288;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1224e4){this['_contentRawOld']=_0x1224e4;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x396f28){this['_contentRawNew']=_0x396f28;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x47a9d1){this['_error']=_0x47a9d1;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x414055){return _0x414055['replace'](/ data-id="[a-z0-9]+"/g,'');}},en=class extends tn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x29497a){this['_summary']=_0x29497a;}},sn=class extends _0x10611c{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0xe34e67,_0x17ad62){if(!_0xe34e67)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x781ba2=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x781ba2[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x55b039=new en({'editor':_0x781ba2[0x0]['editor'],'rootName':_0x781ba2[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x781ba2[0x0]['sessionId']});if(_0x55b039['contentRawOld']=_0x781ba2[0x0]['content'],_0x55b039['documentVersion']=_0x781ba2[0x0]['version'],_0x17ad62?.['signal']?.['aborted'])return _0x55b039['abort'](),_0x55b039;const _0x56064b=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x55b039['contentRawOld'],'prompt':_0xe34e67,'model':_0x17ad62['model']});let _0x3d8ae1;if(_0x17ad62?.['signal']){if(_0x17ad62['signal']['aborted'])return _0x56064b['abortController']['abort'](),_0x55b039['abort'](),_0x55b039;const _0x277906=_0x17ad62['signal'],_0x5c559f=()=>_0x56064b['abortController']['abort']();_0x277906['addEventListener']('abort',_0x5c559f),_0x3d8ae1=()=>_0x277906['removeEventListener']('abort',_0x5c559f);}try{const _0x3c2093=await _0x56064b['getResult']();if(!(_0x3c2093&&_0x3c2093['document']&&_0x3c2093['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x55b039['contentRawNew']=_0x3c2093['document'],_0x55b039['summary']=_0x3c2093['summary']||'';}catch(_0x20f74b){_0x20f74b instanceof Error&&_0x20f74b['message']['includes']('ai-request-aborted')?_0x55b039['abort']():_0x55b039['error']=_0x20f74b instanceof ht?_0x20f74b:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x20f74b);}finally{_0x3d8ae1&&_0x3d8ae1();}return _0x55b039;}['applyResult'](_0x42d4b5,_0x35def3){this['context']['plugins']['get']('AIGateway')['apply'](_0x42d4b5,_0x35def3);}};function nn(_0x8be624){return _0x8be624 instanceof Error&&('AbortError'===_0x8be624['name']||('AICoreError'===_0x8be624['name']?!0x0===_0x8be624['isAbort']:_0x8be624['message']['startsWith']('ai-request-aborted')));}var rn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x2afc54){super(_0x2afc54['code'],_0x2afc54['cause']instanceof Error?{'cause':_0x2afc54['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x2afc54['code'],this['severity']=_0x2afc54['severity']??'error',this['type']=_0x2afc54['type']??'system',this['context']=_0x2afc54['context'],this['isAbort']=_0x2afc54['isAbort']??nn(_0x2afc54['cause']);}},on=class extends _0x10611c{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x4c3c80){return new an(this,_0x4c3c80);}},an=class{['_sink'];['_component'];constructor(_0x3da99d,_0x425f75){this['_sink']=_0x3da99d,this['_component']=_0x425f75;}['logError'](_0x353d6e,_0x1a2f4a={}){this['_emit'](_0x353d6e,_0x1a2f4a),this['_defaultLog'](_0x353d6e);}['reportError'](_0x4ac063,_0x31908d={}){this['_emit'](_0x4ac063,_0x31908d);}['_emit'](_0xcaa788,_0xec71b4){nn(_0xcaa788)||this['_sink']['fire']('error',{'error':_0xcaa788,'component':this['_component'],'context':_0xec71b4['context']});}['_defaultLog'](_0x38194b){if(!nn(_0x38194b)){if(_0x38194b instanceof rn){if('user'===_0x38194b['type']||'network'===_0x38194b['type'])return;if('warning'===_0x38194b['severity'])return void console['warn'](this['_component'],_0x38194b);}console['error'](this['_component'],_0x38194b);}}};const hn='ck-ai-button-primary',cn='ck-ai-button-secondary',ln='ck-ai-button-tertiary';function un(_0x16fc48,_0x2c234a){const _0x20058d=new Ht(_0x16fc48),_0x115f2c=us(_0x16fc48,'AI_TABS_LABEL_MINIMIZE'),_0x567dd1=us(_0x16fc48,'AI_TABS_LABEL_MAXIMIZE');return _0x20058d['set']({'withText':!0x1,'icon':_0x383e57,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+ln}),_0x20058d['bind']('label')['to'](_0x2c234a,'isMaximized',_0x4c8fed=>_0x4c8fed?_0x115f2c:_0x567dd1),_0x20058d['bind']('icon')['to'](_0x2c234a,'isMaximized',_0x7d8274=>_0x7d8274?_0x5c7ac2:_0x383e57),_0x20058d['bind']('isOn')['to'](_0x2c234a,'isMaximized'),_0x20058d['on']('execute',()=>{_0x2c234a['fire']('resizeTabs');}),_0x20058d;}function dn(_0x298d9a){const _0x33f978=new Lt(_0x298d9a);return _0x33f978['attachToDom'](),_0x33f978['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x33f978;}const _n=/* #__PURE__ -- @preserve */
28
- gt();var gn=class extends _n{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x424bfa,isDone:_0x2fd72d=!0x1,isComplete:_0x266b6f,interactionId:_0x5072dc,areActionsDisabled:_0x9d5552,isFromHistory:_0x502cdc=!0x1,documentContextContent:_0x37781f,locale:_0x3d79c2,id:_0x522fbb,channelsToEditors:_0xfd736c}){super(),this['id']=_0x522fbb||vt(),this['interactionId']=_0x5072dc,this['type']=_0x424bfa,this['areActionsDisabled']=!!_0x9d5552,this['isFromHistory']=_0x502cdc,this['locale']=_0x3d79c2,this['aiResponseParser']=new Vs(),this['aiResponseApplier']=new Ls(),this['documentContextContent']=new Map(_0x37781f?.['map'](_0x3c25cc=>[_0x3c25cc['id'],ps(_0x3c25cc['content'])])||[]),this['_documentIdToSource']=new Map(_0x37781f?.['map'](_0xed9250=>[_0xed9250['id'],{'editor':_0xfd736c['get'](_0xed9250['channelId']),'rootName':_0xed9250['rootName']}])||[]),this['set']('isDone',_0x2fd72d),this['set']('isComplete',_0x266b6f??_0x2fd72d),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x3195cd,_0x3cdf86){const _0x40d869='text'===this['type']?'text':_0x3cdf86;this['content']['has'](_0x40d869)||this['content']['set'](_0x40d869,''),this['content']['set'](_0x40d869,this['content']['get'](_0x40d869)+_0x3195cd),this['onContentChange'](_0x40d869);}['done'](_0x4100b2=!0x0){this['isComplete']=_0x4100b2,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x4781b0,_0x734b2f){this['changeGroups'][_0x4781b0]['state']=_0x734b2f,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x4781b0,'state':_0x734b2f});}['getContentParts']({showDiff:_0x4b952e,groupIndex:_0x33c19a}){const _0x37c11b=this['_getCachedContentParts'](_0x4b952e,_0x33c19a);if(_0x37c11b)return _0x37c11b;let _0x508a3b=[];if(void 0x0===_0x33c19a)_0x508a3b=this['changeGroups'];else{const _0xceb4aa=this['changeGroups']['find'](({index:_0x3a0ce9})=>_0x3a0ce9===_0x33c19a);if(!_0xceb4aa)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x33c19a});_0x508a3b=[_0xceb4aa];}const _0x946a36=Bs({'showDiff':_0x4b952e,'changeGroups':_0x508a3b,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4b952e,_0x946a36),_0x946a36;}['_getCachedContentParts'](_0x16c157,_0x392c91){const _0x29aa0b=_0x16c157?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x29aa0b]['length'])return null;const _0x3a808e=this['cachedSuggestionContentParts'][_0x29aa0b];if(void 0x0===_0x392c91)return _0x3a808e['length']>0x0&&_0x3a808e['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x16c157,null),null):_0x540de5(_0x3a808e);{const _0x4648d5=_0x3a808e['find'](({index:_0x414c6d})=>_0x414c6d===_0x392c91);if(_0x4648d5)return[_0x540de5(_0x4648d5)];}return null;}['_setCachedContentParts'](_0x14ce7c,_0x471b8d){const _0x2ac452=_0x14ce7c?'withDiff':'withoutDiff';_0x471b8d?_0x471b8d['forEach'](_0x182553=>{const _0x227136=this['cachedSuggestionContentParts'][_0x2ac452],_0x351978=_0x227136['find'](({index:_0x1fadc2})=>_0x1fadc2===_0x182553['index']);if(_0x351978){const _0x26e647=_0x227136['indexOf'](_0x351978);_0x227136['splice'](_0x26e647,0x1,_0x182553);}else _0x227136['push'](_0x182553);}):this['cachedSuggestionContentParts'][_0x2ac452]['length']=0x0;}['onContentChange'](_0x15f3d2){if('modification'===this['type']){if(_0x15f3d2)this['parsedContent']['set'](_0x15f3d2,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x15f3d2)));else{for(const [_0x102dfc,_0x315230]of this['content'])this['parsedContent']['set'](_0x102dfc,this['aiResponseParser']['parseAndNormalizeHTML'](_0x315230));}const _0x38829d=this['changeGroups'];for(const _0x41e2e7 of this['content']['keys']())this['updateChangeGroups'](_0x41e2e7);const _0x19fd64=this['_getDifferentChangeGroups'](_0x38829d,this['changeGroups']);(_0x19fd64['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x19fd64),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'](_0x407671,_0x5a3f06){const _0x1a806a=[];for(const _0x2861f2 of _0x5a3f06){const _0x349bba=_0x407671[_0x2861f2['index']];_0x349bba?_0x349bba['changes']['length']!==_0x2861f2['changes']['length']?_0x1a806a['push'](_0x2861f2):_0x349bba['changes']['forEach']((_0x327586,_0x41b31e)=>{const _0x461f0f=_0x2861f2['changes'][_0x41b31e];_0x327586['id']!==_0x461f0f['id']&&_0x1a806a['push'](_0x2861f2);}):_0x1a806a['push'](_0x2861f2);}return _0x1a806a;}['updateChangeGroups'](_0x236756){const _0x28401e=this['documentContextContent']['get'](_0x236756),_0x100f23=this['parsedContent']['get'](_0x236756);if(!_0x28401e||!_0x100f23)return;const _0x44ede1=new _0x4e03ab('p',{},[new _0x4e03ab('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0xb034a(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x2fa990=this['aiResponseApplier']['merge'](_0x100f23,_0x28401e['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x44ede1});this['parsedMergedContent']['set'](_0x236756,_0x2fa990['parsedContent']);let _0xfbc204=[];if(_0xfbdc58(_0x19eb05=>{const _0x3efcb3=fs(_0x19eb05,'data-id');if(!_0x3efcb3||!_0x16249e(_0x3efcb3))return!0x1;const _0x7d3da0=[_0x19eb05,...Rs(_0x19eb05)]['at'](-0x2);if(_0x19eb05!=_0x7d3da0){const _0x27812d=fs(_0x7d3da0,'data-id');_0x16249e(_0x27812d)||(_0xfbc204['push']({'node':_0x7d3da0,'id':_0x27812d,'type':'modified'}),_0x2fa990['modifiedNodeIds']['push'](_0x27812d));}else _0x2fa990['modifiedNodeIds']['includes'](_0x3efcb3)?_0xfbc204['push']({'node':_0x19eb05,'type':'modified','id':_0x3efcb3}):_0x2fa990['newNodeIds']['includes'](_0x3efcb3)?_0xfbc204['push']({'node':_0x19eb05,'type':'new','id':_0x3efcb3,'anchorId':fs(_0x19eb05['previousSibling'],'data-id')}):_0xfbc204['push']({'node':_0x19eb05,'type':'removed','id':_0x3efcb3});return!0x0;},this['parsedMergedContent']['get'](_0x236756)),_0xfbc204=_0xfbc204['filter'](({node:_0x23f874})=>[...Rs(_0x23f874),_0x23f874]['every'](_0x36c0cb=>!fs(_0x36c0cb,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x4b759c=>_0x4b759c['documentId']!==_0x236756),0x0==_0xfbc204['length'])return;const _0x3c46ac=[[_0xfbc204[0x0]]];for(let _0x5cb2c9=0x1;_0x5cb2c9<_0xfbc204['length'];_0x5cb2c9++){const _0x28611b=_0x3c46ac[_0x3c46ac['length']-0x1],_0x529ea1=_0x28611b[_0x28611b['length']-0x1];_0xfbc204[_0x5cb2c9]['node']['previousSibling']==_0x529ea1['node']&&'modified'!=_0xfbc204[_0x5cb2c9]['type']&&'modified'!=_0x529ea1['type']?_0x28611b['push'](_0xfbc204[_0x5cb2c9]):_0x3c46ac['push']([_0xfbc204[_0x5cb2c9]]);}for(const _0x3f2e8e of _0x3c46ac){const _0x5430bf=_0x3f2e8e[0x0],_0x2b699b=_0x3f2e8e[_0x3f2e8e['length']-0x1],_0x896cb0=_0x10cfe8(_0x5430bf['node']['previousSibling']);_0x896cb0&&_0x3f2e8e['unshift'](_0x896cb0);const _0x256fbb=_0x10cfe8(_0x2b699b['node']['nextSibling']);_0x256fbb&&_0x3f2e8e['push'](_0x256fbb);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x236756))['forEach'](_0x490fe8=>{bs(_0x490fe8,'data-wrapped-id',null);});const _0xfb64e2=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x236756))['forEach'](_0x1950ba=>{const _0x55a873=fs(_0x1950ba,'data-unwrapped-id'),_0x93a507=fs(_0x1950ba,'data-id');_0xfb64e2['set'](_0x93a507,_0x55a873),bs(_0x1950ba,'data-id',_0x55a873),bs(_0x1950ba,'data-unwrapped-id',null);});for(const _0x1b3fe9 of _0xfbc204){const _0x525822=_0xfb64e2['get'](_0x1b3fe9['id']);_0x525822&&(_0x1b3fe9['id']=_0x525822);}this['changeGroups']['push'](..._0x3c46ac['map']((_0x48bfeb,_0xbe6926)=>({'changes':_0x48bfeb,'state':'pending','index':_0xbe6926,'editor':this['_documentIdToSource']['get'](_0x236756)['editor'],'rootName':this['_documentIdToSource']['get'](_0x236756)['rootName'],'documentId':_0x236756})));const _0x5dfcf0=Array['from'](this['documentContextContent']['keys']());function _0x16249e(_0x3d7965){return _0x2fa990['modifiedNodeIds']['includes'](_0x3d7965)||_0x2fa990['newNodeIds']['includes'](_0x3d7965)||_0x2fa990['removedNodeIds']['includes'](_0x3d7965);}function _0x10cfe8(_0x3f8d8d){if(_0x3f8d8d&&fs(_0x3f8d8d,'data-id')&&!fs(_0x3f8d8d,'data-unstable')){const _0x365938=fs(_0x3f8d8d,'data-id');if(!_0x16249e(_0x365938))return{'node':_0x3f8d8d,'type':'context','id':_0x365938};}return null;}this['changeGroups']['sort']((_0x33bcf2,_0x20ae98)=>_0x5dfcf0['indexOf'](_0x33bcf2['documentId'])-_0x5dfcf0['indexOf'](_0x20ae98['documentId'])),this['changeGroups']['forEach']((_0x2fcd4f,_0x5b2f1f)=>{_0x2fcd4f['index']=_0x5b2f1f;});}};const An=/* #__PURE__ -- @preserve */
29
- ut(),In=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var pn=class extends An{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x320bae,locale:_0x3e8db8,channelsToEditors:_0x196de3}){super(),this['id']=vt(),this['connector']=_0x320bae,this['isStopped']=!0x0,this['locale']=_0x3e8db8,this['_channelsToEditors']=_0x196de3||new Map();}async['start'](){await this['_run']();}async['resume'](_0xc318db){await this['_run'](_0xc318db);}async['_run'](_0x2947d6){const _0x326839=[];let _0x1ed960,_0xf4c243,_0x33e163,_0x1cae75=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x2947d6||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0xbc41a9=await this['currentRequest']['getStream']();for await(const _0x14153b of _0xbc41a9){if(this['isStopped'])return;if('error'==_0x14153b['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x14153b['event']){case'message-metadata':this['messageId']=_0x14153b['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x14153b['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x14153b['data']['conversationTitle'],!0x0);break;case'source':_0x326839['push'](_0x14153b['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'](),_0x1ed960='modification-delta'==_0x14153b['event']?'modification':'text',_0xf4c243='modification-delta'==_0x14153b['event']?_0x14153b['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x1ed960&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x1ed960,'interactionId':this['id'],'id':_0xf4c243,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x14153b['event']&&{'documentId':_0x14153b['data']['documentId']}}),'modification'==_0x1ed960&&(this['currentReply']['sources']=_0x326839['splice'](0x0))),this['currentReply']['appendContent'](_0x14153b['data']['textDelta'],_0x14153b['data']['documentId']);break;case'mcp-tool-result':_0x33e163=JSON['parse'](_0x14153b['data']['result']),this['_handleToolResultData']({'toolName':_0x14153b['data']['toolName'],'data':_0x33e163['data'],'attributes':_0x33e163['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x14153b['data']['toolName'],'data':_0x14153b['data']['data']});}}_0x1cae75=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x326839['length']>0x0&&(this['currentReply']['sources']=_0x326839['splice'](0x0)),this['_finalizeInteraction'](_0x1cae75),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x1c6f7e){return this['replies']['find'](_0x591ea8=>_0x591ea8['id']===_0x1c6f7e);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x385117=>_0x385117['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x3d0d28){const _0x943d29=this['getDocumentContext'](),_0x48bae3=new gn({'locale':this['locale'],'documentContextContent':_0x943d29?.['documents'],..._0x3d0d28});return this['replies']['push'](_0x48bae3),_0x48bae3['delegate'](...In)['to'](this),this['fire']('replyCreated',_0x48bae3),_0x48bae3;}['setConversationTitle'](_0x1b6c23,_0x417913=!0x1){this['fire']('setConversationTitle',_0x1b6c23,_0x417913);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x437ebc){this['fire']('toolDataReceived',{'type':'result','toolName':_0x437ebc['toolName'],'data':structuredClone(_0x437ebc['data']||{}),'attributes':structuredClone(_0x437ebc['attributes']||{})},this);}['_handleToolNotificationData'](_0xdb9059){this['fire']('toolDataReceived',{'type':'notification','toolName':_0xdb9059['toolName'],'data':structuredClone(_0xdb9059['data'])},this);}['_finalizeInteraction'](_0x166929=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x166929),this['currentRequest']=this['currentReply']=void 0x0;}};const mn=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']]),En=/* #__PURE__ -- @preserve */
30
- gt(),Tn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var wn=class AIChatContext extends En{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x3ccba3,config:_0x3eec62,ownerId:_0x21e8b4}){super(),this['_connector']=_0x3ccba3,this['_config']=_0x3eec62,this['_ownerId']=_0x21e8b4;}['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'](_0x904c01,_0x39d075){const _0x306386=new Map(),{contextItem:_0x5550a7,hasUnmatched:_0x553e5c}=await this['_populateDocumentContextItem'](_0x904c01,_0x39d075);_0x5550a7&&_0x306386['set'](_0x5550a7['id'],_0x5550a7);for(const _0x5468d4 of _0x904c01){if('document'===_0x5468d4['type'])continue;const _0x14950d=await this['_createContextItemFromContent'](_0x5468d4);this['_addToConversationContextItem'](_0x14950d),_0x306386['set'](_0x14950d['id'],_0x14950d);}return{'contextItems':_0x306386,'hasUnmatched':_0x553e5c};}async['_populateDocumentContextItem'](_0x4a5d87,_0x5ebdb8){const _0x488c71=_0x4a5d87['filter'](_0x408a7d=>'document'===_0x408a7d['type']);if(0x0===_0x488c71['length'])return{'hasUnmatched':!0x1};const _0x3eb1c5=_0x488c71['map'](_0x566e08=>_0x566e08['id']),_0x4e1243=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x3eb1c5)['getDocuments'](),_0x56d7ce=new Map(_0x4e1243['map'](_0x560f34=>[_0x560f34['id'],_0x560f34])),_0x29f445=[];let _0x5c076e=!0x1;for(const _0x3ce6ac of _0x488c71){const _0x393203=_0x56d7ce['get'](_0x3ce6ac['id']);_0x393203&&(this['_matchDocumentToRoot'](_0x393203,_0x5ebdb8)||(_0x5c076e=!0x0),_0x29f445['push']({'id':_0x393203['id'],'content':_0x393203['content'],'version':_0x393203['attributes']?.['version']??0x0,'sessionId':_0x393203['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x393203['attributes']?.['channelId']??_0x5ebdb8[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x393203['attributes']?.['rootName']??_0x5ebdb8[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x5c52d5={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x29f445};return this['_addToConversationContextItem'](_0x5c52d5),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x5c52d5,'hasUnmatched':_0x5c076e};}['_matchDocumentToRoot'](_0x52f875,_0x444039){const _0x59757f=_0x52f875['attributes']?.['channelId'],_0x46da50=_0x52f875['attributes']?.['rootName'];if(_0x59757f&&_0x46da50){for(const _0x19f9c4 of _0x444039)if(_0x19f9c4['config']['get']('collaboration.channelId')===_0x59757f){for(const _0x944162 of _0x19f9c4['model']['document']['getRoots']())if('$graveyard'!==_0x944162['rootName']&&_0x944162['rootName']===_0x46da50)return{'editor':_0x19f9c4,'rootName':_0x944162['rootName']};}}}async['_createContextItemFromContent'](_0x341cb2){return'mcp-tool-context'===_0x341cb2['type']?{'id':_0x341cb2['id'],'uiId':_0x341cb2['id'],'label':_0x341cb2['data']?.['label']||_0x341cb2['id'],'type':'mcp-tool-context','mcpServerName':_0x341cb2['mcpServerName'],'toolName':_0x341cb2['toolName'],'data':_0x341cb2['data']||{}}:{'id':_0x341cb2['id'],'uiId':_0x341cb2['id'],'label':_0x341cb2['attributes']?.['label']||_0x341cb2['name']||_0x341cb2['url']||_0x341cb2['id'],'type':_0x341cb2['type'],..._0x341cb2?.['attributes']?.['resourceId']?{'resourceId':_0x341cb2['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x1ee0a8){this['_pendingContextItems']['get'](_0x1ee0a8)?.['isReadOnly']||this['_removeContextItem'](_0x1ee0a8);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x41d144 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x41d144['uiId']);const _0x32f1c6=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x32f1c6&&this['_addContextItem']({..._0x32f1c6,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x5ea5e4){for(const _0x29c765 of _0x5ea5e4['values']())this['_addToConversationContextItem'](_0x29c765);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'](_0x5e182d){return Array['from'](_0x5e182d['values']())['flatMap'](_0x8ba50a=>this['_mapContextItemToRequestData'](_0x8ba50a));}async['addFilesToContext'](_0x439fce,_0x52686b,_0x523315='file'){const _0x3bdae6='files-'+vt();this['_startUploadOperation'](_0x3bdae6);try{await Promise['all'](_0x439fce['map'](async _0x298946=>{const _0xbdca16='file-'+vt(),_0x152ea0=_0x4495a6(_0x298946['name']),_0x3fa716='file'===_0x523315&&_0x298946['type']['startsWith']('image/')?'image':_0x523315;try{this['_addContextItem']({'type':_0x3fa716,'label':_0x52686b?.['label']||_0x152ea0,'uiId':_0xbdca16,'resourceId':_0x52686b?.['resourceId']},!0x0);const _0x5bb5ee=this['_connector']['uploadFile'](this['_ownerId'],_0x298946,_0x52686b);this['_ongoingUploads']['set'](_0xbdca16,_0x5bb5ee['abortController']);const {id:_0x176de4}=await _0x5bb5ee['getId']();this['_ongoingUploads']['delete'](_0xbdca16),this['_finishContextItemLoading']({'type':_0x3fa716,'id':_0x176de4,'label':_0x52686b?.['label']||_0x152ea0,'uiId':_0xbdca16,'resourceId':_0x52686b?.['resourceId']},!0x1);}catch(_0x31d4a2){if(this['_ongoingUploads']['delete'](_0xbdca16),!nn(_0x31d4a2)){const _0x1aa8c1=new rn({'code':mn['get'](_0x31d4a2['code'])||'ai-chat-file-upload-failed','cause':_0x31d4a2,'context':{'fileName':_0x152ea0}});this['fire']('error',{'error':_0x1aa8c1});}this['_removeContextItem'](_0xbdca16);}}));}finally{this['_finishUploadOperation'](_0x3bdae6);}}['addCurrentDocumentToContext'](_0x4e4b3b){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x1754d6={'type':'document','uiId':'current-document','label':_0x4e4b3b,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x1754d6);}async['updateCurrentDocuments'](_0x5bc0a4){const _0x294316=this['_pendingContextItems']['get']('current-document');if(!_0x294316||!_0x5bc0a4['length']||_0x5bc0a4['every'](_0xdabde2=>!_0xdabde2['content']))return;_0x5bc0a4['length']>0x1&&_0x5bc0a4['some'](_0x3a55f6=>!_0x3a55f6['description'])&&bt('ai-chat-documents-missing-description');try{const _0x59a21f=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x5bc0a4)['getIds']();if(_0x59a21f['length']!==_0x5bc0a4['length']||_0x59a21f['some'](_0x3b37ef=>!_0x3b37ef?.['id'])){const _0x39e504=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x39e504});}_0x294316['documents']=_0x5bc0a4['map']((_0x3ab968,_0x58b5e2)=>{return{'id':_0x59a21f[_0x58b5e2]['id'],'content':_0x3ab968['content'],'version':_0x3ab968['version'],'sessionId':_0x3ab968['sessionId'],'selection':(_0x4496de=_0x3ab968['selections'],_0x4496de?_0x4496de['map'](_0x309192=>({'start':_0x309192['start'],'end':_0x309192['end']})):[]),'channelId':_0x3ab968['channelId'],'rootName':_0x3ab968['rootName']};var _0x4496de;});}catch(_0x486d8f){const _0x4cb49d=new rn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x486d8f});this['fire']('error',{'error':_0x4cb49d});}}['addSelectionToContext'](_0x1ed761){this['_addContextItem']({'type':'selection','label':_0x1ed761,'uiId':'selection','content':_0x1ed761});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x2c3afd,_0x3aa05b){const _0x10e401='url-'+vt();this['_startUploadOperation'](_0x10e401);const _0x13d2d5='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x3aa05b?.['label']||_0x2c3afd,'uiId':_0x13d2d5,'resourceId':_0x3aa05b?.['resourceId']},!0x0);const _0x50d17d=this['_connector']['uploadUrl'](this['_ownerId'],_0x2c3afd,_0x3aa05b);this['_ongoingUploads']['set'](_0x13d2d5,_0x50d17d['abortController']);const {id:_0x27aef9}=await _0x50d17d['getId']();this['_ongoingUploads']['delete'](_0x13d2d5),this['_finishContextItemLoading']({'type':'web-resource','id':_0x27aef9,'label':_0x3aa05b?.['label']||_0x2c3afd,'uiId':_0x13d2d5,'resourceId':_0x3aa05b?.['resourceId']},!0x1);}catch(_0x19e25e){this['_ongoingUploads']['delete'](_0x13d2d5),nn(_0x19e25e)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x2c3afd,'originalError':_0x19e25e}),'url':_0x2c3afd}),this['_removeContextItem'](_0x13d2d5);}finally{this['_finishUploadOperation'](_0x10e401);}}['addToolItemToContext'](_0x93af3e){_0x93af3e['id']=_0x93af3e['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x93af3e['uiId'],_0x93af3e),this['fire']('contextItemAdded',{'contextItem':_0x93af3e,'isLoading':!0x1});}async['loadSourceResources'](_0x539182,_0x34f7ea,_0x3e0678){const _0x2d01f9=this['_addContextOptionsState']['sources']['find'](_0x4ab67d=>_0x4ab67d['id']===_0x539182);if(!_0x2d01f9)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x539182}),'sourceId':_0x539182}),[];try{const _0x892a78=(await _0x2d01f9['getResources'](_0x34f7ea))['map'](_0x345a5e=>{const _0x338cbe=this['_isResourceInContext'](_0x345a5e['id']);return{..._0x345a5e,'isInContext':_0x338cbe};});return _0x2d01f9['resources']=_0x892a78,this['fire']('sourceResourcesLoaded',{'sourceId':_0x539182,'source':_0x2d01f9,'resources':_0x892a78,'uid':_0x3e0678}),_0x892a78;}catch(_0x8bbe9b){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x539182,'originalError':_0x8bbe9b}),'sourceId':_0x539182,'sourceLabel':_0x2d01f9['label']}),[];}}async['addResourceToContext'](_0x5ef0b1,_0x546c84){if(this['_isResourceInContext'](_0x546c84['id']))return;let _0x5d4a54=_0x546c84['data'];if(!_0x5d4a54&&_0x5ef0b1['getData'])try{_0x5d4a54=await _0x5ef0b1['getData'](_0x546c84['id']);}catch(_0x145e0b){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id'],'originalError':_0x145e0b}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});}if(_0x5d4a54)switch(_0x546c84['type']){case'web-resource':if('string'!=typeof _0x5d4a54)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id'],'expectedType':'string','actualType':typeof _0x5d4a54}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});await this['addUrlToContext'](_0x5d4a54,{'label':_0x546c84['label'],'resourceId':_0x546c84['id']});break;case'file':if(!(_0x5d4a54 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id'],'expectedType':'File','actualType':typeof _0x5d4a54}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});await this['addFilesToContext']([_0x5d4a54],{'label':_0x546c84['label'],'resourceId':_0x546c84['id']});break;case'text':if('object'!=typeof _0x5d4a54||!('content'in _0x5d4a54)||!('type'in _0x5d4a54))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x5d4a54}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});_0x5d4a54=AIChatContext['_convertTextResourceToFile'](_0x5d4a54,_0x546c84['label']),await this['addFilesToContext']([_0x5d4a54],{'label':_0x546c84['label'],'resourceId':_0x546c84['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id'],'resourceType':_0x546c84['type']}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']}),'resourceId':_0x546c84['id'],'sourceId':_0x5ef0b1['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x4a519e){if(void 0x0!==_0x4a519e)this['_addContextOptionsState']['document']['isHidden']=!_0x4a519e;else{const _0x303022=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x303022;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x486a30,_0x350cb1){switch(_0x486a30['type']){case'markdown':return new File([_0x486a30['content']],_0x350cb1,{'type':'text/markdown'});case'html':return new File([_0x486a30['content']],_0x350cb1,{'type':'text/html'});default:return new File([_0x486a30['content']],_0x350cb1,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x18c9b4){switch(_0x18c9b4['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x18c9b4['id']}];case'web-resource':return[{'type':'web-resource','id':_0x18c9b4['id']}];case'document':return _0x18c9b4['documents']?.['length']?_0x18c9b4['documents']['map'](_0x30b7e5=>({'type':'document','id':_0x30b7e5['id'],..._0x30b7e5['selection']?.['length']&&{'selection':_0x30b7e5['selection']}})):[];case'mcp-tool-context':{const _0x347aa2=_0x18c9b4;return[{'type':'mcp-tool-context','mcpServerName':_0x347aa2['mcpServerName'],'toolName':_0x347aa2['toolName'],'data':{..._0x347aa2['data'],'label':_0x347aa2['label']||_0x347aa2['data']?.['label']||_0x347aa2['id']},'id':_0x347aa2['id']}];}default:return[];}}['_addContextItem'](_0xa03e3c,_0x53c8e5=!0x1){if(this['_pendingContextItems']['set'](_0xa03e3c['uiId'],_0xa03e3c),_0xa03e3c['hidden']||this['fire']('contextItemAdded',{'contextItem':_0xa03e3c,'isLoading':_0x53c8e5}),'current-document'===_0xa03e3c['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0xa03e3c['resourceId']){const _0x31c78d=this['_findSourceIdsByResourceId'](_0xa03e3c['resourceId']);_0x31c78d&&_0x31c78d['forEach'](_0x4084b9=>{this['_updateResourceInContextState'](_0x4084b9,_0xa03e3c['resourceId'],!0x0);});}}['_removeContextItem'](_0x44b12d){const _0x29022e=this['_pendingContextItems']['get'](_0x44b12d),_0x97f77a=this['_ongoingUploads']['get'](_0x44b12d);if(_0x97f77a&&(_0x97f77a['abort'](),this['_ongoingUploads']['delete'](_0x44b12d)),_0x29022e?.['resourceId']){const _0x1354d2=this['_findSourceIdsByResourceId'](_0x29022e['resourceId']);_0x1354d2&&_0x1354d2['forEach'](_0x503733=>{this['_updateResourceInContextState'](_0x503733,_0x29022e['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x44b12d),this['fire']('contextItemRemoved',{'uiId':_0x44b12d,'type':_0x29022e?.['type']}),'current-document'===_0x44b12d&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0xf0a1ef,_0xa46811){if(this['_pendingContextItems']['has'](_0xf0a1ef['uiId'])&&(this['_pendingContextItems']['set'](_0xf0a1ef['uiId'],_0xf0a1ef),this['fire']('contextItemLoadingEnded',{'contextItem':_0xf0a1ef,'isLoading':_0xa46811}),_0xf0a1ef['resourceId'])){const _0x59e896=this['_findSourceIdsByResourceId'](_0xf0a1ef['resourceId']);_0x59e896&&_0x59e896['forEach'](_0x427f62=>{this['_updateResourceInContextState'](_0x427f62,_0xf0a1ef['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x1e68a1){this['_conversationContextItems']['set'](_0x1e68a1['uiId'],_0x1e68a1);}['_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'](_0x574984=>({..._0x574984,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x561a04=>({..._0x561a04,'resources':[]}))??[];}['_isResourceInContext'](_0x35e407){for(const _0x1606f0 of this['_pendingContextItems']['values']())if(_0x1606f0['resourceId']===_0x35e407)return!0x0;for(const _0x699223 of this['_conversationContextItems']['values']())if(_0x699223['resourceId']===_0x35e407)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x1cc932){const _0x2ecc97=[];for(const _0x21fc94 of this['_addContextOptionsState']['sources'])_0x21fc94['resources']['find'](_0x37f157=>_0x37f157['id']===_0x1cc932)&&_0x2ecc97['push'](_0x21fc94['id']);return 0x0===_0x2ecc97['length']?null:_0x2ecc97;}['_updateResourceInContextState'](_0x1cc4fe,_0xce83a4,_0x27af25){const _0x108b55=this['_addContextOptionsState']['sources']['find'](_0x389591=>_0x389591['id']===_0x1cc4fe);if(!_0x108b55)return;const _0x151cc2=_0x108b55['resources']['find'](_0x43e23b=>_0x43e23b['id']===_0xce83a4);_0x151cc2&&(_0x151cc2['isInContext']=_0x27af25,this['fire']('resourceStateChanged',{'sourceId':_0x1cc4fe,'resourceId':_0xce83a4,'isInContext':_0x27af25}));}['_startUploadOperation'](_0xe3abf9){this['_ongoingUploadOperations']['set'](_0xe3abf9,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x2a66b6){this['_ongoingUploadOperations']['delete'](_0x2a66b6),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Cn=/* #__PURE__ -- @preserve */
31
- ut(),fn=['capabilitiesUpdated'];var bn=class extends Cn{['_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'](_0x1a9162){const _0x55c24c={};return _0x1a9162&&_0x1a9162['isWebSearchEnabled']&&(_0x55c24c['webSearch']={}),_0x1a9162&&_0x1a9162['isReasoningEnabled']&&(_0x55c24c['reasoning']={}),_0x55c24c;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0xe8ef3e){_0xe8ef3e!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0xe8ef3e,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x8de5dd){_0x8de5dd!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x8de5dd,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},Sn=class extends pn{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x24cf19){super(_0x24cf19),this['conversationId']=_0x24cf19['conversationId'],this['contextItems']=_0x24cf19['contextItems'],this['capabilities']=_0x24cf19['capabilities'],this['userMessage']=_0x24cf19['userMessage'],this['model']=_0x24cf19['model'],this['attributes']=_0x24cf19['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':wn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':bn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Rn=/* #__PURE__ -- @preserve */
32
- ut();var On=class extends Rn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x46b5d1){super(),this['options']=_0x46b5d1,this['connector']=_0x46b5d1['connector'],this['chatModels']=_0x46b5d1['chatModels'],this['id']=_0x46b5d1['conversationId'],this['isFromHistory']=_0x46b5d1['isFromHistory'],this['_channelsToEditors']=_0x46b5d1['channelsToEditors'],this['_getSessionId']=_0x46b5d1['getSessionId'];}async['init'](_0x39df39){try{this['chatContext']=new wn({'connector':this['connector'],'config':_0x39df39,'ownerId':this['id']}),this['chatContext']['delegate'](...Tn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new bn(),this['chatCapabilities']['delegate'](...fn)['to'](this),this['chatCapabilities']['init']();const _0x5503cc=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x5503cc});const _0x56edc0=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x56edc0&&await this['setModel'](_0x56edc0);}catch(_0x17bc2e){const _0x2781bc=new rn({'code':'ai-chat-conversation-init-failed','cause':_0x17bc2e,'type':'network'});this['fire']('error',{'error':_0x2781bc});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x555c46}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x555c46,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x397cd9){const _0x1baa73=new rn({'code':'ai-chat-conversation-start-failed','cause':_0x397cd9,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x1baa73}),_0x1baa73;}}async['load'](_0x39cd3c){try{const _0x5fc261=await this['connector']['fetchConversation'](_0x39cd3c)['getConversation'](),_0x1c98f1=await this['connector']['fetchConversationMessages'](_0x39cd3c)['getMessages'](),_0x4c9c1e=_0x1c98f1[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5fc261['id'],'title'in _0x5fc261?this['fire']('setConversationTitle',_0x5fc261['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x289894=(await this['chatModels']['getAll']())['find'](_0x55af19=>_0x55af19['id']['toLowerCase']()===_0x4c9c1e['toLowerCase']());this['selectedModel']=_0x289894,this['fire']('modelSelected',{'selectedModel':_0x289894,'isDisabled':!0x0});const {streamingMessageId:_0x561a8c}=await this['_processMessagesToInteractions'](_0x1c98f1,_0x4c9c1e);return _0x561a8c&&this['currentInteraction']?this['_resumeStream'](_0x561a8c):this['currentInteraction']=void 0x0,this;}catch(_0x2f0b8c){const _0x1a5ac1=new rn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x2f0b8c,'type':'network','context':{'conversationId':_0x39cd3c}});throw this['fire']('error',{'error':_0x1a5ac1}),_0x1a5ac1;}}async['_processMessagesToInteractions'](_0x525ada,_0x4b99de){let _0x5dff59,_0xb3fee8,_0x292c56=!0x1;for(const _0x332a29 of _0x525ada)if('user'===_0x332a29['role']){const {contextItems:_0x3c9a78,hasUnmatched:_0x109d78}=await this['_extractContextItems'](_0x332a29);_0x292c56=_0x109d78;const _0x5dafab={'isReasoningEnabled':Object['hasOwn'](_0x332a29['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x332a29['capabilities'],'webSearch')};_0x5dff59=this['createInteraction']({'userMessage':_0x332a29['prompt'],'contextItems':_0x3c9a78,'capabilities':_0x5dafab,'modelId':_0x4b99de,'attributes':_0x332a29['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x5dff59,_0xb3fee8=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x332a29['role']&&_0x5dff59){if('streaming'===_0x332a29['status']){_0xb3fee8=_0x332a29['id'];continue;}if('error'===_0x332a29['status'])continue;const _0x4a3f78=[];for(const _0x132a5e of _0x332a29['content'])switch(_0x132a5e['type']){case'text':case'modification':{const _0x38314f=_0x5dff59['getDocumentContext'](),_0x1a1068=this['_hasSessionMismatch'](_0x38314f)||_0x292c56;_0x5dff59['currentReply']?.['type']!==_0x132a5e['type']&&(_0x5dff59['currentReply']=_0x5dff59['createReply']({'type':_0x132a5e['type'],'isDone':!0x0,'interactionId':_0x5dff59['id'],'areActionsDisabled':_0x1a1068,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x4a3f78['length']>0x0&&(_0x5dff59['currentReply']['sources']=_0x4a3f78['splice'](0x0))),_0x5dff59['currentReply']['appendContent'](_0x132a5e['content'],_0x132a5e['documentId']);break;}case'url':_0x4a3f78['push'](_0x132a5e);break;case'mcp-tool-result':{const {data:_0x190fb4,attributes:_0x45d699}=JSON['parse'](_0x132a5e['content']);_0x5dff59['_handleToolResultData']({'toolName':_0x132a5e['toolName'],'data':_0x190fb4,'attributes':_0x45d699});break;}}'cancelled'===_0x332a29['status']&&this['fire']('error',{'interactionId':_0x5dff59['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0xb3fee8};}async['_resumeStream'](_0xf12c9a){if(this['currentInteraction'])try{const _0x177dc8=this['connector']['resumeStream'](this['id'],_0xf12c9a);await this['currentInteraction']['resume'](_0x177dc8);}catch(_0x9f9a72){_0x9f9a72 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x9f9a72});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x4bfc53){return _0x4bfc53['content']?this['chatContext']['populateFromMessage'](_0x4bfc53['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x213ffc,attributes:_0x4d41d7}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x760000=new Map(this['getPendingContextItems']()),_0x40184b=this['chatCapabilities']['getCapabilitiesConfig'](),_0xa73e0b=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x213ffc,'contextItems':_0x760000,'capabilities':_0x40184b,'modelId':_0xa73e0b,'attributes':_0x4d41d7,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x542793){if(_0x542793 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x542793});else{const _0x2d9c92=mn['get'](_0x542793['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x2d9c92,null,{'error':_0x542793})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x3c7353,contextItems:_0x27d40d,capabilities:_0x5ea905,modelId:_0x349591,attributes:_0x565483,channelsToEditors:_0x52a972}){const _0x193c0a=new Sn({'userMessage':_0x3c7353,'contextItems':_0x27d40d,'capabilities':_0x5ea905,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x349591,'attributes':_0x565483,'channelsToEditors':_0x52a972});return _0x193c0a['delegate'](...In)['to'](this),this['interactions']['push'](_0x193c0a),this['fire']('interactionCreated',_0x193c0a),_0x193c0a;}['getInteraction'](_0x22f869){return this['interactions']['find'](_0x150721=>_0x150721['id']===_0x22f869);}['removeInteraction'](_0x28e196){const _0x2c2786=this['getInteraction'](_0x28e196);_0x2c2786&&(_0x2c2786['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x2c2786),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x593a27=this['lastInteraction'];_0x593a27?.['conversationId']&&_0x593a27['messageId']&&this['connector']['cancelStream'](_0x593a27['conversationId'],_0x593a27['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x408afd){this['chatContext']['addCurrentDocumentToContext'](_0x408afd);}async['updateCurrentDocumentsInContext'](_0x3037e2){await this['chatContext']['updateCurrentDocuments'](_0x3037e2);}['toggleAddCurrentDocumentOptionVisibility'](_0x57ab49){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x57ab49);}['_hasSessionMismatch'](_0x128440){return!!_0x128440&&_0x128440['documents']['some'](_0x1d239a=>{const _0x5ed9e5=this['_channelsToEditors']['get'](_0x1d239a['channelId']);return!_0x5ed9e5||_0x1d239a['sessionId']!==this['_getSessionId'](_0x5ed9e5);});}['addSelectionToContext'](_0x1e4241){this['chatContext']['addSelectionToContext'](_0x1e4241);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x165ebb){this['chatContext']['addFilesToContext'](_0x165ebb);}['addUrlToContext'](_0x7ebcc){this['chatContext']['addUrlToContext'](_0x7ebcc);}['addToolItemToContext'](_0x2ad128){this['chatContext']['addToolItemToContext'](_0x2ad128);}['addResourceToContext'](_0x1d8d9e,_0x5dece0){this['chatContext']['addResourceToContext'](_0x1d8d9e,_0x5dece0);}['loadSourceResources'](_0x5d23c9,_0x1746f9,_0x42aad8){return this['chatContext']['loadSourceResources'](_0x5d23c9,_0x1746f9,_0x42aad8);}['removeFromContext'](_0x3a67e9){this['chatContext']['removeFromContext'](_0x3a67e9);}['setWebSearch'](_0x1aa5f3){this['chatCapabilities']['setWebSearch'](_0x1aa5f3);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x438390){this['chatCapabilities']['setReasoning'](_0x438390);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x260cd6){_0x260cd6?!0x1===await this['chatModels']['isAvailable'](_0x260cd6)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x260cd6}),_0x260cd6=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x260cd6=(await this['chatModels']['getAvailableModels']())[0x0]),_0x260cd6['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x260cd6,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x260cd6}));}};function vn({groups:_0x50f06c,documentContextContent:_0x403300,documents:_0x4b4fb8}){const _0x2feaa4=new Map();for(const _0x4231fe of _0x50f06c){const {documentId:_0x8baab8}=_0x4231fe,_0x20796e=_0x2feaa4['get'](_0x8baab8);if(_0x20796e)_0x20796e['groups']['push'](_0x4231fe),_0x20796e['indexes']['push'](_0x4231fe['index']);else{const _0x1fa35e=_0x4b4fb8['find'](_0x599160=>_0x599160['id']===_0x8baab8),_0x3beb1b=_0x403300['get'](_0x8baab8);if(!_0x1fa35e||!_0x3beb1b)continue;_0x2feaa4['set'](_0x8baab8,{'groups':[_0x4231fe],'documentContext':_0x1fa35e,'documentContent':_0x3beb1b,'editor':_0x4231fe['editor'],'indexes':[_0x4231fe['index']]});}}return _0x2feaa4;}function kn(_0x25329c,_0x1511c2){const _0x5a18a7=_0x25329c['files']['length']>0x0&&_0x25329c['files']['every'](_0x118a18=>_0x118a18['type']['startsWith']('image/')),_0x53f71c=_0x25329c['plainText']['trim']()['length']>0x0;if(_0x25329c['files']['length']>0x0&&_0x1511c2['filesEnabled']&&(!_0x5a18a7||!_0x53f71c)){const _0x138655=_0x25329c['files']['filter'](_0x30c762=>_0x30c762['name']);return _0x138655['length']>0x0?{'type':'file','files':_0x138655}:null;}if(_0x1511c2['urlsEnabled']){const _0x3a7ab4=function(_0x54bfeb){const _0x41fbae=_0x54bfeb['trim']();if(/\s/['test'](_0x41fbae))return null;try{const _0x15a6ec=new URL(_0x41fbae);return'http:'!==_0x15a6ec['protocol']&&'https:'!==_0x15a6ec['protocol']?null:_0x15a6ec['toString']();}catch{return null;}}(_0x25329c['plainText']);if(_0x3a7ab4)return{'type':'url','url':_0x3a7ab4};}const _0x49a98c=_0x25329c['forceTextAttachment']?0x1:_0x1511c2['longTextThreshold']??0x1/0x0;if(_0x25329c['plainText']['length']>=Math['max'](_0x49a98c,0x1)&&_0x1511c2['filesEnabled']){const _0x4a00da=_0x1511c2['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x25329c['plainText']],_0x4a00da,{'type':'text/plain'})]};}return null;}var Nn=class extends _0x10611c{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,on,_0x22fa17];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=dn(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'](on)['createReporter']('aichat'),this['_aiChatModels']=new zs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x1ade07=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x3672f8,_0x23a3a2)=>{this['_handleUIUserMessage']({'message':_0x23a3a2});}),this['listenTo'](_0x1ade07['view'],'change:activeTab',(_0x58ef69,_0x392479,_0x47abaa)=>{'chat'!==_0x47abaa&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x57c293,_0x490127)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x490127));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x3d0209,_0x249ce4)=>{this['activeConversation']?.['addUrlToContext'](_0x249ce4);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x359013,_0xaab6bb)=>{const _0x5c7c77=this['activeConversation'];if(!_0x5c7c77)return;_0xaab6bb['hasDirectory']&&(_0xaab6bb['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x60e1dc=kn(_0xaab6bb,{'pastedTextLabel':us(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')});_0x60e1dc&&(_0xaab6bb['preventDefault'](),'url'===_0x60e1dc['type']?_0x5c7c77['addUrlToContext'](_0x60e1dc['url']):_0x5c7c77['chatContext']['addFilesToContext'](_0x60e1dc['files'],void 0x0,_0x60e1dc['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x53582d,_0x2ce775)=>{_0x2ce775['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x2556ef,_0x43636e)=>{this['activeConversation']?.['addResourceToContext'](_0x43636e['source'],_0x43636e['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x2d1725,_0x1c9fe5)=>{this['_removeFromContext'](_0x1c9fe5);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x4cb339,_0x54e1e1)=>{this['activeConversation']?.['loadSourceResources'](_0x54e1e1['sourceId'],_0x54e1e1['query'],_0x54e1e1['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x56d373,_0x1bd8f5)=>{this['activeConversation']?.['setModel'](_0x1bd8f5);}),this['listenTo'](this['_aiChatUi'],'like',(_0x1a5a9d,{replyId:_0x202a67})=>{console['log']('Liked\x20response',_0x202a67);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x779ba,{replyId:_0x143d78})=>{console['log']('Disliked\x20response',_0x143d78);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x1a18fc,_0x35f939)=>{this['_insertSuggestion'](_0x35f939);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x43c54d,{replyId:_0x413893,partIndex:_0x5de5ef})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x413893,_0x5de5ef);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x2d94ed,{replyId:_0x3ba191,partIndex:_0x5671b4})=>{const _0x686d64=this['_getDocumentRangeForReplyChanges'](_0x3ba191,_0x5671b4);if(!_0x686d64)return;const {reply:_0x9409e3}=this['getInteractionAndReplyById'](_0x3ba191);'$graveyard'!=_0x686d64['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x9409e3['changeGroups'][_0x5671b4]['editor'],'ranges':[_0x686d64['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0xd2cd85,_0x2b0121)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x2b0121);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x3be732,{replyId:_0x2a9e82,showDiff:_0x225acf})=>{const {interaction:_0x5e3e60,reply:_0x59e10c}=this['getInteractionAndReplyById'](_0x2a9e82),_0x1b46f1=_0x59e10c['getContentParts']({'showDiff':_0x225acf});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5e3e60['id']+':'+_0x59e10c['id'],'parts':_0x1b46f1});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x354191,{replyId:_0x4821a2,partIndex:_0x46b238})=>{this['_rejectSuggestion']({'replyId':_0x4821a2,'partIndex':_0x46b238}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x5e30ac,_0x1a32b8)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x1a32b8);}),this['on']('replyCreated',(_0x225d1a,_0x258f3d)=>{this['_addFeedItemReply'](_0x258f3d);});}['afterInit'](){this['context']instanceof _0x1bce0a?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x42e672,_0x5e90ee)=>{_0x5e90ee['on']('ready',()=>{this['_integrateEditor'](_0x5e90ee);});}),this['_initConversation']();}async['_initConversation'](){const _0x175990=this['context']['config']['get']('ai.chat.initialConversation');let _0xa74bd4=_0x175990;('lastCreated'!=_0x175990||(_0xa74bd4=await this['_getLastCreatedConversationId'](),_0xa74bd4))&&('new'==_0xa74bd4?await this['_startConversationSafely']():await this['loadConversation'](_0xa74bd4));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x181c49){this['_closeActiveBalloon'](),this['context']['plugins']['get'](cs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x181c49)['getConversation'](),await this['_startConversationSafely']({'id':_0x181c49}),await this['activeConversation']['load'](_0x181c49),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x3bbbc1){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x181c49}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x3bbbc1),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x4f5008){let _0x310f1c=null,_0x20c79a=null;this['on']('toolDataReceived',(_0x458c7f,_0x596523,_0x3aa4a6)=>{_0x3aa4a6['id']!==_0x310f1c&&(_0x310f1c=_0x3aa4a6['id'],_0x20c79a=this['_getAIChatFeedAPI'](_0x3aa4a6)),_0x4f5008(_0x596523,_0x20c79a);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x4e810d){const _0x5cec7e=this['_aiEditing']['getSelectionText'](_0x4e810d);this['activeConversation']?.['addSelectionToContext'](_0x5cec7e),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x5b0f84){await this['_startConversationSafely']({'modelId':_0x5b0f84?.['modelId']});}async['sendMessage'](_0x4caf71){await this['_handleUIUserMessage'](_0x4caf71);}['getGroupId'](){const _0x5dc14f=this['context']['config']['get']('collaboration.channelId');if(!_0x5dc14f)throw new ht('ai-missing-channel-id',this);return _0x5dc14f;}['_handleRemovedConversation'](_0x2d4fb2){this['activeConversation']['id']===_0x2d4fb2&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x226d48){const {reply:_0x2d112c,interaction:_0x4a3b64}=this['getInteractionAndReplyById'](_0x226d48['replyId']),_0x1ece19=void 0x0!==_0x226d48['partIndex']?[_0x2d112c['changeGroups'][_0x226d48['partIndex']]]:_0x2d112c['changeGroups']['filter'](_0x51db20=>'pending'==_0x51db20['state']);return _0x1ece19['map'](_0x59b336=>_0x2d112c['changeGroups']['indexOf'](_0x59b336))['forEach'](_0x1159f6=>{const _0x39b1ae=this['_getDocumentRangeForReplyChanges'](_0x226d48['replyId'],_0x1159f6);_0x39b1ae&&'$graveyard'!=_0x39b1ae['range']['root']['rootName']?(_0x2d112c['setChangeGroupState'](_0x1159f6,'accepted'),void 0x0!==_0x226d48['partIndex']&&this['_scrollToSuggestionRange'](_0x39b1ae['range'],!0x1,_0x39b1ae['targetEditor'])):_0x2d112c['setChangeGroupState'](_0x1159f6,'outdated');}),vn({'groups':_0x1ece19['filter'](_0x46597d=>'accepted'===_0x46597d['state']),'documentContextContent':_0x2d112c['documentContextContent'],'documents':_0x4a3b64['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x484bdc){const _0x18268e=this['context']['plugins']['get'](_0x22fa17),{reply:_0x2aaf02,interaction:_0x32b1db}=this['getInteractionAndReplyById'](_0x484bdc['replyId']),_0x4180e7=this['_prepareDocumentSuggestions'](_0x484bdc),_0x30aa60=Ns({'documentSuggestions':_0x4180e7,'transform':!0x0,'documentCompare':_0x18268e,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x1f90d6,_0x1a605f]of _0x30aa60){const {editor:_0x2a771b,indexes:_0x1f1deb}=_0x4180e7['get'](_0x1f90d6);if(!_0x2a771b['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0x2a771b});continue;}let _0x185e11;Js(_0x1a605f,'chat'),_0x2a771b['model']['change'](_0x4fa32e=>{_0x185e11=_0x4fa32e['batch'],_0x2a771b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1a605f),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x185e11,{'interactionId':_0x32b1db['id'],'replyId':_0x2aaf02['id'],'indexes':_0x1f1deb});}this['_updateRatings'](_0x2aaf02);}['_applySuggestion'](_0x3f773e){const _0x198f3c=this['context']['plugins']['get'](_0x22fa17),{reply:_0x351079,interaction:_0x3ef8a5}=this['getInteractionAndReplyById'](_0x3f773e['replyId']),_0x3ad6c9=this['_prepareDocumentSuggestions'](_0x3f773e),_0x43899e=Ns({'documentSuggestions':_0x3ad6c9,'transform':!0x0,'documentCompare':_0x198f3c,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x387fc3,_0x23809a]of _0x43899e){const {editor:_0x780a9a,indexes:_0x5b1557}=_0x3ad6c9['get'](_0x387fc3);let _0x5ec81b;Js(_0x23809a,'chat');try{_0x780a9a['model']['change'](_0x51fce4=>{_0x5ec81b=_0x51fce4['batch'];for(const _0x39a266 of _0x23809a)_0x39a266['baseVersion']=_0x780a9a['model']['document']['version'],ys(_0x780a9a,_0x39a266),_0x51fce4['batch']['addOperation'](_0x39a266),_0x780a9a['model']['applyOperation'](_0x39a266);}),this['_batchToChanges']['set'](_0x5ec81b,{'interactionId':_0x3ef8a5['id'],'replyId':_0x351079['id'],'indexes':_0x5b1557});}catch(_0x2169d6){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x2169d6})),_0x2169d6;}}this['_updateRatings'](_0x351079);}['_rejectSuggestion'](_0x115bbc){const {reply:_0x186499}=this['getInteractionAndReplyById'](_0x115bbc['replyId']);_0x186499['setChangeGroupState'](_0x115bbc['partIndex'],'rejected');}['_openBalloonFor'](_0x2162b4,_0x568a78){if(!this['_hasAIChatBalloon'])return;const {reply:_0x125f05}=this['getInteractionAndReplyById'](_0x2162b4),_0x1f0c58=_0x125f05['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x1f0c58['length'])return;let _0x3a2e2d,_0x5ce410;if(void 0x0!==_0x568a78?(_0x5ce410=_0x1f0c58['find'](_0x94063b=>_0x94063b['index']==_0x568a78),_0x3a2e2d=_0x5ce410?.['index']):(_0x5ce410=_0x1f0c58[0x0],_0x3a2e2d=_0x5ce410['index']),!_0x5ce410)return void _0x125f05['setChangeGroupState'](_0x568a78??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2162b4&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x3a2e2d)return;const _0x386291=this['_getUserPresentableContentPartDocumentRange'](_0x2162b4,_0x125f05,_0x5ce410),_0x1d1b03=_0x125f05['changeGroups']['find'](_0x2ee91d=>_0x2ee91d['index']==_0x3a2e2d)['editor'],_0xafbaf6=_0x1d1b03['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0xafbaf6&&this['_activeBalloon']['close'](),!_0x386291)return _0xafbaf6['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xafbaf6,this['_currentPreviewedChangeGroup']={'replyId':_0x2162b4,'partIndex':_0x3a2e2d},this['_scrollToSuggestionRange'](_0x386291,!0x0,_0x1d1b03);const _0xde9423=this['_getPresentableSiblingContentPartIndex'](_0x2162b4,_0x3a2e2d,'next');_0xafbaf6['clearContent'](),_0xafbaf6['updateContent']({'part':_0x5ce410,'renderingStrategy':'static'}),_0xafbaf6['open']({'index':_0x3a2e2d,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x3a2e2d+0x1)['toString']()),'showRotator':null!==_0xde9423,'ranges':[_0x386291],'areActionsDisabled':_0x125f05['areActionsDisabled'],'targetEditor':_0x1d1b03}),_0xafbaf6['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2162b4,_0x3a2e2d),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2162b4,'index':_0x3a2e2d,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x2ec3d5,_0x27c378,_0x52060b){const {reply:_0x2ea475}=this['getInteractionAndReplyById'](_0x2ec3d5),_0x48941b=_0x2ea475['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x48941b['length'])return null;const _0x50c248='next'==_0x52060b?0x1:-0x1;function _0x3d91f4(_0x5360a4){const _0x1179cf=(_0x5360a4+_0x50c248+_0x48941b['length'])%_0x48941b['length'];return{'siblingIndex':_0x1179cf,'siblingPart':_0x48941b[_0x1179cf]};}const _0x17bcee=_0x48941b['findIndex'](_0x2ea390=>_0x2ea390['index']==_0x27c378);let {siblingIndex:_0x280379,siblingPart:_0x179b16}=_0x3d91f4(_0x17bcee);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x2ec3d5,_0x2ea475,_0x179b16);)if({siblingIndex:_0x280379,siblingPart:_0x179b16}=_0x3d91f4(_0x280379),_0x280379===_0x17bcee)return null;return _0x179b16['index'];}['_getUserPresentableContentPartDocumentRange'](_0x406f45,_0x2efd0f,_0x52bfff){const _0x393495=_0x2efd0f['changeGroups'];if(!_0x52bfff['hasChanges'])return null;const _0xaca70f=_0x393495['find'](_0x4765db=>_0x4765db['index']==_0x52bfff['index']);if('pending'!==_0xaca70f?.['state'])return null;if(!_0xaca70f?.['editor']||'destroyed'===_0xaca70f['editor']['state'])return _0x2efd0f['setChangeGroupState'](_0x52bfff['index'],'outdated'),null;const _0x521d61=this['_getDocumentRangeForReplyChanges'](_0x406f45,_0x52bfff['index']);if(!_0x521d61)return _0x2efd0f['setChangeGroupState'](_0x52bfff['index'],'outdated'),null;const {range:_0x4ba79a,currentIndex:_0x5531f6}=_0x521d61;return'$graveyard'==_0x4ba79a['root']['rootName']?(_0x2efd0f['setChangeGroupState'](_0x5531f6,'outdated'),null):_0x521d61['range'];}['_getDocumentRangeForReplyChanges'](_0x1caf52,_0x16fbed){const {reply:_0x5236eb,interaction:_0x2bb1c0}=this['getInteractionAndReplyById'](_0x1caf52),_0x558ae4=_0x5236eb['changeGroups']['filter'](_0x3a0264=>'pending'==_0x3a0264['state']),_0x213c11=_0x558ae4['map'](_0x2313a1=>_0x5236eb['changeGroups']['indexOf'](_0x2313a1));void 0x0===_0x16fbed&&(_0x16fbed=_0x213c11[0x0]);const _0x2dea48=_0x213c11['indexOf'](_0x16fbed);if(-0x1==_0x2dea48)return null;const _0x484617=_0x558ae4[_0x2dea48],_0x28ccae=_0x484617['editor'];if(!_0x28ccae||'destroyed'===_0x28ccae['state'])return null;if(!_0x4c4eb3(_0x28ccae,_0x484617['rootName']))return null;const _0x2a5db8=_0x5236eb['documentContextContent']['get'](_0x484617['documentId']),_0x20f502=new _0x52e1ed([]),_0x2ce80c=new _0x52e1ed([]);for(const _0x2975b1 of _0x484617['changes'])if('removed'!=_0x2975b1['type']&&_0x2ce80c['children']['push'](_0x2975b1['node']['cloneNode'](!0x0)),'new'!=_0x2975b1['type']){const _0x47f2ef=ti(_0x29bc3b=>fs(_0x29bc3b,'data-id')==_0x2975b1['id'],_0x2a5db8,!0x0);_0x20f502['children']['push'](_0x47f2ef['cloneNode'](!0x0));}if(0x0==_0x20f502['children']['length']){if(_0x484617['changes'][0x0]['anchorId']){const _0x29c8a1=Es('data-id',_0x484617['changes'][0x0]['anchorId'],_0x2a5db8);_0x20f502['children']['unshift'](_0x29c8a1['cloneNode'](!0x0)),_0x2ce80c['children']['unshift'](_0x29c8a1['cloneNode'](!0x0)),_0x29c8a1['nextSibling']&&(_0x20f502['children']['push'](_0x29c8a1['nextSibling']['cloneNode'](!0x0)),_0x2ce80c['children']['push'](_0x29c8a1['nextSibling']['cloneNode'](!0x0)));}else{const _0x2962db=_0x2a5db8['children'][0x0];if(!_0x2962db)return null;_0x20f502['children']['push'](_0x2962db['cloneNode'](!0x0)),_0x2ce80c['children']['push'](_0x2962db['cloneNode'](!0x0));}}const _0x1d1978=_0x2bb1c0['getDocumentContext'](),_0x566696=_0x1d1978['documents']['find'](_0x49972e=>_0x49972e['id']==_0x484617['documentId'])['content'],_0x2e2cfe=_0x28ccae['model']['document']['getRoot'](_0x484617['rootName']),_0x18d010=_0x28ccae['data']['parse'](_0x566696,_0x2e2cfe),_0x41400e=ms(_0x20f502),_0x3ac2b3=_0x28ccae['data']['parse'](_0x41400e,_0x2e2cfe),_0x28ab82=_0x28ccae['data']['parse'](_0x41400e,_0x2e2cfe),_0x53f59b=_0x28ccae['model']['createPositionAt'](_0x3ac2b3,0x0),_0x40484f=ms(_0x2ce80c),_0x3ba651={'targetEditor':_0x28ccae,'anchor':_0x53f59b,'markDeletions':!0x1};let _0xbb954d;try{_0xbb954d=_0x28ccae['plugins']['get'](_0x22fa17)['getDiff'](_0x41400e,_0x40484f,_0x3ba651)['getOperations']();}catch(_0x336089){return this['_reporter']['reportError'](new rn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x336089,'context':{'replyId':_0x1caf52,'partIndex':_0x16fbed}})),null;}if(!_0xbb954d['length'])return null;_0x28ccae['model']['change'](_0x5af865=>{for(const _0xb01e04 of _0xbb954d)if('remove'==_0xb01e04['type']){const _0x19885b=_0xb01e04['sourcePosition'],_0x40f90d=_0xb01e04['howMany'],_0x554737=new _0x495311(_0x19885b,_0x40f90d);_0x5af865['batch']['addOperation'](_0x554737),_0x28ccae['model']['applyOperation'](_0x554737);}else'marker'!==_0xb01e04['type']&&(_0xb01e04['baseVersion']=null,_0xb01e04['isDocumentOperation']=!0x1,_0x5af865['batch']['addOperation'](_0xb01e04),_0x28ccae['model']['applyOperation'](_0xb01e04));});const _0x498395=Ks(_0x28ccae,_0xbb954d,_0x3ac2b3);Ys(_0x28ccae['model'],_0x498395);const _0x569b40=_0x498395['getFirstRange']()['start']['path']['slice'](),_0x3381d6=_0x498395['getFirstRange']()['end']['path']['slice'](),_0x359dfa=[];let _0x2f5755=_0x3ac2b3,_0x2fd41b=_0x28ab82;for(let _0x3deff8=0x0;_0x3deff8<_0x3381d6['length'];_0x3deff8++){const _0x4650aa=_0x2f5755['maxOffset']-_0x3381d6[_0x3deff8];_0x359dfa[_0x3deff8]=_0x2fd41b['maxOffset']-_0x4650aa,_0x2f5755=_0x2f5755['getChildAtOffset'](_0x3381d6[_0x3deff8]),_0x2fd41b=_0x2fd41b['getChildAtOffset'](_0x359dfa[_0x3deff8]);}const _0x45f037=_0x28ccae['model']['createRange'](_0x28ccae['model']['createPositionFromPath'](_0x28ab82,_0x569b40),_0x28ccae['model']['createPositionFromPath'](_0x28ab82,_0x359dfa)),_0x17cb43=_0x28ab82['getChild'](0x0)['getAttribute'](_0x445414),_0x1002d6=Array['from'](_0x18d010['getChildren']())['find'](_0xabfb5e=>_0xabfb5e['getAttribute'](_0x445414)==_0x17cb43)['getPath'](),_0x370bd2=_0x45f037['start']['path']['slice'](),_0x49067d=_0x45f037['end']['path']['slice']();_0x370bd2[0x0]=_0x1002d6[0x0]+_0x370bd2[0x0],_0x49067d[0x0]=_0x1002d6[0x0]+_0x49067d[0x0];let _0x2f7128=_0x28ccae['model']['createRange'](_0x28ccae['model']['createPositionFromPath'](_0x28ccae['model']['document']['getRoot'](_0x484617['rootName']),_0x370bd2),_0x28ccae['model']['createPositionFromPath'](_0x28ccae['model']['document']['getRoot'](_0x484617['rootName']),_0x49067d));const _0x2c08bf=_0x1d1978['documents']['find'](_0x4e8ea5=>_0x4e8ea5['id']==_0x484617['documentId'])['version'],_0x496c9f=_0x28ccae['model']['document']['history']['getOperations'](_0x2c08bf);for(const _0x531c9c of _0x496c9f)_0x2f7128=_0x2993a5['_createFromRanges'](_0x2f7128['getTransformedByOperation'](_0x531c9c));return{'range':_0x2f7128,'currentIndex':_0x16fbed,'targetEditor':_0x28ccae};}['_integrateEditorBalloon'](_0xd1d907){if(!_0xd1d907['plugins']['has']('AIChatBalloon'))return;const _0x19be92=_0xd1d907['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x19be92['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x19be92,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x3eaec6,partIndex:_0x5ac526}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x4c8634}=this['getInteractionAndReplyById'](_0x3eaec6),_0x15595a=_0x4c8634['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x5ac526});_0x19be92['updateContent']({'part':_0x15595a[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x19be92,'applySuggestion',()=>{const {replyId:_0x3560b8,partIndex:_0x5d28b3}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3560b8,'partIndex':_0x5d28b3}),_0x19be92['setState']('accepted');}),this['listenTo'](_0x19be92,'insertSuggestion',()=>{const {replyId:_0x3481c6,partIndex:_0x2224e4}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x3481c6,'partIndex':_0x2224e4}),_0x19be92['setState']('accepted');}),this['listenTo'](_0x19be92,'rejectSuggestion',()=>{const {replyId:_0x3f6567,partIndex:_0x38d4a2}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x3f6567,'partIndex':_0x38d4a2}),_0x19be92['setState']('rejected');}),this['listenTo'](_0x19be92,'showNext',()=>{const {replyId:_0x2964ab,partIndex:_0x60f32}=this['_currentPreviewedChangeGroup'],_0xc1ee85=this['_getPresentableSiblingContentPartIndex'](_0x2964ab,_0x60f32,'next');null!==_0xc1ee85&&this['_openBalloonFor'](_0x2964ab,_0xc1ee85);}),this['listenTo'](_0x19be92,'showPrevious',()=>{const {replyId:_0xc27ad3,partIndex:_0x2b6f63}=this['_currentPreviewedChangeGroup'],_0x4c64ec=this['_getPresentableSiblingContentPartIndex'](_0xc27ad3,_0x2b6f63,'previous');null!==_0x4c64ec&&this['_openBalloonFor'](_0xc27ad3,_0x4c64ec);}),this['listenTo'](_0x19be92,'dialogClosed',(_0x4bef62,{id:_0x8dd7df})=>{if('aiChatBalloon'!==_0x8dd7df)return;const {replyId:_0x2d72ca,partIndex:_0x374635}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2d72ca,'index':_0x374635,'isActive':!0x1}),this['_activeBalloon']===_0x19be92&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x367ab2){if(this['_channelsToEditors']['set'](_0x367ab2['config']['get']('collaboration.channelId'),_0x367ab2),this['_integrateEditorBalloon'](_0x367ab2),this['addCurrentDocumentToChatContext'](),_0x367ab2['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x367ab2['plugins']['has']('Undo')){const _0x58d8d8=_0x367ab2['commands']['get']('undo'),_0x7aafc1=_0x367ab2['commands']['get']('redo');this['listenTo'](_0x58d8d8,'revert',(_0x26776f,_0x2712f9,_0x14a5a5)=>{const _0x3e96ea=this['_batchToChanges']['get'](_0x2712f9);if(!_0x3e96ea)return;const _0x1c9982=this['activeConversation']['getInteraction'](_0x3e96ea['interactionId']),_0x55a865=_0x1c9982?.['getReply'](_0x3e96ea['replyId']);this['_batchToChanges']['delete'](_0x2712f9),_0x1c9982&&_0x55a865&&(_0x3e96ea['indexes']['forEach'](_0x170498=>_0x55a865['setChangeGroupState'](_0x170498,'pending')),this['_batchToChanges']['set'](_0x14a5a5,_0x3e96ea));}),this['listenTo'](_0x7aafc1,'revert',(_0x4c25bd,_0x52846f,_0x8656a3)=>{const _0x222099=this['_batchToChanges']['get'](_0x52846f);if(!_0x222099)return;const _0x7712ae=this['activeConversation']['getInteraction'](_0x222099['interactionId']),_0x49df7e=_0x7712ae?.['getReply'](_0x222099['replyId']);this['_batchToChanges']['delete'](_0x52846f),_0x7712ae&&_0x49df7e&&(_0x222099['indexes']['forEach'](_0x53a46a=>_0x49df7e['setChangeGroupState'](_0x53a46a,'accepted')),this['_batchToChanges']['set'](_0x8656a3,_0x222099));});}const _0x24b1e6=_0x367ab2['config']['get']('ai.chat.context');_0x24b1e6['alwaysAddSelection']&&_0x24b1e6['document']['enabled']&&this['listenTo'](_0x367ab2['model']['document']['selection'],'change:range',(_0x3577d0,_0x28eb92)=>{_0x28eb92['directChange']&&'chat'===_0x367ab2['plugins']['get']('AITabs')['view']['activeTab']&&(_0x367ab2['model']['hasContent'](_0x367ab2['model']['document']['selection'])?this['addSelectionToChatContext'](_0x367ab2):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x2d89d6=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x27f0be=await _0x2d89d6['getConversations']();return _0x27f0be['length']?_0x27f0be[0x0]['id']:'new';}catch(_0x49c5c1){return this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':vt()}),this['_reporter']['logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x49c5c1})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x5e615f={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x5e615f);}catch(_0x463854){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5e615f['id']||vt()}),this['_reporter']['logError'](_0x463854),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x4e3a19,modelId:_0x2e4a1d}={}){this['_closeActiveBalloon']();let _0x510995=_0x2e4a1d;_0x510995||(_0x4e3a19||!this['activeConversation']?_0x510995=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x510995=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x331a48=this['getGroupId'](),_0x4e2e5b=_0x4e3a19||vt();let _0x2f0d63;this['activeConversation']=new On({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x510995,'conversationId':_0x4e2e5b,'group':_0x331a48,'locale':this['context']['locale'],'isFromHistory':!!_0x4e3a19,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x4d1500=>this['_aiEditing']['getSessionId'](_0x4d1500)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x2ad06a,_0x45aea0)=>{this['_aiChatUi']['createConversation'](_0x45aea0),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x4e3a19||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x1e5298,_0x305310)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x305310['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x444631=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x444631);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x494456=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x494456);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x4a39d7,_0x541165)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x541165,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x11a0c9,_0x3ab6c5)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3ab6c5,{'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',(_0x1cfcc0,_0x43925a)=>{this['_aiChatUi']['removeFeedInteraction'](_0x43925a['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x1211a9,_0x5d1534,_0x2a168e)=>{this['_updateConversationTitle'](_0x5d1534,_0x2a168e);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1cec94,_0x46787a)=>{void 0x0!==_0x2f0d63&&_0x2f0d63!==_0x46787a['id']&&this['_updateReplyContentThrottled']['flush'](),_0x2f0d63=_0x46787a['id'],_0x46787a['isFromHistory']?await this['_updateReplyContent']({'reply':_0x46787a}):await this['_updateReplyContentThrottled']({'reply':_0x46787a});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x2d3d12,{reply:_0x2c8359,index:_0x3d2bd0,state:_0x4f3bc3})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x2c8359['id'],'index':_0x3d2bd0,'state':_0x4f3bc3}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x2c8359['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x3d2bd0&&this['_activeBalloon']?.['setState'](_0x4f3bc3);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x35bd91,_0x29c643)=>{if(this['_aiChatUi']['addContextItem'](_0x29c643['contextItem'],_0x29c643['isLoading']),'selection'===_0x29c643['contextItem']['type']){const _0x19ac70=_s(this['context']),_0x358355=[..._0x19ac70['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x19ac70,'ranges':_0x358355,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x55f545,_0x50982d)=>{this['_aiChatUi']['removeContextItem'](_0x50982d['uiId']),'current-document'==_0x50982d['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x50982d['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x26950e,_0x29321b)=>{this['_aiChatUi']['setContextItemLoading'](_0x29321b['contextItem']['uiId'],_0x29321b['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x2919de,_0xe95de9)=>{this['_aiChatUi']['setConversationContext'](_0xe95de9['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x11b602,_0x4c0d81)=>{this['_aiChatUi']['setAddContextOptions'](_0x4c0d81['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x2a51dc,_0x4d7219)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x4d7219['sourceId'],_0x4d7219['source'],_0x4d7219['resources'],_0x4d7219['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x45ba31,_0x283953)=>{this['_aiChatUi']['updateResourceState'](_0x283953['sourceId'],_0x283953['resourceId'],_0x283953['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x40ed06,_0x36c182)=>{this['_aiChatUi']['updateCapabilities'](_0x36c182);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x31578e,_0x3e9348)=>{try{const _0x505c5b=(await this['_aiChatModels']['getAll']())['find'](_0x5c4a86=>_0x5c4a86['id']===_0x3e9348['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x505c5b,_0x3e9348['isDisabled']);}catch(_0x4d591b){this['_reporter']['logError'](new rn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x4d591b}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x254213,{error:_0x1cbeda,interactionId:_0x36e268,fileName:_0x1d716f,url:_0x441d83,sourceId:_0x5d03b4,sourceLabel:_0x57e127})=>{const _0x72bf34=_0x36e268?_0x36e268+':'+vt():vt();this['_reporter']['reportError'](_0x1cbeda),_0x1cbeda['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1cbeda['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x1d716f),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x441d83),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x5d03b4&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x5d03b4),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x57e127||'source'),'id':_0x72bf34})):_0x1cbeda['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x72bf34}):_0x1cbeda['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x72bf34}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x72bf34});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x4e3a19||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x10a9eb,attributes:_0x1d97c8}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x2620a2=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x2620a2);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x10a9eb,'attributes':_0x1d97c8});}['_removeFromContext'](_0x2ffc4f){this['activeConversation']?.['removeFromContext'](_0x2ffc4f);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x2abb93){const [_0x112ad6,_0x3015cb]=_0x2abb93['split'](':'),_0x52e983=this['activeConversation']['getInteraction'](_0x112ad6);return{'interaction':_0x52e983,'reply':_0x52e983['getReply'](_0x3015cb)};}['_scrollToSuggestionRange'](_0x5f4bf6,_0x215550=!0x1,_0x45257a){const _0x31e7a3={'target':_0x45257a['editing']['view']['domConverter']['viewRangeToDom'](_0x45257a['editing']['mapper']['toViewRange'](_0x5f4bf6)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x215550};_0x215550&&(_0x31e7a3['alignToTop']=!0x0),Rt(_0x31e7a3);}['_updateConversationTitle'](_0x413c8c,_0x508298=!0x1){this['_aiChatUi']['setConversationTitle'](_0x413c8c||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x508298);}['_addFeedItemReply'](_0x3fa312){'text'===_0x3fa312['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x3fa312):this['_aiChatUi']['addFeedItemAISuggestion'](_0x3fa312);}async['_updateReplyContent']({reply:_0x1f7655,renderingStrategy:_0x2ec056}){const {id:_0x352a43,interactionId:_0x4d4ad3,isDone:_0x3e681f,type:_0x5e4618,parsedContent:_0x1c684c}=_0x1f7655,_0x1df867=_0x4d4ad3+':'+_0x352a43;if('modification'===_0x5e4618){const _0x6893b=_0x1f7655['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1df867,'parts':_0x6893b,'isDone':_0x3e681f,'skipLoadingEffects':_0x1f7655['isFromHistory']});}else'text'===_0x5e4618&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x1df867,'parsedContent':_0x1c684c['get']('text'),'renderingStrategy':_0x2ec056,'isDone':_0x3e681f});_0x3e681f&&_0x1f7655['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x1df867,_0x1f7655['sources']);}['_updateReplyContentThrottled']=_0x175e83(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x18c008=this['activeConversation']?.['lastInteraction'];_0x18c008&&(_0x18c008['stop'](),this['_aiChatUi']['stopInteraction'](_0x18c008)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x396ea6=this['activeConversation']?.['lastInteraction'];if(_0x396ea6){for await(const _0x26649d of _0x396ea6['replies'])this['_aiChatUi']['hasFeedItem'](_0x26649d['id'])||this['_addFeedItemReply'](_0x26649d),await this['_updateReplyContent']({'reply':_0x26649d,'renderingStrategy':'static'});}}['_updateRatings'](_0x43b4de){const _0x31e518={'positiveCount':_0x43b4de['changeGroups']['filter'](_0x21fde2=>'accepted'===_0x21fde2['state'])['length'],'totalCount':_0x43b4de['changeGroups']['length'],'modificationId':_0x43b4de['id']},_0x1af88e=this['activeConversation']['getInteraction'](_0x43b4de['interactionId'])['messageId'];_0x1af88e&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x1af88e,_0x31e518);}['_getAIChatFeedAPI'](_0x458833){const _0x13fea6=this['_aiChatUi'],_0x53e8ba=()=>{_0x458833['resetWebSearchState'](),_0x458833['resetReasoningState'](),_0x13fea6['clearLoadingMessage']();},_0x4ef548=()=>{_0x458833['currentReply']&&(_0x458833['currentReply']['done'](),_0x458833['currentReply']=void 0x0);};return{'insertTextReply':(_0x3c1617,_0x39f834)=>{_0x4ef548(),_0x53e8ba();const _0x4be63e=_0x458833['currentReply']=_0x458833['createReply']({'type':'text','interactionId':_0x458833['id'],'id':_0x39f834||vt(),'channelsToEditors':this['_channelsToEditors']});return _0x4be63e['appendContent'](_0x3c1617),_0x4ef548(),_0x4be63e;},'insertCustomElement':async(_0x1481b8,_0x52859e)=>(_0x4ef548(),_0x53e8ba(),_0x13fea6['addFeedItemCustomElement'](_0x1481b8,_0x52859e||vt())),'setLoadingMessage':_0x6d1d3f=>{_0x13fea6['setLoadingMessage'](_0x6d1d3f);},'clearLoadingMessage':()=>{_0x13fea6['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x1ba158=>'destroyed'!==_0x1ba158['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const yn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],xn=[...yn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Ln(_0x424bd9){const _0x56b730=new AbortController();return{'promise':new Promise((_0x7632df,_0x1ed846)=>{const _0x5e88df=setTimeout(_0x7632df,_0x424bd9);_0x56b730['signal']['addEventListener']('abort',()=>{clearTimeout(_0x5e88df),_0x1ed846();});}),'abortController':_0x56b730};}var Dn=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x8ef587){this['options']={'delay':_0x8ef587?.['delay']??0xa,'textNodeStyle':_0x8ef587?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x443b4e,targetElement:_0x1e5932,abortSignal:_0x5478dd}){this['isStreaming']&&this['stop'](),_0x5478dd?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x26e4f2(_0x443b4e,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x3501ee=0x0;_0x3501ee<this['currentIndex'];_0x3501ee++)this['nodesList'][_0x3501ee]['shouldBeStreamed']=!0x0;do{const _0x214496=Date['now'](),_0x5b0b27=this['nodesList'][this['currentIndex']],_0x4af5fd=_0x214496-this['lastUpdateTime'];if(_0x5b0b27){_0x5b0b27['shouldBeStreamed']=!0x0;let _0x595025=_0x5b0b27['parent'];for(;_0x595025;)_0x595025['shouldBeStreamed']=!0x0,_0x595025=_0x595025['parent'];}if(_0x4af5fd<this['options']['delay'])try{const {promise:_0x2ff8f5,abortController:_0x2e8b3c}=Ln(this['options']['delay']-_0x4af5fd);this['timeoutAbortController']=_0x2e8b3c,await _0x2ff8f5;}catch(_0x5eac3a){return;}_0x127c11(_0x1e5932,'<'+_0x1e5932['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x1e5932['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:_0x36dbc2}){Array['from'](_0x36dbc2['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x3b8ffe=>{_0x3b8ffe['replaceWith'](_0x3b8ffe['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x20f33d){let _0x3602f3='';if(function(_0x26cdf6){return _0x19e5ed(_0x26cdf6);}(_0x20f33d)){for(const _0x45f04d of _0x20f33d['children'])_0x3602f3+=this['renderNode'](_0x45f04d);}else{if(Mn(_0x20f33d)){if(!_0x20f33d['shouldBeStreamed'])return'';const _0x4d8005=_0x20f33d,_0x46ec38=Object['entries'](_0x4d8005['attribs'])['map'](([_0x3929c0,_0x59b4ac])=>_0x3929c0+'=\x22'+_0x59b4ac+'\x22')['join']('\x20');_0x3602f3+='<'+_0x4d8005['tagName']+(_0x46ec38?'\x20'+_0x46ec38:'')+'>';for(const _0x40cd4a of _0x2ebe7e(_0x4d8005))_0x3602f3+=this['renderNode'](_0x40cd4a);_0x3602f3+='</'+_0x4d8005['tagName']+'>';}else{if(!Hn(_0x20f33d))return'';if(!_0x20f33d['shouldBeStreamed'])return'';!function(_0x495e63){return!(!_0x495e63['parent']||!Mn(_0x495e63['parent']))&&(!!Pn['includes'](_0x495e63['parent']['tagName'])&&!_0x389fc5(_0x495e63)['match'](/^\s*[<>]\s*$/));}(_0x20f33d)?_0x3602f3+=_0x2c79e7(_0x20f33d):_0x3602f3+=_0x2c79e7(new _0x4e03ab('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x20f33d]));}}return _0x3602f3;}['getParsedDocumentNodeList'](){const _0x497597=[];return function(_0x7e8017,_0x543b1d){const _0x592d33=_0x58cddf=>{if(_0x543b1d(_0x58cddf),_0x58cddf instanceof _0x125039)for(let _0x4188eb=0x0;_0x4188eb<_0x58cddf['children']['length'];_0x4188eb++){const _0x4b5ebe=_0x58cddf['children'][_0x4188eb];_0x592d33(_0x4b5ebe);}};for(let _0x2f7a94=0x0;_0x2f7a94<_0x7e8017['children']['length'];_0x2f7a94++)_0x592d33(_0x7e8017['children'][_0x2f7a94]);}(this['document'],_0x25674e=>{if(Hn(_0x25674e)){const _0x1d7700=this['splitTextNodeIntoWordNodes'](_0x25674e);_0x1d7700['length']&&_0x497597['push'](..._0x1d7700);}_0x25674e['isWordSplitSource']||_0x25674e['isWordSplitResult']||_0x497597['push'](_0x25674e);}),_0x497597;}['splitTextNodeIntoWordNodes'](_0x2a0704){if(_0x2a0704['isWordSplitSource']||_0x2a0704['isWordSplitResult'])return[];const _0x38f0cc=_0x389fc5(_0x2a0704)['match'](/(?:\s*\S+\s*)/g),_0x4a320b=[];if(_0x38f0cc&&_0x38f0cc['length']>0x1){for(const _0x353db0 of _0x38f0cc){const _0xac879=new _0xb034a(_0x353db0);_0xac879['isWordSplitResult']=!0x0,_0x5c42a6(_0x2a0704,_0xac879),_0x4a320b['push'](_0xac879);}_0x2a0704['isWordSplitSource']=!0x0,_0x3cff82(_0x2a0704);}return _0x4a320b;}};const Pn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Hn(_0x302b58){return _0xa4c1f4(_0x302b58);}function Mn(_0x748013){return _0x3a2d7f(_0x748013);}function Vn(_0x38cee7,_0x2b6f22){_0x38cee7['cleanUpAnimations']({'targetElement':_0x2b6f22}),_0x2b6f22['querySelectorAll']('[data-id]')['forEach'](_0xb2a0e5=>{_0xb2a0e5['removeAttribute']('data-id');});}var Un=class extends _0x5d2282{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x4acc8e){super();const _0x19761f=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Dn(),this['options']=_0x4acc8e,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x19761f['if']('isDone','ck-ai-chat__feed__item_done'),_0x19761f['if']('isVisible','ck-hidden',_0x449923=>!_0x449923),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Vn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x406722,_0x4bb467,_0x1b5540){await this['htmlStreamer']['stream']({'document':_0x406722,'targetElement':_0x4bb467,'abortSignal':_0x1b5540});}},Bn=class extends _0x5d2282{['showChangesToggleView'];constructor(_0x409e09,_0xa17c24){super(_0x409e09),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Gn(_0x409e09),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+ln,'label':us(_0x409e09,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0xa17c24['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x2fccc8=>_0x2fccc8?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0xd4e024=new Yt();_0xd4e024['content']=_0x26e7cd,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0xa17c24['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0xd4e024,{'tag':'span','children':[us(_0x409e09,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Gn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Fn={'accepted':_0x302b97,'rejected':_0x2e3064,'outdated':_0x2e3064};var Kn=class extends _0x5d2282{['stateIconView'];constructor(_0xea52b0){super(_0xea52b0);const _0x26dd7f=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Wn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x26dd7f['to']('state',_0x5b41d6=>'ck-ai-suggestion__content-part-state_'+_0x5b41d6),_0x26dd7f['if']('isVisible','ck-hidden',_0x5939b1=>!_0x5939b1)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x26dd7f['to']('state',_0x2fff10=>{switch(_0x2fff10){case'accepted':return us(_0xea52b0,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0xea52b0,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0xea52b0,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x28b021){this['state']=_0x28b021;}},Wn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Fn[this['state']],this['on']('change:state',()=>{this['content']=Fn[this['state']];});}},Yn=class extends _0x11c4f1{['_applyButton'];['_suggestButton'];constructor(_0x3f8251,_0x2a0858,_0x431237){super(_0x3f8251);const _0x645dce=Boolean(_0x431237);this['set']('isEnabled',!_0x645dce),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x393c14=[];if(_0x645dce){const _0x345587=new Ht(_0x3f8251);_0x345587['set']({'label':us(_0x3f8251,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x32d17f}),_0x345587['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x393c14['push'](_0x345587);}else{_0x2a0858['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0x3f8251),this['_applyButton']['set']({'label':us(_0x3f8251,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x302b97}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x4c8c7c=>!_0x4c8c7c),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x393c14['push'](this['_applyButton'])),_0x2a0858['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0x3f8251),this['_suggestButton']['set']({'label':us(_0x3f8251,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x47396e}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x393c14['push'](this['_suggestButton']));const _0x159c2c=new Ht(_0x3f8251);_0x159c2c['set']({'label':us(_0x3f8251,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2e3064}),_0x159c2c['bind']('isEnabled')['to'](this),_0x159c2c['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x393c14['push'](_0x159c2c);}this['items']['addMany'](_0x393c14);const _0x18116a=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x18116a['if']('isVisible','ck-hidden',_0x4cad17=>!_0x4cad17)]}});}['setButtonsVisibility']({showApplyButton:_0xe99321,showSuggestButton:_0x2e0f1a}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0xe99321),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x2e0f1a);}},$n=class extends _0x5d2282{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x51356e,{part:_0x59b58b,uiIndex:_0x1b5de4,availableActions:_0xb0f70d,areActionsDisabled:_0x40edef}){super(_0x51356e),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Yn(_0x51356e,_0xb0f70d,_0x40edef),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x59b58b['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x59b58b['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x59b58b['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Kn(_0x51356e),this['titleLabelView']=new qn(_0x51356e,_0x1b5de4),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',(_0x2bb59d,_0x4ae89e,_0x19d3a8,_0x4b558b)=>{'pending'===_0x4b558b?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x19d3a8?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x19d3a8),this['children']['add'](this['stateView']));});}},qn=class extends _0x5d2282{constructor(_0x18921,_0x5f4ba0){super(_0x18921),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x18921,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x5f4ba0['toString']())]});}},Qn=class extends _0x5d2282{['htmlStreamer'];constructor(_0xf2fd5a){super(_0xf2fd5a),this['htmlStreamer']=new Dn(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x3a201b,renderingStrategy:_0x54ce42,abortSignal:_0x27be9e}){const _0x5b9050=_0x26e4f2(_0x3a201b['content'],!0x0);for(const _0x30efe0 of ws(_0x5b9050))_0x3cff82(_0x30efe0);'streaming'===_0x54ce42?await this['htmlStreamer']['stream']({'document':_0x5b9050,'targetElement':this['element'],'abortSignal':_0x27be9e}):_0x127c11(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x5b9050)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Vn(this['htmlStreamer'],this['element']);}},Xn=class extends _0x5d2282{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x4198e5,{part:_0xbafd15,uiIndex:_0x2e8653,areActionsDisabled:_0x3c9aaa,availableActions:_0x237817}){super(_0x4198e5);const _0x370600=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x51a486=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x3c9aaa;};this['on']('change:state',_0x51a486),this['on']('change:isDone',_0x51a486),_0x51a486(),this['_children']=this['createCollection'](),this['_headerView']=new $n(_0x4198e5,{'part':_0xbafd15,'uiIndex':_0x2e8653,'availableActions':_0x237817,'areActionsDisabled':_0x3c9aaa}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...yn)['to'](this),this['_streamableContentView']=new Qn(_0x4198e5),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x370600['to']('state',_0x1dc5e0=>'ck-ai-suggestion__body__content-part_'+_0x1dc5e0),_0x370600['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x370600['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x370600['if']('isVisible','ck-hidden',_0x4080d2=>!_0x4080d2)]},'children':this['_children'],'on':{'mouseenter':_0x370600['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0xbafd15['index']});}),'mouseleave':_0x370600['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0xbafd15['index']});}),'click':_0x370600['to'](_0x5c2df2=>{const _0x5d38ea=_0x5c2df2['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x5d38ea)&&this['fire']('showChangeInText',{'index':_0xbafd15['index']});})}});}async['updateContent']({part:_0x124c5c,showUnchangedParts:_0x49c168=!0x1,abortSignal:_0x3a1e93}){this['partDefinition']=_0x124c5c,this['isVisible']=this['partDefinition']['hasChanges']||_0x49c168,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x124c5c,'renderingStrategy':'static','abortSignal':_0x3a1e93});}['markAsDone'](){this['isDone']=!0x0;}},zn=class extends _0x5d2282{constructor(_0x755f6d,_0x1f2d8f){super(_0x755f6d),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x7c6a8=>!_0x7c6a8)]},'children':this['_createSkeletonItems'](_0x1f2d8f)});}['_createSkeletonItems'](_0x17a525){const _0x33e208=['ck','ck-ai-skeleton__item'];return _0x17a525['map'](_0x4ac002=>{let _0x3c4c2f='';switch(_0x4ac002['attributes']['align']){case'right':_0x3c4c2f='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x3c4c2f='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x3c4c2f='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x4ac002['tag'],'attributes':{'class':[..._0x33e208,_0x4ac002['attributes']['class']?_0x4ac002['attributes']['class']:''],'style':'width:\x20'+_0x4ac002['attributes']['width']+';\x20height:\x20'+_0x4ac002['attributes']['height']+';'+_0x3c4c2f}};});}};const jn={'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':Jn(0x5,'100%','44px','right'),'aiChatResources':Jn(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 Jn(_0x59207c,_0x42c84c,_0x4169bf,_0x585b18){return new Array(_0x59207c)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x42c84c,'height':_0x4169bf,'align':_0x585b18}}));}const Zn=/* #__PURE__ -- @preserve */
33
- ut();var tr=class extends Zn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x340821){const _0x3dd080=this['createTask'](_0x340821);return this['queue']['push'](_0x3dd080),this['_processQueue'](),_0x3dd080['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(_0x2f3aa4=>{this['once']('_queueEmpty',()=>{_0x2f3aa4();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x4ce4de=this['queue']['shift']();try{await _0x4ce4de['callback'](this['_abortController']['signal']),_0x4ce4de['resolve']();}catch(_0x7b862b){_0x4ce4de['reject'](_0x7b862b);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x21bde2){let _0x1009a2,_0x3d2c85;const _0x179357=new Promise((_0x995e3b,_0x8d2739)=>{_0x1009a2=_0x995e3b,_0x3d2c85=_0x8d2739;});return{'callback':_0x21bde2,'resolve':_0x1009a2,'reject':_0x3d2c85,'completePromise':_0x179357};}},er=class extends Un{constructor(_0x3afefd){super(_0x3afefd),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x3afefd['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x358a56){this['element']['innerHTML']=_0x358a56;}};const ir=['applySuggestion','insertSuggestion'];var sr=class extends _0x5d2282{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x473d8d,_0x53ac6c=[...ir],_0x3c8b81){super(_0x473d8d);const _0xfaf53e=this['bindTemplate'],_0xefc181=Boolean(_0x3c8b81);if(this['set']('isEnabled',!_0xefc181),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0xefc181){const _0x318f0b=new Ht(_0x473d8d);_0x318f0b['set']({'label':us(_0x473d8d,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x32d17f}),_0x318f0b['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x212c8b=new _0x5d2282(_0x473d8d);_0x212c8b['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x473d8d,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x318f0b]}]}),this['children']['add'](_0x212c8b);}else this['_applyChangesButton']=new Ht(_0x473d8d),this['_applyChangesButton']['set']({'label':us(_0x473d8d,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x53ac6c['includes']('applySuggestion'),'class':hn}),this['_insertSuggestionsButton']=new Ht(_0x473d8d),this['_insertSuggestionsButton']['set']({'label':us(_0x473d8d,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x53ac6c['includes']('insertSuggestion'),'class':cn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2ac366=>{_0x2ac366['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',_0xfaf53e['if']('isVisible','ck-hidden',_0x2d32c5=>!_0x2d32c5)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x75378e){this['isVisible']=_0x75378e;}['_switchButtonLabelsPlurality'](_0x408418){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x408418?(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},nr=class extends _0x5d2282{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x18f31c,_0x200fcf){super(_0x18f31c),this['bodyCollection']=_0x200fcf,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',_0x5f51b9=>!_0x5f51b9)]},'children':this['children']});const _0x39e349=new _0x5d2282(this['locale']),_0x3b0663=new Yt();_0x3b0663['content']=at,_0x39e349['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3b0663,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x39e349),this['_setupBalloonPanel'](_0x18f31c);}['addSource'](_0x452182){this['children']['add'](new rr(this['locale'],_0x452182,this['balloonPanelView']));}['_setupBalloonPanel'](_0x167c3d){this['balloonPanelView']=new yt(_0x167c3d),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},rr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x2cb641,_0x2bcf0e,_0x4eade9){super(_0x2cb641),this['source']=_0x2bcf0e,this['balloonPanelView']=_0x4eade9,this['set']({'label':_0x2bcf0e['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x5ead6d=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x5ead6d['to'](()=>{window['open'](_0x2bcf0e['url'],'_blank');}),'mouseenter':_0x5ead6d['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x5ead6d['to'](()=>{this['_hideTooltip']();})}}),_0x2bcf0e['favicon']){const _0xa22d73=new _0x5d2282(_0x2cb641);_0xa22d73['setTemplate']({'tag':'img','attributes':{'src':_0x2bcf0e['favicon']||at,'alt':_0x2bcf0e['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0xa22d73);}else this['set']('icon',at);}['_createTooltipContentView'](_0x20ef94,_0x24f618){const _0x24cb5d=new _0x5d2282(_0x20ef94),_0x29b04c=[];let _0x1648fe;_0x24f618?.['favicon']?(_0x1648fe=new _0x5d2282(_0x20ef94),_0x1648fe['setTemplate']({'tag':'img','attributes':{'src':_0x24f618['favicon'],'alt':_0x24f618['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x1648fe=new Yt(),_0x1648fe['content']=at,_0x1648fe['extendTemplate']({'attributes':{'alt':_0x24f618['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x29b04c['push'](_0x1648fe);const _0x5905ab=new _0x5d2282(_0x20ef94);_0x5905ab['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x24f618['url']},'children':[{'text':new URL(_0x24f618['url'])?.['hostname']}]}),_0x29b04c['push'](_0x5905ab);const _0x5d7868=new _0x5d2282(_0x20ef94);_0x5d7868['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x29b04c});const _0xf6b8b8=new _0x5d2282(_0x20ef94);return _0xf6b8b8['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x24f618['title']['length']>0x190?_0x24f618['title']['substring'](0x0,0x190)+'...':_0x24f618['title']}]}),_0x24cb5d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x5d7868,_0xf6b8b8]}),_0x24cb5d;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthWest'],yt['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 _0x3fe816=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x3fe816);}},or=class extends _0x5d2282{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x3d5a0c(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0xfd1bdd,_0x2c6d13){super(_0xfd1bdd);const {areActionsDisabled:_0x4e1bfc,showUnchangedParts:_0x5f4cd7,availableActions:_0x44a733}=_0x2c6d13;this['_areActionsDisabled']=_0x4e1bfc,this['_showUnchangedParts']=_0x5f4cd7,this['_availableActions']=_0x44a733,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new zn(_0xfd1bdd,jn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new tr(),this['_emptyPartsWarningView']=new er({'id':'empty-parts-warning','initialContent':us(_0xfd1bdd,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new sr(_0xfd1bdd,_0x2c6d13['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new nr(this['locale'],_0x2c6d13['bodyCollection']),_0x2c6d13['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...yn)['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'](_0x3351d0=>_0x3351d0 instanceof Xn);}async['updateContentParts']({parts:_0x2e48c5,abortSignal:_0x272133,skipLoadingEffects:_0x4d7bff}){this['_cachedContentParts']['length']?_0x2e48c5['forEach'](_0x50faa3=>{const _0x34d194=this['_cachedContentParts']['findIndex'](_0x22d019=>_0x22d019['index']==_0x50faa3['index']);-0x1===_0x34d194?this['_cachedContentParts']['push'](_0x50faa3):this['_cachedContentParts'][_0x34d194]=_0x50faa3;}):this['_cachedContentParts']=_0x2e48c5;const _0x73f0ee=this['_showUnchangedParts']?_0x2e48c5:_0x2e48c5['filter'](_0x122e40=>_0x122e40['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x73f0ee['length']>0x1),_0x4d7bff&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x4937a3 of _0x73f0ee)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x1a5a07=>{let _0x3de87a=this['getPartView'](_0x4937a3['index']);if(!_0x3de87a){if(_0x3de87a=new Xn(this['locale'],{'part':_0x4937a3,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3de87a['delegate'](...yn)['to'](this),_0x3de87a['bind']('isTrackChangesOn')['to'](this),!_0x4d7bff&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x1a5a07),_0x1a5a07['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3de87a,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x4d7bff||this['_showSkeletonDebounced']();}await _0x3de87a['updateContent']({'part':_0x4937a3,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x1a5a07}),_0x3de87a['markAsDone']();});return _0x272133?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0xe17366,_0x2f1d5f){const _0x483330=this['getPartView'](_0xe17366);_0x483330&&(_0x483330['state']=_0x2f1d5f),this['hasPendingParts']='pending'==_0x2f1d5f||this['_contentPartViews']['some'](_0x13c23d=>'pending'==_0x13c23d['state']);}['setPartActive'](_0x1e43b3,_0x3b022f){if(!0x1===_0x1e43b3){for(const _0x5bb033 of this['_contentPartViews'])_0x5bb033['isActive']=!0x1;}else{const _0x3e99e3=this['getPartView'](_0x1e43b3);_0x3e99e3&&(_0x3e99e3['isActive']=_0x3b022f);}}['updateSources'](_0x32cf3f){_0x32cf3f['forEach'](_0xe23da=>this['_sourcesView']['addSource'](_0xe23da)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x56eff6){return this['_contentPartViews']['find'](_0x1cb50b=>_0x1cb50b['partDefinition']['index']==_0x56eff6)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x579f26=!this['_cachedContentParts']['find'](({hasChanges:_0x396135})=>_0x396135),_0x374783=!!this['_cachedContentParts']['find'](({hasChanges:_0x170bb2})=>!_0x170bb2);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x374783,_0x579f26?this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x9f6a88=>_0x9f6a88['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x267357){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x3c6275=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x3c6275>0x0){const {promise:_0x4d5a71,abortController:_0x120f38}=Ln(_0x3c6275);_0x267357?.['addEventListener']('abort',()=>_0x120f38['abort']()),await _0x4d5a71['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x22a854=>_0x22a854['partDefinition']['hasChanges'])['length']>0x0;}},ar=class extends _0x5d2282{['bodyView'];['children'];['headerView'];constructor(_0x34d33f,_0x27f530,_0x4116f9){super(_0x34d33f);const {showDiff:_0x55e72a,areActionsDisabled:_0x29236b,showUnchangedParts:_0x3621c9,availableActions:_0x4b2502}=_0x27f530;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Bn(_0x34d33f,{'showDiff':_0x55e72a}),this['headerView']['on']('toggleShowChanges',(_0x47f9cf,_0x12c7f3)=>{this['areChangesVisible']=_0x12c7f3['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x12c7f3['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new or(_0x34d33f,{'areActionsDisabled':_0x29236b,'showUnchangedParts':!!_0x3621c9,'availableActions':_0x4b2502,'bodyCollection':_0x4116f9}),this['bodyView']['delegate'](...yn)['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'](_0xe77932){await this['bodyView']['updateContentParts'](_0xe77932);}['updateSources'](_0x59d25c){this['bodyView']['updateSources'](_0x59d25c);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},hr=class extends Un{['containerView'];constructor(_0x1e3115,_0x25c63e,_0x5bf60c){super(_0x25c63e),this['set']('isTrackChangesOn',!0x1),this['containerView']=new ar(_0x1e3115,{'showDiff':_0x25c63e['showDiff'],'areActionsDisabled':_0x25c63e['areActionsDisabled'],'availableActions':_0x25c63e['availableActions']},_0x5bf60c),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x2bd89a,_0x10b26d)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x10b26d['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',(_0x37ee9c,{index:_0x33d102})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x33d102});}),this['containerView']['on']('applySuggestion',(_0xe3187b,{index:_0x51a2d3}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x51a2d3});}),this['containerView']['on']('insertSuggestion',(_0x3ebf3b,{index:_0x38b6a7}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x38b6a7});}),this['containerView']['on']('rejectSuggestion',(_0x5d345b,{index:_0xcb8fe5})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0xcb8fe5});}),this['containerView']['on']('mouseOverSuggestion',(_0xb37cc9,{index:_0x1c27f3})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1c27f3});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x4fbc50,{index:_0x600a2c})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x600a2c});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x3d6587){await this['containerView']['updateContent'](_0x3d6587);}['updatePartState'](_0x4823fe,_0x137879){this['containerView']['bodyView']['updatePartState'](_0x4823fe,_0x137879);}['setPartActive'](_0x504967,_0x24b9c4){!0x1===_0x504967?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x504967,_0x24b9c4);}['updateSources'](_0x50a933){this['containerView']['updateSources'](_0x50a933);}['getPartView'](_0x37045c){return this['containerView']['bodyView']['getPartView'](_0x37045c);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},cr=class extends Un{['replyContainer'];['_bodyCollection'];constructor(_0x3dcaa0,_0x41f904,_0x26aeca){super(_0x41f904),this['_bodyCollection']=_0x26aeca,this['locale']=_0x3dcaa0,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x5d2282(),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':ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x3547af,renderingStrategy:_0x227467,abortSignal:_0x3693d8}){'streaming'===_0x227467?await this['streamIntoElement'](_0x3547af,this['replyContainer']['element'],_0x3693d8):this['replyContainer']['element']['innerHTML']=_0x2c79e7(_0x3547af);}['updateSources'](_0x2b3c40){const _0x52d7a6=new nr(this['locale'],this['_bodyCollection']);_0x52d7a6['children']['addMany'](_0x2b3c40['map'](_0x22e57a=>new rr(this['locale'],_0x22e57a,_0x52d7a6['balloonPanelView']))),_0x52d7a6['isVisible']=!0x0,this['children']['add'](_0x52d7a6);}},lr=class extends _0x421451{constructor(_0x21d223=void 0x0){super();const _0xdb4a72=_0x21d223?'ck-ai-spinner_'+_0x21d223:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0xdb4a72]}});}};const ur={'file':_0x5ed1b5,'image':_0x288b7a,'document':_0x26e7cd,'web-resource':_0x45e544,'text':_0x5ed1b5,'selection':_0x44caf2,'mcp-tool-context':_0x26e7cd},dr='ck-ai-chat-context-chip',_r='ck-ai-chat-context-chip_wide',gr='ck-ai-chat-context-chip_document',Ar='ck-ai-chat-context-chip__label',Ir='ck-ai-chat-context-chip__type-icon',pr='ck-ai-chat-context-controls__chip-tooltip',mr='n';var Er=class extends Ht{constructor(_0x4750d3,_0x1edfc3,_0x219ada,_0x390541,_0x3af003=!0x1){super(_0x4750d3),this['_isAnimationOnEnterEnabled']=_0x390541,this['_initializeProperties'](_0x1edfc3,_0x219ada,_0x3af003),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'](_0x232bc0,_0x18aa2c,_0x16ddd3){this['set']('label',_0x232bc0['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x232bc0['type']),this['set']('id',_0x232bc0['uiId']),this['set']('readonly',_0x18aa2c),this['set']('isLoading',_0x16ddd3);}['_setupTemplate'](){const _0x1b8873=this['_createIconView'](),_0x41f290=this['_createRemoveButton'](),_0x28d0c0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x28d0c0),'children':this['_createTemplateChildren'](_0x1b8873,_0x41f290,_0x28d0c0)});}['_createTemplateAttributes'](_0x67b44c){return{'class':[dr,_0x67b44c['if']('itemType',gr,_0xd09a6f=>'document'==_0xd09a6f),_0x67b44c['if']('itemType',_r,_0x674f8c=>'selection'==_0x674f8c)],'data-cke-tooltip-text':_0x67b44c['to']('label',Tr),'data-cke-tooltip-position':mr,'data-cke-tooltip-class':pr};}['_createTemplateChildren'](_0x32647a,_0x36eaae,_0x1a7237){const _0x2d0ca0=this['_createLabelElement'](_0x1a7237),_0x4b3840=this['_createLoaderIcon']();return this['readonly']?[_0x32647a,_0x2d0ca0]:[_0x32647a,_0x4b3840,_0x2d0ca0,_0x36eaae];}['_createLabelElement'](_0x3eae0d){return{'tag':'span','attributes':{'class':Ar},'children':[{'text':_0x3eae0d['to']('label')}]};}['_createRemoveButton'](){const _0xaa2b7f=new Ht(this['locale']);return _0xaa2b7f['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x2c8364}),this['_setupRemoveButtonEvent'](_0xaa2b7f),_0xaa2b7f;}['_setupRemoveButtonEvent'](_0x5c538c){_0x5c538c['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x19c7fb=this['bindTemplate'],_0x183fa3=new Yt();return _0x183fa3['content']=ur[this['itemType']],_0x183fa3['extendTemplate']({'attributes':{'class':[Ir,_0x19c7fb['if']('isLoading','ck-hidden',_0x19db94=>_0x19db94)]}}),_0x183fa3;}['_handleAnimationEndOnce'](_0x16d126,_0x42056e){if(!_0x16d126)return;const _0x4e9c2f=()=>{_0x42056e(),_0x16d126['removeEventListener']('animationend',_0x4e9c2f),_0x16d126['removeEventListener']('webkitAnimationEnd',_0x4e9c2f);};_0x16d126['addEventListener']('animationend',_0x4e9c2f),_0x16d126['addEventListener']('webkitAnimationEnd',_0x4e9c2f);}['_createLoaderIcon'](){const _0x5c76d6=new lr('small');return _0x5c76d6['bind']('isVisible')['to'](this,'isLoading',_0x358007=>_0x358007),_0x5c76d6;}};function Tr(_0x154815){if(!_0x154815)return _0x154815;if(_0x154815['length']<=0x78)return _0x154815;const _0x141084=_0x154815['slice'](0x0,0x78),_0x3d112c=_0x141084['lastIndexOf']('\x20');return(_0x3d112c>0x0?_0x141084['slice'](0x0,_0x3d112c):_0x141084)+'…';}const wr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Cr='300px';var fr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x1df940,_0x360e6c,_0xc6408,_0x2bcbe5,_0x43e7fa){this['_locale']=_0x1df940,this['_visibleChips']=_0x360e6c,this['_config']={...wr,..._0xc6408,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0xc6408['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x2bcbe5,this['_parentView']=_0x43e7fa||null;}['setContainerElement'](_0x442133){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x442133,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 _0x5e5d93=[...this['_visibleChips'],...this['_overflowChips']],_0x857006=this['_createCalculationContainer'](),_0x36028a=this['_calculateOverflowInContainer'](_0x857006,_0x5e5d93),_0x10cd3a=_0x857006['_ancestorsToRestore'];_0x10cd3a&&this['_restoreAncestorVisibility'](_0x10cd3a),_0x857006['remove'](),this['_applyOverflowResults'](_0x5e5d93,_0x36028a);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0xf7c0ab({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x16695b=new Ht(this['_locale']);_0x16695b['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x37c9c1=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x37c9c1['push'](this['_config']['cssClasses']['controlsButton']),_0x16695b['extendTemplate']({'attributes':{'class':_0x37c9c1}}),_0x16695b;}['_createShowMoreBalloonPanelView'](){const _0x389549=new yt(this['_locale']);return _0x389549['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x389549),_0x389549;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x25ac50=>{_0x25ac50['disableAnimationOnEnter']();});const _0x3aacb2=new _0x5d2282(this['_locale']);_0x3aacb2['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x3aacb2);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x57a9e2=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x57a9e2?'':'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'](_0x3b385a){const _0x136afa=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x5fb83b=this['_containerElement']?.['classList'];if(_0x5fb83b){const _0x4079f=_0x5fb83b[0x0]||'',_0x57064e=_0x3b385a['querySelector']('.'+_0x4079f),_0x2f1032=_0x3b385a['querySelector'](_0x136afa);return _0x57064e||_0x2f1032||_0x3b385a;}return _0x3b385a['querySelector'](_0x136afa)||_0x3b385a;}['_calculateContainerWidth'](){const _0xbdb08e=this['_parentView']?.['element']||this['_containerElement'];if(!_0xbdb08e)return Cr;const _0x930744=window['getComputedStyle'](_0xbdb08e)['width'];if('auto'===_0x930744||'0px'===_0x930744||!_0x930744){const _0x45c33d=_0xbdb08e['parentElement'];if(_0x45c33d){const _0x305ec8=window['getComputedStyle'](_0x45c33d);return'auto'!==_0x305ec8['width']?_0x305ec8['width']:Cr;}return Cr;}return _0x930744;}['_applyCalculationStyles'](_0x27b383,_0x46afeb){this['_config']['cssClasses']['calculationContainer']&&_0x27b383['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x27b383['style']['width']=_0x46afeb,_0x27b383['style']['position']='absolute',_0x27b383['style']['top']='-9999px',_0x27b383['style']['left']='-9999px',_0x27b383['style']['opacity']='0',_0x27b383['style']['pointerEvents']='none',_0x27b383['style']['zIndex']='-1',_0x27b383['style']['visibility']='visible\x20!important',_0x27b383['style']['display']='block\x20!important',_0x27b383['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x4973a0){_0x4973a0['forEach'](({element:_0x405f32,originalDisplay:_0x21b187,originalVisibility:_0x5ccda2})=>{_0x405f32['style']['display']=_0x21b187,_0x405f32['style']['visibility']=_0x5ccda2;});}['_makeAncestorsVisible'](_0x41802d){const _0x13b8b2=[];let _0x20e5f8=_0x41802d;for(;_0x20e5f8&&_0x20e5f8!==document['body'];){const _0x2e3259=window['getComputedStyle'](_0x20e5f8);'none'!==_0x2e3259['display']&&'hidden'!==_0x2e3259['visibility']||(_0x13b8b2['push']({'element':_0x20e5f8,'originalDisplay':_0x20e5f8['style']['display'],'originalVisibility':_0x20e5f8['style']['visibility']}),_0x20e5f8['style']['display']='block',_0x20e5f8['style']['visibility']='visible'),_0x20e5f8=_0x20e5f8['parentElement'];}return _0x13b8b2;}['_createContainerElements'](){let _0x4d6a6a,_0x1838a8;return this['_parentView']?.['element']?(_0x4d6a6a=this['_parentView']['element']['cloneNode'](!0x0),_0x1838a8=this['_findTargetContainer'](_0x4d6a6a)):(_0x4d6a6a=document['createElement']('div'),_0x1838a8=_0x4d6a6a),{'calculationContainer':_0x4d6a6a,'targetContainer':_0x1838a8};}['_createCalculationContainer'](){const {calculationContainer:_0x42b58f,targetContainer:_0x3344f4}=this['_createContainerElements'](),_0x2de014=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x42b58f,_0x2de014);const _0x1b45a0=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x1b45a0?_0x1b45a0['appendChild'](_0x42b58f):document['body']['appendChild'](_0x42b58f),_0x42b58f['_targetContainer']=_0x3344f4;const _0x46a8f1=this['_makeAncestorsVisible'](_0x1b45a0||null);return _0x42b58f['offsetWidth'],_0x42b58f['_ancestorsToRestore']=_0x46a8f1,_0x42b58f;}['_calculateOverflowInContainer'](_0x35ff05,_0x5f005d){const _0x4bdda1=_0x35ff05['_targetContainer']||_0x35ff05,_0x4fa87d=[],{rowCount:_0x203834}=this['_renderChipsAndCountRows'](_0x4bdda1,_0x5f005d);if(_0x203834<=this['_config']['maxVisibleRows'])return _0x4fa87d;const _0x142cbc=_0x5f005d['slice']();for(;_0x142cbc['length']>0x0;){if(this['_testButtonFit'](_0x35ff05,_0x4bdda1,_0x142cbc)){const _0x5bc525=_0x5f005d['filter'](_0xbbe712=>!_0x142cbc['includes'](_0xbbe712));_0x4fa87d['push'](..._0x5bc525);break;}if(!_0x142cbc['pop']())break;}return _0x4fa87d;}['_renderChipsAndCountRows'](_0x5163b1,_0x7f6c31){_0x5163b1['innerHTML']='',_0x7f6c31['forEach'](_0x2989da=>{if(_0x2989da['element']){const _0x2fb612=_0x2989da['element']['cloneNode'](!0x0);_0x5163b1['appendChild'](_0x2fb612);}}),_0x5163b1['offsetWidth'];const _0x13609d=_0x5163b1['children'],_0x386d41=[];return Array['from'](_0x13609d)['forEach'](_0x32a2ac=>{const _0x4c41a3=_0x32a2ac['getBoundingClientRect']()['top'];_0x386d41['some'](_0x47b8d8=>Math['abs'](_0x47b8d8-_0x4c41a3)<this['_config']['rowDetectionTolerance'])||_0x386d41['push'](_0x4c41a3);}),{'rowCount':_0x386d41['length']};}['_createMockButton'](){const _0x22b047=document['createElement']('button');return _0x22b047['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x22b047['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x22b047['textContent']='+\x201',_0x22b047;}['_testButtonFit'](_0x5d3912,_0x2d0227,_0x4dd4d6){this['_renderChipsAndCountRows'](_0x2d0227,_0x4dd4d6);const _0x469e88=this['_createMockButton']();_0x5d3912['appendChild'](_0x469e88),_0x5d3912['offsetWidth'];const _0x58501d=[..._0x2d0227['children'],_0x469e88],_0x3386f1=[];_0x58501d['forEach'](_0x2ebf97=>{const _0x57ff19=_0x2ebf97['getBoundingClientRect']()['top'];_0x3386f1['some'](_0x55530e=>Math['abs'](_0x55530e-_0x57ff19)<this['_config']['rowDetectionTolerance'])||_0x3386f1['push'](_0x57ff19);});const _0x4b9a67=_0x3386f1['length'];return _0x469e88['remove'](),_0x4b9a67<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x5a9cad,_0x43fed3){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x5a9cad['forEach'](_0x3c5b7d=>{_0x43fed3['includes'](_0x3c5b7d)?this['_overflowChips']['add'](_0x3c5b7d):this['_visibleChips']['add'](_0x3c5b7d);});}['_updateOverflowUI'](_0x466c65){if(_0x466c65>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x466c65>0x0&&this['_showMoreButtonView']){const _0x3aefd9=''+this['_config']['showMoreLabelPrefix']+(_0x466c65<0x63?_0x466c65:'99');this['_showMoreButtonView']['label']=_0x3aefd9;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x58a87f,_0x3190dc){this['_distributeChips'](_0x58a87f,_0x3190dc),this['_updateOverflowUI'](_0x3190dc['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x269cdf=>{_0x269cdf[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 _0xf702ee=this['_containerElement']['getBoundingClientRect']();if(0x0===_0xf702ee['width']||0x0===_0xf702ee['height'])return!0x1;const _0x276123=window['innerHeight']||document['documentElement']['clientHeight'],_0x35979e=window['innerWidth']||document['documentElement']['clientWidth'];return _0xf702ee['bottom']>=-0xc8&&_0xf702ee['top']<=_0x276123+0xc8&&_0xf702ee['right']>=-0xc8&&_0xf702ee['left']<=_0x35979e+0xc8;}};const br='ck-ai-chat__feed__context-chips',Sr='ck-ai-chat-context-chips-wrapper',Rr='ck-ai-chat-context-chips-wrapper-balloon',Or='ck-ai-chat-controls-button',vr='ck-ai-chat-controls_context_show-more-button',kr='ck-ai-chat-context-controls__show-more-balloon-panel';var Nr=class extends _0x5d2282{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x208130,_0x186d04,_0x5e2b94){super(_0x208130),this['_bodyCollection']=_0x5e2b94,this['_createContextChips'](_0x186d04);const _0x797874={'cssClasses':{'showMoreButton':vr+'\x20'+ln,'showMoreBalloon':kr,'overflowContainer':Rr,'controlsButton':Or}};this['_overflowManager']=new fr(_0x208130,this['_contextChips'],_0x797874,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[br,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Sr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x5055e8=this['element']['querySelector']('.'+Sr);_0x5055e8&&(this['_overflowManager']['setContainerElement'](_0x5055e8),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x3800eb){for(const _0x3d3b41 of _0x3800eb){const _0x25d52a=new Er(this['locale'],_0x3d3b41,!0x0,!0x1);this['_contextChips']['add'](_0x25d52a);}}},yr=class extends Un{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x5675cd,_0x301c7a,_0x30fe5f){super(_0x301c7a),this['_locale']=_0x5675cd,this['_bodyCollection']=_0x30fe5f,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 Nr(this['_locale'],this['options']['contextItems']['filter'](_0x2a8e53=>!_0x2a8e53['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x5d2282(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']();}},xr=class extends Un{['capabilities'];constructor(_0x2fff45,_0x4db06a){super(_0x4db06a);const {isWebSearchEnabled:_0x1fc419,isReasoningEnabled:_0x57e062}=_0x4db06a['capabilities'],_0x365c36=[];let _0x13d6b5='';_0x1fc419&&_0x57e062?(_0x13d6b5=us(_0x2fff45,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x365c36['push'](Lr(at)),_0x365c36['push'](Lr(_0x4150ef))):_0x1fc419?(_0x13d6b5=us(_0x2fff45,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x365c36['push'](Lr(at))):_0x57e062&&(_0x13d6b5=us(_0x2fff45,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x365c36['push'](Lr(_0x4150ef))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x13d6b5?'':'ck-hidden']}});const _0x489a59=new _0x5d2282();_0x489a59['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x365c36,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x13d6b5]}]}),this['children']['add'](_0x489a59),this['capabilities']=_0x4db06a['capabilities'];}};function Lr(_0x397d56){const _0x37f7af=new Yt();return _0x37f7af['content']=_0x397d56,_0x37f7af;}const Dr=['wheel','touchstart','pointerdown','keydown'],Pr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Hr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x3194f4){this['element']=_0x3194f4,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x2890ff of Dr){const _0x4a7851='keydown'!==_0x2890ff;this['element']['addEventListener'](_0x2890ff,this['_onUserEvent']['bind'](this),{'passive':_0x4a7851,'signal':this['abortController']['signal']});}}['start']({smooth:_0x39bfca=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x39bfca?'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'](_0x2d4848){if(this['isRunning']){if('keydown'===_0x2d4848['type']){const _0x4d0e03=_0x2d4848['key'];if(!Pr['includes'](_0x4d0e03))return;}_0x2d4848 instanceof WheelEvent?_0x2d4848['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x2e6d61,scrollHeight:_0x1a8463,clientHeight:_0x268329}=this['element'];return _0x1a8463-_0x2e6d61-_0x268329<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Mr=class extends Un{constructor(_0x32bd13){super(_0x32bd13),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']);}},Vr=class extends _0x5d2282{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x539738,_0x4492b7){super(_0x539738),this['_bodyCollection']=_0x4492b7,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...xn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Hr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x51e5f9,_0x1008bf){let _0xb26b85;return'ai-reply'===_0x51e5f9?_0xb26b85=new cr(this['locale'],_0x1008bf,this['_bodyCollection']):'ai-suggestion-reply'===_0x51e5f9?(_0xb26b85=new hr(this['locale'],_0x1008bf,this['_bodyCollection']),_0xb26b85['bind']('isTrackChangesOn')['to'](this)):_0xb26b85='user-message'===_0x51e5f9?new yr(this['locale'],_0x1008bf,this['_bodyCollection']):'interaction-header'===_0x51e5f9?new xr(this['locale'],_0x1008bf):'custom-element'===_0x51e5f9?new Mr(_0x1008bf):new er(_0x1008bf),this['children']['add'](_0xb26b85),_0xb26b85;}async['updateReplyItem']({id:_0x57656e,parsedContent:_0x3637a1,renderingStrategy:_0xe7302e,abortSignal:_0x3f8816}){const _0x49443b=this['getItemById'](_0x57656e);if(!(_0x49443b instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x49443b,'id':_0x57656e,'parsedContent':_0x3637a1});await _0x49443b['updateContent']({'parsedContent':_0x3637a1,'renderingStrategy':_0xe7302e,'abortSignal':_0x3f8816});}async['updateWebSources'](_0x3b6bf3,_0xdb05fa){const _0xa51e02=this['getItemById'](_0x3b6bf3);if(_0xa51e02 instanceof hr)_0xa51e02['updateSources'](_0xdb05fa);else{if(!(_0xa51e02 instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0xa51e02,'id':_0x3b6bf3,'sources':_0xdb05fa});_0xa51e02['updateSources'](_0xdb05fa);}}async['updateSuggestionItem']({id:_0xb97acd,parts:_0x172965,abortSignal:_0x3ab4e0,skipLoadingEffects:_0x2fda00}){const _0x58caa2=this['getItemById'](_0xb97acd);if(!(_0x58caa2 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x58caa2,'id':_0xb97acd,'parts':_0x172965});await _0x58caa2['updateContent']({'parts':_0x172965,'abortSignal':_0x3ab4e0,'skipLoadingEffects':_0x2fda00});}['updateSuggestionPartState']({id:_0x3072c7,index:_0x3f7238,state:_0x35340a}){const _0x289b5c=this['getItemById'](_0x3072c7);if(!(_0x289b5c instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3072c7});_0x289b5c['updatePartState'](_0x3f7238,_0x35340a);}['setSuggestionPartActive']({id:_0x395c5c,index:_0x1b89e5,isActive:_0xc0a260}){const _0x1d6cd3=this['getItemById'](_0x395c5c);if(!(_0x1d6cd3 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x395c5c});this['children']['filter'](_0x54cae8=>_0x54cae8 instanceof hr)['forEach'](_0x12677f=>{_0x12677f['setPartActive'](!0x1);}),_0x1d6cd3['setPartActive'](_0x1b89e5,_0xc0a260);}['markItemAsDone'](_0x56e854){this['getItemById'](_0x56e854)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x2e245a=>_0x2e245a['options']['id']);}['removeItem'](_0x5abc01){this['children']['remove'](this['getItemById'](_0x5abc01));}['hasItem'](_0x2e9866){return!!this['children']['find'](_0x51a212=>_0x51a212['options']['id']['includes'](_0x2e9866));}['scrollToSuggestion'](_0xd93333,_0x20ab5b){const _0x1fb402=this['getItemById'](_0xd93333);if(!(_0x1fb402 instanceof hr))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0xd93333,'partIndex':_0x20ab5b});const _0x485f2d=_0x1fb402['getPartView'](_0x20ab5b);_0x485f2d?St(_0x485f2d['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0xd93333,'partIndex':_0x20ab5b});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x7d7776=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x7d7776,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x41dd9c=new zn(this['locale'],jn['aiFeed']);return _0x41dd9c['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x41dd9c;}['_createFeedItems'](){const _0x22daa8=new _0x5d2282(this['locale']);return _0x22daa8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x22daa8;}['_createFeedLoader'](){const _0x3e557b=new _0x5d2282(this['locale']);return _0x3e557b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x211326=>!_0x211326)]},'children':this['_createLoaderChildren']()}),_0x3e557b;}['_createLoaderChildren'](){const _0x5993a5=new lr();return _0x5993a5['isVisible']=!0x0,[_0x5993a5,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x31eb21){const _0x1afba9=this['children']['find'](_0x30dea9=>_0x30dea9['options']['id']['includes'](_0x31eb21));if(!_0x1afba9)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x31eb21});return _0x1afba9;}['setLoadingMessage'](_0x531ba1){this['set']('loadingMessage',_0x531ba1);}['toggleLoadingSkeleton'](_0x4e7503){this['set']('isLoadingSkeletonVisible',_0x4e7503);}['startAutoScroll'](_0x358ade={}){this['scrollManager']['start'](_0x358ade);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Ur=class extends jt{['filter'](){let _0x106801=0x0;for(const _0x57e2b0 of this['items'])_0x106801+=_0x57e2b0['items']['length'];return{'resultsCount':_0x106801,'totalItemsCount':_0x106801};}};function Br(_0x4cafce){const _0x67181e=[];let _0x32577d=!0x1;for(const _0x8e9e68 of Array['from'](_0x4cafce['items'])){if('file'!==_0x8e9e68['kind'])continue;if(_0x8e9e68['webkitGetAsEntry']()?.['isDirectory']){_0x32577d=!0x0;continue;}const _0x4720c6=_0x8e9e68['getAsFile']();_0x4720c6&&_0x67181e['push'](_0x4720c6);}return{'files':_0x67181e,'hasDirectory':_0x32577d};}const Gr='ck-ai-chat__prompt-input_highlighted';var Fr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x522b80,_0x22f0b7){super(_0x522b80,{'queryView':{'label':'','creator':_0x32d936,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Ur(_0x522b80),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x22f0b7,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',(_0x3ac45a,_0x329c0d)=>!_0x3ac45a&&!_0x329c0d),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0xc90833,_0x469fd8)=>{this['isUploadInProgress']||this['isEmpty']||_0xc90833['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x469fd8());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x2175c1=>this['_handlePaste'](_0x2175c1)),this['element']['addEventListener']('drop',_0x31e28e=>this['_handleDrop'](_0x31e28e));}['_handlePaste'](_0x2e4731){const _0x42bc85=_0x2e4731['clipboardData'];if(!_0x42bc85)return;const {files:_0x1a00a6,hasDirectory:_0x3122a0}=Br(_0x42bc85),_0x4536fc={'files':_0x1a00a6,'plainText':_0x42bc85['getData']('text/plain'),'hasDirectory':_0x3122a0,'forceTextAttachment':!0x1,'preventDefault':()=>_0x2e4731['preventDefault']()};this['fire']('promptInputPaste',_0x4536fc);}['_handleDrop'](_0x14dbfa){const _0x414699=_0x14dbfa['dataTransfer'];if(!_0x414699)return;const _0x2dd9a9={'files':[],'plainText':_0x414699['getData']('text/uri-list')||_0x414699['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x14dbfa['preventDefault']()};this['fire']('promptInputPaste',_0x2dd9a9);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x38be34=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x38be34)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x1975bc=_0x4495a6(_0x38be34);this['fire']('sendUserMessage',_0x1975bc),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x4c6d4c){this['queryView']['fieldView']['set']('placeholder',_0x4c6d4c);}['focus'](_0x2e65ed=!0x1){super['focus'](),_0x2e65ed&&(this['element']['classList']['contains'](Gr)||(this['element']['classList']['add'](Gr),setTimeout(()=>{this['element']['classList']['remove'](Gr);},0x320)));}['_createSubmitButton'](){const _0x105a5f=new Ht(this['locale']);return _0x105a5f['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+hn,'isEnabled':!0x1}),_0x105a5f['on']('execute',()=>{this['submit']();}),_0x105a5f;}['setIsUploadInProgress'](_0x48dd22){this['isUploadInProgress']=_0x48dd22;}['_setUpAddContextButtonPositioning'](){const _0x287a5f=this['locale'],_0x5e7c97=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x375d3c=new At(this['queryView']['fieldView']['element']),_0x47ab6e=new At(this['_addContextButtonView']['element']),_0xef504=_0x375d3c['width'],_0x4dc324='rtl'===_0x287a5f['uiLanguageDirection']?'right':'left';_0x375d3c['excludeScrollbarsAndBorders']();const _0x40b867=_0xef504-_0x375d3c['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4dc324]='calc('+(_0xef504-_0x47ab6e['width']-_0x40b867)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x5e7c97),this['on']('render',()=>{_0x5e7c97(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x5e7c97();});});}},Kr=class extends _0x5d2282{constructor(_0x3af083){super(_0x3af083);const _0x21b7aa=new Yt();_0x21b7aa['content']=_0x5ed1b5,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x21b7aa,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x3af083,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x3d877a){let _0x2c74aa=0x0;_0x3d877a['addEventListener']('dragenter',_0x50da4d=>{_0x50da4d['dataTransfer']&&(_0x2c74aa++,0x1===_0x2c74aa&&this['fire']('dragEnter'),_0x3d877a['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x3d877a['addEventListener']('dragover',_0x3f15cd=>{_0x3f15cd['dataTransfer']&&_0x3f15cd['preventDefault']();}),_0x3d877a['addEventListener']('dragleave',()=>{--_0x2c74aa<=0x0&&(_0x2c74aa=0x0,_0x3d877a['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x3d877a['addEventListener']('drop',_0xe094df=>{_0xe094df['preventDefault'](),_0x2c74aa=0x0,_0x3d877a['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0xe094df);});}['_handleDrop'](_0x250711){const _0x3b53fa=_0x250711['dataTransfer'];if(!_0x3b53fa)return;const {files:_0x58e68c,hasDirectory:_0x30466e}=Br(_0x3b53fa),_0x5c7801={'files':_0x58e68c,'plainText':_0x3b53fa['getData']('text/uri-list')||_0x3b53fa['getData']('text/plain'),'hasDirectory':_0x30466e,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x5c7801);}};const Wr='ck-ai-chat__prompt-capabilities',Yr='ck-ai-chat-controls-button',$r='ck-ai-chat-controls-button--commands',qr='ck-ai-chat-controls__model-selection',Qr='ck-ai-chat-controls__model-selection__item-name',Xr='ck-ai-chat-controls__model-selection__item-description',zr='ck-ai-chat-controls__model-selection__item-capabilities',jr='n';var Jr=class extends _0x5d2282{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x203a43){super(_0x203a43),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x49b777=>'selector'===_0x49b777),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x2c7b39=>_0x2c7b39?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x58152f=>_0x58152f),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x2d6c46=>_0x2d6c46),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x1e8cc9=>us(this['locale'],_0x1e8cc9?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x3be0c1=>_0x3be0c1),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x5f1e56=>us(this['locale'],_0x5f1e56?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Wr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x5d9db0(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x4fadf1,_0x52a88c){if(_0x52a88c)this['set']('modelDisplayMode','hidden');else{const _0x5d1fb7=0x1===_0x4fadf1['length'];this['set']('modelDisplayMode',_0x5d1fb7?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x4fadf1?.['length'])for(const _0x93be5 of _0x4fadf1){const _0x1f6858=new _0x36985a({'label':_0x93be5['name'],'withText':!0x0,'role':'menuitemradio','id':_0x93be5['id'],'model':_0x93be5});_0x1f6858['bind']('isOn')['to'](this,'activeModelId',_0x11c106=>_0x11c106===_0x93be5['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x1f6858,'labelView':new Zr(this['locale'],_0x93be5)});}}['setWebSearch'](_0x22f6b7){this['set']('webSearchActive',_0x22f6b7);}['setReasoning'](_0x1b66c3){this['set']('reasoningActive',_0x1b66c3);}['setModel'](_0x5e839a){if(!_0x5e839a)return;this['activeModelId']=_0x5e839a['id'],this['activeModelName']=_0x5e839a['name']||_0x5e839a['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x5e839a['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x5e839a['name']);const _0x4fdd97=_0x5e839a['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x4fdd97),this['_webSearchButton']['set']('isVisible',_0x4fdd97);const _0x37cea6=_0x5e839a['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x37cea6),this['_reasoningButton']['set']('isVisible',_0x37cea6);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x33a210){this['set']('modelSelectorEnabled',!0x1),_0x33a210&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0xe37689=new Ht();return _0xe37689['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0xe37689['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0xe37689;}['_createReasoningButton'](){const _0x389d0c=new Ht();return _0x389d0c['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x4150ef,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0x389d0c['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x389d0c;}['_createCommandsButton'](){const _0x19f309=new Ht();return _0x19f309['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x480be1,'withText':!0x0,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':jr}),_0x19f309['extendTemplate']({'attributes':{'class':[$r]}}),_0x19f309['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x19f309;}['_createModelSelectionDropdown'](){const _0x4b03f6=_0x2959da(this['locale']);return _0x4b03f6['set']({'panelPosition':'ne','class':[qr]}),_0x4b03f6['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':jr,'class':ln}),this['listenTo'](_0x4b03f6,'execute',_0x3e4043=>{this['fire']('selectModel',_0x3e4043['source']['model']);}),_0x4b03f6;}['_createModelNameView'](){const _0x576404=new to(this['locale']);return _0x576404['bind']('text')['to'](this,'activeModelName',_0x3b71cb=>_0x3b71cb??''),_0x576404['bind']('isVisible')['to'](this,'modelDisplayMode',_0x16ad71=>'name'===_0x16ad71),_0x576404;}},Zr=class extends Dt{constructor(_0x45cbed,_0x418f93){super();const _0x10fb20=this['bindTemplate'],_0x1ca3a8=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x10fb20['to']('style'),'id':_0x10fb20['to']('id')},'children':[{'tag':'div','attributes':{'class':[Qr]},'children':[{'text':_0x10fb20['to']('text')}]},{'tag':'div','attributes':{'class':[Xr]},'children':[{'tag':'span','children':[{'text':_0x418f93['description']}]}]},{'tag':'div','attributes':{'class':[zr]},'children':_0x1ca3a8}]}),_0x1ca3a8['addMany'](this['_getCapabilityParts'](_0x45cbed,at,'AI_CHAT_SEARCH_WEB',_0x418f93['capabilities']['webSearch']?.['enabled']??!0x1)),_0x1ca3a8['addMany'](this['_getCapabilityParts'](_0x45cbed,_0x4150ef,'AI_CHAT_REASONING',_0x418f93['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x1ea3bc,_0x390b6e,_0x435465,_0x66bf90){const _0x35acda=new Yt();_0x35acda['content']=_0x390b6e;const _0x3a3b8c=new _0x5d2282(_0x1ea3bc);_0x3a3b8c['setTemplate']({'tag':'span','children':[{'text':us(_0x1ea3bc,_0x435465)+':\x20'}]});const _0x3f62fa=new _0x5d2282(_0x1ea3bc);return _0x3f62fa['setTemplate']({'tag':'span','children':[{'text':us(_0x1ea3bc,_0x66bf90?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x35acda,_0x3a3b8c,_0x3f62fa];}},to=class extends _0x5d2282{constructor(_0x236474){super(_0x236474),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2b0b7d=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x2b0b7d['if']('isVisible','ck-hidden',_0x22dcb4=>!_0x22dcb4)]},'children':[{'text':_0x2b0b7d['to']('text')}]});}};const eo='ck-ai-chat-context-controls__url-form',io='ck-ai-chat-context-controls__url-input-section';var so=class extends _0x5d2282{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x32dec7){super(_0x32dec7),this['focusTracker']=new dt(),this['keystrokes']=new _t(),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 Gt({'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'](_0x396779=>{this['focusTracker']['add'](_0x396779['element']),this['keystrokes']['listenTo'](_0x396779['element']);}),_0x452df3({'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'](_0x2de110){this['urlInputField']['errorText']=_0x2de110,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0xb2baed=new Ht(this['locale']);return _0xb2baed['set']({'icon':_0x396ec0,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x1c29c3,_0x36c497,_0x48c490)=>{_0xb2baed['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x48c490?'':'\x20ck-hidden')]});}),_0xb2baed;}['_createUrlInputField'](){const _0x487d6c=new qt(this['locale'],_0x2926cc);return _0x487d6c['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x487d6c['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x487d6c;}['_createConfirmButton'](){const _0x16c164=new Ht(this['locale']);return _0x16c164['set']({'icon':_0x4bf74a,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x16c164;}['_setupTemplate'](){const _0x3034cd=new Ft(this['locale'],{'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3034cd['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':eo,'tabindex':'-1'},'children':[_0x3034cd,{'tag':'div','attributes':{'class':io},'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',_0x349013=>{_0x349013['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x18c43d,_0x440690)=>{this['clear'](),this['fire']('cancel'),_0x440690();});}['_handleSubmit'](){const _0x222a37=this['getValue']()['trim']();_0x222a37?this['_isValidUrl'](_0x222a37)?(this['clearError'](),this['fire']('submitUrl',_0x222a37)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x6ef376=this['getValue']()['trim'](),_0x5dfaca=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x6ef376['length']>0x0&&!_0x5dfaca;}['_isValidUrl'](_0x33729e){try{return!!new URL(_0x33729e);}catch{return!0x1;}}};const no='ck-ai-chat-resources__item',ro='ck-ai-chat-resources__item--in-context',oo='ck-ai-chat-resources__item-title',ao='ck-ai-chat-resources__item__icon';var ho=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x1a2a06,_0x432ef7){super(_0x1a2a06),this['resource']=_0x432ef7,this['set']('isInContext',!!_0x432ef7['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x49a271){if(_0x49a271['isInContext'])return _0x4bf74a;switch(_0x49a271['type']){case'document':return _0x26e7cd;case'web-resource':return _0x45e544;case'file':case'text':return _0x5ed1b5;default:return _0x50aab7;}}['highlightText'](_0x163dfb){if(!_0x163dfb||''===_0x163dfb['trim']())return void this['_titleView']['highlightText'](null);const _0x4bb2a9=new RegExp(_0x1e70d6(_0x163dfb),'gi');this['_titleView']['highlightText'](_0x4bb2a9);}['updateResourceState'](_0x553ee7){this['resource']['isInContext']=_0x553ee7,this['isInContext']=_0x553ee7,this['_updateIcon']();}['_createTitleView'](){const _0x5ce399=new Wt();return _0x5ce399['text']=this['resource']['label'],_0x5ce399['extendTemplate']({'tag':'span','attributes':{'class':[oo]}}),_0x5ce399;}['_createIconView'](){const _0x52f079=new Yt();return _0x52f079['content']=this['getResourceIcon'](this['resource']),_0x52f079;}['_setupTemplate'](){const _0x3dca65=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[no,_0x3dca65['if']('isVisible','ck-hidden',_0x4f3844=>!_0x4f3844),_0x3dca65['if']('isInContext',ro)]},'children':[{'tag':'div','attributes':{'class':[ao]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3dca65['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const co='ck-ai-chat-resources__list';var lo=class extends jt{['_source'];constructor(_0x275893,_0x26d9cc){super(_0x275893),this['_source']=_0x26d9cc,this['extendTemplate']({'attributes':{'class':[co]}});}['setResources'](_0x1eeca2,_0x5d9ff8){this['items']['clear']();let _0x1c75d9=_0x1eeca2;if(this['_source']['useDefaultFiltering']&&_0x5d9ff8&&''!==_0x5d9ff8['trim']()){const _0xb665f=new RegExp(_0x5d9ff8['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x1c75d9=_0x1eeca2['filter'](_0x226cf0=>_0xb665f['test'](_0x226cf0['label']));}for(const _0x548f81 of _0x1c75d9){const _0x753e9=new ho(this['locale'],_0x548f81);_0x753e9['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x548f81);}),this['items']['add'](_0x753e9);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x5d9ff8);}['highlightText'](_0x116806){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x4429e7=>{_0x4429e7['highlightText'](_0x116806);});}['updateResourceState'](_0xd8dbf5,_0x38c2f1){for(const _0x1e7dac of this['items']){const _0x33c10c=_0x1e7dac;_0x33c10c['resource']['id']===_0xd8dbf5&&_0x33c10c['updateResourceState'](_0x38c2f1);}}['_handleResourceSelection'](_0x1ae873,_0xffb8b7){this['fire']('addResourceToContext',{'source':_0x1ae873,'resource':_0xffb8b7});}},uo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x15f1a4){const t=_0x15f1a4['t'],_0x2c38c9={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x2926cc,'label':us(_0x15f1a4,'AI_CHAT_SEARCH_RESOURCES')};super(_0x15f1a4,_0x2c38c9['creator']),this['label']=_0x2c38c9['label'],this['_viewConfig']=_0x2c38c9,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x15f1a4,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x1c7f28){this['fire']('search',_0x1c7f28);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x3a593a,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x1fc63c,t){this['resetButtonView']=new Ht(_0x1fc63c),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x2c8364,'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',_0x5ce6c5=>!_0x5ce6c5),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);}},_o=class extends _0x5d2282{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0xcb51cc,_0x190174){super(_0xcb51cc),this['_source']=_0x190174['source'],this['_searchInputVisibleFrom']=_0x190174['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 _0x3c6d3b([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new uo(this['locale']);}['_createSearchSection'](){const _0x11b1eb=new _0x5d2282(this['locale']);return _0x11b1eb['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0xa27bad,_0x540d4a)=>{this['loadResources'](_0x540d4a),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x540d4a);}),_0x11b1eb;}['_createResourcesListView'](){const _0x51cc4a=new lo(this['locale'],this['_source']);return _0x51cc4a['delegate']('addResourceToContext')['to'](this),_0x51cc4a['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x51cc4a;}['_createSkeletonView'](){const _0x4a6c1a=new zn(this['locale'],jn['aiChatResources']);return _0x4a6c1a['bind']('isVisible')['to'](this,'isLoading'),_0x4a6c1a;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x236072){const _0x57b8ab=vt();this['_latestLoadResourcesUid']=_0x57b8ab,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x236072,'uid':_0x57b8ab}),this['isLoading']=!0x0;}['setResources'](_0xecc9e7,_0x9b12fc){if(_0x9b12fc&&_0x9b12fc!==this['_latestLoadResourcesUid'])return;const _0x57ee21=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0xecc9e7,_0x57ee21),_0xecc9e7['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x58ec03,_0x9cade0){this['_resourcesListView']['updateResourceState'](_0x58ec03,_0x9cade0);}};const go='ck-ai-chat-context-controls__source-balloon-panel',Ao='ck-button-icon\x20ck-button-back',Io='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var po=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x625335,_0x24863c,_0x37d90f){this['_locale']=_0x625335,this['_bodyCollection']=_0x24863c,this['_config']=_0x37d90f;}['showSourceResourcesBalloon']({source:_0x48c290,withBackButton:_0x53b917}){let _0x175ca7=this['_sourceResourceBalloons']['get'](_0x48c290['id']);_0x175ca7||(_0x175ca7=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x48c290['id'],_0x175ca7),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x175ca7)),this['_addSourceResourceContent']({'balloonPanel':_0x175ca7,'source':_0x48c290,'withBackButton':_0x53b917}),_0x175ca7['show']();const _0x28fde0=this['_config']['getTargetElement']();_0x28fde0&&_0x175ca7['pin']({'target':_0x28fde0,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x76e1ec,_0x58d36a,_0x1a4c81){const _0x1c59c4=this['_sourceResourceBalloons']['get'](_0x76e1ec);if(!_0x1c59c4)return;const _0x3e7b13=this['_getResourcesViewFromBalloon'](_0x1c59c4);_0x3e7b13&&(_0x3e7b13['setResources'](_0x58d36a,_0x1a4c81),_0x3e7b13['once']('change:isLoading',()=>{_0x1c59c4['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x2093b7){const _0x32638a=this['_sourceResourceBalloons']['get'](_0x2093b7);_0x32638a&&requestAnimationFrame(()=>{_0x32638a['hide'](),this['_sourceResourceBalloons']['delete'](_0x2093b7),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x374a33 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x374a33);}['isAnyResourceBalloonVisible'](){for(const _0x905f24 of this['_sourceResourceBalloons']['values']())if(_0x905f24['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x303013,_0x2402f7,_0x1492ac){const _0x3a1212=this['_sourceResourceBalloons']['get'](_0x303013);if(!_0x3a1212||!_0x3a1212['isVisible'])return;const _0x5795c5=this['_config']['getTargetElement']();if(!_0x5795c5)return;_0x3a1212['pin']({'target':_0x5795c5,'limiter':this['_config']['getLimiterElement']()});const _0x423c7d=this['_getResourcesViewFromBalloon'](_0x3a1212);_0x423c7d&&_0x423c7d['updateResourceState'](_0x2402f7,_0x1492ac);}['destroy'](){for(const _0x40f71 of this['_sourceResourceBalloons']['values']())_0x40f71['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x504583=new yt(this['_locale']);return _0x504583['extendTemplate']({'attributes':{'class':go}}),this['_bodyCollection']['add'](_0x504583),_0x504583;}['_addSourceResourceContent']({balloonPanel:_0x299158,source:_0x37477b,withBackButton:_0x4869b4}){_0x299158['content']['clear']();const _0x137a89=this['_createBalloonHeader']({'balloonPanel':_0x299158,'source':_0x37477b,'withBackButton':_0x4869b4});_0x299158['content']['add'](_0x137a89);const _0x47a6c2=this['_createBalloonResourcesView'](_0x37477b);_0x299158['content']['add'](_0x47a6c2);}['_createBalloonHeader']({balloonPanel:_0x3aef59,source:_0x574ab5,withBackButton:_0x1eccfc}){const _0x3ad77a=new Ft(this['_locale'],{'label':_0x574ab5['label'],'class':Io});return _0x1eccfc&&_0x3ad77a['children']['add'](this['_createBackButton'](_0x3aef59),0x0),_0x3ad77a;}['_createBackButton'](_0x271307){const _0x5009c5=new Ht(this['_locale']);return _0x5009c5['set']({'icon':_0x396ec0,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ao}),_0x5009c5['on']('execute',()=>{_0x271307['hide'](),this['_config']['onBackToContext']();}),_0x5009c5;}['_createBalloonResourcesView'](_0x3d734b){const _0x1d622b=new _o(this['_locale'],{'source':_0x3d734b,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x1d622b['on']('loadSourceResources',(_0x5a547f,_0x693637)=>{this['_config']['onLoadSourceResources'](_0x693637);}),_0x1d622b['on']('addResourceToContext',(_0x122064,_0x3e69ed)=>{this['_config']['onResourceSelected'](_0x3e69ed['source'],_0x3e69ed['resource']),this['closeSourceResourceBalloon'](_0x3d734b['id']);}),_0x1d622b;}['_getResourcesViewFromBalloon'](_0x9d019){const _0xdbb177=_0x9d019['content']['get'](0x1);return _0xdbb177 instanceof _o?_0xdbb177:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x3b777a){_0xf7c0ab({'emitter':_0x3b777a,'contextElements':[_0x3b777a['element']],'callback':()=>{_0x3b777a['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x3b777a['isVisible']});}};const mo=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Eo='ck-ai-chat-context-controls',To='ck-ai-chat-context-controls__pending-contexts',wo='ck-ai-chat-context-controls__add-context-balloon-panel',Co='ck-ai-chat-context-controls__add-context-button',fo='ck-ai-chat-context-controls__url-balloon-panel',bo='ck-ai-chat-context-controls__balloon-button',So='ck-ai-chat-context-controls__balloon-button-source',Ro='ck-ai-chat-controls-button',Oo='ck-ai-chat-context-chips-wrapper-balloon',vo='ck-ai-chat-controls_context_show-more-button',ko='ck-ai-chat-context-controls__show-more-balloon-panel',No='ck-ai-chat',yo=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var xo=class extends _0x5d2282{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x3a10b9,_0x4d4327){super(_0x3a10b9),this['bodyCollection']=_0x4d4327['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3a10b9),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3a10b9),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3a10b9),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3a10b9,_0x4d4327);const _0x1c6d3d={'cssClasses':{'showMoreButton':vo+'\x20'+ln,'showMoreBalloon':ko,'overflowContainer':Oo,'controlsButton':Ro}};this['_overflowManager']=new fr(_0x3a10b9,this['_currentContextsChips'],_0x1c6d3d,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'](_0x39e932,_0x9cbc08){const _0x186549=this['_createContextButton'](_0x39e932,'current',!0x0,_0x9cbc08);this['_addContextToCollection'](_0x186549,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x2b6cbd){this['_removeContextFromCollection'](_0x2b6cbd,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x2b6cbd,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x2d125d,_0x26715b){let _0x2c25ca=this['_currentContextsChips']['find'](_0x3f2f59=>_0x3f2f59['id']===_0x2d125d);_0x2c25ca||(_0x2c25ca=this['_overflowManager']['overflowChips']['find'](_0x5d236c=>_0x5d236c['id']===_0x2d125d)),_0x2c25ca&&(_0x2c25ca['isLoading']=_0x26715b);}['setConversationContext'](_0x4ad3dd){this['_conversationContextsChips']['clear']();for(const _0x2fe556 of _0x4ad3dd){const _0x58c431=this['_createContextButton'](_0x2fe556,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x58c431,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x537b04,_0x498ce4,_0x542fd0){this['_resourcesBalloonView']['updateResourceState'](_0x537b04,_0x498ce4,_0x542fd0);}['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:_0x3332df,withBackButton:_0x559ea1}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x3332df,'withBackButton':_0x559ea1}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0xba656c,_0x328ddf,_0x38c69d,_0x2ce360){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0xba656c,_0x38c69d,_0x2ce360);}['closeSourceResourceBalloon'](_0x519ab9){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x519ab9),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x491d75){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x491d75),this['_setAddContextButtonEnabled'](_0x491d75);}['_setAddContextButtonEnabled'](_0x327c5f){const _0x4132b9=!_0x327c5f['document']['isHidden']&&_0x327c5f['document']['enabled'],_0x88a867=_0x327c5f['urls']['enabled'],_0x3c79a1=_0x327c5f['files']['enabled'],_0x374c25=_0x327c5f['sources']['length']>0x0,_0x1ef231=_0x327c5f['customItems']&&_0x327c5f['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x4132b9||_0x88a867||_0x3c79a1||_0x374c25||_0x1ef231;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Eo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':To},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x1876e3){const _0x380df5=new Ht(_0x1876e3);return _0x380df5['set']({'label':us(_0x1876e3,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ro+'\x20'+Co+'\x20'+ln,'icon':_0x2f7747,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x380df5;}['_createAddContextBalloonPanelView'](_0xc3166c){return this['_createBaseBalloonPanel'](_0xc3166c,wo);}['_createUrlBalloonPanelView'](_0x2ec110){const _0x51c7f7=this['_createBaseBalloonPanel'](_0x2ec110,fo);return this['_addUrlContent'](_0x51c7f7,_0x2ec110),_0x51c7f7;}['_createResourcesBalloonView'](_0x45aa62,_0x42c46a){const _0x4f8149={'searchInputVisibleFrom':_0x42c46a['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});},'onResourceSelected':(_0x341eb1,_0x2a92e7)=>{this['fire']('addResourceToContext',{'source':_0x341eb1,'resource':_0x2a92e7});},'onLoadSourceResources':_0x25bef8=>{this['fire']('loadSourceResources',_0x25bef8);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new po(_0x45aa62,_0x42c46a['bodyCollection'],_0x4f8149);}['_getLimiterElement'](){return this['element']?.['closest']('.'+No)||document['body'];}['_createBaseBalloonPanel'](_0x4c894d,_0x2a73b8){const _0x33124e=new yt(_0x4c894d);return _0x33124e['extendTemplate']({'attributes':{'class':_0x2a73b8}}),this['bodyCollection']['add'](_0x33124e),_0x33124e;}['_setBalloonPanelContent'](_0x300948,_0x18e378,_0x5d6887){if(_0x300948['content']['clear'](),!_0x5d6887['document']['isHidden']&&_0x5d6887['document']['enabled']){const _0x1caa1b=this['_createBalloonButton'](_0x18e378,{'label':us(_0x18e378,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x26e7cd});_0x1caa1b['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x300948['content']['add'](_0x1caa1b);}if(_0x5d6887['urls']['enabled']){const _0x573570=this['_createBalloonButton'](_0x18e378,{'label':us(_0x18e378,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x45e544});_0x573570['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_urlInputView']['focus']();}),_0x300948['content']['add'](_0x573570);}if(_0x5d6887['files']['enabled']){const _0xdf8d73=new Bt(_0x18e378);_0xdf8d73['set']({'label':us(_0x18e378,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x357b59,'withText':!0x0,'tooltip':!0x0,'class':bo,'allowMultipleFiles':!0x0}),_0xdf8d73['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0xdf8d73['on']('done',(_0x42418e,_0xd15195)=>{this['fire']('addFileToContext',_0xd15195);}),_0xdf8d73['tooltip']=!0x0,_0x300948['content']['add'](_0xdf8d73);}for(const _0x4f4414 of _0x5d6887['sources']){const _0x3a0671=this['_createBalloonButton'](_0x18e378,{'label':_0x4f4414['label'],'icon':_0x4f4414['icon']||_0x50aab7,'type':'source'});_0x300948['content']['add'](_0x3a0671),_0x3a0671['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x4f4414,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x5a7ab7 of _0x5d6887['customItems']||[]){const _0x309a3f=this['_createBalloonButton'](_0x18e378,{'label':_0x5a7ab7['label'],'icon':_0x5a7ab7['icon']||_0x50aab7,'type':'customItem'});_0x300948['content']['add'](_0x309a3f),_0x309a3f['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x5a7ab7);});}this['_hasExactlyOneSource']=0x1===_0x300948['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x510c86,_0x4add5c){this['_urlInputView']=new so(_0x4add5c),this['_urlInputView']['on']('submitUrl',(_0x43cc61,_0xccc53c)=>{this['_handleUrlSubmit'](_0xccc53c);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});}),_0x510c86['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x2098ed,_0x1e6ed1){const _0x2abe4b='source'===_0x1e6ed1['type']?new Lo(_0x2098ed):new Ht(_0x2098ed);return _0x2abe4b['set']({'label':_0x1e6ed1['label'],'icon':_0x1e6ed1['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':bo}),_0x2abe4b;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0xf7c0ab({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x417f7a){const _0x588266=this['_addContextBalloonConfig'];_0x588266['buttonView']['isOn']=_0x417f7a,_0x417f7a?_0x588266['balloonView']['show']():_0x588266['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x3f8319,buttonView:_0x31c47d,hideMethod:_0x1f1906}=this['_addContextBalloonConfig'];_0xf7c0ab({'emitter':_0x3f8319,'contextElements':[_0x3f8319['element'],_0x31c47d['element']],'callback':()=>{_0x1f1906();},'activator':()=>_0x31c47d['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x2db680,_0x5a1a2a,_0x36e118=!0x1,_0x52c225=!0x1){const _0x3ea64b='conversation'===_0x5a1a2a||!0x0===_0x2db680['isReadOnly'],_0x8f343f=new Er(this['locale'],_0x2db680,_0x3ea64b,_0x36e118,_0x52c225);return _0x3ea64b||_0x8f343f['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x8f343f['id']);}),_0x8f343f;}['_addContextToCollection'](_0x128910,_0x4d91da){_0x4d91da['add'](_0x128910,0x0);}['_removeContextFromCollection'](_0x36eed1,_0x536718){const _0x37547a=_0x536718['find'](_0x2be536=>_0x2be536['id']===_0x36eed1);_0x37547a&&_0x536718['remove'](_0x37547a);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x4a397f){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x4a397f);}},Lo=class extends Ht{['arrowView'];constructor(_0x1c7447){super(_0x1c7447),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[So]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0xa9498e=new Yt();return _0xa9498e['content']=_0x53adfc,_0xa9498e['extendTemplate']({'attributes':{'class':So+'__arrow'}}),_0xa9498e;}},Do=class extends _0x5d2282{['_cancelButtonView'];['_loaderView'];constructor(_0xbac935){super(_0xbac935),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 _0x57604c=new Ht(this['locale']);return _0x57604c['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':cn+'\x20ck-ai-button-stop-generating','icon':it}),_0x57604c['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x57604c;}['_createLoaderView'](){const _0xcd3b1f=new _0x5d2282(this['locale']);return _0xcd3b1f['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':us(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0xcd3b1f;}},Po=class extends _0x5d2282{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x5639d1,_0x363bf3){super(_0x5639d1),this['_filesEnabled']=_0x363bf3['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x5639d1,{'bodyCollection':_0x363bf3['bodyCollection'],'searchInputVisibleFrom':_0x363bf3['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x5639d1),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x5639d1),this['_loaderView']=this['_createLoaderView'](_0x5639d1),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x5639d1),this['_dropZoneView']=new Kr(_0x5639d1),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...mo)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x13b7be=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x13b7be['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x13b7be['if']('isLoading','ck-hidden',_0x2e11b9=>_0x2e11b9||!this['isModelAvailable']),_0x13b7be['if']('isModelAvailable','ck-hidden',_0x467dda=>!_0x467dda||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x13b7be['if']('isLoading','ck-hidden',_0x280e42=>!_0x280e42)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x13b7be['if']('isModelAvailable','ck-hidden',_0x5b17ef=>_0x5b17ef)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0xf7c0ab({'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'](_0x21a7f0,_0x311f0a){return new xo(_0x21a7f0,_0x311f0a);}['_createPromptInputView'](_0x106b59){return new Fr(_0x106b59,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x18656b){return new Jr(_0x18656b);}['_createLoaderView'](_0x288d19){return new Do(_0x288d19);}['_createModelUnavailableMessageView'](_0x5566e1){const _0x475076=new Ho(_0x5566e1);return _0x475076['delegate']('startConversation')['to'](this),_0x475076;}['_handlePromptInputFocus'](_0x21bb8f,_0x25fc2a,_0x55188d){_0x55188d?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x30913f,_0x2ade02){this['_contextPanelView']['addContextItem'](_0x30913f,_0x2ade02);}['removeContextItem'](_0x4821cb){this['_contextPanelView']['removeContextItem'](_0x4821cb);}['setContextItemLoading'](_0x25f69d,_0x3b9435){this['_contextPanelView']['setContextItemLoading'](_0x25f69d,_0x3b9435);}['setIsUploadInProgress'](_0x11b4ab){this['_promptInputView']['setIsUploadInProgress'](_0x11b4ab);}['setConversationContext'](_0x105f76){this['_contextPanelView']['setConversationContext'](_0x105f76);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x4f4236,_0x1c77ad,_0x155a01){this['_contextPanelView']['updateResourceState'](_0x4f4236,_0x1c77ad,_0x155a01);}['setWebSearch'](_0xbf5dab){this['_promptCapabilitiesView']['setWebSearch'](_0xbf5dab);}['setReasoning'](_0x3e62bb){this['_promptCapabilitiesView']['setReasoning'](_0x3e62bb);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x2b66f7){this['_contextPanelView']['setAddContextOptions'](_0x2b66f7);}['setInputPlaceholder'](_0x2edd1f){this['_promptInputView']['setPlaceholderText'](_0x2edd1f);}['setModelList'](_0x2887de,_0x15dda3){this['_promptCapabilitiesView']['setModelList'](_0x2887de,_0x15dda3);}['setModel'](_0x161b0a){_0x161b0a?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x161b0a)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x345a35){this['_promptCapabilitiesView']['disableModelSelector'](_0x345a35);}['populateSourceResourceBalloon'](_0x98b347,_0x461e2f,_0x42c404,_0x32475a){this['_contextPanelView']['populateSourceResourceBalloon'](_0x98b347,_0x461e2f,_0x42c404,_0x32475a);}['closeSourceResourceBalloon'](_0x26636a){this['_contextPanelView']['closeSourceResourceBalloon'](_0x26636a);}['focusPromptInput'](_0x3b68b7=!0x1){this['_promptInputView']['focus'](_0x3b68b7);}['setPromptInputValue'](_0x5d129c){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x5d129c;}},Ho=class extends _0x5d2282{constructor(_0x2c2fde){super(_0x2c2fde);const _0x195998=new Ht(_0x2c2fde);_0x195998['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x195998['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x195998]}]});}},Mo=class extends Ft{['resizeButton'];constructor(_0x568d62,_0xeb583b){super(_0x568d62,{'label':_0xeb583b['label'],'class':'ck-ai-header\x20'+_0xeb583b['class'],'icon':_0xeb583b['icon']}),this['set']('isMaximized',!0x1),_0xeb583b['content']&&this['children']['add'](_0xeb583b['content']),_0xeb583b['showResizeButton']&&(this['resizeButton']=un(_0x568d62,this),this['children']['add'](this['resizeButton']));}},Vo=class extends _0x5d2282{constructor(_0x16ef8d){super(_0x16ef8d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x16ef8d,'AI_DISCLAIMER_TEXT')}]}]});}};function Uo(_0x3a667e,_0x3ebb6c){const _0x18c7cb=new Ht(_0x3a667e);return _0x18c7cb['set']({'label':us(_0x3a667e,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x534fb7,'class':'ck-ai-chat__start-conversation\x20'+cn}),_0x18c7cb['on']('execute',()=>{_0x3ebb6c['fire']('startConversation');}),_0x18c7cb;}var Bo=class extends _0x5d2282{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0xf9070c,_0x1b44e3){super(_0xf9070c),this['_bodyCollection']=dn(_0xf9070c);const _0x55e8a6=Uo(_0xf9070c,this);this['chatHeader']=new Mo(_0xf9070c,{'label':us(_0xf9070c,'AI_CHAT_HEADING'),'icon':_0x36cf34,'class':'ck-ai-header_chat','content':_0x55e8a6,'showResizeButton':_0x1b44e3['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Vr(_0xf9070c,this['_bodyCollection']),this['chatFeed']['delegate'](...xn)['to'](this),this['chatControls']=new Po(_0xf9070c,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x1b44e3['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x1b44e3['filesEnabled']}),this['chatControls']['delegate'](...xn)['to'](this),this['chatDisclaimer']=new Vo(_0xf9070c),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0xf9070c['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x132ad8,_0x4a4032,_0x22d7b9,_0x244b9e){this['chatControls']['populateSourceResourceBalloon'](_0x132ad8,_0x4a4032,_0x22d7b9,_0x244b9e);}['closeSourceResourceBalloon'](_0x4662c1){this['chatControls']['closeSourceResourceBalloon'](_0x4662c1);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Go=class extends _0x10611c{static get['requires'](){return[cs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x1ecc04){super(_0x1ecc04);const _0x394e62=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new tr(),this['_view']=new Bo(this['context']['locale'],{'showResizeButton':_0x394e62['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'](_0x394e62),this['_view']['delegate'](...xn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x21d5a7,{showDiff:_0x2fc7da})=>{this['showDiff']=_0x2fc7da;}),this['disableControls'](),_0x394e62['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x36cf34,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x394e62['view'],'isMaximized',_0x2c9698=>_0x2c9698),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x53b50f=>_0x53b50f),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x23b2b9){const _0x3d72c0=this['context']['config']['get']('ai.chat.welcomeMessage')??us(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x23b2b9['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x3d72c0}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x58b0e7,staticMessage:_0x13da05}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x58b0e7,'initialContent':'<p>'+_0x13da05+'</p>'});});}async['addFeedItemUserMessage'](_0xd776f){const _0x2a8d20=_0xd776f['attributes']?.['displayedPrompt']||_0xd776f['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xd776f['contextItems']['values']()),'initialContent':'<p>'+_0x2a8d20+'</p>','id':_0xd776f['id']});});}async['addFeedItemError']({errorMessage:_0x31be25,id:_0x5c43e8}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x31be25+'</p>','id':_0x5c43e8});});}async['addFeedItemAIReply'](_0x4f2fb2){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4f2fb2['interactionId']+':'+_0x4f2fb2['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x4c3dfb){const _0x221a0e=ds(this['context']),_0x712899=_0x221a0e['map'](_0x3ec69a=>_0x3ec69a['config']['get']('ai.availableReplyActions')||[...ir]);let _0x20f437=_0x712899['reduce']((_0x3117e4,_0x3b14cf)=>_0x3117e4['filter'](_0x55829c=>_0x3b14cf['includes'](_0x55829c)),_0x712899[0x0]||[...ir]);const _0x309098=_0x221a0e['every'](_0x1f3593=>_0x1f3593['plugins']['has']('TrackChanges')),_0x4a3e7c=_0x221a0e['map'](_0xb0b322=>_0xb0b322['commands']['get']('trackChanges'));return _0x309098?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x4a3e7c,'value',(..._0x42926f)=>_0x42926f['some'](_0x70e948=>_0x70e948))):_0x20f437=_0x20f437['filter'](_0x5364b4=>'insertSuggestion'!=_0x5364b4),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4c3dfb['interactionId']+':'+_0x4c3dfb['id'],'areActionsDisabled':_0x4c3dfb['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x20f437}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x369a0c,_0x417158){return this['_promiseQueue']['enqueue'](async()=>{const _0x4cd90b=this['_view']['chatFeed']['children']['last'];if(_0x4cd90b instanceof xr)return this['_view']['chatFeed']['children']['remove'](_0x4cd90b),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x369a0c['id'],'capabilities':{'isWebSearchEnabled':_0x4cd90b['capabilities']['isWebSearchEnabled']||_0x417158['isWebSearchEnabled'],'isReasoningEnabled':_0x4cd90b['capabilities']['isReasoningEnabled']||_0x417158['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x369a0c['id'],'capabilities':_0x417158});});}async['addFeedItemCustomElement'](_0x2f9e4e,_0xfa23a){let _0x58065c;return await this['_promiseQueue']['enqueue'](async()=>{_0x58065c=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x2f9e4e,'id':_0xfa23a});}),_0x58065c;}['removeFeedItem'](_0x3edd43){this['_view']['chatFeed']['removeItem'](_0x3edd43);}['hasFeedItem'](_0x238108){return this['_view']['chatFeed']['hasItem'](_0x238108);}['updateFeedInteractionHeader'](_0x556f2f){const _0x53e48b=this['_view']['chatFeed']['children']['find'](_0x410769=>_0x410769['options']['id']==_0x556f2f['id']&&_0x410769 instanceof xr);_0x53e48b&&_0x53e48b['set']('isVisible',_0x556f2f['isVisible']);}async['updateFeedItemAIReplyContent'](_0x8e44c6){const _0xdac59e=_0x8e44c6['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x3f3109=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x8e44c6,'abortSignal':_0x3f3109,'renderingStrategy':_0xdac59e}),_0x8e44c6['isDone']&&this['markFeedItemAsDone'](_0x8e44c6['id']);});}['updateFeedItemAIReplySources'](_0x51ec5f,_0xf414c2){this['_view']['chatFeed']['updateWebSources'](_0x51ec5f,_0xf414c2);}async['updateFeedItemAIReplySuggestionContent'](_0x2abcb9){return this['_promiseQueue']['enqueue'](async _0x218e66=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x2abcb9,'abortSignal':_0x218e66}),_0x2abcb9['isDone']&&this['markFeedItemAsDone'](_0x2abcb9['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x4805ac){this['_view']['chatFeed']['updateSuggestionPartState'](_0x4805ac);}['setFeedItemAIReplySuggestionPartActive'](_0x3e0c7c){this['_view']['chatFeed']['setSuggestionPartActive'](_0x3e0c7c);}['markFeedItemAsDone'](_0x2dfd29){this['_view']['chatFeed']['markItemAsDone'](_0x2dfd29);}['removeFeedInteraction'](_0x59f98d){this['_view']['chatFeed']['getItemIds']()['filter'](_0x423ca5=>_0x423ca5['startsWith'](_0x59f98d))['forEach'](_0xf76e75=>this['_view']['chatFeed']['removeItem'](_0xf76e75));}['startInteraction'](){const _0x1f6a44=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x1f6a44),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x55a009){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x5eabc7=>_0x5eabc7['startsWith'](_0x55a009['id']))['forEach'](_0x1d95d4=>this['markFeedItemAsDone'](_0x1d95d4)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x5a2b83,_0x550f43){this['_view']['chatControls']['addContextItem'](_0x5a2b83,_0x550f43);}['removeContextItem'](_0x4921b6){this['_view']['chatControls']['removeContextItem'](_0x4921b6);}['setContextItemLoading'](_0x2cf348,_0xde67c4){this['_view']['chatControls']['setContextItemLoading'](_0x2cf348,_0xde67c4);}['setIsUploadInProgress'](_0x2535e8){this['_view']['chatControls']['setIsUploadInProgress'](_0x2535e8);}['setConversationContext'](_0x2d610f){this['_view']['chatControls']['setConversationContext'](_0x2d610f);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x9b8684,_0x185017,_0x141ecb){this['_view']['chatControls']['updateResourceState'](_0x9b8684,_0x185017,_0x141ecb);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x98a144){this['_view']['chatControls']['setAddContextOptions'](_0x98a144);}['updateCapabilities'](_0x345844){this['_view']['chatControls']['setWebSearch'](_0x345844['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x345844['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x345844));}['setSelectedModel'](_0x5af215,_0x9e5d2){this['_view']['chatControls']['setModel'](_0x5af215),_0x9e5d2&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x398b5a){this['feedItemRenderingStrategy']=_0x398b5a;}['toggleLoadingSkeleton'](_0x1e27b7){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x1e27b7);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x1a544f,_0x499527=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x499527&&!pt()&&_0x1a544f['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x1a544f);this['_view']['chatHeader']['label']=_0x1a544f;}['setLoadingMessage'](_0x9350f9){this['_view']['chatFeed']['setLoadingMessage'](_0x9350f9);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x404d7b){let _0x488c0e=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x404d7b[_0x488c0e],_0x488c0e++,_0x488c0e===_0x404d7b['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x16b2a0){return _0x16b2a0['isWebSearchEnabled']&&_0x16b2a0['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x16b2a0['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x16b2a0['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x4d5c23){return _0x4d5c23?_0x4d5c23['isWebSearchEnabled']&&_0x4d5c23['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x4d5c23['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x4d5c23['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x5b6f79,_0xa8b63b,_0x1460b0,_0x3afeb7){this['_view']['populateSourceResourceBalloon'](_0x5b6f79,_0xa8b63b,_0x1460b0,_0x3afeb7);}['closeSourceResourceBalloon'](_0x370256){this['_view']['closeSourceResourceBalloon'](_0x370256);}['setPromptInputValue'](_0x59ecad){this['_view']['chatControls']['setPromptInputValue'](_0x59ecad);}['focusPromptInput'](_0x15d2ba=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x15d2ba);}['scrollFeedToSuggestion'](_0x20512e,_0x293701){this['_view']['chatFeed']['scrollToSuggestion'](_0x20512e,_0x293701);}['startAutoScroll'](_0x43dbeb={}){this['_view']['chatFeed']['startAutoScroll'](_0x43dbeb);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Fo=class extends jt{['sections'];constructor(_0x5caa06,_0x3e5dd6){super(_0x5caa06),this['sections']=_0x3e5dd6,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x1fd239){let _0x300671=0x0,_0x5e2099=0x0;for(const _0x153f5b of this['sections']){const {resultsCount:_0x5e50eb,totalItemsCount:_0x2373dd}=_0x153f5b['filter'](_0x1fd239);_0x300671+=_0x5e50eb,_0x5e2099+=_0x2373dd;}return{'resultsCount':_0x300671,'totalItemsCount':_0x5e2099};}},Ko=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x2cd62c,{title:_0xca57d9,items:_0x49ad57}){super(_0x2cd62c);const _0x422be9=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0xca57d9,this['itemsViews']=_0x49ad57;const _0x396ab7=new _0x5d2282(_0x2cd62c);_0x396ab7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0x2cd62c),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x422be9['if']('isVisible','ck-hidden',_0x4310d8=>!_0x4310d8)]},'children':[_0x396ab7,this['_itemsListView']]});}['filter'](_0x533dd5){const _0x316cdf=this['itemsViews']['length'];let _0x47c84a=0x0;for(const _0x5c23dc of this['itemsViews'])_0x533dd5?(_0x5c23dc['isVisible']=!!_0x5c23dc['isMatching'](_0x533dd5),_0x5c23dc['highlightText'](_0x533dd5)):(_0x5c23dc['isVisible']=!0x0,_0x5c23dc['highlightText'](null)),_0x5c23dc['isVisible']&&_0x47c84a++;return this['isVisible']=_0x47c84a>0x0,{'resultsCount':_0x47c84a,'totalItemsCount':_0x316cdf};}['getItem'](_0x1c2d1b){return this['itemsViews']['find'](_0x293011=>_0x293011['id']===_0x1c2d1b);}['removeItem'](_0x5ec015){const _0x2e81fb=this['itemsViews']['indexOf'](_0x5ec015);-0x1!==_0x2e81fb&&(this['itemsViews']['splice'](_0x2e81fb,0x1),this['_itemsListView']['items']['remove'](_0x5ec015));}};const Wo=/* #__PURE__ -- @preserve */
34
- _0x5bc6c6(zt);var Yo=class AIChatHistoryListItemView extends Wo{['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(_0x46b258,_0x272b60){super(_0x46b258);const _0xc3098d=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x272b60['pinned']),this['set']('loadingState',null),this['set']('title',_0x272b60['title']),this['id']=_0x272b60['id'];const {createdAt:_0x44dea6,active:_0x2d7300=!0x1}=_0x272b60;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x258c79=this['_createCheckView'](),_0x36ec00=this['_createPinButtonView'](_0x46b258),_0x106c61=this['_createMenuDropdownView'](),_0x46eb77=this['_createEditInputView'](_0x46b258),_0x3b6e6a=this['_createAcceptEditButtonView'](_0x46b258,_0x46eb77),_0xfb47e=this['_createCancelEditButtonView'](_0x46b258);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x36ec00),this['actions']['add'](_0x106c61),this['on']('change:isEdit',(_0x41316b,_0x45cb63,_0x3f9dff)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x3f9dff?(this['actions']['add'](_0x3b6e6a),this['actions']['add'](_0xfb47e),this['mainContent']['add'](_0x46eb77),_0x46eb77['element']['value']=this['title']||'',_0x46eb77['element']['focus']()):(this['actions']['add'](_0x36ec00),this['actions']['add'](_0x106c61),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x2d7300?'ck-ai-chat-history__item--active':'',_0xc3098d['if']('isVisible','ck-hidden',_0x13fa92=>!_0x13fa92),_0xc3098d['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',_0xc3098d['if']('loadingState','ck-hidden',_0x46218d=>!!_0x46218d)]},'children':_0x2d7300?[_0x258c79]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0xc3098d['if']('loadingState','ck-hidden',_0xd9e5bf=>!_0xd9e5bf)]},'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',_0xc3098d['if']('loadingState','ck-hidden',_0x18fad2=>!!_0x18fad2)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0xc3098d['if']('loadingState','ck-hidden',_0x28d2ee=>!_0x28d2ee)]},'children':[{'text':_0xc3098d['to']('loadingState',_0x241ac5=>_0x241ac5?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x241ac5]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x44dea6]}]},{'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'](_0x26a9c6){this['set']('title',_0x26a9c6);}['updateLoadingState'](_0x2b4ddc,_0x23729c){this['set']('loadingState',_0x23729c?_0x2b4ddc:null);}['_createCheckView'](){const _0x363d02=new Yt();return _0x363d02['set']({'content':_0x4bf74a}),_0x363d02;}['_createPinButtonView'](_0x5afa38){const _0xc20e28=new Ht(_0x5afa38);return _0xc20e28['set']({'label':us(_0x5afa38,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x2e604f,'withText':!0x1,'tooltip':!0x0}),_0xc20e28['bind']('isOn')['to'](this,'pinned'),_0xc20e28['on']('execute',()=>{const _0x42c15f=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x42c15f});}),_0xc20e28;}['_createMenuDropdownView'](){const _0x57b28a=_0x2959da(this['locale']),_0x54a32a=_0x57b28a['panelView']['children'];_0x57b28a['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x57b28a['panelPosition']='sw';const _0x1de866=new Ht(this['locale']);_0x1de866['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x1de866['withText']=!0x0,_0x1de866['on']('execute',()=>{this['isEdit']=!0x0;});const _0x444882=new Ht(this['locale']);_0x444882['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x444882['withText']=!0x0,_0x444882['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x856447=new jt(this['locale']),_0xb3d1e6=new zt(this['locale']);_0xb3d1e6['children']['add'](_0x1de866);const _0x1a13b4=new zt(this['locale']);return _0x1a13b4['children']['add'](_0x444882),_0x856447['items']['addMany']([_0xb3d1e6,_0x1a13b4]),_0x54a32a['add'](_0x856447),_0x57b28a;}['_createEditInputView'](_0x23941a){const _0x5202fc=new $t(_0x23941a),_0x12523d=_0x5202fc['bindTemplate'];return _0x5202fc['extendTemplate']({'on':{'keydown':_0x12523d['to'](_0x1de4f4=>{'Enter'==_0x1de4f4['key']&&this['_commitEditInputValue'](_0x5202fc);})}}),_0x5202fc;}['_createAcceptEditButtonView'](_0x249b48,_0x33d98a){const _0xb42dfe=new Ht(_0x249b48);return _0xb42dfe['set']({'icon':_0x4bf74a,'withText':!0x1,'tooltip':us(_0x249b48,'AI_CHAT_HISTORY_ACCEPT')}),_0xb42dfe['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0xb42dfe['on']('execute',()=>{this['_commitEditInputValue'](_0x33d98a);}),_0xb42dfe;}['_commitEditInputValue'](_0x39faa0){const _0x5a383b=_0x39faa0['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x5a383b});}['_createCancelEditButtonView'](_0x503b49){const _0x3d25b6=new Ht(_0x503b49);return _0x3d25b6['set']({'icon':_0x2c8364,'withText':!0x1,'tooltip':us(_0x503b49,'AI_CHAT_HISTORY_CANCEL')}),_0x3d25b6['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x3d25b6['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x3d25b6;}['_createSpinnerView'](){const _0x3e3200=new lr('tiny');return _0x3e3200['isVisible']=!0x0,_0x3e3200;}['isMatching'](_0x3b566a){return'string'==typeof this['title']&&this['title']['match'](_0x3b566a)?{'title':!0x0}:null;}['highlightText'](_0x41d688){this['_titleView']['highlightText'](_0x41d688);}},$o=class extends _0x5d2282{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x56bd68,_0x554058){super(_0x56bd68),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x41ab24=Uo(_0x56bd68,this);this['headerView']=new Mo(_0x56bd68,{'label':us(_0x56bd68,'AI_CHAT_HISTORY_HEADING'),'icon':_0x3b7460,'class':'ck-ai-header_history','content':_0x41ab24,'showResizeButton':_0x554058}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Fo(_0x56bd68,[]),this['sectionsView']['delegate'](...qo)['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',_0x5c776b=>!_0x5c776b)]}}),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 _0xc60b9f=new _0xd993a2(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x51ca17=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x51ca17),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x40812a=this['_createErrorView']();return _0x40812a['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x5657ef=>!_0x5657ef)]}}),_0xc60b9f['on']('render',()=>{_0xc60b9f['children']['add'](_0x40812a,0x1);}),_0xc60b9f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x5b1406=>!_0x5b1406)]}}),_0xc60b9f;}['_createSkeletonView'](){const _0x17b57c=new zn(this['locale'],jn['aiHistory']);return _0x17b57c['bind']('isVisible')['to'](this,'isLoading'),_0x17b57c;}['_createErrorView'](){const _0x350280=new _0x5d2282(this['locale']),_0x396865=new Ht(this['locale']);_0x396865['set']({'withText':!0x1,'icon':_0x2c8364,'class':'ck-ai-notification_error__dismiss-button'}),_0x396865['bind']('isVisible')['to'](this,'hasItems',_0x221cc8=>!!_0x221cc8),_0x396865['on']('execute',()=>{this['errorMessage']='';});const _0x1a3200=this['bindTemplate'];return _0x350280['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x1a3200['to']('errorMessage')}]},_0x396865]}),_0x350280;}['_createEmptyStateView'](){const _0x2757d0=new _0x5d2282(this['locale']);return _0x2757d0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x298872=>!_0x298872)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x2757d0;}['_createListItemViews'](_0x9a6603,_0x3f1004){const _0x5c226b=[];for(const _0x319d51 of _0x9a6603){const _0x2707a4=new Yo(_0x3f1004,_0x319d51);_0x2707a4['delegate'](...qo)['to'](this),_0x5c226b['push'](_0x2707a4);}return _0x5c226b;}['updateHistoryItemsWithCategories'](_0xcc1b02){const _0x208a44=this['locale']||'en',_0xb79cb0=[];for(const _0x3273bc of _0xcc1b02){const _0xcab17e=this['_createListItemViews'](_0x3273bc['items'],_0x208a44);_0xb79cb0['push'](new Ko(_0x208a44,{'title':_0x3273bc['title'],'items':_0xcab17e}));}this['sectionsView']['sections']=_0xb79cb0,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0xb79cb0),this['hasItems']=_0xcc1b02['some'](_0x3efb8e=>_0x3efb8e['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x1312c0){for(const _0x290653 of this['sectionsView']['sections']){const _0x4ca25d=_0x290653['getItem'](_0x1312c0);if(_0x4ca25d){if(_0x290653['removeItem'](_0x4ca25d),0x0===_0x290653['itemsViews']['length']){const _0x2d3628=this['sectionsView']['sections']['indexOf'](_0x290653);-0x1!==_0x2d3628&&(this['sectionsView']['sections']['splice'](_0x2d3628,0x1),this['sectionsView']['items']['remove'](_0x290653));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0xca89dc,_0x34c2dc){for(const _0x6d5d57 of this['sectionsView']['sections']){const _0x3b43e0=_0x6d5d57['getItem'](_0xca89dc);if(_0x3b43e0){_0x3b43e0['updateTitle'](_0x34c2dc);break;}}}['updateItemLoadingState'](_0x4f3fcd,_0x3fe14e,_0x2bc07e){for(const _0x2b29c7 of this['sectionsView']['sections']){const _0x16467c=_0x2b29c7['getItem'](_0x4f3fcd);if(_0x16467c){_0x16467c['updateLoadingState'](_0x3fe14e,_0x2bc07e);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x4b1858=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x4b1858);}}};const qo=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Qo=class extends _0x10611c{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x52b80e){super(_0x52b80e);const _0x21804d=this['context']['plugins']['get']('AITabs');this['_historyView']=new $o(this['context']['locale'],_0x21804d['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x21804d),this['_historyView']['delegate'](...qo)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x21804d['view'],'isMaximized',_0x311a4c=>_0x311a4c),_0x21804d['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x3b7460,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x307723){this['_historyView']['removeHistoryItem'](_0x307723);}['updateItems'](_0x7904ea){this['_historyView']['updateHistoryItemsWithCategories'](_0x7904ea);}['updateItemTitle'](_0x124c1c,_0x405e35){this['_historyView']['updateItemTitle'](_0x124c1c,_0x405e35);}['updateItemLoadingState'](_0x36d29d,_0x501b09,_0x168361){this['_historyView']['updateItemLoadingState'](_0x36d29d,_0x501b09,_0x168361);}['setLoadingSkeleton'](_0xfe2684){this['_historyView']['isLoading']=_0xfe2684;}['showError'](_0x5a166b){this['_historyView']['errorMessage']=_0x5a166b;}['hideError'](){this['_historyView']['errorMessage']='';}};const Xo=/* #__PURE__ -- @preserve */
35
- gt();var zo=class extends Xo{['id'];['createdAt'];constructor({id:_0x27841a,title:_0x279846,createdAt:_0x49d1be,updatedAt:_0x4e6ced,pinned:_0x519885}){super(),this['id']=_0x27841a,this['createdAt']=new Date(_0x49d1be),this['set']('title',_0x279846),this['set']('updatedAt',_0x4e6ced?new Date(_0x4e6ced):null),this['set']('pinned',_0x519885||!0x1);}['updateTitle'](_0x5e1946){this['set']('title',_0x5e1946),this['updatedAt']=new Date();}['updatePinned'](_0x210084){this['set']('pinned',_0x210084),this['updatedAt']=new Date();}};const jo=/* #__PURE__ -- @preserve */
36
- ut();var Jo=class extends jo{['items']=[];['connector'];['group'];constructor({connector:_0x3eecb7,group:_0x34365e}){super(),this['connector']=_0x3eecb7,this['group']=_0x34365e;}async['init'](){try{const _0xaa9ba8=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0xaa9ba8);}catch(_0x1bb1d0){this['fire']('error',{'error':_0x1bb1d0,'operation':'init'});}}['addItem'](_0x4e73c0){this['items']['push'](_0x4e73c0);}async['removeItem'](_0x5e837e){const _0x370bfb=this['items']['findIndex'](_0x475de4=>_0x475de4['id']===_0x5e837e);if(-0x1===_0x370bfb)return!0x1;try{return await this['connector']['deleteConversation'](_0x5e837e)['execute'](),this['items']['splice'](_0x370bfb,0x1),this['fire']('itemRemoved',{'itemId':_0x5e837e}),!0x0;}catch(_0x3da38b){return this['fire']('error',{'error':_0x3da38b,'operation':'removeItem','itemId':_0x5e837e}),!0x1;}}['getItem'](_0x271d8a){return this['items']['find'](_0x4c25f1=>_0x4c25f1['id']===_0x271d8a);}async['updateItemTitle'](_0x50c0d3,_0x238df3){const _0x1d5366=this['getItem'](_0x50c0d3);if(!_0x1d5366)return!0x1;try{return await this['connector']['updateConversation'](_0x50c0d3,{'title':_0x238df3})['getResult'](),_0x1d5366['updateTitle'](_0x238df3),this['fire']('itemUpdated',{'itemId':_0x50c0d3,'updates':{'title':_0x238df3}}),!0x0;}catch(_0x4440b5){return this['fire']('error',{'error':_0x4440b5,'operation':'updateItemTitle','itemId':_0x50c0d3}),!0x1;}}async['updateItemPinned'](_0x404c48,_0x46281d){const _0x48b165=this['getItem'](_0x404c48);if(!_0x48b165)return!0x1;try{return await this['connector']['updateConversation'](_0x404c48,{'pinned':_0x46281d})['getResult'](),_0x48b165['updatePinned'](_0x46281d),this['fire']('itemUpdated',{'itemId':_0x404c48,'updates':{'pinned':_0x46281d}}),!0x0;}catch(_0x45ac89){return this['fire']('error',{'error':_0x45ac89,'operation':'updateItemPinned','itemId':_0x404c48}),!0x1;}}['loadItems'](_0x54fc54){try{this['items']=[],_0x54fc54['map'](_0x2dc9ee=>{this['addItem'](new zo(_0x2dc9ee));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x22714b){this['fire']('error',{'error':_0x22714b,'operation':'loadItems'});}}['getItems'](_0xcdde35={}){const _0x530859=void 0x0!==_0xcdde35['pinned']&&_0xcdde35['pinned'],_0x127f2d=_0xcdde35['from']?new Date(_0xcdde35['from']['getFullYear'](),_0xcdde35['from']['getMonth'](),_0xcdde35['from']['getDate']()):null,_0x52441f=_0xcdde35['to']?new Date(_0xcdde35['to']['getFullYear'](),_0xcdde35['to']['getMonth'](),_0xcdde35['to']['getDate']()):null;return this['items']['filter'](_0x525040=>{if(_0x525040['pinned']!==_0x530859)return!0x1;if(_0x52441f){const _0x65450b=new Date(_0x525040['createdAt']['getFullYear'](),_0x525040['createdAt']['getMonth'](),_0x525040['createdAt']['getDate']());return _0x127f2d?_0x127f2d['getTime']()===_0x52441f['getTime']()?_0x65450b['getTime']()===_0x127f2d['getTime']():_0x65450b<_0x52441f&&_0x65450b>=_0x127f2d:_0x65450b<_0x52441f;}return!0x0;});}},Zo=class extends _0x10611c{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,on,Nn,Qo,cs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](ls),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Qo),this['_aiChatController']=this['context']['plugins']['get'](Nn),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aichathistory');const _0x11069a=this['context']['plugins']['get'](cs);try{const _0x10b0dd=this['_aiChatController']['getGroupId']();this['history']=new Jo({'connector':this['_aiConnector'],'group':_0x10b0dd}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x2cfa5f,_0x1376a9)=>{this['_setItemLoading'](_0x1376a9['id'],'remove'),this['_handleRemove'](_0x1376a9['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x176a11,_0x32cf5a)=>{this['_setItemLoading'](_0x32cf5a['id'],'rename'),this['_handleEditTitle'](_0x32cf5a['id'],_0x32cf5a['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x2e0223,_0x42979b)=>{void 0x0!==_0x42979b['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x42979b['itemId'],_0x42979b['updates']['title']),void 0x0!==_0x42979b['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x42979b['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0xe33b9d,_0x23b388)=>{this['_aiChatController']['_handleRemovedConversation'](_0x23b388['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x23b388['itemId']),this['_clearItemLoading'](_0x23b388['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x16f821,_0x40c697)=>{this['_handleHistoryErrorUI'](_0x40c697['error'],_0x40c697['operation'],_0x40c697['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x1dcbde,_0x1b1353)=>{this['_handleSelectConversation'](_0x1b1353['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x3144d7,_0x2f74cc)=>{const _0x87257b=_0x2f74cc['pinned']?'pin':'unpin';this['_setItemLoading'](_0x2f74cc['id'],_0x87257b),this['_handleTogglePin'](_0x2f74cc['id'],_0x2f74cc['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x11069a['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x11069a['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x17c251){this['_handleHistoryErrorUI'](_0x17c251,'init');}}async['_handleEditTitle'](_0x5a62b7,_0x292a7b){await this['history']['updateItemTitle'](_0x5a62b7,_0x292a7b);}async['_handleTogglePin'](_0x2e3aba,_0x162b2d){await this['history']['updateItemPinned'](_0x2e3aba,_0x162b2d);}async['_handleRemove'](_0xa64f39){await this['history']['removeItem'](_0xa64f39);}async['_handleSelectConversation'](_0x4d7ab4){await this['_aiChatController']['loadConversation'](_0x4d7ab4);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0xdbe9bf=this['_aiChatController']['activeConversation']?.['id'],_0x4d70a7=this['_getCategorizedItems']()['map'](_0x5661ab=>({'title':_0x5661ab['title'],'items':_0x5661ab['items']['map'](_0x5d4914=>({'id':_0x5d4914['id'],'title':_0x5d4914['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x5d4914['createdAt'])['toLocaleDateString'](),'active':_0x5d4914['id']===_0xdbe9bf,'pinned':_0x5d4914['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x4d70a7);}['_setItemLoading'](_0x1c8f00,_0x32146a){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1c8f00,_0x32146a,!0x0);}['_clearItemLoading'](_0x5e05e5){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x5e05e5,null,!0x1);}['_handleHistoryErrorUI'](_0x499020,_0x5ab428,_0x138c52){const _0x523497=this['_generateErrorMessage'](_0x5ab428,_0x138c52);this['_aiChatHistoryUi']['showError'](_0x523497),this['_reporter']['reportError'](_0x499020,{'context':{'operation':_0x5ab428}}),_0x138c52&&this['_clearItemLoading'](_0x138c52),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x40f484,_0xbf1c88){const _0xa1622b=_0xbf1c88?this['history']['getItem'](_0xbf1c88):null,_0x188c14=_0xa1622b?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x40f484){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x188c14);case'updateItemPinned':{const _0x376082=us(this['context']['locale'],_0xa1622b?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x376082,_0x188c14]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x188c14);case'init':case'loadItems':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x49f8d7=new Date(),_0x5991a0=new Date(_0x49f8d7['getFullYear'](),_0x49f8d7['getMonth'](),_0x49f8d7['getDate']()),_0x1b727d=new Date(_0x5991a0);_0x1b727d['setDate'](_0x1b727d['getDate']()-0x1);const _0x42d219=new Date(_0x5991a0);_0x42d219['setDate'](_0x42d219['getDate']()-0xe);const _0x3b09dc=this['history']['getItems']({'pinned':!0x0}),_0x4cc002=this['history']['getItems']({'from':_0x5991a0,'to':_0x5991a0}),_0x3887a1=this['history']['getItems']({'from':_0x1b727d,'to':_0x1b727d}),_0x826f68=this['history']['getItems']({'from':_0x42d219,'to':_0x1b727d}),_0x88ed0b=this['history']['getItems']({'to':_0x42d219}),_0x214190=[];return _0x3b09dc['length']>0x0&&_0x214190['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x3b09dc}),_0x4cc002['length']>0x0&&_0x214190['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x4cc002}),_0x3887a1['length']>0x0&&_0x214190['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x3887a1}),_0x826f68['length']>0x0&&_0x214190['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x826f68}),_0x88ed0b['length']>0x0&&_0x214190['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x88ed0b}),_0x214190;}},ta=class extends _0x10611c{static get['requires'](){return[Zo,Qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ea=class extends _0x10611c{static get['requires'](){return[Nn,Is,Go,ta,sn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x10d2c1){super(_0x10d2c1),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ia=class extends Ht{['id'];constructor(_0x26cfd3,_0x4e57d7){super(_0x26cfd3);const {id:_0x34e05b,type:_0x3967b9,icon:_0x32a2e8}=_0x4e57d7;this['id']=_0x34e05b,this['set']({'label':_0x4e57d7['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x4e57d7['id']}}),_0x32a2e8?this['icon']=_0x32a2e8:'chat'===_0x3967b9?this['icon']=_0x36cf34:'review'===_0x3967b9?this['icon']=_0x247464:'translate'===_0x3967b9&&(this['icon']=_0xc54aae);}},sa=class extends _0x5d2282{['listView'];constructor(_0x3caca1,_0x486e32){super(_0x3caca1),this['set']('isEnabled',!0x0);const _0x418d5b=_0x486e32['map'](_0x223f88=>{const _0xfc848e=new zt(this['locale']),_0x342411=new ia(this['locale'],_0x223f88);return _0x342411['bind']('isEnabled')['to'](this),_0xfc848e['children']['add'](_0x342411),_0x342411['delegate']('execute')['to'](this),_0xfc848e;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x418d5b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const na='chat-shortcuts';var ra=class extends _0x10611c{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Go];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Go),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x354dff=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x4a5f67=_0x354dff['activeConversation'];_0x4a5f67['isFromHistory']||this['_injectShortcuts'](_0x4a5f67);}),this['listenTo'](_0x354dff,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x1f41e5=['chat','review','translate'];this['_shortcuts']['forEach'](_0x24181a=>{let _0x22137d=!0x0;if(_0x24181a['id']&&_0x24181a['label']&&_0x1f41e5['includes'](_0x24181a['type'])?'chat'===_0x24181a['type']&&(_0x22137d='string'==typeof _0x24181a['prompt']):_0x22137d=!0x1,!_0x22137d)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x24181a});});}['_injectShortcuts'](_0x1a79cd){this['_removeShortcuts'](),this['_shortcutsView']=new sa(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],na),this['_shortcutsView']['on']('execute',_0x4c2d61=>{const _0x41d633=_0x4c2d61['source']['id'];this['_executeShortcut'](_0x41d633);}),this['_listenedConversation']=_0x1a79cd,this['listenTo'](_0x1a79cd,'uploadProgressChanged',(_0x5727b5,_0x17e6fc)=>{this['_shortcutsView']['isEnabled']=!_0x17e6fc['isUploadInProgress'];});}['_removeShortcuts'](){const _0xaff423=this['context']['plugins']['get'](Go);_0xaff423['hasFeedItem'](na)&&_0xaff423['removeFeedItem'](na),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x60d244){const _0x156416=this['_shortcuts']['find'](_0x4b3ebb=>_0x4b3ebb['id']===_0x60d244),_0x55b129=_0x156416['type'];'chat'===_0x55b129?this['_runChatShortcut'](_0x156416):'review'===_0x55b129?_0x156416['commandId']?this['_runReviewShortcut'](_0x156416):this['_switchTab']('reviewMode'):'translate'===_0x55b129&&(_0x156416['language']?this['_runTranslateShortcut'](_0x156416):this['_switchTab']('translate'));}['_switchTab'](_0x2a3aac){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x2a3aac});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x2a3aac);}async['_runChatShortcut']({prompt:_0xddc89,draftMode:_0xeeaa26,useWebSearch:_0x637f67=!0x1,useReasoning:_0x2b1479=!0x1,model:_0x2600e0}){const _0x3d15bd=this['context']['plugins']['get']('AIChatController'),_0x127af3=_0x3d15bd['activeConversation'];let _0x58870e;_0x58870e=_0x2600e0?await _0x127af3['chatModels']['getModel'](_0x2600e0):await _0x127af3['chatModels']['getDefault'](),_0x58870e&&await _0x127af3['setModel'](_0x58870e),_0x127af3['setWebSearch'](_0x637f67),_0x127af3['setReasoning'](_0x2b1479),_0x3d15bd['addCurrentDocumentToChatContext'](),_0xeeaa26?(this['_aiChatUI']['setPromptInputValue'](_0xddc89),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x3d15bd['sendMessage']({'message':_0xddc89});}['_runReviewShortcut']({commandId:_0x50b556,model:_0x4e877c,prompt:_0x641ba2,params:_0x3886c7}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x15b300={'id':_0x50b556,'isCustom':'custom'===_0x50b556};_0x4e877c&&_0x641ba2&&(_0x15b300['args']={'model':_0x4e877c,'prompt':_0x641ba2}),_0x3886c7&&(_0x15b300['params']=_0x3886c7),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x15b300);}['_runTranslateShortcut']({language:_0x434b9f}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x434b9f,'args':{'language':_0x434b9f}});}},oa=class extends _0x3738d1{constructor(_0x310f82){super(_0x310f82);const _0x11f57f=_0x310f82['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x11f57f,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x3ce89c=this['editor']['plugins']['get']('AITabs')['view'];_0x3ce89c['isVisible']=!_0x3ce89c['isVisible'];}},aa=class extends _0x2965bd{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1e0725=this['editor'];_0x1e0725['commands']['add']('toggleAi',new oa(_0x1e0725)),_0x1e0725['ui']['componentFactory']['add']('toggleAi',()=>{const _0x58c417=this['_createAIUIButton'](Ht);return _0x58c417['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x58c417;}),_0x1e0725['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x268927=this['_createAIUIButton'](Jt);return _0x268927['set']({'role':'menuitemcheckbox'}),_0x268927;});}['_createAIUIButton'](_0x5792d3){const _0x5c8ad6=this['editor'],_0x2985cd=_0x5c8ad6['commands']['get']('toggleAi'),_0x3986b1=new _0x5792d3(_0x5c8ad6['locale']);return _0x3986b1['set']({'label':us(_0x5c8ad6['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x2ac5dd,'isToggleable':!0x0}),_0x3986b1['bind']('isEnabled')['to'](_0x2985cd),_0x3986b1['bind']('isOn')['to'](_0x2985cd,'value',_0xc14529=>!!_0xc14529),this['listenTo'](_0x3986b1,'execute',()=>{_0x2985cd['execute']();}),_0x3986b1;}};const ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ca=class extends _0x5d2282{['_errorView'];constructor(_0x2a54fa){super(_0x2a54fa),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x3323e6){this['showError'](_0x3323e6);}['showError'](_0xa7bf6){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xa7bf6,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x3a76ce=new _0x5d2282(this['locale']),_0x30caef=new _0x5d2282(this['locale']);return _0x30caef['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x3a76ce['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2dcb4c=>!_0x2dcb4c)]},'children':[_0x30caef]}),_0x3a76ce;}};const la=0xa;var ua=class extends _0x10611c{static get['requires'](){return[Is];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x9726a2){const {id:_0x430e37}=this['_currentConfig']??{};this['_currentConfig']=_0x9726a2,this['_editor']=_0x9726a2['targetEditor'];const {id:_0x16f80d}=this['_currentConfig'];this['isOpen']&&_0x430e37===_0x16f80d?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x1480ac=this['_editor'];if(!_0x1480ac)return;const _0x1eb4fc=_0x1480ac['plugins']['get']('Dialog');_0x1eb4fc['isOpen']&&this['_currentConfig']&&_0x1eb4fc['id']===this['_currentConfig']['id']&&_0x1eb4fc['hide']();}['_updateDialog'](){const _0x1eb1b6=this['_editor']['plugins']['get']('Dialog'),{icon:_0x6c8e72,title:_0x3bbec8}=this['_currentConfig'];_0x1eb1b6['view']?.['headerView']&&(_0x1eb1b6['view']['headerView']['label']=_0x3bbec8,_0x1eb1b6['view']['headerView']['iconView']&&_0x6c8e72&&(_0x1eb1b6['view']['headerView']['iconView']['content']=_0x6c8e72)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x1eb1b6['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Is)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Is)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x46c1a1=this['_editor']['plugins']['get']('Dialog'),{id:_0x56cf7b,title:_0x7ff2c6,icon:_0x1da53b,class:_0x5898df,mainView:_0x18b915}=this['_currentConfig'];_0x18b915['delegate'](...ha)['to'](this),_0x46c1a1['show']({'title':_0x7ff2c6,'icon':_0x1da53b,'hasCloseButton':!0x0,'id':_0x56cf7b,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x5898df||''),'content':_0x18b915,'onShow':_0x3788bd=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x3788bd['view']?.['updatePosition']();const _0x2fa569=this['_getSelectionElements']();_0x2fa569&&_0x2fa569[0x0]&&Rt({'target':_0x2fa569[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x3788bd['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x56cf7b});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x56cf7b}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x5c228f,_0x3ea6d3,_0x5c4b8a){const _0x8d1b86=_0x3ea6d3||_0x5c4b8a;if(!_0x8d1b86)return null;const _0x4089b4=this['_getSelectionElements']();if(!_0x4089b4||0x0===_0x4089b4['length'])return{'left':Math['round'](_0x8d1b86['left']+_0x8d1b86['width']/0x2-_0x5c228f['width']/0x2),'top':Math['round'](_0x8d1b86['top']+_0x8d1b86['height']/0x2-_0x5c228f['height']/0x2)};const _0x3066d9=Math['round'](_0x8d1b86['left']+_0x8d1b86['width']/0x2-_0x5c228f['width']/0x2),_0x226c5c=_0x4089b4['map'](_0x19942b=>new At(_0x19942b)),_0x1cae0a=_0x5c228f['height'];return{'left':_0x3066d9,'top':this['_calculateOptimalTopPosition'](_0x226c5c,_0x1cae0a,_0x8d1b86)};}['_calculateOptimalTopPosition'](_0x4ae2c2,_0x308276,_0x2f2b60){const _0x3504f4=new At(Tt['window']),_0x1d1167=_0x4ae2c2['map'](_0x3d9752=>_0x3d9752['getVisible']())['filter'](_0x72ff25=>_0x72ff25),_0x4f3f5d=At['getBoundingRect'](_0x1d1167);if(!_0x4f3f5d)return Math['round'](_0x2f2b60['top']+_0x2f2b60['height']/0x2);const _0xcd70dc=_0x3504f4['getIntersection'](_0x4f3f5d);if(!_0xcd70dc)return Math['round'](_0x2f2b60['top']+_0x2f2b60['height']/0x2);const _0x10cbe9=_0x2f2b60['getVisible'](),_0x42f0a9=_0x10cbe9&&_0x4f3f5d['height']>_0x10cbe9['height'],_0x56741e=_0xcd70dc['top'],_0x2b7e0d=_0xcd70dc['bottom'];if(_0x42f0a9){const _0x352453=_0x3504f4['top']+_0x3504f4['height']/0x2-_0x308276/0x2,_0x307a05=_0x56741e-la-_0x3504f4['top'],_0x418312=_0x3504f4['bottom']-_0x2b7e0d-la;return _0x307a05>=_0x308276?Math['max'](la,_0x56741e-_0x308276-la):_0x418312>=_0x308276?_0x2b7e0d+la:Math['max'](la,_0x352453);}const _0x57b6df=_0x56741e-_0x308276,_0x59e186=_0x3504f4['bottom']-_0x2b7e0d-la,_0x785cb6=_0x56741e-la-_0x3504f4['top'];let _0x52e8ca;return _0x52e8ca=_0x59e186>=_0x308276?_0x2b7e0d+la:_0x785cb6>=_0x308276?_0x57b6df-la:_0x56741e+_0x4f3f5d['height']/0x2-_0x308276/0x2,_0x52e8ca;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x12ccad=this['_editor'];this['listenTo'](_0x12ccad['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x240b0c,data:{newRange:_0x3837ba}}of _0x12ccad['model']['document']['differ']['getChangedMarkers']())if(_0x240b0c['startsWith']('ai-selection:')&&(_0x3837ba&&(_0x3837ba['start']['isEqual'](_0x3837ba['end'])||'$graveyard'==_0x3837ba['root']['rootName'])||null==_0x3837ba)){const _0x5e9599=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x5e9599),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x3b9564=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x3b9564['model']['document']);}['_getSelectionElements'](){const _0x50f2db=this['_editor'];return _0x5ca127(_0x50f2db['editing'],[..._0x50f2db['model']['markers']['getMarkersGroup']('ai-selection'),..._0x50f2db['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x157eed=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x157eed&&_0x157eed['rootName']?_0x157eed['rootName']:null;}},da=class extends _0x11c4f1{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x4e09f2,_0x48e412={}){super(_0x4e09f2),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x48e412};const _0x2068b8=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x2068b8?'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'](_0x4a0f5f){this['showChangesButton']['isEnabled']=_0x4a0f5f;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':ln,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Ht(this['locale']),this['dislikeButton']['set']({'icon':rt,'label':us(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':ln,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Ht(this['locale']),this['copyButton']['set']({'icon':_0x2d4376,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+ln,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x255b7b=new Yt();_0x255b7b['set']({'content':_0x4bf74a}),_0x255b7b['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'+ln,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+ln;},0x7d0);}),this['copyButton']['children']['add'](_0x255b7b);}['_setupShowChangesButton'](){this['showChangesButton']=new Ht(this['locale']),this['showChangesButton']['set']({'icon':tt,'label':us(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':ln}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x2b194c=>_0x2b194c?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},_a=class extends ca{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x25f609,_0x43258a){super(_0x25f609);const _0x32837c=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x43258a,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new Qn(_0x25f609),this['_partToolbarView']=new Yn(_0x25f609,_0x43258a['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x43258a),this['_stateView']=new Kn(_0x25f609),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new da(_0x25f609,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new ga(_0x25f609,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x4e8387,_0x34cbf0,_0x251957,_0x244561)=>{let _0x30a1f4,_0x31f5a5;'pending'===_0x244561?(_0x30a1f4=this['_partToolbarView'],_0x31f5a5=this['_stateView']):(_0x30a1f4=this['_stateView'],_0x31f5a5=this['_partToolbarView']),this['_stateView']['setState'](_0x251957),_0x30a1f4['isVisible']=!0x1,_0x31f5a5['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x32837c['to']('_state',_0x20dfb0=>'ck-ai-chat-balloon-main_state_'+_0x20dfb0)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x43258a);});}['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'](_0x3aa712){_0x3aa712?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x3aa712);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x1ba303){this['_state']=_0x1ba303;}['showError'](_0xa3f5d9){super['showError'](_0xa3f5d9),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x5dfaae){super['showBlockingError'](_0x5dfaae),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x3cf4a9){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x3cf4a9;}['togglePartToolbarEnabled'](_0x2ee8d4){this['_partToolbarView']['isEnabled']=_0x2ee8d4;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x504c35,showSuggestButton:_0x305452}){_0x504c35=_0x504c35&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x305452=_0x305452&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x504c35,'showSuggestButton':_0x305452});}['_createNextButtonView'](){const _0x29e339=new Ht(this['locale']);return _0x29e339['set']({'icon':_0x55011b,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x29e339['on']('execute',()=>{this['fire']('showNext');}),_0x29e339;}['_createPreviousButtonView'](){const _0x11d87d=new Ht(this['locale']);return _0x11d87d['set']({'icon':_0x1b6be5,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x11d87d['on']('execute',()=>{this['fire']('showPrevious');}),_0x11d87d;}},ga=class extends _0x5d2282{constructor(_0x5ba876,_0x16dae3){super(_0x5ba876),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x16dae3});}},Aa=class extends _0x2965bd{static get['requires'](){return[Mt,ua];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x299be6){super(_0x299be6),this['set']('showDiff',!0x1);}['open'](_0x392806){const _0x19c499=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x19c499['plugins']['get']('AIBalloon')['open']({..._0x392806,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x392806['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x392806['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x51ab7e){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x51ab7e);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x1270dc){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x1270dc);}['_createChatBalloonView'](){const _0x4ae2de=this['editor'],_0x479ac2=_0x4ae2de['plugins']['get']('AIBalloon'),_0x519463=_0x4ae2de['commands']['get']('trackChanges');let _0x219e9a=_0x4ae2de['config']['get']('ai.availableReplyActions')||[...ir];_0x4ae2de['plugins']['has']('TrackChanges')||(_0x219e9a=_0x219e9a['filter'](_0x3d9557=>'insertSuggestion'!=_0x3d9557));const _0x47bed1=new _a(_0x4ae2de['locale'],{'availableActions':_0x219e9a,'showApplyButton':!0x0,'showSuggestButton':!!_0x519463});return _0x47bed1['bind']('showDiff')['to'](this),_0x47bed1['delegate'](...yn)['to'](this),_0x47bed1['delegate']('showPrevious','showNext')['to'](this),_0x479ac2['delegate']('dialogClosed')['to'](this),_0x47bed1['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x47bed1['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x47bed1['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x519463&&_0x47bed1['bind']('isTrackChangesOn')['to'](_0x519463,'value'),_0x47bed1['render'](),_0x47bed1;}['_toggleRotatorButtonsInDialogHeader'](_0x109ddc){const _0x40c0f2=this['editor'],_0x3d215b=_0x40c0f2['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x109ddc),_0x3d215b['has'](this['_chatBalloonView']['previousButtonView'])||(_0x3d215b['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x40c0f2['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x3d215b['remove'](this['_chatBalloonView']['previousButtonView']),_0x3d215b['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Ia=class extends _0x2965bd{static get['requires'](){return[aa,Aa,_0x4e90fb];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function pa(_0x1db5d2){const {editor:_0x31914c,action:_0x1c1f58,withText:_0x449804=!0x1,withIcon:_0x2a8e07=!0x0,isInDropdown:_0x2c03ae=!0x0,shouldPreventFocus:_0x1b1ddb=!0x1,actionButtons:_0x2723d3}=_0x1db5d2;return()=>{const _0x172c5d=_0x31914c['locale'],_0x717a59=new Ht(_0x172c5d),_0x24ccf3=_0x717a59['bindTemplate'];_0x2c03ae&&_0x717a59['extendTemplate']({'on':{'mouseenter':_0x24ccf3['to'](()=>{_0x1b1ddb&&_0x1b1ddb()||_0x717a59['focus']();})}}),_0x2723d3['push']({'buttonView':_0x717a59,'action':_0x1c1f58});const _0x5072d9=_0x1c1f58['icon']??_0x1c1f58['parent']?.['icon'];return _0x717a59['set']({'label':_0x1c1f58['label'],'withText':_0x449804,'role':'menuitem','icon':_0x2a8e07?_0x5072d9??_0x4e19bd:void 0x0,'tooltip':!_0x449804,'class':'ck-ai-quick-actions-button','isEnabled':_0x1c1f58['isEnabled']}),_0x717a59['on']('execute',()=>{_0x31914c['editing']['view']['focus'](),_0x31914c['commands']['execute']('aiQuickAction',_0x1c1f58);}),_0x717a59;};}var ma=class extends Qt{['arrowView'];constructor(_0x4719f,_0x1498d2){super(_0x4719f,_0x1498d2);const _0x3cdfb7=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',_0x3bab7e=>String(_0x3bab7e)),'data-cke-tooltip-disabled':_0x3cdfb7['to']('isOn')},'on':{'mouseenter':_0x3cdfb7['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x35ec03=new Yt();return _0x35ec03['content']=_0x53adfc,_0x35ec03['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x35ec03;}},Ea=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x35028d,_0x20d480,_0x357bc7){super(_0x35028d),this['_allListItems']=_0x20d480,this['_allSearchableItems']=_0x357bc7;}['filter'](_0x333b62){if(!_0x333b62)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x255f69=_0x333b62['source']['toLowerCase']()['trim'](),_0x2d1c88=this['_allSearchableItems']['filter'](_0x56cd85=>(_0x56cd85['groupLabel']?_0x56cd85['label']+'\x20('+_0x56cd85['groupLabel']+')':_0x56cd85['label'])['toLowerCase']()['includes'](_0x255f69));return this['items']['clear'](),this['items']['addMany'](_0x2d1c88['sort']((_0x4af84d,_0x1e3bca)=>{const _0x40b1da=_0x4af84d['groupLabel'],_0x4a2d27=_0x1e3bca['groupLabel'];return _0x40b1da||_0x4a2d27?_0x40b1da?0x1:-0x1:0x0;})['map'](_0x1cb8f8=>_0x1cb8f8['item'])),this['_highlightQuery'](_0x255f69,_0x2d1c88),{'resultsCount':_0x2d1c88['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x43f72f,_0x5ad22e){if(!_0x43f72f)return;const _0x2b41a2=new RegExp(_0x1e70d6(_0x43f72f),'gi');_0x5ad22e['forEach'](_0xe41bc7=>{_0xe41bc7['highlightViews']&&_0xe41bc7['highlightViews']['forEach'](_0x5d9de2=>{'function'==typeof _0x5d9de2['highlightText']&&_0x5d9de2['highlightText'](_0x2b41a2);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x4d3a1c=>{_0x4d3a1c['highlightViews']&&_0x4d3a1c['highlightViews']['forEach'](_0x1640df=>{'function'==typeof _0x1640df['highlightText']&&_0x1640df['highlightText'](null);});});}};const Ta='menu',wa='menuitem';var Ca=class extends _0x5d2282{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x457866,_0x182ed9,_0x484a85,_0x5527b5,_0x353af7=!0x1,_0x198b37=[]){const _0x46ae2f=_0x457866['locale'];super(_0x46ae2f),this['_bodyCollection']=_0x5527b5,this['_hasSearch']=_0x353af7,this['_actionButtons']=_0x198b37;const _0xcab3c1=this['_createListItems'](_0x457866,_0x182ed9,_0x484a85);this['optionsListView']=new Ea(_0x46ae2f,_0xcab3c1,this['_allSearchableItems']),this['optionsListView']['role']=Ta,this['optionsListView']['items']['addMany'](_0xcab3c1),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x353af7&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0xcab3c1,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x353af7&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x19bbe=_0x353af7&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x3c6d3b(_0x19bbe),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x46ae2f['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0xd993a2(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0xd046b9=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0xd046b9);}['_createListItems'](_0x201f5a,_0x19cbb6,_0x5caf84){const _0x504e40=new _0x3c6d3b();return _0x19cbb6['forEach'](_0x369c32=>{if('actions'in _0x369c32){const {listItem:_0x157cbb}=this['_createActionGroupButton'](_0x201f5a,_0x369c32,_0x5caf84);_0x504e40['add'](_0x157cbb),_0x369c32['actions']['forEach'](_0x3b0ad4=>{const {listItem:_0xc5e280,highlightViews:_0x3e5e94}=this['_createSearchResultActionButton'](_0x201f5a,_0x3b0ad4,_0x369c32['label'],_0x369c32['icon']);this['_allSearchableItems']['push']({'item':_0xc5e280,'label':_0x3b0ad4['label'],'groupLabel':_0x369c32['label'],'highlightViews':_0x3e5e94});});}else{const {listItem:_0x227e59}=this['_createActionButton'](_0x201f5a,_0x369c32);_0x504e40['add'](_0x227e59);const _0x5bb9b2=_0x227e59['children']['first'];if(_0x5bb9b2){const {listItem:_0x559c46,highlightViews:_0x85f3b2}=this['_createSearchResultActionButton'](_0x201f5a,_0x369c32);this['_allSearchableItems']['push']({'item':_0x559c46,'label':_0x5bb9b2['label']||'','highlightViews':_0x85f3b2});}}}),_0x504e40;}['_createActionButton'](_0x5167cc,_0x4820d6,_0x56fe55,_0x5a21e3){const _0xac60c7=new zt(this['locale']);if(_0x56fe55&&_0x5a21e3){const _0x3c25f2=new Ht(this['locale']),_0x9f7d7f=_0x3c25f2['bindTemplate'],_0x404d43=new Wt();_0x404d43['text']=_0x4820d6['label'];const _0x12a884=new Wt();_0x12a884['text']=_0x56fe55;const _0x262173=new Yt();_0x262173['content']=_0x5a21e3,_0x262173['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x371a44=new _0x5d2282(this['locale']);_0x371a44['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0xce3885=new _0x5d2282(this['locale']);return _0xce3885['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3c25f2['set']({'label':_0x4820d6['label']+'\x20('+_0x56fe55+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x4820d6['isEnabled']}),_0x3c25f2['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x9f7d7f['if']('isEnabled','ck-disabled',_0x3a597a=>!_0x3a597a)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x404d43,_0x371a44,_0x262173,_0x12a884,_0xce3885],'on':{'mouseenter':_0x9f7d7f['to'](()=>{this['_isSearchFocused']()||_0x3c25f2['focus']();}),'click':_0x9f7d7f['to'](()=>{_0x3c25f2['fire']('execute');})}}),_0x3c25f2['on']('execute',()=>{_0x3c25f2['isEnabled']&&(_0x5167cc['editing']['view']['focus'](),_0x5167cc['commands']['execute']('aiQuickAction',_0x4820d6));}),_0xac60c7['children']['add'](_0x3c25f2),this['_actionButtons']['push']({'buttonView':_0x3c25f2,'action':_0x4820d6}),{'listItem':_0xac60c7,'highlightViews':[_0x404d43,_0x12a884]};}{const _0x13dff2=new Pt(),_0x1815dc=new Ht(this['locale'],_0x13dff2),_0x447884=_0x1815dc['bindTemplate'],_0x5c0448=_0x4820d6['icon']??_0x4820d6['parent']?.['icon'],_0x9a48f6=void 0x0!==_0x4820d6['icon'];return _0x1815dc['set']({'label':_0x4820d6['label'],'withText':!0x0,'role':'menuitem','icon':_0x9a48f6?_0x5c0448??_0x4e19bd:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x4820d6['isEnabled']}),_0x1815dc['extendTemplate']({'on':{'mouseenter':_0x447884['to'](()=>{this['_isSearchFocused']()||_0x1815dc['focus']();})}}),_0x1815dc['on']('execute',()=>{_0x5167cc['editing']['view']['focus'](),_0x5167cc['commands']['execute']('aiQuickAction',_0x4820d6);}),_0xac60c7['children']['add'](_0x1815dc),this['_actionButtons']['push']({'buttonView':_0x1815dc,'action':_0x4820d6}),{'listItem':_0xac60c7,'highlightViews':[_0x13dff2]};}}['_createSearchResultActionButton'](_0x2a8f02,_0x54e99e,_0x12e3ac,_0x5bed35){return _0x12e3ac&&_0x5bed35?this['_createSearchResultGroupedActionButton'](_0x2a8f02,_0x54e99e,_0x12e3ac,_0x5bed35):this['_createSearchResultIndividualActionButton'](_0x2a8f02,_0x54e99e);}['_createSearchResultGroupedActionButton'](_0x56bb80,_0x3f3b49,_0x1898a6,_0x3cc3c0){const _0x252433=new zt(this['locale']),_0x736711=new Ht(this['locale']),_0x3a446c=_0x736711['bindTemplate'],{view:_0x530161,highlightView:_0x51d5e3}=this['_createSearchResultGroupRow'](_0x1898a6,_0x3cc3c0),{view:_0x4fdb08,highlightView:_0xb71333}=this['_createSearchResultActionRow'](_0x3f3b49['label']),_0x523111=this['_createSearchResultContentView'](_0x530161,_0x4fdb08);return _0x736711['set']({'label':_0x3f3b49['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':_0x3f3b49['isEnabled']}),_0x736711['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',_0x3a446c['if']('isEnabled','ck-disabled',_0x3ddffa=>!_0x3ddffa)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x523111],'on':{'mouseenter':_0x3a446c['to'](()=>{this['_isSearchFocused']()||_0x736711['focus']();}),'click':_0x3a446c['to'](()=>{this['_handleSearchResultButtonClick'](_0x736711);})}}),this['_setupActionButtonExecution'](_0x736711,_0x56bb80,_0x3f3b49),_0x252433['children']['add'](_0x736711),this['_actionButtons']['push']({'buttonView':_0x736711,'action':_0x3f3b49}),{'listItem':_0x252433,'highlightViews':[_0x51d5e3,_0xb71333]};}['_createSearchResultIndividualActionButton'](_0x232510,_0xc0ec42){const _0x30e16a=new zt(this['locale']),_0x1b4761=new Pt(),_0x457f86=new Ht(this['locale'],_0x1b4761),_0x3fbde7=_0x457f86['bindTemplate'];return _0x457f86['set']({'label':_0xc0ec42['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0xc0ec42['isEnabled']}),_0x457f86['extendTemplate']({'on':{'mouseenter':_0x3fbde7['to'](()=>{this['_isSearchFocused']()||_0x457f86['focus']();})}}),this['_setupActionButtonExecution'](_0x457f86,_0x232510,_0xc0ec42),_0x30e16a['children']['add'](_0x457f86),this['_actionButtons']['push']({'buttonView':_0x457f86,'action':_0xc0ec42}),{'listItem':_0x30e16a,'highlightViews':[_0x1b4761]};}['_createSearchResultGroupRow'](_0x3c34ff,_0x130a14){const _0x3d0bd2=new _0x5d2282(this['locale']),_0x352cc3=new Yt();_0x352cc3['content']=_0x130a14,_0x352cc3['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3b318b=new Wt();return _0x3b318b['text']=_0x3c34ff,_0x3d0bd2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x352cc3,_0x3b318b]}),{'view':_0x3d0bd2,'highlightView':_0x3b318b};}['_createSearchResultActionRow'](_0x4b6b4a){const _0x45f844=new _0x5d2282(this['locale']),_0xfe82f1=new Wt();return _0xfe82f1['text']=_0x4b6b4a,_0x45f844['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0xfe82f1]}),{'view':_0x45f844,'highlightView':_0xfe82f1};}['_createSearchResultContentView'](_0xee9706,_0x3eae7f){const _0x3f6756=new _0x5d2282(this['locale']);return _0x3f6756['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0xee9706,_0x3eae7f]}),_0x3f6756;}['_setupActionButtonExecution'](_0x4a9ec4,_0x558821,_0x97d286){_0x4a9ec4['on']('execute',()=>{_0x4a9ec4['isEnabled']&&(_0x558821['editing']['view']['focus'](),_0x558821['commands']['execute']('aiQuickAction',_0x97d286));});}['_createActionGroupButton'](_0x659406,_0x5d1741,_0x190744){const _0x42cfec=new zt(this['locale']),_0x1b6e23=new Pt(),_0x3cf21f=new ma(this['locale'],_0x1b6e23),_0x2795ef=_0x3cf21f['bindTemplate'],_0x55c35b=this['_getPanelKeystroke'](_0x190744),_0x1eacd5=this['_createGroupActionsList'](_0x659406,_0x5d1741['actions'],_0x190744);_0x3cf21f['set']({'label':_0x5d1741['label'],'withText':!0x0,'role':wa,'icon':_0x5d1741['icon']??_0x4e19bd,'isEnabled':_0x5d1741['actions']['some'](_0xd44c52=>_0xd44c52['isEnabled'])}),_0x3cf21f['extendTemplate']({'on':{'mouseenter':_0x2795ef['to'](()=>{this['_isSearchFocused']()||_0x3cf21f['focus']();})}});const _0x3628a6=new yt(this['locale']);return _0x3628a6['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x2795ef['to'](_0x1c8bdc=>{this['_handlePanelKeydown'](_0x1c8bdc,_0x55c35b,_0x3cf21f,_0x3628a6);})}}),_0x3cf21f['bind']('isOn')['to'](_0x3628a6,'isVisible'),this['_bodyCollection']['add'](_0x3628a6),_0x3628a6['content']['add'](_0x1eacd5),this['_setupGroupMenuBehavior'](_0x3cf21f,_0x3628a6),_0x42cfec['children']['add'](_0x3cf21f),this['_actionButtons']['push']({'buttonView':_0x3cf21f,'action':_0x5d1741}),{'listItem':_0x42cfec,'highlightView':_0x1b6e23};}['_createGroupActionsList'](_0x169818,_0x184589,_0x114ad2){const _0x49b574=new jt(this['locale']);return _0x49b574['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x184589['forEach'](_0x330991=>{const _0x568a3b=new zt(this['locale']),_0xf0f437=pa({'editor':_0x169818,'action':_0x330991,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x568a3b['children']['add'](_0xf0f437),_0x114ad2['focusTracker']['add'](_0xf0f437),_0x49b574['items']['add'](_0x568a3b);}),_0x49b574;}['_setupGroupMenuBehavior'](_0x4d7908,_0x2bf723){const _0x37e3d7=_0x4d7908['bindTemplate'],_0xef7758=this['_getButtonKeystroke'](_0x4d7908);_0x4d7908['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x37e3d7['to'](()=>{this['_showNestedPanel'](_0x2bf723,_0x4d7908);}),'mouseleave':_0x37e3d7['to'](_0x5356a4=>{const _0x1cc5b1=_0x5356a4['relatedTarget'];this['_isMovingToNestedMenu'](_0x1cc5b1,_0x2bf723)||this['_hideNestedPanel'](_0x2bf723);}),'keydown':_0x37e3d7['to'](_0x1ff78c=>{_0x1ff78c['key']==_0xef7758&&(this['_showNestedPanel'](_0x2bf723,_0x4d7908),_0x2bf723['content']['get'](0x0)['focus']());})}}),_0x2bf723['on']('render',()=>{_0x2bf723['element']?.['addEventListener']('mouseleave',_0x2d9996=>{const _0x333051=_0x2d9996['relatedTarget'];_0x4d7908['element']?.['contains'](_0x333051)||this['_isMovingToNestedMenu'](_0x333051,_0x2bf723)||this['_hideNestedPanel'](_0x2bf723);});});}['_showNestedPanel'](_0x24edff,_0x55f1cc){this['_openNestedPanels']['forEach'](_0x202d90=>{_0x202d90!==_0x24edff&&_0x202d90['isVisible']&&_0x202d90['hide']();}),_0x24edff['show'](),_0x24edff['pin']({'positions':[Ut['eastSouth']],'target':_0x55f1cc['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x24edff);}['_hideNestedPanel'](_0x539d41){_0x539d41['hide'](),this['_openNestedPanels']['delete'](_0x539d41);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x47e6ed=>_0x47e6ed['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x1f5e39,_0x4aabaf){if(!_0x1f5e39)return!0x1;if(_0x4aabaf['element']?.['contains'](_0x1f5e39))return!0x0;const _0xfbda62=_0x1f5e39;return _0xfbda62['closest']&&(null!==_0xfbda62['closest']('.ck-ai-quick-actions-group-panel')||null!==_0xfbda62['closest']('.ck-ai-quick-actions-group-list')||null!==_0xfbda62['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'](_0x33aaa4){return'rtl'===_0x33aaa4['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x392ddc){return'rtl'===_0x392ddc['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x4d193b,_0x2af3b2,_0x2b50e8,_0x1b88a4){_0x4d193b['key']==_0x2af3b2&&(_0x2b50e8['focus'](),this['_hideNestedPanel'](_0x1b88a4));}['_handleSearchResultButtonClick'](_0x5e4dae){_0x5e4dae['fire']('execute');}};function fa(_0x26ac7b){const {editor:_0x1b1b0e,content:_0x423afb,buttonDefinition:_0x5b70b9,bodyCollection:_0x4a176f,hasSearch:_0x1b3900=!0x1,actionButtons:_0x44b2e7}=_0x26ac7b;return()=>{const _0x5ade53=_0x1b1b0e['locale'],_0x11cc26=_0x1b1b0e['commands']['get']('aiQuickAction'),_0x47b61a=_0x2959da(_0x5ade53);_0x47b61a['bind']('isEnabled')['to'](_0x11cc26),_0x47b61a['buttonView']['set']({'icon':_0x5b70b9['icon']??_0x4e19bd,'label':_0x5b70b9['label'],'tooltip':!0x0}),_0x47b61a['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x24f3a6=new Ca(_0x1b1b0e,_0x423afb,_0x47b61a,_0x4a176f,_0x1b3900,_0x44b2e7);return _0x47b61a['panelView']['children']['add'](_0x24f3a6),_0x1b3900&&_0x47b61a['on']('change:isOpen',(_0x180046,_0x4d2f6f,_0x2006ff)=>{if(_0x2006ff){if(_0x1b1b0e['plugins']['has']('AIEditing')){const _0x5e39fe=_0x1b1b0e['plugins']['get'](Is),_0x298e3a=_0x1b1b0e['model']['document']['selection'],_0xf6adf0=Array['from'](_0x298e3a['getRanges']());_0xf6adf0['length']>0x0&&_0x5e39fe['showFakeVisualSelection']({'editor':_0x1b1b0e,'ranges':_0xf6adf0,'id':'quick-action','priority':0x14});}}else _0x1b1b0e['plugins']['has']('AIEditing')&&_0x1b1b0e['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x24f3a6['resetSearch']();}),_0x47b61a;};}const ba='<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>',Sa='<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>',Ra='<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>',Oa=/* #__PURE__ -- @preserve */
37
- ((()=>({'chat':'AIChat','action':'AIActions'}))());var va=class AIQuickActionsUI extends _0x2965bd{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,on];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiquickactions');const _0x214c5e=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x214c5e),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x17195a){return function(_0x505810){const _0x36d5bd=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x505810['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x505810,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xf5b95c},{'id':'chat-commands','label':us(_0x505810,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xf5b95c,'actions':[{'id':'explain','label':us(_0x505810,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x505810,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':ba['replace']('%0',_0x36d5bd),'type':'chat'},{'id':'summarize','label':us(_0x505810,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x505810,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Sa['replace']('%0',_0x36d5bd),'type':'chat'},{'id':'highlight-key-points','label':us(_0x505810,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x505810,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Ra['replace']('%0',_0x36d5bd),'type':'chat'}]},{'id':'improve-writing','label':us(_0x505810,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x46bad4},{'id':'continue','label':us(_0x505810,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x9a7f60},{'id':'fix-grammar','label':us(_0x505810,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x4049d0},{'id':'adjust-length','label':us(_0x505810,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x104e50,'actions':[{'id':'make-shorter','label':us(_0x505810,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x505810,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x505810,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x527cc5,'actions':[{'id':'make-tone-casual','label':us(_0x505810,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x505810,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x505810,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x505810,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x505810,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0xc54aae,'actions':[{'id':'translate-to-english','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x505810,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x505810,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x41d434,'actions':[]}];}(_0x17195a);}['_getDefaultAndCustomActions'](){const _0x54921a=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0xb4d5d=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x596ea6=>({..._0x596ea6,'type':'chat'===_0x596ea6['type']?'chat':'action','icon':void 0x0}));return _0x54921a['find'](_0x41123a=>'other'===_0x41123a['id'])['actions']['push'](..._0xb4d5d),_0x54921a;}async['_initActionTypeQuickActions'](){try{const _0x432e95=new zs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x42a9bf=await _0x432e95['getAll'](),_0x3bf81d=(await _0x432e95['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x3bf81d),this['_enableButtonsByType']('action',_0x573260=>!!_0x42a9bf['find'](_0x462c88=>_0x462c88['id']===_0x573260['model'])||void 0x0===_0x573260['model']);}catch(_0x42273a){const _0x1901db=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x42273a});this['_reporter']['logError'](_0x1901db);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x4b52c8=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x4b52c8,'change:isConversationReady',(_0x26ed4b,_0x234d82,_0x6b58e4)=>{_0x6b58e4&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x4b52c8['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x337928,_0x283ddd){this['_quickActionsDefinition']['forEach'](_0xfc64c0=>{'actions'in _0xfc64c0?_0xfc64c0['actions']['forEach'](_0x4620ca=>{_0x4620ca['type']===_0x337928&&(_0x4620ca['isEnabled']=_0x283ddd(_0x4620ca));}):_0xfc64c0['type']===_0x337928&&(_0xfc64c0['isEnabled']=_0x283ddd(_0xfc64c0));}),this['_actionButtons']['forEach'](_0x59c040=>{if(ka(_0x59c040['action']))return;if(_0x59c040['action']['type']!==_0x337928)return;const _0x56b4cb=_0x283ddd(_0x59c040['action']);if(_0x59c040['action']['isEnabled']=_0x56b4cb,_0x59c040['buttonView']['isEnabled']=_0x56b4cb,!_0x56b4cb&&_0x59c040['action']['model']){const _0x2dfd6f=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x59c040['action']['id'],'modelId':_0x59c040['action']['model']});this['_reporter']['logError'](_0x2dfd6f);}}),this['_actionButtons']['filter'](_0x5ddeab=>ka(_0x5ddeab['action']))['forEach'](_0x2e1952=>{_0x2e1952['buttonView']['isEnabled']=_0x2e1952['action']['actions']['some'](_0x1fb1ff=>_0x1fb1ff['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x2e2070,group:_0x43ab70})=>{_0x2e2070['isEnabled']=_0x43ab70['actions']['some'](_0x35e7f3=>_0x35e7f3['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0xae8568){this['_actionButtons']['forEach'](_0x3ed7f3=>{ka(_0x3ed7f3['action'])||'action'===_0x3ed7f3['action']['type']&&(_0x3ed7f3['action']['model']||(_0x3ed7f3['action']['model']=_0xae8568));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x5ace0c=new Lt(this['editor']['locale']);_0x5ace0c['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x5ace0c),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x5ace0c);}['_initializeQuickActionsDropdown'](_0x10b3e7){const _0x546d04=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',fa({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x4e19bd,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x10b3e7,'hasSearch':_0x546d04,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x339e45){this['_quickActionsDefinition']=_0x339e45['map'](_0xa8f0bc=>{if('actions'in _0xa8f0bc){const _0x415a83=_0xa8f0bc;return{..._0x415a83,'actions':_0x415a83['actions']['map'](_0x65868f=>{const {actions:_0x1013fa,..._0x3e774e}=_0x415a83;return{..._0x65868f,'isEnabled':!0x1,'parent':_0x3e774e};})['filter'](_0x3116ac=>this['_shouldIncludeAction'](_0x3116ac))};}return{..._0xa8f0bc,'isEnabled':!0x1};})['filter'](_0x1cf230=>'actions'in _0x1cf230?_0x1cf230['actions']['length']>0x0:this['_shouldIncludeAction'](_0x1cf230));}['_shouldIncludeAction'](_0x47e877){const _0x3881d9=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Oa[_0x47e877['type']])&&!_0x3881d9['includes'](_0x47e877['id'])&&!('chat'===_0x47e877['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x25cf0c){this['_quickActionsDefinition']['forEach'](_0x4b12b4=>{if('actions'in _0x4b12b4){const _0x37ac75=fa({'editor':this['editor'],'content':_0x4b12b4['actions'],'buttonDefinition':_0x4b12b4,'bodyCollection':_0x25cf0c,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4b12b4['id'],_0x37ac75),_0x4b12b4['actions']['forEach'](_0xc6d79a=>{const _0x17ffff=pa({'editor':this['editor'],'action':_0xc6d79a,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0xc6d79a['id'],_0x17ffff);});}else{const _0x5b2b85=pa({'editor':this['editor'],'action':_0x4b12b4,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4b12b4['id'],_0x5b2b85);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x457234=>{const _0x18674d=this['editor']['commands']['get']('aiQuickAction'),_0x3e3851=new _0x31c0cc(_0x457234),_0x5e5c13=us(_0x457234,'AI_QUICK_ACTIONS_HEADING');_0x3e3851['buttonView']['set']({'label':_0x5e5c13,'icon':_0x4e19bd});const _0x26d499=new te(_0x457234);return _0x26d499['set']({'ariaLabel':_0x5e5c13,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0xa9ce83=>{if('actions'in _0xa9ce83){const _0x3ed285=_0xa9ce83,_0x4b69e6=new Zt(_0x457234,_0x3e3851),_0x592198=new _0x31c0cc(_0x457234),_0x3d2d63=new te(_0x457234);_0x592198['buttonView']['set']({'label':_0x3ed285['label'],'icon':_0x3ed285['icon']}),_0x3ed285['actions']['forEach'](_0x376815=>{const _0x1f7713=new Zt(_0x457234,_0x592198),_0x461cb8=new Jt(_0x457234);_0x461cb8['set']({'label':_0x376815['label'],'icon':_0x376815['icon'],'role':'menuitem','isEnabled':_0x376815['isEnabled']}),_0x461cb8['on']('execute',()=>{this['_executeQuickAction'](_0x376815);}),this['_actionButtons']['push']({'buttonView':_0x461cb8,'action':_0x376815}),_0x461cb8['delegate']('execute')['to'](_0x592198),_0x1f7713['children']['add'](_0x461cb8),_0x3d2d63['items']['add'](_0x1f7713);}),_0x592198['isEnabled']=_0x3ed285['actions']['some'](_0x13bc7d=>_0x13bc7d['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x592198,'group':_0x3ed285}),_0x592198['panelView']['children']['add'](_0x3d2d63),_0x4b69e6['children']['add'](_0x592198),_0x26d499['items']['add'](_0x4b69e6);}else{const _0x50fbc5=_0xa9ce83,_0x40cd58=new Zt(_0x457234,_0x3e3851),_0x10d00a=new Jt(_0x457234);_0x10d00a['set']({'label':_0x50fbc5['label'],'icon':_0x50fbc5['icon'],'role':'menuitem','isEnabled':_0x50fbc5['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x10d00a,'action':_0x50fbc5}),_0x10d00a['on']('execute',()=>{this['_executeQuickAction'](_0x50fbc5);}),_0x10d00a['delegate']('execute')['to'](_0x3e3851),_0x40cd58['children']['add'](_0x10d00a),_0x26d499['items']['add'](_0x40cd58);}}),Object['values'](Oa)['some'](_0x4af98e=>this['editor']['plugins']['has'](_0x4af98e))?_0x3e3851['bind']('isEnabled')['to'](_0x18674d):_0x3e3851['set']({'isEnabled':!0x1}),_0x3e3851['panelView']['children']['add'](_0x26d499),_0x3e3851;});}['_executeQuickAction'](_0x1fb844){const _0xccec21=this['editor'];_0xccec21['editing']['view']['focus'](),_0xccec21['commands']['execute']('aiQuickAction',_0x1fb844);const _0x4e031c=_0xccec21['ui']['view']['menuBarView'];_0x4e031c&&_0x4e031c['close']&&_0x4e031c['close']();}};function ka(_0x1a3d40){return'actions'in _0x1a3d40;}function Na(_0x5d6d35,_0x542340){const _0x30b5c2=_0x5d6d35['plugins']['get']('AITabs')['view'];_0x30b5c2['isVisible']=!0x0,_0x30b5c2['activateTab'](_0x542340);}var ya=class extends _0x3738d1{['execute'](_0x29a562){switch(this['_expandSelectionIfCollapsed'](),_0x29a562['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x32861e=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x32861e});}this['_handleAIChatAction'](_0x29a562);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x2ddb94=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2ddb94});}this['_handleAIActionsAction'](_0x29a562);}}async['_handleAIChatAction'](_0x401ec4){const _0x21d36e=this['editor']['plugins']['get']('AIChatController');if(Na(this['editor'],'chat'),'ask-ai'===_0x401ec4['id'])_0x21d36e['removeSelectionFromChatContext'](),_0x21d36e['addSelectionToChatContext'](this['editor']),_0x21d36e['focusPromptInput']();else await _0x21d36e['startConversation']({'modelId':_0x401ec4['model']}),_0x21d36e['removeSelectionFromChatContext'](),_0x21d36e['addSelectionToChatContext'](this['editor']),_0x21d36e['focusPromptInput'](),await _0x21d36e['sendMessage']({'message':_0x401ec4['prompt']||_0x401ec4['displayedPrompt']||_0x401ec4['label'],'attributes':{'quickActionData':{'id':_0x401ec4['id']},'displayedPrompt':_0x401ec4['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x40795a=this['editor'],_0x3f5816=_0x40795a['model']['document']['selection'];if(!_0x3f5816['isCollapsed'])return;const _0x13b2ad=mt(_0x3f5816['getSelectedBlocks']())||_0x40795a['model']['schema']['getLimitElement'](_0x3f5816);_0x40795a['model']['change'](_0x54e0c1=>{_0x54e0c1['setSelection'](_0x13b2ad,'in');});}['_handleAIActionsActionLabel'](_0x28c4c8){return _0x28c4c8['parent']?.['label']&&'other'!==_0x28c4c8['parent']?.['id']?_0x28c4c8['parent']['label']+':\x20'+_0x28c4c8['label']:_0x28c4c8['label'];}async['_handleAIActionsAction'](_0x5f13a9){const _0x22dc4a=this['editor']['plugins']['get']('AIActions'),_0x597b5=_0x5f13a9['prompt']?{'userMessage':_0x5f13a9['prompt'],'model':_0x5f13a9['model']}:{'actionName':_0x5f13a9['actionName']||_0x5f13a9['id'],'args':_0x5f13a9['args']},_0x8c2651=this['_handleAIActionsActionLabel'](_0x5f13a9);await _0x22dc4a['executeAction'](_0x597b5,_0x8c2651,_0x5f13a9['icon']);}},xa=class extends _0x2965bd{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2648b1=this['editor'],_0x11c9a7=new ya(this['editor']);if(_0x2648b1['commands']['add']('aiQuickAction',_0x11c9a7),_0x2648b1['plugins']['has']('AIChat')){const _0x250e0b=this['editor']['plugins']['get']('AIChatController');_0x2648b1['model']['document']['selection']['on']('change:range',(_0x58cd06,_0x415c5d)=>{_0x415c5d['directChange']&&_0x250e0b['removeSelectionFromChatContext']();});}}},La=class extends gn{['appendContent'](_0x5ae122,_0x41f324='text'){'modification'===this['type']&&'text'===_0x41f324&&(_0x41f324=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x5ae122,_0x41f324);}['updateChangeGroups'](_0xfeac0e){const _0x135875=this['parsedContent']['get'](_0xfeac0e)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0xfeac0e,_0x135875),this['changeGroups']=[],0x0==_0x135875['childNodes']['length'])return;Hs(this['documentContextContent']['get'](_0xfeac0e),this['parsedMergedContent']['get'](_0xfeac0e));const _0x266164=_0x37330f(this['documentContextContent']['get'](_0xfeac0e)['children']['map'](_0x300dc2=>({'node':_0x300dc2,'id':fs(_0x300dc2,'data-id')})),_0x135875['children']['map'](_0x4f474c=>({'node':_0x4f474c,'id':fs(_0x4f474c,'data-id')||vt()})),{'comparator':(_0x15dd20,_0x598ba6)=>_0x15dd20['id']==_0x598ba6['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x266164['length']&&_0x266164[_0x266164['length']-0x1]['removed'];)_0x266164['pop']();}const _0x186d8d=_0x266164['map'](_0x51f0c4=>{const _0xc94956=_0x51f0c4['added']?'new':_0x51f0c4['removed']?'removed':'modified';return{'node':_0x51f0c4['value'][0x0]['node'],'type':_0xc94956,'id':_0x51f0c4['value'][0x0]['id']};}),_0x200c75=this['_documentIdToSource']['get'](_0xfeac0e);this['changeGroups']['push']({'changes':_0x186d8d,'state':'pending','index':this['changeGroups']['length'],'editor':_0x200c75['editor'],'rootName':_0x200c75['rootName'],'documentId':_0xfeac0e});}['_getDifferentChangeGroups'](_0x4b3bde,_0x144391){return _0x144391;}},Da=class extends pn{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x2317f3){super(_0x2317f3),this['content']=_0x2317f3['content'],this['version']=_0x2317f3['version'],this['editor']=_0x2317f3['editor'],this['rootName']=_0x2317f3['rootName'],this['actionName']=_0x2317f3['actionName'],this['args']=_0x2317f3['args'],this['userMessage']=_0x2317f3['userMessage'],this['model']=_0x2317f3['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':vt(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x380974){const _0x103b2d=this['editor']['config']['get']('collaboration.channelId'),_0x2de557=new La({..._0x380974,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x103b2d,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x103b2d,this['editor']]])});return this['replies']['push'](_0x2de557),_0x2de557['delegate'](...In)['to'](this),this['fire']('replyCreated',_0x2de557),_0x2de557;}},Pa=class extends _0x11c4f1{constructor(_0x2e3214,_0x41ec9a=!0x0,_0x2932da=!0x0){super(_0x2e3214),this['set']('isEnabled',!0x1),_0x41ec9a&&(this['applyButton']=this['_createButton'](us(_0x2e3214,'AI_BALLOON_APPLY_BUTTON'),hn),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x2932da&&(this['suggestButton']=this['_createButton'](us(_0x2e3214,'AI_BALLOON_SUGGEST_BUTTON'),_0x41ec9a?cn:hn),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x41ec9a,'showSuggestButton':_0x2932da}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x253f75,showSuggestButton:_0x26e40f}){this['applyButton']&&(this['applyButton']['isVisible']=_0x253f75),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x26e40f);}['_createButton'](_0x10708b,_0x47c537){const _0x167ee4=new Ht(this['locale']);return _0x167ee4['set']({'label':_0x10708b,'class':_0x47c537,'isVisible':!0x0,'withText':!0x0}),_0x167ee4;}},Ha=class extends _0x5d2282{constructor(_0x2bf5b1){super(_0x2bf5b1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':us(_0x2bf5b1,'AI_DISCLAIMER_TEXT')}]}]});}},Ma=class extends _0x5d2282{constructor(_0x53161d){super(_0x53161d),this['set']('isVisible',!0x0);const _0x538a1c=new lr('small');_0x538a1c['isVisible']=!0x0;const _0x700dc=new _0x5d2282(this['locale']);_0x700dc['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[us(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x1fe7b2=>!_0x1fe7b2)]},'children':[_0x538a1c,_0x700dc]});}},Va=class extends ca{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x4fed34,_0x5af2d3){super(_0x4fed34),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x5af2d3,this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x3c6d3b(),this['_addContentWrapper'](_0x5af2d3),this['_addDisclaimerView'](),this['_addToolbar'](_0x5af2d3),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'](_0x5af2d3);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x68a9d7 of this['_focusables'])this['_focusTracker']['add'](_0x68a9d7['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x92adfd){-0x1===_0x92adfd?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x235769){this['_isLoading']=_0x235769;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1206e7){super['showError'](_0x1206e7),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x52bcab){super['showBlockingError'](_0x52bcab),this['setErrorState']();}['addMiniToolbarItem'](_0x2d6a47){this['_miniToolbarView']['items']['has'](_0x2d6a47)||this['_miniToolbarView']['items']['add'](_0x2d6a47);}['removeMiniToolbarItem'](_0x54ba84){this['_miniToolbarView']['items']['has'](_0x54ba84)&&this['_miniToolbarView']['items']['remove'](_0x54ba84);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x52d5a2,showSuggestButton:_0x33484b}){_0x52d5a2=_0x52d5a2&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x33484b=_0x33484b&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x52d5a2,'showSuggestButton':_0x33484b});}async['updateContent'](_0x2d0b4f){await this['_streamableContentView']['update'](_0x2d0b4f);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x29d5a4){this['_contentWrapper']=new _0x5d2282(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'](_0x29d5a4['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Ha(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x510381,showSuggestButton:_0x4689d5}){this['_toolbarView']=new Pa(this['locale'],_0x510381,_0x4689d5),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',(_0x1b7e34,_0x12ad16,_0x56b3d2)=>!(_0x1b7e34||_0x12ad16||_0x56b3d2)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x510381,'showSuggestButton':_0x4689d5}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x17bc04){return this['_miniToolbarView']=new da(this['locale'],_0x17bc04),this['_miniToolbarView']['delegate'](...yn)['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',(_0x2b4b5f,_0x24b5d1)=>!(_0x2b4b5f||_0x24b5d1)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ma(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new Qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x311f14=new Ht(this['locale']),_0x32f189=new Ht(this['locale']),_0x544b14=new Ua(this['locale']),_0x58d0ce=new Ht(this['locale']);_0x311f14['set']({'icon':_0x20d49b,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+ln}),_0x32f189['set']({'icon':_0x396ec0,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+ln}),_0x58d0ce['set']({'icon':_0xc715e6,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+ln}),_0x311f14['bind']('isEnabled')['to'](this,'isBusy',_0x26fdd2=>!_0x26fdd2),_0x311f14['on']('execute',()=>{this['fire']('tryAgain');}),_0x32f189['bind']('isEnabled')['to'](this,'isBusy',_0x50b6f0=>!_0x50b6f0),_0x32f189['on']('execute',()=>{this['fire']('showPrevious');}),_0x58d0ce['bind']('isEnabled')['to'](this,'isBusy',_0x5d3c71=>!_0x5d3c71),_0x58d0ce['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x32f189,this['_navigationCounter']=_0x544b14,this['_navigationNextButton']=_0x58d0ce,this['_navigationTryAgainButton']=_0x311f14;}['updateMiniToolbarButtons'](_0x4e8921,_0x3bdbe5){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x2b9e73=_0x4e8921>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x2b9e73){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x223efb=_0x4e8921-_0x3bdbe5;this['_navigationCounter']['setInteractionCount'](_0x223efb+'/'+_0x4e8921),this['_navigationPreviousButton']['isEnabled']=_0x3bdbe5<_0x4e8921-0x1,this['_navigationNextButton']['isEnabled']=_0x3bdbe5>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'](_0x4e7b93){this['_isLoading']=_0x4e7b93;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0xc98eef=this['_streamableContentView']['element'],_0x314358=this['_miniToolbarView']['element'],_0x46204f=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x8c4975=_0xc98eef['offsetWidth']-_0xc98eef['clientWidth'];_0x314358['style']['right']='calc('+_0x8c4975+'px\x20+\x20var(--ck-spacing-large))';});};_0x46204f(),this['_miniToolbarResizeObserver']=new It(_0xc98eef,()=>{_0x46204f();});}['_initializeScrollManager'](){const _0x576619=this['_getScrollableElement']();_0x576619&&!this['_scrollManager']&&(this['_scrollManager']=new Hr(_0x576619));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Ua=class extends _0x5d2282{constructor(_0x17e628){super(_0x17e628);const _0x3bd262=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x3bd262['to']('interactionCount')}]});}['setInteractionCount'](_0x50bde4){this['set']('interactionCount',_0x50bde4);}},Ba=class extends _0x2965bd{static get['requires'](){return[ls,on,Mt,Is,ua,_0x22fa17];}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(_0x57f31f){super(_0x57f31f),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new tr();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x3b7d8e,_0x187bb2,_0x2ff462){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x152640,anchorData:_0x1fba6d,root:_0x440d37}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3b7d8e,_0x152640,_0x1fba6d,_0x440d37,_0x187bb2,_0x2ff462);}const {modelFragment:_0x2c00e5,anchorData:_0x235918,root:_0x1d8bdf}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3b7d8e,_0x2c00e5,_0x235918,_0x1d8bdf,_0x187bb2,_0x2ff462);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x12f31c=this['editor']['plugins']['has']('TrackChanges');let _0x37a840=this['editor']['config']['get']('ai.availableReplyActions')||[...ir];_0x12f31c||(_0x37a840=_0x37a840['filter'](_0x2a7237=>'insertSuggestion'!=_0x2a7237));const _0x1f1430=this['editor']['commands']['get']('trackChanges'),_0x2330d9=new Va(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x12f31c,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x37a840});return _0x2330d9['bind']('isBusy')['to'](this),_0x1f1430&&_0x2330d9['bind']('isTrackChangesOn')['to'](_0x1f1430,'value'),_0x2330d9['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x2330d9['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x2330d9['on']('showNext',()=>{this['_navigateToNext']();}),_0x2330d9;}['_normalizeSelectionStart'](){const _0x4247d5=this['editor']['model'],_0x483871=_0x4247d5['document']['selection'],_0xfd68a4=_0x483871['getFirstRange']();if(!_0xfd68a4||_0xfd68a4['isCollapsed'])return;const _0x396c1d=mt(_0x483871['getSelectedBlocks']());if(!_0x396c1d)return;const _0x217637=_0x4247d5['createPositionAt'](_0x396c1d,0x0);_0x217637['isAfter'](_0xfd68a4['start'])&&_0x4247d5['change'](_0x24d7f7=>{_0x24d7f7['setSelection'](_0x24d7f7['createRange'](_0x217637,_0xfd68a4['end']));});}['_getExecuteDataRegular'](){const _0x52d9c6=this['editor']['model']['document']['selection'],_0x29fa2c=_0x52d9c6['getFirstRange']()['start']['root'];if(_0x52d9c6['isCollapsed']){const _0x1c951f=mt(_0x52d9c6['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x52d9c6);this['editor']['model']['change'](_0x3d4682=>{_0x3d4682['setSelection'](_0x1c951f,'in');});}this['_normalizeSelectionStart']();const _0xea330c=_0x52d9c6['getFirstRange'](),_0x3d1665=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x52d9c6),_0xea330c['start'],_0xea330c['end']);this['_copyMarkersToFragment'](_0x3d1665,_0x52d9c6,{'isTableSelection':!0x1});const _0x32a53c=_0x52d9c6['getFirstRange']()['start'],_0x4f1177=new Map();let _0x376179=_0x3d1665;for(let _0x584a9e=0x0;_0x584a9e<_0x32a53c['path']['length'];_0x584a9e++)_0x4f1177['set'](_0x376179,_0x32a53c['path'][_0x584a9e]),_0x376179=_0x376179['getChild'](0x0);return{'modelFragment':_0x3d1665,'anchorData':_0x4f1177,'root':_0x29fa2c};}['_getExecuteDataInTable'](){const _0x15365b=this['editor']['model']['document']['selection'],_0x20c1ef=this['editor']['plugins']['get']('TableSelection'),_0x10ace0=_0x15365b['getFirstRange']()['start']['root'],_0x24cea7=_0x20c1ef['getSelectionAsFragment'](),_0x195b36=_0x15365b['getFirstRange']()['start']['parent']['parent'],_0x396194=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x195b36),this['editor']['model']['createPositionAfter'](_0x195b36)),_0x4f1a84=this['_wrapWithCommonAncestors'](_0x24cea7,_0x396194['start'],_0x396194['end']);this['_copyMarkersToFragment'](_0x4f1a84,_0x15365b,{'isTableSelection':!0x0});const _0x3a135a=_0x15365b['getFirstRange']()['start'],_0x39526b=new Map();let _0x280769=_0x4f1a84;for(let _0xb30f5c=0x0;_0xb30f5c<_0x3a135a['path']['length'];_0xb30f5c++)if(_0x39526b['set'](_0x280769,_0x3a135a['path'][_0xb30f5c]),_0xb30f5c<_0x3a135a['path']['length']-0x1)_0x280769=_0x280769['getChild'](0x0);else{let _0xbc2408=_0x280769['nextSibling'];for(;_0xbc2408;)_0x39526b['set'](_0xbc2408,_0x3a135a['path'][_0xb30f5c]),_0xbc2408=_0xbc2408['nextSibling'];}return{'modelFragment':_0x4f1a84,'anchorData':_0x39526b,'root':_0x10ace0};}async['_executeAction'](_0xa30b94,_0x32f5ce,_0x303cca,_0x1709e3,_0x21e1f9,_0x3e8d2b){const _0x2ddc56=this['editor']['plugins']['get'](Is),_0x26203b=this['editor']['plugins']['get'](ua),_0x25cd0e=this['editor']['model']['document']['selection'],_0x396d33=await _0x2ddc56['modelToDataWithIds'](_0x32f5ce,this['editor']),_0x269094=this['editor']['model']['document']['version'],_0x220bcc=[..._0x25cd0e['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x26203b['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x21e1f9,'icon':_0x3e8d2b||_0x4e19bd,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x220bcc,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26203b),this['_interactionParams']={'action':_0xa30b94,'content':_0x396d33,'version':_0x269094,'aiBalloon':_0x26203b,'modelFragment':_0x32f5ce,'anchorData':_0x303cca,'root':_0x1709e3},this['_setupApplyListeners'](),this['listenTo'](_0x26203b,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x26203b,'dialogClosed',(_0x10b1f6,{id:_0x29ed9d})=>{if('aiActionsBalloon'===_0x29ed9d){for(const _0x534346 of this['_interactions']){if(0x0===_0x534346['replies']['length']||_0x534346['stoppedExplicitly'])continue;const _0x2f49a6=_0x534346['replies'][_0x534346['replies']['length']-0x1],_0x179a20=_0x2f49a6['changeGroups'][0x0];_0x179a20&&'pending'===_0x179a20['state']&&_0x2f49a6['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26203b);}}),this['_createInteraction'](_0x396d33,_0x269094,_0x26203b,_0xa30b94);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x282e34,anchorData:_0x558a03,root:_0x48d158}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x282e34,_0x558a03,_0x48d158,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x282e34,_0x558a03,_0x48d158,!0x0);});}['_wrapWithCommonAncestors'](_0x1f2fdc,_0x5650f,_0x2a8147){const _0x3d545b=this['editor']['model']['createRange'](_0x5650f,_0x2a8147)['getCommonAncestor'](),_0x5292be=_0x3d545b['is']('documentFragment')?[]:_0x3d545b['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x5292be['length']){const _0x34aabf=_0x5292be['map'](_0xda8c7e=>_0xda8c7e['_clone'](!0x1));for(let _0x1a0b3c=0x1;_0x1a0b3c<_0x34aabf['length'];_0x1a0b3c++)_0x34aabf[_0x1a0b3c-0x1]['_appendChild'](_0x34aabf[_0x1a0b3c]);return _0x34aabf[_0x34aabf['length']-0x1]['_appendChild'](_0x1f2fdc),new _0x3f99b4(_0x34aabf[0x0]);}return _0x1f2fdc;}['_copyMarkersToFragment'](_0x30abbb,_0x3bd7a2,_0x28b83f={'isTableSelection':!0x1}){const _0x3b9619=this['editor']['model'],_0x3bc4e3=Array['from'](_0x3bd7a2['getRanges']()),_0x21432e=_0x3bd7a2['getFirstRange']()['start'];for(const _0x53439f of _0x3b9619['markers']){if(_0x53439f['name']['startsWith']('ai-selection')||!_0x53439f['affectsData'])continue;const _0x358059=_0x53439f['getRange']();if(!_0x3bc4e3['some'](_0x5a8c7f=>_0x5a8c7f['containsRange'](_0x358059,!0x0)))continue;const _0x31ac66=this['_regularCalculateMarkerPath'](_0x358059['start'],_0x21432e,_0x28b83f['isTableSelection']),_0x4b8e8b=this['_regularCalculateMarkerPath'](_0x358059['end'],_0x21432e,_0x28b83f['isTableSelection']),_0x402ba0=_0x3b9619['createPositionFromPath'](_0x30abbb,_0x31ac66),_0x12f88e=_0x3b9619['createPositionFromPath'](_0x30abbb,_0x4b8e8b);if(!_0x402ba0['isEqual'](_0x12f88e)){const _0x4968af=_0x3b9619['createRange'](_0x402ba0,_0x12f88e);_0x30abbb['markers']['set'](_0x53439f['name'],_0x4968af);}}}['_regularCalculateMarkerPath'](_0xcdfee3,_0x6e20b6,_0x564ded=!0x1){const _0x2f01f6=[..._0xcdfee3['path']['slice']()];for(let _0x2c7d50=0x0;_0x2c7d50<Math['max'](_0x6e20b6['path']['length'],_0xcdfee3['path']['length']);_0x2c7d50++){const _0x2a4c37=_0x6e20b6['path'][_0x2c7d50]||0x0,_0x1b208e=(_0xcdfee3['path'][_0x2c7d50]||0x0)-_0x2a4c37;if(_0x2f01f6[_0x2c7d50]=_0x1b208e,0x0!==_0x1b208e&&!_0x564ded)break;}return _0x2f01f6;}async['_createInteraction'](_0x2b3aec,_0x123d1a,_0x3d74ae,_0x4a0bb2){const _0x42808c=this['editor'],_0xc96816=_0x42808c['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x4c4eb3(_0x42808c,_0xc96816['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x4a0bb2,'content':_0x2b3aec,'version':_0x123d1a,'aiBalloon':_0x3d74ae,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0xc96816});const _0x140e8b=new Da({'connector':this['_aiConnector'],'locale':_0x42808c['locale'],'content':_0x2b3aec,'version':_0x123d1a,'editor':_0x42808c,'rootName':_0xc96816['rootName'],..._0x4a0bb2});this['_interactions']['push'](_0x140e8b);const _0x37304a=(_0xa983f2,_0x457226=!0x1,_0x3482ba='streaming')=>{const {isDone:_0x4e4b6d}=_0xa983f2;return this['_promiseQueue']['enqueue'](async _0x591314=>{try{const _0x54ffe5=Bs({'changeGroups':_0xa983f2['changeGroups'],'documentContextContent':_0xa983f2['documentContextContent'],'showDiff':_0x457226,'trimUnchanged':!0x1});_0x54ffe5['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x54ffe5[0x0],'renderingStrategy':_0x3482ba,'abortSignal':_0x591314}),_0x4e4b6d&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x4443a2){if(nn(_0x4443a2))return;throw _0x4443a2;}});};_0x140e8b['on']('replyCreated',(_0x309f1c,_0x1f806b)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x37304a(_0x1f806b)['catch'](_0x26bd2c=>{this['_reporter']['logError'](_0x26bd2c,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x140e8b,_0x26bd2c);});}),_0x140e8b['on']('replyContentUpdated',(_0x3d4d0c,_0x449c34)=>{_0x37304a(_0x449c34)['catch'](_0x2ad055=>{this['_reporter']['logError'](_0x2ad055,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x140e8b,_0x2ad055);});}),_0x140e8b['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0xcd42a5){this['_reporter']['logError'](_0xcd42a5,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x140e8b,_0xcd42a5);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x196d18,{showDiff:_0x418062})=>{try{this['_balloonShowDiff']=_0x418062;const _0x23841c=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x23841c&&await _0x37304a(_0x23841c,_0x418062,'static');}catch(_0x1b266e){this['_reporter']['logError'](_0x1b266e,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x140e8b,_0x1b266e);}}),_0x140e8b['on']('replyChangeGroupStateUpdated',()=>{const _0x4930e1={'positiveCount':_0x140e8b['replies']['reduce']((_0x423952,_0x5a3b51)=>_0x423952+_0x5a3b51['changeGroups']['filter'](_0x49ff22=>'accepted'===_0x49ff22['state'])['length'],0x0),'totalCount':_0x140e8b['replies']['reduce']((_0x3c84d1,_0x12e90a)=>_0x3c84d1+_0x12e90a['changeGroups']['length'],0x0)},_0x3a00f7=_0x140e8b['actionCallId'],_0x2cdb94=_0x140e8b['actionName'];_0x2cdb94?this['_aiConnector']['upsertAIActionRating'](_0x2cdb94,_0x3a00f7,_0x4930e1):this['_aiConnector']['upsertCustomAIActionRating'](_0x3a00f7,_0x4930e1);}),this['_setLoadingState']();try{const _0x1eb303=await _0x140e8b['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x1eb303;}catch(_0x3cf0af){nn(_0x3cf0af)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x3cf0af,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x140e8b,_0x3cf0af);}}['_applyChanges'](_0x6721ea,_0x3d7e63,_0x29af7a,_0x46397a){const _0x4bbc97=this['editor'];if(_0x46397a&&!_0x4bbc97['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x3987a1=this['editor']['plugins']['get'](_0x22fa17),_0x235099=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x235099||!_0x235099['replies']['length'])return;const _0x4cd0c4=_0x235099['replies'][_0x235099['replies']['length']-0x1];_0x4cd0c4['setChangeGroupState'](0x0,'accepted');const _0x25a998=Ns({'documentSuggestions':vn({'groups':[_0x4cd0c4['changeGroups'][0x0]],'documentContextContent':_0x4cd0c4['documentContextContent'],'documents':_0x235099['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x3987a1,'documentCompareOptions':{'anchor':_0x4bbc97['model']['createPositionAt'](_0x6721ea,0x0),'markDeletions':_0x46397a}})['values']()['next']()['value']??[],_0x4e98b6=this['_filterOperationsOutsideRange'](_0x25a998,_0x3d7e63);for(const _0x73ffc of _0x4e98b6)this['_anchorOperation'](_0x3d7e63,_0x73ffc,_0x29af7a);const _0x2e622b=_0x235099['getDocumentContext']()['documents'][0x0]['version'],_0x20f7fd=_0x4506be(_0x4e98b6,_0x4bbc97['model']['document']['history']['getOperations'](_0x2e622b),{'document':_0x4bbc97['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];Js(_0x20f7fd,'quickActions');try{_0x4bbc97['model']['change'](_0x5cb3d6=>{if(_0x5cb3d6['setSelection'](_0x4bbc97['model']['document']['selection']['focus']),_0x46397a)_0x4bbc97['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x20f7fd);else{for(const _0x38e8b5 of _0x20f7fd)_0x38e8b5['baseVersion']=_0x4bbc97['model']['document']['version'],ys(_0x4bbc97,_0x38e8b5),_0x5cb3d6['batch']['addOperation'](_0x38e8b5),_0x4bbc97['model']['applyOperation'](_0x38e8b5);}});}catch(_0x37603a){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x37603a})),_0x37603a;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x13dd1a,_0x3f0dc7){return _0x13dd1a['filter'](_0x3c4ad3=>{if('rename'==_0x3c4ad3['type']){const _0x2ef6e6=_0x3c4ad3['position']['nodeAfter'];return!_0x3f0dc7['has'](_0x2ef6e6);}if(_0x3c4ad3['type']['indexOf']('Attribute')>-0x1){const _0x23f32d=_0x3c4ad3['range']['start']['nodeAfter'];return!_0x3f0dc7['has'](_0x23f32d);}return!0x0;});}['_anchorOperation'](_0x4df310,_0x30795a,_0x4ed31f){const _0x23ebfe=_0x30795a['clone']();for(const _0x517608 in _0x30795a){const _0x3cbb96=_0x30795a[_0x517608];_0x3cbb96 instanceof _0x2993a5?_0x30795a[_0x517608]=new _0x2993a5(_0x3a1ca0(_0x3cbb96['start']),_0x3a1ca0(_0x3cbb96['end'])):_0x3cbb96 instanceof _0x584844&&(_0x30795a[_0x517608]=_0x3a1ca0(_0x3cbb96));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x23ebfe['type'])){if(_0x23ebfe['isDocumentOperation']=!0x1,_0x23ebfe['baseVersion']=null,'remove'==_0x23ebfe['type']){const _0x4b3dbf=_0x23ebfe['sourcePosition'],_0x9a1014=_0x23ebfe['howMany'];new _0x495311(_0x4b3dbf,_0x9a1014)['_execute']();}else _0x23ebfe['_execute']();}function _0x3a1ca0(_0xebc6a0){if('$graveyard'==_0xebc6a0['root']['rootName'])return _0xebc6a0;const _0x57a61e=[];let _0x59c072=_0xebc6a0['root'];for(let _0x28b27e=0x0;_0x28b27e<_0xebc6a0['path']['length'];_0x28b27e++){const _0x95d307=_0x4df310['get'](_0x59c072)||0x0;_0x57a61e[_0x28b27e]=_0xebc6a0['path'][_0x28b27e]+_0x95d307,_0x59c072=_0x59c072['getChildAtOffset'](_0xebc6a0['path'][_0x28b27e]);}return new _0x584844(_0x4ed31f,_0x57a61e,_0xebc6a0['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x5bc0d7,content:_0x3f7166,version:_0x108b8d,aiBalloon:_0x2e94da}=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'](_0x3f7166,_0x108b8d,_0x2e94da,_0x5bc0d7)['catch'](_0x28b574=>{this['_reporter']['logError'](_0x28b574,{'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 _0x2fcffe=this['_interactions']['length'];this['_currentInteractionIndex']<_0x2fcffe-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x3eeea5){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x3eeea5;const _0x442354=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x442354)return;if(_0x442354['hasError'])return this['_setErrorState'](_0x442354),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x442354['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x1d18b6=_0x442354['replies'][_0x442354['replies']['length']-0x1];if(_0x1d18b6)try{const _0x334bc3=Bs({'changeGroups':_0x1d18b6['changeGroups'],'documentContextContent':_0x1d18b6['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x2a48b4=>setTimeout(_0x2a48b4,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x334bc3[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x5bb0e8){this['_reporter']['logError'](_0x5bb0e8,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x5bc99a,_0x3f7816){if(void 0x0!==_0x3f7816&&nn(_0x3f7816))return;const _0x228768=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x228768),_0x5bc99a['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);}},Ga=class extends _0x2965bd{static get['requires'](){return[va,xa,Ba];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x32c9e6){super(_0x32c9e6),_0x32c9e6['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Fa=class extends _0x5d2282{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0xdf6bb,_0x364ad4){super(_0xdf6bb),this['id']=_0x364ad4,this['set']('status','pending'),this['set']('changeId',_0x364ad4),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',(_0x3c87c8,_0x43cb90)=>{_0x43cb90&&_0x43cb90['target']&&'A'===_0x43cb90['target']['tagName']&&_0x43cb90['preventDefault'](),this['fire']('activateChange',{'id':_0x364ad4,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x364ad4,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x364ad4,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x17ab53=new _0x5d2282(this['locale']);return _0x17ab53['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x150186=>!_0x150186)]}}),_0x17ab53;}['_createAcceptButtonView'](){const _0x9203a6=new Ht(this['locale']);return _0x9203a6['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x9203a6['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x203355=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x203355['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x198376=>'pending'!==_0x198376&&'accepted'!==_0x198376),this['bindTemplate']['if']('status',cn,_0x308d38=>'pending'===_0x308d38),this['bindTemplate']['if']('status',ln,_0x12cb3b=>'pending'!==_0x12cb3b),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x563f17=>'accepted'===_0x563f17)]}}),this['on']('change:status',(_0x4382f4,_0x573d6c,_0x3c96b8)=>{_0x9203a6['isEnabled']='pending'===_0x3c96b8,'accepted'===_0x3c96b8&&(_0x9203a6['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x9203a6['icon']=_0x4bf74a);}),_0x9203a6;}['_createDismissButtonView'](){const _0x1633b9=new Ht(this['locale']);return _0x1633b9['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x1633b9['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x29d489=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x29d489['stopPropagation']();})},'attributes':{'class':[ln,this['bindTemplate']['if']('status','ck-hidden',_0x30fc1a=>'pending'!==_0x30fc1a&&'rejected'!==_0x30fc1a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x2f81a3=>'pending'===_0x2f81a3),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x30c991=>'rejected'===_0x30c991)]}}),this['on']('change:status',(_0x2189b1,_0x554ed1,_0x4027ba)=>{_0x1633b9['isEnabled']='pending'===_0x4027ba,'rejected'===_0x4027ba&&(_0x1633b9['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x1633b9['icon']=_0x2c8364);}),_0x1633b9;}['_createInfoButtonView'](){const _0x1897d8=new Ht(this['locale']);return _0x1897d8['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x32d17f,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':ln+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1897d8['bind']('isOn')['to'](this,'isInfoToggleOn',_0x1e3818=>_0x1e3818),_0x1897d8['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1897d8;}['_createOutdatedButtonView'](){const _0x28422e=new Ht(this['locale']);return _0x28422e['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x25e1a5,'withText':!0x0,'isEnabled':!0x1}),_0x28422e['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x11c2e1=>'outdated'!==_0x11c2e1)],'disabled':'disabled'}}),_0x28422e;}},Ka=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x357a21,_0x30bc58){super(_0x357a21),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']()),_0x30bc58['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0xe66d6f){this['resultItemView']['changeId']=_0xe66d6f['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0xe66d6f['contentDiffed'];}['showBalloon'](_0x4c7e46,_0x522a33,_0x1ac10d,_0x2e9f3f,_0x5d07c6,_0x133fd7){const _0x315426=_0x522a33();if(!_0x315426)return;this['updateContent'](_0x4c7e46),this['show']();const _0x127178=Array['from'](_0x315426['getClientRects']())['reverse'](),_0xb28f06=this['_getPointedRectIndexFromEvent'](_0x1ac10d,_0x127178),_0x36155f=_0x127178[_0xb28f06??0x0];'click'===_0x2e9f3f?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x522a33(),_0xb28f06,_0x4c7e46['id'],_0x5d07c6,_0x133fd7)||_0x36155f})):'hover'===_0x2e9f3f&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x522a33(),_0xb28f06,_0x4c7e46['id'])||_0x36155f}));}['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'](){_0xf7c0ab({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x19ac13=[this['element']];return this['_pinnedTargetElement']&&_0x19ac13['push'](this['_pinnedTargetElement']),_0x19ac13;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x306598=new _0x5d2282();return this['resultItemView']=new Fa(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x306598['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']]}]}),_0x306598;}['_getBestRectPositionOnClick'](_0x3a635f,_0x411ff1,_0x571533,_0x23ad03,_0x1068e1){if(!_0x3a635f)return null;const _0x4e6370=this['position']['replace']('arrow_',''),_0x587d38=Array['from'](_0x3a635f['getClientRects']());let _0x34a92d,_0x44e298=_0x587d38['reverse']();return void 0x0!==_0x411ff1&&this['_isPinnedRectVisible'](_0x44e298[_0x411ff1],_0x23ad03,_0x1068e1)?(_0x34a92d=_0x44e298[_0x411ff1],this['_pinnedRectIndex']=_0x411ff1):this['_isPinnedRectVisible'](_0x44e298[0x0],_0x23ad03,_0x1068e1)&&void 0x0===_0x411ff1?_0x34a92d=_0x44e298[0x0]:(_0x44e298='s'==_0x4e6370[0x0]?[..._0x587d38]['reverse']():_0x587d38,_0x44e298['forEach'](_0x5f36b6=>{this['_isPinnedRectVisible'](_0x5f36b6,_0x23ad03,_0x1068e1)&&(_0x34a92d=_0x5f36b6);})),this['_pinnedTargetChangeId']=_0x571533,this['_pinnedTargetElement']=_0x3a635f,_0x34a92d||_0x3a635f['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x5317b9,_0x16f160,_0x53d54f){if(!_0x5317b9)return null;const _0x16967a=Array['from'](_0x5317b9['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x16f160&&this['_pinnedTargetChangeId']!==_0x53d54f?(this['_pinnedRectIndex']=_0x16f160,this['_pinnedTargetElement']=_0x5317b9,this['_pinnedTargetChangeId']=_0x53d54f,_0x16967a[_0x16f160]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x53d54f?_0x5317b9!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x16967a[this['_pinnedRectIndex']]:void 0x0!==_0x16f160&&this['_pinnedTargetChangeId']!==_0x53d54f?(this['_pinnedRectIndex']=_0x16f160,this['_pinnedTargetElement']=_0x5317b9,this['_pinnedTargetChangeId']=_0x53d54f,_0x16967a[_0x16f160]):_0x5317b9['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0xbae9f8,_0x1e7eab){if(_0xbae9f8)for(let _0x4006e6=0x0;_0x4006e6<_0x1e7eab['length'];_0x4006e6++){const _0x2ac8e4=_0x1e7eab[_0x4006e6];if(_0xbae9f8['clientX']>=_0x2ac8e4['left']-0x3&&_0xbae9f8['clientX']<=_0x2ac8e4['right']+0x3&&_0xbae9f8['clientY']>=_0x2ac8e4['top']-0x3&&_0xbae9f8['clientY']<=_0x2ac8e4['bottom']+0x3)return _0x4006e6;}}['_isPinnedRectVisible'](_0x444aba,_0x4b45c6,_0x88bf84){const _0x3443d6=new At(_0x444aba),_0x37851b=_0x4b45c6||document['documentElement'],_0x4c3cd8=_0x3443d6['getIntersection'](Et(_0x88bf84)),_0x4382f3=new At(_0x37851b)['getIntersection'](_0x3443d6);return!!(_0x4c3cd8&&_0x4382f3&&_0x3443d6['width']>0x0);}};const Wa=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Ya=class extends _0x10611c{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x412810){super(_0x412810),this['_bodyCollection']=dn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Wa)['to'](this),this['_balloonSuggestionView']=new Ka(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x22ebe3=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x22ebe3);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0xd9f2f2){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x1ef1bc=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0xd9f2f2,_0x1ef1bc);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x3ca062){_0x3ca062&&('error-general'!==_0x3ca062['status']?'error-chunk'!==_0x3ca062['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x359aa5){this['_mainView']['addCheckRunResult'](_0x359aa5);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x1fc147){this['_mainView']['showGeneralReviewCoreErrorView'](_0x1fc147??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x6d066a,_0x4ae951){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x6d066a,_0x4ae951);}['setActiveStateInResults'](_0x42705b){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0xd174ef=>{_0xd174ef['id']===_0x42705b&&_0xd174ef['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x241679=>_0x241679['setItemAsInactive']());}['updateChangeState'](_0x1a5901,_0x459112){'accepted'===_0x459112||'rejected'===_0x459112||'outdated'===_0x459112?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x1a5901,_0x459112):this['_mainView']['reviewCheckResultsView']['showResult'](_0x1a5901,_0x459112);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x59ee04,_0x30f48f,_0x182165,_0x590b6c,_0x393fec,_0x1414e5){this['_balloonSuggestionView']['showBalloon'](_0x59ee04,_0x30f48f,_0x182165,_0x590b6c,_0x393fec,_0x1414e5);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x23aeec){const _0x50d7b6=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x5756a0=>_0x5756a0['id']===_0x23aeec);return _0x50d7b6?_0x50d7b6['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},$a=class extends _0x5d2282{constructor(_0x25ee61){super(_0x25ee61),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x50f8bf=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x50f8bf['if']('isVisible','ck-hidden',_0x7bda=>!_0x7bda)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x50f8bf['to']('errorMessage')}]}]});}},qa=class extends _0x5d2282{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x4baf64,_0x40eb16){super(_0x4baf64),this['reviewCoreHeader']=_0x40eb16['header'],this['generalErrorView']=new $a(_0x4baf64),this['reviewCheckListView']=_0x40eb16['list'],this['reviewCheckListView']['delegate'](...Wa)['to'](this),this['reviewCheckResultsView']=_0x40eb16['results'],this['reviewCheckResultsView']['delegate'](...Wa)['to'](this),this['reviewCompletedView']=_0x40eb16['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'](_0x1c0b14){this['reviewCheckResultsView']['addResult'](_0x1c0b14),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'](_0x4e227e){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x4e227e;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},Qa=class extends Ht{constructor(_0x9148e7,_0x201312){super(_0x201312),this['set']({'label':_0x9148e7,'withText':!0x0,'class':hn}),this['on']('execute',()=>{this['fire']('finishReview');});}},Xa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x492e0e,_0x65304e){super(_0x492e0e),this['_contents']=_0x65304e,this['_resultViews']=new _0x3c6d3b(),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 Vo(_0x492e0e),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x47e730=this['_createCombinedSkeletonLoader'](),_0x2cf6c2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x2cf6c2['if']('isLoading','ck-ai_review__check-run_loading',_0x41a580=>_0x41a580),_0x2cf6c2['if']('isResultReady','ck-ai_review__check-run_ready',_0x5d9308=>_0x5d9308),_0x2cf6c2['if']('isVisible','ck-hidden',_0x43b9ea=>!_0x43b9ea)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x47e730,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x306e54){const _0x257a95=new Fa(this['locale'],_0x306e54['id']);_0x257a95['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x257a95),_0x257a95['resultResponseView']['element']['innerHTML']=_0x306e54['contentDiffed'];}['hideResult'](_0x4a7679,_0xd7b6c4){if('pending'===_0xd7b6c4)return;const _0x1cd19f=this['_resultViews']['find'](_0x2534dd=>_0x2534dd['id']===_0x4a7679);_0x1cd19f&&(_0x1cd19f['status']=_0xd7b6c4,_0x1cd19f['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x212da5,_0x167b5a){if('pending'!==_0x167b5a)return;const _0xfcfb61=this['_resultViews']['find'](_0x5a10e6=>_0x5a10e6['id']===_0x212da5);_0xfcfb61&&(_0xfcfb61['status']=_0x167b5a,_0xfcfb61['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x2252f0,_0x42b986){this['headerTitle']=_0x2252f0,this['headerSubtitle']=_0x42b986||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new zn(this['locale'],jn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x1cfa16=new _0x5d2282(this['locale']),_0x24b4b9=[];for(let _0xb87e06=0x0;_0xb87e06<0x10;_0xb87e06++){const _0x486c42=this['_createSkeletonLoader']();_0x486c42['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x24b4b9['push'](_0x486c42);}return _0x1cfa16['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x48e992=>!_0x48e992)]},'children':_0x24b4b9}),_0x1cfa16;}['_createResultsBodyView'](){const _0x7bb5f3=new _0x5d2282(this['locale']);return _0x7bb5f3['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x5e4241=>_0x5e4241)]},'children':this['_resultViews']}),_0x7bb5f3;}['_createErrorView'](){const _0x2c699f=new _0x5d2282(this['locale']),_0x4a774c=new Ht(this['locale']),t=this['locale']['t'];return _0x2c699f['delegate']('retryReview')['to'](this),_0x4a774c['set']({'label':t('Try\x20again'),'withText':!0x0,'class':cn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x4a774c['on']('execute',()=>{this['fire']('retryReview');}),_0x2c699f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x389860=>!_0x389860),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x1fa029=>'chunk'===_0x1fa029)]},'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',_0x30e9a0=>'chunk'===_0x30e9a0)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x462323=>'general'!==_0x462323)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2edf13=>'chunk'!==_0x2edf13)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x4a774c]}),_0x2c699f;}['_createCancelButtonView'](){const _0x338080=new Ht(this['locale']);return _0x338080['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[cn+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x338080['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4a5731=>_0x4a5731),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x43cacd=>_0x43cacd)]}}),_0x338080['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x338080;}['_createToggleDiffButtonView'](){const _0x2eddf5=new Ht(this['locale']);_0x2eddf5['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x2eddf5['bind']('isEnabled')['to'](this,'isError',_0x327f97=>!_0x327f97),_0x2eddf5['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x567ddc=>!_0x567ddc),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xdd078b=>_0xdd078b)]}});const _0x2b4017=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x303985=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x2eddf5['bind']('isOn')['to'](this,'isToggleDiffOn',_0x57502c=>_0x57502c),_0x2eddf5['bind']('icon')['to'](this,'isToggleDiffOn',_0x2d5d19=>_0x2d5d19?_0x30f129:_0x3f6024),_0x2eddf5['bind']('label')['to'](this,'isToggleDiffOn',_0x19d895=>_0x19d895?_0x2b4017:_0x303985),_0x2eddf5['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x2eddf5;}['_createAcceptAllButtonView'](){const _0x4d73bc=new Ht(this['locale']);return _0x4d73bc['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x4d73bc['bind']('isEnabled')['to'](this,'isError',_0xd2861a=>!_0xd2861a),_0x4d73bc['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x431971=>!_0x431971),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5b441e=>_0x5b441e)]}}),_0x4d73bc['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x4d73bc;}['_createExitReviewButtonView'](){const _0xff55c8=new Ht(this['locale']);return _0xff55c8['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0xff55c8['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x19d5c2=>!_0x19d5c2),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x35fda4=>_0x35fda4)]}}),_0xff55c8['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0xff55c8;}['_createResultHeaderView'](){const _0x5ed1e0=new _0x5d2282(this['locale']),_0x37c745=this['_createTitleView']();return _0x5ed1e0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x233e7c=>_0x233e7c)]},'children':[_0x37c745,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4cc952=>!_0x4cc952)],'title':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':us(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']]}]}),_0x5ed1e0;}['_createTitleView'](){const _0x1fcc72=new _0x5d2282(this['locale']),_0x580238=new lr();return _0x580238['bind']('isVisible')['to'](this,'isResultReady',_0x10c862=>!_0x10c862),_0x1fcc72['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x35b75a=>_0x35b75a)]},'children':[_0x580238,{'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')}]}]}]}),_0x1fcc72;}['_createFinishReviewButtonView'](){const _0x52be8c=new Qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x52be8c['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4e8f0a=>!_0x4e8f0a)]}}),_0x52be8c['delegate']('finishReview')['to'](this),_0x52be8c;}},za=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x54b4af,_0x40d309){super(_0x54b4af),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x40d309['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x40d309['headerText']);const _0x4a8d9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x4a8d9['if']('isVisible','ck-hidden',_0x50fd15=>!_0x50fd15)]},'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':_0x40d309['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x5d801f){const _0x450ed2=new Qa(_0x5d801f,this['locale']);return _0x450ed2['delegate']('finishReview')['to'](this),_0x450ed2;}['_createResultHeaderView'](_0x3beca8){const _0x158050=new _0x5d2282(this['locale']);return _0x158050['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x3beca8},'children':[{'text':_0x3beca8}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x158050;}},ja=class extends _0x5d2282{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0xcfe924,_0x52d2d7){super(_0xcfe924),this['_defaultValue']=_0x52d2d7['default']||(_0x52d2d7['data']['length']>0x0?_0x52d2d7['data'][0x0]['id']:''),this['_defaultLabel']=_0x52d2d7['data']['find'](_0x13e499=>_0x13e499['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x2959da(this['locale']);const _0x129df3=this['_prepareListOptions'](_0x52d2d7['data']);_0x5d9db0(this['_dropdownView'],_0x129df3,{'role':'menu','ariaLabel':_0x52d2d7['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2d1af8=>{_0x2d1af8['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x21dc77=>{this['formValue']=_0x21dc77['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x21dc77['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'](_0x38ac39=[]){const _0xf19544=new ct();this['resetToDefault']();for(const _0x43285d of _0x38ac39){const _0x4567a5=new _0x36985a({'label':_0x43285d['label'],'withText':!0x0,'role':'menuitemradio','id':_0x43285d['id'],'model':_0x43285d});_0x4567a5['bind']('isOn')['to'](this,'formValue',_0x3129c4=>_0x3129c4===_0x4567a5['id']);const _0x32fccd={'type':'button','model':_0x4567a5};_0xf19544['add'](_0x32fccd);}return _0xf19544;}},Ja=class extends zt{['_formItem']=null;constructor(_0x3aa0c6,_0x51ecfe,_0xc4a220){if(super(_0x3aa0c6),this['argsKey']=_0x51ecfe?.['argsKey'],'dropdown'===_0x51ecfe['formType'])this['_formItem']=new ja(this['locale'],_0x51ecfe);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x1f33dd=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0xc4a220?'ck-form__row_with-submit':'']});_0xc4a220&&_0x1f33dd['children']['add'](_0xc4a220),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x1f33dd]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Za=class AIReviewCorePromptInputView extends _0x68db3e{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x509380){super(_0x509380),this['set']('isEmpty',!0x0),this['keystrokes']=new _t(),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']);}},th=class extends _0x5d2282{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x3c6d3b();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0xeb382b,_0x4a7eeb,_0xe5f6a2=!0x1){super(_0xeb382b),this['_check']=_0x4a7eeb,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x4a7eeb['defaultModel']?_0x4a7eeb['defaultModel']['id']:'',this['_defaultLabel']=_0x4a7eeb['defaultModel']?_0x4a7eeb['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Za(_0xeb382b)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new ct(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0xe5f6a2),_0x5d9db0(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Kt(this['locale'],{'children':[this['promptInputView']]}),new Kt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x10e560,_0x223a84)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x223a84()):_0x223a84();}),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x6d0011=>{this['_focusables']['add'](_0x6d0011),this['focusTracker']['add'](_0x6d0011['element']);}),this['keystrokes']['listenTo'](this['element']);}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x15a864 of this['_getFormValidators']()){const _0x56420d=_0x15a864();if(_0x56420d)return this['promptInputView']['errorText']=_0x56420d,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return us(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x3dd2c1=new Ht(this['locale']),t=this['locale']['t'];return _0x3dd2c1['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x3dd2c1['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x3dd2c1;}['_createCancelButtonView'](){const _0x141018=new Ht(this['locale']),t=this['locale']['t'];return _0x141018['set']({'label':t('Cancel'),'withText':!0x0,'class':ln}),_0x141018['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2e393c=>{_0x2e393c['stopPropagation']();})}}),_0x141018['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x141018;}['_setModelList'](_0x123b22){this['_modelSelectionDropdownItems']['clear']();const _0x53a629=this['_check']['models'];if(_0x123b22)this['set']('modelDisplayMode','hidden');else{const _0x3e8dc4=0x1===_0x53a629['length'];this['set']('modelDisplayMode',_0x3e8dc4?'name':'selector');}if(this['resetToDefault'](),_0x53a629?.['length']){0x1===_0x53a629['length']&&this['set']('activeModelName',_0x53a629[0x0]['name']||_0x53a629[0x0]['id']);for(const _0x4a96c2 of _0x53a629){const _0x51994b=new _0x36985a({'label':_0x4a96c2['name'],'withText':!0x0,'role':'menuitemradio','id':_0x4a96c2['id'],'model':_0x4a96c2});_0x51994b['bind']('isOn')['to'](this,'modelId',_0x374ff0=>_0x374ff0===_0x4a96c2['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x51994b,'labelView':new ih(this['locale'],_0x4a96c2)});}}}['_createModelSelectionDropdown'](){const _0x20dd10=_0x2959da(this['locale']);return _0x20dd10['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x20dd10['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':ln}),_0x20dd10['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2ada4b=>'selector'===_0x2ada4b),this['listenTo'](_0x20dd10,'execute',_0x373ce9=>{this['modelId']=_0x373ce9['source']['model']['id'],_0x20dd10['buttonView']['label']=_0x373ce9['source']['label'];}),_0x20dd10;}['_createModelNameView'](){const _0x18cf87=new eh(this['locale']);return _0x18cf87['bind']('text')['to'](this,'activeModelName',_0x4e539a=>_0x4e539a??''),_0x18cf87['bind']('isVisible')['to'](this,'modelDisplayMode',_0xca614f=>'name'===_0xca614f),_0x18cf87;}['_createActionsFooterView'](){const _0x39f3bf=new _0x5d2282(this['locale']);return _0x39f3bf['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x39f3bf;}},eh=class extends _0x5d2282{constructor(_0x2d0ff7){super(_0x2d0ff7),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1a4952=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x1a4952['if']('isVisible','ck-hidden',_0x1ba579=>!_0x1ba579)]},'children':[{'text':_0x1a4952['to']('text')}]});}},ih=class extends Dt{constructor(_0x2b7ce7,_0x4c2795){super();const _0x56e850=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x56e850['to']('style'),'id':_0x56e850['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x56e850['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x4c2795['description']||'']}]}]});}},sh=class extends zt{['_formItemsCollection']=new _0x3c6d3b();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x3a2282,_0x2eb4f0,_0x3137f8,_0x3f7f08=!0x1){super(_0x3a2282),this['_hideModels']=_0x3f7f08,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x2eb4f0['isParameterized']);const _0x4ae354=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',_0x3ae625=>_0x3ae625),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x5305d4=>_0x5305d4)],'style':{'--ck-ai-review-check-list-item-index':_0x3137f8}},'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':_0x2eb4f0['title']}]},_0x4ae354]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x2eb4f0['description']?[{'text':_0x2eb4f0['description']}]:[]}]}]},..._0x2eb4f0['isParameterized']?[this['_createParameterizedView'](_0x2eb4f0)]:[],...'custom'===_0x2eb4f0['id']?[this['_createCustomView'](_0x2eb4f0,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x2eb4f0['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x2eb4f0['id'],'args':_0x2eb4f0['useArgs']?_0x2eb4f0['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0xf7c0ab({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x23550d=>{_0x23550d['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x59bc41=new Yt();return _0x59bc41['content']=_0x46b764,_0x59bc41['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x59bc41;}['_createParameterizedView'](_0x542b4d){const _0x97bdba=new _0x5d2282(),_0x46119a=this['_createFormView'](_0x542b4d);return _0x97bdba['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x17c48c=>!_0x17c48c)]},'children':[_0x46119a]}),_0x97bdba;}['_createFormView'](_0x501885){const _0x1a337f=new _0x5d2282(),_0x54a1e3=Array['isArray'](_0x501885['options'])?_0x501885['options']:[],_0x51108d=new Ht(this['locale']),t=this['locale']['t'];_0x51108d['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x51108d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4409cd=>{_0x4409cd['stopPropagation']();})}}),_0x51108d['on']('execute',()=>{const _0xfa8e12=[],_0x419970={};this['_formItemsCollection']['forEach'](_0x228dfc=>{_0xfa8e12['push'](_0x228dfc['value']),_0x501885['useArgs']&&_0x501885['options']&&(_0x419970[_0x228dfc['argsKey']]=_0x228dfc['value']);}),this['fire']('runReviewCheck',{'id':_0x501885['id'],'params':_0xfa8e12['length']?_0xfa8e12:void 0x0,'args':Object['keys'](_0x419970)['length']?_0x419970:void 0x0});});const _0x52d8dd=_0x54a1e3['length'];return _0x54a1e3['forEach']((_0x1e9a1d,_0xa3ad7f)=>{const _0x55c5f2=_0xa3ad7f===_0x52d8dd-0x1;this['_formItemsCollection']['add'](new Ja(this['locale'],_0x1e9a1d,_0x55c5f2?_0x51108d:null));}),_0x1a337f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x1a337f;}['_createCustomView'](_0x233fc9,_0x2b9db1=!0x1){return this['_customCheckView']=new th(this['locale'],_0x233fc9,_0x2b9db1),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',_0x292d1f=>!_0x292d1f)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x303516,_0x5c7d52,_0xafad11)=>{_0xafad11||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},nh=class extends zt{['_checkViews'];constructor(_0x3e44f9){super(_0x3e44f9),this['_checkViews']=new _0x3c6d3b(),this['_setupTemplate']();}['setChecks'](_0x179ac4,_0x180f33=!0x1){this['_checkViews']['clear']();for(const [_0xd28c71,_0x276655]of _0x179ac4['entries']()){const _0x4684a4=new sh(this['locale'],_0x276655,_0xd28c71,_0x180f33);_0x4684a4['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x4684a4);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x90ce7e of this['_checkViews'])_0x90ce7e instanceof sh&&_0x90ce7e['resetToDefault']();}['_setupTemplate'](){const _0x1d36e2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1d36e2['if']('isVisible','ck-hidden',_0x4cd067=>!_0x4cd067)]},'children':this['_checkViews']});}},rh=class extends Ya{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x458147=this['context']['plugins']['get']('AITabs'),_0x294dc8=this['context']['locale'],_0x525410=new Mo(_0x294dc8,{'label':us(_0x294dc8,'AI_REVIEW_MODE'),'icon':_0x247464,'class':'ck-ai-header_review','showResizeButton':_0x458147['showResizeButton']});return _0x525410['delegate']('resizeTabs')['to'](_0x458147),_0x525410['bind']('isMaximized')['to'](_0x458147['view'],'isMaximized',_0x4b866f=>_0x4b866f),new qa(this['context']['locale'],{'header':_0x525410,'list':new nh(_0x294dc8),'results':new Xa(_0x294dc8,{'generalErrorText':us(_0x294dc8,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x294dc8,{'headerText':us(_0x294dc8,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x294dc8,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x294dc8,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x4cfd52=this['context']['plugins']['get']('AITabs');_0x4cfd52['view']['on']('activateTab',(_0x2df31c,{newTab:_0x158782,oldTab:_0x189614})=>{'reviewMode'===_0x158782?this['fire']('getReviewCheckList'):'reviewMode'===_0x189614&&this['fire']('leaveReview');}),_0x4cfd52['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x247464,'order':0x0,'content':this['_mainView']});}};const oh='review-',ah=['softBreak'],hh=['htmlScript','htmlStyle','htmlCustomElement'];var ch=class extends _0x10611c{static get['requires'](){return[_0x22fa17,Is];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x1b2cca){super(_0x1b2cca),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x5580da=_0x1adcd6=>this['_scheduleAttachReviewEditingToEditor'](_0x1adcd6);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1bce0a)return void _0x5580da(this['context']);const _0x31dd3a=this['context'];for(const _0xcd9c16 of _0x31dd3a['editors'])_0x5580da(_0xcd9c16);this['listenTo'](_0x31dd3a['editors'],'add',(_0x580650,_0x129e8b)=>{_0x5580da(_0x129e8b);}),this['listenTo'](_0x31dd3a['editors'],'remove',(_0x1da621,_0x407bd0)=>{for(const [_0xb4ade7,_0x821051]of this['_markers'])_0x821051['editor']===_0x407bd0&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xb4ade7,'changeId':_0x821051['groupId']}),this['_markers']['delete'](_0xb4ade7));});}['_scheduleAttachReviewEditingToEditor'](_0x4e9610){const _0xf479d7=()=>{'destroyed'!==_0x4e9610['state']&&_0x4e9610['conversion']&&this['_attachReviewEditingToEditor'](_0x4e9610);};if('ready'===_0x4e9610['state'])return void _0xf479d7();const _0x1dba3e=()=>{this['stopListening'](_0x4e9610,'ready',_0x1dba3e),_0xf479d7();};this['listenTo'](_0x4e9610,'ready',_0x1dba3e);}['_attachReviewEditingToEditor'](_0x57c35e){this['_reviewEditingAttachedEditors']['has'](_0x57c35e)||(_0x57c35e['conversion']['for']('editingDowncast')['markerToElement']({'model':oh+'insert','view':(_0x57a075,{writer:_0x1f0faf})=>{const _0x5f3ba0=this['_markers']['get'](_0x57a075['markerName']),_0xc11bc3={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x5f3ba0?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x57a075['markerName']};return _0x1f0faf['createUIElement']('span',_0xc11bc3,function(_0x1be3ba){const _0x2982dd=this['toDomElement'](_0x1be3ba);return _0x2982dd['innerHTML']=_0x5f3ba0?.['content']?.['asString']||'',_0x2982dd;});}}),_0x57c35e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-only','view':_0x1f6feb=>{const _0x3e734e=this['_markers']['get'](_0x1f6feb['markerName']),_0x170c9b=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x3e734e?.['id']||'')&&_0x170c9b['push']('ck-ai_review__change_active'),{'classes':_0x170c9b,'attributes':{'data-marker-id':_0x1f6feb['markerName']}};}}),_0x57c35e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-context','view':_0x143c74=>{const _0x138818=this['_markers']['get'](_0x143c74['markerName']),_0x1cc4b1=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x138818?.['id']||'')&&_0x1cc4b1['push']('ck-ai_review__change_active'),{'classes':_0x1cc4b1,'attributes':{'data-marker-id':_0x143c74['markerName']}};}}),_0x57c35e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-text','view':_0x31962f=>{const _0x330269=this['_markers']['get'](_0x31962f['markerName']),_0x979ffc=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x330269?.['id']||'')&&_0x979ffc['push']('ck-ai_review__change_active'),{'classes':_0x979ffc,'attributes':{'data-marker-id':_0x31962f['markerName']}};}}),_0x57c35e['conversion']['for']('dataDowncast')['markerToElement']({'model':oh+'suggestion-context','view':(_0x11f968,{writer:_0x553c71})=>_0x553c71['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x11f968['isOpening']?'start':'end')})}),_0x57c35e['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x445414,'view':_0x1e7972}),this['_updateMouseMarkerInteractionListeners'](_0x57c35e),this['listenTo'](_0x57c35e,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x57c35e),{'priority':'lowest'}),this['listenTo'](_0x57c35e,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x57c35e),{'priority':'lowest'}),_0x57c35e['model']['document']['registerPostFixer'](_0x572278=>this['_validateMarkers'](_0x57c35e,_0x572278)),_0x57c35e['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x57c35e)),this['_reviewEditingAttachedEditors']['add'](_0x57c35e));}['_updateMouseMarkerInteractionListeners'](_0x2ea431){let _0x4859c3=this['_boundEditables']['get'](_0x2ea431);_0x4859c3||(_0x4859c3=new Map(),this['_boundEditables']['set'](_0x2ea431,_0x4859c3));const _0x9cba66=new Set(_0x2ea431['ui']['getEditableElementsNames']());for(const _0x127c9a of _0x9cba66){if(_0x4859c3['has'](_0x127c9a))continue;const _0x77bf4f=_0x2ea431['ui']['getEditableElement'](_0x127c9a);_0x4859c3['set'](_0x127c9a,_0x77bf4f),this['_attachMouseMarkerInteractionListeners'](_0x77bf4f);}for(const [_0x36f27a,_0x934dac]of _0x4859c3)_0x9cba66['has'](_0x36f27a)||(_0x4859c3['delete'](_0x36f27a),this['_domEmitter']['stopListening'](_0x934dac));}['_attachMouseMarkerInteractionListeners'](_0x1473b6){this['_domEmitter']['listenTo'](_0x1473b6,'mouseup',(_0x25f14c,_0xeb7dd2)=>{const _0xf58dc5=_0xeb7dd2['target'],_0x286c67=this['_findMarkerElement'](_0xf58dc5);if(!_0x286c67)return;const _0x3b1b54=_0x286c67['getAttribute']('data-marker-id'),_0x18b72c=_0x3b1b54['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x3b1b54,'changeId':_0x18b72c,'markerElement':()=>this['_findMarkerElementById'](_0x3b1b54),'domEvent':_0xeb7dd2});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1473b6,'mouseover',(_0x39d587,_0x1d620f)=>{const _0x475d71=_0x1d620f['target'],_0x30ce87=_0x1d620f['relatedTarget'];let _0x22c379=this['_findMarkerElement'](_0x475d71);if(!_0x22c379&&_0x30ce87&&(_0x22c379=this['_findMarkerElement'](_0x30ce87)),!_0x22c379)return;const _0x2e7693=_0x22c379['getAttribute']('data-marker-id'),_0x2086cd=_0x2e7693['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x2086cd,'markerElement':()=>this['_findMarkerElementById'](_0x2e7693),'domEvent':_0x1d620f});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x3d5a0c((_0x2bb2d7,_0x3d6a9c)=>{const _0x2a466c=_0x3d6a9c['target'];this['_findMarkerElement'](_0x2a466c)||_0x2a466c['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x54fc59=this['context']['plugins']['get']('AIEditing'),_0x4f4522=ds(this['context']);if(!_0x4f4522['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0xc26e94=new Set(),_0x4f4103=[],_0x28352f=new Map();for(const _0x3486fe of _0x4f4522)for(const _0x338c62 of _0x3486fe['model']['document']['getRoots']()){if('$graveyard'===_0x338c62['rootName'])continue;const _0xf72e5e=this['_buildDocumentDataSliceForRoot'](_0x3486fe,_0x338c62,_0x54fc59,_0xc26e94);_0x4f4103['push'](_0xf72e5e['content']);for(const [_0xdd0eb3,_0xfc8a4e]of _0xf72e5e['elements'])_0x28352f['set'](_0xdd0eb3,_0xfc8a4e);}return{'elements':_0x28352f,'content':_0x4f4103['join']('')};}['_buildDocumentDataSliceForRoot'](_0x49896b,_0x46f26d,_0x5aaf5e,_0xc0172e){const _0x4bed51=_0x49896b['model'],_0xb76ce1=new _0x3f99b4();for(const _0x170f33 of _0x46f26d['getChildren']())_0xb76ce1['_appendChild'](_0x170f33['_clone'](!0x0));for(const _0x4a1bdb of _0x4bed51['markers']){const _0x33f702=_0x4a1bdb['getRange']();_0x33f702&&_0x33f702['root']['rootName']===_0x46f26d['rootName']&&_0xb76ce1['markers']['set'](_0x4a1bdb['name'],this['_changeRangeOwnerDocument'](_0x33f702['clone'](),_0xb76ce1));}const _0x2fa893=new Map(),_0x274c7b=_0x4bed51['document']['version'],_0x4876a2=new _0x81b4df({'ignoreElementEnd':!0x0,'startPosition':_0x4bed51['createPositionAt'](_0xb76ce1,0x0)});for(const {item:_0x11380c}of _0x4876a2){if(_0x11380c['is']('element')&&_0x11380c['name']&&hh['includes'](_0x11380c['name'])){const _0x36bc35=this['_upsertDataId'](_0x11380c,()=>_0x5aaf5e['_nextDataId'](_0xc0172e));_0xc0172e['add'](_0x36bc35);}if(!_0x11380c['is']('$textProxy'))continue;const _0xf689db=_0x11380c['parent'];if(!_0xf689db||!_0xf689db['is']('element'))continue;const _0x5ee44e=this['_upsertDataId'](_0xf689db,()=>_0x5aaf5e['_nextDataId'](_0xc0172e));_0xc0172e['add'](_0x5ee44e);for(const _0x4628fc of _0xf689db['getChildren']())_0x4628fc['is']('element')&&(_0x4628fc['name']&&ah['includes'](_0x4628fc['name'])||_0xc0172e['add'](this['_upsertDataId'](_0x4628fc,()=>_0x5aaf5e['_nextDataId'](_0xc0172e))));let _0x38d92c=_0xf689db;for(;_0x38d92c['parent']&&!_0x38d92c['parent']['is']('documentFragment');)_0x38d92c=_0x38d92c['parent'],_0x38d92c['hasAttribute'](_0x445414)&&_0x38d92c['_removeAttribute'](_0x445414);_0x2fa893['set'](_0x5ee44e,{'editor':_0x49896b,'rootName':_0x46f26d['rootName'],'path':_0xf689db['getPath'](),'documentVersion':_0x274c7b,'getContent':this['_createGetContentUsingDataIdFn'](_0x38d92c['_clone'](!0x0),_0x5ee44e,_0x49896b['data'])}),_0x4876a2['jumpTo'](_0x4bed51['createPositionAfter'](_0xf689db));}return{'content':_0x49896b['data']['processor']['toData'](_0x49896b['data']['toView'](_0xb76ce1)),'elements':_0x2fa893};}['diffContent'](_0x5966cb,_0x369f41,_0x2e3f61,_0x43c25e=!0x1){const {contentInitial:_0x35a3be,contentNew:_0x2134c6}=this['_neutralizeChangesOnUnsupportedElements'](_0x369f41,_0x2e3f61),_0x2c06c7=[],_0x37b866=_0x5966cb['data']['parse'](_0x2134c6,'$documentFragment'),_0x59c45f=_0x5966cb['data']['parse'](_0x35a3be,'$documentFragment'),_0x31c09c=_0x5966cb['model']['createPositionAt'](_0x59c45f,0x0);if(this['_haveSingleTopLevelElement'](_0x37b866)){if(!this['_hasSameTopLevelElement'](_0x59c45f,_0x37b866))return _0x2c06c7;}else{const _0x44e6b7=_0x5966cb['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x59c45f,_0x44e6b7)||!this['_haveOnlyInlineContent'](_0x37b866,_0x44e6b7))return _0x2c06c7;}const _0x2cfc3c=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x35a3be,_0x2134c6,{'targetEditor':_0x5966cb,'anchor':_0x31c09c,'markDeletions':!0x0})['getOperations']()['filter'](_0x4f8cae=>'insert'===_0x4f8cae['type']||'marker'===_0x4f8cae['type']&&_0x4f8cae['name']['startsWith']('$markedRemove')),_0xe3593b=this['_groupAdjacentOperations'](_0x2cfc3c),_0x276f9b=[];if(_0x43c25e){if(_0xe3593b['length']){const _0x4a6d3a=_0xe3593b[0x0]['operations'][0x0],_0x2c51a9='insert'===_0x4a6d3a['type']?_0x4a6d3a['position']:_0x4a6d3a['newRange']['start'],_0x46f203=this['_getPositionLimitingRange'](_0x2c51a9,_0x5966cb,'inside'),_0x2eba0f=_0x46f203?_0x37b866['getChild'](0x0)['getChildren']():_0x37b866['getChildren'](),_0x2cbb1a=_0x46f203||_0x5966cb['model']['createRangeIn'](_0x59c45f),_0x3bb2e8=[new _0x4a02b7('$markedRemove:synthetic'+vt(),null,_0x2cbb1a,_0x5966cb['model']['document']['model']['markers'],!0x0,_0x5966cb['model']['document']['version']+0x1),new _0x5cbae7(_0x2cbb1a['end'],_0x2eba0f,_0x5966cb['model']['document']['version']+0x2)];_0x276f9b['push']({'operations':_0x3bb2e8,'operationsIsolated':_0x3bb2e8,'groupOffset':0x0});}}else _0x276f9b['push'](..._0xe3593b);let _0x362636=0x0;return _0x5966cb['model']['change'](_0xc9808=>{for(let _0x312438=0x0;_0x312438<_0x276f9b['length'];_0x312438++){const _0x3d60db=_0x276f9b[_0x312438],_0x2b31d7=_0xc9808['createDocumentFragment']();for(const _0x538cf2 of _0x59c45f['getChildren']())_0xc9808['append'](_0x538cf2['_clone'](!0x0),_0x2b31d7);for(const _0x1735b1 of _0x3d60db['operationsIsolated'])if('insert'===_0x1735b1['type']){const _0x42100c=_0x1735b1;_0x42100c['baseVersion']=null,_0x42100c['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x42100c,_0x2b31d7),_0xc9808['batch']['addOperation'](_0x1735b1),_0x5966cb['model']['applyOperation'](_0x1735b1);const _0x51943d='suggestion:insertion:id:authorId:'+_0x362636++,_0x4f6232=_0x5966cb['model']['createRange'](_0x42100c['position'],_0x42100c['position']['getShiftedBy'](_0x42100c['howMany']));_0x2b31d7['markers']['set'](_0x51943d,_0x4f6232);}else{if('marker'===_0x1735b1['type']&&_0x1735b1['name']['startsWith']('$markedRemove')){const _0x139e46=_0x1735b1,_0x508e92='suggestion:deletion:id:authorId:'+_0x362636++;this['_changeOperationOwnerDocument'](_0x139e46,_0x2b31d7),_0x2b31d7['markers']['set'](_0x508e92,_0x139e46['newRange']);}}if(_0x43c25e)_0x2c06c7['push']({..._0x3d60db,'context':this['_createGetContentFn'](_0x59c45f,_0x5966cb['data']),'content':this['_createGetContentFn'](_0x59c45f,_0x5966cb['data'])});else{const _0x291456=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x3d60db['operationsIsolated'][0x0]),_0x2b31d7),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x3d60db['operationsIsolated'][_0x3d60db['operationsIsolated']['length']-0x1]),_0x2b31d7),_0x5966cb);_0x2b31d7['markers']['set'](oh+'suggestion-context',new _0x2993a5(_0x291456['start'],_0x291456['end'])),_0x2c06c7['push']({..._0x3d60db,'context':this['_createGetContextFn'](_0x2b31d7,_0x5966cb['data'],{'ellipsisBefore':_0x291456['hasContentBefore'],'ellipsisAfter':_0x291456['hasContentAfter']}),'content':this['_createGetContentFn'](_0x2b31d7,_0x5966cb['data'])});}}}),_0x2c06c7;}['markChangePositionInEditorContent'](_0x553ed8,_0x5a92ec){if(!_0x553ed8['length'])return;const _0x113660=_0x553ed8[0x0]['parent']['id'],_0x5969f0=_0x5a92ec['elements']['get'](_0x113660);if(!_0x5969f0)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x113660);const _0x287bdf=_0x5969f0['path'],_0x4ba4f7=_0x5969f0['editor'],_0xe7368e=_0x4ba4f7['model']['document']['getRoot'](_0x5969f0['rootName']);if(!_0xe7368e)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x5969f0['rootName']);const _0x2dc641=_0x4ba4f7['model']['document']['history']['getOperations'](_0x5969f0['documentVersion']),_0x472997=[];for(const _0x759e9c of _0x553ed8){const _0x832ed=_0x759e9c['operationsIsolated']['map'](_0x35c8b9=>this['_translateOperationToEditorContent'](_0x35c8b9,_0x287bdf,_0xe7368e));if(!_0x832ed||!_0x832ed['length'])continue;const _0x53bcaa=_0x832ed['every'](_0x2ae876=>'marker'===_0x2ae876['type']&&_0x2ae876['name']['startsWith']('$markedRemove')),_0x59e387=_0x4506be(_0x832ed,_0x2dc641,{'document':_0x4ba4f7['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0xda8820 of _0x59e387)if('insert'===_0xda8820['type']){const _0x4ff93d=_0xda8820,_0x59e1be=_0x4ff93d['nodes'];_0x4ba4f7['model']['change'](_0x4f2f9d=>{const _0x1ecbf1=_0x4f2f9d['createDocumentFragment']();for(const _0xa2a03a of _0x59e1be)_0x4f2f9d['append'](_0xa2a03a['_clone'](!0x0),_0x1ecbf1);_0x472997['push']({'start':_0x4ff93d['position'],'end':_0x4ff93d['position'],'type':'insert','groupId':_0x759e9c['id'],'content':{'asString':this['_createGetContentFn'](_0x1ecbf1,_0x4ba4f7['data'])(),'asFragment':_0x1ecbf1}});});}else{if('marker'===_0xda8820['type']&&_0xda8820['name']['startsWith']('$markedRemove')){const _0x2300ca=_0xda8820;let _0x2b4558='remove-text';if(_0x53bcaa){const _0x1aa07a=this['_findAdjacentContextDistance'](_0x2300ca['newRange']['start'],'backward',_0x4ba4f7['model']['schema']),_0x54ee1d=this['_findAdjacentContextDistance'](_0x2300ca['newRange']['end'],'forward',_0x4ba4f7['model']['schema']);if(_0x1aa07a||_0x54ee1d){const _0xee16fd=_0x2300ca['newRange']['start']['getShiftedBy'](-_0x1aa07a),_0x582403=_0x2300ca['newRange']['end']['getShiftedBy'](_0x54ee1d);_0x472997['push']({'start':_0xee16fd,'end':_0x582403,'groupId':_0x759e9c['id'],'type':'remove-context'});}else _0x2b4558='remove-only';}_0x472997['push']({'start':_0x2300ca['newRange']['start'],'end':_0x2300ca['newRange']['end'],'groupId':_0x759e9c['id'],'type':_0x2b4558});}}}this['_insertMarkers'](_0x472997,_0x4ba4f7);}['clearAllMarkers'](){const _0x442970=new Map();for(const _0x33c52c of this['_markers']['keys']()){const _0x214c02=this['_markers']['get'](_0x33c52c);_0x214c02?.['editor']&&(_0x442970['has'](_0x214c02['editor'])||_0x442970['set'](_0x214c02['editor'],[]),_0x442970['get'](_0x214c02['editor'])['push'](_0x33c52c));}for(const [_0x4e4cc5,_0x1dda21]of _0x442970)_0x4e4cc5['model']['change'](_0xf878b5=>{for(const _0x3cb855 of _0x1dda21)_0x4e4cc5['model']['markers']['get'](_0x3cb855)&&_0xf878b5['removeMarker'](_0x3cb855);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x2173a4 of ds(this['context']))_0x2173a4['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x26d59f of ds(this['context']))_0x26d59f['disableReadOnlyMode']('ai-review');}['applyChange'](_0xe2283c,_0x2f3db0=null){const _0x5dfbbe=_0xe2283c['map'](_0x14c644=>this['_getMarkersDataForGroup'](_0x14c644))['flat'](),_0x3f8d08=new Map();for(const _0x5b73f0 of _0x5dfbbe)_0x3f8d08['has'](_0x5b73f0['editor'])||_0x3f8d08['set'](_0x5b73f0['editor'],[]),_0x3f8d08['get'](_0x5b73f0['editor'])['push'](_0x5b73f0);for(const [_0x460eb9,_0x424471]of _0x3f8d08){const _0x6c3478=_0x460eb9['model'],_0x380165=_0x460eb9['plugins']['has']('TrackChangesEditing')?_0x460eb9['plugins']['get']('TrackChangesEditing'):null,_0x14767e=_0x2f3db0&&_0x380165?new Set(_0x380165['getSuggestions']()['map'](_0x67638=>_0x67638['id'])):null;_0x6c3478['change'](_0x394f2d=>{const _0x383f8e=_0x394f2d['batch']['operations']['length'];for(const _0x2c007b of _0x424471){const _0x34486c=_0x460eb9['model']['markers']['get'](_0x2c007b['id']);if(_0x34486c){if('insert'===_0x2c007b['type']){if(!_0x2c007b['content'])continue;_0x6c3478['insertContent'](_0x2c007b['content']['asFragment']||null,_0x34486c['getRange']()['start']);}else'remove-text'!==_0x2c007b['type']&&'remove-only'!==_0x2c007b['type']||_0x6c3478['deleteContent'](_0x6c3478['createSelection'](_0x34486c['getRange']()));_0x394f2d['removeMarker'](_0x2c007b['id']),this['_markers']['delete'](_0x2c007b['id']);}}if(_0x2f3db0&&(Js(_0x394f2d['batch']['operations']['slice'](_0x383f8e),_0x2f3db0),_0x380165)){for(const _0x471ddc of _0x380165['getSuggestions']())_0x14767e['has'](_0x471ddc['id'])||_0x471ddc['setAttribute']('@ai',{'type':_0x2f3db0});}});}}['rejectChange'](_0x326029){const _0x26d84b=this['_getMarkersDataForGroup'](_0x326029),_0x44818b=new Map();for(const _0x3e8baa of _0x26d84b)_0x44818b['has'](_0x3e8baa['editor'])||_0x44818b['set'](_0x3e8baa['editor'],[]),_0x44818b['get'](_0x3e8baa['editor'])['push'](_0x3e8baa);for(const [_0x3994e5,_0x11fed6]of _0x44818b)_0x3994e5['model']['change'](_0x328f83=>{for(const _0x462d9f of _0x11fed6)_0x328f83['removeMarker'](_0x462d9f['id']),this['_markers']['delete'](_0x462d9f['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x29c3b4){return this['_getMarkersDataForGroup'](_0x29c3b4)[0x0]?.['editor'];}['getMarkerElementForChange'](_0xdcc52f){const _0x5b2175=Array['from'](this['_markers']['values']())['filter'](_0x3dd61f=>_0x3dd61f['groupId']===_0xdcc52f);if(!_0x5b2175['length'])return null;const _0x222cad=0x1===_0x5b2175['length']?_0x5b2175[0x0]:this['_sortMarkers'](_0x5b2175)[0x0],_0x240c00=_0x222cad['editor']['model']['markers']['get'](_0x222cad['id']);return _0x240c00?{'modelRange':_0x240c00['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x222cad['id'])}:null;}['getContentElementForChange'](_0x20e700){const _0x4c12bc=Array['from'](this['_markers']['values']())['filter'](_0x459a02=>_0x459a02['groupId']===_0x20e700);if(!_0x4c12bc['length'])return null;const _0x550b0e=0x1===_0x4c12bc['length']?_0x4c12bc[0x0]:this['_sortMarkers'](_0x4c12bc)[0x0],_0x242b35=_0x550b0e['editor'],_0x1939fe=_0x242b35['model']['markers']['get'](_0x550b0e['id']);if(!_0x1939fe)return null;const _0xf9f45e=_0x1939fe['getRange'](),_0x886cf4=_0x242b35['editing']['view']['getDomRoot'](_0xf9f45e['root']['rootName'])||_0x242b35['editing']['view']['getDomRoot']();if(!_0x886cf4||!_0xf9f45e)return null;let _0x5668df=_0xf9f45e['start']['parent'];for(;_0x5668df['parent']&&!_0x5668df['parent']['is']('rootElement');)_0x5668df=_0x5668df['parent'];if(!_0x5668df||!_0x5668df['name'])return null;const _0x5817bb=_0x886cf4['querySelector']('[data-marker-id=\x22'+_0x550b0e['id']+'\x22]');if(!_0x5817bb)return null;let _0x40ac0d=null;_0x242b35['model']['change'](_0x26ed21=>{_0x40ac0d=_0x26ed21['createDocumentFragment'](),_0x26ed21['append'](_0x5668df['_clone'](!0x0),_0x40ac0d);});const _0x1705cd=_0x242b35['data']['toView'](_0x40ac0d)['getChild'](0x0);return _0x5817bb['closest'](_0x1705cd['name']);}['reactivateMarkers'](_0x3d6e68){const _0x3852e4=this['_getMarkersDataForGroup'](_0x3d6e68);if(!_0x3852e4['length'])return;const _0x5a036f=Array['from'](this['_activeMarkers'])['sort'](),_0x543bbd=Array['from'](new Set(_0x3852e4['map'](_0x5e38e5=>_0x5e38e5['id'])))['sort']();_0x5a036f['join']('|')!==_0x543bbd['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x3d6e68));}['setMarkersInElementAsActive'](_0x272b49){const _0x2e32de=this['_getMarkersDataForGroup'](_0x272b49);if(!_0x2e32de['length'])return;const _0x262406=_0x2e32de[0x0]['editor'],_0x304416=new Set(_0x2e32de['map'](_0x4accf8=>_0x4accf8['id'])),_0x114e99=Array['from'](_0x304416['values']())['map'](_0x5cc785=>_0x262406['model']['markers']['get'](_0x5cc785))['filter'](_0x114afc=>!!_0x114afc);_0x304416['forEach'](_0x12f936=>{this['_activeMarkers']['add'](_0x12f936);}),_0x262406['model']['change'](()=>{_0x114e99['forEach'](_0x545d25=>{_0x262406['editing']['reconvertMarker'](_0x545d25);});});}['setAllMarkersAsInactive'](){const _0x4c7cb1=Array['from'](this['_activeMarkers']);if(!_0x4c7cb1['length'])return;this['_activeMarkers']['clear']();const _0x21d68d=new Map();for(const _0x34e114 of _0x4c7cb1){const _0x39c879=this['_markers']['get'](_0x34e114);if(!_0x39c879)continue;const _0x1dc334=_0x39c879['editor'],_0x3cfc34=_0x1dc334['model']['markers']['get'](_0x34e114);_0x3cfc34&&(_0x21d68d['has'](_0x1dc334)||_0x21d68d['set'](_0x1dc334,[]),_0x21d68d['get'](_0x1dc334)['push'](_0x3cfc34));}for(const [_0x4e06dc,_0xa191b3]of _0x21d68d)_0x4e06dc['model']['change'](()=>{_0xa191b3['forEach'](_0x5145a6=>{_0x4e06dc['editing']['reconvertMarker'](_0x5145a6);});});}['_getPositionLimitingRange'](_0x32d4c2,_0x2479e1,_0x322846='outside'){if(!_0x32d4c2)return null;let _0x13b150=_0x32d4c2['parent'];for(;_0x13b150&&_0x13b150['parent']&&!_0x13b150['parent']['is']('rootElement')&&!_0x2479e1['model']['schema']['isLimit'](_0x13b150)&&!_0x2479e1['model']['schema']['isBlock'](_0x13b150);)_0x13b150=_0x13b150['parent'];if(!_0x13b150||!_0x13b150['name']||_0x13b150['is']('rootElement'))return null;let _0x153de8=null;return _0x2479e1['model']['change'](_0x5b079=>{_0x153de8='inside'===_0x322846?_0x5b079['createRangeIn'](_0x13b150):_0x5b079['createRangeOn'](_0x13b150);}),_0x153de8;}['_validateMarkers'](_0x1004d9,_0x39e8b5){const _0x1387a6=Array['from'](this['_markers']['keys']()),_0x48b169=new Map();for(const _0x36941d of _0x1387a6){const _0x1f340e=_0x1004d9['model']['markers']['get'](_0x36941d);if(!_0x1f340e)continue;const _0x5b0f16=_0x1f340e['getStart']()['root']['rootName']+':'+_0x1f340e['getStart']()['path'][0x0];_0x48b169['has'](_0x5b0f16)||_0x48b169['set'](_0x5b0f16,[]),_0x48b169['get'](_0x5b0f16)['push'](_0x1f340e);}const _0xb809f3=new Set();for(const _0xb86311 of _0x1004d9['model']['document']['differ']['getChanges']()){let _0x1aa271='',_0x55abb1=null;if('insert'===_0xb86311['type'])_0x55abb1=new _0x2993a5(_0xb86311['position'],_0xb86311['position']['getShiftedBy'](_0xb86311['length'])),_0x1aa271=_0xb86311['position']['root']['rootName']+':'+_0xb86311['position']['path'][0x0];else{if('remove'!==_0xb86311['type'])continue;_0x55abb1=new _0x2993a5(_0xb86311['position']),_0x1aa271=_0xb86311['position']['root']['rootName']+':'+_0xb86311['position']['path'][0x0];}const _0x5a97f9=_0x48b169['get'](_0x1aa271)||[];if(_0x5a97f9['length']){for(const _0x2e5e8c of _0x5a97f9)if(_0x55abb1['root']['rootName']===_0x2e5e8c['getRange']()['root']['rootName']&&('insert'!==_0xb86311['type']||!_0x55abb1['containsRange'](_0x2e5e8c['getRange']()))&&(_0x55abb1['isIntersecting'](_0x2e5e8c['getRange']())||_0x55abb1['start']['isTouching'](_0x2e5e8c['getRange']()['end'])||_0x55abb1['end']['isTouching'](_0x2e5e8c['getRange']()['start']))){const _0x321768=this['_parseMarkerName'](_0x2e5e8c['name']);Array['from'](this['_markers']['values']())['filter'](_0x3bec2b=>_0x3bec2b['groupId']===_0x321768['groupId'])['forEach'](_0x4b6acd=>_0xb809f3['add'](_0x4b6acd['id']));}}}if(_0xb809f3['size']){for(const _0x11353d of _0xb809f3)_0x39e8b5['removeMarker'](_0x11353d);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0xaedb9f){for(const {name:_0x470443,data:_0x4af271}of _0xaedb9f['model']['document']['differ']['getChangedMarkers']()){if(!_0x470443['startsWith'](oh))continue;const _0x4948ee=_0x4af271['oldRange'],_0x1edd13=_0x4af271['newRange'],_0x3c9077=_0x4948ee&&'$graveyard'===_0x4948ee['root']['rootName'],_0x159560=_0x1edd13&&'$graveyard'===_0x1edd13['root']['rootName'];if(_0x3c9077&&_0x159560)continue;const _0x4a6a3d=this['_parseMarkerName'](_0x470443);this['_markers']['get'](_0x470443)&&(_0x159560||!_0x1edd13?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x470443,'changeId':_0x4a6a3d['groupId']}):_0x3c9077&&_0x1edd13&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x470443,'changeId':_0x4a6a3d['groupId']}));}}['_parseMarkerName'](_0x35afae){const _0x15f03d=_0x35afae['split'](':'),_0x113923=(_0x15f03d[0x1]||'')['split']('_');return{'prefix':_0x15f03d[0x0],'groupId':_0x113923[0x0],'suffix':_0x113923[0x1]};}['_translateOperationToEditorContent'](_0x52f33d,_0x5cbbf3,_0x72a02d){if('insert'===_0x52f33d['type']){const _0x434575=_0x52f33d;return new _0x5cbae7(this['_changePosition'](_0x5cbbf3['concat'](_0x434575['position']['offset']),_0x72a02d),_0x434575['nodes'],_0x434575['baseVersion']);}if('marker'===_0x52f33d['type']&&_0x52f33d['name']['startsWith']('$markedRemove')){const _0x329f93=_0x52f33d;return new _0x4a02b7(_0x329f93['name'],_0x329f93['oldRange'],this['_changeRange'](_0x329f93['newRange'],_0x5cbbf3['concat'](_0x329f93['newRange']['start']['offset']),_0x5cbbf3['concat'](_0x329f93['newRange']['end']['offset']),_0x72a02d),_0x329f93['_markers'],_0x329f93['affectsData'],_0x329f93['baseVersion']);}return _0x52f33d;}['_groupAdjacentOperations'](_0x2fbf03){if(!_0x2fbf03['length'])return[];const _0x4c9001=[];let _0x3a2527=0x0,_0x21b51a=0x0,_0x87220b=[];for(let _0x40ed96=0x0;_0x40ed96<=_0x2fbf03['length'];_0x40ed96++){const _0x5a989c=_0x2fbf03[_0x40ed96],_0x3df0d6=_0x2fbf03[_0x40ed96-0x1];!_0x5a989c||_0x3df0d6&&!this['_getOperationEnd'](_0x3df0d6)['isTouching'](this['_getOperationStart'](_0x5a989c))?(_0x4c9001['push']({'operations':_0x87220b,'operationsIsolated':_0x87220b['map'](_0x24378f=>this['_shiftOperation'](_0x24378f['clone'](),-_0x21b51a)),'groupOffset':_0x3a2527}),_0x87220b=_0x5a989c?[_0x5a989c]:[],_0x21b51a+=_0x3a2527,_0x3a2527=0x0):_0x87220b['push'](_0x5a989c),_0x5a989c&&'insert'===_0x5a989c['type']&&(_0x3a2527+=_0x5a989c['howMany']);}return _0x4c9001;}['_findAdjacentContextDistance'](_0x1facf1,_0x31a1b7,_0x3fe1c0,_0x2377b0=0x1){const _0x302607=new _0x81b4df({'startPosition':_0x1facf1,'direction':_0x31a1b7});let _0x22df32=0x0;for(let _0x26b1b5=0x0;_0x26b1b5<_0x2377b0;_0x26b1b5++){let _0xdfe7da=0x0,_0x435db7=!0x1,_0x1ade54='forward'===_0x31a1b7?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x486dca}of _0x302607)if(_0x486dca['is']('$textProxy')){const _0x2e45f5=_0x1ade54['exec'](_0x486dca['data']);if(_0x2e45f5&&_0x2e45f5['length']){if(_0xdfe7da+='forward'===_0x31a1b7?_0x2e45f5['index']+_0x2e45f5[0x0]['length']:_0x486dca['data']['length']-_0x2e45f5['index'],_0x2e45f5[0x0]['length']!==_0x486dca['data']['length'])break;_0x435db7=!0x0,_0x1ade54='forward'===_0x31a1b7?/^\w+/:/\w+$/;}else{if(_0x435db7)break;_0xdfe7da+=_0x486dca['offsetSize'];}}else{if(_0x486dca['is']('element')){_0x3fe1c0['isInline'](_0x486dca)&&!_0x435db7&&(_0xdfe7da+=0x1);break;}}_0x22df32+=_0xdfe7da,_0x302607['jumpTo'](_0x1facf1['getShiftedBy']('forward'===_0x31a1b7?_0x22df32:-_0x22df32));}return _0x22df32;}['_getChangeContext'](_0x34887c,_0x190641,_0x3d4b8e){const _0x55c909=_0x3d4b8e['model']['schema'],_0x265562=this['_findAdjacentContextDistance'](_0x34887c,'backward',_0x55c909,0x6),_0x2bf44e=this['_findAdjacentContextDistance'](_0x190641,'forward',_0x55c909,0x6),_0x350f66=_0x34887c['getShiftedBy'](-_0x265562),_0x120f99=_0x190641['getShiftedBy'](_0x2bf44e);return{'start':_0x350f66,'end':_0x120f99,'hasContentBefore':!_0x350f66['isAtStart'],'hasContentAfter':!_0x120f99['isAtEnd']};}['_insertMarkers'](_0xead945,_0x3ef7fc){const _0x199b05=this['context']['plugins']['get']('AIEditing'),_0x123b2a=new Set();_0x3ef7fc['model']['change'](_0x14ba60=>{for(const _0x22bc0c of _0xead945){const _0x47ec3f=''+oh+_0x22bc0c['type']+':'+_0x22bc0c['groupId']+'_'+_0x199b05['_nextDataId'](_0x123b2a);this['_markers']['set'](_0x47ec3f,{'id':_0x47ec3f,'groupId':_0x22bc0c['groupId'],'type':_0x22bc0c['type'],'content':_0x22bc0c['content'],'editor':_0x3ef7fc}),_0x14ba60['addMarker'](_0x47ec3f,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x14ba60['createRange'](_0x22bc0c['start'],_0x22bc0c['end'])});}});}['_createGetContextFn'](_0x2277e3,_0x271e37,_0x5aa5de){let _0x2422d5='';return()=>{if(!_0x2422d5){const _0x5b91f9=_0x271e37['toView'](_0x2277e3,{'showSuggestionHighlights':!0x0});let _0x5dc217=_0x5b91f9['getChild'](0x0);if(_0x5dc217['is']('containerElement')||(_0x5dc217=_0x5b91f9),!_0x5dc217)return'';let _0x244271=!0x1;const _0x41cc0d=[];for(const _0x2b765f of _0x5dc217['getChildren']())_0x2b765f['is']('element','span')&&_0x2b765f['hasClass']('ck-ai_review-marker_context-end')&&(_0x244271=!0x1),_0x244271&&_0x41cc0d['push'](_0x2b765f),_0x2b765f['is']('element','span')&&_0x2b765f['hasClass']('ck-ai_review-marker_context-start')&&(_0x244271=!0x0);_0x5dc217['_removeChildren'](0x0,_0x5dc217['childCount']),_0x5aa5de?.['ellipsisBefore']&&_0x5dc217['_appendChild']('…'),_0x5dc217['_appendChild'](_0x41cc0d),_0x5aa5de?.['ellipsisAfter']&&_0x5dc217['_appendChild']('…');const _0x4f4241=_0x271e37['htmlProcessor']['domConverter']['viewToDom'](_0x5b91f9),_0x37147e=_0x271e37['htmlProcessor']['htmlWriter']['getHtml'](_0x4f4241);_0x2422d5=this['_removeUnsupportedElements'](_0x37147e);}return _0x2422d5;};}['_createGetContentFn'](_0x262c4f,_0x43ffa3){let _0x48245b='';return()=>(_0x48245b||(_0x48245b=this['_removeUnsupportedElements'](_0x43ffa3['stringify'](_0x262c4f,{'showSuggestionHighlights':!0x0}))),_0x48245b);}['_createGetContentUsingDataIdFn'](_0x2541e7,_0x191222,_0x3623b1){let _0x1bc7a5='';return()=>{if(!_0x1bc7a5){const _0x3462a5=_0x3623b1['toView'](new _0x3f99b4(_0x2541e7));_0x1bc7a5=_0x3623b1['htmlProcessor']['domConverter']['viewToDom'](_0x3462a5)['querySelector']('[data-id=\x22'+_0x191222+'\x22]')?.['outerHTML']||'';}return _0x1bc7a5;};}['_removeUnsupportedElements'](_0x25bf28){if(!_0x25bf28)return'';const _0x41b76e=ps(_0x25bf28,{'decodeEntities':!0x1}),_0x283d9f=ws(_0x41b76e);if(!_0x283d9f['length'])return _0x25bf28;for(const _0x4b62cc of _0x283d9f)_0x3cff82(_0x4b62cc);return ms(_0x41b76e,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x1ec96c,_0xf47807){const _0x36c7f7=ps(_0x1ec96c,{'decodeEntities':!0x1}),_0x12faa2=ps(_0xf47807,{'decodeEntities':!0x1}),_0x5d5d12=ws(_0x36c7f7),_0x113594=ws(_0x12faa2);if(!_0x5d5d12['length']&&!_0x113594['length'])return{'contentInitial':_0x1ec96c,'contentNew':_0xf47807};const _0x1b6c97=new Map();for(const _0x3e273e of _0x5d5d12)_0x1b6c97['set'](fs(_0x3e273e,'data-id'),_0x3e273e);for(const _0x556494 of _0x113594){const _0x2ff09b=fs(_0x556494,'data-id'),_0x529f35=_0x2ff09b?_0x1b6c97['get'](_0x2ff09b):void 0x0;_0x529f35?_0x53788f(_0x556494,_0x26e4f2(_0x529f35,!0x0)):_0x3cff82(_0x556494);}return{'contentInitial':ms(_0x36c7f7,{'encodeEntities':!0x1}),'contentNew':ms(_0x12faa2,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x2dae48,_0x3de0a5=0x5){let _0x209970=_0x2dae48,_0x17cf54=null;for(let _0x3e226f=0x0;_0x3e226f<_0x3de0a5&&_0x209970;_0x3e226f++)if(_0x209970['className']){if((''+_0x209970['className'])['includes']('ck-ai_review-marker_')){if(!_0x209970['getAttribute']('data-marker-id'))break;_0x17cf54=_0x209970;break;}_0x209970=_0x209970['parentElement'];}else _0x209970=_0x209970['parentElement'];return _0x17cf54;}['_findMarkerElementById'](_0x5ded65){const _0x525af5=this['_markers']['get'](_0x5ded65);if(!_0x525af5)return null;const _0x30f9c0=_0x525af5['editor']['model']['markers']['get'](_0x5ded65);return _0x30f9c0?_0x214a83(_0x525af5['editor']['editing'],_0x30f9c0):null;}['_getMarkersDataForGroup'](_0x7a33d){return Array['from'](this['_markers']['values']())['filter'](_0x1f259e=>_0x1f259e['groupId']===_0x7a33d);}['_getOperationStart'](_0x3bf408){return'insert'===_0x3bf408['type']?_0x3bf408['position']:_0x3bf408['newRange']['start'];}['_getOperationEnd'](_0x179be8,_0x293c6e=!0x1){return'insert'===_0x179be8['type']?_0x293c6e?_0x179be8['position']:_0x179be8['position']['getShiftedBy'](_0x179be8['howMany']):_0x179be8['newRange']['end'];}['_shiftOperation'](_0x4def82,_0x1c8037){return'insert'===_0x4def82['type']?_0x4def82['position']=_0x4def82['position']['getShiftedBy'](_0x1c8037):'marker'===_0x4def82['type']&&_0x4def82['newRange']&&(_0x4def82['newRange']=new _0x2993a5(_0x4def82['newRange']['start']['getShiftedBy'](_0x1c8037),_0x4def82['newRange']['end']['getShiftedBy'](_0x1c8037))),_0x4def82;}['_changeOperationOwnerDocument'](_0x3b20fa,_0x2442a7){'insert'===_0x3b20fa['type']?_0x3b20fa['position']=this['_changePositionOwnerDocument'](_0x3b20fa['position'],_0x2442a7):'marker'===_0x3b20fa['type']&&_0x3b20fa['newRange']&&(_0x3b20fa['newRange']=this['_changeRangeOwnerDocument'](_0x3b20fa['newRange'],_0x2442a7));}['_changePositionOwnerDocument'](_0x6270a7,_0x4e6bd7){return new _0x584844(_0x4e6bd7,_0x6270a7['path']);}['_changeRangeOwnerDocument'](_0x1fbb61,_0xff354e){return new _0x2993a5(this['_changePositionOwnerDocument'](_0x1fbb61['start'],_0xff354e),this['_changePositionOwnerDocument'](_0x1fbb61['end'],_0xff354e));}['_changePosition'](_0x3f65bd,_0x2eda05){return new _0x584844(_0x2eda05,[..._0x3f65bd]);}['_changeRange'](_0x36ee97,_0x1a9616,_0x36618c,_0x4628dd){return new _0x2993a5(this['_changePosition'](_0x1a9616,_0x4628dd),this['_changePosition'](_0x36618c,_0x4628dd));}['_sortMarkers'](_0xa6deaf){const _0x160066=_0x3273db=>{switch(_0x3273db){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0xa6deaf['sort']((_0x1a0ea5,_0x27f417)=>_0x160066(_0x1a0ea5['type'])-_0x160066(_0x27f417['type']));}['_hasSameTopLevelElement'](_0x57ab6b,_0x4b5827){const _0x2196e9=_0x57ab6b['getChild'](0x0),_0x28a81c=_0x4b5827['getChild'](0x0);return!(!_0x2196e9||!_0x28a81c)&&((!_0x2196e9['is']('element')||!_0x28a81c['is']('element')||_0x2196e9['name']===_0x28a81c['name'])&&!(_0x2196e9['is']('element')&&!_0x28a81c['is']('element')||!_0x2196e9['is']('element')&&_0x28a81c['is']('element')));}['_haveSingleTopLevelElement'](_0xb5cb0){return 0x1===_0xb5cb0['childCount'];}['_haveOnlyInlineContent'](_0x275cdf,_0x364a62){for(const _0x2603fc of _0x275cdf['getChildren']())if(_0x2603fc['is']('element')&&!_0x364a62['isInline'](_0x2603fc))return!0x1;return!0x0;}['_upsertDataId'](_0x5a9546,_0x5ecbd8){let _0x2dc15b=_0x5a9546['getAttribute'](_0x445414);return _0x2dc15b||(_0x2dc15b=_0x5ecbd8(),_0x5a9546['_setAttribute'](_0x445414,_0x2dc15b)),_0x2dc15b;}};const lh=/* #__PURE__ -- @preserve */
38
- ut();var uh=class extends lh{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x486785,contentNew:_0x4e1b43,contentInitial:_0x4184df,documentVersion:_0x2ee437}){super(),this['id']=_0x486785,this['contentNew']=_0x4e1b43,this['contentInitial']=_0x4184df,this['documentVersion']=_0x2ee437;}};const dh=/* #__PURE__ -- @preserve */
39
- gt();var _h=class extends dh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x210e6,_0x53de48,_0x4beced){super(),this['id']=_0x210e6,this['parent']=_0x4beced,this['_data']=_0x53de48,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const gh=/* #__PURE__ -- @preserve */
40
- gt();var Ah=class extends gh{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0xd21805,_0x593bfa,_0x588de6,_0x464421,_0x14f350){super(),this['_sourceCheck']=_0x593bfa,this['_documentData']=_0xd21805,this['_aiConnector']=_0x588de6,this['_reviewParams']=_0x464421,this['_reviewArgs']=_0x14f350,this['on']('change:status',(_0x222d24,_0x2ef9ae,_0x496540)=>{'aborted'==_0x496540&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x496540,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x5f3d7f=>'pending'===_0x5f3d7f['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x1a6b57){this['_documentData']=_0x1a6b57;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x57943b=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x475d70 of _0x57943b)'unmodified'!==_0x475d70['data']['operation']&&('error'!==_0x475d70['data']['operation']?'review-metadata'!==_0x475d70['event']?this['_addReviewCheckResult'](_0x475d70['data']['dataId'],_0x475d70['data']['textDelta']):this['callId']=_0x475d70['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(_0x3e08e9){this['_currentError']=_0x3e08e9,nn(_0x3e08e9)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x5cecba,_0x2805c1){const _0x115a15=this['_results']['get'](_0x5cecba);if(!_0x115a15)return;if(0x0===_0x2805c1['length'])return;const _0x5815fc=[];_0x2805c1['forEach']((_0x1f1a4b,_0xc56bc8)=>{const _0x48f36d=new _h(_0x115a15['id']+'-'+_0xc56bc8,_0x1f1a4b,_0x115a15);_0x48f36d['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x48f36d,'status':_0x48f36d['status']});}),_0x48f36d['on']('change:isActivated',()=>{_0x48f36d['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x48f36d}):this['fire']('reviewCheckResultDeactivated',{'change':_0x48f36d});}),this['_changes']['push'](_0x48f36d),_0x5815fc['push'](_0x48f36d);}),this['fire']('reviewCheckResultReady',{'changes':_0x5815fc,'result':_0x115a15,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x176767){const _0x427cd1=this['_changes']['find'](_0x5ba735=>_0x5ba735['id']===_0x176767);return!(!_0x427cd1||'pending'!==_0x427cd1['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x30fae9=>!0x0===_0x30fae9['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x2083b0=>'pending'===_0x2083b0['status']);}['getChangeById'](_0x2cc6a2){return this['_changes']['find'](_0x50539e=>_0x50539e['id']===_0x2cc6a2);}['markAllChangesAsAccepted'](){for(const _0x2cecd1 of this['_changes'])'pending'===_0x2cecd1['status']&&(_0x2cecd1['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x36bf12){const _0x4ce994=this['_changes']['find'](_0x1948b2=>_0x1948b2['id']===_0x36bf12);_0x4ce994&&'pending'===_0x4ce994['status']&&(_0x4ce994['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x1567fd){const _0x1c7373=this['_changes']['find'](_0x5d7887=>_0x5d7887['id']===_0x1567fd);_0x1c7373&&'pending'===_0x1c7373['status']&&(_0x1c7373['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x265474){const _0x35ffd4=this['_changes']['find'](_0x32fe07=>_0x32fe07['id']===_0x265474);_0x35ffd4&&'pending'===_0x35ffd4['status']&&(_0x35ffd4['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x51cb27){const _0x10f8f0=this['_changes']['find'](_0x314f4f=>_0x314f4f['id']===_0x51cb27);_0x10f8f0&&'outdated'===_0x10f8f0['status']&&(_0x10f8f0['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x3ea7fb){this['_changes']['filter'](_0x23f292=>_0x23f292['isActivated']&&_0x23f292['id']!==_0x3ea7fb)['forEach'](_0x24d419=>{_0x24d419['isActivated']=!0x1;});const _0x490c5b=this['_changes']['find'](_0xe066fb=>_0xe066fb['id']===_0x3ea7fb);_0x490c5b&&'pending'===_0x490c5b['status']&&(_0x490c5b['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x39d701=>_0x39d701['isActivated'])['forEach'](_0x56d103=>{_0x56d103['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x2c023d){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x1fa1ed;if(_0x2c023d){const _0x45a45a=this['_changes']['find'](_0x511cf5=>_0x511cf5['id']===_0x2c023d);if(_0x45a45a&&_0x45a45a['isRated'])return;_0x45a45a&&(_0x1fa1ed=_0x45a45a['parent']['id'],_0x45a45a['isRated']=!0x0);}const _0x44cf43={'positiveCount':this['_changes']['filter'](_0x45cf07=>'accepted'===_0x45cf07['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x44cf43,this['callId'],_0x1fa1ed);}['_addReviewCheckResult'](_0xb0d4d9,_0x3818df){const _0x2f0a6b=this['_documentData']['elements']['get'](_0xb0d4d9);if(!_0x2f0a6b)return;const _0x17cd21=_0x2f0a6b['getContent']();if(_0x17cd21===_0x3818df)return;const _0x594163=new uh({'id':_0xb0d4d9,'contentInitial':_0x17cd21,'contentNew':_0x3818df,'documentVersion':_0x2f0a6b['documentVersion']});this['_results']['set'](_0x594163['id'],_0x594163),this['fire']('reviewCheckResultAdded',{'result':_0x594163,'source':this,'editor':_0x2f0a6b['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x5502ab=>'pending'===_0x5502ab['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x3820ac=>'pending'===_0x3820ac['status'])['length']&&(this['status']='finished');}},Ih=class extends Ah{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5bd792=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x15b3ef=0x0;_0x15b3ef<this['_reviewParams']['length'];_0x15b3ef++){if(!this['_reviewParams'][_0x15b3ef]||!this['_sourceCheck']['options'][_0x15b3ef])continue;const _0x581358=this['_sourceCheck']['options'][_0x15b3ef]['data']?.['find'](_0x5c7a21=>_0x5c7a21['id']===this['_reviewParams'][_0x15b3ef]);_0x581358&&_0x5bd792['push'](_0x581358['label']);}return _0x5bd792['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x3c6a13,_0x571b5,_0x1e28ea){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x571b5,_0x3c6a13,_0x1e28ea);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},ph=class extends _0x10611c{['_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',(_0x400b3b,_0xfd66b3)=>this['runCheck'](_0xfd66b3)),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 _0x38007b=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x38007b['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x38007b['map'](_0x54f939=>_0x54f939['id']),this['_aiSource']);const _0x8bf487=this['_currentReviewCheckRun'];_0x8bf487['markAllChangesAsAccepted'](),_0x8bf487['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x4c78cb,_0x1f2dc4)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1f2dc4['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x1f2dc4['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x1f2dc4['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1f2dc4['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x1f9ba1,_0x33133f)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x33133f['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x33133f['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x33133f['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x33133f['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0xd2e22a,_0x591631)=>{this['_onActivateChange'](_0x591631);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x44f2d5,_0x3f3298)=>{this['_onDeactivateChange'](_0x3f3298);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x5f4d98,_0x9e28b0)=>{this['_onChangeMarkerClicked'](_0x5f4d98,_0x9e28b0);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x2038c1,_0x30610f)=>{this['_onChangeMarkerHovered'](_0x2038c1,_0x30610f);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x517b4f,_0x1f75f6)=>{this['_onChangeMarkerRemoved'](_0x517b4f,_0x1f75f6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x220127,_0x899acf)=>{this['_onChangeMarkerRestored'](_0x220127,_0x899acf);});}async['runCheck'](_0x4cbfc9){if(!this['_availableReviewChecks'])return;const _0x223fac=this['_availableReviewChecks']['find'](_0x12b89c=>_0x12b89c['id']===_0x4cbfc9['id']);if(_0x223fac){this['_onReviewCheckRun'](_0x4cbfc9),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4cbfc9,_0x223fac),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x9421e0,_0x4cb5dc)=>{switch(_0x4cb5dc['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x4cb5dc);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x4cb5dc['status']&&'error-chunk'!==_0x4cb5dc['status']&&'error-general'!==_0x4cb5dc['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x318455,_0x3f813a)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x161f5d=this['_diffContent'](_0x3f813a['editor'],_0x3f813a['result']['contentInitial'],_0x3f813a['result']['contentNew']);_0x3f813a['source']['addResultChanges'](_0x3f813a['result']['id'],_0x161f5d);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x36f945,_0x2aa460)=>{for(const _0x533c7d of _0x2aa460['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x533c7d);this['_markChangePositionInEditorContent'](_0x2aa460['changes'],_0x2aa460['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x1056d8,_0x15b521)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x15b521['change']['id'],_0x15b521['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x239823,_0x1dbd1e)=>{this['_onReviewCheckResultActivated'](_0x1dbd1e);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0xcfa38f){if(nn(_0xcfa38f))return;_0xcfa38f instanceof ht?this['_logError'](_0xcfa38f):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0xcfa38f));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x4cbfc9['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x4722f4,_0x558c4f){return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0x558c4f,this['_aiConnector'],_0x4722f4['params'],_0x4722f4['args']);}['_onChangeMarkerRemoved'](_0x165ba7,_0x3ecdbe){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x3ecdbe['changeId']);}['_onChangeMarkerRestored'](_0x5179a5,_0x39d190){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x39d190['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['_onReviewRunLeave'](_0x5ef130=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x5ef130&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x5ca605 of this['_aiReviewCoreEditing']['getEditors']())_0x5ca605['editing']['view']['change'](_0x24cac3=>{for(const _0x3c3ebc of _0x5ca605['editing']['view']['document']['getRoots']())_0x24cac3['removeClass']('ck-ai_review-diff',_0x3c3ebc),_0x24cac3['removeClass']('ck-ai_review-highlights',_0x3c3ebc),_0x24cac3['removeClass']('ck-ai-translate-mode-content',_0x3c3ebc);});}['_logError'](_0x44fbdc){this['_reporter']['logError'](_0x44fbdc),'ai-review-mode-models-unable-to-retrieve'===function(_0x17ef72){return _0x17ef72 instanceof rn?_0x17ef72['code']:_0x17ef72 instanceof Error?_0x17ef72['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x44fbdc)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x11b674){if('content'===this['_changeActivationSource']){const _0xdb952a=this['_aiReviewCoreUi']['getChangeElement'](_0x11b674);_0xdb952a&&St(_0xdb952a['closest']('.ck-ai_review__check-run-result')||_0xdb952a);}else{if('panel'===this['_changeActivationSource']){const _0x20bcca=this['_getChangeContentElement'](_0x11b674);if(!_0x20bcca)return;Rt({'target':_0x20bcca,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},mh=class extends Ah{['_prompt'];['_model'];constructor(_0x2da41b,_0x4eab55,_0x8d2ab6,_0x551d26,_0x1ce9ce){super(_0x8d2ab6,_0x551d26,_0x1ce9ce),this['_prompt']=_0x2da41b,this['_model']=_0x4eab55;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x55c509,_0x40a00a,_0x9b2e8e){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x40a00a,_0x55c509,_0x9b2e8e);}},Eh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0xe50f1b){this['id']=_0xe50f1b['id'],this['commandId']=_0xe50f1b['commandId'],this['title']=_0xe50f1b['title'],this['description']=_0xe50f1b['description'],this['isParameterized']=_0xe50f1b['isParameterized'],this['useArgs']=_0xe50f1b['useArgs'],this['options']=_0xe50f1b['options'],this['args']=_0xe50f1b['args'];}},Th=class extends Eh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x526afe,_0x231e8f,_0x3ec125){super(_0x526afe),this['prompt']=_0x526afe['prompt'],this['model']=_0x526afe['model'],this['model']?this['_defaultModel']=_0x231e8f['find'](_0x36016e=>_0x36016e['id']===this['model'])||null:this['_defaultModel']=_0x3ec125;}get['defaultModel'](){return this['_defaultModel'];}},wh=class extends mh{get['subTitle'](){return'';}set['prompt'](_0x59a6ed){this['_prompt']=_0x59a6ed;}set['model'](_0x44713b){this['_model']=_0x44713b;}},Ch=class extends _0x10611c{static get['requires'](){return[ls,on];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const fh=[{'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'}]}]}],bh=/* #__PURE__ -- @preserve */
41
- gt();var Sh=class extends bh{['_checks']=[];['setupChecks'](_0x1bcd47){this['_checks']=_0x1bcd47['map'](_0x32349f=>new Eh(_0x32349f));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x1ba0bd){return this['checks']['find'](_0xce4bf2=>_0xce4bf2['id']===_0x1ba0bd);}['removeCheckById'](_0x96c767){this['_checks']=this['_checks']['filter'](_0xbc9a98=>_0xbc9a98['id']!==_0x96c767);}},Rh=class extends Eh{['_models']=[];['_defaultModel']=null;constructor(_0x4c32f7,_0xf584d3,_0x5aad3c){super(_0x4c32f7),this['_models']=_0xf584d3,this['_defaultModel']=_0x5aad3c;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Oh=class extends Sh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x2955d2,_0x2bc015,_0x2e44d6){super(),this['_allModels']=_0x2955d2,this['_recommendedModels']=_0x2bc015,this['_defaultModel']=_0x2e44d6;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x1c1839){this['_checks']=_0x1c1839['map'](_0x100078=>!0x0===_0x100078['isExtra']?new Th(_0x100078,this['_allModels'],this['_defaultModel']):'custom'===_0x100078['id']?new Rh(_0x100078,this['_recommendedModels'],this['_defaultModel']):new Eh(_0x100078));}},vh=class extends Ch{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0xc61406){super(_0xc61406),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x4c1590=>({'id':_0x4c1590['id'],'commandId':_0x4c1590['id'],'title':_0x4c1590['label'],'description':_0x4c1590['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x4c1590['prompt'],'model':_0x4c1590['model']}));}async['_loadChecksList'](){const _0x1b1a9a=[...fh,...this['getExtraChecks']()]['map'](_0x6c1d22=>_0x6c1d22['isExtra']?_0x6c1d22:this['_translateReviewCheck'](_0x6c1d22)),_0x3e1d06=await this['_getModels'](),_0x228eb0=new Oh(_0x3e1d06['all'],_0x3e1d06['recommended'],_0x3e1d06['default']);return _0x228eb0['setupChecks'](_0x1b1a9a),_0x228eb0;}async['_getModels'](){const _0x576d93=this['context']['plugins']['get']('AIConnector');try{const _0x3053d3=new zs({'connector':_0x576d93,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x2335d5={'all':await _0x3053d3['getAll'](),'recommended':await _0x3053d3['getAvailableModels'](),'default':await _0x3053d3['getDefault']()};return this['_modelsLoadError']=null,_0x2335d5;}catch(_0x45a291){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x45a291),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x3f156a){const _0x1ed6f6='AI_REVIEW_CHECK_'+_0x3f156a['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x1f8381={..._0x3f156a,'title':this['_translate'](_0x1ed6f6+'_TITLE',_0x3f156a['title']),'description':this['_translate'](_0x1ed6f6+'_DESCRIPTION',_0x3f156a['description'])};return _0x3f156a['options']&&(_0x1f8381['options']=_0x3f156a['options']['map'](_0x5ca35c=>({..._0x5ca35c,'label':this['_translate'](_0x1ed6f6+'_OPTIONS_LABEL',_0x5ca35c['label']||''),'data':_0x5ca35c['data']?_0x5ca35c['data']['map'](_0x67bbdf=>({..._0x67bbdf,'label':this['_translate'](_0x1ed6f6+'_OPTIONS_DATA_'+_0x67bbdf['id']['toUpperCase'](),_0x67bbdf['label'])})):void 0x0}))),_0x1f8381;}['_translate'](_0x1ce720,_0x4fc0e4){const _0x24aaa2=us(this['context']['locale'],_0x1ce720);return _0x24aaa2===_0x1ce720?_0x4fc0e4:_0x24aaa2;}},kh=class extends ph{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[on,vh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x33f734){super(_0x33f734),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',fh['map'](_0x37bd48=>_0x37bd48['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x55e390,_0xf005c3)=>{this['_isDiffOn']=_0xf005c3['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x15cb28,_0x58f36e){if(_0x15cb28['isCustom'])return new mh(_0x15cb28['args']['prompt'],_0x15cb28['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x58f36e,this['_aiConnector']);if(_0x58f36e['isExtra']){const _0x2763c1=_0x58f36e;return new wh(_0x15cb28['args']?.['prompt']??_0x2763c1['prompt'],_0x15cb28['args']?.['model']??_0x2763c1['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x58f36e,this['_aiConnector']);}return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0x58f36e,this['_aiConnector'],_0x15cb28['params'],_0x15cb28['args']);}['_onReviewCheckResultActivated'](_0x1718f3){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1718f3['change']['id']),this['_scrollToChange'](_0x1718f3['change']['id']);const _0x50edfc=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1718f3['change']['id']);if(!_0x50edfc)return;const _0x5d876b=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1718f3['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x1718f3['change'],()=>_0x50edfc['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x5d876b,_0x50edfc['modelRange']['root']['rootName']),_0x5d876b?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1718f3['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x1f7098){this['_currentReviewCheckRun']&&'click'===_0x1f7098['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1f7098['id']));}['_onDeactivateChange'](_0x598fcc){this['_currentReviewCheckRun']&&'balloon'===_0x598fcc['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1a5663,_0x4a0494){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4a0494['changeId']);const _0x5b8d38=this['_currentReviewCheckRun']['getChangeById'](_0x4a0494['changeId']);if(!_0x5b8d38)return;const _0x6e7cb6=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4a0494['changeId']),_0x528f94=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4a0494['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5b8d38,_0x4a0494['markerElement'],_0x4a0494['domEvent'],'click',this['_getBalloonDomRoot'](_0x528f94,_0x6e7cb6?.['modelRange']['root']['rootName']),_0x528f94?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x208e71,_0x3ce016){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x329d78=this['_currentReviewCheckRun']['getChangeById'](_0x3ce016['changeId']);if(!_0x329d78)return;const _0x594a47=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3ce016['changeId']),_0x6d3c42=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3ce016['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x329d78,_0x3ce016['markerElement'],_0x3ce016['domEvent'],'hover',this['_getBalloonDomRoot'](_0x6d3c42,_0x594a47?.['modelRange']['root']['rootName']),_0x6d3c42?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x3f9d93){const _0x651e79=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3f9d93);return _0x651e79?_0x651e79['getElement']():null;}['_markChangePositionInEditorContent'](_0x3ff1e9,_0x503873){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3ff1e9,_0x503873);}['_diffContent'](_0x56db83,_0x5dfcd4,_0x396c19){return this['_aiReviewCoreEditing']['diffContent'](_0x56db83,_0x5dfcd4,_0x396c19,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x3ac4f7){_0x3ac4f7?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x35383b of this['_aiReviewCoreEditing']['getEditors']())_0x35383b['editing']['view']['change'](_0x5c741d=>{for(const _0x160dc5 of _0x35383b['editing']['view']['document']['getRoots']()){for(const _0x242a24 of _0x160dc5['getClassNames']())_0x242a24['startsWith']('ck-ai_review-')&&_0x5c741d['removeClass'](_0x242a24,_0x160dc5);_0x5c741d['addClass'](_0x3ac4f7?'ck-ai_review-diff':'ck-ai_review-highlights',_0x160dc5);}});}['_getBalloonDomRoot'](_0x1efa1f,_0x17d5cc){const _0x3b6de3=_0x1efa1f['editing']['view'];if(_0x17d5cc){const _0x22180b=_0x3b6de3['getDomRoot'](_0x17d5cc);if(_0x22180b)return _0x22180b;}return _0x3b6de3['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x2cf270=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x18a56d=await _0x2cf270['getChecksList']();_0x2cf270['modelsLoadError']&&this['_logError'](_0x2cf270['modelsLoadError']);let _0x4e0fae=_0x18a56d['checks'];const _0x509553=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x509553,_0x4e0fae),this['_usesAvailableCommandsConfig']&&(_0x4e0fae=_0x509553['map'](_0x3f1d82=>_0x4e0fae['find'](_0x43b932=>_0x43b932['id']===_0x3f1d82))['filter'](_0x2061de=>!!_0x2061de)),this['_filterChecksWithMissingModel'](_0x4e0fae);}['_logWarningForNonExistentChecks'](_0x562bad,_0x5d91f9){const _0x1811f6=_0x562bad['filter'](_0x4016c3=>!_0x5d91f9['some'](_0xe6bab=>_0xe6bab['id']===_0x4016c3));_0x1811f6['length']&&this['_reporter']['logError'](new rn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x1811f6['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0xc01350){const _0xb85d06=[];return _0xc01350['forEach'](_0x2841a2=>{(_0x2841a2 instanceof Th&&!_0x2841a2['defaultModel']||_0x2841a2 instanceof Rh&&!_0x2841a2['models']['length'])&&_0xb85d06['push'](_0x2841a2['id']);}),_0xb85d06['length']&&_0xb85d06['forEach'](_0x15aad4=>{_0xc01350=_0xc01350['filter'](_0x59fd17=>_0x59fd17['id']!==_0x15aad4),this['_reporter']['logError'](new rn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x15aad4}}));}),_0xc01350;}};function Nh(_0x54c2cd,_0x325571,_0x3ac97c,_0x1eb0ca){return _0x54c2cd instanceof ht?_0x54c2cd:new ht(_0x325571,_0x3ac97c,_0x1eb0ca,_0x54c2cd);}var yh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x29fe9d){this['_affectedBlocks']=_0x29fe9d;}},xh=class extends _0x10611c{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[ch,vh,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x486163=>{const _0x337ac5={'id':_0x486163['id'],'title':_0x486163['title'],'description':_0x486163['description']};return'custom'!==_0x486163['id']&&_0x486163['options']?.['length']&&(_0x337ac5['parameters']=_0x486163['options'][0x0]['data']['map'](_0x3ee204=>({..._0x3ee204}))),_0x337ac5;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x2b1afb,_0x1d90ff){return await this['_runReviewCheck'](_0x2b1afb,()=>this['_createReviewCheckRun'](_0x2b1afb,_0x1d90ff?.['parameterId']),_0x1d90ff?.['signal']);}async['runCustomReview'](_0x5b120e,_0x389740){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x5b120e,_0x389740?.['model']),_0x389740?.['signal']);}['applyReview'](_0x25aab8,_0x178efc){this['context']['plugins']['get']('AIGateway')['apply'](_0x25aab8,{'applyMethod':_0x178efc,'aiSource':'review'});}async['_runReviewCheck'](_0x3e5471,_0x50a758,_0x474db4){const _0x53b38c=_s(this['context']),_0x3b73cf=new yh({'editor':_0x53b38c,'rootName':_0x53b38c['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x53b38c['plugins']['get']('AIEditing')['getSessionId'](_0x53b38c)});let _0x2957d9,_0xae9584;if(_0x474db4){if(_0x474db4['aborted'])return _0x3b73cf['abort'](),_0x3b73cf;const _0x3f6fa8=()=>{_0x3b73cf['error']||(_0x3b73cf['abort'](),_0x2957d9&&_0x2957d9['abort']());};_0x474db4['addEventListener']('abort',_0x3f6fa8),_0xae9584=()=>_0x474db4['removeEventListener']('abort',_0x3f6fa8);}try{_0x2957d9=await _0x50a758(),_0x3b73cf['contentRawOld']=_0x2957d9['documentData']['content'],_0x3b73cf['documentVersion']=Array['from'](_0x2957d9['documentData']['elements'])['find'](([,_0x55ee95])=>_0x55ee95['rootName']===_0x3b73cf['rootName'])?.[0x1]['documentVersion']??0x1,_0x2957d9['on']('reviewCheckRunUpdated',(_0x107335,_0x293efd)=>{'aborted'===_0x293efd['status']?_0x3b73cf['abort']():'error-general'!==_0x293efd['status']&&'error-chunk'!==_0x293efd['status']||(_0x3b73cf['error']=Nh(_0x293efd['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x3e5471}));}),'aborted'!==_0x3b73cf['status']&&await _0x2957d9['start']();}catch(_0x1ba9b3){_0x3b73cf['error']=Nh(_0x1ba9b3,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x3e5471});}finally{_0xae9584&&_0xae9584();}if(!_0x2957d9||'aborted'===_0x3b73cf['status']||'error'===_0x3b73cf['status'])return _0x3b73cf;_0x3b73cf['affectedBlocks']=_0x2957d9['results']['map'](_0x3ddcfb=>({'id':_0x3ddcfb['id'],'content':_0x3ddcfb['contentNew']}));try{_0x3b73cf['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x3b73cf['affectedBlocks'],_0x3b73cf['contentRawOld'],_0x3b73cf['editor']));}catch(_0x534492){_0x3b73cf['error']=Nh(_0x534492,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x3e5471});}return _0x3b73cf;}async['_createReviewCheckRun'](_0x594b5c,_0xb62793){const _0x1d060a=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5a0e9a=>_0x5a0e9a['id']===_0x594b5c);if(!_0x1d060a)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x594b5c});if(_0x1d060a instanceof Rh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x594b5c});const _0x313c8b=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x45bd26=this['context']['plugins']['get']('AIConnector');if(_0x1d060a instanceof Th){if(!_0x1d060a['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x594b5c});return new wh(_0x1d060a['prompt'],_0x1d060a['defaultModel']['id'],_0x313c8b,_0x1d060a,_0x45bd26);}return new Ih(_0x313c8b,_0x1d060a,_0x45bd26,_0xb62793?[_0xb62793]:void 0x0);}async['_createCustomReviewCheckRun'](_0x5c020f,_0x107c43,_0x1ecdbc){const _0x19a5b6=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x52a2ab=>_0x52a2ab['id']===_0x5c020f);if(!_0x19a5b6)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x5c020f});if(!(_0x19a5b6 instanceof Rh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x5c020f});const _0x1d09c2=_0x1ecdbc??_0x19a5b6['defaultModel']?.['id'];if(!_0x107c43)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x5c020f});if(!_0x1d09c2)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x5c020f});return new mh(_0x107c43,_0x1d09c2,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x19a5b6,this['context']['plugins']['get']('AIConnector'));}},Lh=class extends _0x10611c{static get['requires'](){return[kh,rh,ch,xh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x34b59a,_0x382a0a){if(this['assertStartReviewPreconditions'](_0x34b59a)instanceof Rh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x34b59a});Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x34b59a,'params':_0x382a0a?.['parameterId']?[_0x382a0a['parameterId']]:void 0x0});}async['startCustomReview'](_0x21882e,_0x14bbc5){if(!_0x21882e)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x37f185=fh['find'](_0x5df461=>'custom'===_0x5df461['commandId'])['id'],_0x5f5642=this['assertStartReviewPreconditions'](_0x37f185),_0x3143f8=_0x14bbc5?.['model']??_0x5f5642['defaultModel']?.['id'];if(!_0x3143f8)throw new ht('ai-reviewmode-missing-custom-command-model',this);Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x37f185,'isCustom':!0x0,'args':{'prompt':_0x21882e,'model':_0x3143f8}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x42828=>{const _0x35dcff={'id':_0x42828['id'],'title':_0x42828['title'],'description':_0x42828['description']};return'custom'!==_0x42828['id']&&_0x42828['options']?.['length']&&(_0x35dcff['parameters']=_0x42828['options'][0x0]['data']['map'](_0x5972cf=>({..._0x5972cf}))),_0x35dcff;});}['assertStartReviewPreconditions'](_0x5baabb){const _0x48526c=this['context']['plugins']['get']('AIReviewModeController');if(_0x48526c['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x4168dd=_0x48526c['getAvailableChecks']()['find'](_0x4dc7a2=>_0x4dc7a2['id']===_0x5baabb);if(!_0x4168dd)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x5baabb});return _0x4168dd;}},Dh=class extends Ih{['_title'];constructor(_0x422f9c,_0x1a3ccb,_0x21cdaf,_0x46d0b7,_0x1886c9,_0x375bf8){super(_0x422f9c,_0x1a3ccb,_0x21cdaf,_0x1886c9,_0x375bf8),this['_title']=_0x46d0b7;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Ph=class extends Eh{get['apiId'](){return'translate';}},Hh=class extends Sh{['setupChecks'](_0xbb4a85){this['_checks']=_0xbb4a85['map'](_0x5005aa=>new Ph(_0x5005aa));}};const Mh=[{'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 Vh=class extends Ch{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x621b65){super(_0x621b65),this['context']['config']['define']('ai.translate.languages',Mh);}async['_loadChecksList'](){const _0x228886=[],_0x43edfc=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x48ec36 of _0x43edfc)_0x228886['push']({'title':_0x48ec36['label'],'id':_0x48ec36['id'],'commandId':_0x48ec36['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x48ec36['id']}});const _0x5df30=new Hh();return _0x5df30['setupChecks'](this['_translateChecks'](_0x228886)),_0x5df30;}['_translateChecks'](_0x222af9){const _0x3d786b=this['context']['locale'];return _0x222af9['map'](_0x46cfaa=>{const _0x3e0614='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x46cfaa['title']['toUpperCase']()['replaceAll']('-','_'),_0x4f9eca=us(_0x3d786b,_0x3e0614);return{..._0x46cfaa,'title':_0x4f9eca===_0x3e0614?_0x46cfaa['title']:_0x4f9eca};});}},Uh=class extends ph{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[on,Vh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x59960f,_0x29eb19){return new Dh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x29eb19,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x59960f['params'],_0x59960f['args']);}['_onReviewCheckResultActivated'](_0x2a72fc){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x2a72fc['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x2a72fc['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x1ecaa7){this['_currentReviewCheckRun']&&('hover'===_0x1ecaa7['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1ecaa7['id'])),'click'===_0x1ecaa7['uiInteraction']&&this['_scrollToChange'](_0x1ecaa7['id']));}['_onDeactivateChange'](_0x1c6c0e){this['_currentReviewCheckRun']&&'panel'===_0x1c6c0e['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x537049,_0x4815fa){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4815fa['changeId']),this['_scrollToChange'](_0x4815fa['changeId']));}['_onChangeMarkerHovered'](_0x3ae519,_0x117175){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x117175['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x117175['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x826331){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x826331);}['_markChangePositionInEditorContent'](_0x29b94c,_0x3b0886){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x29b94c,_0x3b0886);}['_diffContent'](_0x2927b2,_0x399c9d,_0x2b0e45){return this['_aiReviewCoreEditing']['diffContent'](_0x2927b2,_0x399c9d,_0x2b0e45,!0x0);}['_onReviewCheckRun'](){for(const _0x380fd8 of this['_aiReviewCoreEditing']['getEditors']())_0x380fd8['editing']['view']['change'](_0x236f23=>{for(const _0x46a171 of _0x380fd8['editing']['view']['document']['getRoots']())_0x236f23['addClass']('ck-ai-translate-mode-content',_0x46a171);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Bh=class extends Xa{constructor(_0x1d03fe,_0x5634dc){super(_0x1d03fe,_0x5634dc),this['on']('set:isLoading',(_0xdafb47,_0x41f468,_0x33e3f7)=>{_0x33e3f7&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x48bea4,_0x3dd395,_0x289944)=>{_0x289944&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x1dca9d=super['_createAcceptAllButtonView']();return _0x1dca9d['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x1dca9d;}['_createExitReviewButtonView'](){const _0x3187d2=super['_createExitReviewButtonView']();return _0x3187d2['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x3187d2;}},Gh=class extends nh{['_setupTemplate'](){const _0x242807=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x242807['if']('isVisible','ck-hidden',_0x5013ee=>!_0x5013ee)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x242807['if']('isVisible','ck-hidden',_0x380f1f=>!_0x380f1f)]},'children':this['_checkViews']}]});}},Fh=class extends Ya{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x171331=this['context']['plugins']['get']('AITabs'),_0x14ff3f=this['context']['locale'],_0x337d7c=new Mo(_0x14ff3f,{'label':us(_0x14ff3f,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0xc54aae,'class':'ck-ai-header_review-translate','showResizeButton':_0x171331['showResizeButton']});_0x337d7c['delegate']('resizeTabs')['to'](_0x171331),_0x337d7c['bind']('isMaximized')['to'](_0x171331['view'],'isMaximized',_0x2f3bf4=>_0x2f3bf4);const _0x5d567b=new qa(_0x14ff3f,{'header':_0x337d7c,'list':new Gh(_0x14ff3f),'results':new Bh(_0x14ff3f,{'generalErrorText':us(_0x14ff3f,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x14ff3f,{'headerText':us(_0x14ff3f,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x14ff3f,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x14ff3f,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x5d567b['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x5d567b;}['registerTab'](){const _0x244898=this['context']['plugins']['get']('AITabs');_0x244898['view']['on']('activateTab',(_0x252aa2,{newTab:_0x290092,oldTab:_0x5cbb1b})=>{'translate'===_0x290092?this['fire']('getReviewCheckList'):'translate'===_0x5cbb1b&&this['fire']('leaveReview');}),_0x244898['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0xc54aae,'order':0x0,'content':this['_mainView']});}},Kh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x4b1e97){this['_affectedBlocks']=_0x4b1e97;}},Wh=class extends _0x10611c{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[ch,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x529a65,_0x52c13a){return await this['_runTranslateCheck'](_0x529a65,()=>this['_createTranslateCheckRun'](_0x529a65),_0x52c13a?.['signal']);}['applyTranslate'](_0x551b39,_0x1228e1){this['context']['plugins']['get']('AIGateway')['apply'](_0x551b39,_0x1228e1);}async['_runTranslateCheck'](_0x5d1be7,_0x5231b0,_0x35fb82){const _0x3fe290=_s(this['context']),_0x5338f8=new Kh({'editor':_0x3fe290,'rootName':_0x3fe290['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x3fe290['plugins']['get']('AIEditing')['getSessionId'](_0x3fe290)});let _0x5a95bb,_0x3862c4;if(_0x35fb82){if(_0x35fb82['aborted'])return _0x5338f8['abort'](),_0x5338f8;const _0x16b26e=()=>{_0x5338f8['error']||(_0x5338f8['abort'](),_0x5a95bb&&_0x5a95bb['abort']());};_0x35fb82['addEventListener']('abort',_0x16b26e),_0x3862c4=()=>_0x35fb82['removeEventListener']('abort',_0x16b26e);}try{_0x5a95bb=await _0x5231b0(),_0x5338f8['contentRawOld']=_0x5a95bb['documentData']['content'],_0x5338f8['documentVersion']=Array['from'](_0x5a95bb['documentData']['elements'])['find'](([,_0x47627e])=>_0x47627e['rootName']===_0x5338f8['rootName'])?.[0x1]['documentVersion']??0x1,_0x5a95bb['on']('reviewCheckRunUpdated',(_0x4a7f92,_0x42a914)=>{'aborted'===_0x42a914['status']?_0x5338f8['abort']():'error-general'!==_0x42a914['status']&&'error-chunk'!==_0x42a914['status']||(_0x5338f8['error']=Nh(_0x42a914['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x5d1be7}));}),'aborted'!==_0x5338f8['status']&&await _0x5a95bb['start']();}catch(_0x5618da){_0x5338f8['error']=Nh(_0x5618da,'ai-translategateway-translation-run-failed',this,{'language':_0x5d1be7});}finally{_0x3862c4&&_0x3862c4();}if(!_0x5a95bb||'aborted'===_0x5338f8['status']||'error'===_0x5338f8['status'])return _0x5338f8;_0x5338f8['affectedBlocks']=_0x5a95bb['results']['map'](_0x10662d=>({'id':_0x10662d['id'],'content':_0x10662d['contentNew']}));try{_0x5338f8['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x5338f8['affectedBlocks'],_0x5338f8['contentRawOld'],_0x5338f8['editor']));}catch(_0x3be3ac){_0x5338f8['error']=Nh(_0x3be3ac,'ai-translategateway-translation-run-failed',this,{'language':_0x5d1be7});}return _0x5338f8;}async['_createTranslateCheckRun'](_0x25bbdc){const _0x464483=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x34a3ff=this['context']['plugins']['get']('AIConnector');return new Dh(_0x464483,new Ph({'id':_0x25bbdc,'commandId':_0x25bbdc,'title':_0x25bbdc,'description':'','isParameterized':!0x1}),_0x34a3ff,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x25bbdc});}},Yh=class extends _0x10611c{static get['requires'](){return[Uh,Fh,ch,Wh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x10b2b8){const _0x281dd1=this['assertStartTranslatePreconditions'](_0x10b2b8);Na(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x281dd1['id'],'args':_0x281dd1['useArgs']?_0x281dd1['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x384dfb=>({'id':_0x384dfb['id'],'label':_0x384dfb['title']}));}['assertStartTranslatePreconditions'](_0x4960b1){const _0x1d4ef3=this['context']['plugins']['get']('AITranslateController');if(_0x1d4ef3['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x28ea5c=_0x1d4ef3['getAvailableChecks']()['find'](_0x3d1809=>_0x3d1809['id']===_0x4960b1);if(!_0x28ea5c)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x4960b1});return _0x28ea5c;}};export{Ba as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,ua as AIBalloon,ea as AIChat,Nn as AIChatController,Mr as AIChatFeedCustomElementView,ta as AIChatHistory,Zo as AIChatHistoryController,Qo as AIChatHistoryUI,Sn as AIChatInteraction,ra as AIChatShortcuts,Go as AIChatUI,ls as AIConnector,rn as AICoreError,sn as AIDocumentProcessingGateway,en as AIDocumentProcessingRunResult,Is as AIEditing,Ia as AIEditorIntegration,an as AIErrorReporter,on as AIErrorSink,Zs as AIGateway,pn as AIInteraction,Ga as AIQuickActions,va as AIQuickActionsUI,gn as AIReply,ki as AIRequestError,Eh as AIReviewCheck,uh as AIReviewCheckResult,_h as AIReviewCheckResultChange,Ah as AIReviewCheckRun,xh as AIReviewGateway,Lh as AIReviewMode,ph as AIReviewModeController,ch as AIReviewModeEditing,rh as AIReviewModeUI,yh as AIReviewRunResult,tn as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,aa as AIToggleButtonUI,Yh as AITranslate,Uh as AITranslateController,Wh as AITranslateGateway,Kh as AITranslateRunResult,Fh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,oa as ToggleAICommand,un as createResizeButton,Zi as getDefaultAICommands,Js as markOperationsAsAI};
23
+ import{Command as _0x362678,ContextPlugin as _0x215b79,Editor as _0x21f3b4,Plugin as _0x538f78,rootAcceptsBlocks as _0x1779c2}from'@ckeditor/ckeditor5-core';import{IconAI as _0x5b4c55,IconAIAdjustLength as _0x2c8297,IconAIAskAI as _0x37bee7,IconAIChangeTone as _0x2cd5e6,IconAIChat as _0x36cfd5,IconAIChatCommands as _0x4b0e14,IconAIContinueWriting as _0x1286c5,IconAIGrammarCheck as _0x57ee30,IconAIHistory as _0x11b517,IconAIImproveWriting as _0x1142df,IconAIOther as _0x4b0fbc,IconAIQuickActions as _0x37448c,IconAIReview as _0x5af653,IconAITranslate as _0x3549b8,IconBoxWithCheck as _0x54c326,IconBoxWithCross as _0xb9952d,IconBoxWithMarker as _0x8e738f,IconBrowseFiles as _0x35ea5d,IconBulb as _0x8a1161,IconCancel as _0x5ec216,IconCheck as _0x3c5aaf,IconChevronDown as _0x19898b,IconChevronRight as _0x131eba,IconChevronUp as _0x212ef3,IconCopy as _0x2b1f4f,IconDocument as _0x385941,IconDocumentOutline as _0x36e9c0,IconDropdownArrow as _0x899818,IconError as _0x699988,IconEye as _0x39ddde,IconEyeCrossedOut as _0x2d688a,IconFileUpload as _0x90f4eb,IconImage as _0x3b073f,IconInfo as _0x304b33,IconLink as _0x52b9b5,IconLoupe as _0x878c2c,IconMagicWand as _0x5c6cbf,IconMaximize as _0x3f0cae,IconMinimize as _0x5c3340,IconNextArrow as _0x26a4e8,IconOutdated as _0x1dd5ea,IconPaperClip as _0xf7813d,IconPin as _0x5ee4d4,IconPlus as _0x5e2ed5,IconPreviousArrow as _0x54835b,IconRefresh as _0x355f3e,IconRobotPencil as _0x527356,IconSelection as _0x5378d9,IconShowChangesOff as tt,IconShowChangesOn as et,IconStop as it,IconSubmit as st,IconThreeHorizontalDots as nt,IconThumbDown as rt,IconThumbUp as ot,IconWeb as at}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ht,Collection as ct,DomEmitterMixin as lt,EmitterMixin as ut,FocusTracker as dt,KeystrokeHandler as _t,ObservableMixin as gt,Rect as At,ResizeObserver as It,_isMotionReduced as pt,first as mt,getConstrainedViewportRect as Et,global as Tt,insertToPriorityArray as wt,isVisible as Ct,logError as ft,logWarning as bt,scrollAncestorsToShowTarget as St,scrollViewportToShowTarget as Rt,toArray as Ot,uid as vt,version as kt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as yt,BalloonToolbar as xt,BodyCollection as Lt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Pt,ButtonView as Ht,Dialog as Mt,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Ut,FileDialogButtonView as Bt,FocusCycler as Gt,FormHeaderView as Ft,FormRowView as Kt,HighlightedTextView as Wt,IconView as Yt,InputTextView as $t,LabeledFieldView as qt,ListItemButtonView as Qt,ListItemGroupView as Xt,ListItemView as zt,ListView as jt,MenuBarMenuListItemButtonView as Jt,MenuBarMenuListItemView as Zt,MenuBarMenuListView as te,MenuBarMenuView as _0x2c9b8f,SearchTextView as _0x53ae11,SpinnerView as _0xc7f55c,TextareaView as _0x1cfbf3,ToolbarView as _0x515f62,UIModel as _0xc45766,View as _0x5afcc4,ViewCollection as _0x1c61f8,addListToDropdown as _0x45d336,addMenuToDropdown as _0x46ad8e,clickOutsideHandler as _0x3f90e8,createDropdown as _0x178550,createLabeledInputText as _0x2f24c8,createLabeledTextarea as _0x36058f,submitHandler as _0x4bc9c9}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x3d0343,ClipboardPipeline as _0x774c95}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x175945,MarkerOperation as _0x31888e,Matcher as _0x5a9f59,ModelDocumentFragment as _0x3ce28b,ModelPosition as _0x167b65,ModelRange as _0x217c33,ModelTreeWalker as _0x442751,ViewDataTransfer as _0x596c86,ViewDocumentDomEventData as _0x15b215,ViewDowncastWriter as _0x7e6bd5,ViewUpcastWriter as _0x51de9a,_DetachOperation as _0x16ad52,_insertIntoModelNodeList as _0x3f4027,_removeFromModelNodeList as _0x260940,transformOperationSets as _0x25b633}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x480e02,debounce as _0x134ee8,escape as _0x5cae26,escapeRegExp as _0x515f94,throttle as _0x4f82c9,unescape as _0x4e759e}from'es-toolkit/compat';import{createParser as _0x1ce2ef}from'eventsource-parser';import{CloudServices as _0x4fc2a3}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x1f1e2f,DATA_ID_MODEL_ATTRIBUTE as _0x19a42d,DATA_ID_VIEW_ATTRIBUTE as _0x263357,DocumentCompare as _0x598e2f,SuggestionsConversion as _0x701e23,fixElementSuggestionRange as _0x501532,getAllMarkersDomElementsSorted as _0x480ed2,getMarkerDomElement as _0x5c1ac3}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x4152d5}from'htmlparser2';import{append as _0x430def,appendChild as _0x4b5e7a,find as _0x484c09,findAll as _0x389c21,findOne as ti,getChildren as _0x56e42f,getParent as _0x1b6412,isComment as _0x253096,isTag as _0x34aa28,prepend as _0x52f7e8,prependChild as _0x834dd8,removeElement as _0x1356eb,replaceElement as _0x11c441,textContent as _0x324b4d}from'domutils';import _0x420708 from'dom-serializer';import{Document as _0x35a1e4,Element as _0x193d60,NodeWithChildren as _0x25c0d6,Text as _0x27d7ca,cloneNode as _0x3cd9d3,isDocument as _0x325b22,isText as _0x45e9d0}from'domhandler';import{MarkdownGfmMdToHtml as _0x479cbe,MarkdownGfmMdToHtmlDefaultPlugins as _0x401844}from'@ckeditor/ckeditor5-markdown-gfm';import _0x12ea20 from'rehype-sanitize';import _0x151f8e from'morphdom';import{diffArrays as _0x4cf212}from'diff';const fi='_ungrouppedCommands';function bi(_0x395be8,_0x1a2c10){const _0x1a5d58=(0x0,_0x1a2c10['t'])('Other');return _0x395be8['length']?'groupId'in _0x395be8[0x0]?_0x395be8:[{'groupId':fi,'groupLabel':_0x1a5d58,'order':0x1/0x0,'commands':_0x395be8}]:[{'groupId':fi,'groupLabel':_0x1a5d58,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x538f78{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x45a4c2}=this,_0x3e9c99=['ck-fake-ai-selection'];_0x45a4c2['config']['get']('ai.assistant.useTheme')&&_0x3e9c99['push']('ck-ai-assistant-ui_theme'),_0x45a4c2['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x3e9c99,'priority':0xc}}),_0x45a4c2['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x230b6f,{writer:_0x3c2edc})=>{if(!_0x230b6f['markerRange']['isCollapsed'])return null;const _0x44662a=_0x3c2edc['createUIElement']('span');return _0x3c2edc['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x44662a),_0x44662a;}});}['afterInit'](){!async function(_0x3f573a){const _0x295d38='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x2dc814=0x78e58,_0x48ee06=window['Date']['now'](),_0x55467a=_0x3f573a['editor'],_0xadaf28=new window['Promise'](_0x27cf1f=>{_0x55467a['once']('ready',_0x27cf1f);}),_0x4812e3={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x2d8c5e=_0x55467a['config']['get']('licenseKey');async function _0x39818c(){let _0x1016f1,_0x5f2fa4=null,_0x3922d2=null;try{return'GPL'==_0x2d8c5e?'NotAllowed':(_0x1016f1=_0x9915da(),_0x1016f1?(_0x1016f1['usageEndpoint']&&(_0x3922d2=_0x5938a8(_0x1016f1['usageEndpoint'],_0x1016f1['jti'])),await _0x4485bc()?_0x3ab534()?_0x44bda0()?'Expired':_0x19a97d()?('evaluation'==_0x1016f1['licenseType']&&(_0x5f2fa4=_0x4dde8e('EvaluationLimit')),await _0x437d86()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x44bda0(){const _0xe0fd74=['evaluation','trial']['includes'](_0x1016f1['licenseType'])?_0x48ee06/0x3e8:0xe10*_0x2dc814;return _0x1016f1['exp']<_0xe0fd74;}function _0x3ab534(){const _0x33ff18=_0x1016f1['features'];return!!_0x33ff18&&(!!_0x33ff18['includes']('*')||!!_0x33ff18['includes']('AI'));}function _0x19a97d(){const _0x552169=_0x1016f1['licensedHosts'];if(!_0x552169||0x0==_0x552169['length'])return!0x0;const {hostname:_0x4226f4}=new URL(window['location']['href']);if(_0x552169['includes'](_0x4226f4))return!0x0;const _0x4319fa=_0x4226f4['split']('.');return _0x552169['filter'](_0x18f7e4=>_0x18f7e4['includes']('*'))['map'](_0x248e13=>_0x248e13['split']('.'))['filter'](_0x2ebd93=>_0x2ebd93['length']<=_0x4319fa['length'])['map'](_0x58faac=>Array(_0x4319fa['length']-_0x58faac['length'])['fill']('*'===_0x58faac[0x0]?'*':'')['concat'](_0x58faac))['some'](_0x12ff27=>_0x4319fa['every']((_0x698860,_0x40e806)=>_0x12ff27[_0x40e806]===_0x698860||'*'===_0x12ff27[_0x40e806]));}function _0x437d86(){return _0x5f2fa4&&_0x3922d2?new window['Promise']((_0x37a784,_0x34cefc)=>{_0x5f2fa4['then'](_0x37a784,_0x34cefc),_0x3922d2['then'](_0x55931b=>{'Valid'!=_0x55931b&&_0x37a784(_0x55931b);},_0x34cefc);}):_0x5f2fa4||_0x3922d2||'Valid';}}function _0x5938a8(_0x2d8838,_0x5b2452){return new window['Promise'](_0x276601=>{if(_0x4fcd24())return _0x276601('Valid');_0x4bc7af(),_0x55467a['decorate']('_sendUsageRequest');let _0x3026fd=!0x1;const _0xad5249=vt();function _0x11b0ac(_0x54467b){return!!_0x54467b&&('object'==typeof _0x54467b||'function'==typeof _0x54467b)&&'function'==typeof _0x54467b['then']&&'function'==typeof _0x54467b['catch'];}function _0x3d2145(_0x279c73){_0x43ddd9(_0x279c73)['then'](_0x5a975c=>_0x5a975c&&'ok'==_0x5a975c['status']?_0x5df211(_0x1d293f(_0xad5249+_0x5b2452))!=_0x5a975c['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x1736e6=>(_0x1c5ee3(),_0x1736e6),()=>{const _0xda7075=_0x135aae();return null==_0xda7075?(_0x1c5ee3(),'Valid'):_0x48ee06-_0xda7075>0x240c8400?'UsageLimit':'Valid';})['then'](_0x276601)['catch'](()=>{_0x276601('UsageLimit');});const _0x4a9889=0x36ee80;function _0x1c5ee3(){const _0x23534b='llct-'+_0x5df211(_0x1d293f(_0x2d8838)),_0xe7a2b8=_0x26a1da(_0x5df211(window['Math']['ceil'](_0x48ee06/_0x4a9889)));window['localStorage']['setItem'](_0x23534b,_0xe7a2b8);}function _0x135aae(){const _0x11cc53='llct-'+_0x5df211(_0x1d293f(_0x2d8838)),_0x21a00f=window['localStorage']['getItem'](_0x11cc53);return _0x21a00f?window['parseInt'](_0x26a1da(_0x21a00f),0x10)*_0x4a9889:null;}function _0x43ddd9(_0x4b5f03){return new window['Promise']((_0xb22579,_0x4cbfb3)=>{_0x4b5f03['then'](_0xb22579,_0x4cbfb3),window['setTimeout'](_0x4cbfb3,0x1d4c0);});}}_0x55467a['on']('_sendUsageRequest',(_0x36455d,_0x1883be)=>{if(_0x1883be[0x0]!=_0x2d8838)return _0x276601('UsageLimit');_0x1883be[0x1]={..._0x1883be[0x1],'requestId':_0xad5249};},{'priority':'high'}),_0x55467a['on']('_sendUsageRequest',_0x155aa3=>{_0x11b0ac(_0x155aa3['return'])&&(_0x3026fd=!0x0,_0x3d2145(_0x155aa3['return']));},{'priority':'low'}),_0xadaf28['then'](()=>{_0x3026fd||_0x276601('UsageLimit');});});function _0x4fcd24(){return'auto'==_0x55467a['editing']['view']['_overlayModeHint'];}function _0x4bc7af(){_0x55467a['editing']['view']['_overlayModeHint']='auto';}}function _0x4dde8e(_0x1365d4){const _0x4214c3=[new window['Promise'](_0x234429=>setTimeout(_0x234429,0x93ecc)),_0xadaf28['then'](()=>new window['Promise'](_0x5a1def=>{let _0x450c70=0x0;_0x55467a['model']['on']('applyOperation',(_0x363bac,_0x2b3075)=>{_0x2b3075[0x0]['isDocumentOperation']&&_0x450c70++,0x5e8==_0x450c70&&(_0x5a1def(),_0x363bac['off']());});}))];return window['Promise']['race'](_0x4214c3)['then'](()=>_0x1365d4);}async function _0x428456(){await _0xadaf28,_0x55467a['model']['change']=_0x87ec8b,_0x55467a['model']['enqueueChange']=_0x87ec8b,_0x55467a['enableReadOnlyMode']('model');}function _0x1b01df(_0x2c2586){const _0x41b958=_0x9bccdf();_0x55467a[_0x41b958]='aiLicenseKey'+_0x2c2586,'Valid'!=_0x2c2586&&_0x428456();}function _0x9bccdf(){const _0x4d4380=window['String'](window['performance']['now']())['replace']('.','');let _0x4565f1='n';for(let _0x183641=0x0;_0x183641<_0x4d4380['length'];_0x183641+=0x2){let _0x5ef8de=window['parseInt'](_0x4d4380['substring'](_0x183641,_0x183641+0x2));_0x5ef8de>=0x3e&&(_0x5ef8de-=0x3e),_0x4565f1+=_0x295d38[_0x5ef8de];}return _0x4565f1;}function _0x9915da(){const _0x5b91b5=_0x2d8c5e['split']('.');if(0x3!=_0x5b91b5['length'])return null;return _0x1999d3(_0x5b91b5[0x1]);function _0x1999d3(_0x23c2ac){const _0x48a91f=_0x1e1f31(_0x23c2ac);return _0x48a91f&&_0x3e118b()?_0x48a91f:null;function _0x3e118b(){const _0x224107=_0x48a91f['jti'],_0x45a828=window['parseInt'](_0x224107['substring'](_0x224107['length']-0x8),0x10),_0x574b9e={..._0x48a91f,'jti':_0x224107['substring'](0x0,_0x224107['length']-0x8)};return delete _0x574b9e['vc'],_0x1d293f(_0x574b9e)==_0x45a828;}}}async function _0x4485bc(){let _0x5473a8=!0x0;try{const [_0x513297,_0x52a56e,_0x5b080c]=_0x2d8c5e['split']('.');return _0x39cdb0(_0x513297),await _0x346cd4(_0x513297,_0x52a56e,_0x5b080c),_0x5473a8;}catch{return!0x1;}function _0x39cdb0(_0x1daec7){const _0x135ad1=_0x1e1f31(_0x1daec7);_0x135ad1&&'ES256'==_0x135ad1['alg']||(_0x5473a8=!0x1);}async function _0x346cd4(_0x4e409e,_0x4cbbe4,_0x13ad54){const _0x38291c=window['Uint8Array']['from'](_0x545113(_0x13ad54),_0x142d03=>_0x142d03['charCodeAt'](0x0)),_0x41d86e=new window['TextEncoder']()['encode'](_0x4e409e+'.'+_0x4cbbe4),_0x317f12=window['crypto']['subtle'];if(!_0x317f12)return;const _0x535bfc=await _0x317f12['importKey']('jwk',_0x4812e3,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x317f12['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x535bfc,_0x38291c,_0x41d86e)||(_0x5473a8=!0x1);}}function _0x1e1f31(_0x33fb92){return _0x33fb92['startsWith']('ey')?JSON['parse'](_0x545113(_0x33fb92)):null;}function _0x545113(_0x529cbf){return window['atob'](_0x529cbf['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x1d293f(_0x25f23e){let _0x44970a=0x1505;function _0x5399c8(_0x274848){for(let _0x2270bc=0x0;_0x2270bc<_0x274848['length'];_0x2270bc++){const _0x457a3b=_0x274848['charCodeAt'](_0x2270bc);_0x44970a=(_0x44970a<<0x5)+_0x44970a+_0x457a3b,_0x44970a&=_0x44970a;}}function _0xf79d4(_0x2d1dc2){Array['isArray'](_0x2d1dc2)?_0x2d1dc2['forEach'](_0xf79d4):_0x2d1dc2&&'object'==typeof _0x2d1dc2?Object['entries'](_0x2d1dc2)['sort']()['forEach'](([_0x371679,_0x3b4b6b])=>{_0x5399c8(_0x371679),_0xf79d4(_0x3b4b6b);}):_0x5399c8(window['String'](_0x2d1dc2));}return _0xf79d4(_0x25f23e),_0x44970a>>>0x0;}function _0x5df211(_0x120f4a){return _0x120f4a['toString'](0x10)['padStart'](0x8,'0');}function _0x26a1da(_0x186ff4){return _0x186ff4['split']('')['reverse']()['join']('');}function _0x87ec8b(){}_0x1b01df(await _0x39818c());}(this);}['showFakeVisualSelection'](){const _0x5b34e0=this['editor']['model'];_0x5b34e0['change'](_0x28ce1c=>{const _0x5dfb61=_0x5b34e0['document']['selection']['getRanges']();let _0x58d2e9=0x0;for(const _0x50155b of _0x5dfb61){const _0x31b820=Ri+':'+_0x58d2e9;if(_0x5b34e0['markers']['has'](_0x31b820))_0x28ce1c['updateMarker'](_0x31b820,{'range':_0x50155b});else{if(_0x50155b['start']['isAtEnd']){const _0x4080bf=_0x50155b['start']['getLastMatchingPosition'](({item:_0x42d9ad})=>!_0x5b34e0['schema']['isContent'](_0x42d9ad),{'boundaries':_0x50155b});_0x28ce1c['addMarker'](_0x31b820,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x28ce1c['createRange'](_0x4080bf,_0x50155b['end'])});}else _0x28ce1c['addMarker'](_0x31b820,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x50155b});}_0x58d2e9++;}});}['hideFakeVisualSelection'](){const _0xe7df19=this['editor']['model'],_0x19321a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x19321a['length']&&_0xe7df19['change'](_0x44459a=>{_0x19321a['forEach'](_0x3f823e=>{_0x44459a['removeMarker'](_0x3f823e);});});}['insertContent'](_0x23289b,_0x6da437){const _0x6e4b84=this['_getAISelection'](),_0x5913eb=_0x6da437||_0x6e4b84['getFirstRange']();this['editor']['model']['canEditAt'](_0x5913eb)&&this['editor']['model']['change'](_0x2f209c=>{this['hideFakeVisualSelection'](),_0x6da437||this['_resetContentOfSelectedTableCells'](_0x2f209c,_0x6e4b84),this['_pasteHTMLUsingClipboard']({'insertAt':_0x5913eb,'writer':_0x2f209c,'html':_0x23289b});});}['insertContentBelow'](_0x3c164f){const {model:_0x482706}=this['editor'],_0x43c498=this['_getAISelection']();_0x482706['change'](()=>{const _0x2dda7b=this['_prepareTableInsertBelowPosition'](_0x3c164f,_0x43c498)||this['_getDefaultInsertBelowPosition'](_0x43c498);this['insertContent'](_0x3c164f,_0x2dda7b);});}['_getAISelection'](){const _0xaf0e46=this['editor']['model'],_0x24880a=Array['from'](_0xaf0e46['markers']['getMarkersGroup'](Ri))['map'](_0x5f1362=>_0x5f1362['getRange']());return _0xaf0e46['createSelection'](_0x24880a);}['_pasteHTMLUsingClipboard']({writer:_0x548ea0,html:_0x5c3f5e,insertAt:_0x456c98}){const {view:_0x43885c}=this['editor']['editing'],_0x2f2829=this['editor']['plugins']['get'](_0x774c95),_0x38e7b6=new Si();_0x38e7b6['setData']('text/html',_0x5c3f5e);const _0x566acc=new _0x15b215(_0x43885c,new ClipboardEvent('paste',{'clipboardData':_0x38e7b6}),{'dataTransfer':new _0x596c86(_0x38e7b6)});_0x548ea0['setSelection'](_0x456c98);const _0xc0ca18=(_0x5c4ca9,_0x337fb8)=>{_0x337fb8['resultRange']&&_0x548ea0['setSelection'](_0x337fb8['resultRange']);};_0x2f2829['once']('contentInsertion',_0xc0ca18,{'priority':'lowest'}),_0x43885c['document']['fire']('paste',_0x566acc),_0x2f2829['off']('contentInsertion',_0xc0ca18);}['_getDefaultInsertBelowPosition'](_0x5b7dee){const {model:_0x17e764}=this['editor'],_0x29a63d=Array['from'](_0x5b7dee['getSelectedBlocks']());return _0x29a63d['length']?_0x17e764['createPositionAfter'](_0x29a63d['pop']()):_0x5b7dee['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x257419,_0x22fd72){const {model:_0x542766,plugins:_0x5bcdf5}=this['editor'];if(_0x5bcdf5['has']('TableUtils')){const _0x5aa551=_0x5bcdf5['get']('TableUtils')['getSelectedTableCells'](_0x22fd72);if(_0x5aa551['length']){const _0x303d79=this['_getTableRowCountFromContent'](_0x257419),_0x258f44=this['_createEmptyTableRows'](_0x5aa551,_0x303d79);return _0x542766['createPositionAt'](_0x258f44,0x0);}}return null;}['_getTableRowCountFromContent'](_0x13ea6c){const _0x398308=this['editor']['plugins']['get']('TableUtils'),_0x264191=this['editor']['data']['parse'](_0x13ea6c,'$documentFragment'),_0x46ab82=Array['from'](_0x264191['getChildren']())['filter'](_0x24af22=>_0x24af22['is']('element','table'));let _0x4d5690=0x0;return _0x46ab82['forEach'](_0x4ea2fb=>{_0x4d5690+=_0x398308['getRows'](_0x4ea2fb);}),_0x4d5690;}['_createEmptyTableRows'](_0x130c8d,_0x109462){const _0x327ffd=this['editor']['plugins']['get']('TableUtils'),_0xf88f5=_0x327ffd['getRowIndexes'](_0x130c8d),_0x5a59a9=_0x327ffd['getColumnIndexes'](_0x130c8d),_0x49a5ad=_0xf88f5['last']+0x1,_0xd38d3d=_0x5a59a9['first'],_0x1966f3=_0x130c8d[0x0]['findAncestor']('table');for(let _0x58c37b=0x0;_0x58c37b<_0x109462;_0x58c37b++)_0x327ffd['insertRows'](_0x1966f3,{'at':_0x49a5ad});return _0x1966f3['getChild'](_0x49a5ad)['getChild'](_0xd38d3d);}['_resetContentOfSelectedTableCells'](_0x499599,_0x4b127d){const {plugins:_0x5bb225}=this['editor'],{model:_0x4ebc90}=_0x499599;_0x5bb225['has']('TableUtils')&&_0x5bb225['get']('TableUtils')['getSelectedTableCells'](_0x4b127d)['length']&&_0x4ebc90['deleteContent'](_0x4b127d);}},vi=class extends _0x538f78{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}},ki=class extends Error{constructor(_0xa464e8){super(_0xa464e8),this['name']='AIRequestError';}};function Ni(_0x5e31a2,_0x1f6ad8,_0x3fb7cb){const t=_0x5e31a2['t'];switch(_0x1f6ad8){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',_0x3fb7cb);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x3fb7cb);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'},_0x3fb7cb);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 _0x1f6ad8;}}var yi=class extends _0x362678{['_commandDefinitions'];constructor(_0x1ac32a,_0xc8b4bb){super(_0x1ac32a),this['_commandDefinitions']=_0xc8b4bb,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x34b1da,_0x3f7504,_0x414376)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0x414376));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0xebbdf7,_0x3a5756,_0xede59e)=>{this['enabledCommandsIds']=_0xede59e?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x1b920d=this['editor']['model'];this['_hasContext']=function(_0x285426){const _0x4af1e8=_0x285426['document']['selection'];return _0x4af1e8['isCollapsed']?0x0!==[..._0x4af1e8['getSelectedBlocks']()]['length']&&![..._0x4af1e8['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x285426['hasContent'](_0x4af1e8['getFirstRange']());}(_0x1b920d);const _0x220fbe=_0x1b920d['document']['selection'],_0x3769ce=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x864f52 of _0x220fbe['getRanges']())for(const _0x48040b of _0x864f52['getItems']())if(_0x48040b['is']('element')&&_0x3769ce['includes'](_0x48040b['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x3aa94a='',_0x2c1ce3='',_0x56c27b='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x3aa94a,_0x2c1ce3,_0x56c27b);}};function xi(_0x105abb,_0x7cb4d3){const _0x58e94b=new Set();for(const _0x2bba7d of _0x105abb['values']())(_0x7cb4d3||!0x1===_0x2bba7d['requiresContent'])&&_0x58e94b['add'](_0x2bba7d['id']);return Array['from'](_0x58e94b);}const Li=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Di=/* #__PURE__ -- @preserve */
24
+ gt();var Pi=class extends Di{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x468151,_0x2a4017,_0xcd9b4a){super(),this['editor']=_0x468151,this['textAdapter']=_0x2a4017,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0xcd9b4a,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x506bff,_0x3dad78,_0x2ba364)=>{this['view']['value']=this['_sanitizeHTML'](_0x2ba364);}),this['listenTo'](this['view'],'submitPrompt',(_0x3ec66d,_0x336466)=>{const _0x288b05=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x336466,_0x288b05,'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:_0x9bb60a,query:_0x58cb1f,htmlContent:_0x3b3044,label:_0x577d28,mainActionLabel:_0x3e9850}){this['view']['prompt']=_0x577d28,this['view']['mainAction']=_0x3e9850,this['initialContext']=_0x3b3044,_0x58cb1f&&(this['view']['isRendered']?this['_handleQuery'](_0x58cb1f,_0x3b3044,_0x9bb60a,_0x577d28):this['view']['once']('render',()=>{this['_handleQuery'](_0x58cb1f,_0x3b3044,_0x9bb60a,_0x577d28);}));}['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'](_0x190f4d,_0x3fe70f,_0xab7094,_0x37cf36){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x3fe70f,this['previousQuery']=_0x190f4d,this['previousLabel']=_0x37cf36||_0x190f4d,this['previousActionId']=_0xab7094,new Promise(_0x598091=>{this['textAdapter']['makeRequest']({'query':_0x190f4d,'context':_0x3fe70f,'onData':_0x3ddc1a=>{this['currentResponse']=_0x3ddc1a,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0xab7094})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x5f13b2=>{_0x5f13b2 instanceof ki?this['view']['handleError'](_0x5f13b2['message']):this['view']['handleError'](),_0x598091();})['finally'](()=>{this['stopProcessing'](),_0x598091();});});}['_parseAndNormalizeContent'](_0x27e707,_0x296eb9=!0x1){const _0x223b5=Li['exec'](_0x27e707);_0x27e707=_0x223b5?_0x27e707['substring'](_0x223b5[0x1]['length']):_0x27e707['length']<0x64&&!_0x296eb9?'':this['_stripMarkdownSyntax'](_0x27e707);const _0x33d381=this['_domParser']['parseFromString'](_0x27e707,'text/html');if(_0x223b5){const _0x573f35=Array['from'](_0x33d381['body']['childNodes']);_0x573f35['reverse']();for(const _0x3cef0a of _0x573f35){if(_0x3cef0a['nodeType']==Node['ELEMENT_NODE'])break;_0x3cef0a['remove']();}}const _0x11be31=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x33d381['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x11be31);const _0x505851=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x43e227=this['editor']['data']['toModel'](_0x11be31);return _0x505851||_0x43e227['markers']['clear'](),this['editor']['data']['stringify'](_0x43e227);}['_normalizeResponseHeadings'](_0x20064f){const _0x18bfb3=new _0x51de9a(this['editor']['editing']['view']['document']),_0x3136e1=new _0x5a9f59({'name':/^h[1-5]$/}),_0x1182a3=[];let _0x579fd8=!0x1;for(const _0x40b717 of _0x20064f)_0x40b717['is']('element')&&_0x3136e1['match'](_0x40b717)&&(_0x1182a3['push'](_0x40b717),'h1'==_0x40b717['name']&&(_0x579fd8=!0x0));if(_0x579fd8){for(const _0x1b972d of _0x1182a3)_0x18bfb3['rename']('h'+(parseInt(_0x1b972d['name'][0x1])+0x1),_0x1b972d);}}['_isH1TagSupportEnabled'](){const {data:_0x489136,editing:_0x5c744b}=this['editor'],_0x53493c=_0x489136['htmlProcessor']['toView']('<h1></h1>'),_0x2d87d9=_0x489136['toView'](_0x489136['toModel'](_0x53493c));return!!_0x5c744b['view']['domConverter']['viewToDom'](_0x2d87d9)['querySelector']('h1');}['_sanitizeHTML'](_0x205098){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x205098),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x316d59){const _0x307663=_0x316d59['trim']();return _0x307663['startsWith']('```html')?_0x307663['endsWith']('```')?_0x307663['substring'](0x7,_0x307663['length']-0x3):_0x307663['substring'](0x7):_0x316d59;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x515f62{constructor(_0x3a028e){super(_0x3a028e),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x1f711f=>Ni(_0x3a028e,'AI_'+_0x1f711f['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x3a028e,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x3a028e,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x3a028e,'Stop'));const _0x24d107=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x24d107['if']('isVisible','ck-hidden',_0xaf0fb8=>!_0xaf0fb8)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x2d386e,_0x1cce4a){const _0x48ec8c=new Ht(this['locale']);return _0x48ec8c['set']({'label':_0x2d386e,'class':_0x1cce4a||'','isVisible':!0x0,'withText':!0x0}),_0x48ec8c;}},Vi=class extends _0x5afcc4{['contentFieldView'];['copyButtonView'];constructor(_0x41c264,_0x36e06f=''){super(_0x41c264),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x115051=this['bindTemplate'];this['contentFieldView']=new Ui(_0x41c264,_0x36e06f),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x115051['if']('isVisible','ck-hidden',_0x449dbd=>!_0x449dbd)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x115051['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 _0xba92f=!0x1;this['on']('change:value',(_0x23f7d1,_0x29beea,_0x3cd1ae)=>{const _0x333f0f=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3cd1ae),this['isProcessing']&&_0x333f0f&&!_0xba92f&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xe50886,_0x43dd9d,_0x2686f8)=>{_0xba92f=!0x1,_0x2686f8?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0xba92f=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0xba92f=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x18e7e4=this['locale'],_0x117135=new Ht(this['locale']),_0x3319f9='ck-ai-form__copy-button';return _0x117135['set']({'label':Ni(_0x18e7e4,'Copy'),'icon':_0x2b1f4f,'class':_0x3319f9,'tooltip':!0x0}),_0x117135['bind']('isVisible')['to'](this,'value',_0x3091b4=>!!_0x3091b4),_0x117135['bind']('isEnabled')['to'](this,'isProcessing',_0x227dc=>!_0x227dc),_0x117135['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x117135['icon']=_0x3c5aaf,_0x117135['class']=_0x3319f9+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x117135['icon']=_0x2b1f4f,_0x117135['class']=_0x3319f9;},0x3e8);}),_0x117135;}['_copyHTMLToClipboard'](_0x3bddd1){const {window:_0x443412,document:_0x283dd6}=Tt;if(_0x443412['ClipboardItem']){const {Blob:_0x381ed6,ClipboardItem:_0x55017c}=_0x443412,_0x527d6b=[new _0x55017c({'text/html':new _0x381ed6([_0x3bddd1['innerHTML']],{'type':'text/html'}),'text/plain':new _0x381ed6([_0x3bddd1['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x527d6b);}else{const _0x513ae6=_0x283dd6['createElement']('div');_0x513ae6['style']['position']='absolute',_0x513ae6['style']['left']='-9999px',_0x513ae6['innerHTML']='<span>[</span>'+_0x3bddd1['innerHTML']+'<span>]</span>',_0x283dd6['body']['appendChild'](_0x513ae6);const _0xe4f793=_0x283dd6['createRange']();_0xe4f793['setStartAfter'](_0x513ae6['firstElementChild']),_0xe4f793['setEndBefore'](_0x513ae6['lastElementChild']);const _0x23e093=_0x443412['getSelection']();_0x23e093['removeAllRanges'](),_0x23e093['addRange'](_0xe4f793),_0x283dd6['execCommand']('copy'),_0x513ae6['remove']();}}},Ui=class extends _0x5afcc4{constructor(_0x41d4f0,_0x41b51b=''){super(_0x41d4f0),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x41b51b,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x5b6b0a){this['element']['innerHTML']=_0x5b6b0a;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x2ac2b1=new _0x5afcc4(),_0x5727b6=this['locale'],_0x5231d0=new _0xc7f55c();return _0x5231d0['isVisible']=!0x0,_0x2ac2b1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x5231d0,{'text':Ni(_0x5727b6,'AI\x20is\x20writing...')}]}),_0x2ac2b1['render'](),_0x2ac2b1;}},Bi=class extends _0x5afcc4{constructor(_0x1cf4c1,_0x2d4ff7=''){super(_0x1cf4c1);const _0x58c281=new Yt(),_0x4c1339=this['bindTemplate'];this['set']('text',_0x2d4ff7),_0x58c281['content']=_0x699988,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x58c281,{'text':_0x4c1339['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x3c7ab5,_0x5aa526){super(_0x3c7ab5,_0x5aa526),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',(_0x4947c8,_0x295f97)=>{_0x4947c8['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x295f97());});}['_createSubmitButton'](){const _0x12c1d2=new Ht(this['locale']),_0x44a83e=this['locale'];return _0x12c1d2['set']({'icon':st,'label':Ni(_0x44a83e,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x12c1d2['on']('execute',()=>{this['submit']();}),_0x12c1d2['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x1c824a,_0xcb939d)=>!_0x1c824a&&_0xcb939d),_0x12c1d2;}['_createShowHistoryButton'](){const _0x1e1f80=new Ht(this['locale']),_0x3600a3=this['resultsView'],_0x2aa6f7=this['locale'];_0x1e1f80['set']({'label':Ni(_0x2aa6f7,'History'),'withText':!0x1,'icon':_0x11b517,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x1e1f80['bind']('isOn')['to'](_0x3600a3,'isVisible'),_0x1e1f80['bind']('isEnabled')['to'](this,'isEnabled'),_0x1e1f80['on']('execute',()=>{_0x3600a3['isVisible']=!_0x3600a3['isVisible'],_0x3600a3['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x547476=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x5ec651=new At(this['queryView']['fieldView']['element']),_0x4f3b77=_0x5ec651['width'],_0x597213='rtl'===_0x2aa6f7['uiLanguageDirection']?'left':'right';_0x5ec651['excludeScrollbarsAndBorders'](),_0x1e1f80['element']['style'][_0x597213]=_0x4f3b77-_0x5ec651['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x547476),this['on']('render',_0x547476),_0x1e1f80;}['submit'](){const _0x2d8af8=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x2d8af8);}['focus'](_0x149a0f){-0x1===_0x149a0f?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x57570d){super(_0x57570d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x57570d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x34aa78=0x0;for(const _0x5b5e15 of this['items'])_0x34aa78+=_0x5b5e15['items']['length'];return{'resultsCount':_0x34aa78,'totalItemsCount':_0x34aa78};}['_createClearHistoryButton'](){const _0x4a05e8=this['locale'],_0x24eabf=new Ht(this['locale']);return _0x24eabf['set']({'label':'('+Ni(_0x4a05e8,'Clear')+')','withText':!0x0}),_0x24eabf['on']('execute',()=>this['fire']('clearHistory')),_0x24eabf;}},Ki=class extends zt{constructor(_0x529895){super();const _0x3fb3ab=new Dt(),_0x1608be=new Ht(this['locale'],_0x3fb3ab);this['children']['add'](_0x1608be),_0x1608be['set']({'label':_0x529895['prompt'],'withText':!0x0}),_0x1608be['on']('execute',()=>{this['fire']('execute',{'value':_0x4e759e(_0x529895['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1b6007,_0x492ac7)=>{const _0x5a1bbe=$i(_0x492ac7['prompt']);for(const _0x2db2f3 of this)if(_0x2db2f3!=_0x492ac7&&$i(_0x2db2f3['prompt'])===_0x5a1bbe){this['remove'](_0x2db2f3);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x5b8a4f=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x5b8a4f));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x5534e3=>_0x5534e3)));}};function $i(_0x405870){return _0x405870['toLowerCase']()['trim']();}var qi=class extends _0x5afcc4{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x1eefe0,_0x3a0ba8,_0x32675c=''){super(_0x1eefe0),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Hi['REPLACE']),this['_promptHistory']=new Yi(),this['errorView']=new Bi(_0x1eefe0),this['contentArea']=new Vi(_0x1eefe0,_0x32675c),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 dt(),this['keystrokes']=new _t(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Gt({'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 _0x2d3b37=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x3a0ba8],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x2d3b37['if']('isError','ck-hidden',_0x47fbfa=>!_0x47fbfa)]},'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'](_0x29d0f1=0x1){-0x1===_0x29d0f1?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 _0x5b1975=this['locale'],_0xaa609f=new Gi(_0x5b1975,{'queryView':{'label':Ni(_0x5b1975,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x36058f,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x5b1975,'Empty\x20history'),'secondary':Ni(_0x5b1975,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0xaa609f['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x147669,_0x582bfe)=>_0x147669&&!_0x582bfe),this['listenTo'](_0xaa609f,'submit',(_0x1f0f41,_0x3ebee3)=>{this['prompt']=_0x3ebee3;const _0x82b320=_0x5cae26(_0x3ebee3);this['fire']('submitPrompt',_0x82b320),_0x3ebee3['trim']()&&this['_promptHistory']['add']({'prompt':_0x82b320},0x0);},{'priority':'high'}),_0xaa609f;}['_createHistoryView'](){const _0x25c8fb=new Fi(this['locale']);return _0x25c8fb['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x25c8fb['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x25c8fb;}['_createToolbar'](){const _0x20f765=new Mi(this['locale']);return _0x20f765['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1630e2,_0x30eb64,_0x3dba68)=>_0x1630e2&&!_0x30eb64&&!!_0x3dba68),_0x20f765['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x20f765['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xf695e3,_0x4ba7c3,_0x24a5cb)=>_0xf695e3&&!_0x4ba7c3&&!!_0x24a5cb),_0x20f765['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x20f765['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x243443,_0x314427)=>_0x243443&&!_0x314427),_0x20f765['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x20f765['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x20f765['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x20f765;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x5ece6e=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x5ece6e,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x2387da){const _0x2378e2=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x2387da||Ni(_0x2378e2,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x538f78{['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[_0x3d0343,Oi,vi,Mt];}constructor(_0x20ae5d){super(_0x20ae5d),_0x20ae5d['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x20ae5d['config']['define']('ai.assistant.contentAreaCssClass',''),_0x20ae5d['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x20ae5d['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x288de4}=this;this['_aiAdapter']=_0x288de4['plugins']['get'](vi),this['_dialog']=_0x288de4['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x1af32e=new yi(_0x288de4,Array['from'](this['_commandDefinitions']['values']()));_0x288de4['commands']['add']('showAIAssistant',_0x1af32e),_0x288de4['ui']['componentFactory']['add']('aiCommands',_0x2c71ad=>{const _0x50c4cb=_0x178550(_0x2c71ad);return _0x50c4cb['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x50c4cb['buttonView']['set']({'label':Ni(_0x2c71ad,'AI\x20Commands'),'icon':_0x5c6cbf,'tooltip':!0x0}),_0x50c4cb['on']('execute',_0x1dc9fd=>this['_onExecute'](_0x1dc9fd['source']['id'])),_0x46ad8e(_0x50c4cb,_0x288de4['ui']['view']['body'],function(_0xf101e9){const _0x51b4cd=ji(_0xf101e9,bi(_0xf101e9['config']['get']('ai.assistant.commands'),_0xf101e9['locale']))['filter'](_0x3a4674=>_0x3a4674['commands']['length']);return 0x1===_0x51b4cd['length']?ji(_0xf101e9,_0x51b4cd[0x0]['commands'])['map'](_0x16ff9c=>({'id':_0x16ff9c['id'],'label':_0x16ff9c['label']})):_0x51b4cd['map'](_0x5efce7=>{const {groupId:_0xaca5e9,groupLabel:_0x47c84e,commands:_0x568f72}=_0x5efce7,_0x438ac6=ji(_0xf101e9,_0x568f72)['map'](_0xca6dc5=>({'id':_0xca6dc5['id'],'label':_0xca6dc5['label']}));return{'id':_0xaca5e9,'menu':_0x47c84e||_0xaca5e9,'children':_0x438ac6};});}(_0x288de4),{'ariaLabel':Ni(_0x2c71ad,'AI\x20Commands')}),_0x50c4cb['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x1af32e['on']('change:enabledCommandsIds',_0x2902d5),_0x50c4cb['menuView']['once']('render',_0x2902d5),_0x50c4cb;function _0x2902d5(){_0x50c4cb['isEnabled']=_0x1af32e['enabledCommandsIds']['length']>0x0;for(const _0x4079db of _0x50c4cb['menuView']['buttons'])_0x4079db['isEnabled']=_0x1af32e['enabledCommandsIds']['includes'](_0x4079db['id']);}}),_0x288de4['ui']['componentFactory']['add']('menuBar:aiCommands',_0x1e37e1=>{const _0x2d492=new _0x2c9b8f(_0x1e37e1);_0x2d492['buttonView']['set']({'label':Ni(_0x1e37e1,'AI\x20Commands'),'icon':_0x5c6cbf}),_0x2d492['bind']('isEnabled')['to'](_0x1af32e,'enabledCommandsIds',_0x46910b=>_0x46910b['length']>0x0);const _0x576a3c=bi(_0x288de4['config']['get']('ai.assistant.commands'),_0x1e37e1);return this['_populateMenuBarMenu'](_0x1af32e,_0x2d492,_0x576a3c,_0x10cb71=>this['_onExecute'](_0x10cb71)),_0x2d492;}),_0x288de4['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x113c57=this['_createAIAssistantUIButton'](Ht);return _0x113c57['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x113c57;}),_0x288de4['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x2935f8=this['_createAIAssistantUIButton'](Jt);return _0x2935f8['set']({'role':'menuitemcheckbox'}),_0x2935f8;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x46effb=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1475dd;for(const _0x47e5b9 in _0x46effb){const _0x11d098=_0x47e5b9,_0x2e7308=_0x46effb[_0x11d098];if('aiLicenseKeyValid'==_0x2e7308||'aiLicenseKeyInvalid'==_0x2e7308||'aiLicenseKeyExpired'==_0x2e7308||'aiLicenseKeyDomainLimit'==_0x2e7308||'aiLicenseKeyNotAllowed'==_0x2e7308||'aiLicenseKeyEvaluationLimit'==_0x2e7308||'aiLicenseKeyUsageLimit'==_0x2e7308){delete _0x46effb[_0x11d098],_0x1475dd=_0x2e7308,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1475dd&&_0x46effb['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1475dd&&_0x46effb['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1475dd&&_0x46effb['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1475dd&&_0x46effb['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1475dd&&_0x46effb['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1475dd&&_0x46effb['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x3538d6='',_0x85fe='',_0x49d113='custom'){const _0x4052b9=this['editor'],_0x393953=_0x4052b9['editing']['view'],_0x4c84a3=_0x4052b9['plugins']['get'](Oi),_0x20f926=_0x4052b9['plugins']['get'](_0x3d0343);_0x4c84a3['showFakeVisualSelection']();const _0x4ab020=new Qi(),_0x58ec4f=new ClipboardEvent('copy',{'clipboardData':_0x4ab020}),_0x48363e=new _0x596c86(_0x4ab020),_0x126baf=new _0x15b215(_0x393953,_0x58ec4f,{'dataTransfer':_0x48363e});_0x20f926['_forceMarkersCopy']('comment',()=>{_0x393953['document']['fire']('copy',_0x126baf);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x4052b9,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x22c577=_0x48363e['getData']('text/html');const _0x5ab189=_0x4052b9['model']['document']['selection'],_0x26bf93=Array['from'](_0x5ab189['getRanges']());0x1===_0x26bf93['length']&&_0x26bf93[0x0]['isFlat']&&!_0x5ab189['getSelectedElement']()&&''!==_0x22c577['replace'](/&nbsp;/g,'')['trim']()&&(_0x22c577='<p>'+_0x22c577+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x49d113,'query':_0x3538d6,'htmlContent':_0x22c577,'label':_0x85fe,'mainActionLabel':Hi[_0x4052b9['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x527356,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x4c84a3['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x1d5992=new Map(),_0xec67e2=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0xb2b24a of _0xec67e2)for(const _0x486bfb of _0xb2b24a['commands'])_0x1d5992['set'](_0x486bfb['id'],{..._0x486bfb,'groupId':_0xb2b24a['groupId'],'groupLabel':_0xb2b24a['groupLabel']||_0xb2b24a['groupId']});return _0x1d5992;}['_createAIAssistantUIButton'](_0x303eb3){const _0x2995e4=this['editor'],_0x418951=_0x2995e4['commands']['get']('showAIAssistant'),_0x184e87=new _0x303eb3(_0x2995e4['locale']);return _0x184e87['set']({'label':Ni(_0x2995e4['locale'],'AI\x20Assistant'),'icon':_0x527356,'isToggleable':!0x0}),_0x184e87['bind']('isEnabled')['to'](_0x418951),_0x184e87['bind']('isOn')['to'](this['_dialog'],'id',_0x480b41=>'aiAssistant'===_0x480b41),this['listenTo'](_0x184e87,'execute',()=>{_0x184e87['isOn']?this['hideUI']():_0x418951['execute']();}),_0x184e87;}['_initView'](){const _0x53f43=this['editor']['plugins']['get'](Oi);this['_formView']=new qi(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',()=>{_0x53f43['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x53f43['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x203a9b,ui:{ariaLiveAnnouncer:_0x56ff1f}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x143005,_0x506a58,_0xee3183)=>{const _0x38544c=this['_aiAssistantController']['currentContext'];_0xee3183?_0x56ff1f['announce'](Ni(_0x203a9b,'AI\x20is\x20writing')):_0x38544c&&_0x56ff1f['announce'](Ni(_0x203a9b,'Generated\x20content:\x20%0',_0x38544c),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1f7049,_0x1e085d,_0x46321f)=>{if(_0x46321f){const _0x56e30d=this['_formView']['errorView']['text'];_0x56ff1f['announce'](Ni(_0x203a9b,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x56e30d));}});}['_onExecute'](_0xa526ff){const _0x433f7b=this['_commandDefinitions']['get'](_0xa526ff),_0x529a0d=this['editor'],_0x4c3997=_0x529a0d['model']['document']['selection'],_0xea890b=_0x529a0d['commands']['get']('showAIAssistant'),_0x39a0cd=_0x529a0d['plugins']['get'](Oi),_0x4c972b=''+('_ungrouppedCommands'!==_0x433f7b['groupId']?_0x433f7b['groupLabel']+':\x20':'')+_0x433f7b['label'];if(!0x1!==_0x433f7b['requiresContent']&&_0x4c3997['isCollapsed']){const _0x930194=mt(_0x4c3997['getSelectedBlocks']())||_0x529a0d['model']['schema']['getLimitElement'](_0x4c3997);_0x529a0d['model']['change'](_0x1147e3=>{_0x1147e3['setSelection'](_0x930194,'in');});}_0x39a0cd['showFakeVisualSelection'](),_0xea890b['execute'](_0x433f7b['prompt'],_0x4c972b,'command:'+_0xa526ff);}['_populateMenuBarMenu'](_0x5dffb4,_0x4d8416,_0xdf7aa1,_0x54ffb7){const _0x252d01=this['editor'],_0x1174a8=_0x252d01['locale'],_0x26d366=new te(_0x1174a8),_0x27bbfa=ji(_0x252d01,_0xdf7aa1)['filter'](_0x2c176e=>_0x2c176e['commands']['length']);0x1===_0x27bbfa['length']?this['_getMenuBarGroupButtons']({'command':_0x5dffb4,'commands':_0x27bbfa[0x0]['commands'],'parentMenuView':_0x4d8416,'onExecute':_0x54ffb7})['forEach'](_0x2c5666=>_0x26d366['items']['add'](_0x2c5666)):_0x27bbfa['forEach'](({groupId:_0xfaafb9,groupLabel:_0x108c1b,commands:_0x1435d5})=>{const _0x1848b5=new Zt(_0x1174a8,_0x4d8416),_0x933d1d=new _0x2c9b8f(_0x1174a8),_0x42a0e0=new te(_0x1174a8),_0x424122=this['_getMenuBarGroupButtons']({'command':_0x5dffb4,'commands':_0x1435d5,'parentMenuView':_0x933d1d,'onExecute':_0x54ffb7});_0x933d1d['buttonView']['set']({'label':_0x108c1b||_0xfaafb9}),_0x933d1d['delegate']('execute')['to'](_0x4d8416),_0x42a0e0['items']['addMany'](_0x424122),_0x933d1d['panelView']['children']['add'](_0x42a0e0),_0x1848b5['children']['add'](_0x933d1d),_0x26d366['items']['add'](_0x1848b5);}),_0x4d8416['panelView']['children']['add'](_0x26d366);}['_getMenuBarGroupButtons']({command:_0x1fb56f,commands:_0x231b7e,parentMenuView:_0x2851f7,onExecute:_0x2f81d7}){const _0x1aaf48=this['editor'],_0x6208d3=_0x1aaf48['locale'];return ji(_0x1aaf48,_0x231b7e)['map'](_0xd38c37=>{const _0x7b5385=new Zt(_0x6208d3,_0x2851f7),_0x56c0f8=new Jt(_0x6208d3);return _0x56c0f8['set']({'label':_0xd38c37['label']}),_0x56c0f8['delegate']('execute')['to'](_0x2851f7),_0x56c0f8['on']('execute',()=>_0x2f81d7(_0xd38c37['id'])),_0x56c0f8['bind']('isEnabled')['to'](_0x1fb56f,'enabledCommandsIds',_0x466cfc=>_0x466cfc['includes'](_0xd38c37['id'])),_0x7b5385['children']['add'](_0x56c0f8),_0x7b5385;});}};function zi(_0x35f156,_0x1c291c){return void 0x0!==_0x35f156['order']&&void 0x0===_0x1c291c['order']?0x1:void 0x0===_0x35f156['order']&&void 0x0!==_0x1c291c['order']?-0x1:void 0x0!==_0x35f156['order']&&void 0x0!==_0x1c291c['order']?_0x35f156['order']-_0x1c291c['order']:0x0;}function ji(_0x2d752d,_0x51a05f){_0x51a05f['sort'](zi);const _0x2d085b={},_0x57f290=[];for(const _0x10bbd3 of _0x51a05f)if(void 0x0!==_0x10bbd3['order']){if(_0x10bbd3['order']in _0x2d085b)throw new ht('ai-commands-config-order-collision',_0x2d752d,{'conflictingDefinitions':[_0x10bbd3,_0x2d085b[_0x10bbd3['order']]]});_0x2d085b[_0x10bbd3['order']]=_0x10bbd3,_0x57f290['splice'](_0x10bbd3['order'],0x0,_0x10bbd3);}else _0x57f290['push'](_0x10bbd3);return _0x57f290;}var Ji=class extends _0x538f78{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c8ea3){super(_0x5c8ea3);const _0x18871b=_0x5c8ea3['config'],_0x1b1972=_0x5c8ea3['locale'];_0x18871b['define']('ai.assistant.preserveComments',!0x0),_0x18871b['define']('ai.assistant.commands',Zi(_0x1b1972)),_0x18871b['define']('ai.assistant.extraCommandGroups',[]),_0x18871b['define']('ai.assistant.removeCommands',[]);let _0xb8801f=bi(_0x18871b['get']('ai.assistant.commands'),_0x1b1972);const _0x126452=_0x18871b['get']('ai.assistant.extraCommandGroups'),_0x17f692=_0x18871b['get']('ai.assistant.removeCommands');_0x126452['forEach'](_0x5619e1=>{const _0x227895=_0xb8801f['find'](_0x12454a=>_0x12454a['groupId']===_0x5619e1['groupId']);_0x227895?_0x227895['commands']=_0x227895['commands']['concat'](_0x5619e1['commands']):_0xb8801f['push'](_0x5619e1);}),_0xb8801f=_0xb8801f['filter'](_0x1645fe=>!_0x17f692['includes'](_0x1645fe['groupId'])),_0xb8801f['forEach'](_0x34b03f=>{_0x34b03f['commands']=_0x34b03f['commands']['filter'](_0x4b39c0=>!_0x17f692['includes'](_0x4b39c0['id']));}),_0x18871b['set']('ai.assistant.commands',_0xb8801f);}};function Zi(_0x3754b0){return[{'groupId':'editOrReview','groupLabel':Ni(_0x3754b0,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0x3754b0,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0x3754b0,'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':Ni(_0x3754b0,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0x3754b0,'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':Ni(_0x3754b0,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0x3754b0,'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':Ni(_0x3754b0,'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':Ni(_0x3754b0,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0x3754b0,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0x3754b0,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0x3754b0,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0x3754b0,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0x3754b0,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0x3754b0,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0x3754b0,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0x3754b0,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0x3754b0,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0x3754b0,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0x3754b0,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0x3754b0,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0x3754b0,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0x3754b0,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0x3754b0,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0x3754b0,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0x3754b0,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0x3754b0,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0x3754b0,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x538f78{['abortController'];static get['requires'](){return[vi];}constructor(_0xdb6d7a){super(_0xdb6d7a),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](vi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x296e5b){return this['sendRequest'](_0x296e5b)['catch'](_0x4ad978=>{if(_0x4ad978 instanceof ki)return Promise['reject'](_0x4ad978);if('AbortError'==_0x4ad978['name'])return Promise['resolve']();throw console['error'](_0x4ad978),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x5de36c,_0x377ebf){const _0x2f66df=this['editor']['locale'],_0xcdc101={'Content-Type':'application/json'};if('object'==typeof _0x5de36c)Object['assign'](_0xcdc101,_0x5de36c);else{if(_0x5de36c)try{const _0x5adac4=await _0x5de36c(_0x377ebf);Object['assign'](_0xcdc101,_0x5adac4);}catch{return Promise['reject'](new ki(Ni(_0x2f66df,'AI_ERROR_GET_HEADERS')));}}return _0xcdc101;}async['_prepareRequestParameters'](_0x7c82a6,_0x5004fb){const _0x5f3dcf=this['editor']['locale'];if('object'==typeof _0x7c82a6)return _0x7c82a6;try{return await _0x7c82a6(_0x5004fb);}catch{return Promise['reject'](new ki(Ni(_0x5f3dcf,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x34b308){super(_0x34b308),_0x34b308['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x34b308['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x34b308['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x34b308['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x34b308['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x34b308['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x4286b8,context:_0x89d2cf,onData:_0x292b50,actionId:_0x4db359}){const _0x180487=this['editor']['locale'],_0x24c2ea=await this['prepareMessages'](_0x4286b8,_0x89d2cf,_0x4db359),_0x1b8884=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4db359),_0x2fe1b6=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4db359),_0x354d02={'messages':_0x24c2ea,..._0x2fe1b6},_0x4234f0={'method':'POST','headers':_0x1b8884,'body':JSON['stringify'](_0x354d02),'signal':this['abortController']['signal']},_0x4d6212=await fetch(this['_apiUrl'],_0x4234f0);if(_0x4d6212['ok'])return _0x2fe1b6['stream']?await this['_readStreamableResponse'](_0x4d6212,_0x292b50):await this['_readStaticResponse'](_0x4d6212,_0x292b50),Promise['resolve']();{const _0x364406=await _0x4d6212['text']();return _0x364406['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x180487,'AI_ERROR_CONTEXT_LENGTH'))):_0x364406['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x180487,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x364406));}}async['prepareMessages'](_0x26ac0a,_0x262b66,_0x4d9db5){let _0xfd068e,_0xa3c228;return _0x262b66?(_0xfd068e='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.',_0xa3c228='Instruction:\x0a'+_0x26ac0a+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x262b66):(_0xfd068e='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.',_0xa3c228=_0x26ac0a),[{'role':'system','content':_0xfd068e},{'role':'user','content':_0xa3c228}];}async['_readStreamableResponse'](_0x1a5146,_0x1f941f){const _0x4983c5=_0x1a5146['body']['getReader'](),_0xfbd8d0=new TextDecoder();let _0x4f65eb='',_0x5890d8='',_0x1796c7='',_0xb84c76=!0x1;for(;!_0xb84c76;){const {done:_0x434181,value:_0x284762}=await _0x4983c5['read'](),_0x26fe82=_0x4f65eb+_0xfbd8d0['decode'](_0x284762);let _0x826385='';_0xb84c76=_0x434181;try{_0x826385=this['_cleanUpData'](_0x26fe82),_0x4f65eb='';}catch{_0x4f65eb=_0x26fe82;continue;}_0x5890d8+=_0x826385,!_0xb84c76&&this['_isBufferIncomplete'](_0x5890d8)||_0x5890d8&&(_0x1796c7+=_0x5890d8,_0x5890d8='',_0x1f941f(_0x1796c7));}return Promise['resolve']();}async['_readStaticResponse'](_0x399b9e,_0x13b3d8){return _0x13b3d8((await _0x399b9e['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x4ff477){const _0x2bb07a=_0x4ff477['split']('<')['length']!==_0x4ff477['split']('>')['length'],_0x4219f2=_0x4ff477['length']<0x1e;return _0x2bb07a&&_0x4219f2;}['_cleanUpData'](_0x49be25){return _0x49be25['split'](/\n(?![^{]*\})/g)['map'](_0xf2fc01=>_0xf2fc01['replace']('data:\x20',''))['filter'](_0x592654=>_0x592654&&_0x592654['length']>0x0&&'[DONE]'!==_0x592654)['map'](_0x532aa8=>{const {choices:_0x2b70f1}=JSON['parse'](_0x532aa8);if(_0x2b70f1[0x0]?.['delta']?.['content'])return _0x2b70f1[0x0]['delta']['content'];})['filter'](_0x31ac78=>_0x31ac78)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x2cfafb){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x57d68e,_0x511018={}){super(_0x57d68e),this['isToggleable']=!0x0,this['set']('side',_0x511018['side']||'top');const _0x3f518b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x511018['class']||[]),_0x3f518b['to']('side',_0x3533db=>'ck-tab-button_'+_0x3533db),_0x3f518b['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x5afcc4{['children'];constructor(_0x2faaaf,_0x519b3d={}){super(_0x2faaaf);const _0x5da23e=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x519b3d['class']||[]),_0x5da23e['to']('class'),_0x5da23e['if']('isVisible','ck-hidden',_0x58b144=>!_0x58b144)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x5afcc4{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x1a77f2,_0x4834aa={}){super(_0x1a77f2),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x4834aa['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x4834aa['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x1b9f79,_0x49293c)=>_0x1b9f79&&!_0x49293c);const _0x53ecb9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x4834aa['class']||[]),_0x53ecb9['to']('side',_0x52db7b=>'ck-tabs_'+_0x52db7b),_0x53ecb9['to']('class'),_0x53ecb9['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x53ecb9['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x53ecb9['to']('side',_0x1dc573=>'ck-tabs__buttons-container_'+_0x1dc573)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x53ecb9['to']('side',_0x4c7054=>'ck-tabs__panels-container_'+_0x4c7054)]},'children':this['panelViews']},...Ot(_0x4834aa['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x3c2277){const _0x1d8e46=this['_tabs']['get'](_0x3c2277);return _0x1d8e46||null;}['addTab'](_0x116875){const _0x5f3493=this['_setupButton']({'id':_0x116875['id'],'label':_0x116875['buttonLabel'],'icon':_0x116875['buttonIcon'],'order':_0x116875['order']}),_0x13e747=new ns(this['locale']);return _0x13e747['render'](),_0x116875['content']&&_0x13e747['children']['add'](_0x116875['content']),this['panelViews']['add'](_0x13e747),this['_tabs']['set'](_0x116875['id'],{'button':_0x5f3493,'panel':_0x13e747,'order':void 0x0!==_0x116875['order']?_0x116875['order']:null}),this['fire']('addTab:'+_0x116875['id'],{'id':_0x116875['id'],'button':_0x5f3493,'panel':_0x13e747}),null===this['activeTab']?this['activateTab'](_0x116875['id']):this['_hidePanel'](_0x116875['id']),{'button':_0x5f3493,'panel':_0x13e747};}['activateTab'](_0x1f4f1d){if(null!==_0x1f4f1d&&!this['getTab'](_0x1f4f1d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1f4f1d});if(this['isCollapsed']=!0x1,this['activeTab']===_0x1f4f1d)return;const _0x1f1b7e=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x1f4f1d,_0x1f4f1d&&this['_showPanel'](_0x1f4f1d),this['fire']('activateTab:'+_0x1f4f1d,{'newTab':_0x1f4f1d,'oldTab':_0x1f1b7e});}['toggleTabPanel'](_0x4701c8){this['activeTab']===_0x4701c8?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x4701c8);}['showTab'](_0x56c30c){if(!this['getTab'](_0x56c30c))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x56c30c});this['_showPanel'](_0x56c30c),this['_showButton'](_0x56c30c),this['fire']('show:'+_0x56c30c,_0x56c30c);}['hideTab'](_0x5118a3){if(!this['getTab'](_0x5118a3))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5118a3});const _0x4ca81f=this['activeTab'];this['_hidePanel'](_0x5118a3),this['_hideButton'](_0x5118a3);const _0x22309d=this['getTabIds']();_0x4ca81f===_0x5118a3&&_0x22309d['length']>0x1&&this['activateTab'](_0x22309d['find'](_0x495ac2=>_0x495ac2!==_0x5118a3)),this['fire']('hide:'+_0x5118a3,_0x5118a3);}['_getPanel'](_0x45e0f1){const _0xbaf0e3=this['_tabs']['get'](_0x45e0f1);return _0xbaf0e3?_0xbaf0e3['panel']:null;}['_showPanel'](_0x296e04){null!==this['activeTab']&&this['activeTab']!==_0x296e04||this['_getPanel'](_0x296e04)['show']();}['_hidePanel'](_0x130cdf){const _0x1a39fd=this['_getPanel'](_0x130cdf);_0x1a39fd['isVisible']&&(this['activeTab']===_0x130cdf&&(this['activeTab']=null),_0x1a39fd['hide']());}['_getButton'](_0x545166){const _0x5bbc3e=this['_tabs']['get'](_0x545166);return _0x5bbc3e?_0x5bbc3e['button']:null;}['_showButton'](_0x12598e){this['_getButton'](_0x12598e)['show']();}['_hideButton'](_0x56c478){this['_getButton'](_0x56c478)['hide']();}['_setupButton'](_0x194ed7){const _0x2f370a=new ss(this['locale'],{'side':this['side']}),_0x1d43a1=this['buttonViews'];if(_0x2f370a['set']({'label':_0x194ed7['label'],'icon':_0x194ed7['icon'],'tooltip':!0x0,'withText':!0x0}),_0x2f370a['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x45046e,_0x1fc31d)=>_0x45046e===_0x194ed7['id']&&!_0x1fc31d),_0x2f370a['bind']('side')['to'](this,'side'),_0x194ed7['order']){const _0x13c572=[...this['_tabs']]['reduce']((_0x59f533,_0x50a23a)=>{const _0x21146b=_0x50a23a[0x0],{order:_0x5b939c}=_0x50a23a[0x1];return!_0x5b939c||_0x5b939c>_0x194ed7['order']?_0x59f533:_0x5b939c>=_0x59f533['order']?{'id':_0x21146b,'order':_0x5b939c}:_0x59f533;},{'id':'','order':0x0}),_0x345db4=_0x1d43a1['getIndex'](this['_getButton'](_0x13c572['id']));_0x1d43a1['add'](_0x2f370a,_0x345db4+0x1);}else _0x1d43a1['add'](_0x2f370a);return _0x2f370a['on']('execute',()=>{this['toggleTabPanel'](_0x194ed7['id']);}),_0x2f370a;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x39e48b,_0x2d40b3={}){super(_0x39e48b,_0x2d40b3),this['set']('type',_0x2d40b3['type']||'sidebar'),this['set']('side',_0x2d40b3['side']||'right'),this['set']('isVisible',_0x2d40b3['visibleByDefault']??!0x0);const _0x3e77b1=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x3e77b1['if']('type','ck-ai-tabs__overlay',_0x27db56=>'overlay'===_0x27db56),_0x3e77b1['if']('type','ck-ai-tabs__sidebar',_0x35096a=>'sidebar'===_0x35096a),_0x3e77b1['if']('isVisible','ck-hidden',_0x47dcb0=>!_0x47dcb0)]}}),this['buttonViews']['on']('add',(_0xdb761d,_0x122993)=>{_0x122993['set']('withText',!0x1);});}},cs=class extends _0x215b79{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x10cd74){if(super(_0x10cd74),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x2ed3cc=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x2ed3cc['showResizeButton']&&(this['showResizeButton']=_0x2ed3cc['showResizeButton']),'sidebar'!==_0x2ed3cc['type']&&'overlay'!==_0x2ed3cc['type']||_0x2ed3cc['side']&&(this['side']=_0x2ed3cc['side']),'sidebar'===_0x2ed3cc['type']){if(this['container']=_0x2ed3cc['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x2ed3cc['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new hs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x2ed3cc['visibleByDefault'],'collapsible':_0x2ed3cc['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 _0x21f3b4&&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'](_0x48f88e){if(_0x48f88e&&this['type']!==_0x48f88e){if(!os['includes'](_0x48f88e))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x48f88e;}}['switchSide'](_0x300ae2){if(_0x300ae2&&this['side']!==_0x300ae2){if(!as['includes'](_0x300ae2))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x300ae2;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x215b79{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x4fc2a3];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x36c91c){if(super(_0x36c91c),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x3817d4=this['context']['plugins']['get'](_0x4fc2a3);if(!_0x3817d4['token'])throw new ht('ai-missing-token',this);this['_token']=_0x3817d4['token'];}['startConversation'](_0x3fb701,_0x151279){const _0x3de076=this['_sendApiRequest']('/conversations','POST',{'id':_0x3fb701,'group':_0x151279});return{'getConversation':async()=>(await _0x3de076['request'])['json'](),'abortController':_0x3de076['abortController']};}['queryAssistant']({message:_0x27a7da,conversationId:_0x5de29f,parts:_0x438c62,capabilities:_0x489629,model:_0xd7f857,attributes:_0x33cf0d}){const _0x5b0a7f={'prompt':_0x27a7da,'content':_0x438c62,'model':_0xd7f857,..._0x489629&&{'capabilities':_0x489629},..._0x33cf0d&&{'attributes':_0x33cf0d}},_0x40f4a4=this['_sendApiRequest']('/conversations/'+_0x5de29f+'/messages','POST',_0x5b0a7f,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x571f6c=(await _0x40f4a4['request'])['body'];return this['_getStreamReader'](_0x571f6c);},'abortController':_0x40f4a4['abortController']};}['executeCustomAction']({content:_0x2848c4,message:_0x4ac63a,model:_0x360470,outputFormat:_0x11cab3}){const _0xf81c6d={'content':[{'type':'text','content':_0x2848c4}],'prompt':_0x4ac63a,'model':_0x360470,'outputFormat':_0x11cab3},_0x11142a=this['_sendApiRequest']('/actions/custom/calls','POST',_0xf81c6d);return{'getStream':async()=>{const _0xb26e9b=(await _0x11142a['request'])['body'];return this['_getStreamReader'](_0xb26e9b);},'abortController':_0x11142a['abortController']};}['executeAction']({actionName:_0x5afe46,content:_0x205cc6,args:_0x55eee7}){const _0x56c413={'content':[{'type':'text','content':_0x205cc6}],'args':_0x55eee7},_0x50c97e=this['_sendApiRequest']('/actions/system/'+_0x5afe46+'/calls','POST',_0x56c413);return{'getStream':async()=>{const _0x4cdefc=(await _0x50c97e['request'])['body'];return this['_getStreamReader'](_0x4cdefc);},'abortController':_0x50c97e['abortController']};}['uploadFile'](_0x35ee79,_0x23d4bc,_0x322d22){const _0x5093a4=new FormData();_0x5093a4['append']('file',_0x23d4bc,_0x23d4bc['name']),_0x322d22&&_0x5093a4['append']('attributes',JSON['stringify'](_0x322d22));const _0x3b3653=this['_sendApiRequest']('/conversations/'+_0x35ee79+'/files','POST',_0x5093a4);return{'getId':async()=>(await _0x3b3653['request'])['json'](),'abortController':_0x3b3653['abortController']};}['uploadDocuments'](_0x2e519e,_0x72b0e1){const _0x20ec81={'documents':_0x72b0e1['map'](_0x38d5e1=>({'content':_0x38d5e1['content'],'attributes':{'version':_0x38d5e1['version'],'sessionId':_0x38d5e1['sessionId'],'channelId':_0x38d5e1['channelId'],'rootName':_0x38d5e1['rootName'],'selections':_0x38d5e1['selections']},...void 0x0!==_0x38d5e1['name']?{'name':_0x38d5e1['name']}:{},...void 0x0!==_0x38d5e1['description']?{'description':_0x38d5e1['description']}:{}}))},_0x4774f5=this['_sendApiRequest']('/conversations/'+_0x2e519e+'/documents/batch','POST',_0x20ec81);return{'getIds':async()=>(await _0x4774f5['request'])['json'](),'abortController':_0x4774f5['abortController']};}['fetchDocuments'](_0x4d6e2e,_0x4b3058){const _0x431075=new URLSearchParams();_0x431075['append']('documentIds',_0x4b3058['join'](','));const _0x17e3e1=this['_sendApiRequest']('/conversations/'+_0x4d6e2e+'/documents/batch?'+_0x431075['toString'](),'GET');return{'getDocuments':async()=>(await _0x17e3e1['request'])['json'](),'abortController':_0x17e3e1['abortController']};}['fetchConversations'](_0x2a9a3d,_0x46cd08={}){const _0x2e7b98=new URLSearchParams();_0x2e7b98['append']('group',_0x2a9a3d),_0x2e7b98['append']('excludeEmpty',!0x1!==_0x46cd08['excludeEmpty']?'true':'false'),_0x2e7b98['append']('limit',_0x46cd08['limit']?_0x46cd08['limit']['toString']():'100'),_0x2e7b98['append']('sortBy',_0x46cd08['sortBy']?_0x46cd08['sortBy']:'createdAt'),_0x2e7b98['append']('order',_0x46cd08['order']?_0x46cd08['order']:'desc');const _0x18bcd2=this['_sendApiRequest']('/conversations?'+_0x2e7b98['toString'](),'GET');return{'getConversations':async()=>(await(await _0x18bcd2['request'])['json']())['items'],'abortController':_0x18bcd2['abortController']};}['deleteConversation'](_0x4bbb4e){const _0x514ea4=this['_sendApiRequest']('/conversations/'+_0x4bbb4e,'DELETE');return{'execute':async()=>{await _0x514ea4['request'];},'abortController':_0x514ea4['abortController']};}['updateConversation'](_0x1ebfa6,_0x223817){const _0x31acb5=this['_sendApiRequest']('/conversations/'+_0x1ebfa6,'PATCH',_0x223817);return{'getResult':async()=>(await _0x31acb5['request'],_0x223817),'abortController':_0x31acb5['abortController']};}['fetchConversation'](_0x25b08d){const _0x378303=this['_sendApiRequest']('/conversations/'+_0x25b08d,'GET');return{'getConversation':async()=>(await _0x378303['request'])['json'](),'abortController':_0x378303['abortController']};}['fetchConversationMessages'](_0x37d4bb){const _0x34cd43=this['_sendApiRequest']('/conversations/'+_0x37d4bb+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x34cd43['request'])['json']())['items'],'abortController':_0x34cd43['abortController']};}['uploadUrl'](_0x46491c,_0x294e37,_0x44f9aa){const _0x5d5746=this['_sendApiRequest']('/conversations/'+_0x46491c+'/web-resources','POST',{'url':_0x294e37,'attributes':_0x44f9aa});return{'getId':async()=>(await _0x5d5746['request'])['json'](),'abortController':_0x5d5746['abortController']};}['getModels'](_0x445866='en'){const _0x58ff60=new URLSearchParams();_0x58ff60['append']('language',_0x445866);const _0x29392e='/models/1?'+_0x58ff60['toString'](),_0x2a922a=this['_sendApiRequest'](_0x29392e,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x2a922a['request'])['json'](),'abortController':_0x2a922a['abortController']};}['deleteFile'](_0x1d07f4,_0x3b9f0b){const _0x376f93=this['_sendApiRequest']('/conversations/'+_0x1d07f4+'/files/'+_0x3b9f0b,'DELETE');return{'execute':async()=>{await _0x376f93['request'];},'abortController':_0x376f93['abortController']};}['deleteDocument'](_0x1e26ea,_0x590c3c){const _0x380df9=this['_sendApiRequest']('/conversations/'+_0x1e26ea+'/documents/'+_0x590c3c,'DELETE');return{'execute':async()=>{await _0x380df9['request'];},'abortController':_0x380df9['abortController']};}['deleteWebResource'](_0x520a66,_0x6c977a){const _0x35f59b=this['_sendApiRequest']('/conversations/'+_0x520a66+'/web-resources/'+_0x6c977a,'DELETE');return{'execute':async()=>{await _0x35f59b['request'];},'abortController':_0x35f59b['abortController']};}['cancelStream'](_0x3f69ec,_0x210d2a){const _0x20f85f=this['_sendApiRequest']('/conversations/'+_0x3f69ec+'/messages/'+_0x210d2a+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x20f85f['request'];},'abortController':_0x20f85f['abortController']};}['resumeStream'](_0x384912,_0x5ae463,_0x5df4a7='0-0'){const _0x85c289=new URLSearchParams({'lastEventId':_0x5df4a7}),_0x240b74=this['_sendApiRequest']('/conversations/'+_0x384912+'/messages/'+_0x5ae463+'/stream?'+_0x85c289['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x286f86=await _0x240b74['request'];return this['_getStreamReader'](_0x286f86['body']);},'abortController':_0x240b74['abortController']};}['callSystemReview']({reviewName:_0x35dac9,content:_0x5f5c39,args:_0x107a45}){const _0x10aba6=this['_sendApiRequest']('/reviews/system/'+_0x35dac9+'/calls','POST',{'content':[{'type':'text','content':_0x5f5c39}],'args':_0x107a45});return{'getStream':async()=>{const _0x17f1a8=(await _0x10aba6['request'])['body'];return this['_getStreamReader'](_0x17f1a8);},'abortController':_0x10aba6['abortController']};}['processDocument']({document:_0x51282c,prompt:_0x379893,model:_0x2477da}){const _0x1323b9=this['_sendApiRequest']('/documents/process','POST',{'document':_0x51282c,'prompt':_0x379893,'model':_0x2477da});return{'getResult':async()=>(await _0x1323b9['request'])['json'](),'abortController':_0x1323b9['abortController']};}['callCustomReview']({content:_0x34ab5b,prompt:_0x15a3ae,model:_0x1575c2}){const _0x579b9a=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x34ab5b}],'prompt':_0x15a3ae,'model':_0x1575c2});return{'getStream':async()=>{const _0x37967a=(await _0x579b9a['request'])['body'];return this['_getStreamReader'](_0x37967a);},'abortController':_0x579b9a['abortController']};}['upsertAIChatRating'](_0x412b79,_0x111e1c,_0x28ffd9){const _0x42e6fa=this['_sendApiRequest']('/conversations/'+_0x412b79+'/messages/'+_0x111e1c+'/ratings','PUT',{'positiveCount':_0x28ffd9['positiveCount'],'totalCount':_0x28ffd9['totalCount'],'modificationId':_0x28ffd9['modificationId']});return{'execute':async()=>{await _0x42e6fa['request'];},'abortController':_0x42e6fa['abortController']};}['upsertAIActionRating'](_0x2954fc,_0x5c1239,_0x144d89){const _0x11626c=this['_sendApiRequest']('/actions/system/'+_0x2954fc+'/calls/'+_0x5c1239+'/ratings','PUT',{'positiveCount':_0x144d89['positiveCount'],'totalCount':_0x144d89['totalCount']});return{'execute':async()=>{await _0x11626c['request'];},'abortController':_0x11626c['abortController']};}['upsertCustomAIActionRating'](_0x4f028f,_0x4d6197){const _0x55d760=this['_sendApiRequest']('/actions/custom/calls/'+_0x4f028f+'/ratings','PUT',{'positiveCount':_0x4d6197['positiveCount'],'totalCount':_0x4d6197['totalCount']});return{'execute':async()=>{await _0x55d760['request'];},'abortController':_0x55d760['abortController']};}['upsertAIReviewRating'](_0x1a31c8,_0x3f5f66,_0x534f56,_0x5809a5){const _0x89e8bb=this['_sendApiRequest']('/reviews/system/'+_0x1a31c8+'/calls/'+_0x3f5f66+'/ratings','PUT',{'positiveCount':_0x534f56['positiveCount'],'totalCount':_0x534f56['totalCount'],'dataId':_0x5809a5});return{'execute':async()=>{await _0x89e8bb['request'];},'abortController':_0x89e8bb['abortController']};}['upsertCustomAIReviewRating'](_0x4eef22,_0x588e8f,_0x580422){const _0x4cd6fa=this['_sendApiRequest']('/reviews/custom/calls/'+_0x4eef22+'/ratings','PUT',{'positiveCount':_0x588e8f['positiveCount'],'totalCount':_0x588e8f['totalCount'],'dataId':_0x580422});return{'execute':async()=>{await _0x4cd6fa['request'];},'abortController':_0x4cd6fa['abortController']};}['_sendApiRequest'](_0x22aff0,_0x2d0505,_0x47da84,_0x48eb06={}){const {useCache:_0x309853=!0x1,apiUrl:_0x26dcee=this['_apiUrl']}=_0x48eb06,_0x276a6f=new AbortController(),_0x4390bc=_0x309853?_0x2d0505+':'+_0x22aff0:null;if(_0x4390bc){const _0x10d28a=this['_responseCache']['get'](_0x4390bc);if(_0x10d28a)return{'request':_0x10d28a['then'](_0x347cb6=>_0x347cb6['clone']()),'abortController':_0x276a6f};}const _0x10e84b=_0x47da84 instanceof FormData,_0x396546={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x47da84&&!_0x10e84b&&(_0x396546['Content-Type']='application/json');const _0x5362cd={'method':_0x2d0505,'headers':_0x396546,'signal':_0x276a6f['signal']};_0x47da84&&(_0x5362cd['body']=_0x10e84b?_0x47da84:JSON['stringify'](_0x47da84));const _0x7ea4ca=fetch(''+_0x26dcee+_0x22aff0,_0x5362cd)['catch'](_0xaee529=>{_0x4390bc&&this['_responseCache']['delete'](_0x4390bc),this['_handleError'](_0xaee529);})['then'](_0x2be919=>_0x2be919['ok']?_0x2be919:_0x2be919['json']()['then'](_0x3e526f=>{throw _0x4390bc&&this['_responseCache']['delete'](_0x4390bc),{'url':_0x26dcee,'path':_0x22aff0,'method':_0x2d0505,'body':_0x47da84,'status':(_0x2be919||{})['status'],'statusText':(_0x2be919||{})['statusText'],'code':_0x3e526f['code'],'message':_0x3e526f['message'],'traceId':_0x3e526f['traceId']};}));return _0x4390bc&&this['_responseCache']['set'](_0x4390bc,_0x7ea4ca['then'](_0x11e8e8=>_0x11e8e8['clone']())),{'request':_0x7ea4ca,'abortController':_0x276a6f};}async*['_getStreamReader'](_0x4e07f1){const _0x1c1aa7=[],_0x9b6e89=_0x4e07f1['getReader'](),_0x397b38=_0x1ce2ef({'onError':_0xe616a7=>{this['_handleError'](_0xe616a7);},'onEvent':_0x42bcf0=>{_0x42bcf0['data']=JSON['parse'](_0x42bcf0['data']),_0x1c1aa7['push'](_0x42bcf0);}});try{let _0xd76635=!0x1;for(;!_0xd76635;){const {done:_0x22328f,value:_0x7081a9}=await _0x9b6e89['read']();_0x22328f&&(_0xd76635=!0x0),_0x397b38['feed'](this['_decoder']['decode'](_0x7081a9,{'stream':!0x0})),yield*_0x1c1aa7,_0x1c1aa7['length']=0x0;}}catch(_0x58565d){this['_handleError'](_0x58565d);}finally{_0x9b6e89['releaseLock'](),_0x397b38['reset']();}}['_handleError'](_0x486fcb){if(_0x486fcb instanceof ht)throw _0x486fcb;if(_0x486fcb instanceof Error&&'AbortError'===_0x486fcb['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x486fcb});throw new ht('ai-request-failed',this,{'originalError':_0x486fcb});}};function us(_0x581e40,_0x414961,_0x34ce8d){const t=_0x581e40['t'];switch(_0x414961){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'},_0x34ce8d);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x34ce8d);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.'},_0x34ce8d);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x34ce8d);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'},_0x34ce8d);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x34ce8d);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'},_0x34ce8d);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.'},_0x34ce8d);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.'},_0x34ce8d);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.'},_0x34ce8d);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.'},_0x34ce8d);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'},_0x34ce8d);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.'},_0x34ce8d);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x414961;}}function ds(_0xaeeee6){return _0xaeeee6?_0xaeeee6 instanceof _0x21f3b4?[_0xaeeee6]:_0xaeeee6['editors']&&0x0!==_0xaeeee6['editors']['length']?Array['from'](_0xaeeee6['editors']):[]:[];}function _s(_0x34a751){const _0x2ef7b0=ds(_0x34a751);if(!_0x2ef7b0['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x2ef7b0['length'])return _0x2ef7b0[0x0];const _0x119273=_0x2ef7b0['find'](_0x58788a=>_0x58788a['ui']?.['focusTracker']?.['isFocused']);if(_0x119273)return _0x119273;const _0x1de92e=function(_0x1d0a7d){if(_0x1d0a7d instanceof _0x21f3b4)return;const _0x5ed85d=_0x1d0a7d;if(!_0x5ed85d['plugins']||!_0x5ed85d['plugins']['has']('AIEditing'))return;return _0x5ed85d['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x34a751);return _0x1de92e&&_0x2ef7b0['includes'](_0x1de92e)?_0x1de92e:_0x2ef7b0[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x215b79{constructor(_0x3f6506){super(_0x3f6506),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x55b442){let _0x9d6216=this['_sessionIdByEditor']['get'](_0x55b442);return _0x9d6216||(_0x9d6216=_0x55b442['plugins']['has']('RealTimeCollaborationClient')&&_0x55b442['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x55b442,_0x9d6216)),_0x9d6216;}async['getDocumentData'](){const _0x7cebb=ds(this['context']);if(!_0x7cebb['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x30b9b2=[],_0x19686f=new Set();for(const _0x4b9ade of _0x7cebb){const _0x575391=_0x4b9ade['config']['get']('roots')||{};for(const _0x4909ba of _0x4b9ade['model']['document']['getRoots']()){if('$graveyard'===_0x4909ba['rootName'])continue;const _0x1d259f=await this['_getDocumentDataForEditorRoot'](_0x4b9ade,_0x4909ba,_0x19686f),_0x295f02=_0x575391[_0x4909ba['rootName']],_0x36b4a4=_0x4909ba['getAttribute']('$description')??_0x295f02?.['description'];let _0x10c217=_0x4909ba['getAttribute']('$title')??_0x295f02?.['title'];_0x10c217||(_0x10c217=_0x4909ba['getAttribute']('$rootEditableOptions')?.['label']??_0x295f02?.['label']),_0x10c217||(bt('ai-document-root-missing-title',{'editor':_0x4b9ade,'rootName':_0x4909ba['rootName']}),_0x10c217=_0x4909ba['rootName']),_0x30b9b2['push']({'editor':_0x4b9ade,'rootName':_0x4909ba['rootName'],'content':_0x1d259f['content'],'version':_0x1d259f['version'],'sessionId':this['getSessionId'](_0x4b9ade),'channelId':_0x4b9ade['config']['get']('collaboration.channelId'),'selections':_0x1d259f['selections'],'name':_0x10c217,'description':_0x36b4a4});}}return _0x30b9b2;}async['_getDocumentDataForEditorRoot'](_0xb1047b,_0x1f05e6,_0x18037b){const _0x478316=_0xb1047b['data']['toView'](_0x1f05e6,{'convertAiChatSelectionMarker':!0x0}),_0x2f39d0=new _0x7e6bd5(_0xb1047b['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x478316,_0x2f39d0,_0x18037b);let _0x2d4b7c=await this['_getDocumentDataStringFromView'](_0x478316,_0xb1047b);const _0x4acee2=this['_getMarkersInDocumentOrder'](_0xb1047b,_0x1f05e6),_0x2df665=[];for(const _0x449aef of _0x4acee2){const _0x29428c='<'+_0x449aef['name']+':start></'+_0x449aef['name']+':start>',_0x43a5f3=_0x2d4b7c['indexOf'](_0x29428c);_0x2d4b7c=_0x2d4b7c['substring'](0x0,_0x43a5f3)+_0x2d4b7c['substring'](_0x43a5f3+_0x29428c['length']);const _0x3a94a9='<'+_0x449aef['name']+':end></'+_0x449aef['name']+':end>',_0x551104=_0x2d4b7c['indexOf'](_0x3a94a9);_0x2d4b7c=_0x2d4b7c['substring'](0x0,_0x551104)+_0x2d4b7c['substring'](_0x551104+_0x3a94a9['length']),_0x2df665['push']({'markerName':_0x449aef['name'],'start':_0x43a5f3,'end':_0x551104,'htmlFragment':_0x2d4b7c['substring'](_0x43a5f3,_0x551104)});}return{'content':_0x2d4b7c,'version':_0xb1047b['model']['document']['version'],'selections':_0x2df665};}['afterInit'](){this['context']instanceof _0x21f3b4?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x54c856,_0x5b3660)=>{_0x5b3660['on']('ready',()=>{this['_integrateEditor'](_0x5b3660);});});}['_setOutputDataProcessor'](_0x520d6b){this['_outputDataProcessor']=_0x520d6b;}async['_getDocumentDataStringFromView'](_0x52cb3c,_0x21e6db){let _0xb058a1;if(this['_outputDataProcessor']){const _0x1c00bf=_0x21e6db['data']['processor']['domConverter']['viewToDom'](_0x52cb3c),_0x459ac4=await this['_outputDataProcessor'](_0x1c00bf);_0xb058a1=_0x21e6db['data']['processor']['htmlWriter']['getHtml'](_0x459ac4);}else _0xb058a1=_0x21e6db['data']['processor']['toData'](_0x52cb3c);return _0xb058a1;}['_integrateEditor'](_0x384705){if(!_0x384705['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x384705);_0x384705['ui']['focusTracker']['on']('change:isFocused',(_0x3e002f,_0xe994e8,_0x5c9a5e)=>{_0x5c9a5e&&(this['_lastContentFocusedEditor']=_0x384705);}),_0x384705['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x384705&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x384705['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x451991})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x451991['split'](':')[0x1]],'priority':0xc})}),_0x384705['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x46e832,{writer:_0x2a7c6d,options:_0x1fc2ec})=>_0x1fc2ec['convertAiChatSelectionMarker']?_0x2a7c6d['createUIElement'](_0x46e832['markerName']+':'+(_0x46e832['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x2c9748){const _0x43e170=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x2c9748);const _0x2e0d6c=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x43e170,_0x2e0d6c);}['hideFakeVisualSelection'](_0x3415c5){const _0x38c62f=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x3415c5);const _0xeb1280=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x38c62f,_0xeb1280);}async['modelToDataWithIds'](_0x228b02,_0xfea628){const _0x4e752f=_0xfea628['data']['toView'](_0x228b02),_0x5d672b=new _0x7e6bd5(_0xfea628['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x4e752f,_0x5d672b),this['_getDocumentDataStringFromView'](_0x4e752f,_0xfea628);}['_setDataIdsOnChildren'](_0x1caed1,_0x285c52,_0x38b09b=new Set()){let _0x1e33ad=!0x1;for(const _0x15ecb6 of _0x1caed1['getChildren']()){if(!_0x15ecb6['is']('view:element')||As['includes'](_0x15ecb6['name']))continue;const _0x45f3b5=_0x15ecb6['is']('view:containerElement'),_0x1b92aa=_0x15ecb6['is']('view:emptyElement'),_0xe68ec8=_0x15ecb6['is']('view:rawElement'),_0x35044f=this['_setDataIdsOnChildren'](_0x15ecb6,_0x285c52,_0x38b09b);_0x15ecb6['hasAttribute']('data-id')?(_0x1e33ad=!0x0,_0x38b09b['add'](_0x15ecb6['getAttribute']('data-id'))):(_0x45f3b5||_0x1b92aa||_0xe68ec8||_0x35044f)&&(_0x285c52['setAttribute']('data-id',this['_nextDataId'](_0x38b09b),_0x15ecb6),_0x1e33ad=!0x0);}return _0x1e33ad;}['_nextDataId'](_0x534181){let _0x4a484a;do{_0x4a484a='';for(let _0x256066=0x0;_0x256066<0x4;_0x256066++)_0x4a484a+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x534181['has'](_0x4a484a));return _0x534181['add'](_0x4a484a),_0x4a484a;}['getSelectionText'](_0x5a118c){const _0x5db3fa=(_0x5a118c?_0x5a118c['model']:_s(this['context'])['model'])['document']['selection'],_0x50f1d0=[],_0x5b02ce=Array['from'](_0x5db3fa['getRanges']());_0x5b02ce['sort']((_0x466711,_0x33ab0b)=>_0x466711['start']['isBefore'](_0x33ab0b['start'])?-0x1:0x1);for(const _0x54b3e2 of _0x5b02ce)for(const _0x399be2 of _0x54b3e2['getItems']())_0x399be2['is']('$textProxy')?_0x50f1d0['push'](_0x399be2['data']):_0x399be2['is']('element')&&_0x50f1d0['length']>0x0&&'\x20'!==_0x50f1d0[_0x50f1d0['length']-0x1]&&_0x50f1d0['push']('\x20');return _0x50f1d0['length']?'\x22'+_0x50f1d0['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x5e8d17){for(let _0x5cb7b7=0x0;_0x5cb7b7<this['_fakeSelections']['length'];_0x5cb7b7++)if(this['_fakeSelections'][_0x5cb7b7]['id']==_0x5e8d17)return void this['_fakeSelections']['splice'](_0x5cb7b7,0x1);}['_addFakeSelection'](_0x243c1e){this['_removeFakeSelectionById'](_0x243c1e['id']),wt(this['_fakeSelections'],_0x243c1e);}['_refreshFakeSelection'](_0x58b2b5,_0x3b44e0){if(_0x58b2b5==_0x3b44e0)return;const _0x1a8d82=_0x58b2b5?_0x58b2b5['editor']:null,_0x22f447=_0x3b44e0?_0x3b44e0['editor']:null,_0x125136=(_0x49c06e,_0x34e504)=>{const _0x563e72=_0x34e504['model']['markers']['getMarkersGroup'](gs);for(const _0x30a980 of _0x563e72)_0x49c06e['removeMarker'](_0x30a980);},_0x5c0f6b=(_0x328ec8,_0x293ee0,_0x3eafce)=>{const _0x47aae5=_0x293ee0['model'];for(let _0x2fee68=0x0;_0x2fee68<_0x3eafce['ranges']['length'];_0x2fee68++){let _0x429b17=_0x3eafce['ranges'][_0x2fee68];const _0x560553=gs+':'+_0x3eafce['id']+':'+_0x2fee68;if(_0x429b17['start']['isAtEnd']){const _0x4d440e=_0x429b17['start']['getLastMatchingPosition'](({item:_0x1e43f8})=>!_0x47aae5['schema']['isContent'](_0x1e43f8),{'boundaries':_0x429b17});_0x429b17=_0x328ec8['createRange'](_0x4d440e,_0x429b17['end']);}_0x328ec8['addMarker'](_0x560553,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x429b17});}};_0x1a8d82&&_0x22f447&&_0x1a8d82===_0x22f447&&_0x3b44e0?_0x1a8d82['model']['change'](_0x2a4171=>{_0x125136(_0x2a4171,_0x1a8d82),_0x5c0f6b(_0x2a4171,_0x22f447,_0x3b44e0);}):(_0x1a8d82&&_0x1a8d82['model']['change'](_0x174e42=>_0x125136(_0x174e42,_0x1a8d82)),_0x22f447&&_0x3b44e0&&_0x22f447['model']['change'](_0x3f4c6b=>_0x5c0f6b(_0x3f4c6b,_0x22f447,_0x3b44e0)));}['_getMarkersInDocumentOrder'](_0x2a929e,_0x34f15b){const _0x4cb01a=Array['from'](_0x2a929e['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x34f15b?_0x4cb01a['filter'](_0x118c23=>{const _0x1c5fec=_0x118c23['getRange']();return _0x1c5fec&&_0x1c5fec['root']['rootName']===_0x34f15b['rootName'];}):_0x4cb01a)['sort']((_0x47a798,_0x1df881)=>_0x47a798['getStart']()['isBefore'](_0x1df881['getStart']())?-0x1:_0x47a798['getStart']()['isAfter'](_0x1df881['getStart']())?0x1:0x0);}};function ps(_0x2f5c52,_0x27c0f4){return _0x4152d5(_0x2f5c52,_0x27c0f4);}function ms(_0x16072d,_0xec78c6){return _0x420708(_0x16072d,_0xec78c6);}function Es(_0x1b9a15,_0x4fd1a8,_0x310405){const _0x3df656=null!==_0x4fd1a8?_0x166ffa=>_0x166ffa['attribs'][_0x1b9a15]===_0x4fd1a8:_0x257c1e=>Boolean(_0x257c1e['attribs'][_0x1b9a15]);return ti(_0x2b983b=>_0x34aa28(_0x2b983b)&&_0x3df656(_0x2b983b),_0x310405);}function Ts(_0x54f53c,_0x158dbb,_0x5982a3){const _0x17d820=null!==_0x158dbb?_0x359551=>_0x359551['attribs'][_0x54f53c]===_0x158dbb:_0x1727aa=>Boolean(_0x1727aa['attribs'][_0x54f53c]);return _0x389c21(_0x3c6e58=>_0x34aa28(_0x3c6e58)&&_0x17d820(_0x3c6e58),_0x5982a3);}function ws(_0x4649a6){return _0x389c21(_0x46a55b=>_0x34aa28(_0x46a55b)&&function(_0x2a72fc){const _0x4d01bb=_0x2a72fc['toLowerCase']();return'script'===_0x4d01bb||'style'===_0x4d01bb||_0x4d01bb['includes']('-');}(_0x46a55b['name']),_0x4649a6);}function Cs(_0x47edc2){return _0x484c09(_0x86fd3c=>_0x253096(_0x86fd3c),_0x47edc2,!0x0,0x1/0x0);}function fs(_0xa3eb8b,_0x47086f){return _0xa3eb8b&&_0x34aa28(_0xa3eb8b)?_0xa3eb8b['attribs'][_0x47086f]:null;}function bs(_0x54028f,_0x1f838f,_0x2994ef){_0x34aa28(_0x54028f)&&(null===_0x2994ef?delete _0x54028f['attribs'][_0x1f838f]:_0x54028f['attribs'][_0x1f838f]=_0x2994ef);}function Ss(_0xb43c6c,_0x2c8111,_0x30106c){const _0x2bf440=_0x2c8111['cloneNode'](!0x0);'beforebegin'===_0x30106c?_0x52f7e8(_0xb43c6c,_0x2bf440):'afterbegin'===_0x30106c?_0x834dd8(_0xb43c6c,_0x2bf440):'beforeend'===_0x30106c?_0x4b5e7a(_0xb43c6c,_0x2bf440):'afterend'===_0x30106c&&_0x430def(_0xb43c6c,_0x2bf440);}function Rs(_0x45a0f5){const _0x37eea8=[];let _0x1c8661=_0x45a0f5;for(;_0x1c8661;)_0x1c8661=_0x1b6412(_0x1c8661),_0x1c8661&&_0x37eea8['push'](_0x1c8661);return _0x37eea8;}function Os(_0x3469ef){return _0x3469ef['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x252bc7){let _0x42415c=0x0;for(;_0x252bc7['parentNode'];)_0x252bc7=_0x252bc7['parentNode'],_0x42415c++;return _0x42415c;}function ks(_0x499265){const _0xfa11a2=[];let _0x5b3377=_0x499265['nextSibling'];for(;_0x5b3377;)_0xfa11a2['push'](_0x5b3377),_0x5b3377=_0x5b3377['nextSibling'];_0xfa11a2['forEach'](_0x4f4c99=>{_0x1356eb(_0x4f4c99);});}function Ns({documentSuggestions:_0x22bb57,transform:_0x12d76a,documentCompare:_0x29ad36,documentCompareOptions:_0x3c05ba}){const _0x3498a4=new Map();for(const [_0x308339,{groups:_0x4b6789,documentContext:_0x56a8,documentContent:_0x52dec3,editor:_0x3e4bce}]of _0x22bb57){const _0x539cc2=_0x56a8['content'],_0x50145c=_0x56a8['version'],_0x2dcadb=_0x52dec3['cloneNode'](!0x0);for(const {changes:_0x3e6048}of _0x4b6789){const _0x239401=_0x3e6048['filter'](_0x11e8dc=>'new'!=_0x11e8dc['type'])['map'](_0x331602=>Es('data-id',_0x331602['id'],_0x2dcadb))['filter'](_0x3a32d5=>null!==_0x3a32d5),_0xdc1c3a=_0x3e6048['filter'](_0x3bcef0=>'removed'!=_0x3bcef0['type'])['map'](_0x3b404c=>_0x3b404c['node']['cloneNode'](!0x0));let _0x67dd2e=null;if(_0x239401['length']){_0x67dd2e=_0x239401[0x0]['previousSibling'];for(let _0x5ec21c=0x0;_0x5ec21c<_0x239401['length'];_0x5ec21c++)_0x1356eb(_0x239401[_0x5ec21c]);}if(_0xdc1c3a['length']){_0x67dd2e||(_0x3e6048[0x0]['anchorId']?_0x67dd2e=Es('data-id',_0x3e6048[0x0]['anchorId'],_0x2dcadb):(_0x67dd2e=_0xdc1c3a['shift'](),_0x834dd8(_0x2dcadb,_0x67dd2e)));for(let _0x298f51=0x0;_0x298f51<_0xdc1c3a['length'];_0x298f51++)_0x430def(_0x67dd2e,_0xdc1c3a[_0x298f51]),_0x67dd2e=_0xdc1c3a[_0x298f51];}}const _0x4ab12e=ms(_0x2dcadb),_0x36bce3=_0x29ad36['getDiff'](_0x539cc2,_0x4ab12e,{'targetEditor':_0x3e4bce,'anchor':_0x56a8['rootName'],..._0x3c05ba})['getOperations']();if(_0x12d76a){const _0x2b8ca1=_0x3e4bce['model']['document']['history']['getOperations'](_0x50145c),_0x293768={'document':_0x3e4bce['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x3498a4['set'](_0x308339,_0x25b633(_0x36bce3,_0x2b8ca1,_0x293768)['operationsA']);}else _0x3498a4['set'](_0x308339,_0x36bce3);}return _0x3498a4;}function ys(_0x38b963,_0x31d57d){if('marker'!=_0x31d57d['type'])return;const _0x5bafd9=_0x38b963['model']['markers']['get'](_0x31d57d['name']);_0x5bafd9&&(_0x31d57d['oldRange']=_0x5bafd9['getRange']());}const xs=/* #__PURE__ -- @preserve */
25
+ gt();var Ls=class extends xs{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x49f71d){super(),this['_generateUid']=_0x49f71d||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x2cc067,_0xac8cf5,_0x1e6792){this['_uidCounter']=0x0;const _0x48d8b0=_0x2cc067['cloneNode'](!0x0);Hs(_0xac8cf5,_0x48d8b0);const _0x4ece06=_0x48d8b0['childNodes'],_0x3e8ed1=Array['from'](_0x4ece06)['filter'](_0x12b514=>!(0x3===_0x12b514['nodeType']&&''===ms(_0x12b514)['trim']())),_0x1b1b77=_0x3e8ed1['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0xac8cf5)['map'](_0x5c95e8=>fs(_0x5c95e8,'data-id'))['filter'](_0x384ddc=>!!_0x384ddc));for(const _0x4436d7 of _0x3e8ed1)_0x4436d7&&_0x34aa28(_0x4436d7)&&void 0x0===_0x4436d7['attribs']['data-id']&&bs(_0x4436d7,'data-id','new-element');if(Ts('data-id',null,_0x48d8b0)['forEach'](_0x355128=>{const _0x5e47a9=fs(_0x355128,'data-id');'new-element'===_0x5e47a9||this['_existingDataIds']['has'](_0x5e47a9)||bs(_0x355128,'data-id','new-element');}),0x0===_0xac8cf5['childNodes']['length']){const _0x3885a4=[];return Ts('data-id','new-element',_0x48d8b0)['forEach'](_0x1344b3=>{const _0x74c085=this['_generateUid']();bs(_0x1344b3,'data-id',_0x74c085),_0x3885a4['push'](_0x74c085);}),this['_removeSpecialComments'](_0x48d8b0),{'parsedContent':_0x48d8b0,'newNodeIds':_0x3885a4,'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 _0x32283e=-0x1,_0x1d4ec4=!0x1;for(let _0xf9fe93=0x0;_0xf9fe93<_0x1b1b77;_0xf9fe93++){const _0x41b3ba=_0x3e8ed1[_0xf9fe93],_0xe51a85=_0x3e8ed1[_0xf9fe93+0x1];if(this['_isNewNode'](_0x41b3ba)){if(-0x1===_0x32283e&&(_0x32283e=_0xf9fe93),this['_markWrappedElements'](_0x41b3ba),!this['_isNewNode'](_0xe51a85)){const [_0x5a416c,_0xbdd02a]=this['_findReferenceNode'](_0x41b3ba,_0x1d4ec4,_0xac8cf5);if(_0x5a416c){const _0x271e52=Array['from'](_0x3e8ed1)['slice'](_0x32283e,_0xf9fe93+0x1);this['_insertNodes'](_0x5a416c,_0x271e52,_0xbdd02a),_0x32283e=-0x1;}}}else{if(this['_isExistingContentComment'](_0x41b3ba))_0x1d4ec4=!0x0;else{if(this['_isExistingNode'](_0x41b3ba)){const _0x415f37=fs(_0x41b3ba,'data-id');if(_0x415f37&&this['_existingDataIds']['has'](_0x415f37)){this['_referencedExistingIds']['add'](_0x415f37);const _0x4cf1dd=Es('data-id',_0x415f37,_0xac8cf5);this['_replaceNode'](_0x4cf1dd,_0x41b3ba);}}else{if(Ds(_0x41b3ba)){const _0x37852f=Ps(_0x41b3ba);Es('data-id',_0x37852f,_0x48d8b0)||this['_touchedNodesState']['removedIds']['push'](_0x37852f);}}}}}for(const _0x37bd36 of this['_touchedNodesState']['removedIds']){const _0x21612e=Es('data-id',_0x37bd36,_0xac8cf5);_0x21612e&&(this['_rescueUnwrappedElements'](_0x21612e),this['_removeNode'](_0x21612e,_0x37bd36,_0x1e6792));}if(Ts('data-id','new-element',_0xac8cf5)['forEach'](_0x35dfbc=>{const _0x1cd847=this['_getUid'](_0x35dfbc);bs(_0x35dfbc,'data-id',_0x1cd847),this['_touchedNodesState']['newIds']['push'](_0x1cd847);}),this['_removeSpecialComments'](_0xac8cf5),_0x1e6792&&_0x1e6792['cutAfterUnstable']){const _0x110126=this['_findLastConfirmationPoint'](_0x3e8ed1),_0x51865d=this['_getLastStableElement'](_0xac8cf5,_0x110126);this['_markUnstableElements'](_0xac8cf5,_0x51865d);}if(this['_processWrappedElements'](_0xac8cf5,_0x1e6792),_0x1e6792&&_0x1e6792['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x2a64ec=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0xac8cf5);let _0x14d418=_0x2a64ec[_0x2a64ec['length']-0x1];for(;_0x14d418;)ks(_0x14d418),_0x14d418=_0x14d418['parentNode'];}return{'parsedContent':_0xac8cf5,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x46a719,_0x550c93,_0x1fa827){for(const _0x19209d of _0x550c93){const _0x5d1154=this['_getUid'](_0x19209d);bs(_0x19209d,'data-id',_0x5d1154),this['_touchedNodesState']['newIds']['push'](_0x5d1154),this['_touchedNodesState']['lastTouchedId']=_0x5d1154;}const _0x5c506d='afterbegin'===_0x1fa827||'afterend'===_0x1fa827?_0x550c93['reverse']():_0x550c93;for(const _0x5c2437 of _0x5c506d)Ss(_0x46a719,_0x5c2437,_0x1fa827);}['_replaceNode'](_0x273410,_0x4096ab){if(!_0x273410)return;if(_0x37c429=_0x4096ab,Os(ms(_0x273410))===Os(ms(_0x37c429)))return;var _0x37c429;const _0x2f56e5=fs(_0x273410,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x2f56e5),this['_touchedNodesState']['lastTouchedId']=_0x2f56e5,_0x11c441(_0x273410,_0x4096ab['cloneNode'](!0x0));}['_removeNode'](_0x1c0a35,_0x57d613,_0x9cc61e){if(_0x9cc61e&&_0x9cc61e['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x57d613;const _0x4dff37=_0x9cc61e['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x4dff37,'data-id',_0x57d613),bs(_0x4dff37,'data-removed','true'),_0x11c441(_0x1c0a35,_0x4dff37);}else _0x1356eb(_0x1c0a35);}['_findReferenceNode'](_0x4a5b3c,_0x3f6288,_0x2d998b){const _0x4248cc=this['_findPrevElementWithDataId'](_0x4a5b3c,!0x1);if(_0x4248cc){const _0x78be83=Ps(_0x4248cc),_0x2eeade=Es('data-id',_0x78be83,_0x2d998b);if(_0x2eeade)return[_0x2eeade,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x78be83);}const _0x38bb8c=this['_findNextElementWithDataId'](_0x4a5b3c,!0x1);if(_0x38bb8c){const _0x1bd35a=Ps(_0x38bb8c),_0x5ab2a9=Es('data-id',_0x1bd35a,_0x2d998b);if(_0x5ab2a9)return[_0x5ab2a9,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1bd35a);}return _0x3f6288?_0x4a5b3c['nextSibling']?this['_findFallbackReferenceNode'](_0x4a5b3c,_0x2d998b):[_0x2d998b['childNodes'][_0x2d998b['childNodes']['length']-0x1],'afterend']:[_0x2d998b['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x503359,_0x44974b){const _0xa1a180=[],_0x19f799=this['_findPrevElementWithDataId'](_0x503359,!0x0);if(_0x19f799){const _0x4f6011=Es('data-id',Ps(_0x19f799),_0x44974b);_0x4f6011&&_0xa1a180['push']([_0x4f6011,'afterend']);}const _0x5ad1fa=this['_findNextElementWithDataId'](_0x503359,!0x0);if(_0x5ad1fa){const _0x4c34ce=Es('data-id',Ps(_0x5ad1fa),_0x44974b);_0x4c34ce&&_0xa1a180['push']([_0x4c34ce,'beforebegin']);}return _0xa1a180['length']>0x1?vs(_0xa1a180[0x0][0x0])<=vs(_0xa1a180[0x1][0x0])?_0xa1a180[0x0]:_0xa1a180[0x1]:0x1===_0xa1a180['length']?_0xa1a180[0x0]:[_0x44974b['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x3bdb83,_0x26e4d2){let _0x3893b0=_0x3bdb83['nextSibling'],_0x221afe=null,_0x43979c=!0x1;for(;_0x3893b0;){if(_0x253096(_0x3893b0)){if(Ds(_0x3893b0)&&(_0x221afe=_0x3893b0),this['_isExistingContentComment'](_0x3893b0)&&_0x26e4d2&&!_0x43979c){_0x43979c=!0x0,_0x3893b0=_0x3893b0['nextSibling'];continue;}break;}const _0x1d386a=fs(_0x3893b0,'data-id');if(_0x1d386a&&'new-element'!==_0x1d386a&&this['_existingDataIds']['has'](_0x1d386a)){_0x221afe=_0x3893b0;break;}_0x3893b0=_0x3893b0['nextSibling'];}return _0x221afe;}['_findPrevElementWithDataId'](_0x34d53a,_0x314467){let _0x3e046c=_0x34d53a['previousSibling'],_0x1466a8=null,_0x29ebca=!0x1;for(;_0x3e046c;){if(_0x253096(_0x3e046c)){if(Ds(_0x3e046c)&&(_0x1466a8=_0x3e046c),this['_isExistingContentComment'](_0x3e046c)&&_0x314467&&!_0x29ebca){_0x29ebca=!0x0,_0x3e046c=_0x3e046c['previousSibling'];continue;}break;}const _0x2097b7=fs(_0x3e046c,'data-id');if(_0x2097b7&&'new-element'!==_0x2097b7&&this['_existingDataIds']['has'](_0x2097b7)){_0x1466a8=_0x3e046c;break;}_0x3e046c=_0x3e046c['previousSibling'];}return _0x1466a8;}['_markWrappedElements'](_0x145a66){_0x34aa28(_0x145a66)&&Ts('data-id',null,_0x145a66)['forEach'](_0x3566d5=>{this['_isExistingNode'](_0x3566d5)&&(bs(_0x3566d5,'data-wrapped-id',fs(_0x3566d5,'data-id')),bs(_0x3566d5,'data-id',null));});}['_processWrappedElements'](_0xd4f843,_0x308fe8){Ts('data-wrapped-id',null,_0xd4f843)['forEach'](_0x675e14=>{const _0x1303c2=fs(_0x675e14,'data-wrapped-id');if(this['_hasUnstableParent'](_0x675e14))return;const _0x364753=Es('data-id',_0x1303c2,_0xd4f843);bs(_0x675e14,'data-id',_0x1303c2),_0x364753&&(this['_removeNode'](_0x364753,_0x1303c2,_0x308fe8),this['_touchedNodesState']['removedIds']['push'](_0x1303c2),this['_touchedNodesState']['lastTouchedId']=_0x1303c2);});}['_hasUnstableParent'](_0x3f1d8f){let _0x28cb0c=_0x3f1d8f['parentNode'];for(;_0x28cb0c;){if(fs(_0x28cb0c,'data-unstable'))return!0x0;_0x28cb0c=_0x28cb0c['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x5c4909){const _0x437990=new Set(this['_touchedNodesState']['removedIds']),_0x5ecdc9=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x5c4909)['forEach'](_0x2e7469=>{const _0x24f3f0=fs(_0x2e7469,'data-id'),_0x65e089=!!_0x24f3f0&&this['_referencedExistingIds']['has'](_0x24f3f0),_0x3202d9=!!_0x24f3f0&&_0x5ecdc9['has'](_0x24f3f0);if(!_0x24f3f0||!_0x65e089&&!_0x3202d9)return;if(_0x437990['has'](_0x24f3f0))return;let _0x1fd309=_0x2e7469['parentNode'],_0x4334b0=!0x1;for(;_0x1fd309;){if(_0x1fd309===_0x5c4909){_0x4334b0=!0x0;break;}const _0x5a9d43=fs(_0x1fd309,'data-id');if(_0x5a9d43&&(this['_referencedExistingIds']['has'](_0x5a9d43)||_0x5ecdc9['has'](_0x5a9d43)))return;_0x1fd309=_0x1fd309['parentNode'];}if(_0x4334b0){if(_0x52f7e8(_0x5c4909,_0x2e7469),_0x65e089){const _0x25ca68=this['_generateUid'](),_0x7a5811=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x24f3f0);-0x1!==_0x7a5811&&this['_touchedNodesState']['modifiedIds']['splice'](_0x7a5811,0x1),bs(_0x2e7469,'data-unwrapped-id',_0x24f3f0),bs(_0x2e7469,'data-id',_0x25ca68),this['_touchedNodesState']['newIds']['push'](_0x25ca68),this['_touchedNodesState']['rescuedNewIds']['add'](_0x25ca68),this['_touchedNodesState']['lastTouchedId']=_0x25ca68;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x24f3f0),this['_touchedNodesState']['lastTouchedId']=_0x24f3f0;}});}['_getUid'](_0x59f2a9){return this['_isExistingNode'](_0x59f2a9)?fs(_0x59f2a9,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x4b4bfa){Cs(_0x4b4bfa)['filter'](_0x347141=>Ds(_0x347141)||this['_isExistingContentComment'](_0x347141))['forEach'](_0x2b4617=>{_0x1356eb(_0x2b4617);});}['_findLastConfirmationPoint'](_0x5f24cd){let _0x28500f=null,_0x1418ac=null,_0x4c4df=null,_0x4445cc=null;const _0x512acb=_0x3a54c2=>{_0x3a54c2&&(_0x28500f=_0x3a54c2),_0x4c4df=null,_0x4445cc=null;};for(let _0x38e528=0x0;_0x38e528<_0x5f24cd['length'];_0x38e528++){const _0xb359d5=_0x5f24cd[_0x38e528];if(this['_isExistingContentComment'](_0xb359d5)){_0x512acb(_0x1418ac);continue;}if(_0x34aa28(_0xb359d5)){const _0x305b0a=fs(_0xb359d5,'data-id'),_0x5a6b98=_0x38e528===_0x5f24cd['length']-0x1;if(_0x305b0a&&'new-element'!==_0x305b0a&&this['_touchedNodesState']['modifiedIds']['includes'](_0x305b0a)&&!_0x5a6b98){_0x512acb(_0x305b0a),_0x1418ac=_0x305b0a;continue;}}let _0x3efbb1=null;const _0x29cd5f=Ps(_0xb359d5);if(_0x29cd5f&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x29cd5f))_0x1418ac=_0x29cd5f;else{if(_0x29cd5f&&this['_touchedNodesState']['newIds']['includes'](_0x29cd5f))_0x3efbb1='N';else{if(!Ds(_0xb359d5))continue;_0x3efbb1='R';}_0x3efbb1===_0x4445cc||null===_0x4445cc?_0x4445cc=_0x3efbb1:null!==_0x4c4df?(_0x512acb(_0x1418ac),_0x4445cc=_0x3efbb1):(_0x4c4df=_0x4445cc,_0x4445cc=_0x3efbb1),_0x1418ac=_0x29cd5f;}}const _0x5dc377=_0x5f24cd[_0x5f24cd['length']-0x1];return _0x5dc377&&!_0x34aa28(_0x5dc377)&&!Ds(_0x5dc377)&&_0x1418ac&&_0x512acb(_0x1418ac),_0x28500f;}['_getLastStableElement'](_0x390f4e,_0x4d34e5){if(!_0x4d34e5)return null;const _0x1dc5f0=Es('data-id',_0x4d34e5,_0x390f4e);if(!_0x1dc5f0)return null;const _0x38efa3=[_0x1dc5f0,...Rs(_0x1dc5f0)]['at'](-0x2);if(_0x38efa3===_0x1dc5f0)return _0x1dc5f0;let _0x42c1df=_0x38efa3['previousSibling'];for(;_0x42c1df&&!_0x34aa28(_0x42c1df);)_0x42c1df=_0x42c1df['previousSibling'];return _0x42c1df;}['_markUnstableElements'](_0x3852c3,_0x1c3333){const _0x126112=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x4f728f=_0x1c3333?_0x1c3333['nextSibling']:_0x3852c3['firstChild'];for(;_0x4f728f;)_0x34aa28(_0x4f728f)&&(_0x126112['has'](fs(_0x4f728f,'data-id'))||Ts('data-id',null,_0x4f728f)['some'](_0x5f04e8=>_0x126112['has'](fs(_0x5f04e8,'data-id'))))&&bs(_0x4f728f,'data-unstable','true'),_0x4f728f=_0x4f728f['nextSibling'];}['_isNewNode'](_0x1e8e07){return Boolean('new-element'===fs(_0x1e8e07,'data-id'));}['_isExistingNode'](_0x5b5788){return Boolean((fs(_0x5b5788,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x5b5788,'data-id'));}['_isExistingContentComment'](_0x368a30){return Boolean(_0x253096(_0x368a30)&&ms(_0x368a30)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ds(_0x47a649){return!!_0x47a649&&Boolean(_0x253096(_0x47a649)&&ms(_0x47a649)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ps(_0x30b11c){if(!_0x30b11c)return null;if(_0x34aa28(_0x30b11c))return fs(_0x30b11c,'data-id')??null;if(_0x253096(_0x30b11c)){const _0x1754f7=ms(_0x30b11c)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x1754f7&&_0x1754f7[0x1])return _0x1754f7[0x1];}return null;}function Hs(_0x52c494,_0xccc58b){const _0x18bc62=new Map();for(const _0x11bf45 of ws(_0x52c494))_0x18bc62['set'](fs(_0x11bf45,'data-id'),_0x11bf45);const _0x3b115c=new Set();for(const _0x26201b of ws(_0xccc58b)){const _0x57701a=fs(_0x26201b,'data-id'),_0x2b0e83=_0x57701a?_0x18bc62['get'](_0x57701a):void 0x0;_0x2b0e83?(_0x11c441(_0x26201b,_0x3cd9d3(_0x2b0e83,!0x0)),_0x3b115c['add'](_0x57701a)):_0x1356eb(_0x26201b);}for(const _0x15c51a of Cs(_0xccc58b))Ds(_0x15c51a)&&_0x18bc62['has'](Ps(_0x15c51a))&&_0x1356eb(_0x15c51a);const _0x51c367=new Set(Ts('data-id',null,_0xccc58b)['map'](_0x2c8f80=>fs(_0x2c8f80,'data-id')));for(const [_0x26bbb6,_0x38217f]of _0x18bc62){if(_0x3b115c['has'](_0x26bbb6))continue;let _0xfa7704=_0x38217f['parent'],_0x2bca92=null;for(;_0xfa7704&&_0x34aa28(_0xfa7704);){const _0x5e9fb1=fs(_0xfa7704,'data-id');if(_0x5e9fb1&&_0x51c367['has'](_0x5e9fb1)){_0x2bca92=_0x5e9fb1;break;}_0xfa7704=_0xfa7704['parent'];}if(!_0x2bca92)continue;const _0x4c68b7=Es('data-id',_0x2bca92,_0xccc58b);_0x4c68b7&&_0x4b5e7a(_0x4c68b7,_0x3cd9d3(_0x38217f,!0x0));}}const Ms=/* #__PURE__ -- @preserve */
26
+ gt();var Vs=class extends Ms{['_m2html'];constructor(){super();const _0x20d9ad=Object['entries'](_0x401844),_0x55235d=_0x20d9ad['findIndex'](([_0x2fa1ea])=>'rehypeDomRaw'===_0x2fa1ea);if(-0x1===_0x55235d)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x20d9ad['splice'](_0x55235d+0x1,0x0,['rehypeSanitize',_0x12ea20]),this['_m2html']=new _0x479cbe({'plugins':Object['fromEntries'](_0x20d9ad)});}['convertMarkdownToHTML'](_0x3a205d){const _0x42ffc2=this['_m2html']['parse'](_0x3a205d);return this['parseAndNormalizeHTML'](_0x42ffc2);}['parseAndNormalizeHTML'](_0x2d8678){return this['_parseHTML'](_0x2d8678);}['_parseHTML'](_0x3b4c34){const _0x10d27b=ps('<dummy>'+_0x3b4c34['replace'](/<[^>]*?$/g,'')+'</dummy>');return Us(_0x10d27b),_0x10d27b['children']=_0x10d27b['children'][0x0]['children'],_0x10d27b;}};function Us(_0x5b04c4){for(const _0x4bbb65 of _0x5b04c4['children'])_0x34aa28(_0x4bbb65)?'pre'!==_0x4bbb65['name']&&Us(_0x4bbb65):_0x45e9d0(_0x4bbb65)&&(_0x4bbb65['data']=_0x4bbb65['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Bs({changeGroups:_0x361d44,documentContextContent:_0x372254,showDiff:_0x152970,trimUnchanged:_0x3444ae=!0x0}){return _0x361d44['map'](_0x44a9f3=>{if(!_0x44a9f3['editor']||'destroyed'===_0x44a9f3['editor']['state'])return null;if(!_0x1779c2(_0x44a9f3['editor'],_0x44a9f3['rootName']))return{'type':_0x44a9f3['changes'][0x0]['type'],'index':_0x44a9f3['index'],'content':new _0x35a1e4([]),'hasChanges':!0x1};const _0x325a11=new _0x35a1e4([]),_0x3da45a=new _0x35a1e4([]),_0x5c30db=new Set();for(const _0x42ba6f of _0x44a9f3['changes'])'new'==_0x42ba6f['type']&&Ts('data-id',null,_0x42ba6f['node'])['forEach'](_0x588c8a=>{_0x5c30db['add'](fs(_0x588c8a,'data-id'));});for(const _0x1b1cf0 of _0x44a9f3['changes'])if('removed'!=_0x1b1cf0['type']?_0x3da45a['children']['push'](_0x1b1cf0['node']['cloneNode'](!0x0)):_0x152970||_0x5c30db['has'](_0x1b1cf0['id'])||_0x3da45a['children']['push'](_0x1b1cf0['node']['cloneNode'](!0x0)),'new'!=_0x1b1cf0['type']&&(_0x152970||'removed'!=_0x1b1cf0['type'])){const _0x4a1f4d=ti(_0x232dd9=>fs(_0x232dd9,'data-id')==_0x1b1cf0['id'],_0x372254['get'](_0x44a9f3['documentId']),!0x0);_0x4a1f4d&&_0x325a11['children']['push'](_0x4a1f4d['cloneNode'](!0x0));}let _0x10849f,_0x5a6567;try{({content:_0x10849f,hasChanges:_0x5a6567}=Gs(_0x44a9f3['editor'],_0x325a11,_0x3da45a,_0x152970,_0x3444ae));}catch{return{'type':_0x44a9f3['changes'][0x0]['type'],'index':_0x44a9f3['index'],'content':new _0x35a1e4([]),'hasChanges':!0x1};}return{'type':_0x44a9f3['changes'][0x0]['type'],'index':_0x44a9f3['index'],'content':_0x10849f,'hasChanges':_0x5a6567};})['filter'](_0x44f37c=>null!==_0x44f37c);}function Gs(_0x1c22ba,_0x333bb3,_0x4e4caa,_0x1a40de,_0x33a2c2=!0x0){const _0x2b34bd=_0x1c22ba['plugins']['get']('DocumentCompare'),_0xce6705=ms(_0x333bb3),_0x543b13=ms(_0x4e4caa),_0xa63656=_0x1c22ba['data']['parse'](_0xce6705,'$root'),_0x4d8a14=_0x1c22ba['model']['createPositionAt'](_0xa63656,0x0),_0x39627f=_0x2b34bd['getDiff'](_0xce6705,_0x543b13,{'anchor':_0x4d8a14,'markDeletions':_0x1a40de,'targetEditor':_0x1c22ba})['getOperations']();if(0x0==_0x39627f['length'])return{'content':_0x333bb3['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x1a40de?function(_0x2bf73c,_0xacc47f,_0x548074){if(0x0==_0x2bf73c['length'])return;const _0x36c34c=_0x548074['plugins']['get']('DocumentCompare'),_0x2a66dd=_0x548074['plugins']['get']('SuggestionsConversion');_0x548074['model']['change'](_0x4a8c4e=>{const _0x302a19=new Set();for(let _0x43cbf2=0x0;_0x43cbf2<_0x2bf73c['length'];_0x43cbf2++){const _0x49374e=_0x2bf73c[_0x43cbf2];if(_0x49374e['baseVersion']=null,_0x49374e['isDocumentOperation']=!0x1,_0x36c34c['isMarkedRemoveOperation'](_0x49374e)){const _0x549f7d=_0x501532(_0x49374e['newRange'],_0x548074['model']),_0x39e88e='suggestion:deletion:'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x39e88e,_0x549f7d);}else switch(_0x49374e['type']){case'rename':{if(_0x49374e['oldName']==_0x49374e['newName'])break;_0x4a8c4e['batch']['addOperation'](_0x49374e),_0x548074['model']['applyOperation'](_0x49374e);const _0xd33f9c='$elementName',_0x54254c=_0x49374e['position'],_0x2baf81=_0x548074['model']['createRange'](_0x54254c,_0x548074['model']['createPositionAt'](_0x54254c['nodeAfter'],'end')),_0x23a05a='suggestion:attribute:'+_0xd33f9c+':'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x23a05a,_0x2baf81);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x49374e['oldValue']==_0x49374e['newValue'])break;_0x4a8c4e['batch']['addOperation'](_0x49374e),_0x548074['model']['applyOperation'](_0x49374e);const _0x3e99dd=_0x49374e['key'];if(!_0x2a66dd['isRegisteredAttribute'](_0x3e99dd))break;const _0x509b7c=_0x501532(_0x49374e['range'],_0x548074['model']),_0x5d5a8e='suggestion:attribute:'+_0x3e99dd+':'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x5d5a8e,_0x509b7c);break;}case'insert':{if(_0x4a8c4e['batch']['addOperation'](_0x49374e),_0x548074['model']['applyOperation'](_0x49374e),Fs(_0xacc47f,_0x49374e),_0x2bf73c[_0x43cbf2+0x1]&&'move'==_0x2bf73c[_0x43cbf2+0x1]['type'])break;const _0x1d233e=_0x49374e['position'],_0x271c6f=_0x49374e['howMany'],_0x4e3fd2=_0x501532(_0x548074['model']['createRange'](_0x1d233e,_0x1d233e['getShiftedBy'](_0x271c6f)),_0x548074['model']),_0x1d7288='suggestion:insertion:'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x1d7288,_0x4e3fd2);break;}case'split':{_0x4a8c4e['batch']['addOperation'](_0x49374e),_0x548074['model']['applyOperation'](_0x49374e),Fs(_0xacc47f,_0x49374e);const _0x2034f8=_0x49374e['splitPosition'],_0x47ea09=_0x49374e['moveTargetPosition'],_0x32d654=_0x548074['model']['createRange'](_0x2034f8,_0x47ea09),_0x203ffd='suggestion:insertion:'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x203ffd,_0x32d654);break;}case'move':{_0x4a8c4e['batch']['addOperation'](_0x49374e),_0x548074['model']['applyOperation'](_0x49374e),Fs(_0xacc47f,_0x49374e);const _0x233801=_0x49374e['getMovedRangeStart'](),_0xe154b=_0x49374e['howMany'];for(let _0x42426c=0x0;_0x42426c<_0xe154b;_0x42426c++){const _0x25fc7a=_0x233801['getShiftedBy'](_0x42426c)['nodeAfter'];_0x302a19['add'](_0x25fc7a);}break;}case'remove':{const _0x503aeb=_0x49374e['sourcePosition'],_0x4a8c7a=_0x49374e['howMany'],_0x4ab1f0=new _0x16ad52(_0x503aeb,_0x4a8c7a);_0x4a8c4e['batch']['addOperation'](_0x4ab1f0),_0x548074['model']['applyOperation'](_0x4ab1f0),Fs(_0xacc47f,_0x49374e);break;}}}for(const _0x17bbc8 of _0x302a19){const _0xe32487=_0x548074['model']['createRangeOn'](_0x17bbc8),_0x4a86f1='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0xacc47f['markers']['set'](_0x4a86f1,_0x501532(_0xe32487,_0x548074['model']));}});}(_0x39627f,_0xa63656,_0x1c22ba):_0x1c22ba['model']['change'](_0x105f74=>{for(const _0x2ab1d3 of _0x39627f)if('remove'==_0x2ab1d3['type']){const _0x1cc4a9=_0x2ab1d3['sourcePosition'],_0x1fbdfd=_0x2ab1d3['howMany'],_0x2bdbae=new _0x16ad52(_0x1cc4a9,_0x1fbdfd);_0x105f74['batch']['addOperation'](_0x2bdbae),_0x1c22ba['model']['applyOperation'](_0x2bdbae),Fs(_0xa63656,_0x2ab1d3);}else{if('marker'==_0x2ab1d3['type']){const _0x136cbe=_0x2ab1d3['name'],_0x41d3e8=_0x2ab1d3['newRange'];null!==_0x41d3e8?_0xa63656['markers']['set'](_0x136cbe,_0x41d3e8):_0xa63656['markers']['delete'](_0x136cbe);}else _0x2ab1d3['baseVersion']=null,_0x2ab1d3['isDocumentOperation']=!0x1,_0x105f74['batch']['addOperation'](_0x2ab1d3),_0x1c22ba['model']['applyOperation'](_0x2ab1d3),Fs(_0xa63656,_0x2ab1d3);}}),_0x33a2c2){const _0x26791d=Ks(_0x1c22ba,_0x39627f,_0xa63656);Ys(_0x1c22ba['model'],_0x26791d),function(_0x5e8b40,_0x59eadd){const _0x220d4c=_0x59eadd['getFirstRange']()['start'];let _0x13695d=_0x59eadd['getFirstRange']()['end'];const _0x402418=_0x220d4c['root'];(_0x13695d['textNode']||_0x13695d['nodeAfter']&&_0x13695d['nodeAfter']['is']('$text'))&&(_0x3f4027(_0x13695d,'...'),Qs(_0x402418,_0x13695d,0x3),_0x13695d=_0x13695d['getShiftedBy'](0x3)),(_0x220d4c['textNode']||_0x220d4c['nodeBefore']&&_0x220d4c['nodeBefore']['is']('$text'))&&(_0x3f4027(_0x220d4c,'...'),Qs(_0x402418,_0x220d4c,0x3),_0x220d4c['parent']==_0x13695d['parent']&&(_0x13695d=_0x13695d['getShiftedBy'](0x3)));const _0x387996=_0x5e8b40['createRange'](_0x5e8b40['createPositionAt'](_0x402418,0x0),_0x220d4c),_0x120b95=_0x5e8b40['createRange'](_0x13695d,_0x5e8b40['createPositionAt'](_0x402418,'end')),_0xbd4728=[..._0x387996['getMinimalFlatRanges'](),..._0x120b95['getMinimalFlatRanges']()];_0xbd4728['reverse']();for(const _0x14c868 of _0xbd4728)_0x260940(_0x14c868),qs(_0x402418,_0x14c868);}(_0x1c22ba['model'],_0x26791d);}return{'content':ps(_0x1c22ba['data']['stringify'](_0xa63656,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Fs(_0x53186b,_0x63466d){for(const [_0x1deada,_0x2a1078]of _0x53186b['markers']){const _0x582d2b=_0x217c33['_createFromRanges'](_0x2a1078['getTransformedByOperation'](_0x63466d));_0x582d2b['root']==_0x53186b?_0x53186b['markers']['set'](_0x1deada,_0x582d2b):_0x53186b['markers']['delete'](_0x1deada);}}function Ks(_0x20a3c7,_0x28730a,_0x480dd0){const _0x36af05=_0x20a3c7['plugins']['get']('DocumentCompare');let _0x3e81dd=_0x20a3c7['model']['createPositionAt'](_0x480dd0,Number['POSITIVE_INFINITY']),_0x489899=_0x20a3c7['model']['createPositionAt'](_0x480dd0,0x0);for(const _0x7d26e2 of _0x28730a){let _0x560f33,_0x29d418;if(_0x36af05['isMarkedRemoveOperation'](_0x7d26e2))_0x560f33=_0x7d26e2['newRange']['start'],_0x29d418=_0x7d26e2['newRange']['end'];else switch(_0x3e81dd=Ws(_0x3e81dd,_0x7d26e2),_0x489899=Ws(_0x489899,_0x7d26e2),_0x7d26e2['type']){case'rename':_0x560f33=_0x7d26e2['position'],_0x29d418=_0x560f33['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x560f33=_0x7d26e2['range']['start'],_0x29d418=_0x7d26e2['range']['end'];break;case'insert':_0x560f33=_0x7d26e2['position'],_0x29d418=_0x560f33['getShiftedBy'](_0x7d26e2['howMany']);break;case'split':_0x560f33=_0x7d26e2['splitPosition'],_0x29d418=_0x7d26e2['moveTargetPosition'];break;case'merge':{const _0x23971d=_0x7d26e2['targetPosition']['path']['slice'](0x0,-0x1);_0x560f33=_0x20a3c7['model']['createPositionFromPath'](_0x480dd0,_0x23971d),_0x29d418=_0x560f33['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x1c8845=_0x7d26e2['howMany'],_0x4e60a9=_0x7d26e2['sourcePosition']['_getTransformedByInsertion'](_0x7d26e2['targetPosition'],_0x1c8845),_0x5d9fa0=_0x7d26e2['getMovedRangeStart']();'remove'==_0x7d26e2['type']?(_0x560f33=_0x4e60a9,_0x29d418=_0x4e60a9):(_0x560f33=_0x5d9fa0,_0x29d418=_0x5d9fa0['getShiftedBy'](_0x1c8845));break;}}_0x560f33&&_0x560f33['isBefore'](_0x3e81dd)&&(_0x3e81dd=_0x560f33['clone'](),_0x3e81dd['stickiness']='toNone'),_0x29d418&&_0x29d418['isAfter'](_0x489899)&&(_0x489899=_0x29d418['clone'](),_0x489899['stickiness']='toNone');}return _0x20a3c7['model']['createSelection'](_0x20a3c7['model']['createRange'](_0x3e81dd,_0x489899));}function Ws(_0x4b0146,_0x304379){return'move'!=_0x304379['type']&&'remove'!=_0x304379['type']||_0x304379['sourceRange']['containsPosition'](_0x4b0146)&&((_0x4b0146=_0x304379['sourcePosition']['clone']())['stickiness']='toNone'),_0x4b0146['getTransformedByOperation'](_0x304379);}function Ys(_0x1b1a4e,_0x4fdcd8){$s(_0x1b1a4e,_0x4fdcd8,'forward');const _0x46a85b=_0x4fdcd8['getFirstRange']();_0x4fdcd8['setTo']([]),_0x4fdcd8['setTo'](_0x46a85b,{'backward':!0x0}),$s(_0x1b1a4e,_0x4fdcd8,'backward');}function $s(_0x504281,_0x5898ff,_0x25cddf){let _0x21c4d3=0x14;for(;_0x21c4d3;){_0x504281['modifySelection'](_0x5898ff,{'unit':'word','direction':_0x25cddf}),_0x21c4d3--;const _0x511814=_0x5898ff['focus']['forward'==_0x25cddf?'nodeBefore':'nodeAfter'];if(_0x511814&&_0x511814['is']('element')&&_0x504281['schema']['isBlock'](_0x511814)&&_0x504281['schema']['isObject'](_0x511814))break;}}function qs(_0x32f8b3,_0x7fec4f){for(const [_0x2882c1,_0x25fbf9]of _0x32f8b3['markers']){const _0x435b81=_0x25fbf9['_getTransformedByDeletion'](_0x7fec4f['start'],_0x7fec4f['end']['offset']-_0x7fec4f['start']['offset']);null!=_0x435b81?_0x32f8b3['markers']['set'](_0x2882c1,_0x435b81):_0x32f8b3['markers']['delete'](_0x2882c1);}}function Qs(_0x1fd38c,_0x53d4e2,_0x26a6ed){for(let [_0x21fa37,_0x53ab7d]of _0x1fd38c['markers'])_0x53ab7d=_0x53ab7d['_getTransformedByInsertion'](_0x53d4e2,_0x26a6ed,!0x1)[0x0],_0x1fd38c['markers']['set'](_0x21fa37,_0x53ab7d);}const Xs=/* #__PURE__ -- @preserve */
27
+ ut();var zs=class extends Xs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x1b1347,config:_0x440766,locale:_0x9748fd}){super(),this['_connector']=_0x1b1347,this['_config']=_0x440766,this['_locale']=_0x9748fd;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x145d25=await this['getAll']();let _0x463c30;return _0x463c30=this['_availableModels']?this['_filterModels'](_0x145d25,this['_availableModels']):_0x145d25['filter'](_0x47365f=>_0x47365f['recommended']),_0x463c30;}async['getModel'](_0x314130){const _0x26cab5=await this['getAll']();if(!_0x26cab5['length'])return null;if(_0x314130){const _0x51f54c=this['_getModelById'](_0x26cab5,_0x314130);if(_0x51f54c)return _0x51f54c;bt('ai-chat-model-id-unrecognized',{'modelId':_0x314130,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x2c4173=await this['getAvailableModels']();if(!_0x2c4173['length'])return null;if(this['_defaultModelId']){const _0x4d2008=this['_getModelById'](_0x2c4173,this['_defaultModelId']);if(_0x4d2008)return _0x4d2008;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x2c4173[0x0]['id']});}return _0x2c4173[0x0];}async['isAvailable'](_0x1a70f9){return(await this['getAvailableModels']())['some'](_0x1fd143=>_0x1fd143['name']===_0x1a70f9['name']&&_0x1fd143['provider']===_0x1a70f9['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x217d4c=this['_locale']['uiLanguage']||'en',_0x541f8f=await this['_connector']['getModels'](_0x217d4c)['list']();this['_modelList']=_0x541f8f['items']['map'](_0x4a4a24=>js(_0x4a4a24)?{..._0x4a4a24,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x4a4a24);}return[...this['_modelList']];}['_filterModels'](_0x27a396,_0x1f5776){let _0x573577;if(_0x1f5776){_0x573577=[];const _0x242254=new Set(),_0x321d42='string'==typeof _0x1f5776?[_0x1f5776['toLocaleLowerCase']()]:_0x1f5776['map'](_0x430604=>_0x430604['toLocaleLowerCase']());for(const _0x2f22a5 of _0x321d42)for(const _0x346b26 of _0x27a396)!_0x242254['has'](_0x346b26['id'])&&this['_isMatchingFilter'](_0x346b26,_0x2f22a5)&&(_0x573577['push'](_0x346b26),_0x242254['add'](_0x346b26['id']));}else _0x573577=_0x27a396;return _0x573577;}['_isMatchingFilter'](_0x3e5f06,_0x9d0e9d){const _0xaee79b=_0x3e5f06['id']['toLocaleLowerCase'](),_0x1f3299=_0x3e5f06['name']['toLocaleLowerCase'](),_0x30959b=_0x3e5f06['provider']['toLocaleLowerCase']();return _0xaee79b===_0x9d0e9d||_0x1f3299===_0x9d0e9d||js(_0x3e5f06)&&'auto'===_0x9d0e9d||_0x30959b===_0x9d0e9d||_0xaee79b['startsWith'](_0x9d0e9d);}['_getModelById'](_0x3cd613,_0x3ee28c){return _0x3cd613['find'](_0x84b8b8=>js(_0x84b8b8)&&'auto'===_0x3ee28c?_0x84b8b8:_0x84b8b8['id']===_0x3ee28c)||null;}};function js(_0x252138){return _0x252138['id']['startsWith']('agent');}function Js(_0x5450c6,_0x27b4ff){for(const _0x2282d3 of _0x5450c6)'noop'!==_0x2282d3['type']&&(_0x2282d3['_aiSource']=_0x27b4ff);}var Zs=class extends _0x215b79{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x598e2f];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new zs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x238002,_0x535b90){if('completed'!==_0x238002['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x238002['status']});const _0x4301eb=_0x238002['editor'],{applyMethod:_0x4c6f35}=_0x535b90;if('suggest'===_0x4c6f35&&!_0x4301eb['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x1fc950='suggest'===_0x4c6f35,_0x2db091=this['context']['plugins']['get'](_0x598e2f),_0x5d4d04=_0x4301eb['model']['createPositionAt'](_0x4301eb['model']['document']['getRoot'](),0x0),_0x1bcca1=_0x2db091['getDiff'](_0x238002['contentRawOld'],_0x238002['contentRawNew'],{'anchor':_0x5d4d04,'markDeletions':_0x1fc950,'targetEditor':_0x4301eb}),_0x2f14a1=_0x4301eb['model']['document']['history']['getOperations'](_0x238002['documentVersion']),_0x2c83aa={'document':_0x4301eb['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x23a9b9=_0x25b633(_0x1bcca1['getOperations'](),_0x2f14a1,_0x2c83aa)['operationsA'];Js(_0x23a9b9,_0x535b90['aiSource']??'api'),_0x4301eb['model']['change'](_0x9a75cc=>{if(_0x1fc950)_0x4301eb['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x23a9b9);else{for(const _0x352646 of _0x23a9b9)_0x352646['baseVersion']=_0x4301eb['model']['document']['version'],ys(_0x4301eb,_0x352646),_0x9a75cc['batch']['addOperation'](_0x352646),_0x4301eb['model']['applyOperation'](_0x352646);}});}['mergeChangesIntoContent'](_0xcb1be9,_0x4c519a,_0xdc95fc){const _0x175b4b=new Vs(),_0xab79f9=new Ls();let _0x49233c=_0x175b4b['parseAndNormalizeHTML'](_0x4c519a);for(const _0x258e39 of _0xcb1be9)try{const _0x3977a7=_0x175b4b['parseAndNormalizeHTML'](_0x258e39['content']);_0x49233c=_0xab79f9['merge'](_0x3977a7,_0x49233c,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x50878d){throw new ht('ai-gateway-merge-failed',this,{..._0x258e39},_0x50878d);}return Gs(_0xdc95fc,_0x175b4b['parseAndNormalizeHTML'](_0x4c519a),_0x49233c,!0x1,!0x1)['content'];}},tn=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x2907bd){this['_editor']=_0x2907bd['editor'],this['_rootName']=_0x2907bd['rootName'],this['_channelId']=_0x2907bd['channelId'],this['_sessionId']=_0x2907bd['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'](_0x5e0be5){this['_documentVersion']=_0x5e0be5;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x37831d){this['_contentRawOld']=_0x37831d;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x5263fa){this['_contentRawNew']=_0x5263fa;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x20dc26){this['_error']=_0x20dc26;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x59b1a4){return _0x59b1a4['replace'](/ data-id="[a-z0-9]+"/g,'');}},en=class extends tn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x14eb8e){this['_summary']=_0x14eb8e;}},sn=class extends _0x215b79{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x5e078b,_0x43fd0b){if(!_0x5e078b)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x45aa1c=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x45aa1c[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x3dcb57=new en({'editor':_0x45aa1c[0x0]['editor'],'rootName':_0x45aa1c[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x45aa1c[0x0]['sessionId']});if(_0x3dcb57['contentRawOld']=_0x45aa1c[0x0]['content'],_0x3dcb57['documentVersion']=_0x45aa1c[0x0]['version'],_0x43fd0b?.['signal']?.['aborted'])return _0x3dcb57['abort'](),_0x3dcb57;const _0x2717d5=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x3dcb57['contentRawOld'],'prompt':_0x5e078b,'model':_0x43fd0b['model']});let _0x4d10be;if(_0x43fd0b?.['signal']){if(_0x43fd0b['signal']['aborted'])return _0x2717d5['abortController']['abort'](),_0x3dcb57['abort'](),_0x3dcb57;const _0x594984=_0x43fd0b['signal'],_0x4bb244=()=>_0x2717d5['abortController']['abort']();_0x594984['addEventListener']('abort',_0x4bb244),_0x4d10be=()=>_0x594984['removeEventListener']('abort',_0x4bb244);}try{const _0x52e9ba=await _0x2717d5['getResult']();if(!(_0x52e9ba&&_0x52e9ba['document']&&_0x52e9ba['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x3dcb57['contentRawNew']=_0x52e9ba['document'],_0x3dcb57['summary']=_0x52e9ba['summary']||'';}catch(_0x1b9ab0){_0x1b9ab0 instanceof Error&&_0x1b9ab0['message']['includes']('ai-request-aborted')?_0x3dcb57['abort']():_0x3dcb57['error']=_0x1b9ab0 instanceof ht?_0x1b9ab0:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x1b9ab0);}finally{_0x4d10be&&_0x4d10be();}return _0x3dcb57;}['applyResult'](_0x48b10b,_0x5dbabd){this['context']['plugins']['get']('AIGateway')['apply'](_0x48b10b,_0x5dbabd);}};function nn(_0x2b3c3c){return _0x2b3c3c instanceof Error&&('AbortError'===_0x2b3c3c['name']||('AICoreError'===_0x2b3c3c['name']?!0x0===_0x2b3c3c['isAbort']:_0x2b3c3c['message']['startsWith']('ai-request-aborted')));}var rn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x5b3c8d){super(_0x5b3c8d['code'],_0x5b3c8d['cause']instanceof Error?{'cause':_0x5b3c8d['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x5b3c8d['code'],this['severity']=_0x5b3c8d['severity']??'error',this['type']=_0x5b3c8d['type']??'system',this['context']=_0x5b3c8d['context'],this['isAbort']=_0x5b3c8d['isAbort']??nn(_0x5b3c8d['cause']);}},on=class extends _0x215b79{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x24f6fb){return new an(this,_0x24f6fb);}},an=class{['_sink'];['_component'];constructor(_0x5e73b1,_0x492360){this['_sink']=_0x5e73b1,this['_component']=_0x492360;}['logError'](_0x25f5b0,_0x2251f7={}){this['_emit'](_0x25f5b0,_0x2251f7),this['_defaultLog'](_0x25f5b0);}['reportError'](_0x3136f8,_0x52acd3={}){this['_emit'](_0x3136f8,_0x52acd3);}['_emit'](_0x12d0cc,_0x518f88){nn(_0x12d0cc)||this['_sink']['fire']('error',{'error':_0x12d0cc,'component':this['_component'],'context':_0x518f88['context']});}['_defaultLog'](_0x4dd0bb){if(!nn(_0x4dd0bb)){if(_0x4dd0bb instanceof rn){if('user'===_0x4dd0bb['type']||'network'===_0x4dd0bb['type'])return;if('warning'===_0x4dd0bb['severity'])return void console['warn'](this['_component'],_0x4dd0bb);}console['error'](this['_component'],_0x4dd0bb);}}};const hn='ck-ai-button-primary',cn='ck-ai-button-secondary',ln='ck-ai-button-tertiary';function un(_0x1595f6,_0x1c0ac8){const _0x252e6d=new Ht(_0x1595f6),_0x3382f4=us(_0x1595f6,'AI_TABS_LABEL_MINIMIZE'),_0x6d0aed=us(_0x1595f6,'AI_TABS_LABEL_MAXIMIZE');return _0x252e6d['set']({'withText':!0x1,'icon':_0x3f0cae,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+ln}),_0x252e6d['bind']('label')['to'](_0x1c0ac8,'isMaximized',_0x527ab1=>_0x527ab1?_0x3382f4:_0x6d0aed),_0x252e6d['bind']('icon')['to'](_0x1c0ac8,'isMaximized',_0x439196=>_0x439196?_0x5c3340:_0x3f0cae),_0x252e6d['bind']('isOn')['to'](_0x1c0ac8,'isMaximized'),_0x252e6d['on']('execute',()=>{_0x1c0ac8['fire']('resizeTabs');}),_0x252e6d;}function dn(_0x1c1883){const _0x914a28=new Lt(_0x1c1883);return _0x914a28['attachToDom'](),_0x914a28['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x914a28;}const _n=/* #__PURE__ -- @preserve */
28
+ gt();var gn=class extends _n{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x4bb8fe,isDone:_0x2bf3bc=!0x1,isComplete:_0x4e6fa0,interactionId:_0x193c16,areActionsDisabled:_0x45a1c2,isFromHistory:_0x1fed77=!0x1,documentContextContent:_0x4446e1,locale:_0x18d340,id:_0xc47e7c,channelsToEditors:_0x135d99}){super(),this['id']=_0xc47e7c||vt(),this['interactionId']=_0x193c16,this['type']=_0x4bb8fe,this['areActionsDisabled']=!!_0x45a1c2,this['isFromHistory']=_0x1fed77,this['locale']=_0x18d340,this['aiResponseParser']=new Vs(),this['aiResponseApplier']=new Ls(),this['documentContextContent']=new Map(_0x4446e1?.['map'](_0x28f230=>[_0x28f230['id'],ps(_0x28f230['content'])])||[]),this['_documentIdToSource']=new Map(_0x4446e1?.['map'](_0x2f4d37=>[_0x2f4d37['id'],{'editor':_0x135d99['get'](_0x2f4d37['channelId']),'rootName':_0x2f4d37['rootName']}])||[]),this['set']('isDone',_0x2bf3bc),this['set']('isComplete',_0x4e6fa0??_0x2bf3bc),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x238c2a,_0x1c5966){const _0x2d9fb0='text'===this['type']?'text':_0x1c5966;this['content']['has'](_0x2d9fb0)||this['content']['set'](_0x2d9fb0,''),this['content']['set'](_0x2d9fb0,this['content']['get'](_0x2d9fb0)+_0x238c2a),this['onContentChange'](_0x2d9fb0);}['done'](_0xa5bf8f=!0x0){this['isComplete']=_0xa5bf8f,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x510bb5,_0x225027){this['changeGroups'][_0x510bb5]['state']=_0x225027,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x510bb5,'state':_0x225027});}['getContentParts']({showDiff:_0x2147f1,groupIndex:_0x1347c8}){const _0x492ad2=this['_getCachedContentParts'](_0x2147f1,_0x1347c8);if(_0x492ad2)return _0x492ad2;let _0x1014a7=[];if(void 0x0===_0x1347c8)_0x1014a7=this['changeGroups'];else{const _0x17867b=this['changeGroups']['find'](({index:_0x264fbd})=>_0x264fbd===_0x1347c8);if(!_0x17867b)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x1347c8});_0x1014a7=[_0x17867b];}const _0x168c8f=Bs({'showDiff':_0x2147f1,'changeGroups':_0x1014a7,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x2147f1,_0x168c8f),_0x168c8f;}['_getCachedContentParts'](_0xa8bec7,_0x5603ef){const _0x38397b=_0xa8bec7?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x38397b]['length'])return null;const _0x161fbe=this['cachedSuggestionContentParts'][_0x38397b];if(void 0x0===_0x5603ef)return _0x161fbe['length']>0x0&&_0x161fbe['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0xa8bec7,null),null):_0x480e02(_0x161fbe);{const _0x52b4c7=_0x161fbe['find'](({index:_0x31119e})=>_0x31119e===_0x5603ef);if(_0x52b4c7)return[_0x480e02(_0x52b4c7)];}return null;}['_setCachedContentParts'](_0x47a240,_0x117f89){const _0x7e2d2b=_0x47a240?'withDiff':'withoutDiff';_0x117f89?_0x117f89['forEach'](_0x49db86=>{const _0x6d07dd=this['cachedSuggestionContentParts'][_0x7e2d2b],_0x430392=_0x6d07dd['find'](({index:_0x103749})=>_0x103749===_0x49db86['index']);if(_0x430392){const _0x57b21b=_0x6d07dd['indexOf'](_0x430392);_0x6d07dd['splice'](_0x57b21b,0x1,_0x49db86);}else _0x6d07dd['push'](_0x49db86);}):this['cachedSuggestionContentParts'][_0x7e2d2b]['length']=0x0;}['onContentChange'](_0x22038d){if('modification'===this['type']){if(_0x22038d)this['parsedContent']['set'](_0x22038d,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x22038d)));else{for(const [_0x20f793,_0x299a12]of this['content'])this['parsedContent']['set'](_0x20f793,this['aiResponseParser']['parseAndNormalizeHTML'](_0x299a12));}const _0x2ee577=this['changeGroups'];for(const _0x13abe8 of this['content']['keys']())this['updateChangeGroups'](_0x13abe8);const _0x47f8e3=this['_getDifferentChangeGroups'](_0x2ee577,this['changeGroups']);(_0x47f8e3['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x47f8e3),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'](_0x15f590,_0x53701a){const _0xc7c99b=[];for(const _0x5491ef of _0x53701a){const _0x1f8a64=_0x15f590[_0x5491ef['index']];_0x1f8a64?_0x1f8a64['changes']['length']!==_0x5491ef['changes']['length']?_0xc7c99b['push'](_0x5491ef):_0x1f8a64['changes']['forEach']((_0x3826e8,_0x109aa3)=>{const _0xdd9d9=_0x5491ef['changes'][_0x109aa3];_0x3826e8['id']!==_0xdd9d9['id']&&_0xc7c99b['push'](_0x5491ef);}):_0xc7c99b['push'](_0x5491ef);}return _0xc7c99b;}['updateChangeGroups'](_0x462d1f){const _0x56ca76=this['documentContextContent']['get'](_0x462d1f),_0x39c6ce=this['parsedContent']['get'](_0x462d1f);if(!_0x56ca76||!_0x39c6ce)return;const _0x37b640=new _0x193d60('p',{},[new _0x193d60('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x27d7ca(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x436f04=this['aiResponseApplier']['merge'](_0x39c6ce,_0x56ca76['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x37b640});this['parsedMergedContent']['set'](_0x462d1f,_0x436f04['parsedContent']);let _0x21c7da=[];if(_0x389c21(_0x2929bc=>{const _0x14aec0=fs(_0x2929bc,'data-id');if(!_0x14aec0||!_0x2d306c(_0x14aec0))return!0x1;const _0x19dec5=[_0x2929bc,...Rs(_0x2929bc)]['at'](-0x2);if(_0x2929bc!=_0x19dec5){const _0x1cfbfa=fs(_0x19dec5,'data-id');_0x2d306c(_0x1cfbfa)||(_0x21c7da['push']({'node':_0x19dec5,'id':_0x1cfbfa,'type':'modified'}),_0x436f04['modifiedNodeIds']['push'](_0x1cfbfa));}else _0x436f04['modifiedNodeIds']['includes'](_0x14aec0)?_0x21c7da['push']({'node':_0x2929bc,'type':'modified','id':_0x14aec0}):_0x436f04['newNodeIds']['includes'](_0x14aec0)?_0x21c7da['push']({'node':_0x2929bc,'type':'new','id':_0x14aec0,'anchorId':fs(_0x2929bc['previousSibling'],'data-id')}):_0x21c7da['push']({'node':_0x2929bc,'type':'removed','id':_0x14aec0});return!0x0;},this['parsedMergedContent']['get'](_0x462d1f)),_0x21c7da=_0x21c7da['filter'](({node:_0x27e25c})=>[...Rs(_0x27e25c),_0x27e25c]['every'](_0x401e07=>!fs(_0x401e07,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x247e51=>_0x247e51['documentId']!==_0x462d1f),0x0==_0x21c7da['length'])return;const _0x3aec37=[[_0x21c7da[0x0]]];for(let _0x2dbc29=0x1;_0x2dbc29<_0x21c7da['length'];_0x2dbc29++){const _0x39c545=_0x3aec37[_0x3aec37['length']-0x1],_0x5ee954=_0x39c545[_0x39c545['length']-0x1];_0x21c7da[_0x2dbc29]['node']['previousSibling']==_0x5ee954['node']&&'modified'!=_0x21c7da[_0x2dbc29]['type']&&'modified'!=_0x5ee954['type']?_0x39c545['push'](_0x21c7da[_0x2dbc29]):_0x3aec37['push']([_0x21c7da[_0x2dbc29]]);}for(const _0x370cc6 of _0x3aec37){const _0x48e7f8=_0x370cc6[0x0],_0x53e5cb=_0x370cc6[_0x370cc6['length']-0x1],_0x95e748=_0x3d01a6(_0x48e7f8['node']['previousSibling']);_0x95e748&&_0x370cc6['unshift'](_0x95e748);const _0x3a5f4b=_0x3d01a6(_0x53e5cb['node']['nextSibling']);_0x3a5f4b&&_0x370cc6['push'](_0x3a5f4b);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x462d1f))['forEach'](_0x46bf8f=>{bs(_0x46bf8f,'data-wrapped-id',null);});const _0x1cd999=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x462d1f))['forEach'](_0x37159a=>{const _0x561da0=fs(_0x37159a,'data-unwrapped-id'),_0x1698cb=fs(_0x37159a,'data-id');_0x1cd999['set'](_0x1698cb,_0x561da0),bs(_0x37159a,'data-id',_0x561da0),bs(_0x37159a,'data-unwrapped-id',null);});for(const _0x35ac7b of _0x21c7da){const _0x40efc4=_0x1cd999['get'](_0x35ac7b['id']);_0x40efc4&&(_0x35ac7b['id']=_0x40efc4);}this['changeGroups']['push'](..._0x3aec37['map']((_0x545736,_0x299c3f)=>({'changes':_0x545736,'state':'pending','index':_0x299c3f,'editor':this['_documentIdToSource']['get'](_0x462d1f)['editor'],'rootName':this['_documentIdToSource']['get'](_0x462d1f)['rootName'],'documentId':_0x462d1f})));const _0x3c06c2=Array['from'](this['documentContextContent']['keys']());function _0x2d306c(_0x5487c3){return _0x436f04['modifiedNodeIds']['includes'](_0x5487c3)||_0x436f04['newNodeIds']['includes'](_0x5487c3)||_0x436f04['removedNodeIds']['includes'](_0x5487c3);}function _0x3d01a6(_0x5414f1){if(_0x5414f1&&fs(_0x5414f1,'data-id')&&!fs(_0x5414f1,'data-unstable')){const _0x5c18df=fs(_0x5414f1,'data-id');if(!_0x2d306c(_0x5c18df))return{'node':_0x5414f1,'type':'context','id':_0x5c18df};}return null;}this['changeGroups']['sort']((_0x1bc276,_0x275ffa)=>_0x3c06c2['indexOf'](_0x1bc276['documentId'])-_0x3c06c2['indexOf'](_0x275ffa['documentId'])),this['changeGroups']['forEach']((_0x46d6ad,_0x42507c)=>{_0x46d6ad['index']=_0x42507c;});}};const An=/* #__PURE__ -- @preserve */
29
+ ut(),In=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var pn=class extends An{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x5e1a47,locale:_0x37a710,channelsToEditors:_0x294f53}){super(),this['id']=vt(),this['connector']=_0x5e1a47,this['isStopped']=!0x0,this['locale']=_0x37a710,this['_channelsToEditors']=_0x294f53||new Map();}async['start'](){await this['_run']();}async['resume'](_0x4bd9e6){await this['_run'](_0x4bd9e6);}async['_run'](_0x600fcf){const _0x39c4b0=[];let _0x3ce256,_0x462218,_0x3a18cf,_0xe0b407=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x600fcf||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x477d34=await this['currentRequest']['getStream']();for await(const _0x56dc64 of _0x477d34){if(this['isStopped'])return;if('error'==_0x56dc64['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x56dc64['event']){case'message-metadata':this['messageId']=_0x56dc64['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x56dc64['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x56dc64['data']['conversationTitle'],!0x0);break;case'source':_0x39c4b0['push'](_0x56dc64['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'](),_0x3ce256='modification-delta'==_0x56dc64['event']?'modification':'text',_0x462218='modification-delta'==_0x56dc64['event']?_0x56dc64['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x3ce256&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x3ce256,'interactionId':this['id'],'id':_0x462218,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x56dc64['event']&&{'documentId':_0x56dc64['data']['documentId']}}),'modification'==_0x3ce256&&(this['currentReply']['sources']=_0x39c4b0['splice'](0x0))),this['currentReply']['appendContent'](_0x56dc64['data']['textDelta'],_0x56dc64['data']['documentId']);break;case'mcp-tool-result':_0x3a18cf=JSON['parse'](_0x56dc64['data']['result']),this['_handleToolResultData']({'toolName':_0x56dc64['data']['toolName'],'data':_0x3a18cf['data'],'attributes':_0x3a18cf['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x56dc64['data']['toolName'],'data':_0x56dc64['data']['data']});}}_0xe0b407=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x39c4b0['length']>0x0&&(this['currentReply']['sources']=_0x39c4b0['splice'](0x0)),this['_finalizeInteraction'](_0xe0b407),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0xe602e6){return this['replies']['find'](_0x5726e4=>_0x5726e4['id']===_0xe602e6);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x4c2c37=>_0x4c2c37['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x5e7bc4){const _0x324a9a=this['getDocumentContext'](),_0x538eb2=new gn({'locale':this['locale'],'documentContextContent':_0x324a9a?.['documents'],..._0x5e7bc4});return this['replies']['push'](_0x538eb2),_0x538eb2['delegate'](...In)['to'](this),this['fire']('replyCreated',_0x538eb2),_0x538eb2;}['setConversationTitle'](_0x56d69b,_0x49f88f=!0x1){this['fire']('setConversationTitle',_0x56d69b,_0x49f88f);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x2f56a7){this['fire']('toolDataReceived',{'type':'result','toolName':_0x2f56a7['toolName'],'data':structuredClone(_0x2f56a7['data']||{}),'attributes':structuredClone(_0x2f56a7['attributes']||{})},this);}['_handleToolNotificationData'](_0x6777d2){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x6777d2['toolName'],'data':structuredClone(_0x6777d2['data'])},this);}['_finalizeInteraction'](_0x2d23c9=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x2d23c9),this['currentRequest']=this['currentReply']=void 0x0;}};const mn=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']]),En=/* #__PURE__ -- @preserve */
30
+ gt(),Tn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var wn=class AIChatContext extends En{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x4ea99a,config:_0x265fdb,ownerId:_0x3faf54}){super(),this['_connector']=_0x4ea99a,this['_config']=_0x265fdb,this['_ownerId']=_0x3faf54;}['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'](_0x236fb1,_0xec5be5){const _0x3d230e=new Map(),{contextItem:_0x142bb7,hasUnmatched:_0x5a00ab}=await this['_populateDocumentContextItem'](_0x236fb1,_0xec5be5);_0x142bb7&&_0x3d230e['set'](_0x142bb7['id'],_0x142bb7);for(const _0x30915a of _0x236fb1){if('document'===_0x30915a['type'])continue;const _0x46cfdf=await this['_createContextItemFromContent'](_0x30915a);this['_addToConversationContextItem'](_0x46cfdf),_0x3d230e['set'](_0x46cfdf['id'],_0x46cfdf);}return{'contextItems':_0x3d230e,'hasUnmatched':_0x5a00ab};}async['_populateDocumentContextItem'](_0x4b28f3,_0x581e0a){const _0x4b4814=_0x4b28f3['filter'](_0x335a0c=>'document'===_0x335a0c['type']);if(0x0===_0x4b4814['length'])return{'hasUnmatched':!0x1};const _0x2c3af4=_0x4b4814['map'](_0x346ca3=>_0x346ca3['id']),_0x158e70=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x2c3af4)['getDocuments'](),_0xf5f3a4=new Map(_0x158e70['map'](_0x58ad78=>[_0x58ad78['id'],_0x58ad78])),_0x5a6aa7=[];let _0x15df8b=!0x1;for(const _0x459627 of _0x4b4814){const _0x48e055=_0xf5f3a4['get'](_0x459627['id']);_0x48e055&&(this['_matchDocumentToRoot'](_0x48e055,_0x581e0a)||(_0x15df8b=!0x0),_0x5a6aa7['push']({'id':_0x48e055['id'],'content':_0x48e055['content'],'version':_0x48e055['attributes']?.['version']??0x0,'sessionId':_0x48e055['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x48e055['attributes']?.['channelId']??_0x581e0a[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x48e055['attributes']?.['rootName']??_0x581e0a[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x34c75c={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x5a6aa7};return this['_addToConversationContextItem'](_0x34c75c),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x34c75c,'hasUnmatched':_0x15df8b};}['_matchDocumentToRoot'](_0x5977d4,_0x44dbb6){const _0x1e29be=_0x5977d4['attributes']?.['channelId'],_0x294cc7=_0x5977d4['attributes']?.['rootName'];if(_0x1e29be&&_0x294cc7){for(const _0x14c533 of _0x44dbb6)if(_0x14c533['config']['get']('collaboration.channelId')===_0x1e29be){for(const _0x7845d2 of _0x14c533['model']['document']['getRoots']())if('$graveyard'!==_0x7845d2['rootName']&&_0x7845d2['rootName']===_0x294cc7)return{'editor':_0x14c533,'rootName':_0x7845d2['rootName']};}}}async['_createContextItemFromContent'](_0x3275b2){return'mcp-tool-context'===_0x3275b2['type']?{'id':_0x3275b2['id'],'uiId':_0x3275b2['id'],'label':_0x3275b2['data']?.['label']||_0x3275b2['id'],'type':'mcp-tool-context','mcpServerName':_0x3275b2['mcpServerName'],'toolName':_0x3275b2['toolName'],'data':_0x3275b2['data']||{}}:{'id':_0x3275b2['id'],'uiId':_0x3275b2['id'],'label':_0x3275b2['attributes']?.['label']||_0x3275b2['name']||_0x3275b2['url']||_0x3275b2['id'],'type':_0x3275b2['type'],..._0x3275b2?.['attributes']?.['resourceId']?{'resourceId':_0x3275b2['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x5706d5){this['_pendingContextItems']['get'](_0x5706d5)?.['isReadOnly']||this['_removeContextItem'](_0x5706d5);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x512037 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x512037['uiId']);const _0x38f73f=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x38f73f&&this['_addContextItem']({..._0x38f73f,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x2fed32){for(const _0x4273a6 of _0x2fed32['values']())this['_addToConversationContextItem'](_0x4273a6);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'](_0x1f69a8){return Array['from'](_0x1f69a8['values']())['flatMap'](_0x194f0e=>this['_mapContextItemToRequestData'](_0x194f0e));}async['addFilesToContext'](_0x3bc53b,_0x46f43e,_0x1bb5c0='file'){const _0x1ca3fa='files-'+vt();this['_startUploadOperation'](_0x1ca3fa);try{await Promise['all'](_0x3bc53b['map'](async _0xc71c25=>{const _0x4b0109='file-'+vt(),_0x289283=_0x5cae26(_0xc71c25['name']),_0x3d4ba8='file'===_0x1bb5c0&&_0xc71c25['type']['startsWith']('image/')?'image':_0x1bb5c0;try{this['_addContextItem']({'type':_0x3d4ba8,'label':_0x46f43e?.['label']||_0x289283,'uiId':_0x4b0109,'resourceId':_0x46f43e?.['resourceId']},!0x0);const _0x4a48ce=this['_connector']['uploadFile'](this['_ownerId'],_0xc71c25,_0x46f43e);this['_ongoingUploads']['set'](_0x4b0109,_0x4a48ce['abortController']);const {id:_0x12ae90}=await _0x4a48ce['getId']();this['_ongoingUploads']['delete'](_0x4b0109),this['_finishContextItemLoading']({'type':_0x3d4ba8,'id':_0x12ae90,'label':_0x46f43e?.['label']||_0x289283,'uiId':_0x4b0109,'resourceId':_0x46f43e?.['resourceId']},!0x1);}catch(_0x38715d){if(this['_ongoingUploads']['delete'](_0x4b0109),!nn(_0x38715d)){const _0x545bba=new rn({'code':mn['get'](_0x38715d['code'])||'ai-chat-file-upload-failed','cause':_0x38715d,'context':{'fileName':_0x289283}});this['fire']('error',{'error':_0x545bba});}this['_removeContextItem'](_0x4b0109);}}));}finally{this['_finishUploadOperation'](_0x1ca3fa);}}['addCurrentDocumentToContext'](_0x49605c){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0xbb200d={'type':'document','uiId':'current-document','label':_0x49605c,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0xbb200d);}async['updateCurrentDocuments'](_0x69d47d){const _0x39f6ef=this['_pendingContextItems']['get']('current-document');if(!_0x39f6ef||!_0x69d47d['length']||_0x69d47d['every'](_0x45aaad=>!_0x45aaad['content']))return;_0x69d47d['length']>0x1&&_0x69d47d['some'](_0x4a71ed=>!_0x4a71ed['description'])&&bt('ai-chat-documents-missing-description');try{const _0x324291=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x69d47d)['getIds']();if(_0x324291['length']!==_0x69d47d['length']||_0x324291['some'](_0x1c22f3=>!_0x1c22f3?.['id'])){const _0x302ecc=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x302ecc});}_0x39f6ef['documents']=_0x69d47d['map']((_0x322c35,_0xe5ecc6)=>{return{'id':_0x324291[_0xe5ecc6]['id'],'content':_0x322c35['content'],'version':_0x322c35['version'],'sessionId':_0x322c35['sessionId'],'selection':(_0x4d4507=_0x322c35['selections'],_0x4d4507?_0x4d4507['map'](_0x2bc825=>({'start':_0x2bc825['start'],'end':_0x2bc825['end']})):[]),'channelId':_0x322c35['channelId'],'rootName':_0x322c35['rootName']};var _0x4d4507;});}catch(_0x3afb4c){const _0x3e9330=new rn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x3afb4c});this['fire']('error',{'error':_0x3e9330});}}['addSelectionToContext'](_0x206816){this['_addContextItem']({'type':'selection','label':_0x206816,'uiId':'selection','content':_0x206816});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x212552,_0x15a9cf){const _0x4b630f='url-'+vt();this['_startUploadOperation'](_0x4b630f);const _0x5b9ba6='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x15a9cf?.['label']||_0x212552,'uiId':_0x5b9ba6,'resourceId':_0x15a9cf?.['resourceId']},!0x0);const _0x47c57b=this['_connector']['uploadUrl'](this['_ownerId'],_0x212552,_0x15a9cf);this['_ongoingUploads']['set'](_0x5b9ba6,_0x47c57b['abortController']);const {id:_0x2dc33d}=await _0x47c57b['getId']();this['_ongoingUploads']['delete'](_0x5b9ba6),this['_finishContextItemLoading']({'type':'web-resource','id':_0x2dc33d,'label':_0x15a9cf?.['label']||_0x212552,'uiId':_0x5b9ba6,'resourceId':_0x15a9cf?.['resourceId']},!0x1);}catch(_0x432775){this['_ongoingUploads']['delete'](_0x5b9ba6),nn(_0x432775)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x212552,'originalError':_0x432775}),'url':_0x212552}),this['_removeContextItem'](_0x5b9ba6);}finally{this['_finishUploadOperation'](_0x4b630f);}}['addToolItemToContext'](_0x4a3730){_0x4a3730['id']=_0x4a3730['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x4a3730['uiId'],_0x4a3730),this['fire']('contextItemAdded',{'contextItem':_0x4a3730,'isLoading':!0x1});}async['loadSourceResources'](_0x11c76a,_0x4ab7c3,_0x35ddf){const _0x800fb3=this['_addContextOptionsState']['sources']['find'](_0x5c1df7=>_0x5c1df7['id']===_0x11c76a);if(!_0x800fb3)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x11c76a}),'sourceId':_0x11c76a}),[];try{const _0x2d012a=(await _0x800fb3['getResources'](_0x4ab7c3))['map'](_0x404204=>{const _0x2655d5=this['_isResourceInContext'](_0x404204['id']);return{..._0x404204,'isInContext':_0x2655d5};});return _0x800fb3['resources']=_0x2d012a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x11c76a,'source':_0x800fb3,'resources':_0x2d012a,'uid':_0x35ddf}),_0x2d012a;}catch(_0x5b5cc5){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x11c76a,'originalError':_0x5b5cc5}),'sourceId':_0x11c76a,'sourceLabel':_0x800fb3['label']}),[];}}async['addResourceToContext'](_0x105544,_0xf7c531){if(this['_isResourceInContext'](_0xf7c531['id']))return;let _0x35621e=_0xf7c531['data'];if(!_0x35621e&&_0x105544['getData'])try{_0x35621e=await _0x105544['getData'](_0xf7c531['id']);}catch(_0x55bf19){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id'],'originalError':_0x55bf19}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});}if(_0x35621e)switch(_0xf7c531['type']){case'web-resource':if('string'!=typeof _0x35621e)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id'],'expectedType':'string','actualType':typeof _0x35621e}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});await this['addUrlToContext'](_0x35621e,{'label':_0xf7c531['label'],'resourceId':_0xf7c531['id']});break;case'file':if(!(_0x35621e instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id'],'expectedType':'File','actualType':typeof _0x35621e}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});await this['addFilesToContext']([_0x35621e],{'label':_0xf7c531['label'],'resourceId':_0xf7c531['id']});break;case'text':if('object'!=typeof _0x35621e||!('content'in _0x35621e)||!('type'in _0x35621e))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x35621e}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});_0x35621e=AIChatContext['_convertTextResourceToFile'](_0x35621e,_0xf7c531['label']),await this['addFilesToContext']([_0x35621e],{'label':_0xf7c531['label'],'resourceId':_0xf7c531['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id'],'resourceType':_0xf7c531['type']}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']}),'resourceId':_0xf7c531['id'],'sourceId':_0x105544['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x42edca){if(void 0x0!==_0x42edca)this['_addContextOptionsState']['document']['isHidden']=!_0x42edca;else{const _0x3c253c=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x3c253c;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x127920,_0x47e042){switch(_0x127920['type']){case'markdown':return new File([_0x127920['content']],_0x47e042,{'type':'text/markdown'});case'html':return new File([_0x127920['content']],_0x47e042,{'type':'text/html'});default:return new File([_0x127920['content']],_0x47e042,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x156120){switch(_0x156120['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x156120['id']}];case'web-resource':return[{'type':'web-resource','id':_0x156120['id']}];case'document':return _0x156120['documents']?.['length']?_0x156120['documents']['map'](_0x67fea=>({'type':'document','id':_0x67fea['id'],..._0x67fea['selection']?.['length']&&{'selection':_0x67fea['selection']}})):[];case'mcp-tool-context':{const _0x268a90=_0x156120;return[{'type':'mcp-tool-context','mcpServerName':_0x268a90['mcpServerName'],'toolName':_0x268a90['toolName'],'data':{..._0x268a90['data'],'label':_0x268a90['label']||_0x268a90['data']?.['label']||_0x268a90['id']},'id':_0x268a90['id']}];}default:return[];}}['_addContextItem'](_0x57ca4a,_0x195528=!0x1){if(this['_pendingContextItems']['set'](_0x57ca4a['uiId'],_0x57ca4a),_0x57ca4a['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x57ca4a,'isLoading':_0x195528}),'current-document'===_0x57ca4a['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x57ca4a['resourceId']){const _0x49c05a=this['_findSourceIdsByResourceId'](_0x57ca4a['resourceId']);_0x49c05a&&_0x49c05a['forEach'](_0x56ec06=>{this['_updateResourceInContextState'](_0x56ec06,_0x57ca4a['resourceId'],!0x0);});}}['_removeContextItem'](_0x5c2e2e){const _0x5c1760=this['_pendingContextItems']['get'](_0x5c2e2e),_0x5e54e8=this['_ongoingUploads']['get'](_0x5c2e2e);if(_0x5e54e8&&(_0x5e54e8['abort'](),this['_ongoingUploads']['delete'](_0x5c2e2e)),_0x5c1760?.['resourceId']){const _0x13d715=this['_findSourceIdsByResourceId'](_0x5c1760['resourceId']);_0x13d715&&_0x13d715['forEach'](_0x9364fc=>{this['_updateResourceInContextState'](_0x9364fc,_0x5c1760['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x5c2e2e),this['fire']('contextItemRemoved',{'uiId':_0x5c2e2e,'type':_0x5c1760?.['type']}),'current-document'===_0x5c2e2e&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x1bc536,_0x40716e){if(this['_pendingContextItems']['has'](_0x1bc536['uiId'])&&(this['_pendingContextItems']['set'](_0x1bc536['uiId'],_0x1bc536),this['fire']('contextItemLoadingEnded',{'contextItem':_0x1bc536,'isLoading':_0x40716e}),_0x1bc536['resourceId'])){const _0x46928e=this['_findSourceIdsByResourceId'](_0x1bc536['resourceId']);_0x46928e&&_0x46928e['forEach'](_0x54fc7b=>{this['_updateResourceInContextState'](_0x54fc7b,_0x1bc536['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x1ba7db){this['_conversationContextItems']['set'](_0x1ba7db['uiId'],_0x1ba7db);}['_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'](_0x417aca=>({..._0x417aca,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x4f3a87=>({..._0x4f3a87,'resources':[]}))??[];}['_isResourceInContext'](_0x446b28){for(const _0x52f55c of this['_pendingContextItems']['values']())if(_0x52f55c['resourceId']===_0x446b28)return!0x0;for(const _0x265142 of this['_conversationContextItems']['values']())if(_0x265142['resourceId']===_0x446b28)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x4b3f5a){const _0x58e874=[];for(const _0x34a6b7 of this['_addContextOptionsState']['sources'])_0x34a6b7['resources']['find'](_0x1fa655=>_0x1fa655['id']===_0x4b3f5a)&&_0x58e874['push'](_0x34a6b7['id']);return 0x0===_0x58e874['length']?null:_0x58e874;}['_updateResourceInContextState'](_0x310293,_0x508a6e,_0x34ff39){const _0x3cfb3f=this['_addContextOptionsState']['sources']['find'](_0x2b6766=>_0x2b6766['id']===_0x310293);if(!_0x3cfb3f)return;const _0x3be7f8=_0x3cfb3f['resources']['find'](_0x16c9e7=>_0x16c9e7['id']===_0x508a6e);_0x3be7f8&&(_0x3be7f8['isInContext']=_0x34ff39,this['fire']('resourceStateChanged',{'sourceId':_0x310293,'resourceId':_0x508a6e,'isInContext':_0x34ff39}));}['_startUploadOperation'](_0x2eb316){this['_ongoingUploadOperations']['set'](_0x2eb316,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x432918){this['_ongoingUploadOperations']['delete'](_0x432918),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Cn=/* #__PURE__ -- @preserve */
31
+ ut(),fn=['capabilitiesUpdated'];var bn=class extends Cn{['_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'](_0xede88e){const _0x2a0e05={};return _0xede88e&&_0xede88e['isWebSearchEnabled']&&(_0x2a0e05['webSearch']={}),_0xede88e&&_0xede88e['isReasoningEnabled']&&(_0x2a0e05['reasoning']={}),_0x2a0e05;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x5d0fb2){_0x5d0fb2!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x5d0fb2,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x1e7add){_0x1e7add!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x1e7add,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},Sn=class extends pn{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x90c85){super(_0x90c85),this['conversationId']=_0x90c85['conversationId'],this['contextItems']=_0x90c85['contextItems'],this['capabilities']=_0x90c85['capabilities'],this['userMessage']=_0x90c85['userMessage'],this['model']=_0x90c85['model'],this['attributes']=_0x90c85['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':wn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':bn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Rn=/* #__PURE__ -- @preserve */
32
+ ut();var On=class extends Rn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x514140){super(),this['options']=_0x514140,this['connector']=_0x514140['connector'],this['chatModels']=_0x514140['chatModels'],this['id']=_0x514140['conversationId'],this['isFromHistory']=_0x514140['isFromHistory'],this['_channelsToEditors']=_0x514140['channelsToEditors'],this['_getSessionId']=_0x514140['getSessionId'];}async['init'](_0x147aad){try{this['chatContext']=new wn({'connector':this['connector'],'config':_0x147aad,'ownerId':this['id']}),this['chatContext']['delegate'](...Tn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new bn(),this['chatCapabilities']['delegate'](...fn)['to'](this),this['chatCapabilities']['init']();const _0x52271d=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x52271d});const _0x2fcb16=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x2fcb16&&await this['setModel'](_0x2fcb16);}catch(_0x5c8e24){const _0x346b0a=new rn({'code':'ai-chat-conversation-init-failed','cause':_0x5c8e24,'type':'network'});this['fire']('error',{'error':_0x346b0a});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x4f0bf4}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x4f0bf4,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x1f801e){const _0x3cdd0a=new rn({'code':'ai-chat-conversation-start-failed','cause':_0x1f801e,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x3cdd0a}),_0x3cdd0a;}}async['load'](_0x5a86d6){try{const _0x17b859=await this['connector']['fetchConversation'](_0x5a86d6)['getConversation'](),_0x3cbfa2=await this['connector']['fetchConversationMessages'](_0x5a86d6)['getMessages'](),_0x88062c=_0x3cbfa2[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x17b859['id'],'title'in _0x17b859?this['fire']('setConversationTitle',_0x17b859['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x5b49f3=(await this['chatModels']['getAll']())['find'](_0x3c7a61=>_0x3c7a61['id']['toLowerCase']()===_0x88062c['toLowerCase']());this['selectedModel']=_0x5b49f3,this['fire']('modelSelected',{'selectedModel':_0x5b49f3,'isDisabled':!0x0});const {streamingMessageId:_0x29ade1}=await this['_processMessagesToInteractions'](_0x3cbfa2,_0x88062c);return _0x29ade1&&this['currentInteraction']?this['_resumeStream'](_0x29ade1):this['currentInteraction']=void 0x0,this;}catch(_0x1d58fb){const _0x5a2291=new rn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x1d58fb,'type':'network','context':{'conversationId':_0x5a86d6}});throw this['fire']('error',{'error':_0x5a2291}),_0x5a2291;}}async['_processMessagesToInteractions'](_0x2ac306,_0x446d6b){let _0x461050,_0x3027f5,_0x3809f3=!0x1;for(const _0xecd24c of _0x2ac306)if('user'===_0xecd24c['role']){const {contextItems:_0x4ee62f,hasUnmatched:_0x47270}=await this['_extractContextItems'](_0xecd24c);_0x3809f3=_0x47270;const _0x390ea1={'isReasoningEnabled':Object['hasOwn'](_0xecd24c['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0xecd24c['capabilities'],'webSearch')};_0x461050=this['createInteraction']({'userMessage':_0xecd24c['prompt'],'contextItems':_0x4ee62f,'capabilities':_0x390ea1,'modelId':_0x446d6b,'attributes':_0xecd24c['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x461050,_0x3027f5=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0xecd24c['role']&&_0x461050){if('streaming'===_0xecd24c['status']){_0x3027f5=_0xecd24c['id'];continue;}if('error'===_0xecd24c['status'])continue;const _0x3af43e=[];for(const _0x3b9e09 of _0xecd24c['content'])switch(_0x3b9e09['type']){case'text':case'modification':{const _0x532b3e=_0x461050['getDocumentContext'](),_0x149992=this['_hasSessionMismatch'](_0x532b3e)||_0x3809f3;_0x461050['currentReply']?.['type']!==_0x3b9e09['type']&&(_0x461050['currentReply']=_0x461050['createReply']({'type':_0x3b9e09['type'],'isDone':!0x0,'interactionId':_0x461050['id'],'areActionsDisabled':_0x149992,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3af43e['length']>0x0&&(_0x461050['currentReply']['sources']=_0x3af43e['splice'](0x0))),_0x461050['currentReply']['appendContent'](_0x3b9e09['content'],_0x3b9e09['documentId']);break;}case'url':_0x3af43e['push'](_0x3b9e09);break;case'mcp-tool-result':{const {data:_0x420345,attributes:_0x1cefc6}=JSON['parse'](_0x3b9e09['content']);_0x461050['_handleToolResultData']({'toolName':_0x3b9e09['toolName'],'data':_0x420345,'attributes':_0x1cefc6});break;}}'cancelled'===_0xecd24c['status']&&this['fire']('error',{'interactionId':_0x461050['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x3027f5};}async['_resumeStream'](_0x4dcf5b){if(this['currentInteraction'])try{const _0x3db1d4=this['connector']['resumeStream'](this['id'],_0x4dcf5b);await this['currentInteraction']['resume'](_0x3db1d4);}catch(_0x1b3c5d){_0x1b3c5d instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x1b3c5d});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x471b4c){return _0x471b4c['content']?this['chatContext']['populateFromMessage'](_0x471b4c['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x3c7c20,attributes:_0x52b672}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4a6b32=new Map(this['getPendingContextItems']()),_0x102fa4=this['chatCapabilities']['getCapabilitiesConfig'](),_0x5eafb3=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x3c7c20,'contextItems':_0x4a6b32,'capabilities':_0x102fa4,'modelId':_0x5eafb3,'attributes':_0x52b672,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x4ded1a){if(_0x4ded1a instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x4ded1a});else{const _0x417829=mn['get'](_0x4ded1a['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x417829,null,{'error':_0x4ded1a})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x7b0bcf,contextItems:_0xb2ba1c,capabilities:_0x557594,modelId:_0x26204c,attributes:_0x5c2432,channelsToEditors:_0xdd376}){const _0x3dc06b=new Sn({'userMessage':_0x7b0bcf,'contextItems':_0xb2ba1c,'capabilities':_0x557594,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x26204c,'attributes':_0x5c2432,'channelsToEditors':_0xdd376});return _0x3dc06b['delegate'](...In)['to'](this),this['interactions']['push'](_0x3dc06b),this['fire']('interactionCreated',_0x3dc06b),_0x3dc06b;}['getInteraction'](_0x1306b3){return this['interactions']['find'](_0x14e449=>_0x14e449['id']===_0x1306b3);}['removeInteraction'](_0x30d495){const _0x3e87bb=this['getInteraction'](_0x30d495);_0x3e87bb&&(_0x3e87bb['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x3e87bb),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x4986fa=this['lastInteraction'];_0x4986fa?.['conversationId']&&_0x4986fa['messageId']&&this['connector']['cancelStream'](_0x4986fa['conversationId'],_0x4986fa['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x5b127c){this['chatContext']['addCurrentDocumentToContext'](_0x5b127c);}async['updateCurrentDocumentsInContext'](_0x167323){await this['chatContext']['updateCurrentDocuments'](_0x167323);}['toggleAddCurrentDocumentOptionVisibility'](_0x8e9f69){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x8e9f69);}['_hasSessionMismatch'](_0x14ae63){return!!_0x14ae63&&_0x14ae63['documents']['some'](_0x47365e=>{const _0x4bb9d6=this['_channelsToEditors']['get'](_0x47365e['channelId']);return!_0x4bb9d6||_0x47365e['sessionId']!==this['_getSessionId'](_0x4bb9d6);});}['addSelectionToContext'](_0x229945){this['chatContext']['addSelectionToContext'](_0x229945);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x12c3b6){this['chatContext']['addFilesToContext'](_0x12c3b6);}['addUrlToContext'](_0x1ffae9){this['chatContext']['addUrlToContext'](_0x1ffae9);}['addToolItemToContext'](_0x267057){this['chatContext']['addToolItemToContext'](_0x267057);}['addResourceToContext'](_0x1eda4e,_0x19b674){this['chatContext']['addResourceToContext'](_0x1eda4e,_0x19b674);}['loadSourceResources'](_0x3f44ad,_0x37501c,_0x4d846f){return this['chatContext']['loadSourceResources'](_0x3f44ad,_0x37501c,_0x4d846f);}['removeFromContext'](_0x259391){this['chatContext']['removeFromContext'](_0x259391);}['setWebSearch'](_0x597367){this['chatCapabilities']['setWebSearch'](_0x597367);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x45f1bc){this['chatCapabilities']['setReasoning'](_0x45f1bc);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x33451e){_0x33451e?!0x1===await this['chatModels']['isAvailable'](_0x33451e)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x33451e}),_0x33451e=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x33451e=(await this['chatModels']['getAvailableModels']())[0x0]),_0x33451e['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x33451e,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x33451e}));}};function vn({groups:_0x554812,documentContextContent:_0x50e7da,documents:_0x2bf57b}){const _0x3e591b=new Map();for(const _0x225a37 of _0x554812){const {documentId:_0x37f99e}=_0x225a37,_0x5ea0bb=_0x3e591b['get'](_0x37f99e);if(_0x5ea0bb)_0x5ea0bb['groups']['push'](_0x225a37),_0x5ea0bb['indexes']['push'](_0x225a37['index']);else{const _0x393c4b=_0x2bf57b['find'](_0x255771=>_0x255771['id']===_0x37f99e),_0x29396b=_0x50e7da['get'](_0x37f99e);if(!_0x393c4b||!_0x29396b)continue;_0x3e591b['set'](_0x37f99e,{'groups':[_0x225a37],'documentContext':_0x393c4b,'documentContent':_0x29396b,'editor':_0x225a37['editor'],'indexes':[_0x225a37['index']]});}}return _0x3e591b;}function kn(_0x470a0c,_0x382b68){const _0x50e0c2=_0x470a0c['files']['length']>0x0&&_0x470a0c['files']['every'](_0x239f63=>_0x239f63['type']['startsWith']('image/')),_0x55d2e1=_0x470a0c['plainText']['trim']()['length']>0x0;if(_0x470a0c['files']['length']>0x0&&_0x382b68['filesEnabled']&&(!_0x50e0c2||!_0x55d2e1)){const _0x9e0d81=_0x470a0c['files']['filter'](_0x87dab9=>_0x87dab9['name']);return _0x9e0d81['length']>0x0?{'type':'file','files':_0x9e0d81}:null;}if(_0x382b68['urlsEnabled']){const _0x5daba=function(_0x424f65){const _0x169cee=_0x424f65['trim']();if(/\s/['test'](_0x169cee))return null;try{const _0x3ad818=new URL(_0x169cee);return'http:'!==_0x3ad818['protocol']&&'https:'!==_0x3ad818['protocol']?null:_0x3ad818['toString']();}catch{return null;}}(_0x470a0c['plainText']);if(_0x5daba)return{'type':'url','url':_0x5daba};}const _0x456d99=_0x470a0c['forceTextAttachment']?0x1:_0x382b68['longTextThreshold']??0x1/0x0;if(_0x470a0c['plainText']['length']>=Math['max'](_0x456d99,0x1)&&_0x382b68['filesEnabled']){const _0x269516=_0x382b68['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x470a0c['plainText']],_0x269516,{'type':'text/plain'})]};}return null;}var Nn=class extends _0x215b79{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,on,_0x598e2f];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=dn(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'](on)['createReporter']('aichat'),this['_aiChatModels']=new zs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x2ca102=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x24260f,_0x4cae4d)=>{this['_handleUIUserMessage']({'message':_0x4cae4d});}),this['listenTo'](_0x2ca102['view'],'change:activeTab',(_0x52f329,_0x437d38,_0x49e5ca)=>{'chat'!==_0x49e5ca&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x2b07e4,_0x4b7338)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x4b7338));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x545869,_0x49ee29)=>{this['activeConversation']?.['addUrlToContext'](_0x49ee29);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x372bd6,_0x13fe2b)=>{const _0x7ae3fc=this['activeConversation'];if(!_0x7ae3fc)return;_0x13fe2b['hasDirectory']&&(_0x13fe2b['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x11f3e4=kn(_0x13fe2b,{'pastedTextLabel':us(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')});_0x11f3e4&&(_0x13fe2b['preventDefault'](),'url'===_0x11f3e4['type']?_0x7ae3fc['addUrlToContext'](_0x11f3e4['url']):_0x7ae3fc['chatContext']['addFilesToContext'](_0x11f3e4['files'],void 0x0,_0x11f3e4['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0xf34f6,_0x22db99)=>{_0x22db99['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x1808a3,_0x2ea410)=>{this['activeConversation']?.['addResourceToContext'](_0x2ea410['source'],_0x2ea410['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x22f9d9,_0x37b1a2)=>{this['_removeFromContext'](_0x37b1a2);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x450499,_0x438df1)=>{this['activeConversation']?.['loadSourceResources'](_0x438df1['sourceId'],_0x438df1['query'],_0x438df1['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x389a97,_0x35c77f)=>{this['activeConversation']?.['setModel'](_0x35c77f);}),this['listenTo'](this['_aiChatUi'],'like',(_0x6380c,{replyId:_0xd94286})=>{console['log']('Liked\x20response',_0xd94286);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x558808,{replyId:_0x12257f})=>{console['log']('Disliked\x20response',_0x12257f);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x266b16,_0x369f0c)=>{this['_insertSuggestion'](_0x369f0c);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3b7652,{replyId:_0x5c1779,partIndex:_0x2498f3})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x5c1779,_0x2498f3);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x4948ca,{replyId:_0x5a2dd3,partIndex:_0x1f677c})=>{const _0x297779=this['_getDocumentRangeForReplyChanges'](_0x5a2dd3,_0x1f677c);if(!_0x297779)return;const {reply:_0x48ef5c}=this['getInteractionAndReplyById'](_0x5a2dd3);'$graveyard'!=_0x297779['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x48ef5c['changeGroups'][_0x1f677c]['editor'],'ranges':[_0x297779['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x3f7c28,_0x254d7a)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x254d7a);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x337290,{replyId:_0x5f2e0d,showDiff:_0x2e8758})=>{const {interaction:_0x5ac23f,reply:_0x408916}=this['getInteractionAndReplyById'](_0x5f2e0d),_0x15f528=_0x408916['getContentParts']({'showDiff':_0x2e8758});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5ac23f['id']+':'+_0x408916['id'],'parts':_0x15f528});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x54d705,{replyId:_0x449dd4,partIndex:_0x24f5bf})=>{this['_rejectSuggestion']({'replyId':_0x449dd4,'partIndex':_0x24f5bf}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x1962e0,_0x4c5f8d)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4c5f8d);}),this['on']('replyCreated',(_0x18b9ab,_0x26ddee)=>{this['_addFeedItemReply'](_0x26ddee);});}['afterInit'](){this['context']instanceof _0x21f3b4?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x196280,_0x451fb0)=>{_0x451fb0['on']('ready',()=>{this['_integrateEditor'](_0x451fb0);});}),this['_initConversation']();}async['_initConversation'](){const _0x46abea=this['context']['config']['get']('ai.chat.initialConversation');let _0x25875b=_0x46abea;('lastCreated'!=_0x46abea||(_0x25875b=await this['_getLastCreatedConversationId'](),_0x25875b))&&('new'==_0x25875b?await this['_startConversationSafely']():await this['loadConversation'](_0x25875b));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x77ec43){this['_closeActiveBalloon'](),this['context']['plugins']['get'](cs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x77ec43)['getConversation'](),await this['_startConversationSafely']({'id':_0x77ec43}),await this['activeConversation']['load'](_0x77ec43),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x1a41d8){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x77ec43}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x1a41d8),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x512d8a){let _0x5853db=null,_0x3038dd=null;this['on']('toolDataReceived',(_0x4ff64f,_0x4bf5b7,_0xc97212)=>{_0xc97212['id']!==_0x5853db&&(_0x5853db=_0xc97212['id'],_0x3038dd=this['_getAIChatFeedAPI'](_0xc97212)),_0x512d8a(_0x4bf5b7,_0x3038dd);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0xb4f226){const _0x1c3b28=this['_aiEditing']['getSelectionText'](_0xb4f226);this['activeConversation']?.['addSelectionToContext'](_0x1c3b28),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x3f6e7e){await this['_startConversationSafely']({'modelId':_0x3f6e7e?.['modelId']});}async['sendMessage'](_0x5f11bc){await this['_handleUIUserMessage'](_0x5f11bc);}['getGroupId'](){const _0xbe075f=this['context']['config']['get']('collaboration.channelId');if(!_0xbe075f)throw new ht('ai-missing-channel-id',this);return _0xbe075f;}['_handleRemovedConversation'](_0x42ff86){this['activeConversation']['id']===_0x42ff86&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x8a775c){const {reply:_0x433d5b,interaction:_0x531de1}=this['getInteractionAndReplyById'](_0x8a775c['replyId']),_0x4cfe79=void 0x0!==_0x8a775c['partIndex']?[_0x433d5b['changeGroups'][_0x8a775c['partIndex']]]:_0x433d5b['changeGroups']['filter'](_0x433a49=>'pending'==_0x433a49['state']);return _0x4cfe79['map'](_0x2d6cdb=>_0x433d5b['changeGroups']['indexOf'](_0x2d6cdb))['forEach'](_0x1edbc5=>{const _0x36e9cc=this['_getDocumentRangeForReplyChanges'](_0x8a775c['replyId'],_0x1edbc5);_0x36e9cc&&'$graveyard'!=_0x36e9cc['range']['root']['rootName']?(_0x433d5b['setChangeGroupState'](_0x1edbc5,'accepted'),void 0x0!==_0x8a775c['partIndex']&&this['_scrollToSuggestionRange'](_0x36e9cc['range'],!0x1,_0x36e9cc['targetEditor'])):_0x433d5b['setChangeGroupState'](_0x1edbc5,'outdated');}),vn({'groups':_0x4cfe79['filter'](_0x340955=>'accepted'===_0x340955['state']),'documentContextContent':_0x433d5b['documentContextContent'],'documents':_0x531de1['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x2b27b3){const _0xf32dcc=this['context']['plugins']['get'](_0x598e2f),{reply:_0x26b240,interaction:_0x41d952}=this['getInteractionAndReplyById'](_0x2b27b3['replyId']),_0x2c4c9a=this['_prepareDocumentSuggestions'](_0x2b27b3),_0x35d3ce=Ns({'documentSuggestions':_0x2c4c9a,'transform':!0x0,'documentCompare':_0xf32dcc,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x3e23cc,_0x34aca2]of _0x35d3ce){const {editor:_0x405935,indexes:_0x1059b9}=_0x2c4c9a['get'](_0x3e23cc);if(!_0x405935['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0x405935});continue;}let _0x46e0a6;Js(_0x34aca2,'chat'),_0x405935['model']['change'](_0x49021e=>{_0x46e0a6=_0x49021e['batch'],_0x405935['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x34aca2),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x46e0a6,{'interactionId':_0x41d952['id'],'replyId':_0x26b240['id'],'indexes':_0x1059b9});}this['_updateRatings'](_0x26b240);}['_applySuggestion'](_0x4bbe84){const _0x7c11d7=this['context']['plugins']['get'](_0x598e2f),{reply:_0x4fd26b,interaction:_0x461fd4}=this['getInteractionAndReplyById'](_0x4bbe84['replyId']),_0x5f31e6=this['_prepareDocumentSuggestions'](_0x4bbe84),_0x28e7d8=Ns({'documentSuggestions':_0x5f31e6,'transform':!0x0,'documentCompare':_0x7c11d7,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x242267,_0x1d6819]of _0x28e7d8){const {editor:_0x264eec,indexes:_0x24bea8}=_0x5f31e6['get'](_0x242267);let _0x3148a0;Js(_0x1d6819,'chat');try{_0x264eec['model']['change'](_0x2d7dcc=>{_0x3148a0=_0x2d7dcc['batch'];for(const _0x1912af of _0x1d6819)_0x1912af['baseVersion']=_0x264eec['model']['document']['version'],ys(_0x264eec,_0x1912af),_0x2d7dcc['batch']['addOperation'](_0x1912af),_0x264eec['model']['applyOperation'](_0x1912af);}),this['_batchToChanges']['set'](_0x3148a0,{'interactionId':_0x461fd4['id'],'replyId':_0x4fd26b['id'],'indexes':_0x24bea8});}catch(_0x58d3e7){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x58d3e7})),_0x58d3e7;}}this['_updateRatings'](_0x4fd26b);}['_rejectSuggestion'](_0x12fc59){const {reply:_0x489cda}=this['getInteractionAndReplyById'](_0x12fc59['replyId']);_0x489cda['setChangeGroupState'](_0x12fc59['partIndex'],'rejected');}['_openBalloonFor'](_0x41ec71,_0x181482){if(!this['_hasAIChatBalloon'])return;const {reply:_0x18294c}=this['getInteractionAndReplyById'](_0x41ec71),_0x43f5dc=_0x18294c['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x43f5dc['length'])return;let _0xc079bf,_0x450454;if(void 0x0!==_0x181482?(_0x450454=_0x43f5dc['find'](_0x309180=>_0x309180['index']==_0x181482),_0xc079bf=_0x450454?.['index']):(_0x450454=_0x43f5dc[0x0],_0xc079bf=_0x450454['index']),!_0x450454)return void _0x18294c['setChangeGroupState'](_0x181482??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x41ec71&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0xc079bf)return;const _0x492520=this['_getUserPresentableContentPartDocumentRange'](_0x41ec71,_0x18294c,_0x450454),_0x3eab84=_0x18294c['changeGroups']['find'](_0x4bbd15=>_0x4bbd15['index']==_0xc079bf)['editor'],_0xf25f2=_0x3eab84['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0xf25f2&&this['_activeBalloon']['close'](),!_0x492520)return _0xf25f2['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xf25f2,this['_currentPreviewedChangeGroup']={'replyId':_0x41ec71,'partIndex':_0xc079bf},this['_scrollToSuggestionRange'](_0x492520,!0x0,_0x3eab84);const _0x1c5734=this['_getPresentableSiblingContentPartIndex'](_0x41ec71,_0xc079bf,'next');_0xf25f2['clearContent'](),_0xf25f2['updateContent']({'part':_0x450454,'renderingStrategy':'static'}),_0xf25f2['open']({'index':_0xc079bf,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0xc079bf+0x1)['toString']()),'showRotator':null!==_0x1c5734,'ranges':[_0x492520],'areActionsDisabled':_0x18294c['areActionsDisabled'],'targetEditor':_0x3eab84}),_0xf25f2['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x41ec71,_0xc079bf),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x41ec71,'index':_0xc079bf,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x538862,_0x58181d,_0x1fffbe){const {reply:_0x1da048}=this['getInteractionAndReplyById'](_0x538862),_0x51cf03=_0x1da048['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x51cf03['length'])return null;const _0x35ffdc='next'==_0x1fffbe?0x1:-0x1;function _0xad82cd(_0x1f9ce5){const _0xdca106=(_0x1f9ce5+_0x35ffdc+_0x51cf03['length'])%_0x51cf03['length'];return{'siblingIndex':_0xdca106,'siblingPart':_0x51cf03[_0xdca106]};}const _0x445677=_0x51cf03['findIndex'](_0x2d14a2=>_0x2d14a2['index']==_0x58181d);let {siblingIndex:_0x5b849a,siblingPart:_0x4a8bfc}=_0xad82cd(_0x445677);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x538862,_0x1da048,_0x4a8bfc);)if({siblingIndex:_0x5b849a,siblingPart:_0x4a8bfc}=_0xad82cd(_0x5b849a),_0x5b849a===_0x445677)return null;return _0x4a8bfc['index'];}['_getUserPresentableContentPartDocumentRange'](_0x1fe288,_0x1201b9,_0x4794e7){const _0xbd761b=_0x1201b9['changeGroups'];if(!_0x4794e7['hasChanges'])return null;const _0x546304=_0xbd761b['find'](_0x1e8304=>_0x1e8304['index']==_0x4794e7['index']);if('pending'!==_0x546304?.['state'])return null;if(!_0x546304?.['editor']||'destroyed'===_0x546304['editor']['state'])return _0x1201b9['setChangeGroupState'](_0x4794e7['index'],'outdated'),null;const _0x4e1536=this['_getDocumentRangeForReplyChanges'](_0x1fe288,_0x4794e7['index']);if(!_0x4e1536)return _0x1201b9['setChangeGroupState'](_0x4794e7['index'],'outdated'),null;const {range:_0x35b795,currentIndex:_0x2bdb16}=_0x4e1536;return'$graveyard'==_0x35b795['root']['rootName']?(_0x1201b9['setChangeGroupState'](_0x2bdb16,'outdated'),null):_0x4e1536['range'];}['_getDocumentRangeForReplyChanges'](_0x3b1821,_0x2689b6){const {reply:_0x460952,interaction:_0x2baefc}=this['getInteractionAndReplyById'](_0x3b1821),_0x3eae2d=_0x460952['changeGroups']['filter'](_0x26c392=>'pending'==_0x26c392['state']),_0x5a635e=_0x3eae2d['map'](_0x460f1c=>_0x460952['changeGroups']['indexOf'](_0x460f1c));void 0x0===_0x2689b6&&(_0x2689b6=_0x5a635e[0x0]);const _0x113580=_0x5a635e['indexOf'](_0x2689b6);if(-0x1==_0x113580)return null;const _0x58dfc7=_0x3eae2d[_0x113580],_0x385f05=_0x58dfc7['editor'];if(!_0x385f05||'destroyed'===_0x385f05['state'])return null;if(!_0x1779c2(_0x385f05,_0x58dfc7['rootName']))return null;const _0x27654f=_0x460952['documentContextContent']['get'](_0x58dfc7['documentId']),_0x16f5ef=new _0x35a1e4([]),_0x3afeb2=new _0x35a1e4([]);for(const _0x55a856 of _0x58dfc7['changes'])if('removed'!=_0x55a856['type']&&_0x3afeb2['children']['push'](_0x55a856['node']['cloneNode'](!0x0)),'new'!=_0x55a856['type']){const _0x5d2597=ti(_0x5c74eb=>fs(_0x5c74eb,'data-id')==_0x55a856['id'],_0x27654f,!0x0);_0x16f5ef['children']['push'](_0x5d2597['cloneNode'](!0x0));}if(0x0==_0x16f5ef['children']['length']){if(_0x58dfc7['changes'][0x0]['anchorId']){const _0x1ac742=Es('data-id',_0x58dfc7['changes'][0x0]['anchorId'],_0x27654f);_0x16f5ef['children']['unshift'](_0x1ac742['cloneNode'](!0x0)),_0x3afeb2['children']['unshift'](_0x1ac742['cloneNode'](!0x0)),_0x1ac742['nextSibling']&&(_0x16f5ef['children']['push'](_0x1ac742['nextSibling']['cloneNode'](!0x0)),_0x3afeb2['children']['push'](_0x1ac742['nextSibling']['cloneNode'](!0x0)));}else{const _0x4de12f=_0x27654f['children'][0x0];if(!_0x4de12f)return null;_0x16f5ef['children']['push'](_0x4de12f['cloneNode'](!0x0)),_0x3afeb2['children']['push'](_0x4de12f['cloneNode'](!0x0));}}const _0x50480c=_0x2baefc['getDocumentContext'](),_0x58c20f=_0x50480c['documents']['find'](_0x3e8f46=>_0x3e8f46['id']==_0x58dfc7['documentId'])['content'],_0x3cd420=_0x385f05['model']['document']['getRoot'](_0x58dfc7['rootName']),_0x5e104d=_0x385f05['data']['parse'](_0x58c20f,_0x3cd420),_0x4d5e39=ms(_0x16f5ef),_0x5f0798=_0x385f05['data']['parse'](_0x4d5e39,_0x3cd420),_0x30c435=_0x385f05['data']['parse'](_0x4d5e39,_0x3cd420),_0x3f6df2=_0x385f05['model']['createPositionAt'](_0x5f0798,0x0),_0x11a04f=ms(_0x3afeb2),_0x5e5fb0={'targetEditor':_0x385f05,'anchor':_0x3f6df2,'markDeletions':!0x1};let _0x2a9c18;try{_0x2a9c18=_0x385f05['plugins']['get'](_0x598e2f)['getDiff'](_0x4d5e39,_0x11a04f,_0x5e5fb0)['getOperations']();}catch(_0x399821){return this['_reporter']['reportError'](new rn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x399821,'context':{'replyId':_0x3b1821,'partIndex':_0x2689b6}})),null;}if(!_0x2a9c18['length'])return null;_0x385f05['model']['change'](_0x3ad232=>{for(const _0x1d01cc of _0x2a9c18)if('remove'==_0x1d01cc['type']){const _0x39a000=_0x1d01cc['sourcePosition'],_0xfc47ba=_0x1d01cc['howMany'],_0xc7b42e=new _0x16ad52(_0x39a000,_0xfc47ba);_0x3ad232['batch']['addOperation'](_0xc7b42e),_0x385f05['model']['applyOperation'](_0xc7b42e);}else'marker'!==_0x1d01cc['type']&&(_0x1d01cc['baseVersion']=null,_0x1d01cc['isDocumentOperation']=!0x1,_0x3ad232['batch']['addOperation'](_0x1d01cc),_0x385f05['model']['applyOperation'](_0x1d01cc));});const _0xffd047=Ks(_0x385f05,_0x2a9c18,_0x5f0798);Ys(_0x385f05['model'],_0xffd047);const _0x3b8123=_0xffd047['getFirstRange']()['start']['path']['slice'](),_0x87d481=_0xffd047['getFirstRange']()['end']['path']['slice'](),_0x1b96ca=[];let _0x12cef0=_0x5f0798,_0x268318=_0x30c435;for(let _0x3e8a28=0x0;_0x3e8a28<_0x87d481['length'];_0x3e8a28++){const _0x3927d3=_0x12cef0['maxOffset']-_0x87d481[_0x3e8a28];_0x1b96ca[_0x3e8a28]=_0x268318['maxOffset']-_0x3927d3,_0x12cef0=_0x12cef0['getChildAtOffset'](_0x87d481[_0x3e8a28]),_0x268318=_0x268318['getChildAtOffset'](_0x1b96ca[_0x3e8a28]);}const _0x5686ed=_0x385f05['model']['createRange'](_0x385f05['model']['createPositionFromPath'](_0x30c435,_0x3b8123),_0x385f05['model']['createPositionFromPath'](_0x30c435,_0x1b96ca)),_0xee2158=_0x30c435['getChild'](0x0)['getAttribute'](_0x19a42d),_0x547e2a=Array['from'](_0x5e104d['getChildren']())['find'](_0x1586ea=>_0x1586ea['getAttribute'](_0x19a42d)==_0xee2158)['getPath'](),_0x29ef1c=_0x5686ed['start']['path']['slice'](),_0x13267d=_0x5686ed['end']['path']['slice']();_0x29ef1c[0x0]=_0x547e2a[0x0]+_0x29ef1c[0x0],_0x13267d[0x0]=_0x547e2a[0x0]+_0x13267d[0x0];let _0x570071=_0x385f05['model']['createRange'](_0x385f05['model']['createPositionFromPath'](_0x385f05['model']['document']['getRoot'](_0x58dfc7['rootName']),_0x29ef1c),_0x385f05['model']['createPositionFromPath'](_0x385f05['model']['document']['getRoot'](_0x58dfc7['rootName']),_0x13267d));const _0x239413=_0x50480c['documents']['find'](_0x41e5ef=>_0x41e5ef['id']==_0x58dfc7['documentId'])['version'],_0x4095a4=_0x385f05['model']['document']['history']['getOperations'](_0x239413);for(const _0xc4bcc of _0x4095a4)_0x570071=_0x217c33['_createFromRanges'](_0x570071['getTransformedByOperation'](_0xc4bcc));return{'range':_0x570071,'currentIndex':_0x2689b6,'targetEditor':_0x385f05};}['_integrateEditorBalloon'](_0x4cedf2){if(!_0x4cedf2['plugins']['has']('AIChatBalloon'))return;const _0x44db21=_0x4cedf2['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x44db21['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x44db21,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x50cb15,partIndex:_0x2193d1}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x50c489}=this['getInteractionAndReplyById'](_0x50cb15),_0x3eeaea=_0x50c489['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x2193d1});_0x44db21['updateContent']({'part':_0x3eeaea[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x44db21,'applySuggestion',()=>{const {replyId:_0x241a1a,partIndex:_0x1a0715}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x241a1a,'partIndex':_0x1a0715}),_0x44db21['setState']('accepted');}),this['listenTo'](_0x44db21,'insertSuggestion',()=>{const {replyId:_0x5c5305,partIndex:_0x16a72a}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x5c5305,'partIndex':_0x16a72a}),_0x44db21['setState']('accepted');}),this['listenTo'](_0x44db21,'rejectSuggestion',()=>{const {replyId:_0x57f6df,partIndex:_0x22f6cf}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x57f6df,'partIndex':_0x22f6cf}),_0x44db21['setState']('rejected');}),this['listenTo'](_0x44db21,'showNext',()=>{const {replyId:_0x1ba850,partIndex:_0x4549d4}=this['_currentPreviewedChangeGroup'],_0x38955b=this['_getPresentableSiblingContentPartIndex'](_0x1ba850,_0x4549d4,'next');null!==_0x38955b&&this['_openBalloonFor'](_0x1ba850,_0x38955b);}),this['listenTo'](_0x44db21,'showPrevious',()=>{const {replyId:_0x375757,partIndex:_0x382319}=this['_currentPreviewedChangeGroup'],_0x179217=this['_getPresentableSiblingContentPartIndex'](_0x375757,_0x382319,'previous');null!==_0x179217&&this['_openBalloonFor'](_0x375757,_0x179217);}),this['listenTo'](_0x44db21,'dialogClosed',(_0x3ceabd,{id:_0x826c3})=>{if('aiChatBalloon'!==_0x826c3)return;const {replyId:_0x5f248d,partIndex:_0x2170f6}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x5f248d,'index':_0x2170f6,'isActive':!0x1}),this['_activeBalloon']===_0x44db21&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x8eba84){if(this['_channelsToEditors']['set'](_0x8eba84['config']['get']('collaboration.channelId'),_0x8eba84),this['_integrateEditorBalloon'](_0x8eba84),this['addCurrentDocumentToChatContext'](),_0x8eba84['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x8eba84['plugins']['has']('Undo')){const _0x3e8938=_0x8eba84['commands']['get']('undo'),_0x3de514=_0x8eba84['commands']['get']('redo');this['listenTo'](_0x3e8938,'revert',(_0x263ba8,_0x4cffcf,_0x282072)=>{const _0x5aac31=this['_batchToChanges']['get'](_0x4cffcf);if(!_0x5aac31)return;const _0x28b3e3=this['activeConversation']['getInteraction'](_0x5aac31['interactionId']),_0x3c6122=_0x28b3e3?.['getReply'](_0x5aac31['replyId']);this['_batchToChanges']['delete'](_0x4cffcf),_0x28b3e3&&_0x3c6122&&(_0x5aac31['indexes']['forEach'](_0x22c804=>_0x3c6122['setChangeGroupState'](_0x22c804,'pending')),this['_batchToChanges']['set'](_0x282072,_0x5aac31));}),this['listenTo'](_0x3de514,'revert',(_0xc684c1,_0x3a9e39,_0x248b5f)=>{const _0x45ea84=this['_batchToChanges']['get'](_0x3a9e39);if(!_0x45ea84)return;const _0x5841bd=this['activeConversation']['getInteraction'](_0x45ea84['interactionId']),_0x4179fe=_0x5841bd?.['getReply'](_0x45ea84['replyId']);this['_batchToChanges']['delete'](_0x3a9e39),_0x5841bd&&_0x4179fe&&(_0x45ea84['indexes']['forEach'](_0x21b314=>_0x4179fe['setChangeGroupState'](_0x21b314,'accepted')),this['_batchToChanges']['set'](_0x248b5f,_0x45ea84));});}const _0x2e51d0=_0x8eba84['config']['get']('ai.chat.context');_0x2e51d0['alwaysAddSelection']&&_0x2e51d0['document']['enabled']&&this['listenTo'](_0x8eba84['model']['document']['selection'],'change:range',(_0x14952f,_0x406390)=>{_0x406390['directChange']&&'chat'===_0x8eba84['plugins']['get']('AITabs')['view']['activeTab']&&(_0x8eba84['model']['hasContent'](_0x8eba84['model']['document']['selection'])?this['addSelectionToChatContext'](_0x8eba84):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x4e83e9=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x4ed965=await _0x4e83e9['getConversations']();return _0x4ed965['length']?_0x4ed965[0x0]['id']:'new';}catch(_0x377cb7){return this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':vt()}),this['_reporter']['logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x377cb7})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x39411c={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x39411c);}catch(_0x23a006){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x39411c['id']||vt()}),this['_reporter']['logError'](_0x23a006),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x409c40,modelId:_0xe5ae82}={}){this['_closeActiveBalloon']();let _0x53bc80=_0xe5ae82;_0x53bc80||(_0x409c40||!this['activeConversation']?_0x53bc80=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x53bc80=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x33fe67=this['getGroupId'](),_0x36ea2a=_0x409c40||vt();let _0x34c869;this['activeConversation']=new On({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x53bc80,'conversationId':_0x36ea2a,'group':_0x33fe67,'locale':this['context']['locale'],'isFromHistory':!!_0x409c40,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x3a7d1e=>this['_aiEditing']['getSessionId'](_0x3a7d1e)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x371e3d,_0x47577f)=>{this['_aiChatUi']['createConversation'](_0x47577f),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x409c40||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x4f48f7,_0x36f054)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x36f054['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x49d24d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x49d24d);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x711ff=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x711ff);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x4ff283,_0x3bf16e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3bf16e,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x121400,_0x2229e7)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x2229e7,{'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',(_0x125a2d,_0x24c2d8)=>{this['_aiChatUi']['removeFeedInteraction'](_0x24c2d8['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0xe75846,_0x146077,_0x27af87)=>{this['_updateConversationTitle'](_0x146077,_0x27af87);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x28f2aa,_0xb32c26)=>{void 0x0!==_0x34c869&&_0x34c869!==_0xb32c26['id']&&this['_updateReplyContentThrottled']['flush'](),_0x34c869=_0xb32c26['id'],_0xb32c26['isFromHistory']?await this['_updateReplyContent']({'reply':_0xb32c26}):await this['_updateReplyContentThrottled']({'reply':_0xb32c26});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x3613e2,{reply:_0x445b36,index:_0x115ba8,state:_0x150245})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x445b36['id'],'index':_0x115ba8,'state':_0x150245}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x445b36['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x115ba8&&this['_activeBalloon']?.['setState'](_0x150245);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x5c15fc,_0x404b6d)=>{if(this['_aiChatUi']['addContextItem'](_0x404b6d['contextItem'],_0x404b6d['isLoading']),'selection'===_0x404b6d['contextItem']['type']){const _0x4ed16f=_s(this['context']),_0x1b2f37=[..._0x4ed16f['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x4ed16f,'ranges':_0x1b2f37,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x19d565,_0x2a46d1)=>{this['_aiChatUi']['removeContextItem'](_0x2a46d1['uiId']),'current-document'==_0x2a46d1['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x2a46d1['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xf3661,_0xdeda97)=>{this['_aiChatUi']['setContextItemLoading'](_0xdeda97['contextItem']['uiId'],_0xdeda97['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x26a27c,_0x2788dd)=>{this['_aiChatUi']['setConversationContext'](_0x2788dd['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x2d1dd1,_0x120780)=>{this['_aiChatUi']['setAddContextOptions'](_0x120780['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x50cc67,_0x252d00)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x252d00['sourceId'],_0x252d00['source'],_0x252d00['resources'],_0x252d00['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x1828de,_0x2396cf)=>{this['_aiChatUi']['updateResourceState'](_0x2396cf['sourceId'],_0x2396cf['resourceId'],_0x2396cf['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x3921a0,_0x20f3d3)=>{this['_aiChatUi']['updateCapabilities'](_0x20f3d3);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x3cd7f5,_0x1bc77)=>{try{const _0x473adb=(await this['_aiChatModels']['getAll']())['find'](_0xd3c3bc=>_0xd3c3bc['id']===_0x1bc77['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x473adb,_0x1bc77['isDisabled']);}catch(_0x11ebf4){this['_reporter']['logError'](new rn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x11ebf4}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x2a4ab8,{error:_0x42e601,interactionId:_0x1c6cec,fileName:_0x4adab7,url:_0x44199a,sourceId:_0x45b0d6,sourceLabel:_0x261835})=>{const _0x56a2ef=_0x1c6cec?_0x1c6cec+':'+vt():vt();this['_reporter']['reportError'](_0x42e601),_0x42e601['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-conversation-init-failed')||_0x42e601['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x4adab7),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x44199a),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x45b0d6&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x45b0d6),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x261835||'source'),'id':_0x56a2ef})):_0x42e601['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x56a2ef}):_0x42e601['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x56a2ef}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x56a2ef});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x409c40||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x306edc,attributes:_0x3aef0c}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3fb74c=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3fb74c);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x306edc,'attributes':_0x3aef0c});}['_removeFromContext'](_0x164752){this['activeConversation']?.['removeFromContext'](_0x164752);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x2a8960){const [_0xed0855,_0x26e6fe]=_0x2a8960['split'](':'),_0x2073cc=this['activeConversation']['getInteraction'](_0xed0855);return{'interaction':_0x2073cc,'reply':_0x2073cc['getReply'](_0x26e6fe)};}['_scrollToSuggestionRange'](_0x462847,_0x2ea714=!0x1,_0x5a160a){const _0x1e01c9={'target':_0x5a160a['editing']['view']['domConverter']['viewRangeToDom'](_0x5a160a['editing']['mapper']['toViewRange'](_0x462847)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x2ea714};_0x2ea714&&(_0x1e01c9['alignToTop']=!0x0),Rt(_0x1e01c9);}['_updateConversationTitle'](_0x2899b8,_0xb8d3d5=!0x1){this['_aiChatUi']['setConversationTitle'](_0x2899b8||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0xb8d3d5);}['_addFeedItemReply'](_0x5012b4){'text'===_0x5012b4['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x5012b4):this['_aiChatUi']['addFeedItemAISuggestion'](_0x5012b4);}async['_updateReplyContent']({reply:_0x42c72a,renderingStrategy:_0x277b24}){const {id:_0x3c8013,interactionId:_0x59e7b4,isDone:_0x386b8a,type:_0x2dbdc4,parsedContent:_0x2460c0}=_0x42c72a,_0x565f56=_0x59e7b4+':'+_0x3c8013;if('modification'===_0x2dbdc4){const _0x44b2dc=_0x42c72a['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x565f56,'parts':_0x44b2dc,'isDone':_0x386b8a,'skipLoadingEffects':_0x42c72a['isFromHistory']});}else'text'===_0x2dbdc4&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x565f56,'parsedContent':_0x2460c0['get']('text'),'renderingStrategy':_0x277b24,'isDone':_0x386b8a});_0x386b8a&&_0x42c72a['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x565f56,_0x42c72a['sources']);}['_updateReplyContentThrottled']=_0x4f82c9(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x191379=this['activeConversation']?.['lastInteraction'];_0x191379&&(_0x191379['stop'](),this['_aiChatUi']['stopInteraction'](_0x191379)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x3fa006=this['activeConversation']?.['lastInteraction'];if(_0x3fa006){for await(const _0x19e002 of _0x3fa006['replies'])this['_aiChatUi']['hasFeedItem'](_0x19e002['id'])||this['_addFeedItemReply'](_0x19e002),await this['_updateReplyContent']({'reply':_0x19e002,'renderingStrategy':'static'});}}['_updateRatings'](_0x4118e9){const _0x12280f={'positiveCount':_0x4118e9['changeGroups']['filter'](_0x35c427=>'accepted'===_0x35c427['state'])['length'],'totalCount':_0x4118e9['changeGroups']['length'],'modificationId':_0x4118e9['id']},_0xf70699=this['activeConversation']['getInteraction'](_0x4118e9['interactionId'])['messageId'];_0xf70699&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0xf70699,_0x12280f);}['_getAIChatFeedAPI'](_0xca7b23){const _0x1c3146=this['_aiChatUi'],_0x181e4f=()=>{_0xca7b23['resetWebSearchState'](),_0xca7b23['resetReasoningState'](),_0x1c3146['clearLoadingMessage']();},_0x3a7b3e=()=>{_0xca7b23['currentReply']&&(_0xca7b23['currentReply']['done'](),_0xca7b23['currentReply']=void 0x0);};return{'insertTextReply':(_0x3e1482,_0x5c6048)=>{_0x3a7b3e(),_0x181e4f();const _0x39fed3=_0xca7b23['currentReply']=_0xca7b23['createReply']({'type':'text','interactionId':_0xca7b23['id'],'id':_0x5c6048||vt(),'channelsToEditors':this['_channelsToEditors']});return _0x39fed3['appendContent'](_0x3e1482),_0x3a7b3e(),_0x39fed3;},'insertCustomElement':async(_0x46993c,_0x41d908)=>(_0x3a7b3e(),_0x181e4f(),_0x1c3146['addFeedItemCustomElement'](_0x46993c,_0x41d908||vt())),'setLoadingMessage':_0x20f620=>{_0x1c3146['setLoadingMessage'](_0x20f620);},'clearLoadingMessage':()=>{_0x1c3146['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x4ab79a=>'destroyed'!==_0x4ab79a['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const yn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],xn=[...yn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Ln(_0x5dba42){const _0x36941d=new AbortController();return{'promise':new Promise((_0x3c6c6f,_0x554fb4)=>{const _0x172fdf=setTimeout(_0x3c6c6f,_0x5dba42);_0x36941d['signal']['addEventListener']('abort',()=>{clearTimeout(_0x172fdf),_0x554fb4();});}),'abortController':_0x36941d};}var Dn=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x271cf5){this['options']={'delay':_0x271cf5?.['delay']??0xa,'textNodeStyle':_0x271cf5?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x3d6b0c,targetElement:_0x1c01f8,abortSignal:_0x2a6252}){this['isStreaming']&&this['stop'](),_0x2a6252?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x3cd9d3(_0x3d6b0c,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x208b88=0x0;_0x208b88<this['currentIndex'];_0x208b88++)this['nodesList'][_0x208b88]['shouldBeStreamed']=!0x0;do{const _0x16e805=Date['now'](),_0x45d8a8=this['nodesList'][this['currentIndex']],_0x20134a=_0x16e805-this['lastUpdateTime'];if(_0x45d8a8){_0x45d8a8['shouldBeStreamed']=!0x0;let _0x3483bd=_0x45d8a8['parent'];for(;_0x3483bd;)_0x3483bd['shouldBeStreamed']=!0x0,_0x3483bd=_0x3483bd['parent'];}if(_0x20134a<this['options']['delay'])try{const {promise:_0x1362bb,abortController:_0x369e01}=Ln(this['options']['delay']-_0x20134a);this['timeoutAbortController']=_0x369e01,await _0x1362bb;}catch(_0x135f75){return;}_0x151f8e(_0x1c01f8,'<'+_0x1c01f8['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x1c01f8['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:_0x17aca5}){Array['from'](_0x17aca5['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x2d3af9=>{_0x2d3af9['replaceWith'](_0x2d3af9['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x30bfe9){let _0x4606d8='';if(function(_0x55d2a2){return _0x325b22(_0x55d2a2);}(_0x30bfe9)){for(const _0x2cb212 of _0x30bfe9['children'])_0x4606d8+=this['renderNode'](_0x2cb212);}else{if(Mn(_0x30bfe9)){if(!_0x30bfe9['shouldBeStreamed'])return'';const _0x169321=_0x30bfe9,_0x8e4bff=Object['entries'](_0x169321['attribs'])['map'](([_0x53570f,_0x79cab8])=>_0x53570f+'=\x22'+_0x79cab8+'\x22')['join']('\x20');_0x4606d8+='<'+_0x169321['tagName']+(_0x8e4bff?'\x20'+_0x8e4bff:'')+'>';for(const _0x1d1374 of _0x56e42f(_0x169321))_0x4606d8+=this['renderNode'](_0x1d1374);_0x4606d8+='</'+_0x169321['tagName']+'>';}else{if(!Hn(_0x30bfe9))return'';if(!_0x30bfe9['shouldBeStreamed'])return'';!function(_0x116080){return!(!_0x116080['parent']||!Mn(_0x116080['parent']))&&(!!Pn['includes'](_0x116080['parent']['tagName'])&&!_0x324b4d(_0x116080)['match'](/^\s*[<>]\s*$/));}(_0x30bfe9)?_0x4606d8+=_0x420708(_0x30bfe9):_0x4606d8+=_0x420708(new _0x193d60('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x30bfe9]));}}return _0x4606d8;}['getParsedDocumentNodeList'](){const _0x10dcf1=[];return function(_0x112160,_0xd1f35){const _0x49784d=_0x3b622c=>{if(_0xd1f35(_0x3b622c),_0x3b622c instanceof _0x25c0d6)for(let _0x20fc22=0x0;_0x20fc22<_0x3b622c['children']['length'];_0x20fc22++){const _0xeffad6=_0x3b622c['children'][_0x20fc22];_0x49784d(_0xeffad6);}};for(let _0x1c5b44=0x0;_0x1c5b44<_0x112160['children']['length'];_0x1c5b44++)_0x49784d(_0x112160['children'][_0x1c5b44]);}(this['document'],_0xd50ba4=>{if(Hn(_0xd50ba4)){const _0x232e96=this['splitTextNodeIntoWordNodes'](_0xd50ba4);_0x232e96['length']&&_0x10dcf1['push'](..._0x232e96);}_0xd50ba4['isWordSplitSource']||_0xd50ba4['isWordSplitResult']||_0x10dcf1['push'](_0xd50ba4);}),_0x10dcf1;}['splitTextNodeIntoWordNodes'](_0x306c71){if(_0x306c71['isWordSplitSource']||_0x306c71['isWordSplitResult'])return[];const _0x1006ab=_0x324b4d(_0x306c71)['match'](/(?:\s*\S+\s*)/g),_0x470395=[];if(_0x1006ab&&_0x1006ab['length']>0x1){for(const _0x11b059 of _0x1006ab){const _0x240c8f=new _0x27d7ca(_0x11b059);_0x240c8f['isWordSplitResult']=!0x0,_0x52f7e8(_0x306c71,_0x240c8f),_0x470395['push'](_0x240c8f);}_0x306c71['isWordSplitSource']=!0x0,_0x1356eb(_0x306c71);}return _0x470395;}};const Pn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Hn(_0x46788d){return _0x45e9d0(_0x46788d);}function Mn(_0x1ae61d){return _0x34aa28(_0x1ae61d);}function Vn(_0x2bdbd9,_0x27d659){_0x2bdbd9['cleanUpAnimations']({'targetElement':_0x27d659}),_0x27d659['querySelectorAll']('[data-id]')['forEach'](_0x213c6b=>{_0x213c6b['removeAttribute']('data-id');});}var Un=class extends _0x5afcc4{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x4c09d3){super();const _0x33f7a1=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Dn(),this['options']=_0x4c09d3,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x33f7a1['if']('isDone','ck-ai-chat__feed__item_done'),_0x33f7a1['if']('isVisible','ck-hidden',_0x12fc93=>!_0x12fc93),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Vn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x3e207d,_0xb74ab3,_0x26feb5){await this['htmlStreamer']['stream']({'document':_0x3e207d,'targetElement':_0xb74ab3,'abortSignal':_0x26feb5});}},Bn=class extends _0x5afcc4{['showChangesToggleView'];constructor(_0x4afd0c,_0x4542f1){super(_0x4afd0c),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Gn(_0x4afd0c),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+ln,'label':us(_0x4afd0c,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x4542f1['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x4faf21=>_0x4faf21?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x3f6154=new Yt();_0x3f6154['content']=_0x385941,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x4542f1['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x3f6154,{'tag':'span','children':[us(_0x4afd0c,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Gn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Fn={'accepted':_0x54c326,'rejected':_0xb9952d,'outdated':_0xb9952d};var Kn=class extends _0x5afcc4{['stateIconView'];constructor(_0x18d652){super(_0x18d652);const _0x31311d=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Wn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x31311d['to']('state',_0x1e764a=>'ck-ai-suggestion__content-part-state_'+_0x1e764a),_0x31311d['if']('isVisible','ck-hidden',_0x1fc694=>!_0x1fc694)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x31311d['to']('state',_0x592c4c=>{switch(_0x592c4c){case'accepted':return us(_0x18d652,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0x18d652,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0x18d652,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x21996a){this['state']=_0x21996a;}},Wn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Fn[this['state']],this['on']('change:state',()=>{this['content']=Fn[this['state']];});}},Yn=class extends _0x515f62{['_applyButton'];['_suggestButton'];constructor(_0xff303e,_0x4bfa3c,_0x43e4e1){super(_0xff303e);const _0x20c16a=Boolean(_0x43e4e1);this['set']('isEnabled',!_0x20c16a),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x62be50=[];if(_0x20c16a){const _0x17caec=new Ht(_0xff303e);_0x17caec['set']({'label':us(_0xff303e,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x304b33}),_0x17caec['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x62be50['push'](_0x17caec);}else{_0x4bfa3c['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0xff303e),this['_applyButton']['set']({'label':us(_0xff303e,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x54c326}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x3efcae=>!_0x3efcae),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x62be50['push'](this['_applyButton'])),_0x4bfa3c['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0xff303e),this['_suggestButton']['set']({'label':us(_0xff303e,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x8e738f}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x62be50['push'](this['_suggestButton']));const _0x160b35=new Ht(_0xff303e);_0x160b35['set']({'label':us(_0xff303e,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xb9952d}),_0x160b35['bind']('isEnabled')['to'](this),_0x160b35['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x62be50['push'](_0x160b35);}this['items']['addMany'](_0x62be50);const _0x1bdc57=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x1bdc57['if']('isVisible','ck-hidden',_0x473135=>!_0x473135)]}});}['setButtonsVisibility']({showApplyButton:_0x5a7323,showSuggestButton:_0x18ec9d}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x5a7323),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x18ec9d);}},$n=class extends _0x5afcc4{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x32fd0d,{part:_0x5e4cb9,uiIndex:_0x46d1cb,availableActions:_0x1554c0,areActionsDisabled:_0x3c4237}){super(_0x32fd0d),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Yn(_0x32fd0d,_0x1554c0,_0x3c4237),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x5e4cb9['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x5e4cb9['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x5e4cb9['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Kn(_0x32fd0d),this['titleLabelView']=new qn(_0x32fd0d,_0x46d1cb),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',(_0x391e92,_0x37a6a2,_0x6a37ee,_0x25cc93)=>{'pending'===_0x25cc93?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x6a37ee?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x6a37ee),this['children']['add'](this['stateView']));});}},qn=class extends _0x5afcc4{constructor(_0x489aea,_0x5db2f4){super(_0x489aea),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x489aea,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x5db2f4['toString']())]});}},Qn=class extends _0x5afcc4{['htmlStreamer'];constructor(_0x430a57){super(_0x430a57),this['htmlStreamer']=new Dn(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0xd3c4f3,renderingStrategy:_0x70dab5,abortSignal:_0x47593b}){const _0x444eab=_0x3cd9d3(_0xd3c4f3['content'],!0x0);for(const _0x527eec of ws(_0x444eab))_0x1356eb(_0x527eec);'streaming'===_0x70dab5?await this['htmlStreamer']['stream']({'document':_0x444eab,'targetElement':this['element'],'abortSignal':_0x47593b}):_0x151f8e(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x444eab)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Vn(this['htmlStreamer'],this['element']);}},Xn=class extends _0x5afcc4{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x450a17,{part:_0xcf322f,uiIndex:_0x69a6d6,areActionsDisabled:_0x47ff87,availableActions:_0x350710}){super(_0x450a17);const _0x2ff516=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x128227=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x47ff87;};this['on']('change:state',_0x128227),this['on']('change:isDone',_0x128227),_0x128227(),this['_children']=this['createCollection'](),this['_headerView']=new $n(_0x450a17,{'part':_0xcf322f,'uiIndex':_0x69a6d6,'availableActions':_0x350710,'areActionsDisabled':_0x47ff87}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...yn)['to'](this),this['_streamableContentView']=new Qn(_0x450a17),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x2ff516['to']('state',_0x2800b8=>'ck-ai-suggestion__body__content-part_'+_0x2800b8),_0x2ff516['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x2ff516['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x2ff516['if']('isVisible','ck-hidden',_0x452972=>!_0x452972)]},'children':this['_children'],'on':{'mouseenter':_0x2ff516['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0xcf322f['index']});}),'mouseleave':_0x2ff516['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0xcf322f['index']});}),'click':_0x2ff516['to'](_0x2bcc6f=>{const _0x28d224=_0x2bcc6f['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x28d224)&&this['fire']('showChangeInText',{'index':_0xcf322f['index']});})}});}async['updateContent']({part:_0x36513b,showUnchangedParts:_0x31c6c2=!0x1,abortSignal:_0x5becc0}){this['partDefinition']=_0x36513b,this['isVisible']=this['partDefinition']['hasChanges']||_0x31c6c2,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x36513b,'renderingStrategy':'static','abortSignal':_0x5becc0});}['markAsDone'](){this['isDone']=!0x0;}},zn=class extends _0x5afcc4{constructor(_0xa5fcbc,_0x3bd105){super(_0xa5fcbc),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4d5304=>!_0x4d5304)]},'children':this['_createSkeletonItems'](_0x3bd105)});}['_createSkeletonItems'](_0x1162e5){const _0x483461=['ck','ck-ai-skeleton__item'];return _0x1162e5['map'](_0x4f08fa=>{let _0x550007='';switch(_0x4f08fa['attributes']['align']){case'right':_0x550007='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x550007='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x550007='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x4f08fa['tag'],'attributes':{'class':[..._0x483461,_0x4f08fa['attributes']['class']?_0x4f08fa['attributes']['class']:''],'style':'width:\x20'+_0x4f08fa['attributes']['width']+';\x20height:\x20'+_0x4f08fa['attributes']['height']+';'+_0x550007}};});}};const jn={'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':Jn(0x5,'100%','44px','right'),'aiChatResources':Jn(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 Jn(_0x4223c1,_0x54b21e,_0x4c4382,_0x53b519){return new Array(_0x4223c1)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x54b21e,'height':_0x4c4382,'align':_0x53b519}}));}const Zn=/* #__PURE__ -- @preserve */
33
+ ut();var tr=class extends Zn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x27ba4f){const _0x570af6=this['createTask'](_0x27ba4f);return this['queue']['push'](_0x570af6),this['_processQueue'](),_0x570af6['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(_0x5260ff=>{this['once']('_queueEmpty',()=>{_0x5260ff();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x5b10ef=this['queue']['shift']();try{await _0x5b10ef['callback'](this['_abortController']['signal']),_0x5b10ef['resolve']();}catch(_0x5b8d53){_0x5b10ef['reject'](_0x5b8d53);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x4a6721){let _0x2275dd,_0x363647;const _0x50e6fa=new Promise((_0x4e6e63,_0x367e2b)=>{_0x2275dd=_0x4e6e63,_0x363647=_0x367e2b;});return{'callback':_0x4a6721,'resolve':_0x2275dd,'reject':_0x363647,'completePromise':_0x50e6fa};}},er=class extends Un{constructor(_0x241c22){super(_0x241c22),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x241c22['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x483f52){this['element']['innerHTML']=_0x483f52;}};const ir=['applySuggestion','insertSuggestion'];var sr=class extends _0x5afcc4{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x16c65f,_0x7ffc97=[...ir],_0x3b2dd4){super(_0x16c65f);const _0x328ecc=this['bindTemplate'],_0x3b74a4=Boolean(_0x3b2dd4);if(this['set']('isEnabled',!_0x3b74a4),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x3b74a4){const _0x3c4b78=new Ht(_0x16c65f);_0x3c4b78['set']({'label':us(_0x16c65f,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x304b33}),_0x3c4b78['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x491fe6=new _0x5afcc4(_0x16c65f);_0x491fe6['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x16c65f,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x3c4b78]}]}),this['children']['add'](_0x491fe6);}else this['_applyChangesButton']=new Ht(_0x16c65f),this['_applyChangesButton']['set']({'label':us(_0x16c65f,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x7ffc97['includes']('applySuggestion'),'class':hn}),this['_insertSuggestionsButton']=new Ht(_0x16c65f),this['_insertSuggestionsButton']['set']({'label':us(_0x16c65f,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x7ffc97['includes']('insertSuggestion'),'class':cn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x238eaf=>{_0x238eaf['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',_0x328ecc['if']('isVisible','ck-hidden',_0xd02416=>!_0xd02416)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x4eda3b){this['isVisible']=_0x4eda3b;}['_switchButtonLabelsPlurality'](_0x2e41af){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x2e41af?(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},nr=class extends _0x5afcc4{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x360447,_0x3459f4){super(_0x360447),this['bodyCollection']=_0x3459f4,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',_0x4b01b4=>!_0x4b01b4)]},'children':this['children']});const _0x509a60=new _0x5afcc4(this['locale']),_0x418677=new Yt();_0x418677['content']=at,_0x509a60['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x418677,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x509a60),this['_setupBalloonPanel'](_0x360447);}['addSource'](_0x547387){this['children']['add'](new rr(this['locale'],_0x547387,this['balloonPanelView']));}['_setupBalloonPanel'](_0x12e71a){this['balloonPanelView']=new yt(_0x12e71a),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},rr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x415b7b,_0x1d6344,_0x5252c5){super(_0x415b7b),this['source']=_0x1d6344,this['balloonPanelView']=_0x5252c5,this['set']({'label':_0x1d6344['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x1be73d=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x1be73d['to'](()=>{window['open'](_0x1d6344['url'],'_blank');}),'mouseenter':_0x1be73d['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x1be73d['to'](()=>{this['_hideTooltip']();})}}),_0x1d6344['favicon']){const _0x5b2df6=new _0x5afcc4(_0x415b7b);_0x5b2df6['setTemplate']({'tag':'img','attributes':{'src':_0x1d6344['favicon']||at,'alt':_0x1d6344['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x5b2df6);}else this['set']('icon',at);}['_createTooltipContentView'](_0x13b93c,_0x57d5f1){const _0x571676=new _0x5afcc4(_0x13b93c),_0x250713=[];let _0x3d546a;_0x57d5f1?.['favicon']?(_0x3d546a=new _0x5afcc4(_0x13b93c),_0x3d546a['setTemplate']({'tag':'img','attributes':{'src':_0x57d5f1['favicon'],'alt':_0x57d5f1['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3d546a=new Yt(),_0x3d546a['content']=at,_0x3d546a['extendTemplate']({'attributes':{'alt':_0x57d5f1['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x250713['push'](_0x3d546a);const _0x27d8c5=new _0x5afcc4(_0x13b93c);_0x27d8c5['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x57d5f1['url']},'children':[{'text':new URL(_0x57d5f1['url'])?.['hostname']}]}),_0x250713['push'](_0x27d8c5);const _0x4b0004=new _0x5afcc4(_0x13b93c);_0x4b0004['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x250713});const _0x244198=new _0x5afcc4(_0x13b93c);return _0x244198['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x57d5f1['title']['length']>0x190?_0x57d5f1['title']['substring'](0x0,0x190)+'...':_0x57d5f1['title']}]}),_0x571676['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x4b0004,_0x244198]}),_0x571676;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthWest'],yt['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 _0x5cc430=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5cc430);}},or=class extends _0x5afcc4{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x134ee8(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x4beab0,_0x28a439){super(_0x4beab0);const {areActionsDisabled:_0x51e14a,showUnchangedParts:_0x238c8a,availableActions:_0x32c71f}=_0x28a439;this['_areActionsDisabled']=_0x51e14a,this['_showUnchangedParts']=_0x238c8a,this['_availableActions']=_0x32c71f,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new zn(_0x4beab0,jn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new tr(),this['_emptyPartsWarningView']=new er({'id':'empty-parts-warning','initialContent':us(_0x4beab0,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new sr(_0x4beab0,_0x28a439['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new nr(this['locale'],_0x28a439['bodyCollection']),_0x28a439['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...yn)['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'](_0x554562=>_0x554562 instanceof Xn);}async['updateContentParts']({parts:_0x3bf584,abortSignal:_0x4a3b30,skipLoadingEffects:_0x3c0f8b}){this['_cachedContentParts']['length']?_0x3bf584['forEach'](_0x2ae118=>{const _0x823bea=this['_cachedContentParts']['findIndex'](_0x3a425c=>_0x3a425c['index']==_0x2ae118['index']);-0x1===_0x823bea?this['_cachedContentParts']['push'](_0x2ae118):this['_cachedContentParts'][_0x823bea]=_0x2ae118;}):this['_cachedContentParts']=_0x3bf584;const _0x486a34=this['_showUnchangedParts']?_0x3bf584:_0x3bf584['filter'](_0xada7f8=>_0xada7f8['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x486a34['length']>0x1),_0x3c0f8b&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x3a7048 of _0x486a34)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x52a182=>{let _0x2a0059=this['getPartView'](_0x3a7048['index']);if(!_0x2a0059){if(_0x2a0059=new Xn(this['locale'],{'part':_0x3a7048,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x2a0059['delegate'](...yn)['to'](this),_0x2a0059['bind']('isTrackChangesOn')['to'](this),!_0x3c0f8b&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x52a182),_0x52a182['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x2a0059,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x3c0f8b||this['_showSkeletonDebounced']();}await _0x2a0059['updateContent']({'part':_0x3a7048,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x52a182}),_0x2a0059['markAsDone']();});return _0x4a3b30?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x549dda,_0x140241){const _0x139518=this['getPartView'](_0x549dda);_0x139518&&(_0x139518['state']=_0x140241),this['hasPendingParts']='pending'==_0x140241||this['_contentPartViews']['some'](_0x8ee936=>'pending'==_0x8ee936['state']);}['setPartActive'](_0x58e749,_0x15688b){if(!0x1===_0x58e749){for(const _0x3b1816 of this['_contentPartViews'])_0x3b1816['isActive']=!0x1;}else{const _0x473d8c=this['getPartView'](_0x58e749);_0x473d8c&&(_0x473d8c['isActive']=_0x15688b);}}['updateSources'](_0x2915dd){_0x2915dd['forEach'](_0x369a1a=>this['_sourcesView']['addSource'](_0x369a1a)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x55fa09){return this['_contentPartViews']['find'](_0x26a969=>_0x26a969['partDefinition']['index']==_0x55fa09)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x5d91d8=!this['_cachedContentParts']['find'](({hasChanges:_0x5dc141})=>_0x5dc141),_0x3284c9=!!this['_cachedContentParts']['find'](({hasChanges:_0x235eef})=>!_0x235eef);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x3284c9,_0x5d91d8?this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x3dbafa=>_0x3dbafa['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x137a1c){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x59ab72=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x59ab72>0x0){const {promise:_0x8462a2,abortController:_0x3e6566}=Ln(_0x59ab72);_0x137a1c?.['addEventListener']('abort',()=>_0x3e6566['abort']()),await _0x8462a2['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x524a00=>_0x524a00['partDefinition']['hasChanges'])['length']>0x0;}},ar=class extends _0x5afcc4{['bodyView'];['children'];['headerView'];constructor(_0x534a70,_0x3bd283,_0x5271c2){super(_0x534a70);const {showDiff:_0x8e19e0,areActionsDisabled:_0x581306,showUnchangedParts:_0x5a5eeb,availableActions:_0x2c3368}=_0x3bd283;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Bn(_0x534a70,{'showDiff':_0x8e19e0}),this['headerView']['on']('toggleShowChanges',(_0x39d558,_0x2ef45f)=>{this['areChangesVisible']=_0x2ef45f['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x2ef45f['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new or(_0x534a70,{'areActionsDisabled':_0x581306,'showUnchangedParts':!!_0x5a5eeb,'availableActions':_0x2c3368,'bodyCollection':_0x5271c2}),this['bodyView']['delegate'](...yn)['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'](_0x38caee){await this['bodyView']['updateContentParts'](_0x38caee);}['updateSources'](_0x4f37fa){this['bodyView']['updateSources'](_0x4f37fa);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},hr=class extends Un{['containerView'];constructor(_0x28a5fb,_0x1d6dec,_0x4aad18){super(_0x1d6dec),this['set']('isTrackChangesOn',!0x1),this['containerView']=new ar(_0x28a5fb,{'showDiff':_0x1d6dec['showDiff'],'areActionsDisabled':_0x1d6dec['areActionsDisabled'],'availableActions':_0x1d6dec['availableActions']},_0x4aad18),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x436650,_0xa54f68)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0xa54f68['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',(_0x30b2af,{index:_0x8c0704})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x8c0704});}),this['containerView']['on']('applySuggestion',(_0x2363f8,{index:_0x3e8595}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x3e8595});}),this['containerView']['on']('insertSuggestion',(_0x4a3751,{index:_0x1cc02b}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1cc02b});}),this['containerView']['on']('rejectSuggestion',(_0x419d8f,{index:_0x5a5617})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5a5617});}),this['containerView']['on']('mouseOverSuggestion',(_0x9a404,{index:_0x4a65a4})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4a65a4});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x70c66d,{index:_0x1af94e})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1af94e});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x3820e8){await this['containerView']['updateContent'](_0x3820e8);}['updatePartState'](_0x2e30cc,_0x169c79){this['containerView']['bodyView']['updatePartState'](_0x2e30cc,_0x169c79);}['setPartActive'](_0x476515,_0x2024e3){!0x1===_0x476515?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x476515,_0x2024e3);}['updateSources'](_0x4a7e64){this['containerView']['updateSources'](_0x4a7e64);}['getPartView'](_0x384210){return this['containerView']['bodyView']['getPartView'](_0x384210);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},cr=class extends Un{['replyContainer'];['_bodyCollection'];constructor(_0x3ee7ff,_0x352380,_0x998467){super(_0x352380),this['_bodyCollection']=_0x998467,this['locale']=_0x3ee7ff,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x5afcc4(),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':ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x3bb8fa,renderingStrategy:_0x168eb3,abortSignal:_0x4d1c76}){'streaming'===_0x168eb3?await this['streamIntoElement'](_0x3bb8fa,this['replyContainer']['element'],_0x4d1c76):this['replyContainer']['element']['innerHTML']=_0x420708(_0x3bb8fa);}['updateSources'](_0x3a86f0){const _0x563c11=new nr(this['locale'],this['_bodyCollection']);_0x563c11['children']['addMany'](_0x3a86f0['map'](_0x5497cb=>new rr(this['locale'],_0x5497cb,_0x563c11['balloonPanelView']))),_0x563c11['isVisible']=!0x0,this['children']['add'](_0x563c11);}},lr=class extends _0xc7f55c{constructor(_0xf5e329=void 0x0){super();const _0x18cbb5=_0xf5e329?'ck-ai-spinner_'+_0xf5e329:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x18cbb5]}});}};const ur={'file':_0x90f4eb,'image':_0x3b073f,'document':_0x385941,'web-resource':_0x52b9b5,'text':_0x90f4eb,'selection':_0x5378d9,'mcp-tool-context':_0x385941},dr='ck-ai-chat-context-chip',_r='ck-ai-chat-context-chip_wide',gr='ck-ai-chat-context-chip_document',Ar='ck-ai-chat-context-chip__label',Ir='ck-ai-chat-context-chip__type-icon',pr='ck-ai-chat-context-controls__chip-tooltip',mr='n';var Er=class extends Ht{constructor(_0x4f2e3b,_0x589935,_0x3e1818,_0x41636d,_0x5c9d00=!0x1){super(_0x4f2e3b),this['_isAnimationOnEnterEnabled']=_0x41636d,this['_initializeProperties'](_0x589935,_0x3e1818,_0x5c9d00),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'](_0x57cb39,_0x553570,_0xcf76d8){this['set']('label',_0x57cb39['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x57cb39['type']),this['set']('id',_0x57cb39['uiId']),this['set']('readonly',_0x553570),this['set']('isLoading',_0xcf76d8);}['_setupTemplate'](){const _0x2dbb2f=this['_createIconView'](),_0x1709c7=this['_createRemoveButton'](),_0x4616b5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4616b5),'children':this['_createTemplateChildren'](_0x2dbb2f,_0x1709c7,_0x4616b5)});}['_createTemplateAttributes'](_0x2e882e){return{'class':[dr,_0x2e882e['if']('itemType',gr,_0x41f3ef=>'document'==_0x41f3ef),_0x2e882e['if']('itemType',_r,_0x4baf14=>'selection'==_0x4baf14)],'data-cke-tooltip-text':_0x2e882e['to']('label',Tr),'data-cke-tooltip-position':mr,'data-cke-tooltip-class':pr};}['_createTemplateChildren'](_0x482e21,_0x5aa7a3,_0x34af52){const _0x3e0e71=this['_createLabelElement'](_0x34af52),_0x2e12f9=this['_createLoaderIcon']();return this['readonly']?[_0x482e21,_0x3e0e71]:[_0x482e21,_0x2e12f9,_0x3e0e71,_0x5aa7a3];}['_createLabelElement'](_0x1cbec2){return{'tag':'span','attributes':{'class':Ar},'children':[{'text':_0x1cbec2['to']('label')}]};}['_createRemoveButton'](){const _0x461791=new Ht(this['locale']);return _0x461791['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x5ec216}),this['_setupRemoveButtonEvent'](_0x461791),_0x461791;}['_setupRemoveButtonEvent'](_0x31684f){_0x31684f['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x4777a1=this['bindTemplate'],_0x5b4088=new Yt();return _0x5b4088['content']=ur[this['itemType']],_0x5b4088['extendTemplate']({'attributes':{'class':[Ir,_0x4777a1['if']('isLoading','ck-hidden',_0x371d11=>_0x371d11)]}}),_0x5b4088;}['_handleAnimationEndOnce'](_0x4e3a59,_0x391b60){if(!_0x4e3a59)return;const _0x5c042c=()=>{_0x391b60(),_0x4e3a59['removeEventListener']('animationend',_0x5c042c),_0x4e3a59['removeEventListener']('webkitAnimationEnd',_0x5c042c);};_0x4e3a59['addEventListener']('animationend',_0x5c042c),_0x4e3a59['addEventListener']('webkitAnimationEnd',_0x5c042c);}['_createLoaderIcon'](){const _0x1d273d=new lr('small');return _0x1d273d['bind']('isVisible')['to'](this,'isLoading',_0x26b374=>_0x26b374),_0x1d273d;}};function Tr(_0x32badc){if(!_0x32badc)return _0x32badc;if(_0x32badc['length']<=0x78)return _0x32badc;const _0x39655e=_0x32badc['slice'](0x0,0x78),_0x2b1dd8=_0x39655e['lastIndexOf']('\x20');return(_0x2b1dd8>0x0?_0x39655e['slice'](0x0,_0x2b1dd8):_0x39655e)+'…';}const wr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Cr='300px';var fr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x4f01f2,_0x160bce,_0x345aae,_0x5b17af,_0x5358b2){this['_locale']=_0x4f01f2,this['_visibleChips']=_0x160bce,this['_config']={...wr,..._0x345aae,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x345aae['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x5b17af,this['_parentView']=_0x5358b2||null;}['setContainerElement'](_0x25211a){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x25211a,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 _0x2d2300=[...this['_visibleChips'],...this['_overflowChips']],_0x37a00a=this['_createCalculationContainer'](),_0x21dd5a=this['_calculateOverflowInContainer'](_0x37a00a,_0x2d2300),_0x5b55ba=_0x37a00a['_ancestorsToRestore'];_0x5b55ba&&this['_restoreAncestorVisibility'](_0x5b55ba),_0x37a00a['remove'](),this['_applyOverflowResults'](_0x2d2300,_0x21dd5a);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x3f90e8({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x151590=new Ht(this['_locale']);_0x151590['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x1415c8=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x1415c8['push'](this['_config']['cssClasses']['controlsButton']),_0x151590['extendTemplate']({'attributes':{'class':_0x1415c8}}),_0x151590;}['_createShowMoreBalloonPanelView'](){const _0x691d8b=new yt(this['_locale']);return _0x691d8b['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x691d8b),_0x691d8b;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2b3e6b=>{_0x2b3e6b['disableAnimationOnEnter']();});const _0x251450=new _0x5afcc4(this['_locale']);_0x251450['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x251450);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x2b5cb7=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x2b5cb7?'':'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'](_0x211179){const _0x240c65=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x3b1079=this['_containerElement']?.['classList'];if(_0x3b1079){const _0x208ba6=_0x3b1079[0x0]||'',_0x2d20c0=_0x211179['querySelector']('.'+_0x208ba6),_0x28db20=_0x211179['querySelector'](_0x240c65);return _0x2d20c0||_0x28db20||_0x211179;}return _0x211179['querySelector'](_0x240c65)||_0x211179;}['_calculateContainerWidth'](){const _0x1f7816=this['_parentView']?.['element']||this['_containerElement'];if(!_0x1f7816)return Cr;const _0x12556f=window['getComputedStyle'](_0x1f7816)['width'];if('auto'===_0x12556f||'0px'===_0x12556f||!_0x12556f){const _0x231da2=_0x1f7816['parentElement'];if(_0x231da2){const _0xda38a8=window['getComputedStyle'](_0x231da2);return'auto'!==_0xda38a8['width']?_0xda38a8['width']:Cr;}return Cr;}return _0x12556f;}['_applyCalculationStyles'](_0x23632f,_0x4f3749){this['_config']['cssClasses']['calculationContainer']&&_0x23632f['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x23632f['style']['width']=_0x4f3749,_0x23632f['style']['position']='absolute',_0x23632f['style']['top']='-9999px',_0x23632f['style']['left']='-9999px',_0x23632f['style']['opacity']='0',_0x23632f['style']['pointerEvents']='none',_0x23632f['style']['zIndex']='-1',_0x23632f['style']['visibility']='visible\x20!important',_0x23632f['style']['display']='block\x20!important',_0x23632f['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x28e08){_0x28e08['forEach'](({element:_0x1ad0ef,originalDisplay:_0x1ad4b0,originalVisibility:_0x58f451})=>{_0x1ad0ef['style']['display']=_0x1ad4b0,_0x1ad0ef['style']['visibility']=_0x58f451;});}['_makeAncestorsVisible'](_0x2be797){const _0x21a501=[];let _0x8574da=_0x2be797;for(;_0x8574da&&_0x8574da!==document['body'];){const _0x56a356=window['getComputedStyle'](_0x8574da);'none'!==_0x56a356['display']&&'hidden'!==_0x56a356['visibility']||(_0x21a501['push']({'element':_0x8574da,'originalDisplay':_0x8574da['style']['display'],'originalVisibility':_0x8574da['style']['visibility']}),_0x8574da['style']['display']='block',_0x8574da['style']['visibility']='visible'),_0x8574da=_0x8574da['parentElement'];}return _0x21a501;}['_createContainerElements'](){let _0x3f157d,_0x1bb9cc;return this['_parentView']?.['element']?(_0x3f157d=this['_parentView']['element']['cloneNode'](!0x0),_0x1bb9cc=this['_findTargetContainer'](_0x3f157d)):(_0x3f157d=document['createElement']('div'),_0x1bb9cc=_0x3f157d),{'calculationContainer':_0x3f157d,'targetContainer':_0x1bb9cc};}['_createCalculationContainer'](){const {calculationContainer:_0x3db0a3,targetContainer:_0x18a9e2}=this['_createContainerElements'](),_0x346b7e=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3db0a3,_0x346b7e);const _0x24c8d9=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x24c8d9?_0x24c8d9['appendChild'](_0x3db0a3):document['body']['appendChild'](_0x3db0a3),_0x3db0a3['_targetContainer']=_0x18a9e2;const _0x5d0e18=this['_makeAncestorsVisible'](_0x24c8d9||null);return _0x3db0a3['offsetWidth'],_0x3db0a3['_ancestorsToRestore']=_0x5d0e18,_0x3db0a3;}['_calculateOverflowInContainer'](_0x1391be,_0x107418){const _0x6dffcb=_0x1391be['_targetContainer']||_0x1391be,_0x1059cb=[],{rowCount:_0x44ca66}=this['_renderChipsAndCountRows'](_0x6dffcb,_0x107418);if(_0x44ca66<=this['_config']['maxVisibleRows'])return _0x1059cb;const _0x194f98=_0x107418['slice']();for(;_0x194f98['length']>0x0;){if(this['_testButtonFit'](_0x1391be,_0x6dffcb,_0x194f98)){const _0x338901=_0x107418['filter'](_0x3bdc9a=>!_0x194f98['includes'](_0x3bdc9a));_0x1059cb['push'](..._0x338901);break;}if(!_0x194f98['pop']())break;}return _0x1059cb;}['_renderChipsAndCountRows'](_0x431a50,_0x28b149){_0x431a50['innerHTML']='',_0x28b149['forEach'](_0x1498a3=>{if(_0x1498a3['element']){const _0x332c43=_0x1498a3['element']['cloneNode'](!0x0);_0x431a50['appendChild'](_0x332c43);}}),_0x431a50['offsetWidth'];const _0x4fc10c=_0x431a50['children'],_0x395319=[];return Array['from'](_0x4fc10c)['forEach'](_0x5bb59c=>{const _0x4685ca=_0x5bb59c['getBoundingClientRect']()['top'];_0x395319['some'](_0x37428b=>Math['abs'](_0x37428b-_0x4685ca)<this['_config']['rowDetectionTolerance'])||_0x395319['push'](_0x4685ca);}),{'rowCount':_0x395319['length']};}['_createMockButton'](){const _0x45bd36=document['createElement']('button');return _0x45bd36['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x45bd36['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x45bd36['textContent']='+\x201',_0x45bd36;}['_testButtonFit'](_0x2d0e65,_0x41e522,_0xe9f0b4){this['_renderChipsAndCountRows'](_0x41e522,_0xe9f0b4);const _0x11248b=this['_createMockButton']();_0x2d0e65['appendChild'](_0x11248b),_0x2d0e65['offsetWidth'];const _0x4d7570=[..._0x41e522['children'],_0x11248b],_0x4aefac=[];_0x4d7570['forEach'](_0x5d1444=>{const _0x101381=_0x5d1444['getBoundingClientRect']()['top'];_0x4aefac['some'](_0x12ee19=>Math['abs'](_0x12ee19-_0x101381)<this['_config']['rowDetectionTolerance'])||_0x4aefac['push'](_0x101381);});const _0x380272=_0x4aefac['length'];return _0x11248b['remove'](),_0x380272<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x442cf6,_0x2dcede){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x442cf6['forEach'](_0x407c1c=>{_0x2dcede['includes'](_0x407c1c)?this['_overflowChips']['add'](_0x407c1c):this['_visibleChips']['add'](_0x407c1c);});}['_updateOverflowUI'](_0x3e95e4){if(_0x3e95e4>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x3e95e4>0x0&&this['_showMoreButtonView']){const _0x11e82d=''+this['_config']['showMoreLabelPrefix']+(_0x3e95e4<0x63?_0x3e95e4:'99');this['_showMoreButtonView']['label']=_0x11e82d;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x25a8d1,_0x2502a5){this['_distributeChips'](_0x25a8d1,_0x2502a5),this['_updateOverflowUI'](_0x2502a5['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x3a3daf=>{_0x3a3daf[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 _0x33f3c5=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x33f3c5['width']||0x0===_0x33f3c5['height'])return!0x1;const _0x4c0159=window['innerHeight']||document['documentElement']['clientHeight'],_0x17a16e=window['innerWidth']||document['documentElement']['clientWidth'];return _0x33f3c5['bottom']>=-0xc8&&_0x33f3c5['top']<=_0x4c0159+0xc8&&_0x33f3c5['right']>=-0xc8&&_0x33f3c5['left']<=_0x17a16e+0xc8;}};const br='ck-ai-chat__feed__context-chips',Sr='ck-ai-chat-context-chips-wrapper',Rr='ck-ai-chat-context-chips-wrapper-balloon',Or='ck-ai-chat-controls-button',vr='ck-ai-chat-controls_context_show-more-button',kr='ck-ai-chat-context-controls__show-more-balloon-panel';var Nr=class extends _0x5afcc4{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x17deab,_0x177aae,_0x5651e8){super(_0x17deab),this['_bodyCollection']=_0x5651e8,this['_createContextChips'](_0x177aae);const _0x3e60a2={'cssClasses':{'showMoreButton':vr+'\x20'+ln,'showMoreBalloon':kr,'overflowContainer':Rr,'controlsButton':Or}};this['_overflowManager']=new fr(_0x17deab,this['_contextChips'],_0x3e60a2,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[br,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Sr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x1407ee=this['element']['querySelector']('.'+Sr);_0x1407ee&&(this['_overflowManager']['setContainerElement'](_0x1407ee),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x3e9c25){for(const _0x41eb0c of _0x3e9c25){const _0x19ff59=new Er(this['locale'],_0x41eb0c,!0x0,!0x1);this['_contextChips']['add'](_0x19ff59);}}},yr=class extends Un{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x26c4be,_0x17ea29,_0x30e6c9){super(_0x17ea29),this['_locale']=_0x26c4be,this['_bodyCollection']=_0x30e6c9,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 Nr(this['_locale'],this['options']['contextItems']['filter'](_0xa88b77=>!_0xa88b77['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x5afcc4(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']();}},xr=class extends Un{['capabilities'];constructor(_0x142386,_0x2a5f43){super(_0x2a5f43);const {isWebSearchEnabled:_0x153b06,isReasoningEnabled:_0x3487a8}=_0x2a5f43['capabilities'],_0x520a0b=[];let _0x5467ee='';_0x153b06&&_0x3487a8?(_0x5467ee=us(_0x142386,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x520a0b['push'](Lr(at)),_0x520a0b['push'](Lr(_0x8a1161))):_0x153b06?(_0x5467ee=us(_0x142386,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x520a0b['push'](Lr(at))):_0x3487a8&&(_0x5467ee=us(_0x142386,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x520a0b['push'](Lr(_0x8a1161))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x5467ee?'':'ck-hidden']}});const _0x540ae3=new _0x5afcc4();_0x540ae3['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x520a0b,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x5467ee]}]}),this['children']['add'](_0x540ae3),this['capabilities']=_0x2a5f43['capabilities'];}};function Lr(_0x12e5dc){const _0x5b1c84=new Yt();return _0x5b1c84['content']=_0x12e5dc,_0x5b1c84;}const Dr=['wheel','touchstart','pointerdown','keydown'],Pr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Hr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x1bc417){this['element']=_0x1bc417,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x8a5bde of Dr){const _0x128d2b='keydown'!==_0x8a5bde;this['element']['addEventListener'](_0x8a5bde,this['_onUserEvent']['bind'](this),{'passive':_0x128d2b,'signal':this['abortController']['signal']});}}['start']({smooth:_0x1cda85=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x1cda85?'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'](_0x19842e){if(this['isRunning']){if('keydown'===_0x19842e['type']){const _0x26f59f=_0x19842e['key'];if(!Pr['includes'](_0x26f59f))return;}_0x19842e instanceof WheelEvent?_0x19842e['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x44f4f4,scrollHeight:_0x1fc446,clientHeight:_0x52c5d1}=this['element'];return _0x1fc446-_0x44f4f4-_0x52c5d1<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Mr=class extends Un{constructor(_0x3d40b2){super(_0x3d40b2),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']);}},Vr=class extends _0x5afcc4{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x3e26b0,_0xa05ade){super(_0x3e26b0),this['_bodyCollection']=_0xa05ade,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...xn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Hr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x34639a,_0xb6f309){let _0x5af2a7;return'ai-reply'===_0x34639a?_0x5af2a7=new cr(this['locale'],_0xb6f309,this['_bodyCollection']):'ai-suggestion-reply'===_0x34639a?(_0x5af2a7=new hr(this['locale'],_0xb6f309,this['_bodyCollection']),_0x5af2a7['bind']('isTrackChangesOn')['to'](this)):_0x5af2a7='user-message'===_0x34639a?new yr(this['locale'],_0xb6f309,this['_bodyCollection']):'interaction-header'===_0x34639a?new xr(this['locale'],_0xb6f309):'custom-element'===_0x34639a?new Mr(_0xb6f309):new er(_0xb6f309),this['children']['add'](_0x5af2a7),_0x5af2a7;}async['updateReplyItem']({id:_0x2271c8,parsedContent:_0x280f0f,renderingStrategy:_0x231a4c,abortSignal:_0x3a7dff}){const _0x1eab4e=this['getItemById'](_0x2271c8);if(!(_0x1eab4e instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x1eab4e,'id':_0x2271c8,'parsedContent':_0x280f0f});await _0x1eab4e['updateContent']({'parsedContent':_0x280f0f,'renderingStrategy':_0x231a4c,'abortSignal':_0x3a7dff});}async['updateWebSources'](_0x27ff77,_0x1cdc14){const _0x5d38f6=this['getItemById'](_0x27ff77);if(_0x5d38f6 instanceof hr)_0x5d38f6['updateSources'](_0x1cdc14);else{if(!(_0x5d38f6 instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x5d38f6,'id':_0x27ff77,'sources':_0x1cdc14});_0x5d38f6['updateSources'](_0x1cdc14);}}async['updateSuggestionItem']({id:_0x221a4d,parts:_0x26fddd,abortSignal:_0xa25028,skipLoadingEffects:_0x51227a}){const _0x43ecd=this['getItemById'](_0x221a4d);if(!(_0x43ecd instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x43ecd,'id':_0x221a4d,'parts':_0x26fddd});await _0x43ecd['updateContent']({'parts':_0x26fddd,'abortSignal':_0xa25028,'skipLoadingEffects':_0x51227a});}['updateSuggestionPartState']({id:_0x52ce64,index:_0x4323ee,state:_0xce028a}){const _0x3d31a1=this['getItemById'](_0x52ce64);if(!(_0x3d31a1 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x52ce64});_0x3d31a1['updatePartState'](_0x4323ee,_0xce028a);}['setSuggestionPartActive']({id:_0x1bb3a5,index:_0x3fdb7d,isActive:_0x45ba45}){const _0x5ac6e7=this['getItemById'](_0x1bb3a5);if(!(_0x5ac6e7 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1bb3a5});this['children']['filter'](_0x2831f8=>_0x2831f8 instanceof hr)['forEach'](_0x95dc17=>{_0x95dc17['setPartActive'](!0x1);}),_0x5ac6e7['setPartActive'](_0x3fdb7d,_0x45ba45);}['markItemAsDone'](_0x1628a6){this['getItemById'](_0x1628a6)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5d56b2=>_0x5d56b2['options']['id']);}['removeItem'](_0x513604){this['children']['remove'](this['getItemById'](_0x513604));}['hasItem'](_0x2fda00){return!!this['children']['find'](_0x4e6ea9=>_0x4e6ea9['options']['id']['includes'](_0x2fda00));}['scrollToSuggestion'](_0x110a98,_0x38cf6f){const _0x61e3fc=this['getItemById'](_0x110a98);if(!(_0x61e3fc instanceof hr))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x110a98,'partIndex':_0x38cf6f});const _0x12a7a3=_0x61e3fc['getPartView'](_0x38cf6f);_0x12a7a3?St(_0x12a7a3['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x110a98,'partIndex':_0x38cf6f});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x1829e8=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x1829e8,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x3ba084=new zn(this['locale'],jn['aiFeed']);return _0x3ba084['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x3ba084;}['_createFeedItems'](){const _0x435550=new _0x5afcc4(this['locale']);return _0x435550['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x435550;}['_createFeedLoader'](){const _0x1748fa=new _0x5afcc4(this['locale']);return _0x1748fa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x3fd7f2=>!_0x3fd7f2)]},'children':this['_createLoaderChildren']()}),_0x1748fa;}['_createLoaderChildren'](){const _0x3b0327=new lr();return _0x3b0327['isVisible']=!0x0,[_0x3b0327,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x4623ce){const _0x4eeffc=this['children']['find'](_0x33351d=>_0x33351d['options']['id']['includes'](_0x4623ce));if(!_0x4eeffc)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x4623ce});return _0x4eeffc;}['setLoadingMessage'](_0x5b1ddf){this['set']('loadingMessage',_0x5b1ddf);}['toggleLoadingSkeleton'](_0xe23fa8){this['set']('isLoadingSkeletonVisible',_0xe23fa8);}['startAutoScroll'](_0x470d30={}){this['scrollManager']['start'](_0x470d30);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Ur=class extends jt{['filter'](){let _0x40efca=0x0;for(const _0x30fd04 of this['items'])_0x40efca+=_0x30fd04['items']['length'];return{'resultsCount':_0x40efca,'totalItemsCount':_0x40efca};}};function Br(_0x4c4ea3){const _0x49ecca=[];let _0x48b6bb=!0x1;for(const _0x3e30a5 of Array['from'](_0x4c4ea3['items'])){if('file'!==_0x3e30a5['kind'])continue;if(_0x3e30a5['webkitGetAsEntry']()?.['isDirectory']){_0x48b6bb=!0x0;continue;}const _0x11079b=_0x3e30a5['getAsFile']();_0x11079b&&_0x49ecca['push'](_0x11079b);}return{'files':_0x49ecca,'hasDirectory':_0x48b6bb};}const Gr='ck-ai-chat__prompt-input_highlighted';var Fr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x1f99d9,_0x13447e){super(_0x1f99d9,{'queryView':{'label':'','creator':_0x36058f,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Ur(_0x1f99d9),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x13447e,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',(_0x37a69c,_0x3fba9e)=>!_0x37a69c&&!_0x3fba9e),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x181a7b,_0x185b52)=>{this['isUploadInProgress']||this['isEmpty']||_0x181a7b['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x185b52());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x1d8c73=>this['_handlePaste'](_0x1d8c73)),this['element']['addEventListener']('drop',_0x4964ba=>this['_handleDrop'](_0x4964ba));}['_handlePaste'](_0x50e657){const _0x2aacbe=_0x50e657['clipboardData'];if(!_0x2aacbe)return;const {files:_0x1391ca,hasDirectory:_0x4bb409}=Br(_0x2aacbe),_0x2f48ed={'files':_0x1391ca,'plainText':_0x2aacbe['getData']('text/plain'),'hasDirectory':_0x4bb409,'forceTextAttachment':!0x1,'preventDefault':()=>_0x50e657['preventDefault']()};this['fire']('promptInputPaste',_0x2f48ed);}['_handleDrop'](_0x498dd4){const _0xc2928e=_0x498dd4['dataTransfer'];if(!_0xc2928e)return;const _0x47c1b8={'files':[],'plainText':_0xc2928e['getData']('text/uri-list')||_0xc2928e['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x498dd4['preventDefault']()};this['fire']('promptInputPaste',_0x47c1b8);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x3dc02f=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x3dc02f)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x3afbf4=_0x5cae26(_0x3dc02f);this['fire']('sendUserMessage',_0x3afbf4),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0xdc60b8){this['queryView']['fieldView']['set']('placeholder',_0xdc60b8);}['focus'](_0x445dbe=!0x1){super['focus'](),_0x445dbe&&(this['element']['classList']['contains'](Gr)||(this['element']['classList']['add'](Gr),setTimeout(()=>{this['element']['classList']['remove'](Gr);},0x320)));}['_createSubmitButton'](){const _0x22b2f6=new Ht(this['locale']);return _0x22b2f6['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+hn,'isEnabled':!0x1}),_0x22b2f6['on']('execute',()=>{this['submit']();}),_0x22b2f6;}['setIsUploadInProgress'](_0x13c303){this['isUploadInProgress']=_0x13c303;}['_setUpAddContextButtonPositioning'](){const _0x4c540b=this['locale'],_0x1d6687=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x5e327a=new At(this['queryView']['fieldView']['element']),_0xa3a365=new At(this['_addContextButtonView']['element']),_0x2fe61b=_0x5e327a['width'],_0x2b802a='rtl'===_0x4c540b['uiLanguageDirection']?'right':'left';_0x5e327a['excludeScrollbarsAndBorders']();const _0x52e018=_0x2fe61b-_0x5e327a['width']+0x1;this['_addContextButtonView']['element']['style'][_0x2b802a]='calc('+(_0x2fe61b-_0xa3a365['width']-_0x52e018)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x1d6687),this['on']('render',()=>{_0x1d6687(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x1d6687();});});}},Kr=class extends _0x5afcc4{constructor(_0x594473){super(_0x594473);const _0x321ae4=new Yt();_0x321ae4['content']=_0x90f4eb,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x321ae4,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x594473,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x26c700){let _0x4e6476=0x0;_0x26c700['addEventListener']('dragenter',_0x4bf1b0=>{_0x4bf1b0['dataTransfer']&&(_0x4e6476++,0x1===_0x4e6476&&this['fire']('dragEnter'),_0x26c700['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x26c700['addEventListener']('dragover',_0x1ed2ac=>{_0x1ed2ac['dataTransfer']&&_0x1ed2ac['preventDefault']();}),_0x26c700['addEventListener']('dragleave',()=>{--_0x4e6476<=0x0&&(_0x4e6476=0x0,_0x26c700['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x26c700['addEventListener']('drop',_0x27db4e=>{_0x27db4e['preventDefault'](),_0x4e6476=0x0,_0x26c700['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x27db4e);});}['_handleDrop'](_0x424290){const _0x4e0d20=_0x424290['dataTransfer'];if(!_0x4e0d20)return;const {files:_0x34ceef,hasDirectory:_0x29a1b4}=Br(_0x4e0d20),_0x1ba1d0={'files':_0x34ceef,'plainText':_0x4e0d20['getData']('text/uri-list')||_0x4e0d20['getData']('text/plain'),'hasDirectory':_0x29a1b4,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x1ba1d0);}};const Wr='ck-ai-chat__prompt-capabilities',Yr='ck-ai-chat-controls-button',$r='ck-ai-chat-controls-button--commands',qr='ck-ai-chat-controls__model-selection',Qr='ck-ai-chat-controls__model-selection__item-name',Xr='ck-ai-chat-controls__model-selection__item-description',zr='ck-ai-chat-controls__model-selection__item-capabilities',jr='n';var Jr=class extends _0x5afcc4{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0xaa2fe0){super(_0xaa2fe0),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x51efb1=>'selector'===_0x51efb1),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x18b735=>_0x18b735?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x255d53=>_0x255d53),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x1c4cb5=>_0x1c4cb5),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0xc115a3=>us(this['locale'],_0xc115a3?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x50c622=>_0x50c622),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x42afbc=>us(this['locale'],_0x42afbc?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Wr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x45d336(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x1a1889,_0x577c15){if(_0x577c15)this['set']('modelDisplayMode','hidden');else{const _0x41e6e3=0x1===_0x1a1889['length'];this['set']('modelDisplayMode',_0x41e6e3?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x1a1889?.['length'])for(const _0x469349 of _0x1a1889){const _0x4a6112=new _0xc45766({'label':_0x469349['name'],'withText':!0x0,'role':'menuitemradio','id':_0x469349['id'],'model':_0x469349});_0x4a6112['bind']('isOn')['to'](this,'activeModelId',_0x5a4ba3=>_0x5a4ba3===_0x469349['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x4a6112,'labelView':new Zr(this['locale'],_0x469349)});}}['setWebSearch'](_0x3f337b){this['set']('webSearchActive',_0x3f337b);}['setReasoning'](_0x3c937c){this['set']('reasoningActive',_0x3c937c);}['setModel'](_0x3c99c6){if(!_0x3c99c6)return;this['activeModelId']=_0x3c99c6['id'],this['activeModelName']=_0x3c99c6['name']||_0x3c99c6['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x3c99c6['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x3c99c6['name']);const _0x10c81f=_0x3c99c6['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x10c81f),this['_webSearchButton']['set']('isVisible',_0x10c81f);const _0x2e3404=_0x3c99c6['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x2e3404),this['_reasoningButton']['set']('isVisible',_0x2e3404);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x474591){this['set']('modelSelectorEnabled',!0x1),_0x474591&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x72424=new Ht();return _0x72424['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0x72424['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x72424;}['_createReasoningButton'](){const _0x39429b=new Ht();return _0x39429b['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x8a1161,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0x39429b['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x39429b;}['_createCommandsButton'](){const _0x1504dd=new Ht();return _0x1504dd['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x5b4c55,'withText':!0x0,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':jr}),_0x1504dd['extendTemplate']({'attributes':{'class':[$r]}}),_0x1504dd['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x1504dd;}['_createModelSelectionDropdown'](){const _0x28c56b=_0x178550(this['locale']);return _0x28c56b['set']({'panelPosition':'ne','class':[qr]}),_0x28c56b['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':jr,'class':ln}),this['listenTo'](_0x28c56b,'execute',_0x58770d=>{this['fire']('selectModel',_0x58770d['source']['model']);}),_0x28c56b;}['_createModelNameView'](){const _0x106568=new to(this['locale']);return _0x106568['bind']('text')['to'](this,'activeModelName',_0x2b5869=>_0x2b5869??''),_0x106568['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3ca7bd=>'name'===_0x3ca7bd),_0x106568;}},Zr=class extends Dt{constructor(_0x3a0ab5,_0x20db9a){super();const _0x24504c=this['bindTemplate'],_0x41d4d3=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x24504c['to']('style'),'id':_0x24504c['to']('id')},'children':[{'tag':'div','attributes':{'class':[Qr]},'children':[{'text':_0x24504c['to']('text')}]},{'tag':'div','attributes':{'class':[Xr]},'children':[{'tag':'span','children':[{'text':_0x20db9a['description']}]}]},{'tag':'div','attributes':{'class':[zr]},'children':_0x41d4d3}]}),_0x41d4d3['addMany'](this['_getCapabilityParts'](_0x3a0ab5,at,'AI_CHAT_SEARCH_WEB',_0x20db9a['capabilities']['webSearch']?.['enabled']??!0x1)),_0x41d4d3['addMany'](this['_getCapabilityParts'](_0x3a0ab5,_0x8a1161,'AI_CHAT_REASONING',_0x20db9a['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x184742,_0x166bd3,_0x20463c,_0xb871ca){const _0x4457eb=new Yt();_0x4457eb['content']=_0x166bd3;const _0x4658f4=new _0x5afcc4(_0x184742);_0x4658f4['setTemplate']({'tag':'span','children':[{'text':us(_0x184742,_0x20463c)+':\x20'}]});const _0x5bbd9=new _0x5afcc4(_0x184742);return _0x5bbd9['setTemplate']({'tag':'span','children':[{'text':us(_0x184742,_0xb871ca?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x4457eb,_0x4658f4,_0x5bbd9];}},to=class extends _0x5afcc4{constructor(_0x2a6f70){super(_0x2a6f70),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x30888a=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x30888a['if']('isVisible','ck-hidden',_0x187327=>!_0x187327)]},'children':[{'text':_0x30888a['to']('text')}]});}};const eo='ck-ai-chat-context-controls__url-form',io='ck-ai-chat-context-controls__url-input-section';var so=class extends _0x5afcc4{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x2de0a8){super(_0x2de0a8),this['focusTracker']=new dt(),this['keystrokes']=new _t(),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 Gt({'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'](_0x373e79=>{this['focusTracker']['add'](_0x373e79['element']),this['keystrokes']['listenTo'](_0x373e79['element']);}),_0x4bc9c9({'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'](_0x794bce){this['urlInputField']['errorText']=_0x794bce,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x54e9c4=new Ht(this['locale']);return _0x54e9c4['set']({'icon':_0x54835b,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x367050,_0x11d878,_0x2fbd29)=>{_0x54e9c4['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x2fbd29?'':'\x20ck-hidden')]});}),_0x54e9c4;}['_createUrlInputField'](){const _0x345cc0=new qt(this['locale'],_0x2f24c8);return _0x345cc0['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x345cc0['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x345cc0;}['_createConfirmButton'](){const _0x43aaff=new Ht(this['locale']);return _0x43aaff['set']({'icon':_0x3c5aaf,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x43aaff;}['_setupTemplate'](){const _0x1c1ca8=new Ft(this['locale'],{'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x1c1ca8['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':eo,'tabindex':'-1'},'children':[_0x1c1ca8,{'tag':'div','attributes':{'class':io},'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',_0x3e838c=>{_0x3e838c['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x3fd399,_0x94755c)=>{this['clear'](),this['fire']('cancel'),_0x94755c();});}['_handleSubmit'](){const _0x3707fc=this['getValue']()['trim']();_0x3707fc?this['_isValidUrl'](_0x3707fc)?(this['clearError'](),this['fire']('submitUrl',_0x3707fc)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x3f22ca=this['getValue']()['trim'](),_0x8cd6f0=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x3f22ca['length']>0x0&&!_0x8cd6f0;}['_isValidUrl'](_0x3ccd32){try{return!!new URL(_0x3ccd32);}catch{return!0x1;}}};const no='ck-ai-chat-resources__item',ro='ck-ai-chat-resources__item--in-context',oo='ck-ai-chat-resources__item-title',ao='ck-ai-chat-resources__item__icon';var ho=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x4dfb4a,_0x5de712){super(_0x4dfb4a),this['resource']=_0x5de712,this['set']('isInContext',!!_0x5de712['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x5531d2){if(_0x5531d2['isInContext'])return _0x3c5aaf;switch(_0x5531d2['type']){case'document':return _0x385941;case'web-resource':return _0x52b9b5;case'file':case'text':return _0x90f4eb;default:return _0x36e9c0;}}['highlightText'](_0x11a548){if(!_0x11a548||''===_0x11a548['trim']())return void this['_titleView']['highlightText'](null);const _0x2ea039=new RegExp(_0x515f94(_0x11a548),'gi');this['_titleView']['highlightText'](_0x2ea039);}['updateResourceState'](_0x282026){this['resource']['isInContext']=_0x282026,this['isInContext']=_0x282026,this['_updateIcon']();}['_createTitleView'](){const _0x522209=new Wt();return _0x522209['text']=this['resource']['label'],_0x522209['extendTemplate']({'tag':'span','attributes':{'class':[oo]}}),_0x522209;}['_createIconView'](){const _0xf32a33=new Yt();return _0xf32a33['content']=this['getResourceIcon'](this['resource']),_0xf32a33;}['_setupTemplate'](){const _0x595757=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[no,_0x595757['if']('isVisible','ck-hidden',_0x3e17d8=>!_0x3e17d8),_0x595757['if']('isInContext',ro)]},'children':[{'tag':'div','attributes':{'class':[ao]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x595757['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const co='ck-ai-chat-resources__list';var lo=class extends jt{['_source'];constructor(_0x357272,_0x1b1be0){super(_0x357272),this['_source']=_0x1b1be0,this['extendTemplate']({'attributes':{'class':[co]}});}['setResources'](_0x540bb7,_0x418c37){this['items']['clear']();let _0x5ec4c3=_0x540bb7;if(this['_source']['useDefaultFiltering']&&_0x418c37&&''!==_0x418c37['trim']()){const _0x5e8d2a=new RegExp(_0x418c37['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x5ec4c3=_0x540bb7['filter'](_0x5cb524=>_0x5e8d2a['test'](_0x5cb524['label']));}for(const _0x3ce7f3 of _0x5ec4c3){const _0x4d8b07=new ho(this['locale'],_0x3ce7f3);_0x4d8b07['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x3ce7f3);}),this['items']['add'](_0x4d8b07);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x418c37);}['highlightText'](_0x20432d){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x2959fb=>{_0x2959fb['highlightText'](_0x20432d);});}['updateResourceState'](_0x44665b,_0x357538){for(const _0x18d4d7 of this['items']){const _0x5affd3=_0x18d4d7;_0x5affd3['resource']['id']===_0x44665b&&_0x5affd3['updateResourceState'](_0x357538);}}['_handleResourceSelection'](_0x23167b,_0x26ef6f){this['fire']('addResourceToContext',{'source':_0x23167b,'resource':_0x26ef6f});}},uo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x16e6e3){const t=_0x16e6e3['t'],_0x150074={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x2f24c8,'label':us(_0x16e6e3,'AI_CHAT_SEARCH_RESOURCES')};super(_0x16e6e3,_0x150074['creator']),this['label']=_0x150074['label'],this['_viewConfig']=_0x150074,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x16e6e3,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x261c43){this['fire']('search',_0x261c43);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x878c2c,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x1456fe,t){this['resetButtonView']=new Ht(_0x1456fe),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x5ec216,'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',_0x23066b=>!_0x23066b),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);}},_o=class extends _0x5afcc4{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x147f21,_0x1e1479){super(_0x147f21),this['_source']=_0x1e1479['source'],this['_searchInputVisibleFrom']=_0x1e1479['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 _0x1c61f8([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new uo(this['locale']);}['_createSearchSection'](){const _0x19e68a=new _0x5afcc4(this['locale']);return _0x19e68a['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x4a74f4,_0x2757e4)=>{this['loadResources'](_0x2757e4),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x2757e4);}),_0x19e68a;}['_createResourcesListView'](){const _0x51af19=new lo(this['locale'],this['_source']);return _0x51af19['delegate']('addResourceToContext')['to'](this),_0x51af19['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x51af19;}['_createSkeletonView'](){const _0x5a5af7=new zn(this['locale'],jn['aiChatResources']);return _0x5a5af7['bind']('isVisible')['to'](this,'isLoading'),_0x5a5af7;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1a133f){const _0x4c6648=vt();this['_latestLoadResourcesUid']=_0x4c6648,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1a133f,'uid':_0x4c6648}),this['isLoading']=!0x0;}['setResources'](_0x4ce6c4,_0x3cff22){if(_0x3cff22&&_0x3cff22!==this['_latestLoadResourcesUid'])return;const _0x57cb34=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x4ce6c4,_0x57cb34),_0x4ce6c4['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x355d41,_0x2e7a8d){this['_resourcesListView']['updateResourceState'](_0x355d41,_0x2e7a8d);}};const go='ck-ai-chat-context-controls__source-balloon-panel',Ao='ck-button-icon\x20ck-button-back',Io='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var po=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x45cdab,_0x291db0,_0x4b58f2){this['_locale']=_0x45cdab,this['_bodyCollection']=_0x291db0,this['_config']=_0x4b58f2;}['showSourceResourcesBalloon']({source:_0x4a8106,withBackButton:_0x30fce9}){let _0x34fb18=this['_sourceResourceBalloons']['get'](_0x4a8106['id']);_0x34fb18||(_0x34fb18=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x4a8106['id'],_0x34fb18),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x34fb18)),this['_addSourceResourceContent']({'balloonPanel':_0x34fb18,'source':_0x4a8106,'withBackButton':_0x30fce9}),_0x34fb18['show']();const _0x37d25f=this['_config']['getTargetElement']();_0x37d25f&&_0x34fb18['pin']({'target':_0x37d25f,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x309188,_0x1b353d,_0x46b88d){const _0x413166=this['_sourceResourceBalloons']['get'](_0x309188);if(!_0x413166)return;const _0x2cb5c7=this['_getResourcesViewFromBalloon'](_0x413166);_0x2cb5c7&&(_0x2cb5c7['setResources'](_0x1b353d,_0x46b88d),_0x2cb5c7['once']('change:isLoading',()=>{_0x413166['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x37a8e0){const _0x7d3ac8=this['_sourceResourceBalloons']['get'](_0x37a8e0);_0x7d3ac8&&requestAnimationFrame(()=>{_0x7d3ac8['hide'](),this['_sourceResourceBalloons']['delete'](_0x37a8e0),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x535ee7 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x535ee7);}['isAnyResourceBalloonVisible'](){for(const _0x34a620 of this['_sourceResourceBalloons']['values']())if(_0x34a620['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0xce30f0,_0x1b533d,_0x98bc87){const _0x14dbd4=this['_sourceResourceBalloons']['get'](_0xce30f0);if(!_0x14dbd4||!_0x14dbd4['isVisible'])return;const _0x57b9ee=this['_config']['getTargetElement']();if(!_0x57b9ee)return;_0x14dbd4['pin']({'target':_0x57b9ee,'limiter':this['_config']['getLimiterElement']()});const _0x376c5b=this['_getResourcesViewFromBalloon'](_0x14dbd4);_0x376c5b&&_0x376c5b['updateResourceState'](_0x1b533d,_0x98bc87);}['destroy'](){for(const _0x52651f of this['_sourceResourceBalloons']['values']())_0x52651f['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x4709f1=new yt(this['_locale']);return _0x4709f1['extendTemplate']({'attributes':{'class':go}}),this['_bodyCollection']['add'](_0x4709f1),_0x4709f1;}['_addSourceResourceContent']({balloonPanel:_0x298ae9,source:_0x5e6c5e,withBackButton:_0x31c5a4}){_0x298ae9['content']['clear']();const _0x3b7e81=this['_createBalloonHeader']({'balloonPanel':_0x298ae9,'source':_0x5e6c5e,'withBackButton':_0x31c5a4});_0x298ae9['content']['add'](_0x3b7e81);const _0x4bd24a=this['_createBalloonResourcesView'](_0x5e6c5e);_0x298ae9['content']['add'](_0x4bd24a);}['_createBalloonHeader']({balloonPanel:_0x16cb53,source:_0x2697a9,withBackButton:_0x5414e9}){const _0x177deb=new Ft(this['_locale'],{'label':_0x2697a9['label'],'class':Io});return _0x5414e9&&_0x177deb['children']['add'](this['_createBackButton'](_0x16cb53),0x0),_0x177deb;}['_createBackButton'](_0x5a0671){const _0x12a625=new Ht(this['_locale']);return _0x12a625['set']({'icon':_0x54835b,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ao}),_0x12a625['on']('execute',()=>{_0x5a0671['hide'](),this['_config']['onBackToContext']();}),_0x12a625;}['_createBalloonResourcesView'](_0x26927e){const _0x4370fd=new _o(this['_locale'],{'source':_0x26927e,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x4370fd['on']('loadSourceResources',(_0x4ede44,_0x124af0)=>{this['_config']['onLoadSourceResources'](_0x124af0);}),_0x4370fd['on']('addResourceToContext',(_0x4ce03d,_0x5c34ed)=>{this['_config']['onResourceSelected'](_0x5c34ed['source'],_0x5c34ed['resource']),this['closeSourceResourceBalloon'](_0x26927e['id']);}),_0x4370fd;}['_getResourcesViewFromBalloon'](_0xa21a0){const _0x1f9282=_0xa21a0['content']['get'](0x1);return _0x1f9282 instanceof _o?_0x1f9282:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x4346d1){_0x3f90e8({'emitter':_0x4346d1,'contextElements':[_0x4346d1['element']],'callback':()=>{_0x4346d1['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x4346d1['isVisible']});}};const mo=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Eo='ck-ai-chat-context-controls',To='ck-ai-chat-context-controls__pending-contexts',wo='ck-ai-chat-context-controls__add-context-balloon-panel',Co='ck-ai-chat-context-controls__add-context-button',fo='ck-ai-chat-context-controls__url-balloon-panel',bo='ck-ai-chat-context-controls__balloon-button',So='ck-ai-chat-context-controls__balloon-button-source',Ro='ck-ai-chat-controls-button',Oo='ck-ai-chat-context-chips-wrapper-balloon',vo='ck-ai-chat-controls_context_show-more-button',ko='ck-ai-chat-context-controls__show-more-balloon-panel',No='ck-ai-chat',yo=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var xo=class extends _0x5afcc4{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x3d9747,_0x24ee3b){super(_0x3d9747),this['bodyCollection']=_0x24ee3b['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3d9747),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3d9747),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3d9747),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3d9747,_0x24ee3b);const _0x672ce6={'cssClasses':{'showMoreButton':vo+'\x20'+ln,'showMoreBalloon':ko,'overflowContainer':Oo,'controlsButton':Ro}};this['_overflowManager']=new fr(_0x3d9747,this['_currentContextsChips'],_0x672ce6,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'](_0x4b609d,_0x4abf38){const _0x5033e8=this['_createContextButton'](_0x4b609d,'current',!0x0,_0x4abf38);this['_addContextToCollection'](_0x5033e8,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0xf0e51){this['_removeContextFromCollection'](_0xf0e51,this['_currentContextsChips']),this['_removeContextFromCollection'](_0xf0e51,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x2520ce,_0x2e13f7){let _0x30a375=this['_currentContextsChips']['find'](_0x253c8f=>_0x253c8f['id']===_0x2520ce);_0x30a375||(_0x30a375=this['_overflowManager']['overflowChips']['find'](_0x3d7095=>_0x3d7095['id']===_0x2520ce)),_0x30a375&&(_0x30a375['isLoading']=_0x2e13f7);}['setConversationContext'](_0x38a44d){this['_conversationContextsChips']['clear']();for(const _0x207c7c of _0x38a44d){const _0x77753f=this['_createContextButton'](_0x207c7c,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x77753f,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x1d119b,_0x4a13d8,_0xa6e3d6){this['_resourcesBalloonView']['updateResourceState'](_0x1d119b,_0x4a13d8,_0xa6e3d6);}['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:_0x34fc98,withBackButton:_0x11d66d}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x34fc98,'withBackButton':_0x11d66d}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x6e0982,_0x414035,_0x3c83d3,_0x2076bc){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x6e0982,_0x3c83d3,_0x2076bc);}['closeSourceResourceBalloon'](_0x58e222){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x58e222),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x13a077){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x13a077),this['_setAddContextButtonEnabled'](_0x13a077);}['_setAddContextButtonEnabled'](_0x3c3b21){const _0x5d2dfd=!_0x3c3b21['document']['isHidden']&&_0x3c3b21['document']['enabled'],_0x180dff=_0x3c3b21['urls']['enabled'],_0x2817c1=_0x3c3b21['files']['enabled'],_0x4e1c99=_0x3c3b21['sources']['length']>0x0,_0x445b96=_0x3c3b21['customItems']&&_0x3c3b21['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x5d2dfd||_0x180dff||_0x2817c1||_0x4e1c99||_0x445b96;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Eo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':To},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x4a241c){const _0x2714a1=new Ht(_0x4a241c);return _0x2714a1['set']({'label':us(_0x4a241c,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ro+'\x20'+Co+'\x20'+ln,'icon':_0xf7813d,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x2714a1;}['_createAddContextBalloonPanelView'](_0x25e716){return this['_createBaseBalloonPanel'](_0x25e716,wo);}['_createUrlBalloonPanelView'](_0x79985f){const _0x4a78b1=this['_createBaseBalloonPanel'](_0x79985f,fo);return this['_addUrlContent'](_0x4a78b1,_0x79985f),_0x4a78b1;}['_createResourcesBalloonView'](_0x2ad630,_0x216b48){const _0x3fd4d3={'searchInputVisibleFrom':_0x216b48['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});},'onResourceSelected':(_0x42fdaf,_0x1d9b28)=>{this['fire']('addResourceToContext',{'source':_0x42fdaf,'resource':_0x1d9b28});},'onLoadSourceResources':_0x112fc1=>{this['fire']('loadSourceResources',_0x112fc1);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new po(_0x2ad630,_0x216b48['bodyCollection'],_0x3fd4d3);}['_getLimiterElement'](){return this['element']?.['closest']('.'+No)||document['body'];}['_createBaseBalloonPanel'](_0x22a30c,_0x34999c){const _0x372036=new yt(_0x22a30c);return _0x372036['extendTemplate']({'attributes':{'class':_0x34999c}}),this['bodyCollection']['add'](_0x372036),_0x372036;}['_setBalloonPanelContent'](_0x4c4336,_0x5489a0,_0x467ba5){if(_0x4c4336['content']['clear'](),!_0x467ba5['document']['isHidden']&&_0x467ba5['document']['enabled']){const _0x4f6ecb=this['_createBalloonButton'](_0x5489a0,{'label':us(_0x5489a0,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x385941});_0x4f6ecb['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x4c4336['content']['add'](_0x4f6ecb);}if(_0x467ba5['urls']['enabled']){const _0x22eb46=this['_createBalloonButton'](_0x5489a0,{'label':us(_0x5489a0,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x52b9b5});_0x22eb46['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_urlInputView']['focus']();}),_0x4c4336['content']['add'](_0x22eb46);}if(_0x467ba5['files']['enabled']){const _0x494898=new Bt(_0x5489a0);_0x494898['set']({'label':us(_0x5489a0,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x35ea5d,'withText':!0x0,'tooltip':!0x0,'class':bo,'allowMultipleFiles':!0x0}),_0x494898['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x494898['on']('done',(_0x4a8bc3,_0x33eb50)=>{this['fire']('addFileToContext',_0x33eb50);}),_0x494898['tooltip']=!0x0,_0x4c4336['content']['add'](_0x494898);}for(const _0x96b939 of _0x467ba5['sources']){const _0x143d35=this['_createBalloonButton'](_0x5489a0,{'label':_0x96b939['label'],'icon':_0x96b939['icon']||_0x36e9c0,'type':'source'});_0x4c4336['content']['add'](_0x143d35),_0x143d35['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x96b939,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x1927f5 of _0x467ba5['customItems']||[]){const _0x1ec72e=this['_createBalloonButton'](_0x5489a0,{'label':_0x1927f5['label'],'icon':_0x1927f5['icon']||_0x36e9c0,'type':'customItem'});_0x4c4336['content']['add'](_0x1ec72e),_0x1ec72e['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x1927f5);});}this['_hasExactlyOneSource']=0x1===_0x4c4336['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x6095f4,_0x20294e){this['_urlInputView']=new so(_0x20294e),this['_urlInputView']['on']('submitUrl',(_0x5524b2,_0x564670)=>{this['_handleUrlSubmit'](_0x564670);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});}),_0x6095f4['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0xe3aede,_0xf89c9e){const _0x304edd='source'===_0xf89c9e['type']?new Lo(_0xe3aede):new Ht(_0xe3aede);return _0x304edd['set']({'label':_0xf89c9e['label'],'icon':_0xf89c9e['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':bo}),_0x304edd;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x3f90e8({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x8026cf){const _0x35358c=this['_addContextBalloonConfig'];_0x35358c['buttonView']['isOn']=_0x8026cf,_0x8026cf?_0x35358c['balloonView']['show']():_0x35358c['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x11d02e,buttonView:_0x1dea24,hideMethod:_0x8d9819}=this['_addContextBalloonConfig'];_0x3f90e8({'emitter':_0x11d02e,'contextElements':[_0x11d02e['element'],_0x1dea24['element']],'callback':()=>{_0x8d9819();},'activator':()=>_0x1dea24['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x3869e2,_0x5c6a69,_0x3aac80=!0x1,_0x3820bd=!0x1){const _0x3a0fba='conversation'===_0x5c6a69||!0x0===_0x3869e2['isReadOnly'],_0x34f927=new Er(this['locale'],_0x3869e2,_0x3a0fba,_0x3aac80,_0x3820bd);return _0x3a0fba||_0x34f927['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x34f927['id']);}),_0x34f927;}['_addContextToCollection'](_0x4d1035,_0x1b46c0){_0x1b46c0['add'](_0x4d1035,0x0);}['_removeContextFromCollection'](_0x2e893e,_0x35e648){const _0x49da1c=_0x35e648['find'](_0x37f969=>_0x37f969['id']===_0x2e893e);_0x49da1c&&_0x35e648['remove'](_0x49da1c);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x2fe323){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x2fe323);}},Lo=class extends Ht{['arrowView'];constructor(_0xe33c04){super(_0xe33c04),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[So]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x949bc2=new Yt();return _0x949bc2['content']=_0x899818,_0x949bc2['extendTemplate']({'attributes':{'class':So+'__arrow'}}),_0x949bc2;}},Do=class extends _0x5afcc4{['_cancelButtonView'];['_loaderView'];constructor(_0x579a46){super(_0x579a46),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 _0xfecc61=new Ht(this['locale']);return _0xfecc61['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':cn+'\x20ck-ai-button-stop-generating','icon':it}),_0xfecc61['on']('execute',()=>{this['fire']('abortPromptStream');}),_0xfecc61;}['_createLoaderView'](){const _0x35b0e4=new _0x5afcc4(this['locale']);return _0x35b0e4['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':us(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x35b0e4;}},Po=class extends _0x5afcc4{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x4f9e56,_0x54d480){super(_0x4f9e56),this['_filesEnabled']=_0x54d480['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x4f9e56,{'bodyCollection':_0x54d480['bodyCollection'],'searchInputVisibleFrom':_0x54d480['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x4f9e56),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x4f9e56),this['_loaderView']=this['_createLoaderView'](_0x4f9e56),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x4f9e56),this['_dropZoneView']=new Kr(_0x4f9e56),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...mo)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x21297f=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x21297f['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x21297f['if']('isLoading','ck-hidden',_0x5e686b=>_0x5e686b||!this['isModelAvailable']),_0x21297f['if']('isModelAvailable','ck-hidden',_0x2efa46=>!_0x2efa46||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x21297f['if']('isLoading','ck-hidden',_0x2cdb44=>!_0x2cdb44)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x21297f['if']('isModelAvailable','ck-hidden',_0x1f8c35=>_0x1f8c35)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x3f90e8({'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'](_0x4d90fd,_0x38b955){return new xo(_0x4d90fd,_0x38b955);}['_createPromptInputView'](_0x7557c2){return new Fr(_0x7557c2,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x28b05f){return new Jr(_0x28b05f);}['_createLoaderView'](_0x27b201){return new Do(_0x27b201);}['_createModelUnavailableMessageView'](_0x48c999){const _0x596409=new Ho(_0x48c999);return _0x596409['delegate']('startConversation')['to'](this),_0x596409;}['_handlePromptInputFocus'](_0x14ed14,_0x542c55,_0x4a521a){_0x4a521a?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x1c04a5,_0x337047){this['_contextPanelView']['addContextItem'](_0x1c04a5,_0x337047);}['removeContextItem'](_0x29f5f3){this['_contextPanelView']['removeContextItem'](_0x29f5f3);}['setContextItemLoading'](_0x529f72,_0x10e6cc){this['_contextPanelView']['setContextItemLoading'](_0x529f72,_0x10e6cc);}['setIsUploadInProgress'](_0x475015){this['_promptInputView']['setIsUploadInProgress'](_0x475015);}['setConversationContext'](_0x1a994f){this['_contextPanelView']['setConversationContext'](_0x1a994f);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x128a7e,_0x19928b,_0x6137aa){this['_contextPanelView']['updateResourceState'](_0x128a7e,_0x19928b,_0x6137aa);}['setWebSearch'](_0x4a4263){this['_promptCapabilitiesView']['setWebSearch'](_0x4a4263);}['setReasoning'](_0x35bf88){this['_promptCapabilitiesView']['setReasoning'](_0x35bf88);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x4bb311){this['_contextPanelView']['setAddContextOptions'](_0x4bb311);}['setInputPlaceholder'](_0x107604){this['_promptInputView']['setPlaceholderText'](_0x107604);}['setModelList'](_0x3f00af,_0x56db2c){this['_promptCapabilitiesView']['setModelList'](_0x3f00af,_0x56db2c);}['setModel'](_0x6c959f){_0x6c959f?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x6c959f)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x42826){this['_promptCapabilitiesView']['disableModelSelector'](_0x42826);}['populateSourceResourceBalloon'](_0x48dbbf,_0x1b8326,_0x5cf656,_0x281e9d){this['_contextPanelView']['populateSourceResourceBalloon'](_0x48dbbf,_0x1b8326,_0x5cf656,_0x281e9d);}['closeSourceResourceBalloon'](_0x3bac63){this['_contextPanelView']['closeSourceResourceBalloon'](_0x3bac63);}['focusPromptInput'](_0x20ed8f=!0x1){this['_promptInputView']['focus'](_0x20ed8f);}['setPromptInputValue'](_0x4064db){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x4064db;}},Ho=class extends _0x5afcc4{constructor(_0x3fde15){super(_0x3fde15);const _0xdaa95e=new Ht(_0x3fde15);_0xdaa95e['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0xdaa95e['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0xdaa95e]}]});}},Mo=class extends Ft{['resizeButton'];constructor(_0x3eea96,_0x357766){super(_0x3eea96,{'label':_0x357766['label'],'class':'ck-ai-header\x20'+_0x357766['class'],'icon':_0x357766['icon']}),this['set']('isMaximized',!0x1),_0x357766['content']&&this['children']['add'](_0x357766['content']),_0x357766['showResizeButton']&&(this['resizeButton']=un(_0x3eea96,this),this['children']['add'](this['resizeButton']));}},Vo=class extends _0x5afcc4{constructor(_0x114af5){super(_0x114af5),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x114af5,'AI_DISCLAIMER_TEXT')}]}]});}};function Uo(_0x44c4ca,_0x2093e1){const _0x360530=new Ht(_0x44c4ca);return _0x360530['set']({'label':us(_0x44c4ca,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x5e2ed5,'class':'ck-ai-chat__start-conversation\x20'+cn}),_0x360530['on']('execute',()=>{_0x2093e1['fire']('startConversation');}),_0x360530;}var Bo=class extends _0x5afcc4{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x234399,_0x63d318){super(_0x234399),this['_bodyCollection']=dn(_0x234399);const _0x584aa0=Uo(_0x234399,this);this['chatHeader']=new Mo(_0x234399,{'label':us(_0x234399,'AI_CHAT_HEADING'),'icon':_0x36cfd5,'class':'ck-ai-header_chat','content':_0x584aa0,'showResizeButton':_0x63d318['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Vr(_0x234399,this['_bodyCollection']),this['chatFeed']['delegate'](...xn)['to'](this),this['chatControls']=new Po(_0x234399,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x63d318['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x63d318['filesEnabled']}),this['chatControls']['delegate'](...xn)['to'](this),this['chatDisclaimer']=new Vo(_0x234399),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x234399['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x1b15e8,_0x4c1276,_0x34dad1,_0x3fcc81){this['chatControls']['populateSourceResourceBalloon'](_0x1b15e8,_0x4c1276,_0x34dad1,_0x3fcc81);}['closeSourceResourceBalloon'](_0x5280f5){this['chatControls']['closeSourceResourceBalloon'](_0x5280f5);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Go=class extends _0x215b79{static get['requires'](){return[cs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x51086b){super(_0x51086b);const _0x31d880=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new tr(),this['_view']=new Bo(this['context']['locale'],{'showResizeButton':_0x31d880['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'](_0x31d880),this['_view']['delegate'](...xn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x4d12dc,{showDiff:_0x4ca1c7})=>{this['showDiff']=_0x4ca1c7;}),this['disableControls'](),_0x31d880['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x36cfd5,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x31d880['view'],'isMaximized',_0x153f28=>_0x153f28),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x25ae80=>_0x25ae80),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x58435c){const _0x1778d4=this['context']['config']['get']('ai.chat.welcomeMessage')??us(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x58435c['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x1778d4}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x17a450,staticMessage:_0x4fb65b}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x17a450,'initialContent':'<p>'+_0x4fb65b+'</p>'});});}async['addFeedItemUserMessage'](_0x4950a2){const _0x520e17=_0x4950a2['attributes']?.['displayedPrompt']||_0x4950a2['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x4950a2['contextItems']['values']()),'initialContent':'<p>'+_0x520e17+'</p>','id':_0x4950a2['id']});});}async['addFeedItemError']({errorMessage:_0xe23755,id:_0x4305ff}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0xe23755+'</p>','id':_0x4305ff});});}async['addFeedItemAIReply'](_0x5cf375){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5cf375['interactionId']+':'+_0x5cf375['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x31ac2e){const _0x16624f=ds(this['context']),_0x3cee1f=_0x16624f['map'](_0x17f141=>_0x17f141['config']['get']('ai.availableReplyActions')||[...ir]);let _0x32ff5c=_0x3cee1f['reduce']((_0x164134,_0x294af2)=>_0x164134['filter'](_0x2a0888=>_0x294af2['includes'](_0x2a0888)),_0x3cee1f[0x0]||[...ir]);const _0x4ae520=_0x16624f['every'](_0x332cb0=>_0x332cb0['plugins']['has']('TrackChanges')),_0x1eaa6a=_0x16624f['map'](_0x5affe0=>_0x5affe0['commands']['get']('trackChanges'));return _0x4ae520?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x1eaa6a,'value',(..._0x2b73ec)=>_0x2b73ec['some'](_0x248df2=>_0x248df2))):_0x32ff5c=_0x32ff5c['filter'](_0x565b0a=>'insertSuggestion'!=_0x565b0a),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x31ac2e['interactionId']+':'+_0x31ac2e['id'],'areActionsDisabled':_0x31ac2e['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x32ff5c}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x47f834,_0x2af184){return this['_promiseQueue']['enqueue'](async()=>{const _0x5b3a8b=this['_view']['chatFeed']['children']['last'];if(_0x5b3a8b instanceof xr)return this['_view']['chatFeed']['children']['remove'](_0x5b3a8b),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x47f834['id'],'capabilities':{'isWebSearchEnabled':_0x5b3a8b['capabilities']['isWebSearchEnabled']||_0x2af184['isWebSearchEnabled'],'isReasoningEnabled':_0x5b3a8b['capabilities']['isReasoningEnabled']||_0x2af184['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x47f834['id'],'capabilities':_0x2af184});});}async['addFeedItemCustomElement'](_0x57ce42,_0x3cabfc){let _0x4d36af;return await this['_promiseQueue']['enqueue'](async()=>{_0x4d36af=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x57ce42,'id':_0x3cabfc});}),_0x4d36af;}['removeFeedItem'](_0x5a49e0){this['_view']['chatFeed']['removeItem'](_0x5a49e0);}['hasFeedItem'](_0x32b8f5){return this['_view']['chatFeed']['hasItem'](_0x32b8f5);}['updateFeedInteractionHeader'](_0x502f57){const _0x43780e=this['_view']['chatFeed']['children']['find'](_0x542573=>_0x542573['options']['id']==_0x502f57['id']&&_0x542573 instanceof xr);_0x43780e&&_0x43780e['set']('isVisible',_0x502f57['isVisible']);}async['updateFeedItemAIReplyContent'](_0x392ca5){const _0x43512a=_0x392ca5['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x184a3a=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x392ca5,'abortSignal':_0x184a3a,'renderingStrategy':_0x43512a}),_0x392ca5['isDone']&&this['markFeedItemAsDone'](_0x392ca5['id']);});}['updateFeedItemAIReplySources'](_0x456582,_0x23f2d0){this['_view']['chatFeed']['updateWebSources'](_0x456582,_0x23f2d0);}async['updateFeedItemAIReplySuggestionContent'](_0x2d5105){return this['_promiseQueue']['enqueue'](async _0x178023=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x2d5105,'abortSignal':_0x178023}),_0x2d5105['isDone']&&this['markFeedItemAsDone'](_0x2d5105['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x300eb6){this['_view']['chatFeed']['updateSuggestionPartState'](_0x300eb6);}['setFeedItemAIReplySuggestionPartActive'](_0x48ceeb){this['_view']['chatFeed']['setSuggestionPartActive'](_0x48ceeb);}['markFeedItemAsDone'](_0x5cd3ce){this['_view']['chatFeed']['markItemAsDone'](_0x5cd3ce);}['removeFeedInteraction'](_0x23d388){this['_view']['chatFeed']['getItemIds']()['filter'](_0x1dc963=>_0x1dc963['startsWith'](_0x23d388))['forEach'](_0x712c7d=>this['_view']['chatFeed']['removeItem'](_0x712c7d));}['startInteraction'](){const _0x46bc7e=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x46bc7e),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x127515){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0xe47c4c=>_0xe47c4c['startsWith'](_0x127515['id']))['forEach'](_0x4426c7=>this['markFeedItemAsDone'](_0x4426c7)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x4ed5c9,_0x32390f){this['_view']['chatControls']['addContextItem'](_0x4ed5c9,_0x32390f);}['removeContextItem'](_0x5af55){this['_view']['chatControls']['removeContextItem'](_0x5af55);}['setContextItemLoading'](_0x544624,_0x3b428d){this['_view']['chatControls']['setContextItemLoading'](_0x544624,_0x3b428d);}['setIsUploadInProgress'](_0x24dcaf){this['_view']['chatControls']['setIsUploadInProgress'](_0x24dcaf);}['setConversationContext'](_0x343e62){this['_view']['chatControls']['setConversationContext'](_0x343e62);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x5a5bbb,_0x13d4f6,_0x30551d){this['_view']['chatControls']['updateResourceState'](_0x5a5bbb,_0x13d4f6,_0x30551d);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0xa5a64a){this['_view']['chatControls']['setAddContextOptions'](_0xa5a64a);}['updateCapabilities'](_0x3a6024){this['_view']['chatControls']['setWebSearch'](_0x3a6024['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x3a6024['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x3a6024));}['setSelectedModel'](_0x52ffdf,_0x19483d){this['_view']['chatControls']['setModel'](_0x52ffdf),_0x19483d&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x48aefd){this['feedItemRenderingStrategy']=_0x48aefd;}['toggleLoadingSkeleton'](_0x3a4175){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x3a4175);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x359cd5,_0x34e1d0=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x34e1d0&&!pt()&&_0x359cd5['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x359cd5);this['_view']['chatHeader']['label']=_0x359cd5;}['setLoadingMessage'](_0x1f4538){this['_view']['chatFeed']['setLoadingMessage'](_0x1f4538);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x44f6b3){let _0x2daa6c=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x44f6b3[_0x2daa6c],_0x2daa6c++,_0x2daa6c===_0x44f6b3['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x12eee8){return _0x12eee8['isWebSearchEnabled']&&_0x12eee8['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x12eee8['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x12eee8['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x34b334){return _0x34b334?_0x34b334['isWebSearchEnabled']&&_0x34b334['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x34b334['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x34b334['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x52fd17,_0x1057b0,_0x5834ca,_0x5d4ceb){this['_view']['populateSourceResourceBalloon'](_0x52fd17,_0x1057b0,_0x5834ca,_0x5d4ceb);}['closeSourceResourceBalloon'](_0xf05054){this['_view']['closeSourceResourceBalloon'](_0xf05054);}['setPromptInputValue'](_0x4332b5){this['_view']['chatControls']['setPromptInputValue'](_0x4332b5);}['focusPromptInput'](_0x5cdaae=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x5cdaae);}['scrollFeedToSuggestion'](_0x404cdf,_0x59a7d0){this['_view']['chatFeed']['scrollToSuggestion'](_0x404cdf,_0x59a7d0);}['startAutoScroll'](_0x4e2fa8={}){this['_view']['chatFeed']['startAutoScroll'](_0x4e2fa8);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Fo=class extends jt{['sections'];constructor(_0x2542b9,_0x284bff){super(_0x2542b9),this['sections']=_0x284bff,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x1c666a){let _0x1a8386=0x0,_0x1e0b53=0x0;for(const _0x2284f2 of this['sections']){const {resultsCount:_0x310ec4,totalItemsCount:_0xccadcc}=_0x2284f2['filter'](_0x1c666a);_0x1a8386+=_0x310ec4,_0x1e0b53+=_0xccadcc;}return{'resultsCount':_0x1a8386,'totalItemsCount':_0x1e0b53};}},Ko=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x50bb32,{title:_0xc7ad03,items:_0x547fa7}){super(_0x50bb32);const _0x122b58=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0xc7ad03,this['itemsViews']=_0x547fa7;const _0x222533=new _0x5afcc4(_0x50bb32);_0x222533['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0x50bb32),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x122b58['if']('isVisible','ck-hidden',_0x45ac57=>!_0x45ac57)]},'children':[_0x222533,this['_itemsListView']]});}['filter'](_0x2b7215){const _0xf50beb=this['itemsViews']['length'];let _0xb09762=0x0;for(const _0x5eb9f9 of this['itemsViews'])_0x2b7215?(_0x5eb9f9['isVisible']=!!_0x5eb9f9['isMatching'](_0x2b7215),_0x5eb9f9['highlightText'](_0x2b7215)):(_0x5eb9f9['isVisible']=!0x0,_0x5eb9f9['highlightText'](null)),_0x5eb9f9['isVisible']&&_0xb09762++;return this['isVisible']=_0xb09762>0x0,{'resultsCount':_0xb09762,'totalItemsCount':_0xf50beb};}['getItem'](_0x20e797){return this['itemsViews']['find'](_0xcf3dba=>_0xcf3dba['id']===_0x20e797);}['removeItem'](_0x5843b7){const _0x519d5c=this['itemsViews']['indexOf'](_0x5843b7);-0x1!==_0x519d5c&&(this['itemsViews']['splice'](_0x519d5c,0x1),this['_itemsListView']['items']['remove'](_0x5843b7));}};const Wo=/* #__PURE__ -- @preserve */
34
+ _0x1f1e2f(zt);var Yo=class AIChatHistoryListItemView extends Wo{['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(_0x37c7e5,_0x8f2ea3){super(_0x37c7e5);const _0x5d1196=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x8f2ea3['pinned']),this['set']('loadingState',null),this['set']('title',_0x8f2ea3['title']),this['id']=_0x8f2ea3['id'];const {createdAt:_0x4d279a,active:_0x4e067b=!0x1}=_0x8f2ea3;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x5f2cdf=this['_createCheckView'](),_0x1d61ee=this['_createPinButtonView'](_0x37c7e5),_0x265a08=this['_createMenuDropdownView'](),_0x16a90a=this['_createEditInputView'](_0x37c7e5),_0x49bcfe=this['_createAcceptEditButtonView'](_0x37c7e5,_0x16a90a),_0x30fa2e=this['_createCancelEditButtonView'](_0x37c7e5);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x1d61ee),this['actions']['add'](_0x265a08),this['on']('change:isEdit',(_0x5ac4b2,_0x58a4c7,_0x1296f5)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x1296f5?(this['actions']['add'](_0x49bcfe),this['actions']['add'](_0x30fa2e),this['mainContent']['add'](_0x16a90a),_0x16a90a['element']['value']=this['title']||'',_0x16a90a['element']['focus']()):(this['actions']['add'](_0x1d61ee),this['actions']['add'](_0x265a08),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x4e067b?'ck-ai-chat-history__item--active':'',_0x5d1196['if']('isVisible','ck-hidden',_0x173d84=>!_0x173d84),_0x5d1196['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',_0x5d1196['if']('loadingState','ck-hidden',_0x33b102=>!!_0x33b102)]},'children':_0x4e067b?[_0x5f2cdf]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x5d1196['if']('loadingState','ck-hidden',_0x41ff4c=>!_0x41ff4c)]},'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',_0x5d1196['if']('loadingState','ck-hidden',_0x417979=>!!_0x417979)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x5d1196['if']('loadingState','ck-hidden',_0xa60b87=>!_0xa60b87)]},'children':[{'text':_0x5d1196['to']('loadingState',_0x4b416f=>_0x4b416f?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x4b416f]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4d279a]}]},{'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'](_0x482711){this['set']('title',_0x482711);}['updateLoadingState'](_0x4dce9b,_0x5b2ff0){this['set']('loadingState',_0x5b2ff0?_0x4dce9b:null);}['_createCheckView'](){const _0x39e4d6=new Yt();return _0x39e4d6['set']({'content':_0x3c5aaf}),_0x39e4d6;}['_createPinButtonView'](_0x462784){const _0x41c2d4=new Ht(_0x462784);return _0x41c2d4['set']({'label':us(_0x462784,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x5ee4d4,'withText':!0x1,'tooltip':!0x0}),_0x41c2d4['bind']('isOn')['to'](this,'pinned'),_0x41c2d4['on']('execute',()=>{const _0x424d94=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x424d94});}),_0x41c2d4;}['_createMenuDropdownView'](){const _0x276d2a=_0x178550(this['locale']),_0x57d048=_0x276d2a['panelView']['children'];_0x276d2a['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x276d2a['panelPosition']='sw';const _0x114549=new Ht(this['locale']);_0x114549['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x114549['withText']=!0x0,_0x114549['on']('execute',()=>{this['isEdit']=!0x0;});const _0x366295=new Ht(this['locale']);_0x366295['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x366295['withText']=!0x0,_0x366295['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x5a70c8=new jt(this['locale']),_0xa5a7c0=new zt(this['locale']);_0xa5a7c0['children']['add'](_0x114549);const _0xcddb64=new zt(this['locale']);return _0xcddb64['children']['add'](_0x366295),_0x5a70c8['items']['addMany']([_0xa5a7c0,_0xcddb64]),_0x57d048['add'](_0x5a70c8),_0x276d2a;}['_createEditInputView'](_0x485a25){const _0x2d9abb=new $t(_0x485a25),_0x5639a9=_0x2d9abb['bindTemplate'];return _0x2d9abb['extendTemplate']({'on':{'keydown':_0x5639a9['to'](_0x14e7d4=>{'Enter'==_0x14e7d4['key']&&this['_commitEditInputValue'](_0x2d9abb);})}}),_0x2d9abb;}['_createAcceptEditButtonView'](_0x1103bb,_0x5c3f79){const _0xa9d882=new Ht(_0x1103bb);return _0xa9d882['set']({'icon':_0x3c5aaf,'withText':!0x1,'tooltip':us(_0x1103bb,'AI_CHAT_HISTORY_ACCEPT')}),_0xa9d882['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0xa9d882['on']('execute',()=>{this['_commitEditInputValue'](_0x5c3f79);}),_0xa9d882;}['_commitEditInputValue'](_0x4ec423){const _0xd82c53=_0x4ec423['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0xd82c53});}['_createCancelEditButtonView'](_0x781501){const _0x1a0943=new Ht(_0x781501);return _0x1a0943['set']({'icon':_0x5ec216,'withText':!0x1,'tooltip':us(_0x781501,'AI_CHAT_HISTORY_CANCEL')}),_0x1a0943['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1a0943['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1a0943;}['_createSpinnerView'](){const _0x446cab=new lr('tiny');return _0x446cab['isVisible']=!0x0,_0x446cab;}['isMatching'](_0x3592e1){return'string'==typeof this['title']&&this['title']['match'](_0x3592e1)?{'title':!0x0}:null;}['highlightText'](_0x2f02d8){this['_titleView']['highlightText'](_0x2f02d8);}},$o=class extends _0x5afcc4{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x57ad4a,_0x54f5c4){super(_0x57ad4a),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x1a0351=Uo(_0x57ad4a,this);this['headerView']=new Mo(_0x57ad4a,{'label':us(_0x57ad4a,'AI_CHAT_HISTORY_HEADING'),'icon':_0x11b517,'class':'ck-ai-header_history','content':_0x1a0351,'showResizeButton':_0x54f5c4}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Fo(_0x57ad4a,[]),this['sectionsView']['delegate'](...qo)['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',_0x154d44=>!_0x154d44)]}}),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 _0x380e50=new _0x53ae11(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x3754a6=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x3754a6),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x24f11e=this['_createErrorView']();return _0x24f11e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x575210=>!_0x575210)]}}),_0x380e50['on']('render',()=>{_0x380e50['children']['add'](_0x24f11e,0x1);}),_0x380e50['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x745a40=>!_0x745a40)]}}),_0x380e50;}['_createSkeletonView'](){const _0x3b2243=new zn(this['locale'],jn['aiHistory']);return _0x3b2243['bind']('isVisible')['to'](this,'isLoading'),_0x3b2243;}['_createErrorView'](){const _0x9f899=new _0x5afcc4(this['locale']),_0x307c9b=new Ht(this['locale']);_0x307c9b['set']({'withText':!0x1,'icon':_0x5ec216,'class':'ck-ai-notification_error__dismiss-button'}),_0x307c9b['bind']('isVisible')['to'](this,'hasItems',_0x3cf522=>!!_0x3cf522),_0x307c9b['on']('execute',()=>{this['errorMessage']='';});const _0x3314cb=this['bindTemplate'];return _0x9f899['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x3314cb['to']('errorMessage')}]},_0x307c9b]}),_0x9f899;}['_createEmptyStateView'](){const _0x1a1b1e=new _0x5afcc4(this['locale']);return _0x1a1b1e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x365478=>!_0x365478)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x1a1b1e;}['_createListItemViews'](_0x508201,_0x45a2d6){const _0x1c88c5=[];for(const _0x41d6ac of _0x508201){const _0xa250b1=new Yo(_0x45a2d6,_0x41d6ac);_0xa250b1['delegate'](...qo)['to'](this),_0x1c88c5['push'](_0xa250b1);}return _0x1c88c5;}['updateHistoryItemsWithCategories'](_0x1804f1){const _0x3905fd=this['locale']||'en',_0x2eb142=[];for(const _0x21fcb6 of _0x1804f1){const _0x337f50=this['_createListItemViews'](_0x21fcb6['items'],_0x3905fd);_0x2eb142['push'](new Ko(_0x3905fd,{'title':_0x21fcb6['title'],'items':_0x337f50}));}this['sectionsView']['sections']=_0x2eb142,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x2eb142),this['hasItems']=_0x1804f1['some'](_0x435577=>_0x435577['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x264de5){for(const _0x40331a of this['sectionsView']['sections']){const _0x262d64=_0x40331a['getItem'](_0x264de5);if(_0x262d64){if(_0x40331a['removeItem'](_0x262d64),0x0===_0x40331a['itemsViews']['length']){const _0x3f97ba=this['sectionsView']['sections']['indexOf'](_0x40331a);-0x1!==_0x3f97ba&&(this['sectionsView']['sections']['splice'](_0x3f97ba,0x1),this['sectionsView']['items']['remove'](_0x40331a));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x277464,_0x477a0e){for(const _0x3b53d9 of this['sectionsView']['sections']){const _0x4074f1=_0x3b53d9['getItem'](_0x277464);if(_0x4074f1){_0x4074f1['updateTitle'](_0x477a0e);break;}}}['updateItemLoadingState'](_0x4ebb11,_0x181ba8,_0x79199f){for(const _0x3266bd of this['sectionsView']['sections']){const _0x181d10=_0x3266bd['getItem'](_0x4ebb11);if(_0x181d10){_0x181d10['updateLoadingState'](_0x181ba8,_0x79199f);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x3feca7=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x3feca7);}}};const qo=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Qo=class extends _0x215b79{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x7dfc1a){super(_0x7dfc1a);const _0xf99c24=this['context']['plugins']['get']('AITabs');this['_historyView']=new $o(this['context']['locale'],_0xf99c24['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0xf99c24),this['_historyView']['delegate'](...qo)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0xf99c24['view'],'isMaximized',_0x51dd54=>_0x51dd54),_0xf99c24['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x11b517,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x4046b0){this['_historyView']['removeHistoryItem'](_0x4046b0);}['updateItems'](_0x4df277){this['_historyView']['updateHistoryItemsWithCategories'](_0x4df277);}['updateItemTitle'](_0x25993c,_0x4568fc){this['_historyView']['updateItemTitle'](_0x25993c,_0x4568fc);}['updateItemLoadingState'](_0x3b1d09,_0x13baeb,_0x3852b0){this['_historyView']['updateItemLoadingState'](_0x3b1d09,_0x13baeb,_0x3852b0);}['setLoadingSkeleton'](_0x3b912b){this['_historyView']['isLoading']=_0x3b912b;}['showError'](_0x481156){this['_historyView']['errorMessage']=_0x481156;}['hideError'](){this['_historyView']['errorMessage']='';}};const Xo=/* #__PURE__ -- @preserve */
35
+ gt();var zo=class extends Xo{['id'];['createdAt'];constructor({id:_0x525d9c,title:_0x569984,createdAt:_0x49448c,updatedAt:_0x30b337,pinned:_0x4c8394}){super(),this['id']=_0x525d9c,this['createdAt']=new Date(_0x49448c),this['set']('title',_0x569984),this['set']('updatedAt',_0x30b337?new Date(_0x30b337):null),this['set']('pinned',_0x4c8394||!0x1);}['updateTitle'](_0x32e041){this['set']('title',_0x32e041),this['updatedAt']=new Date();}['updatePinned'](_0x5ca4a5){this['set']('pinned',_0x5ca4a5),this['updatedAt']=new Date();}};const jo=/* #__PURE__ -- @preserve */
36
+ ut();var Jo=class extends jo{['items']=[];['connector'];['group'];constructor({connector:_0x3a972a,group:_0x2d3d13}){super(),this['connector']=_0x3a972a,this['group']=_0x2d3d13;}async['init'](){try{const _0x5485fd=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x5485fd);}catch(_0x526663){this['fire']('error',{'error':_0x526663,'operation':'init'});}}['addItem'](_0x158c76){this['items']['push'](_0x158c76);}async['removeItem'](_0x3ec6c9){const _0x422e5d=this['items']['findIndex'](_0xf7bd2d=>_0xf7bd2d['id']===_0x3ec6c9);if(-0x1===_0x422e5d)return!0x1;try{return await this['connector']['deleteConversation'](_0x3ec6c9)['execute'](),this['items']['splice'](_0x422e5d,0x1),this['fire']('itemRemoved',{'itemId':_0x3ec6c9}),!0x0;}catch(_0x3b0335){return this['fire']('error',{'error':_0x3b0335,'operation':'removeItem','itemId':_0x3ec6c9}),!0x1;}}['getItem'](_0x162ee1){return this['items']['find'](_0x4dc8eb=>_0x4dc8eb['id']===_0x162ee1);}async['updateItemTitle'](_0x18b34f,_0x28f9ca){const _0x2ca23e=this['getItem'](_0x18b34f);if(!_0x2ca23e)return!0x1;try{return await this['connector']['updateConversation'](_0x18b34f,{'title':_0x28f9ca})['getResult'](),_0x2ca23e['updateTitle'](_0x28f9ca),this['fire']('itemUpdated',{'itemId':_0x18b34f,'updates':{'title':_0x28f9ca}}),!0x0;}catch(_0x9563f0){return this['fire']('error',{'error':_0x9563f0,'operation':'updateItemTitle','itemId':_0x18b34f}),!0x1;}}async['updateItemPinned'](_0x2305d4,_0xca85f5){const _0x312308=this['getItem'](_0x2305d4);if(!_0x312308)return!0x1;try{return await this['connector']['updateConversation'](_0x2305d4,{'pinned':_0xca85f5})['getResult'](),_0x312308['updatePinned'](_0xca85f5),this['fire']('itemUpdated',{'itemId':_0x2305d4,'updates':{'pinned':_0xca85f5}}),!0x0;}catch(_0x46e531){return this['fire']('error',{'error':_0x46e531,'operation':'updateItemPinned','itemId':_0x2305d4}),!0x1;}}['loadItems'](_0xb19a9c){try{this['items']=[],_0xb19a9c['map'](_0x844e1=>{this['addItem'](new zo(_0x844e1));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x4913de){this['fire']('error',{'error':_0x4913de,'operation':'loadItems'});}}['getItems'](_0x1e07dc={}){const _0x7d889b=void 0x0!==_0x1e07dc['pinned']&&_0x1e07dc['pinned'],_0x34a31b=_0x1e07dc['from']?new Date(_0x1e07dc['from']['getFullYear'](),_0x1e07dc['from']['getMonth'](),_0x1e07dc['from']['getDate']()):null,_0x316984=_0x1e07dc['to']?new Date(_0x1e07dc['to']['getFullYear'](),_0x1e07dc['to']['getMonth'](),_0x1e07dc['to']['getDate']()):null;return this['items']['filter'](_0x52a393=>{if(_0x52a393['pinned']!==_0x7d889b)return!0x1;if(_0x316984){const _0x181432=new Date(_0x52a393['createdAt']['getFullYear'](),_0x52a393['createdAt']['getMonth'](),_0x52a393['createdAt']['getDate']());return _0x34a31b?_0x34a31b['getTime']()===_0x316984['getTime']()?_0x181432['getTime']()===_0x34a31b['getTime']():_0x181432<_0x316984&&_0x181432>=_0x34a31b:_0x181432<_0x316984;}return!0x0;});}},Zo=class extends _0x215b79{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,on,Nn,Qo,cs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](ls),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Qo),this['_aiChatController']=this['context']['plugins']['get'](Nn),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aichathistory');const _0x339072=this['context']['plugins']['get'](cs);try{const _0x32246a=this['_aiChatController']['getGroupId']();this['history']=new Jo({'connector':this['_aiConnector'],'group':_0x32246a}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x38c2bd,_0x2bd702)=>{this['_setItemLoading'](_0x2bd702['id'],'remove'),this['_handleRemove'](_0x2bd702['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x5eb498,_0x5b1444)=>{this['_setItemLoading'](_0x5b1444['id'],'rename'),this['_handleEditTitle'](_0x5b1444['id'],_0x5b1444['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x147201,_0x1bc633)=>{void 0x0!==_0x1bc633['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x1bc633['itemId'],_0x1bc633['updates']['title']),void 0x0!==_0x1bc633['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x1bc633['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x2e611c,_0x1c9111)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1c9111['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1c9111['itemId']),this['_clearItemLoading'](_0x1c9111['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x587944,_0x33c9ae)=>{this['_handleHistoryErrorUI'](_0x33c9ae['error'],_0x33c9ae['operation'],_0x33c9ae['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x58f823,_0x11032d)=>{this['_handleSelectConversation'](_0x11032d['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x493b11,_0x3bfbf8)=>{const _0x1337b3=_0x3bfbf8['pinned']?'pin':'unpin';this['_setItemLoading'](_0x3bfbf8['id'],_0x1337b3),this['_handleTogglePin'](_0x3bfbf8['id'],_0x3bfbf8['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x339072['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x339072['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x38e98a){this['_handleHistoryErrorUI'](_0x38e98a,'init');}}async['_handleEditTitle'](_0xf3e40b,_0x17d413){await this['history']['updateItemTitle'](_0xf3e40b,_0x17d413);}async['_handleTogglePin'](_0xa4654a,_0x550acd){await this['history']['updateItemPinned'](_0xa4654a,_0x550acd);}async['_handleRemove'](_0x5efee1){await this['history']['removeItem'](_0x5efee1);}async['_handleSelectConversation'](_0x2da11f){await this['_aiChatController']['loadConversation'](_0x2da11f);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x2988e6=this['_aiChatController']['activeConversation']?.['id'],_0x5b2c10=this['_getCategorizedItems']()['map'](_0x17a832=>({'title':_0x17a832['title'],'items':_0x17a832['items']['map'](_0x527a78=>({'id':_0x527a78['id'],'title':_0x527a78['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x527a78['createdAt'])['toLocaleDateString'](),'active':_0x527a78['id']===_0x2988e6,'pinned':_0x527a78['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x5b2c10);}['_setItemLoading'](_0x1ece48,_0x4e947e){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1ece48,_0x4e947e,!0x0);}['_clearItemLoading'](_0x4e2889){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4e2889,null,!0x1);}['_handleHistoryErrorUI'](_0x224798,_0x33aba1,_0x5ae008){const _0x5a4b15=this['_generateErrorMessage'](_0x33aba1,_0x5ae008);this['_aiChatHistoryUi']['showError'](_0x5a4b15),this['_reporter']['reportError'](_0x224798,{'context':{'operation':_0x33aba1}}),_0x5ae008&&this['_clearItemLoading'](_0x5ae008),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x12629e,_0x2436a9){const _0x59fbb3=_0x2436a9?this['history']['getItem'](_0x2436a9):null,_0x453de1=_0x59fbb3?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x12629e){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x453de1);case'updateItemPinned':{const _0x4f5cbe=us(this['context']['locale'],_0x59fbb3?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x4f5cbe,_0x453de1]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x453de1);case'init':case'loadItems':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x59bdcf=new Date(),_0x3fca9c=new Date(_0x59bdcf['getFullYear'](),_0x59bdcf['getMonth'](),_0x59bdcf['getDate']()),_0xd7e914=new Date(_0x3fca9c);_0xd7e914['setDate'](_0xd7e914['getDate']()-0x1);const _0x1091e9=new Date(_0x3fca9c);_0x1091e9['setDate'](_0x1091e9['getDate']()-0xe);const _0x5b24b7=this['history']['getItems']({'pinned':!0x0}),_0x243d2d=this['history']['getItems']({'from':_0x3fca9c,'to':_0x3fca9c}),_0x43d2a0=this['history']['getItems']({'from':_0xd7e914,'to':_0xd7e914}),_0x297e8c=this['history']['getItems']({'from':_0x1091e9,'to':_0xd7e914}),_0xa0120c=this['history']['getItems']({'to':_0x1091e9}),_0x357ecc=[];return _0x5b24b7['length']>0x0&&_0x357ecc['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x5b24b7}),_0x243d2d['length']>0x0&&_0x357ecc['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x243d2d}),_0x43d2a0['length']>0x0&&_0x357ecc['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x43d2a0}),_0x297e8c['length']>0x0&&_0x357ecc['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x297e8c}),_0xa0120c['length']>0x0&&_0x357ecc['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0xa0120c}),_0x357ecc;}},ta=class extends _0x215b79{static get['requires'](){return[Zo,Qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ea=class extends _0x215b79{static get['requires'](){return[Nn,Is,Go,ta,sn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x259216){super(_0x259216),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ia=class extends Ht{['id'];constructor(_0x34d894,_0x45b6eb){super(_0x34d894);const {id:_0x3d3712,type:_0x541324,icon:_0x4d36d2}=_0x45b6eb;this['id']=_0x3d3712,this['set']({'label':_0x45b6eb['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x45b6eb['id']}}),_0x4d36d2?this['icon']=_0x4d36d2:'chat'===_0x541324?this['icon']=_0x36cfd5:'review'===_0x541324?this['icon']=_0x5af653:'translate'===_0x541324&&(this['icon']=_0x3549b8);}},sa=class extends _0x5afcc4{['listView'];constructor(_0x3d51a8,_0x171c02){super(_0x3d51a8),this['set']('isEnabled',!0x0);const _0x1647e7=_0x171c02['map'](_0x44e6ad=>{const _0x53d60c=new zt(this['locale']),_0x3f4732=new ia(this['locale'],_0x44e6ad);return _0x3f4732['bind']('isEnabled')['to'](this),_0x53d60c['children']['add'](_0x3f4732),_0x3f4732['delegate']('execute')['to'](this),_0x53d60c;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x1647e7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const na='chat-shortcuts';var ra=class extends _0x215b79{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Go];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Go),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x14c0a4=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x5e7d2f=_0x14c0a4['activeConversation'];_0x5e7d2f['isFromHistory']||this['_injectShortcuts'](_0x5e7d2f);}),this['listenTo'](_0x14c0a4,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x34a03=['chat','review','translate'];this['_shortcuts']['forEach'](_0x441b0e=>{let _0x366686=!0x0;if(_0x441b0e['id']&&_0x441b0e['label']&&_0x34a03['includes'](_0x441b0e['type'])?'chat'===_0x441b0e['type']&&(_0x366686='string'==typeof _0x441b0e['prompt']):_0x366686=!0x1,!_0x366686)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x441b0e});});}['_injectShortcuts'](_0x59698d){this['_removeShortcuts'](),this['_shortcutsView']=new sa(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],na),this['_shortcutsView']['on']('execute',_0x5347a4=>{const _0x529ff5=_0x5347a4['source']['id'];this['_executeShortcut'](_0x529ff5);}),this['_listenedConversation']=_0x59698d,this['listenTo'](_0x59698d,'uploadProgressChanged',(_0x2f3c71,_0x29ad16)=>{this['_shortcutsView']['isEnabled']=!_0x29ad16['isUploadInProgress'];});}['_removeShortcuts'](){const _0x2f3588=this['context']['plugins']['get'](Go);_0x2f3588['hasFeedItem'](na)&&_0x2f3588['removeFeedItem'](na),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x588073){const _0x3c278a=this['_shortcuts']['find'](_0x5a03a0=>_0x5a03a0['id']===_0x588073),_0x510152=_0x3c278a['type'];'chat'===_0x510152?this['_runChatShortcut'](_0x3c278a):'review'===_0x510152?_0x3c278a['commandId']?this['_runReviewShortcut'](_0x3c278a):this['_switchTab']('reviewMode'):'translate'===_0x510152&&(_0x3c278a['language']?this['_runTranslateShortcut'](_0x3c278a):this['_switchTab']('translate'));}['_switchTab'](_0x585497){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x585497});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x585497);}async['_runChatShortcut']({prompt:_0x6ffbb0,draftMode:_0x36a724,useWebSearch:_0x1d7616=!0x1,useReasoning:_0x2105ae=!0x1,model:_0x5c21cc}){const _0x2ca265=this['context']['plugins']['get']('AIChatController'),_0x35462b=_0x2ca265['activeConversation'];let _0x5c3c87;_0x5c3c87=_0x5c21cc?await _0x35462b['chatModels']['getModel'](_0x5c21cc):await _0x35462b['chatModels']['getDefault'](),_0x5c3c87&&await _0x35462b['setModel'](_0x5c3c87),_0x35462b['setWebSearch'](_0x1d7616),_0x35462b['setReasoning'](_0x2105ae),_0x2ca265['addCurrentDocumentToChatContext'](),_0x36a724?(this['_aiChatUI']['setPromptInputValue'](_0x6ffbb0),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x2ca265['sendMessage']({'message':_0x6ffbb0});}['_runReviewShortcut']({commandId:_0x12d7a0,model:_0x308128,prompt:_0xab4fb9,params:_0xf672c7}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x21e603={'id':_0x12d7a0,'isCustom':'custom'===_0x12d7a0};_0x308128&&_0xab4fb9&&(_0x21e603['args']={'model':_0x308128,'prompt':_0xab4fb9}),_0xf672c7&&(_0x21e603['params']=_0xf672c7),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x21e603);}['_runTranslateShortcut']({language:_0x826f02}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x826f02,'args':{'language':_0x826f02}});}},oa=class extends _0x362678{constructor(_0x2e7a0c){super(_0x2e7a0c);const _0x589407=_0x2e7a0c['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x589407,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x30400b=this['editor']['plugins']['get']('AITabs')['view'];_0x30400b['isVisible']=!_0x30400b['isVisible'];}},aa=class extends _0x538f78{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xe8441b=this['editor'];_0xe8441b['commands']['add']('toggleAi',new oa(_0xe8441b)),_0xe8441b['ui']['componentFactory']['add']('toggleAi',()=>{const _0x3b7a7f=this['_createAIUIButton'](Ht);return _0x3b7a7f['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x3b7a7f;}),_0xe8441b['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3a13b0=this['_createAIUIButton'](Jt);return _0x3a13b0['set']({'role':'menuitemcheckbox'}),_0x3a13b0;});}['_createAIUIButton'](_0x45689a){const _0x5da39d=this['editor'],_0x1968e2=_0x5da39d['commands']['get']('toggleAi'),_0xa7a010=new _0x45689a(_0x5da39d['locale']);return _0xa7a010['set']({'label':us(_0x5da39d['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x37bee7,'isToggleable':!0x0}),_0xa7a010['bind']('isEnabled')['to'](_0x1968e2),_0xa7a010['bind']('isOn')['to'](_0x1968e2,'value',_0x5a457e=>!!_0x5a457e),this['listenTo'](_0xa7a010,'execute',()=>{_0x1968e2['execute']();}),_0xa7a010;}};const ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ca=class extends _0x5afcc4{['_errorView'];constructor(_0x4d28c0){super(_0x4d28c0),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x20e3f1){this['showError'](_0x20e3f1);}['showError'](_0x4c36f8){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x4c36f8,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x5ddc38=new _0x5afcc4(this['locale']),_0x409d36=new _0x5afcc4(this['locale']);return _0x409d36['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x5ddc38['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x3606a5=>!_0x3606a5)]},'children':[_0x409d36]}),_0x5ddc38;}};const la=0xa;var ua=class extends _0x215b79{static get['requires'](){return[Is];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x3ac811){const {id:_0x35fb4c}=this['_currentConfig']??{};this['_currentConfig']=_0x3ac811,this['_editor']=_0x3ac811['targetEditor'];const {id:_0x5a0333}=this['_currentConfig'];this['isOpen']&&_0x35fb4c===_0x5a0333?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x56a48e=this['_editor'];if(!_0x56a48e)return;const _0x5826de=_0x56a48e['plugins']['get']('Dialog');_0x5826de['isOpen']&&this['_currentConfig']&&_0x5826de['id']===this['_currentConfig']['id']&&_0x5826de['hide']();}['_updateDialog'](){const _0x48a6b6=this['_editor']['plugins']['get']('Dialog'),{icon:_0x409f59,title:_0x46911f}=this['_currentConfig'];_0x48a6b6['view']?.['headerView']&&(_0x48a6b6['view']['headerView']['label']=_0x46911f,_0x48a6b6['view']['headerView']['iconView']&&_0x409f59&&(_0x48a6b6['view']['headerView']['iconView']['content']=_0x409f59)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x48a6b6['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Is)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Is)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x113308=this['_editor']['plugins']['get']('Dialog'),{id:_0x1c0e9e,title:_0x2ff8c3,icon:_0x499293,class:_0x116014,mainView:_0x50627b}=this['_currentConfig'];_0x50627b['delegate'](...ha)['to'](this),_0x113308['show']({'title':_0x2ff8c3,'icon':_0x499293,'hasCloseButton':!0x0,'id':_0x1c0e9e,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x116014||''),'content':_0x50627b,'onShow':_0x590b59=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x590b59['view']?.['updatePosition']();const _0x81f9fa=this['_getSelectionElements']();_0x81f9fa&&_0x81f9fa[0x0]&&Rt({'target':_0x81f9fa[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x590b59['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x1c0e9e});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x1c0e9e}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x4b478b,_0x2692af,_0x8344db){const _0x3f23d4=_0x2692af||_0x8344db;if(!_0x3f23d4)return null;const _0x552b00=this['_getSelectionElements']();if(!_0x552b00||0x0===_0x552b00['length'])return{'left':Math['round'](_0x3f23d4['left']+_0x3f23d4['width']/0x2-_0x4b478b['width']/0x2),'top':Math['round'](_0x3f23d4['top']+_0x3f23d4['height']/0x2-_0x4b478b['height']/0x2)};const _0x165e63=Math['round'](_0x3f23d4['left']+_0x3f23d4['width']/0x2-_0x4b478b['width']/0x2),_0x5947db=_0x552b00['map'](_0x169681=>new At(_0x169681)),_0x585d6e=_0x4b478b['height'];return{'left':_0x165e63,'top':this['_calculateOptimalTopPosition'](_0x5947db,_0x585d6e,_0x3f23d4)};}['_calculateOptimalTopPosition'](_0x705cfc,_0x35acd4,_0x5233ae){const _0x3723fb=new At(Tt['window']),_0x200b03=_0x705cfc['map'](_0xfd077d=>_0xfd077d['getVisible']())['filter'](_0x1389bd=>_0x1389bd),_0xb3d603=At['getBoundingRect'](_0x200b03);if(!_0xb3d603)return Math['round'](_0x5233ae['top']+_0x5233ae['height']/0x2);const _0x42dd6c=_0x3723fb['getIntersection'](_0xb3d603);if(!_0x42dd6c)return Math['round'](_0x5233ae['top']+_0x5233ae['height']/0x2);const _0x18ee69=_0x5233ae['getVisible'](),_0x12d99c=_0x18ee69&&_0xb3d603['height']>_0x18ee69['height'],_0x31af37=_0x42dd6c['top'],_0x55cb97=_0x42dd6c['bottom'];if(_0x12d99c){const _0x5a042a=_0x3723fb['top']+_0x3723fb['height']/0x2-_0x35acd4/0x2,_0x493ffc=_0x31af37-la-_0x3723fb['top'],_0xe124aa=_0x3723fb['bottom']-_0x55cb97-la;return _0x493ffc>=_0x35acd4?Math['max'](la,_0x31af37-_0x35acd4-la):_0xe124aa>=_0x35acd4?_0x55cb97+la:Math['max'](la,_0x5a042a);}const _0xcc0256=_0x31af37-_0x35acd4,_0x435028=_0x3723fb['bottom']-_0x55cb97-la,_0x5913d2=_0x31af37-la-_0x3723fb['top'];let _0x95d25;return _0x95d25=_0x435028>=_0x35acd4?_0x55cb97+la:_0x5913d2>=_0x35acd4?_0xcc0256-la:_0x31af37+_0xb3d603['height']/0x2-_0x35acd4/0x2,_0x95d25;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x184256=this['_editor'];this['listenTo'](_0x184256['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x2dadb7,data:{newRange:_0x2cd556}}of _0x184256['model']['document']['differ']['getChangedMarkers']())if(_0x2dadb7['startsWith']('ai-selection:')&&(_0x2cd556&&(_0x2cd556['start']['isEqual'](_0x2cd556['end'])||'$graveyard'==_0x2cd556['root']['rootName'])||null==_0x2cd556)){const _0x20f0d9=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x20f0d9),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x5dd203=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x5dd203['model']['document']);}['_getSelectionElements'](){const _0xdf809f=this['_editor'];return _0x480ed2(_0xdf809f['editing'],[..._0xdf809f['model']['markers']['getMarkersGroup']('ai-selection'),..._0xdf809f['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x5175e8=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x5175e8&&_0x5175e8['rootName']?_0x5175e8['rootName']:null;}},da=class extends _0x515f62{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0xe8dc28,_0xbc0258={}){super(_0xe8dc28),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0xbc0258};const _0x1b288c=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x1b288c?'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'](_0x5c277a){this['showChangesButton']['isEnabled']=_0x5c277a;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':ln,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Ht(this['locale']),this['dislikeButton']['set']({'icon':rt,'label':us(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':ln,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Ht(this['locale']),this['copyButton']['set']({'icon':_0x2b1f4f,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+ln,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x10d187=new Yt();_0x10d187['set']({'content':_0x3c5aaf}),_0x10d187['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'+ln,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+ln;},0x7d0);}),this['copyButton']['children']['add'](_0x10d187);}['_setupShowChangesButton'](){this['showChangesButton']=new Ht(this['locale']),this['showChangesButton']['set']({'icon':tt,'label':us(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':ln}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x54ff5c=>_0x54ff5c?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},_a=class extends ca{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x223a58,_0x1057fd){super(_0x223a58);const _0x27df83=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x1057fd,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new Qn(_0x223a58),this['_partToolbarView']=new Yn(_0x223a58,_0x1057fd['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x1057fd),this['_stateView']=new Kn(_0x223a58),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new da(_0x223a58,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new ga(_0x223a58,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x1f82e2,_0x2701cb,_0x466997,_0x5bc3b1)=>{let _0x4818a4,_0x43f535;'pending'===_0x5bc3b1?(_0x4818a4=this['_partToolbarView'],_0x43f535=this['_stateView']):(_0x4818a4=this['_stateView'],_0x43f535=this['_partToolbarView']),this['_stateView']['setState'](_0x466997),_0x4818a4['isVisible']=!0x1,_0x43f535['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x27df83['to']('_state',_0x14b8b6=>'ck-ai-chat-balloon-main_state_'+_0x14b8b6)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x1057fd);});}['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'](_0x120836){_0x120836?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x120836);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x1cfdc3){this['_state']=_0x1cfdc3;}['showError'](_0xc9c07b){super['showError'](_0xc9c07b),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x4b278a){super['showBlockingError'](_0x4b278a),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x30e8c0){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x30e8c0;}['togglePartToolbarEnabled'](_0xc8fb08){this['_partToolbarView']['isEnabled']=_0xc8fb08;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x3554bd,showSuggestButton:_0x486dab}){_0x3554bd=_0x3554bd&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x486dab=_0x486dab&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x3554bd,'showSuggestButton':_0x486dab});}['_createNextButtonView'](){const _0x5df66f=new Ht(this['locale']);return _0x5df66f['set']({'icon':_0x19898b,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x5df66f['on']('execute',()=>{this['fire']('showNext');}),_0x5df66f;}['_createPreviousButtonView'](){const _0x4c8ebc=new Ht(this['locale']);return _0x4c8ebc['set']({'icon':_0x212ef3,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x4c8ebc['on']('execute',()=>{this['fire']('showPrevious');}),_0x4c8ebc;}},ga=class extends _0x5afcc4{constructor(_0x22afac,_0x17e677){super(_0x22afac),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x17e677});}},Aa=class extends _0x538f78{static get['requires'](){return[Mt,ua];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x31f8bf){super(_0x31f8bf),this['set']('showDiff',!0x1);}['open'](_0x2e07a4){const _0x1ac950=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x1ac950['plugins']['get']('AIBalloon')['open']({..._0x2e07a4,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x2e07a4['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x2e07a4['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x3e63e2){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x3e63e2);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x35a537){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x35a537);}['_createChatBalloonView'](){const _0x55d10a=this['editor'],_0x3b6cd1=_0x55d10a['plugins']['get']('AIBalloon'),_0x423ced=_0x55d10a['commands']['get']('trackChanges');let _0x1d792d=_0x55d10a['config']['get']('ai.availableReplyActions')||[...ir];_0x55d10a['plugins']['has']('TrackChanges')||(_0x1d792d=_0x1d792d['filter'](_0x2394a7=>'insertSuggestion'!=_0x2394a7));const _0x5cb8a7=new _a(_0x55d10a['locale'],{'availableActions':_0x1d792d,'showApplyButton':!0x0,'showSuggestButton':!!_0x423ced});return _0x5cb8a7['bind']('showDiff')['to'](this),_0x5cb8a7['delegate'](...yn)['to'](this),_0x5cb8a7['delegate']('showPrevious','showNext')['to'](this),_0x3b6cd1['delegate']('dialogClosed')['to'](this),_0x5cb8a7['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5cb8a7['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5cb8a7['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x423ced&&_0x5cb8a7['bind']('isTrackChangesOn')['to'](_0x423ced,'value'),_0x5cb8a7['render'](),_0x5cb8a7;}['_toggleRotatorButtonsInDialogHeader'](_0xedcf04){const _0x51dcb9=this['editor'],_0x1a1aff=_0x51dcb9['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0xedcf04),_0x1a1aff['has'](this['_chatBalloonView']['previousButtonView'])||(_0x1a1aff['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x51dcb9['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x1a1aff['remove'](this['_chatBalloonView']['previousButtonView']),_0x1a1aff['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Ia=class extends _0x538f78{static get['requires'](){return[aa,Aa,_0x701e23];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function pa(_0x54f150){const {editor:_0x432569,action:_0x4296bf,withText:_0x5e58e5=!0x1,withIcon:_0x5029d0=!0x0,isInDropdown:_0x26618d=!0x0,shouldPreventFocus:_0x2438b6=!0x1,actionButtons:_0x214da1}=_0x54f150;return()=>{const _0x1ec760=_0x432569['locale'],_0x193eed=new Ht(_0x1ec760),_0x5d6aa0=_0x193eed['bindTemplate'];_0x26618d&&_0x193eed['extendTemplate']({'on':{'mouseenter':_0x5d6aa0['to'](()=>{_0x2438b6&&_0x2438b6()||_0x193eed['focus']();})}}),_0x214da1['push']({'buttonView':_0x193eed,'action':_0x4296bf});const _0x33af69=_0x4296bf['icon']??_0x4296bf['parent']?.['icon'];return _0x193eed['set']({'label':_0x4296bf['label'],'withText':_0x5e58e5,'role':'menuitem','icon':_0x5029d0?_0x33af69??_0x37448c:void 0x0,'tooltip':!_0x5e58e5,'class':'ck-ai-quick-actions-button','isEnabled':_0x4296bf['isEnabled']}),_0x193eed['on']('execute',()=>{_0x432569['editing']['view']['focus'](),_0x432569['commands']['execute']('aiQuickAction',_0x4296bf);}),_0x193eed;};}var ma=class extends Qt{['arrowView'];constructor(_0x9e4813,_0x7e47f3){super(_0x9e4813,_0x7e47f3);const _0x57bc18=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',_0xb7860e=>String(_0xb7860e)),'data-cke-tooltip-disabled':_0x57bc18['to']('isOn')},'on':{'mouseenter':_0x57bc18['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x3692b5=new Yt();return _0x3692b5['content']=_0x899818,_0x3692b5['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x3692b5;}},Ea=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x537ed6,_0x5f0b67,_0x44a183){super(_0x537ed6),this['_allListItems']=_0x5f0b67,this['_allSearchableItems']=_0x44a183;}['filter'](_0x5bb65f){if(!_0x5bb65f)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x591d72=_0x5bb65f['source']['toLowerCase']()['trim'](),_0x13aab5=this['_allSearchableItems']['filter'](_0x31c822=>(_0x31c822['groupLabel']?_0x31c822['label']+'\x20('+_0x31c822['groupLabel']+')':_0x31c822['label'])['toLowerCase']()['includes'](_0x591d72));return this['items']['clear'](),this['items']['addMany'](_0x13aab5['sort']((_0x3a4fbb,_0x376568)=>{const _0x3edf68=_0x3a4fbb['groupLabel'],_0x336d31=_0x376568['groupLabel'];return _0x3edf68||_0x336d31?_0x3edf68?0x1:-0x1:0x0;})['map'](_0x46bcea=>_0x46bcea['item'])),this['_highlightQuery'](_0x591d72,_0x13aab5),{'resultsCount':_0x13aab5['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x57537c,_0x391e6d){if(!_0x57537c)return;const _0x21e777=new RegExp(_0x515f94(_0x57537c),'gi');_0x391e6d['forEach'](_0x13e72a=>{_0x13e72a['highlightViews']&&_0x13e72a['highlightViews']['forEach'](_0x2ea8d5=>{'function'==typeof _0x2ea8d5['highlightText']&&_0x2ea8d5['highlightText'](_0x21e777);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x39bc22=>{_0x39bc22['highlightViews']&&_0x39bc22['highlightViews']['forEach'](_0x3481bc=>{'function'==typeof _0x3481bc['highlightText']&&_0x3481bc['highlightText'](null);});});}};const Ta='menu',wa='menuitem';var Ca=class extends _0x5afcc4{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x158336,_0x265bd4,_0x34068e,_0x17591b,_0x6aa2b9=!0x1,_0x300413=[]){const _0xee715f=_0x158336['locale'];super(_0xee715f),this['_bodyCollection']=_0x17591b,this['_hasSearch']=_0x6aa2b9,this['_actionButtons']=_0x300413;const _0x468087=this['_createListItems'](_0x158336,_0x265bd4,_0x34068e);this['optionsListView']=new Ea(_0xee715f,_0x468087,this['_allSearchableItems']),this['optionsListView']['role']=Ta,this['optionsListView']['items']['addMany'](_0x468087),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x6aa2b9&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x468087,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x6aa2b9&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x5a9fa8=_0x6aa2b9&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x1c61f8(_0x5a9fa8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0xee715f['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x53ae11(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x1eb85b=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x1eb85b);}['_createListItems'](_0x1d283d,_0x5a71ef,_0x4e4075){const _0x2e63d0=new _0x1c61f8();return _0x5a71ef['forEach'](_0x3e74ba=>{if('actions'in _0x3e74ba){const {listItem:_0x5f5335}=this['_createActionGroupButton'](_0x1d283d,_0x3e74ba,_0x4e4075);_0x2e63d0['add'](_0x5f5335),_0x3e74ba['actions']['forEach'](_0x46c965=>{const {listItem:_0x474bbf,highlightViews:_0xbccf}=this['_createSearchResultActionButton'](_0x1d283d,_0x46c965,_0x3e74ba['label'],_0x3e74ba['icon']);this['_allSearchableItems']['push']({'item':_0x474bbf,'label':_0x46c965['label'],'groupLabel':_0x3e74ba['label'],'highlightViews':_0xbccf});});}else{const {listItem:_0x457c1f}=this['_createActionButton'](_0x1d283d,_0x3e74ba);_0x2e63d0['add'](_0x457c1f);const _0x534290=_0x457c1f['children']['first'];if(_0x534290){const {listItem:_0x4fd24e,highlightViews:_0x345cc6}=this['_createSearchResultActionButton'](_0x1d283d,_0x3e74ba);this['_allSearchableItems']['push']({'item':_0x4fd24e,'label':_0x534290['label']||'','highlightViews':_0x345cc6});}}}),_0x2e63d0;}['_createActionButton'](_0x2df2b4,_0x28fd89,_0x12d9b2,_0xb456d2){const _0x277d7d=new zt(this['locale']);if(_0x12d9b2&&_0xb456d2){const _0x2c0baa=new Ht(this['locale']),_0x1b5244=_0x2c0baa['bindTemplate'],_0x2ef9c8=new Wt();_0x2ef9c8['text']=_0x28fd89['label'];const _0x1a2d87=new Wt();_0x1a2d87['text']=_0x12d9b2;const _0x4f6be4=new Yt();_0x4f6be4['content']=_0xb456d2,_0x4f6be4['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x119495=new _0x5afcc4(this['locale']);_0x119495['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x3bf07b=new _0x5afcc4(this['locale']);return _0x3bf07b['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x2c0baa['set']({'label':_0x28fd89['label']+'\x20('+_0x12d9b2+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x28fd89['isEnabled']}),_0x2c0baa['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x1b5244['if']('isEnabled','ck-disabled',_0x3df0f2=>!_0x3df0f2)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2ef9c8,_0x119495,_0x4f6be4,_0x1a2d87,_0x3bf07b],'on':{'mouseenter':_0x1b5244['to'](()=>{this['_isSearchFocused']()||_0x2c0baa['focus']();}),'click':_0x1b5244['to'](()=>{_0x2c0baa['fire']('execute');})}}),_0x2c0baa['on']('execute',()=>{_0x2c0baa['isEnabled']&&(_0x2df2b4['editing']['view']['focus'](),_0x2df2b4['commands']['execute']('aiQuickAction',_0x28fd89));}),_0x277d7d['children']['add'](_0x2c0baa),this['_actionButtons']['push']({'buttonView':_0x2c0baa,'action':_0x28fd89}),{'listItem':_0x277d7d,'highlightViews':[_0x2ef9c8,_0x1a2d87]};}{const _0x5d6767=new Pt(),_0x410676=new Ht(this['locale'],_0x5d6767),_0x319cb3=_0x410676['bindTemplate'],_0x514b51=_0x28fd89['icon']??_0x28fd89['parent']?.['icon'],_0x43211e=void 0x0!==_0x28fd89['icon'];return _0x410676['set']({'label':_0x28fd89['label'],'withText':!0x0,'role':'menuitem','icon':_0x43211e?_0x514b51??_0x37448c:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x28fd89['isEnabled']}),_0x410676['extendTemplate']({'on':{'mouseenter':_0x319cb3['to'](()=>{this['_isSearchFocused']()||_0x410676['focus']();})}}),_0x410676['on']('execute',()=>{_0x2df2b4['editing']['view']['focus'](),_0x2df2b4['commands']['execute']('aiQuickAction',_0x28fd89);}),_0x277d7d['children']['add'](_0x410676),this['_actionButtons']['push']({'buttonView':_0x410676,'action':_0x28fd89}),{'listItem':_0x277d7d,'highlightViews':[_0x5d6767]};}}['_createSearchResultActionButton'](_0x16ad66,_0x4e9c02,_0x1b575b,_0x1c3c51){return _0x1b575b&&_0x1c3c51?this['_createSearchResultGroupedActionButton'](_0x16ad66,_0x4e9c02,_0x1b575b,_0x1c3c51):this['_createSearchResultIndividualActionButton'](_0x16ad66,_0x4e9c02);}['_createSearchResultGroupedActionButton'](_0x176362,_0x569561,_0x46ecd8,_0x29ebd7){const _0x21404a=new zt(this['locale']),_0x2b28ba=new Ht(this['locale']),_0x2eb135=_0x2b28ba['bindTemplate'],{view:_0x3ef87d,highlightView:_0x1b650f}=this['_createSearchResultGroupRow'](_0x46ecd8,_0x29ebd7),{view:_0x3239ab,highlightView:_0x369468}=this['_createSearchResultActionRow'](_0x569561['label']),_0x8e795f=this['_createSearchResultContentView'](_0x3ef87d,_0x3239ab);return _0x2b28ba['set']({'label':_0x569561['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':_0x569561['isEnabled']}),_0x2b28ba['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',_0x2eb135['if']('isEnabled','ck-disabled',_0x20e637=>!_0x20e637)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x8e795f],'on':{'mouseenter':_0x2eb135['to'](()=>{this['_isSearchFocused']()||_0x2b28ba['focus']();}),'click':_0x2eb135['to'](()=>{this['_handleSearchResultButtonClick'](_0x2b28ba);})}}),this['_setupActionButtonExecution'](_0x2b28ba,_0x176362,_0x569561),_0x21404a['children']['add'](_0x2b28ba),this['_actionButtons']['push']({'buttonView':_0x2b28ba,'action':_0x569561}),{'listItem':_0x21404a,'highlightViews':[_0x1b650f,_0x369468]};}['_createSearchResultIndividualActionButton'](_0xf99eb0,_0x1b42bb){const _0x51ca39=new zt(this['locale']),_0x27daf7=new Pt(),_0x50572b=new Ht(this['locale'],_0x27daf7),_0x2e8886=_0x50572b['bindTemplate'];return _0x50572b['set']({'label':_0x1b42bb['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x1b42bb['isEnabled']}),_0x50572b['extendTemplate']({'on':{'mouseenter':_0x2e8886['to'](()=>{this['_isSearchFocused']()||_0x50572b['focus']();})}}),this['_setupActionButtonExecution'](_0x50572b,_0xf99eb0,_0x1b42bb),_0x51ca39['children']['add'](_0x50572b),this['_actionButtons']['push']({'buttonView':_0x50572b,'action':_0x1b42bb}),{'listItem':_0x51ca39,'highlightViews':[_0x27daf7]};}['_createSearchResultGroupRow'](_0x9b6398,_0xd7de36){const _0x23c370=new _0x5afcc4(this['locale']),_0x1c491d=new Yt();_0x1c491d['content']=_0xd7de36,_0x1c491d['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x59e0bc=new Wt();return _0x59e0bc['text']=_0x9b6398,_0x23c370['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x1c491d,_0x59e0bc]}),{'view':_0x23c370,'highlightView':_0x59e0bc};}['_createSearchResultActionRow'](_0x34b955){const _0x34bd59=new _0x5afcc4(this['locale']),_0x276d68=new Wt();return _0x276d68['text']=_0x34b955,_0x34bd59['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x276d68]}),{'view':_0x34bd59,'highlightView':_0x276d68};}['_createSearchResultContentView'](_0x330e29,_0x4f7e67){const _0x37e5b7=new _0x5afcc4(this['locale']);return _0x37e5b7['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x330e29,_0x4f7e67]}),_0x37e5b7;}['_setupActionButtonExecution'](_0x13046b,_0x13fa39,_0x1f1916){_0x13046b['on']('execute',()=>{_0x13046b['isEnabled']&&(_0x13fa39['editing']['view']['focus'](),_0x13fa39['commands']['execute']('aiQuickAction',_0x1f1916));});}['_createActionGroupButton'](_0x22bf69,_0x5c7351,_0x5e1913){const _0x1fbbc0=new zt(this['locale']),_0x228ceb=new Pt(),_0x46c18c=new ma(this['locale'],_0x228ceb),_0x224da4=_0x46c18c['bindTemplate'],_0x9cd39a=this['_getPanelKeystroke'](_0x5e1913),_0x2583fa=this['_createGroupActionsList'](_0x22bf69,_0x5c7351['actions'],_0x5e1913);_0x46c18c['set']({'label':_0x5c7351['label'],'withText':!0x0,'role':wa,'icon':_0x5c7351['icon']??_0x37448c,'isEnabled':_0x5c7351['actions']['some'](_0x4b3f87=>_0x4b3f87['isEnabled'])}),_0x46c18c['extendTemplate']({'on':{'mouseenter':_0x224da4['to'](()=>{this['_isSearchFocused']()||_0x46c18c['focus']();})}});const _0x1c5188=new yt(this['locale']);return _0x1c5188['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x224da4['to'](_0x5e0160=>{this['_handlePanelKeydown'](_0x5e0160,_0x9cd39a,_0x46c18c,_0x1c5188);})}}),_0x46c18c['bind']('isOn')['to'](_0x1c5188,'isVisible'),this['_bodyCollection']['add'](_0x1c5188),_0x1c5188['content']['add'](_0x2583fa),this['_setupGroupMenuBehavior'](_0x46c18c,_0x1c5188),_0x1fbbc0['children']['add'](_0x46c18c),this['_actionButtons']['push']({'buttonView':_0x46c18c,'action':_0x5c7351}),{'listItem':_0x1fbbc0,'highlightView':_0x228ceb};}['_createGroupActionsList'](_0x542c0e,_0x324f86,_0x4a49af){const _0x26000f=new jt(this['locale']);return _0x26000f['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x324f86['forEach'](_0x3ebd49=>{const _0x1e1be5=new zt(this['locale']),_0xc5eed4=pa({'editor':_0x542c0e,'action':_0x3ebd49,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x1e1be5['children']['add'](_0xc5eed4),_0x4a49af['focusTracker']['add'](_0xc5eed4),_0x26000f['items']['add'](_0x1e1be5);}),_0x26000f;}['_setupGroupMenuBehavior'](_0xe9755,_0x36790f){const _0x550a70=_0xe9755['bindTemplate'],_0x5d3334=this['_getButtonKeystroke'](_0xe9755);_0xe9755['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x550a70['to'](()=>{this['_showNestedPanel'](_0x36790f,_0xe9755);}),'mouseleave':_0x550a70['to'](_0x535429=>{const _0x4d2c42=_0x535429['relatedTarget'];this['_isMovingToNestedMenu'](_0x4d2c42,_0x36790f)||this['_hideNestedPanel'](_0x36790f);}),'keydown':_0x550a70['to'](_0xeab324=>{_0xeab324['key']==_0x5d3334&&(this['_showNestedPanel'](_0x36790f,_0xe9755),_0x36790f['content']['get'](0x0)['focus']());})}}),_0x36790f['on']('render',()=>{_0x36790f['element']?.['addEventListener']('mouseleave',_0x1e6cf3=>{const _0x45d2d3=_0x1e6cf3['relatedTarget'];_0xe9755['element']?.['contains'](_0x45d2d3)||this['_isMovingToNestedMenu'](_0x45d2d3,_0x36790f)||this['_hideNestedPanel'](_0x36790f);});});}['_showNestedPanel'](_0x1c59e0,_0xe47706){this['_openNestedPanels']['forEach'](_0x2c39bc=>{_0x2c39bc!==_0x1c59e0&&_0x2c39bc['isVisible']&&_0x2c39bc['hide']();}),_0x1c59e0['show'](),_0x1c59e0['pin']({'positions':[Ut['eastSouth']],'target':_0xe47706['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x1c59e0);}['_hideNestedPanel'](_0x63c371){_0x63c371['hide'](),this['_openNestedPanels']['delete'](_0x63c371);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x3bf23c=>_0x3bf23c['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x5ce604,_0x3e08c4){if(!_0x5ce604)return!0x1;if(_0x3e08c4['element']?.['contains'](_0x5ce604))return!0x0;const _0x437cc4=_0x5ce604;return _0x437cc4['closest']&&(null!==_0x437cc4['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x437cc4['closest']('.ck-ai-quick-actions-group-list')||null!==_0x437cc4['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'](_0x4f4b17){return'rtl'===_0x4f4b17['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x589f7e){return'rtl'===_0x589f7e['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x272522,_0x4a488f,_0x51342f,_0xfe7a94){_0x272522['key']==_0x4a488f&&(_0x51342f['focus'](),this['_hideNestedPanel'](_0xfe7a94));}['_handleSearchResultButtonClick'](_0x1c6a29){_0x1c6a29['fire']('execute');}};function fa(_0x9f6d6e){const {editor:_0x5db502,content:_0x53fd0f,buttonDefinition:_0x53772e,bodyCollection:_0x2d9481,hasSearch:_0x269192=!0x1,actionButtons:_0x313400}=_0x9f6d6e;return()=>{const _0x5b5da3=_0x5db502['locale'],_0x48af3a=_0x5db502['commands']['get']('aiQuickAction'),_0x568d26=_0x178550(_0x5b5da3);_0x568d26['bind']('isEnabled')['to'](_0x48af3a),_0x568d26['buttonView']['set']({'icon':_0x53772e['icon']??_0x37448c,'label':_0x53772e['label'],'tooltip':!0x0}),_0x568d26['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x3a288e=new Ca(_0x5db502,_0x53fd0f,_0x568d26,_0x2d9481,_0x269192,_0x313400);return _0x568d26['panelView']['children']['add'](_0x3a288e),_0x269192&&_0x568d26['on']('change:isOpen',(_0x52d40e,_0x1442b7,_0x2d429b)=>{if(_0x2d429b){if(_0x5db502['plugins']['has']('AIEditing')){const _0x1ccd8f=_0x5db502['plugins']['get'](Is),_0x3c60c2=_0x5db502['model']['document']['selection'],_0x18a4bd=Array['from'](_0x3c60c2['getRanges']());_0x18a4bd['length']>0x0&&_0x1ccd8f['showFakeVisualSelection']({'editor':_0x5db502,'ranges':_0x18a4bd,'id':'quick-action','priority':0x14});}}else _0x5db502['plugins']['has']('AIEditing')&&_0x5db502['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x3a288e['resetSearch']();}),_0x568d26;};}const ba='<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>',Sa='<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>',Ra='<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>',Oa=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var va=class AIQuickActionsUI extends _0x538f78{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,on];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiquickactions');const _0x1d6d3d=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x1d6d3d),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x3210b2){return function(_0x47f49f){const _0x2a1fa2=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x47f49f['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x47f49f,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x4b0e14},{'id':'chat-commands','label':us(_0x47f49f,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x4b0e14,'actions':[{'id':'explain','label':us(_0x47f49f,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x47f49f,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':ba['replace']('%0',_0x2a1fa2),'type':'chat'},{'id':'summarize','label':us(_0x47f49f,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x47f49f,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Sa['replace']('%0',_0x2a1fa2),'type':'chat'},{'id':'highlight-key-points','label':us(_0x47f49f,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x47f49f,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Ra['replace']('%0',_0x2a1fa2),'type':'chat'}]},{'id':'improve-writing','label':us(_0x47f49f,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x1142df},{'id':'continue','label':us(_0x47f49f,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x1286c5},{'id':'fix-grammar','label':us(_0x47f49f,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x57ee30},{'id':'adjust-length','label':us(_0x47f49f,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2c8297,'actions':[{'id':'make-shorter','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x47f49f,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2cd5e6,'actions':[{'id':'make-tone-casual','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x47f49f,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x3549b8,'actions':[{'id':'translate-to-english','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x47f49f,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x47f49f,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x4b0fbc,'actions':[]}];}(_0x3210b2);}['_getDefaultAndCustomActions'](){const _0x5b6338=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x411ea8=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x3f323a=>({..._0x3f323a,'type':'chat'===_0x3f323a['type']?'chat':'action','icon':void 0x0}));return _0x5b6338['find'](_0x53d0c6=>'other'===_0x53d0c6['id'])['actions']['push'](..._0x411ea8),_0x5b6338;}async['_initActionTypeQuickActions'](){try{const _0x1440e9=new zs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x27319c=await _0x1440e9['getAll'](),_0x20b820=(await _0x1440e9['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x20b820),this['_enableButtonsByType']('action',_0x27e13b=>!!_0x27319c['find'](_0x48536d=>_0x48536d['id']===_0x27e13b['model'])||void 0x0===_0x27e13b['model']);}catch(_0x33315b){const _0xaf691a=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x33315b});this['_reporter']['logError'](_0xaf691a);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x3a30db=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x3a30db,'change:isConversationReady',(_0x50b7ab,_0x361247,_0xd91c5d)=>{_0xd91c5d&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x3a30db['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3edebf,_0x2f3c51){this['_quickActionsDefinition']['forEach'](_0x4264f3=>{'actions'in _0x4264f3?_0x4264f3['actions']['forEach'](_0x3c6d47=>{_0x3c6d47['type']===_0x3edebf&&(_0x3c6d47['isEnabled']=_0x2f3c51(_0x3c6d47));}):_0x4264f3['type']===_0x3edebf&&(_0x4264f3['isEnabled']=_0x2f3c51(_0x4264f3));}),this['_actionButtons']['forEach'](_0x4c10b1=>{if(ka(_0x4c10b1['action']))return;if(_0x4c10b1['action']['type']!==_0x3edebf)return;const _0x3e7568=_0x2f3c51(_0x4c10b1['action']);if(_0x4c10b1['action']['isEnabled']=_0x3e7568,_0x4c10b1['buttonView']['isEnabled']=_0x3e7568,!_0x3e7568&&_0x4c10b1['action']['model']){const _0x55fcdd=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x4c10b1['action']['id'],'modelId':_0x4c10b1['action']['model']});this['_reporter']['logError'](_0x55fcdd);}}),this['_actionButtons']['filter'](_0x29e7a8=>ka(_0x29e7a8['action']))['forEach'](_0x3d8ce9=>{_0x3d8ce9['buttonView']['isEnabled']=_0x3d8ce9['action']['actions']['some'](_0x10c49b=>_0x10c49b['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x419f8f,group:_0x35e3aa})=>{_0x419f8f['isEnabled']=_0x35e3aa['actions']['some'](_0x3a46e3=>_0x3a46e3['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x384043){this['_actionButtons']['forEach'](_0x3fdad0=>{ka(_0x3fdad0['action'])||'action'===_0x3fdad0['action']['type']&&(_0x3fdad0['action']['model']||(_0x3fdad0['action']['model']=_0x384043));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x442f38=new Lt(this['editor']['locale']);_0x442f38['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x442f38),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x442f38);}['_initializeQuickActionsDropdown'](_0x909b6f){const _0x37c3d9=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',fa({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x37448c,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x909b6f,'hasSearch':_0x37c3d9,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x2f7000){this['_quickActionsDefinition']=_0x2f7000['map'](_0x32dec4=>{if('actions'in _0x32dec4){const _0x354a45=_0x32dec4;return{..._0x354a45,'actions':_0x354a45['actions']['map'](_0x4cb452=>{const {actions:_0x5d6b1f,..._0x7e3c00}=_0x354a45;return{..._0x4cb452,'isEnabled':!0x1,'parent':_0x7e3c00};})['filter'](_0x35b450=>this['_shouldIncludeAction'](_0x35b450))};}return{..._0x32dec4,'isEnabled':!0x1};})['filter'](_0xb6cf73=>'actions'in _0xb6cf73?_0xb6cf73['actions']['length']>0x0:this['_shouldIncludeAction'](_0xb6cf73));}['_shouldIncludeAction'](_0x50ce17){const _0xb60fd6=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Oa[_0x50ce17['type']])&&!_0xb60fd6['includes'](_0x50ce17['id'])&&!('chat'===_0x50ce17['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x35a4e1){this['_quickActionsDefinition']['forEach'](_0x2bac1e=>{if('actions'in _0x2bac1e){const _0x28a1ca=fa({'editor':this['editor'],'content':_0x2bac1e['actions'],'buttonDefinition':_0x2bac1e,'bodyCollection':_0x35a4e1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x2bac1e['id'],_0x28a1ca),_0x2bac1e['actions']['forEach'](_0x1df598=>{const _0x56af55=pa({'editor':this['editor'],'action':_0x1df598,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1df598['id'],_0x56af55);});}else{const _0x249ffd=pa({'editor':this['editor'],'action':_0x2bac1e,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x2bac1e['id'],_0x249ffd);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x4e86cc=>{const _0x58f4e5=this['editor']['commands']['get']('aiQuickAction'),_0x5b7350=new _0x2c9b8f(_0x4e86cc),_0x2a8057=us(_0x4e86cc,'AI_QUICK_ACTIONS_HEADING');_0x5b7350['buttonView']['set']({'label':_0x2a8057,'icon':_0x37448c});const _0x5ef850=new te(_0x4e86cc);return _0x5ef850['set']({'ariaLabel':_0x2a8057,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x49d13e=>{if('actions'in _0x49d13e){const _0xf1d642=_0x49d13e,_0x108ae7=new Zt(_0x4e86cc,_0x5b7350),_0x4c1d8d=new _0x2c9b8f(_0x4e86cc),_0x42011f=new te(_0x4e86cc);_0x4c1d8d['buttonView']['set']({'label':_0xf1d642['label'],'icon':_0xf1d642['icon']}),_0xf1d642['actions']['forEach'](_0x366bdd=>{const _0x3ec59a=new Zt(_0x4e86cc,_0x4c1d8d),_0xd56ce2=new Jt(_0x4e86cc);_0xd56ce2['set']({'label':_0x366bdd['label'],'icon':_0x366bdd['icon'],'role':'menuitem','isEnabled':_0x366bdd['isEnabled']}),_0xd56ce2['on']('execute',()=>{this['_executeQuickAction'](_0x366bdd);}),this['_actionButtons']['push']({'buttonView':_0xd56ce2,'action':_0x366bdd}),_0xd56ce2['delegate']('execute')['to'](_0x4c1d8d),_0x3ec59a['children']['add'](_0xd56ce2),_0x42011f['items']['add'](_0x3ec59a);}),_0x4c1d8d['isEnabled']=_0xf1d642['actions']['some'](_0x4bbcbf=>_0x4bbcbf['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x4c1d8d,'group':_0xf1d642}),_0x4c1d8d['panelView']['children']['add'](_0x42011f),_0x108ae7['children']['add'](_0x4c1d8d),_0x5ef850['items']['add'](_0x108ae7);}else{const _0x674146=_0x49d13e,_0x241738=new Zt(_0x4e86cc,_0x5b7350),_0x4eb25b=new Jt(_0x4e86cc);_0x4eb25b['set']({'label':_0x674146['label'],'icon':_0x674146['icon'],'role':'menuitem','isEnabled':_0x674146['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x4eb25b,'action':_0x674146}),_0x4eb25b['on']('execute',()=>{this['_executeQuickAction'](_0x674146);}),_0x4eb25b['delegate']('execute')['to'](_0x5b7350),_0x241738['children']['add'](_0x4eb25b),_0x5ef850['items']['add'](_0x241738);}}),Object['values'](Oa)['some'](_0xe97500=>this['editor']['plugins']['has'](_0xe97500))?_0x5b7350['bind']('isEnabled')['to'](_0x58f4e5):_0x5b7350['set']({'isEnabled':!0x1}),_0x5b7350['panelView']['children']['add'](_0x5ef850),_0x5b7350;});}['_executeQuickAction'](_0x478202){const _0x2aea77=this['editor'];_0x2aea77['editing']['view']['focus'](),_0x2aea77['commands']['execute']('aiQuickAction',_0x478202);const _0x402fe5=_0x2aea77['ui']['view']['menuBarView'];_0x402fe5&&_0x402fe5['close']&&_0x402fe5['close']();}};function ka(_0x60b21b){return'actions'in _0x60b21b;}function Na(_0x454ba9,_0x596ffd){const _0x856f05=_0x454ba9['plugins']['get']('AITabs')['view'];_0x856f05['isVisible']=!0x0,_0x856f05['activateTab'](_0x596ffd);}var ya=class extends _0x362678{['execute'](_0x2092ff){switch(this['_expandSelectionIfCollapsed'](),_0x2092ff['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x526c80=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x526c80});}this['_handleAIChatAction'](_0x2092ff);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x2d5425=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2d5425});}this['_handleAIActionsAction'](_0x2092ff);}}async['_handleAIChatAction'](_0x17dbc6){const _0x325fb2=this['editor']['plugins']['get']('AIChatController');if(Na(this['editor'],'chat'),'ask-ai'===_0x17dbc6['id'])_0x325fb2['removeSelectionFromChatContext'](),_0x325fb2['addSelectionToChatContext'](this['editor']),_0x325fb2['focusPromptInput']();else await _0x325fb2['startConversation']({'modelId':_0x17dbc6['model']}),_0x325fb2['removeSelectionFromChatContext'](),_0x325fb2['addSelectionToChatContext'](this['editor']),_0x325fb2['focusPromptInput'](),await _0x325fb2['sendMessage']({'message':_0x17dbc6['prompt']||_0x17dbc6['displayedPrompt']||_0x17dbc6['label'],'attributes':{'quickActionData':{'id':_0x17dbc6['id']},'displayedPrompt':_0x17dbc6['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x1d926c=this['editor'],_0x5a28d4=_0x1d926c['model']['document']['selection'];if(!_0x5a28d4['isCollapsed'])return;const _0x50a85e=mt(_0x5a28d4['getSelectedBlocks']())||_0x1d926c['model']['schema']['getLimitElement'](_0x5a28d4);_0x1d926c['model']['change'](_0x9d0cb9=>{_0x9d0cb9['setSelection'](_0x50a85e,'in');});}['_handleAIActionsActionLabel'](_0x436df1){return _0x436df1['parent']?.['label']&&'other'!==_0x436df1['parent']?.['id']?_0x436df1['parent']['label']+':\x20'+_0x436df1['label']:_0x436df1['label'];}async['_handleAIActionsAction'](_0x55a85d){const _0x306971=this['editor']['plugins']['get']('AIActions'),_0x4f6780=_0x55a85d['prompt']?{'userMessage':_0x55a85d['prompt'],'model':_0x55a85d['model']}:{'actionName':_0x55a85d['actionName']||_0x55a85d['id'],'args':_0x55a85d['args']},_0x54ff36=this['_handleAIActionsActionLabel'](_0x55a85d);await _0x306971['executeAction'](_0x4f6780,_0x54ff36,_0x55a85d['icon']);}},xa=class extends _0x538f78{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2204ab=this['editor'],_0x1e294c=new ya(this['editor']);if(_0x2204ab['commands']['add']('aiQuickAction',_0x1e294c),_0x2204ab['plugins']['has']('AIChat')){const _0x5bc522=this['editor']['plugins']['get']('AIChatController');_0x2204ab['model']['document']['selection']['on']('change:range',(_0x1f4a07,_0x4f07e0)=>{_0x4f07e0['directChange']&&_0x5bc522['removeSelectionFromChatContext']();});}}},La=class extends gn{['appendContent'](_0x1942b7,_0x22f829='text'){'modification'===this['type']&&'text'===_0x22f829&&(_0x22f829=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x1942b7,_0x22f829);}['updateChangeGroups'](_0x4245ff){const _0x287967=this['parsedContent']['get'](_0x4245ff)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x4245ff,_0x287967),this['changeGroups']=[],0x0==_0x287967['childNodes']['length'])return;Hs(this['documentContextContent']['get'](_0x4245ff),this['parsedMergedContent']['get'](_0x4245ff));const _0x2ebf64=_0x4cf212(this['documentContextContent']['get'](_0x4245ff)['children']['map'](_0x5c9222=>({'node':_0x5c9222,'id':fs(_0x5c9222,'data-id')})),_0x287967['children']['map'](_0x107f0f=>({'node':_0x107f0f,'id':fs(_0x107f0f,'data-id')||vt()})),{'comparator':(_0x1fe090,_0x5560b4)=>_0x1fe090['id']==_0x5560b4['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x2ebf64['length']&&_0x2ebf64[_0x2ebf64['length']-0x1]['removed'];)_0x2ebf64['pop']();}const _0x33fc74=_0x2ebf64['map'](_0x327a3b=>{const _0x1a239a=_0x327a3b['added']?'new':_0x327a3b['removed']?'removed':'modified';return{'node':_0x327a3b['value'][0x0]['node'],'type':_0x1a239a,'id':_0x327a3b['value'][0x0]['id']};}),_0x634cfb=this['_documentIdToSource']['get'](_0x4245ff);this['changeGroups']['push']({'changes':_0x33fc74,'state':'pending','index':this['changeGroups']['length'],'editor':_0x634cfb['editor'],'rootName':_0x634cfb['rootName'],'documentId':_0x4245ff});}['_getDifferentChangeGroups'](_0x5ba13d,_0x50a028){return _0x50a028;}},Da=class extends pn{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x417ea6){super(_0x417ea6),this['content']=_0x417ea6['content'],this['version']=_0x417ea6['version'],this['editor']=_0x417ea6['editor'],this['rootName']=_0x417ea6['rootName'],this['actionName']=_0x417ea6['actionName'],this['args']=_0x417ea6['args'],this['userMessage']=_0x417ea6['userMessage'],this['model']=_0x417ea6['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':vt(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x262417){const _0x3f35f3=this['editor']['config']['get']('collaboration.channelId'),_0x2a0519=new La({..._0x262417,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x3f35f3,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x3f35f3,this['editor']]])});return this['replies']['push'](_0x2a0519),_0x2a0519['delegate'](...In)['to'](this),this['fire']('replyCreated',_0x2a0519),_0x2a0519;}},Pa=class extends _0x515f62{constructor(_0x171bfd,_0x5a50da=!0x0,_0x30ae49=!0x0){super(_0x171bfd),this['set']('isEnabled',!0x1),_0x5a50da&&(this['applyButton']=this['_createButton'](us(_0x171bfd,'AI_BALLOON_APPLY_BUTTON'),hn),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x30ae49&&(this['suggestButton']=this['_createButton'](us(_0x171bfd,'AI_BALLOON_SUGGEST_BUTTON'),_0x5a50da?cn:hn),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x5a50da,'showSuggestButton':_0x30ae49}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x52a94a,showSuggestButton:_0x2a9092}){this['applyButton']&&(this['applyButton']['isVisible']=_0x52a94a),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x2a9092);}['_createButton'](_0xfb4a62,_0x5089cc){const _0x5405f8=new Ht(this['locale']);return _0x5405f8['set']({'label':_0xfb4a62,'class':_0x5089cc,'isVisible':!0x0,'withText':!0x0}),_0x5405f8;}},Ha=class extends _0x5afcc4{constructor(_0x22db5b){super(_0x22db5b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':us(_0x22db5b,'AI_DISCLAIMER_TEXT')}]}]});}},Ma=class extends _0x5afcc4{constructor(_0x3b00de){super(_0x3b00de),this['set']('isVisible',!0x0);const _0x126fe4=new lr('small');_0x126fe4['isVisible']=!0x0;const _0x559d8=new _0x5afcc4(this['locale']);_0x559d8['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[us(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x59bb35=>!_0x59bb35)]},'children':[_0x126fe4,_0x559d8]});}},Va=class extends ca{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x3baa82,_0x29df67){super(_0x3baa82),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x29df67,this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x1c61f8(),this['_addContentWrapper'](_0x29df67),this['_addDisclaimerView'](),this['_addToolbar'](_0x29df67),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'](_0x29df67);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x561ed7 of this['_focusables'])this['_focusTracker']['add'](_0x561ed7['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x1b0105){-0x1===_0x1b0105?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x52e6d3){this['_isLoading']=_0x52e6d3;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0xd6a984){super['showError'](_0xd6a984),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x4eff34){super['showBlockingError'](_0x4eff34),this['setErrorState']();}['addMiniToolbarItem'](_0x2737d1){this['_miniToolbarView']['items']['has'](_0x2737d1)||this['_miniToolbarView']['items']['add'](_0x2737d1);}['removeMiniToolbarItem'](_0x294497){this['_miniToolbarView']['items']['has'](_0x294497)&&this['_miniToolbarView']['items']['remove'](_0x294497);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x3f15e1,showSuggestButton:_0x58a92a}){_0x3f15e1=_0x3f15e1&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x58a92a=_0x58a92a&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x3f15e1,'showSuggestButton':_0x58a92a});}async['updateContent'](_0x5b6b44){await this['_streamableContentView']['update'](_0x5b6b44);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x17d88b){this['_contentWrapper']=new _0x5afcc4(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'](_0x17d88b['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Ha(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x167003,showSuggestButton:_0x4f1264}){this['_toolbarView']=new Pa(this['locale'],_0x167003,_0x4f1264),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',(_0x2f1eaf,_0x3ba1ed,_0x50d1cc)=>!(_0x2f1eaf||_0x3ba1ed||_0x50d1cc)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x167003,'showSuggestButton':_0x4f1264}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x1e631c){return this['_miniToolbarView']=new da(this['locale'],_0x1e631c),this['_miniToolbarView']['delegate'](...yn)['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',(_0x344703,_0x2d0884)=>!(_0x344703||_0x2d0884)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ma(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new Qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x4c1bfc=new Ht(this['locale']),_0x15e390=new Ht(this['locale']),_0xc8750b=new Ua(this['locale']),_0x13a8a9=new Ht(this['locale']);_0x4c1bfc['set']({'icon':_0x355f3e,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+ln}),_0x15e390['set']({'icon':_0x54835b,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+ln}),_0x13a8a9['set']({'icon':_0x26a4e8,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+ln}),_0x4c1bfc['bind']('isEnabled')['to'](this,'isBusy',_0xc4302a=>!_0xc4302a),_0x4c1bfc['on']('execute',()=>{this['fire']('tryAgain');}),_0x15e390['bind']('isEnabled')['to'](this,'isBusy',_0x23c6ac=>!_0x23c6ac),_0x15e390['on']('execute',()=>{this['fire']('showPrevious');}),_0x13a8a9['bind']('isEnabled')['to'](this,'isBusy',_0x2c2592=>!_0x2c2592),_0x13a8a9['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x15e390,this['_navigationCounter']=_0xc8750b,this['_navigationNextButton']=_0x13a8a9,this['_navigationTryAgainButton']=_0x4c1bfc;}['updateMiniToolbarButtons'](_0x4f5339,_0xb65f72){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x151fce=_0x4f5339>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x151fce){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x2d2de8=_0x4f5339-_0xb65f72;this['_navigationCounter']['setInteractionCount'](_0x2d2de8+'/'+_0x4f5339),this['_navigationPreviousButton']['isEnabled']=_0xb65f72<_0x4f5339-0x1,this['_navigationNextButton']['isEnabled']=_0xb65f72>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'](_0x4d89a4){this['_isLoading']=_0x4d89a4;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x65792f=this['_streamableContentView']['element'],_0xf58e8a=this['_miniToolbarView']['element'],_0x8a856e=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x3993ac=_0x65792f['offsetWidth']-_0x65792f['clientWidth'];_0xf58e8a['style']['right']='calc('+_0x3993ac+'px\x20+\x20var(--ck-spacing-large))';});};_0x8a856e(),this['_miniToolbarResizeObserver']=new It(_0x65792f,()=>{_0x8a856e();});}['_initializeScrollManager'](){const _0x245aaf=this['_getScrollableElement']();_0x245aaf&&!this['_scrollManager']&&(this['_scrollManager']=new Hr(_0x245aaf));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Ua=class extends _0x5afcc4{constructor(_0x361abf){super(_0x361abf);const _0x536e05=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x536e05['to']('interactionCount')}]});}['setInteractionCount'](_0x19c351){this['set']('interactionCount',_0x19c351);}},Ba=class extends _0x538f78{static get['requires'](){return[ls,on,Mt,Is,ua,_0x598e2f];}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(_0x553c2b){super(_0x553c2b),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new tr();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x4d794d,_0x1548bc,_0x12031c){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x1b7b96,anchorData:_0x2b6126,root:_0x280cde}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x4d794d,_0x1b7b96,_0x2b6126,_0x280cde,_0x1548bc,_0x12031c);}const {modelFragment:_0x231c1d,anchorData:_0xc3197d,root:_0x37fa98}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x4d794d,_0x231c1d,_0xc3197d,_0x37fa98,_0x1548bc,_0x12031c);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x9494cb=this['editor']['plugins']['has']('TrackChanges');let _0x3cef20=this['editor']['config']['get']('ai.availableReplyActions')||[...ir];_0x9494cb||(_0x3cef20=_0x3cef20['filter'](_0x314745=>'insertSuggestion'!=_0x314745));const _0x20ff21=this['editor']['commands']['get']('trackChanges'),_0x59a186=new Va(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x9494cb,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x3cef20});return _0x59a186['bind']('isBusy')['to'](this),_0x20ff21&&_0x59a186['bind']('isTrackChangesOn')['to'](_0x20ff21,'value'),_0x59a186['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x59a186['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x59a186['on']('showNext',()=>{this['_navigateToNext']();}),_0x59a186;}['_normalizeSelectionStart'](){const _0x18188d=this['editor']['model'],_0x5c2542=_0x18188d['document']['selection'],_0x1d9baf=_0x5c2542['getFirstRange']();if(!_0x1d9baf||_0x1d9baf['isCollapsed'])return;const _0x14cf6b=mt(_0x5c2542['getSelectedBlocks']());if(!_0x14cf6b)return;const _0x4b0ee8=_0x18188d['createPositionAt'](_0x14cf6b,0x0);_0x4b0ee8['isAfter'](_0x1d9baf['start'])&&_0x18188d['change'](_0x466bd5=>{_0x466bd5['setSelection'](_0x466bd5['createRange'](_0x4b0ee8,_0x1d9baf['end']));});}['_getExecuteDataRegular'](){const _0x30c0de=this['editor']['model']['document']['selection'],_0x261528=_0x30c0de['getFirstRange']()['start']['root'];if(_0x30c0de['isCollapsed']){const _0x51ed55=mt(_0x30c0de['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x30c0de);this['editor']['model']['change'](_0xc69776=>{_0xc69776['setSelection'](_0x51ed55,'in');});}this['_normalizeSelectionStart']();const _0x37227c=_0x30c0de['getFirstRange'](),_0x53a8f9=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x30c0de),_0x37227c['start'],_0x37227c['end']);this['_copyMarkersToFragment'](_0x53a8f9,_0x30c0de,{'isTableSelection':!0x1});const _0x74f1d6=_0x30c0de['getFirstRange']()['start'],_0x210759=new Map();let _0x6b543d=_0x53a8f9;for(let _0x4e3b73=0x0;_0x4e3b73<_0x74f1d6['path']['length'];_0x4e3b73++)_0x210759['set'](_0x6b543d,_0x74f1d6['path'][_0x4e3b73]),_0x6b543d=_0x6b543d['getChild'](0x0);return{'modelFragment':_0x53a8f9,'anchorData':_0x210759,'root':_0x261528};}['_getExecuteDataInTable'](){const _0xee56f=this['editor']['model']['document']['selection'],_0x5c0bdb=this['editor']['plugins']['get']('TableSelection'),_0x20947c=_0xee56f['getFirstRange']()['start']['root'],_0x5ab099=_0x5c0bdb['getSelectionAsFragment'](),_0x50a7eb=_0xee56f['getFirstRange']()['start']['parent']['parent'],_0x565dd6=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x50a7eb),this['editor']['model']['createPositionAfter'](_0x50a7eb)),_0x11c027=this['_wrapWithCommonAncestors'](_0x5ab099,_0x565dd6['start'],_0x565dd6['end']);this['_copyMarkersToFragment'](_0x11c027,_0xee56f,{'isTableSelection':!0x0});const _0x5f193c=_0xee56f['getFirstRange']()['start'],_0x545ea2=new Map();let _0xb804b=_0x11c027;for(let _0x1dd7ab=0x0;_0x1dd7ab<_0x5f193c['path']['length'];_0x1dd7ab++)if(_0x545ea2['set'](_0xb804b,_0x5f193c['path'][_0x1dd7ab]),_0x1dd7ab<_0x5f193c['path']['length']-0x1)_0xb804b=_0xb804b['getChild'](0x0);else{let _0x30533d=_0xb804b['nextSibling'];for(;_0x30533d;)_0x545ea2['set'](_0x30533d,_0x5f193c['path'][_0x1dd7ab]),_0x30533d=_0x30533d['nextSibling'];}return{'modelFragment':_0x11c027,'anchorData':_0x545ea2,'root':_0x20947c};}async['_executeAction'](_0xaba0c9,_0x5c28ae,_0x43f53b,_0x37cd51,_0x3ba657,_0x571c58){const _0x193749=this['editor']['plugins']['get'](Is),_0xcf8f8f=this['editor']['plugins']['get'](ua),_0x203737=this['editor']['model']['document']['selection'],_0x4b1eee=await _0x193749['modelToDataWithIds'](_0x5c28ae,this['editor']),_0x241299=this['editor']['model']['document']['version'],_0x16b89b=[..._0x203737['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0xcf8f8f['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x3ba657,'icon':_0x571c58||_0x37448c,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x16b89b,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xcf8f8f),this['_interactionParams']={'action':_0xaba0c9,'content':_0x4b1eee,'version':_0x241299,'aiBalloon':_0xcf8f8f,'modelFragment':_0x5c28ae,'anchorData':_0x43f53b,'root':_0x37cd51},this['_setupApplyListeners'](),this['listenTo'](_0xcf8f8f,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0xcf8f8f,'dialogClosed',(_0x53ac6e,{id:_0x59e9fe})=>{if('aiActionsBalloon'===_0x59e9fe){for(const _0x56606a of this['_interactions']){if(0x0===_0x56606a['replies']['length']||_0x56606a['stoppedExplicitly'])continue;const _0x27eac9=_0x56606a['replies'][_0x56606a['replies']['length']-0x1],_0x5ca5dd=_0x27eac9['changeGroups'][0x0];_0x5ca5dd&&'pending'===_0x5ca5dd['state']&&_0x27eac9['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xcf8f8f);}}),this['_createInteraction'](_0x4b1eee,_0x241299,_0xcf8f8f,_0xaba0c9);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x1cb5e6,anchorData:_0x394af6,root:_0x46ce9d}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x1cb5e6,_0x394af6,_0x46ce9d,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x1cb5e6,_0x394af6,_0x46ce9d,!0x0);});}['_wrapWithCommonAncestors'](_0x58e2a7,_0x480038,_0x5a5555){const _0xdd1b47=this['editor']['model']['createRange'](_0x480038,_0x5a5555)['getCommonAncestor'](),_0x1339f5=_0xdd1b47['is']('documentFragment')?[]:_0xdd1b47['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x1339f5['length']){const _0x35c5e8=_0x1339f5['map'](_0x393b54=>_0x393b54['_clone'](!0x1));for(let _0x550e49=0x1;_0x550e49<_0x35c5e8['length'];_0x550e49++)_0x35c5e8[_0x550e49-0x1]['_appendChild'](_0x35c5e8[_0x550e49]);return _0x35c5e8[_0x35c5e8['length']-0x1]['_appendChild'](_0x58e2a7),new _0x3ce28b(_0x35c5e8[0x0]);}return _0x58e2a7;}['_copyMarkersToFragment'](_0x2d6eea,_0x58092b,_0x5c6ecc={'isTableSelection':!0x1}){const _0x3e6a4f=this['editor']['model'],_0x1c8f51=Array['from'](_0x58092b['getRanges']()),_0x4c428d=_0x58092b['getFirstRange']()['start'];for(const _0x163964 of _0x3e6a4f['markers']){if(_0x163964['name']['startsWith']('ai-selection')||!_0x163964['affectsData'])continue;const _0xb7d209=_0x163964['getRange']();if(!_0x1c8f51['some'](_0x259028=>_0x259028['containsRange'](_0xb7d209,!0x0)))continue;const _0x1f27a4=this['_regularCalculateMarkerPath'](_0xb7d209['start'],_0x4c428d,_0x5c6ecc['isTableSelection']),_0x465c61=this['_regularCalculateMarkerPath'](_0xb7d209['end'],_0x4c428d,_0x5c6ecc['isTableSelection']),_0x299781=_0x3e6a4f['createPositionFromPath'](_0x2d6eea,_0x1f27a4),_0x11bdff=_0x3e6a4f['createPositionFromPath'](_0x2d6eea,_0x465c61);if(!_0x299781['isEqual'](_0x11bdff)){const _0x3e1db3=_0x3e6a4f['createRange'](_0x299781,_0x11bdff);_0x2d6eea['markers']['set'](_0x163964['name'],_0x3e1db3);}}}['_regularCalculateMarkerPath'](_0x4a0b55,_0x3c6df7,_0x1213d8=!0x1){const _0x34ec26=[..._0x4a0b55['path']['slice']()];for(let _0x49927c=0x0;_0x49927c<Math['max'](_0x3c6df7['path']['length'],_0x4a0b55['path']['length']);_0x49927c++){const _0xf93fea=_0x3c6df7['path'][_0x49927c]||0x0,_0x29e40e=(_0x4a0b55['path'][_0x49927c]||0x0)-_0xf93fea;if(_0x34ec26[_0x49927c]=_0x29e40e,0x0!==_0x29e40e&&!_0x1213d8)break;}return _0x34ec26;}async['_createInteraction'](_0x5ce6d7,_0x2df0a1,_0x2bb646,_0x2b88f9){const _0xd47e0b=this['editor'],_0xa10c95=_0xd47e0b['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x1779c2(_0xd47e0b,_0xa10c95['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x2b88f9,'content':_0x5ce6d7,'version':_0x2df0a1,'aiBalloon':_0x2bb646,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0xa10c95});const _0x569d13=new Da({'connector':this['_aiConnector'],'locale':_0xd47e0b['locale'],'content':_0x5ce6d7,'version':_0x2df0a1,'editor':_0xd47e0b,'rootName':_0xa10c95['rootName'],..._0x2b88f9});this['_interactions']['push'](_0x569d13);const _0x87156b=(_0x5a4849,_0x38e046=!0x1,_0x10419c='streaming')=>{const {isDone:_0xa97855}=_0x5a4849;return this['_promiseQueue']['enqueue'](async _0x16ae36=>{try{const _0x583590=Bs({'changeGroups':_0x5a4849['changeGroups'],'documentContextContent':_0x5a4849['documentContextContent'],'showDiff':_0x38e046,'trimUnchanged':!0x1});_0x583590['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x583590[0x0],'renderingStrategy':_0x10419c,'abortSignal':_0x16ae36}),_0xa97855&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x2e1fd){if(nn(_0x2e1fd))return;throw _0x2e1fd;}});};_0x569d13['on']('replyCreated',(_0x13fe1d,_0x507f9d)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x87156b(_0x507f9d)['catch'](_0x4a3e65=>{this['_reporter']['logError'](_0x4a3e65,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x569d13,_0x4a3e65);});}),_0x569d13['on']('replyContentUpdated',(_0x41fc7a,_0x20aafa)=>{_0x87156b(_0x20aafa)['catch'](_0xa57afd=>{this['_reporter']['logError'](_0xa57afd,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x569d13,_0xa57afd);});}),_0x569d13['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x409e77){this['_reporter']['logError'](_0x409e77,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x569d13,_0x409e77);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x9efae6,{showDiff:_0x3fae9a})=>{try{this['_balloonShowDiff']=_0x3fae9a;const _0x68ac3a=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x68ac3a&&await _0x87156b(_0x68ac3a,_0x3fae9a,'static');}catch(_0x5f523d){this['_reporter']['logError'](_0x5f523d,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x569d13,_0x5f523d);}}),_0x569d13['on']('replyChangeGroupStateUpdated',()=>{const _0xfc4a0e={'positiveCount':_0x569d13['replies']['reduce']((_0x4d528a,_0x593d24)=>_0x4d528a+_0x593d24['changeGroups']['filter'](_0x9b22e8=>'accepted'===_0x9b22e8['state'])['length'],0x0),'totalCount':_0x569d13['replies']['reduce']((_0x333cdc,_0x18848c)=>_0x333cdc+_0x18848c['changeGroups']['length'],0x0)},_0x2502ed=_0x569d13['actionCallId'],_0x564d12=_0x569d13['actionName'];_0x564d12?this['_aiConnector']['upsertAIActionRating'](_0x564d12,_0x2502ed,_0xfc4a0e):this['_aiConnector']['upsertCustomAIActionRating'](_0x2502ed,_0xfc4a0e);}),this['_setLoadingState']();try{const _0x284fef=await _0x569d13['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x284fef;}catch(_0x1d7ac4){nn(_0x1d7ac4)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x1d7ac4,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x569d13,_0x1d7ac4);}}['_applyChanges'](_0x25396c,_0x197e23,_0x7e159c,_0xabaa00){const _0x388ba8=this['editor'];if(_0xabaa00&&!_0x388ba8['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x3bea5d=this['editor']['plugins']['get'](_0x598e2f),_0x4627ee=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x4627ee||!_0x4627ee['replies']['length'])return;const _0x532367=_0x4627ee['replies'][_0x4627ee['replies']['length']-0x1];_0x532367['setChangeGroupState'](0x0,'accepted');const _0x2c092b=Ns({'documentSuggestions':vn({'groups':[_0x532367['changeGroups'][0x0]],'documentContextContent':_0x532367['documentContextContent'],'documents':_0x4627ee['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x3bea5d,'documentCompareOptions':{'anchor':_0x388ba8['model']['createPositionAt'](_0x25396c,0x0),'markDeletions':_0xabaa00}})['values']()['next']()['value']??[],_0x2e55d5=this['_filterOperationsOutsideRange'](_0x2c092b,_0x197e23);for(const _0x27b05b of _0x2e55d5)this['_anchorOperation'](_0x197e23,_0x27b05b,_0x7e159c);const _0x374ebc=_0x4627ee['getDocumentContext']()['documents'][0x0]['version'],_0x19da14=_0x25b633(_0x2e55d5,_0x388ba8['model']['document']['history']['getOperations'](_0x374ebc),{'document':_0x388ba8['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];Js(_0x19da14,'quickActions');try{_0x388ba8['model']['change'](_0x3125ca=>{if(_0x3125ca['setSelection'](_0x388ba8['model']['document']['selection']['focus']),_0xabaa00)_0x388ba8['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x19da14);else{for(const _0x3196c0 of _0x19da14)_0x3196c0['baseVersion']=_0x388ba8['model']['document']['version'],ys(_0x388ba8,_0x3196c0),_0x3125ca['batch']['addOperation'](_0x3196c0),_0x388ba8['model']['applyOperation'](_0x3196c0);}});}catch(_0x52f970){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x52f970})),_0x52f970;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x34fed7,_0x3c7f5f){return _0x34fed7['filter'](_0xbfbfa9=>{if('rename'==_0xbfbfa9['type']){const _0x19e385=_0xbfbfa9['position']['nodeAfter'];return!_0x3c7f5f['has'](_0x19e385);}if(_0xbfbfa9['type']['indexOf']('Attribute')>-0x1){const _0x5f137f=_0xbfbfa9['range']['start']['nodeAfter'];return!_0x3c7f5f['has'](_0x5f137f);}return!0x0;});}['_anchorOperation'](_0x4290df,_0x1b5a8a,_0x4ca99d){const _0x509eda=_0x1b5a8a['clone']();for(const _0x2ceb20 in _0x1b5a8a){const _0x2fd3c7=_0x1b5a8a[_0x2ceb20];_0x2fd3c7 instanceof _0x217c33?_0x1b5a8a[_0x2ceb20]=new _0x217c33(_0x27f504(_0x2fd3c7['start']),_0x27f504(_0x2fd3c7['end'])):_0x2fd3c7 instanceof _0x167b65&&(_0x1b5a8a[_0x2ceb20]=_0x27f504(_0x2fd3c7));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x509eda['type'])){if(_0x509eda['isDocumentOperation']=!0x1,_0x509eda['baseVersion']=null,'remove'==_0x509eda['type']){const _0x2ea9f4=_0x509eda['sourcePosition'],_0x54bd41=_0x509eda['howMany'];new _0x16ad52(_0x2ea9f4,_0x54bd41)['_execute']();}else _0x509eda['_execute']();}function _0x27f504(_0x27b385){if('$graveyard'==_0x27b385['root']['rootName'])return _0x27b385;const _0x58ec88=[];let _0x140ecd=_0x27b385['root'];for(let _0x376f72=0x0;_0x376f72<_0x27b385['path']['length'];_0x376f72++){const _0x342982=_0x4290df['get'](_0x140ecd)||0x0;_0x58ec88[_0x376f72]=_0x27b385['path'][_0x376f72]+_0x342982,_0x140ecd=_0x140ecd['getChildAtOffset'](_0x27b385['path'][_0x376f72]);}return new _0x167b65(_0x4ca99d,_0x58ec88,_0x27b385['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x264141,content:_0x49ad45,version:_0x22fc69,aiBalloon:_0x6df1f9}=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'](_0x49ad45,_0x22fc69,_0x6df1f9,_0x264141)['catch'](_0x23480=>{this['_reporter']['logError'](_0x23480,{'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 _0x1fe572=this['_interactions']['length'];this['_currentInteractionIndex']<_0x1fe572-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x17ccae){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x17ccae;const _0x3a0ea3=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x3a0ea3)return;if(_0x3a0ea3['hasError'])return this['_setErrorState'](_0x3a0ea3),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x3a0ea3['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x84ba0e=_0x3a0ea3['replies'][_0x3a0ea3['replies']['length']-0x1];if(_0x84ba0e)try{const _0x397123=Bs({'changeGroups':_0x84ba0e['changeGroups'],'documentContextContent':_0x84ba0e['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x24cba4=>setTimeout(_0x24cba4,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x397123[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x1469af){this['_reporter']['logError'](_0x1469af,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x4a4a45,_0x415959){if(void 0x0!==_0x415959&&nn(_0x415959))return;const _0x564872=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x564872),_0x4a4a45['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);}},Ga=class extends _0x538f78{static get['requires'](){return[va,xa,Ba];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5eb285){super(_0x5eb285),_0x5eb285['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Fa=class extends _0x5afcc4{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0xa7658c,_0x195295){super(_0xa7658c),this['id']=_0x195295,this['set']('status','pending'),this['set']('changeId',_0x195295),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',(_0x17c5b6,_0x520e76)=>{_0x520e76&&_0x520e76['target']&&'A'===_0x520e76['target']['tagName']&&_0x520e76['preventDefault'](),this['fire']('activateChange',{'id':_0x195295,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x195295,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x195295,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x5332d2=new _0x5afcc4(this['locale']);return _0x5332d2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x1f9d9f=>!_0x1f9d9f)]}}),_0x5332d2;}['_createAcceptButtonView'](){const _0x4f8e86=new Ht(this['locale']);return _0x4f8e86['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x4f8e86['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x23d4a9=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x23d4a9['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x3b7bb7=>'pending'!==_0x3b7bb7&&'accepted'!==_0x3b7bb7),this['bindTemplate']['if']('status',cn,_0x55f5cd=>'pending'===_0x55f5cd),this['bindTemplate']['if']('status',ln,_0x29519c=>'pending'!==_0x29519c),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x5972a6=>'accepted'===_0x5972a6)]}}),this['on']('change:status',(_0x27b963,_0x3ebc4a,_0x304952)=>{_0x4f8e86['isEnabled']='pending'===_0x304952,'accepted'===_0x304952&&(_0x4f8e86['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x4f8e86['icon']=_0x3c5aaf);}),_0x4f8e86;}['_createDismissButtonView'](){const _0x2de85d=new Ht(this['locale']);return _0x2de85d['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x2de85d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1bb910=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x1bb910['stopPropagation']();})},'attributes':{'class':[ln,this['bindTemplate']['if']('status','ck-hidden',_0x5af8a1=>'pending'!==_0x5af8a1&&'rejected'!==_0x5af8a1),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0xd66155=>'pending'===_0xd66155),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2e65e7=>'rejected'===_0x2e65e7)]}}),this['on']('change:status',(_0x4d65a8,_0x1e9c8c,_0x475c52)=>{_0x2de85d['isEnabled']='pending'===_0x475c52,'rejected'===_0x475c52&&(_0x2de85d['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x2de85d['icon']=_0x5ec216);}),_0x2de85d;}['_createInfoButtonView'](){const _0x1225ac=new Ht(this['locale']);return _0x1225ac['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x304b33,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':ln+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1225ac['bind']('isOn')['to'](this,'isInfoToggleOn',_0x76e742=>_0x76e742),_0x1225ac['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1225ac;}['_createOutdatedButtonView'](){const _0xcd2095=new Ht(this['locale']);return _0xcd2095['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x1dd5ea,'withText':!0x0,'isEnabled':!0x1}),_0xcd2095['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x54bc1b=>'outdated'!==_0x54bc1b)],'disabled':'disabled'}}),_0xcd2095;}},Ka=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x35d8e9,_0x3fbe2c){super(_0x35d8e9),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']()),_0x3fbe2c['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x42c67c){this['resultItemView']['changeId']=_0x42c67c['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x42c67c['contentDiffed'];}['showBalloon'](_0x4900d6,_0x90508c,_0x3a2464,_0x2f4b08,_0x3719ad,_0xec81a0){const _0x528c3f=_0x90508c();if(!_0x528c3f)return;this['updateContent'](_0x4900d6),this['show']();const _0x25aa28=Array['from'](_0x528c3f['getClientRects']())['reverse'](),_0x2f4fa6=this['_getPointedRectIndexFromEvent'](_0x3a2464,_0x25aa28),_0x174153=_0x25aa28[_0x2f4fa6??0x0];'click'===_0x2f4b08?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x90508c(),_0x2f4fa6,_0x4900d6['id'],_0x3719ad,_0xec81a0)||_0x174153})):'hover'===_0x2f4b08&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x90508c(),_0x2f4fa6,_0x4900d6['id'])||_0x174153}));}['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'](){_0x3f90e8({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0xa53928=[this['element']];return this['_pinnedTargetElement']&&_0xa53928['push'](this['_pinnedTargetElement']),_0xa53928;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0xc62227=new _0x5afcc4();return this['resultItemView']=new Fa(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0xc62227['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']]}]}),_0xc62227;}['_getBestRectPositionOnClick'](_0x44afb6,_0x19cf79,_0x449956,_0x279852,_0x5c3cf1){if(!_0x44afb6)return null;const _0x2fc221=this['position']['replace']('arrow_',''),_0xe9f465=Array['from'](_0x44afb6['getClientRects']());let _0x5489dd,_0x3cb998=_0xe9f465['reverse']();return void 0x0!==_0x19cf79&&this['_isPinnedRectVisible'](_0x3cb998[_0x19cf79],_0x279852,_0x5c3cf1)?(_0x5489dd=_0x3cb998[_0x19cf79],this['_pinnedRectIndex']=_0x19cf79):this['_isPinnedRectVisible'](_0x3cb998[0x0],_0x279852,_0x5c3cf1)&&void 0x0===_0x19cf79?_0x5489dd=_0x3cb998[0x0]:(_0x3cb998='s'==_0x2fc221[0x0]?[..._0xe9f465]['reverse']():_0xe9f465,_0x3cb998['forEach'](_0x4b006e=>{this['_isPinnedRectVisible'](_0x4b006e,_0x279852,_0x5c3cf1)&&(_0x5489dd=_0x4b006e);})),this['_pinnedTargetChangeId']=_0x449956,this['_pinnedTargetElement']=_0x44afb6,_0x5489dd||_0x44afb6['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x51d171,_0x37d668,_0xc60baa){if(!_0x51d171)return null;const _0x10f5b4=Array['from'](_0x51d171['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x37d668&&this['_pinnedTargetChangeId']!==_0xc60baa?(this['_pinnedRectIndex']=_0x37d668,this['_pinnedTargetElement']=_0x51d171,this['_pinnedTargetChangeId']=_0xc60baa,_0x10f5b4[_0x37d668]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0xc60baa?_0x51d171!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x10f5b4[this['_pinnedRectIndex']]:void 0x0!==_0x37d668&&this['_pinnedTargetChangeId']!==_0xc60baa?(this['_pinnedRectIndex']=_0x37d668,this['_pinnedTargetElement']=_0x51d171,this['_pinnedTargetChangeId']=_0xc60baa,_0x10f5b4[_0x37d668]):_0x51d171['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x3d9a7e,_0x6b8706){if(_0x3d9a7e)for(let _0x447ca2=0x0;_0x447ca2<_0x6b8706['length'];_0x447ca2++){const _0x32df24=_0x6b8706[_0x447ca2];if(_0x3d9a7e['clientX']>=_0x32df24['left']-0x3&&_0x3d9a7e['clientX']<=_0x32df24['right']+0x3&&_0x3d9a7e['clientY']>=_0x32df24['top']-0x3&&_0x3d9a7e['clientY']<=_0x32df24['bottom']+0x3)return _0x447ca2;}}['_isPinnedRectVisible'](_0x297e66,_0x462f88,_0x4744df){const _0x379db1=new At(_0x297e66),_0x7762b1=_0x462f88||document['documentElement'],_0x2e9189=_0x379db1['getIntersection'](Et(_0x4744df)),_0xa0131e=new At(_0x7762b1)['getIntersection'](_0x379db1);return!!(_0x2e9189&&_0xa0131e&&_0x379db1['width']>0x0);}};const Wa=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Ya=class extends _0x215b79{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x519853){super(_0x519853),this['_bodyCollection']=dn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Wa)['to'](this),this['_balloonSuggestionView']=new Ka(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4e0966=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4e0966);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x265020){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x520a7e=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x265020,_0x520a7e);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x301b0b){_0x301b0b&&('error-general'!==_0x301b0b['status']?'error-chunk'!==_0x301b0b['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x2474d2){this['_mainView']['addCheckRunResult'](_0x2474d2);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0xf4ebe6){this['_mainView']['showGeneralReviewCoreErrorView'](_0xf4ebe6??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x124de9,_0x1e4df1){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x124de9,_0x1e4df1);}['setActiveStateInResults'](_0x3cf107){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x5f27a0=>{_0x5f27a0['id']===_0x3cf107&&_0x5f27a0['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0xbd1714=>_0xbd1714['setItemAsInactive']());}['updateChangeState'](_0x53f2eb,_0x243e40){'accepted'===_0x243e40||'rejected'===_0x243e40||'outdated'===_0x243e40?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x53f2eb,_0x243e40):this['_mainView']['reviewCheckResultsView']['showResult'](_0x53f2eb,_0x243e40);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x563fa7,_0x4ecd4f,_0xd5485f,_0x188e4a,_0x350273,_0x7b9d2f){this['_balloonSuggestionView']['showBalloon'](_0x563fa7,_0x4ecd4f,_0xd5485f,_0x188e4a,_0x350273,_0x7b9d2f);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x1599b0){const _0x11559d=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x12eee6=>_0x12eee6['id']===_0x1599b0);return _0x11559d?_0x11559d['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},$a=class extends _0x5afcc4{constructor(_0x1e4255){super(_0x1e4255),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x4ed36d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x4ed36d['if']('isVisible','ck-hidden',_0x2bec8d=>!_0x2bec8d)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x4ed36d['to']('errorMessage')}]}]});}},qa=class extends _0x5afcc4{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x18938f,_0x5e56bc){super(_0x18938f),this['reviewCoreHeader']=_0x5e56bc['header'],this['generalErrorView']=new $a(_0x18938f),this['reviewCheckListView']=_0x5e56bc['list'],this['reviewCheckListView']['delegate'](...Wa)['to'](this),this['reviewCheckResultsView']=_0x5e56bc['results'],this['reviewCheckResultsView']['delegate'](...Wa)['to'](this),this['reviewCompletedView']=_0x5e56bc['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'](_0x518fb0){this['reviewCheckResultsView']['addResult'](_0x518fb0),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'](_0x132f4e){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x132f4e;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},Qa=class extends Ht{constructor(_0x2ed981,_0x392dc4){super(_0x392dc4),this['set']({'label':_0x2ed981,'withText':!0x0,'class':hn}),this['on']('execute',()=>{this['fire']('finishReview');});}},Xa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x41cfd4,_0x37acc8){super(_0x41cfd4),this['_contents']=_0x37acc8,this['_resultViews']=new _0x1c61f8(),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 Vo(_0x41cfd4),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0x3a5e1e=this['_createCombinedSkeletonLoader'](),_0x1a7211=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x1a7211['if']('isLoading','ck-ai_review__check-run_loading',_0x1e159f=>_0x1e159f),_0x1a7211['if']('isResultReady','ck-ai_review__check-run_ready',_0x5738d1=>_0x5738d1),_0x1a7211['if']('isVisible','ck-hidden',_0x25067a=>!_0x25067a)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x3a5e1e,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x997989){const _0x59bcb2=new Fa(this['locale'],_0x997989['id']);_0x59bcb2['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x59bcb2),_0x59bcb2['resultResponseView']['element']['innerHTML']=_0x997989['contentDiffed'];}['hideResult'](_0x3927f4,_0x17f268){if('pending'===_0x17f268)return;const _0x48266d=this['_resultViews']['find'](_0x541220=>_0x541220['id']===_0x3927f4);_0x48266d&&(_0x48266d['status']=_0x17f268,_0x48266d['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x58b3b9,_0x4b1175){if('pending'!==_0x4b1175)return;const _0x11fd32=this['_resultViews']['find'](_0x18f978=>_0x18f978['id']===_0x58b3b9);_0x11fd32&&(_0x11fd32['status']=_0x4b1175,_0x11fd32['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0xb9b64c,_0x5409ac){this['headerTitle']=_0xb9b64c,this['headerSubtitle']=_0x5409ac||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new zn(this['locale'],jn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x3da084=new _0x5afcc4(this['locale']),_0x291dfd=[];for(let _0x545700=0x0;_0x545700<0x10;_0x545700++){const _0x55bcd3=this['_createSkeletonLoader']();_0x55bcd3['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x291dfd['push'](_0x55bcd3);}return _0x3da084['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x2ca161=>!_0x2ca161)]},'children':_0x291dfd}),_0x3da084;}['_createResultsBodyView'](){const _0x4b9fa2=new _0x5afcc4(this['locale']);return _0x4b9fa2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0xb7e075=>_0xb7e075)]},'children':this['_resultViews']}),_0x4b9fa2;}['_createErrorView'](){const _0xafb026=new _0x5afcc4(this['locale']),_0x473722=new Ht(this['locale']),t=this['locale']['t'];return _0xafb026['delegate']('retryReview')['to'](this),_0x473722['set']({'label':t('Try\x20again'),'withText':!0x0,'class':cn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x473722['on']('execute',()=>{this['fire']('retryReview');}),_0xafb026['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x172a94=>!_0x172a94),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x4b6d4e=>'chunk'===_0x4b6d4e)]},'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',_0x5b9f93=>'chunk'===_0x5b9f93)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x34bc60=>'general'!==_0x34bc60)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x466887=>'chunk'!==_0x466887)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x473722]}),_0xafb026;}['_createCancelButtonView'](){const _0x5084bc=new Ht(this['locale']);return _0x5084bc['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[cn+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x5084bc['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x227447=>_0x227447),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2fa73f=>_0x2fa73f)]}}),_0x5084bc['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x5084bc;}['_createToggleDiffButtonView'](){const _0x5ebfb7=new Ht(this['locale']);_0x5ebfb7['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x5ebfb7['bind']('isEnabled')['to'](this,'isError',_0x28bf43=>!_0x28bf43),_0x5ebfb7['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3afc63=>!_0x3afc63),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1ecb2e=>_0x1ecb2e)]}});const _0x599321=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x2a2116=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x5ebfb7['bind']('isOn')['to'](this,'isToggleDiffOn',_0x119837=>_0x119837),_0x5ebfb7['bind']('icon')['to'](this,'isToggleDiffOn',_0x22cb46=>_0x22cb46?_0x39ddde:_0x2d688a),_0x5ebfb7['bind']('label')['to'](this,'isToggleDiffOn',_0x4551dd=>_0x4551dd?_0x599321:_0x2a2116),_0x5ebfb7['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x5ebfb7;}['_createAcceptAllButtonView'](){const _0x24f90d=new Ht(this['locale']);return _0x24f90d['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x24f90d['bind']('isEnabled')['to'](this,'isError',_0x3ca4cd=>!_0x3ca4cd),_0x24f90d['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5041e4=>!_0x5041e4),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2db80b=>_0x2db80b)]}}),_0x24f90d['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x24f90d;}['_createExitReviewButtonView'](){const _0x5e32d7=new Ht(this['locale']);return _0x5e32d7['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x5e32d7['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x257259=>!_0x257259),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2ff0ef=>_0x2ff0ef)]}}),_0x5e32d7['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x5e32d7;}['_createResultHeaderView'](){const _0x2bdcf2=new _0x5afcc4(this['locale']),_0x2f8f7b=this['_createTitleView']();return _0x2bdcf2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0xaed555=>_0xaed555)]},'children':[_0x2f8f7b,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x503402=>!_0x503402)],'title':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':us(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']]}]}),_0x2bdcf2;}['_createTitleView'](){const _0x212e65=new _0x5afcc4(this['locale']),_0x39c354=new lr();return _0x39c354['bind']('isVisible')['to'](this,'isResultReady',_0x51bd16=>!_0x51bd16),_0x212e65['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4b04aa=>_0x4b04aa)]},'children':[_0x39c354,{'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')}]}]}]}),_0x212e65;}['_createFinishReviewButtonView'](){const _0x54a354=new Qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x54a354['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x15a1a4=>!_0x15a1a4)]}}),_0x54a354['delegate']('finishReview')['to'](this),_0x54a354;}},za=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x29103b,_0x3c1796){super(_0x29103b),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x3c1796['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x3c1796['headerText']);const _0x1a6cf6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x1a6cf6['if']('isVisible','ck-hidden',_0xb2ab28=>!_0xb2ab28)]},'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':_0x3c1796['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x3ec350){const _0xc1a045=new Qa(_0x3ec350,this['locale']);return _0xc1a045['delegate']('finishReview')['to'](this),_0xc1a045;}['_createResultHeaderView'](_0x1b4566){const _0x53a47d=new _0x5afcc4(this['locale']);return _0x53a47d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x1b4566},'children':[{'text':_0x1b4566}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x53a47d;}},ja=class extends _0x5afcc4{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x2aa96e,_0x390f69){super(_0x2aa96e),this['_defaultValue']=_0x390f69['default']||(_0x390f69['data']['length']>0x0?_0x390f69['data'][0x0]['id']:''),this['_defaultLabel']=_0x390f69['data']['find'](_0x4108a5=>_0x4108a5['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x178550(this['locale']);const _0x5b7b45=this['_prepareListOptions'](_0x390f69['data']);_0x45d336(this['_dropdownView'],_0x5b7b45,{'role':'menu','ariaLabel':_0x390f69['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x58d2bf=>{_0x58d2bf['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0xdac861=>{this['formValue']=_0xdac861['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0xdac861['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'](_0x531258=[]){const _0x4c6a1f=new ct();this['resetToDefault']();for(const _0x1a50ce of _0x531258){const _0x5de68b=new _0xc45766({'label':_0x1a50ce['label'],'withText':!0x0,'role':'menuitemradio','id':_0x1a50ce['id'],'model':_0x1a50ce});_0x5de68b['bind']('isOn')['to'](this,'formValue',_0x13822f=>_0x13822f===_0x5de68b['id']);const _0x2052c8={'type':'button','model':_0x5de68b};_0x4c6a1f['add'](_0x2052c8);}return _0x4c6a1f;}},Ja=class extends zt{['_formItem']=null;constructor(_0x50a98e,_0x568015,_0x111ac7){if(super(_0x50a98e),this['argsKey']=_0x568015?.['argsKey'],'dropdown'===_0x568015['formType'])this['_formItem']=new ja(this['locale'],_0x568015);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x354346=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x111ac7?'ck-form__row_with-submit':'']});_0x111ac7&&_0x354346['children']['add'](_0x111ac7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x354346]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Za=class AIReviewCorePromptInputView extends _0x1cfbf3{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x34dc22){super(_0x34dc22),this['set']('isEmpty',!0x0),this['keystrokes']=new _t(),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']);}},th=class extends _0x5afcc4{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x1c61f8();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x3eb926,_0x2e969b,_0x187976=!0x1){super(_0x3eb926),this['_check']=_0x2e969b,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x2e969b['defaultModel']?_0x2e969b['defaultModel']['id']:'',this['_defaultLabel']=_0x2e969b['defaultModel']?_0x2e969b['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Za(_0x3eb926)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new ct(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x187976),_0x45d336(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Kt(this['locale'],{'children':[this['promptInputView']]}),new Kt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x4b42b7,_0x183d96)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x183d96()):_0x183d96();}),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x3c248c=>{this['_focusables']['add'](_0x3c248c),this['focusTracker']['add'](_0x3c248c['element']);}),this['keystrokes']['listenTo'](this['element']);}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x2aadf9 of this['_getFormValidators']()){const _0x20ae00=_0x2aadf9();if(_0x20ae00)return this['promptInputView']['errorText']=_0x20ae00,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return us(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x395783=new Ht(this['locale']),t=this['locale']['t'];return _0x395783['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x395783['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x395783;}['_createCancelButtonView'](){const _0x490f5f=new Ht(this['locale']),t=this['locale']['t'];return _0x490f5f['set']({'label':t('Cancel'),'withText':!0x0,'class':ln}),_0x490f5f['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4de658=>{_0x4de658['stopPropagation']();})}}),_0x490f5f['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x490f5f;}['_setModelList'](_0xa4d231){this['_modelSelectionDropdownItems']['clear']();const _0x563904=this['_check']['models'];if(_0xa4d231)this['set']('modelDisplayMode','hidden');else{const _0xa2c0e4=0x1===_0x563904['length'];this['set']('modelDisplayMode',_0xa2c0e4?'name':'selector');}if(this['resetToDefault'](),_0x563904?.['length']){0x1===_0x563904['length']&&this['set']('activeModelName',_0x563904[0x0]['name']||_0x563904[0x0]['id']);for(const _0x490575 of _0x563904){const _0x412199=new _0xc45766({'label':_0x490575['name'],'withText':!0x0,'role':'menuitemradio','id':_0x490575['id'],'model':_0x490575});_0x412199['bind']('isOn')['to'](this,'modelId',_0x22a7c5=>_0x22a7c5===_0x490575['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x412199,'labelView':new ih(this['locale'],_0x490575)});}}}['_createModelSelectionDropdown'](){const _0x2ad1a0=_0x178550(this['locale']);return _0x2ad1a0['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x2ad1a0['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':ln}),_0x2ad1a0['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x99285e=>'selector'===_0x99285e),this['listenTo'](_0x2ad1a0,'execute',_0x567620=>{this['modelId']=_0x567620['source']['model']['id'],_0x2ad1a0['buttonView']['label']=_0x567620['source']['label'];}),_0x2ad1a0;}['_createModelNameView'](){const _0x563c0f=new eh(this['locale']);return _0x563c0f['bind']('text')['to'](this,'activeModelName',_0x1f476b=>_0x1f476b??''),_0x563c0f['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3c1fe7=>'name'===_0x3c1fe7),_0x563c0f;}['_createActionsFooterView'](){const _0x185d7c=new _0x5afcc4(this['locale']);return _0x185d7c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x185d7c;}},eh=class extends _0x5afcc4{constructor(_0x151d3e){super(_0x151d3e),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x45ee9e=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x45ee9e['if']('isVisible','ck-hidden',_0x248bc5=>!_0x248bc5)]},'children':[{'text':_0x45ee9e['to']('text')}]});}},ih=class extends Dt{constructor(_0x4946a4,_0x206a1f){super();const _0x4e3cba=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x4e3cba['to']('style'),'id':_0x4e3cba['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x4e3cba['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x206a1f['description']||'']}]}]});}},sh=class extends zt{['_formItemsCollection']=new _0x1c61f8();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x31b2b0,_0x308886,_0x288755,_0x1cd3d6=!0x1){super(_0x31b2b0),this['_hideModels']=_0x1cd3d6,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x308886['isParameterized']);const _0x20dbc4=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',_0x344c6b=>_0x344c6b),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x38c8de=>_0x38c8de)],'style':{'--ck-ai-review-check-list-item-index':_0x288755}},'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':_0x308886['title']}]},_0x20dbc4]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x308886['description']?[{'text':_0x308886['description']}]:[]}]}]},..._0x308886['isParameterized']?[this['_createParameterizedView'](_0x308886)]:[],...'custom'===_0x308886['id']?[this['_createCustomView'](_0x308886,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x308886['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x308886['id'],'args':_0x308886['useArgs']?_0x308886['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x3f90e8({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x2f1c94=>{_0x2f1c94['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x4be89d=new Yt();return _0x4be89d['content']=_0x131eba,_0x4be89d['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x4be89d;}['_createParameterizedView'](_0x3c20ad){const _0x16eef7=new _0x5afcc4(),_0x375d84=this['_createFormView'](_0x3c20ad);return _0x16eef7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x1923c6=>!_0x1923c6)]},'children':[_0x375d84]}),_0x16eef7;}['_createFormView'](_0x52dbb0){const _0x53afd8=new _0x5afcc4(),_0x2b386b=Array['isArray'](_0x52dbb0['options'])?_0x52dbb0['options']:[],_0x62383b=new Ht(this['locale']),t=this['locale']['t'];_0x62383b['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x62383b['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xb8649b=>{_0xb8649b['stopPropagation']();})}}),_0x62383b['on']('execute',()=>{const _0x722ae7=[],_0x316508={};this['_formItemsCollection']['forEach'](_0x3a2030=>{_0x722ae7['push'](_0x3a2030['value']),_0x52dbb0['useArgs']&&_0x52dbb0['options']&&(_0x316508[_0x3a2030['argsKey']]=_0x3a2030['value']);}),this['fire']('runReviewCheck',{'id':_0x52dbb0['id'],'params':_0x722ae7['length']?_0x722ae7:void 0x0,'args':Object['keys'](_0x316508)['length']?_0x316508:void 0x0});});const _0x17c5be=_0x2b386b['length'];return _0x2b386b['forEach']((_0x3592b0,_0x44e963)=>{const _0x590aaa=_0x44e963===_0x17c5be-0x1;this['_formItemsCollection']['add'](new Ja(this['locale'],_0x3592b0,_0x590aaa?_0x62383b:null));}),_0x53afd8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x53afd8;}['_createCustomView'](_0x478cef,_0x861a86=!0x1){return this['_customCheckView']=new th(this['locale'],_0x478cef,_0x861a86),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',_0x1edf2f=>!_0x1edf2f)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0xe122b7,_0xc41a99,_0x203c7d)=>{_0x203c7d||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},nh=class extends zt{['_checkViews'];constructor(_0x4fe09a){super(_0x4fe09a),this['_checkViews']=new _0x1c61f8(),this['_setupTemplate']();}['setChecks'](_0xa70507,_0x599cd9=!0x1){this['_checkViews']['clear']();for(const [_0x38624e,_0x1edd80]of _0xa70507['entries']()){const _0x1cc525=new sh(this['locale'],_0x1edd80,_0x38624e,_0x599cd9);_0x1cc525['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x1cc525);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x2da854 of this['_checkViews'])_0x2da854 instanceof sh&&_0x2da854['resetToDefault']();}['_setupTemplate'](){const _0x461e51=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x461e51['if']('isVisible','ck-hidden',_0x4e29ab=>!_0x4e29ab)]},'children':this['_checkViews']});}},rh=class extends Ya{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x5738ea=this['context']['plugins']['get']('AITabs'),_0x316762=this['context']['locale'],_0x518d7e=new Mo(_0x316762,{'label':us(_0x316762,'AI_REVIEW_MODE'),'icon':_0x5af653,'class':'ck-ai-header_review','showResizeButton':_0x5738ea['showResizeButton']});return _0x518d7e['delegate']('resizeTabs')['to'](_0x5738ea),_0x518d7e['bind']('isMaximized')['to'](_0x5738ea['view'],'isMaximized',_0x49febc=>_0x49febc),new qa(this['context']['locale'],{'header':_0x518d7e,'list':new nh(_0x316762),'results':new Xa(_0x316762,{'generalErrorText':us(_0x316762,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x316762,{'headerText':us(_0x316762,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x316762,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x316762,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x397066=this['context']['plugins']['get']('AITabs');_0x397066['view']['on']('activateTab',(_0x578dbc,{newTab:_0xfcb0be,oldTab:_0x2f8c0a})=>{'reviewMode'===_0xfcb0be?this['fire']('getReviewCheckList'):'reviewMode'===_0x2f8c0a&&this['fire']('leaveReview');}),_0x397066['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x5af653,'order':0x0,'content':this['_mainView']});}};const oh='review-',ah=['softBreak'],hh=['htmlScript','htmlStyle','htmlCustomElement'];var ch=class extends _0x215b79{static get['requires'](){return[_0x598e2f,Is];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x2d21df){super(_0x2d21df),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x412bec=_0x334592=>this['_scheduleAttachReviewEditingToEditor'](_0x334592);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x21f3b4)return void _0x412bec(this['context']);const _0x45c20e=this['context'];for(const _0xa12a3 of _0x45c20e['editors'])_0x412bec(_0xa12a3);this['listenTo'](_0x45c20e['editors'],'add',(_0x54ea8c,_0x32e6c3)=>{_0x412bec(_0x32e6c3);}),this['listenTo'](_0x45c20e['editors'],'remove',(_0x5c26b9,_0x3db2e6)=>{for(const [_0x1b477c,_0xf878ed]of this['_markers'])_0xf878ed['editor']===_0x3db2e6&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x1b477c,'changeId':_0xf878ed['groupId']}),this['_markers']['delete'](_0x1b477c));});}['_scheduleAttachReviewEditingToEditor'](_0x40b2b1){const _0x478dbc=()=>{'destroyed'!==_0x40b2b1['state']&&_0x40b2b1['conversion']&&this['_attachReviewEditingToEditor'](_0x40b2b1);};if('ready'===_0x40b2b1['state'])return void _0x478dbc();const _0x2b296e=()=>{this['stopListening'](_0x40b2b1,'ready',_0x2b296e),_0x478dbc();};this['listenTo'](_0x40b2b1,'ready',_0x2b296e);}['_attachReviewEditingToEditor'](_0x4e03ba){this['_reviewEditingAttachedEditors']['has'](_0x4e03ba)||(_0x4e03ba['conversion']['for']('editingDowncast')['markerToElement']({'model':oh+'insert','view':(_0x395cbc,{writer:_0x363bed})=>{const _0x1d0e78=this['_markers']['get'](_0x395cbc['markerName']),_0x2a5b2a={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x1d0e78?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x395cbc['markerName']};return _0x363bed['createUIElement']('span',_0x2a5b2a,function(_0x3519b1){const _0x1bf441=this['toDomElement'](_0x3519b1);return _0x1bf441['innerHTML']=_0x1d0e78?.['content']?.['asString']||'',_0x1bf441;});}}),_0x4e03ba['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-only','view':_0xb063f=>{const _0xc00d34=this['_markers']['get'](_0xb063f['markerName']),_0x351e57=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0xc00d34?.['id']||'')&&_0x351e57['push']('ck-ai_review__change_active'),{'classes':_0x351e57,'attributes':{'data-marker-id':_0xb063f['markerName']}};}}),_0x4e03ba['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-context','view':_0x38edc9=>{const _0x4a5789=this['_markers']['get'](_0x38edc9['markerName']),_0x23df5b=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x4a5789?.['id']||'')&&_0x23df5b['push']('ck-ai_review__change_active'),{'classes':_0x23df5b,'attributes':{'data-marker-id':_0x38edc9['markerName']}};}}),_0x4e03ba['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-text','view':_0x1e2881=>{const _0xf611b5=this['_markers']['get'](_0x1e2881['markerName']),_0xd794d2=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0xf611b5?.['id']||'')&&_0xd794d2['push']('ck-ai_review__change_active'),{'classes':_0xd794d2,'attributes':{'data-marker-id':_0x1e2881['markerName']}};}}),_0x4e03ba['conversion']['for']('dataDowncast')['markerToElement']({'model':oh+'suggestion-context','view':(_0x46258d,{writer:_0x2abefb})=>_0x2abefb['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x46258d['isOpening']?'start':'end')})}),_0x4e03ba['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x19a42d,'view':_0x263357}),this['_updateMouseMarkerInteractionListeners'](_0x4e03ba),this['listenTo'](_0x4e03ba,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4e03ba),{'priority':'lowest'}),this['listenTo'](_0x4e03ba,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4e03ba),{'priority':'lowest'}),_0x4e03ba['model']['document']['registerPostFixer'](_0x18cb8e=>this['_validateMarkers'](_0x4e03ba,_0x18cb8e)),_0x4e03ba['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x4e03ba)),this['_reviewEditingAttachedEditors']['add'](_0x4e03ba));}['_updateMouseMarkerInteractionListeners'](_0x39c735){let _0x175454=this['_boundEditables']['get'](_0x39c735);_0x175454||(_0x175454=new Map(),this['_boundEditables']['set'](_0x39c735,_0x175454));const _0x5c9d67=new Set(_0x39c735['ui']['getEditableElementsNames']());for(const _0x3355d4 of _0x5c9d67){if(_0x175454['has'](_0x3355d4))continue;const _0x41cd29=_0x39c735['ui']['getEditableElement'](_0x3355d4);_0x175454['set'](_0x3355d4,_0x41cd29),this['_attachMouseMarkerInteractionListeners'](_0x41cd29);}for(const [_0x3e44f7,_0x170c51]of _0x175454)_0x5c9d67['has'](_0x3e44f7)||(_0x175454['delete'](_0x3e44f7),this['_domEmitter']['stopListening'](_0x170c51));}['_attachMouseMarkerInteractionListeners'](_0x1c5bbb){this['_domEmitter']['listenTo'](_0x1c5bbb,'mouseup',(_0x162d8f,_0x3cbf82)=>{const _0x366edb=_0x3cbf82['target'],_0x4c332a=this['_findMarkerElement'](_0x366edb);if(!_0x4c332a)return;const _0x639844=_0x4c332a['getAttribute']('data-marker-id'),_0x313d8b=_0x639844['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x639844,'changeId':_0x313d8b,'markerElement':()=>this['_findMarkerElementById'](_0x639844),'domEvent':_0x3cbf82});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1c5bbb,'mouseover',(_0x5afa2c,_0x1f44b5)=>{const _0x26bd8c=_0x1f44b5['target'],_0x331df4=_0x1f44b5['relatedTarget'];let _0x205a53=this['_findMarkerElement'](_0x26bd8c);if(!_0x205a53&&_0x331df4&&(_0x205a53=this['_findMarkerElement'](_0x331df4)),!_0x205a53)return;const _0x10a8ed=_0x205a53['getAttribute']('data-marker-id'),_0x46360b=_0x10a8ed['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x46360b,'markerElement':()=>this['_findMarkerElementById'](_0x10a8ed),'domEvent':_0x1f44b5});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x134ee8((_0x37670c,_0x176ca0)=>{const _0x21ead7=_0x176ca0['target'];this['_findMarkerElement'](_0x21ead7)||_0x21ead7['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x247690=this['context']['plugins']['get']('AIEditing'),_0x4e3d41=ds(this['context']);if(!_0x4e3d41['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0xef047c=new Set(),_0x2c47fb=[],_0x3e1e59=new Map();for(const _0x500db3 of _0x4e3d41)for(const _0x520b98 of _0x500db3['model']['document']['getRoots']()){if('$graveyard'===_0x520b98['rootName'])continue;const _0x2a7581=this['_buildDocumentDataSliceForRoot'](_0x500db3,_0x520b98,_0x247690,_0xef047c);_0x2c47fb['push'](_0x2a7581['content']);for(const [_0x580f58,_0x1cbe2d]of _0x2a7581['elements'])_0x3e1e59['set'](_0x580f58,_0x1cbe2d);}return{'elements':_0x3e1e59,'content':_0x2c47fb['join']('')};}['_buildDocumentDataSliceForRoot'](_0x937980,_0x4a8281,_0x43f6ea,_0x5ee2dd){const _0x59cbcc=_0x937980['model'],_0x3e9f99=new _0x3ce28b();for(const _0x1052a8 of _0x4a8281['getChildren']())_0x3e9f99['_appendChild'](_0x1052a8['_clone'](!0x0));for(const _0x7b9ff9 of _0x59cbcc['markers']){const _0x4be037=_0x7b9ff9['getRange']();_0x4be037&&_0x4be037['root']['rootName']===_0x4a8281['rootName']&&_0x3e9f99['markers']['set'](_0x7b9ff9['name'],this['_changeRangeOwnerDocument'](_0x4be037['clone'](),_0x3e9f99));}const _0x1f672d=new Map(),_0x197baf=_0x59cbcc['document']['version'],_0x555d71=new _0x442751({'ignoreElementEnd':!0x0,'startPosition':_0x59cbcc['createPositionAt'](_0x3e9f99,0x0)});for(const {item:_0x39bfe9}of _0x555d71){if(_0x39bfe9['is']('element')&&_0x39bfe9['name']&&hh['includes'](_0x39bfe9['name'])){const _0x543c0f=this['_upsertDataId'](_0x39bfe9,()=>_0x43f6ea['_nextDataId'](_0x5ee2dd));_0x5ee2dd['add'](_0x543c0f);}if(!_0x39bfe9['is']('$textProxy'))continue;const _0x5ef18b=_0x39bfe9['parent'];if(!_0x5ef18b||!_0x5ef18b['is']('element'))continue;const _0x176306=this['_upsertDataId'](_0x5ef18b,()=>_0x43f6ea['_nextDataId'](_0x5ee2dd));_0x5ee2dd['add'](_0x176306);for(const _0x36a9df of _0x5ef18b['getChildren']())_0x36a9df['is']('element')&&(_0x36a9df['name']&&ah['includes'](_0x36a9df['name'])||_0x5ee2dd['add'](this['_upsertDataId'](_0x36a9df,()=>_0x43f6ea['_nextDataId'](_0x5ee2dd))));let _0x19f219=_0x5ef18b;for(;_0x19f219['parent']&&!_0x19f219['parent']['is']('documentFragment');)_0x19f219=_0x19f219['parent'],_0x19f219['hasAttribute'](_0x19a42d)&&_0x19f219['_removeAttribute'](_0x19a42d);_0x1f672d['set'](_0x176306,{'editor':_0x937980,'rootName':_0x4a8281['rootName'],'path':_0x5ef18b['getPath'](),'documentVersion':_0x197baf,'getContent':this['_createGetContentUsingDataIdFn'](_0x19f219['_clone'](!0x0),_0x176306,_0x937980['data'])}),_0x555d71['jumpTo'](_0x59cbcc['createPositionAfter'](_0x5ef18b));}return{'content':_0x937980['data']['processor']['toData'](_0x937980['data']['toView'](_0x3e9f99)),'elements':_0x1f672d};}['diffContent'](_0x449b25,_0x5c2e77,_0x4adda7,_0x4a8b0d=!0x1){const {contentInitial:_0x2d50a0,contentNew:_0xe7e23b}=this['_neutralizeChangesOnUnsupportedElements'](_0x5c2e77,_0x4adda7),_0x193f12=[],_0x50e9d4=_0x449b25['data']['parse'](_0xe7e23b,'$documentFragment'),_0x22345b=_0x449b25['data']['parse'](_0x2d50a0,'$documentFragment'),_0x12bbdf=_0x449b25['model']['createPositionAt'](_0x22345b,0x0);if(this['_haveSingleTopLevelElement'](_0x50e9d4)){if(!this['_hasSameTopLevelElement'](_0x22345b,_0x50e9d4))return _0x193f12;}else{const _0x20cc85=_0x449b25['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x22345b,_0x20cc85)||!this['_haveOnlyInlineContent'](_0x50e9d4,_0x20cc85))return _0x193f12;}const _0x5690b0=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x2d50a0,_0xe7e23b,{'targetEditor':_0x449b25,'anchor':_0x12bbdf,'markDeletions':!0x0})['getOperations']()['filter'](_0x5d86a5=>'insert'===_0x5d86a5['type']||'marker'===_0x5d86a5['type']&&_0x5d86a5['name']['startsWith']('$markedRemove')),_0x226976=this['_groupAdjacentOperations'](_0x5690b0),_0x28961a=[];if(_0x4a8b0d){if(_0x226976['length']){const _0x5c0ea3=_0x226976[0x0]['operations'][0x0],_0x43443b='insert'===_0x5c0ea3['type']?_0x5c0ea3['position']:_0x5c0ea3['newRange']['start'],_0x12db2f=this['_getPositionLimitingRange'](_0x43443b,_0x449b25,'inside'),_0x5332d1=_0x12db2f?_0x50e9d4['getChild'](0x0)['getChildren']():_0x50e9d4['getChildren'](),_0x5b6838=_0x12db2f||_0x449b25['model']['createRangeIn'](_0x22345b),_0x185f3a=[new _0x31888e('$markedRemove:synthetic'+vt(),null,_0x5b6838,_0x449b25['model']['document']['model']['markers'],!0x0,_0x449b25['model']['document']['version']+0x1),new _0x175945(_0x5b6838['end'],_0x5332d1,_0x449b25['model']['document']['version']+0x2)];_0x28961a['push']({'operations':_0x185f3a,'operationsIsolated':_0x185f3a,'groupOffset':0x0});}}else _0x28961a['push'](..._0x226976);let _0x1bb09a=0x0;return _0x449b25['model']['change'](_0x1e43f9=>{for(let _0x9337f8=0x0;_0x9337f8<_0x28961a['length'];_0x9337f8++){const _0x38e4bd=_0x28961a[_0x9337f8],_0x59f4a3=_0x1e43f9['createDocumentFragment']();for(const _0x150850 of _0x22345b['getChildren']())_0x1e43f9['append'](_0x150850['_clone'](!0x0),_0x59f4a3);for(const _0x45c198 of _0x38e4bd['operationsIsolated'])if('insert'===_0x45c198['type']){const _0x58498f=_0x45c198;_0x58498f['baseVersion']=null,_0x58498f['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x58498f,_0x59f4a3),_0x1e43f9['batch']['addOperation'](_0x45c198),_0x449b25['model']['applyOperation'](_0x45c198);const _0x4a46c1='suggestion:insertion:id:authorId:'+_0x1bb09a++,_0x47952e=_0x449b25['model']['createRange'](_0x58498f['position'],_0x58498f['position']['getShiftedBy'](_0x58498f['howMany']));_0x59f4a3['markers']['set'](_0x4a46c1,_0x47952e);}else{if('marker'===_0x45c198['type']&&_0x45c198['name']['startsWith']('$markedRemove')){const _0x470c1e=_0x45c198,_0x215f6d='suggestion:deletion:id:authorId:'+_0x1bb09a++;this['_changeOperationOwnerDocument'](_0x470c1e,_0x59f4a3),_0x59f4a3['markers']['set'](_0x215f6d,_0x470c1e['newRange']);}}if(_0x4a8b0d)_0x193f12['push']({..._0x38e4bd,'context':this['_createGetContentFn'](_0x22345b,_0x449b25['data']),'content':this['_createGetContentFn'](_0x22345b,_0x449b25['data'])});else{const _0xc95219=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x38e4bd['operationsIsolated'][0x0]),_0x59f4a3),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x38e4bd['operationsIsolated'][_0x38e4bd['operationsIsolated']['length']-0x1]),_0x59f4a3),_0x449b25);_0x59f4a3['markers']['set'](oh+'suggestion-context',new _0x217c33(_0xc95219['start'],_0xc95219['end'])),_0x193f12['push']({..._0x38e4bd,'context':this['_createGetContextFn'](_0x59f4a3,_0x449b25['data'],{'ellipsisBefore':_0xc95219['hasContentBefore'],'ellipsisAfter':_0xc95219['hasContentAfter']}),'content':this['_createGetContentFn'](_0x59f4a3,_0x449b25['data'])});}}}),_0x193f12;}['markChangePositionInEditorContent'](_0x35a1a8,_0x1fabeb){if(!_0x35a1a8['length'])return;const _0x270e49=_0x35a1a8[0x0]['parent']['id'],_0x112390=_0x1fabeb['elements']['get'](_0x270e49);if(!_0x112390)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x270e49);const _0x455ce9=_0x112390['path'],_0x152e47=_0x112390['editor'],_0x53e487=_0x152e47['model']['document']['getRoot'](_0x112390['rootName']);if(!_0x53e487)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x112390['rootName']);const _0x5c835f=_0x152e47['model']['document']['history']['getOperations'](_0x112390['documentVersion']),_0x2eab6b=[];for(const _0x29f153 of _0x35a1a8){const _0x30d952=_0x29f153['operationsIsolated']['map'](_0x364d72=>this['_translateOperationToEditorContent'](_0x364d72,_0x455ce9,_0x53e487));if(!_0x30d952||!_0x30d952['length'])continue;const _0x140a8d=_0x30d952['every'](_0x54f122=>'marker'===_0x54f122['type']&&_0x54f122['name']['startsWith']('$markedRemove')),_0xfe3595=_0x25b633(_0x30d952,_0x5c835f,{'document':_0x152e47['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x2e0f3e of _0xfe3595)if('insert'===_0x2e0f3e['type']){const _0x3cc8d9=_0x2e0f3e,_0xd0003a=_0x3cc8d9['nodes'];_0x152e47['model']['change'](_0x27240f=>{const _0x41e982=_0x27240f['createDocumentFragment']();for(const _0x314b2b of _0xd0003a)_0x27240f['append'](_0x314b2b['_clone'](!0x0),_0x41e982);_0x2eab6b['push']({'start':_0x3cc8d9['position'],'end':_0x3cc8d9['position'],'type':'insert','groupId':_0x29f153['id'],'content':{'asString':this['_createGetContentFn'](_0x41e982,_0x152e47['data'])(),'asFragment':_0x41e982}});});}else{if('marker'===_0x2e0f3e['type']&&_0x2e0f3e['name']['startsWith']('$markedRemove')){const _0xd93568=_0x2e0f3e;let _0x20fdd0='remove-text';if(_0x140a8d){const _0x4edec4=this['_findAdjacentContextDistance'](_0xd93568['newRange']['start'],'backward',_0x152e47['model']['schema']),_0x58a549=this['_findAdjacentContextDistance'](_0xd93568['newRange']['end'],'forward',_0x152e47['model']['schema']);if(_0x4edec4||_0x58a549){const _0x4a6bf8=_0xd93568['newRange']['start']['getShiftedBy'](-_0x4edec4),_0xb3d35=_0xd93568['newRange']['end']['getShiftedBy'](_0x58a549);_0x2eab6b['push']({'start':_0x4a6bf8,'end':_0xb3d35,'groupId':_0x29f153['id'],'type':'remove-context'});}else _0x20fdd0='remove-only';}_0x2eab6b['push']({'start':_0xd93568['newRange']['start'],'end':_0xd93568['newRange']['end'],'groupId':_0x29f153['id'],'type':_0x20fdd0});}}}this['_insertMarkers'](_0x2eab6b,_0x152e47);}['clearAllMarkers'](){const _0x37178a=new Map();for(const _0x5d12b7 of this['_markers']['keys']()){const _0x41fac7=this['_markers']['get'](_0x5d12b7);_0x41fac7?.['editor']&&(_0x37178a['has'](_0x41fac7['editor'])||_0x37178a['set'](_0x41fac7['editor'],[]),_0x37178a['get'](_0x41fac7['editor'])['push'](_0x5d12b7));}for(const [_0x1f9b41,_0x3dedb8]of _0x37178a)_0x1f9b41['model']['change'](_0xfbae3=>{for(const _0x485b46 of _0x3dedb8)_0x1f9b41['model']['markers']['get'](_0x485b46)&&_0xfbae3['removeMarker'](_0x485b46);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0xc9c4e7 of ds(this['context']))_0xc9c4e7['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x3742ce of ds(this['context']))_0x3742ce['disableReadOnlyMode']('ai-review');}['applyChange'](_0x822921,_0x539e15=null){const _0x298ea8=_0x822921['map'](_0x2da02f=>this['_getMarkersDataForGroup'](_0x2da02f))['flat'](),_0x312764=new Map();for(const _0x2a5984 of _0x298ea8)_0x312764['has'](_0x2a5984['editor'])||_0x312764['set'](_0x2a5984['editor'],[]),_0x312764['get'](_0x2a5984['editor'])['push'](_0x2a5984);for(const [_0x5b6e48,_0x5d5210]of _0x312764){const _0x420ae5=_0x5b6e48['model'],_0x46815c=_0x5b6e48['plugins']['has']('TrackChangesEditing')?_0x5b6e48['plugins']['get']('TrackChangesEditing'):null,_0x43b724=_0x539e15&&_0x46815c?new Set(_0x46815c['getSuggestions']()['map'](_0x1327cd=>_0x1327cd['id'])):null;_0x420ae5['change'](_0x23424b=>{const _0x2f4dc0=_0x23424b['batch']['operations']['length'];for(const _0x33e218 of _0x5d5210){const _0xdd99fc=_0x5b6e48['model']['markers']['get'](_0x33e218['id']);if(_0xdd99fc){if('insert'===_0x33e218['type']){if(!_0x33e218['content'])continue;_0x420ae5['insertContent'](_0x33e218['content']['asFragment']||null,_0xdd99fc['getRange']()['start']);}else'remove-text'!==_0x33e218['type']&&'remove-only'!==_0x33e218['type']||_0x420ae5['deleteContent'](_0x420ae5['createSelection'](_0xdd99fc['getRange']()));_0x23424b['removeMarker'](_0x33e218['id']),this['_markers']['delete'](_0x33e218['id']);}}if(_0x539e15&&(Js(_0x23424b['batch']['operations']['slice'](_0x2f4dc0),_0x539e15),_0x46815c)){for(const _0x52cdc2 of _0x46815c['getSuggestions']())_0x43b724['has'](_0x52cdc2['id'])||_0x52cdc2['setAttribute']('@ai',{'type':_0x539e15});}});}}['rejectChange'](_0x2256ad){const _0x56b5d8=this['_getMarkersDataForGroup'](_0x2256ad),_0x2ec451=new Map();for(const _0x45ec9a of _0x56b5d8)_0x2ec451['has'](_0x45ec9a['editor'])||_0x2ec451['set'](_0x45ec9a['editor'],[]),_0x2ec451['get'](_0x45ec9a['editor'])['push'](_0x45ec9a);for(const [_0x42de69,_0x1ef1c2]of _0x2ec451)_0x42de69['model']['change'](_0x484534=>{for(const _0x405358 of _0x1ef1c2)_0x484534['removeMarker'](_0x405358['id']),this['_markers']['delete'](_0x405358['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x26a601){return this['_getMarkersDataForGroup'](_0x26a601)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x21fafb){const _0x31cf6f=Array['from'](this['_markers']['values']())['filter'](_0x4b0b61=>_0x4b0b61['groupId']===_0x21fafb);if(!_0x31cf6f['length'])return null;const _0xe49ac7=0x1===_0x31cf6f['length']?_0x31cf6f[0x0]:this['_sortMarkers'](_0x31cf6f)[0x0],_0x2baa12=_0xe49ac7['editor']['model']['markers']['get'](_0xe49ac7['id']);return _0x2baa12?{'modelRange':_0x2baa12['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0xe49ac7['id'])}:null;}['getContentElementForChange'](_0x452911){const _0x2617b8=Array['from'](this['_markers']['values']())['filter'](_0x376a0b=>_0x376a0b['groupId']===_0x452911);if(!_0x2617b8['length'])return null;const _0x22be42=0x1===_0x2617b8['length']?_0x2617b8[0x0]:this['_sortMarkers'](_0x2617b8)[0x0],_0x4a19ec=_0x22be42['editor'],_0x254674=_0x4a19ec['model']['markers']['get'](_0x22be42['id']);if(!_0x254674)return null;const _0x4c9bf6=_0x254674['getRange'](),_0x1d42fd=_0x4a19ec['editing']['view']['getDomRoot'](_0x4c9bf6['root']['rootName'])||_0x4a19ec['editing']['view']['getDomRoot']();if(!_0x1d42fd||!_0x4c9bf6)return null;let _0x57cd93=_0x4c9bf6['start']['parent'];for(;_0x57cd93['parent']&&!_0x57cd93['parent']['is']('rootElement');)_0x57cd93=_0x57cd93['parent'];if(!_0x57cd93||!_0x57cd93['name'])return null;const _0x8a82ce=_0x1d42fd['querySelector']('[data-marker-id=\x22'+_0x22be42['id']+'\x22]');if(!_0x8a82ce)return null;let _0x2cf75b=null;_0x4a19ec['model']['change'](_0x407f3d=>{_0x2cf75b=_0x407f3d['createDocumentFragment'](),_0x407f3d['append'](_0x57cd93['_clone'](!0x0),_0x2cf75b);});const _0x4b0746=_0x4a19ec['data']['toView'](_0x2cf75b)['getChild'](0x0);return _0x8a82ce['closest'](_0x4b0746['name']);}['reactivateMarkers'](_0x26ada7){const _0x3ea74e=this['_getMarkersDataForGroup'](_0x26ada7);if(!_0x3ea74e['length'])return;const _0x358cd2=Array['from'](this['_activeMarkers'])['sort'](),_0x4e7099=Array['from'](new Set(_0x3ea74e['map'](_0x40d35e=>_0x40d35e['id'])))['sort']();_0x358cd2['join']('|')!==_0x4e7099['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x26ada7));}['setMarkersInElementAsActive'](_0x412027){const _0x746f60=this['_getMarkersDataForGroup'](_0x412027);if(!_0x746f60['length'])return;const _0x353f0e=_0x746f60[0x0]['editor'],_0x34be71=new Set(_0x746f60['map'](_0x515551=>_0x515551['id'])),_0x26671e=Array['from'](_0x34be71['values']())['map'](_0x217ebb=>_0x353f0e['model']['markers']['get'](_0x217ebb))['filter'](_0x164010=>!!_0x164010);_0x34be71['forEach'](_0x341c7d=>{this['_activeMarkers']['add'](_0x341c7d);}),_0x353f0e['model']['change'](()=>{_0x26671e['forEach'](_0x42ea29=>{_0x353f0e['editing']['reconvertMarker'](_0x42ea29);});});}['setAllMarkersAsInactive'](){const _0x75a823=Array['from'](this['_activeMarkers']);if(!_0x75a823['length'])return;this['_activeMarkers']['clear']();const _0x3dd077=new Map();for(const _0xdfeffc of _0x75a823){const _0x634e0f=this['_markers']['get'](_0xdfeffc);if(!_0x634e0f)continue;const _0xc1bb2b=_0x634e0f['editor'],_0x92335a=_0xc1bb2b['model']['markers']['get'](_0xdfeffc);_0x92335a&&(_0x3dd077['has'](_0xc1bb2b)||_0x3dd077['set'](_0xc1bb2b,[]),_0x3dd077['get'](_0xc1bb2b)['push'](_0x92335a));}for(const [_0x2953b9,_0x5e7d40]of _0x3dd077)_0x2953b9['model']['change'](()=>{_0x5e7d40['forEach'](_0x2024b3=>{_0x2953b9['editing']['reconvertMarker'](_0x2024b3);});});}['_getPositionLimitingRange'](_0x462178,_0x5b47a4,_0x470bb8='outside'){if(!_0x462178)return null;let _0x58f1b1=_0x462178['parent'];for(;_0x58f1b1&&_0x58f1b1['parent']&&!_0x58f1b1['parent']['is']('rootElement')&&!_0x5b47a4['model']['schema']['isLimit'](_0x58f1b1)&&!_0x5b47a4['model']['schema']['isBlock'](_0x58f1b1);)_0x58f1b1=_0x58f1b1['parent'];if(!_0x58f1b1||!_0x58f1b1['name']||_0x58f1b1['is']('rootElement'))return null;let _0x569d49=null;return _0x5b47a4['model']['change'](_0x11b643=>{_0x569d49='inside'===_0x470bb8?_0x11b643['createRangeIn'](_0x58f1b1):_0x11b643['createRangeOn'](_0x58f1b1);}),_0x569d49;}['_validateMarkers'](_0x33bc5d,_0x163604){const _0x236e1b=Array['from'](this['_markers']['keys']()),_0x4b0fed=new Map();for(const _0x48a6fc of _0x236e1b){const _0x75932b=_0x33bc5d['model']['markers']['get'](_0x48a6fc);if(!_0x75932b)continue;const _0x52f8d2=_0x75932b['getStart']()['root']['rootName']+':'+_0x75932b['getStart']()['path'][0x0];_0x4b0fed['has'](_0x52f8d2)||_0x4b0fed['set'](_0x52f8d2,[]),_0x4b0fed['get'](_0x52f8d2)['push'](_0x75932b);}const _0x7b5b41=new Set();for(const _0x262302 of _0x33bc5d['model']['document']['differ']['getChanges']()){let _0x493d05='',_0x306dab=null;if('insert'===_0x262302['type'])_0x306dab=new _0x217c33(_0x262302['position'],_0x262302['position']['getShiftedBy'](_0x262302['length'])),_0x493d05=_0x262302['position']['root']['rootName']+':'+_0x262302['position']['path'][0x0];else{if('remove'!==_0x262302['type'])continue;_0x306dab=new _0x217c33(_0x262302['position']),_0x493d05=_0x262302['position']['root']['rootName']+':'+_0x262302['position']['path'][0x0];}const _0x22c6f8=_0x4b0fed['get'](_0x493d05)||[];if(_0x22c6f8['length']){for(const _0x516375 of _0x22c6f8)if(_0x306dab['root']['rootName']===_0x516375['getRange']()['root']['rootName']&&('insert'!==_0x262302['type']||!_0x306dab['containsRange'](_0x516375['getRange']()))&&(_0x306dab['isIntersecting'](_0x516375['getRange']())||_0x306dab['start']['isTouching'](_0x516375['getRange']()['end'])||_0x306dab['end']['isTouching'](_0x516375['getRange']()['start']))){const _0x1b68e5=this['_parseMarkerName'](_0x516375['name']);Array['from'](this['_markers']['values']())['filter'](_0x5b03d5=>_0x5b03d5['groupId']===_0x1b68e5['groupId'])['forEach'](_0x513865=>_0x7b5b41['add'](_0x513865['id']));}}}if(_0x7b5b41['size']){for(const _0x24a95d of _0x7b5b41)_0x163604['removeMarker'](_0x24a95d);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x86f41d){for(const {name:_0x43e9c8,data:_0x5db475}of _0x86f41d['model']['document']['differ']['getChangedMarkers']()){if(!_0x43e9c8['startsWith'](oh))continue;const _0x5e13b7=_0x5db475['oldRange'],_0x2f9e87=_0x5db475['newRange'],_0x59c6c8=_0x5e13b7&&'$graveyard'===_0x5e13b7['root']['rootName'],_0x47a5f9=_0x2f9e87&&'$graveyard'===_0x2f9e87['root']['rootName'];if(_0x59c6c8&&_0x47a5f9)continue;const _0x536154=this['_parseMarkerName'](_0x43e9c8);this['_markers']['get'](_0x43e9c8)&&(_0x47a5f9||!_0x2f9e87?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x43e9c8,'changeId':_0x536154['groupId']}):_0x59c6c8&&_0x2f9e87&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x43e9c8,'changeId':_0x536154['groupId']}));}}['_parseMarkerName'](_0x2612d0){const _0x1cde5b=_0x2612d0['split'](':'),_0x5ebe3d=(_0x1cde5b[0x1]||'')['split']('_');return{'prefix':_0x1cde5b[0x0],'groupId':_0x5ebe3d[0x0],'suffix':_0x5ebe3d[0x1]};}['_translateOperationToEditorContent'](_0x53e860,_0x453b8e,_0x106e92){if('insert'===_0x53e860['type']){const _0x5a56a7=_0x53e860;return new _0x175945(this['_changePosition'](_0x453b8e['concat'](_0x5a56a7['position']['offset']),_0x106e92),_0x5a56a7['nodes'],_0x5a56a7['baseVersion']);}if('marker'===_0x53e860['type']&&_0x53e860['name']['startsWith']('$markedRemove')){const _0x4176e8=_0x53e860;return new _0x31888e(_0x4176e8['name'],_0x4176e8['oldRange'],this['_changeRange'](_0x4176e8['newRange'],_0x453b8e['concat'](_0x4176e8['newRange']['start']['offset']),_0x453b8e['concat'](_0x4176e8['newRange']['end']['offset']),_0x106e92),_0x4176e8['_markers'],_0x4176e8['affectsData'],_0x4176e8['baseVersion']);}return _0x53e860;}['_groupAdjacentOperations'](_0xf112b1){if(!_0xf112b1['length'])return[];const _0x38c744=[];let _0x3e9ae8=0x0,_0x417985=0x0,_0x4f9239=[];for(let _0x170c35=0x0;_0x170c35<=_0xf112b1['length'];_0x170c35++){const _0x4ac124=_0xf112b1[_0x170c35],_0x5015df=_0xf112b1[_0x170c35-0x1];!_0x4ac124||_0x5015df&&!this['_getOperationEnd'](_0x5015df)['isTouching'](this['_getOperationStart'](_0x4ac124))?(_0x38c744['push']({'operations':_0x4f9239,'operationsIsolated':_0x4f9239['map'](_0x30c03c=>this['_shiftOperation'](_0x30c03c['clone'](),-_0x417985)),'groupOffset':_0x3e9ae8}),_0x4f9239=_0x4ac124?[_0x4ac124]:[],_0x417985+=_0x3e9ae8,_0x3e9ae8=0x0):_0x4f9239['push'](_0x4ac124),_0x4ac124&&'insert'===_0x4ac124['type']&&(_0x3e9ae8+=_0x4ac124['howMany']);}return _0x38c744;}['_findAdjacentContextDistance'](_0x47ef7b,_0x595d9e,_0x46cd82,_0x4b8d03=0x1){const _0x5198ef=new _0x442751({'startPosition':_0x47ef7b,'direction':_0x595d9e});let _0x3d649f=0x0;for(let _0x554dd0=0x0;_0x554dd0<_0x4b8d03;_0x554dd0++){let _0x687bc2=0x0,_0x1f487e=!0x1,_0x19889b='forward'===_0x595d9e?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x778140}of _0x5198ef)if(_0x778140['is']('$textProxy')){const _0x4f2a61=_0x19889b['exec'](_0x778140['data']);if(_0x4f2a61&&_0x4f2a61['length']){if(_0x687bc2+='forward'===_0x595d9e?_0x4f2a61['index']+_0x4f2a61[0x0]['length']:_0x778140['data']['length']-_0x4f2a61['index'],_0x4f2a61[0x0]['length']!==_0x778140['data']['length'])break;_0x1f487e=!0x0,_0x19889b='forward'===_0x595d9e?/^\w+/:/\w+$/;}else{if(_0x1f487e)break;_0x687bc2+=_0x778140['offsetSize'];}}else{if(_0x778140['is']('element')){_0x46cd82['isInline'](_0x778140)&&!_0x1f487e&&(_0x687bc2+=0x1);break;}}_0x3d649f+=_0x687bc2,_0x5198ef['jumpTo'](_0x47ef7b['getShiftedBy']('forward'===_0x595d9e?_0x3d649f:-_0x3d649f));}return _0x3d649f;}['_getChangeContext'](_0x9b21d3,_0x227629,_0x343962){const _0x40600f=_0x343962['model']['schema'],_0x1be1ff=this['_findAdjacentContextDistance'](_0x9b21d3,'backward',_0x40600f,0x6),_0x283165=this['_findAdjacentContextDistance'](_0x227629,'forward',_0x40600f,0x6),_0x58c233=_0x9b21d3['getShiftedBy'](-_0x1be1ff),_0x227446=_0x227629['getShiftedBy'](_0x283165);return{'start':_0x58c233,'end':_0x227446,'hasContentBefore':!_0x58c233['isAtStart'],'hasContentAfter':!_0x227446['isAtEnd']};}['_insertMarkers'](_0x15eb31,_0x35b79c){const _0x5ae6de=this['context']['plugins']['get']('AIEditing'),_0x1a6506=new Set();_0x35b79c['model']['change'](_0x30d8d2=>{for(const _0x471a6d of _0x15eb31){const _0x25fcb5=''+oh+_0x471a6d['type']+':'+_0x471a6d['groupId']+'_'+_0x5ae6de['_nextDataId'](_0x1a6506);this['_markers']['set'](_0x25fcb5,{'id':_0x25fcb5,'groupId':_0x471a6d['groupId'],'type':_0x471a6d['type'],'content':_0x471a6d['content'],'editor':_0x35b79c}),_0x30d8d2['addMarker'](_0x25fcb5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x30d8d2['createRange'](_0x471a6d['start'],_0x471a6d['end'])});}});}['_createGetContextFn'](_0x528cf2,_0x1c03d6,_0x464a36){let _0xd7fdda='';return()=>{if(!_0xd7fdda){const _0x2d90ef=_0x1c03d6['toView'](_0x528cf2,{'showSuggestionHighlights':!0x0});let _0x3e29d6=_0x2d90ef['getChild'](0x0);if(_0x3e29d6['is']('containerElement')||(_0x3e29d6=_0x2d90ef),!_0x3e29d6)return'';let _0x4ecc95=!0x1;const _0x1c3abf=[];for(const _0xde0aa6 of _0x3e29d6['getChildren']())_0xde0aa6['is']('element','span')&&_0xde0aa6['hasClass']('ck-ai_review-marker_context-end')&&(_0x4ecc95=!0x1),_0x4ecc95&&_0x1c3abf['push'](_0xde0aa6),_0xde0aa6['is']('element','span')&&_0xde0aa6['hasClass']('ck-ai_review-marker_context-start')&&(_0x4ecc95=!0x0);_0x3e29d6['_removeChildren'](0x0,_0x3e29d6['childCount']),_0x464a36?.['ellipsisBefore']&&_0x3e29d6['_appendChild']('…'),_0x3e29d6['_appendChild'](_0x1c3abf),_0x464a36?.['ellipsisAfter']&&_0x3e29d6['_appendChild']('…');const _0x168dcd=_0x1c03d6['htmlProcessor']['domConverter']['viewToDom'](_0x2d90ef),_0x434164=_0x1c03d6['htmlProcessor']['htmlWriter']['getHtml'](_0x168dcd);_0xd7fdda=this['_removeUnsupportedElements'](_0x434164);}return _0xd7fdda;};}['_createGetContentFn'](_0x4ef897,_0x97ef88){let _0xfa839f='';return()=>(_0xfa839f||(_0xfa839f=this['_removeUnsupportedElements'](_0x97ef88['stringify'](_0x4ef897,{'showSuggestionHighlights':!0x0}))),_0xfa839f);}['_createGetContentUsingDataIdFn'](_0x139c43,_0x4b99fe,_0x274fc5){let _0x2f0ecc='';return()=>{if(!_0x2f0ecc){const _0xf22f5c=_0x274fc5['toView'](new _0x3ce28b(_0x139c43));_0x2f0ecc=_0x274fc5['htmlProcessor']['domConverter']['viewToDom'](_0xf22f5c)['querySelector']('[data-id=\x22'+_0x4b99fe+'\x22]')?.['outerHTML']||'';}return _0x2f0ecc;};}['_removeUnsupportedElements'](_0x7c2815){if(!_0x7c2815)return'';const _0xcaac7e=ps(_0x7c2815,{'decodeEntities':!0x1}),_0x1f1094=ws(_0xcaac7e);if(!_0x1f1094['length'])return _0x7c2815;for(const _0x13317e of _0x1f1094)_0x1356eb(_0x13317e);return ms(_0xcaac7e,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x3ec51c,_0x2f1c9c){const _0x50303f=ps(_0x3ec51c,{'decodeEntities':!0x1}),_0x135278=ps(_0x2f1c9c,{'decodeEntities':!0x1}),_0xd8f012=ws(_0x50303f),_0x52cb5d=ws(_0x135278);if(!_0xd8f012['length']&&!_0x52cb5d['length'])return{'contentInitial':_0x3ec51c,'contentNew':_0x2f1c9c};const _0xa9f483=new Map();for(const _0x5cad46 of _0xd8f012)_0xa9f483['set'](fs(_0x5cad46,'data-id'),_0x5cad46);for(const _0x3c497e of _0x52cb5d){const _0x1635f0=fs(_0x3c497e,'data-id'),_0x44412f=_0x1635f0?_0xa9f483['get'](_0x1635f0):void 0x0;_0x44412f?_0x11c441(_0x3c497e,_0x3cd9d3(_0x44412f,!0x0)):_0x1356eb(_0x3c497e);}return{'contentInitial':ms(_0x50303f,{'encodeEntities':!0x1}),'contentNew':ms(_0x135278,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0xeff28a,_0x2a5737=0x5){let _0x5b5993=_0xeff28a,_0x53f9d0=null;for(let _0x3c73bd=0x0;_0x3c73bd<_0x2a5737&&_0x5b5993;_0x3c73bd++)if(_0x5b5993['className']){if((''+_0x5b5993['className'])['includes']('ck-ai_review-marker_')){if(!_0x5b5993['getAttribute']('data-marker-id'))break;_0x53f9d0=_0x5b5993;break;}_0x5b5993=_0x5b5993['parentElement'];}else _0x5b5993=_0x5b5993['parentElement'];return _0x53f9d0;}['_findMarkerElementById'](_0x2560d7){const _0x49b298=this['_markers']['get'](_0x2560d7);if(!_0x49b298)return null;const _0x2ebe0d=_0x49b298['editor']['model']['markers']['get'](_0x2560d7);return _0x2ebe0d?_0x5c1ac3(_0x49b298['editor']['editing'],_0x2ebe0d):null;}['_getMarkersDataForGroup'](_0x111906){return Array['from'](this['_markers']['values']())['filter'](_0x5cccd1=>_0x5cccd1['groupId']===_0x111906);}['_getOperationStart'](_0x4ce2ce){return'insert'===_0x4ce2ce['type']?_0x4ce2ce['position']:_0x4ce2ce['newRange']['start'];}['_getOperationEnd'](_0x29dc17,_0x3abec6=!0x1){return'insert'===_0x29dc17['type']?_0x3abec6?_0x29dc17['position']:_0x29dc17['position']['getShiftedBy'](_0x29dc17['howMany']):_0x29dc17['newRange']['end'];}['_shiftOperation'](_0x227b8b,_0x66e2c6){return'insert'===_0x227b8b['type']?_0x227b8b['position']=_0x227b8b['position']['getShiftedBy'](_0x66e2c6):'marker'===_0x227b8b['type']&&_0x227b8b['newRange']&&(_0x227b8b['newRange']=new _0x217c33(_0x227b8b['newRange']['start']['getShiftedBy'](_0x66e2c6),_0x227b8b['newRange']['end']['getShiftedBy'](_0x66e2c6))),_0x227b8b;}['_changeOperationOwnerDocument'](_0x317757,_0x490107){'insert'===_0x317757['type']?_0x317757['position']=this['_changePositionOwnerDocument'](_0x317757['position'],_0x490107):'marker'===_0x317757['type']&&_0x317757['newRange']&&(_0x317757['newRange']=this['_changeRangeOwnerDocument'](_0x317757['newRange'],_0x490107));}['_changePositionOwnerDocument'](_0x3e3e1f,_0x205613){return new _0x167b65(_0x205613,_0x3e3e1f['path']);}['_changeRangeOwnerDocument'](_0x202f6a,_0x4fc88b){return new _0x217c33(this['_changePositionOwnerDocument'](_0x202f6a['start'],_0x4fc88b),this['_changePositionOwnerDocument'](_0x202f6a['end'],_0x4fc88b));}['_changePosition'](_0x304ae9,_0x50fc02){return new _0x167b65(_0x50fc02,[..._0x304ae9]);}['_changeRange'](_0xd22a7,_0x564924,_0x12761e,_0x11e3c0){return new _0x217c33(this['_changePosition'](_0x564924,_0x11e3c0),this['_changePosition'](_0x12761e,_0x11e3c0));}['_sortMarkers'](_0x752dfc){const _0x2fce13=_0x423008=>{switch(_0x423008){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x752dfc['sort']((_0x4c7ac4,_0xee5868)=>_0x2fce13(_0x4c7ac4['type'])-_0x2fce13(_0xee5868['type']));}['_hasSameTopLevelElement'](_0x1988c6,_0x5c761c){const _0x34f8a8=_0x1988c6['getChild'](0x0),_0x334358=_0x5c761c['getChild'](0x0);return!(!_0x34f8a8||!_0x334358)&&((!_0x34f8a8['is']('element')||!_0x334358['is']('element')||_0x34f8a8['name']===_0x334358['name'])&&!(_0x34f8a8['is']('element')&&!_0x334358['is']('element')||!_0x34f8a8['is']('element')&&_0x334358['is']('element')));}['_haveSingleTopLevelElement'](_0x2348b7){return 0x1===_0x2348b7['childCount'];}['_haveOnlyInlineContent'](_0x36d376,_0x1820f2){for(const _0x215f03 of _0x36d376['getChildren']())if(_0x215f03['is']('element')&&!_0x1820f2['isInline'](_0x215f03))return!0x1;return!0x0;}['_upsertDataId'](_0x1eacc1,_0x148669){let _0x19bbc3=_0x1eacc1['getAttribute'](_0x19a42d);return _0x19bbc3||(_0x19bbc3=_0x148669(),_0x1eacc1['_setAttribute'](_0x19a42d,_0x19bbc3)),_0x19bbc3;}};const lh=/* #__PURE__ -- @preserve */
38
+ ut();var uh=class extends lh{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x51971a,contentNew:_0x4a5105,contentInitial:_0x155adb,documentVersion:_0x3791b8}){super(),this['id']=_0x51971a,this['contentNew']=_0x4a5105,this['contentInitial']=_0x155adb,this['documentVersion']=_0x3791b8;}};const dh=/* #__PURE__ -- @preserve */
39
+ gt();var _h=class extends dh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x234500,_0x552326,_0x33a78d){super(),this['id']=_0x234500,this['parent']=_0x33a78d,this['_data']=_0x552326,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const gh=/* #__PURE__ -- @preserve */
40
+ gt();var Ah=class extends gh{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x4e6275,_0x869cc5,_0x3bcae9,_0x43b31b,_0x12beb2){super(),this['_sourceCheck']=_0x869cc5,this['_documentData']=_0x4e6275,this['_aiConnector']=_0x3bcae9,this['_reviewParams']=_0x43b31b,this['_reviewArgs']=_0x12beb2,this['on']('change:status',(_0x426c31,_0x536ab8,_0x229d19)=>{'aborted'==_0x229d19&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x229d19,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x2bf788=>'pending'===_0x2bf788['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x249f1f){this['_documentData']=_0x249f1f;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0xaf6591=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x2db8db of _0xaf6591)'unmodified'!==_0x2db8db['data']['operation']&&('error'!==_0x2db8db['data']['operation']?'review-metadata'!==_0x2db8db['event']?this['_addReviewCheckResult'](_0x2db8db['data']['dataId'],_0x2db8db['data']['textDelta']):this['callId']=_0x2db8db['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(_0x3196ea){this['_currentError']=_0x3196ea,nn(_0x3196ea)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x321828,_0x243746){const _0x3533fd=this['_results']['get'](_0x321828);if(!_0x3533fd)return;if(0x0===_0x243746['length'])return;const _0x5b3cdc=[];_0x243746['forEach']((_0x5bd058,_0x1cdffe)=>{const _0x3fb8d3=new _h(_0x3533fd['id']+'-'+_0x1cdffe,_0x5bd058,_0x3533fd);_0x3fb8d3['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x3fb8d3,'status':_0x3fb8d3['status']});}),_0x3fb8d3['on']('change:isActivated',()=>{_0x3fb8d3['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x3fb8d3}):this['fire']('reviewCheckResultDeactivated',{'change':_0x3fb8d3});}),this['_changes']['push'](_0x3fb8d3),_0x5b3cdc['push'](_0x3fb8d3);}),this['fire']('reviewCheckResultReady',{'changes':_0x5b3cdc,'result':_0x3533fd,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x13f37d){const _0x420369=this['_changes']['find'](_0x26ab8e=>_0x26ab8e['id']===_0x13f37d);return!(!_0x420369||'pending'!==_0x420369['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x5c642b=>!0x0===_0x5c642b['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0xd698a3=>'pending'===_0xd698a3['status']);}['getChangeById'](_0x1aca95){return this['_changes']['find'](_0x69fb41=>_0x69fb41['id']===_0x1aca95);}['markAllChangesAsAccepted'](){for(const _0x552198 of this['_changes'])'pending'===_0x552198['status']&&(_0x552198['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x1a60b9){const _0x5a684d=this['_changes']['find'](_0x4741a6=>_0x4741a6['id']===_0x1a60b9);_0x5a684d&&'pending'===_0x5a684d['status']&&(_0x5a684d['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x1aed6d){const _0x54916f=this['_changes']['find'](_0x8dd7db=>_0x8dd7db['id']===_0x1aed6d);_0x54916f&&'pending'===_0x54916f['status']&&(_0x54916f['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x33e825){const _0x59f64d=this['_changes']['find'](_0x35f3f9=>_0x35f3f9['id']===_0x33e825);_0x59f64d&&'pending'===_0x59f64d['status']&&(_0x59f64d['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x5a2721){const _0x700a07=this['_changes']['find'](_0x284c2c=>_0x284c2c['id']===_0x5a2721);_0x700a07&&'outdated'===_0x700a07['status']&&(_0x700a07['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x1cf8d0){this['_changes']['filter'](_0x3e137b=>_0x3e137b['isActivated']&&_0x3e137b['id']!==_0x1cf8d0)['forEach'](_0x5be0cf=>{_0x5be0cf['isActivated']=!0x1;});const _0x494615=this['_changes']['find'](_0x34cf08=>_0x34cf08['id']===_0x1cf8d0);_0x494615&&'pending'===_0x494615['status']&&(_0x494615['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x3b2cd9=>_0x3b2cd9['isActivated'])['forEach'](_0x15523a=>{_0x15523a['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x302a13){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x1fc7c2;if(_0x302a13){const _0x58b24b=this['_changes']['find'](_0x206a68=>_0x206a68['id']===_0x302a13);if(_0x58b24b&&_0x58b24b['isRated'])return;_0x58b24b&&(_0x1fc7c2=_0x58b24b['parent']['id'],_0x58b24b['isRated']=!0x0);}const _0x28387c={'positiveCount':this['_changes']['filter'](_0x5ca6d3=>'accepted'===_0x5ca6d3['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x28387c,this['callId'],_0x1fc7c2);}['_addReviewCheckResult'](_0x20d08c,_0x59a8ce){const _0x133a22=this['_documentData']['elements']['get'](_0x20d08c);if(!_0x133a22)return;const _0x442198=_0x133a22['getContent']();if(_0x442198===_0x59a8ce)return;const _0xee1f29=new uh({'id':_0x20d08c,'contentInitial':_0x442198,'contentNew':_0x59a8ce,'documentVersion':_0x133a22['documentVersion']});this['_results']['set'](_0xee1f29['id'],_0xee1f29),this['fire']('reviewCheckResultAdded',{'result':_0xee1f29,'source':this,'editor':_0x133a22['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0xdb67da=>'pending'===_0xdb67da['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x4706f1=>'pending'===_0x4706f1['status'])['length']&&(this['status']='finished');}},Ih=class extends Ah{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5c4177=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x555961=0x0;_0x555961<this['_reviewParams']['length'];_0x555961++){if(!this['_reviewParams'][_0x555961]||!this['_sourceCheck']['options'][_0x555961])continue;const _0x238413=this['_sourceCheck']['options'][_0x555961]['data']?.['find'](_0x12b4eb=>_0x12b4eb['id']===this['_reviewParams'][_0x555961]);_0x238413&&_0x5c4177['push'](_0x238413['label']);}return _0x5c4177['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0xcb7063,_0x5b1a99,_0x37a115){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x5b1a99,_0xcb7063,_0x37a115);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},ph=class extends _0x215b79{['_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',(_0x3bb1d3,_0x551969)=>this['runCheck'](_0x551969)),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 _0x2cac63=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x2cac63['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x2cac63['map'](_0x3478fc=>_0x3478fc['id']),this['_aiSource']);const _0x2f5089=this['_currentReviewCheckRun'];_0x2f5089['markAllChangesAsAccepted'](),_0x2f5089['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0xdbb812,_0x4a740)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4a740['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x4a740['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x4a740['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4a740['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0xa30bc2,_0x37fd86)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x37fd86['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x37fd86['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x37fd86['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x37fd86['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0xe4b511,_0x5eb636)=>{this['_onActivateChange'](_0x5eb636);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x385b64,_0x2b3d2b)=>{this['_onDeactivateChange'](_0x2b3d2b);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0xd8a8c2,_0x502b0c)=>{this['_onChangeMarkerClicked'](_0xd8a8c2,_0x502b0c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x334d9c,_0x99e51d)=>{this['_onChangeMarkerHovered'](_0x334d9c,_0x99e51d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x5313ee,_0x5f0831)=>{this['_onChangeMarkerRemoved'](_0x5313ee,_0x5f0831);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x4e1543,_0x287fbc)=>{this['_onChangeMarkerRestored'](_0x4e1543,_0x287fbc);});}async['runCheck'](_0x1d9388){if(!this['_availableReviewChecks'])return;const _0x3ce5e4=this['_availableReviewChecks']['find'](_0x3d1056=>_0x3d1056['id']===_0x1d9388['id']);if(_0x3ce5e4){this['_onReviewCheckRun'](_0x1d9388),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x1d9388,_0x3ce5e4),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x5eac36,_0x171efa)=>{switch(_0x171efa['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x171efa);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x171efa['status']&&'error-chunk'!==_0x171efa['status']&&'error-general'!==_0x171efa['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x228c66,_0x3d89e1)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x133b58=this['_diffContent'](_0x3d89e1['editor'],_0x3d89e1['result']['contentInitial'],_0x3d89e1['result']['contentNew']);_0x3d89e1['source']['addResultChanges'](_0x3d89e1['result']['id'],_0x133b58);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x43aa0b,_0x3a15a4)=>{for(const _0x5716f5 of _0x3a15a4['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x5716f5);this['_markChangePositionInEditorContent'](_0x3a15a4['changes'],_0x3a15a4['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x3979ec,_0x1667ed)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x1667ed['change']['id'],_0x1667ed['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x5d7ebd,_0x5b3d6f)=>{this['_onReviewCheckResultActivated'](_0x5b3d6f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x5265c4){if(nn(_0x5265c4))return;_0x5265c4 instanceof ht?this['_logError'](_0x5265c4):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x5265c4));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x1d9388['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x9c1773,_0x573105){return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0x573105,this['_aiConnector'],_0x9c1773['params'],_0x9c1773['args']);}['_onChangeMarkerRemoved'](_0x54d44a,_0x599018){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x599018['changeId']);}['_onChangeMarkerRestored'](_0x91606e,_0x63b803){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x63b803['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['_onReviewRunLeave'](_0x32fc3a=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x32fc3a&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x104034 of this['_aiReviewCoreEditing']['getEditors']())_0x104034['editing']['view']['change'](_0x428145=>{for(const _0x2cfd7c of _0x104034['editing']['view']['document']['getRoots']())_0x428145['removeClass']('ck-ai_review-diff',_0x2cfd7c),_0x428145['removeClass']('ck-ai_review-highlights',_0x2cfd7c),_0x428145['removeClass']('ck-ai-translate-mode-content',_0x2cfd7c);});}['_logError'](_0x172225){this['_reporter']['logError'](_0x172225),'ai-review-mode-models-unable-to-retrieve'===function(_0x4f2ea3){return _0x4f2ea3 instanceof rn?_0x4f2ea3['code']:_0x4f2ea3 instanceof Error?_0x4f2ea3['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x172225)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x3fc58b){if('content'===this['_changeActivationSource']){const _0xa3c878=this['_aiReviewCoreUi']['getChangeElement'](_0x3fc58b);_0xa3c878&&St(_0xa3c878['closest']('.ck-ai_review__check-run-result')||_0xa3c878);}else{if('panel'===this['_changeActivationSource']){const _0x1d4c56=this['_getChangeContentElement'](_0x3fc58b);if(!_0x1d4c56)return;Rt({'target':_0x1d4c56,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},mh=class extends Ah{['_prompt'];['_model'];constructor(_0x4496e2,_0x1d084f,_0x1865c4,_0x39c5b5,_0x3c4350){super(_0x1865c4,_0x39c5b5,_0x3c4350),this['_prompt']=_0x4496e2,this['_model']=_0x1d084f;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x3088cd,_0x5138cb,_0x25a73f){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x5138cb,_0x3088cd,_0x25a73f);}},Eh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x53e862){this['id']=_0x53e862['id'],this['commandId']=_0x53e862['commandId'],this['title']=_0x53e862['title'],this['description']=_0x53e862['description'],this['isParameterized']=_0x53e862['isParameterized'],this['useArgs']=_0x53e862['useArgs'],this['options']=_0x53e862['options'],this['args']=_0x53e862['args'];}},Th=class extends Eh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x27b1b5,_0x1bf858,_0x4d97f0){super(_0x27b1b5),this['prompt']=_0x27b1b5['prompt'],this['model']=_0x27b1b5['model'],this['model']?this['_defaultModel']=_0x1bf858['find'](_0x4450ad=>_0x4450ad['id']===this['model'])||null:this['_defaultModel']=_0x4d97f0;}get['defaultModel'](){return this['_defaultModel'];}},wh=class extends mh{get['subTitle'](){return'';}set['prompt'](_0x196d0b){this['_prompt']=_0x196d0b;}set['model'](_0x1c76eb){this['_model']=_0x1c76eb;}},Ch=class extends _0x215b79{static get['requires'](){return[ls,on];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const fh=[{'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'}]}]}],bh=/* #__PURE__ -- @preserve */
41
+ gt();var Sh=class extends bh{['_checks']=[];['setupChecks'](_0x4e6da6){this['_checks']=_0x4e6da6['map'](_0x49fcaf=>new Eh(_0x49fcaf));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x2686de){return this['checks']['find'](_0x482916=>_0x482916['id']===_0x2686de);}['removeCheckById'](_0x53c133){this['_checks']=this['_checks']['filter'](_0x55ace9=>_0x55ace9['id']!==_0x53c133);}},Rh=class extends Eh{['_models']=[];['_defaultModel']=null;constructor(_0x149b04,_0x9ecce4,_0x38d6be){super(_0x149b04),this['_models']=_0x9ecce4,this['_defaultModel']=_0x38d6be;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Oh=class extends Sh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x17613a,_0x30418b,_0x1fbdea){super(),this['_allModels']=_0x17613a,this['_recommendedModels']=_0x30418b,this['_defaultModel']=_0x1fbdea;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x47fd11){this['_checks']=_0x47fd11['map'](_0x7eb9e5=>!0x0===_0x7eb9e5['isExtra']?new Th(_0x7eb9e5,this['_allModels'],this['_defaultModel']):'custom'===_0x7eb9e5['id']?new Rh(_0x7eb9e5,this['_recommendedModels'],this['_defaultModel']):new Eh(_0x7eb9e5));}},vh=class extends Ch{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x495a49){super(_0x495a49),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x20bee3=>({'id':_0x20bee3['id'],'commandId':_0x20bee3['id'],'title':_0x20bee3['label'],'description':_0x20bee3['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x20bee3['prompt'],'model':_0x20bee3['model']}));}async['_loadChecksList'](){const _0x484f2b=[...fh,...this['getExtraChecks']()]['map'](_0x395140=>_0x395140['isExtra']?_0x395140:this['_translateReviewCheck'](_0x395140)),_0xe0292=await this['_getModels'](),_0x1cd5cf=new Oh(_0xe0292['all'],_0xe0292['recommended'],_0xe0292['default']);return _0x1cd5cf['setupChecks'](_0x484f2b),_0x1cd5cf;}async['_getModels'](){const _0x196f95=this['context']['plugins']['get']('AIConnector');try{const _0x4eec8f=new zs({'connector':_0x196f95,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x2cc641={'all':await _0x4eec8f['getAll'](),'recommended':await _0x4eec8f['getAvailableModels'](),'default':await _0x4eec8f['getDefault']()};return this['_modelsLoadError']=null,_0x2cc641;}catch(_0x2c0fb6){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x2c0fb6),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x189b6e){const _0x13512a='AI_REVIEW_CHECK_'+_0x189b6e['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x29837f={..._0x189b6e,'title':this['_translate'](_0x13512a+'_TITLE',_0x189b6e['title']),'description':this['_translate'](_0x13512a+'_DESCRIPTION',_0x189b6e['description'])};return _0x189b6e['options']&&(_0x29837f['options']=_0x189b6e['options']['map'](_0xc11453=>({..._0xc11453,'label':this['_translate'](_0x13512a+'_OPTIONS_LABEL',_0xc11453['label']||''),'data':_0xc11453['data']?_0xc11453['data']['map'](_0x4d5be5=>({..._0x4d5be5,'label':this['_translate'](_0x13512a+'_OPTIONS_DATA_'+_0x4d5be5['id']['toUpperCase'](),_0x4d5be5['label'])})):void 0x0}))),_0x29837f;}['_translate'](_0x57fa89,_0x314bbf){const _0x563b85=us(this['context']['locale'],_0x57fa89);return _0x563b85===_0x57fa89?_0x314bbf:_0x563b85;}},kh=class extends ph{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[on,vh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x59fb01){super(_0x59fb01),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',fh['map'](_0x4a31c9=>_0x4a31c9['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x49e74f,_0x297706)=>{this['_isDiffOn']=_0x297706['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x376227,_0x1861ed){if(_0x376227['isCustom'])return new mh(_0x376227['args']['prompt'],_0x376227['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1861ed,this['_aiConnector']);if(_0x1861ed['isExtra']){const _0x2e06a2=_0x1861ed;return new wh(_0x376227['args']?.['prompt']??_0x2e06a2['prompt'],_0x376227['args']?.['model']??_0x2e06a2['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1861ed,this['_aiConnector']);}return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1861ed,this['_aiConnector'],_0x376227['params'],_0x376227['args']);}['_onReviewCheckResultActivated'](_0x46d976){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x46d976['change']['id']),this['_scrollToChange'](_0x46d976['change']['id']);const _0x469461=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x46d976['change']['id']);if(!_0x469461)return;const _0x3f24a1=this['_aiReviewCoreEditing']['getEditorForChange'](_0x46d976['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x46d976['change'],()=>_0x469461['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3f24a1,_0x469461['modelRange']['root']['rootName']),_0x3f24a1?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x46d976['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x2ac5bb){this['_currentReviewCheckRun']&&'click'===_0x2ac5bb['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x2ac5bb['id']));}['_onDeactivateChange'](_0x1193f6){this['_currentReviewCheckRun']&&'balloon'===_0x1193f6['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4666c3,_0x2aa3a8){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2aa3a8['changeId']);const _0x489293=this['_currentReviewCheckRun']['getChangeById'](_0x2aa3a8['changeId']);if(!_0x489293)return;const _0x2a1e7c=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2aa3a8['changeId']),_0x2a2c9d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2aa3a8['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x489293,_0x2aa3a8['markerElement'],_0x2aa3a8['domEvent'],'click',this['_getBalloonDomRoot'](_0x2a2c9d,_0x2a1e7c?.['modelRange']['root']['rootName']),_0x2a2c9d?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x30f956,_0x1c29ea){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x3f2f19=this['_currentReviewCheckRun']['getChangeById'](_0x1c29ea['changeId']);if(!_0x3f2f19)return;const _0x187886=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1c29ea['changeId']),_0x4eb3b7=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1c29ea['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3f2f19,_0x1c29ea['markerElement'],_0x1c29ea['domEvent'],'hover',this['_getBalloonDomRoot'](_0x4eb3b7,_0x187886?.['modelRange']['root']['rootName']),_0x4eb3b7?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x5eb060){const _0x5adf87=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5eb060);return _0x5adf87?_0x5adf87['getElement']():null;}['_markChangePositionInEditorContent'](_0x123755,_0x21e1fe){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x123755,_0x21e1fe);}['_diffContent'](_0x3d7328,_0x58742d,_0x4d5632){return this['_aiReviewCoreEditing']['diffContent'](_0x3d7328,_0x58742d,_0x4d5632,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x9b5eee){_0x9b5eee?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x3351dc of this['_aiReviewCoreEditing']['getEditors']())_0x3351dc['editing']['view']['change'](_0x2fe653=>{for(const _0x72c71a of _0x3351dc['editing']['view']['document']['getRoots']()){for(const _0x221a18 of _0x72c71a['getClassNames']())_0x221a18['startsWith']('ck-ai_review-')&&_0x2fe653['removeClass'](_0x221a18,_0x72c71a);_0x2fe653['addClass'](_0x9b5eee?'ck-ai_review-diff':'ck-ai_review-highlights',_0x72c71a);}});}['_getBalloonDomRoot'](_0x3a8dd6,_0x2b5d86){const _0x2acbd7=_0x3a8dd6['editing']['view'];if(_0x2b5d86){const _0x6cc42e=_0x2acbd7['getDomRoot'](_0x2b5d86);if(_0x6cc42e)return _0x6cc42e;}return _0x2acbd7['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x37ee82=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0xe70284=await _0x37ee82['getChecksList']();_0x37ee82['modelsLoadError']&&this['_logError'](_0x37ee82['modelsLoadError']);let _0x4d7ab8=_0xe70284['checks'];const _0x253ab7=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x253ab7,_0x4d7ab8),this['_usesAvailableCommandsConfig']&&(_0x4d7ab8=_0x253ab7['map'](_0x398077=>_0x4d7ab8['find'](_0x3d31aa=>_0x3d31aa['id']===_0x398077))['filter'](_0x1c155f=>!!_0x1c155f)),this['_filterChecksWithMissingModel'](_0x4d7ab8);}['_logWarningForNonExistentChecks'](_0x5195f0,_0x437627){const _0x5a51af=_0x5195f0['filter'](_0x2da8a1=>!_0x437627['some'](_0x23f9d=>_0x23f9d['id']===_0x2da8a1));_0x5a51af['length']&&this['_reporter']['logError'](new rn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x5a51af['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x49e97b){const _0x574cf5=[];return _0x49e97b['forEach'](_0x570700=>{(_0x570700 instanceof Th&&!_0x570700['defaultModel']||_0x570700 instanceof Rh&&!_0x570700['models']['length'])&&_0x574cf5['push'](_0x570700['id']);}),_0x574cf5['length']&&_0x574cf5['forEach'](_0x1f3178=>{_0x49e97b=_0x49e97b['filter'](_0x34c342=>_0x34c342['id']!==_0x1f3178),this['_reporter']['logError'](new rn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x1f3178}}));}),_0x49e97b;}};function Nh(_0xe0e361,_0x31a5fa,_0x391777,_0x40cce7){return _0xe0e361 instanceof ht?_0xe0e361:new ht(_0x31a5fa,_0x391777,_0x40cce7,_0xe0e361);}var yh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x90a2df){this['_affectedBlocks']=_0x90a2df;}},xh=class extends _0x215b79{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[ch,vh,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x1925fd=>{const _0x13b84c={'id':_0x1925fd['id'],'title':_0x1925fd['title'],'description':_0x1925fd['description']};return'custom'!==_0x1925fd['id']&&_0x1925fd['options']?.['length']&&(_0x13b84c['parameters']=_0x1925fd['options'][0x0]['data']['map'](_0x3f2e92=>({..._0x3f2e92}))),_0x13b84c;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x1c7a18,_0x484b44){return await this['_runReviewCheck'](_0x1c7a18,()=>this['_createReviewCheckRun'](_0x1c7a18,_0x484b44?.['parameterId']),_0x484b44?.['signal']);}async['runCustomReview'](_0x32eac5,_0x216aef){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x32eac5,_0x216aef?.['model']),_0x216aef?.['signal']);}['applyReview'](_0x5dc4dd,_0x433fe6){this['context']['plugins']['get']('AIGateway')['apply'](_0x5dc4dd,{'applyMethod':_0x433fe6,'aiSource':'review'});}async['_runReviewCheck'](_0x208479,_0x5d980f,_0x3833c9){const _0x20161d=_s(this['context']),_0x24ad72=new yh({'editor':_0x20161d,'rootName':_0x20161d['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x20161d['plugins']['get']('AIEditing')['getSessionId'](_0x20161d)});let _0x27fadb,_0x2d267a;if(_0x3833c9){if(_0x3833c9['aborted'])return _0x24ad72['abort'](),_0x24ad72;const _0x445acc=()=>{_0x24ad72['error']||(_0x24ad72['abort'](),_0x27fadb&&_0x27fadb['abort']());};_0x3833c9['addEventListener']('abort',_0x445acc),_0x2d267a=()=>_0x3833c9['removeEventListener']('abort',_0x445acc);}try{_0x27fadb=await _0x5d980f(),_0x24ad72['contentRawOld']=_0x27fadb['documentData']['content'],_0x24ad72['documentVersion']=Array['from'](_0x27fadb['documentData']['elements'])['find'](([,_0x5bff05])=>_0x5bff05['rootName']===_0x24ad72['rootName'])?.[0x1]['documentVersion']??0x1,_0x27fadb['on']('reviewCheckRunUpdated',(_0xbf43b8,_0x39806c)=>{'aborted'===_0x39806c['status']?_0x24ad72['abort']():'error-general'!==_0x39806c['status']&&'error-chunk'!==_0x39806c['status']||(_0x24ad72['error']=Nh(_0x39806c['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x208479}));}),'aborted'!==_0x24ad72['status']&&await _0x27fadb['start']();}catch(_0x1f07a2){_0x24ad72['error']=Nh(_0x1f07a2,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x208479});}finally{_0x2d267a&&_0x2d267a();}if(!_0x27fadb||'aborted'===_0x24ad72['status']||'error'===_0x24ad72['status'])return _0x24ad72;_0x24ad72['affectedBlocks']=_0x27fadb['results']['map'](_0x5690bc=>({'id':_0x5690bc['id'],'content':_0x5690bc['contentNew']}));try{_0x24ad72['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x24ad72['affectedBlocks'],_0x24ad72['contentRawOld'],_0x24ad72['editor']));}catch(_0x4b92bf){_0x24ad72['error']=Nh(_0x4b92bf,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x208479});}return _0x24ad72;}async['_createReviewCheckRun'](_0x28c836,_0xe54707){const _0x275f89=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x438a70=>_0x438a70['id']===_0x28c836);if(!_0x275f89)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x28c836});if(_0x275f89 instanceof Rh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x28c836});const _0xbe6d34=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x3dc835=this['context']['plugins']['get']('AIConnector');if(_0x275f89 instanceof Th){if(!_0x275f89['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x28c836});return new wh(_0x275f89['prompt'],_0x275f89['defaultModel']['id'],_0xbe6d34,_0x275f89,_0x3dc835);}return new Ih(_0xbe6d34,_0x275f89,_0x3dc835,_0xe54707?[_0xe54707]:void 0x0);}async['_createCustomReviewCheckRun'](_0x55e21f,_0x30f290,_0xd07b0f){const _0x33723a=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0xa61456=>_0xa61456['id']===_0x55e21f);if(!_0x33723a)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x55e21f});if(!(_0x33723a instanceof Rh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x55e21f});const _0x11e0c4=_0xd07b0f??_0x33723a['defaultModel']?.['id'];if(!_0x30f290)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x55e21f});if(!_0x11e0c4)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x55e21f});return new mh(_0x30f290,_0x11e0c4,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x33723a,this['context']['plugins']['get']('AIConnector'));}},Lh=class extends _0x215b79{static get['requires'](){return[kh,rh,ch,xh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x566b73,_0x4e287c){if(this['assertStartReviewPreconditions'](_0x566b73)instanceof Rh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x566b73});Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x566b73,'params':_0x4e287c?.['parameterId']?[_0x4e287c['parameterId']]:void 0x0});}async['startCustomReview'](_0x4a87ac,_0x390f23){if(!_0x4a87ac)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0xb5cd54=fh['find'](_0x48648e=>'custom'===_0x48648e['commandId'])['id'],_0x4fe2c2=this['assertStartReviewPreconditions'](_0xb5cd54),_0x43a2ab=_0x390f23?.['model']??_0x4fe2c2['defaultModel']?.['id'];if(!_0x43a2ab)throw new ht('ai-reviewmode-missing-custom-command-model',this);Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0xb5cd54,'isCustom':!0x0,'args':{'prompt':_0x4a87ac,'model':_0x43a2ab}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x82c7a0=>{const _0x393d68={'id':_0x82c7a0['id'],'title':_0x82c7a0['title'],'description':_0x82c7a0['description']};return'custom'!==_0x82c7a0['id']&&_0x82c7a0['options']?.['length']&&(_0x393d68['parameters']=_0x82c7a0['options'][0x0]['data']['map'](_0x35c885=>({..._0x35c885}))),_0x393d68;});}['assertStartReviewPreconditions'](_0x121848){const _0x2c3296=this['context']['plugins']['get']('AIReviewModeController');if(_0x2c3296['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0xc04bdd=_0x2c3296['getAvailableChecks']()['find'](_0x1e8eef=>_0x1e8eef['id']===_0x121848);if(!_0xc04bdd)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x121848});return _0xc04bdd;}},Dh=class extends Ih{['_title'];constructor(_0x3b2dfb,_0x458aa3,_0x41477c,_0x15a5b8,_0x2a0da9,_0xed46e6){super(_0x3b2dfb,_0x458aa3,_0x41477c,_0x2a0da9,_0xed46e6),this['_title']=_0x15a5b8;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Ph=class extends Eh{get['apiId'](){return'translate';}},Hh=class extends Sh{['setupChecks'](_0x50522b){this['_checks']=_0x50522b['map'](_0x874e89=>new Ph(_0x874e89));}};const Mh=[{'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 Vh=class extends Ch{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x3f4c9e){super(_0x3f4c9e),this['context']['config']['define']('ai.translate.languages',Mh);}async['_loadChecksList'](){const _0x528e55=[],_0x8b6bc1=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x459ab5 of _0x8b6bc1)_0x528e55['push']({'title':_0x459ab5['label'],'id':_0x459ab5['id'],'commandId':_0x459ab5['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x459ab5['id']}});const _0x49fcfe=new Hh();return _0x49fcfe['setupChecks'](this['_translateChecks'](_0x528e55)),_0x49fcfe;}['_translateChecks'](_0x38a845){const _0x4d84e0=this['context']['locale'];return _0x38a845['map'](_0x257eea=>{const _0x3084b0='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x257eea['title']['toUpperCase']()['replaceAll']('-','_'),_0x175970=us(_0x4d84e0,_0x3084b0);return{..._0x257eea,'title':_0x175970===_0x3084b0?_0x257eea['title']:_0x175970};});}},Uh=class extends ph{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[on,Vh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x387f1d,_0x34ef4c){return new Dh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x34ef4c,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x387f1d['params'],_0x387f1d['args']);}['_onReviewCheckResultActivated'](_0x428568){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x428568['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x428568['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x4f095b){this['_currentReviewCheckRun']&&('hover'===_0x4f095b['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4f095b['id'])),'click'===_0x4f095b['uiInteraction']&&this['_scrollToChange'](_0x4f095b['id']));}['_onDeactivateChange'](_0x5d87e4){this['_currentReviewCheckRun']&&'panel'===_0x5d87e4['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3bdbcd,_0x4e72d4){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4e72d4['changeId']),this['_scrollToChange'](_0x4e72d4['changeId']));}['_onChangeMarkerHovered'](_0xd15c1b,_0xfd4b89){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0xfd4b89['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0xfd4b89['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x3ab62e){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3ab62e);}['_markChangePositionInEditorContent'](_0x4a2123,_0x20c88e){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x4a2123,_0x20c88e);}['_diffContent'](_0x3df9fd,_0x3f67e9,_0x492209){return this['_aiReviewCoreEditing']['diffContent'](_0x3df9fd,_0x3f67e9,_0x492209,!0x0);}['_onReviewCheckRun'](){for(const _0x328b15 of this['_aiReviewCoreEditing']['getEditors']())_0x328b15['editing']['view']['change'](_0x20f73a=>{for(const _0x310850 of _0x328b15['editing']['view']['document']['getRoots']())_0x20f73a['addClass']('ck-ai-translate-mode-content',_0x310850);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Bh=class extends Xa{constructor(_0x3744f9,_0x44d271){super(_0x3744f9,_0x44d271),this['on']('set:isLoading',(_0xf53717,_0x142285,_0x32467d)=>{_0x32467d&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x53d55b,_0x23b47d,_0x4d7a1c)=>{_0x4d7a1c&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x29e30f=super['_createAcceptAllButtonView']();return _0x29e30f['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x29e30f;}['_createExitReviewButtonView'](){const _0x45efb3=super['_createExitReviewButtonView']();return _0x45efb3['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x45efb3;}},Gh=class extends nh{['_setupTemplate'](){const _0x43efd7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x43efd7['if']('isVisible','ck-hidden',_0x52e9b3=>!_0x52e9b3)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x43efd7['if']('isVisible','ck-hidden',_0x2e65b8=>!_0x2e65b8)]},'children':this['_checkViews']}]});}},Fh=class extends Ya{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x593173=this['context']['plugins']['get']('AITabs'),_0x11120a=this['context']['locale'],_0x1c7162=new Mo(_0x11120a,{'label':us(_0x11120a,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x3549b8,'class':'ck-ai-header_review-translate','showResizeButton':_0x593173['showResizeButton']});_0x1c7162['delegate']('resizeTabs')['to'](_0x593173),_0x1c7162['bind']('isMaximized')['to'](_0x593173['view'],'isMaximized',_0x388db=>_0x388db);const _0x238ffd=new qa(_0x11120a,{'header':_0x1c7162,'list':new Gh(_0x11120a),'results':new Bh(_0x11120a,{'generalErrorText':us(_0x11120a,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x11120a,{'headerText':us(_0x11120a,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x11120a,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x11120a,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x238ffd['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x238ffd;}['registerTab'](){const _0x441cf3=this['context']['plugins']['get']('AITabs');_0x441cf3['view']['on']('activateTab',(_0x123c53,{newTab:_0xd8b04c,oldTab:_0xa6305c})=>{'translate'===_0xd8b04c?this['fire']('getReviewCheckList'):'translate'===_0xa6305c&&this['fire']('leaveReview');}),_0x441cf3['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x3549b8,'order':0x0,'content':this['_mainView']});}},Kh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x1a604a){this['_affectedBlocks']=_0x1a604a;}},Wh=class extends _0x215b79{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[ch,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x39b360,_0x2e0622){return await this['_runTranslateCheck'](_0x39b360,()=>this['_createTranslateCheckRun'](_0x39b360),_0x2e0622?.['signal']);}['applyTranslate'](_0x2abce0,_0x4532bd){this['context']['plugins']['get']('AIGateway')['apply'](_0x2abce0,_0x4532bd);}async['_runTranslateCheck'](_0x362a43,_0x2f0cf0,_0x192ab9){const _0x14ad05=_s(this['context']),_0x4a8002=new Kh({'editor':_0x14ad05,'rootName':_0x14ad05['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x14ad05['plugins']['get']('AIEditing')['getSessionId'](_0x14ad05)});let _0x35f74e,_0x221bb0;if(_0x192ab9){if(_0x192ab9['aborted'])return _0x4a8002['abort'](),_0x4a8002;const _0x36b7ac=()=>{_0x4a8002['error']||(_0x4a8002['abort'](),_0x35f74e&&_0x35f74e['abort']());};_0x192ab9['addEventListener']('abort',_0x36b7ac),_0x221bb0=()=>_0x192ab9['removeEventListener']('abort',_0x36b7ac);}try{_0x35f74e=await _0x2f0cf0(),_0x4a8002['contentRawOld']=_0x35f74e['documentData']['content'],_0x4a8002['documentVersion']=Array['from'](_0x35f74e['documentData']['elements'])['find'](([,_0x4af0a7])=>_0x4af0a7['rootName']===_0x4a8002['rootName'])?.[0x1]['documentVersion']??0x1,_0x35f74e['on']('reviewCheckRunUpdated',(_0x908f9c,_0x36a2ee)=>{'aborted'===_0x36a2ee['status']?_0x4a8002['abort']():'error-general'!==_0x36a2ee['status']&&'error-chunk'!==_0x36a2ee['status']||(_0x4a8002['error']=Nh(_0x36a2ee['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x362a43}));}),'aborted'!==_0x4a8002['status']&&await _0x35f74e['start']();}catch(_0xeb752){_0x4a8002['error']=Nh(_0xeb752,'ai-translategateway-translation-run-failed',this,{'language':_0x362a43});}finally{_0x221bb0&&_0x221bb0();}if(!_0x35f74e||'aborted'===_0x4a8002['status']||'error'===_0x4a8002['status'])return _0x4a8002;_0x4a8002['affectedBlocks']=_0x35f74e['results']['map'](_0x23d39a=>({'id':_0x23d39a['id'],'content':_0x23d39a['contentNew']}));try{_0x4a8002['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x4a8002['affectedBlocks'],_0x4a8002['contentRawOld'],_0x4a8002['editor']));}catch(_0x91218c){_0x4a8002['error']=Nh(_0x91218c,'ai-translategateway-translation-run-failed',this,{'language':_0x362a43});}return _0x4a8002;}async['_createTranslateCheckRun'](_0x1e55a5){const _0x54e25b=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x22ed14=this['context']['plugins']['get']('AIConnector');return new Dh(_0x54e25b,new Ph({'id':_0x1e55a5,'commandId':_0x1e55a5,'title':_0x1e55a5,'description':'','isParameterized':!0x1}),_0x22ed14,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x1e55a5});}},Yh=class extends _0x215b79{static get['requires'](){return[Uh,Fh,ch,Wh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x191f96){const _0x5a7cfb=this['assertStartTranslatePreconditions'](_0x191f96);Na(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x5a7cfb['id'],'args':_0x5a7cfb['useArgs']?_0x5a7cfb['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x56ba3a=>({'id':_0x56ba3a['id'],'label':_0x56ba3a['title']}));}['assertStartTranslatePreconditions'](_0x26d513){const _0x4bd6ef=this['context']['plugins']['get']('AITranslateController');if(_0x4bd6ef['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x535396=_0x4bd6ef['getAvailableChecks']()['find'](_0x2bba30=>_0x2bba30['id']===_0x26d513);if(!_0x535396)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x26d513});return _0x535396;}};export{Ba as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,ua as AIBalloon,ea as AIChat,Nn as AIChatController,Mr as AIChatFeedCustomElementView,ta as AIChatHistory,Zo as AIChatHistoryController,Qo as AIChatHistoryUI,Sn as AIChatInteraction,ra as AIChatShortcuts,Go as AIChatUI,ls as AIConnector,rn as AICoreError,sn as AIDocumentProcessingGateway,en as AIDocumentProcessingRunResult,Is as AIEditing,Ia as AIEditorIntegration,an as AIErrorReporter,on as AIErrorSink,Zs as AIGateway,pn as AIInteraction,Ga as AIQuickActions,va as AIQuickActionsUI,gn as AIReply,ki as AIRequestError,Eh as AIReviewCheck,uh as AIReviewCheckResult,_h as AIReviewCheckResultChange,Ah as AIReviewCheckRun,xh as AIReviewGateway,Lh as AIReviewMode,ph as AIReviewModeController,ch as AIReviewModeEditing,rh as AIReviewModeUI,yh as AIReviewRunResult,tn as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,aa as AIToggleButtonUI,Yh as AITranslate,Uh as AITranslateController,Wh as AITranslateGateway,Kh as AITranslateRunResult,Fh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,oa as ToggleAICommand,un as createResizeButton,Zi as getDefaultAICommands,Js as markOperationsAsAI};