@ckeditor/ckeditor5-ai 48.3.0-alpha.7 → 48.3.0-alpha.8

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 (148) hide show
  1. package/dist/index.js +19 -19
  2. package/dist/translations/af.js +1 -1
  3. package/dist/translations/af.umd.js +1 -1
  4. package/dist/translations/ar.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.js +1 -1
  7. package/dist/translations/ast.umd.js +1 -1
  8. package/dist/translations/az.js +1 -1
  9. package/dist/translations/az.umd.js +1 -1
  10. package/dist/translations/be.js +1 -1
  11. package/dist/translations/be.umd.js +1 -1
  12. package/dist/translations/bg.js +1 -1
  13. package/dist/translations/bg.umd.js +1 -1
  14. package/dist/translations/bn.js +1 -1
  15. package/dist/translations/bn.umd.js +1 -1
  16. package/dist/translations/bs.js +1 -1
  17. package/dist/translations/bs.umd.js +1 -1
  18. package/dist/translations/ca.js +1 -1
  19. package/dist/translations/ca.umd.js +1 -1
  20. package/dist/translations/cs.js +1 -1
  21. package/dist/translations/cs.umd.js +1 -1
  22. package/dist/translations/da.js +1 -1
  23. package/dist/translations/da.umd.js +1 -1
  24. package/dist/translations/de-ch.js +1 -1
  25. package/dist/translations/de-ch.umd.js +1 -1
  26. package/dist/translations/de.js +1 -1
  27. package/dist/translations/de.umd.js +1 -1
  28. package/dist/translations/el.js +1 -1
  29. package/dist/translations/el.umd.js +1 -1
  30. package/dist/translations/en-au.js +1 -1
  31. package/dist/translations/en-au.umd.js +1 -1
  32. package/dist/translations/en-gb.js +1 -1
  33. package/dist/translations/en-gb.umd.js +1 -1
  34. package/dist/translations/en.js +1 -1
  35. package/dist/translations/en.umd.js +1 -1
  36. package/dist/translations/eo.js +1 -1
  37. package/dist/translations/eo.umd.js +1 -1
  38. package/dist/translations/es-co.js +1 -1
  39. package/dist/translations/es-co.umd.js +1 -1
  40. package/dist/translations/es.js +1 -1
  41. package/dist/translations/es.umd.js +1 -1
  42. package/dist/translations/et.js +1 -1
  43. package/dist/translations/et.umd.js +1 -1
  44. package/dist/translations/eu.js +1 -1
  45. package/dist/translations/eu.umd.js +1 -1
  46. package/dist/translations/fa.js +1 -1
  47. package/dist/translations/fa.umd.js +1 -1
  48. package/dist/translations/fi.js +1 -1
  49. package/dist/translations/fi.umd.js +1 -1
  50. package/dist/translations/fr.js +1 -1
  51. package/dist/translations/fr.umd.js +1 -1
  52. package/dist/translations/gl.js +1 -1
  53. package/dist/translations/gl.umd.js +1 -1
  54. package/dist/translations/gu.js +1 -1
  55. package/dist/translations/gu.umd.js +1 -1
  56. package/dist/translations/he.js +1 -1
  57. package/dist/translations/he.umd.js +1 -1
  58. package/dist/translations/hi.js +1 -1
  59. package/dist/translations/hi.umd.js +1 -1
  60. package/dist/translations/hr.js +1 -1
  61. package/dist/translations/hr.umd.js +1 -1
  62. package/dist/translations/hu.js +1 -1
  63. package/dist/translations/hu.umd.js +1 -1
  64. package/dist/translations/hy.js +1 -1
  65. package/dist/translations/hy.umd.js +1 -1
  66. package/dist/translations/id.js +1 -1
  67. package/dist/translations/id.umd.js +1 -1
  68. package/dist/translations/it.js +1 -1
  69. package/dist/translations/it.umd.js +1 -1
  70. package/dist/translations/ja.js +1 -1
  71. package/dist/translations/ja.umd.js +1 -1
  72. package/dist/translations/jv.js +1 -1
  73. package/dist/translations/jv.umd.js +1 -1
  74. package/dist/translations/kk.js +1 -1
  75. package/dist/translations/kk.umd.js +1 -1
  76. package/dist/translations/km.js +1 -1
  77. package/dist/translations/km.umd.js +1 -1
  78. package/dist/translations/kn.js +1 -1
  79. package/dist/translations/kn.umd.js +1 -1
  80. package/dist/translations/ko.js +1 -1
  81. package/dist/translations/ko.umd.js +1 -1
  82. package/dist/translations/ku.js +1 -1
  83. package/dist/translations/ku.umd.js +1 -1
  84. package/dist/translations/lt.js +1 -1
  85. package/dist/translations/lt.umd.js +1 -1
  86. package/dist/translations/lv.js +1 -1
  87. package/dist/translations/lv.umd.js +1 -1
  88. package/dist/translations/ms.js +1 -1
  89. package/dist/translations/ms.umd.js +1 -1
  90. package/dist/translations/nb.js +1 -1
  91. package/dist/translations/nb.umd.js +1 -1
  92. package/dist/translations/ne.js +1 -1
  93. package/dist/translations/ne.umd.js +1 -1
  94. package/dist/translations/nl.js +1 -1
  95. package/dist/translations/nl.umd.js +1 -1
  96. package/dist/translations/no.js +1 -1
  97. package/dist/translations/no.umd.js +1 -1
  98. package/dist/translations/oc.js +1 -1
  99. package/dist/translations/oc.umd.js +1 -1
  100. package/dist/translations/pl.js +1 -1
  101. package/dist/translations/pl.umd.js +1 -1
  102. package/dist/translations/pt-br.js +1 -1
  103. package/dist/translations/pt-br.umd.js +1 -1
  104. package/dist/translations/pt.js +1 -1
  105. package/dist/translations/pt.umd.js +1 -1
  106. package/dist/translations/ro.js +1 -1
  107. package/dist/translations/ro.umd.js +1 -1
  108. package/dist/translations/ru.js +1 -1
  109. package/dist/translations/ru.umd.js +1 -1
  110. package/dist/translations/si.js +1 -1
  111. package/dist/translations/si.umd.js +1 -1
  112. package/dist/translations/sk.js +1 -1
  113. package/dist/translations/sk.umd.js +1 -1
  114. package/dist/translations/sl.js +1 -1
  115. package/dist/translations/sl.umd.js +1 -1
  116. package/dist/translations/sq.js +1 -1
  117. package/dist/translations/sq.umd.js +1 -1
  118. package/dist/translations/sr-latn.js +1 -1
  119. package/dist/translations/sr-latn.umd.js +1 -1
  120. package/dist/translations/sr.js +1 -1
  121. package/dist/translations/sr.umd.js +1 -1
  122. package/dist/translations/sv.js +1 -1
  123. package/dist/translations/sv.umd.js +1 -1
  124. package/dist/translations/th.js +1 -1
  125. package/dist/translations/th.umd.js +1 -1
  126. package/dist/translations/ti.js +1 -1
  127. package/dist/translations/ti.umd.js +1 -1
  128. package/dist/translations/tk.js +1 -1
  129. package/dist/translations/tk.umd.js +1 -1
  130. package/dist/translations/tr.js +1 -1
  131. package/dist/translations/tr.umd.js +1 -1
  132. package/dist/translations/tt.js +1 -1
  133. package/dist/translations/tt.umd.js +1 -1
  134. package/dist/translations/ug.js +1 -1
  135. package/dist/translations/ug.umd.js +1 -1
  136. package/dist/translations/uk.js +1 -1
  137. package/dist/translations/uk.umd.js +1 -1
  138. package/dist/translations/ur.js +1 -1
  139. package/dist/translations/ur.umd.js +1 -1
  140. package/dist/translations/uz.js +1 -1
  141. package/dist/translations/uz.umd.js +1 -1
  142. package/dist/translations/vi.js +1 -1
  143. package/dist/translations/vi.umd.js +1 -1
  144. package/dist/translations/zh-cn.js +1 -1
  145. package/dist/translations/zh-cn.umd.js +1 -1
  146. package/dist/translations/zh.js +1 -1
  147. package/dist/translations/zh.umd.js +1 -1
  148. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,22 +20,22 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0xbc060f,ContextPlugin as _0x5bb7a3,Editor as _0x4fb071,Plugin as _0x1c4dee,rootAcceptsBlocks as _0x33336f}from'@ckeditor/ckeditor5-core';import{IconAI as _0x4e0656,IconAIAdjustLength as _0x31de5d,IconAIAskAI as _0x403b79,IconAIChangeTone as _0x62c29b,IconAIChat as _0x37c71d,IconAIChatCommands as _0xbde94f,IconAIContinueWriting as _0x295849,IconAIGrammarCheck as _0x3fc065,IconAIHistory as _0x1c0d96,IconAIImproveWriting as _0x53a96a,IconAIOther as _0x4ddb86,IconAIQuickActions as _0x355d7e,IconAIReview as _0x259f1e,IconAITranslate as _0x1b8aec,IconBoxWithCheck as _0x70e58a,IconBoxWithCross as _0x38fc79,IconBoxWithMarker as _0x13976d,IconBrowseFiles as _0xe745fb,IconBulb as _0x4fdc5e,IconCancel as _0x5ea60e,IconCheck as _0x20a950,IconChevronDown as _0x40c169,IconChevronRight as _0xe4118c,IconChevronUp as _0x1f1087,IconCopy as _0xfa100c,IconDocument as _0x56c092,IconDocumentOutline as _0x4ea467,IconDropdownArrow as _0x3a4797,IconError as _0x1e308d,IconEye as _0x4238bb,IconEyeCrossedOut as _0x5e2adc,IconFileUpload as _0xd9f44a,IconImage as _0x484929,IconInfo as _0x2be136,IconLink as _0x353a80,IconLoupe as _0x343e03,IconMagicWand as _0x1eed24,IconMaximize as _0x15df19,IconMinimize as _0x50c50b,IconNextArrow as _0xb20ede,IconOutdated as _0x5ace95,IconPaperClip as _0x11f5f7,IconPin as _0x53225f,IconPlus as _0x3560b9,IconPreviousArrow as _0xed123e,IconRefresh as _0x19fb4b,IconRobotPencil as _0x4c8750,IconSelection as _0x24f756,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 _0x589b9d,SearchTextView as _0x235aa2,SpinnerView as _0xbabce0,TextareaView as _0xbac387,ToolbarView as _0x3ffb1c,UIModel as _0x3cc729,View as _0x1f08de,ViewCollection as _0x3994e5,addListToDropdown as _0x5346bb,addMenuToDropdown as _0x3471a4,clickOutsideHandler as _0x563b8b,createDropdown as _0x4a2fa7,createLabeledInputText as _0x4a5536,createLabeledTextarea as _0x172dbb,submitHandler as _0x472261}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x9cabd4,ClipboardPipeline as _0x27c9d2}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x46a31d,MarkerOperation as _0x24ffd0,Matcher as _0xf34e02,ModelDocumentFragment as _0x46ccc9,ModelPosition as _0x339ffb,ModelRange as _0x3888b9,ModelTreeWalker as _0x433ecb,ViewDataTransfer as _0x5ef68f,ViewDocumentDomEventData as _0x432dde,ViewDowncastWriter as _0x3dbe74,ViewUpcastWriter as _0x169097,_DetachOperation as _0x462971,_insertIntoModelNodeList as _0x1a03de,_removeFromModelNodeList as _0x345048,transformOperationSets as _0x4a80ce}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x3bd7b7,debounce as _0x152bc3,escape as _0x2621bf,escapeRegExp as _0x265956,throttle as _0x1290d2,unescape as _0x570825}from'es-toolkit/compat';import{createParser as _0x2c8409}from'eventsource-parser';import{CloudServices as _0xadf50b}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0xecc157,DATA_ID_MODEL_ATTRIBUTE as _0x40a4b3,DATA_ID_VIEW_ATTRIBUTE as _0x5c4d3d,DocumentCompare as _0x5bc848,SuggestionsConversion as _0x36c9c5,fixElementSuggestionRange as _0x24d965,getAllMarkersDomElementsSorted as _0x1b7007,getMarkerDomElement as _0x494bee}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x123003}from'htmlparser2';import{append as _0x34f2bc,appendChild as _0x3da38c,find as _0x2b79fd,findAll as _0x4211cd,findOne as ti,getChildren as _0xb28728,getParent as _0x39a5c7,isComment as _0x335e26,isTag as _0x4654ea,prepend as _0x129955,prependChild as _0x228582,removeElement as _0x183ce6,replaceElement as _0x1845ad,textContent as _0x4abfc8}from'domutils';import _0x154796 from'dom-serializer';import{Document as _0xc2b1d2,Element as _0x1b6d09,NodeWithChildren as _0x16bc48,Text as _0x238b0a,cloneNode as _0x398eb6,isDocument as _0x441c88,isText as _0x157de6}from'domhandler';import{MarkdownGfmMdToHtml as _0x3325a1,MarkdownGfmMdToHtmlDefaultPlugins as _0x5b9145}from'@ckeditor/ckeditor5-markdown-gfm';import _0x52b7a8 from'rehype-sanitize';import _0x2becb9 from'morphdom';import{diffArrays as _0x581566}from'diff';const fi='_ungrouppedCommands';function bi(_0x93ec9e,_0x2e008f){const _0x7ddfd8=(0x0,_0x2e008f['t'])('Other');return _0x93ec9e['length']?'groupId'in _0x93ec9e[0x0]?_0x93ec9e:[{'groupId':fi,'groupLabel':_0x7ddfd8,'order':0x1/0x0,'commands':_0x93ec9e}]:[{'groupId':fi,'groupLabel':_0x7ddfd8,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x1c4dee{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x25c973}=this,_0x3005ae=['ck-fake-ai-selection'];_0x25c973['config']['get']('ai.assistant.useTheme')&&_0x3005ae['push']('ck-ai-assistant-ui_theme'),_0x25c973['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x3005ae,'priority':0xc}}),_0x25c973['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x838dd0,{writer:_0x329b28})=>{if(!_0x838dd0['markerRange']['isCollapsed'])return null;const _0x4c4d8c=_0x329b28['createUIElement']('span');return _0x329b28['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x4c4d8c),_0x4c4d8c;}});}['afterInit'](){!async function(_0x2e8d30){const _0x116d2c='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x14eaa6=0x78e70,_0x2c2379=window['Date']['now'](),_0x3f33dc=_0x2e8d30['editor'],_0x590d13=new window['Promise'](_0x4f74eb=>{_0x3f33dc['once']('ready',_0x4f74eb);}),_0x2adc49={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x58afaf=_0x3f33dc['config']['get']('licenseKey');async function _0x3db417(){let _0xbbed16,_0x10a600=null,_0x580c2e=null;try{return'GPL'==_0x58afaf?'NotAllowed':(_0xbbed16=_0x2fc0db(),_0xbbed16?(_0xbbed16['usageEndpoint']&&(_0x580c2e=_0x1b6ed9(_0xbbed16['usageEndpoint'],_0xbbed16['jti'])),await _0x54f05c()?_0xfed4eb()?_0x212856()?'Expired':_0x274ede()?('evaluation'==_0xbbed16['licenseType']&&(_0x10a600=_0x5a0970('EvaluationLimit')),await _0x3f078d()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x212856(){const _0x3ba3d6=['evaluation','trial']['includes'](_0xbbed16['licenseType'])?_0x2c2379/0x3e8:0xe10*_0x14eaa6;return _0xbbed16['exp']<_0x3ba3d6;}function _0xfed4eb(){const _0x4cc8c4=_0xbbed16['features'];return!!_0x4cc8c4&&(!!_0x4cc8c4['includes']('*')||!!_0x4cc8c4['includes']('AI'));}function _0x274ede(){const _0x35d974=_0xbbed16['licensedHosts'];if(!_0x35d974||0x0==_0x35d974['length'])return!0x0;const {hostname:_0x5b2260}=new URL(window['location']['href']);if(_0x35d974['includes'](_0x5b2260))return!0x0;const _0x4efce5=_0x5b2260['split']('.');return _0x35d974['filter'](_0x2f9b1c=>_0x2f9b1c['includes']('*'))['map'](_0x4196c6=>_0x4196c6['split']('.'))['filter'](_0x5a4f19=>_0x5a4f19['length']<=_0x4efce5['length'])['map'](_0x4c5ebe=>Array(_0x4efce5['length']-_0x4c5ebe['length'])['fill']('*'===_0x4c5ebe[0x0]?'*':'')['concat'](_0x4c5ebe))['some'](_0x5ae8a8=>_0x4efce5['every']((_0x268b9a,_0x119926)=>_0x5ae8a8[_0x119926]===_0x268b9a||'*'===_0x5ae8a8[_0x119926]));}function _0x3f078d(){return _0x10a600&&_0x580c2e?new window['Promise']((_0x4ff53c,_0x423bde)=>{_0x10a600['then'](_0x4ff53c,_0x423bde),_0x580c2e['then'](_0x271b89=>{'Valid'!=_0x271b89&&_0x4ff53c(_0x271b89);},_0x423bde);}):_0x10a600||_0x580c2e||'Valid';}}function _0x1b6ed9(_0x146525,_0xe05c90){return new window['Promise'](_0x34e051=>{if(_0x4d1937())return _0x34e051('Valid');_0xff798d(),_0x3f33dc['decorate']('_sendUsageRequest');let _0x1d5406=!0x1;const _0xe3b611=vt();function _0x41630d(_0x8ba526){return!!_0x8ba526&&('object'==typeof _0x8ba526||'function'==typeof _0x8ba526)&&'function'==typeof _0x8ba526['then']&&'function'==typeof _0x8ba526['catch'];}function _0x43d02a(_0x2f41dd){_0x10678b(_0x2f41dd)['then'](_0x5a6552=>_0x5a6552&&'ok'==_0x5a6552['status']?_0x3c6db6(_0x1c57a6(_0xe3b611+_0xe05c90))!=_0x5a6552['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xe785d3=>(_0x5ab300(),_0xe785d3),()=>{const _0x3c0de6=_0xb04911();return null==_0x3c0de6?(_0x5ab300(),'Valid'):_0x2c2379-_0x3c0de6>0x240c8400?'UsageLimit':'Valid';})['then'](_0x34e051)['catch'](()=>{_0x34e051('UsageLimit');});const _0x53e837=0x36ee80;function _0x5ab300(){const _0x317eea='llct-'+_0x3c6db6(_0x1c57a6(_0x146525)),_0x7fe562=_0x1999bb(_0x3c6db6(window['Math']['ceil'](_0x2c2379/_0x53e837)));window['localStorage']['setItem'](_0x317eea,_0x7fe562);}function _0xb04911(){const _0xc43cb6='llct-'+_0x3c6db6(_0x1c57a6(_0x146525)),_0x28c66a=window['localStorage']['getItem'](_0xc43cb6);return _0x28c66a?window['parseInt'](_0x1999bb(_0x28c66a),0x10)*_0x53e837:null;}function _0x10678b(_0x44d23a){return new window['Promise']((_0x9d895a,_0x421320)=>{_0x44d23a['then'](_0x9d895a,_0x421320),window['setTimeout'](_0x421320,0x1d4c0);});}}_0x3f33dc['on']('_sendUsageRequest',(_0x10ff49,_0x3b02e0)=>{if(_0x3b02e0[0x0]!=_0x146525)return _0x34e051('UsageLimit');_0x3b02e0[0x1]={..._0x3b02e0[0x1],'requestId':_0xe3b611};},{'priority':'high'}),_0x3f33dc['on']('_sendUsageRequest',_0x7f0809=>{_0x41630d(_0x7f0809['return'])&&(_0x1d5406=!0x0,_0x43d02a(_0x7f0809['return']));},{'priority':'low'}),_0x590d13['then'](()=>{_0x1d5406||_0x34e051('UsageLimit');});});function _0x4d1937(){return'auto'==_0x3f33dc['editing']['view']['_overlayModeHint'];}function _0xff798d(){_0x3f33dc['editing']['view']['_overlayModeHint']='auto';}}function _0x5a0970(_0x222b6e){const _0x2fdb78=[new window['Promise'](_0x2b9ec2=>setTimeout(_0x2b9ec2,0x93ecc)),_0x590d13['then'](()=>new window['Promise'](_0x5bcbda=>{let _0x366ecb=0x0;_0x3f33dc['model']['on']('applyOperation',(_0xfa5a15,_0x8ca973)=>{_0x8ca973[0x0]['isDocumentOperation']&&_0x366ecb++,0x5e8==_0x366ecb&&(_0x5bcbda(),_0xfa5a15['off']());});}))];return window['Promise']['race'](_0x2fdb78)['then'](()=>_0x222b6e);}async function _0x29d72d(){await _0x590d13,_0x3f33dc['model']['change']=_0x182f03,_0x3f33dc['model']['enqueueChange']=_0x182f03,_0x3f33dc['enableReadOnlyMode']('model');}function _0x19dfa7(_0xba4297){const _0x17dc01=_0x5cf978();_0x3f33dc[_0x17dc01]='aiLicenseKey'+_0xba4297,'Valid'!=_0xba4297&&_0x29d72d();}function _0x5cf978(){const _0x33feaf=window['String'](window['performance']['now']())['replace']('.','');let _0x5993c1='n';for(let _0x572050=0x0;_0x572050<_0x33feaf['length'];_0x572050+=0x2){let _0x4e554a=window['parseInt'](_0x33feaf['substring'](_0x572050,_0x572050+0x2));_0x4e554a>=0x3e&&(_0x4e554a-=0x3e),_0x5993c1+=_0x116d2c[_0x4e554a];}return _0x5993c1;}function _0x2fc0db(){const _0xc1deba=_0x58afaf['split']('.');if(0x3!=_0xc1deba['length'])return null;return _0x25c5ff(_0xc1deba[0x1]);function _0x25c5ff(_0x2b32eb){const _0x3fc15b=_0x456231(_0x2b32eb);return _0x3fc15b&&_0x2f045f()?_0x3fc15b:null;function _0x2f045f(){const _0x5ec157=_0x3fc15b['jti'],_0x1c244f=window['parseInt'](_0x5ec157['substring'](_0x5ec157['length']-0x8),0x10),_0x3011f1={..._0x3fc15b,'jti':_0x5ec157['substring'](0x0,_0x5ec157['length']-0x8)};return delete _0x3011f1['vc'],_0x1c57a6(_0x3011f1)==_0x1c244f;}}}async function _0x54f05c(){let _0x48a39a=!0x0;try{const [_0x2f36e4,_0x288ad9,_0xdfb6c5]=_0x58afaf['split']('.');return _0xb1e66b(_0x2f36e4),await _0x34bf88(_0x2f36e4,_0x288ad9,_0xdfb6c5),_0x48a39a;}catch{return!0x1;}function _0xb1e66b(_0x37debc){const _0x596744=_0x456231(_0x37debc);_0x596744&&'ES256'==_0x596744['alg']||(_0x48a39a=!0x1);}async function _0x34bf88(_0x373e27,_0x1a0155,_0x54b3fb){const _0x5e737c=window['Uint8Array']['from'](_0x42fc04(_0x54b3fb),_0x45a9ee=>_0x45a9ee['charCodeAt'](0x0)),_0x556ed8=new window['TextEncoder']()['encode'](_0x373e27+'.'+_0x1a0155),_0xd5f526=window['crypto']['subtle'];if(!_0xd5f526)return;const _0x3de655=await _0xd5f526['importKey']('jwk',_0x2adc49,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0xd5f526['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x3de655,_0x5e737c,_0x556ed8)||(_0x48a39a=!0x1);}}function _0x456231(_0x4ad062){return _0x4ad062['startsWith']('ey')?JSON['parse'](_0x42fc04(_0x4ad062)):null;}function _0x42fc04(_0x136744){return window['atob'](_0x136744['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x1c57a6(_0x55b72c){let _0x552d6a=0x1505;function _0x4e6a51(_0x474bba){for(let _0x5e0371=0x0;_0x5e0371<_0x474bba['length'];_0x5e0371++){const _0x2d7c28=_0x474bba['charCodeAt'](_0x5e0371);_0x552d6a=(_0x552d6a<<0x5)+_0x552d6a+_0x2d7c28,_0x552d6a&=_0x552d6a;}}function _0x3e1c8e(_0x381226){Array['isArray'](_0x381226)?_0x381226['forEach'](_0x3e1c8e):_0x381226&&'object'==typeof _0x381226?Object['entries'](_0x381226)['sort']()['forEach'](([_0x15eab0,_0x388306])=>{_0x4e6a51(_0x15eab0),_0x3e1c8e(_0x388306);}):_0x4e6a51(window['String'](_0x381226));}return _0x3e1c8e(_0x55b72c),_0x552d6a>>>0x0;}function _0x3c6db6(_0x284888){return _0x284888['toString'](0x10)['padStart'](0x8,'0');}function _0x1999bb(_0x5aa7d7){return _0x5aa7d7['split']('')['reverse']()['join']('');}function _0x182f03(){}_0x19dfa7(await _0x3db417());}(this);}['showFakeVisualSelection'](){const _0x565283=this['editor']['model'];_0x565283['change'](_0x546765=>{const _0x460caf=_0x565283['document']['selection']['getRanges']();let _0x52fdea=0x0;for(const _0x31ac45 of _0x460caf){const _0x4a95aa=Ri+':'+_0x52fdea;if(_0x565283['markers']['has'](_0x4a95aa))_0x546765['updateMarker'](_0x4a95aa,{'range':_0x31ac45});else{if(_0x31ac45['start']['isAtEnd']){const _0x21345e=_0x31ac45['start']['getLastMatchingPosition'](({item:_0x160d15})=>!_0x565283['schema']['isContent'](_0x160d15),{'boundaries':_0x31ac45});_0x546765['addMarker'](_0x4a95aa,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x546765['createRange'](_0x21345e,_0x31ac45['end'])});}else _0x546765['addMarker'](_0x4a95aa,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x31ac45});}_0x52fdea++;}});}['hideFakeVisualSelection'](){const _0x3df4c3=this['editor']['model'],_0x436add=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x436add['length']&&_0x3df4c3['change'](_0x5dbfc4=>{_0x436add['forEach'](_0xa33372=>{_0x5dbfc4['removeMarker'](_0xa33372);});});}['insertContent'](_0x211152,_0x10d395){const _0x5e664c=this['_getAISelection'](),_0x57282e=_0x10d395||_0x5e664c['getFirstRange']();this['editor']['model']['canEditAt'](_0x57282e)&&this['editor']['model']['change'](_0x578826=>{this['hideFakeVisualSelection'](),_0x10d395||this['_resetContentOfSelectedTableCells'](_0x578826,_0x5e664c),this['_pasteHTMLUsingClipboard']({'insertAt':_0x57282e,'writer':_0x578826,'html':_0x211152});});}['insertContentBelow'](_0x5ec376){const {model:_0x30a846}=this['editor'],_0x4d8955=this['_getAISelection']();_0x30a846['change'](()=>{const _0x109eec=this['_prepareTableInsertBelowPosition'](_0x5ec376,_0x4d8955)||this['_getDefaultInsertBelowPosition'](_0x4d8955);this['insertContent'](_0x5ec376,_0x109eec);});}['_getAISelection'](){const _0x28a7f3=this['editor']['model'],_0x39b90b=Array['from'](_0x28a7f3['markers']['getMarkersGroup'](Ri))['map'](_0x3d1787=>_0x3d1787['getRange']());return _0x28a7f3['createSelection'](_0x39b90b);}['_pasteHTMLUsingClipboard']({writer:_0x58b2f9,html:_0x12d766,insertAt:_0x4b0efc}){const {view:_0x14f64a}=this['editor']['editing'],_0x5d823c=this['editor']['plugins']['get'](_0x27c9d2),_0x51d9a3=new Si();_0x51d9a3['setData']('text/html',_0x12d766);const _0x408f30=new _0x432dde(_0x14f64a,new ClipboardEvent('paste',{'clipboardData':_0x51d9a3}),{'dataTransfer':new _0x5ef68f(_0x51d9a3)});_0x58b2f9['setSelection'](_0x4b0efc);const _0x2c260c=(_0x44b2c5,_0x1b35db)=>{_0x1b35db['resultRange']&&_0x58b2f9['setSelection'](_0x1b35db['resultRange']);};_0x5d823c['once']('contentInsertion',_0x2c260c,{'priority':'lowest'}),_0x14f64a['document']['fire']('paste',_0x408f30),_0x5d823c['off']('contentInsertion',_0x2c260c);}['_getDefaultInsertBelowPosition'](_0x5dc3ae){const {model:_0xfd2b21}=this['editor'],_0xdaefa4=Array['from'](_0x5dc3ae['getSelectedBlocks']());return _0xdaefa4['length']?_0xfd2b21['createPositionAfter'](_0xdaefa4['pop']()):_0x5dc3ae['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x920ec6,_0x5cb406){const {model:_0x4f688e,plugins:_0x2c9a57}=this['editor'];if(_0x2c9a57['has']('TableUtils')){const _0x425a71=_0x2c9a57['get']('TableUtils')['getSelectedTableCells'](_0x5cb406);if(_0x425a71['length']){const _0x284ee0=this['_getTableRowCountFromContent'](_0x920ec6),_0x5824f3=this['_createEmptyTableRows'](_0x425a71,_0x284ee0);return _0x4f688e['createPositionAt'](_0x5824f3,0x0);}}return null;}['_getTableRowCountFromContent'](_0x474f73){const _0x6f37cf=this['editor']['plugins']['get']('TableUtils'),_0x450276=this['editor']['data']['parse'](_0x474f73,'$documentFragment'),_0x363085=Array['from'](_0x450276['getChildren']())['filter'](_0x5a1d67=>_0x5a1d67['is']('element','table'));let _0x587e99=0x0;return _0x363085['forEach'](_0x1c736e=>{_0x587e99+=_0x6f37cf['getRows'](_0x1c736e);}),_0x587e99;}['_createEmptyTableRows'](_0x376d60,_0x45e8f9){const _0x33016f=this['editor']['plugins']['get']('TableUtils'),_0x80aa30=_0x33016f['getRowIndexes'](_0x376d60),_0x1e0d65=_0x33016f['getColumnIndexes'](_0x376d60),_0x45a465=_0x80aa30['last']+0x1,_0x440153=_0x1e0d65['first'],_0x3a9123=_0x376d60[0x0]['findAncestor']('table');for(let _0x5c91a0=0x0;_0x5c91a0<_0x45e8f9;_0x5c91a0++)_0x33016f['insertRows'](_0x3a9123,{'at':_0x45a465});return _0x3a9123['getChild'](_0x45a465)['getChild'](_0x440153);}['_resetContentOfSelectedTableCells'](_0x40837d,_0x2406af){const {plugins:_0x187bd8}=this['editor'],{model:_0x511c2f}=_0x40837d;_0x187bd8['has']('TableUtils')&&_0x187bd8['get']('TableUtils')['getSelectedTableCells'](_0x2406af)['length']&&_0x511c2f['deleteContent'](_0x2406af);}},vi=class extends _0x1c4dee{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(_0x490d92){super(_0x490d92),this['name']='AIRequestError';}};function Ni(_0xa7bad9,_0x2f2673,_0x1f14a2){const t=_0xa7bad9['t'];switch(_0x2f2673){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',_0x1f14a2);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1f14a2);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'},_0x1f14a2);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 _0x2f2673;}}var yi=class extends _0xbc060f{['_commandDefinitions'];constructor(_0x31de46,_0x5efd91){super(_0x31de46),this['_commandDefinitions']=_0x5efd91,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x302460,_0x5187cd,_0x57141d)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0x57141d));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x1417fc,_0x158834,_0x10737e)=>{this['enabledCommandsIds']=_0x10737e?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2772f0=this['editor']['model'];this['_hasContext']=function(_0x1eacb0){const _0x4cfbd2=_0x1eacb0['document']['selection'];return _0x4cfbd2['isCollapsed']?0x0!==[..._0x4cfbd2['getSelectedBlocks']()]['length']&&![..._0x4cfbd2['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x1eacb0['hasContent'](_0x4cfbd2['getFirstRange']());}(_0x2772f0);const _0x3bfacf=_0x2772f0['document']['selection'],_0x2bb252=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x32f2c7 of _0x3bfacf['getRanges']())for(const _0x271c8e of _0x32f2c7['getItems']())if(_0x271c8e['is']('element')&&_0x2bb252['includes'](_0x271c8e['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x275aab='',_0x3bd38f='',_0x30870f='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x275aab,_0x3bd38f,_0x30870f);}};function xi(_0x78fce1,_0x57d452){const _0x3081f5=new Set();for(const _0x454363 of _0x78fce1['values']())(_0x57d452||!0x1===_0x454363['requiresContent'])&&_0x3081f5['add'](_0x454363['id']);return Array['from'](_0x3081f5);}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(_0x2137c0,_0x58bdee,_0x456a10){super(),this['editor']=_0x2137c0,this['textAdapter']=_0x58bdee,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x456a10,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x5a6728,_0x371849,_0xd3b398)=>{this['view']['value']=this['_sanitizeHTML'](_0xd3b398);}),this['listenTo'](this['view'],'submitPrompt',(_0x2d5364,_0x537303)=>{const _0x504030=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x537303,_0x504030,'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:_0x575469,query:_0x3579c6,htmlContent:_0x3e7749,label:_0x590e64,mainActionLabel:_0x425ccc}){this['view']['prompt']=_0x590e64,this['view']['mainAction']=_0x425ccc,this['initialContext']=_0x3e7749,_0x3579c6&&(this['view']['isRendered']?this['_handleQuery'](_0x3579c6,_0x3e7749,_0x575469,_0x590e64):this['view']['once']('render',()=>{this['_handleQuery'](_0x3579c6,_0x3e7749,_0x575469,_0x590e64);}));}['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'](_0x374a0c,_0x1adfe9,_0x43178b,_0x1789d1){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x1adfe9,this['previousQuery']=_0x374a0c,this['previousLabel']=_0x1789d1||_0x374a0c,this['previousActionId']=_0x43178b,new Promise(_0x2dadd8=>{this['textAdapter']['makeRequest']({'query':_0x374a0c,'context':_0x1adfe9,'onData':_0x106e3f=>{this['currentResponse']=_0x106e3f,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x43178b})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x584a83=>{_0x584a83 instanceof ki?this['view']['handleError'](_0x584a83['message']):this['view']['handleError'](),_0x2dadd8();})['finally'](()=>{this['stopProcessing'](),_0x2dadd8();});});}['_parseAndNormalizeContent'](_0x32efbb,_0xa5a272=!0x1){const _0x173475=Li['exec'](_0x32efbb);_0x32efbb=_0x173475?_0x32efbb['substring'](_0x173475[0x1]['length']):_0x32efbb['length']<0x64&&!_0xa5a272?'':this['_stripMarkdownSyntax'](_0x32efbb);const _0x198a30=this['_domParser']['parseFromString'](_0x32efbb,'text/html');if(_0x173475){const _0x2c7692=Array['from'](_0x198a30['body']['childNodes']);_0x2c7692['reverse']();for(const _0x472e6d of _0x2c7692){if(_0x472e6d['nodeType']==Node['ELEMENT_NODE'])break;_0x472e6d['remove']();}}const _0x1b8957=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x198a30['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x1b8957);const _0xcfa5b5=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x585838=this['editor']['data']['toModel'](_0x1b8957);return _0xcfa5b5||_0x585838['markers']['clear'](),this['editor']['data']['stringify'](_0x585838);}['_normalizeResponseHeadings'](_0x1d95c1){const _0x29bcc5=new _0x169097(this['editor']['editing']['view']['document']),_0x23bc23=new _0xf34e02({'name':/^h[1-5]$/}),_0x2ca34b=[];let _0x4d8902=!0x1;for(const _0x2a3dcf of _0x1d95c1)_0x2a3dcf['is']('element')&&_0x23bc23['match'](_0x2a3dcf)&&(_0x2ca34b['push'](_0x2a3dcf),'h1'==_0x2a3dcf['name']&&(_0x4d8902=!0x0));if(_0x4d8902){for(const _0x4da10c of _0x2ca34b)_0x29bcc5['rename']('h'+(parseInt(_0x4da10c['name'][0x1])+0x1),_0x4da10c);}}['_isH1TagSupportEnabled'](){const {data:_0x5b8389,editing:_0x60d498}=this['editor'],_0x515141=_0x5b8389['htmlProcessor']['toView']('<h1></h1>'),_0x2291b6=_0x5b8389['toView'](_0x5b8389['toModel'](_0x515141));return!!_0x60d498['view']['domConverter']['viewToDom'](_0x2291b6)['querySelector']('h1');}['_sanitizeHTML'](_0x479925){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x479925),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x23dbeb){const _0x187a37=_0x23dbeb['trim']();return _0x187a37['startsWith']('```html')?_0x187a37['endsWith']('```')?_0x187a37['substring'](0x7,_0x187a37['length']-0x3):_0x187a37['substring'](0x7):_0x23dbeb;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x3ffb1c{constructor(_0x54928b){super(_0x54928b),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0xfbd4d6=>Ni(_0x54928b,'AI_'+_0xfbd4d6['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x54928b,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x54928b,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x54928b,'Stop'));const _0x2e89bb=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x2e89bb['if']('isVisible','ck-hidden',_0x34df67=>!_0x34df67)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x244460,_0x11367b){const _0x27d224=new Ht(this['locale']);return _0x27d224['set']({'label':_0x244460,'class':_0x11367b||'','isVisible':!0x0,'withText':!0x0}),_0x27d224;}},Vi=class extends _0x1f08de{['contentFieldView'];['copyButtonView'];constructor(_0x10cf8e,_0x4b3d78=''){super(_0x10cf8e),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x329a27=this['bindTemplate'];this['contentFieldView']=new Ui(_0x10cf8e,_0x4b3d78),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x329a27['if']('isVisible','ck-hidden',_0x1dfb10=>!_0x1dfb10)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x329a27['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 _0x281d59=!0x1;this['on']('change:value',(_0x563293,_0x38124a,_0x545001)=>{const _0x124be5=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x545001),this['isProcessing']&&_0x124be5&&!_0x281d59&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x339d36,_0x4feaa8,_0x39930e)=>{_0x281d59=!0x1,_0x39930e?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x281d59=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x281d59=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x5c14a6=this['locale'],_0x223551=new Ht(this['locale']),_0x33df91='ck-ai-form__copy-button';return _0x223551['set']({'label':Ni(_0x5c14a6,'Copy'),'icon':_0xfa100c,'class':_0x33df91,'tooltip':!0x0}),_0x223551['bind']('isVisible')['to'](this,'value',_0x3e4e6b=>!!_0x3e4e6b),_0x223551['bind']('isEnabled')['to'](this,'isProcessing',_0x17d3b6=>!_0x17d3b6),_0x223551['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x223551['icon']=_0x20a950,_0x223551['class']=_0x33df91+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x223551['icon']=_0xfa100c,_0x223551['class']=_0x33df91;},0x3e8);}),_0x223551;}['_copyHTMLToClipboard'](_0x2b4d92){const {window:_0x34b4d8,document:_0x143b31}=Tt;if(_0x34b4d8['ClipboardItem']){const {Blob:_0x1c21c3,ClipboardItem:_0x571c58}=_0x34b4d8,_0x11a088=[new _0x571c58({'text/html':new _0x1c21c3([_0x2b4d92['innerHTML']],{'type':'text/html'}),'text/plain':new _0x1c21c3([_0x2b4d92['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x11a088);}else{const _0x1b48d2=_0x143b31['createElement']('div');_0x1b48d2['style']['position']='absolute',_0x1b48d2['style']['left']='-9999px',_0x1b48d2['innerHTML']='<span>[</span>'+_0x2b4d92['innerHTML']+'<span>]</span>',_0x143b31['body']['appendChild'](_0x1b48d2);const _0x1c6d33=_0x143b31['createRange']();_0x1c6d33['setStartAfter'](_0x1b48d2['firstElementChild']),_0x1c6d33['setEndBefore'](_0x1b48d2['lastElementChild']);const _0xf10683=_0x34b4d8['getSelection']();_0xf10683['removeAllRanges'](),_0xf10683['addRange'](_0x1c6d33),_0x143b31['execCommand']('copy'),_0x1b48d2['remove']();}}},Ui=class extends _0x1f08de{constructor(_0x4630aa,_0x8c0632=''){super(_0x4630aa),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x8c0632,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x5cfa75){this['element']['innerHTML']=_0x5cfa75;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x5c4804=new _0x1f08de(),_0x3846a9=this['locale'],_0x37d173=new _0xbabce0();return _0x37d173['isVisible']=!0x0,_0x5c4804['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x37d173,{'text':Ni(_0x3846a9,'AI\x20is\x20writing...')}]}),_0x5c4804['render'](),_0x5c4804;}},Bi=class extends _0x1f08de{constructor(_0x2ec070,_0x38ea1d=''){super(_0x2ec070);const _0x31528d=new Yt(),_0x1019c7=this['bindTemplate'];this['set']('text',_0x38ea1d),_0x31528d['content']=_0x1e308d,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x31528d,{'text':_0x1019c7['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x331b88,_0x1d7b86){super(_0x331b88,_0x1d7b86),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',(_0x486cd5,_0x431de5)=>{_0x486cd5['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x431de5());});}['_createSubmitButton'](){const _0x2b0dd4=new Ht(this['locale']),_0x473846=this['locale'];return _0x2b0dd4['set']({'icon':st,'label':Ni(_0x473846,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x2b0dd4['on']('execute',()=>{this['submit']();}),_0x2b0dd4['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x50ef6d,_0x2038da)=>!_0x50ef6d&&_0x2038da),_0x2b0dd4;}['_createShowHistoryButton'](){const _0x211c43=new Ht(this['locale']),_0x155fc8=this['resultsView'],_0x1b77ec=this['locale'];_0x211c43['set']({'label':Ni(_0x1b77ec,'History'),'withText':!0x1,'icon':_0x1c0d96,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x211c43['bind']('isOn')['to'](_0x155fc8,'isVisible'),_0x211c43['bind']('isEnabled')['to'](this,'isEnabled'),_0x211c43['on']('execute',()=>{_0x155fc8['isVisible']=!_0x155fc8['isVisible'],_0x155fc8['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x20a26e=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x1fbad7=new At(this['queryView']['fieldView']['element']),_0x94e97f=_0x1fbad7['width'],_0x1441b4='rtl'===_0x1b77ec['uiLanguageDirection']?'left':'right';_0x1fbad7['excludeScrollbarsAndBorders'](),_0x211c43['element']['style'][_0x1441b4]=_0x94e97f-_0x1fbad7['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x20a26e),this['on']('render',_0x20a26e),_0x211c43;}['submit'](){const _0x1caecc=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1caecc);}['focus'](_0x5708d8){-0x1===_0x5708d8?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x5dced7){super(_0x5dced7),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x5dced7,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x104f83=0x0;for(const _0x484ef1 of this['items'])_0x104f83+=_0x484ef1['items']['length'];return{'resultsCount':_0x104f83,'totalItemsCount':_0x104f83};}['_createClearHistoryButton'](){const _0x3ce2a8=this['locale'],_0x5902e2=new Ht(this['locale']);return _0x5902e2['set']({'label':'('+Ni(_0x3ce2a8,'Clear')+')','withText':!0x0}),_0x5902e2['on']('execute',()=>this['fire']('clearHistory')),_0x5902e2;}},Ki=class extends zt{constructor(_0x4e4ab2){super();const _0x36b39a=new Dt(),_0x2b2125=new Ht(this['locale'],_0x36b39a);this['children']['add'](_0x2b2125),_0x2b2125['set']({'label':_0x4e4ab2['prompt'],'withText':!0x0}),_0x2b2125['on']('execute',()=>{this['fire']('execute',{'value':_0x570825(_0x4e4ab2['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1f3eff,_0x216156)=>{const _0x3cbbc8=$i(_0x216156['prompt']);for(const _0xbae150 of this)if(_0xbae150!=_0x216156&&$i(_0xbae150['prompt'])===_0x3cbbc8){this['remove'](_0xbae150);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x7548c8=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x7548c8));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x25ceb3=>_0x25ceb3)));}};function $i(_0x4a5ab9){return _0x4a5ab9['toLowerCase']()['trim']();}var qi=class extends _0x1f08de{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0xee6db9,_0x3bec81,_0x14807b=''){super(_0xee6db9),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(_0xee6db9),this['contentArea']=new Vi(_0xee6db9,_0x14807b),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 _0x4a7b67=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x3bec81],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x4a7b67['if']('isError','ck-hidden',_0x5a7c62=>!_0x5a7c62)]},'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'](_0x5cff15=0x1){-0x1===_0x5cff15?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 _0x3a7922=this['locale'],_0x8a4036=new Gi(_0x3a7922,{'queryView':{'label':Ni(_0x3a7922,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x172dbb,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x3a7922,'Empty\x20history'),'secondary':Ni(_0x3a7922,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x8a4036['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x596510,_0x2edacc)=>_0x596510&&!_0x2edacc),this['listenTo'](_0x8a4036,'submit',(_0x1dced7,_0x413737)=>{this['prompt']=_0x413737;const _0x4d8759=_0x2621bf(_0x413737);this['fire']('submitPrompt',_0x4d8759),_0x413737['trim']()&&this['_promptHistory']['add']({'prompt':_0x4d8759},0x0);},{'priority':'high'}),_0x8a4036;}['_createHistoryView'](){const _0x279124=new Fi(this['locale']);return _0x279124['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x279124['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x279124;}['_createToolbar'](){const _0x23876e=new Mi(this['locale']);return _0x23876e['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x12ac3f,_0x11e9f2,_0x46c670)=>_0x12ac3f&&!_0x11e9f2&&!!_0x46c670),_0x23876e['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x23876e['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3fc5aa,_0x179e94,_0x2c22c3)=>_0x3fc5aa&&!_0x179e94&&!!_0x2c22c3),_0x23876e['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x23876e['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x224833,_0x4b3761)=>_0x224833&&!_0x4b3761),_0x23876e['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x23876e['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x23876e['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x23876e;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x3ad761=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x3ad761,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x119452){const _0x141a57=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x119452||Ni(_0x141a57,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x1c4dee{['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[_0x9cabd4,Oi,vi,Mt];}constructor(_0x4e2c86){super(_0x4e2c86),_0x4e2c86['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x4e2c86['config']['define']('ai.assistant.contentAreaCssClass',''),_0x4e2c86['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x4e2c86['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x4f113c}=this;this['_aiAdapter']=_0x4f113c['plugins']['get'](vi),this['_dialog']=_0x4f113c['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x395900=new yi(_0x4f113c,Array['from'](this['_commandDefinitions']['values']()));_0x4f113c['commands']['add']('showAIAssistant',_0x395900),_0x4f113c['ui']['componentFactory']['add']('aiCommands',_0x51b032=>{const _0x5dcad3=_0x4a2fa7(_0x51b032);return _0x5dcad3['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x5dcad3['buttonView']['set']({'label':Ni(_0x51b032,'AI\x20Commands'),'icon':_0x1eed24,'tooltip':!0x0}),_0x5dcad3['on']('execute',_0x5688bd=>this['_onExecute'](_0x5688bd['source']['id'])),_0x3471a4(_0x5dcad3,_0x4f113c['ui']['view']['body'],function(_0x3c3318){const _0x3dacd0=ji(_0x3c3318,bi(_0x3c3318['config']['get']('ai.assistant.commands'),_0x3c3318['locale']))['filter'](_0x39d139=>_0x39d139['commands']['length']);return 0x1===_0x3dacd0['length']?ji(_0x3c3318,_0x3dacd0[0x0]['commands'])['map'](_0x5c9976=>({'id':_0x5c9976['id'],'label':_0x5c9976['label']})):_0x3dacd0['map'](_0x78a02f=>{const {groupId:_0x3e4d09,groupLabel:_0x1f4505,commands:_0x15d915}=_0x78a02f,_0x2acb7c=ji(_0x3c3318,_0x15d915)['map'](_0x1e7379=>({'id':_0x1e7379['id'],'label':_0x1e7379['label']}));return{'id':_0x3e4d09,'menu':_0x1f4505||_0x3e4d09,'children':_0x2acb7c};});}(_0x4f113c),{'ariaLabel':Ni(_0x51b032,'AI\x20Commands')}),_0x5dcad3['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x395900['on']('change:enabledCommandsIds',_0x4cc90d),_0x5dcad3['menuView']['once']('render',_0x4cc90d),_0x5dcad3;function _0x4cc90d(){_0x5dcad3['isEnabled']=_0x395900['enabledCommandsIds']['length']>0x0;for(const _0x45163f of _0x5dcad3['menuView']['buttons'])_0x45163f['isEnabled']=_0x395900['enabledCommandsIds']['includes'](_0x45163f['id']);}}),_0x4f113c['ui']['componentFactory']['add']('menuBar:aiCommands',_0x81ab13=>{const _0x28c925=new _0x589b9d(_0x81ab13);_0x28c925['buttonView']['set']({'label':Ni(_0x81ab13,'AI\x20Commands'),'icon':_0x1eed24}),_0x28c925['bind']('isEnabled')['to'](_0x395900,'enabledCommandsIds',_0x1a5b41=>_0x1a5b41['length']>0x0);const _0x35a790=bi(_0x4f113c['config']['get']('ai.assistant.commands'),_0x81ab13);return this['_populateMenuBarMenu'](_0x395900,_0x28c925,_0x35a790,_0x556db7=>this['_onExecute'](_0x556db7)),_0x28c925;}),_0x4f113c['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x4860be=this['_createAIAssistantUIButton'](Ht);return _0x4860be['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x4860be;}),_0x4f113c['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x1119ad=this['_createAIAssistantUIButton'](Jt);return _0x1119ad['set']({'role':'menuitemcheckbox'}),_0x1119ad;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x137a72=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x3db1d6;for(const _0x5ecb40 in _0x137a72){const _0xa48af3=_0x5ecb40,_0x29dd58=_0x137a72[_0xa48af3];if('aiLicenseKeyValid'==_0x29dd58||'aiLicenseKeyInvalid'==_0x29dd58||'aiLicenseKeyExpired'==_0x29dd58||'aiLicenseKeyDomainLimit'==_0x29dd58||'aiLicenseKeyNotAllowed'==_0x29dd58||'aiLicenseKeyEvaluationLimit'==_0x29dd58||'aiLicenseKeyUsageLimit'==_0x29dd58){delete _0x137a72[_0xa48af3],_0x3db1d6=_0x29dd58,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x3db1d6&&_0x137a72['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x3db1d6&&_0x137a72['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x3db1d6&&_0x137a72['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x3db1d6&&_0x137a72['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x3db1d6&&_0x137a72['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x3db1d6&&_0x137a72['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x4eb71c='',_0x287ffc='',_0x33d83b='custom'){const _0x218cd7=this['editor'],_0x37d408=_0x218cd7['editing']['view'],_0x421451=_0x218cd7['plugins']['get'](Oi),_0x56f35d=_0x218cd7['plugins']['get'](_0x9cabd4);_0x421451['showFakeVisualSelection']();const _0x4b68d3=new Qi(),_0x459db5=new ClipboardEvent('copy',{'clipboardData':_0x4b68d3}),_0x427f78=new _0x5ef68f(_0x4b68d3),_0x5e8b51=new _0x432dde(_0x37d408,_0x459db5,{'dataTransfer':_0x427f78});_0x56f35d['_forceMarkersCopy']('comment',()=>{_0x37d408['document']['fire']('copy',_0x5e8b51);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x218cd7,this['_aiAdapter']['textAdapter'],this['_formView']));let _0xa72555=_0x427f78['getData']('text/html');const _0xeadf7e=_0x218cd7['model']['document']['selection'],_0x2a9c18=Array['from'](_0xeadf7e['getRanges']());0x1===_0x2a9c18['length']&&_0x2a9c18[0x0]['isFlat']&&!_0xeadf7e['getSelectedElement']()&&''!==_0xa72555['replace'](/&nbsp;/g,'')['trim']()&&(_0xa72555='<p>'+_0xa72555+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x33d83b,'query':_0x4eb71c,'htmlContent':_0xa72555,'label':_0x287ffc,'mainActionLabel':Hi[_0x218cd7['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4c8750,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x421451['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x32d687=new Map(),_0x3ee743=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x50ee1b of _0x3ee743)for(const _0x527b8d of _0x50ee1b['commands'])_0x32d687['set'](_0x527b8d['id'],{..._0x527b8d,'groupId':_0x50ee1b['groupId'],'groupLabel':_0x50ee1b['groupLabel']||_0x50ee1b['groupId']});return _0x32d687;}['_createAIAssistantUIButton'](_0x19045b){const _0x24ddfd=this['editor'],_0x3ac0b9=_0x24ddfd['commands']['get']('showAIAssistant'),_0x49c72a=new _0x19045b(_0x24ddfd['locale']);return _0x49c72a['set']({'label':Ni(_0x24ddfd['locale'],'AI\x20Assistant'),'icon':_0x4c8750,'isToggleable':!0x0}),_0x49c72a['bind']('isEnabled')['to'](_0x3ac0b9),_0x49c72a['bind']('isOn')['to'](this['_dialog'],'id',_0x18660b=>'aiAssistant'===_0x18660b),this['listenTo'](_0x49c72a,'execute',()=>{_0x49c72a['isOn']?this['hideUI']():_0x3ac0b9['execute']();}),_0x49c72a;}['_initView'](){const _0x18bb56=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',()=>{_0x18bb56['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x18bb56['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x505fd5,ui:{ariaLiveAnnouncer:_0x24fd4a}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x42209d,_0x462abf,_0x59efb0)=>{const _0x2bc66d=this['_aiAssistantController']['currentContext'];_0x59efb0?_0x24fd4a['announce'](Ni(_0x505fd5,'AI\x20is\x20writing')):_0x2bc66d&&_0x24fd4a['announce'](Ni(_0x505fd5,'Generated\x20content:\x20%0',_0x2bc66d),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1a609c,_0x441e4a,_0x431396)=>{if(_0x431396){const _0x488134=this['_formView']['errorView']['text'];_0x24fd4a['announce'](Ni(_0x505fd5,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x488134));}});}['_onExecute'](_0x427daa){const _0x4559de=this['_commandDefinitions']['get'](_0x427daa),_0x7a1013=this['editor'],_0x5b2525=_0x7a1013['model']['document']['selection'],_0x272f8=_0x7a1013['commands']['get']('showAIAssistant'),_0x4a365a=_0x7a1013['plugins']['get'](Oi),_0x3403e4=''+('_ungrouppedCommands'!==_0x4559de['groupId']?_0x4559de['groupLabel']+':\x20':'')+_0x4559de['label'];if(!0x1!==_0x4559de['requiresContent']&&_0x5b2525['isCollapsed']){const _0x4effb2=mt(_0x5b2525['getSelectedBlocks']())||_0x7a1013['model']['schema']['getLimitElement'](_0x5b2525);_0x7a1013['model']['change'](_0x3a8136=>{_0x3a8136['setSelection'](_0x4effb2,'in');});}_0x4a365a['showFakeVisualSelection'](),_0x272f8['execute'](_0x4559de['prompt'],_0x3403e4,'command:'+_0x427daa);}['_populateMenuBarMenu'](_0x37165f,_0x4362ee,_0x2092a3,_0x302735){const _0x3608ad=this['editor'],_0x8615d4=_0x3608ad['locale'],_0xfa3db0=new te(_0x8615d4),_0x1b16b9=ji(_0x3608ad,_0x2092a3)['filter'](_0x2e84e5=>_0x2e84e5['commands']['length']);0x1===_0x1b16b9['length']?this['_getMenuBarGroupButtons']({'command':_0x37165f,'commands':_0x1b16b9[0x0]['commands'],'parentMenuView':_0x4362ee,'onExecute':_0x302735})['forEach'](_0x1f2bef=>_0xfa3db0['items']['add'](_0x1f2bef)):_0x1b16b9['forEach'](({groupId:_0x507195,groupLabel:_0x5ccc88,commands:_0x48c3dc})=>{const _0x5184e6=new Zt(_0x8615d4,_0x4362ee),_0x43fae8=new _0x589b9d(_0x8615d4),_0x2bab4f=new te(_0x8615d4),_0x5fb66b=this['_getMenuBarGroupButtons']({'command':_0x37165f,'commands':_0x48c3dc,'parentMenuView':_0x43fae8,'onExecute':_0x302735});_0x43fae8['buttonView']['set']({'label':_0x5ccc88||_0x507195}),_0x43fae8['delegate']('execute')['to'](_0x4362ee),_0x2bab4f['items']['addMany'](_0x5fb66b),_0x43fae8['panelView']['children']['add'](_0x2bab4f),_0x5184e6['children']['add'](_0x43fae8),_0xfa3db0['items']['add'](_0x5184e6);}),_0x4362ee['panelView']['children']['add'](_0xfa3db0);}['_getMenuBarGroupButtons']({command:_0x45bc2a,commands:_0x756004,parentMenuView:_0x2da91f,onExecute:_0x4fcab2}){const _0x414351=this['editor'],_0x2dfe62=_0x414351['locale'];return ji(_0x414351,_0x756004)['map'](_0x2c6e07=>{const _0x2126f5=new Zt(_0x2dfe62,_0x2da91f),_0x55d690=new Jt(_0x2dfe62);return _0x55d690['set']({'label':_0x2c6e07['label']}),_0x55d690['delegate']('execute')['to'](_0x2da91f),_0x55d690['on']('execute',()=>_0x4fcab2(_0x2c6e07['id'])),_0x55d690['bind']('isEnabled')['to'](_0x45bc2a,'enabledCommandsIds',_0x2029b9=>_0x2029b9['includes'](_0x2c6e07['id'])),_0x2126f5['children']['add'](_0x55d690),_0x2126f5;});}};function zi(_0x45c482,_0x3ad9f4){return void 0x0!==_0x45c482['order']&&void 0x0===_0x3ad9f4['order']?0x1:void 0x0===_0x45c482['order']&&void 0x0!==_0x3ad9f4['order']?-0x1:void 0x0!==_0x45c482['order']&&void 0x0!==_0x3ad9f4['order']?_0x45c482['order']-_0x3ad9f4['order']:0x0;}function ji(_0x4f4b3d,_0x69d476){_0x69d476['sort'](zi);const _0x4e7bdd={},_0x2f5951=[];for(const _0x5a958d of _0x69d476)if(void 0x0!==_0x5a958d['order']){if(_0x5a958d['order']in _0x4e7bdd)throw new ht('ai-commands-config-order-collision',_0x4f4b3d,{'conflictingDefinitions':[_0x5a958d,_0x4e7bdd[_0x5a958d['order']]]});_0x4e7bdd[_0x5a958d['order']]=_0x5a958d,_0x2f5951['splice'](_0x5a958d['order'],0x0,_0x5a958d);}else _0x2f5951['push'](_0x5a958d);return _0x2f5951;}var Ji=class extends _0x1c4dee{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x59627b){super(_0x59627b);const _0x539e5b=_0x59627b['config'],_0x45ddc7=_0x59627b['locale'];_0x539e5b['define']('ai.assistant.preserveComments',!0x0),_0x539e5b['define']('ai.assistant.commands',Zi(_0x45ddc7)),_0x539e5b['define']('ai.assistant.extraCommandGroups',[]),_0x539e5b['define']('ai.assistant.removeCommands',[]);let _0x382232=bi(_0x539e5b['get']('ai.assistant.commands'),_0x45ddc7);const _0x96f3f6=_0x539e5b['get']('ai.assistant.extraCommandGroups'),_0x1e8954=_0x539e5b['get']('ai.assistant.removeCommands');_0x96f3f6['forEach'](_0x4a1308=>{const _0x1e8801=_0x382232['find'](_0x25718d=>_0x25718d['groupId']===_0x4a1308['groupId']);_0x1e8801?_0x1e8801['commands']=_0x1e8801['commands']['concat'](_0x4a1308['commands']):_0x382232['push'](_0x4a1308);}),_0x382232=_0x382232['filter'](_0x5a7cef=>!_0x1e8954['includes'](_0x5a7cef['groupId'])),_0x382232['forEach'](_0x439547=>{_0x439547['commands']=_0x439547['commands']['filter'](_0x1f5ca8=>!_0x1e8954['includes'](_0x1f5ca8['id']));}),_0x539e5b['set']('ai.assistant.commands',_0x382232);}};function Zi(_0x3f3eec){return[{'groupId':'editOrReview','groupLabel':Ni(_0x3f3eec,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0x3f3eec,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0x3f3eec,'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(_0x3f3eec,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0x3f3eec,'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(_0x3f3eec,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0x3f3eec,'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(_0x3f3eec,'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(_0x3f3eec,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0x3f3eec,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0x3f3eec,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0x3f3eec,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0x3f3eec,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0x3f3eec,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0x3f3eec,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0x3f3eec,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0x3f3eec,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0x3f3eec,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0x3f3eec,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0x3f3eec,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0x3f3eec,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0x3f3eec,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0x3f3eec,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0x3f3eec,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0x3f3eec,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0x3f3eec,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0x3f3eec,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0x3f3eec,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x1c4dee{['abortController'];static get['requires'](){return[vi];}constructor(_0x1f2c7d){super(_0x1f2c7d),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'](_0x26531a){return this['sendRequest'](_0x26531a)['catch'](_0x4cbf59=>{if(_0x4cbf59 instanceof ki)return Promise['reject'](_0x4cbf59);if('AbortError'==_0x4cbf59['name'])return Promise['resolve']();throw console['error'](_0x4cbf59),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x47bdf1,_0x13b652){const _0x226a35=this['editor']['locale'],_0x4b1dee={'Content-Type':'application/json'};if('object'==typeof _0x47bdf1)Object['assign'](_0x4b1dee,_0x47bdf1);else{if(_0x47bdf1)try{const _0x5aabac=await _0x47bdf1(_0x13b652);Object['assign'](_0x4b1dee,_0x5aabac);}catch{return Promise['reject'](new ki(Ni(_0x226a35,'AI_ERROR_GET_HEADERS')));}}return _0x4b1dee;}async['_prepareRequestParameters'](_0x7ebf42,_0x1c16d8){const _0x101369=this['editor']['locale'];if('object'==typeof _0x7ebf42)return _0x7ebf42;try{return await _0x7ebf42(_0x1c16d8);}catch{return Promise['reject'](new ki(Ni(_0x101369,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x2cfbb5){super(_0x2cfbb5),_0x2cfbb5['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x2cfbb5['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x2cfbb5['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x2cfbb5['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x2cfbb5['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x2cfbb5['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x4c4dbd,context:_0xe05fc1,onData:_0xab2c9e,actionId:_0x3c9b9a}){const _0x62edb9=this['editor']['locale'],_0x2a202d=await this['prepareMessages'](_0x4c4dbd,_0xe05fc1,_0x3c9b9a),_0x145ec9=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x3c9b9a),_0x4b97f3=await this['_prepareRequestParameters'](this['_requestParameters'],_0x3c9b9a),_0x453cef={'messages':_0x2a202d,..._0x4b97f3},_0x7efc4d={'method':'POST','headers':_0x145ec9,'body':JSON['stringify'](_0x453cef),'signal':this['abortController']['signal']},_0xf98e22=await fetch(this['_apiUrl'],_0x7efc4d);if(_0xf98e22['ok'])return _0x4b97f3['stream']?await this['_readStreamableResponse'](_0xf98e22,_0xab2c9e):await this['_readStaticResponse'](_0xf98e22,_0xab2c9e),Promise['resolve']();{const _0x481b5d=await _0xf98e22['text']();return _0x481b5d['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x62edb9,'AI_ERROR_CONTEXT_LENGTH'))):_0x481b5d['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x62edb9,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x481b5d));}}async['prepareMessages'](_0x4fcf4c,_0x27ff3b,_0x4a6e7f){let _0x37d604,_0x3e715b;return _0x27ff3b?(_0x37d604='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.',_0x3e715b='Instruction:\x0a'+_0x4fcf4c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x27ff3b):(_0x37d604='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.',_0x3e715b=_0x4fcf4c),[{'role':'system','content':_0x37d604},{'role':'user','content':_0x3e715b}];}async['_readStreamableResponse'](_0x34c694,_0x2cce17){const _0x5b8d53=_0x34c694['body']['getReader'](),_0x531ac2=new TextDecoder();let _0x10f8bd='',_0x19f590='',_0x1be116='',_0x214432=!0x1;for(;!_0x214432;){const {done:_0x23e3f8,value:_0x1ae218}=await _0x5b8d53['read'](),_0x16e3d0=_0x10f8bd+_0x531ac2['decode'](_0x1ae218);let _0x46c757='';_0x214432=_0x23e3f8;try{_0x46c757=this['_cleanUpData'](_0x16e3d0),_0x10f8bd='';}catch{_0x10f8bd=_0x16e3d0;continue;}_0x19f590+=_0x46c757,!_0x214432&&this['_isBufferIncomplete'](_0x19f590)||_0x19f590&&(_0x1be116+=_0x19f590,_0x19f590='',_0x2cce17(_0x1be116));}return Promise['resolve']();}async['_readStaticResponse'](_0x150879,_0x165896){return _0x165896((await _0x150879['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x1be1fa){const _0x1a6542=_0x1be1fa['split']('<')['length']!==_0x1be1fa['split']('>')['length'],_0x3dd1ba=_0x1be1fa['length']<0x1e;return _0x1a6542&&_0x3dd1ba;}['_cleanUpData'](_0x4830e8){return _0x4830e8['split'](/\n(?![^{]*\})/g)['map'](_0x59ae02=>_0x59ae02['replace']('data:\x20',''))['filter'](_0x44d5e3=>_0x44d5e3&&_0x44d5e3['length']>0x0&&'[DONE]'!==_0x44d5e3)['map'](_0xaa39e2=>{const {choices:_0x18735e}=JSON['parse'](_0xaa39e2);if(_0x18735e[0x0]?.['delta']?.['content'])return _0x18735e[0x0]['delta']['content'];})['filter'](_0x4d0e58=>_0x4d0e58)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x3caecd){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x3e5f55,_0x446776={}){super(_0x3e5f55),this['isToggleable']=!0x0,this['set']('side',_0x446776['side']||'top');const _0x522748=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x446776['class']||[]),_0x522748['to']('side',_0x3f9dae=>'ck-tab-button_'+_0x3f9dae),_0x522748['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x1f08de{['children'];constructor(_0x2cd1c0,_0x117255={}){super(_0x2cd1c0);const _0x50e75b=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x117255['class']||[]),_0x50e75b['to']('class'),_0x50e75b['if']('isVisible','ck-hidden',_0x5c215c=>!_0x5c215c)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x1f08de{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x46a36b,_0x183fc5={}){super(_0x46a36b),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x183fc5['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x183fc5['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x5d1b08,_0x2f28b3)=>_0x5d1b08&&!_0x2f28b3);const _0x48e1da=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x183fc5['class']||[]),_0x48e1da['to']('side',_0x194581=>'ck-tabs_'+_0x194581),_0x48e1da['to']('class'),_0x48e1da['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x48e1da['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x48e1da['to']('side',_0x52ecf3=>'ck-tabs__buttons-container_'+_0x52ecf3)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x48e1da['to']('side',_0x5ba0f4=>'ck-tabs__panels-container_'+_0x5ba0f4)]},'children':this['panelViews']},...Ot(_0x183fc5['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x593f6f){const _0x523dc6=this['_tabs']['get'](_0x593f6f);return _0x523dc6||null;}['addTab'](_0x26a196){const _0x5642fd=this['_setupButton']({'id':_0x26a196['id'],'label':_0x26a196['buttonLabel'],'icon':_0x26a196['buttonIcon'],'order':_0x26a196['order']}),_0x2a330=new ns(this['locale']);return _0x2a330['render'](),_0x26a196['content']&&_0x2a330['children']['add'](_0x26a196['content']),this['panelViews']['add'](_0x2a330),this['_tabs']['set'](_0x26a196['id'],{'button':_0x5642fd,'panel':_0x2a330,'order':void 0x0!==_0x26a196['order']?_0x26a196['order']:null}),this['fire']('addTab:'+_0x26a196['id'],{'id':_0x26a196['id'],'button':_0x5642fd,'panel':_0x2a330}),null===this['activeTab']?this['activateTab'](_0x26a196['id']):this['_hidePanel'](_0x26a196['id']),{'button':_0x5642fd,'panel':_0x2a330};}['activateTab'](_0x48ef9b){if(null!==_0x48ef9b&&!this['getTab'](_0x48ef9b))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x48ef9b});if(this['isCollapsed']=!0x1,this['activeTab']===_0x48ef9b)return;const _0x1e413a=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x48ef9b,_0x48ef9b&&this['_showPanel'](_0x48ef9b),this['fire']('activateTab:'+_0x48ef9b,{'newTab':_0x48ef9b,'oldTab':_0x1e413a});}['toggleTabPanel'](_0x45ea69){this['activeTab']===_0x45ea69?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x45ea69);}['showTab'](_0x2ae8c8){if(!this['getTab'](_0x2ae8c8))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2ae8c8});this['_showPanel'](_0x2ae8c8),this['_showButton'](_0x2ae8c8),this['fire']('show:'+_0x2ae8c8,_0x2ae8c8);}['hideTab'](_0x55d010){if(!this['getTab'](_0x55d010))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x55d010});const _0x485010=this['activeTab'];this['_hidePanel'](_0x55d010),this['_hideButton'](_0x55d010);const _0x153b95=this['getTabIds']();_0x485010===_0x55d010&&_0x153b95['length']>0x1&&this['activateTab'](_0x153b95['find'](_0x3045fb=>_0x3045fb!==_0x55d010)),this['fire']('hide:'+_0x55d010,_0x55d010);}['_getPanel'](_0x649c0f){const _0x24fb10=this['_tabs']['get'](_0x649c0f);return _0x24fb10?_0x24fb10['panel']:null;}['_showPanel'](_0xf6507e){null!==this['activeTab']&&this['activeTab']!==_0xf6507e||this['_getPanel'](_0xf6507e)['show']();}['_hidePanel'](_0x2a97ec){const _0x1320f5=this['_getPanel'](_0x2a97ec);_0x1320f5['isVisible']&&(this['activeTab']===_0x2a97ec&&(this['activeTab']=null),_0x1320f5['hide']());}['_getButton'](_0x445ea7){const _0x59a0db=this['_tabs']['get'](_0x445ea7);return _0x59a0db?_0x59a0db['button']:null;}['_showButton'](_0x554062){this['_getButton'](_0x554062)['show']();}['_hideButton'](_0x209071){this['_getButton'](_0x209071)['hide']();}['_setupButton'](_0x5e07d6){const _0xca700f=new ss(this['locale'],{'side':this['side']}),_0x437d6a=this['buttonViews'];if(_0xca700f['set']({'label':_0x5e07d6['label'],'icon':_0x5e07d6['icon'],'tooltip':!0x0,'withText':!0x0}),_0xca700f['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0xf49bc8,_0x2508f2)=>_0xf49bc8===_0x5e07d6['id']&&!_0x2508f2),_0xca700f['bind']('side')['to'](this,'side'),_0x5e07d6['order']){const _0x513988=[...this['_tabs']]['reduce']((_0x13d354,_0x269502)=>{const _0x46f9f4=_0x269502[0x0],{order:_0x23f060}=_0x269502[0x1];return!_0x23f060||_0x23f060>_0x5e07d6['order']?_0x13d354:_0x23f060>=_0x13d354['order']?{'id':_0x46f9f4,'order':_0x23f060}:_0x13d354;},{'id':'','order':0x0}),_0x272872=_0x437d6a['getIndex'](this['_getButton'](_0x513988['id']));_0x437d6a['add'](_0xca700f,_0x272872+0x1);}else _0x437d6a['add'](_0xca700f);return _0xca700f['on']('execute',()=>{this['toggleTabPanel'](_0x5e07d6['id']);}),_0xca700f;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x4fa914,_0x223aeb={}){super(_0x4fa914,_0x223aeb),this['set']('type',_0x223aeb['type']||'sidebar'),this['set']('side',_0x223aeb['side']||'right'),this['set']('isVisible',_0x223aeb['visibleByDefault']??!0x0);const _0x590fdd=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x590fdd['if']('type','ck-ai-tabs__overlay',_0x48e3e8=>'overlay'===_0x48e3e8),_0x590fdd['if']('type','ck-ai-tabs__sidebar',_0x42dba1=>'sidebar'===_0x42dba1),_0x590fdd['if']('isVisible','ck-hidden',_0x2b17e8=>!_0x2b17e8)]}}),this['buttonViews']['on']('add',(_0x36f8fd,_0x361b9a)=>{_0x361b9a['set']('withText',!0x1);});}},cs=class extends _0x5bb7a3{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3bf415){if(super(_0x3bf415),!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 _0x38fd1d=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x38fd1d['showResizeButton']&&(this['showResizeButton']=_0x38fd1d['showResizeButton']),'sidebar'!==_0x38fd1d['type']&&'overlay'!==_0x38fd1d['type']||_0x38fd1d['side']&&(this['side']=_0x38fd1d['side']),'sidebar'===_0x38fd1d['type']){if(this['container']=_0x38fd1d['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x38fd1d['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':_0x38fd1d['visibleByDefault'],'collapsible':_0x38fd1d['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 _0x4fb071&&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'](_0x3810c8){if(_0x3810c8&&this['type']!==_0x3810c8){if(!os['includes'](_0x3810c8))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x3810c8;}}['switchSide'](_0x589a90){if(_0x589a90&&this['side']!==_0x589a90){if(!as['includes'](_0x589a90))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x589a90;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x5bb7a3{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0xadf50b];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x155989){if(super(_0x155989),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 _0x25a70c=this['context']['plugins']['get'](_0xadf50b);if(!_0x25a70c['token'])throw new ht('ai-missing-token',this);this['_token']=_0x25a70c['token'];}['startConversation'](_0x191eb0,_0x5a21de){const _0x5d2c52=this['_sendApiRequest']('/conversations','POST',{'id':_0x191eb0,'group':_0x5a21de});return{'getConversation':async()=>(await _0x5d2c52['request'])['json'](),'abortController':_0x5d2c52['abortController']};}['queryAssistant']({message:_0x1e882b,conversationId:_0x330fbc,parts:_0x436dbf,capabilities:_0x383b9b,model:_0x519317,attributes:_0x2065e7}){const _0x249a52={'prompt':_0x1e882b,'content':_0x436dbf,'model':_0x519317,..._0x383b9b&&{'capabilities':_0x383b9b},..._0x2065e7&&{'attributes':_0x2065e7}},_0x1d44fc=this['_sendApiRequest']('/conversations/'+_0x330fbc+'/messages','POST',_0x249a52,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x30d21d=(await _0x1d44fc['request'])['body'];return this['_getStreamReader'](_0x30d21d);},'abortController':_0x1d44fc['abortController']};}['executeCustomAction']({content:_0x527656,message:_0x3cf508,model:_0xda215d,outputFormat:_0x1485ae}){const _0x45fd3d={'content':[{'type':'text','content':_0x527656}],'prompt':_0x3cf508,'model':_0xda215d,'outputFormat':_0x1485ae},_0x5486b7=this['_sendApiRequest']('/actions/custom/calls','POST',_0x45fd3d);return{'getStream':async()=>{const _0x2ccdca=(await _0x5486b7['request'])['body'];return this['_getStreamReader'](_0x2ccdca);},'abortController':_0x5486b7['abortController']};}['executeAction']({actionName:_0x1566e6,content:_0x1607d5,args:_0x11ea96}){const _0x219a1d={'content':[{'type':'text','content':_0x1607d5}],'args':_0x11ea96},_0x40129f=this['_sendApiRequest']('/actions/system/'+_0x1566e6+'/calls','POST',_0x219a1d);return{'getStream':async()=>{const _0x3ba145=(await _0x40129f['request'])['body'];return this['_getStreamReader'](_0x3ba145);},'abortController':_0x40129f['abortController']};}['uploadFile'](_0x22e0de,_0x4dcfd7,_0x412761){const _0x437c1d=new FormData();_0x437c1d['append']('file',_0x4dcfd7,_0x4dcfd7['name']),_0x412761&&_0x437c1d['append']('attributes',JSON['stringify'](_0x412761));const _0x3e9e65=this['_sendApiRequest']('/conversations/'+_0x22e0de+'/files','POST',_0x437c1d);return{'getId':async()=>(await _0x3e9e65['request'])['json'](),'abortController':_0x3e9e65['abortController']};}['uploadDocuments'](_0x566fd3,_0x544c1f){const _0x10fa32={'documents':_0x544c1f['map'](_0x9d15fe=>({'content':_0x9d15fe['content'],'attributes':{'version':_0x9d15fe['version'],'sessionId':_0x9d15fe['sessionId'],'channelId':_0x9d15fe['channelId'],'rootName':_0x9d15fe['rootName'],'selections':_0x9d15fe['selections']},...void 0x0!==_0x9d15fe['name']?{'name':_0x9d15fe['name']}:{},...void 0x0!==_0x9d15fe['description']?{'description':_0x9d15fe['description']}:{}}))},_0x2c6896=this['_sendApiRequest']('/conversations/'+_0x566fd3+'/documents/batch','POST',_0x10fa32);return{'getIds':async()=>(await _0x2c6896['request'])['json'](),'abortController':_0x2c6896['abortController']};}['fetchDocuments'](_0x4d7d9a,_0xcfd780){const _0xb5a168=new URLSearchParams();_0xb5a168['append']('documentIds',_0xcfd780['join'](','));const _0x329791=this['_sendApiRequest']('/conversations/'+_0x4d7d9a+'/documents/batch?'+_0xb5a168['toString'](),'GET');return{'getDocuments':async()=>(await _0x329791['request'])['json'](),'abortController':_0x329791['abortController']};}['fetchConversations'](_0x63f05,_0x39ff19={}){const _0x1a46f2=new URLSearchParams();_0x1a46f2['append']('group',_0x63f05),_0x1a46f2['append']('excludeEmpty',!0x1!==_0x39ff19['excludeEmpty']?'true':'false'),_0x1a46f2['append']('limit',_0x39ff19['limit']?_0x39ff19['limit']['toString']():'100'),_0x1a46f2['append']('sortBy',_0x39ff19['sortBy']?_0x39ff19['sortBy']:'createdAt'),_0x1a46f2['append']('order',_0x39ff19['order']?_0x39ff19['order']:'desc');const _0x275a29=this['_sendApiRequest']('/conversations?'+_0x1a46f2['toString'](),'GET');return{'getConversations':async()=>(await(await _0x275a29['request'])['json']())['items'],'abortController':_0x275a29['abortController']};}['deleteConversation'](_0x21ac99){const _0x2b82cd=this['_sendApiRequest']('/conversations/'+_0x21ac99,'DELETE');return{'execute':async()=>{await _0x2b82cd['request'];},'abortController':_0x2b82cd['abortController']};}['updateConversation'](_0x5eb089,_0x3d1a78){const _0x1c928e=this['_sendApiRequest']('/conversations/'+_0x5eb089,'PATCH',_0x3d1a78);return{'getResult':async()=>(await _0x1c928e['request'],_0x3d1a78),'abortController':_0x1c928e['abortController']};}['fetchConversation'](_0x449757){const _0x4a791f=this['_sendApiRequest']('/conversations/'+_0x449757,'GET');return{'getConversation':async()=>(await _0x4a791f['request'])['json'](),'abortController':_0x4a791f['abortController']};}['fetchConversationMessages'](_0x2bd853){const _0x3048e6=this['_sendApiRequest']('/conversations/'+_0x2bd853+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x3048e6['request'])['json']())['items'],'abortController':_0x3048e6['abortController']};}['uploadUrl'](_0x2ee63d,_0x35815c,_0x3b1582){const _0x17797d=this['_sendApiRequest']('/conversations/'+_0x2ee63d+'/web-resources','POST',{'url':_0x35815c,'attributes':_0x3b1582});return{'getId':async()=>(await _0x17797d['request'])['json'](),'abortController':_0x17797d['abortController']};}['getModels'](_0x53bf39='en'){const _0x12b2d3=new URLSearchParams();_0x12b2d3['append']('language',_0x53bf39);const _0x59fbcd='/models/1?'+_0x12b2d3['toString'](),_0x4bab3d=this['_sendApiRequest'](_0x59fbcd,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x4bab3d['request'])['json'](),'abortController':_0x4bab3d['abortController']};}['deleteFile'](_0x25a84e,_0x35dd84){const _0x3503da=this['_sendApiRequest']('/conversations/'+_0x25a84e+'/files/'+_0x35dd84,'DELETE');return{'execute':async()=>{await _0x3503da['request'];},'abortController':_0x3503da['abortController']};}['deleteDocument'](_0x25c085,_0x57d65b){const _0x309222=this['_sendApiRequest']('/conversations/'+_0x25c085+'/documents/'+_0x57d65b,'DELETE');return{'execute':async()=>{await _0x309222['request'];},'abortController':_0x309222['abortController']};}['deleteWebResource'](_0x327670,_0x194ada){const _0x4e1d43=this['_sendApiRequest']('/conversations/'+_0x327670+'/web-resources/'+_0x194ada,'DELETE');return{'execute':async()=>{await _0x4e1d43['request'];},'abortController':_0x4e1d43['abortController']};}['cancelStream'](_0x4e2129,_0x249119){const _0x874ab7=this['_sendApiRequest']('/conversations/'+_0x4e2129+'/messages/'+_0x249119+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x874ab7['request'];},'abortController':_0x874ab7['abortController']};}['resumeStream'](_0x5d1b83,_0x249118,_0x4e3fea='0-0'){const _0x3ba426=new URLSearchParams({'lastEventId':_0x4e3fea}),_0xcc54ac=this['_sendApiRequest']('/conversations/'+_0x5d1b83+'/messages/'+_0x249118+'/stream?'+_0x3ba426['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2f3fbe=await _0xcc54ac['request'];return this['_getStreamReader'](_0x2f3fbe['body']);},'abortController':_0xcc54ac['abortController']};}['callSystemReview']({reviewName:_0x378bd8,content:_0x50f3de,args:_0x196ba9}){const _0x3d5a85=this['_sendApiRequest']('/reviews/system/'+_0x378bd8+'/calls','POST',{'content':[{'type':'text','content':_0x50f3de}],'args':_0x196ba9});return{'getStream':async()=>{const _0xb3ad6e=(await _0x3d5a85['request'])['body'];return this['_getStreamReader'](_0xb3ad6e);},'abortController':_0x3d5a85['abortController']};}['processDocument']({document:_0x292d82,prompt:_0x324649,model:_0x32f126}){const _0x2e9e40=this['_sendApiRequest']('/documents/process','POST',{'document':_0x292d82,'prompt':_0x324649,'model':_0x32f126});return{'getResult':async()=>(await _0x2e9e40['request'])['json'](),'abortController':_0x2e9e40['abortController']};}['callCustomReview']({content:_0x3f18e3,prompt:_0x4000e2,model:_0x5b595c}){const _0x2c8483=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x3f18e3}],'prompt':_0x4000e2,'model':_0x5b595c});return{'getStream':async()=>{const _0xe4b6a4=(await _0x2c8483['request'])['body'];return this['_getStreamReader'](_0xe4b6a4);},'abortController':_0x2c8483['abortController']};}['upsertAIChatRating'](_0x914e5b,_0x263bc4,_0x3ed9e2){const _0x34a754=this['_sendApiRequest']('/conversations/'+_0x914e5b+'/messages/'+_0x263bc4+'/ratings','PUT',{'positiveCount':_0x3ed9e2['positiveCount'],'totalCount':_0x3ed9e2['totalCount'],'modificationId':_0x3ed9e2['modificationId']});return{'execute':async()=>{await _0x34a754['request'];},'abortController':_0x34a754['abortController']};}['upsertAIActionRating'](_0xd63f1b,_0x5a2546,_0x10b39b){const _0x5ad3f3=this['_sendApiRequest']('/actions/system/'+_0xd63f1b+'/calls/'+_0x5a2546+'/ratings','PUT',{'positiveCount':_0x10b39b['positiveCount'],'totalCount':_0x10b39b['totalCount']});return{'execute':async()=>{await _0x5ad3f3['request'];},'abortController':_0x5ad3f3['abortController']};}['upsertCustomAIActionRating'](_0x14d2ab,_0x2ca906){const _0x39c332=this['_sendApiRequest']('/actions/custom/calls/'+_0x14d2ab+'/ratings','PUT',{'positiveCount':_0x2ca906['positiveCount'],'totalCount':_0x2ca906['totalCount']});return{'execute':async()=>{await _0x39c332['request'];},'abortController':_0x39c332['abortController']};}['upsertAIReviewRating'](_0x11c037,_0x2bf96a,_0x12b40f,_0x1a1f81){const _0x2e5908=this['_sendApiRequest']('/reviews/system/'+_0x11c037+'/calls/'+_0x2bf96a+'/ratings','PUT',{'positiveCount':_0x12b40f['positiveCount'],'totalCount':_0x12b40f['totalCount'],'dataId':_0x1a1f81});return{'execute':async()=>{await _0x2e5908['request'];},'abortController':_0x2e5908['abortController']};}['upsertCustomAIReviewRating'](_0x6e00e8,_0x4f9706,_0x1b5623){const _0x551a15=this['_sendApiRequest']('/reviews/custom/calls/'+_0x6e00e8+'/ratings','PUT',{'positiveCount':_0x4f9706['positiveCount'],'totalCount':_0x4f9706['totalCount'],'dataId':_0x1b5623});return{'execute':async()=>{await _0x551a15['request'];},'abortController':_0x551a15['abortController']};}['_sendApiRequest'](_0x5baaba,_0x59f2a4,_0xfab16c,_0x20f28d={}){const {useCache:_0x485698=!0x1,apiUrl:_0x5d62b9=this['_apiUrl']}=_0x20f28d,_0x21ea37=new AbortController(),_0x5dbf29=_0x485698?_0x59f2a4+':'+_0x5baaba:null;if(_0x5dbf29){const _0x5e59f8=this['_responseCache']['get'](_0x5dbf29);if(_0x5e59f8)return{'request':_0x5e59f8['then'](_0x19e482=>_0x19e482['clone']()),'abortController':_0x21ea37};}const _0xd0cc44=_0xfab16c instanceof FormData,_0x5eca7c={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0xfab16c&&!_0xd0cc44&&(_0x5eca7c['Content-Type']='application/json');const _0x2c8182={'method':_0x59f2a4,'headers':_0x5eca7c,'signal':_0x21ea37['signal']};_0xfab16c&&(_0x2c8182['body']=_0xd0cc44?_0xfab16c:JSON['stringify'](_0xfab16c));const _0x53de67=fetch(''+_0x5d62b9+_0x5baaba,_0x2c8182)['catch'](_0x23cf57=>{_0x5dbf29&&this['_responseCache']['delete'](_0x5dbf29),this['_handleError'](_0x23cf57);})['then'](_0x556051=>_0x556051['ok']?_0x556051:_0x556051['json']()['then'](_0x102aee=>{throw _0x5dbf29&&this['_responseCache']['delete'](_0x5dbf29),{'url':_0x5d62b9,'path':_0x5baaba,'method':_0x59f2a4,'body':_0xfab16c,'status':(_0x556051||{})['status'],'statusText':(_0x556051||{})['statusText'],'code':_0x102aee['code'],'message':_0x102aee['message'],'traceId':_0x102aee['traceId']};}));return _0x5dbf29&&this['_responseCache']['set'](_0x5dbf29,_0x53de67['then'](_0x38ffe9=>_0x38ffe9['clone']())),{'request':_0x53de67,'abortController':_0x21ea37};}async*['_getStreamReader'](_0x3fa1c3){const _0x50de23=[],_0x2881b7=_0x3fa1c3['getReader'](),_0x493b4d=_0x2c8409({'onError':_0x5d0eab=>{this['_handleError'](_0x5d0eab);},'onEvent':_0x372794=>{_0x372794['data']=JSON['parse'](_0x372794['data']),_0x50de23['push'](_0x372794);}});try{let _0xfeed90=!0x1;for(;!_0xfeed90;){const {done:_0x38f8d9,value:_0x444495}=await _0x2881b7['read']();_0x38f8d9&&(_0xfeed90=!0x0),_0x493b4d['feed'](this['_decoder']['decode'](_0x444495,{'stream':!0x0})),yield*_0x50de23,_0x50de23['length']=0x0;}}catch(_0x187047){this['_handleError'](_0x187047);}finally{_0x2881b7['releaseLock'](),_0x493b4d['reset']();}}['_handleError'](_0x2fa903){if(_0x2fa903 instanceof ht)throw _0x2fa903;if(_0x2fa903 instanceof Error&&'AbortError'===_0x2fa903['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x2fa903});throw new ht('ai-request-failed',this,{'originalError':_0x2fa903});}};function us(_0x231c1b,_0x32dc6c,_0x292d4f){const t=_0x231c1b['t'];switch(_0x32dc6c){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'},_0x292d4f);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.'},_0x292d4f);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.'},_0x292d4f);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.'},_0x292d4f);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'},_0x292d4f);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x292d4f);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'},_0x292d4f);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.'},_0x292d4f);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.'},_0x292d4f);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.'},_0x292d4f);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.'},_0x292d4f);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'},_0x292d4f);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.'},_0x292d4f);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 _0x32dc6c;}}function ds(_0x35cc6f){return _0x35cc6f?_0x35cc6f instanceof _0x4fb071?[_0x35cc6f]:_0x35cc6f['editors']&&0x0!==_0x35cc6f['editors']['length']?Array['from'](_0x35cc6f['editors']):[]:[];}function _s(_0x1a598d){const _0x505cbd=ds(_0x1a598d);if(!_0x505cbd['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x505cbd['length'])return _0x505cbd[0x0];const _0x54fe3a=_0x505cbd['find'](_0x3e2463=>_0x3e2463['ui']?.['focusTracker']?.['isFocused']);if(_0x54fe3a)return _0x54fe3a;const _0x3ebaad=function(_0x5d2a41){if(_0x5d2a41 instanceof _0x4fb071)return;const _0x35587d=_0x5d2a41;if(!_0x35587d['plugins']||!_0x35587d['plugins']['has']('AIEditing'))return;return _0x35587d['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x1a598d);return _0x3ebaad&&_0x505cbd['includes'](_0x3ebaad)?_0x3ebaad:_0x505cbd[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x5bb7a3{constructor(_0x5123cc){super(_0x5123cc),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'](_0x1f253e){let _0x2a1f55=this['_sessionIdByEditor']['get'](_0x1f253e);return _0x2a1f55||(_0x2a1f55=_0x1f253e['plugins']['has']('RealTimeCollaborationClient')&&_0x1f253e['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x1f253e,_0x2a1f55)),_0x2a1f55;}async['getDocumentData'](){const _0x5cc5b0=ds(this['context']);if(!_0x5cc5b0['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x34277f=[],_0x5a34a3=new Set();for(const _0xfb7b39 of _0x5cc5b0){const _0x1b9053=_0xfb7b39['config']['get']('roots')||{};for(const _0x4f3562 of _0xfb7b39['model']['document']['getRoots']()){if('$graveyard'===_0x4f3562['rootName'])continue;const _0x2514b3=await this['_getDocumentDataForEditorRoot'](_0xfb7b39,_0x4f3562,_0x5a34a3),_0x46edd1=_0x1b9053[_0x4f3562['rootName']],_0x1ac375=_0x4f3562['getAttribute']('$description')??_0x46edd1?.['description'];let _0x4a8900=_0x4f3562['getAttribute']('$title')??_0x46edd1?.['title'];_0x4a8900||(_0x4a8900=_0x4f3562['getAttribute']('$rootEditableOptions')?.['label']??_0x46edd1?.['label']),_0x4a8900||(bt('ai-document-root-missing-title',{'editor':_0xfb7b39,'rootName':_0x4f3562['rootName']}),_0x4a8900=_0x4f3562['rootName']),_0x34277f['push']({'editor':_0xfb7b39,'rootName':_0x4f3562['rootName'],'content':_0x2514b3['content'],'version':_0x2514b3['version'],'sessionId':this['getSessionId'](_0xfb7b39),'channelId':_0xfb7b39['config']['get']('collaboration.channelId'),'selections':_0x2514b3['selections'],'name':_0x4a8900,'description':_0x1ac375});}}return _0x34277f;}async['_getDocumentDataForEditorRoot'](_0x458dcc,_0x33ad0f,_0x117ea6){const _0x1ef19d=_0x458dcc['data']['toView'](_0x33ad0f,{'convertAiChatSelectionMarker':!0x0}),_0x51bac5=new _0x3dbe74(_0x458dcc['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x1ef19d,_0x51bac5,_0x117ea6);let _0x11c439=await this['_getDocumentDataStringFromView'](_0x1ef19d,_0x458dcc);const _0x306ea3=this['_getMarkersInDocumentOrder'](_0x458dcc,_0x33ad0f),_0x31f09c=[];for(const _0x52b5b7 of _0x306ea3){const _0x9e9105='<'+_0x52b5b7['name']+':start></'+_0x52b5b7['name']+':start>',_0xb0fec8=_0x11c439['indexOf'](_0x9e9105);_0x11c439=_0x11c439['substring'](0x0,_0xb0fec8)+_0x11c439['substring'](_0xb0fec8+_0x9e9105['length']);const _0x219a26='<'+_0x52b5b7['name']+':end></'+_0x52b5b7['name']+':end>',_0x516539=_0x11c439['indexOf'](_0x219a26);_0x11c439=_0x11c439['substring'](0x0,_0x516539)+_0x11c439['substring'](_0x516539+_0x219a26['length']),_0x31f09c['push']({'markerName':_0x52b5b7['name'],'start':_0xb0fec8,'end':_0x516539,'htmlFragment':_0x11c439['substring'](_0xb0fec8,_0x516539)});}return{'content':_0x11c439,'version':_0x458dcc['model']['document']['version'],'selections':_0x31f09c};}['afterInit'](){this['context']instanceof _0x4fb071?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x5d7a43,_0x1c207b)=>{_0x1c207b['on']('ready',()=>{this['_integrateEditor'](_0x1c207b);});});}['_setOutputDataProcessor'](_0x4f9744){this['_outputDataProcessor']=_0x4f9744;}async['_getDocumentDataStringFromView'](_0x279d76,_0x4eb029){let _0xf5fe1;if(this['_outputDataProcessor']){const _0x49e27b=_0x4eb029['data']['processor']['domConverter']['viewToDom'](_0x279d76),_0x16b467=await this['_outputDataProcessor'](_0x49e27b);_0xf5fe1=_0x4eb029['data']['processor']['htmlWriter']['getHtml'](_0x16b467);}else _0xf5fe1=_0x4eb029['data']['processor']['toData'](_0x279d76);return _0xf5fe1;}['_integrateEditor'](_0x4a06ec){if(!_0x4a06ec['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x4a06ec);_0x4a06ec['ui']['focusTracker']['on']('change:isFocused',(_0x16855e,_0x566d2b,_0x5e3aae)=>{_0x5e3aae&&(this['_lastContentFocusedEditor']=_0x4a06ec);}),_0x4a06ec['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x4a06ec&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x4a06ec['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x6b2bae})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x6b2bae['split'](':')[0x1]],'priority':0xc})}),_0x4a06ec['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x4955df,{writer:_0x177e10,options:_0x46847b})=>_0x46847b['convertAiChatSelectionMarker']?_0x177e10['createUIElement'](_0x4955df['markerName']+':'+(_0x4955df['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x30a857){const _0x1e041d=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x30a857);const _0x1e4c45=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x1e041d,_0x1e4c45);}['hideFakeVisualSelection'](_0x34bd16){const _0x39510e=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x34bd16);const _0x59f45b=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x39510e,_0x59f45b);}async['modelToDataWithIds'](_0x8a0aa1,_0xebc1d0){const _0x45196b=_0xebc1d0['data']['toView'](_0x8a0aa1),_0x1c90bc=new _0x3dbe74(_0xebc1d0['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x45196b,_0x1c90bc),this['_getDocumentDataStringFromView'](_0x45196b,_0xebc1d0);}['_setDataIdsOnChildren'](_0x207690,_0x127259,_0x322ffd=new Set()){let _0x5986eb=!0x1;for(const _0x467f1f of _0x207690['getChildren']()){if(!_0x467f1f['is']('view:element')||As['includes'](_0x467f1f['name']))continue;const _0x247d70=_0x467f1f['is']('view:containerElement'),_0x3824b0=_0x467f1f['is']('view:emptyElement'),_0x4b232c=_0x467f1f['is']('view:rawElement'),_0x2ee763=this['_setDataIdsOnChildren'](_0x467f1f,_0x127259,_0x322ffd);_0x467f1f['hasAttribute']('data-id')?(_0x5986eb=!0x0,_0x322ffd['add'](_0x467f1f['getAttribute']('data-id'))):(_0x247d70||_0x3824b0||_0x4b232c||_0x2ee763)&&(_0x127259['setAttribute']('data-id',this['_nextDataId'](_0x322ffd),_0x467f1f),_0x5986eb=!0x0);}return _0x5986eb;}['_nextDataId'](_0x55564a){let _0x5f311a;do{_0x5f311a='';for(let _0x176981=0x0;_0x176981<0x4;_0x176981++)_0x5f311a+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x55564a['has'](_0x5f311a));return _0x55564a['add'](_0x5f311a),_0x5f311a;}['getSelectionText'](_0x567894){const _0x3e5ccd=(_0x567894?_0x567894['model']:_s(this['context'])['model'])['document']['selection'],_0x525abc=[],_0x36b015=Array['from'](_0x3e5ccd['getRanges']());_0x36b015['sort']((_0x2b220e,_0x571604)=>_0x2b220e['start']['isBefore'](_0x571604['start'])?-0x1:0x1);for(const _0x458cf8 of _0x36b015)for(const _0x33e435 of _0x458cf8['getItems']())_0x33e435['is']('$textProxy')?_0x525abc['push'](_0x33e435['data']):_0x33e435['is']('element')&&_0x525abc['length']>0x0&&'\x20'!==_0x525abc[_0x525abc['length']-0x1]&&_0x525abc['push']('\x20');return _0x525abc['length']?'\x22'+_0x525abc['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x651ccb){for(let _0x270733=0x0;_0x270733<this['_fakeSelections']['length'];_0x270733++)if(this['_fakeSelections'][_0x270733]['id']==_0x651ccb)return void this['_fakeSelections']['splice'](_0x270733,0x1);}['_addFakeSelection'](_0x4c6408){this['_removeFakeSelectionById'](_0x4c6408['id']),wt(this['_fakeSelections'],_0x4c6408);}['_refreshFakeSelection'](_0x23cef4,_0x521cde){if(_0x23cef4==_0x521cde)return;const _0x2a8ce9=_0x23cef4?_0x23cef4['editor']:null,_0x19d467=_0x521cde?_0x521cde['editor']:null,_0x53f964=(_0x1d0ee7,_0x371fc8)=>{const _0x5beb91=_0x371fc8['model']['markers']['getMarkersGroup'](gs);for(const _0x44c2dc of _0x5beb91)_0x1d0ee7['removeMarker'](_0x44c2dc);},_0x4f46d5=(_0x26f95b,_0x97dcb6,_0x38c3ff)=>{const _0x3ed7ba=_0x97dcb6['model'];for(let _0x41b441=0x0;_0x41b441<_0x38c3ff['ranges']['length'];_0x41b441++){let _0x529999=_0x38c3ff['ranges'][_0x41b441];const _0x470bd8=gs+':'+_0x38c3ff['id']+':'+_0x41b441;if(_0x529999['start']['isAtEnd']){const _0x337792=_0x529999['start']['getLastMatchingPosition'](({item:_0x2f1fac})=>!_0x3ed7ba['schema']['isContent'](_0x2f1fac),{'boundaries':_0x529999});_0x529999=_0x26f95b['createRange'](_0x337792,_0x529999['end']);}_0x26f95b['addMarker'](_0x470bd8,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x529999});}};_0x2a8ce9&&_0x19d467&&_0x2a8ce9===_0x19d467&&_0x521cde?_0x2a8ce9['model']['change'](_0x4c3b5d=>{_0x53f964(_0x4c3b5d,_0x2a8ce9),_0x4f46d5(_0x4c3b5d,_0x19d467,_0x521cde);}):(_0x2a8ce9&&_0x2a8ce9['model']['change'](_0x4282a5=>_0x53f964(_0x4282a5,_0x2a8ce9)),_0x19d467&&_0x521cde&&_0x19d467['model']['change'](_0x547ebc=>_0x4f46d5(_0x547ebc,_0x19d467,_0x521cde)));}['_getMarkersInDocumentOrder'](_0x1d3a77,_0x4b9f69){const _0x55a9b2=Array['from'](_0x1d3a77['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x4b9f69?_0x55a9b2['filter'](_0x5e68ea=>{const _0x883a99=_0x5e68ea['getRange']();return _0x883a99&&_0x883a99['root']['rootName']===_0x4b9f69['rootName'];}):_0x55a9b2)['sort']((_0x1392c3,_0x1bcc09)=>_0x1392c3['getStart']()['isBefore'](_0x1bcc09['getStart']())?-0x1:_0x1392c3['getStart']()['isAfter'](_0x1bcc09['getStart']())?0x1:0x0);}};function ps(_0x391167,_0x1b8b75){return _0x123003(_0x391167,_0x1b8b75);}function ms(_0x335745,_0x31a06c){return _0x154796(_0x335745,_0x31a06c);}function Es(_0x417167,_0x56d94e,_0x4f422a){const _0x25c7d1=null!==_0x56d94e?_0x4a9725=>_0x4a9725['attribs'][_0x417167]===_0x56d94e:_0x268db4=>Boolean(_0x268db4['attribs'][_0x417167]);return ti(_0x7914b1=>_0x4654ea(_0x7914b1)&&_0x25c7d1(_0x7914b1),_0x4f422a);}function Ts(_0x3e357c,_0x4bd76f,_0x13ed29){const _0x4e0c33=null!==_0x4bd76f?_0x86c883=>_0x86c883['attribs'][_0x3e357c]===_0x4bd76f:_0x3dcd65=>Boolean(_0x3dcd65['attribs'][_0x3e357c]);return _0x4211cd(_0x123221=>_0x4654ea(_0x123221)&&_0x4e0c33(_0x123221),_0x13ed29);}function ws(_0x1aa3e2){return _0x4211cd(_0x224e77=>_0x4654ea(_0x224e77)&&function(_0x1ee25d){const _0x29605b=_0x1ee25d['toLowerCase']();return'script'===_0x29605b||'style'===_0x29605b||_0x29605b['includes']('-');}(_0x224e77['name']),_0x1aa3e2);}function Cs(_0x4bb0c2){return _0x2b79fd(_0x17d491=>_0x335e26(_0x17d491),_0x4bb0c2,!0x0,0x1/0x0);}function fs(_0x21151d,_0xe3a3c1){return _0x21151d&&_0x4654ea(_0x21151d)?_0x21151d['attribs'][_0xe3a3c1]:null;}function bs(_0x32f58c,_0x8283d8,_0x1ac876){_0x4654ea(_0x32f58c)&&(null===_0x1ac876?delete _0x32f58c['attribs'][_0x8283d8]:_0x32f58c['attribs'][_0x8283d8]=_0x1ac876);}function Ss(_0x380745,_0x390d22,_0x4da852){const _0x4a3326=_0x390d22['cloneNode'](!0x0);'beforebegin'===_0x4da852?_0x129955(_0x380745,_0x4a3326):'afterbegin'===_0x4da852?_0x228582(_0x380745,_0x4a3326):'beforeend'===_0x4da852?_0x3da38c(_0x380745,_0x4a3326):'afterend'===_0x4da852&&_0x34f2bc(_0x380745,_0x4a3326);}function Rs(_0x37ca53){const _0x4703f6=[];let _0x2670ca=_0x37ca53;for(;_0x2670ca;)_0x2670ca=_0x39a5c7(_0x2670ca),_0x2670ca&&_0x4703f6['push'](_0x2670ca);return _0x4703f6;}function Os(_0x5acdd0){return _0x5acdd0['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x465616){let _0x280eb1=0x0;for(;_0x465616['parentNode'];)_0x465616=_0x465616['parentNode'],_0x280eb1++;return _0x280eb1;}function ks(_0x5c2c37){const _0x3be530=[];let _0x172d6b=_0x5c2c37['nextSibling'];for(;_0x172d6b;)_0x3be530['push'](_0x172d6b),_0x172d6b=_0x172d6b['nextSibling'];_0x3be530['forEach'](_0x4a55ac=>{_0x183ce6(_0x4a55ac);});}const Ns=/* #__PURE__ -- @preserve */
25
- gt();var ys=class extends Ns{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x55a4d5){super(),this['_generateUid']=_0x55a4d5||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x45a1f9,_0x5c5012,_0xbd6445){this['_uidCounter']=0x0;const _0x463fca=_0x45a1f9['cloneNode'](!0x0);Ds(_0x5c5012,_0x463fca);const _0x5a364d=_0x463fca['childNodes'],_0x5ca4ac=Array['from'](_0x5a364d)['filter'](_0x3903c4=>!(0x3===_0x3903c4['nodeType']&&''===ms(_0x3903c4)['trim']())),_0x42fcb7=_0x5ca4ac['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0x5c5012)['map'](_0x244dee=>fs(_0x244dee,'data-id'))['filter'](_0x1a1ed3=>!!_0x1a1ed3));for(const _0x2f013d of _0x5ca4ac)_0x2f013d&&_0x4654ea(_0x2f013d)&&void 0x0===_0x2f013d['attribs']['data-id']&&bs(_0x2f013d,'data-id','new-element');if(Ts('data-id',null,_0x463fca)['forEach'](_0x49d69e=>{const _0x244c46=fs(_0x49d69e,'data-id');'new-element'===_0x244c46||this['_existingDataIds']['has'](_0x244c46)||bs(_0x49d69e,'data-id','new-element');}),0x0===_0x5c5012['childNodes']['length']){const _0x3e407b=[];return Ts('data-id','new-element',_0x463fca)['forEach'](_0x10db3c=>{const _0x42820a=this['_generateUid']();bs(_0x10db3c,'data-id',_0x42820a),_0x3e407b['push'](_0x42820a);}),this['_removeSpecialComments'](_0x463fca),{'parsedContent':_0x463fca,'newNodeIds':_0x3e407b,'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 _0x3ff2a7=-0x1,_0x2078e6=!0x1;for(let _0x1a068e=0x0;_0x1a068e<_0x42fcb7;_0x1a068e++){const _0x115c96=_0x5ca4ac[_0x1a068e],_0x3731c1=_0x5ca4ac[_0x1a068e+0x1];if(this['_isNewNode'](_0x115c96)){if(-0x1===_0x3ff2a7&&(_0x3ff2a7=_0x1a068e),this['_markWrappedElements'](_0x115c96),!this['_isNewNode'](_0x3731c1)){const [_0x3fc5ec,_0x4931ea]=this['_findReferenceNode'](_0x115c96,_0x2078e6,_0x5c5012);if(_0x3fc5ec){const _0x313bae=Array['from'](_0x5ca4ac)['slice'](_0x3ff2a7,_0x1a068e+0x1);this['_insertNodes'](_0x3fc5ec,_0x313bae,_0x4931ea),_0x3ff2a7=-0x1;}}}else{if(this['_isExistingContentComment'](_0x115c96))_0x2078e6=!0x0;else{if(this['_isExistingNode'](_0x115c96)){const _0x539ef5=fs(_0x115c96,'data-id');if(_0x539ef5&&this['_existingDataIds']['has'](_0x539ef5)){this['_referencedExistingIds']['add'](_0x539ef5);const _0x33e101=Es('data-id',_0x539ef5,_0x5c5012);this['_replaceNode'](_0x33e101,_0x115c96);}}else{if(xs(_0x115c96)){const _0x12ffb7=Ls(_0x115c96);Es('data-id',_0x12ffb7,_0x463fca)||this['_touchedNodesState']['removedIds']['push'](_0x12ffb7);}}}}}for(const _0x23dd77 of this['_touchedNodesState']['removedIds']){const _0x527461=Es('data-id',_0x23dd77,_0x5c5012);_0x527461&&(this['_rescueUnwrappedElements'](_0x527461),this['_removeNode'](_0x527461,_0x23dd77,_0xbd6445));}if(Ts('data-id','new-element',_0x5c5012)['forEach'](_0x522361=>{const _0x4ef109=this['_getUid'](_0x522361);bs(_0x522361,'data-id',_0x4ef109),this['_touchedNodesState']['newIds']['push'](_0x4ef109);}),this['_removeSpecialComments'](_0x5c5012),_0xbd6445&&_0xbd6445['cutAfterUnstable']){const _0x58ef86=this['_findLastConfirmationPoint'](_0x5ca4ac),_0x15d1c2=this['_getLastStableElement'](_0x5c5012,_0x58ef86);this['_markUnstableElements'](_0x5c5012,_0x15d1c2);}if(this['_processWrappedElements'](_0x5c5012,_0xbd6445),_0xbd6445&&_0xbd6445['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x158b0d=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0x5c5012);let _0x52cb77=_0x158b0d[_0x158b0d['length']-0x1];for(;_0x52cb77;)ks(_0x52cb77),_0x52cb77=_0x52cb77['parentNode'];}return{'parsedContent':_0x5c5012,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x60e16d,_0xc74bb0,_0x33c0e0){for(const _0x3829eb of _0xc74bb0){const _0x176fdd=this['_getUid'](_0x3829eb);bs(_0x3829eb,'data-id',_0x176fdd),this['_touchedNodesState']['newIds']['push'](_0x176fdd),this['_touchedNodesState']['lastTouchedId']=_0x176fdd;}const _0x5228dc='afterbegin'===_0x33c0e0||'afterend'===_0x33c0e0?_0xc74bb0['reverse']():_0xc74bb0;for(const _0x18072d of _0x5228dc)Ss(_0x60e16d,_0x18072d,_0x33c0e0);}['_replaceNode'](_0x25bb86,_0x523a32){if(!_0x25bb86)return;if(_0x2442e5=_0x523a32,Os(ms(_0x25bb86))===Os(ms(_0x2442e5)))return;var _0x2442e5;const _0x1229ce=fs(_0x25bb86,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x1229ce),this['_touchedNodesState']['lastTouchedId']=_0x1229ce,_0x1845ad(_0x25bb86,_0x523a32['cloneNode'](!0x0));}['_removeNode'](_0x31686d,_0x298284,_0x238870){if(_0x238870&&_0x238870['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x298284;const _0x2f4488=_0x238870['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x2f4488,'data-id',_0x298284),bs(_0x2f4488,'data-removed','true'),_0x1845ad(_0x31686d,_0x2f4488);}else _0x183ce6(_0x31686d);}['_findReferenceNode'](_0x3c643a,_0xca2328,_0x476efc){const _0x4816d7=this['_findPrevElementWithDataId'](_0x3c643a,!0x1);if(_0x4816d7){const _0x23e80a=Ls(_0x4816d7),_0x508a9b=Es('data-id',_0x23e80a,_0x476efc);if(_0x508a9b)return[_0x508a9b,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x23e80a);}const _0x8430ce=this['_findNextElementWithDataId'](_0x3c643a,!0x1);if(_0x8430ce){const _0x4ce930=Ls(_0x8430ce),_0x1f2849=Es('data-id',_0x4ce930,_0x476efc);if(_0x1f2849)return[_0x1f2849,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x4ce930);}return _0xca2328?_0x3c643a['nextSibling']?this['_findFallbackReferenceNode'](_0x3c643a,_0x476efc):[_0x476efc['childNodes'][_0x476efc['childNodes']['length']-0x1],'afterend']:[_0x476efc['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x2de784,_0x5df6a2){const _0x120094=[],_0x34a0a1=this['_findPrevElementWithDataId'](_0x2de784,!0x0);if(_0x34a0a1){const _0x51b67d=Es('data-id',Ls(_0x34a0a1),_0x5df6a2);_0x51b67d&&_0x120094['push']([_0x51b67d,'afterend']);}const _0x558b19=this['_findNextElementWithDataId'](_0x2de784,!0x0);if(_0x558b19){const _0x2e2a4f=Es('data-id',Ls(_0x558b19),_0x5df6a2);_0x2e2a4f&&_0x120094['push']([_0x2e2a4f,'beforebegin']);}return _0x120094['length']>0x1?vs(_0x120094[0x0][0x0])<=vs(_0x120094[0x1][0x0])?_0x120094[0x0]:_0x120094[0x1]:0x1===_0x120094['length']?_0x120094[0x0]:[_0x5df6a2['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x2abe2a,_0x329fd2){let _0xa2c2c=_0x2abe2a['nextSibling'],_0x3ffa38=null,_0x425dd8=!0x1;for(;_0xa2c2c;){if(_0x335e26(_0xa2c2c)){if(xs(_0xa2c2c)&&(_0x3ffa38=_0xa2c2c),this['_isExistingContentComment'](_0xa2c2c)&&_0x329fd2&&!_0x425dd8){_0x425dd8=!0x0,_0xa2c2c=_0xa2c2c['nextSibling'];continue;}break;}const _0x225100=fs(_0xa2c2c,'data-id');if(_0x225100&&'new-element'!==_0x225100&&this['_existingDataIds']['has'](_0x225100)){_0x3ffa38=_0xa2c2c;break;}_0xa2c2c=_0xa2c2c['nextSibling'];}return _0x3ffa38;}['_findPrevElementWithDataId'](_0x336254,_0xfd86e3){let _0x231419=_0x336254['previousSibling'],_0x5b5777=null,_0x437d8f=!0x1;for(;_0x231419;){if(_0x335e26(_0x231419)){if(xs(_0x231419)&&(_0x5b5777=_0x231419),this['_isExistingContentComment'](_0x231419)&&_0xfd86e3&&!_0x437d8f){_0x437d8f=!0x0,_0x231419=_0x231419['previousSibling'];continue;}break;}const _0x1c1597=fs(_0x231419,'data-id');if(_0x1c1597&&'new-element'!==_0x1c1597&&this['_existingDataIds']['has'](_0x1c1597)){_0x5b5777=_0x231419;break;}_0x231419=_0x231419['previousSibling'];}return _0x5b5777;}['_markWrappedElements'](_0x378894){_0x4654ea(_0x378894)&&Ts('data-id',null,_0x378894)['forEach'](_0x56b7f0=>{this['_isExistingNode'](_0x56b7f0)&&(bs(_0x56b7f0,'data-wrapped-id',fs(_0x56b7f0,'data-id')),bs(_0x56b7f0,'data-id',null));});}['_processWrappedElements'](_0x5e62cb,_0x1034cb){Ts('data-wrapped-id',null,_0x5e62cb)['forEach'](_0x4ca496=>{const _0x8ff347=fs(_0x4ca496,'data-wrapped-id');if(this['_hasUnstableParent'](_0x4ca496))return;const _0x58fc05=Es('data-id',_0x8ff347,_0x5e62cb);bs(_0x4ca496,'data-id',_0x8ff347),_0x58fc05&&(this['_removeNode'](_0x58fc05,_0x8ff347,_0x1034cb),this['_touchedNodesState']['removedIds']['push'](_0x8ff347),this['_touchedNodesState']['lastTouchedId']=_0x8ff347);});}['_hasUnstableParent'](_0x1fd6d3){let _0x59e865=_0x1fd6d3['parentNode'];for(;_0x59e865;){if(fs(_0x59e865,'data-unstable'))return!0x0;_0x59e865=_0x59e865['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x4ce463){const _0x281afb=new Set(this['_touchedNodesState']['removedIds']),_0x142719=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x4ce463)['forEach'](_0x3e3b45=>{const _0x51bae5=fs(_0x3e3b45,'data-id'),_0x1dc6a7=!!_0x51bae5&&this['_referencedExistingIds']['has'](_0x51bae5),_0x2897e9=!!_0x51bae5&&_0x142719['has'](_0x51bae5);if(!_0x51bae5||!_0x1dc6a7&&!_0x2897e9)return;if(_0x281afb['has'](_0x51bae5))return;let _0x2c5c91=_0x3e3b45['parentNode'],_0x4f3e9c=!0x1;for(;_0x2c5c91;){if(_0x2c5c91===_0x4ce463){_0x4f3e9c=!0x0;break;}const _0x50d750=fs(_0x2c5c91,'data-id');if(_0x50d750&&(this['_referencedExistingIds']['has'](_0x50d750)||_0x142719['has'](_0x50d750)))return;_0x2c5c91=_0x2c5c91['parentNode'];}if(_0x4f3e9c){if(_0x129955(_0x4ce463,_0x3e3b45),_0x1dc6a7){const _0x4609ca=this['_generateUid'](),_0x53956c=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x51bae5);-0x1!==_0x53956c&&this['_touchedNodesState']['modifiedIds']['splice'](_0x53956c,0x1),bs(_0x3e3b45,'data-unwrapped-id',_0x51bae5),bs(_0x3e3b45,'data-id',_0x4609ca),this['_touchedNodesState']['newIds']['push'](_0x4609ca),this['_touchedNodesState']['rescuedNewIds']['add'](_0x4609ca),this['_touchedNodesState']['lastTouchedId']=_0x4609ca;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x51bae5),this['_touchedNodesState']['lastTouchedId']=_0x51bae5;}});}['_getUid'](_0x1e3499){return this['_isExistingNode'](_0x1e3499)?fs(_0x1e3499,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x3581e3){Cs(_0x3581e3)['filter'](_0x3f5509=>xs(_0x3f5509)||this['_isExistingContentComment'](_0x3f5509))['forEach'](_0x53661d=>{_0x183ce6(_0x53661d);});}['_findLastConfirmationPoint'](_0x11fd92){let _0x2892db=null,_0x15df22=null,_0x102ae4=null,_0x1d0ed7=null;const _0x30b7ce=_0x127be6=>{_0x127be6&&(_0x2892db=_0x127be6),_0x102ae4=null,_0x1d0ed7=null;};for(let _0x1ebf16=0x0;_0x1ebf16<_0x11fd92['length'];_0x1ebf16++){const _0x174483=_0x11fd92[_0x1ebf16];if(this['_isExistingContentComment'](_0x174483)){_0x30b7ce(_0x15df22);continue;}if(_0x4654ea(_0x174483)){const _0x5e01ab=fs(_0x174483,'data-id'),_0x9d1b45=_0x1ebf16===_0x11fd92['length']-0x1;if(_0x5e01ab&&'new-element'!==_0x5e01ab&&this['_touchedNodesState']['modifiedIds']['includes'](_0x5e01ab)&&!_0x9d1b45){_0x30b7ce(_0x5e01ab),_0x15df22=_0x5e01ab;continue;}}let _0x343137=null;const _0x27cfb9=Ls(_0x174483);if(_0x27cfb9&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x27cfb9))_0x15df22=_0x27cfb9;else{if(_0x27cfb9&&this['_touchedNodesState']['newIds']['includes'](_0x27cfb9))_0x343137='N';else{if(!xs(_0x174483))continue;_0x343137='R';}_0x343137===_0x1d0ed7||null===_0x1d0ed7?_0x1d0ed7=_0x343137:null!==_0x102ae4?(_0x30b7ce(_0x15df22),_0x1d0ed7=_0x343137):(_0x102ae4=_0x1d0ed7,_0x1d0ed7=_0x343137),_0x15df22=_0x27cfb9;}}const _0x3f2702=_0x11fd92[_0x11fd92['length']-0x1];return _0x3f2702&&!_0x4654ea(_0x3f2702)&&!xs(_0x3f2702)&&_0x15df22&&_0x30b7ce(_0x15df22),_0x2892db;}['_getLastStableElement'](_0x355ff6,_0x4cde04){if(!_0x4cde04)return null;const _0x23a6d0=Es('data-id',_0x4cde04,_0x355ff6);if(!_0x23a6d0)return null;const _0x33af32=[_0x23a6d0,...Rs(_0x23a6d0)]['at'](-0x2);if(_0x33af32===_0x23a6d0)return _0x23a6d0;let _0x1a29cb=_0x33af32['previousSibling'];for(;_0x1a29cb&&!_0x4654ea(_0x1a29cb);)_0x1a29cb=_0x1a29cb['previousSibling'];return _0x1a29cb;}['_markUnstableElements'](_0x603ca,_0x112751){const _0x3e2acf=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x285c8c=_0x112751?_0x112751['nextSibling']:_0x603ca['firstChild'];for(;_0x285c8c;)_0x4654ea(_0x285c8c)&&(_0x3e2acf['has'](fs(_0x285c8c,'data-id'))||Ts('data-id',null,_0x285c8c)['some'](_0x352bd5=>_0x3e2acf['has'](fs(_0x352bd5,'data-id'))))&&bs(_0x285c8c,'data-unstable','true'),_0x285c8c=_0x285c8c['nextSibling'];}['_isNewNode'](_0x395b19){return Boolean('new-element'===fs(_0x395b19,'data-id'));}['_isExistingNode'](_0x4bae0e){return Boolean((fs(_0x4bae0e,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x4bae0e,'data-id'));}['_isExistingContentComment'](_0x2533e1){return Boolean(_0x335e26(_0x2533e1)&&ms(_0x2533e1)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function xs(_0x348bc5){return!!_0x348bc5&&Boolean(_0x335e26(_0x348bc5)&&ms(_0x348bc5)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ls(_0x298851){if(!_0x298851)return null;if(_0x4654ea(_0x298851))return fs(_0x298851,'data-id')??null;if(_0x335e26(_0x298851)){const _0x3b2d58=ms(_0x298851)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x3b2d58&&_0x3b2d58[0x1])return _0x3b2d58[0x1];}return null;}function Ds(_0x24bb0f,_0x3881b0){const _0x5b2a2a=new Map();for(const _0xb22505 of ws(_0x24bb0f))_0x5b2a2a['set'](fs(_0xb22505,'data-id'),_0xb22505);const _0x572cd6=new Set();for(const _0x4b716a of ws(_0x3881b0)){const _0x2aad95=fs(_0x4b716a,'data-id'),_0x277ed1=_0x2aad95?_0x5b2a2a['get'](_0x2aad95):void 0x0;_0x277ed1?(_0x1845ad(_0x4b716a,_0x398eb6(_0x277ed1,!0x0)),_0x572cd6['add'](_0x2aad95)):_0x183ce6(_0x4b716a);}for(const _0x1813cf of Cs(_0x3881b0))xs(_0x1813cf)&&_0x5b2a2a['has'](Ls(_0x1813cf))&&_0x183ce6(_0x1813cf);const _0x51ad1a=new Set(Ts('data-id',null,_0x3881b0)['map'](_0x5f2000=>fs(_0x5f2000,'data-id')));for(const [_0x4aaf26,_0x343797]of _0x5b2a2a){if(_0x572cd6['has'](_0x4aaf26))continue;let _0x10ac50=_0x343797['parent'],_0x1d1c64=null;for(;_0x10ac50&&_0x4654ea(_0x10ac50);){const _0x17c0e9=fs(_0x10ac50,'data-id');if(_0x17c0e9&&_0x51ad1a['has'](_0x17c0e9)){_0x1d1c64=_0x17c0e9;break;}_0x10ac50=_0x10ac50['parent'];}if(!_0x1d1c64)continue;const _0x135b25=Es('data-id',_0x1d1c64,_0x3881b0);_0x135b25&&_0x3da38c(_0x135b25,_0x398eb6(_0x343797,!0x0));}}const Ps=/* #__PURE__ -- @preserve */
26
- gt();var Hs=class extends Ps{['_m2html'];constructor(){super();const _0x1bba2a=Object['entries'](_0x5b9145),_0x21c449=_0x1bba2a['findIndex'](([_0x5aa48b])=>'rehypeDomRaw'===_0x5aa48b);if(-0x1===_0x21c449)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x1bba2a['splice'](_0x21c449+0x1,0x0,['rehypeSanitize',_0x52b7a8]),this['_m2html']=new _0x3325a1({'plugins':Object['fromEntries'](_0x1bba2a)});}['convertMarkdownToHTML'](_0x3fd872){const _0x5f2de2=this['_m2html']['parse'](_0x3fd872);return this['parseAndNormalizeHTML'](_0x5f2de2);}['parseAndNormalizeHTML'](_0xabd7ff){return this['_parseHTML'](_0xabd7ff);}['_parseHTML'](_0x1a5eb4){const _0x544d67=ps('<dummy>'+_0x1a5eb4['replace'](/<[^>]*?$/g,'')+'</dummy>');return Ms(_0x544d67),_0x544d67['children']=_0x544d67['children'][0x0]['children'],_0x544d67;}};function Ms(_0x18c6c5){for(const _0x39f7fa of _0x18c6c5['children'])_0x4654ea(_0x39f7fa)?'pre'!==_0x39f7fa['name']&&Ms(_0x39f7fa):_0x157de6(_0x39f7fa)&&(_0x39f7fa['data']=_0x39f7fa['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Vs({changeGroups:_0x10d293,documentContextContent:_0x2f6b18,showDiff:_0x413505,trimUnchanged:_0x24583f=!0x0}){return _0x10d293['map'](_0x4c4665=>{if(!_0x4c4665['editor']||'destroyed'===_0x4c4665['editor']['state'])return null;if(!_0x33336f(_0x4c4665['editor'],_0x4c4665['rootName']))return{'type':_0x4c4665['changes'][0x0]['type'],'index':_0x4c4665['index'],'content':new _0xc2b1d2([]),'hasChanges':!0x1};const _0x597660=new _0xc2b1d2([]),_0x2f6926=new _0xc2b1d2([]),_0x1753c7=new Set();for(const _0x56aa45 of _0x4c4665['changes'])'new'==_0x56aa45['type']&&Ts('data-id',null,_0x56aa45['node'])['forEach'](_0x4d1bd3=>{_0x1753c7['add'](fs(_0x4d1bd3,'data-id'));});for(const _0x25048 of _0x4c4665['changes'])if('removed'!=_0x25048['type']?_0x2f6926['children']['push'](_0x25048['node']['cloneNode'](!0x0)):_0x413505||_0x1753c7['has'](_0x25048['id'])||_0x2f6926['children']['push'](_0x25048['node']['cloneNode'](!0x0)),'new'!=_0x25048['type']&&(_0x413505||'removed'!=_0x25048['type'])){const _0x261ef9=ti(_0x41c110=>fs(_0x41c110,'data-id')==_0x25048['id'],_0x2f6b18['get'](_0x4c4665['documentId']),!0x0);_0x261ef9&&_0x597660['children']['push'](_0x261ef9['cloneNode'](!0x0));}let _0x436e9b,_0x21eb1d;try{({content:_0x436e9b,hasChanges:_0x21eb1d}=Us(_0x4c4665['editor'],_0x597660,_0x2f6926,_0x413505,_0x24583f));}catch{return{'type':_0x4c4665['changes'][0x0]['type'],'index':_0x4c4665['index'],'content':new _0xc2b1d2([]),'hasChanges':!0x1};}return{'type':_0x4c4665['changes'][0x0]['type'],'index':_0x4c4665['index'],'content':_0x436e9b,'hasChanges':_0x21eb1d};})['filter'](_0x1e05a4=>null!==_0x1e05a4);}function Us(_0x2ba11b,_0x427041,_0x47cd6a,_0x57b492,_0x5180b9=!0x0){const _0x18ce3c=_0x2ba11b['plugins']['get']('DocumentCompare'),_0x27870b=ms(_0x427041),_0x28c6fb=ms(_0x47cd6a),_0x2006ee=_0x2ba11b['data']['parse'](_0x27870b,'$root'),_0x149e2c=_0x2ba11b['model']['createPositionAt'](_0x2006ee,0x0),_0x2e2cbb=_0x18ce3c['getDiff'](_0x27870b,_0x28c6fb,{'anchor':_0x149e2c,'markDeletions':_0x57b492,'targetEditor':_0x2ba11b})['getOperations']();if(0x0==_0x2e2cbb['length'])return{'content':_0x427041['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x57b492?function(_0x594385,_0x2e92cb,_0xad2513){if(0x0==_0x594385['length'])return;const _0x27deda=_0xad2513['plugins']['get']('DocumentCompare'),_0x3c3722=_0xad2513['plugins']['get']('SuggestionsConversion');_0xad2513['model']['change'](_0x26ea73=>{const _0x39ff73=new Set();for(let _0x359176=0x0;_0x359176<_0x594385['length'];_0x359176++){const _0x2c51f2=_0x594385[_0x359176];if(_0x2c51f2['baseVersion']=null,_0x2c51f2['isDocumentOperation']=!0x1,_0x27deda['isMarkedRemoveOperation'](_0x2c51f2)){const _0x43d2dd=_0x24d965(_0x2c51f2['newRange'],_0xad2513['model']),_0x3bf609='suggestion:deletion:'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x3bf609,_0x43d2dd);}else switch(_0x2c51f2['type']){case'rename':{if(_0x2c51f2['oldName']==_0x2c51f2['newName'])break;_0x26ea73['batch']['addOperation'](_0x2c51f2),_0xad2513['model']['applyOperation'](_0x2c51f2);const _0x5909ce='$elementName',_0x519683=_0x2c51f2['position'],_0x2c3a2f=_0xad2513['model']['createRange'](_0x519683,_0xad2513['model']['createPositionAt'](_0x519683['nodeAfter'],'end')),_0x4bef12='suggestion:attribute:'+_0x5909ce+':'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x4bef12,_0x2c3a2f);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x2c51f2['oldValue']==_0x2c51f2['newValue'])break;_0x26ea73['batch']['addOperation'](_0x2c51f2),_0xad2513['model']['applyOperation'](_0x2c51f2);const _0x2f4b8b=_0x2c51f2['key'];if(!_0x3c3722['isRegisteredAttribute'](_0x2f4b8b))break;const _0x300b57=_0x24d965(_0x2c51f2['range'],_0xad2513['model']),_0x352a9b='suggestion:attribute:'+_0x2f4b8b+':'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x352a9b,_0x300b57);break;}case'insert':{if(_0x26ea73['batch']['addOperation'](_0x2c51f2),_0xad2513['model']['applyOperation'](_0x2c51f2),Bs(_0x2e92cb,_0x2c51f2),_0x594385[_0x359176+0x1]&&'move'==_0x594385[_0x359176+0x1]['type'])break;const _0x20527c=_0x2c51f2['position'],_0x1666e7=_0x2c51f2['howMany'],_0x2a0f10=_0x24d965(_0xad2513['model']['createRange'](_0x20527c,_0x20527c['getShiftedBy'](_0x1666e7)),_0xad2513['model']),_0x120663='suggestion:insertion:'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x120663,_0x2a0f10);break;}case'split':{_0x26ea73['batch']['addOperation'](_0x2c51f2),_0xad2513['model']['applyOperation'](_0x2c51f2),Bs(_0x2e92cb,_0x2c51f2);const _0x36787d=_0x2c51f2['splitPosition'],_0x4955b8=_0x2c51f2['moveTargetPosition'],_0x105712=_0xad2513['model']['createRange'](_0x36787d,_0x4955b8),_0x327e9d='suggestion:insertion:'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x327e9d,_0x105712);break;}case'move':{_0x26ea73['batch']['addOperation'](_0x2c51f2),_0xad2513['model']['applyOperation'](_0x2c51f2),Bs(_0x2e92cb,_0x2c51f2);const _0x472edd=_0x2c51f2['getMovedRangeStart'](),_0x2fbc43=_0x2c51f2['howMany'];for(let _0x5edb48=0x0;_0x5edb48<_0x2fbc43;_0x5edb48++){const _0x164dd3=_0x472edd['getShiftedBy'](_0x5edb48)['nodeAfter'];_0x39ff73['add'](_0x164dd3);}break;}case'remove':{const _0x4cd97f=_0x2c51f2['sourcePosition'],_0x4d3918=_0x2c51f2['howMany'],_0x3f5ad0=new _0x462971(_0x4cd97f,_0x4d3918);_0x26ea73['batch']['addOperation'](_0x3f5ad0),_0xad2513['model']['applyOperation'](_0x3f5ad0),Bs(_0x2e92cb,_0x2c51f2);break;}}}for(const _0x2d15f of _0x39ff73){const _0x1bec37=_0xad2513['model']['createRangeOn'](_0x2d15f),_0x2196c0='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0x2e92cb['markers']['set'](_0x2196c0,_0x24d965(_0x1bec37,_0xad2513['model']));}});}(_0x2e2cbb,_0x2006ee,_0x2ba11b):_0x2ba11b['model']['change'](_0xf4ff28=>{for(const _0x4cbd17 of _0x2e2cbb)if('remove'==_0x4cbd17['type']){const _0x57ac2d=_0x4cbd17['sourcePosition'],_0x370529=_0x4cbd17['howMany'],_0x96a87a=new _0x462971(_0x57ac2d,_0x370529);_0xf4ff28['batch']['addOperation'](_0x96a87a),_0x2ba11b['model']['applyOperation'](_0x96a87a),Bs(_0x2006ee,_0x4cbd17);}else{if('marker'==_0x4cbd17['type']){const _0x1c4bbe=_0x4cbd17['name'],_0x3b2f1e=_0x4cbd17['newRange'];null!==_0x3b2f1e?_0x2006ee['markers']['set'](_0x1c4bbe,_0x3b2f1e):_0x2006ee['markers']['delete'](_0x1c4bbe);}else _0x4cbd17['baseVersion']=null,_0x4cbd17['isDocumentOperation']=!0x1,_0xf4ff28['batch']['addOperation'](_0x4cbd17),_0x2ba11b['model']['applyOperation'](_0x4cbd17),Bs(_0x2006ee,_0x4cbd17);}}),_0x5180b9){const _0x19fdc2=Gs(_0x2ba11b,_0x2e2cbb,_0x2006ee);Ks(_0x2ba11b['model'],_0x19fdc2),function(_0x10909c,_0x3de49d){const _0x4ea2d2=_0x3de49d['getFirstRange']()['start'];let _0xc9db2e=_0x3de49d['getFirstRange']()['end'];const _0x419e55=_0x4ea2d2['root'];(_0xc9db2e['textNode']||_0xc9db2e['nodeAfter']&&_0xc9db2e['nodeAfter']['is']('$text'))&&(_0x1a03de(_0xc9db2e,'...'),$s(_0x419e55,_0xc9db2e,0x3),_0xc9db2e=_0xc9db2e['getShiftedBy'](0x3)),(_0x4ea2d2['textNode']||_0x4ea2d2['nodeBefore']&&_0x4ea2d2['nodeBefore']['is']('$text'))&&(_0x1a03de(_0x4ea2d2,'...'),$s(_0x419e55,_0x4ea2d2,0x3),_0x4ea2d2['parent']==_0xc9db2e['parent']&&(_0xc9db2e=_0xc9db2e['getShiftedBy'](0x3)));const _0x56db78=_0x10909c['createRange'](_0x10909c['createPositionAt'](_0x419e55,0x0),_0x4ea2d2),_0x2c886f=_0x10909c['createRange'](_0xc9db2e,_0x10909c['createPositionAt'](_0x419e55,'end')),_0x52c4b8=[..._0x56db78['getMinimalFlatRanges'](),..._0x2c886f['getMinimalFlatRanges']()];_0x52c4b8['reverse']();for(const _0x3b336a of _0x52c4b8)_0x345048(_0x3b336a),Ys(_0x419e55,_0x3b336a);}(_0x2ba11b['model'],_0x19fdc2);}return{'content':ps(_0x2ba11b['data']['stringify'](_0x2006ee,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Bs(_0x41df4a,_0x49c125){for(const [_0x217c9c,_0x248f5c]of _0x41df4a['markers']){const _0x14b198=_0x3888b9['_createFromRanges'](_0x248f5c['getTransformedByOperation'](_0x49c125));_0x14b198['root']==_0x41df4a?_0x41df4a['markers']['set'](_0x217c9c,_0x14b198):_0x41df4a['markers']['delete'](_0x217c9c);}}function Gs(_0xb64d31,_0x1d48f8,_0x28f35f){const _0x1a9b07=_0xb64d31['plugins']['get']('DocumentCompare');let _0x2f81aa=_0xb64d31['model']['createPositionAt'](_0x28f35f,Number['POSITIVE_INFINITY']),_0x33829f=_0xb64d31['model']['createPositionAt'](_0x28f35f,0x0);for(const _0x18d823 of _0x1d48f8){let _0x2223e3,_0xfc2cb8;if(_0x1a9b07['isMarkedRemoveOperation'](_0x18d823))_0x2223e3=_0x18d823['newRange']['start'],_0xfc2cb8=_0x18d823['newRange']['end'];else switch(_0x2f81aa=Fs(_0x2f81aa,_0x18d823),_0x33829f=Fs(_0x33829f,_0x18d823),_0x18d823['type']){case'rename':_0x2223e3=_0x18d823['position'],_0xfc2cb8=_0x2223e3['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x2223e3=_0x18d823['range']['start'],_0xfc2cb8=_0x18d823['range']['end'];break;case'insert':_0x2223e3=_0x18d823['position'],_0xfc2cb8=_0x2223e3['getShiftedBy'](_0x18d823['howMany']);break;case'split':_0x2223e3=_0x18d823['splitPosition'],_0xfc2cb8=_0x18d823['moveTargetPosition'];break;case'merge':{const _0x362a1f=_0x18d823['targetPosition']['path']['slice'](0x0,-0x1);_0x2223e3=_0xb64d31['model']['createPositionFromPath'](_0x28f35f,_0x362a1f),_0xfc2cb8=_0x2223e3['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x440ffc=_0x18d823['howMany'],_0x2ed38b=_0x18d823['sourcePosition']['_getTransformedByInsertion'](_0x18d823['targetPosition'],_0x440ffc),_0x186bdd=_0x18d823['getMovedRangeStart']();'remove'==_0x18d823['type']?(_0x2223e3=_0x2ed38b,_0xfc2cb8=_0x2ed38b):(_0x2223e3=_0x186bdd,_0xfc2cb8=_0x186bdd['getShiftedBy'](_0x440ffc));break;}}_0x2223e3&&_0x2223e3['isBefore'](_0x2f81aa)&&(_0x2f81aa=_0x2223e3['clone'](),_0x2f81aa['stickiness']='toNone'),_0xfc2cb8&&_0xfc2cb8['isAfter'](_0x33829f)&&(_0x33829f=_0xfc2cb8['clone'](),_0x33829f['stickiness']='toNone');}return _0xb64d31['model']['createSelection'](_0xb64d31['model']['createRange'](_0x2f81aa,_0x33829f));}function Fs(_0x2a1251,_0x197d96){return'move'!=_0x197d96['type']&&'remove'!=_0x197d96['type']||_0x197d96['sourceRange']['containsPosition'](_0x2a1251)&&((_0x2a1251=_0x197d96['sourcePosition']['clone']())['stickiness']='toNone'),_0x2a1251['getTransformedByOperation'](_0x197d96);}function Ks(_0x2cf019,_0x1d190a){Ws(_0x2cf019,_0x1d190a,'forward');const _0x4064d9=_0x1d190a['getFirstRange']();_0x1d190a['setTo']([]),_0x1d190a['setTo'](_0x4064d9,{'backward':!0x0}),Ws(_0x2cf019,_0x1d190a,'backward');}function Ws(_0x3aa7c6,_0x5dfb16,_0x4b804b){let _0x5c5dc7=0x14;for(;_0x5c5dc7;){_0x3aa7c6['modifySelection'](_0x5dfb16,{'unit':'word','direction':_0x4b804b}),_0x5c5dc7--;const _0x4500c1=_0x5dfb16['focus']['forward'==_0x4b804b?'nodeBefore':'nodeAfter'];if(_0x4500c1&&_0x4500c1['is']('element')&&_0x3aa7c6['schema']['isBlock'](_0x4500c1)&&_0x3aa7c6['schema']['isObject'](_0x4500c1))break;}}function Ys(_0x2f7d1a,_0x2317f2){for(const [_0x1b9db3,_0x10147f]of _0x2f7d1a['markers']){const _0x16377a=_0x10147f['_getTransformedByDeletion'](_0x2317f2['start'],_0x2317f2['end']['offset']-_0x2317f2['start']['offset']);null!=_0x16377a?_0x2f7d1a['markers']['set'](_0x1b9db3,_0x16377a):_0x2f7d1a['markers']['delete'](_0x1b9db3);}}function $s(_0x3c071b,_0x4c4f02,_0x1de7a7){for(let [_0x4a58e5,_0x298a04]of _0x3c071b['markers'])_0x298a04=_0x298a04['_getTransformedByInsertion'](_0x4c4f02,_0x1de7a7,!0x1)[0x0],_0x3c071b['markers']['set'](_0x4a58e5,_0x298a04);}const qs=/* #__PURE__ -- @preserve */
27
- ut();var Qs=class extends qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0xb5e8ff,config:_0x4f3d89,locale:_0xe18966}){super(),this['_connector']=_0xb5e8ff,this['_config']=_0x4f3d89,this['_locale']=_0xe18966;}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 _0x3a81d1=await this['getAll']();let _0x280a0c;return _0x280a0c=this['_availableModels']?this['_filterModels'](_0x3a81d1,this['_availableModels']):_0x3a81d1['filter'](_0x40c2ef=>_0x40c2ef['recommended']),_0x280a0c;}async['getModel'](_0x538240){const _0x3751cf=await this['getAll']();if(!_0x3751cf['length'])return null;if(_0x538240){const _0x14108a=this['_getModelById'](_0x3751cf,_0x538240);if(_0x14108a)return _0x14108a;bt('ai-chat-model-id-unrecognized',{'modelId':_0x538240,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x547c5f=await this['getAvailableModels']();if(!_0x547c5f['length'])return null;if(this['_defaultModelId']){const _0x324efe=this['_getModelById'](_0x547c5f,this['_defaultModelId']);if(_0x324efe)return _0x324efe;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x547c5f[0x0]['id']});}return _0x547c5f[0x0];}async['isAvailable'](_0x1bbd21){return(await this['getAvailableModels']())['some'](_0x3a547d=>_0x3a547d['name']===_0x1bbd21['name']&&_0x3a547d['provider']===_0x1bbd21['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x1db227=this['_locale']['uiLanguage']||'en',_0x21b7fd=await this['_connector']['getModels'](_0x1db227)['list']();this['_modelList']=_0x21b7fd['items']['map'](_0x20f5f1=>Xs(_0x20f5f1)?{..._0x20f5f1,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x20f5f1);}return[...this['_modelList']];}['_filterModels'](_0x17217d,_0x4c92c3){let _0x1b4a50;if(_0x4c92c3){_0x1b4a50=[];const _0x2643ef=new Set(),_0xa32b8c='string'==typeof _0x4c92c3?[_0x4c92c3['toLocaleLowerCase']()]:_0x4c92c3['map'](_0x2de2a9=>_0x2de2a9['toLocaleLowerCase']());for(const _0x4e40fa of _0xa32b8c)for(const _0x55c0c1 of _0x17217d)!_0x2643ef['has'](_0x55c0c1['id'])&&this['_isMatchingFilter'](_0x55c0c1,_0x4e40fa)&&(_0x1b4a50['push'](_0x55c0c1),_0x2643ef['add'](_0x55c0c1['id']));}else _0x1b4a50=_0x17217d;return _0x1b4a50;}['_isMatchingFilter'](_0xe3a8a7,_0x7c6a62){const _0x4e7977=_0xe3a8a7['id']['toLocaleLowerCase'](),_0x544a2e=_0xe3a8a7['name']['toLocaleLowerCase'](),_0x597d9c=_0xe3a8a7['provider']['toLocaleLowerCase']();return _0x4e7977===_0x7c6a62||_0x544a2e===_0x7c6a62||Xs(_0xe3a8a7)&&'auto'===_0x7c6a62||_0x597d9c===_0x7c6a62||_0x4e7977['startsWith'](_0x7c6a62);}['_getModelById'](_0x3988a9,_0x4652b3){return _0x3988a9['find'](_0x22eb48=>Xs(_0x22eb48)&&'auto'===_0x4652b3?_0x22eb48:_0x22eb48['id']===_0x4652b3)||null;}};function Xs(_0x5aefcd){return _0x5aefcd['id']['startsWith']('agent');}function zs(_0x4aeeac,_0x4dee66){for(const _0x6fbd82 of _0x4aeeac)'noop'!==_0x6fbd82['type']&&(_0x6fbd82['_aiSource']=_0x4dee66);}var js=class extends _0x5bb7a3{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x5bc848];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Qs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x23fd01,_0xbbb18d){if('completed'!==_0x23fd01['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x23fd01['status']});const _0x2e15c1=_0x23fd01['editor'],{applyMethod:_0x362552}=_0xbbb18d;if('suggest'===_0x362552&&!_0x2e15c1['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x3e7e02='suggest'===_0x362552,_0x38841b=this['context']['plugins']['get'](_0x5bc848),_0xee8b6c=_0x2e15c1['model']['createPositionAt'](_0x2e15c1['model']['document']['getRoot'](),0x0),_0x339741=_0x38841b['getDiff'](_0x23fd01['contentRawOld'],_0x23fd01['contentRawNew'],{'anchor':_0xee8b6c,'markDeletions':_0x3e7e02,'targetEditor':_0x2e15c1}),_0x34ff18=_0x2e15c1['model']['document']['history']['getOperations'](_0x23fd01['documentVersion']),_0x4c23e4={'document':_0x2e15c1['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x586d6a=_0x4a80ce(_0x339741['getOperations'](),_0x34ff18,_0x4c23e4)['operationsA'];zs(_0x586d6a,_0xbbb18d['aiSource']??'api'),_0x2e15c1['model']['change'](_0x358e02=>{_0x3e7e02?_0x2e15c1['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x586d6a):_0x38841b['applyOperations'](_0x358e02,_0x586d6a);});}['mergeChangesIntoContent'](_0x57f3fe,_0x1a402d,_0x4bca5b){const _0x2ea0f4=new Hs(),_0x1bb4cf=new ys();let _0x54502d=_0x2ea0f4['parseAndNormalizeHTML'](_0x1a402d);for(const _0x10006d of _0x57f3fe)try{const _0x35863f=_0x2ea0f4['parseAndNormalizeHTML'](_0x10006d['content']);_0x54502d=_0x1bb4cf['merge'](_0x35863f,_0x54502d,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x3e77e3){throw new ht('ai-gateway-merge-failed',this,{..._0x10006d},_0x3e77e3);}return Us(_0x4bca5b,_0x2ea0f4['parseAndNormalizeHTML'](_0x1a402d),_0x54502d,!0x1,!0x1)['content'];}},Js=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x258b57){this['_editor']=_0x258b57['editor'],this['_rootName']=_0x258b57['rootName'],this['_channelId']=_0x258b57['channelId'],this['_sessionId']=_0x258b57['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'](_0x32b148){this['_documentVersion']=_0x32b148;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1d89de){this['_contentRawOld']=_0x1d89de;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x5d1bb4){this['_contentRawNew']=_0x5d1bb4;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x2dc35c){this['_error']=_0x2dc35c;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x5647f4){return _0x5647f4['replace'](/ data-id="[a-z0-9]+"/g,'');}},Zs=class extends Js{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x520070){this['_summary']=_0x520070;}},tn=class extends _0x5bb7a3{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0xf2ed3a,_0x476bfe){if(!_0xf2ed3a)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x357d2b=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x357d2b[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x2cb075=new Zs({'editor':_0x357d2b[0x0]['editor'],'rootName':_0x357d2b[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x357d2b[0x0]['sessionId']});if(_0x2cb075['contentRawOld']=_0x357d2b[0x0]['content'],_0x2cb075['documentVersion']=_0x357d2b[0x0]['version'],_0x476bfe?.['signal']?.['aborted'])return _0x2cb075['abort'](),_0x2cb075;const _0x4adc2c=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x2cb075['contentRawOld'],'prompt':_0xf2ed3a,'model':_0x476bfe['model']});let _0x488abb;if(_0x476bfe?.['signal']){if(_0x476bfe['signal']['aborted'])return _0x4adc2c['abortController']['abort'](),_0x2cb075['abort'](),_0x2cb075;const _0x52883b=_0x476bfe['signal'],_0x42bea2=()=>_0x4adc2c['abortController']['abort']();_0x52883b['addEventListener']('abort',_0x42bea2),_0x488abb=()=>_0x52883b['removeEventListener']('abort',_0x42bea2);}try{const _0x4b34e9=await _0x4adc2c['getResult']();if(!(_0x4b34e9&&_0x4b34e9['document']&&_0x4b34e9['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x2cb075['contentRawNew']=_0x4b34e9['document'],_0x2cb075['summary']=_0x4b34e9['summary']||'';}catch(_0x589146){_0x589146 instanceof Error&&_0x589146['message']['includes']('ai-request-aborted')?_0x2cb075['abort']():_0x2cb075['error']=_0x589146 instanceof ht?_0x589146:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x589146);}finally{_0x488abb&&_0x488abb();}return _0x2cb075;}['applyResult'](_0x5ca00d,_0x101da2){this['context']['plugins']['get']('AIGateway')['apply'](_0x5ca00d,_0x101da2);}};function en(_0x4acf29){return _0x4acf29 instanceof Error&&('AbortError'===_0x4acf29['name']||('AICoreError'===_0x4acf29['name']?!0x0===_0x4acf29['isAbort']:_0x4acf29['message']['startsWith']('ai-request-aborted')));}var sn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x4e81a5){super(_0x4e81a5['code'],_0x4e81a5['cause']instanceof Error?{'cause':_0x4e81a5['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x4e81a5['code'],this['severity']=_0x4e81a5['severity']??'error',this['type']=_0x4e81a5['type']??'system',this['context']=_0x4e81a5['context'],this['isAbort']=_0x4e81a5['isAbort']??en(_0x4e81a5['cause']);}},nn=class extends _0x5bb7a3{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x4c8506){return new rn(this,_0x4c8506);}},rn=class{['_sink'];['_component'];constructor(_0x16f495,_0x2c79b0){this['_sink']=_0x16f495,this['_component']=_0x2c79b0;}['logError'](_0x521567,_0x5bf73a={}){this['_emit'](_0x521567,_0x5bf73a),this['_defaultLog'](_0x521567);}['reportError'](_0x459bce,_0x45c607={}){this['_emit'](_0x459bce,_0x45c607);}['_emit'](_0x3c4c39,_0x30876a){en(_0x3c4c39)||this['_sink']['fire']('error',{'error':_0x3c4c39,'component':this['_component'],'context':_0x30876a['context']});}['_defaultLog'](_0x3fedac){if(!en(_0x3fedac)){if(_0x3fedac instanceof sn){if('user'===_0x3fedac['type']||'network'===_0x3fedac['type'])return;if('warning'===_0x3fedac['severity'])return void console['warn'](this['_component'],_0x3fedac);}console['error'](this['_component'],_0x3fedac);}}};const on='ck-ai-button-primary',an='ck-ai-button-secondary',hn='ck-ai-button-tertiary';function cn(_0x42855d,_0xe99175){const _0x465341=new Ht(_0x42855d),_0x1bd950=us(_0x42855d,'AI_TABS_LABEL_MINIMIZE'),_0x502034=us(_0x42855d,'AI_TABS_LABEL_MAXIMIZE');return _0x465341['set']({'withText':!0x1,'icon':_0x15df19,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+hn}),_0x465341['bind']('label')['to'](_0xe99175,'isMaximized',_0xad8774=>_0xad8774?_0x1bd950:_0x502034),_0x465341['bind']('icon')['to'](_0xe99175,'isMaximized',_0x33e72f=>_0x33e72f?_0x50c50b:_0x15df19),_0x465341['bind']('isOn')['to'](_0xe99175,'isMaximized'),_0x465341['on']('execute',()=>{_0xe99175['fire']('resizeTabs');}),_0x465341;}function ln(_0x401ced){const _0x12d4ec=new Lt(_0x401ced);return _0x12d4ec['attachToDom'](),_0x12d4ec['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x12d4ec;}const un=/* #__PURE__ -- @preserve */
28
- gt();var dn=class extends un{['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:_0x2962d5,isDone:_0x6d8681=!0x1,isComplete:_0x6179a,interactionId:_0x1eb6f0,areActionsDisabled:_0x3bcd99,isFromHistory:_0x3478f4=!0x1,documentContextContent:_0xb8e1f2,locale:_0x4bd4ea,id:_0x35b988,channelsToEditors:_0x4b5f7c}){super(),this['id']=_0x35b988||vt(),this['interactionId']=_0x1eb6f0,this['type']=_0x2962d5,this['areActionsDisabled']=!!_0x3bcd99,this['isFromHistory']=_0x3478f4,this['locale']=_0x4bd4ea,this['aiResponseParser']=new Hs(),this['aiResponseApplier']=new ys(),this['documentContextContent']=new Map(_0xb8e1f2?.['map'](_0xf38056=>[_0xf38056['id'],ps(_0xf38056['content'])])||[]),this['_documentIdToSource']=new Map(_0xb8e1f2?.['map'](_0xa1376f=>[_0xa1376f['id'],{'editor':_0x4b5f7c['get'](_0xa1376f['channelId']),'rootName':_0xa1376f['rootName']}])||[]),this['set']('isDone',_0x6d8681),this['set']('isComplete',_0x6179a??_0x6d8681),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x3db34f,_0xb96916){const _0x33b35d='text'===this['type']?'text':_0xb96916;this['content']['has'](_0x33b35d)||this['content']['set'](_0x33b35d,''),this['content']['set'](_0x33b35d,this['content']['get'](_0x33b35d)+_0x3db34f),this['onContentChange'](_0x33b35d);}['done'](_0x499ed8=!0x0){this['isComplete']=_0x499ed8,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x41ed14,_0x56c451){this['changeGroups'][_0x41ed14]['state']=_0x56c451,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x41ed14,'state':_0x56c451});}['getContentParts']({showDiff:_0x53f9eb,groupIndex:_0x5e0aeb}){const _0x441a8a=this['_getCachedContentParts'](_0x53f9eb,_0x5e0aeb);if(_0x441a8a)return _0x441a8a;let _0x4042b6=[];if(void 0x0===_0x5e0aeb)_0x4042b6=this['changeGroups'];else{const _0x14b41=this['changeGroups']['find'](({index:_0x90e558})=>_0x90e558===_0x5e0aeb);if(!_0x14b41)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x5e0aeb});_0x4042b6=[_0x14b41];}const _0x23ad7b=Vs({'showDiff':_0x53f9eb,'changeGroups':_0x4042b6,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x53f9eb,_0x23ad7b),_0x23ad7b;}['_getCachedContentParts'](_0x2ef2b9,_0x22f5e8){const _0x31584b=_0x2ef2b9?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x31584b]['length'])return null;const _0x1abb76=this['cachedSuggestionContentParts'][_0x31584b];if(void 0x0===_0x22f5e8)return _0x1abb76['length']>0x0&&_0x1abb76['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x2ef2b9,null),null):_0x3bd7b7(_0x1abb76);{const _0x533ac7=_0x1abb76['find'](({index:_0x53db60})=>_0x53db60===_0x22f5e8);if(_0x533ac7)return[_0x3bd7b7(_0x533ac7)];}return null;}['_setCachedContentParts'](_0x26f688,_0x5708e8){const _0x90d06c=_0x26f688?'withDiff':'withoutDiff';_0x5708e8?_0x5708e8['forEach'](_0x4b7a9a=>{const _0x464b9b=this['cachedSuggestionContentParts'][_0x90d06c],_0x508e1e=_0x464b9b['find'](({index:_0x563492})=>_0x563492===_0x4b7a9a['index']);if(_0x508e1e){const _0x5958c7=_0x464b9b['indexOf'](_0x508e1e);_0x464b9b['splice'](_0x5958c7,0x1,_0x4b7a9a);}else _0x464b9b['push'](_0x4b7a9a);}):this['cachedSuggestionContentParts'][_0x90d06c]['length']=0x0;}['onContentChange'](_0x4accb7){if('modification'===this['type']){if(_0x4accb7)this['parsedContent']['set'](_0x4accb7,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x4accb7)));else{for(const [_0x5b7080,_0xa9327]of this['content'])this['parsedContent']['set'](_0x5b7080,this['aiResponseParser']['parseAndNormalizeHTML'](_0xa9327));}const _0x4db3e5=this['changeGroups'];for(const _0xe54a9f of this['content']['keys']())this['updateChangeGroups'](_0xe54a9f);const _0x129365=this['_getDifferentChangeGroups'](_0x4db3e5,this['changeGroups']);(_0x129365['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x129365),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'](_0x412682,_0x33390a){const _0x4ef265=[];for(const _0x1e66cf of _0x33390a){const _0x1c1e5a=_0x412682[_0x1e66cf['index']];_0x1c1e5a?_0x1c1e5a['changes']['length']!==_0x1e66cf['changes']['length']?_0x4ef265['push'](_0x1e66cf):_0x1c1e5a['changes']['forEach']((_0x33fa1b,_0x3e6fc4)=>{const _0x1996e5=_0x1e66cf['changes'][_0x3e6fc4];_0x33fa1b['id']!==_0x1996e5['id']&&_0x4ef265['push'](_0x1e66cf);}):_0x4ef265['push'](_0x1e66cf);}return _0x4ef265;}['updateChangeGroups'](_0x2a2d71){const _0x461943=this['documentContextContent']['get'](_0x2a2d71),_0x1e6b2b=this['parsedContent']['get'](_0x2a2d71);if(!_0x461943||!_0x1e6b2b)return;const _0xb568be=new _0x1b6d09('p',{},[new _0x1b6d09('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x238b0a(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x40f9e3=this['aiResponseApplier']['merge'](_0x1e6b2b,_0x461943['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0xb568be});this['parsedMergedContent']['set'](_0x2a2d71,_0x40f9e3['parsedContent']);let _0x4df6eb=[];if(_0x4211cd(_0x15f50a=>{const _0x4643cb=fs(_0x15f50a,'data-id');if(!_0x4643cb||!_0x674193(_0x4643cb))return!0x1;const _0x4efd0b=[_0x15f50a,...Rs(_0x15f50a)]['at'](-0x2);if(_0x15f50a!=_0x4efd0b){const _0x5dcadd=fs(_0x4efd0b,'data-id');_0x674193(_0x5dcadd)||(_0x4df6eb['push']({'node':_0x4efd0b,'id':_0x5dcadd,'type':'modified'}),_0x40f9e3['modifiedNodeIds']['push'](_0x5dcadd));}else _0x40f9e3['modifiedNodeIds']['includes'](_0x4643cb)?_0x4df6eb['push']({'node':_0x15f50a,'type':'modified','id':_0x4643cb}):_0x40f9e3['newNodeIds']['includes'](_0x4643cb)?_0x4df6eb['push']({'node':_0x15f50a,'type':'new','id':_0x4643cb,'anchorId':fs(_0x15f50a['previousSibling'],'data-id')}):_0x4df6eb['push']({'node':_0x15f50a,'type':'removed','id':_0x4643cb});return!0x0;},this['parsedMergedContent']['get'](_0x2a2d71)),_0x4df6eb=_0x4df6eb['filter'](({node:_0x243110})=>[...Rs(_0x243110),_0x243110]['every'](_0x491fe9=>!fs(_0x491fe9,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x191ba3=>_0x191ba3['documentId']!==_0x2a2d71),0x0==_0x4df6eb['length'])return;const _0x58b4a0=[[_0x4df6eb[0x0]]];for(let _0x1346a9=0x1;_0x1346a9<_0x4df6eb['length'];_0x1346a9++){const _0x4c6005=_0x58b4a0[_0x58b4a0['length']-0x1],_0x5a5b94=_0x4c6005[_0x4c6005['length']-0x1];_0x4df6eb[_0x1346a9]['node']['previousSibling']==_0x5a5b94['node']&&'modified'!=_0x4df6eb[_0x1346a9]['type']&&'modified'!=_0x5a5b94['type']?_0x4c6005['push'](_0x4df6eb[_0x1346a9]):_0x58b4a0['push']([_0x4df6eb[_0x1346a9]]);}for(const _0x7a3504 of _0x58b4a0){const _0x5a47fb=_0x7a3504[0x0],_0x24ff9f=_0x7a3504[_0x7a3504['length']-0x1],_0x456616=_0x38bab9(_0x5a47fb['node']['previousSibling']);_0x456616&&_0x7a3504['unshift'](_0x456616);const _0x50f70c=_0x38bab9(_0x24ff9f['node']['nextSibling']);_0x50f70c&&_0x7a3504['push'](_0x50f70c);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x2a2d71))['forEach'](_0x448b99=>{bs(_0x448b99,'data-wrapped-id',null);});const _0x17ea30=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x2a2d71))['forEach'](_0x3f40d4=>{const _0x5a0924=fs(_0x3f40d4,'data-unwrapped-id'),_0x20a12d=fs(_0x3f40d4,'data-id');_0x17ea30['set'](_0x20a12d,_0x5a0924),bs(_0x3f40d4,'data-id',_0x5a0924),bs(_0x3f40d4,'data-unwrapped-id',null);});for(const _0x253c6f of _0x4df6eb){const _0x455f37=_0x17ea30['get'](_0x253c6f['id']);_0x455f37&&(_0x253c6f['id']=_0x455f37);}this['changeGroups']['push'](..._0x58b4a0['map']((_0x2819a6,_0x1aaefd)=>({'changes':_0x2819a6,'state':'pending','index':_0x1aaefd,'editor':this['_documentIdToSource']['get'](_0x2a2d71)['editor'],'rootName':this['_documentIdToSource']['get'](_0x2a2d71)['rootName'],'documentId':_0x2a2d71})));const _0x402c77=Array['from'](this['documentContextContent']['keys']());function _0x674193(_0x1bdc51){return _0x40f9e3['modifiedNodeIds']['includes'](_0x1bdc51)||_0x40f9e3['newNodeIds']['includes'](_0x1bdc51)||_0x40f9e3['removedNodeIds']['includes'](_0x1bdc51);}function _0x38bab9(_0x3551a9){if(_0x3551a9&&fs(_0x3551a9,'data-id')&&!fs(_0x3551a9,'data-unstable')){const _0x3e0a3b=fs(_0x3551a9,'data-id');if(!_0x674193(_0x3e0a3b))return{'node':_0x3551a9,'type':'context','id':_0x3e0a3b};}return null;}this['changeGroups']['sort']((_0x360000,_0x552c1f)=>_0x402c77['indexOf'](_0x360000['documentId'])-_0x402c77['indexOf'](_0x552c1f['documentId'])),this['changeGroups']['forEach']((_0x432748,_0x4c56d1)=>{_0x432748['index']=_0x4c56d1;});}};const _n=/* #__PURE__ -- @preserve */
29
- ut(),gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var An=class extends _n{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x5523d2,locale:_0x155436,channelsToEditors:_0x595213}){super(),this['id']=vt(),this['connector']=_0x5523d2,this['isStopped']=!0x0,this['locale']=_0x155436,this['_channelsToEditors']=_0x595213||new Map();}async['start'](){await this['_run']();}async['resume'](_0x2239ef){await this['_run'](_0x2239ef);}async['_run'](_0x55f3da){const _0x4eed9d=[];let _0x558b90,_0x464cba,_0x1a096b,_0x52ce7c=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x55f3da||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x21b6e9=await this['currentRequest']['getStream']();for await(const _0x1f13aa of _0x21b6e9){if(this['isStopped'])return;if('error'==_0x1f13aa['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x1f13aa['event']){case'message-metadata':this['messageId']=_0x1f13aa['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x1f13aa['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x1f13aa['data']['conversationTitle'],!0x0);break;case'source':_0x4eed9d['push'](_0x1f13aa['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'](),_0x558b90='modification-delta'==_0x1f13aa['event']?'modification':'text',_0x464cba='modification-delta'==_0x1f13aa['event']?_0x1f13aa['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x558b90&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x558b90,'interactionId':this['id'],'id':_0x464cba,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x1f13aa['event']&&{'documentId':_0x1f13aa['data']['documentId']}}),'modification'==_0x558b90&&(this['currentReply']['sources']=_0x4eed9d['splice'](0x0))),this['currentReply']['appendContent'](_0x1f13aa['data']['textDelta'],_0x1f13aa['data']['documentId']);break;case'mcp-tool-result':_0x1a096b=JSON['parse'](_0x1f13aa['data']['result']),this['_handleToolResultData']({'toolName':_0x1f13aa['data']['toolName'],'data':_0x1a096b['data'],'attributes':_0x1a096b['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x1f13aa['data']['toolName'],'data':_0x1f13aa['data']['data']});}}_0x52ce7c=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x4eed9d['length']>0x0&&(this['currentReply']['sources']=_0x4eed9d['splice'](0x0)),this['_finalizeInteraction'](_0x52ce7c),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x3a8838){return this['replies']['find'](_0x2d4ee9=>_0x2d4ee9['id']===_0x3a8838);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1ce1fb=>_0x1ce1fb['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0xfced0b){const _0x2fd480=this['getDocumentContext'](),_0x25d98d=new dn({'locale':this['locale'],'documentContextContent':_0x2fd480?.['documents'],..._0xfced0b});return this['replies']['push'](_0x25d98d),_0x25d98d['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x25d98d),_0x25d98d;}['setConversationTitle'](_0x5c8cc5,_0x43318f=!0x1){this['fire']('setConversationTitle',_0x5c8cc5,_0x43318f);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x122e35){this['fire']('toolDataReceived',{'type':'result','toolName':_0x122e35['toolName'],'data':structuredClone(_0x122e35['data']||{}),'attributes':structuredClone(_0x122e35['attributes']||{})},this);}['_handleToolNotificationData'](_0xdb6d58){this['fire']('toolDataReceived',{'type':'notification','toolName':_0xdb6d58['toolName'],'data':structuredClone(_0xdb6d58['data'])},this);}['_finalizeInteraction'](_0x7d5ae5=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x7d5ae5),this['currentRequest']=this['currentReply']=void 0x0;}};const In=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']]),pn=/* #__PURE__ -- @preserve */
30
- gt(),mn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var En=class AIChatContext extends pn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x243c1b,config:_0x2eef89,ownerId:_0xf009e3}){super(),this['_connector']=_0x243c1b,this['_config']=_0x2eef89,this['_ownerId']=_0xf009e3;}['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'](_0x5e54ba,_0x60d534){const _0x178283=new Map(),{contextItem:_0x12ca43,hasUnmatched:_0x460f58}=await this['_populateDocumentContextItem'](_0x5e54ba,_0x60d534);_0x12ca43&&_0x178283['set'](_0x12ca43['id'],_0x12ca43);for(const _0x4b8792 of _0x5e54ba){if('document'===_0x4b8792['type'])continue;const _0x2c6a09=await this['_createContextItemFromContent'](_0x4b8792);this['_addToConversationContextItem'](_0x2c6a09),_0x178283['set'](_0x2c6a09['id'],_0x2c6a09);}return{'contextItems':_0x178283,'hasUnmatched':_0x460f58};}async['_populateDocumentContextItem'](_0x23506a,_0x1c770e){const _0x4050be=_0x23506a['filter'](_0x1a705e=>'document'===_0x1a705e['type']);if(0x0===_0x4050be['length'])return{'hasUnmatched':!0x1};const _0x270bd0=_0x4050be['map'](_0x538a3e=>_0x538a3e['id']),_0x11b867=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x270bd0)['getDocuments'](),_0xf6df25=new Map(_0x11b867['map'](_0x327698=>[_0x327698['id'],_0x327698])),_0x42a943=[];let _0x2ca014=!0x1;for(const _0xd0fb1e of _0x4050be){const _0x1c3bcf=_0xf6df25['get'](_0xd0fb1e['id']);_0x1c3bcf&&(this['_matchDocumentToRoot'](_0x1c3bcf,_0x1c770e)||(_0x2ca014=!0x0),_0x42a943['push']({'id':_0x1c3bcf['id'],'content':_0x1c3bcf['content'],'version':_0x1c3bcf['attributes']?.['version']??0x0,'sessionId':_0x1c3bcf['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x1c3bcf['attributes']?.['channelId']??_0x1c770e[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x1c3bcf['attributes']?.['rootName']??_0x1c770e[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x51a423={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x42a943};return this['_addToConversationContextItem'](_0x51a423),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x51a423,'hasUnmatched':_0x2ca014};}['_matchDocumentToRoot'](_0x644c95,_0x48df06){const _0x598e4e=_0x644c95['attributes']?.['channelId'],_0x160387=_0x644c95['attributes']?.['rootName'];if(_0x598e4e&&_0x160387){for(const _0x341db0 of _0x48df06)if(_0x341db0['config']['get']('collaboration.channelId')===_0x598e4e){for(const _0x3408c5 of _0x341db0['model']['document']['getRoots']())if('$graveyard'!==_0x3408c5['rootName']&&_0x3408c5['rootName']===_0x160387)return{'editor':_0x341db0,'rootName':_0x3408c5['rootName']};}}}async['_createContextItemFromContent'](_0x170c52){return'mcp-tool-context'===_0x170c52['type']?{'id':_0x170c52['id'],'uiId':_0x170c52['id'],'label':_0x170c52['data']?.['label']||_0x170c52['id'],'type':'mcp-tool-context','mcpServerName':_0x170c52['mcpServerName'],'toolName':_0x170c52['toolName'],'data':_0x170c52['data']||{}}:{'id':_0x170c52['id'],'uiId':_0x170c52['id'],'label':_0x170c52['attributes']?.['label']||_0x170c52['name']||_0x170c52['url']||_0x170c52['id'],'type':_0x170c52['type'],..._0x170c52?.['attributes']?.['resourceId']?{'resourceId':_0x170c52['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x41fb3a){this['_pendingContextItems']['get'](_0x41fb3a)?.['isReadOnly']||this['_removeContextItem'](_0x41fb3a);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x5b0c24 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x5b0c24['uiId']);const _0x2d823a=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x2d823a&&this['_addContextItem']({..._0x2d823a,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x2db0a2){for(const _0x5b8e9e of _0x2db0a2['values']())this['_addToConversationContextItem'](_0x5b8e9e);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'](_0x380d3b){return Array['from'](_0x380d3b['values']())['flatMap'](_0x33dc4f=>this['_mapContextItemToRequestData'](_0x33dc4f));}async['addFilesToContext'](_0xc8b17a,_0x649a17,_0x4b971f='file'){const _0x2f1958='files-'+vt();this['_startUploadOperation'](_0x2f1958);try{await Promise['all'](_0xc8b17a['map'](async _0x1411aa=>{const _0x4ba289='file-'+vt(),_0x5b5db4=_0x2621bf(_0x1411aa['name']),_0x2c81fa='file'===_0x4b971f&&_0x1411aa['type']['startsWith']('image/')?'image':_0x4b971f;try{this['_addContextItem']({'type':_0x2c81fa,'label':_0x649a17?.['label']||_0x5b5db4,'uiId':_0x4ba289,'resourceId':_0x649a17?.['resourceId']},!0x0);const _0x5341c7=this['_connector']['uploadFile'](this['_ownerId'],_0x1411aa,_0x649a17);this['_ongoingUploads']['set'](_0x4ba289,_0x5341c7['abortController']);const {id:_0x49168d}=await _0x5341c7['getId']();this['_ongoingUploads']['delete'](_0x4ba289),this['_finishContextItemLoading']({'type':_0x2c81fa,'id':_0x49168d,'label':_0x649a17?.['label']||_0x5b5db4,'uiId':_0x4ba289,'resourceId':_0x649a17?.['resourceId']},!0x1);}catch(_0x532f4b){if(this['_ongoingUploads']['delete'](_0x4ba289),!en(_0x532f4b)){const _0x10f4d9=new sn({'code':In['get'](_0x532f4b['code'])||'ai-chat-file-upload-failed','cause':_0x532f4b,'context':{'fileName':_0x5b5db4}});this['fire']('error',{'error':_0x10f4d9});}this['_removeContextItem'](_0x4ba289);}}));}finally{this['_finishUploadOperation'](_0x2f1958);}}['addCurrentDocumentToContext'](_0x4fa87b){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x5036af={'type':'document','uiId':'current-document','label':_0x4fa87b,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x5036af);}async['updateCurrentDocuments'](_0x359141){const _0x5b2af2=this['_pendingContextItems']['get']('current-document');if(!_0x5b2af2||!_0x359141['length']||_0x359141['every'](_0x2b48f2=>!_0x2b48f2['content']))return;_0x359141['length']>0x1&&_0x359141['some'](_0xcfc88a=>!_0xcfc88a['description'])&&bt('ai-chat-documents-missing-description');try{const _0x1c6b95=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x359141)['getIds']();if(_0x1c6b95['length']!==_0x359141['length']||_0x1c6b95['some'](_0x38bee7=>!_0x38bee7?.['id'])){const _0x1a1a27=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x1a1a27});}_0x5b2af2['documents']=_0x359141['map']((_0x2ac13d,_0x2cbe0d)=>{return{'id':_0x1c6b95[_0x2cbe0d]['id'],'content':_0x2ac13d['content'],'version':_0x2ac13d['version'],'sessionId':_0x2ac13d['sessionId'],'selection':(_0x8ccf50=_0x2ac13d['selections'],_0x8ccf50?_0x8ccf50['map'](_0x14fdb5=>({'start':_0x14fdb5['start'],'end':_0x14fdb5['end']})):[]),'channelId':_0x2ac13d['channelId'],'rootName':_0x2ac13d['rootName']};var _0x8ccf50;});}catch(_0x49445c){const _0x1c7eb7=new sn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x49445c});this['fire']('error',{'error':_0x1c7eb7});}}['addSelectionToContext'](_0x4a1d82){this['_addContextItem']({'type':'selection','label':_0x4a1d82,'uiId':'selection','content':_0x4a1d82});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x370fe3,_0x20ce91){const _0x22b7db='url-'+vt();this['_startUploadOperation'](_0x22b7db);const _0x1e57a6='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x20ce91?.['label']||_0x370fe3,'uiId':_0x1e57a6,'resourceId':_0x20ce91?.['resourceId']},!0x0);const _0x213b0b=this['_connector']['uploadUrl'](this['_ownerId'],_0x370fe3,_0x20ce91);this['_ongoingUploads']['set'](_0x1e57a6,_0x213b0b['abortController']);const {id:_0x43c18e}=await _0x213b0b['getId']();this['_ongoingUploads']['delete'](_0x1e57a6),this['_finishContextItemLoading']({'type':'web-resource','id':_0x43c18e,'label':_0x20ce91?.['label']||_0x370fe3,'uiId':_0x1e57a6,'resourceId':_0x20ce91?.['resourceId']},!0x1);}catch(_0x4a3e15){this['_ongoingUploads']['delete'](_0x1e57a6),en(_0x4a3e15)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x370fe3,'originalError':_0x4a3e15}),'url':_0x370fe3}),this['_removeContextItem'](_0x1e57a6);}finally{this['_finishUploadOperation'](_0x22b7db);}}['addToolItemToContext'](_0x52d1fa){_0x52d1fa['id']=_0x52d1fa['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x52d1fa['uiId'],_0x52d1fa),this['fire']('contextItemAdded',{'contextItem':_0x52d1fa,'isLoading':!0x1});}async['loadSourceResources'](_0x3f3db0,_0x61a103,_0x51ae09){const _0x8c5b06=this['_addContextOptionsState']['sources']['find'](_0xb18e1a=>_0xb18e1a['id']===_0x3f3db0);if(!_0x8c5b06)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x3f3db0}),'sourceId':_0x3f3db0}),[];try{const _0x125d4d=(await _0x8c5b06['getResources'](_0x61a103))['map'](_0x22a7d5=>{const _0x3f1bf1=this['_isResourceInContext'](_0x22a7d5['id']);return{..._0x22a7d5,'isInContext':_0x3f1bf1};});return _0x8c5b06['resources']=_0x125d4d,this['fire']('sourceResourcesLoaded',{'sourceId':_0x3f3db0,'source':_0x8c5b06,'resources':_0x125d4d,'uid':_0x51ae09}),_0x125d4d;}catch(_0x1d4e12){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x3f3db0,'originalError':_0x1d4e12}),'sourceId':_0x3f3db0,'sourceLabel':_0x8c5b06['label']}),[];}}async['addResourceToContext'](_0x4fefc3,_0x4c2004){if(this['_isResourceInContext'](_0x4c2004['id']))return;let _0x3e7482=_0x4c2004['data'];if(!_0x3e7482&&_0x4fefc3['getData'])try{_0x3e7482=await _0x4fefc3['getData'](_0x4c2004['id']);}catch(_0x19fe7b){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id'],'originalError':_0x19fe7b}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});}if(_0x3e7482)switch(_0x4c2004['type']){case'web-resource':if('string'!=typeof _0x3e7482)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id'],'expectedType':'string','actualType':typeof _0x3e7482}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});await this['addUrlToContext'](_0x3e7482,{'label':_0x4c2004['label'],'resourceId':_0x4c2004['id']});break;case'file':if(!(_0x3e7482 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id'],'expectedType':'File','actualType':typeof _0x3e7482}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});await this['addFilesToContext']([_0x3e7482],{'label':_0x4c2004['label'],'resourceId':_0x4c2004['id']});break;case'text':if('object'!=typeof _0x3e7482||!('content'in _0x3e7482)||!('type'in _0x3e7482))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x3e7482}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});_0x3e7482=AIChatContext['_convertTextResourceToFile'](_0x3e7482,_0x4c2004['label']),await this['addFilesToContext']([_0x3e7482],{'label':_0x4c2004['label'],'resourceId':_0x4c2004['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id'],'resourceType':_0x4c2004['type']}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']}),'resourceId':_0x4c2004['id'],'sourceId':_0x4fefc3['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x525b79){if(void 0x0!==_0x525b79)this['_addContextOptionsState']['document']['isHidden']=!_0x525b79;else{const _0x37fc20=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x37fc20;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x3a5a9e,_0x5c918e){switch(_0x3a5a9e['type']){case'markdown':return new File([_0x3a5a9e['content']],_0x5c918e,{'type':'text/markdown'});case'html':return new File([_0x3a5a9e['content']],_0x5c918e,{'type':'text/html'});default:return new File([_0x3a5a9e['content']],_0x5c918e,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0xda9b4d){switch(_0xda9b4d['type']){case'file':case'image':case'text':return[{'type':'file','id':_0xda9b4d['id']}];case'web-resource':return[{'type':'web-resource','id':_0xda9b4d['id']}];case'document':return _0xda9b4d['documents']?.['length']?_0xda9b4d['documents']['map'](_0x179ad7=>({'type':'document','id':_0x179ad7['id'],..._0x179ad7['selection']?.['length']&&{'selection':_0x179ad7['selection']}})):[];case'mcp-tool-context':{const _0x4897fb=_0xda9b4d;return[{'type':'mcp-tool-context','mcpServerName':_0x4897fb['mcpServerName'],'toolName':_0x4897fb['toolName'],'data':{..._0x4897fb['data'],'label':_0x4897fb['label']||_0x4897fb['data']?.['label']||_0x4897fb['id']},'id':_0x4897fb['id']}];}default:return[];}}['_addContextItem'](_0x2c3740,_0x23daf7=!0x1){if(this['_pendingContextItems']['set'](_0x2c3740['uiId'],_0x2c3740),_0x2c3740['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x2c3740,'isLoading':_0x23daf7}),'current-document'===_0x2c3740['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x2c3740['resourceId']){const _0x1f60ab=this['_findSourceIdsByResourceId'](_0x2c3740['resourceId']);_0x1f60ab&&_0x1f60ab['forEach'](_0x5a261d=>{this['_updateResourceInContextState'](_0x5a261d,_0x2c3740['resourceId'],!0x0);});}}['_removeContextItem'](_0x58563e){const _0x528830=this['_pendingContextItems']['get'](_0x58563e),_0x3b3f0e=this['_ongoingUploads']['get'](_0x58563e);if(_0x3b3f0e&&(_0x3b3f0e['abort'](),this['_ongoingUploads']['delete'](_0x58563e)),_0x528830?.['resourceId']){const _0x5e5f3f=this['_findSourceIdsByResourceId'](_0x528830['resourceId']);_0x5e5f3f&&_0x5e5f3f['forEach'](_0x5cabf3=>{this['_updateResourceInContextState'](_0x5cabf3,_0x528830['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x58563e),this['fire']('contextItemRemoved',{'uiId':_0x58563e,'type':_0x528830?.['type']}),'current-document'===_0x58563e&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x251c27,_0x56c6e8){if(this['_pendingContextItems']['has'](_0x251c27['uiId'])&&(this['_pendingContextItems']['set'](_0x251c27['uiId'],_0x251c27),this['fire']('contextItemLoadingEnded',{'contextItem':_0x251c27,'isLoading':_0x56c6e8}),_0x251c27['resourceId'])){const _0x4e0dd1=this['_findSourceIdsByResourceId'](_0x251c27['resourceId']);_0x4e0dd1&&_0x4e0dd1['forEach'](_0x31a5bf=>{this['_updateResourceInContextState'](_0x31a5bf,_0x251c27['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x405f52){this['_conversationContextItems']['set'](_0x405f52['uiId'],_0x405f52);}['_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'](_0x283e22=>({..._0x283e22,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x5724e1=>({..._0x5724e1,'resources':[]}))??[];}['_isResourceInContext'](_0x3345d3){for(const _0x51d9f2 of this['_pendingContextItems']['values']())if(_0x51d9f2['resourceId']===_0x3345d3)return!0x0;for(const _0x22ada0 of this['_conversationContextItems']['values']())if(_0x22ada0['resourceId']===_0x3345d3)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0xb2560b){const _0x302f9b=[];for(const _0x365c31 of this['_addContextOptionsState']['sources'])_0x365c31['resources']['find'](_0x5d63c6=>_0x5d63c6['id']===_0xb2560b)&&_0x302f9b['push'](_0x365c31['id']);return 0x0===_0x302f9b['length']?null:_0x302f9b;}['_updateResourceInContextState'](_0x2b2187,_0x5d992a,_0x25a85e){const _0x3e3e3f=this['_addContextOptionsState']['sources']['find'](_0x35d684=>_0x35d684['id']===_0x2b2187);if(!_0x3e3e3f)return;const _0x539f19=_0x3e3e3f['resources']['find'](_0x591f6c=>_0x591f6c['id']===_0x5d992a);_0x539f19&&(_0x539f19['isInContext']=_0x25a85e,this['fire']('resourceStateChanged',{'sourceId':_0x2b2187,'resourceId':_0x5d992a,'isInContext':_0x25a85e}));}['_startUploadOperation'](_0x12b266){this['_ongoingUploadOperations']['set'](_0x12b266,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x1cbc52){this['_ongoingUploadOperations']['delete'](_0x1cbc52),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Tn=/* #__PURE__ -- @preserve */
31
- ut(),wn=['capabilitiesUpdated'];var Cn=class extends Tn{['_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'](_0x2392ed){const _0x225a7a={};return _0x2392ed&&_0x2392ed['isWebSearchEnabled']&&(_0x225a7a['webSearch']={}),_0x2392ed&&_0x2392ed['isReasoningEnabled']&&(_0x225a7a['reasoning']={}),_0x225a7a;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x2ecaf3){_0x2ecaf3!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x2ecaf3,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x1b1c64){_0x1b1c64!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x1b1c64,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},fn=class extends An{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x2f1459){super(_0x2f1459),this['conversationId']=_0x2f1459['conversationId'],this['contextItems']=_0x2f1459['contextItems'],this['capabilities']=_0x2f1459['capabilities'],this['userMessage']=_0x2f1459['userMessage'],this['model']=_0x2f1459['model'],this['attributes']=_0x2f1459['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':En['mapContextItemsToRequestData'](this['contextItems']),'capabilities':Cn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const bn=/* #__PURE__ -- @preserve */
32
- ut();var Sn=class extends bn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x9bd7e7){super(),this['options']=_0x9bd7e7,this['connector']=_0x9bd7e7['connector'],this['chatModels']=_0x9bd7e7['chatModels'],this['id']=_0x9bd7e7['conversationId'],this['isFromHistory']=_0x9bd7e7['isFromHistory'],this['_channelsToEditors']=_0x9bd7e7['channelsToEditors'],this['_getSessionId']=_0x9bd7e7['getSessionId'];}async['init'](_0x19c3b0){try{this['chatContext']=new En({'connector':this['connector'],'config':_0x19c3b0,'ownerId':this['id']}),this['chatContext']['delegate'](...mn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new Cn(),this['chatCapabilities']['delegate'](...wn)['to'](this),this['chatCapabilities']['init']();const _0x3be4bf=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x3be4bf});const _0xc904d7=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0xc904d7&&await this['setModel'](_0xc904d7);}catch(_0x329162){const _0x48004b=new sn({'code':'ai-chat-conversation-init-failed','cause':_0x329162,'type':'network'});this['fire']('error',{'error':_0x48004b});}}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:_0xc9d6a6}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0xc9d6a6,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x3a3acc){const _0x30975b=new sn({'code':'ai-chat-conversation-start-failed','cause':_0x3a3acc,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x30975b}),_0x30975b;}}async['load'](_0x58cb35){try{const _0x837685=await this['connector']['fetchConversation'](_0x58cb35)['getConversation'](),_0x1bc77b=await this['connector']['fetchConversationMessages'](_0x58cb35)['getMessages'](),_0x5018d7=_0x1bc77b[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x837685['id'],'title'in _0x837685?this['fire']('setConversationTitle',_0x837685['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x31cb0a=(await this['chatModels']['getAll']())['find'](_0x1addd2=>_0x1addd2['id']['toLowerCase']()===_0x5018d7['toLowerCase']());this['selectedModel']=_0x31cb0a,this['fire']('modelSelected',{'selectedModel':_0x31cb0a,'isDisabled':!0x0});const {streamingMessageId:_0x4c31c1}=await this['_processMessagesToInteractions'](_0x1bc77b,_0x5018d7);return _0x4c31c1&&this['currentInteraction']?this['_resumeStream'](_0x4c31c1):this['currentInteraction']=void 0x0,this;}catch(_0x18ffbf){const _0x328e50=new sn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x18ffbf,'type':'network','context':{'conversationId':_0x58cb35}});throw this['fire']('error',{'error':_0x328e50}),_0x328e50;}}async['_processMessagesToInteractions'](_0x579b26,_0x599202){let _0x50e4d1,_0x24fb34,_0x1b64ca=!0x1;for(const _0x318382 of _0x579b26)if('user'===_0x318382['role']){const {contextItems:_0x469276,hasUnmatched:_0x2143ec}=await this['_extractContextItems'](_0x318382);_0x1b64ca=_0x2143ec;const _0x41d4ac={'isReasoningEnabled':Object['hasOwn'](_0x318382['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x318382['capabilities'],'webSearch')};_0x50e4d1=this['createInteraction']({'userMessage':_0x318382['prompt'],'contextItems':_0x469276,'capabilities':_0x41d4ac,'modelId':_0x599202,'attributes':_0x318382['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x50e4d1,_0x24fb34=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x318382['role']&&_0x50e4d1){if('streaming'===_0x318382['status']){_0x24fb34=_0x318382['id'];continue;}if('error'===_0x318382['status'])continue;const _0x24e723=[];for(const _0x29d6f7 of _0x318382['content'])switch(_0x29d6f7['type']){case'text':case'modification':{const _0x134609=_0x50e4d1['getDocumentContext'](),_0x402508=this['_hasSessionMismatch'](_0x134609)||_0x1b64ca;_0x50e4d1['currentReply']?.['type']!==_0x29d6f7['type']&&(_0x50e4d1['currentReply']=_0x50e4d1['createReply']({'type':_0x29d6f7['type'],'isDone':!0x0,'interactionId':_0x50e4d1['id'],'areActionsDisabled':_0x402508,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x24e723['length']>0x0&&(_0x50e4d1['currentReply']['sources']=_0x24e723['splice'](0x0))),_0x50e4d1['currentReply']['appendContent'](_0x29d6f7['content'],_0x29d6f7['documentId']);break;}case'url':_0x24e723['push'](_0x29d6f7);break;case'mcp-tool-result':{const {data:_0xb0f6da,attributes:_0x2471ea}=JSON['parse'](_0x29d6f7['content']);_0x50e4d1['_handleToolResultData']({'toolName':_0x29d6f7['toolName'],'data':_0xb0f6da,'attributes':_0x2471ea});break;}}'cancelled'===_0x318382['status']&&this['fire']('error',{'interactionId':_0x50e4d1['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x24fb34};}async['_resumeStream'](_0x47174a){if(this['currentInteraction'])try{const _0x3fa44b=this['connector']['resumeStream'](this['id'],_0x47174a);await this['currentInteraction']['resume'](_0x3fa44b);}catch(_0x5d2044){_0x5d2044 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x5d2044});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x14e692){return _0x14e692['content']?this['chatContext']['populateFromMessage'](_0x14e692['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x6a919a,attributes:_0x24d899}){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 _0xce81be=new Map(this['getPendingContextItems']()),_0x460d63=this['chatCapabilities']['getCapabilitiesConfig'](),_0x42886c=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x6a919a,'contextItems':_0xce81be,'capabilities':_0x460d63,'modelId':_0x42886c,'attributes':_0x24d899,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x31e2ad){if(_0x31e2ad instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x31e2ad});else{const _0x144ef7=In['get'](_0x31e2ad['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x144ef7,null,{'error':_0x31e2ad})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x44de96,contextItems:_0x47840e,capabilities:_0x1f4e34,modelId:_0x5065f9,attributes:_0x411fa6,channelsToEditors:_0x4623b3}){const _0x27daf1=new fn({'userMessage':_0x44de96,'contextItems':_0x47840e,'capabilities':_0x1f4e34,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x5065f9,'attributes':_0x411fa6,'channelsToEditors':_0x4623b3});return _0x27daf1['delegate'](...gn)['to'](this),this['interactions']['push'](_0x27daf1),this['fire']('interactionCreated',_0x27daf1),_0x27daf1;}['getInteraction'](_0x5db161){return this['interactions']['find'](_0x130011=>_0x130011['id']===_0x5db161);}['removeInteraction'](_0x1e515d){const _0xf397c9=this['getInteraction'](_0x1e515d);_0xf397c9&&(_0xf397c9['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0xf397c9),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x3380d5=this['lastInteraction'];_0x3380d5?.['conversationId']&&_0x3380d5['messageId']&&this['connector']['cancelStream'](_0x3380d5['conversationId'],_0x3380d5['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0xed469){this['chatContext']['addCurrentDocumentToContext'](_0xed469);}async['updateCurrentDocumentsInContext'](_0x28edc4){await this['chatContext']['updateCurrentDocuments'](_0x28edc4);}['toggleAddCurrentDocumentOptionVisibility'](_0x166155){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x166155);}['_hasSessionMismatch'](_0x256c8e){return!!_0x256c8e&&_0x256c8e['documents']['some'](_0xeb22b0=>{const _0xf9b9bf=this['_channelsToEditors']['get'](_0xeb22b0['channelId']);return!_0xf9b9bf||_0xeb22b0['sessionId']!==this['_getSessionId'](_0xf9b9bf);});}['addSelectionToContext'](_0x5b4f8a){this['chatContext']['addSelectionToContext'](_0x5b4f8a);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x32dcbc){this['chatContext']['addFilesToContext'](_0x32dcbc);}['addUrlToContext'](_0x25dcff){this['chatContext']['addUrlToContext'](_0x25dcff);}['addToolItemToContext'](_0x36b9bd){this['chatContext']['addToolItemToContext'](_0x36b9bd);}['addResourceToContext'](_0x2b2820,_0x51e31c){this['chatContext']['addResourceToContext'](_0x2b2820,_0x51e31c);}['loadSourceResources'](_0x3e958,_0x43a20d,_0x54c58d){return this['chatContext']['loadSourceResources'](_0x3e958,_0x43a20d,_0x54c58d);}['removeFromContext'](_0x1b4061){this['chatContext']['removeFromContext'](_0x1b4061);}['setWebSearch'](_0x308b30){this['chatCapabilities']['setWebSearch'](_0x308b30);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x512690){this['chatCapabilities']['setReasoning'](_0x512690);}['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'](_0x1f66e6){_0x1f66e6?!0x1===await this['chatModels']['isAvailable'](_0x1f66e6)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x1f66e6}),_0x1f66e6=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x1f66e6=(await this['chatModels']['getAvailableModels']())[0x0]),_0x1f66e6['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x1f66e6,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x1f66e6}));}};function Rn({documentSuggestions:_0x45b0b1,transform:_0x2f21ef,documentCompare:_0x47ea84,documentCompareOptions:_0x9663e}){const _0x3fae33=new Map();for(const [_0x597509,{groups:_0x331206,documentContext:_0xd615d5,documentContent:_0x18268,editor:_0x103085}]of _0x45b0b1){const _0x135244=_0xd615d5['content'],_0x1be657=_0xd615d5['version'],_0x3628f6=_0x18268['cloneNode'](!0x0);for(const {changes:_0x14b667}of _0x331206){const _0x35e1df=_0x14b667['filter'](_0x58e5d5=>'new'!=_0x58e5d5['type'])['map'](_0x3a03db=>Es('data-id',_0x3a03db['id'],_0x3628f6))['filter'](_0x12137d=>null!==_0x12137d),_0x3530eb=_0x14b667['filter'](_0x81379=>'removed'!=_0x81379['type'])['map'](_0x4384e1=>_0x4384e1['node']['cloneNode'](!0x0));let _0x44ff39=null;if(_0x35e1df['length']){_0x44ff39=_0x35e1df[0x0]['previousSibling'];for(let _0x1f5949=0x0;_0x1f5949<_0x35e1df['length'];_0x1f5949++)_0x183ce6(_0x35e1df[_0x1f5949]);}if(_0x3530eb['length']){_0x44ff39||(_0x14b667[0x0]['anchorId']?_0x44ff39=Es('data-id',_0x14b667[0x0]['anchorId'],_0x3628f6):(_0x44ff39=_0x3530eb['shift'](),_0x228582(_0x3628f6,_0x44ff39)));for(let _0x3c9bdc=0x0;_0x3c9bdc<_0x3530eb['length'];_0x3c9bdc++)_0x34f2bc(_0x44ff39,_0x3530eb[_0x3c9bdc]),_0x44ff39=_0x3530eb[_0x3c9bdc];}}const _0x2ca203=ms(_0x3628f6),_0x3bb8eb=_0x47ea84['getDiff'](_0x135244,_0x2ca203,{'targetEditor':_0x103085,'anchor':_0xd615d5['rootName'],..._0x9663e})['getOperations']();if(_0x2f21ef){const _0x531d03=_0x103085['model']['document']['history']['getOperations'](_0x1be657),_0x3dac98={'document':_0x103085['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x3fae33['set'](_0x597509,_0x4a80ce(_0x3bb8eb,_0x531d03,_0x3dac98)['operationsA']);}else _0x3fae33['set'](_0x597509,_0x3bb8eb);}return _0x3fae33;}function On({groups:_0x551d74,documentContextContent:_0x44a30b,documents:_0x19ef78}){const _0x34ce0c=new Map();for(const _0x2af63b of _0x551d74){const {documentId:_0x6a329f}=_0x2af63b,_0x1fbcbb=_0x34ce0c['get'](_0x6a329f);if(_0x1fbcbb)_0x1fbcbb['groups']['push'](_0x2af63b),_0x1fbcbb['indexes']['push'](_0x2af63b['index']);else{const _0x3161a3=_0x19ef78['find'](_0x380035=>_0x380035['id']===_0x6a329f),_0x5949ee=_0x44a30b['get'](_0x6a329f);if(!_0x3161a3||!_0x5949ee)continue;_0x34ce0c['set'](_0x6a329f,{'groups':[_0x2af63b],'documentContext':_0x3161a3,'documentContent':_0x5949ee,'editor':_0x2af63b['editor'],'indexes':[_0x2af63b['index']]});}}return _0x34ce0c;}function vn(_0x482910,_0x499cfa){const _0x526934=_0x482910['files']['length']>0x0&&_0x482910['files']['every'](_0x1a2b13=>_0x1a2b13['type']['startsWith']('image/')),_0x37ffda=_0x482910['plainText']['trim']()['length']>0x0;if(_0x482910['files']['length']>0x0&&_0x499cfa['filesEnabled']&&(!_0x526934||!_0x37ffda)){const _0x22ba98=_0x482910['files']['filter'](_0x360833=>_0x360833['name']);return _0x22ba98['length']>0x0?{'type':'file','files':_0x22ba98}:null;}if(_0x499cfa['urlsEnabled']){const _0x430580=function(_0x4c940d){const _0x17ed37=_0x4c940d['trim']();if(/\s/['test'](_0x17ed37))return null;try{const _0xd53f7f=new URL(_0x17ed37);return'http:'!==_0xd53f7f['protocol']&&'https:'!==_0xd53f7f['protocol']?null:_0xd53f7f['toString']();}catch{return null;}}(_0x482910['plainText']);if(_0x430580)return{'type':'url','url':_0x430580};}const _0x5abce9=_0x482910['forceTextAttachment']?0x1:_0x499cfa['longTextThreshold']??0x1/0x0;if(_0x482910['plainText']['length']>=Math['max'](_0x5abce9,0x1)&&_0x499cfa['filesEnabled']){const _0x36b631=_0x499cfa['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x482910['plainText']],_0x36b631,{'type':'text/plain'})]};}return null;}var kn=class extends _0x5bb7a3{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,nn,_0x5bc848];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=ln(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichat'),this['_aiChatModels']=new Qs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x14c8b6=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x38ca87,_0x427e33)=>{this['_handleUIUserMessage']({'message':_0x427e33});}),this['listenTo'](_0x14c8b6['view'],'change:activeTab',(_0x3fa0cf,_0x1180cc,_0x21b675)=>{'chat'!==_0x21b675&&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',(_0x1db21d,_0x2af3df)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x2af3df));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x5c3caa,_0x2388d8)=>{this['activeConversation']?.['addUrlToContext'](_0x2388d8);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0xf60377,_0x1827a9)=>{const _0x1a7e23=this['activeConversation'];if(!_0x1a7e23)return;_0x1827a9['hasDirectory']&&(_0x1827a9['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x41a5a8=vn(_0x1827a9,{'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')});_0x41a5a8&&(_0x1827a9['preventDefault'](),'url'===_0x41a5a8['type']?_0x1a7e23['addUrlToContext'](_0x41a5a8['url']):_0x1a7e23['chatContext']['addFilesToContext'](_0x41a5a8['files'],void 0x0,_0x41a5a8['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x2d1b70,_0x83ace0)=>{_0x83ace0['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x43df47,_0x3c7436)=>{this['activeConversation']?.['addResourceToContext'](_0x3c7436['source'],_0x3c7436['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x5b8d77,_0x5dd05a)=>{this['_removeFromContext'](_0x5dd05a);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x346878,_0x53c6ca)=>{this['activeConversation']?.['loadSourceResources'](_0x53c6ca['sourceId'],_0x53c6ca['query'],_0x53c6ca['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x464d61,_0x2ad03a)=>{this['activeConversation']?.['setModel'](_0x2ad03a);}),this['listenTo'](this['_aiChatUi'],'like',(_0x4fefcb,{replyId:_0x38fc4f})=>{console['log']('Liked\x20response',_0x38fc4f);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0xe4b012,{replyId:_0x2bf6d7})=>{console['log']('Disliked\x20response',_0x2bf6d7);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x2c6783,_0x48928b)=>{this['_insertSuggestion'](_0x48928b);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3304be,{replyId:_0x480fe6,partIndex:_0x2d3bdd})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x480fe6,_0x2d3bdd);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x3d4c4c,{replyId:_0x25c2cf,partIndex:_0x268aae})=>{const _0x18e781=this['_getDocumentRangeForReplyChanges'](_0x25c2cf,_0x268aae);if(!_0x18e781)return;const {reply:_0x3f1384}=this['getInteractionAndReplyById'](_0x25c2cf);'$graveyard'!=_0x18e781['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x3f1384['changeGroups'][_0x268aae]['editor'],'ranges':[_0x18e781['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x3a0ac5,_0x50631a)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x50631a);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x1295b3,{replyId:_0x3e53c4,showDiff:_0x87f428})=>{const {interaction:_0xac4199,reply:_0x5c5e4d}=this['getInteractionAndReplyById'](_0x3e53c4),_0x511c18=_0x5c5e4d['getContentParts']({'showDiff':_0x87f428});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xac4199['id']+':'+_0x5c5e4d['id'],'parts':_0x511c18});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x48d723,{replyId:_0x15184a,partIndex:_0x590c36})=>{this['_rejectSuggestion']({'replyId':_0x15184a,'partIndex':_0x590c36}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x990ed2,_0x3cb9a0)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x3cb9a0);}),this['on']('replyCreated',(_0x349780,_0x5c80bb)=>{this['_addFeedItemReply'](_0x5c80bb);});}['afterInit'](){this['context']instanceof _0x4fb071?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x12bed3,_0x54d04b)=>{_0x54d04b['on']('ready',()=>{this['_integrateEditor'](_0x54d04b);});}),this['_initConversation']();}async['_initConversation'](){const _0x4c82d7=this['context']['config']['get']('ai.chat.initialConversation');let _0x4592fb=_0x4c82d7;('lastCreated'!=_0x4c82d7||(_0x4592fb=await this['_getLastCreatedConversationId'](),_0x4592fb))&&('new'==_0x4592fb?await this['_startConversationSafely']():await this['loadConversation'](_0x4592fb));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x306b02){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'](_0x306b02)['getConversation'](),await this['_startConversationSafely']({'id':_0x306b02}),await this['activeConversation']['load'](_0x306b02),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x329862){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x306b02}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x329862),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x2ad91a){let _0x401933=null,_0x620c26=null;this['on']('toolDataReceived',(_0x249ce6,_0x1f79d7,_0x38efbf)=>{_0x38efbf['id']!==_0x401933&&(_0x401933=_0x38efbf['id'],_0x620c26=this['_getAIChatFeedAPI'](_0x38efbf)),_0x2ad91a(_0x1f79d7,_0x620c26);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x3b4b2c){const _0x4f84b5=this['_aiEditing']['getSelectionText'](_0x3b4b2c);this['activeConversation']?.['addSelectionToContext'](_0x4f84b5),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x2b5855){await this['_startConversationSafely']({'modelId':_0x2b5855?.['modelId']});}async['sendMessage'](_0xc930d2){await this['_handleUIUserMessage'](_0xc930d2);}['getGroupId'](){const _0x278d23=this['context']['config']['get']('collaboration.channelId');if(!_0x278d23)throw new ht('ai-missing-channel-id',this);return _0x278d23;}['_handleRemovedConversation'](_0x1aa367){this['activeConversation']['id']===_0x1aa367&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x490755){const {reply:_0x141807,interaction:_0x12b9cd}=this['getInteractionAndReplyById'](_0x490755['replyId']),_0x13b591=void 0x0!==_0x490755['partIndex']?[_0x141807['changeGroups'][_0x490755['partIndex']]]:_0x141807['changeGroups']['filter'](_0x5c2455=>'pending'==_0x5c2455['state']);return _0x13b591['map'](_0x59de45=>_0x141807['changeGroups']['indexOf'](_0x59de45))['forEach'](_0x3138b8=>{const _0x3bdd45=this['_getDocumentRangeForReplyChanges'](_0x490755['replyId'],_0x3138b8);_0x3bdd45&&'$graveyard'!=_0x3bdd45['range']['root']['rootName']?(_0x141807['setChangeGroupState'](_0x3138b8,'accepted'),void 0x0!==_0x490755['partIndex']&&this['_scrollToSuggestionRange'](_0x3bdd45['range'],!0x1,_0x3bdd45['targetEditor'])):_0x141807['setChangeGroupState'](_0x3138b8,'outdated');}),On({'groups':_0x13b591['filter'](_0x5003ae=>'accepted'===_0x5003ae['state']),'documentContextContent':_0x141807['documentContextContent'],'documents':_0x12b9cd['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x2eb7c2){const _0x3f0fd9=this['context']['plugins']['get'](_0x5bc848),{reply:_0x365969,interaction:_0x5134a4}=this['getInteractionAndReplyById'](_0x2eb7c2['replyId']),_0xec58e9=this['_prepareDocumentSuggestions'](_0x2eb7c2),_0x4ceed4=Rn({'documentSuggestions':_0xec58e9,'transform':!0x0,'documentCompare':_0x3f0fd9,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x3d2ae1,_0x563c63]of _0x4ceed4){const {editor:_0xebc89c,indexes:_0x17852d}=_0xec58e9['get'](_0x3d2ae1);if(!_0xebc89c['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0xebc89c});continue;}let _0x180d82;zs(_0x563c63,'chat'),_0xebc89c['model']['change'](_0x1a3223=>{_0x180d82=_0x1a3223['batch'],_0xebc89c['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x563c63),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x180d82,{'interactionId':_0x5134a4['id'],'replyId':_0x365969['id'],'indexes':_0x17852d});}this['_updateRatings'](_0x365969);}['_applySuggestion'](_0x39142b){const _0x3dfc2f=this['context']['plugins']['get'](_0x5bc848),{reply:_0x1746e6,interaction:_0x466c19}=this['getInteractionAndReplyById'](_0x39142b['replyId']),_0x37918b=this['_prepareDocumentSuggestions'](_0x39142b),_0x523e1b=Rn({'documentSuggestions':_0x37918b,'transform':!0x0,'documentCompare':_0x3dfc2f,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x22a07e,_0x3db3be]of _0x523e1b){const {editor:_0x301e9f,indexes:_0x4c5fb6}=_0x37918b['get'](_0x22a07e);let _0x555a2d;zs(_0x3db3be,'chat');try{_0x301e9f['model']['change'](_0x1d2f3f=>{_0x555a2d=_0x1d2f3f['batch'],_0x3dfc2f['applyOperations'](_0x1d2f3f,_0x3db3be);}),this['_batchToChanges']['set'](_0x555a2d,{'interactionId':_0x466c19['id'],'replyId':_0x1746e6['id'],'indexes':_0x4c5fb6});}catch(_0x27f67a){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x27f67a})),_0x27f67a;}}this['_updateRatings'](_0x1746e6);}['_rejectSuggestion'](_0x4d9c14){const {reply:_0x42d090}=this['getInteractionAndReplyById'](_0x4d9c14['replyId']);_0x42d090['setChangeGroupState'](_0x4d9c14['partIndex'],'rejected');}['_openBalloonFor'](_0xf248a6,_0xd204d7){if(!this['_hasAIChatBalloon'])return;const {reply:_0x47c6df}=this['getInteractionAndReplyById'](_0xf248a6),_0x4925f8=_0x47c6df['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x4925f8['length'])return;let _0x4bc778,_0x1afaaf;if(void 0x0!==_0xd204d7?(_0x1afaaf=_0x4925f8['find'](_0x2b99b6=>_0x2b99b6['index']==_0xd204d7),_0x4bc778=_0x1afaaf?.['index']):(_0x1afaaf=_0x4925f8[0x0],_0x4bc778=_0x1afaaf['index']),!_0x1afaaf)return void _0x47c6df['setChangeGroupState'](_0xd204d7??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0xf248a6&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4bc778)return;const _0x570213=this['_getUserPresentableContentPartDocumentRange'](_0xf248a6,_0x47c6df,_0x1afaaf),_0x1c7b23=_0x47c6df['changeGroups']['find'](_0x266159=>_0x266159['index']==_0x4bc778)['editor'],_0x366976=_0x1c7b23['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x366976&&this['_activeBalloon']['close'](),!_0x570213)return _0x366976['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x366976,this['_currentPreviewedChangeGroup']={'replyId':_0xf248a6,'partIndex':_0x4bc778},this['_scrollToSuggestionRange'](_0x570213,!0x0,_0x1c7b23);const _0x445920=this['_getPresentableSiblingContentPartIndex'](_0xf248a6,_0x4bc778,'next');_0x366976['clearContent'](),_0x366976['updateContent']({'part':_0x1afaaf,'renderingStrategy':'static'}),_0x366976['open']({'index':_0x4bc778,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x4bc778+0x1)['toString']()),'showRotator':null!==_0x445920,'ranges':[_0x570213],'areActionsDisabled':_0x47c6df['areActionsDisabled'],'targetEditor':_0x1c7b23}),_0x366976['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0xf248a6,_0x4bc778),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0xf248a6,'index':_0x4bc778,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x44dbb9,_0x262808,_0x3a77ab){const {reply:_0x4f761b}=this['getInteractionAndReplyById'](_0x44dbb9),_0x100fbe=_0x4f761b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x100fbe['length'])return null;const _0x3f9022='next'==_0x3a77ab?0x1:-0x1;function _0x1f2836(_0x490db9){const _0x563d13=(_0x490db9+_0x3f9022+_0x100fbe['length'])%_0x100fbe['length'];return{'siblingIndex':_0x563d13,'siblingPart':_0x100fbe[_0x563d13]};}const _0x5e368c=_0x100fbe['findIndex'](_0x28c386=>_0x28c386['index']==_0x262808);let {siblingIndex:_0x216c7e,siblingPart:_0x1365cd}=_0x1f2836(_0x5e368c);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x44dbb9,_0x4f761b,_0x1365cd);)if({siblingIndex:_0x216c7e,siblingPart:_0x1365cd}=_0x1f2836(_0x216c7e),_0x216c7e===_0x5e368c)return null;return _0x1365cd['index'];}['_getUserPresentableContentPartDocumentRange'](_0x293eba,_0x4aae5a,_0x3447c9){const _0x4fed33=_0x4aae5a['changeGroups'];if(!_0x3447c9['hasChanges'])return null;const _0x2f754a=_0x4fed33['find'](_0xc0f23c=>_0xc0f23c['index']==_0x3447c9['index']);if('pending'!==_0x2f754a?.['state'])return null;if(!_0x2f754a?.['editor']||'destroyed'===_0x2f754a['editor']['state'])return _0x4aae5a['setChangeGroupState'](_0x3447c9['index'],'outdated'),null;const _0x29bea7=this['_getDocumentRangeForReplyChanges'](_0x293eba,_0x3447c9['index']);if(!_0x29bea7)return _0x4aae5a['setChangeGroupState'](_0x3447c9['index'],'outdated'),null;const {range:_0x8e5d1a,currentIndex:_0x2a0ae5}=_0x29bea7;return'$graveyard'==_0x8e5d1a['root']['rootName']?(_0x4aae5a['setChangeGroupState'](_0x2a0ae5,'outdated'),null):_0x29bea7['range'];}['_getDocumentRangeForReplyChanges'](_0x1d7869,_0x435c66){const {reply:_0x2d7968,interaction:_0x13eca4}=this['getInteractionAndReplyById'](_0x1d7869),_0x18c698=_0x2d7968['changeGroups']['filter'](_0x30f23f=>'pending'==_0x30f23f['state']),_0x104ddd=_0x18c698['map'](_0x57e657=>_0x2d7968['changeGroups']['indexOf'](_0x57e657));void 0x0===_0x435c66&&(_0x435c66=_0x104ddd[0x0]);const _0x4e8b8c=_0x104ddd['indexOf'](_0x435c66);if(-0x1==_0x4e8b8c)return null;const _0xcb89f2=_0x18c698[_0x4e8b8c],_0x30a939=_0xcb89f2['editor'];if(!_0x30a939||'destroyed'===_0x30a939['state'])return null;if(!_0x33336f(_0x30a939,_0xcb89f2['rootName']))return null;const _0x4edd65=_0x2d7968['documentContextContent']['get'](_0xcb89f2['documentId']),_0x55aea8=new _0xc2b1d2([]),_0x59c8a1=new _0xc2b1d2([]);for(const _0x1def5d of _0xcb89f2['changes'])if('removed'!=_0x1def5d['type']&&_0x59c8a1['children']['push'](_0x1def5d['node']['cloneNode'](!0x0)),'new'!=_0x1def5d['type']){const _0x468e86=ti(_0x3fb3d9=>fs(_0x3fb3d9,'data-id')==_0x1def5d['id'],_0x4edd65,!0x0);_0x55aea8['children']['push'](_0x468e86['cloneNode'](!0x0));}if(0x0==_0x55aea8['children']['length']){if(_0xcb89f2['changes'][0x0]['anchorId']){const _0x5e9829=Es('data-id',_0xcb89f2['changes'][0x0]['anchorId'],_0x4edd65);_0x55aea8['children']['unshift'](_0x5e9829['cloneNode'](!0x0)),_0x59c8a1['children']['unshift'](_0x5e9829['cloneNode'](!0x0)),_0x5e9829['nextSibling']&&(_0x55aea8['children']['push'](_0x5e9829['nextSibling']['cloneNode'](!0x0)),_0x59c8a1['children']['push'](_0x5e9829['nextSibling']['cloneNode'](!0x0)));}else{const _0x4517e7=_0x4edd65['children'][0x0];if(!_0x4517e7)return null;_0x55aea8['children']['push'](_0x4517e7['cloneNode'](!0x0)),_0x59c8a1['children']['push'](_0x4517e7['cloneNode'](!0x0));}}const _0x4feee8=_0x13eca4['getDocumentContext'](),_0x4c7c82=_0x4feee8['documents']['find'](_0x5a9aa2=>_0x5a9aa2['id']==_0xcb89f2['documentId'])['content'],_0x4aef79=_0x30a939['model']['document']['getRoot'](_0xcb89f2['rootName']),_0x1b778b=_0x30a939['data']['parse'](_0x4c7c82,_0x4aef79),_0x3fafb7=ms(_0x55aea8),_0x3171af=_0x30a939['data']['parse'](_0x3fafb7,_0x4aef79),_0xe22538=_0x30a939['data']['parse'](_0x3fafb7,_0x4aef79),_0xab8b64=_0x30a939['model']['createPositionAt'](_0x3171af,0x0),_0x26cbd6=ms(_0x59c8a1),_0x5c73b5={'targetEditor':_0x30a939,'anchor':_0xab8b64,'markDeletions':!0x1};let _0x37f774;try{_0x37f774=_0x30a939['plugins']['get'](_0x5bc848)['getDiff'](_0x3fafb7,_0x26cbd6,_0x5c73b5)['getOperations']();}catch(_0x1694d0){return this['_reporter']['reportError'](new sn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x1694d0,'context':{'replyId':_0x1d7869,'partIndex':_0x435c66}})),null;}if(!_0x37f774['length'])return null;_0x30a939['model']['change'](_0xa0af04=>{for(const _0x442989 of _0x37f774)if('remove'==_0x442989['type']){const _0x2e2bc9=_0x442989['sourcePosition'],_0x2660c9=_0x442989['howMany'],_0x36e8f2=new _0x462971(_0x2e2bc9,_0x2660c9);_0xa0af04['batch']['addOperation'](_0x36e8f2),_0x30a939['model']['applyOperation'](_0x36e8f2);}else'marker'!==_0x442989['type']&&(_0x442989['baseVersion']=null,_0x442989['isDocumentOperation']=!0x1,_0xa0af04['batch']['addOperation'](_0x442989),_0x30a939['model']['applyOperation'](_0x442989));});const _0x3ca1ca=Gs(_0x30a939,_0x37f774,_0x3171af);Ks(_0x30a939['model'],_0x3ca1ca);const _0x59fbdf=_0x3ca1ca['getFirstRange']()['start']['path']['slice'](),_0x307351=_0x3ca1ca['getFirstRange']()['end']['path']['slice'](),_0x155d1e=[];let _0x29fc4f=_0x3171af,_0x512b83=_0xe22538;for(let _0x221976=0x0;_0x221976<_0x307351['length'];_0x221976++){const _0x5be887=_0x29fc4f['maxOffset']-_0x307351[_0x221976];_0x155d1e[_0x221976]=_0x512b83['maxOffset']-_0x5be887,_0x29fc4f=_0x29fc4f['getChildAtOffset'](_0x307351[_0x221976]),_0x512b83=_0x512b83['getChildAtOffset'](_0x155d1e[_0x221976]);}const _0x3f47a0=_0x30a939['model']['createRange'](_0x30a939['model']['createPositionFromPath'](_0xe22538,_0x59fbdf),_0x30a939['model']['createPositionFromPath'](_0xe22538,_0x155d1e)),_0x1b3e02=_0xe22538['getChild'](0x0)['getAttribute'](_0x40a4b3),_0x5ea3dc=Array['from'](_0x1b778b['getChildren']())['find'](_0x294d5e=>_0x294d5e['getAttribute'](_0x40a4b3)==_0x1b3e02)['getPath'](),_0x19ad1c=_0x3f47a0['start']['path']['slice'](),_0x21f4ac=_0x3f47a0['end']['path']['slice']();_0x19ad1c[0x0]=_0x5ea3dc[0x0]+_0x19ad1c[0x0],_0x21f4ac[0x0]=_0x5ea3dc[0x0]+_0x21f4ac[0x0];let _0x1e98d1=_0x30a939['model']['createRange'](_0x30a939['model']['createPositionFromPath'](_0x30a939['model']['document']['getRoot'](_0xcb89f2['rootName']),_0x19ad1c),_0x30a939['model']['createPositionFromPath'](_0x30a939['model']['document']['getRoot'](_0xcb89f2['rootName']),_0x21f4ac));const _0x38fc30=_0x4feee8['documents']['find'](_0x207dd9=>_0x207dd9['id']==_0xcb89f2['documentId'])['version'],_0x1f8e88=_0x30a939['model']['document']['history']['getOperations'](_0x38fc30);for(const _0x29b13b of _0x1f8e88)_0x1e98d1=_0x3888b9['_createFromRanges'](_0x1e98d1['getTransformedByOperation'](_0x29b13b));return{'range':_0x1e98d1,'currentIndex':_0x435c66,'targetEditor':_0x30a939};}['_integrateEditorBalloon'](_0x3b7525){if(!_0x3b7525['plugins']['has']('AIChatBalloon'))return;const _0x2257d6=_0x3b7525['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x2257d6['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x2257d6,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x31b328,partIndex:_0x2ca379}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x5752c0}=this['getInteractionAndReplyById'](_0x31b328),_0x581b96=_0x5752c0['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x2ca379});_0x2257d6['updateContent']({'part':_0x581b96[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x2257d6,'applySuggestion',()=>{const {replyId:_0x1cc441,partIndex:_0x1ddf89}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x1cc441,'partIndex':_0x1ddf89}),_0x2257d6['setState']('accepted');}),this['listenTo'](_0x2257d6,'insertSuggestion',()=>{const {replyId:_0x29eb5d,partIndex:_0x268881}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x29eb5d,'partIndex':_0x268881}),_0x2257d6['setState']('accepted');}),this['listenTo'](_0x2257d6,'rejectSuggestion',()=>{const {replyId:_0x28559b,partIndex:_0x44c1ac}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x28559b,'partIndex':_0x44c1ac}),_0x2257d6['setState']('rejected');}),this['listenTo'](_0x2257d6,'showNext',()=>{const {replyId:_0xb912d1,partIndex:_0x10f1a4}=this['_currentPreviewedChangeGroup'],_0x17bd31=this['_getPresentableSiblingContentPartIndex'](_0xb912d1,_0x10f1a4,'next');null!==_0x17bd31&&this['_openBalloonFor'](_0xb912d1,_0x17bd31);}),this['listenTo'](_0x2257d6,'showPrevious',()=>{const {replyId:_0x2030a2,partIndex:_0x47b076}=this['_currentPreviewedChangeGroup'],_0x3f6dbd=this['_getPresentableSiblingContentPartIndex'](_0x2030a2,_0x47b076,'previous');null!==_0x3f6dbd&&this['_openBalloonFor'](_0x2030a2,_0x3f6dbd);}),this['listenTo'](_0x2257d6,'dialogClosed',(_0x2c2bd1,{id:_0x41ce01})=>{if('aiChatBalloon'!==_0x41ce01)return;const {replyId:_0x7bf8a,partIndex:_0x59c009}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x7bf8a,'index':_0x59c009,'isActive':!0x1}),this['_activeBalloon']===_0x2257d6&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x3b8bca){if(this['_channelsToEditors']['set'](_0x3b8bca['config']['get']('collaboration.channelId'),_0x3b8bca),this['_integrateEditorBalloon'](_0x3b8bca),this['addCurrentDocumentToChatContext'](),_0x3b8bca['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x3b8bca['plugins']['has']('Undo')){const _0x4f77b9=_0x3b8bca['commands']['get']('undo'),_0x15b5ea=_0x3b8bca['commands']['get']('redo');this['listenTo'](_0x4f77b9,'revert',(_0x5994fe,_0x1661dc,_0x2fe1cf)=>{const _0x15bdb8=this['_batchToChanges']['get'](_0x1661dc);if(!_0x15bdb8)return;const _0x2ce662=this['activeConversation']['getInteraction'](_0x15bdb8['interactionId']),_0xed6448=_0x2ce662?.['getReply'](_0x15bdb8['replyId']);this['_batchToChanges']['delete'](_0x1661dc),_0x2ce662&&_0xed6448&&(_0x15bdb8['indexes']['forEach'](_0x2a0cf3=>_0xed6448['setChangeGroupState'](_0x2a0cf3,'pending')),this['_batchToChanges']['set'](_0x2fe1cf,_0x15bdb8));}),this['listenTo'](_0x15b5ea,'revert',(_0x25637b,_0x229107,_0x314a83)=>{const _0x310c84=this['_batchToChanges']['get'](_0x229107);if(!_0x310c84)return;const _0xaebf21=this['activeConversation']['getInteraction'](_0x310c84['interactionId']),_0x29d702=_0xaebf21?.['getReply'](_0x310c84['replyId']);this['_batchToChanges']['delete'](_0x229107),_0xaebf21&&_0x29d702&&(_0x310c84['indexes']['forEach'](_0x3a17d0=>_0x29d702['setChangeGroupState'](_0x3a17d0,'accepted')),this['_batchToChanges']['set'](_0x314a83,_0x310c84));});}const _0x51355f=_0x3b8bca['config']['get']('ai.chat.context');_0x51355f['alwaysAddSelection']&&_0x51355f['document']['enabled']&&this['listenTo'](_0x3b8bca['model']['document']['selection'],'change:range',(_0x2cc599,_0x514279)=>{_0x514279['directChange']&&'chat'===_0x3b8bca['plugins']['get']('AITabs')['view']['activeTab']&&(_0x3b8bca['model']['hasContent'](_0x3b8bca['model']['document']['selection'])?this['addSelectionToChatContext'](_0x3b8bca):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x5d9783=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x9e6002=await _0x5d9783['getConversations']();return _0x9e6002['length']?_0x9e6002[0x0]['id']:'new';}catch(_0x12effd){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':_0x12effd})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x18e0d8={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x18e0d8);}catch(_0x287194){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x18e0d8['id']||vt()}),this['_reporter']['logError'](_0x287194),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x40bc73,modelId:_0x5425a7}={}){this['_closeActiveBalloon']();let _0x25e18f=_0x5425a7;_0x25e18f||(_0x40bc73||!this['activeConversation']?_0x25e18f=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x25e18f=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x28bbbd=this['getGroupId'](),_0x1a14ac=_0x40bc73||vt();let _0x21d2ef;this['activeConversation']=new Sn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x25e18f,'conversationId':_0x1a14ac,'group':_0x28bbbd,'locale':this['context']['locale'],'isFromHistory':!!_0x40bc73,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x31c849=>this['_aiEditing']['getSessionId'](_0x31c849)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x3da5eb,_0x9ae2a6)=>{this['_aiChatUi']['createConversation'](_0x9ae2a6),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x40bc73||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x464c74,_0x55f211)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x55f211['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0xed724d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0xed724d);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x3c17c1=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x3c17c1);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x356e27,_0x298176)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x298176,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x41cd51,_0xdaf97e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xdaf97e,{'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',(_0x1a6f29,_0x298de4)=>{this['_aiChatUi']['removeFeedInteraction'](_0x298de4['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x37f3ce,_0x542ba1,_0x39a7e6)=>{this['_updateConversationTitle'](_0x542ba1,_0x39a7e6);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x3fefe5,_0x22de21)=>{void 0x0!==_0x21d2ef&&_0x21d2ef!==_0x22de21['id']&&this['_updateReplyContentThrottled']['flush'](),_0x21d2ef=_0x22de21['id'],_0x22de21['isFromHistory']?await this['_updateReplyContent']({'reply':_0x22de21}):await this['_updateReplyContentThrottled']({'reply':_0x22de21});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x2f7638,{reply:_0x59eb27,index:_0x360d62,state:_0x9496f4})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x59eb27['id'],'index':_0x360d62,'state':_0x9496f4}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x59eb27['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x360d62&&this['_activeBalloon']?.['setState'](_0x9496f4);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x4a0b12,_0x227ded)=>{if(this['_aiChatUi']['addContextItem'](_0x227ded['contextItem'],_0x227ded['isLoading']),'selection'===_0x227ded['contextItem']['type']){const _0x5843af=_s(this['context']),_0x5668d3=[..._0x5843af['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x5843af,'ranges':_0x5668d3,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x172312,_0x55f3e0)=>{this['_aiChatUi']['removeContextItem'](_0x55f3e0['uiId']),'current-document'==_0x55f3e0['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x55f3e0['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xb4fcee,_0xf9ecb7)=>{this['_aiChatUi']['setContextItemLoading'](_0xf9ecb7['contextItem']['uiId'],_0xf9ecb7['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x590347,_0x1823c2)=>{this['_aiChatUi']['setConversationContext'](_0x1823c2['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x2e9b2a,_0x45da2c)=>{this['_aiChatUi']['setAddContextOptions'](_0x45da2c['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x147954,_0x1bff0d)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x1bff0d['sourceId'],_0x1bff0d['source'],_0x1bff0d['resources'],_0x1bff0d['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x17f722,_0x85331f)=>{this['_aiChatUi']['updateResourceState'](_0x85331f['sourceId'],_0x85331f['resourceId'],_0x85331f['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x2ee8a4,_0x271e79)=>{this['_aiChatUi']['updateCapabilities'](_0x271e79);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x1b5214,_0x31df04)=>{try{const _0x15baba=(await this['_aiChatModels']['getAll']())['find'](_0x54db1a=>_0x54db1a['id']===_0x31df04['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x15baba,_0x31df04['isDisabled']);}catch(_0x221683){this['_reporter']['logError'](new sn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x221683}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x2d118d,{error:_0x2e47e3,interactionId:_0x56750e,fileName:_0xd7f372,url:_0xdeb8de,sourceId:_0xfd29e8,sourceLabel:_0xe020cd})=>{const _0x1a1c20=_0x56750e?_0x56750e+':'+vt():vt();this['_reporter']['reportError'](_0x2e47e3),_0x2e47e3['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-conversation-init-failed')||_0x2e47e3['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0xd7f372),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0xdeb8de),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0xfd29e8&&this['_aiChatUi']['closeSourceResourceBalloon'](_0xfd29e8),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0xe020cd||'source'),'id':_0x1a1c20})):_0x2e47e3['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x1a1c20}):_0x2e47e3['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x1a1c20}):_0x2e47e3['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':_0x1a1c20}):_0x2e47e3['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':_0x1a1c20}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x1a1c20});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x40bc73||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0xa3bf55,attributes:_0x28835a}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x2b5709=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x2b5709);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0xa3bf55,'attributes':_0x28835a});}['_removeFromContext'](_0x33f989){this['activeConversation']?.['removeFromContext'](_0x33f989);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x153898){const [_0x18bbb7,_0x548469]=_0x153898['split'](':'),_0x372507=this['activeConversation']['getInteraction'](_0x18bbb7);return{'interaction':_0x372507,'reply':_0x372507['getReply'](_0x548469)};}['_scrollToSuggestionRange'](_0x9659fa,_0x40369c=!0x1,_0x3c204e){const _0x3d2e1e={'target':_0x3c204e['editing']['view']['domConverter']['viewRangeToDom'](_0x3c204e['editing']['mapper']['toViewRange'](_0x9659fa)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x40369c};_0x40369c&&(_0x3d2e1e['alignToTop']=!0x0),Rt(_0x3d2e1e);}['_updateConversationTitle'](_0x3a0af0,_0x57f5b5=!0x1){this['_aiChatUi']['setConversationTitle'](_0x3a0af0||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x57f5b5);}['_addFeedItemReply'](_0x42c7b3){'text'===_0x42c7b3['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x42c7b3):this['_aiChatUi']['addFeedItemAISuggestion'](_0x42c7b3);}async['_updateReplyContent']({reply:_0x2241ac,renderingStrategy:_0x2bd598}){const {id:_0x278f67,interactionId:_0x30e3fa,isDone:_0x58b46a,type:_0x4e1239,parsedContent:_0x21f6f1}=_0x2241ac,_0x14de34=_0x30e3fa+':'+_0x278f67;if('modification'===_0x4e1239){const _0x2a8339=_0x2241ac['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x14de34,'parts':_0x2a8339,'isDone':_0x58b46a,'skipLoadingEffects':_0x2241ac['isFromHistory']});}else'text'===_0x4e1239&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x14de34,'parsedContent':_0x21f6f1['get']('text'),'renderingStrategy':_0x2bd598,'isDone':_0x58b46a});_0x58b46a&&_0x2241ac['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x14de34,_0x2241ac['sources']);}['_updateReplyContentThrottled']=_0x1290d2(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x5285a6=this['activeConversation']?.['lastInteraction'];_0x5285a6&&(_0x5285a6['stop'](),this['_aiChatUi']['stopInteraction'](_0x5285a6)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x57dabd=this['activeConversation']?.['lastInteraction'];if(_0x57dabd){for await(const _0x25bfb7 of _0x57dabd['replies'])this['_aiChatUi']['hasFeedItem'](_0x25bfb7['id'])||this['_addFeedItemReply'](_0x25bfb7),await this['_updateReplyContent']({'reply':_0x25bfb7,'renderingStrategy':'static'});}}['_updateRatings'](_0x467da0){const _0x41e9b0={'positiveCount':_0x467da0['changeGroups']['filter'](_0x11cfd7=>'accepted'===_0x11cfd7['state'])['length'],'totalCount':_0x467da0['changeGroups']['length'],'modificationId':_0x467da0['id']},_0x2be763=this['activeConversation']['getInteraction'](_0x467da0['interactionId'])['messageId'];_0x2be763&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x2be763,_0x41e9b0);}['_getAIChatFeedAPI'](_0x475887){const _0x42c71b=this['_aiChatUi'],_0x73d7a4=()=>{_0x475887['resetWebSearchState'](),_0x475887['resetReasoningState'](),_0x42c71b['clearLoadingMessage']();},_0x2408ac=()=>{_0x475887['currentReply']&&(_0x475887['currentReply']['done'](),_0x475887['currentReply']=void 0x0);};return{'insertTextReply':(_0x49f89e,_0x2aeca2)=>{_0x2408ac(),_0x73d7a4();const _0x45a40b=_0x475887['currentReply']=_0x475887['createReply']({'type':'text','interactionId':_0x475887['id'],'id':_0x2aeca2||vt(),'channelsToEditors':this['_channelsToEditors']});return _0x45a40b['appendContent'](_0x49f89e),_0x2408ac(),_0x45a40b;},'insertCustomElement':async(_0x953c6,_0x2ae191)=>(_0x2408ac(),_0x73d7a4(),_0x42c71b['addFeedItemCustomElement'](_0x953c6,_0x2ae191||vt())),'setLoadingMessage':_0x5b023a=>{_0x42c71b['setLoadingMessage'](_0x5b023a);},'clearLoadingMessage':()=>{_0x42c71b['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x4adef4=>'destroyed'!==_0x4adef4['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Nn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],yn=[...Nn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function xn(_0x4d779e){const _0x5548ed=new AbortController();return{'promise':new Promise((_0x443b5d,_0x174093)=>{const _0x190f6f=setTimeout(_0x443b5d,_0x4d779e);_0x5548ed['signal']['addEventListener']('abort',()=>{clearTimeout(_0x190f6f),_0x174093();});}),'abortController':_0x5548ed};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x11853d){this['options']={'delay':_0x11853d?.['delay']??0xa,'textNodeStyle':_0x11853d?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0xd31460,targetElement:_0x5189d8,abortSignal:_0x379ceb}){this['isStreaming']&&this['stop'](),_0x379ceb?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x398eb6(_0xd31460,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x51abd6=0x0;_0x51abd6<this['currentIndex'];_0x51abd6++)this['nodesList'][_0x51abd6]['shouldBeStreamed']=!0x0;do{const _0xbca54e=Date['now'](),_0x24c2af=this['nodesList'][this['currentIndex']],_0x4f3319=_0xbca54e-this['lastUpdateTime'];if(_0x24c2af){_0x24c2af['shouldBeStreamed']=!0x0;let _0x4dd33c=_0x24c2af['parent'];for(;_0x4dd33c;)_0x4dd33c['shouldBeStreamed']=!0x0,_0x4dd33c=_0x4dd33c['parent'];}if(_0x4f3319<this['options']['delay'])try{const {promise:_0x43cf52,abortController:_0x47f114}=xn(this['options']['delay']-_0x4f3319);this['timeoutAbortController']=_0x47f114,await _0x43cf52;}catch(_0x1bc117){return;}_0x2becb9(_0x5189d8,'<'+_0x5189d8['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x5189d8['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:_0x584203}){Array['from'](_0x584203['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x58851e=>{_0x58851e['replaceWith'](_0x58851e['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x58bbc0){let _0x5e7e1a='';if(function(_0x3aaaa1){return _0x441c88(_0x3aaaa1);}(_0x58bbc0)){for(const _0xbf33bf of _0x58bbc0['children'])_0x5e7e1a+=this['renderNode'](_0xbf33bf);}else{if(Hn(_0x58bbc0)){if(!_0x58bbc0['shouldBeStreamed'])return'';const _0x526f1b=_0x58bbc0,_0x44b00e=Object['entries'](_0x526f1b['attribs'])['map'](([_0x17849a,_0x4f58a3])=>_0x17849a+'=\x22'+_0x4f58a3+'\x22')['join']('\x20');_0x5e7e1a+='<'+_0x526f1b['tagName']+(_0x44b00e?'\x20'+_0x44b00e:'')+'>';for(const _0x303415 of _0xb28728(_0x526f1b))_0x5e7e1a+=this['renderNode'](_0x303415);_0x5e7e1a+='</'+_0x526f1b['tagName']+'>';}else{if(!Pn(_0x58bbc0))return'';if(!_0x58bbc0['shouldBeStreamed'])return'';!function(_0xbee574){return!(!_0xbee574['parent']||!Hn(_0xbee574['parent']))&&(!!Dn['includes'](_0xbee574['parent']['tagName'])&&!_0x4abfc8(_0xbee574)['match'](/^\s*[<>]\s*$/));}(_0x58bbc0)?_0x5e7e1a+=_0x154796(_0x58bbc0):_0x5e7e1a+=_0x154796(new _0x1b6d09('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x58bbc0]));}}return _0x5e7e1a;}['getParsedDocumentNodeList'](){const _0x4c173e=[];return function(_0xd84587,_0x7bc8bd){const _0x15c6d9=_0x566cff=>{if(_0x7bc8bd(_0x566cff),_0x566cff instanceof _0x16bc48)for(let _0x24be23=0x0;_0x24be23<_0x566cff['children']['length'];_0x24be23++){const _0x166151=_0x566cff['children'][_0x24be23];_0x15c6d9(_0x166151);}};for(let _0x4b1b48=0x0;_0x4b1b48<_0xd84587['children']['length'];_0x4b1b48++)_0x15c6d9(_0xd84587['children'][_0x4b1b48]);}(this['document'],_0x217df5=>{if(Pn(_0x217df5)){const _0x5cce5a=this['splitTextNodeIntoWordNodes'](_0x217df5);_0x5cce5a['length']&&_0x4c173e['push'](..._0x5cce5a);}_0x217df5['isWordSplitSource']||_0x217df5['isWordSplitResult']||_0x4c173e['push'](_0x217df5);}),_0x4c173e;}['splitTextNodeIntoWordNodes'](_0x1221b5){if(_0x1221b5['isWordSplitSource']||_0x1221b5['isWordSplitResult'])return[];const _0xf78795=_0x4abfc8(_0x1221b5)['match'](/(?:\s*\S+\s*)/g),_0x335c8f=[];if(_0xf78795&&_0xf78795['length']>0x1){for(const _0x518cdc of _0xf78795){const _0x104d49=new _0x238b0a(_0x518cdc);_0x104d49['isWordSplitResult']=!0x0,_0x129955(_0x1221b5,_0x104d49),_0x335c8f['push'](_0x104d49);}_0x1221b5['isWordSplitSource']=!0x0,_0x183ce6(_0x1221b5);}return _0x335c8f;}};const Dn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Pn(_0x79b5aa){return _0x157de6(_0x79b5aa);}function Hn(_0x4f4f3e){return _0x4654ea(_0x4f4f3e);}function Mn(_0x4deebc,_0x1a4cfd){_0x4deebc['cleanUpAnimations']({'targetElement':_0x1a4cfd}),_0x1a4cfd['querySelectorAll']('[data-id]')['forEach'](_0x5e6b69=>{_0x5e6b69['removeAttribute']('data-id');});}var Vn=class extends _0x1f08de{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x20522c){super();const _0x1b105e=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x20522c,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x1b105e['if']('isDone','ck-ai-chat__feed__item_done'),_0x1b105e['if']('isVisible','ck-hidden',_0x5caeb0=>!_0x5caeb0),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Mn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x1f89d6,_0x5ec8a6,_0x5f0a05){await this['htmlStreamer']['stream']({'document':_0x1f89d6,'targetElement':_0x5ec8a6,'abortSignal':_0x5f0a05});}},Un=class extends _0x1f08de{['showChangesToggleView'];constructor(_0x1a5d31,_0x6cfa54){super(_0x1a5d31),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x1a5d31),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+hn,'label':us(_0x1a5d31,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x6cfa54['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x3839ea=>_0x3839ea?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x35937f=new Yt();_0x35937f['content']=_0x56c092,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x6cfa54['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x35937f,{'tag':'span','children':[us(_0x1a5d31,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x70e58a,'rejected':_0x38fc79,'outdated':_0x38fc79};var Fn=class extends _0x1f08de{['stateIconView'];constructor(_0x51280f){super(_0x51280f);const _0xc1ba07=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Kn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0xc1ba07['to']('state',_0x71d555=>'ck-ai-suggestion__content-part-state_'+_0x71d555),_0xc1ba07['if']('isVisible','ck-hidden',_0x1dbb9b=>!_0x1dbb9b)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0xc1ba07['to']('state',_0x228b58=>{switch(_0x228b58){case'accepted':return us(_0x51280f,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0x51280f,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0x51280f,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x5f3f7d){this['state']=_0x5f3f7d;}},Kn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x3ffb1c{['_applyButton'];['_suggestButton'];constructor(_0x2e873d,_0x3a2259,_0x2e193b){super(_0x2e873d);const _0x16abdc=Boolean(_0x2e193b);this['set']('isEnabled',!_0x16abdc),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x1f235a=[];if(_0x16abdc){const _0x283a5d=new Ht(_0x2e873d);_0x283a5d['set']({'label':us(_0x2e873d,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2be136}),_0x283a5d['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x1f235a['push'](_0x283a5d);}else{_0x3a2259['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0x2e873d),this['_applyButton']['set']({'label':us(_0x2e873d,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x70e58a}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x2845a2=>!_0x2845a2),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x1f235a['push'](this['_applyButton'])),_0x3a2259['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0x2e873d),this['_suggestButton']['set']({'label':us(_0x2e873d,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x13976d}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x1f235a['push'](this['_suggestButton']));const _0x23390a=new Ht(_0x2e873d);_0x23390a['set']({'label':us(_0x2e873d,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x38fc79}),_0x23390a['bind']('isEnabled')['to'](this),_0x23390a['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x1f235a['push'](_0x23390a);}this['items']['addMany'](_0x1f235a);const _0x5d3370=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x5d3370['if']('isVisible','ck-hidden',_0x2777c4=>!_0x2777c4)]}});}['setButtonsVisibility']({showApplyButton:_0x292cc8,showSuggestButton:_0x2238f8}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x292cc8),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x2238f8);}},Yn=class extends _0x1f08de{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0xd197b2,{part:_0x33a334,uiIndex:_0x4894a4,availableActions:_0x3ae996,areActionsDisabled:_0x1fb94e}){super(_0xd197b2),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0xd197b2,_0x3ae996,_0x1fb94e),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x33a334['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x33a334['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x33a334['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0xd197b2),this['titleLabelView']=new $n(_0xd197b2,_0x4894a4),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',(_0x192d03,_0xc562ed,_0xba12cc,_0x410039)=>{'pending'===_0x410039?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0xba12cc?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0xba12cc),this['children']['add'](this['stateView']));});}},$n=class extends _0x1f08de{constructor(_0x254b8b,_0x137efb){super(_0x254b8b),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x254b8b,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x137efb['toString']())]});}},qn=class extends _0x1f08de{['htmlStreamer'];constructor(_0x867875){super(_0x867875),this['htmlStreamer']=new Ln(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x8f1f44,renderingStrategy:_0x185ef6,abortSignal:_0x1c5b2a}){const _0xb278a7=_0x398eb6(_0x8f1f44['content'],!0x0);for(const _0x7d205d of ws(_0xb278a7))_0x183ce6(_0x7d205d);'streaming'===_0x185ef6?await this['htmlStreamer']['stream']({'document':_0xb278a7,'targetElement':this['element'],'abortSignal':_0x1c5b2a}):_0x2becb9(this['element'],'<'+this['element']['tagName']+'>'+ms(_0xb278a7)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Mn(this['htmlStreamer'],this['element']);}},Qn=class extends _0x1f08de{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x5202b4,{part:_0x581a64,uiIndex:_0x1a079a,areActionsDisabled:_0x9d52a9,availableActions:_0x112bb0}){super(_0x5202b4);const _0x185bb=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 _0x5e4b70=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x9d52a9;};this['on']('change:state',_0x5e4b70),this['on']('change:isDone',_0x5e4b70),_0x5e4b70(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x5202b4,{'part':_0x581a64,'uiIndex':_0x1a079a,'availableActions':_0x112bb0,'areActionsDisabled':_0x9d52a9}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x5202b4),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x185bb['to']('state',_0x363bd5=>'ck-ai-suggestion__body__content-part_'+_0x363bd5),_0x185bb['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x185bb['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x185bb['if']('isVisible','ck-hidden',_0x1a75c9=>!_0x1a75c9)]},'children':this['_children'],'on':{'mouseenter':_0x185bb['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x581a64['index']});}),'mouseleave':_0x185bb['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x581a64['index']});}),'click':_0x185bb['to'](_0x37bc64=>{const _0x1db030=_0x37bc64['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x1db030)&&this['fire']('showChangeInText',{'index':_0x581a64['index']});})}});}async['updateContent']({part:_0x15622a,showUnchangedParts:_0x865064=!0x1,abortSignal:_0x400233}){this['partDefinition']=_0x15622a,this['isVisible']=this['partDefinition']['hasChanges']||_0x865064,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x15622a,'renderingStrategy':'static','abortSignal':_0x400233});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x1f08de{constructor(_0x31284a,_0x3997d1){super(_0x31284a),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x18bb7e=>!_0x18bb7e)]},'children':this['_createSkeletonItems'](_0x3997d1)});}['_createSkeletonItems'](_0x3d7fd2){const _0x33b842=['ck','ck-ai-skeleton__item'];return _0x3d7fd2['map'](_0x232cb3=>{let _0x4b1cd8='';switch(_0x232cb3['attributes']['align']){case'right':_0x4b1cd8='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x4b1cd8='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x4b1cd8='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x232cb3['tag'],'attributes':{'class':[..._0x33b842,_0x232cb3['attributes']['class']?_0x232cb3['attributes']['class']:''],'style':'width:\x20'+_0x232cb3['attributes']['width']+';\x20height:\x20'+_0x232cb3['attributes']['height']+';'+_0x4b1cd8}};});}};const zn={'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(_0xf2606b,_0x5c13d0,_0x168aa9,_0x4c088c){return new Array(_0xf2606b)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x5c13d0,'height':_0x168aa9,'align':_0x4c088c}}));}const Jn=/* #__PURE__ -- @preserve */
33
- ut();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x2f06ea){const _0x857d3f=this['createTask'](_0x2f06ea);return this['queue']['push'](_0x857d3f),this['_processQueue'](),_0x857d3f['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(_0xcd0cd9=>{this['once']('_queueEmpty',()=>{_0xcd0cd9();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x2d5265=this['queue']['shift']();try{await _0x2d5265['callback'](this['_abortController']['signal']),_0x2d5265['resolve']();}catch(_0x492974){_0x2d5265['reject'](_0x492974);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x18017e){let _0x4bf5bb,_0x27da23;const _0x25d650=new Promise((_0x33c4d7,_0x13d03e)=>{_0x4bf5bb=_0x33c4d7,_0x27da23=_0x13d03e;});return{'callback':_0x18017e,'resolve':_0x4bf5bb,'reject':_0x27da23,'completePromise':_0x25d650};}},tr=class extends Vn{constructor(_0x155dd5){super(_0x155dd5),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x155dd5['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0xc23a7c){this['element']['innerHTML']=_0xc23a7c;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x1f08de{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x46d0ed,_0x3b861b=[...er],_0xefcced){super(_0x46d0ed);const _0x2c0dad=this['bindTemplate'],_0x53ba50=Boolean(_0xefcced);if(this['set']('isEnabled',!_0x53ba50),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x53ba50){const _0x358cff=new Ht(_0x46d0ed);_0x358cff['set']({'label':us(_0x46d0ed,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2be136}),_0x358cff['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x2c96db=new _0x1f08de(_0x46d0ed);_0x2c96db['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x46d0ed,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x358cff]}]}),this['children']['add'](_0x2c96db);}else this['_applyChangesButton']=new Ht(_0x46d0ed),this['_applyChangesButton']['set']({'label':us(_0x46d0ed,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3b861b['includes']('applySuggestion'),'class':on}),this['_insertSuggestionsButton']=new Ht(_0x46d0ed),this['_insertSuggestionsButton']['set']({'label':us(_0x46d0ed,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3b861b['includes']('insertSuggestion'),'class':an}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2003e5=>{_0x2003e5['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',_0x2c0dad['if']('isVisible','ck-hidden',_0x39d2fa=>!_0x39d2fa)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x4da37f){this['isVisible']=_0x4da37f;}['_switchButtonLabelsPlurality'](_0x286409){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x286409?(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')));}},sr=class extends _0x1f08de{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x26e18e,_0x522068){super(_0x26e18e),this['bodyCollection']=_0x522068,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',_0x20ffb3=>!_0x20ffb3)]},'children':this['children']});const _0x2a3e6c=new _0x1f08de(this['locale']),_0x5814c6=new Yt();_0x5814c6['content']=at,_0x2a3e6c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x5814c6,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x2a3e6c),this['_setupBalloonPanel'](_0x26e18e);}['addSource'](_0x57b476){this['children']['add'](new nr(this['locale'],_0x57b476,this['balloonPanelView']));}['_setupBalloonPanel'](_0x77ab9f){this['balloonPanelView']=new yt(_0x77ab9f),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x1b79c4,_0x280475,_0x5e807a){super(_0x1b79c4),this['source']=_0x280475,this['balloonPanelView']=_0x5e807a,this['set']({'label':_0x280475['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x2d0b95=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x2d0b95['to'](()=>{window['open'](_0x280475['url'],'_blank');}),'mouseenter':_0x2d0b95['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x2d0b95['to'](()=>{this['_hideTooltip']();})}}),_0x280475['favicon']){const _0x417924=new _0x1f08de(_0x1b79c4);_0x417924['setTemplate']({'tag':'img','attributes':{'src':_0x280475['favicon']||at,'alt':_0x280475['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x417924);}else this['set']('icon',at);}['_createTooltipContentView'](_0x4457dd,_0x3c1e5a){const _0x1477a7=new _0x1f08de(_0x4457dd),_0x4ae835=[];let _0x24cf78;_0x3c1e5a?.['favicon']?(_0x24cf78=new _0x1f08de(_0x4457dd),_0x24cf78['setTemplate']({'tag':'img','attributes':{'src':_0x3c1e5a['favicon'],'alt':_0x3c1e5a['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x24cf78=new Yt(),_0x24cf78['content']=at,_0x24cf78['extendTemplate']({'attributes':{'alt':_0x3c1e5a['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x4ae835['push'](_0x24cf78);const _0x4eea01=new _0x1f08de(_0x4457dd);_0x4eea01['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x3c1e5a['url']},'children':[{'text':new URL(_0x3c1e5a['url'])?.['hostname']}]}),_0x4ae835['push'](_0x4eea01);const _0x36f2da=new _0x1f08de(_0x4457dd);_0x36f2da['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x4ae835});const _0x4fdbcd=new _0x1f08de(_0x4457dd);return _0x4fdbcd['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x3c1e5a['title']['length']>0x190?_0x3c1e5a['title']['substring'](0x0,0x190)+'...':_0x3c1e5a['title']}]}),_0x1477a7['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x36f2da,_0x4fdbcd]}),_0x1477a7;}['_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 _0xb7603d=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0xb7603d);}},rr=class extends _0x1f08de{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x152bc3(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x3eb9b9,_0x38a112){super(_0x3eb9b9);const {areActionsDisabled:_0x506240,showUnchangedParts:_0x288a41,availableActions:_0xb0cf2d}=_0x38a112;this['_areActionsDisabled']=_0x506240,this['_showUnchangedParts']=_0x288a41,this['_availableActions']=_0xb0cf2d,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x3eb9b9,zn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Zn(),this['_emptyPartsWarningView']=new tr({'id':'empty-parts-warning','initialContent':us(_0x3eb9b9,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x3eb9b9,_0x38a112['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x38a112['bodyCollection']),_0x38a112['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Nn)['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'](_0x594ebc=>_0x594ebc instanceof Qn);}async['updateContentParts']({parts:_0xf779e6,abortSignal:_0x3693c3,skipLoadingEffects:_0x3549f7}){this['_cachedContentParts']['length']?_0xf779e6['forEach'](_0x58a122=>{const _0x1b5b46=this['_cachedContentParts']['findIndex'](_0xc7dea8=>_0xc7dea8['index']==_0x58a122['index']);-0x1===_0x1b5b46?this['_cachedContentParts']['push'](_0x58a122):this['_cachedContentParts'][_0x1b5b46]=_0x58a122;}):this['_cachedContentParts']=_0xf779e6;const _0x2dbeb1=this['_showUnchangedParts']?_0xf779e6:_0xf779e6['filter'](_0x3b0e3a=>_0x3b0e3a['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x2dbeb1['length']>0x1),_0x3549f7&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x1449d6 of _0x2dbeb1)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x174558=>{let _0x4b0c56=this['getPartView'](_0x1449d6['index']);if(!_0x4b0c56){if(_0x4b0c56=new Qn(this['locale'],{'part':_0x1449d6,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x4b0c56['delegate'](...Nn)['to'](this),_0x4b0c56['bind']('isTrackChangesOn')['to'](this),!_0x3549f7&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x174558),_0x174558['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x4b0c56,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x3549f7||this['_showSkeletonDebounced']();}await _0x4b0c56['updateContent']({'part':_0x1449d6,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x174558}),_0x4b0c56['markAsDone']();});return _0x3693c3?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x4ae05e,_0x397910){const _0x5d7d28=this['getPartView'](_0x4ae05e);_0x5d7d28&&(_0x5d7d28['state']=_0x397910),this['hasPendingParts']='pending'==_0x397910||this['_contentPartViews']['some'](_0x59e232=>'pending'==_0x59e232['state']);}['setPartActive'](_0x36bb09,_0x384fe0){if(!0x1===_0x36bb09){for(const _0x57bc7c of this['_contentPartViews'])_0x57bc7c['isActive']=!0x1;}else{const _0x466a68=this['getPartView'](_0x36bb09);_0x466a68&&(_0x466a68['isActive']=_0x384fe0);}}['updateSources'](_0xb0cd7e){_0xb0cd7e['forEach'](_0x1165c2=>this['_sourcesView']['addSource'](_0x1165c2)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x52ca75){return this['_contentPartViews']['find'](_0x5ee87f=>_0x5ee87f['partDefinition']['index']==_0x52ca75)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x1f9945=!this['_cachedContentParts']['find'](({hasChanges:_0x164cda})=>_0x164cda),_0x4eb376=!!this['_cachedContentParts']['find'](({hasChanges:_0x1143e8})=>!_0x1143e8);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x4eb376,_0x1f9945?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'](_0x22f0ca=>_0x22f0ca['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x12976d){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x5b449c=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x5b449c>0x0){const {promise:_0x4e058f,abortController:_0x3adb18}=xn(_0x5b449c);_0x12976d?.['addEventListener']('abort',()=>_0x3adb18['abort']()),await _0x4e058f['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x325f0f=>_0x325f0f['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x1f08de{['bodyView'];['children'];['headerView'];constructor(_0x591794,_0x5a3f1b,_0x15a4fd){super(_0x591794);const {showDiff:_0xe250b6,areActionsDisabled:_0x159a7a,showUnchangedParts:_0x3f0bfb,availableActions:_0x82254f}=_0x5a3f1b;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x591794,{'showDiff':_0xe250b6}),this['headerView']['on']('toggleShowChanges',(_0x314de9,_0x54ae37)=>{this['areChangesVisible']=_0x54ae37['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x54ae37['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x591794,{'areActionsDisabled':_0x159a7a,'showUnchangedParts':!!_0x3f0bfb,'availableActions':_0x82254f,'bodyCollection':_0x15a4fd}),this['bodyView']['delegate'](...Nn)['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'](_0x4a14cb){await this['bodyView']['updateContentParts'](_0x4a14cb);}['updateSources'](_0x462a76){this['bodyView']['updateSources'](_0x462a76);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x2bb5b0,_0x36bca2,_0xd4d8a9){super(_0x36bca2),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x2bb5b0,{'showDiff':_0x36bca2['showDiff'],'areActionsDisabled':_0x36bca2['areActionsDisabled'],'availableActions':_0x36bca2['availableActions']},_0xd4d8a9),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x2ffd9b,_0x101868)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x101868['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',(_0x4c90ff,{index:_0x390dac})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x390dac});}),this['containerView']['on']('applySuggestion',(_0x20e5f1,{index:_0x5b6684}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x5b6684});}),this['containerView']['on']('insertSuggestion',(_0x57eb2e,{index:_0x163282}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x163282});}),this['containerView']['on']('rejectSuggestion',(_0x3534b8,{index:_0x1801c1})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1801c1});}),this['containerView']['on']('mouseOverSuggestion',(_0x4afc6f,{index:_0x3538f6})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3538f6});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x40ce7c,{index:_0x46d2d9})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x46d2d9});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x4ae647){await this['containerView']['updateContent'](_0x4ae647);}['updatePartState'](_0x129e83,_0x44f64e){this['containerView']['bodyView']['updatePartState'](_0x129e83,_0x44f64e);}['setPartActive'](_0x6780ef,_0x5e94aa){!0x1===_0x6780ef?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x6780ef,_0x5e94aa);}['updateSources'](_0x5a511c){this['containerView']['updateSources'](_0x5a511c);}['getPartView'](_0x6db33b){return this['containerView']['bodyView']['getPartView'](_0x6db33b);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x543e70,_0x2d2d17,_0x31c9e1){super(_0x2d2d17),this['_bodyCollection']=_0x31c9e1,this['locale']=_0x543e70,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x1f08de(),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:_0x1be767,renderingStrategy:_0x464a99,abortSignal:_0x2caf2e}){'streaming'===_0x464a99?await this['streamIntoElement'](_0x1be767,this['replyContainer']['element'],_0x2caf2e):this['replyContainer']['element']['innerHTML']=_0x154796(_0x1be767);}['updateSources'](_0x59164a){const _0x20b605=new sr(this['locale'],this['_bodyCollection']);_0x20b605['children']['addMany'](_0x59164a['map'](_0x56fa4a=>new nr(this['locale'],_0x56fa4a,_0x20b605['balloonPanelView']))),_0x20b605['isVisible']=!0x0,this['children']['add'](_0x20b605);}},cr=class extends _0xbabce0{constructor(_0x381195=void 0x0){super();const _0x1644a0=_0x381195?'ck-ai-spinner_'+_0x381195:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x1644a0]}});}};const lr={'file':_0xd9f44a,'image':_0x484929,'document':_0x56c092,'web-resource':_0x353a80,'text':_0xd9f44a,'selection':_0x24f756,'mcp-tool-context':_0x56c092},ur='ck-ai-chat-context-chip',dr='ck-ai-chat-context-chip_wide',_r='ck-ai-chat-context-chip_document',gr='ck-ai-chat-context-chip__label',Ar='ck-ai-chat-context-chip__type-icon',Ir='ck-ai-chat-context-controls__chip-tooltip',pr='n';var mr=class extends Ht{constructor(_0x50a513,_0x5021f9,_0x8251a1,_0x1c3072,_0x5e46e8=!0x1){super(_0x50a513),this['_isAnimationOnEnterEnabled']=_0x1c3072,this['_initializeProperties'](_0x5021f9,_0x8251a1,_0x5e46e8),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'](_0x4cfecd,_0x5f083a,_0xae70be){this['set']('label',_0x4cfecd['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x4cfecd['type']),this['set']('id',_0x4cfecd['uiId']),this['set']('readonly',_0x5f083a),this['set']('isLoading',_0xae70be);}['_setupTemplate'](){const _0x1b66f0=this['_createIconView'](),_0x346412=this['_createRemoveButton'](),_0x54d3b5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x54d3b5),'children':this['_createTemplateChildren'](_0x1b66f0,_0x346412,_0x54d3b5)});}['_createTemplateAttributes'](_0x53f3b3){return{'class':[ur,_0x53f3b3['if']('itemType',_r,_0x2e12ca=>'document'==_0x2e12ca),_0x53f3b3['if']('itemType',dr,_0x7f0e4b=>'selection'==_0x7f0e4b)],'data-cke-tooltip-text':_0x53f3b3['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x71d292,_0x36dd9a,_0x2f677c){const _0x494b95=this['_createLabelElement'](_0x2f677c),_0x2f8870=this['_createLoaderIcon']();return this['readonly']?[_0x71d292,_0x494b95]:[_0x71d292,_0x2f8870,_0x494b95,_0x36dd9a];}['_createLabelElement'](_0x1627bb){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x1627bb['to']('label')}]};}['_createRemoveButton'](){const _0x3aa1f6=new Ht(this['locale']);return _0x3aa1f6['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x5ea60e}),this['_setupRemoveButtonEvent'](_0x3aa1f6),_0x3aa1f6;}['_setupRemoveButtonEvent'](_0x5ad601){_0x5ad601['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x58c19c=this['bindTemplate'],_0x16f06f=new Yt();return _0x16f06f['content']=lr[this['itemType']],_0x16f06f['extendTemplate']({'attributes':{'class':[Ar,_0x58c19c['if']('isLoading','ck-hidden',_0x40f77b=>_0x40f77b)]}}),_0x16f06f;}['_handleAnimationEndOnce'](_0x3b4636,_0xe7776c){if(!_0x3b4636)return;const _0x8ccc1e=()=>{_0xe7776c(),_0x3b4636['removeEventListener']('animationend',_0x8ccc1e),_0x3b4636['removeEventListener']('webkitAnimationEnd',_0x8ccc1e);};_0x3b4636['addEventListener']('animationend',_0x8ccc1e),_0x3b4636['addEventListener']('webkitAnimationEnd',_0x8ccc1e);}['_createLoaderIcon'](){const _0x4d5652=new cr('small');return _0x4d5652['bind']('isVisible')['to'](this,'isLoading',_0x12c34a=>_0x12c34a),_0x4d5652;}};function Er(_0x2a62c6){if(!_0x2a62c6)return _0x2a62c6;if(_0x2a62c6['length']<=0x78)return _0x2a62c6;const _0x34da00=_0x2a62c6['slice'](0x0,0x78),_0x6f41fc=_0x34da00['lastIndexOf']('\x20');return(_0x6f41fc>0x0?_0x34da00['slice'](0x0,_0x6f41fc):_0x34da00)+'…';}const Tr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},wr='300px';var Cr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x3912e7,_0x599cef,_0x477502,_0x4fb3c5,_0x565c9c){this['_locale']=_0x3912e7,this['_visibleChips']=_0x599cef,this['_config']={...Tr,..._0x477502,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x477502['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x4fb3c5,this['_parentView']=_0x565c9c||null;}['setContainerElement'](_0x3c314d){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x3c314d,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 _0x62de81=[...this['_visibleChips'],...this['_overflowChips']],_0x5db3a4=this['_createCalculationContainer'](),_0x510a0b=this['_calculateOverflowInContainer'](_0x5db3a4,_0x62de81),_0x5003f6=_0x5db3a4['_ancestorsToRestore'];_0x5003f6&&this['_restoreAncestorVisibility'](_0x5003f6),_0x5db3a4['remove'](),this['_applyOverflowResults'](_0x62de81,_0x510a0b);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x563b8b({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x16b5eb=new Ht(this['_locale']);_0x16b5eb['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x461612=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x461612['push'](this['_config']['cssClasses']['controlsButton']),_0x16b5eb['extendTemplate']({'attributes':{'class':_0x461612}}),_0x16b5eb;}['_createShowMoreBalloonPanelView'](){const _0x1edb61=new yt(this['_locale']);return _0x1edb61['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x1edb61),_0x1edb61;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2c5df1=>{_0x2c5df1['disableAnimationOnEnter']();});const _0x2167ff=new _0x1f08de(this['_locale']);_0x2167ff['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2167ff);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x26e4dc=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x26e4dc?'':'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'](_0x415544){const _0x582512=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x3188e2=this['_containerElement']?.['classList'];if(_0x3188e2){const _0x5ced13=_0x3188e2[0x0]||'',_0x15e939=_0x415544['querySelector']('.'+_0x5ced13),_0x9f74c5=_0x415544['querySelector'](_0x582512);return _0x15e939||_0x9f74c5||_0x415544;}return _0x415544['querySelector'](_0x582512)||_0x415544;}['_calculateContainerWidth'](){const _0x2fbc99=this['_parentView']?.['element']||this['_containerElement'];if(!_0x2fbc99)return wr;const _0x531bcb=window['getComputedStyle'](_0x2fbc99)['width'];if('auto'===_0x531bcb||'0px'===_0x531bcb||!_0x531bcb){const _0x3f12cc=_0x2fbc99['parentElement'];if(_0x3f12cc){const _0x110456=window['getComputedStyle'](_0x3f12cc);return'auto'!==_0x110456['width']?_0x110456['width']:wr;}return wr;}return _0x531bcb;}['_applyCalculationStyles'](_0x2f5c71,_0x42cd9b){this['_config']['cssClasses']['calculationContainer']&&_0x2f5c71['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x2f5c71['style']['width']=_0x42cd9b,_0x2f5c71['style']['position']='absolute',_0x2f5c71['style']['top']='-9999px',_0x2f5c71['style']['left']='-9999px',_0x2f5c71['style']['opacity']='0',_0x2f5c71['style']['pointerEvents']='none',_0x2f5c71['style']['zIndex']='-1',_0x2f5c71['style']['visibility']='visible\x20!important',_0x2f5c71['style']['display']='block\x20!important',_0x2f5c71['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x23773e){_0x23773e['forEach'](({element:_0x418609,originalDisplay:_0x3e25b0,originalVisibility:_0x2e0030})=>{_0x418609['style']['display']=_0x3e25b0,_0x418609['style']['visibility']=_0x2e0030;});}['_makeAncestorsVisible'](_0x548c99){const _0x484338=[];let _0x10226f=_0x548c99;for(;_0x10226f&&_0x10226f!==document['body'];){const _0x2814cd=window['getComputedStyle'](_0x10226f);'none'!==_0x2814cd['display']&&'hidden'!==_0x2814cd['visibility']||(_0x484338['push']({'element':_0x10226f,'originalDisplay':_0x10226f['style']['display'],'originalVisibility':_0x10226f['style']['visibility']}),_0x10226f['style']['display']='block',_0x10226f['style']['visibility']='visible'),_0x10226f=_0x10226f['parentElement'];}return _0x484338;}['_createContainerElements'](){let _0x402939,_0x25e5bb;return this['_parentView']?.['element']?(_0x402939=this['_parentView']['element']['cloneNode'](!0x0),_0x25e5bb=this['_findTargetContainer'](_0x402939)):(_0x402939=document['createElement']('div'),_0x25e5bb=_0x402939),{'calculationContainer':_0x402939,'targetContainer':_0x25e5bb};}['_createCalculationContainer'](){const {calculationContainer:_0x10b287,targetContainer:_0x5cc9be}=this['_createContainerElements'](),_0x644c15=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x10b287,_0x644c15);const _0x10a674=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x10a674?_0x10a674['appendChild'](_0x10b287):document['body']['appendChild'](_0x10b287),_0x10b287['_targetContainer']=_0x5cc9be;const _0x5230a7=this['_makeAncestorsVisible'](_0x10a674||null);return _0x10b287['offsetWidth'],_0x10b287['_ancestorsToRestore']=_0x5230a7,_0x10b287;}['_calculateOverflowInContainer'](_0x1b2ccd,_0x2bee43){const _0x20d2f0=_0x1b2ccd['_targetContainer']||_0x1b2ccd,_0x406436=[],{rowCount:_0x109826}=this['_renderChipsAndCountRows'](_0x20d2f0,_0x2bee43);if(_0x109826<=this['_config']['maxVisibleRows'])return _0x406436;const _0x383cf0=_0x2bee43['slice']();for(;_0x383cf0['length']>0x0;){if(this['_testButtonFit'](_0x1b2ccd,_0x20d2f0,_0x383cf0)){const _0x5b17da=_0x2bee43['filter'](_0x30270f=>!_0x383cf0['includes'](_0x30270f));_0x406436['push'](..._0x5b17da);break;}if(!_0x383cf0['pop']())break;}return _0x406436;}['_renderChipsAndCountRows'](_0x1fe6e5,_0x5a5424){_0x1fe6e5['innerHTML']='',_0x5a5424['forEach'](_0x46e4cc=>{if(_0x46e4cc['element']){const _0x536fd1=_0x46e4cc['element']['cloneNode'](!0x0);_0x1fe6e5['appendChild'](_0x536fd1);}}),_0x1fe6e5['offsetWidth'];const _0xffb3c2=_0x1fe6e5['children'],_0x119c4c=[];return Array['from'](_0xffb3c2)['forEach'](_0x10b917=>{const _0x2fe015=_0x10b917['getBoundingClientRect']()['top'];_0x119c4c['some'](_0x5243cc=>Math['abs'](_0x5243cc-_0x2fe015)<this['_config']['rowDetectionTolerance'])||_0x119c4c['push'](_0x2fe015);}),{'rowCount':_0x119c4c['length']};}['_createMockButton'](){const _0x4075d9=document['createElement']('button');return _0x4075d9['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x4075d9['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x4075d9['textContent']='+\x201',_0x4075d9;}['_testButtonFit'](_0x2f042e,_0x41422e,_0x1dd1e4){this['_renderChipsAndCountRows'](_0x41422e,_0x1dd1e4);const _0x284303=this['_createMockButton']();_0x2f042e['appendChild'](_0x284303),_0x2f042e['offsetWidth'];const _0x5a4e89=[..._0x41422e['children'],_0x284303],_0x4bf58a=[];_0x5a4e89['forEach'](_0x2ba705=>{const _0x3e44dd=_0x2ba705['getBoundingClientRect']()['top'];_0x4bf58a['some'](_0x42bfd6=>Math['abs'](_0x42bfd6-_0x3e44dd)<this['_config']['rowDetectionTolerance'])||_0x4bf58a['push'](_0x3e44dd);});const _0x3e6cc2=_0x4bf58a['length'];return _0x284303['remove'](),_0x3e6cc2<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x3f0487,_0x3e9513){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x3f0487['forEach'](_0x45c857=>{_0x3e9513['includes'](_0x45c857)?this['_overflowChips']['add'](_0x45c857):this['_visibleChips']['add'](_0x45c857);});}['_updateOverflowUI'](_0x24a966){if(_0x24a966>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x24a966>0x0&&this['_showMoreButtonView']){const _0x53d1b0=''+this['_config']['showMoreLabelPrefix']+(_0x24a966<0x63?_0x24a966:'99');this['_showMoreButtonView']['label']=_0x53d1b0;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x2d1ade,_0x44f9fe){this['_distributeChips'](_0x2d1ade,_0x44f9fe),this['_updateOverflowUI'](_0x44f9fe['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x401e4f=>{_0x401e4f[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 _0x317582=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x317582['width']||0x0===_0x317582['height'])return!0x1;const _0xa5390a=window['innerHeight']||document['documentElement']['clientHeight'],_0x204c20=window['innerWidth']||document['documentElement']['clientWidth'];return _0x317582['bottom']>=-0xc8&&_0x317582['top']<=_0xa5390a+0xc8&&_0x317582['right']>=-0xc8&&_0x317582['left']<=_0x204c20+0xc8;}};const fr='ck-ai-chat__feed__context-chips',br='ck-ai-chat-context-chips-wrapper',Sr='ck-ai-chat-context-chips-wrapper-balloon',Rr='ck-ai-chat-controls-button',Or='ck-ai-chat-controls_context_show-more-button',vr='ck-ai-chat-context-controls__show-more-balloon-panel';var kr=class extends _0x1f08de{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x7d16ce,_0x1cfe51,_0x3633d2){super(_0x7d16ce),this['_bodyCollection']=_0x3633d2,this['_createContextChips'](_0x1cfe51);const _0x409e65={'cssClasses':{'showMoreButton':Or+'\x20'+hn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x7d16ce,this['_contextChips'],_0x409e65,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[fr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':br},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x2c208e=this['element']['querySelector']('.'+br);_0x2c208e&&(this['_overflowManager']['setContainerElement'](_0x2c208e),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0xb4b0c3){for(const _0x267e5d of _0xb4b0c3){const _0x586a2b=new mr(this['locale'],_0x267e5d,!0x0,!0x1);this['_contextChips']['add'](_0x586a2b);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x4909fb,_0x479ecf,_0x558a31){super(_0x479ecf),this['_locale']=_0x4909fb,this['_bodyCollection']=_0x558a31,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 kr(this['_locale'],this['options']['contextItems']['filter'](_0x4f869a=>!_0x4f869a['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x1f08de(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']();}},yr=class extends Vn{['capabilities'];constructor(_0x2efb33,_0x46d2ef){super(_0x46d2ef);const {isWebSearchEnabled:_0x3c4ab9,isReasoningEnabled:_0x2336e1}=_0x46d2ef['capabilities'],_0x47bf9f=[];let _0x385c8f='';_0x3c4ab9&&_0x2336e1?(_0x385c8f=us(_0x2efb33,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x47bf9f['push'](xr(at)),_0x47bf9f['push'](xr(_0x4fdc5e))):_0x3c4ab9?(_0x385c8f=us(_0x2efb33,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x47bf9f['push'](xr(at))):_0x2336e1&&(_0x385c8f=us(_0x2efb33,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x47bf9f['push'](xr(_0x4fdc5e))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x385c8f?'':'ck-hidden']}});const _0x2358ac=new _0x1f08de();_0x2358ac['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x47bf9f,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x385c8f]}]}),this['children']['add'](_0x2358ac),this['capabilities']=_0x46d2ef['capabilities'];}};function xr(_0x2f8867){const _0x2991fa=new Yt();return _0x2991fa['content']=_0x2f8867,_0x2991fa;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x239fe7){this['element']=_0x239fe7,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x3177ca of Lr){const _0x2a20da='keydown'!==_0x3177ca;this['element']['addEventListener'](_0x3177ca,this['_onUserEvent']['bind'](this),{'passive':_0x2a20da,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3ac435=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3ac435?'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'](_0x49b22b){if(this['isRunning']){if('keydown'===_0x49b22b['type']){const _0x52d7a7=_0x49b22b['key'];if(!Dr['includes'](_0x52d7a7))return;}_0x49b22b instanceof WheelEvent?_0x49b22b['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x4b916b,scrollHeight:_0x4bf1c7,clientHeight:_0x295025}=this['element'];return _0x4bf1c7-_0x4b916b-_0x295025<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Hr=class extends Vn{constructor(_0x4d9eb8){super(_0x4d9eb8),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']);}},Mr=class extends _0x1f08de{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x3a6a57,_0x24f225){super(_0x3a6a57),this['_bodyCollection']=_0x24f225,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...yn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Pr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x223c22,_0x4d7dbb){let _0x5daa18;return'ai-reply'===_0x223c22?_0x5daa18=new hr(this['locale'],_0x4d7dbb,this['_bodyCollection']):'ai-suggestion-reply'===_0x223c22?(_0x5daa18=new ar(this['locale'],_0x4d7dbb,this['_bodyCollection']),_0x5daa18['bind']('isTrackChangesOn')['to'](this)):_0x5daa18='user-message'===_0x223c22?new Nr(this['locale'],_0x4d7dbb,this['_bodyCollection']):'interaction-header'===_0x223c22?new yr(this['locale'],_0x4d7dbb):'custom-element'===_0x223c22?new Hr(_0x4d7dbb):new tr(_0x4d7dbb),this['children']['add'](_0x5daa18),_0x5daa18;}async['updateReplyItem']({id:_0x119d04,parsedContent:_0x5134d2,renderingStrategy:_0x43d193,abortSignal:_0x1a1ad3}){const _0x53a47e=this['getItemById'](_0x119d04);if(!(_0x53a47e instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x53a47e,'id':_0x119d04,'parsedContent':_0x5134d2});await _0x53a47e['updateContent']({'parsedContent':_0x5134d2,'renderingStrategy':_0x43d193,'abortSignal':_0x1a1ad3});}async['updateWebSources'](_0x22b3dd,_0x44f427){const _0x2d88aa=this['getItemById'](_0x22b3dd);if(_0x2d88aa instanceof ar)_0x2d88aa['updateSources'](_0x44f427);else{if(!(_0x2d88aa instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x2d88aa,'id':_0x22b3dd,'sources':_0x44f427});_0x2d88aa['updateSources'](_0x44f427);}}async['updateSuggestionItem']({id:_0x4fb19c,parts:_0x29d592,abortSignal:_0x2f3fb1,skipLoadingEffects:_0x297440}){const _0x1dd9ac=this['getItemById'](_0x4fb19c);if(!(_0x1dd9ac instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x1dd9ac,'id':_0x4fb19c,'parts':_0x29d592});await _0x1dd9ac['updateContent']({'parts':_0x29d592,'abortSignal':_0x2f3fb1,'skipLoadingEffects':_0x297440});}['updateSuggestionPartState']({id:_0x4cc6ce,index:_0x5cb30d,state:_0x4f3c74}){const _0xeb225=this['getItemById'](_0x4cc6ce);if(!(_0xeb225 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4cc6ce});_0xeb225['updatePartState'](_0x5cb30d,_0x4f3c74);}['setSuggestionPartActive']({id:_0x1fe674,index:_0x2641ba,isActive:_0x5ef7e1}){const _0x2ae0b4=this['getItemById'](_0x1fe674);if(!(_0x2ae0b4 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1fe674});this['children']['filter'](_0x122228=>_0x122228 instanceof ar)['forEach'](_0xac00cd=>{_0xac00cd['setPartActive'](!0x1);}),_0x2ae0b4['setPartActive'](_0x2641ba,_0x5ef7e1);}['markItemAsDone'](_0xfc66cf){this['getItemById'](_0xfc66cf)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x6eb1f9=>_0x6eb1f9['options']['id']);}['removeItem'](_0x47d75d){this['children']['remove'](this['getItemById'](_0x47d75d));}['hasItem'](_0x382c2d){return!!this['children']['find'](_0x1b86c4=>_0x1b86c4['options']['id']['includes'](_0x382c2d));}['scrollToSuggestion'](_0x3cf6bf,_0x3fc813){const _0xedca92=this['getItemById'](_0x3cf6bf);if(!(_0xedca92 instanceof ar))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x3cf6bf,'partIndex':_0x3fc813});const _0x306572=_0xedca92['getPartView'](_0x3fc813);_0x306572?St(_0x306572['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x3cf6bf,'partIndex':_0x3fc813});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x5eefc9=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x5eefc9,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x4dbf87=new Xn(this['locale'],zn['aiFeed']);return _0x4dbf87['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x4dbf87;}['_createFeedItems'](){const _0x388dac=new _0x1f08de(this['locale']);return _0x388dac['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x388dac;}['_createFeedLoader'](){const _0x5cbf3e=new _0x1f08de(this['locale']);return _0x5cbf3e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x1fbbcd=>!_0x1fbbcd)]},'children':this['_createLoaderChildren']()}),_0x5cbf3e;}['_createLoaderChildren'](){const _0x2c2b84=new cr();return _0x2c2b84['isVisible']=!0x0,[_0x2c2b84,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x37f26c){const _0xc9e4b1=this['children']['find'](_0x2c950d=>_0x2c950d['options']['id']['includes'](_0x37f26c));if(!_0xc9e4b1)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x37f26c});return _0xc9e4b1;}['setLoadingMessage'](_0x4843ff){this['set']('loadingMessage',_0x4843ff);}['toggleLoadingSkeleton'](_0x47e40d){this['set']('isLoadingSkeletonVisible',_0x47e40d);}['startAutoScroll'](_0x4cc30d={}){this['scrollManager']['start'](_0x4cc30d);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends jt{['filter'](){let _0x3c252c=0x0;for(const _0x4c1d85 of this['items'])_0x3c252c+=_0x4c1d85['items']['length'];return{'resultsCount':_0x3c252c,'totalItemsCount':_0x3c252c};}};function Ur(_0x2323f3){const _0x34fbd4=[];let _0x24b204=!0x1;for(const _0x3097d5 of Array['from'](_0x2323f3['items'])){if('file'!==_0x3097d5['kind'])continue;if(_0x3097d5['webkitGetAsEntry']()?.['isDirectory']){_0x24b204=!0x0;continue;}const _0x30f4f1=_0x3097d5['getAsFile']();_0x30f4f1&&_0x34fbd4['push'](_0x30f4f1);}return{'files':_0x34fbd4,'hasDirectory':_0x24b204};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x37192e,_0x44d3c6){super(_0x37192e,{'queryView':{'label':'','creator':_0x172dbb,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x37192e),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x44d3c6,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',(_0x2a5b54,_0x29f49c)=>!_0x2a5b54&&!_0x29f49c),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x26df7c,_0x5e6465)=>{this['isUploadInProgress']||this['isEmpty']||_0x26df7c['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x5e6465());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x469764=>this['_handlePaste'](_0x469764)),this['element']['addEventListener']('drop',_0x825217=>this['_handleDrop'](_0x825217));}['_handlePaste'](_0x212ab3){const _0x92648e=_0x212ab3['clipboardData'];if(!_0x92648e)return;const {files:_0x17f1eb,hasDirectory:_0x2a6010}=Ur(_0x92648e),_0x301e63={'files':_0x17f1eb,'plainText':_0x92648e['getData']('text/plain'),'hasDirectory':_0x2a6010,'forceTextAttachment':!0x1,'preventDefault':()=>_0x212ab3['preventDefault']()};this['fire']('promptInputPaste',_0x301e63);}['_handleDrop'](_0x4d6887){const _0x170003=_0x4d6887['dataTransfer'];if(!_0x170003)return;const _0x5b3c36={'files':[],'plainText':_0x170003['getData']('text/uri-list')||_0x170003['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x4d6887['preventDefault']()};this['fire']('promptInputPaste',_0x5b3c36);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x478be7=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x478be7)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x267675=_0x2621bf(_0x478be7);this['fire']('sendUserMessage',_0x267675),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x7dbd15){this['queryView']['fieldView']['set']('placeholder',_0x7dbd15);}['focus'](_0x4a2d1a=!0x1){super['focus'](),_0x4a2d1a&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x247fa2=new Ht(this['locale']);return _0x247fa2['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+on,'isEnabled':!0x1}),_0x247fa2['on']('execute',()=>{this['submit']();}),_0x247fa2;}['setIsUploadInProgress'](_0x1edde4){this['isUploadInProgress']=_0x1edde4;}['_setUpAddContextButtonPositioning'](){const _0x1cf37d=this['locale'],_0xc0199b=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x5bf130=new At(this['queryView']['fieldView']['element']),_0x2f1ab2=new At(this['_addContextButtonView']['element']),_0xa21562=_0x5bf130['width'],_0x511a5e='rtl'===_0x1cf37d['uiLanguageDirection']?'right':'left';_0x5bf130['excludeScrollbarsAndBorders']();const _0x305b31=_0xa21562-_0x5bf130['width']+0x1;this['_addContextButtonView']['element']['style'][_0x511a5e]='calc('+(_0xa21562-_0x2f1ab2['width']-_0x305b31)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0xc0199b),this['on']('render',()=>{_0xc0199b(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0xc0199b();});});}},Fr=class extends _0x1f08de{constructor(_0x5ed245){super(_0x5ed245);const _0x552927=new Yt();_0x552927['content']=_0xd9f44a,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x552927,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x5ed245,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x2c4266){let _0x2b13be=0x0;_0x2c4266['addEventListener']('dragenter',_0x244648=>{_0x244648['dataTransfer']&&(_0x2b13be++,0x1===_0x2b13be&&this['fire']('dragEnter'),_0x2c4266['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x2c4266['addEventListener']('dragover',_0x2aeb0e=>{_0x2aeb0e['dataTransfer']&&_0x2aeb0e['preventDefault']();}),_0x2c4266['addEventListener']('dragleave',()=>{--_0x2b13be<=0x0&&(_0x2b13be=0x0,_0x2c4266['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x2c4266['addEventListener']('drop',_0x11672=>{_0x11672['preventDefault'](),_0x2b13be=0x0,_0x2c4266['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x11672);});}['_handleDrop'](_0x566be3){const _0x40fa19=_0x566be3['dataTransfer'];if(!_0x40fa19)return;const {files:_0x3a51a9,hasDirectory:_0x492e38}=Ur(_0x40fa19),_0x1a9e8b={'files':_0x3a51a9,'plainText':_0x40fa19['getData']('text/uri-list')||_0x40fa19['getData']('text/plain'),'hasDirectory':_0x492e38,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x1a9e8b);}};const Kr='ck-ai-chat__prompt-capabilities',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-controls-button--commands',$r='ck-ai-chat-controls__model-selection',qr='ck-ai-chat-controls__model-selection__item-name',Qr='ck-ai-chat-controls__model-selection__item-description',Xr='ck-ai-chat-controls__model-selection__item-capabilities',zr='n';var jr=class extends _0x1f08de{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x5a028a){super(_0x5a028a),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',_0x5937da=>'selector'===_0x5937da),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x7ed2bb=>_0x7ed2bb?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3745e6=>_0x3745e6),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x3f16af=>_0x3f16af),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x439a3d=>us(this['locale'],_0x439a3d?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x2567de=>_0x2567de),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x1997b3=>us(this['locale'],_0x1997b3?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Kr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x5346bb(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x462d80,_0x4bb3a1){if(_0x4bb3a1)this['set']('modelDisplayMode','hidden');else{const _0x2517a7=0x1===_0x462d80['length'];this['set']('modelDisplayMode',_0x2517a7?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x462d80?.['length'])for(const _0x30ebea of _0x462d80){const _0x2ec14d=new _0x3cc729({'label':_0x30ebea['name'],'withText':!0x0,'role':'menuitemradio','id':_0x30ebea['id'],'model':_0x30ebea});_0x2ec14d['bind']('isOn')['to'](this,'activeModelId',_0x455dcf=>_0x455dcf===_0x30ebea['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x2ec14d,'labelView':new Jr(this['locale'],_0x30ebea)});}}['setWebSearch'](_0x3067d1){this['set']('webSearchActive',_0x3067d1);}['setReasoning'](_0xfcdf66){this['set']('reasoningActive',_0xfcdf66);}['setModel'](_0x337eb9){if(!_0x337eb9)return;this['activeModelId']=_0x337eb9['id'],this['activeModelName']=_0x337eb9['name']||_0x337eb9['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x337eb9['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x337eb9['name']);const _0x2a9cea=_0x337eb9['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x2a9cea),this['_webSearchButton']['set']('isVisible',_0x2a9cea);const _0x527822=_0x337eb9['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x527822),this['_reasoningButton']['set']('isVisible',_0x527822);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x2d3dfe){this['set']('modelSelectorEnabled',!0x1),_0x2d3dfe&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x2857d6=new Ht();return _0x2857d6['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x2857d6['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x2857d6;}['_createReasoningButton'](){const _0x5c5f6e=new Ht();return _0x5c5f6e['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x4fdc5e,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x5c5f6e['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x5c5f6e;}['_createCommandsButton'](){const _0x14a3ba=new Ht();return _0x14a3ba['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x4e0656,'withText':!0x0,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x14a3ba['extendTemplate']({'attributes':{'class':[Yr]}}),_0x14a3ba['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x14a3ba;}['_createModelSelectionDropdown'](){const _0x5ba369=_0x4a2fa7(this['locale']);return _0x5ba369['set']({'panelPosition':'ne','class':[$r]}),_0x5ba369['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':hn}),this['listenTo'](_0x5ba369,'execute',_0x3fdaa2=>{this['fire']('selectModel',_0x3fdaa2['source']['model']);}),_0x5ba369;}['_createModelNameView'](){const _0x27d711=new Zr(this['locale']);return _0x27d711['bind']('text')['to'](this,'activeModelName',_0xcb99ba=>_0xcb99ba??''),_0x27d711['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5efd68=>'name'===_0x5efd68),_0x27d711;}},Jr=class extends Dt{constructor(_0x5c35b5,_0x4b6e7c){super();const _0x5d1f93=this['bindTemplate'],_0x3d7413=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x5d1f93['to']('style'),'id':_0x5d1f93['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x5d1f93['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x4b6e7c['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x3d7413}]}),_0x3d7413['addMany'](this['_getCapabilityParts'](_0x5c35b5,at,'AI_CHAT_SEARCH_WEB',_0x4b6e7c['capabilities']['webSearch']?.['enabled']??!0x1)),_0x3d7413['addMany'](this['_getCapabilityParts'](_0x5c35b5,_0x4fdc5e,'AI_CHAT_REASONING',_0x4b6e7c['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x243b5d,_0x26a304,_0x21fd93,_0x3286f9){const _0x11d7b9=new Yt();_0x11d7b9['content']=_0x26a304;const _0xba050a=new _0x1f08de(_0x243b5d);_0xba050a['setTemplate']({'tag':'span','children':[{'text':us(_0x243b5d,_0x21fd93)+':\x20'}]});const _0x2b4695=new _0x1f08de(_0x243b5d);return _0x2b4695['setTemplate']({'tag':'span','children':[{'text':us(_0x243b5d,_0x3286f9?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x11d7b9,_0xba050a,_0x2b4695];}},Zr=class extends _0x1f08de{constructor(_0x477fa2){super(_0x477fa2),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x4b7803=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x4b7803['if']('isVisible','ck-hidden',_0x46c0e7=>!_0x46c0e7)]},'children':[{'text':_0x4b7803['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x1f08de{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x5338a7){super(_0x5338a7),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'](_0x3ac467=>{this['focusTracker']['add'](_0x3ac467['element']),this['keystrokes']['listenTo'](_0x3ac467['element']);}),_0x472261({'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'](_0x31a751){this['urlInputField']['errorText']=_0x31a751,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x4bce8f=new Ht(this['locale']);return _0x4bce8f['set']({'icon':_0xed123e,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x3396c9,_0x3d6e33,_0x66d687)=>{_0x4bce8f['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x66d687?'':'\x20ck-hidden')]});}),_0x4bce8f;}['_createUrlInputField'](){const _0x17f894=new qt(this['locale'],_0x4a5536);return _0x17f894['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x17f894['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x17f894;}['_createConfirmButton'](){const _0x54c0be=new Ht(this['locale']);return _0x54c0be['set']({'icon':_0x20a950,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x54c0be;}['_setupTemplate'](){const _0x154759=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'});_0x154759['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x154759,{'tag':'div','attributes':{'class':eo},'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',_0x5946f1=>{_0x5946f1['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x356cad,_0x1d54bf)=>{this['clear'](),this['fire']('cancel'),_0x1d54bf();});}['_handleSubmit'](){const _0x3dcef4=this['getValue']()['trim']();_0x3dcef4?this['_isValidUrl'](_0x3dcef4)?(this['clearError'](),this['fire']('submitUrl',_0x3dcef4)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x2af3d9=this['getValue']()['trim'](),_0x9b8f53=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x2af3d9['length']>0x0&&!_0x9b8f53;}['_isValidUrl'](_0x5a5409){try{return!!new URL(_0x5a5409);}catch{return!0x1;}}};const so='ck-ai-chat-resources__item',no='ck-ai-chat-resources__item--in-context',ro='ck-ai-chat-resources__item-title',oo='ck-ai-chat-resources__item__icon';var ao=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x520be2,_0x2e4b07){super(_0x520be2),this['resource']=_0x2e4b07,this['set']('isInContext',!!_0x2e4b07['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x532216){if(_0x532216['isInContext'])return _0x20a950;switch(_0x532216['type']){case'document':return _0x56c092;case'web-resource':return _0x353a80;case'file':case'text':return _0xd9f44a;default:return _0x4ea467;}}['highlightText'](_0x2cdf54){if(!_0x2cdf54||''===_0x2cdf54['trim']())return void this['_titleView']['highlightText'](null);const _0x3e448a=new RegExp(_0x265956(_0x2cdf54),'gi');this['_titleView']['highlightText'](_0x3e448a);}['updateResourceState'](_0x500e69){this['resource']['isInContext']=_0x500e69,this['isInContext']=_0x500e69,this['_updateIcon']();}['_createTitleView'](){const _0x4eced2=new Wt();return _0x4eced2['text']=this['resource']['label'],_0x4eced2['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x4eced2;}['_createIconView'](){const _0x5ed87e=new Yt();return _0x5ed87e['content']=this['getResourceIcon'](this['resource']),_0x5ed87e;}['_setupTemplate'](){const _0x30d738=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x30d738['if']('isVisible','ck-hidden',_0x5b1af6=>!_0x5b1af6),_0x30d738['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x30d738['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends jt{['_source'];constructor(_0x290e42,_0x148b2c){super(_0x290e42),this['_source']=_0x148b2c,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x16ba4c,_0xb46c0c){this['items']['clear']();let _0x1cf36d=_0x16ba4c;if(this['_source']['useDefaultFiltering']&&_0xb46c0c&&''!==_0xb46c0c['trim']()){const _0x5d7d57=new RegExp(_0xb46c0c['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x1cf36d=_0x16ba4c['filter'](_0xabba6f=>_0x5d7d57['test'](_0xabba6f['label']));}for(const _0x6c0bc7 of _0x1cf36d){const _0x4c0769=new ao(this['locale'],_0x6c0bc7);_0x4c0769['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x6c0bc7);}),this['items']['add'](_0x4c0769);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0xb46c0c);}['highlightText'](_0x1cd568){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x338207=>{_0x338207['highlightText'](_0x1cd568);});}['updateResourceState'](_0xf7aaaa,_0x1be0f3){for(const _0x23e846 of this['items']){const _0x40566f=_0x23e846;_0x40566f['resource']['id']===_0xf7aaaa&&_0x40566f['updateResourceState'](_0x1be0f3);}}['_handleResourceSelection'](_0x4814fa,_0x33c5a0){this['fire']('addResourceToContext',{'source':_0x4814fa,'resource':_0x33c5a0});}},lo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x2e712b){const t=_0x2e712b['t'],_0x2c53fd={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x4a5536,'label':us(_0x2e712b,'AI_CHAT_SEARCH_RESOURCES')};super(_0x2e712b,_0x2c53fd['creator']),this['label']=_0x2c53fd['label'],this['_viewConfig']=_0x2c53fd,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x2e712b,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x2ed30f){this['fire']('search',_0x2ed30f);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x343e03,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x38edda,t){this['resetButtonView']=new Ht(_0x38edda),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x5ea60e,'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',_0x50100c=>!_0x50100c),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);}},uo=class extends _0x1f08de{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x370e97,_0x447134){super(_0x370e97),this['_source']=_0x447134['source'],this['_searchInputVisibleFrom']=_0x447134['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 _0x3994e5([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new lo(this['locale']);}['_createSearchSection'](){const _0x4c5f1d=new _0x1f08de(this['locale']);return _0x4c5f1d['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x32efcd,_0x13cede)=>{this['loadResources'](_0x13cede),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x13cede);}),_0x4c5f1d;}['_createResourcesListView'](){const _0x211642=new co(this['locale'],this['_source']);return _0x211642['delegate']('addResourceToContext')['to'](this),_0x211642['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x211642;}['_createSkeletonView'](){const _0x16470d=new Xn(this['locale'],zn['aiChatResources']);return _0x16470d['bind']('isVisible')['to'](this,'isLoading'),_0x16470d;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x56275f){const _0x52641a=vt();this['_latestLoadResourcesUid']=_0x52641a,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x56275f,'uid':_0x52641a}),this['isLoading']=!0x0;}['setResources'](_0x2514e2,_0x241040){if(_0x241040&&_0x241040!==this['_latestLoadResourcesUid'])return;const _0x271fe2=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x2514e2,_0x271fe2),_0x2514e2['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0xcc696d,_0x2801e9){this['_resourcesListView']['updateResourceState'](_0xcc696d,_0x2801e9);}};const _o='ck-ai-chat-context-controls__source-balloon-panel',go='ck-button-icon\x20ck-button-back',Ao='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Io=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x152478,_0x2021c0,_0x168966){this['_locale']=_0x152478,this['_bodyCollection']=_0x2021c0,this['_config']=_0x168966;}['showSourceResourcesBalloon']({source:_0x1d2bc6,withBackButton:_0x3fd7f1}){let _0x546609=this['_sourceResourceBalloons']['get'](_0x1d2bc6['id']);_0x546609||(_0x546609=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x1d2bc6['id'],_0x546609),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x546609)),this['_addSourceResourceContent']({'balloonPanel':_0x546609,'source':_0x1d2bc6,'withBackButton':_0x3fd7f1}),_0x546609['show']();const _0xd362c0=this['_config']['getTargetElement']();_0xd362c0&&_0x546609['pin']({'target':_0xd362c0,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x57b0a8,_0x3c281c,_0xacc501){const _0x12e1ce=this['_sourceResourceBalloons']['get'](_0x57b0a8);if(!_0x12e1ce)return;const _0x570c7f=this['_getResourcesViewFromBalloon'](_0x12e1ce);_0x570c7f&&(_0x570c7f['setResources'](_0x3c281c,_0xacc501),_0x570c7f['once']('change:isLoading',()=>{_0x12e1ce['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0xc5fec9){const _0x1364cc=this['_sourceResourceBalloons']['get'](_0xc5fec9);_0x1364cc&&requestAnimationFrame(()=>{_0x1364cc['hide'](),this['_sourceResourceBalloons']['delete'](_0xc5fec9),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x52dd13 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x52dd13);}['isAnyResourceBalloonVisible'](){for(const _0x5aa937 of this['_sourceResourceBalloons']['values']())if(_0x5aa937['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x494c9d,_0x57b28f,_0x88e9b8){const _0x44de8c=this['_sourceResourceBalloons']['get'](_0x494c9d);if(!_0x44de8c||!_0x44de8c['isVisible'])return;const _0x2ef9ec=this['_config']['getTargetElement']();if(!_0x2ef9ec)return;_0x44de8c['pin']({'target':_0x2ef9ec,'limiter':this['_config']['getLimiterElement']()});const _0x5e7d0b=this['_getResourcesViewFromBalloon'](_0x44de8c);_0x5e7d0b&&_0x5e7d0b['updateResourceState'](_0x57b28f,_0x88e9b8);}['destroy'](){for(const _0x114f36 of this['_sourceResourceBalloons']['values']())_0x114f36['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x1685a5=new yt(this['_locale']);return _0x1685a5['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x1685a5),_0x1685a5;}['_addSourceResourceContent']({balloonPanel:_0x30ff8a,source:_0x2490f4,withBackButton:_0x106b04}){_0x30ff8a['content']['clear']();const _0x5d71a8=this['_createBalloonHeader']({'balloonPanel':_0x30ff8a,'source':_0x2490f4,'withBackButton':_0x106b04});_0x30ff8a['content']['add'](_0x5d71a8);const _0x395b33=this['_createBalloonResourcesView'](_0x2490f4);_0x30ff8a['content']['add'](_0x395b33);}['_createBalloonHeader']({balloonPanel:_0x2a2599,source:_0x293f3f,withBackButton:_0x22ec5d}){const _0x1a88c0=new Ft(this['_locale'],{'label':_0x293f3f['label'],'class':Ao});return _0x22ec5d&&_0x1a88c0['children']['add'](this['_createBackButton'](_0x2a2599),0x0),_0x1a88c0;}['_createBackButton'](_0x34d608){const _0x4ea2da=new Ht(this['_locale']);return _0x4ea2da['set']({'icon':_0xed123e,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x4ea2da['on']('execute',()=>{_0x34d608['hide'](),this['_config']['onBackToContext']();}),_0x4ea2da;}['_createBalloonResourcesView'](_0x22cc9e){const _0x564217=new uo(this['_locale'],{'source':_0x22cc9e,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x564217['on']('loadSourceResources',(_0x5008da,_0x4b874e)=>{this['_config']['onLoadSourceResources'](_0x4b874e);}),_0x564217['on']('addResourceToContext',(_0x106cc4,_0xb06854)=>{this['_config']['onResourceSelected'](_0xb06854['source'],_0xb06854['resource']),this['closeSourceResourceBalloon'](_0x22cc9e['id']);}),_0x564217;}['_getResourcesViewFromBalloon'](_0x465566){const _0x9aa863=_0x465566['content']['get'](0x1);return _0x9aa863 instanceof uo?_0x9aa863:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0xd1a6f6){_0x563b8b({'emitter':_0xd1a6f6,'contextElements':[_0xd1a6f6['element']],'callback':()=>{_0xd1a6f6['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0xd1a6f6['isVisible']});}};const po=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],mo='ck-ai-chat-context-controls',Eo='ck-ai-chat-context-controls__pending-contexts',To='ck-ai-chat-context-controls__add-context-balloon-panel',wo='ck-ai-chat-context-controls__add-context-button',Co='ck-ai-chat-context-controls__url-balloon-panel',fo='ck-ai-chat-context-controls__balloon-button',bo='ck-ai-chat-context-controls__balloon-button-source',So='ck-ai-chat-controls-button',Ro='ck-ai-chat-context-chips-wrapper-balloon',Oo='ck-ai-chat-controls_context_show-more-button',vo='ck-ai-chat-context-controls__show-more-balloon-panel',ko='ck-ai-chat',No=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x1f08de{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x6b0af6,_0x13058a){super(_0x6b0af6),this['bodyCollection']=_0x13058a['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x6b0af6),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x6b0af6),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x6b0af6),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x6b0af6,_0x13058a);const _0x108b0f={'cssClasses':{'showMoreButton':Oo+'\x20'+hn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x6b0af6,this['_currentContextsChips'],_0x108b0f,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'](_0x5579fd,_0x22275f){const _0x2b8050=this['_createContextButton'](_0x5579fd,'current',!0x0,_0x22275f);this['_addContextToCollection'](_0x2b8050,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x5108a7){this['_removeContextFromCollection'](_0x5108a7,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x5108a7,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0xf06d78,_0x1be804){let _0x36a671=this['_currentContextsChips']['find'](_0xffa740=>_0xffa740['id']===_0xf06d78);_0x36a671||(_0x36a671=this['_overflowManager']['overflowChips']['find'](_0x37f212=>_0x37f212['id']===_0xf06d78)),_0x36a671&&(_0x36a671['isLoading']=_0x1be804);}['setConversationContext'](_0x3b6879){this['_conversationContextsChips']['clear']();for(const _0x22672d of _0x3b6879){const _0x2bca41=this['_createContextButton'](_0x22672d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x2bca41,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x109235,_0xa6fc12,_0x12894b){this['_resourcesBalloonView']['updateResourceState'](_0x109235,_0xa6fc12,_0x12894b);}['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:_0x1cd68d,withBackButton:_0x4519d3}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x1cd68d,'withBackButton':_0x4519d3}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x3f70d3,_0x277677,_0x2b09dd,_0x225afc){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x3f70d3,_0x2b09dd,_0x225afc);}['closeSourceResourceBalloon'](_0x56cbe7){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x56cbe7),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x173d52){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x173d52),this['_setAddContextButtonEnabled'](_0x173d52);}['_setAddContextButtonEnabled'](_0x2a0538){const _0x387c2d=!_0x2a0538['document']['isHidden']&&_0x2a0538['document']['enabled'],_0x552e48=_0x2a0538['urls']['enabled'],_0x1767aa=_0x2a0538['files']['enabled'],_0x111ae9=_0x2a0538['sources']['length']>0x0,_0x1c8f07=_0x2a0538['customItems']&&_0x2a0538['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x387c2d||_0x552e48||_0x1767aa||_0x111ae9||_0x1c8f07;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[mo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Eo},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x47c80f){const _0x43b69d=new Ht(_0x47c80f);return _0x43b69d['set']({'label':us(_0x47c80f,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+hn,'icon':_0x11f5f7,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x43b69d;}['_createAddContextBalloonPanelView'](_0x57763){return this['_createBaseBalloonPanel'](_0x57763,To);}['_createUrlBalloonPanelView'](_0x139ff6){const _0x658954=this['_createBaseBalloonPanel'](_0x139ff6,Co);return this['_addUrlContent'](_0x658954,_0x139ff6),_0x658954;}['_createResourcesBalloonView'](_0x3e6d99,_0x1e6dc8){const _0x5d8cb5={'searchInputVisibleFrom':_0x1e6dc8['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x2e1bee,_0x181ba1)=>{this['fire']('addResourceToContext',{'source':_0x2e1bee,'resource':_0x181ba1});},'onLoadSourceResources':_0x3e2c56=>{this['fire']('loadSourceResources',_0x3e2c56);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x3e6d99,_0x1e6dc8['bodyCollection'],_0x5d8cb5);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x8676db,_0xb8ab0f){const _0x4de1c3=new yt(_0x8676db);return _0x4de1c3['extendTemplate']({'attributes':{'class':_0xb8ab0f}}),this['bodyCollection']['add'](_0x4de1c3),_0x4de1c3;}['_setBalloonPanelContent'](_0x253698,_0x1c2a87,_0x374750){if(_0x253698['content']['clear'](),!_0x374750['document']['isHidden']&&_0x374750['document']['enabled']){const _0x404862=this['_createBalloonButton'](_0x1c2a87,{'label':us(_0x1c2a87,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x56c092});_0x404862['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x253698['content']['add'](_0x404862);}if(_0x374750['urls']['enabled']){const _0x123104=this['_createBalloonButton'](_0x1c2a87,{'label':us(_0x1c2a87,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x353a80});_0x123104['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x253698['content']['add'](_0x123104);}if(_0x374750['files']['enabled']){const _0x1b5dc3=new Bt(_0x1c2a87);_0x1b5dc3['set']({'label':us(_0x1c2a87,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0xe745fb,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x1b5dc3['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x1b5dc3['on']('done',(_0xaf3126,_0x4f5efa)=>{this['fire']('addFileToContext',_0x4f5efa);}),_0x1b5dc3['tooltip']=!0x0,_0x253698['content']['add'](_0x1b5dc3);}for(const _0x4a72fc of _0x374750['sources']){const _0x46a7bf=this['_createBalloonButton'](_0x1c2a87,{'label':_0x4a72fc['label'],'icon':_0x4a72fc['icon']||_0x4ea467,'type':'source'});_0x253698['content']['add'](_0x46a7bf),_0x46a7bf['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x4a72fc,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x2b36b4 of _0x374750['customItems']||[]){const _0x32bbe7=this['_createBalloonButton'](_0x1c2a87,{'label':_0x2b36b4['label'],'icon':_0x2b36b4['icon']||_0x4ea467,'type':'customItem'});_0x253698['content']['add'](_0x32bbe7),_0x32bbe7['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x2b36b4);});}this['_hasExactlyOneSource']=0x1===_0x253698['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x41324c,_0x1928e4){this['_urlInputView']=new io(_0x1928e4),this['_urlInputView']['on']('submitUrl',(_0x4df06c,_0x16c734)=>{this['_handleUrlSubmit'](_0x16c734);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});}),_0x41324c['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x51ca9a,_0x4bda8e){const _0x3c1284='source'===_0x4bda8e['type']?new xo(_0x51ca9a):new Ht(_0x51ca9a);return _0x3c1284['set']({'label':_0x4bda8e['label'],'icon':_0x4bda8e['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x3c1284;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x563b8b({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x463905){const _0x2bcb5a=this['_addContextBalloonConfig'];_0x2bcb5a['buttonView']['isOn']=_0x463905,_0x463905?_0x2bcb5a['balloonView']['show']():_0x2bcb5a['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x53c186,buttonView:_0x32d738,hideMethod:_0x2f056b}=this['_addContextBalloonConfig'];_0x563b8b({'emitter':_0x53c186,'contextElements':[_0x53c186['element'],_0x32d738['element']],'callback':()=>{_0x2f056b();},'activator':()=>_0x32d738['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x25ce4b,_0x37d9b4,_0x4c3fb7=!0x1,_0x1873b2=!0x1){const _0x2488cb='conversation'===_0x37d9b4||!0x0===_0x25ce4b['isReadOnly'],_0x4c427e=new mr(this['locale'],_0x25ce4b,_0x2488cb,_0x4c3fb7,_0x1873b2);return _0x2488cb||_0x4c427e['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x4c427e['id']);}),_0x4c427e;}['_addContextToCollection'](_0x290daa,_0x25d5cc){_0x25d5cc['add'](_0x290daa,0x0);}['_removeContextFromCollection'](_0x29d39c,_0x4a86ae){const _0x5a7c85=_0x4a86ae['find'](_0x101093=>_0x101093['id']===_0x29d39c);_0x5a7c85&&_0x4a86ae['remove'](_0x5a7c85);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x123bec){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x123bec);}},xo=class extends Ht{['arrowView'];constructor(_0x430e54){super(_0x430e54),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[bo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x267ca1=new Yt();return _0x267ca1['content']=_0x3a4797,_0x267ca1['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x267ca1;}},Lo=class extends _0x1f08de{['_cancelButtonView'];['_loaderView'];constructor(_0x9343ea){super(_0x9343ea),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 _0x18d388=new Ht(this['locale']);return _0x18d388['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':an+'\x20ck-ai-button-stop-generating','icon':it}),_0x18d388['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x18d388;}['_createLoaderView'](){const _0x1e626d=new _0x1f08de(this['locale']);return _0x1e626d['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')}]}),_0x1e626d;}},Do=class extends _0x1f08de{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x147122,_0x5a9d05){super(_0x147122),this['_filesEnabled']=_0x5a9d05['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x147122,{'bodyCollection':_0x5a9d05['bodyCollection'],'searchInputVisibleFrom':_0x5a9d05['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x147122),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x147122),this['_loaderView']=this['_createLoaderView'](_0x147122),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x147122),this['_dropZoneView']=new Fr(_0x147122),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'](...po)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x223ac0=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x223ac0['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x223ac0['if']('isLoading','ck-hidden',_0x2f0b5b=>_0x2f0b5b||!this['isModelAvailable']),_0x223ac0['if']('isModelAvailable','ck-hidden',_0x36692a=>!_0x36692a||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x223ac0['if']('isLoading','ck-hidden',_0x4d42be=>!_0x4d42be)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x223ac0['if']('isModelAvailable','ck-hidden',_0x1a04e7=>_0x1a04e7)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x563b8b({'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'](_0x4541dd,_0x2b0b4b){return new yo(_0x4541dd,_0x2b0b4b);}['_createPromptInputView'](_0x5c50f4){return new Gr(_0x5c50f4,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x3520a4){return new jr(_0x3520a4);}['_createLoaderView'](_0x210602){return new Lo(_0x210602);}['_createModelUnavailableMessageView'](_0x4eef71){const _0x5b9ca4=new Po(_0x4eef71);return _0x5b9ca4['delegate']('startConversation')['to'](this),_0x5b9ca4;}['_handlePromptInputFocus'](_0x2cba9a,_0x5d794a,_0x45d164){_0x45d164?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x53cc0b,_0x42b89f){this['_contextPanelView']['addContextItem'](_0x53cc0b,_0x42b89f);}['removeContextItem'](_0x844a46){this['_contextPanelView']['removeContextItem'](_0x844a46);}['setContextItemLoading'](_0x2a6cb1,_0xc85eaf){this['_contextPanelView']['setContextItemLoading'](_0x2a6cb1,_0xc85eaf);}['setIsUploadInProgress'](_0xb9a76c){this['_promptInputView']['setIsUploadInProgress'](_0xb9a76c);}['setConversationContext'](_0x542d54){this['_contextPanelView']['setConversationContext'](_0x542d54);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x342128,_0x22e833,_0x11a2f6){this['_contextPanelView']['updateResourceState'](_0x342128,_0x22e833,_0x11a2f6);}['setWebSearch'](_0xccd57b){this['_promptCapabilitiesView']['setWebSearch'](_0xccd57b);}['setReasoning'](_0x2ddedb){this['_promptCapabilitiesView']['setReasoning'](_0x2ddedb);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x3a0f06){this['_contextPanelView']['setAddContextOptions'](_0x3a0f06);}['setInputPlaceholder'](_0x40c4a5){this['_promptInputView']['setPlaceholderText'](_0x40c4a5);}['setModelList'](_0x5b0cc1,_0x5d3878){this['_promptCapabilitiesView']['setModelList'](_0x5b0cc1,_0x5d3878);}['setModel'](_0x4b6761){_0x4b6761?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x4b6761)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x288ce1){this['_promptCapabilitiesView']['disableModelSelector'](_0x288ce1);}['populateSourceResourceBalloon'](_0x19a183,_0x52f646,_0x40eba5,_0x1d4d8a){this['_contextPanelView']['populateSourceResourceBalloon'](_0x19a183,_0x52f646,_0x40eba5,_0x1d4d8a);}['closeSourceResourceBalloon'](_0x3d1dc4){this['_contextPanelView']['closeSourceResourceBalloon'](_0x3d1dc4);}['focusPromptInput'](_0x1f4698=!0x1){this['_promptInputView']['focus'](_0x1f4698);}['setPromptInputValue'](_0x5d58dc){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x5d58dc;}},Po=class extends _0x1f08de{constructor(_0x92de68){super(_0x92de68);const _0x5b2cfd=new Ht(_0x92de68);_0x5b2cfd['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x5b2cfd['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'},_0x5b2cfd]}]});}},Ho=class extends Ft{['resizeButton'];constructor(_0x4d59c2,_0x43e7b0){super(_0x4d59c2,{'label':_0x43e7b0['label'],'class':'ck-ai-header\x20'+_0x43e7b0['class'],'icon':_0x43e7b0['icon']}),this['set']('isMaximized',!0x1),_0x43e7b0['content']&&this['children']['add'](_0x43e7b0['content']),_0x43e7b0['showResizeButton']&&(this['resizeButton']=cn(_0x4d59c2,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x1f08de{constructor(_0x3c8acf){super(_0x3c8acf),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x3c8acf,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x27e431,_0x42bdd6){const _0x53ab1e=new Ht(_0x27e431);return _0x53ab1e['set']({'label':us(_0x27e431,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3560b9,'class':'ck-ai-chat__start-conversation\x20'+an}),_0x53ab1e['on']('execute',()=>{_0x42bdd6['fire']('startConversation');}),_0x53ab1e;}var Uo=class extends _0x1f08de{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0xda2e5d,_0x348941){super(_0xda2e5d),this['_bodyCollection']=ln(_0xda2e5d);const _0x586e58=Vo(_0xda2e5d,this);this['chatHeader']=new Ho(_0xda2e5d,{'label':us(_0xda2e5d,'AI_CHAT_HEADING'),'icon':_0x37c71d,'class':'ck-ai-header_chat','content':_0x586e58,'showResizeButton':_0x348941['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0xda2e5d,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0xda2e5d,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x348941['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x348941['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0xda2e5d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0xda2e5d['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x50573c,_0x52a1f3,_0x1fbcf8,_0x56348b){this['chatControls']['populateSourceResourceBalloon'](_0x50573c,_0x52a1f3,_0x1fbcf8,_0x56348b);}['closeSourceResourceBalloon'](_0x1827df){this['chatControls']['closeSourceResourceBalloon'](_0x1827df);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x5bb7a3{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(_0x188b13){super(_0x188b13);const _0x5cd281=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x5cd281['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'](_0x5cd281),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x1e2dfe,{showDiff:_0x497af4})=>{this['showDiff']=_0x497af4;}),this['disableControls'](),_0x5cd281['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x37c71d,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5cd281['view'],'isMaximized',_0x3bc60d=>_0x3bc60d),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x296b7f=>_0x296b7f),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x15baad){const _0x5d9241=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'](_0x15baad['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x5d9241}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x3917eb,staticMessage:_0xd1b577}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3917eb,'initialContent':'<p>'+_0xd1b577+'</p>'});});}async['addFeedItemUserMessage'](_0x22455d){const _0x1a9fff=_0x22455d['attributes']?.['displayedPrompt']||_0x22455d['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x22455d['contextItems']['values']()),'initialContent':'<p>'+_0x1a9fff+'</p>','id':_0x22455d['id']});});}async['addFeedItemError']({errorMessage:_0x216b0a,id:_0x23fba0}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x216b0a+'</p>','id':_0x23fba0});});}async['addFeedItemAIReply'](_0x59864a){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x59864a['interactionId']+':'+_0x59864a['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x296f51){const _0x163039=ds(this['context']),_0xe6128f=_0x163039['map'](_0x1a9ae2=>_0x1a9ae2['config']['get']('ai.availableReplyActions')||[...er]);let _0x2c2299=_0xe6128f['reduce']((_0x2ed4a8,_0x272089)=>_0x2ed4a8['filter'](_0x3cd095=>_0x272089['includes'](_0x3cd095)),_0xe6128f[0x0]||[...er]);const _0x4bbfe5=_0x163039['every'](_0x3df4ae=>_0x3df4ae['plugins']['has']('TrackChanges')),_0x2a031f=_0x163039['map'](_0x134e50=>_0x134e50['commands']['get']('trackChanges'));return _0x4bbfe5?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x2a031f,'value',(..._0x389d23)=>_0x389d23['some'](_0x3831ba=>_0x3831ba))):_0x2c2299=_0x2c2299['filter'](_0x108f69=>'insertSuggestion'!=_0x108f69),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x296f51['interactionId']+':'+_0x296f51['id'],'areActionsDisabled':_0x296f51['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x2c2299}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x17232d,_0x7f8ceb){return this['_promiseQueue']['enqueue'](async()=>{const _0xbfed5c=this['_view']['chatFeed']['children']['last'];if(_0xbfed5c instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0xbfed5c),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x17232d['id'],'capabilities':{'isWebSearchEnabled':_0xbfed5c['capabilities']['isWebSearchEnabled']||_0x7f8ceb['isWebSearchEnabled'],'isReasoningEnabled':_0xbfed5c['capabilities']['isReasoningEnabled']||_0x7f8ceb['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x17232d['id'],'capabilities':_0x7f8ceb});});}async['addFeedItemCustomElement'](_0x434b12,_0x4ae7df){let _0x32bb9f;return await this['_promiseQueue']['enqueue'](async()=>{_0x32bb9f=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x434b12,'id':_0x4ae7df});}),_0x32bb9f;}['removeFeedItem'](_0x56365e){this['_view']['chatFeed']['removeItem'](_0x56365e);}['hasFeedItem'](_0x571b52){return this['_view']['chatFeed']['hasItem'](_0x571b52);}['updateFeedInteractionHeader'](_0x312cf0){const _0x19f0a5=this['_view']['chatFeed']['children']['find'](_0x846046=>_0x846046['options']['id']==_0x312cf0['id']&&_0x846046 instanceof yr);_0x19f0a5&&_0x19f0a5['set']('isVisible',_0x312cf0['isVisible']);}async['updateFeedItemAIReplyContent'](_0xa8a78c){const _0x4b6a89=_0xa8a78c['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1a6cc2=>{await this['_view']['chatFeed']['updateReplyItem']({..._0xa8a78c,'abortSignal':_0x1a6cc2,'renderingStrategy':_0x4b6a89}),_0xa8a78c['isDone']&&this['markFeedItemAsDone'](_0xa8a78c['id']);});}['updateFeedItemAIReplySources'](_0x4b3ce4,_0x44c4bf){this['_view']['chatFeed']['updateWebSources'](_0x4b3ce4,_0x44c4bf);}async['updateFeedItemAIReplySuggestionContent'](_0x24cb2c){return this['_promiseQueue']['enqueue'](async _0x143bb6=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x24cb2c,'abortSignal':_0x143bb6}),_0x24cb2c['isDone']&&this['markFeedItemAsDone'](_0x24cb2c['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0xa89a42){this['_view']['chatFeed']['updateSuggestionPartState'](_0xa89a42);}['setFeedItemAIReplySuggestionPartActive'](_0x3ebad0){this['_view']['chatFeed']['setSuggestionPartActive'](_0x3ebad0);}['markFeedItemAsDone'](_0x32485a){this['_view']['chatFeed']['markItemAsDone'](_0x32485a);}['removeFeedInteraction'](_0x19932e){this['_view']['chatFeed']['getItemIds']()['filter'](_0x4b0910=>_0x4b0910['startsWith'](_0x19932e))['forEach'](_0x24cee4=>this['_view']['chatFeed']['removeItem'](_0x24cee4));}['startInteraction'](){const _0x12edce=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x12edce),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x2488a0){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x5c0d1c=>_0x5c0d1c['startsWith'](_0x2488a0['id']))['forEach'](_0x54140c=>this['markFeedItemAsDone'](_0x54140c)),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'](_0x461923,_0x4c95ac){this['_view']['chatControls']['addContextItem'](_0x461923,_0x4c95ac);}['removeContextItem'](_0x14d24a){this['_view']['chatControls']['removeContextItem'](_0x14d24a);}['setContextItemLoading'](_0x58c5c5,_0xb3e868){this['_view']['chatControls']['setContextItemLoading'](_0x58c5c5,_0xb3e868);}['setIsUploadInProgress'](_0x482b52){this['_view']['chatControls']['setIsUploadInProgress'](_0x482b52);}['setConversationContext'](_0x237a48){this['_view']['chatControls']['setConversationContext'](_0x237a48);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x14c92f,_0x37076c,_0x5f3b32){this['_view']['chatControls']['updateResourceState'](_0x14c92f,_0x37076c,_0x5f3b32);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x66bd1d){this['_view']['chatControls']['setAddContextOptions'](_0x66bd1d);}['updateCapabilities'](_0x4cdc94){this['_view']['chatControls']['setWebSearch'](_0x4cdc94['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x4cdc94['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x4cdc94));}['setSelectedModel'](_0x55122c,_0x45a7d2){this['_view']['chatControls']['setModel'](_0x55122c),_0x45a7d2&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x3f7379){this['feedItemRenderingStrategy']=_0x3f7379;}['toggleLoadingSkeleton'](_0x38ad5c){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x38ad5c);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x331287,_0xfd47a0=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0xfd47a0&&!pt()&&_0x331287['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x331287);this['_view']['chatHeader']['label']=_0x331287;}['setLoadingMessage'](_0x817a15){this['_view']['chatFeed']['setLoadingMessage'](_0x817a15);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x360048){let _0x1c5990=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x360048[_0x1c5990],_0x1c5990++,_0x1c5990===_0x360048['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x500bdc){return _0x500bdc['isWebSearchEnabled']&&_0x500bdc['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x500bdc['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x500bdc['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x594246){return _0x594246?_0x594246['isWebSearchEnabled']&&_0x594246['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x594246['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x594246['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'](_0x11030b,_0x36f476,_0x3a9907,_0x453ea4){this['_view']['populateSourceResourceBalloon'](_0x11030b,_0x36f476,_0x3a9907,_0x453ea4);}['closeSourceResourceBalloon'](_0x8c4b93){this['_view']['closeSourceResourceBalloon'](_0x8c4b93);}['setPromptInputValue'](_0x967818){this['_view']['chatControls']['setPromptInputValue'](_0x967818);}['focusPromptInput'](_0x4bb8c2=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x4bb8c2);}['scrollFeedToSuggestion'](_0x5c3e78,_0x5b8cc5){this['_view']['chatFeed']['scrollToSuggestion'](_0x5c3e78,_0x5b8cc5);}['startAutoScroll'](_0x2f84d2={}){this['_view']['chatFeed']['startAutoScroll'](_0x2f84d2);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends jt{['sections'];constructor(_0x9e561d,_0xf5df4c){super(_0x9e561d),this['sections']=_0xf5df4c,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x333a0d){let _0x5dac41=0x0,_0x46bff7=0x0;for(const _0x250c39 of this['sections']){const {resultsCount:_0x23e804,totalItemsCount:_0x1f676f}=_0x250c39['filter'](_0x333a0d);_0x5dac41+=_0x23e804,_0x46bff7+=_0x1f676f;}return{'resultsCount':_0x5dac41,'totalItemsCount':_0x46bff7};}},Fo=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0xfc11b4,{title:_0x354703,items:_0x362274}){super(_0xfc11b4);const _0x419ec4=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x354703,this['itemsViews']=_0x362274;const _0x37ac15=new _0x1f08de(_0xfc11b4);_0x37ac15['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0xfc11b4),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x419ec4['if']('isVisible','ck-hidden',_0x149a04=>!_0x149a04)]},'children':[_0x37ac15,this['_itemsListView']]});}['filter'](_0x2258f1){const _0x409015=this['itemsViews']['length'];let _0x19b74d=0x0;for(const _0xa4d24 of this['itemsViews'])_0x2258f1?(_0xa4d24['isVisible']=!!_0xa4d24['isMatching'](_0x2258f1),_0xa4d24['highlightText'](_0x2258f1)):(_0xa4d24['isVisible']=!0x0,_0xa4d24['highlightText'](null)),_0xa4d24['isVisible']&&_0x19b74d++;return this['isVisible']=_0x19b74d>0x0,{'resultsCount':_0x19b74d,'totalItemsCount':_0x409015};}['getItem'](_0x58d4ec){return this['itemsViews']['find'](_0x3fff82=>_0x3fff82['id']===_0x58d4ec);}['removeItem'](_0x47351e){const _0x8e52e5=this['itemsViews']['indexOf'](_0x47351e);-0x1!==_0x8e52e5&&(this['itemsViews']['splice'](_0x8e52e5,0x1),this['_itemsListView']['items']['remove'](_0x47351e));}};const Ko=/* #__PURE__ -- @preserve */
34
- _0xecc157(zt);var Wo=class AIChatHistoryListItemView extends Ko{['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(_0x385206,_0x5961bf){super(_0x385206);const _0x1bd15e=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x5961bf['pinned']),this['set']('loadingState',null),this['set']('title',_0x5961bf['title']),this['id']=_0x5961bf['id'];const {createdAt:_0x274738,active:_0x24de7c=!0x1}=_0x5961bf;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x390502=this['_createCheckView'](),_0x4ba009=this['_createPinButtonView'](_0x385206),_0x931e9f=this['_createMenuDropdownView'](),_0x4b3224=this['_createEditInputView'](_0x385206),_0x1d68f0=this['_createAcceptEditButtonView'](_0x385206,_0x4b3224),_0x3a160d=this['_createCancelEditButtonView'](_0x385206);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x4ba009),this['actions']['add'](_0x931e9f),this['on']('change:isEdit',(_0x4e35b5,_0x30cab5,_0x4e50ed)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4e50ed?(this['actions']['add'](_0x1d68f0),this['actions']['add'](_0x3a160d),this['mainContent']['add'](_0x4b3224),_0x4b3224['element']['value']=this['title']||'',_0x4b3224['element']['focus']()):(this['actions']['add'](_0x4ba009),this['actions']['add'](_0x931e9f),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x24de7c?'ck-ai-chat-history__item--active':'',_0x1bd15e['if']('isVisible','ck-hidden',_0xc8c93f=>!_0xc8c93f),_0x1bd15e['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',_0x1bd15e['if']('loadingState','ck-hidden',_0x9cf643=>!!_0x9cf643)]},'children':_0x24de7c?[_0x390502]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x1bd15e['if']('loadingState','ck-hidden',_0x1d3717=>!_0x1d3717)]},'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',_0x1bd15e['if']('loadingState','ck-hidden',_0x3e94fc=>!!_0x3e94fc)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x1bd15e['if']('loadingState','ck-hidden',_0x5508d1=>!_0x5508d1)]},'children':[{'text':_0x1bd15e['to']('loadingState',_0x306175=>_0x306175?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x306175]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x274738]}]},{'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'](_0x393c8f){this['set']('title',_0x393c8f);}['updateLoadingState'](_0xd3fb70,_0x20179d){this['set']('loadingState',_0x20179d?_0xd3fb70:null);}['_createCheckView'](){const _0x55bec3=new Yt();return _0x55bec3['set']({'content':_0x20a950}),_0x55bec3;}['_createPinButtonView'](_0x148e22){const _0x4a2e46=new Ht(_0x148e22);return _0x4a2e46['set']({'label':us(_0x148e22,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x53225f,'withText':!0x1,'tooltip':!0x0}),_0x4a2e46['bind']('isOn')['to'](this,'pinned'),_0x4a2e46['on']('execute',()=>{const _0x2ff379=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x2ff379});}),_0x4a2e46;}['_createMenuDropdownView'](){const _0x36838c=_0x4a2fa7(this['locale']),_0x1a170c=_0x36838c['panelView']['children'];_0x36838c['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x36838c['panelPosition']='sw';const _0x5258a8=new Ht(this['locale']);_0x5258a8['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x5258a8['withText']=!0x0,_0x5258a8['on']('execute',()=>{this['isEdit']=!0x0;});const _0xf55046=new Ht(this['locale']);_0xf55046['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0xf55046['withText']=!0x0,_0xf55046['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x473bdf=new jt(this['locale']),_0x4673ee=new zt(this['locale']);_0x4673ee['children']['add'](_0x5258a8);const _0x166bac=new zt(this['locale']);return _0x166bac['children']['add'](_0xf55046),_0x473bdf['items']['addMany']([_0x4673ee,_0x166bac]),_0x1a170c['add'](_0x473bdf),_0x36838c;}['_createEditInputView'](_0x94e3d3){const _0x3df0d3=new $t(_0x94e3d3),_0x468378=_0x3df0d3['bindTemplate'];return _0x3df0d3['extendTemplate']({'on':{'keydown':_0x468378['to'](_0x3c86fd=>{'Enter'==_0x3c86fd['key']&&this['_commitEditInputValue'](_0x3df0d3);})}}),_0x3df0d3;}['_createAcceptEditButtonView'](_0x1a6906,_0x80c9df){const _0x13c292=new Ht(_0x1a6906);return _0x13c292['set']({'icon':_0x20a950,'withText':!0x1,'tooltip':us(_0x1a6906,'AI_CHAT_HISTORY_ACCEPT')}),_0x13c292['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x13c292['on']('execute',()=>{this['_commitEditInputValue'](_0x80c9df);}),_0x13c292;}['_commitEditInputValue'](_0x2f1e87){const _0x5336c7=_0x2f1e87['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x5336c7});}['_createCancelEditButtonView'](_0x3552f9){const _0xda5ae5=new Ht(_0x3552f9);return _0xda5ae5['set']({'icon':_0x5ea60e,'withText':!0x1,'tooltip':us(_0x3552f9,'AI_CHAT_HISTORY_CANCEL')}),_0xda5ae5['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0xda5ae5['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0xda5ae5;}['_createSpinnerView'](){const _0x53551a=new cr('tiny');return _0x53551a['isVisible']=!0x0,_0x53551a;}['isMatching'](_0x4ca70b){return'string'==typeof this['title']&&this['title']['match'](_0x4ca70b)?{'title':!0x0}:null;}['highlightText'](_0x528c20){this['_titleView']['highlightText'](_0x528c20);}},Yo=class extends _0x1f08de{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x1feec5,_0xb44b46){super(_0x1feec5),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x2bf49f=Vo(_0x1feec5,this);this['headerView']=new Ho(_0x1feec5,{'label':us(_0x1feec5,'AI_CHAT_HISTORY_HEADING'),'icon':_0x1c0d96,'class':'ck-ai-header_history','content':_0x2bf49f,'showResizeButton':_0xb44b46}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x1feec5,[]),this['sectionsView']['delegate'](...$o)['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',_0x3490f0=>!_0x3490f0)]}}),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 _0x104872=new _0x235aa2(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x3f0151=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x3f0151),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x5725ee=this['_createErrorView']();return _0x5725ee['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x475b0b=>!_0x475b0b)]}}),_0x104872['on']('render',()=>{_0x104872['children']['add'](_0x5725ee,0x1);}),_0x104872['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x4b0d4a=>!_0x4b0d4a)]}}),_0x104872;}['_createSkeletonView'](){const _0x3047bd=new Xn(this['locale'],zn['aiHistory']);return _0x3047bd['bind']('isVisible')['to'](this,'isLoading'),_0x3047bd;}['_createErrorView'](){const _0x4389a9=new _0x1f08de(this['locale']),_0x3e3be7=new Ht(this['locale']);_0x3e3be7['set']({'withText':!0x1,'icon':_0x5ea60e,'class':'ck-ai-notification_error__dismiss-button'}),_0x3e3be7['bind']('isVisible')['to'](this,'hasItems',_0x13a224=>!!_0x13a224),_0x3e3be7['on']('execute',()=>{this['errorMessage']='';});const _0x5866b4=this['bindTemplate'];return _0x4389a9['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x5866b4['to']('errorMessage')}]},_0x3e3be7]}),_0x4389a9;}['_createEmptyStateView'](){const _0x15194a=new _0x1f08de(this['locale']);return _0x15194a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x328ac6=>!_0x328ac6)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x15194a;}['_createListItemViews'](_0x5a481d,_0x50c475){const _0x28a92b=[];for(const _0x1317bb of _0x5a481d){const _0x5a47ae=new Wo(_0x50c475,_0x1317bb);_0x5a47ae['delegate'](...$o)['to'](this),_0x28a92b['push'](_0x5a47ae);}return _0x28a92b;}['updateHistoryItemsWithCategories'](_0x549f65){const _0x410dc7=this['locale']||'en',_0x3025ff=[];for(const _0x1844c7 of _0x549f65){const _0x1c85dc=this['_createListItemViews'](_0x1844c7['items'],_0x410dc7);_0x3025ff['push'](new Fo(_0x410dc7,{'title':_0x1844c7['title'],'items':_0x1c85dc}));}this['sectionsView']['sections']=_0x3025ff,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x3025ff),this['hasItems']=_0x549f65['some'](_0x99dba0=>_0x99dba0['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x4720b5){for(const _0x3e04ba of this['sectionsView']['sections']){const _0x4f7322=_0x3e04ba['getItem'](_0x4720b5);if(_0x4f7322){if(_0x3e04ba['removeItem'](_0x4f7322),0x0===_0x3e04ba['itemsViews']['length']){const _0x4a8f42=this['sectionsView']['sections']['indexOf'](_0x3e04ba);-0x1!==_0x4a8f42&&(this['sectionsView']['sections']['splice'](_0x4a8f42,0x1),this['sectionsView']['items']['remove'](_0x3e04ba));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x308803,_0x207c0e){for(const _0x4da5b3 of this['sectionsView']['sections']){const _0x2f88a2=_0x4da5b3['getItem'](_0x308803);if(_0x2f88a2){_0x2f88a2['updateTitle'](_0x207c0e);break;}}}['updateItemLoadingState'](_0x4d880d,_0x49089f,_0x1fc79d){for(const _0x567f79 of this['sectionsView']['sections']){const _0x3e5230=_0x567f79['getItem'](_0x4d880d);if(_0x3e5230){_0x3e5230['updateLoadingState'](_0x49089f,_0x1fc79d);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x2f286a=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x2f286a);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x5bb7a3{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbb4493){super(_0xbb4493);const _0x1a28ec=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x1a28ec['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x1a28ec),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x1a28ec['view'],'isMaximized',_0x489357=>_0x489357),_0x1a28ec['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x1c0d96,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x11836a){this['_historyView']['removeHistoryItem'](_0x11836a);}['updateItems'](_0x52316a){this['_historyView']['updateHistoryItemsWithCategories'](_0x52316a);}['updateItemTitle'](_0x951058,_0xea0299){this['_historyView']['updateItemTitle'](_0x951058,_0xea0299);}['updateItemLoadingState'](_0x284d16,_0x1d7948,_0x2df756){this['_historyView']['updateItemLoadingState'](_0x284d16,_0x1d7948,_0x2df756);}['setLoadingSkeleton'](_0x11adba){this['_historyView']['isLoading']=_0x11adba;}['showError'](_0x32dec7){this['_historyView']['errorMessage']=_0x32dec7;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
- gt();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x428f68,title:_0x387595,createdAt:_0xc0bdfe,updatedAt:_0x66d0ca,pinned:_0xe2954d}){super(),this['id']=_0x428f68,this['createdAt']=new Date(_0xc0bdfe),this['set']('title',_0x387595),this['set']('updatedAt',_0x66d0ca?new Date(_0x66d0ca):null),this['set']('pinned',_0xe2954d||!0x1);}['updateTitle'](_0x38a5f1){this['set']('title',_0x38a5f1),this['updatedAt']=new Date();}['updatePinned'](_0x339595){this['set']('pinned',_0x339595),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
- ut();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x42fe71,group:_0x5ad0f1}){super(),this['connector']=_0x42fe71,this['group']=_0x5ad0f1;}async['init'](){try{const _0x4d8ea2=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x4d8ea2);}catch(_0x10107a){this['fire']('error',{'error':_0x10107a,'operation':'init'});}}['addItem'](_0x5ef006){this['items']['push'](_0x5ef006);}async['removeItem'](_0x273b08){const _0x2039fd=this['items']['findIndex'](_0x4c295b=>_0x4c295b['id']===_0x273b08);if(-0x1===_0x2039fd)return!0x1;try{return await this['connector']['deleteConversation'](_0x273b08)['execute'](),this['items']['splice'](_0x2039fd,0x1),this['fire']('itemRemoved',{'itemId':_0x273b08}),!0x0;}catch(_0x445e37){return this['fire']('error',{'error':_0x445e37,'operation':'removeItem','itemId':_0x273b08}),!0x1;}}['getItem'](_0x28f617){return this['items']['find'](_0x4425ee=>_0x4425ee['id']===_0x28f617);}async['updateItemTitle'](_0x47afbb,_0x504ce8){const _0x45d851=this['getItem'](_0x47afbb);if(!_0x45d851)return!0x1;try{return await this['connector']['updateConversation'](_0x47afbb,{'title':_0x504ce8})['getResult'](),_0x45d851['updateTitle'](_0x504ce8),this['fire']('itemUpdated',{'itemId':_0x47afbb,'updates':{'title':_0x504ce8}}),!0x0;}catch(_0x5d3a09){return this['fire']('error',{'error':_0x5d3a09,'operation':'updateItemTitle','itemId':_0x47afbb}),!0x1;}}async['updateItemPinned'](_0x4c2b69,_0x2f24aa){const _0x5a5559=this['getItem'](_0x4c2b69);if(!_0x5a5559)return!0x1;try{return await this['connector']['updateConversation'](_0x4c2b69,{'pinned':_0x2f24aa})['getResult'](),_0x5a5559['updatePinned'](_0x2f24aa),this['fire']('itemUpdated',{'itemId':_0x4c2b69,'updates':{'pinned':_0x2f24aa}}),!0x0;}catch(_0x250fcc){return this['fire']('error',{'error':_0x250fcc,'operation':'updateItemPinned','itemId':_0x4c2b69}),!0x1;}}['loadItems'](_0x1b70f1){try{this['items']=[],_0x1b70f1['map'](_0x1f7b6c=>{this['addItem'](new Xo(_0x1f7b6c));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2baeeb){this['fire']('error',{'error':_0x2baeeb,'operation':'loadItems'});}}['getItems'](_0x590238={}){const _0x551118=void 0x0!==_0x590238['pinned']&&_0x590238['pinned'],_0x13e94a=_0x590238['from']?new Date(_0x590238['from']['getFullYear'](),_0x590238['from']['getMonth'](),_0x590238['from']['getDate']()):null,_0x4195be=_0x590238['to']?new Date(_0x590238['to']['getFullYear'](),_0x590238['to']['getMonth'](),_0x590238['to']['getDate']()):null;return this['items']['filter'](_0x1ea538=>{if(_0x1ea538['pinned']!==_0x551118)return!0x1;if(_0x4195be){const _0x55ed2c=new Date(_0x1ea538['createdAt']['getFullYear'](),_0x1ea538['createdAt']['getMonth'](),_0x1ea538['createdAt']['getDate']());return _0x13e94a?_0x13e94a['getTime']()===_0x4195be['getTime']()?_0x55ed2c['getTime']()===_0x13e94a['getTime']():_0x55ed2c<_0x4195be&&_0x55ed2c>=_0x13e94a:_0x55ed2c<_0x4195be;}return!0x0;});}},Jo=class extends _0x5bb7a3{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,nn,kn,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'](kn),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichathistory');const _0x3b6c05=this['context']['plugins']['get'](cs);try{const _0x11cca7=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x11cca7}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x5413f8,_0x2ed095)=>{this['_setItemLoading'](_0x2ed095['id'],'remove'),this['_handleRemove'](_0x2ed095['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x15073f,_0x259eed)=>{this['_setItemLoading'](_0x259eed['id'],'rename'),this['_handleEditTitle'](_0x259eed['id'],_0x259eed['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x1ffc07,_0x493584)=>{void 0x0!==_0x493584['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x493584['itemId'],_0x493584['updates']['title']),void 0x0!==_0x493584['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x493584['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x4d6a64,_0xc368c9)=>{this['_aiChatController']['_handleRemovedConversation'](_0xc368c9['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0xc368c9['itemId']),this['_clearItemLoading'](_0xc368c9['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x269939,_0x5779e5)=>{this['_handleHistoryErrorUI'](_0x5779e5['error'],_0x5779e5['operation'],_0x5779e5['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x5993af,_0x2aa40a)=>{this['_handleSelectConversation'](_0x2aa40a['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x3ba25e,_0x5bbf99)=>{const _0x21d43e=_0x5bbf99['pinned']?'pin':'unpin';this['_setItemLoading'](_0x5bbf99['id'],_0x21d43e),this['_handleTogglePin'](_0x5bbf99['id'],_0x5bbf99['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x3b6c05['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x3b6c05['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x77fce8){this['_handleHistoryErrorUI'](_0x77fce8,'init');}}async['_handleEditTitle'](_0x2ad56e,_0x5da195){await this['history']['updateItemTitle'](_0x2ad56e,_0x5da195);}async['_handleTogglePin'](_0x26583b,_0x572d74){await this['history']['updateItemPinned'](_0x26583b,_0x572d74);}async['_handleRemove'](_0x451a96){await this['history']['removeItem'](_0x451a96);}async['_handleSelectConversation'](_0x22db97){await this['_aiChatController']['loadConversation'](_0x22db97);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x5511fc=this['_aiChatController']['activeConversation']?.['id'],_0x1958a4=this['_getCategorizedItems']()['map'](_0x59ec69=>({'title':_0x59ec69['title'],'items':_0x59ec69['items']['map'](_0x71adf4=>({'id':_0x71adf4['id'],'title':_0x71adf4['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x71adf4['createdAt'])['toLocaleDateString'](),'active':_0x71adf4['id']===_0x5511fc,'pinned':_0x71adf4['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x1958a4);}['_setItemLoading'](_0x459bb9,_0x1c66a3){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x459bb9,_0x1c66a3,!0x0);}['_clearItemLoading'](_0x3879e0){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3879e0,null,!0x1);}['_handleHistoryErrorUI'](_0x258a3d,_0x3096f5,_0xca3c9c){const _0x146b83=this['_generateErrorMessage'](_0x3096f5,_0xca3c9c);this['_aiChatHistoryUi']['showError'](_0x146b83),this['_reporter']['reportError'](_0x258a3d,{'context':{'operation':_0x3096f5}}),_0xca3c9c&&this['_clearItemLoading'](_0xca3c9c),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x5504de,_0x51f69f){const _0x44fc99=_0x51f69f?this['history']['getItem'](_0x51f69f):null,_0x5487f2=_0x44fc99?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x5504de){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x5487f2);case'updateItemPinned':{const _0x512735=us(this['context']['locale'],_0x44fc99?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x512735,_0x5487f2]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x5487f2);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 _0x42dffc=new Date(),_0x5c8718=new Date(_0x42dffc['getFullYear'](),_0x42dffc['getMonth'](),_0x42dffc['getDate']()),_0x50023b=new Date(_0x5c8718);_0x50023b['setDate'](_0x50023b['getDate']()-0x1);const _0x24a82f=new Date(_0x5c8718);_0x24a82f['setDate'](_0x24a82f['getDate']()-0xe);const _0x3a30e1=this['history']['getItems']({'pinned':!0x0}),_0x2b3879=this['history']['getItems']({'from':_0x5c8718,'to':_0x5c8718}),_0x52da96=this['history']['getItems']({'from':_0x50023b,'to':_0x50023b}),_0x56575b=this['history']['getItems']({'from':_0x24a82f,'to':_0x50023b}),_0xdd1ca1=this['history']['getItems']({'to':_0x24a82f}),_0x2c3175=[];return _0x3a30e1['length']>0x0&&_0x2c3175['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x3a30e1}),_0x2b3879['length']>0x0&&_0x2c3175['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x2b3879}),_0x52da96['length']>0x0&&_0x2c3175['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x52da96}),_0x56575b['length']>0x0&&_0x2c3175['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x56575b}),_0xdd1ca1['length']>0x0&&_0x2c3175['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0xdd1ca1}),_0x2c3175;}},Zo=class extends _0x5bb7a3{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x5bb7a3{static get['requires'](){return[kn,Is,Bo,Zo,tn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x49aa30){super(_0x49aa30),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');}},ea=class extends Ht{['id'];constructor(_0x2261d8,_0xb914f6){super(_0x2261d8);const {id:_0x5dc8d6,type:_0x2d8377,icon:_0x196a30}=_0xb914f6;this['id']=_0x5dc8d6,this['set']({'label':_0xb914f6['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0xb914f6['id']}}),_0x196a30?this['icon']=_0x196a30:'chat'===_0x2d8377?this['icon']=_0x37c71d:'review'===_0x2d8377?this['icon']=_0x259f1e:'translate'===_0x2d8377&&(this['icon']=_0x1b8aec);}},ia=class extends _0x1f08de{['listView'];constructor(_0x7dbc86,_0x1ffbd4){super(_0x7dbc86),this['set']('isEnabled',!0x0);const _0x2de287=_0x1ffbd4['map'](_0x458c4a=>{const _0x4c2c30=new zt(this['locale']),_0x5e6b6e=new ea(this['locale'],_0x458c4a);return _0x5e6b6e['bind']('isEnabled')['to'](this),_0x4c2c30['children']['add'](_0x5e6b6e),_0x5e6b6e['delegate']('execute')['to'](this),_0x4c2c30;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x2de287),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x5bb7a3{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Bo];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Bo),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x53a8c1=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x713aa4=_0x53a8c1['activeConversation'];_0x713aa4['isFromHistory']||this['_injectShortcuts'](_0x713aa4);}),this['listenTo'](_0x53a8c1,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x328160=['chat','review','translate'];this['_shortcuts']['forEach'](_0x1db1a9=>{let _0x368daa=!0x0;if(_0x1db1a9['id']&&_0x1db1a9['label']&&_0x328160['includes'](_0x1db1a9['type'])?'chat'===_0x1db1a9['type']&&(_0x368daa='string'==typeof _0x1db1a9['prompt']):_0x368daa=!0x1,!_0x368daa)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x1db1a9});});}['_injectShortcuts'](_0x8b9f7f){this['_removeShortcuts'](),this['_shortcutsView']=new ia(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],sa),this['_shortcutsView']['on']('execute',_0x26db9a=>{const _0x64d74c=_0x26db9a['source']['id'];this['_executeShortcut'](_0x64d74c);}),this['_listenedConversation']=_0x8b9f7f,this['listenTo'](_0x8b9f7f,'uploadProgressChanged',(_0x32e7f7,_0x103b11)=>{this['_shortcutsView']['isEnabled']=!_0x103b11['isUploadInProgress'];});}['_removeShortcuts'](){const _0x524e1c=this['context']['plugins']['get'](Bo);_0x524e1c['hasFeedItem'](sa)&&_0x524e1c['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x5d76a5){const _0x5a9f30=this['_shortcuts']['find'](_0x4b41ff=>_0x4b41ff['id']===_0x5d76a5),_0x30cb9e=_0x5a9f30['type'];'chat'===_0x30cb9e?this['_runChatShortcut'](_0x5a9f30):'review'===_0x30cb9e?_0x5a9f30['commandId']?this['_runReviewShortcut'](_0x5a9f30):this['_switchTab']('reviewMode'):'translate'===_0x30cb9e&&(_0x5a9f30['language']?this['_runTranslateShortcut'](_0x5a9f30):this['_switchTab']('translate'));}['_switchTab'](_0x580773){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x580773});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x580773);}async['_runChatShortcut']({prompt:_0x432036,draftMode:_0x175f80,useWebSearch:_0x30cee3=!0x1,useReasoning:_0x18d191=!0x1,model:_0x221f62}){const _0x228fe7=this['context']['plugins']['get']('AIChatController'),_0x26ac8c=_0x228fe7['activeConversation'];let _0x49e8e6;_0x49e8e6=_0x221f62?await _0x26ac8c['chatModels']['getModel'](_0x221f62):await _0x26ac8c['chatModels']['getDefault'](),_0x49e8e6&&await _0x26ac8c['setModel'](_0x49e8e6),_0x26ac8c['setWebSearch'](_0x30cee3),_0x26ac8c['setReasoning'](_0x18d191),_0x228fe7['addCurrentDocumentToChatContext'](),_0x175f80?(this['_aiChatUI']['setPromptInputValue'](_0x432036),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x228fe7['sendMessage']({'message':_0x432036});}['_runReviewShortcut']({commandId:_0x39a729,model:_0x53b831,prompt:_0x5b6146,params:_0x2830ee}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x349785={'id':_0x39a729,'isCustom':'custom'===_0x39a729};_0x53b831&&_0x5b6146&&(_0x349785['args']={'model':_0x53b831,'prompt':_0x5b6146}),_0x2830ee&&(_0x349785['params']=_0x2830ee),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x349785);}['_runTranslateShortcut']({language:_0x529013}){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':_0x529013,'args':{'language':_0x529013}});}},ra=class extends _0xbc060f{constructor(_0x102bcd){super(_0x102bcd);const _0x223e94=_0x102bcd['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x223e94,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xaf7326=this['editor']['plugins']['get']('AITabs')['view'];_0xaf7326['isVisible']=!_0xaf7326['isVisible'];}},oa=class extends _0x1c4dee{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x41cc56=this['editor'];_0x41cc56['commands']['add']('toggleAi',new ra(_0x41cc56)),_0x41cc56['ui']['componentFactory']['add']('toggleAi',()=>{const _0x4212f0=this['_createAIUIButton'](Ht);return _0x4212f0['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x4212f0;}),_0x41cc56['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3b522f=this['_createAIUIButton'](Jt);return _0x3b522f['set']({'role':'menuitemcheckbox'}),_0x3b522f;});}['_createAIUIButton'](_0x5b820c){const _0x4fc4b0=this['editor'],_0x255ef6=_0x4fc4b0['commands']['get']('toggleAi'),_0x1e4add=new _0x5b820c(_0x4fc4b0['locale']);return _0x1e4add['set']({'label':us(_0x4fc4b0['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x403b79,'isToggleable':!0x0}),_0x1e4add['bind']('isEnabled')['to'](_0x255ef6),_0x1e4add['bind']('isOn')['to'](_0x255ef6,'value',_0x345179=>!!_0x345179),this['listenTo'](_0x1e4add,'execute',()=>{_0x255ef6['execute']();}),_0x1e4add;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x1f08de{['_errorView'];constructor(_0x17f1d5){super(_0x17f1d5),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x26bde7){this['showError'](_0x26bde7);}['showError'](_0xa83dcd){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xa83dcd,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x5b441f=new _0x1f08de(this['locale']),_0x2c6e74=new _0x1f08de(this['locale']);return _0x2c6e74['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x5b441f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x12a6c2=>!_0x12a6c2)]},'children':[_0x2c6e74]}),_0x5b441f;}};const ca=0xa;var la=class extends _0x5bb7a3{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'](_0x1e4daa){const {id:_0x45d019}=this['_currentConfig']??{};this['_currentConfig']=_0x1e4daa,this['_editor']=_0x1e4daa['targetEditor'];const {id:_0x50cbbc}=this['_currentConfig'];this['isOpen']&&_0x45d019===_0x50cbbc?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x4384ce=this['_editor'];if(!_0x4384ce)return;const _0x577744=_0x4384ce['plugins']['get']('Dialog');_0x577744['isOpen']&&this['_currentConfig']&&_0x577744['id']===this['_currentConfig']['id']&&_0x577744['hide']();}['_updateDialog'](){const _0x2d8e61=this['_editor']['plugins']['get']('Dialog'),{icon:_0x1fc2da,title:_0x50bcce}=this['_currentConfig'];_0x2d8e61['view']?.['headerView']&&(_0x2d8e61['view']['headerView']['label']=_0x50bcce,_0x2d8e61['view']['headerView']['iconView']&&_0x1fc2da&&(_0x2d8e61['view']['headerView']['iconView']['content']=_0x1fc2da)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x2d8e61['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 _0x3bd485=this['_editor']['plugins']['get']('Dialog'),{id:_0x33a614,title:_0xb35faf,icon:_0x5065a1,class:_0x4a6e8e,mainView:_0xbe9281}=this['_currentConfig'];_0xbe9281['delegate'](...aa)['to'](this),_0x3bd485['show']({'title':_0xb35faf,'icon':_0x5065a1,'hasCloseButton':!0x0,'id':_0x33a614,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x4a6e8e||''),'content':_0xbe9281,'onShow':_0x392cee=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x392cee['view']?.['updatePosition']();const _0x307585=this['_getSelectionElements']();_0x307585&&_0x307585[0x0]&&Rt({'target':_0x307585[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x392cee['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x33a614});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x33a614}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0xb5305f,_0x421fca,_0x106b39){const _0xec689b=_0x421fca||_0x106b39;if(!_0xec689b)return null;const _0x415149=this['_getSelectionElements']();if(!_0x415149||0x0===_0x415149['length'])return{'left':Math['round'](_0xec689b['left']+_0xec689b['width']/0x2-_0xb5305f['width']/0x2),'top':Math['round'](_0xec689b['top']+_0xec689b['height']/0x2-_0xb5305f['height']/0x2)};const _0x895030=Math['round'](_0xec689b['left']+_0xec689b['width']/0x2-_0xb5305f['width']/0x2),_0xce2b9=_0x415149['map'](_0x28a014=>new At(_0x28a014)),_0x4b3a0d=_0xb5305f['height'];return{'left':_0x895030,'top':this['_calculateOptimalTopPosition'](_0xce2b9,_0x4b3a0d,_0xec689b)};}['_calculateOptimalTopPosition'](_0x35107b,_0x49554c,_0x386203){const _0x49cfbb=new At(Tt['window']),_0x2be5b6=_0x35107b['map'](_0x7a454c=>_0x7a454c['getVisible']())['filter'](_0x474c04=>_0x474c04),_0x13fa78=At['getBoundingRect'](_0x2be5b6);if(!_0x13fa78)return Math['round'](_0x386203['top']+_0x386203['height']/0x2);const _0x559197=_0x49cfbb['getIntersection'](_0x13fa78);if(!_0x559197)return Math['round'](_0x386203['top']+_0x386203['height']/0x2);const _0x50395f=_0x386203['getVisible'](),_0x4502cd=_0x50395f&&_0x13fa78['height']>_0x50395f['height'],_0x2c26b4=_0x559197['top'],_0x3ace4d=_0x559197['bottom'];if(_0x4502cd){const _0x5e6a9d=_0x49cfbb['top']+_0x49cfbb['height']/0x2-_0x49554c/0x2,_0x5ec634=_0x2c26b4-ca-_0x49cfbb['top'],_0x158bbf=_0x49cfbb['bottom']-_0x3ace4d-ca;return _0x5ec634>=_0x49554c?Math['max'](ca,_0x2c26b4-_0x49554c-ca):_0x158bbf>=_0x49554c?_0x3ace4d+ca:Math['max'](ca,_0x5e6a9d);}const _0x261e18=_0x2c26b4-_0x49554c,_0xb9c6e=_0x49cfbb['bottom']-_0x3ace4d-ca,_0x3d4ba3=_0x2c26b4-ca-_0x49cfbb['top'];let _0x48edee;return _0x48edee=_0xb9c6e>=_0x49554c?_0x3ace4d+ca:_0x3d4ba3>=_0x49554c?_0x261e18-ca:_0x2c26b4+_0x13fa78['height']/0x2-_0x49554c/0x2,_0x48edee;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x346c9f=this['_editor'];this['listenTo'](_0x346c9f['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0xdf1324,data:{newRange:_0x2a906}}of _0x346c9f['model']['document']['differ']['getChangedMarkers']())if(_0xdf1324['startsWith']('ai-selection:')&&(_0x2a906&&(_0x2a906['start']['isEqual'](_0x2a906['end'])||'$graveyard'==_0x2a906['root']['rootName'])||null==_0x2a906)){const _0x21168c=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x21168c),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x514a99=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x514a99['model']['document']);}['_getSelectionElements'](){const _0xeb15b2=this['_editor'];return _0x1b7007(_0xeb15b2['editing'],[..._0xeb15b2['model']['markers']['getMarkersGroup']('ai-selection'),..._0xeb15b2['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x1a7499=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x1a7499&&_0x1a7499['rootName']?_0x1a7499['rootName']:null;}},ua=class extends _0x3ffb1c{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x31b2b7,_0x5cd9f9={}){super(_0x31b2b7),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x5cd9f9};const _0x2e74d4=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x2e74d4?'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'](_0x19e9c9){this['showChangesButton']['isEnabled']=_0x19e9c9;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':hn,'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':hn,'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':_0xfa100c,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+hn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0xb2b275=new Yt();_0xb2b275['set']({'content':_0x20a950}),_0xb2b275['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'+hn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+hn;},0x7d0);}),this['copyButton']['children']['add'](_0xb2b275);}['_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':hn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x2a5424=>_0x2a5424?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},da=class extends ha{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x457de1,_0x21761d){super(_0x457de1);const _0xf6ae81=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']=_0x21761d,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x457de1),this['_partToolbarView']=new Wn(_0x457de1,_0x21761d['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x21761d),this['_stateView']=new Fn(_0x457de1),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x457de1,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x457de1,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x5c0960,_0x7ec962,_0x415d07,_0x536eda)=>{let _0x4940f3,_0xb9636c;'pending'===_0x536eda?(_0x4940f3=this['_partToolbarView'],_0xb9636c=this['_stateView']):(_0x4940f3=this['_stateView'],_0xb9636c=this['_partToolbarView']),this['_stateView']['setState'](_0x415d07),_0x4940f3['isVisible']=!0x1,_0xb9636c['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0xf6ae81['to']('_state',_0x3d357e=>'ck-ai-chat-balloon-main_state_'+_0x3d357e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x21761d);});}['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'](_0x4f10dd){_0x4f10dd?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x4f10dd);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x2a3c4c){this['_state']=_0x2a3c4c;}['showError'](_0xa8bb3a){super['showError'](_0xa8bb3a),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x3d30d9){super['showBlockingError'](_0x3d30d9),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x5bab94){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x5bab94;}['togglePartToolbarEnabled'](_0x5c2795){this['_partToolbarView']['isEnabled']=_0x5c2795;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x21c124,showSuggestButton:_0x3fe0ae}){_0x21c124=_0x21c124&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x3fe0ae=_0x3fe0ae&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x21c124,'showSuggestButton':_0x3fe0ae});}['_createNextButtonView'](){const _0x497e39=new Ht(this['locale']);return _0x497e39['set']({'icon':_0x40c169,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x497e39['on']('execute',()=>{this['fire']('showNext');}),_0x497e39;}['_createPreviousButtonView'](){const _0x29495a=new Ht(this['locale']);return _0x29495a['set']({'icon':_0x1f1087,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x29495a['on']('execute',()=>{this['fire']('showPrevious');}),_0x29495a;}},_a=class extends _0x1f08de{constructor(_0x43577e,_0x3b7a4d){super(_0x43577e),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x3b7a4d});}},ga=class extends _0x1c4dee{static get['requires'](){return[Mt,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x929d4d){super(_0x929d4d),this['set']('showDiff',!0x1);}['open'](_0x545701){const _0x53325e=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x53325e['plugins']['get']('AIBalloon')['open']({..._0x545701,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x545701['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x545701['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x5efe0d){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x5efe0d);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x45de47){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x45de47);}['_createChatBalloonView'](){const _0x357a70=this['editor'],_0x2ad545=_0x357a70['plugins']['get']('AIBalloon'),_0x56bcdb=_0x357a70['commands']['get']('trackChanges');let _0x4c0f80=_0x357a70['config']['get']('ai.availableReplyActions')||[...er];_0x357a70['plugins']['has']('TrackChanges')||(_0x4c0f80=_0x4c0f80['filter'](_0x377c0b=>'insertSuggestion'!=_0x377c0b));const _0x3220bb=new da(_0x357a70['locale'],{'availableActions':_0x4c0f80,'showApplyButton':!0x0,'showSuggestButton':!!_0x56bcdb});return _0x3220bb['bind']('showDiff')['to'](this),_0x3220bb['delegate'](...Nn)['to'](this),_0x3220bb['delegate']('showPrevious','showNext')['to'](this),_0x2ad545['delegate']('dialogClosed')['to'](this),_0x3220bb['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3220bb['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3220bb['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x56bcdb&&_0x3220bb['bind']('isTrackChangesOn')['to'](_0x56bcdb,'value'),_0x3220bb['render'](),_0x3220bb;}['_toggleRotatorButtonsInDialogHeader'](_0x3286d9){const _0x4799ba=this['editor'],_0x353fff=_0x4799ba['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x3286d9),_0x353fff['has'](this['_chatBalloonView']['previousButtonView'])||(_0x353fff['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x4799ba['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x353fff['remove'](this['_chatBalloonView']['previousButtonView']),_0x353fff['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x1c4dee{static get['requires'](){return[oa,ga,_0x36c9c5];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x1ece15){const {editor:_0x345472,action:_0x3eabef,withText:_0x5d7759=!0x1,withIcon:_0xa17a23=!0x0,isInDropdown:_0xe5efd2=!0x0,shouldPreventFocus:_0x52794e=!0x1,actionButtons:_0x200eea}=_0x1ece15;return()=>{const _0x443c93=_0x345472['locale'],_0x37b011=new Ht(_0x443c93),_0x2cb754=_0x37b011['bindTemplate'];_0xe5efd2&&_0x37b011['extendTemplate']({'on':{'mouseenter':_0x2cb754['to'](()=>{_0x52794e&&_0x52794e()||_0x37b011['focus']();})}}),_0x200eea['push']({'buttonView':_0x37b011,'action':_0x3eabef});const _0x35d987=_0x3eabef['icon']??_0x3eabef['parent']?.['icon'];return _0x37b011['set']({'label':_0x3eabef['label'],'withText':_0x5d7759,'role':'menuitem','icon':_0xa17a23?_0x35d987??_0x355d7e:void 0x0,'tooltip':!_0x5d7759,'class':'ck-ai-quick-actions-button','isEnabled':_0x3eabef['isEnabled']}),_0x37b011['on']('execute',()=>{_0x345472['editing']['view']['focus'](),_0x345472['commands']['execute']('aiQuickAction',_0x3eabef);}),_0x37b011;};}var pa=class extends Qt{['arrowView'];constructor(_0x3301ed,_0x3c7612){super(_0x3301ed,_0x3c7612);const _0x4b4b2d=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',_0x165057=>String(_0x165057)),'data-cke-tooltip-disabled':_0x4b4b2d['to']('isOn')},'on':{'mouseenter':_0x4b4b2d['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x277f56=new Yt();return _0x277f56['content']=_0x3a4797,_0x277f56['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x277f56;}},ma=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x239e20,_0x344890,_0x433080){super(_0x239e20),this['_allListItems']=_0x344890,this['_allSearchableItems']=_0x433080;}['filter'](_0x40d5c7){if(!_0x40d5c7)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x278f7a=_0x40d5c7['source']['toLowerCase']()['trim'](),_0x20773a=this['_allSearchableItems']['filter'](_0x3fcae6=>(_0x3fcae6['groupLabel']?_0x3fcae6['label']+'\x20('+_0x3fcae6['groupLabel']+')':_0x3fcae6['label'])['toLowerCase']()['includes'](_0x278f7a));return this['items']['clear'](),this['items']['addMany'](_0x20773a['sort']((_0x54c259,_0x1efa90)=>{const _0x5161fd=_0x54c259['groupLabel'],_0x1ff258=_0x1efa90['groupLabel'];return _0x5161fd||_0x1ff258?_0x5161fd?0x1:-0x1:0x0;})['map'](_0x4e60a4=>_0x4e60a4['item'])),this['_highlightQuery'](_0x278f7a,_0x20773a),{'resultsCount':_0x20773a['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x2f890a,_0x44a907){if(!_0x2f890a)return;const _0x3df061=new RegExp(_0x265956(_0x2f890a),'gi');_0x44a907['forEach'](_0x25ad1c=>{_0x25ad1c['highlightViews']&&_0x25ad1c['highlightViews']['forEach'](_0x13f5d1=>{'function'==typeof _0x13f5d1['highlightText']&&_0x13f5d1['highlightText'](_0x3df061);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x53b057=>{_0x53b057['highlightViews']&&_0x53b057['highlightViews']['forEach'](_0x30b46a=>{'function'==typeof _0x30b46a['highlightText']&&_0x30b46a['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x1f08de{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x18e4f0,_0x5a8b30,_0x46aad3,_0x50b7a1,_0x49a4d5=!0x1,_0x30b9d4=[]){const _0x2ef5b4=_0x18e4f0['locale'];super(_0x2ef5b4),this['_bodyCollection']=_0x50b7a1,this['_hasSearch']=_0x49a4d5,this['_actionButtons']=_0x30b9d4;const _0x5f4af4=this['_createListItems'](_0x18e4f0,_0x5a8b30,_0x46aad3);this['optionsListView']=new ma(_0x2ef5b4,_0x5f4af4,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x5f4af4),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x49a4d5&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x5f4af4,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x49a4d5&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x3212ed=_0x49a4d5&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x3994e5(_0x3212ed),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x2ef5b4['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x235aa2(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 _0x3edffa=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3edffa);}['_createListItems'](_0x30a5ab,_0x39576b,_0x579e8d){const _0x579359=new _0x3994e5();return _0x39576b['forEach'](_0xc21270=>{if('actions'in _0xc21270){const {listItem:_0x39c31b}=this['_createActionGroupButton'](_0x30a5ab,_0xc21270,_0x579e8d);_0x579359['add'](_0x39c31b),_0xc21270['actions']['forEach'](_0xc33274=>{const {listItem:_0x220b6b,highlightViews:_0x18cf35}=this['_createSearchResultActionButton'](_0x30a5ab,_0xc33274,_0xc21270['label'],_0xc21270['icon']);this['_allSearchableItems']['push']({'item':_0x220b6b,'label':_0xc33274['label'],'groupLabel':_0xc21270['label'],'highlightViews':_0x18cf35});});}else{const {listItem:_0x4a93bb}=this['_createActionButton'](_0x30a5ab,_0xc21270);_0x579359['add'](_0x4a93bb);const _0x3aad04=_0x4a93bb['children']['first'];if(_0x3aad04){const {listItem:_0x27323e,highlightViews:_0x209196}=this['_createSearchResultActionButton'](_0x30a5ab,_0xc21270);this['_allSearchableItems']['push']({'item':_0x27323e,'label':_0x3aad04['label']||'','highlightViews':_0x209196});}}}),_0x579359;}['_createActionButton'](_0x56a03f,_0x17a70c,_0x5bb83b,_0x36e3d6){const _0x11c3a2=new zt(this['locale']);if(_0x5bb83b&&_0x36e3d6){const _0x211e48=new Ht(this['locale']),_0x1951d6=_0x211e48['bindTemplate'],_0x73e5db=new Wt();_0x73e5db['text']=_0x17a70c['label'];const _0x396518=new Wt();_0x396518['text']=_0x5bb83b;const _0x5def33=new Yt();_0x5def33['content']=_0x36e3d6,_0x5def33['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x54b38e=new _0x1f08de(this['locale']);_0x54b38e['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x1e4102=new _0x1f08de(this['locale']);return _0x1e4102['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x211e48['set']({'label':_0x17a70c['label']+'\x20('+_0x5bb83b+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x17a70c['isEnabled']}),_0x211e48['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x1951d6['if']('isEnabled','ck-disabled',_0x397a4c=>!_0x397a4c)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x73e5db,_0x54b38e,_0x5def33,_0x396518,_0x1e4102],'on':{'mouseenter':_0x1951d6['to'](()=>{this['_isSearchFocused']()||_0x211e48['focus']();}),'click':_0x1951d6['to'](()=>{_0x211e48['fire']('execute');})}}),_0x211e48['on']('execute',()=>{_0x211e48['isEnabled']&&(_0x56a03f['editing']['view']['focus'](),_0x56a03f['commands']['execute']('aiQuickAction',_0x17a70c));}),_0x11c3a2['children']['add'](_0x211e48),this['_actionButtons']['push']({'buttonView':_0x211e48,'action':_0x17a70c}),{'listItem':_0x11c3a2,'highlightViews':[_0x73e5db,_0x396518]};}{const _0xaab477=new Pt(),_0x7f098e=new Ht(this['locale'],_0xaab477),_0x2397e4=_0x7f098e['bindTemplate'],_0x2e49d9=_0x17a70c['icon']??_0x17a70c['parent']?.['icon'],_0x4c98bb=void 0x0!==_0x17a70c['icon'];return _0x7f098e['set']({'label':_0x17a70c['label'],'withText':!0x0,'role':'menuitem','icon':_0x4c98bb?_0x2e49d9??_0x355d7e:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x17a70c['isEnabled']}),_0x7f098e['extendTemplate']({'on':{'mouseenter':_0x2397e4['to'](()=>{this['_isSearchFocused']()||_0x7f098e['focus']();})}}),_0x7f098e['on']('execute',()=>{_0x56a03f['editing']['view']['focus'](),_0x56a03f['commands']['execute']('aiQuickAction',_0x17a70c);}),_0x11c3a2['children']['add'](_0x7f098e),this['_actionButtons']['push']({'buttonView':_0x7f098e,'action':_0x17a70c}),{'listItem':_0x11c3a2,'highlightViews':[_0xaab477]};}}['_createSearchResultActionButton'](_0x55ff05,_0x52e0a8,_0x34a58b,_0x5d85ee){return _0x34a58b&&_0x5d85ee?this['_createSearchResultGroupedActionButton'](_0x55ff05,_0x52e0a8,_0x34a58b,_0x5d85ee):this['_createSearchResultIndividualActionButton'](_0x55ff05,_0x52e0a8);}['_createSearchResultGroupedActionButton'](_0x4937b2,_0x3134f8,_0x570913,_0xcced3a){const _0x5137e5=new zt(this['locale']),_0x3de3e6=new Ht(this['locale']),_0x15c0e5=_0x3de3e6['bindTemplate'],{view:_0x1d7ade,highlightView:_0x54693c}=this['_createSearchResultGroupRow'](_0x570913,_0xcced3a),{view:_0x108605,highlightView:_0x1144a0}=this['_createSearchResultActionRow'](_0x3134f8['label']),_0x560e87=this['_createSearchResultContentView'](_0x1d7ade,_0x108605);return _0x3de3e6['set']({'label':_0x3134f8['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':_0x3134f8['isEnabled']}),_0x3de3e6['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',_0x15c0e5['if']('isEnabled','ck-disabled',_0x2506d5=>!_0x2506d5)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x560e87],'on':{'mouseenter':_0x15c0e5['to'](()=>{this['_isSearchFocused']()||_0x3de3e6['focus']();}),'click':_0x15c0e5['to'](()=>{this['_handleSearchResultButtonClick'](_0x3de3e6);})}}),this['_setupActionButtonExecution'](_0x3de3e6,_0x4937b2,_0x3134f8),_0x5137e5['children']['add'](_0x3de3e6),this['_actionButtons']['push']({'buttonView':_0x3de3e6,'action':_0x3134f8}),{'listItem':_0x5137e5,'highlightViews':[_0x54693c,_0x1144a0]};}['_createSearchResultIndividualActionButton'](_0x495f4a,_0x1be574){const _0x525e4a=new zt(this['locale']),_0x35dd30=new Pt(),_0x49c4a0=new Ht(this['locale'],_0x35dd30),_0x25c231=_0x49c4a0['bindTemplate'];return _0x49c4a0['set']({'label':_0x1be574['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x1be574['isEnabled']}),_0x49c4a0['extendTemplate']({'on':{'mouseenter':_0x25c231['to'](()=>{this['_isSearchFocused']()||_0x49c4a0['focus']();})}}),this['_setupActionButtonExecution'](_0x49c4a0,_0x495f4a,_0x1be574),_0x525e4a['children']['add'](_0x49c4a0),this['_actionButtons']['push']({'buttonView':_0x49c4a0,'action':_0x1be574}),{'listItem':_0x525e4a,'highlightViews':[_0x35dd30]};}['_createSearchResultGroupRow'](_0x433353,_0x1e094e){const _0x3e7320=new _0x1f08de(this['locale']),_0x573227=new Yt();_0x573227['content']=_0x1e094e,_0x573227['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4a4c3b=new Wt();return _0x4a4c3b['text']=_0x433353,_0x3e7320['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x573227,_0x4a4c3b]}),{'view':_0x3e7320,'highlightView':_0x4a4c3b};}['_createSearchResultActionRow'](_0x559f79){const _0x409f7d=new _0x1f08de(this['locale']),_0x575640=new Wt();return _0x575640['text']=_0x559f79,_0x409f7d['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x575640]}),{'view':_0x409f7d,'highlightView':_0x575640};}['_createSearchResultContentView'](_0x4e215e,_0x54fcda){const _0x124b7a=new _0x1f08de(this['locale']);return _0x124b7a['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x4e215e,_0x54fcda]}),_0x124b7a;}['_setupActionButtonExecution'](_0x3dd114,_0x2b5e02,_0x1705b9){_0x3dd114['on']('execute',()=>{_0x3dd114['isEnabled']&&(_0x2b5e02['editing']['view']['focus'](),_0x2b5e02['commands']['execute']('aiQuickAction',_0x1705b9));});}['_createActionGroupButton'](_0xd260b3,_0x497fe9,_0x3deda9){const _0x2e145c=new zt(this['locale']),_0x379454=new Pt(),_0x276aa4=new pa(this['locale'],_0x379454),_0x1f53b9=_0x276aa4['bindTemplate'],_0x5849c6=this['_getPanelKeystroke'](_0x3deda9),_0x2fc9d3=this['_createGroupActionsList'](_0xd260b3,_0x497fe9['actions'],_0x3deda9);_0x276aa4['set']({'label':_0x497fe9['label'],'withText':!0x0,'role':Ta,'icon':_0x497fe9['icon']??_0x355d7e,'isEnabled':_0x497fe9['actions']['some'](_0x1e878c=>_0x1e878c['isEnabled'])}),_0x276aa4['extendTemplate']({'on':{'mouseenter':_0x1f53b9['to'](()=>{this['_isSearchFocused']()||_0x276aa4['focus']();})}});const _0x50c3e8=new yt(this['locale']);return _0x50c3e8['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x1f53b9['to'](_0x557e06=>{this['_handlePanelKeydown'](_0x557e06,_0x5849c6,_0x276aa4,_0x50c3e8);})}}),_0x276aa4['bind']('isOn')['to'](_0x50c3e8,'isVisible'),this['_bodyCollection']['add'](_0x50c3e8),_0x50c3e8['content']['add'](_0x2fc9d3),this['_setupGroupMenuBehavior'](_0x276aa4,_0x50c3e8),_0x2e145c['children']['add'](_0x276aa4),this['_actionButtons']['push']({'buttonView':_0x276aa4,'action':_0x497fe9}),{'listItem':_0x2e145c,'highlightView':_0x379454};}['_createGroupActionsList'](_0xce8380,_0x48938b,_0x19ea2f){const _0x447b32=new jt(this['locale']);return _0x447b32['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x48938b['forEach'](_0x2c25d9=>{const _0x1ea0e6=new zt(this['locale']),_0x5e8a33=Ia({'editor':_0xce8380,'action':_0x2c25d9,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x1ea0e6['children']['add'](_0x5e8a33),_0x19ea2f['focusTracker']['add'](_0x5e8a33),_0x447b32['items']['add'](_0x1ea0e6);}),_0x447b32;}['_setupGroupMenuBehavior'](_0x5409f3,_0x5207a6){const _0x3e1bd8=_0x5409f3['bindTemplate'],_0x144019=this['_getButtonKeystroke'](_0x5409f3);_0x5409f3['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x3e1bd8['to'](()=>{this['_showNestedPanel'](_0x5207a6,_0x5409f3);}),'mouseleave':_0x3e1bd8['to'](_0xe91757=>{const _0x5e151e=_0xe91757['relatedTarget'];this['_isMovingToNestedMenu'](_0x5e151e,_0x5207a6)||this['_hideNestedPanel'](_0x5207a6);}),'keydown':_0x3e1bd8['to'](_0x1de435=>{_0x1de435['key']==_0x144019&&(this['_showNestedPanel'](_0x5207a6,_0x5409f3),_0x5207a6['content']['get'](0x0)['focus']());})}}),_0x5207a6['on']('render',()=>{_0x5207a6['element']?.['addEventListener']('mouseleave',_0x57d574=>{const _0x11537a=_0x57d574['relatedTarget'];_0x5409f3['element']?.['contains'](_0x11537a)||this['_isMovingToNestedMenu'](_0x11537a,_0x5207a6)||this['_hideNestedPanel'](_0x5207a6);});});}['_showNestedPanel'](_0x3aaaef,_0x34c3d4){this['_openNestedPanels']['forEach'](_0x4bde1a=>{_0x4bde1a!==_0x3aaaef&&_0x4bde1a['isVisible']&&_0x4bde1a['hide']();}),_0x3aaaef['show'](),_0x3aaaef['pin']({'positions':[Ut['eastSouth']],'target':_0x34c3d4['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x3aaaef);}['_hideNestedPanel'](_0x1341a5){_0x1341a5['hide'](),this['_openNestedPanels']['delete'](_0x1341a5);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x51d489=>_0x51d489['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x4bc077,_0x26e835){if(!_0x4bc077)return!0x1;if(_0x26e835['element']?.['contains'](_0x4bc077))return!0x0;const _0x4956a1=_0x4bc077;return _0x4956a1['closest']&&(null!==_0x4956a1['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x4956a1['closest']('.ck-ai-quick-actions-group-list')||null!==_0x4956a1['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'](_0x5c56b7){return'rtl'===_0x5c56b7['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x2743e1){return'rtl'===_0x2743e1['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x5e2f2f,_0x8d93c7,_0x5c4610,_0x6226c8){_0x5e2f2f['key']==_0x8d93c7&&(_0x5c4610['focus'](),this['_hideNestedPanel'](_0x6226c8));}['_handleSearchResultButtonClick'](_0x1a52bd){_0x1a52bd['fire']('execute');}};function Ca(_0x17b486){const {editor:_0x15f752,content:_0xc45e2d,buttonDefinition:_0x19fc69,bodyCollection:_0x30b8a8,hasSearch:_0x454f78=!0x1,actionButtons:_0x4eda48}=_0x17b486;return()=>{const _0x46aa03=_0x15f752['locale'],_0x280f42=_0x15f752['commands']['get']('aiQuickAction'),_0x2c6db7=_0x4a2fa7(_0x46aa03);_0x2c6db7['bind']('isEnabled')['to'](_0x280f42),_0x2c6db7['buttonView']['set']({'icon':_0x19fc69['icon']??_0x355d7e,'label':_0x19fc69['label'],'tooltip':!0x0}),_0x2c6db7['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x3dcd2a=new wa(_0x15f752,_0xc45e2d,_0x2c6db7,_0x30b8a8,_0x454f78,_0x4eda48);return _0x2c6db7['panelView']['children']['add'](_0x3dcd2a),_0x454f78&&_0x2c6db7['on']('change:isOpen',(_0x39c367,_0x4253b6,_0x339276)=>{if(_0x339276){if(_0x15f752['plugins']['has']('AIEditing')){const _0x3ba3b0=_0x15f752['plugins']['get'](Is),_0x4809c1=_0x15f752['model']['document']['selection'],_0x319dc3=Array['from'](_0x4809c1['getRanges']());_0x319dc3['length']>0x0&&_0x3ba3b0['showFakeVisualSelection']({'editor':_0x15f752,'ranges':_0x319dc3,'id':'quick-action','priority':0x14});}}else _0x15f752['plugins']['has']('AIEditing')&&_0x15f752['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x3dcd2a['resetSearch']();}),_0x2c6db7;};}const fa='<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>',ba='<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>',Sa='<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>',Ra=/* #__PURE__ -- @preserve */
37
- ((()=>({'chat':'AIChat','action':'AIActions'}))());var Oa=class AIQuickActionsUI extends _0x1c4dee{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,nn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiquickactions');const _0x28cefa=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x28cefa),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x1e7c5f){return function(_0x36e6d4){const _0x421ab3=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x36e6d4['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xbde94f},{'id':'chat-commands','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xbde94f,'actions':[{'id':'explain','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x36e6d4,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x421ab3),'type':'chat'},{'id':'summarize','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x36e6d4,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x421ab3),'type':'chat'},{'id':'highlight-key-points','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x36e6d4,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x421ab3),'type':'chat'}]},{'id':'improve-writing','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x53a96a},{'id':'continue','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x295849},{'id':'fix-grammar','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x3fc065},{'id':'adjust-length','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x31de5d,'actions':[{'id':'make-shorter','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x62c29b,'actions':[{'id':'make-tone-casual','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x1b8aec,'actions':[{'id':'translate-to-english','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x36e6d4,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x4ddb86,'actions':[]}];}(_0x1e7c5f);}['_getDefaultAndCustomActions'](){const _0x50e2cc=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x4d3af0=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0xb5a37c=>({..._0xb5a37c,'type':'chat'===_0xb5a37c['type']?'chat':'action','icon':void 0x0}));return _0x50e2cc['find'](_0x116018=>'other'===_0x116018['id'])['actions']['push'](..._0x4d3af0),_0x50e2cc;}async['_initActionTypeQuickActions'](){try{const _0x21bd2e=new Qs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x359548=await _0x21bd2e['getAll'](),_0x494101=(await _0x21bd2e['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x494101),this['_enableButtonsByType']('action',_0x22612f=>!!_0x359548['find'](_0x1d8483=>_0x1d8483['id']===_0x22612f['model'])||void 0x0===_0x22612f['model']);}catch(_0x6d370a){const _0x55422e=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x6d370a});this['_reporter']['logError'](_0x55422e);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x119f2e=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x119f2e,'change:isConversationReady',(_0x56d6be,_0x391329,_0x10282e)=>{_0x10282e&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x119f2e['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x108e94,_0x3cf4e2){this['_quickActionsDefinition']['forEach'](_0x1d290b=>{'actions'in _0x1d290b?_0x1d290b['actions']['forEach'](_0x374112=>{_0x374112['type']===_0x108e94&&(_0x374112['isEnabled']=_0x3cf4e2(_0x374112));}):_0x1d290b['type']===_0x108e94&&(_0x1d290b['isEnabled']=_0x3cf4e2(_0x1d290b));}),this['_actionButtons']['forEach'](_0x5a78ed=>{if(va(_0x5a78ed['action']))return;if(_0x5a78ed['action']['type']!==_0x108e94)return;const _0x1ec73d=_0x3cf4e2(_0x5a78ed['action']);if(_0x5a78ed['action']['isEnabled']=_0x1ec73d,_0x5a78ed['buttonView']['isEnabled']=_0x1ec73d,!_0x1ec73d&&_0x5a78ed['action']['model']){const _0x277429=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x5a78ed['action']['id'],'modelId':_0x5a78ed['action']['model']});this['_reporter']['logError'](_0x277429);}}),this['_actionButtons']['filter'](_0x5c0730=>va(_0x5c0730['action']))['forEach'](_0x5f12df=>{_0x5f12df['buttonView']['isEnabled']=_0x5f12df['action']['actions']['some'](_0x217319=>_0x217319['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x1c0107,group:_0x487296})=>{_0x1c0107['isEnabled']=_0x487296['actions']['some'](_0x1aebb3=>_0x1aebb3['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x4fccff){this['_actionButtons']['forEach'](_0x441882=>{va(_0x441882['action'])||'action'===_0x441882['action']['type']&&(_0x441882['action']['model']||(_0x441882['action']['model']=_0x4fccff));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x1f2fd0=new Lt(this['editor']['locale']);_0x1f2fd0['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x1f2fd0),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x1f2fd0);}['_initializeQuickActionsDropdown'](_0x5abbc8){const _0x2f89fd=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x355d7e,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x5abbc8,'hasSearch':_0x2f89fd,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x1d75c6){this['_quickActionsDefinition']=_0x1d75c6['map'](_0x415a17=>{if('actions'in _0x415a17){const _0x4218d5=_0x415a17;return{..._0x4218d5,'actions':_0x4218d5['actions']['map'](_0x274b53=>{const {actions:_0x2e7426,..._0x50eaba}=_0x4218d5;return{..._0x274b53,'isEnabled':!0x1,'parent':_0x50eaba};})['filter'](_0x5a7055=>this['_shouldIncludeAction'](_0x5a7055))};}return{..._0x415a17,'isEnabled':!0x1};})['filter'](_0x5b5ec1=>'actions'in _0x5b5ec1?_0x5b5ec1['actions']['length']>0x0:this['_shouldIncludeAction'](_0x5b5ec1));}['_shouldIncludeAction'](_0x3d09ff){const _0x47ba1c=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x3d09ff['type']])&&!_0x47ba1c['includes'](_0x3d09ff['id'])&&!('chat'===_0x3d09ff['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x5a4b64){this['_quickActionsDefinition']['forEach'](_0x4f450c=>{if('actions'in _0x4f450c){const _0x21d8ae=Ca({'editor':this['editor'],'content':_0x4f450c['actions'],'buttonDefinition':_0x4f450c,'bodyCollection':_0x5a4b64,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4f450c['id'],_0x21d8ae),_0x4f450c['actions']['forEach'](_0x52c73b=>{const _0x5f321a=Ia({'editor':this['editor'],'action':_0x52c73b,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x52c73b['id'],_0x5f321a);});}else{const _0x1ef9a8=Ia({'editor':this['editor'],'action':_0x4f450c,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4f450c['id'],_0x1ef9a8);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x192b9e=>{const _0x22da8e=this['editor']['commands']['get']('aiQuickAction'),_0x479701=new _0x589b9d(_0x192b9e),_0x3360cd=us(_0x192b9e,'AI_QUICK_ACTIONS_HEADING');_0x479701['buttonView']['set']({'label':_0x3360cd,'icon':_0x355d7e});const _0xb70346=new te(_0x192b9e);return _0xb70346['set']({'ariaLabel':_0x3360cd,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x864da6=>{if('actions'in _0x864da6){const _0x3a30fa=_0x864da6,_0x29da91=new Zt(_0x192b9e,_0x479701),_0x55a68d=new _0x589b9d(_0x192b9e),_0x57f8eb=new te(_0x192b9e);_0x55a68d['buttonView']['set']({'label':_0x3a30fa['label'],'icon':_0x3a30fa['icon']}),_0x3a30fa['actions']['forEach'](_0x48624a=>{const _0xb5b62f=new Zt(_0x192b9e,_0x55a68d),_0x18c31c=new Jt(_0x192b9e);_0x18c31c['set']({'label':_0x48624a['label'],'icon':_0x48624a['icon'],'role':'menuitem','isEnabled':_0x48624a['isEnabled']}),_0x18c31c['on']('execute',()=>{this['_executeQuickAction'](_0x48624a);}),this['_actionButtons']['push']({'buttonView':_0x18c31c,'action':_0x48624a}),_0x18c31c['delegate']('execute')['to'](_0x55a68d),_0xb5b62f['children']['add'](_0x18c31c),_0x57f8eb['items']['add'](_0xb5b62f);}),_0x55a68d['isEnabled']=_0x3a30fa['actions']['some'](_0x5d6808=>_0x5d6808['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x55a68d,'group':_0x3a30fa}),_0x55a68d['panelView']['children']['add'](_0x57f8eb),_0x29da91['children']['add'](_0x55a68d),_0xb70346['items']['add'](_0x29da91);}else{const _0x23f080=_0x864da6,_0x483be3=new Zt(_0x192b9e,_0x479701),_0x395919=new Jt(_0x192b9e);_0x395919['set']({'label':_0x23f080['label'],'icon':_0x23f080['icon'],'role':'menuitem','isEnabled':_0x23f080['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x395919,'action':_0x23f080}),_0x395919['on']('execute',()=>{this['_executeQuickAction'](_0x23f080);}),_0x395919['delegate']('execute')['to'](_0x479701),_0x483be3['children']['add'](_0x395919),_0xb70346['items']['add'](_0x483be3);}}),Object['values'](Ra)['some'](_0x184c3b=>this['editor']['plugins']['has'](_0x184c3b))?_0x479701['bind']('isEnabled')['to'](_0x22da8e):_0x479701['set']({'isEnabled':!0x1}),_0x479701['panelView']['children']['add'](_0xb70346),_0x479701;});}['_executeQuickAction'](_0xa8711f){const _0xa3f695=this['editor'];_0xa3f695['editing']['view']['focus'](),_0xa3f695['commands']['execute']('aiQuickAction',_0xa8711f);const _0x26e031=_0xa3f695['ui']['view']['menuBarView'];_0x26e031&&_0x26e031['close']&&_0x26e031['close']();}};function va(_0x49f870){return'actions'in _0x49f870;}function ka(_0x1582bf,_0x24d071){const _0x593240=_0x1582bf['plugins']['get']('AITabs')['view'];_0x593240['isVisible']=!0x0,_0x593240['activateTab'](_0x24d071);}var Na=class extends _0xbc060f{['execute'](_0x502f20){switch(this['_expandSelectionIfCollapsed'](),_0x502f20['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x402937=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x402937});}this['_handleAIChatAction'](_0x502f20);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x5c5ec7=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5c5ec7});}this['_handleAIActionsAction'](_0x502f20);}}async['_handleAIChatAction'](_0x422f4f){const _0x29688d=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x422f4f['id'])_0x29688d['removeSelectionFromChatContext'](),_0x29688d['addSelectionToChatContext'](this['editor']),_0x29688d['focusPromptInput']();else await _0x29688d['startConversation']({'modelId':_0x422f4f['model']}),_0x29688d['removeSelectionFromChatContext'](),_0x29688d['addSelectionToChatContext'](this['editor']),_0x29688d['focusPromptInput'](),await _0x29688d['sendMessage']({'message':_0x422f4f['prompt']||_0x422f4f['displayedPrompt']||_0x422f4f['label'],'attributes':{'quickActionData':{'id':_0x422f4f['id']},'displayedPrompt':_0x422f4f['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x1f3099=this['editor'],_0x31eef4=_0x1f3099['model']['document']['selection'];if(!_0x31eef4['isCollapsed'])return;const _0x1f6f77=mt(_0x31eef4['getSelectedBlocks']())||_0x1f3099['model']['schema']['getLimitElement'](_0x31eef4);_0x1f3099['model']['change'](_0x34b0d1=>{_0x34b0d1['setSelection'](_0x1f6f77,'in');});}['_handleAIActionsActionLabel'](_0x10225b){return _0x10225b['parent']?.['label']&&'other'!==_0x10225b['parent']?.['id']?_0x10225b['parent']['label']+':\x20'+_0x10225b['label']:_0x10225b['label'];}async['_handleAIActionsAction'](_0x31a0ec){const _0x2ef423=this['editor']['plugins']['get']('AIActions'),_0x432e95=_0x31a0ec['prompt']?{'userMessage':_0x31a0ec['prompt'],'model':_0x31a0ec['model']}:{'actionName':_0x31a0ec['actionName']||_0x31a0ec['id'],'args':_0x31a0ec['args']},_0x3d8c86=this['_handleAIActionsActionLabel'](_0x31a0ec);await _0x2ef423['executeAction'](_0x432e95,_0x3d8c86,_0x31a0ec['icon']);}},ya=class extends _0x1c4dee{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2cde20=this['editor'],_0x4e420d=new Na(this['editor']);if(_0x2cde20['commands']['add']('aiQuickAction',_0x4e420d),_0x2cde20['plugins']['has']('AIChat')){const _0x5e6c88=this['editor']['plugins']['get']('AIChatController');_0x2cde20['model']['document']['selection']['on']('change:range',(_0x32551f,_0x998a70)=>{_0x998a70['directChange']&&_0x5e6c88['removeSelectionFromChatContext']();});}}},xa=class extends dn{['appendContent'](_0x419519,_0x5583ee='text'){'modification'===this['type']&&'text'===_0x5583ee&&(_0x5583ee=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x419519,_0x5583ee);}['updateChangeGroups'](_0x586005){const _0x32399e=this['parsedContent']['get'](_0x586005)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x586005,_0x32399e),this['changeGroups']=[],0x0==_0x32399e['childNodes']['length'])return;Ds(this['documentContextContent']['get'](_0x586005),this['parsedMergedContent']['get'](_0x586005));const _0x4c966d=_0x581566(this['documentContextContent']['get'](_0x586005)['children']['map'](_0x3a376b=>({'node':_0x3a376b,'id':fs(_0x3a376b,'data-id')})),_0x32399e['children']['map'](_0x340609=>({'node':_0x340609,'id':fs(_0x340609,'data-id')||vt()})),{'comparator':(_0x244ead,_0x343c70)=>_0x244ead['id']==_0x343c70['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x4c966d['length']&&_0x4c966d[_0x4c966d['length']-0x1]['removed'];)_0x4c966d['pop']();}const _0x6742d9=_0x4c966d['map'](_0x19d418=>{const _0x408917=_0x19d418['added']?'new':_0x19d418['removed']?'removed':'modified';return{'node':_0x19d418['value'][0x0]['node'],'type':_0x408917,'id':_0x19d418['value'][0x0]['id']};}),_0x4a5900=this['_documentIdToSource']['get'](_0x586005);this['changeGroups']['push']({'changes':_0x6742d9,'state':'pending','index':this['changeGroups']['length'],'editor':_0x4a5900['editor'],'rootName':_0x4a5900['rootName'],'documentId':_0x586005});}['_getDifferentChangeGroups'](_0x3700b9,_0x1e1caf){return _0x1e1caf;}},La=class extends An{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x2d7ca6){super(_0x2d7ca6),this['content']=_0x2d7ca6['content'],this['version']=_0x2d7ca6['version'],this['editor']=_0x2d7ca6['editor'],this['rootName']=_0x2d7ca6['rootName'],this['actionName']=_0x2d7ca6['actionName'],this['args']=_0x2d7ca6['args'],this['userMessage']=_0x2d7ca6['userMessage'],this['model']=_0x2d7ca6['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'](_0x402186){const _0x2fc46f=this['editor']['config']['get']('collaboration.channelId'),_0x5e7a33=new xa({..._0x402186,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x2fc46f,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x2fc46f,this['editor']]])});return this['replies']['push'](_0x5e7a33),_0x5e7a33['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x5e7a33),_0x5e7a33;}},Da=class extends _0x3ffb1c{constructor(_0x243abd,_0x38ba65=!0x0,_0x42f194=!0x0){super(_0x243abd),this['set']('isEnabled',!0x1),_0x38ba65&&(this['applyButton']=this['_createButton'](us(_0x243abd,'AI_BALLOON_APPLY_BUTTON'),on),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x42f194&&(this['suggestButton']=this['_createButton'](us(_0x243abd,'AI_BALLOON_SUGGEST_BUTTON'),_0x38ba65?an:on),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x38ba65,'showSuggestButton':_0x42f194}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x4cc1f8,showSuggestButton:_0x5d6b77}){this['applyButton']&&(this['applyButton']['isVisible']=_0x4cc1f8),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x5d6b77);}['_createButton'](_0x3237b2,_0x2b4c86){const _0x4e9772=new Ht(this['locale']);return _0x4e9772['set']({'label':_0x3237b2,'class':_0x2b4c86,'isVisible':!0x0,'withText':!0x0}),_0x4e9772;}},Pa=class extends _0x1f08de{constructor(_0x4455cb){super(_0x4455cb),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(_0x4455cb,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x1f08de{constructor(_0x4f456a){super(_0x4f456a),this['set']('isVisible',!0x0);const _0xd05923=new cr('small');_0xd05923['isVisible']=!0x0;const _0x5a87a4=new _0x1f08de(this['locale']);_0x5a87a4['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',_0x1f3123=>!_0x1f3123)]},'children':[_0xd05923,_0x5a87a4]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x3a6d5f,_0x3b009b){super(_0x3a6d5f),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x3b009b,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 _0x3994e5(),this['_addContentWrapper'](_0x3b009b),this['_addDisclaimerView'](),this['_addToolbar'](_0x3b009b),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'](_0x3b009b);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x5aa1a1 of this['_focusables'])this['_focusTracker']['add'](_0x5aa1a1['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x301f6c){-0x1===_0x301f6c?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x290a06){this['_isLoading']=_0x290a06;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x2a8552){super['showError'](_0x2a8552),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x4feade){super['showBlockingError'](_0x4feade),this['setErrorState']();}['addMiniToolbarItem'](_0x406a19){this['_miniToolbarView']['items']['has'](_0x406a19)||this['_miniToolbarView']['items']['add'](_0x406a19);}['removeMiniToolbarItem'](_0x156033){this['_miniToolbarView']['items']['has'](_0x156033)&&this['_miniToolbarView']['items']['remove'](_0x156033);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x15bf64,showSuggestButton:_0x48177b}){_0x15bf64=_0x15bf64&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x48177b=_0x48177b&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x15bf64,'showSuggestButton':_0x48177b});}async['updateContent'](_0x509036){await this['_streamableContentView']['update'](_0x509036);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x3a820f){this['_contentWrapper']=new _0x1f08de(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'](_0x3a820f['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x1f1d8e,showSuggestButton:_0x4af735}){this['_toolbarView']=new Da(this['locale'],_0x1f1d8e,_0x4af735),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',(_0x25c2df,_0x17a665,_0x4df037)=>!(_0x25c2df||_0x17a665||_0x4df037)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x1f1d8e,'showSuggestButton':_0x4af735}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x2a7b8b){return this['_miniToolbarView']=new ua(this['locale'],_0x2a7b8b),this['_miniToolbarView']['delegate'](...Nn)['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',(_0x1d6593,_0x2f377f)=>!(_0x1d6593||_0x2f377f)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ha(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x427653=new Ht(this['locale']),_0x4dd838=new Ht(this['locale']),_0x3622c4=new Va(this['locale']),_0x458bf3=new Ht(this['locale']);_0x427653['set']({'icon':_0x19fb4b,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+hn}),_0x4dd838['set']({'icon':_0xed123e,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+hn}),_0x458bf3['set']({'icon':_0xb20ede,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+hn}),_0x427653['bind']('isEnabled')['to'](this,'isBusy',_0x50c7e4=>!_0x50c7e4),_0x427653['on']('execute',()=>{this['fire']('tryAgain');}),_0x4dd838['bind']('isEnabled')['to'](this,'isBusy',_0xa548cf=>!_0xa548cf),_0x4dd838['on']('execute',()=>{this['fire']('showPrevious');}),_0x458bf3['bind']('isEnabled')['to'](this,'isBusy',_0x2cf668=>!_0x2cf668),_0x458bf3['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x4dd838,this['_navigationCounter']=_0x3622c4,this['_navigationNextButton']=_0x458bf3,this['_navigationTryAgainButton']=_0x427653;}['updateMiniToolbarButtons'](_0x47a179,_0x3de06a){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x13feb2=_0x47a179>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x13feb2){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x2109cc=_0x47a179-_0x3de06a;this['_navigationCounter']['setInteractionCount'](_0x2109cc+'/'+_0x47a179),this['_navigationPreviousButton']['isEnabled']=_0x3de06a<_0x47a179-0x1,this['_navigationNextButton']['isEnabled']=_0x3de06a>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'](_0x3ad534){this['_isLoading']=_0x3ad534;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x582d5b=this['_streamableContentView']['element'],_0x29b1d8=this['_miniToolbarView']['element'],_0x273e07=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x5ee19c=_0x582d5b['offsetWidth']-_0x582d5b['clientWidth'];_0x29b1d8['style']['right']='calc('+_0x5ee19c+'px\x20+\x20var(--ck-spacing-large))';});};_0x273e07(),this['_miniToolbarResizeObserver']=new It(_0x582d5b,()=>{_0x273e07();});}['_initializeScrollManager'](){const _0x58d67b=this['_getScrollableElement']();_0x58d67b&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x58d67b));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x1f08de{constructor(_0x136420){super(_0x136420);const _0xdbe3f8=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0xdbe3f8['to']('interactionCount')}]});}['setInteractionCount'](_0x10c2ee){this['set']('interactionCount',_0x10c2ee);}},Ua=class extends _0x1c4dee{static get['requires'](){return[ls,nn,Mt,Is,la,_0x5bc848];}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(_0x3c1307){super(_0x3c1307),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x553f6f,_0x68bd72,_0x2b8781){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x62f2fe,anchorData:_0xbf260d,root:_0x2204a4}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x553f6f,_0x62f2fe,_0xbf260d,_0x2204a4,_0x68bd72,_0x2b8781);}const {modelFragment:_0x596c1e,anchorData:_0x1a52d3,root:_0xebed54}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x553f6f,_0x596c1e,_0x1a52d3,_0xebed54,_0x68bd72,_0x2b8781);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0xf877fa=this['editor']['plugins']['has']('TrackChanges');let _0x396c7b=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0xf877fa||(_0x396c7b=_0x396c7b['filter'](_0x2c3b78=>'insertSuggestion'!=_0x2c3b78));const _0xf011c9=this['editor']['commands']['get']('trackChanges'),_0xa233c8=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0xf877fa,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x396c7b});return _0xa233c8['bind']('isBusy')['to'](this),_0xf011c9&&_0xa233c8['bind']('isTrackChangesOn')['to'](_0xf011c9,'value'),_0xa233c8['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0xa233c8['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0xa233c8['on']('showNext',()=>{this['_navigateToNext']();}),_0xa233c8;}['_normalizeSelectionStart'](){const _0x3a2008=this['editor']['model'],_0x3de5fe=_0x3a2008['document']['selection'],_0x4d89ae=_0x3de5fe['getFirstRange']();if(!_0x4d89ae||_0x4d89ae['isCollapsed'])return;const _0x21b454=mt(_0x3de5fe['getSelectedBlocks']());if(!_0x21b454)return;const _0x4c0b34=_0x3a2008['createPositionAt'](_0x21b454,0x0);_0x4c0b34['isAfter'](_0x4d89ae['start'])&&_0x3a2008['change'](_0x7fc6b4=>{_0x7fc6b4['setSelection'](_0x7fc6b4['createRange'](_0x4c0b34,_0x4d89ae['end']));});}['_getExecuteDataRegular'](){const _0x197abd=this['editor']['model']['document']['selection'],_0x381dcf=_0x197abd['getFirstRange']()['start']['root'];if(_0x197abd['isCollapsed']){const _0x3ba9ae=mt(_0x197abd['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x197abd);this['editor']['model']['change'](_0x7b5736=>{_0x7b5736['setSelection'](_0x3ba9ae,'in');});}this['_normalizeSelectionStart']();const _0x488357=_0x197abd['getFirstRange'](),_0x29c124=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x197abd),_0x488357['start'],_0x488357['end']);this['_copyMarkersToFragment'](_0x29c124,_0x197abd,{'isTableSelection':!0x1});const _0x28131a=_0x197abd['getFirstRange']()['start'],_0x151588=new Map();let _0x17ffcf=_0x29c124;for(let _0x53b7b3=0x0;_0x53b7b3<_0x28131a['path']['length'];_0x53b7b3++)_0x151588['set'](_0x17ffcf,_0x28131a['path'][_0x53b7b3]),_0x17ffcf=_0x17ffcf['getChild'](0x0);return{'modelFragment':_0x29c124,'anchorData':_0x151588,'root':_0x381dcf};}['_getExecuteDataInTable'](){const _0x348370=this['editor']['model']['document']['selection'],_0x186f46=this['editor']['plugins']['get']('TableSelection'),_0x5513e7=_0x348370['getFirstRange']()['start']['root'],_0x10e82f=_0x186f46['getSelectionAsFragment'](),_0x3cb35d=_0x348370['getFirstRange']()['start']['parent']['parent'],_0x197c57=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x3cb35d),this['editor']['model']['createPositionAfter'](_0x3cb35d)),_0x453fc1=this['_wrapWithCommonAncestors'](_0x10e82f,_0x197c57['start'],_0x197c57['end']);this['_copyMarkersToFragment'](_0x453fc1,_0x348370,{'isTableSelection':!0x0});const _0x3c2343=_0x348370['getFirstRange']()['start'],_0xef49aa=new Map();let _0x37f5ca=_0x453fc1;for(let _0x247b62=0x0;_0x247b62<_0x3c2343['path']['length'];_0x247b62++)if(_0xef49aa['set'](_0x37f5ca,_0x3c2343['path'][_0x247b62]),_0x247b62<_0x3c2343['path']['length']-0x1)_0x37f5ca=_0x37f5ca['getChild'](0x0);else{let _0x408e5c=_0x37f5ca['nextSibling'];for(;_0x408e5c;)_0xef49aa['set'](_0x408e5c,_0x3c2343['path'][_0x247b62]),_0x408e5c=_0x408e5c['nextSibling'];}return{'modelFragment':_0x453fc1,'anchorData':_0xef49aa,'root':_0x5513e7};}async['_executeAction'](_0x5a9daa,_0x2f8bac,_0x417370,_0x55cac6,_0x3566bc,_0x4afec4){const _0x4a02d0=this['editor']['plugins']['get'](Is),_0x37f994=this['editor']['plugins']['get'](la),_0x49d25a=this['editor']['model']['document']['selection'],_0xb8afdd=await _0x4a02d0['modelToDataWithIds'](_0x2f8bac,this['editor']),_0x42e297=this['editor']['model']['document']['version'],_0x360595=[..._0x49d25a['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x37f994['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x3566bc,'icon':_0x4afec4||_0x355d7e,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x360595,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x37f994),this['_interactionParams']={'action':_0x5a9daa,'content':_0xb8afdd,'version':_0x42e297,'aiBalloon':_0x37f994,'modelFragment':_0x2f8bac,'anchorData':_0x417370,'root':_0x55cac6},this['_setupApplyListeners'](),this['listenTo'](_0x37f994,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x37f994,'dialogClosed',(_0x2e3d73,{id:_0x52a371})=>{if('aiActionsBalloon'===_0x52a371){for(const _0x361adc of this['_interactions']){if(0x0===_0x361adc['replies']['length']||_0x361adc['stoppedExplicitly'])continue;const _0x1c7b51=_0x361adc['replies'][_0x361adc['replies']['length']-0x1],_0x31f210=_0x1c7b51['changeGroups'][0x0];_0x31f210&&'pending'===_0x31f210['state']&&_0x1c7b51['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x37f994);}}),this['_createInteraction'](_0xb8afdd,_0x42e297,_0x37f994,_0x5a9daa);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x1560dc,anchorData:_0x19273d,root:_0x1a065a}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x1560dc,_0x19273d,_0x1a065a,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x1560dc,_0x19273d,_0x1a065a,!0x0);});}['_wrapWithCommonAncestors'](_0x258ff3,_0x2089cd,_0x4e2a9c){const _0x34e36b=this['editor']['model']['createRange'](_0x2089cd,_0x4e2a9c)['getCommonAncestor'](),_0x47f5d0=_0x34e36b['is']('documentFragment')?[]:_0x34e36b['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x47f5d0['length']){const _0x2df70d=_0x47f5d0['map'](_0x20b1f3=>_0x20b1f3['_clone'](!0x1));for(let _0x2b0694=0x1;_0x2b0694<_0x2df70d['length'];_0x2b0694++)_0x2df70d[_0x2b0694-0x1]['_appendChild'](_0x2df70d[_0x2b0694]);return _0x2df70d[_0x2df70d['length']-0x1]['_appendChild'](_0x258ff3),new _0x46ccc9(_0x2df70d[0x0]);}return _0x258ff3;}['_copyMarkersToFragment'](_0x1e33cb,_0x3eb0ba,_0x5583b7={'isTableSelection':!0x1}){const _0x94fc37=this['editor']['model'],_0x22c478=Array['from'](_0x3eb0ba['getRanges']()),_0x5539d3=_0x3eb0ba['getFirstRange']()['start'];for(const _0x58ddf5 of _0x94fc37['markers']){if(_0x58ddf5['name']['startsWith']('ai-selection')||!_0x58ddf5['affectsData'])continue;const _0x59998a=_0x58ddf5['getRange']();if(!_0x22c478['some'](_0x1c19be=>_0x1c19be['containsRange'](_0x59998a,!0x0)))continue;const _0x4c8a1b=this['_regularCalculateMarkerPath'](_0x59998a['start'],_0x5539d3,_0x5583b7['isTableSelection']),_0x2e0ec9=this['_regularCalculateMarkerPath'](_0x59998a['end'],_0x5539d3,_0x5583b7['isTableSelection']),_0x4141b7=_0x94fc37['createPositionFromPath'](_0x1e33cb,_0x4c8a1b),_0x4a69d8=_0x94fc37['createPositionFromPath'](_0x1e33cb,_0x2e0ec9);if(!_0x4141b7['isEqual'](_0x4a69d8)){const _0x552075=_0x94fc37['createRange'](_0x4141b7,_0x4a69d8);_0x1e33cb['markers']['set'](_0x58ddf5['name'],_0x552075);}}}['_regularCalculateMarkerPath'](_0x41a75f,_0x996cc5,_0x5270ee=!0x1){const _0xf92825=[..._0x41a75f['path']['slice']()];for(let _0x4981c3=0x0;_0x4981c3<Math['max'](_0x996cc5['path']['length'],_0x41a75f['path']['length']);_0x4981c3++){const _0x49d23b=_0x996cc5['path'][_0x4981c3]||0x0,_0x19fbc3=(_0x41a75f['path'][_0x4981c3]||0x0)-_0x49d23b;if(_0xf92825[_0x4981c3]=_0x19fbc3,0x0!==_0x19fbc3&&!_0x5270ee)break;}return _0xf92825;}async['_createInteraction'](_0x954362,_0x9862e1,_0x23f5e2,_0x1779ed){const _0x4852f4=this['editor'],_0x4c5957=_0x4852f4['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x33336f(_0x4852f4,_0x4c5957['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x1779ed,'content':_0x954362,'version':_0x9862e1,'aiBalloon':_0x23f5e2,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x4c5957});const _0x44684b=new La({'connector':this['_aiConnector'],'locale':_0x4852f4['locale'],'content':_0x954362,'version':_0x9862e1,'editor':_0x4852f4,'rootName':_0x4c5957['rootName'],..._0x1779ed});this['_interactions']['push'](_0x44684b);const _0x402868=(_0x31f02c,_0x569ee6=!0x1,_0x311a51='streaming')=>{const {isDone:_0x22c061}=_0x31f02c;return this['_promiseQueue']['enqueue'](async _0x49271e=>{try{const _0x222a9f=Vs({'changeGroups':_0x31f02c['changeGroups'],'documentContextContent':_0x31f02c['documentContextContent'],'showDiff':_0x569ee6,'trimUnchanged':!0x1});_0x222a9f['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x222a9f[0x0],'renderingStrategy':_0x311a51,'abortSignal':_0x49271e}),_0x22c061&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x145da1){if(en(_0x145da1))return;throw _0x145da1;}});};_0x44684b['on']('replyCreated',(_0x2da7a3,_0x105de9)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x402868(_0x105de9)['catch'](_0x575e64=>{this['_reporter']['logError'](_0x575e64,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x44684b,_0x575e64);});}),_0x44684b['on']('replyContentUpdated',(_0x2ca2e2,_0x40ede5)=>{_0x402868(_0x40ede5)['catch'](_0x727ef4=>{this['_reporter']['logError'](_0x727ef4,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x44684b,_0x727ef4);});}),_0x44684b['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x579c5d){this['_reporter']['logError'](_0x579c5d,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x44684b,_0x579c5d);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x1e0c0c,{showDiff:_0x33e519})=>{try{this['_balloonShowDiff']=_0x33e519;const _0x32b7e6=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x32b7e6&&await _0x402868(_0x32b7e6,_0x33e519,'static');}catch(_0x5f0178){this['_reporter']['logError'](_0x5f0178,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x44684b,_0x5f0178);}}),_0x44684b['on']('replyChangeGroupStateUpdated',()=>{const _0x25100c={'positiveCount':_0x44684b['replies']['reduce']((_0x51d100,_0x289285)=>_0x51d100+_0x289285['changeGroups']['filter'](_0x2882a2=>'accepted'===_0x2882a2['state'])['length'],0x0),'totalCount':_0x44684b['replies']['reduce']((_0x6e6f24,_0x267197)=>_0x6e6f24+_0x267197['changeGroups']['length'],0x0)},_0x1253d6=_0x44684b['actionCallId'],_0x1d79ef=_0x44684b['actionName'];_0x1d79ef?this['_aiConnector']['upsertAIActionRating'](_0x1d79ef,_0x1253d6,_0x25100c):this['_aiConnector']['upsertCustomAIActionRating'](_0x1253d6,_0x25100c);}),this['_setLoadingState']();try{const _0x55f0b4=await _0x44684b['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x55f0b4;}catch(_0x12aeb6){en(_0x12aeb6)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x12aeb6,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x44684b,_0x12aeb6);}}['_applyChanges'](_0x933598,_0x4dc764,_0x4ca84e,_0x129c48){const _0x4debe7=this['editor'];if(_0x129c48&&!_0x4debe7['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x25a4a9=this['editor']['plugins']['get'](_0x5bc848),_0x502e27=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x502e27||!_0x502e27['replies']['length'])return;const _0x5b4668=_0x502e27['replies'][_0x502e27['replies']['length']-0x1];_0x5b4668['setChangeGroupState'](0x0,'accepted');const _0x5ad9e0=Rn({'documentSuggestions':On({'groups':[_0x5b4668['changeGroups'][0x0]],'documentContextContent':_0x5b4668['documentContextContent'],'documents':_0x502e27['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x25a4a9,'documentCompareOptions':{'anchor':_0x4debe7['model']['createPositionAt'](_0x933598,0x0),'markDeletions':_0x129c48}})['values']()['next']()['value']??[],_0x2f440e=this['_filterOperationsOutsideRange'](_0x5ad9e0,_0x4dc764);for(const _0x15f503 of _0x2f440e)this['_anchorOperation'](_0x4dc764,_0x15f503,_0x4ca84e);const _0x384820=_0x502e27['getDocumentContext']()['documents'][0x0]['version'],_0x5a9f79=_0x4a80ce(_0x2f440e,_0x4debe7['model']['document']['history']['getOperations'](_0x384820),{'document':_0x4debe7['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];zs(_0x5a9f79,'quickActions');try{_0x4debe7['model']['change'](_0x3ca27a=>{_0x3ca27a['setSelection'](_0x4debe7['model']['document']['selection']['focus']),_0x129c48?_0x4debe7['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5a9f79):_0x25a4a9['applyOperations'](_0x3ca27a,_0x5a9f79);});}catch(_0x19a9ad){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x19a9ad})),_0x19a9ad;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x3b546e,_0x1d1286){return _0x3b546e['filter'](_0x148476=>{if('rename'==_0x148476['type']){const _0x18653c=_0x148476['position']['nodeAfter'];return!_0x1d1286['has'](_0x18653c);}if(_0x148476['type']['indexOf']('Attribute')>-0x1){const _0x5b87df=_0x148476['range']['start']['nodeAfter'];return!_0x1d1286['has'](_0x5b87df);}return!0x0;});}['_anchorOperation'](_0x286634,_0xd2080d,_0x4d852c){const _0x155605=_0xd2080d['clone']();for(const _0x51b05 in _0xd2080d){const _0x31aa31=_0xd2080d[_0x51b05];_0x31aa31 instanceof _0x3888b9?_0xd2080d[_0x51b05]=new _0x3888b9(_0x1b5830(_0x31aa31['start']),_0x1b5830(_0x31aa31['end'])):_0x31aa31 instanceof _0x339ffb&&(_0xd2080d[_0x51b05]=_0x1b5830(_0x31aa31));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x155605['type'])){if(_0x155605['isDocumentOperation']=!0x1,_0x155605['baseVersion']=null,'remove'==_0x155605['type']){const _0x106fce=_0x155605['sourcePosition'],_0x3b3ada=_0x155605['howMany'];new _0x462971(_0x106fce,_0x3b3ada)['_execute']();}else _0x155605['_execute']();}function _0x1b5830(_0x2a2297){if('$graveyard'==_0x2a2297['root']['rootName'])return _0x2a2297;const _0x29ba8e=[];let _0x5b605e=_0x2a2297['root'];for(let _0x2f8099=0x0;_0x2f8099<_0x2a2297['path']['length'];_0x2f8099++){const _0x541e71=_0x286634['get'](_0x5b605e)||0x0;_0x29ba8e[_0x2f8099]=_0x2a2297['path'][_0x2f8099]+_0x541e71,_0x5b605e=_0x5b605e['getChildAtOffset'](_0x2a2297['path'][_0x2f8099]);}return new _0x339ffb(_0x4d852c,_0x29ba8e,_0x2a2297['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x4ad772,content:_0x3dcb46,version:_0x261428,aiBalloon:_0xa0296c}=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'](_0x3dcb46,_0x261428,_0xa0296c,_0x4ad772)['catch'](_0x598ec9=>{this['_reporter']['logError'](_0x598ec9,{'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 _0x47285c=this['_interactions']['length'];this['_currentInteractionIndex']<_0x47285c-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x3be12e){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x3be12e;const _0x13a2ce=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x13a2ce)return;if(_0x13a2ce['hasError'])return this['_setErrorState'](_0x13a2ce),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x13a2ce['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x11ac2e=_0x13a2ce['replies'][_0x13a2ce['replies']['length']-0x1];if(_0x11ac2e)try{const _0x476446=Vs({'changeGroups':_0x11ac2e['changeGroups'],'documentContextContent':_0x11ac2e['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x19f3e4=>setTimeout(_0x19f3e4,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x476446[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x4cfaee){this['_reporter']['logError'](_0x4cfaee,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x23c1ac,_0x1d8367){if(void 0x0!==_0x1d8367&&en(_0x1d8367))return;const _0x402263=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x402263),_0x23c1ac['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);}},Ba=class extends _0x1c4dee{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41c32c){super(_0x41c32c),_0x41c32c['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x1f08de{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x959a3f,_0x1538ab){super(_0x959a3f),this['id']=_0x1538ab,this['set']('status','pending'),this['set']('changeId',_0x1538ab),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',(_0x1b4e95,_0x475760)=>{_0x475760&&_0x475760['target']&&'A'===_0x475760['target']['tagName']&&_0x475760['preventDefault'](),this['fire']('activateChange',{'id':_0x1538ab,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x1538ab,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x1538ab,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x432162=new _0x1f08de(this['locale']);return _0x432162['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',_0x525676=>!_0x525676)]}}),_0x432162;}['_createAcceptButtonView'](){const _0x34f5f9=new Ht(this['locale']);return _0x34f5f9['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x34f5f9['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x98fed8=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x98fed8['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x45ae49=>'pending'!==_0x45ae49&&'accepted'!==_0x45ae49),this['bindTemplate']['if']('status',an,_0x4b3bdb=>'pending'===_0x4b3bdb),this['bindTemplate']['if']('status',hn,_0x5e11fb=>'pending'!==_0x5e11fb),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x1464b6=>'accepted'===_0x1464b6)]}}),this['on']('change:status',(_0xe86740,_0x174afe,_0x3ad301)=>{_0x34f5f9['isEnabled']='pending'===_0x3ad301,'accepted'===_0x3ad301&&(_0x34f5f9['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x34f5f9['icon']=_0x20a950);}),_0x34f5f9;}['_createDismissButtonView'](){const _0x5a107b=new Ht(this['locale']);return _0x5a107b['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x5a107b['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5cb2a5=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x5cb2a5['stopPropagation']();})},'attributes':{'class':[hn,this['bindTemplate']['if']('status','ck-hidden',_0x357a3f=>'pending'!==_0x357a3f&&'rejected'!==_0x357a3f),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x13ef1c=>'pending'===_0x13ef1c),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2fa1eb=>'rejected'===_0x2fa1eb)]}}),this['on']('change:status',(_0x1ed7dc,_0x54779d,_0x13b747)=>{_0x5a107b['isEnabled']='pending'===_0x13b747,'rejected'===_0x13b747&&(_0x5a107b['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x5a107b['icon']=_0x5ea60e);}),_0x5a107b;}['_createInfoButtonView'](){const _0x249e0e=new Ht(this['locale']);return _0x249e0e['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2be136,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':hn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x249e0e['bind']('isOn')['to'](this,'isInfoToggleOn',_0x28efc6=>_0x28efc6),_0x249e0e['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x249e0e;}['_createOutdatedButtonView'](){const _0x2659dc=new Ht(this['locale']);return _0x2659dc['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x5ace95,'withText':!0x0,'isEnabled':!0x1}),_0x2659dc['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x3b197a=>'outdated'!==_0x3b197a)],'disabled':'disabled'}}),_0x2659dc;}},Fa=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x411dc3,_0x4b37e7){super(_0x411dc3),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']()),_0x4b37e7['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0xf005ac){this['resultItemView']['changeId']=_0xf005ac['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0xf005ac['contentDiffed'];}['showBalloon'](_0x55193d,_0x533712,_0x2f0322,_0x3a793b,_0x114636,_0x39ee6f){const _0x2b44ed=_0x533712();if(!_0x2b44ed)return;this['updateContent'](_0x55193d),this['show']();const _0x611473=Array['from'](_0x2b44ed['getClientRects']())['reverse'](),_0x381606=this['_getPointedRectIndexFromEvent'](_0x2f0322,_0x611473),_0x2860e8=_0x611473[_0x381606??0x0];'click'===_0x3a793b?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x533712(),_0x381606,_0x55193d['id'],_0x114636,_0x39ee6f)||_0x2860e8})):'hover'===_0x3a793b&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x533712(),_0x381606,_0x55193d['id'])||_0x2860e8}));}['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'](){_0x563b8b({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x59c082=[this['element']];return this['_pinnedTargetElement']&&_0x59c082['push'](this['_pinnedTargetElement']),_0x59c082;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x42e016=new _0x1f08de();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x42e016['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']]}]}),_0x42e016;}['_getBestRectPositionOnClick'](_0x3cc18e,_0x450720,_0x73a943,_0x234818,_0x10f846){if(!_0x3cc18e)return null;const _0x3b49b3=this['position']['replace']('arrow_',''),_0x58a80f=Array['from'](_0x3cc18e['getClientRects']());let _0x49c966,_0x357575=_0x58a80f['reverse']();return void 0x0!==_0x450720&&this['_isPinnedRectVisible'](_0x357575[_0x450720],_0x234818,_0x10f846)?(_0x49c966=_0x357575[_0x450720],this['_pinnedRectIndex']=_0x450720):this['_isPinnedRectVisible'](_0x357575[0x0],_0x234818,_0x10f846)&&void 0x0===_0x450720?_0x49c966=_0x357575[0x0]:(_0x357575='s'==_0x3b49b3[0x0]?[..._0x58a80f]['reverse']():_0x58a80f,_0x357575['forEach'](_0x304bbd=>{this['_isPinnedRectVisible'](_0x304bbd,_0x234818,_0x10f846)&&(_0x49c966=_0x304bbd);})),this['_pinnedTargetChangeId']=_0x73a943,this['_pinnedTargetElement']=_0x3cc18e,_0x49c966||_0x3cc18e['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x1a03ff,_0x440e1b,_0x320762){if(!_0x1a03ff)return null;const _0x275d91=Array['from'](_0x1a03ff['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x440e1b&&this['_pinnedTargetChangeId']!==_0x320762?(this['_pinnedRectIndex']=_0x440e1b,this['_pinnedTargetElement']=_0x1a03ff,this['_pinnedTargetChangeId']=_0x320762,_0x275d91[_0x440e1b]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x320762?_0x1a03ff!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x275d91[this['_pinnedRectIndex']]:void 0x0!==_0x440e1b&&this['_pinnedTargetChangeId']!==_0x320762?(this['_pinnedRectIndex']=_0x440e1b,this['_pinnedTargetElement']=_0x1a03ff,this['_pinnedTargetChangeId']=_0x320762,_0x275d91[_0x440e1b]):_0x1a03ff['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x3969fb,_0x373537){if(_0x3969fb)for(let _0x56b003=0x0;_0x56b003<_0x373537['length'];_0x56b003++){const _0x1e6e48=_0x373537[_0x56b003];if(_0x3969fb['clientX']>=_0x1e6e48['left']-0x3&&_0x3969fb['clientX']<=_0x1e6e48['right']+0x3&&_0x3969fb['clientY']>=_0x1e6e48['top']-0x3&&_0x3969fb['clientY']<=_0x1e6e48['bottom']+0x3)return _0x56b003;}}['_isPinnedRectVisible'](_0x5077f7,_0x90c4ac,_0xf9147e){const _0x3dc88c=new At(_0x5077f7),_0x3e4fd1=_0x90c4ac||document['documentElement'],_0x2d3389=_0x3dc88c['getIntersection'](Et(_0xf9147e)),_0x74afeb=new At(_0x3e4fd1)['getIntersection'](_0x3dc88c);return!!(_0x2d3389&&_0x74afeb&&_0x3dc88c['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x5bb7a3{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x56de64){super(_0x56de64),this['_bodyCollection']=ln(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Ka)['to'](this),this['_balloonSuggestionView']=new Fa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x38ba69=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x38ba69);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x38a86a){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0xa8c74c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x38a86a,_0xa8c74c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x3a8cc3){_0x3a8cc3&&('error-general'!==_0x3a8cc3['status']?'error-chunk'!==_0x3a8cc3['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x2bb003){this['_mainView']['addCheckRunResult'](_0x2bb003);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x38363c){this['_mainView']['showGeneralReviewCoreErrorView'](_0x38363c??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x11289c,_0x3f44d5){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x11289c,_0x3f44d5);}['setActiveStateInResults'](_0x2423f7){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x2cfb4e=>{_0x2cfb4e['id']===_0x2423f7&&_0x2cfb4e['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x51715d=>_0x51715d['setItemAsInactive']());}['updateChangeState'](_0xccf788,_0xcd5bc9){'accepted'===_0xcd5bc9||'rejected'===_0xcd5bc9||'outdated'===_0xcd5bc9?this['_mainView']['reviewCheckResultsView']['hideResult'](_0xccf788,_0xcd5bc9):this['_mainView']['reviewCheckResultsView']['showResult'](_0xccf788,_0xcd5bc9);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x2e7a4c,_0x19381c,_0x4ebc54,_0x3cf1e3,_0x4bb1a3,_0x3050a9){this['_balloonSuggestionView']['showBalloon'](_0x2e7a4c,_0x19381c,_0x4ebc54,_0x3cf1e3,_0x4bb1a3,_0x3050a9);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x96830d){const _0x2165a0=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x158058=>_0x158058['id']===_0x96830d);return _0x2165a0?_0x2165a0['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x1f08de{constructor(_0x3a4398){super(_0x3a4398),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x572bfd=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x572bfd['if']('isVisible','ck-hidden',_0x85baed=>!_0x85baed)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x572bfd['to']('errorMessage')}]}]});}},$a=class extends _0x1f08de{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x5eae52,_0x38ac31){super(_0x5eae52),this['reviewCoreHeader']=_0x38ac31['header'],this['generalErrorView']=new Ya(_0x5eae52),this['reviewCheckListView']=_0x38ac31['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x38ac31['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x38ac31['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'](_0x26165a){this['reviewCheckResultsView']['addResult'](_0x26165a),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'](_0x4f7cc2){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x4f7cc2;}['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(_0x58a519,_0x4aee36){super(_0x4aee36),this['set']({'label':_0x58a519,'withText':!0x0,'class':on}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x3f12aa,_0x2a09d6){super(_0x3f12aa),this['_contents']=_0x2a09d6,this['_resultViews']=new _0x3994e5(),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 Mo(_0x3f12aa),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 _0x5b20ae=this['_createCombinedSkeletonLoader'](),_0x1448d8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x1448d8['if']('isLoading','ck-ai_review__check-run_loading',_0x4e5557=>_0x4e5557),_0x1448d8['if']('isResultReady','ck-ai_review__check-run_ready',_0x124558=>_0x124558),_0x1448d8['if']('isVisible','ck-hidden',_0x4eebb0=>!_0x4eebb0)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x5b20ae,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x515e6c){const _0xf0704c=new Ga(this['locale'],_0x515e6c['id']);_0xf0704c['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0xf0704c),_0xf0704c['resultResponseView']['element']['innerHTML']=_0x515e6c['contentDiffed'];}['hideResult'](_0x63db1,_0x351ddd){if('pending'===_0x351ddd)return;const _0x1b810d=this['_resultViews']['find'](_0x47ffea=>_0x47ffea['id']===_0x63db1);_0x1b810d&&(_0x1b810d['status']=_0x351ddd,_0x1b810d['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x3af889,_0x3154f4){if('pending'!==_0x3154f4)return;const _0x39a8e5=this['_resultViews']['find'](_0x35f247=>_0x35f247['id']===_0x3af889);_0x39a8e5&&(_0x39a8e5['status']=_0x3154f4,_0x39a8e5['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x214cff,_0x27d38e){this['headerTitle']=_0x214cff,this['headerSubtitle']=_0x27d38e||'';}['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 Xn(this['locale'],zn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x14eda2=new _0x1f08de(this['locale']),_0x5e6bc6=[];for(let _0x46fbc9=0x0;_0x46fbc9<0x10;_0x46fbc9++){const _0x5ac715=this['_createSkeletonLoader']();_0x5ac715['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x5e6bc6['push'](_0x5ac715);}return _0x14eda2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x42d843=>!_0x42d843)]},'children':_0x5e6bc6}),_0x14eda2;}['_createResultsBodyView'](){const _0x5bcfbe=new _0x1f08de(this['locale']);return _0x5bcfbe['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x23b6eb=>_0x23b6eb)]},'children':this['_resultViews']}),_0x5bcfbe;}['_createErrorView'](){const _0x4db11f=new _0x1f08de(this['locale']),_0x23ba7a=new Ht(this['locale']),t=this['locale']['t'];return _0x4db11f['delegate']('retryReview')['to'](this),_0x23ba7a['set']({'label':t('Try\x20again'),'withText':!0x0,'class':an+'\x20ck-ai_review__check-run-error-retry-button'}),_0x23ba7a['on']('execute',()=>{this['fire']('retryReview');}),_0x4db11f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x4a1bd3=>!_0x4a1bd3),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x26bcf3=>'chunk'===_0x26bcf3)]},'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',_0x4fed49=>'chunk'===_0x4fed49)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x288644=>'general'!==_0x288644)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x397ee9=>'chunk'!==_0x397ee9)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x23ba7a]}),_0x4db11f;}['_createCancelButtonView'](){const _0x1ff754=new Ht(this['locale']);return _0x1ff754['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[an+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x1ff754['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4228f5=>_0x4228f5),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5b3563=>_0x5b3563)]}}),_0x1ff754['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1ff754;}['_createToggleDiffButtonView'](){const _0x3483ea=new Ht(this['locale']);_0x3483ea['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x3483ea['bind']('isEnabled')['to'](this,'isError',_0x318a15=>!_0x318a15),_0x3483ea['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5bb408=>!_0x5bb408),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x808481=>_0x808481)]}});const _0x9c8069=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x43cfb9=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x3483ea['bind']('isOn')['to'](this,'isToggleDiffOn',_0x35ad46=>_0x35ad46),_0x3483ea['bind']('icon')['to'](this,'isToggleDiffOn',_0x52ca39=>_0x52ca39?_0x4238bb:_0x5e2adc),_0x3483ea['bind']('label')['to'](this,'isToggleDiffOn',_0x3da23b=>_0x3da23b?_0x9c8069:_0x43cfb9),_0x3483ea['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x3483ea;}['_createAcceptAllButtonView'](){const _0x434500=new Ht(this['locale']);return _0x434500['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x434500['bind']('isEnabled')['to'](this,'isError',_0x498ff9=>!_0x498ff9),_0x434500['extendTemplate']({'attributes':{'class':[on,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2a3bcb=>!_0x2a3bcb),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x583c61=>_0x583c61)]}}),_0x434500['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x434500;}['_createExitReviewButtonView'](){const _0x254c12=new Ht(this['locale']);return _0x254c12['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x254c12['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2c3e81=>!_0x2c3e81),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2ef4bb=>_0x2ef4bb)]}}),_0x254c12['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x254c12;}['_createResultHeaderView'](){const _0x1f2a97=new _0x1f08de(this['locale']),_0x17f742=this['_createTitleView']();return _0x1f2a97['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x236083=>_0x236083)]},'children':[_0x17f742,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x337a1a=>!_0x337a1a)],'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']]}]}),_0x1f2a97;}['_createTitleView'](){const _0x5a0d13=new _0x1f08de(this['locale']),_0x2d020a=new cr();return _0x2d020a['bind']('isVisible')['to'](this,'isResultReady',_0x12aa9b=>!_0x12aa9b),_0x5a0d13['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x212898=>_0x212898)]},'children':[_0x2d020a,{'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')}]}]}]}),_0x5a0d13;}['_createFinishReviewButtonView'](){const _0x204354=new qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x204354['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xffe588=>!_0xffe588)]}}),_0x204354['delegate']('finishReview')['to'](this),_0x204354;}},Xa=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x521eb1,_0x1c3084){super(_0x521eb1),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x1c3084['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x1c3084['headerText']);const _0x1460e6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x1460e6['if']('isVisible','ck-hidden',_0x17e667=>!_0x17e667)]},'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':_0x1c3084['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0xebff42){const _0x4c44ec=new qa(_0xebff42,this['locale']);return _0x4c44ec['delegate']('finishReview')['to'](this),_0x4c44ec;}['_createResultHeaderView'](_0x203e6c){const _0x3d27e1=new _0x1f08de(this['locale']);return _0x3d27e1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x203e6c},'children':[{'text':_0x203e6c}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3d27e1;}},za=class extends _0x1f08de{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x384fb0,_0x44267b){super(_0x384fb0),this['_defaultValue']=_0x44267b['default']||(_0x44267b['data']['length']>0x0?_0x44267b['data'][0x0]['id']:''),this['_defaultLabel']=_0x44267b['data']['find'](_0x3ebf74=>_0x3ebf74['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x4a2fa7(this['locale']);const _0x2188e7=this['_prepareListOptions'](_0x44267b['data']);_0x5346bb(this['_dropdownView'],_0x2188e7,{'role':'menu','ariaLabel':_0x44267b['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1338b6=>{_0x1338b6['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0xb96c4d=>{this['formValue']=_0xb96c4d['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0xb96c4d['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'](_0x361d8d=[]){const _0x3538a6=new ct();this['resetToDefault']();for(const _0x48f90c of _0x361d8d){const _0x486f85=new _0x3cc729({'label':_0x48f90c['label'],'withText':!0x0,'role':'menuitemradio','id':_0x48f90c['id'],'model':_0x48f90c});_0x486f85['bind']('isOn')['to'](this,'formValue',_0x21ffbb=>_0x21ffbb===_0x486f85['id']);const _0xa8ed76={'type':'button','model':_0x486f85};_0x3538a6['add'](_0xa8ed76);}return _0x3538a6;}},ja=class extends zt{['_formItem']=null;constructor(_0x26a6cd,_0x33865e,_0x1f61ce){if(super(_0x26a6cd),this['argsKey']=_0x33865e?.['argsKey'],'dropdown'===_0x33865e['formType'])this['_formItem']=new za(this['locale'],_0x33865e);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x419168=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x1f61ce?'ck-form__row_with-submit':'']});_0x1f61ce&&_0x419168['children']['add'](_0x1f61ce),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x419168]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0xbac387{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x2bf8e5){super(_0x2bf8e5),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']);}},Za=class extends _0x1f08de{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x3994e5();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0xef1cd,_0x6fb369,_0x2c821d=!0x1){super(_0xef1cd),this['_check']=_0x6fb369,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x6fb369['defaultModel']?_0x6fb369['defaultModel']['id']:'',this['_defaultLabel']=_0x6fb369['defaultModel']?_0x6fb369['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Ja(_0xef1cd)),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'](_0x2c821d),_0x5346bb(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',(_0x31887c,_0x1c6348)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x1c6348()):_0x1c6348();}),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'](_0x14747f=>{this['_focusables']['add'](_0x14747f),this['focusTracker']['add'](_0x14747f['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 _0x4d790e of this['_getFormValidators']()){const _0x253ae0=_0x4d790e();if(_0x253ae0)return this['promptInputView']['errorText']=_0x253ae0,!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 _0x53a051=new Ht(this['locale']),t=this['locale']['t'];return _0x53a051['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x53a051['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x53a051;}['_createCancelButtonView'](){const _0x3343da=new Ht(this['locale']),t=this['locale']['t'];return _0x3343da['set']({'label':t('Cancel'),'withText':!0x0,'class':hn}),_0x3343da['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5ef2a7=>{_0x5ef2a7['stopPropagation']();})}}),_0x3343da['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x3343da;}['_setModelList'](_0x30992b){this['_modelSelectionDropdownItems']['clear']();const _0x4163ce=this['_check']['models'];if(_0x30992b)this['set']('modelDisplayMode','hidden');else{const _0x4d2c2b=0x1===_0x4163ce['length'];this['set']('modelDisplayMode',_0x4d2c2b?'name':'selector');}if(this['resetToDefault'](),_0x4163ce?.['length']){0x1===_0x4163ce['length']&&this['set']('activeModelName',_0x4163ce[0x0]['name']||_0x4163ce[0x0]['id']);for(const _0x36a7ff of _0x4163ce){const _0x205a25=new _0x3cc729({'label':_0x36a7ff['name'],'withText':!0x0,'role':'menuitemradio','id':_0x36a7ff['id'],'model':_0x36a7ff});_0x205a25['bind']('isOn')['to'](this,'modelId',_0x3b6d81=>_0x3b6d81===_0x36a7ff['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x205a25,'labelView':new eh(this['locale'],_0x36a7ff)});}}}['_createModelSelectionDropdown'](){const _0x5b1959=_0x4a2fa7(this['locale']);return _0x5b1959['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x5b1959['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':hn}),_0x5b1959['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0xb941e2=>'selector'===_0xb941e2),this['listenTo'](_0x5b1959,'execute',_0xdce45e=>{this['modelId']=_0xdce45e['source']['model']['id'],_0x5b1959['buttonView']['label']=_0xdce45e['source']['label'];}),_0x5b1959;}['_createModelNameView'](){const _0x5b9526=new th(this['locale']);return _0x5b9526['bind']('text')['to'](this,'activeModelName',_0x147ae6=>_0x147ae6??''),_0x5b9526['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1838a9=>'name'===_0x1838a9),_0x5b9526;}['_createActionsFooterView'](){const _0x2d4cac=new _0x1f08de(this['locale']);return _0x2d4cac['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']]}]}),_0x2d4cac;}},th=class extends _0x1f08de{constructor(_0x5d6457){super(_0x5d6457),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x56fe1a=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x56fe1a['if']('isVisible','ck-hidden',_0x54093e=>!_0x54093e)]},'children':[{'text':_0x56fe1a['to']('text')}]});}},eh=class extends Dt{constructor(_0x10a0a4,_0x4d475a){super();const _0x1b43b3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x1b43b3['to']('style'),'id':_0x1b43b3['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x1b43b3['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x4d475a['description']||'']}]}]});}},ih=class extends zt{['_formItemsCollection']=new _0x3994e5();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0xf76cad,_0x213c67,_0x78316b,_0x891eb5=!0x1){super(_0xf76cad),this['_hideModels']=_0x891eb5,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x213c67['isParameterized']);const _0xeb3dd1=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',_0x5ab21c=>_0x5ab21c),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x131d06=>_0x131d06)],'style':{'--ck-ai-review-check-list-item-index':_0x78316b}},'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':_0x213c67['title']}]},_0xeb3dd1]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x213c67['description']?[{'text':_0x213c67['description']}]:[]}]}]},..._0x213c67['isParameterized']?[this['_createParameterizedView'](_0x213c67)]:[],...'custom'===_0x213c67['id']?[this['_createCustomView'](_0x213c67,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x213c67['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x213c67['id'],'args':_0x213c67['useArgs']?_0x213c67['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x563b8b({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x14c865=>{_0x14c865['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x22f3d6=new Yt();return _0x22f3d6['content']=_0xe4118c,_0x22f3d6['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x22f3d6;}['_createParameterizedView'](_0x4d852b){const _0x295113=new _0x1f08de(),_0x19524e=this['_createFormView'](_0x4d852b);return _0x295113['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x4ec210=>!_0x4ec210)]},'children':[_0x19524e]}),_0x295113;}['_createFormView'](_0x1708f9){const _0x50dcfe=new _0x1f08de(),_0x454d47=Array['isArray'](_0x1708f9['options'])?_0x1708f9['options']:[],_0x186fbf=new Ht(this['locale']),t=this['locale']['t'];_0x186fbf['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x186fbf['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x40abb0=>{_0x40abb0['stopPropagation']();})}}),_0x186fbf['on']('execute',()=>{const _0x55b9f7=[],_0x18c083={};this['_formItemsCollection']['forEach'](_0x2999fd=>{_0x55b9f7['push'](_0x2999fd['value']),_0x1708f9['useArgs']&&_0x1708f9['options']&&(_0x18c083[_0x2999fd['argsKey']]=_0x2999fd['value']);}),this['fire']('runReviewCheck',{'id':_0x1708f9['id'],'params':_0x55b9f7['length']?_0x55b9f7:void 0x0,'args':Object['keys'](_0x18c083)['length']?_0x18c083:void 0x0});});const _0xfebc03=_0x454d47['length'];return _0x454d47['forEach']((_0x2ca162,_0x161500)=>{const _0x470513=_0x161500===_0xfebc03-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x2ca162,_0x470513?_0x186fbf:null));}),_0x50dcfe['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x50dcfe;}['_createCustomView'](_0x3352ea,_0x1cc7f7=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x3352ea,_0x1cc7f7),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',_0x2ec905=>!_0x2ec905)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x2f0040,_0x3e61b7,_0x209ebb)=>{_0x209ebb||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends zt{['_checkViews'];constructor(_0x1354ed){super(_0x1354ed),this['_checkViews']=new _0x3994e5(),this['_setupTemplate']();}['setChecks'](_0x19f514,_0x20ea18=!0x1){this['_checkViews']['clear']();for(const [_0x5cda7c,_0xd97655]of _0x19f514['entries']()){const _0x103041=new ih(this['locale'],_0xd97655,_0x5cda7c,_0x20ea18);_0x103041['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x103041);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x3ed035 of this['_checkViews'])_0x3ed035 instanceof ih&&_0x3ed035['resetToDefault']();}['_setupTemplate'](){const _0x173367=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x173367['if']('isVisible','ck-hidden',_0x25ba00=>!_0x25ba00)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x42e2aa=this['context']['plugins']['get']('AITabs'),_0x9ffa4a=this['context']['locale'],_0x237b12=new Ho(_0x9ffa4a,{'label':us(_0x9ffa4a,'AI_REVIEW_MODE'),'icon':_0x259f1e,'class':'ck-ai-header_review','showResizeButton':_0x42e2aa['showResizeButton']});return _0x237b12['delegate']('resizeTabs')['to'](_0x42e2aa),_0x237b12['bind']('isMaximized')['to'](_0x42e2aa['view'],'isMaximized',_0xac1ba4=>_0xac1ba4),new $a(this['context']['locale'],{'header':_0x237b12,'list':new sh(_0x9ffa4a),'results':new Qa(_0x9ffa4a,{'generalErrorText':us(_0x9ffa4a,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x9ffa4a,{'headerText':us(_0x9ffa4a,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x9ffa4a,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x9ffa4a,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x542c3c=this['context']['plugins']['get']('AITabs');_0x542c3c['view']['on']('activateTab',(_0x2212f8,{newTab:_0x4cbaca,oldTab:_0x2b0f0c})=>{'reviewMode'===_0x4cbaca?this['fire']('getReviewCheckList'):'reviewMode'===_0x2b0f0c&&this['fire']('leaveReview');}),_0x542c3c['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x259f1e,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x5bb7a3{static get['requires'](){return[_0x5bc848,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(_0xbe9fef){super(_0xbe9fef),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x1bfa64=_0x474d3b=>this['_scheduleAttachReviewEditingToEditor'](_0x474d3b);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x4fb071)return void _0x1bfa64(this['context']);const _0xc12968=this['context'];for(const _0x33033f of _0xc12968['editors'])_0x1bfa64(_0x33033f);this['listenTo'](_0xc12968['editors'],'add',(_0x32b9b1,_0xb4144)=>{_0x1bfa64(_0xb4144);}),this['listenTo'](_0xc12968['editors'],'remove',(_0x4334f5,_0x3e3b8c)=>{for(const [_0xf246db,_0x472d22]of this['_markers'])_0x472d22['editor']===_0x3e3b8c&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xf246db,'changeId':_0x472d22['groupId']}),this['_markers']['delete'](_0xf246db));});}['_scheduleAttachReviewEditingToEditor'](_0xa3055){const _0x4f4c2a=()=>{'destroyed'!==_0xa3055['state']&&_0xa3055['conversion']&&this['_attachReviewEditingToEditor'](_0xa3055);};if('ready'===_0xa3055['state'])return void _0x4f4c2a();const _0x4bd449=()=>{this['stopListening'](_0xa3055,'ready',_0x4bd449),_0x4f4c2a();};this['listenTo'](_0xa3055,'ready',_0x4bd449);}['_attachReviewEditingToEditor'](_0x4e9a0a){this['_reviewEditingAttachedEditors']['has'](_0x4e9a0a)||(_0x4e9a0a['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x4e294b,{writer:_0x7d553d})=>{const _0xc6e8ff=this['_markers']['get'](_0x4e294b['markerName']),_0xb445c2={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0xc6e8ff?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4e294b['markerName']};return _0x7d553d['createUIElement']('span',_0xb445c2,function(_0x1ef67a){const _0x1df777=this['toDomElement'](_0x1ef67a);return _0x1df777['innerHTML']=_0xc6e8ff?.['content']?.['asString']||'',_0x1df777;});}}),_0x4e9a0a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x1bdddb=>{const _0x804e16=this['_markers']['get'](_0x1bdddb['markerName']),_0x1908ed=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x804e16?.['id']||'')&&_0x1908ed['push']('ck-ai_review__change_active'),{'classes':_0x1908ed,'attributes':{'data-marker-id':_0x1bdddb['markerName']}};}}),_0x4e9a0a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x249cc2=>{const _0x2d1aa4=this['_markers']['get'](_0x249cc2['markerName']),_0x43e9c6=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x2d1aa4?.['id']||'')&&_0x43e9c6['push']('ck-ai_review__change_active'),{'classes':_0x43e9c6,'attributes':{'data-marker-id':_0x249cc2['markerName']}};}}),_0x4e9a0a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x5d0f2e=>{const _0x53aa35=this['_markers']['get'](_0x5d0f2e['markerName']),_0x58bee3=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x53aa35?.['id']||'')&&_0x58bee3['push']('ck-ai_review__change_active'),{'classes':_0x58bee3,'attributes':{'data-marker-id':_0x5d0f2e['markerName']}};}}),_0x4e9a0a['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x10356b,{writer:_0x5248c1})=>_0x5248c1['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x10356b['isOpening']?'start':'end')})}),_0x4e9a0a['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x40a4b3,'view':_0x5c4d3d}),this['_updateMouseMarkerInteractionListeners'](_0x4e9a0a),this['listenTo'](_0x4e9a0a,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4e9a0a),{'priority':'lowest'}),this['listenTo'](_0x4e9a0a,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4e9a0a),{'priority':'lowest'}),_0x4e9a0a['model']['document']['registerPostFixer'](_0x4505a9=>this['_validateMarkers'](_0x4e9a0a,_0x4505a9)),_0x4e9a0a['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x4e9a0a)),this['_reviewEditingAttachedEditors']['add'](_0x4e9a0a));}['_updateMouseMarkerInteractionListeners'](_0x6b432a){let _0x4711ec=this['_boundEditables']['get'](_0x6b432a);_0x4711ec||(_0x4711ec=new Map(),this['_boundEditables']['set'](_0x6b432a,_0x4711ec));const _0x4eb929=new Set(_0x6b432a['ui']['getEditableElementsNames']());for(const _0x5c17d0 of _0x4eb929){if(_0x4711ec['has'](_0x5c17d0))continue;const _0x3ea0ba=_0x6b432a['ui']['getEditableElement'](_0x5c17d0);_0x4711ec['set'](_0x5c17d0,_0x3ea0ba),this['_attachMouseMarkerInteractionListeners'](_0x3ea0ba);}for(const [_0x72d209,_0x439e57]of _0x4711ec)_0x4eb929['has'](_0x72d209)||(_0x4711ec['delete'](_0x72d209),this['_domEmitter']['stopListening'](_0x439e57));}['_attachMouseMarkerInteractionListeners'](_0x21bbd9){this['_domEmitter']['listenTo'](_0x21bbd9,'mouseup',(_0xb76d55,_0x57183e)=>{const _0x5c4d51=_0x57183e['target'],_0x12ee15=this['_findMarkerElement'](_0x5c4d51);if(!_0x12ee15)return;const _0xc582a4=_0x12ee15['getAttribute']('data-marker-id'),_0x47d24f=_0xc582a4['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0xc582a4,'changeId':_0x47d24f,'markerElement':()=>this['_findMarkerElementById'](_0xc582a4),'domEvent':_0x57183e});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x21bbd9,'mouseover',(_0x5d70d0,_0x1091a1)=>{const _0x4a650c=_0x1091a1['target'],_0x1328d1=_0x1091a1['relatedTarget'];let _0x2ac5ca=this['_findMarkerElement'](_0x4a650c);if(!_0x2ac5ca&&_0x1328d1&&(_0x2ac5ca=this['_findMarkerElement'](_0x1328d1)),!_0x2ac5ca)return;const _0x3c5e0b=_0x2ac5ca['getAttribute']('data-marker-id'),_0x414f74=_0x3c5e0b['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x414f74,'markerElement':()=>this['_findMarkerElementById'](_0x3c5e0b),'domEvent':_0x1091a1});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x152bc3((_0x3582a0,_0x4da3b1)=>{const _0xe68b16=_0x4da3b1['target'];this['_findMarkerElement'](_0xe68b16)||_0xe68b16['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5758f0=this['context']['plugins']['get']('AIEditing'),_0x4b3001=ds(this['context']);if(!_0x4b3001['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x128acf=new Set(),_0x2dcaab=[],_0x380fab=new Map();for(const _0x340e0a of _0x4b3001)for(const _0x5e6855 of _0x340e0a['model']['document']['getRoots']()){if('$graveyard'===_0x5e6855['rootName'])continue;const _0x5af0ba=this['_buildDocumentDataSliceForRoot'](_0x340e0a,_0x5e6855,_0x5758f0,_0x128acf);_0x2dcaab['push'](_0x5af0ba['content']);for(const [_0x3987c2,_0x5955dc]of _0x5af0ba['elements'])_0x380fab['set'](_0x3987c2,_0x5955dc);}return{'elements':_0x380fab,'content':_0x2dcaab['join']('')};}['_buildDocumentDataSliceForRoot'](_0x50f8a0,_0x39a8ad,_0x189af8,_0x545615){const _0x12b0f0=_0x50f8a0['model'],_0x5aeb19=new _0x46ccc9();for(const _0x2366a7 of _0x39a8ad['getChildren']())_0x5aeb19['_appendChild'](_0x2366a7['_clone'](!0x0));for(const _0x7f749c of _0x12b0f0['markers']){const _0x28a0eb=_0x7f749c['getRange']();_0x28a0eb&&_0x28a0eb['root']['rootName']===_0x39a8ad['rootName']&&_0x5aeb19['markers']['set'](_0x7f749c['name'],this['_changeRangeOwnerDocument'](_0x28a0eb['clone'](),_0x5aeb19));}const _0x132352=new Map(),_0x1e7f0c=_0x12b0f0['document']['version'],_0x20d115=new _0x433ecb({'ignoreElementEnd':!0x0,'startPosition':_0x12b0f0['createPositionAt'](_0x5aeb19,0x0)});for(const {item:_0x14d19f}of _0x20d115){if(_0x14d19f['is']('element')&&_0x14d19f['name']&&ah['includes'](_0x14d19f['name'])){const _0x48ecb3=this['_upsertDataId'](_0x14d19f,()=>_0x189af8['_nextDataId'](_0x545615));_0x545615['add'](_0x48ecb3);}if(!_0x14d19f['is']('$textProxy'))continue;const _0x29ac5a=_0x14d19f['parent'];if(!_0x29ac5a||!_0x29ac5a['is']('element'))continue;const _0x2b6f69=this['_upsertDataId'](_0x29ac5a,()=>_0x189af8['_nextDataId'](_0x545615));_0x545615['add'](_0x2b6f69);for(const _0x18f575 of _0x29ac5a['getChildren']())_0x18f575['is']('element')&&(_0x18f575['name']&&oh['includes'](_0x18f575['name'])||_0x545615['add'](this['_upsertDataId'](_0x18f575,()=>_0x189af8['_nextDataId'](_0x545615))));let _0x3a48ea=_0x29ac5a;for(;_0x3a48ea['parent']&&!_0x3a48ea['parent']['is']('documentFragment');)_0x3a48ea=_0x3a48ea['parent'],_0x3a48ea['hasAttribute'](_0x40a4b3)&&_0x3a48ea['_removeAttribute'](_0x40a4b3);_0x132352['set'](_0x2b6f69,{'editor':_0x50f8a0,'rootName':_0x39a8ad['rootName'],'path':_0x29ac5a['getPath'](),'documentVersion':_0x1e7f0c,'getContent':this['_createGetContentUsingDataIdFn'](_0x3a48ea['_clone'](!0x0),_0x2b6f69,_0x50f8a0['data'])}),_0x20d115['jumpTo'](_0x12b0f0['createPositionAfter'](_0x29ac5a));}return{'content':_0x50f8a0['data']['processor']['toData'](_0x50f8a0['data']['toView'](_0x5aeb19)),'elements':_0x132352};}['diffContent'](_0x5b8dec,_0x21625a,_0xdf87dc,_0x42ad6d=!0x1){const {contentInitial:_0x519d8e,contentNew:_0x55db79}=this['_neutralizeChangesOnUnsupportedElements'](_0x21625a,_0xdf87dc),_0x4ec245=[],_0x3b5616=_0x5b8dec['data']['parse'](_0x55db79,'$documentFragment'),_0x39cbf4=_0x5b8dec['data']['parse'](_0x519d8e,'$documentFragment'),_0x5e2dfd=_0x5b8dec['model']['createPositionAt'](_0x39cbf4,0x0);if(this['_haveSingleTopLevelElement'](_0x3b5616)){if(!this['_hasSameTopLevelElement'](_0x39cbf4,_0x3b5616))return _0x4ec245;}else{const _0xe83e4e=_0x5b8dec['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x39cbf4,_0xe83e4e)||!this['_haveOnlyInlineContent'](_0x3b5616,_0xe83e4e))return _0x4ec245;}const _0x44e43b=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x519d8e,_0x55db79,{'targetEditor':_0x5b8dec,'anchor':_0x5e2dfd,'markDeletions':!0x0})['getOperations']()['filter'](_0x50ba50=>'insert'===_0x50ba50['type']||'marker'===_0x50ba50['type']&&_0x50ba50['name']['startsWith']('$markedRemove')),_0x9e2317=this['_groupAdjacentOperations'](_0x44e43b),_0x415698=[];if(_0x42ad6d){if(_0x9e2317['length']){const _0x4b16ea=_0x9e2317[0x0]['operations'][0x0],_0x3075e0='insert'===_0x4b16ea['type']?_0x4b16ea['position']:_0x4b16ea['newRange']['start'],_0x3f765b=this['_getPositionLimitingRange'](_0x3075e0,_0x5b8dec,'inside'),_0x8c6ad0=_0x3f765b?_0x3b5616['getChild'](0x0)['getChildren']():_0x3b5616['getChildren'](),_0x14c6e2=_0x3f765b||_0x5b8dec['model']['createRangeIn'](_0x39cbf4),_0x3c4b90=[new _0x24ffd0('$markedRemove:synthetic'+vt(),null,_0x14c6e2,_0x5b8dec['model']['document']['model']['markers'],!0x0,_0x5b8dec['model']['document']['version']+0x1),new _0x46a31d(_0x14c6e2['end'],_0x8c6ad0,_0x5b8dec['model']['document']['version']+0x2)];_0x415698['push']({'operations':_0x3c4b90,'operationsIsolated':_0x3c4b90,'groupOffset':0x0});}}else _0x415698['push'](..._0x9e2317);let _0x2591a2=0x0;return _0x5b8dec['model']['change'](_0x1baf03=>{for(let _0x4f2efa=0x0;_0x4f2efa<_0x415698['length'];_0x4f2efa++){const _0x4469f8=_0x415698[_0x4f2efa],_0x472f63=_0x1baf03['createDocumentFragment']();for(const _0x3e47f2 of _0x39cbf4['getChildren']())_0x1baf03['append'](_0x3e47f2['_clone'](!0x0),_0x472f63);for(const _0x8f12ea of _0x4469f8['operationsIsolated'])if('insert'===_0x8f12ea['type']){const _0x432619=_0x8f12ea;_0x432619['baseVersion']=null,_0x432619['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x432619,_0x472f63),_0x1baf03['batch']['addOperation'](_0x8f12ea),_0x5b8dec['model']['applyOperation'](_0x8f12ea);const _0x14b621='suggestion:insertion:id:authorId:'+_0x2591a2++,_0xaa5426=_0x5b8dec['model']['createRange'](_0x432619['position'],_0x432619['position']['getShiftedBy'](_0x432619['howMany']));_0x472f63['markers']['set'](_0x14b621,_0xaa5426);}else{if('marker'===_0x8f12ea['type']&&_0x8f12ea['name']['startsWith']('$markedRemove')){const _0x2d82df=_0x8f12ea,_0x59f4a6='suggestion:deletion:id:authorId:'+_0x2591a2++;this['_changeOperationOwnerDocument'](_0x2d82df,_0x472f63),_0x472f63['markers']['set'](_0x59f4a6,_0x2d82df['newRange']);}}if(_0x42ad6d)_0x4ec245['push']({..._0x4469f8,'context':this['_createGetContentFn'](_0x39cbf4,_0x5b8dec['data']),'content':this['_createGetContentFn'](_0x39cbf4,_0x5b8dec['data'])});else{const _0x1274f6=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x4469f8['operationsIsolated'][0x0]),_0x472f63),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x4469f8['operationsIsolated'][_0x4469f8['operationsIsolated']['length']-0x1]),_0x472f63),_0x5b8dec);_0x472f63['markers']['set'](rh+'suggestion-context',new _0x3888b9(_0x1274f6['start'],_0x1274f6['end'])),_0x4ec245['push']({..._0x4469f8,'context':this['_createGetContextFn'](_0x472f63,_0x5b8dec['data'],{'ellipsisBefore':_0x1274f6['hasContentBefore'],'ellipsisAfter':_0x1274f6['hasContentAfter']}),'content':this['_createGetContentFn'](_0x472f63,_0x5b8dec['data'])});}}}),_0x4ec245;}['markChangePositionInEditorContent'](_0x30d8ae,_0x772fcd){if(!_0x30d8ae['length'])return;const _0x1921d0=_0x30d8ae[0x0]['parent']['id'],_0x11b428=_0x772fcd['elements']['get'](_0x1921d0);if(!_0x11b428)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x1921d0);const _0x45d29b=_0x11b428['path'],_0x23a7b4=_0x11b428['editor'],_0x2207b4=_0x23a7b4['model']['document']['getRoot'](_0x11b428['rootName']);if(!_0x2207b4)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x11b428['rootName']);const _0x183b3e=_0x23a7b4['model']['document']['history']['getOperations'](_0x11b428['documentVersion']),_0x5d5278=[];for(const _0x537d4e of _0x30d8ae){const _0x30ca1f=_0x537d4e['operationsIsolated']['map'](_0x5ee1c2=>this['_translateOperationToEditorContent'](_0x5ee1c2,_0x45d29b,_0x2207b4));if(!_0x30ca1f||!_0x30ca1f['length'])continue;const _0x39c36a=_0x30ca1f['every'](_0x2bd511=>'marker'===_0x2bd511['type']&&_0x2bd511['name']['startsWith']('$markedRemove')),_0x4cf402=_0x4a80ce(_0x30ca1f,_0x183b3e,{'document':_0x23a7b4['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x21c53a of _0x4cf402)if('insert'===_0x21c53a['type']){const _0x2c82c7=_0x21c53a,_0x169dea=_0x2c82c7['nodes'];_0x23a7b4['model']['change'](_0x21f31b=>{const _0x474a51=_0x21f31b['createDocumentFragment']();for(const _0x42dc77 of _0x169dea)_0x21f31b['append'](_0x42dc77['_clone'](!0x0),_0x474a51);_0x5d5278['push']({'start':_0x2c82c7['position'],'end':_0x2c82c7['position'],'type':'insert','groupId':_0x537d4e['id'],'content':{'asString':this['_createGetContentFn'](_0x474a51,_0x23a7b4['data'])(),'asFragment':_0x474a51}});});}else{if('marker'===_0x21c53a['type']&&_0x21c53a['name']['startsWith']('$markedRemove')){const _0x2abe47=_0x21c53a;let _0xa776d5='remove-text';if(_0x39c36a){const _0x33bb33=this['_findAdjacentContextDistance'](_0x2abe47['newRange']['start'],'backward',_0x23a7b4['model']['schema']),_0x2ed3ea=this['_findAdjacentContextDistance'](_0x2abe47['newRange']['end'],'forward',_0x23a7b4['model']['schema']);if(_0x33bb33||_0x2ed3ea){const _0x5cc2ff=_0x2abe47['newRange']['start']['getShiftedBy'](-_0x33bb33),_0x45ad8b=_0x2abe47['newRange']['end']['getShiftedBy'](_0x2ed3ea);_0x5d5278['push']({'start':_0x5cc2ff,'end':_0x45ad8b,'groupId':_0x537d4e['id'],'type':'remove-context'});}else _0xa776d5='remove-only';}_0x5d5278['push']({'start':_0x2abe47['newRange']['start'],'end':_0x2abe47['newRange']['end'],'groupId':_0x537d4e['id'],'type':_0xa776d5});}}}this['_insertMarkers'](_0x5d5278,_0x23a7b4);}['clearAllMarkers'](){const _0x4961ca=new Map();for(const _0x37f34e of this['_markers']['keys']()){const _0x1522f0=this['_markers']['get'](_0x37f34e);_0x1522f0?.['editor']&&(_0x4961ca['has'](_0x1522f0['editor'])||_0x4961ca['set'](_0x1522f0['editor'],[]),_0x4961ca['get'](_0x1522f0['editor'])['push'](_0x37f34e));}for(const [_0x11d2ca,_0x5260dc]of _0x4961ca)_0x11d2ca['model']['change'](_0x556aba=>{for(const _0x166a09 of _0x5260dc)_0x11d2ca['model']['markers']['get'](_0x166a09)&&_0x556aba['removeMarker'](_0x166a09);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x447dc2 of ds(this['context']))_0x447dc2['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x15c255 of ds(this['context']))_0x15c255['disableReadOnlyMode']('ai-review');}['applyChange'](_0x5013d9,_0x18bcd3=null){const _0x1dabbd=_0x5013d9['map'](_0x4d2f5e=>this['_getMarkersDataForGroup'](_0x4d2f5e))['flat'](),_0xfbde72=new Map();for(const _0x2d2f99 of _0x1dabbd)_0xfbde72['has'](_0x2d2f99['editor'])||_0xfbde72['set'](_0x2d2f99['editor'],[]),_0xfbde72['get'](_0x2d2f99['editor'])['push'](_0x2d2f99);for(const [_0x35435a,_0x30ddda]of _0xfbde72){const _0x75c55b=_0x35435a['model'],_0x261666=_0x35435a['plugins']['has']('TrackChangesEditing')?_0x35435a['plugins']['get']('TrackChangesEditing'):null,_0x55bd12=_0x18bcd3&&_0x261666?new Set(_0x261666['getSuggestions']()['map'](_0x4c88ca=>_0x4c88ca['id'])):null;_0x75c55b['change'](_0x4b9c51=>{const _0x28300f=_0x4b9c51['batch']['operations']['length'];for(const _0x1d6989 of _0x30ddda){const _0x20f63f=_0x35435a['model']['markers']['get'](_0x1d6989['id']);if(_0x20f63f){if('insert'===_0x1d6989['type']){if(!_0x1d6989['content'])continue;_0x75c55b['insertContent'](_0x1d6989['content']['asFragment']||null,_0x20f63f['getRange']()['start']);}else'remove-text'!==_0x1d6989['type']&&'remove-only'!==_0x1d6989['type']||_0x75c55b['deleteContent'](_0x75c55b['createSelection'](_0x20f63f['getRange']()));_0x4b9c51['removeMarker'](_0x1d6989['id']),this['_markers']['delete'](_0x1d6989['id']);}}if(_0x18bcd3&&(zs(_0x4b9c51['batch']['operations']['slice'](_0x28300f),_0x18bcd3),_0x261666)){for(const _0x439c2e of _0x261666['getSuggestions']())_0x55bd12['has'](_0x439c2e['id'])||_0x439c2e['setAttribute']('@ai',{'type':_0x18bcd3});}});}}['rejectChange'](_0x11a1b2){const _0x356ffb=this['_getMarkersDataForGroup'](_0x11a1b2),_0x1b9ca9=new Map();for(const _0x747c37 of _0x356ffb)_0x1b9ca9['has'](_0x747c37['editor'])||_0x1b9ca9['set'](_0x747c37['editor'],[]),_0x1b9ca9['get'](_0x747c37['editor'])['push'](_0x747c37);for(const [_0x4825de,_0x13da46]of _0x1b9ca9)_0x4825de['model']['change'](_0x3da985=>{for(const _0x312fe9 of _0x13da46)_0x3da985['removeMarker'](_0x312fe9['id']),this['_markers']['delete'](_0x312fe9['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x5788a2){return this['_getMarkersDataForGroup'](_0x5788a2)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x1d011e){const _0x5727ad=Array['from'](this['_markers']['values']())['filter'](_0x39674c=>_0x39674c['groupId']===_0x1d011e);if(!_0x5727ad['length'])return null;const _0x491197=0x1===_0x5727ad['length']?_0x5727ad[0x0]:this['_sortMarkers'](_0x5727ad)[0x0],_0x19740a=_0x491197['editor']['model']['markers']['get'](_0x491197['id']);return _0x19740a?{'modelRange':_0x19740a['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x491197['id'])}:null;}['getContentElementForChange'](_0x1eab5d){const _0x3fa10a=Array['from'](this['_markers']['values']())['filter'](_0x35a03f=>_0x35a03f['groupId']===_0x1eab5d);if(!_0x3fa10a['length'])return null;const _0x353a48=0x1===_0x3fa10a['length']?_0x3fa10a[0x0]:this['_sortMarkers'](_0x3fa10a)[0x0],_0x2d8d8a=_0x353a48['editor'],_0x19826e=_0x2d8d8a['model']['markers']['get'](_0x353a48['id']);if(!_0x19826e)return null;const _0x7d041c=_0x19826e['getRange'](),_0x4e1128=_0x2d8d8a['editing']['view']['getDomRoot'](_0x7d041c['root']['rootName'])||_0x2d8d8a['editing']['view']['getDomRoot']();if(!_0x4e1128||!_0x7d041c)return null;let _0x2df2c8=_0x7d041c['start']['parent'];for(;_0x2df2c8['parent']&&!_0x2df2c8['parent']['is']('rootElement');)_0x2df2c8=_0x2df2c8['parent'];if(!_0x2df2c8||!_0x2df2c8['name'])return null;const _0x4c8ef2=_0x4e1128['querySelector']('[data-marker-id=\x22'+_0x353a48['id']+'\x22]');if(!_0x4c8ef2)return null;let _0x1f5533=null;_0x2d8d8a['model']['change'](_0x3524bd=>{_0x1f5533=_0x3524bd['createDocumentFragment'](),_0x3524bd['append'](_0x2df2c8['_clone'](!0x0),_0x1f5533);});const _0x4e9045=_0x2d8d8a['data']['toView'](_0x1f5533)['getChild'](0x0);return _0x4c8ef2['closest'](_0x4e9045['name']);}['reactivateMarkers'](_0x3ab3ef){const _0x24a334=this['_getMarkersDataForGroup'](_0x3ab3ef);if(!_0x24a334['length'])return;const _0x5ae450=Array['from'](this['_activeMarkers'])['sort'](),_0x383015=Array['from'](new Set(_0x24a334['map'](_0x208a12=>_0x208a12['id'])))['sort']();_0x5ae450['join']('|')!==_0x383015['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x3ab3ef));}['setMarkersInElementAsActive'](_0x404d55){const _0x7bded0=this['_getMarkersDataForGroup'](_0x404d55);if(!_0x7bded0['length'])return;const _0x3f007f=_0x7bded0[0x0]['editor'],_0x47797c=new Set(_0x7bded0['map'](_0xc4e68a=>_0xc4e68a['id'])),_0x30f5e2=Array['from'](_0x47797c['values']())['map'](_0x5426b2=>_0x3f007f['model']['markers']['get'](_0x5426b2))['filter'](_0x4ad8e0=>!!_0x4ad8e0);_0x47797c['forEach'](_0x5ebf0c=>{this['_activeMarkers']['add'](_0x5ebf0c);}),_0x3f007f['model']['change'](()=>{_0x30f5e2['forEach'](_0x453719=>{_0x3f007f['editing']['reconvertMarker'](_0x453719);});});}['setAllMarkersAsInactive'](){const _0x2e2fad=Array['from'](this['_activeMarkers']);if(!_0x2e2fad['length'])return;this['_activeMarkers']['clear']();const _0x47d38e=new Map();for(const _0x4eb66d of _0x2e2fad){const _0x3ce357=this['_markers']['get'](_0x4eb66d);if(!_0x3ce357)continue;const _0x25e7be=_0x3ce357['editor'],_0x546051=_0x25e7be['model']['markers']['get'](_0x4eb66d);_0x546051&&(_0x47d38e['has'](_0x25e7be)||_0x47d38e['set'](_0x25e7be,[]),_0x47d38e['get'](_0x25e7be)['push'](_0x546051));}for(const [_0x24c220,_0x2f4a2b]of _0x47d38e)_0x24c220['model']['change'](()=>{_0x2f4a2b['forEach'](_0x8fb2e8=>{_0x24c220['editing']['reconvertMarker'](_0x8fb2e8);});});}['_getPositionLimitingRange'](_0x349aee,_0x259c76,_0x53b28c='outside'){if(!_0x349aee)return null;let _0x76585d=_0x349aee['parent'];for(;_0x76585d&&_0x76585d['parent']&&!_0x76585d['parent']['is']('rootElement')&&!_0x259c76['model']['schema']['isLimit'](_0x76585d)&&!_0x259c76['model']['schema']['isBlock'](_0x76585d);)_0x76585d=_0x76585d['parent'];if(!_0x76585d||!_0x76585d['name']||_0x76585d['is']('rootElement'))return null;let _0x3cef50=null;return _0x259c76['model']['change'](_0x3131b3=>{_0x3cef50='inside'===_0x53b28c?_0x3131b3['createRangeIn'](_0x76585d):_0x3131b3['createRangeOn'](_0x76585d);}),_0x3cef50;}['_validateMarkers'](_0x29bf98,_0x5267bd){const _0x3178ae=Array['from'](this['_markers']['keys']()),_0x13e975=new Map();for(const _0x5a0283 of _0x3178ae){const _0x40d990=_0x29bf98['model']['markers']['get'](_0x5a0283);if(!_0x40d990)continue;const _0x168e42=_0x40d990['getStart']()['root']['rootName']+':'+_0x40d990['getStart']()['path'][0x0];_0x13e975['has'](_0x168e42)||_0x13e975['set'](_0x168e42,[]),_0x13e975['get'](_0x168e42)['push'](_0x40d990);}const _0x1ba51f=new Set();for(const _0x124477 of _0x29bf98['model']['document']['differ']['getChanges']()){let _0x59ce4c='',_0x807f18=null;if('insert'===_0x124477['type'])_0x807f18=new _0x3888b9(_0x124477['position'],_0x124477['position']['getShiftedBy'](_0x124477['length'])),_0x59ce4c=_0x124477['position']['root']['rootName']+':'+_0x124477['position']['path'][0x0];else{if('remove'!==_0x124477['type'])continue;_0x807f18=new _0x3888b9(_0x124477['position']),_0x59ce4c=_0x124477['position']['root']['rootName']+':'+_0x124477['position']['path'][0x0];}const _0x5b0a90=_0x13e975['get'](_0x59ce4c)||[];if(_0x5b0a90['length']){for(const _0x4b9a53 of _0x5b0a90)if(_0x807f18['root']['rootName']===_0x4b9a53['getRange']()['root']['rootName']&&('insert'!==_0x124477['type']||!_0x807f18['containsRange'](_0x4b9a53['getRange']()))&&(_0x807f18['isIntersecting'](_0x4b9a53['getRange']())||_0x807f18['start']['isTouching'](_0x4b9a53['getRange']()['end'])||_0x807f18['end']['isTouching'](_0x4b9a53['getRange']()['start']))){const _0x51022e=this['_parseMarkerName'](_0x4b9a53['name']);Array['from'](this['_markers']['values']())['filter'](_0x35f4c9=>_0x35f4c9['groupId']===_0x51022e['groupId'])['forEach'](_0xbc8ddc=>_0x1ba51f['add'](_0xbc8ddc['id']));}}}if(_0x1ba51f['size']){for(const _0x56c834 of _0x1ba51f)_0x5267bd['removeMarker'](_0x56c834);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x7a2c55){for(const {name:_0x539156,data:_0x38b489}of _0x7a2c55['model']['document']['differ']['getChangedMarkers']()){if(!_0x539156['startsWith'](rh))continue;const _0x5db953=_0x38b489['oldRange'],_0x49df75=_0x38b489['newRange'],_0x1210c7=_0x5db953&&'$graveyard'===_0x5db953['root']['rootName'],_0x45f8a9=_0x49df75&&'$graveyard'===_0x49df75['root']['rootName'];if(_0x1210c7&&_0x45f8a9)continue;const _0x43b000=this['_parseMarkerName'](_0x539156);this['_markers']['get'](_0x539156)&&(_0x45f8a9||!_0x49df75?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x539156,'changeId':_0x43b000['groupId']}):_0x1210c7&&_0x49df75&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x539156,'changeId':_0x43b000['groupId']}));}}['_parseMarkerName'](_0x409c4c){const _0x545911=_0x409c4c['split'](':'),_0x301d5d=(_0x545911[0x1]||'')['split']('_');return{'prefix':_0x545911[0x0],'groupId':_0x301d5d[0x0],'suffix':_0x301d5d[0x1]};}['_translateOperationToEditorContent'](_0x132211,_0x4530a1,_0x13005a){if('insert'===_0x132211['type']){const _0x445580=_0x132211;return new _0x46a31d(this['_changePosition'](_0x4530a1['concat'](_0x445580['position']['offset']),_0x13005a),_0x445580['nodes'],_0x445580['baseVersion']);}if('marker'===_0x132211['type']&&_0x132211['name']['startsWith']('$markedRemove')){const _0x445d30=_0x132211;return new _0x24ffd0(_0x445d30['name'],_0x445d30['oldRange'],this['_changeRange'](_0x445d30['newRange'],_0x4530a1['concat'](_0x445d30['newRange']['start']['offset']),_0x4530a1['concat'](_0x445d30['newRange']['end']['offset']),_0x13005a),_0x445d30['_markers'],_0x445d30['affectsData'],_0x445d30['baseVersion']);}return _0x132211;}['_groupAdjacentOperations'](_0x759937){if(!_0x759937['length'])return[];const _0x4d7ad7=[];let _0x1f103a=0x0,_0xcf96c7=0x0,_0x51e3dc=[];for(let _0x1acf7b=0x0;_0x1acf7b<=_0x759937['length'];_0x1acf7b++){const _0x390b04=_0x759937[_0x1acf7b],_0x52d41c=_0x759937[_0x1acf7b-0x1];!_0x390b04||_0x52d41c&&!this['_getOperationEnd'](_0x52d41c)['isTouching'](this['_getOperationStart'](_0x390b04))?(_0x4d7ad7['push']({'operations':_0x51e3dc,'operationsIsolated':_0x51e3dc['map'](_0x50d69f=>this['_shiftOperation'](_0x50d69f['clone'](),-_0xcf96c7)),'groupOffset':_0x1f103a}),_0x51e3dc=_0x390b04?[_0x390b04]:[],_0xcf96c7+=_0x1f103a,_0x1f103a=0x0):_0x51e3dc['push'](_0x390b04),_0x390b04&&'insert'===_0x390b04['type']&&(_0x1f103a+=_0x390b04['howMany']);}return _0x4d7ad7;}['_findAdjacentContextDistance'](_0x24df2b,_0x1b34b0,_0x4923c3,_0x45dd31=0x1){const _0x3a1d9f=new _0x433ecb({'startPosition':_0x24df2b,'direction':_0x1b34b0});let _0x314fe5=0x0;for(let _0x45ad83=0x0;_0x45ad83<_0x45dd31;_0x45ad83++){let _0x44af96=0x0,_0x5247d6=!0x1,_0x26fbe9='forward'===_0x1b34b0?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x4aca88}of _0x3a1d9f)if(_0x4aca88['is']('$textProxy')){const _0x5cf0d7=_0x26fbe9['exec'](_0x4aca88['data']);if(_0x5cf0d7&&_0x5cf0d7['length']){if(_0x44af96+='forward'===_0x1b34b0?_0x5cf0d7['index']+_0x5cf0d7[0x0]['length']:_0x4aca88['data']['length']-_0x5cf0d7['index'],_0x5cf0d7[0x0]['length']!==_0x4aca88['data']['length'])break;_0x5247d6=!0x0,_0x26fbe9='forward'===_0x1b34b0?/^\w+/:/\w+$/;}else{if(_0x5247d6)break;_0x44af96+=_0x4aca88['offsetSize'];}}else{if(_0x4aca88['is']('element')){_0x4923c3['isInline'](_0x4aca88)&&!_0x5247d6&&(_0x44af96+=0x1);break;}}_0x314fe5+=_0x44af96,_0x3a1d9f['jumpTo'](_0x24df2b['getShiftedBy']('forward'===_0x1b34b0?_0x314fe5:-_0x314fe5));}return _0x314fe5;}['_getChangeContext'](_0x21cf0a,_0x153130,_0x5546fa){const _0x527975=_0x5546fa['model']['schema'],_0x4f9b0d=this['_findAdjacentContextDistance'](_0x21cf0a,'backward',_0x527975,0x6),_0x4ba77=this['_findAdjacentContextDistance'](_0x153130,'forward',_0x527975,0x6),_0x117dde=_0x21cf0a['getShiftedBy'](-_0x4f9b0d),_0x1f95f5=_0x153130['getShiftedBy'](_0x4ba77);return{'start':_0x117dde,'end':_0x1f95f5,'hasContentBefore':!_0x117dde['isAtStart'],'hasContentAfter':!_0x1f95f5['isAtEnd']};}['_insertMarkers'](_0x440d82,_0x593d3e){const _0x1514af=this['context']['plugins']['get']('AIEditing'),_0x432fa1=new Set();_0x593d3e['model']['change'](_0x1b3b58=>{for(const _0x469e44 of _0x440d82){const _0x313e9c=''+rh+_0x469e44['type']+':'+_0x469e44['groupId']+'_'+_0x1514af['_nextDataId'](_0x432fa1);this['_markers']['set'](_0x313e9c,{'id':_0x313e9c,'groupId':_0x469e44['groupId'],'type':_0x469e44['type'],'content':_0x469e44['content'],'editor':_0x593d3e}),_0x1b3b58['addMarker'](_0x313e9c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1b3b58['createRange'](_0x469e44['start'],_0x469e44['end'])});}});}['_createGetContextFn'](_0x59f3a2,_0x56d33b,_0x4d71f8){let _0x3e43ff='';return()=>{if(!_0x3e43ff){const _0x59e2b2=_0x56d33b['toView'](_0x59f3a2,{'showSuggestionHighlights':!0x0});let _0x41af24=_0x59e2b2['getChild'](0x0);if(_0x41af24['is']('containerElement')||(_0x41af24=_0x59e2b2),!_0x41af24)return'';let _0x3c3bf1=!0x1;const _0x2fe20d=[];for(const _0x51d348 of _0x41af24['getChildren']())_0x51d348['is']('element','span')&&_0x51d348['hasClass']('ck-ai_review-marker_context-end')&&(_0x3c3bf1=!0x1),_0x3c3bf1&&_0x2fe20d['push'](_0x51d348),_0x51d348['is']('element','span')&&_0x51d348['hasClass']('ck-ai_review-marker_context-start')&&(_0x3c3bf1=!0x0);_0x41af24['_removeChildren'](0x0,_0x41af24['childCount']),_0x4d71f8?.['ellipsisBefore']&&_0x41af24['_appendChild']('…'),_0x41af24['_appendChild'](_0x2fe20d),_0x4d71f8?.['ellipsisAfter']&&_0x41af24['_appendChild']('…');const _0xdd2671=_0x56d33b['htmlProcessor']['domConverter']['viewToDom'](_0x59e2b2),_0x166bc1=_0x56d33b['htmlProcessor']['htmlWriter']['getHtml'](_0xdd2671);_0x3e43ff=this['_removeUnsupportedElements'](_0x166bc1);}return _0x3e43ff;};}['_createGetContentFn'](_0x12135e,_0x30b058){let _0x50a934='';return()=>(_0x50a934||(_0x50a934=this['_removeUnsupportedElements'](_0x30b058['stringify'](_0x12135e,{'showSuggestionHighlights':!0x0}))),_0x50a934);}['_createGetContentUsingDataIdFn'](_0x5a3722,_0x1e66c5,_0x2f58bf){let _0xb79ca8='';return()=>{if(!_0xb79ca8){const _0x40c484=_0x2f58bf['toView'](new _0x46ccc9(_0x5a3722));_0xb79ca8=_0x2f58bf['htmlProcessor']['domConverter']['viewToDom'](_0x40c484)['querySelector']('[data-id=\x22'+_0x1e66c5+'\x22]')?.['outerHTML']||'';}return _0xb79ca8;};}['_removeUnsupportedElements'](_0x84fb22){if(!_0x84fb22)return'';const _0x1bb474=ps(_0x84fb22,{'decodeEntities':!0x1}),_0xdd353d=ws(_0x1bb474);if(!_0xdd353d['length'])return _0x84fb22;for(const _0x58e5e6 of _0xdd353d)_0x183ce6(_0x58e5e6);return ms(_0x1bb474,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x30dc86,_0x282c27){const _0x521cc0=ps(_0x30dc86,{'decodeEntities':!0x1}),_0x15b678=ps(_0x282c27,{'decodeEntities':!0x1}),_0x3097b0=ws(_0x521cc0),_0x3545a1=ws(_0x15b678);if(!_0x3097b0['length']&&!_0x3545a1['length'])return{'contentInitial':_0x30dc86,'contentNew':_0x282c27};const _0x1446db=new Map();for(const _0x4fe8d6 of _0x3097b0)_0x1446db['set'](fs(_0x4fe8d6,'data-id'),_0x4fe8d6);for(const _0x2c4bdc of _0x3545a1){const _0x302666=fs(_0x2c4bdc,'data-id'),_0x2de9bf=_0x302666?_0x1446db['get'](_0x302666):void 0x0;_0x2de9bf?_0x1845ad(_0x2c4bdc,_0x398eb6(_0x2de9bf,!0x0)):_0x183ce6(_0x2c4bdc);}return{'contentInitial':ms(_0x521cc0,{'encodeEntities':!0x1}),'contentNew':ms(_0x15b678,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x249d90,_0x1fe23b=0x5){let _0x4db91d=_0x249d90,_0x13644d=null;for(let _0xdc1d60=0x0;_0xdc1d60<_0x1fe23b&&_0x4db91d;_0xdc1d60++)if(_0x4db91d['className']){if((''+_0x4db91d['className'])['includes']('ck-ai_review-marker_')){if(!_0x4db91d['getAttribute']('data-marker-id'))break;_0x13644d=_0x4db91d;break;}_0x4db91d=_0x4db91d['parentElement'];}else _0x4db91d=_0x4db91d['parentElement'];return _0x13644d;}['_findMarkerElementById'](_0x4599d2){const _0x9c9a9=this['_markers']['get'](_0x4599d2);if(!_0x9c9a9)return null;const _0x2fc930=_0x9c9a9['editor']['model']['markers']['get'](_0x4599d2);return _0x2fc930?_0x494bee(_0x9c9a9['editor']['editing'],_0x2fc930):null;}['_getMarkersDataForGroup'](_0x433cb6){return Array['from'](this['_markers']['values']())['filter'](_0x10c932=>_0x10c932['groupId']===_0x433cb6);}['_getOperationStart'](_0x3a375b){return'insert'===_0x3a375b['type']?_0x3a375b['position']:_0x3a375b['newRange']['start'];}['_getOperationEnd'](_0x1f091c,_0x3d27dc=!0x1){return'insert'===_0x1f091c['type']?_0x3d27dc?_0x1f091c['position']:_0x1f091c['position']['getShiftedBy'](_0x1f091c['howMany']):_0x1f091c['newRange']['end'];}['_shiftOperation'](_0x58a798,_0x4219d5){return'insert'===_0x58a798['type']?_0x58a798['position']=_0x58a798['position']['getShiftedBy'](_0x4219d5):'marker'===_0x58a798['type']&&_0x58a798['newRange']&&(_0x58a798['newRange']=new _0x3888b9(_0x58a798['newRange']['start']['getShiftedBy'](_0x4219d5),_0x58a798['newRange']['end']['getShiftedBy'](_0x4219d5))),_0x58a798;}['_changeOperationOwnerDocument'](_0x24f77f,_0x116d57){'insert'===_0x24f77f['type']?_0x24f77f['position']=this['_changePositionOwnerDocument'](_0x24f77f['position'],_0x116d57):'marker'===_0x24f77f['type']&&_0x24f77f['newRange']&&(_0x24f77f['newRange']=this['_changeRangeOwnerDocument'](_0x24f77f['newRange'],_0x116d57));}['_changePositionOwnerDocument'](_0xc07327,_0x1d4c93){return new _0x339ffb(_0x1d4c93,_0xc07327['path']);}['_changeRangeOwnerDocument'](_0x149e51,_0x23ab48){return new _0x3888b9(this['_changePositionOwnerDocument'](_0x149e51['start'],_0x23ab48),this['_changePositionOwnerDocument'](_0x149e51['end'],_0x23ab48));}['_changePosition'](_0xea0608,_0x16c533){return new _0x339ffb(_0x16c533,[..._0xea0608]);}['_changeRange'](_0x19632f,_0x51e533,_0x4678f2,_0x59591a){return new _0x3888b9(this['_changePosition'](_0x51e533,_0x59591a),this['_changePosition'](_0x4678f2,_0x59591a));}['_sortMarkers'](_0x267a25){const _0x53dfb2=_0x3452d8=>{switch(_0x3452d8){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x267a25['sort']((_0x4e16bf,_0xc81c00)=>_0x53dfb2(_0x4e16bf['type'])-_0x53dfb2(_0xc81c00['type']));}['_hasSameTopLevelElement'](_0x56ae08,_0x33539f){const _0x432861=_0x56ae08['getChild'](0x0),_0x50b90f=_0x33539f['getChild'](0x0);return!(!_0x432861||!_0x50b90f)&&((!_0x432861['is']('element')||!_0x50b90f['is']('element')||_0x432861['name']===_0x50b90f['name'])&&!(_0x432861['is']('element')&&!_0x50b90f['is']('element')||!_0x432861['is']('element')&&_0x50b90f['is']('element')));}['_haveSingleTopLevelElement'](_0x5a88f8){return 0x1===_0x5a88f8['childCount'];}['_haveOnlyInlineContent'](_0x358e26,_0x24e154){for(const _0x3fd81b of _0x358e26['getChildren']())if(_0x3fd81b['is']('element')&&!_0x24e154['isInline'](_0x3fd81b))return!0x1;return!0x0;}['_upsertDataId'](_0x5c7bf0,_0x14874e){let _0x5f4b19=_0x5c7bf0['getAttribute'](_0x40a4b3);return _0x5f4b19||(_0x5f4b19=_0x14874e(),_0x5c7bf0['_setAttribute'](_0x40a4b3,_0x5f4b19)),_0x5f4b19;}};const ch=/* #__PURE__ -- @preserve */
38
- ut();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x10b829,contentNew:_0x584b0e,contentInitial:_0x2007c3,documentVersion:_0x3a5dcb}){super(),this['id']=_0x10b829,this['contentNew']=_0x584b0e,this['contentInitial']=_0x2007c3,this['documentVersion']=_0x3a5dcb;}};const uh=/* #__PURE__ -- @preserve */
39
- gt();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x31582a,_0x31f689,_0x2fc82d){super(),this['id']=_0x31582a,this['parent']=_0x2fc82d,this['_data']=_0x31f689,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 _h=/* #__PURE__ -- @preserve */
40
- gt();var gh=class extends _h{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x42d8aa,_0xfb3b6e,_0x44af0e,_0x44502c,_0x1c6f66){super(),this['_sourceCheck']=_0xfb3b6e,this['_documentData']=_0x42d8aa,this['_aiConnector']=_0x44af0e,this['_reviewParams']=_0x44502c,this['_reviewArgs']=_0x1c6f66,this['on']('change:status',(_0x4d436d,_0x48f862,_0x2e6513)=>{'aborted'==_0x2e6513&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x2e6513,'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'](_0xcece8a=>'pending'===_0xcece8a['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x2f1683){this['_documentData']=_0x2f1683;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x391b6e=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x5ec0ae of _0x391b6e)'unmodified'!==_0x5ec0ae['data']['operation']&&('error'!==_0x5ec0ae['data']['operation']?'review-metadata'!==_0x5ec0ae['event']?this['_addReviewCheckResult'](_0x5ec0ae['data']['dataId'],_0x5ec0ae['data']['textDelta']):this['callId']=_0x5ec0ae['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(_0x23f1da){this['_currentError']=_0x23f1da,en(_0x23f1da)?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'](_0x51e9f3,_0x44b99a){const _0x18d7e3=this['_results']['get'](_0x51e9f3);if(!_0x18d7e3)return;if(0x0===_0x44b99a['length'])return;const _0x58cd6f=[];_0x44b99a['forEach']((_0x1069e3,_0x12071e)=>{const _0x144a0e=new dh(_0x18d7e3['id']+'-'+_0x12071e,_0x1069e3,_0x18d7e3);_0x144a0e['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x144a0e,'status':_0x144a0e['status']});}),_0x144a0e['on']('change:isActivated',()=>{_0x144a0e['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x144a0e}):this['fire']('reviewCheckResultDeactivated',{'change':_0x144a0e});}),this['_changes']['push'](_0x144a0e),_0x58cd6f['push'](_0x144a0e);}),this['fire']('reviewCheckResultReady',{'changes':_0x58cd6f,'result':_0x18d7e3,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x5cd557){const _0x586d1f=this['_changes']['find'](_0x51df58=>_0x51df58['id']===_0x5cd557);return!(!_0x586d1f||'pending'!==_0x586d1f['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x3862fd=>!0x0===_0x3862fd['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x2ccc97=>'pending'===_0x2ccc97['status']);}['getChangeById'](_0x23da13){return this['_changes']['find'](_0x42dbb0=>_0x42dbb0['id']===_0x23da13);}['markAllChangesAsAccepted'](){for(const _0x13870c of this['_changes'])'pending'===_0x13870c['status']&&(_0x13870c['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x22a55e){const _0x498e01=this['_changes']['find'](_0x5e67db=>_0x5e67db['id']===_0x22a55e);_0x498e01&&'pending'===_0x498e01['status']&&(_0x498e01['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x1ac892){const _0x530ab2=this['_changes']['find'](_0x29cfe3=>_0x29cfe3['id']===_0x1ac892);_0x530ab2&&'pending'===_0x530ab2['status']&&(_0x530ab2['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x46f647){const _0x5996d8=this['_changes']['find'](_0x203492=>_0x203492['id']===_0x46f647);_0x5996d8&&'pending'===_0x5996d8['status']&&(_0x5996d8['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x17edbc){const _0x40db08=this['_changes']['find'](_0xbb4ea9=>_0xbb4ea9['id']===_0x17edbc);_0x40db08&&'outdated'===_0x40db08['status']&&(_0x40db08['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x4c6b41){this['_changes']['filter'](_0x22cfc9=>_0x22cfc9['isActivated']&&_0x22cfc9['id']!==_0x4c6b41)['forEach'](_0x1ec932=>{_0x1ec932['isActivated']=!0x1;});const _0x58c3f3=this['_changes']['find'](_0x2bd957=>_0x2bd957['id']===_0x4c6b41);_0x58c3f3&&'pending'===_0x58c3f3['status']&&(_0x58c3f3['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x3daa07=>_0x3daa07['isActivated'])['forEach'](_0x54858e=>{_0x54858e['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x2fd7ba){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x1cfd7d;if(_0x2fd7ba){const _0x499fdf=this['_changes']['find'](_0x493ab7=>_0x493ab7['id']===_0x2fd7ba);if(_0x499fdf&&_0x499fdf['isRated'])return;_0x499fdf&&(_0x1cfd7d=_0x499fdf['parent']['id'],_0x499fdf['isRated']=!0x0);}const _0x490e8a={'positiveCount':this['_changes']['filter'](_0x2ef2bd=>'accepted'===_0x2ef2bd['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x490e8a,this['callId'],_0x1cfd7d);}['_addReviewCheckResult'](_0x461c5c,_0x4914c5){const _0x544226=this['_documentData']['elements']['get'](_0x461c5c);if(!_0x544226)return;const _0x2ea066=_0x544226['getContent']();if(_0x2ea066===_0x4914c5)return;const _0x58e5fd=new lh({'id':_0x461c5c,'contentInitial':_0x2ea066,'contentNew':_0x4914c5,'documentVersion':_0x544226['documentVersion']});this['_results']['set'](_0x58e5fd['id'],_0x58e5fd),this['fire']('reviewCheckResultAdded',{'result':_0x58e5fd,'source':this,'editor':_0x544226['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0xcafbe=>'pending'===_0xcafbe['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x335a2d=>'pending'===_0x335a2d['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x22fa30=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x251ca4=0x0;_0x251ca4<this['_reviewParams']['length'];_0x251ca4++){if(!this['_reviewParams'][_0x251ca4]||!this['_sourceCheck']['options'][_0x251ca4])continue;const _0x13fe3b=this['_sourceCheck']['options'][_0x251ca4]['data']?.['find'](_0x193fd2=>_0x193fd2['id']===this['_reviewParams'][_0x251ca4]);_0x13fe3b&&_0x22fa30['push'](_0x13fe3b['label']);}return _0x22fa30['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x566654,_0xc784ff,_0x6db77a){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0xc784ff,_0x566654,_0x6db77a);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x5bb7a3{['_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',(_0x2009e8,_0x230223)=>this['runCheck'](_0x230223)),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 _0x3227e7=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x3227e7['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x3227e7['map'](_0x2d6367=>_0x2d6367['id']),this['_aiSource']);const _0x39635e=this['_currentReviewCheckRun'];_0x39635e['markAllChangesAsAccepted'](),_0x39635e['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x3a1a3e,_0xba5146)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0xba5146['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0xba5146['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0xba5146['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0xba5146['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0xa4c50c,_0x1871e0)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1871e0['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x1871e0['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x1871e0['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1871e0['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',(_0xfdb436,_0x54a02a)=>{this['_onActivateChange'](_0x54a02a);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2a19d5,_0x11603f)=>{this['_onDeactivateChange'](_0x11603f);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x2a47ed,_0x57f52b)=>{this['_onChangeMarkerClicked'](_0x2a47ed,_0x57f52b);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x40838d,_0x44339e)=>{this['_onChangeMarkerHovered'](_0x40838d,_0x44339e);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x679c0e,_0x56ce39)=>{this['_onChangeMarkerRemoved'](_0x679c0e,_0x56ce39);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x334e73,_0xdd81a3)=>{this['_onChangeMarkerRestored'](_0x334e73,_0xdd81a3);});}async['runCheck'](_0x4f7cfb){if(!this['_availableReviewChecks'])return;const _0x9e0e=this['_availableReviewChecks']['find'](_0x535677=>_0x535677['id']===_0x4f7cfb['id']);if(_0x9e0e){this['_onReviewCheckRun'](_0x4f7cfb),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x4f7cfb,_0x9e0e),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x1bfd7e,_0x3e385b)=>{switch(_0x3e385b['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x3e385b);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'!==_0x3e385b['status']&&'error-chunk'!==_0x3e385b['status']&&'error-general'!==_0x3e385b['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x4dea2f,_0x2bc56c)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x522dfa=this['_diffContent'](_0x2bc56c['editor'],_0x2bc56c['result']['contentInitial'],_0x2bc56c['result']['contentNew']);_0x2bc56c['source']['addResultChanges'](_0x2bc56c['result']['id'],_0x522dfa);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x3d3ced,_0x514257)=>{for(const _0x39946e of _0x514257['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x39946e);this['_markChangePositionInEditorContent'](_0x514257['changes'],_0x514257['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x106f7b,_0x5a523a)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x5a523a['change']['id'],_0x5a523a['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x336b47,_0x4e88be)=>{this['_onReviewCheckResultActivated'](_0x4e88be);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x4bdbfe){if(en(_0x4bdbfe))return;_0x4bdbfe instanceof ht?this['_logError'](_0x4bdbfe):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x4bdbfe));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x4f7cfb['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x4888d1,_0x3ea840){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x3ea840,this['_aiConnector'],_0x4888d1['params'],_0x4888d1['args']);}['_onChangeMarkerRemoved'](_0x2db48a,_0x3622cf){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x3622cf['changeId']);}['_onChangeMarkerRestored'](_0xa04afd,_0xca98a0){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0xca98a0['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x2f2922=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x2f2922&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x3ec15b of this['_aiReviewCoreEditing']['getEditors']())_0x3ec15b['editing']['view']['change'](_0x56e4a3=>{for(const _0x131817 of _0x3ec15b['editing']['view']['document']['getRoots']())_0x56e4a3['removeClass']('ck-ai_review-diff',_0x131817),_0x56e4a3['removeClass']('ck-ai_review-highlights',_0x131817),_0x56e4a3['removeClass']('ck-ai-translate-mode-content',_0x131817);});}['_logError'](_0xe4bd1){this['_reporter']['logError'](_0xe4bd1),'ai-review-mode-models-unable-to-retrieve'===function(_0x63c465){return _0x63c465 instanceof sn?_0x63c465['code']:_0x63c465 instanceof Error?_0x63c465['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0xe4bd1)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x3bb807){if('content'===this['_changeActivationSource']){const _0x5696dc=this['_aiReviewCoreUi']['getChangeElement'](_0x3bb807);_0x5696dc&&St(_0x5696dc['closest']('.ck-ai_review__check-run-result')||_0x5696dc);}else{if('panel'===this['_changeActivationSource']){const _0x33ec1e=this['_getChangeContentElement'](_0x3bb807);if(!_0x33ec1e)return;Rt({'target':_0x33ec1e,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x141696,_0x4f40ff,_0x2943a1,_0x3e6a1f,_0x2f160b){super(_0x2943a1,_0x3e6a1f,_0x2f160b),this['_prompt']=_0x141696,this['_model']=_0x4f40ff;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x1a9957,_0x4eee44,_0x1370c4){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x4eee44,_0x1a9957,_0x1370c4);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x17acfe){this['id']=_0x17acfe['id'],this['commandId']=_0x17acfe['commandId'],this['title']=_0x17acfe['title'],this['description']=_0x17acfe['description'],this['isParameterized']=_0x17acfe['isParameterized'],this['useArgs']=_0x17acfe['useArgs'],this['options']=_0x17acfe['options'],this['args']=_0x17acfe['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x2a3191,_0x8389f5,_0x5c264a){super(_0x2a3191),this['prompt']=_0x2a3191['prompt'],this['model']=_0x2a3191['model'],this['model']?this['_defaultModel']=_0x8389f5['find'](_0x530571=>_0x530571['id']===this['model'])||null:this['_defaultModel']=_0x5c264a;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x1f48c7){this['_prompt']=_0x1f48c7;}set['model'](_0x174d07){this['_model']=_0x174d07;}},wh=class extends _0x5bb7a3{static get['requires'](){return[ls,nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ch=[{'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'}]}]}],fh=/* #__PURE__ -- @preserve */
41
- gt();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x1166f3){this['_checks']=_0x1166f3['map'](_0x2b9991=>new mh(_0x2b9991));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x1c9b8f){return this['checks']['find'](_0x564be9=>_0x564be9['id']===_0x1c9b8f);}['removeCheckById'](_0x2bcbd0){this['_checks']=this['_checks']['filter'](_0x569449=>_0x569449['id']!==_0x2bcbd0);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x1918a1,_0x4aedda,_0x1ea67c){super(_0x1918a1),this['_models']=_0x4aedda,this['_defaultModel']=_0x1ea67c;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x1fdec0,_0xad73e,_0x5df9a2){super(),this['_allModels']=_0x1fdec0,this['_recommendedModels']=_0xad73e,this['_defaultModel']=_0x5df9a2;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x44f4b5){this['_checks']=_0x44f4b5['map'](_0x5e68de=>!0x0===_0x5e68de['isExtra']?new Eh(_0x5e68de,this['_allModels'],this['_defaultModel']):'custom'===_0x5e68de['id']?new Sh(_0x5e68de,this['_recommendedModels'],this['_defaultModel']):new mh(_0x5e68de));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x322ebf){super(_0x322ebf),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x2f0c02=>({'id':_0x2f0c02['id'],'commandId':_0x2f0c02['id'],'title':_0x2f0c02['label'],'description':_0x2f0c02['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x2f0c02['prompt'],'model':_0x2f0c02['model']}));}async['_loadChecksList'](){const _0x12568f=[...Ch,...this['getExtraChecks']()]['map'](_0x581764=>_0x581764['isExtra']?_0x581764:this['_translateReviewCheck'](_0x581764)),_0x4171cb=await this['_getModels'](),_0x3f908b=new Rh(_0x4171cb['all'],_0x4171cb['recommended'],_0x4171cb['default']);return _0x3f908b['setupChecks'](_0x12568f),_0x3f908b;}async['_getModels'](){const _0x5ef6fc=this['context']['plugins']['get']('AIConnector');try{const _0x125ea8=new Qs({'connector':_0x5ef6fc,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x3f3e4c={'all':await _0x125ea8['getAll'](),'recommended':await _0x125ea8['getAvailableModels'](),'default':await _0x125ea8['getDefault']()};return this['_modelsLoadError']=null,_0x3f3e4c;}catch(_0x11bf30){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x11bf30),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x534fdd){const _0x183597='AI_REVIEW_CHECK_'+_0x534fdd['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x2ec76a={..._0x534fdd,'title':this['_translate'](_0x183597+'_TITLE',_0x534fdd['title']),'description':this['_translate'](_0x183597+'_DESCRIPTION',_0x534fdd['description'])};return _0x534fdd['options']&&(_0x2ec76a['options']=_0x534fdd['options']['map'](_0x43399a=>({..._0x43399a,'label':this['_translate'](_0x183597+'_OPTIONS_LABEL',_0x43399a['label']||''),'data':_0x43399a['data']?_0x43399a['data']['map'](_0x4642ae=>({..._0x4642ae,'label':this['_translate'](_0x183597+'_OPTIONS_DATA_'+_0x4642ae['id']['toUpperCase'](),_0x4642ae['label'])})):void 0x0}))),_0x2ec76a;}['_translate'](_0x35093a,_0x33ead7){const _0x164fe9=us(this['context']['locale'],_0x35093a);return _0x164fe9===_0x35093a?_0x33ead7:_0x164fe9;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[nn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x3d5c09){super(_0x3d5c09),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x3dc1cc=>_0x3dc1cc['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x58f9ae,_0x2dd9c3)=>{this['_isDiffOn']=_0x2dd9c3['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x2bc0ff,_0x33385e){if(_0x2bc0ff['isCustom'])return new ph(_0x2bc0ff['args']['prompt'],_0x2bc0ff['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x33385e,this['_aiConnector']);if(_0x33385e['isExtra']){const _0x2dc1c0=_0x33385e;return new Th(_0x2bc0ff['args']?.['prompt']??_0x2dc1c0['prompt'],_0x2bc0ff['args']?.['model']??_0x2dc1c0['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x33385e,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x33385e,this['_aiConnector'],_0x2bc0ff['params'],_0x2bc0ff['args']);}['_onReviewCheckResultActivated'](_0x4af276){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x4af276['change']['id']),this['_scrollToChange'](_0x4af276['change']['id']);const _0x35d66f=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4af276['change']['id']);if(!_0x35d66f)return;const _0x3d71a2=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4af276['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4af276['change'],()=>_0x35d66f['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3d71a2,_0x35d66f['modelRange']['root']['rootName']),_0x3d71a2?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x4af276['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x1b22bf){this['_currentReviewCheckRun']&&'click'===_0x1b22bf['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x1b22bf['id']));}['_onDeactivateChange'](_0x563b83){this['_currentReviewCheckRun']&&'balloon'===_0x563b83['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x303c70,_0x165f22){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x165f22['changeId']);const _0x23e3e2=this['_currentReviewCheckRun']['getChangeById'](_0x165f22['changeId']);if(!_0x23e3e2)return;const _0x1be849=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x165f22['changeId']),_0x20034d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x165f22['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x23e3e2,_0x165f22['markerElement'],_0x165f22['domEvent'],'click',this['_getBalloonDomRoot'](_0x20034d,_0x1be849?.['modelRange']['root']['rootName']),_0x20034d?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x4cfb8c,_0x48e4a1){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x8d29b2=this['_currentReviewCheckRun']['getChangeById'](_0x48e4a1['changeId']);if(!_0x8d29b2)return;const _0x389da3=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x48e4a1['changeId']),_0x3657b3=this['_aiReviewCoreEditing']['getEditorForChange'](_0x48e4a1['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x8d29b2,_0x48e4a1['markerElement'],_0x48e4a1['domEvent'],'hover',this['_getBalloonDomRoot'](_0x3657b3,_0x389da3?.['modelRange']['root']['rootName']),_0x3657b3?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x7a6219){const _0x25e025=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x7a6219);return _0x25e025?_0x25e025['getElement']():null;}['_markChangePositionInEditorContent'](_0xedf581,_0xc519b){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0xedf581,_0xc519b);}['_diffContent'](_0x35d85e,_0x20c6a7,_0x567e8d){return this['_aiReviewCoreEditing']['diffContent'](_0x35d85e,_0x20c6a7,_0x567e8d,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x16381d){_0x16381d?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x556240 of this['_aiReviewCoreEditing']['getEditors']())_0x556240['editing']['view']['change'](_0x79d23c=>{for(const _0x4be2c1 of _0x556240['editing']['view']['document']['getRoots']()){for(const _0x5471d9 of _0x4be2c1['getClassNames']())_0x5471d9['startsWith']('ck-ai_review-')&&_0x79d23c['removeClass'](_0x5471d9,_0x4be2c1);_0x79d23c['addClass'](_0x16381d?'ck-ai_review-diff':'ck-ai_review-highlights',_0x4be2c1);}});}['_getBalloonDomRoot'](_0x2f19b9,_0x451449){const _0x5bc6da=_0x2f19b9['editing']['view'];if(_0x451449){const _0x169081=_0x5bc6da['getDomRoot'](_0x451449);if(_0x169081)return _0x169081;}return _0x5bc6da['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x457c45=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x47eb5d=await _0x457c45['getChecksList']();_0x457c45['modelsLoadError']&&this['_logError'](_0x457c45['modelsLoadError']);let _0x5e677c=_0x47eb5d['checks'];const _0x1f5d52=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x1f5d52,_0x5e677c),this['_usesAvailableCommandsConfig']&&(_0x5e677c=_0x1f5d52['map'](_0x208bf5=>_0x5e677c['find'](_0x38db34=>_0x38db34['id']===_0x208bf5))['filter'](_0x5ed393=>!!_0x5ed393)),this['_filterChecksWithMissingModel'](_0x5e677c);}['_logWarningForNonExistentChecks'](_0x4e0dc3,_0x435299){const _0x494b13=_0x4e0dc3['filter'](_0x5182ad=>!_0x435299['some'](_0x2046bb=>_0x2046bb['id']===_0x5182ad));_0x494b13['length']&&this['_reporter']['logError'](new sn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x494b13['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x25304f){const _0x5483b3=[];return _0x25304f['forEach'](_0x44552a=>{(_0x44552a instanceof Eh&&!_0x44552a['defaultModel']||_0x44552a instanceof Sh&&!_0x44552a['models']['length'])&&_0x5483b3['push'](_0x44552a['id']);}),_0x5483b3['length']&&_0x5483b3['forEach'](_0x2a5e59=>{_0x25304f=_0x25304f['filter'](_0x57ad35=>_0x57ad35['id']!==_0x2a5e59),this['_reporter']['logError'](new sn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x2a5e59}}));}),_0x25304f;}};function kh(_0x565692,_0x597db2,_0x57e026,_0x593bc5){return _0x565692 instanceof ht?_0x565692:new ht(_0x597db2,_0x57e026,_0x593bc5,_0x565692);}var Nh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x2d76b4){this['_affectedBlocks']=_0x2d76b4;}},yh=class extends _0x5bb7a3{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x4d20c8=>{const _0x3c3d63={'id':_0x4d20c8['id'],'title':_0x4d20c8['title'],'description':_0x4d20c8['description']};return'custom'!==_0x4d20c8['id']&&_0x4d20c8['options']?.['length']&&(_0x3c3d63['parameters']=_0x4d20c8['options'][0x0]['data']['map'](_0x24c680=>({..._0x24c680}))),_0x3c3d63;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x74828a,_0x5498a9){return await this['_runReviewCheck'](_0x74828a,()=>this['_createReviewCheckRun'](_0x74828a,_0x5498a9?.['parameterId']),_0x5498a9?.['signal']);}async['runCustomReview'](_0x270ae7,_0x152f1a){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x270ae7,_0x152f1a?.['model']),_0x152f1a?.['signal']);}['applyReview'](_0x37cdb9,_0x556b4c){this['context']['plugins']['get']('AIGateway')['apply'](_0x37cdb9,{'applyMethod':_0x556b4c,'aiSource':'review'});}async['_runReviewCheck'](_0x239176,_0x3ccb98,_0x1ba48a){const _0xdd0122=_s(this['context']),_0x4a95a4=new Nh({'editor':_0xdd0122,'rootName':_0xdd0122['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0xdd0122['plugins']['get']('AIEditing')['getSessionId'](_0xdd0122)});let _0x4d11ce,_0x449b22;if(_0x1ba48a){if(_0x1ba48a['aborted'])return _0x4a95a4['abort'](),_0x4a95a4;const _0x443496=()=>{_0x4a95a4['error']||(_0x4a95a4['abort'](),_0x4d11ce&&_0x4d11ce['abort']());};_0x1ba48a['addEventListener']('abort',_0x443496),_0x449b22=()=>_0x1ba48a['removeEventListener']('abort',_0x443496);}try{_0x4d11ce=await _0x3ccb98(),_0x4a95a4['contentRawOld']=_0x4d11ce['documentData']['content'],_0x4a95a4['documentVersion']=Array['from'](_0x4d11ce['documentData']['elements'])['find'](([,_0x3913ca])=>_0x3913ca['rootName']===_0x4a95a4['rootName'])?.[0x1]['documentVersion']??0x1,_0x4d11ce['on']('reviewCheckRunUpdated',(_0x39a6ef,_0x1fddc2)=>{'aborted'===_0x1fddc2['status']?_0x4a95a4['abort']():'error-general'!==_0x1fddc2['status']&&'error-chunk'!==_0x1fddc2['status']||(_0x4a95a4['error']=kh(_0x1fddc2['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x239176}));}),'aborted'!==_0x4a95a4['status']&&await _0x4d11ce['start']();}catch(_0xc5e425){_0x4a95a4['error']=kh(_0xc5e425,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x239176});}finally{_0x449b22&&_0x449b22();}if(!_0x4d11ce||'aborted'===_0x4a95a4['status']||'error'===_0x4a95a4['status'])return _0x4a95a4;_0x4a95a4['affectedBlocks']=_0x4d11ce['results']['map'](_0x329dd8=>({'id':_0x329dd8['id'],'content':_0x329dd8['contentNew']}));try{_0x4a95a4['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x4a95a4['affectedBlocks'],_0x4a95a4['contentRawOld'],_0x4a95a4['editor']));}catch(_0x40a134){_0x4a95a4['error']=kh(_0x40a134,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x239176});}return _0x4a95a4;}async['_createReviewCheckRun'](_0x20435d,_0x330804){const _0x340fc8=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x38c242=>_0x38c242['id']===_0x20435d);if(!_0x340fc8)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x20435d});if(_0x340fc8 instanceof Sh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x20435d});const _0x261376=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2296da=this['context']['plugins']['get']('AIConnector');if(_0x340fc8 instanceof Eh){if(!_0x340fc8['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x20435d});return new Th(_0x340fc8['prompt'],_0x340fc8['defaultModel']['id'],_0x261376,_0x340fc8,_0x2296da);}return new Ah(_0x261376,_0x340fc8,_0x2296da,_0x330804?[_0x330804]:void 0x0);}async['_createCustomReviewCheckRun'](_0x39282e,_0x258a85,_0x14802c){const _0x13c3c9=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5636c6=>_0x5636c6['id']===_0x39282e);if(!_0x13c3c9)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x39282e});if(!(_0x13c3c9 instanceof Sh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x39282e});const _0x3a1da4=_0x14802c??_0x13c3c9['defaultModel']?.['id'];if(!_0x258a85)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x39282e});if(!_0x3a1da4)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x39282e});return new ph(_0x258a85,_0x3a1da4,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x13c3c9,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x5bb7a3{static get['requires'](){return[vh,nh,hh,yh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x104fca,_0x48b0ea){if(this['assertStartReviewPreconditions'](_0x104fca)instanceof Sh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x104fca});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x104fca,'params':_0x48b0ea?.['parameterId']?[_0x48b0ea['parameterId']]:void 0x0});}async['startCustomReview'](_0x178988,_0x3041dc){if(!_0x178988)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x1eb2be=Ch['find'](_0x10b1d2=>'custom'===_0x10b1d2['commandId'])['id'],_0x559768=this['assertStartReviewPreconditions'](_0x1eb2be),_0x25fa86=_0x3041dc?.['model']??_0x559768['defaultModel']?.['id'];if(!_0x25fa86)throw new ht('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x1eb2be,'isCustom':!0x0,'args':{'prompt':_0x178988,'model':_0x25fa86}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x293a4e=>{const _0x486d11={'id':_0x293a4e['id'],'title':_0x293a4e['title'],'description':_0x293a4e['description']};return'custom'!==_0x293a4e['id']&&_0x293a4e['options']?.['length']&&(_0x486d11['parameters']=_0x293a4e['options'][0x0]['data']['map'](_0x1ce5f7=>({..._0x1ce5f7}))),_0x486d11;});}['assertStartReviewPreconditions'](_0x322a85){const _0x4f0f08=this['context']['plugins']['get']('AIReviewModeController');if(_0x4f0f08['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x2cc4c3=_0x4f0f08['getAvailableChecks']()['find'](_0x77836=>_0x77836['id']===_0x322a85);if(!_0x2cc4c3)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x322a85});return _0x2cc4c3;}},Lh=class extends Ah{['_title'];constructor(_0x32f3dc,_0x54a540,_0x1f1b4a,_0x236b2e,_0xce8679,_0x528290){super(_0x32f3dc,_0x54a540,_0x1f1b4a,_0xce8679,_0x528290),this['_title']=_0x236b2e;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x9a38ab){this['_checks']=_0x9a38ab['map'](_0x2c0a8a=>new Dh(_0x2c0a8a));}};const Hh=[{'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 Mh=class extends wh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x4674a1){super(_0x4674a1),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x4ad268=[],_0x325113=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x518c4d of _0x325113)_0x4ad268['push']({'title':_0x518c4d['label'],'id':_0x518c4d['id'],'commandId':_0x518c4d['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x518c4d['id']}});const _0x4e8512=new Ph();return _0x4e8512['setupChecks'](this['_translateChecks'](_0x4ad268)),_0x4e8512;}['_translateChecks'](_0x2d0f6e){const _0x4f1628=this['context']['locale'];return _0x2d0f6e['map'](_0x5280e4=>{const _0x424a65='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x5280e4['title']['toUpperCase']()['replaceAll']('-','_'),_0x1fd230=us(_0x4f1628,_0x424a65);return{..._0x5280e4,'title':_0x1fd230===_0x424a65?_0x5280e4['title']:_0x1fd230};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[nn,Mh];}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'](_0x5a7334,_0x3c64bb){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x3c64bb,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x5a7334['params'],_0x5a7334['args']);}['_onReviewCheckResultActivated'](_0x5d9f22){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5d9f22['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5d9f22['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x33c026){this['_currentReviewCheckRun']&&('hover'===_0x33c026['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x33c026['id'])),'click'===_0x33c026['uiInteraction']&&this['_scrollToChange'](_0x33c026['id']));}['_onDeactivateChange'](_0x46c17d){this['_currentReviewCheckRun']&&'panel'===_0x46c17d['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x39facb,_0x1cf338){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1cf338['changeId']),this['_scrollToChange'](_0x1cf338['changeId']));}['_onChangeMarkerHovered'](_0x4aa217,_0x7b23fa){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x7b23fa['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x7b23fa['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x3b859c){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3b859c);}['_markChangePositionInEditorContent'](_0x532744,_0x53dee1){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x532744,_0x53dee1);}['_diffContent'](_0x369e99,_0x24ff2d,_0x16f9dd){return this['_aiReviewCoreEditing']['diffContent'](_0x369e99,_0x24ff2d,_0x16f9dd,!0x0);}['_onReviewCheckRun'](){for(const _0x411796 of this['_aiReviewCoreEditing']['getEditors']())_0x411796['editing']['view']['change'](_0x1ab967=>{for(const _0x1088e7 of _0x411796['editing']['view']['document']['getRoots']())_0x1ab967['addClass']('ck-ai-translate-mode-content',_0x1088e7);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x1b2d64,_0x47fb0e){super(_0x1b2d64,_0x47fb0e),this['on']('set:isLoading',(_0x1bde8a,_0x28e79e,_0x56a5d1)=>{_0x56a5d1&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x29e105,_0x5e9d42,_0x4d3201)=>{_0x4d3201&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x3c800c=super['_createAcceptAllButtonView']();return _0x3c800c['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x3c800c;}['_createExitReviewButtonView'](){const _0x19360d=super['_createExitReviewButtonView']();return _0x19360d['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x19360d;}},Bh=class extends sh{['_setupTemplate'](){const _0x4af629=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x4af629['if']('isVisible','ck-hidden',_0x288238=>!_0x288238)]},'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',_0x4af629['if']('isVisible','ck-hidden',_0x341941=>!_0x341941)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x44de45=this['context']['plugins']['get']('AITabs'),_0x4ad5c5=this['context']['locale'],_0x459edc=new Ho(_0x4ad5c5,{'label':us(_0x4ad5c5,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x1b8aec,'class':'ck-ai-header_review-translate','showResizeButton':_0x44de45['showResizeButton']});_0x459edc['delegate']('resizeTabs')['to'](_0x44de45),_0x459edc['bind']('isMaximized')['to'](_0x44de45['view'],'isMaximized',_0x16975b=>_0x16975b);const _0x1a4b32=new $a(_0x4ad5c5,{'header':_0x459edc,'list':new Bh(_0x4ad5c5),'results':new Uh(_0x4ad5c5,{'generalErrorText':us(_0x4ad5c5,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x4ad5c5,{'headerText':us(_0x4ad5c5,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x4ad5c5,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x4ad5c5,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x1a4b32['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x1a4b32;}['registerTab'](){const _0x5815f9=this['context']['plugins']['get']('AITabs');_0x5815f9['view']['on']('activateTab',(_0x3a8540,{newTab:_0x24d446,oldTab:_0x15730c})=>{'translate'===_0x24d446?this['fire']('getReviewCheckList'):'translate'===_0x15730c&&this['fire']('leaveReview');}),_0x5815f9['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x1b8aec,'order':0x0,'content':this['_mainView']});}},Fh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x3f2d8a){this['_affectedBlocks']=_0x3f2d8a;}},Kh=class extends _0x5bb7a3{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x76f235,_0x9ab3f0){return await this['_runTranslateCheck'](_0x76f235,()=>this['_createTranslateCheckRun'](_0x76f235),_0x9ab3f0?.['signal']);}['applyTranslate'](_0x14d45d,_0x1eb755){this['context']['plugins']['get']('AIGateway')['apply'](_0x14d45d,_0x1eb755);}async['_runTranslateCheck'](_0x425f6b,_0x3bee68,_0x572dd0){const _0x439719=_s(this['context']),_0xafea42=new Fh({'editor':_0x439719,'rootName':_0x439719['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x439719['plugins']['get']('AIEditing')['getSessionId'](_0x439719)});let _0x18ed90,_0x4e449e;if(_0x572dd0){if(_0x572dd0['aborted'])return _0xafea42['abort'](),_0xafea42;const _0xe699bc=()=>{_0xafea42['error']||(_0xafea42['abort'](),_0x18ed90&&_0x18ed90['abort']());};_0x572dd0['addEventListener']('abort',_0xe699bc),_0x4e449e=()=>_0x572dd0['removeEventListener']('abort',_0xe699bc);}try{_0x18ed90=await _0x3bee68(),_0xafea42['contentRawOld']=_0x18ed90['documentData']['content'],_0xafea42['documentVersion']=Array['from'](_0x18ed90['documentData']['elements'])['find'](([,_0x1bbe50])=>_0x1bbe50['rootName']===_0xafea42['rootName'])?.[0x1]['documentVersion']??0x1,_0x18ed90['on']('reviewCheckRunUpdated',(_0xe94b01,_0x407315)=>{'aborted'===_0x407315['status']?_0xafea42['abort']():'error-general'!==_0x407315['status']&&'error-chunk'!==_0x407315['status']||(_0xafea42['error']=kh(_0x407315['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x425f6b}));}),'aborted'!==_0xafea42['status']&&await _0x18ed90['start']();}catch(_0x26ce2e){_0xafea42['error']=kh(_0x26ce2e,'ai-translategateway-translation-run-failed',this,{'language':_0x425f6b});}finally{_0x4e449e&&_0x4e449e();}if(!_0x18ed90||'aborted'===_0xafea42['status']||'error'===_0xafea42['status'])return _0xafea42;_0xafea42['affectedBlocks']=_0x18ed90['results']['map'](_0x39cd35=>({'id':_0x39cd35['id'],'content':_0x39cd35['contentNew']}));try{_0xafea42['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0xafea42['affectedBlocks'],_0xafea42['contentRawOld'],_0xafea42['editor']));}catch(_0x3e5a13){_0xafea42['error']=kh(_0x3e5a13,'ai-translategateway-translation-run-failed',this,{'language':_0x425f6b});}return _0xafea42;}async['_createTranslateCheckRun'](_0x4a091a){const _0x2d5bfc=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x5df36b=this['context']['plugins']['get']('AIConnector');return new Lh(_0x2d5bfc,new Dh({'id':_0x4a091a,'commandId':_0x4a091a,'title':_0x4a091a,'description':'','isParameterized':!0x1}),_0x5df36b,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x4a091a});}},Wh=class extends _0x5bb7a3{static get['requires'](){return[Vh,Gh,hh,Kh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x20de95){const _0x1cd111=this['assertStartTranslatePreconditions'](_0x20de95);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x1cd111['id'],'args':_0x1cd111['useArgs']?_0x1cd111['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1a98e6=>({'id':_0x1a98e6['id'],'label':_0x1a98e6['title']}));}['assertStartTranslatePreconditions'](_0xcf18f){const _0x2aadf8=this['context']['plugins']['get']('AITranslateController');if(_0x2aadf8['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x103e2c=_0x2aadf8['getAvailableChecks']()['find'](_0x349bb7=>_0x349bb7['id']===_0xcf18f);if(!_0x103e2c)throw new ht('ai-translate-unknown-language',this,{'languageId':_0xcf18f});return _0x103e2c;}};export{Ua as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,fn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,ls as AIConnector,sn as AICoreError,tn as AIDocumentProcessingGateway,Zs as AIDocumentProcessingRunResult,Is as AIEditing,Aa as AIEditorIntegration,rn as AIErrorReporter,nn as AIErrorSink,js as AIGateway,An as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,dn as AIReply,ki as AIRequestError,mh as AIReviewCheck,lh as AIReviewCheckResult,dh as AIReviewCheckResultChange,gh as AIReviewCheckRun,yh as AIReviewGateway,xh as AIReviewMode,Ih as AIReviewModeController,hh as AIReviewModeEditing,nh as AIReviewModeUI,Nh as AIReviewRunResult,Js as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,ra as ToggleAICommand,cn as createResizeButton,Zi as getDefaultAICommands,zs as markOperationsAsAI};
23
+ import{Command as _0x492f00,ContextPlugin as _0x7ceac6,Editor as _0x3d3542,Plugin as _0x3fb090,rootAcceptsBlocks as _0xc7c2a1}from'@ckeditor/ckeditor5-core';import{IconAI as _0x39c18b,IconAIAdjustLength as _0x2419c3,IconAIAskAI as _0x1adff3,IconAIChangeTone as _0x3bdecd,IconAIChat as _0x57b32e,IconAIChatCommands as _0x4ebdfa,IconAIContinueWriting as _0x3578f6,IconAIGrammarCheck as _0x36b440,IconAIHistory as _0x389f69,IconAIImproveWriting as _0x502ed5,IconAIOther as _0xae41ea,IconAIQuickActions as _0x40e9e1,IconAIReview as _0x13db03,IconAITranslate as _0x23533e,IconBoxWithCheck as _0x251146,IconBoxWithCross as _0x4bfdfc,IconBoxWithMarker as _0x41639c,IconBrowseFiles as _0x3322f5,IconBulb as _0x376593,IconCancel as _0x3e4cf9,IconCheck as _0x3afcd8,IconChevronDown as _0x45bedb,IconChevronRight as _0xeefee8,IconChevronUp as _0x4195d0,IconCopy as _0x3855bb,IconDocument as _0x43d4dc,IconDocumentOutline as _0x232d49,IconDropdownArrow as _0x5b9e25,IconError as _0x2e6b11,IconEye as _0x56116e,IconEyeCrossedOut as _0x3564bb,IconFileUpload as _0x7d3934,IconImage as _0x34fbb2,IconInfo as _0x51052c,IconLink as _0x3ef3ff,IconLoupe as _0x785cd,IconMagicWand as _0x57caaf,IconMaximize as _0x322c97,IconMinimize as _0x2ea4dd,IconNextArrow as _0x1513ef,IconOutdated as _0x15f2a4,IconPaperClip as _0x1bf76f,IconPin as _0x350cc3,IconPlus as _0x543d19,IconPreviousArrow as _0x56e661,IconRefresh as _0x1f7099,IconRobotPencil as _0x1d2de2,IconSelection as _0x20160d,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 _0x512173,SearchTextView as _0x105f16,SpinnerView as _0x520d48,TextareaView as _0x32a77f,ToolbarView as _0x411218,UIModel as _0x365b55,View as _0x9561fa,ViewCollection as _0x18f546,addListToDropdown as _0x2e32a2,addMenuToDropdown as _0x4333d3,clickOutsideHandler as _0xf72b9b,createDropdown as _0x4acf15,createLabeledInputText as _0x192bba,createLabeledTextarea as _0xc793c6,submitHandler as _0x3842ab}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x15bbc0,ClipboardPipeline as _0x20ca9d}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x2b44dc,MarkerOperation as _0xbdce83,Matcher as _0x17cfd1,ModelDocumentFragment as _0x38a201,ModelPosition as _0x435e4b,ModelRange as _0x156cfa,ModelTreeWalker as _0x2d6fc5,ViewDataTransfer as _0x5f035e,ViewDocumentDomEventData as _0xd915d1,ViewDowncastWriter as _0xdfa425,ViewUpcastWriter as _0x426413,_DetachOperation as _0x521b81,_insertIntoModelNodeList as _0x539ac0,_removeFromModelNodeList as _0x3d5521,transformOperationSets as _0x456211}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x4a0d84,debounce as _0x14414f,escape as _0x42dd97,escapeRegExp as _0x42acc1,throttle as _0x271436,unescape as _0x50e237}from'es-toolkit/compat';import{createParser as _0x22545b}from'eventsource-parser';import{CloudServices as _0x4f40da}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x1a0ec9,DATA_ID_MODEL_ATTRIBUTE as _0x9dc3c8,DATA_ID_VIEW_ATTRIBUTE as _0x322327,DocumentCompare as _0x4568e8,SuggestionsConversion as _0x129c58,fixElementSuggestionRange as _0x5e2c2d,getAllMarkersDomElementsSorted as _0x3f3ea9,getMarkerDomElement as _0xca6049}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x374aa9}from'htmlparser2';import{append as _0x37093c,appendChild as _0x3fb410,find as _0x41f6ef,findAll as _0x16747b,findOne as ti,getChildren as _0x52c55b,getParent as _0x128397,isComment as _0x5da664,isTag as _0x5769a6,prepend as _0x22c1dd,prependChild as _0x82f7d2,removeElement as _0x4e4767,replaceElement as _0x2b89b7,textContent as _0xdcf064}from'domutils';import _0x12c7a7 from'dom-serializer';import{Document as _0x37a11f,Element as _0x597b04,NodeWithChildren as _0x20b480,Text as _0x48552e,cloneNode as _0xe09a37,isDocument as _0x9a518f,isText as _0x59c448}from'domhandler';import{MarkdownGfmMdToHtml as _0x366b05,MarkdownGfmMdToHtmlDefaultPlugins as _0xa04aaf}from'@ckeditor/ckeditor5-markdown-gfm';import _0x4c3032 from'rehype-sanitize';import _0x3aceaf from'morphdom';import{diffArrays as _0x47a983}from'diff';const fi='_ungrouppedCommands';function bi(_0x42a31f,_0x2ad422){const _0x30cbca=(0x0,_0x2ad422['t'])('Other');return _0x42a31f['length']?'groupId'in _0x42a31f[0x0]?_0x42a31f:[{'groupId':fi,'groupLabel':_0x30cbca,'order':0x1/0x0,'commands':_0x42a31f}]:[{'groupId':fi,'groupLabel':_0x30cbca,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x3fb090{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0xe4b28b}=this,_0x5e3153=['ck-fake-ai-selection'];_0xe4b28b['config']['get']('ai.assistant.useTheme')&&_0x5e3153['push']('ck-ai-assistant-ui_theme'),_0xe4b28b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x5e3153,'priority':0xc}}),_0xe4b28b['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x5d85b2,{writer:_0x281913})=>{if(!_0x5d85b2['markerRange']['isCollapsed'])return null;const _0x463e04=_0x281913['createUIElement']('span');return _0x281913['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x463e04),_0x463e04;}});}['afterInit'](){!async function(_0x32d577){const _0x3df974='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x1f2153=0x78e88,_0x4710f2=window['Date']['now'](),_0x3ef669=_0x32d577['editor'],_0x215a7a=new window['Promise'](_0x4b634b=>{_0x3ef669['once']('ready',_0x4b634b);}),_0x54708f={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x38c595=_0x3ef669['config']['get']('licenseKey');async function _0x1f66ee(){let _0x2c5a78,_0x59237e=null,_0x3e90ee=null;try{return'GPL'==_0x38c595?'NotAllowed':(_0x2c5a78=_0x286f12(),_0x2c5a78?(_0x2c5a78['usageEndpoint']&&(_0x3e90ee=_0x576d64(_0x2c5a78['usageEndpoint'],_0x2c5a78['jti'])),await _0x49d4c3()?_0x1e7948()?_0x49c0cf()?'Expired':_0x366723()?('evaluation'==_0x2c5a78['licenseType']&&(_0x59237e=_0x124e87('EvaluationLimit')),await _0x2e7fc3()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x49c0cf(){const _0x297b4b=['evaluation','trial']['includes'](_0x2c5a78['licenseType'])?_0x4710f2/0x3e8:0xe10*_0x1f2153;return _0x2c5a78['exp']<_0x297b4b;}function _0x1e7948(){const _0x103f91=_0x2c5a78['features'];return!!_0x103f91&&(!!_0x103f91['includes']('*')||!!_0x103f91['includes']('AI'));}function _0x366723(){const _0x1c29ad=_0x2c5a78['licensedHosts'];if(!_0x1c29ad||0x0==_0x1c29ad['length'])return!0x0;const {hostname:_0x4ee5e4}=new URL(window['location']['href']);if(_0x1c29ad['includes'](_0x4ee5e4))return!0x0;const _0x399253=_0x4ee5e4['split']('.');return _0x1c29ad['filter'](_0x47958f=>_0x47958f['includes']('*'))['map'](_0x5b7b50=>_0x5b7b50['split']('.'))['filter'](_0x1b6898=>_0x1b6898['length']<=_0x399253['length'])['map'](_0x3e66f7=>Array(_0x399253['length']-_0x3e66f7['length'])['fill']('*'===_0x3e66f7[0x0]?'*':'')['concat'](_0x3e66f7))['some'](_0x1f347c=>_0x399253['every']((_0x11bde0,_0x539110)=>_0x1f347c[_0x539110]===_0x11bde0||'*'===_0x1f347c[_0x539110]));}function _0x2e7fc3(){return _0x59237e&&_0x3e90ee?new window['Promise']((_0x58248e,_0x3f832f)=>{_0x59237e['then'](_0x58248e,_0x3f832f),_0x3e90ee['then'](_0x4415c0=>{'Valid'!=_0x4415c0&&_0x58248e(_0x4415c0);},_0x3f832f);}):_0x59237e||_0x3e90ee||'Valid';}}function _0x576d64(_0x2dc8db,_0x9d9535){return new window['Promise'](_0x46a588=>{if(_0x3c17e4())return _0x46a588('Valid');_0x5c8897(),_0x3ef669['decorate']('_sendUsageRequest');let _0x4befa2=!0x1;const _0x3dbfb4=vt();function _0x1e5ed7(_0x313d5a){return!!_0x313d5a&&('object'==typeof _0x313d5a||'function'==typeof _0x313d5a)&&'function'==typeof _0x313d5a['then']&&'function'==typeof _0x313d5a['catch'];}function _0x3f06d7(_0xb2002f){_0x540451(_0xb2002f)['then'](_0xc12b19=>_0xc12b19&&'ok'==_0xc12b19['status']?_0x83e53a(_0x5c3d8c(_0x3dbfb4+_0x9d9535))!=_0xc12b19['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x4087b2=>(_0x1f3acd(),_0x4087b2),()=>{const _0x2f419d=_0x1be706();return null==_0x2f419d?(_0x1f3acd(),'Valid'):_0x4710f2-_0x2f419d>0x240c8400?'UsageLimit':'Valid';})['then'](_0x46a588)['catch'](()=>{_0x46a588('UsageLimit');});const _0x4dd936=0x36ee80;function _0x1f3acd(){const _0x2761ca='llct-'+_0x83e53a(_0x5c3d8c(_0x2dc8db)),_0x204cae=_0x12cc62(_0x83e53a(window['Math']['ceil'](_0x4710f2/_0x4dd936)));window['localStorage']['setItem'](_0x2761ca,_0x204cae);}function _0x1be706(){const _0x9bd171='llct-'+_0x83e53a(_0x5c3d8c(_0x2dc8db)),_0x494eff=window['localStorage']['getItem'](_0x9bd171);return _0x494eff?window['parseInt'](_0x12cc62(_0x494eff),0x10)*_0x4dd936:null;}function _0x540451(_0x1d59ac){return new window['Promise']((_0x9d9367,_0xbb7d04)=>{_0x1d59ac['then'](_0x9d9367,_0xbb7d04),window['setTimeout'](_0xbb7d04,0x1d4c0);});}}_0x3ef669['on']('_sendUsageRequest',(_0x449c91,_0x3b0a1f)=>{if(_0x3b0a1f[0x0]!=_0x2dc8db)return _0x46a588('UsageLimit');_0x3b0a1f[0x1]={..._0x3b0a1f[0x1],'requestId':_0x3dbfb4};},{'priority':'high'}),_0x3ef669['on']('_sendUsageRequest',_0x217996=>{_0x1e5ed7(_0x217996['return'])&&(_0x4befa2=!0x0,_0x3f06d7(_0x217996['return']));},{'priority':'low'}),_0x215a7a['then'](()=>{_0x4befa2||_0x46a588('UsageLimit');});});function _0x3c17e4(){return'auto'==_0x3ef669['editing']['view']['_overlayModeHint'];}function _0x5c8897(){_0x3ef669['editing']['view']['_overlayModeHint']='auto';}}function _0x124e87(_0x8e0e94){const _0x212a15=[new window['Promise'](_0x106f8b=>setTimeout(_0x106f8b,0x93ecc)),_0x215a7a['then'](()=>new window['Promise'](_0x2ea524=>{let _0xa10b22=0x0;_0x3ef669['model']['on']('applyOperation',(_0x3830dd,_0xd21b98)=>{_0xd21b98[0x0]['isDocumentOperation']&&_0xa10b22++,0x5e8==_0xa10b22&&(_0x2ea524(),_0x3830dd['off']());});}))];return window['Promise']['race'](_0x212a15)['then'](()=>_0x8e0e94);}async function _0x322b83(){await _0x215a7a,_0x3ef669['model']['change']=_0x505bc6,_0x3ef669['model']['enqueueChange']=_0x505bc6,_0x3ef669['enableReadOnlyMode']('model');}function _0x2ff46a(_0x3ca086){const _0xe91d19=_0x3a196a();_0x3ef669[_0xe91d19]='aiLicenseKey'+_0x3ca086,'Valid'!=_0x3ca086&&_0x322b83();}function _0x3a196a(){const _0x47a3b6=window['String'](window['performance']['now']())['replace']('.','');let _0x52463f='n';for(let _0x2bf86d=0x0;_0x2bf86d<_0x47a3b6['length'];_0x2bf86d+=0x2){let _0x303ac6=window['parseInt'](_0x47a3b6['substring'](_0x2bf86d,_0x2bf86d+0x2));_0x303ac6>=0x3e&&(_0x303ac6-=0x3e),_0x52463f+=_0x3df974[_0x303ac6];}return _0x52463f;}function _0x286f12(){const _0x2f401d=_0x38c595['split']('.');if(0x3!=_0x2f401d['length'])return null;return _0x2997dc(_0x2f401d[0x1]);function _0x2997dc(_0xa1c949){const _0x23ef92=_0xb3eb41(_0xa1c949);return _0x23ef92&&_0x348e2f()?_0x23ef92:null;function _0x348e2f(){const _0x3009a8=_0x23ef92['jti'],_0xf35356=window['parseInt'](_0x3009a8['substring'](_0x3009a8['length']-0x8),0x10),_0xf3e175={..._0x23ef92,'jti':_0x3009a8['substring'](0x0,_0x3009a8['length']-0x8)};return delete _0xf3e175['vc'],_0x5c3d8c(_0xf3e175)==_0xf35356;}}}async function _0x49d4c3(){let _0x3d1de6=!0x0;try{const [_0x49c142,_0x120767,_0x3cbbff]=_0x38c595['split']('.');return _0x516afb(_0x49c142),await _0x36d11d(_0x49c142,_0x120767,_0x3cbbff),_0x3d1de6;}catch{return!0x1;}function _0x516afb(_0x453565){const _0x250e94=_0xb3eb41(_0x453565);_0x250e94&&'ES256'==_0x250e94['alg']||(_0x3d1de6=!0x1);}async function _0x36d11d(_0x5542ba,_0x219404,_0x1605dd){const _0x2bef49=window['Uint8Array']['from'](_0x322f7e(_0x1605dd),_0x35eac2=>_0x35eac2['charCodeAt'](0x0)),_0x1213b8=new window['TextEncoder']()['encode'](_0x5542ba+'.'+_0x219404),_0x8a815c=window['crypto']['subtle'];if(!_0x8a815c)return;const _0x1755e8=await _0x8a815c['importKey']('jwk',_0x54708f,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x8a815c['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x1755e8,_0x2bef49,_0x1213b8)||(_0x3d1de6=!0x1);}}function _0xb3eb41(_0x3de5cb){return _0x3de5cb['startsWith']('ey')?JSON['parse'](_0x322f7e(_0x3de5cb)):null;}function _0x322f7e(_0x237014){return window['atob'](_0x237014['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x5c3d8c(_0x442e9a){let _0x1bdcec=0x1505;function _0x4a2b11(_0xc8bd6){for(let _0x4e1256=0x0;_0x4e1256<_0xc8bd6['length'];_0x4e1256++){const _0x5e5f85=_0xc8bd6['charCodeAt'](_0x4e1256);_0x1bdcec=(_0x1bdcec<<0x5)+_0x1bdcec+_0x5e5f85,_0x1bdcec&=_0x1bdcec;}}function _0x51c4a7(_0xfe106c){Array['isArray'](_0xfe106c)?_0xfe106c['forEach'](_0x51c4a7):_0xfe106c&&'object'==typeof _0xfe106c?Object['entries'](_0xfe106c)['sort']()['forEach'](([_0x424aec,_0x5ab06a])=>{_0x4a2b11(_0x424aec),_0x51c4a7(_0x5ab06a);}):_0x4a2b11(window['String'](_0xfe106c));}return _0x51c4a7(_0x442e9a),_0x1bdcec>>>0x0;}function _0x83e53a(_0x3bbb49){return _0x3bbb49['toString'](0x10)['padStart'](0x8,'0');}function _0x12cc62(_0x46fced){return _0x46fced['split']('')['reverse']()['join']('');}function _0x505bc6(){}_0x2ff46a(await _0x1f66ee());}(this);}['showFakeVisualSelection'](){const _0x18d6c8=this['editor']['model'];_0x18d6c8['change'](_0x3efa71=>{const _0x4beb8b=_0x18d6c8['document']['selection']['getRanges']();let _0x4aab66=0x0;for(const _0xe7d984 of _0x4beb8b){const _0x45f6f9=Ri+':'+_0x4aab66;if(_0x18d6c8['markers']['has'](_0x45f6f9))_0x3efa71['updateMarker'](_0x45f6f9,{'range':_0xe7d984});else{if(_0xe7d984['start']['isAtEnd']){const _0x47f0fe=_0xe7d984['start']['getLastMatchingPosition'](({item:_0x22b33b})=>!_0x18d6c8['schema']['isContent'](_0x22b33b),{'boundaries':_0xe7d984});_0x3efa71['addMarker'](_0x45f6f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3efa71['createRange'](_0x47f0fe,_0xe7d984['end'])});}else _0x3efa71['addMarker'](_0x45f6f9,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xe7d984});}_0x4aab66++;}});}['hideFakeVisualSelection'](){const _0x2127d0=this['editor']['model'],_0x79f6b9=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x79f6b9['length']&&_0x2127d0['change'](_0x5ca36f=>{_0x79f6b9['forEach'](_0x4c5bcb=>{_0x5ca36f['removeMarker'](_0x4c5bcb);});});}['insertContent'](_0x1df3d1,_0x328e45){const _0x3df36f=this['_getAISelection'](),_0x4ffa9a=_0x328e45||_0x3df36f['getFirstRange']();this['editor']['model']['canEditAt'](_0x4ffa9a)&&this['editor']['model']['change'](_0x5170b5=>{this['hideFakeVisualSelection'](),_0x328e45||this['_resetContentOfSelectedTableCells'](_0x5170b5,_0x3df36f),this['_pasteHTMLUsingClipboard']({'insertAt':_0x4ffa9a,'writer':_0x5170b5,'html':_0x1df3d1});});}['insertContentBelow'](_0x38f4bf){const {model:_0xa89a14}=this['editor'],_0xea9889=this['_getAISelection']();_0xa89a14['change'](()=>{const _0x467854=this['_prepareTableInsertBelowPosition'](_0x38f4bf,_0xea9889)||this['_getDefaultInsertBelowPosition'](_0xea9889);this['insertContent'](_0x38f4bf,_0x467854);});}['_getAISelection'](){const _0x228db0=this['editor']['model'],_0x5c41c9=Array['from'](_0x228db0['markers']['getMarkersGroup'](Ri))['map'](_0x35812a=>_0x35812a['getRange']());return _0x228db0['createSelection'](_0x5c41c9);}['_pasteHTMLUsingClipboard']({writer:_0xb9a8e3,html:_0x3593b1,insertAt:_0x46c69e}){const {view:_0x3f6da3}=this['editor']['editing'],_0x48e3de=this['editor']['plugins']['get'](_0x20ca9d),_0x473b93=new Si();_0x473b93['setData']('text/html',_0x3593b1);const _0x1ff499=new _0xd915d1(_0x3f6da3,new ClipboardEvent('paste',{'clipboardData':_0x473b93}),{'dataTransfer':new _0x5f035e(_0x473b93)});_0xb9a8e3['setSelection'](_0x46c69e);const _0x4075af=(_0x370155,_0x40f551)=>{_0x40f551['resultRange']&&_0xb9a8e3['setSelection'](_0x40f551['resultRange']);};_0x48e3de['once']('contentInsertion',_0x4075af,{'priority':'lowest'}),_0x3f6da3['document']['fire']('paste',_0x1ff499),_0x48e3de['off']('contentInsertion',_0x4075af);}['_getDefaultInsertBelowPosition'](_0x40011f){const {model:_0x4b45b4}=this['editor'],_0x5e1d5b=Array['from'](_0x40011f['getSelectedBlocks']());return _0x5e1d5b['length']?_0x4b45b4['createPositionAfter'](_0x5e1d5b['pop']()):_0x40011f['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x5bfd3d,_0x3a913a){const {model:_0x2bca9b,plugins:_0x56adf5}=this['editor'];if(_0x56adf5['has']('TableUtils')){const _0x5c34d7=_0x56adf5['get']('TableUtils')['getSelectedTableCells'](_0x3a913a);if(_0x5c34d7['length']){const _0x576c36=this['_getTableRowCountFromContent'](_0x5bfd3d),_0x1087fe=this['_createEmptyTableRows'](_0x5c34d7,_0x576c36);return _0x2bca9b['createPositionAt'](_0x1087fe,0x0);}}return null;}['_getTableRowCountFromContent'](_0xdf4106){const _0x40db8b=this['editor']['plugins']['get']('TableUtils'),_0x396570=this['editor']['data']['parse'](_0xdf4106,'$documentFragment'),_0x42c74c=Array['from'](_0x396570['getChildren']())['filter'](_0x5e8300=>_0x5e8300['is']('element','table'));let _0x457baf=0x0;return _0x42c74c['forEach'](_0x5f2edb=>{_0x457baf+=_0x40db8b['getRows'](_0x5f2edb);}),_0x457baf;}['_createEmptyTableRows'](_0x1e029f,_0x515f36){const _0x29d61b=this['editor']['plugins']['get']('TableUtils'),_0x21571f=_0x29d61b['getRowIndexes'](_0x1e029f),_0x3a5d6a=_0x29d61b['getColumnIndexes'](_0x1e029f),_0x2dcfbf=_0x21571f['last']+0x1,_0x2daf73=_0x3a5d6a['first'],_0x22c5b3=_0x1e029f[0x0]['findAncestor']('table');for(let _0x89ca6b=0x0;_0x89ca6b<_0x515f36;_0x89ca6b++)_0x29d61b['insertRows'](_0x22c5b3,{'at':_0x2dcfbf});return _0x22c5b3['getChild'](_0x2dcfbf)['getChild'](_0x2daf73);}['_resetContentOfSelectedTableCells'](_0xd83bd,_0x3fbb22){const {plugins:_0x314a2c}=this['editor'],{model:_0x4c3b1e}=_0xd83bd;_0x314a2c['has']('TableUtils')&&_0x314a2c['get']('TableUtils')['getSelectedTableCells'](_0x3fbb22)['length']&&_0x4c3b1e['deleteContent'](_0x3fbb22);}},vi=class extends _0x3fb090{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(_0x1678ae){super(_0x1678ae),this['name']='AIRequestError';}};function Ni(_0x12d717,_0x8ce40,_0x1b3e01){const t=_0x12d717['t'];switch(_0x8ce40){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',_0x1b3e01);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1b3e01);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'},_0x1b3e01);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 _0x8ce40;}}var yi=class extends _0x492f00{['_commandDefinitions'];constructor(_0x4a508f,_0x3de0c2){super(_0x4a508f),this['_commandDefinitions']=_0x3de0c2,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3eab26,_0x75f7e4,_0xd4d407)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0xd4d407));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x43c36a,_0x57339f,_0x86f6d5)=>{this['enabledCommandsIds']=_0x86f6d5?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x548887=this['editor']['model'];this['_hasContext']=function(_0x3b6a91){const _0x5607ed=_0x3b6a91['document']['selection'];return _0x5607ed['isCollapsed']?0x0!==[..._0x5607ed['getSelectedBlocks']()]['length']&&![..._0x5607ed['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x3b6a91['hasContent'](_0x5607ed['getFirstRange']());}(_0x548887);const _0x13870b=_0x548887['document']['selection'],_0x4b6c9a=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2115ba of _0x13870b['getRanges']())for(const _0xad79bf of _0x2115ba['getItems']())if(_0xad79bf['is']('element')&&_0x4b6c9a['includes'](_0xad79bf['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x28dd5e='',_0x35052e='',_0xe5da74='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x28dd5e,_0x35052e,_0xe5da74);}};function xi(_0x438445,_0x4e178a){const _0x333d64=new Set();for(const _0x3a825c of _0x438445['values']())(_0x4e178a||!0x1===_0x3a825c['requiresContent'])&&_0x333d64['add'](_0x3a825c['id']);return Array['from'](_0x333d64);}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(_0x20ae87,_0x6c78da,_0x4e1eb8){super(),this['editor']=_0x20ae87,this['textAdapter']=_0x6c78da,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x4e1eb8,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x10ed4c,_0x1b7239,_0x3e2507)=>{this['view']['value']=this['_sanitizeHTML'](_0x3e2507);}),this['listenTo'](this['view'],'submitPrompt',(_0x236e3d,_0x3f9664)=>{const _0x93d547=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x3f9664,_0x93d547,'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:_0x235764,query:_0xe38b64,htmlContent:_0x4e6c9d,label:_0x483a95,mainActionLabel:_0x2a2802}){this['view']['prompt']=_0x483a95,this['view']['mainAction']=_0x2a2802,this['initialContext']=_0x4e6c9d,_0xe38b64&&(this['view']['isRendered']?this['_handleQuery'](_0xe38b64,_0x4e6c9d,_0x235764,_0x483a95):this['view']['once']('render',()=>{this['_handleQuery'](_0xe38b64,_0x4e6c9d,_0x235764,_0x483a95);}));}['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'](_0x43578f,_0x16d8d5,_0x15745f,_0x26de2b){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x16d8d5,this['previousQuery']=_0x43578f,this['previousLabel']=_0x26de2b||_0x43578f,this['previousActionId']=_0x15745f,new Promise(_0x3c8b6a=>{this['textAdapter']['makeRequest']({'query':_0x43578f,'context':_0x16d8d5,'onData':_0x5c8e2e=>{this['currentResponse']=_0x5c8e2e,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x15745f})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1dee20=>{_0x1dee20 instanceof ki?this['view']['handleError'](_0x1dee20['message']):this['view']['handleError'](),_0x3c8b6a();})['finally'](()=>{this['stopProcessing'](),_0x3c8b6a();});});}['_parseAndNormalizeContent'](_0x3fad06,_0x4ee85f=!0x1){const _0x390e64=Li['exec'](_0x3fad06);_0x3fad06=_0x390e64?_0x3fad06['substring'](_0x390e64[0x1]['length']):_0x3fad06['length']<0x64&&!_0x4ee85f?'':this['_stripMarkdownSyntax'](_0x3fad06);const _0x1a9779=this['_domParser']['parseFromString'](_0x3fad06,'text/html');if(_0x390e64){const _0xac78f3=Array['from'](_0x1a9779['body']['childNodes']);_0xac78f3['reverse']();for(const _0x12bacd of _0xac78f3){if(_0x12bacd['nodeType']==Node['ELEMENT_NODE'])break;_0x12bacd['remove']();}}const _0x3d1fc1=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x1a9779['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x3d1fc1);const _0x11c3b3=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x2697a6=this['editor']['data']['toModel'](_0x3d1fc1);return _0x11c3b3||_0x2697a6['markers']['clear'](),this['editor']['data']['stringify'](_0x2697a6);}['_normalizeResponseHeadings'](_0x378253){const _0xb4dc89=new _0x426413(this['editor']['editing']['view']['document']),_0x8167bc=new _0x17cfd1({'name':/^h[1-5]$/}),_0x59002a=[];let _0x307d5c=!0x1;for(const _0x1da8aa of _0x378253)_0x1da8aa['is']('element')&&_0x8167bc['match'](_0x1da8aa)&&(_0x59002a['push'](_0x1da8aa),'h1'==_0x1da8aa['name']&&(_0x307d5c=!0x0));if(_0x307d5c){for(const _0x3adcad of _0x59002a)_0xb4dc89['rename']('h'+(parseInt(_0x3adcad['name'][0x1])+0x1),_0x3adcad);}}['_isH1TagSupportEnabled'](){const {data:_0x1c2f31,editing:_0x4ef9c7}=this['editor'],_0x18f729=_0x1c2f31['htmlProcessor']['toView']('<h1></h1>'),_0x107d6c=_0x1c2f31['toView'](_0x1c2f31['toModel'](_0x18f729));return!!_0x4ef9c7['view']['domConverter']['viewToDom'](_0x107d6c)['querySelector']('h1');}['_sanitizeHTML'](_0x255b45){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x255b45),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x22f534){const _0x4e2061=_0x22f534['trim']();return _0x4e2061['startsWith']('```html')?_0x4e2061['endsWith']('```')?_0x4e2061['substring'](0x7,_0x4e2061['length']-0x3):_0x4e2061['substring'](0x7):_0x22f534;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x411218{constructor(_0x3c21ef){super(_0x3c21ef),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x481a30=>Ni(_0x3c21ef,'AI_'+_0x481a30['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x3c21ef,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x3c21ef,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x3c21ef,'Stop'));const _0x1d2a84=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x1d2a84['if']('isVisible','ck-hidden',_0x3c232e=>!_0x3c232e)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x211189,_0x2b66e0){const _0x5055e4=new Ht(this['locale']);return _0x5055e4['set']({'label':_0x211189,'class':_0x2b66e0||'','isVisible':!0x0,'withText':!0x0}),_0x5055e4;}},Vi=class extends _0x9561fa{['contentFieldView'];['copyButtonView'];constructor(_0x4decf3,_0x1145bc=''){super(_0x4decf3),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3d1b9c=this['bindTemplate'];this['contentFieldView']=new Ui(_0x4decf3,_0x1145bc),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3d1b9c['if']('isVisible','ck-hidden',_0x3267b2=>!_0x3267b2)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3d1b9c['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 _0x459afa=!0x1;this['on']('change:value',(_0x930ce6,_0x150770,_0x41fdc4)=>{const _0x17521d=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x41fdc4),this['isProcessing']&&_0x17521d&&!_0x459afa&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5e7cfb,_0x57373c,_0x240cda)=>{_0x459afa=!0x1,_0x240cda?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x459afa=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x459afa=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x121b7e=this['locale'],_0x3e14a7=new Ht(this['locale']),_0x1b7522='ck-ai-form__copy-button';return _0x3e14a7['set']({'label':Ni(_0x121b7e,'Copy'),'icon':_0x3855bb,'class':_0x1b7522,'tooltip':!0x0}),_0x3e14a7['bind']('isVisible')['to'](this,'value',_0x41e585=>!!_0x41e585),_0x3e14a7['bind']('isEnabled')['to'](this,'isProcessing',_0x3c8b6c=>!_0x3c8b6c),_0x3e14a7['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x3e14a7['icon']=_0x3afcd8,_0x3e14a7['class']=_0x1b7522+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x3e14a7['icon']=_0x3855bb,_0x3e14a7['class']=_0x1b7522;},0x3e8);}),_0x3e14a7;}['_copyHTMLToClipboard'](_0x3a494e){const {window:_0x6481a7,document:_0x462d7b}=Tt;if(_0x6481a7['ClipboardItem']){const {Blob:_0x5d1cca,ClipboardItem:_0x55192c}=_0x6481a7,_0x59d280=[new _0x55192c({'text/html':new _0x5d1cca([_0x3a494e['innerHTML']],{'type':'text/html'}),'text/plain':new _0x5d1cca([_0x3a494e['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x59d280);}else{const _0x39a3a3=_0x462d7b['createElement']('div');_0x39a3a3['style']['position']='absolute',_0x39a3a3['style']['left']='-9999px',_0x39a3a3['innerHTML']='<span>[</span>'+_0x3a494e['innerHTML']+'<span>]</span>',_0x462d7b['body']['appendChild'](_0x39a3a3);const _0x32fc1c=_0x462d7b['createRange']();_0x32fc1c['setStartAfter'](_0x39a3a3['firstElementChild']),_0x32fc1c['setEndBefore'](_0x39a3a3['lastElementChild']);const _0x223b0e=_0x6481a7['getSelection']();_0x223b0e['removeAllRanges'](),_0x223b0e['addRange'](_0x32fc1c),_0x462d7b['execCommand']('copy'),_0x39a3a3['remove']();}}},Ui=class extends _0x9561fa{constructor(_0x29f570,_0x43bc44=''){super(_0x29f570),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x43bc44,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x2ba1ef){this['element']['innerHTML']=_0x2ba1ef;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x1961c8=new _0x9561fa(),_0x186163=this['locale'],_0x5dcc35=new _0x520d48();return _0x5dcc35['isVisible']=!0x0,_0x1961c8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x5dcc35,{'text':Ni(_0x186163,'AI\x20is\x20writing...')}]}),_0x1961c8['render'](),_0x1961c8;}},Bi=class extends _0x9561fa{constructor(_0x250240,_0x142b40=''){super(_0x250240);const _0x19201b=new Yt(),_0x2cd0b0=this['bindTemplate'];this['set']('text',_0x142b40),_0x19201b['content']=_0x2e6b11,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x19201b,{'text':_0x2cd0b0['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x238084,_0x129451){super(_0x238084,_0x129451),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',(_0x20abec,_0x1eb89f)=>{_0x20abec['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1eb89f());});}['_createSubmitButton'](){const _0x4d5913=new Ht(this['locale']),_0xc7f3c0=this['locale'];return _0x4d5913['set']({'icon':st,'label':Ni(_0xc7f3c0,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x4d5913['on']('execute',()=>{this['submit']();}),_0x4d5913['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x1d39ee,_0x563faa)=>!_0x1d39ee&&_0x563faa),_0x4d5913;}['_createShowHistoryButton'](){const _0x2c1120=new Ht(this['locale']),_0x3d2587=this['resultsView'],_0x4bc4a2=this['locale'];_0x2c1120['set']({'label':Ni(_0x4bc4a2,'History'),'withText':!0x1,'icon':_0x389f69,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x2c1120['bind']('isOn')['to'](_0x3d2587,'isVisible'),_0x2c1120['bind']('isEnabled')['to'](this,'isEnabled'),_0x2c1120['on']('execute',()=>{_0x3d2587['isVisible']=!_0x3d2587['isVisible'],_0x3d2587['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x57947d=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x203ff3=new At(this['queryView']['fieldView']['element']),_0x2ea700=_0x203ff3['width'],_0x741fb9='rtl'===_0x4bc4a2['uiLanguageDirection']?'left':'right';_0x203ff3['excludeScrollbarsAndBorders'](),_0x2c1120['element']['style'][_0x741fb9]=_0x2ea700-_0x203ff3['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x57947d),this['on']('render',_0x57947d),_0x2c1120;}['submit'](){const _0x369033=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x369033);}['focus'](_0x5c7470){-0x1===_0x5c7470?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x3519ad){super(_0x3519ad),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x3519ad,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x5579e0=0x0;for(const _0x39dd31 of this['items'])_0x5579e0+=_0x39dd31['items']['length'];return{'resultsCount':_0x5579e0,'totalItemsCount':_0x5579e0};}['_createClearHistoryButton'](){const _0x528396=this['locale'],_0xa849a0=new Ht(this['locale']);return _0xa849a0['set']({'label':'('+Ni(_0x528396,'Clear')+')','withText':!0x0}),_0xa849a0['on']('execute',()=>this['fire']('clearHistory')),_0xa849a0;}},Ki=class extends zt{constructor(_0x28ba44){super();const _0x16b850=new Dt(),_0x439eb9=new Ht(this['locale'],_0x16b850);this['children']['add'](_0x439eb9),_0x439eb9['set']({'label':_0x28ba44['prompt'],'withText':!0x0}),_0x439eb9['on']('execute',()=>{this['fire']('execute',{'value':_0x50e237(_0x28ba44['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x506074,_0x50d3eb)=>{const _0x31bcce=$i(_0x50d3eb['prompt']);for(const _0x3f6776 of this)if(_0x3f6776!=_0x50d3eb&&$i(_0x3f6776['prompt'])===_0x31bcce){this['remove'](_0x3f6776);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2366ea=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x2366ea));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x518d99=>_0x518d99)));}};function $i(_0x222c01){return _0x222c01['toLowerCase']()['trim']();}var qi=class extends _0x9561fa{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x376b9b,_0x37e9bf,_0x514470=''){super(_0x376b9b),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(_0x376b9b),this['contentArea']=new Vi(_0x376b9b,_0x514470),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 _0x598b75=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x37e9bf],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x598b75['if']('isError','ck-hidden',_0x56b954=>!_0x56b954)]},'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'](_0x589418=0x1){-0x1===_0x589418?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 _0x54c0c3=this['locale'],_0x2cfb13=new Gi(_0x54c0c3,{'queryView':{'label':Ni(_0x54c0c3,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0xc793c6,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x54c0c3,'Empty\x20history'),'secondary':Ni(_0x54c0c3,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x2cfb13['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2afbc3,_0x12ce14)=>_0x2afbc3&&!_0x12ce14),this['listenTo'](_0x2cfb13,'submit',(_0x245f58,_0x58b0fb)=>{this['prompt']=_0x58b0fb;const _0x208c9e=_0x42dd97(_0x58b0fb);this['fire']('submitPrompt',_0x208c9e),_0x58b0fb['trim']()&&this['_promptHistory']['add']({'prompt':_0x208c9e},0x0);},{'priority':'high'}),_0x2cfb13;}['_createHistoryView'](){const _0x28d900=new Fi(this['locale']);return _0x28d900['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x28d900['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x28d900;}['_createToolbar'](){const _0x29fd54=new Mi(this['locale']);return _0x29fd54['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x56f6f3,_0x30254e,_0x50ee58)=>_0x56f6f3&&!_0x30254e&&!!_0x50ee58),_0x29fd54['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x29fd54['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x254a9d,_0x1eb6c1,_0x4af50f)=>_0x254a9d&&!_0x1eb6c1&&!!_0x4af50f),_0x29fd54['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x29fd54['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x29cf1b,_0x493b2d)=>_0x29cf1b&&!_0x493b2d),_0x29fd54['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x29fd54['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x29fd54['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x29fd54;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x347b41=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x347b41,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4cd0a3){const _0x55afd3=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4cd0a3||Ni(_0x55afd3,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x3fb090{['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[_0x15bbc0,Oi,vi,Mt];}constructor(_0x39e0af){super(_0x39e0af),_0x39e0af['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x39e0af['config']['define']('ai.assistant.contentAreaCssClass',''),_0x39e0af['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x39e0af['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x21e8da}=this;this['_aiAdapter']=_0x21e8da['plugins']['get'](vi),this['_dialog']=_0x21e8da['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x399cf8=new yi(_0x21e8da,Array['from'](this['_commandDefinitions']['values']()));_0x21e8da['commands']['add']('showAIAssistant',_0x399cf8),_0x21e8da['ui']['componentFactory']['add']('aiCommands',_0x2e91cc=>{const _0x15cbb6=_0x4acf15(_0x2e91cc);return _0x15cbb6['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x15cbb6['buttonView']['set']({'label':Ni(_0x2e91cc,'AI\x20Commands'),'icon':_0x57caaf,'tooltip':!0x0}),_0x15cbb6['on']('execute',_0x460263=>this['_onExecute'](_0x460263['source']['id'])),_0x4333d3(_0x15cbb6,_0x21e8da['ui']['view']['body'],function(_0x57397a){const _0xc23415=ji(_0x57397a,bi(_0x57397a['config']['get']('ai.assistant.commands'),_0x57397a['locale']))['filter'](_0x58f13b=>_0x58f13b['commands']['length']);return 0x1===_0xc23415['length']?ji(_0x57397a,_0xc23415[0x0]['commands'])['map'](_0x180ed0=>({'id':_0x180ed0['id'],'label':_0x180ed0['label']})):_0xc23415['map'](_0x46d0bc=>{const {groupId:_0x32bf02,groupLabel:_0x49067b,commands:_0xedbfc0}=_0x46d0bc,_0x4b4c3a=ji(_0x57397a,_0xedbfc0)['map'](_0x30ac5c=>({'id':_0x30ac5c['id'],'label':_0x30ac5c['label']}));return{'id':_0x32bf02,'menu':_0x49067b||_0x32bf02,'children':_0x4b4c3a};});}(_0x21e8da),{'ariaLabel':Ni(_0x2e91cc,'AI\x20Commands')}),_0x15cbb6['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x399cf8['on']('change:enabledCommandsIds',_0x1155e3),_0x15cbb6['menuView']['once']('render',_0x1155e3),_0x15cbb6;function _0x1155e3(){_0x15cbb6['isEnabled']=_0x399cf8['enabledCommandsIds']['length']>0x0;for(const _0x21a31e of _0x15cbb6['menuView']['buttons'])_0x21a31e['isEnabled']=_0x399cf8['enabledCommandsIds']['includes'](_0x21a31e['id']);}}),_0x21e8da['ui']['componentFactory']['add']('menuBar:aiCommands',_0x9d1974=>{const _0x4fee28=new _0x512173(_0x9d1974);_0x4fee28['buttonView']['set']({'label':Ni(_0x9d1974,'AI\x20Commands'),'icon':_0x57caaf}),_0x4fee28['bind']('isEnabled')['to'](_0x399cf8,'enabledCommandsIds',_0x1d9d38=>_0x1d9d38['length']>0x0);const _0x21e2eb=bi(_0x21e8da['config']['get']('ai.assistant.commands'),_0x9d1974);return this['_populateMenuBarMenu'](_0x399cf8,_0x4fee28,_0x21e2eb,_0xc16b9c=>this['_onExecute'](_0xc16b9c)),_0x4fee28;}),_0x21e8da['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x4ba9e2=this['_createAIAssistantUIButton'](Ht);return _0x4ba9e2['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x4ba9e2;}),_0x21e8da['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x5db579=this['_createAIAssistantUIButton'](Jt);return _0x5db579['set']({'role':'menuitemcheckbox'}),_0x5db579;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x4c5e01=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1e231f;for(const _0x4c6a66 in _0x4c5e01){const _0x11372a=_0x4c6a66,_0x1acb07=_0x4c5e01[_0x11372a];if('aiLicenseKeyValid'==_0x1acb07||'aiLicenseKeyInvalid'==_0x1acb07||'aiLicenseKeyExpired'==_0x1acb07||'aiLicenseKeyDomainLimit'==_0x1acb07||'aiLicenseKeyNotAllowed'==_0x1acb07||'aiLicenseKeyEvaluationLimit'==_0x1acb07||'aiLicenseKeyUsageLimit'==_0x1acb07){delete _0x4c5e01[_0x11372a],_0x1e231f=_0x1acb07,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1e231f&&_0x4c5e01['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1e231f&&_0x4c5e01['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1e231f&&_0x4c5e01['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1e231f&&_0x4c5e01['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1e231f&&_0x4c5e01['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1e231f&&_0x4c5e01['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x5a8f4c='',_0x28ead3='',_0x9b658='custom'){const _0x45b7e6=this['editor'],_0x2b38d1=_0x45b7e6['editing']['view'],_0x4a2c0d=_0x45b7e6['plugins']['get'](Oi),_0x38eae4=_0x45b7e6['plugins']['get'](_0x15bbc0);_0x4a2c0d['showFakeVisualSelection']();const _0x2b7642=new Qi(),_0xf5f271=new ClipboardEvent('copy',{'clipboardData':_0x2b7642}),_0x4027e6=new _0x5f035e(_0x2b7642),_0x3d369e=new _0xd915d1(_0x2b38d1,_0xf5f271,{'dataTransfer':_0x4027e6});_0x38eae4['_forceMarkersCopy']('comment',()=>{_0x2b38d1['document']['fire']('copy',_0x3d369e);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0x45b7e6,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x50d078=_0x4027e6['getData']('text/html');const _0x49c359=_0x45b7e6['model']['document']['selection'],_0x257196=Array['from'](_0x49c359['getRanges']());0x1===_0x257196['length']&&_0x257196[0x0]['isFlat']&&!_0x49c359['getSelectedElement']()&&''!==_0x50d078['replace'](/&nbsp;/g,'')['trim']()&&(_0x50d078='<p>'+_0x50d078+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x9b658,'query':_0x5a8f4c,'htmlContent':_0x50d078,'label':_0x28ead3,'mainActionLabel':Hi[_0x45b7e6['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x1d2de2,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x4a2c0d['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x477f9c=new Map(),_0x197ef6=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x3c12e6 of _0x197ef6)for(const _0x23df8a of _0x3c12e6['commands'])_0x477f9c['set'](_0x23df8a['id'],{..._0x23df8a,'groupId':_0x3c12e6['groupId'],'groupLabel':_0x3c12e6['groupLabel']||_0x3c12e6['groupId']});return _0x477f9c;}['_createAIAssistantUIButton'](_0x3dba74){const _0x37dc2a=this['editor'],_0x332c66=_0x37dc2a['commands']['get']('showAIAssistant'),_0x45e871=new _0x3dba74(_0x37dc2a['locale']);return _0x45e871['set']({'label':Ni(_0x37dc2a['locale'],'AI\x20Assistant'),'icon':_0x1d2de2,'isToggleable':!0x0}),_0x45e871['bind']('isEnabled')['to'](_0x332c66),_0x45e871['bind']('isOn')['to'](this['_dialog'],'id',_0x56cb8a=>'aiAssistant'===_0x56cb8a),this['listenTo'](_0x45e871,'execute',()=>{_0x45e871['isOn']?this['hideUI']():_0x332c66['execute']();}),_0x45e871;}['_initView'](){const _0x2b661d=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',()=>{_0x2b661d['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x2b661d['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5c1e3e,ui:{ariaLiveAnnouncer:_0x41244f}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x29b21f,_0x5e361c,_0x3fbc00)=>{const _0x46ab88=this['_aiAssistantController']['currentContext'];_0x3fbc00?_0x41244f['announce'](Ni(_0x5c1e3e,'AI\x20is\x20writing')):_0x46ab88&&_0x41244f['announce'](Ni(_0x5c1e3e,'Generated\x20content:\x20%0',_0x46ab88),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x56a7a7,_0x1a4190,_0x1d5c8e)=>{if(_0x1d5c8e){const _0x262957=this['_formView']['errorView']['text'];_0x41244f['announce'](Ni(_0x5c1e3e,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x262957));}});}['_onExecute'](_0x3a13df){const _0x2e2d76=this['_commandDefinitions']['get'](_0x3a13df),_0x561686=this['editor'],_0x335850=_0x561686['model']['document']['selection'],_0x58a939=_0x561686['commands']['get']('showAIAssistant'),_0x2e6b5d=_0x561686['plugins']['get'](Oi),_0x132d41=''+('_ungrouppedCommands'!==_0x2e2d76['groupId']?_0x2e2d76['groupLabel']+':\x20':'')+_0x2e2d76['label'];if(!0x1!==_0x2e2d76['requiresContent']&&_0x335850['isCollapsed']){const _0x1dba39=mt(_0x335850['getSelectedBlocks']())||_0x561686['model']['schema']['getLimitElement'](_0x335850);_0x561686['model']['change'](_0x305c02=>{_0x305c02['setSelection'](_0x1dba39,'in');});}_0x2e6b5d['showFakeVisualSelection'](),_0x58a939['execute'](_0x2e2d76['prompt'],_0x132d41,'command:'+_0x3a13df);}['_populateMenuBarMenu'](_0x25509b,_0xc4ef0e,_0x469c5c,_0xc05a57){const _0x33f586=this['editor'],_0x51f908=_0x33f586['locale'],_0x319fff=new te(_0x51f908),_0x13ec43=ji(_0x33f586,_0x469c5c)['filter'](_0x371d88=>_0x371d88['commands']['length']);0x1===_0x13ec43['length']?this['_getMenuBarGroupButtons']({'command':_0x25509b,'commands':_0x13ec43[0x0]['commands'],'parentMenuView':_0xc4ef0e,'onExecute':_0xc05a57})['forEach'](_0x4b93ff=>_0x319fff['items']['add'](_0x4b93ff)):_0x13ec43['forEach'](({groupId:_0x14b819,groupLabel:_0x3cffa5,commands:_0x414413})=>{const _0x29b425=new Zt(_0x51f908,_0xc4ef0e),_0x5e7042=new _0x512173(_0x51f908),_0x95433=new te(_0x51f908),_0x3d3d65=this['_getMenuBarGroupButtons']({'command':_0x25509b,'commands':_0x414413,'parentMenuView':_0x5e7042,'onExecute':_0xc05a57});_0x5e7042['buttonView']['set']({'label':_0x3cffa5||_0x14b819}),_0x5e7042['delegate']('execute')['to'](_0xc4ef0e),_0x95433['items']['addMany'](_0x3d3d65),_0x5e7042['panelView']['children']['add'](_0x95433),_0x29b425['children']['add'](_0x5e7042),_0x319fff['items']['add'](_0x29b425);}),_0xc4ef0e['panelView']['children']['add'](_0x319fff);}['_getMenuBarGroupButtons']({command:_0x43e37d,commands:_0x3072db,parentMenuView:_0x1b7749,onExecute:_0x3e43e2}){const _0x4a6e32=this['editor'],_0x513996=_0x4a6e32['locale'];return ji(_0x4a6e32,_0x3072db)['map'](_0x407741=>{const _0x5062ef=new Zt(_0x513996,_0x1b7749),_0x24e64a=new Jt(_0x513996);return _0x24e64a['set']({'label':_0x407741['label']}),_0x24e64a['delegate']('execute')['to'](_0x1b7749),_0x24e64a['on']('execute',()=>_0x3e43e2(_0x407741['id'])),_0x24e64a['bind']('isEnabled')['to'](_0x43e37d,'enabledCommandsIds',_0x4d4a26=>_0x4d4a26['includes'](_0x407741['id'])),_0x5062ef['children']['add'](_0x24e64a),_0x5062ef;});}};function zi(_0x110e96,_0x484a33){return void 0x0!==_0x110e96['order']&&void 0x0===_0x484a33['order']?0x1:void 0x0===_0x110e96['order']&&void 0x0!==_0x484a33['order']?-0x1:void 0x0!==_0x110e96['order']&&void 0x0!==_0x484a33['order']?_0x110e96['order']-_0x484a33['order']:0x0;}function ji(_0x3a8f3b,_0x5c4f33){_0x5c4f33['sort'](zi);const _0x5407fb={},_0x4a8caa=[];for(const _0x55cd47 of _0x5c4f33)if(void 0x0!==_0x55cd47['order']){if(_0x55cd47['order']in _0x5407fb)throw new ht('ai-commands-config-order-collision',_0x3a8f3b,{'conflictingDefinitions':[_0x55cd47,_0x5407fb[_0x55cd47['order']]]});_0x5407fb[_0x55cd47['order']]=_0x55cd47,_0x4a8caa['splice'](_0x55cd47['order'],0x0,_0x55cd47);}else _0x4a8caa['push'](_0x55cd47);return _0x4a8caa;}var Ji=class extends _0x3fb090{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x532acd){super(_0x532acd);const _0x332ba1=_0x532acd['config'],_0x4d281a=_0x532acd['locale'];_0x332ba1['define']('ai.assistant.preserveComments',!0x0),_0x332ba1['define']('ai.assistant.commands',Zi(_0x4d281a)),_0x332ba1['define']('ai.assistant.extraCommandGroups',[]),_0x332ba1['define']('ai.assistant.removeCommands',[]);let _0x3c917a=bi(_0x332ba1['get']('ai.assistant.commands'),_0x4d281a);const _0x3bfb7f=_0x332ba1['get']('ai.assistant.extraCommandGroups'),_0x131b2f=_0x332ba1['get']('ai.assistant.removeCommands');_0x3bfb7f['forEach'](_0xf7eeb0=>{const _0x2e53da=_0x3c917a['find'](_0x450076=>_0x450076['groupId']===_0xf7eeb0['groupId']);_0x2e53da?_0x2e53da['commands']=_0x2e53da['commands']['concat'](_0xf7eeb0['commands']):_0x3c917a['push'](_0xf7eeb0);}),_0x3c917a=_0x3c917a['filter'](_0x72c721=>!_0x131b2f['includes'](_0x72c721['groupId'])),_0x3c917a['forEach'](_0x1f2303=>{_0x1f2303['commands']=_0x1f2303['commands']['filter'](_0x39cbe3=>!_0x131b2f['includes'](_0x39cbe3['id']));}),_0x332ba1['set']('ai.assistant.commands',_0x3c917a);}};function Zi(_0x207e18){return[{'groupId':'editOrReview','groupLabel':Ni(_0x207e18,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0x207e18,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0x207e18,'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(_0x207e18,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0x207e18,'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(_0x207e18,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0x207e18,'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(_0x207e18,'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(_0x207e18,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0x207e18,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0x207e18,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0x207e18,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0x207e18,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0x207e18,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0x207e18,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0x207e18,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0x207e18,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0x207e18,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0x207e18,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0x207e18,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0x207e18,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0x207e18,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0x207e18,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0x207e18,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0x207e18,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0x207e18,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0x207e18,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0x207e18,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x3fb090{['abortController'];static get['requires'](){return[vi];}constructor(_0x66863f){super(_0x66863f),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'](_0x10929d){return this['sendRequest'](_0x10929d)['catch'](_0x4dd774=>{if(_0x4dd774 instanceof ki)return Promise['reject'](_0x4dd774);if('AbortError'==_0x4dd774['name'])return Promise['resolve']();throw console['error'](_0x4dd774),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x39a46c,_0x3326ba){const _0x25dad1=this['editor']['locale'],_0x3627de={'Content-Type':'application/json'};if('object'==typeof _0x39a46c)Object['assign'](_0x3627de,_0x39a46c);else{if(_0x39a46c)try{const _0x3105ad=await _0x39a46c(_0x3326ba);Object['assign'](_0x3627de,_0x3105ad);}catch{return Promise['reject'](new ki(Ni(_0x25dad1,'AI_ERROR_GET_HEADERS')));}}return _0x3627de;}async['_prepareRequestParameters'](_0x15b617,_0x302d01){const _0x2e4d28=this['editor']['locale'];if('object'==typeof _0x15b617)return _0x15b617;try{return await _0x15b617(_0x302d01);}catch{return Promise['reject'](new ki(Ni(_0x2e4d28,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x7f5628){super(_0x7f5628),_0x7f5628['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x7f5628['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x7f5628['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x7f5628['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x7f5628['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x7f5628['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x5576c6,context:_0x20ba9e,onData:_0x4bd950,actionId:_0xc66178}){const _0x1e470e=this['editor']['locale'],_0x467bdc=await this['prepareMessages'](_0x5576c6,_0x20ba9e,_0xc66178),_0x41b144=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xc66178),_0x1beb68=await this['_prepareRequestParameters'](this['_requestParameters'],_0xc66178),_0x1b22c5={'messages':_0x467bdc,..._0x1beb68},_0x4c1070={'method':'POST','headers':_0x41b144,'body':JSON['stringify'](_0x1b22c5),'signal':this['abortController']['signal']},_0x527395=await fetch(this['_apiUrl'],_0x4c1070);if(_0x527395['ok'])return _0x1beb68['stream']?await this['_readStreamableResponse'](_0x527395,_0x4bd950):await this['_readStaticResponse'](_0x527395,_0x4bd950),Promise['resolve']();{const _0x33f0a5=await _0x527395['text']();return _0x33f0a5['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x1e470e,'AI_ERROR_CONTEXT_LENGTH'))):_0x33f0a5['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x1e470e,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x33f0a5));}}async['prepareMessages'](_0x483257,_0x2ce43c,_0x7dd066){let _0xf7dbb9,_0x462e7e;return _0x2ce43c?(_0xf7dbb9='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.',_0x462e7e='Instruction:\x0a'+_0x483257+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2ce43c):(_0xf7dbb9='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.',_0x462e7e=_0x483257),[{'role':'system','content':_0xf7dbb9},{'role':'user','content':_0x462e7e}];}async['_readStreamableResponse'](_0xe3c356,_0x2956c6){const _0x1ee278=_0xe3c356['body']['getReader'](),_0x531c02=new TextDecoder();let _0x1668b3='',_0x5f2380='',_0x221652='',_0x3bc702=!0x1;for(;!_0x3bc702;){const {done:_0x2f75aa,value:_0x2499aa}=await _0x1ee278['read'](),_0x1b2b3c=_0x1668b3+_0x531c02['decode'](_0x2499aa);let _0x4c283a='';_0x3bc702=_0x2f75aa;try{_0x4c283a=this['_cleanUpData'](_0x1b2b3c),_0x1668b3='';}catch{_0x1668b3=_0x1b2b3c;continue;}_0x5f2380+=_0x4c283a,!_0x3bc702&&this['_isBufferIncomplete'](_0x5f2380)||_0x5f2380&&(_0x221652+=_0x5f2380,_0x5f2380='',_0x2956c6(_0x221652));}return Promise['resolve']();}async['_readStaticResponse'](_0x3a20c4,_0x51e269){return _0x51e269((await _0x3a20c4['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x136fc9){const _0x586f0a=_0x136fc9['split']('<')['length']!==_0x136fc9['split']('>')['length'],_0x1af94b=_0x136fc9['length']<0x1e;return _0x586f0a&&_0x1af94b;}['_cleanUpData'](_0x330dea){return _0x330dea['split'](/\n(?![^{]*\})/g)['map'](_0xa14cf2=>_0xa14cf2['replace']('data:\x20',''))['filter'](_0x29936f=>_0x29936f&&_0x29936f['length']>0x0&&'[DONE]'!==_0x29936f)['map'](_0x4fe23f=>{const {choices:_0x2d7b20}=JSON['parse'](_0x4fe23f);if(_0x2d7b20[0x0]?.['delta']?.['content'])return _0x2d7b20[0x0]['delta']['content'];})['filter'](_0x5e177f=>_0x5e177f)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x483350){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x4ebdec,_0x100e7e={}){super(_0x4ebdec),this['isToggleable']=!0x0,this['set']('side',_0x100e7e['side']||'top');const _0x199d57=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x100e7e['class']||[]),_0x199d57['to']('side',_0x644a7a=>'ck-tab-button_'+_0x644a7a),_0x199d57['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x9561fa{['children'];constructor(_0x4d32ab,_0x52743d={}){super(_0x4d32ab);const _0x59c9fe=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x52743d['class']||[]),_0x59c9fe['to']('class'),_0x59c9fe['if']('isVisible','ck-hidden',_0x29f224=>!_0x29f224)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x9561fa{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0xeaeb2,_0x100c72={}){super(_0xeaeb2),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x100c72['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x100c72['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x11d8c9,_0x69f6c6)=>_0x11d8c9&&!_0x69f6c6);const _0x505801=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x100c72['class']||[]),_0x505801['to']('side',_0x5151df=>'ck-tabs_'+_0x5151df),_0x505801['to']('class'),_0x505801['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x505801['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x505801['to']('side',_0x5ce594=>'ck-tabs__buttons-container_'+_0x5ce594)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x505801['to']('side',_0x14ef29=>'ck-tabs__panels-container_'+_0x14ef29)]},'children':this['panelViews']},...Ot(_0x100c72['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0xbb3c55){const _0x233d1e=this['_tabs']['get'](_0xbb3c55);return _0x233d1e||null;}['addTab'](_0x35f6c5){const _0x365678=this['_setupButton']({'id':_0x35f6c5['id'],'label':_0x35f6c5['buttonLabel'],'icon':_0x35f6c5['buttonIcon'],'order':_0x35f6c5['order']}),_0x248147=new ns(this['locale']);return _0x248147['render'](),_0x35f6c5['content']&&_0x248147['children']['add'](_0x35f6c5['content']),this['panelViews']['add'](_0x248147),this['_tabs']['set'](_0x35f6c5['id'],{'button':_0x365678,'panel':_0x248147,'order':void 0x0!==_0x35f6c5['order']?_0x35f6c5['order']:null}),this['fire']('addTab:'+_0x35f6c5['id'],{'id':_0x35f6c5['id'],'button':_0x365678,'panel':_0x248147}),null===this['activeTab']?this['activateTab'](_0x35f6c5['id']):this['_hidePanel'](_0x35f6c5['id']),{'button':_0x365678,'panel':_0x248147};}['activateTab'](_0x3477b2){if(null!==_0x3477b2&&!this['getTab'](_0x3477b2))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x3477b2});if(this['isCollapsed']=!0x1,this['activeTab']===_0x3477b2)return;const _0xf78717=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x3477b2,_0x3477b2&&this['_showPanel'](_0x3477b2),this['fire']('activateTab:'+_0x3477b2,{'newTab':_0x3477b2,'oldTab':_0xf78717});}['toggleTabPanel'](_0x5a03f9){this['activeTab']===_0x5a03f9?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x5a03f9);}['showTab'](_0x5958df){if(!this['getTab'](_0x5958df))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5958df});this['_showPanel'](_0x5958df),this['_showButton'](_0x5958df),this['fire']('show:'+_0x5958df,_0x5958df);}['hideTab'](_0x40cb86){if(!this['getTab'](_0x40cb86))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x40cb86});const _0x35da7a=this['activeTab'];this['_hidePanel'](_0x40cb86),this['_hideButton'](_0x40cb86);const _0x169c44=this['getTabIds']();_0x35da7a===_0x40cb86&&_0x169c44['length']>0x1&&this['activateTab'](_0x169c44['find'](_0x4bdadd=>_0x4bdadd!==_0x40cb86)),this['fire']('hide:'+_0x40cb86,_0x40cb86);}['_getPanel'](_0x512ecd){const _0x3121e4=this['_tabs']['get'](_0x512ecd);return _0x3121e4?_0x3121e4['panel']:null;}['_showPanel'](_0x3b24a1){null!==this['activeTab']&&this['activeTab']!==_0x3b24a1||this['_getPanel'](_0x3b24a1)['show']();}['_hidePanel'](_0x1d0c63){const _0x34f822=this['_getPanel'](_0x1d0c63);_0x34f822['isVisible']&&(this['activeTab']===_0x1d0c63&&(this['activeTab']=null),_0x34f822['hide']());}['_getButton'](_0xebd189){const _0x57c6ae=this['_tabs']['get'](_0xebd189);return _0x57c6ae?_0x57c6ae['button']:null;}['_showButton'](_0x41d96e){this['_getButton'](_0x41d96e)['show']();}['_hideButton'](_0x5ac020){this['_getButton'](_0x5ac020)['hide']();}['_setupButton'](_0x5674dc){const _0x1c3a7e=new ss(this['locale'],{'side':this['side']}),_0x3b5024=this['buttonViews'];if(_0x1c3a7e['set']({'label':_0x5674dc['label'],'icon':_0x5674dc['icon'],'tooltip':!0x0,'withText':!0x0}),_0x1c3a7e['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x2e4614,_0x198f5f)=>_0x2e4614===_0x5674dc['id']&&!_0x198f5f),_0x1c3a7e['bind']('side')['to'](this,'side'),_0x5674dc['order']){const _0x4fd79e=[...this['_tabs']]['reduce']((_0x37bc16,_0x265445)=>{const _0x21e365=_0x265445[0x0],{order:_0x19b4c2}=_0x265445[0x1];return!_0x19b4c2||_0x19b4c2>_0x5674dc['order']?_0x37bc16:_0x19b4c2>=_0x37bc16['order']?{'id':_0x21e365,'order':_0x19b4c2}:_0x37bc16;},{'id':'','order':0x0}),_0x513a07=_0x3b5024['getIndex'](this['_getButton'](_0x4fd79e['id']));_0x3b5024['add'](_0x1c3a7e,_0x513a07+0x1);}else _0x3b5024['add'](_0x1c3a7e);return _0x1c3a7e['on']('execute',()=>{this['toggleTabPanel'](_0x5674dc['id']);}),_0x1c3a7e;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x29c2a6,_0x3dbae1={}){super(_0x29c2a6,_0x3dbae1),this['set']('type',_0x3dbae1['type']||'sidebar'),this['set']('side',_0x3dbae1['side']||'right'),this['set']('isVisible',_0x3dbae1['visibleByDefault']??!0x0);const _0x2f8cf7=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x2f8cf7['if']('type','ck-ai-tabs__overlay',_0x594531=>'overlay'===_0x594531),_0x2f8cf7['if']('type','ck-ai-tabs__sidebar',_0x3f3b2f=>'sidebar'===_0x3f3b2f),_0x2f8cf7['if']('isVisible','ck-hidden',_0x1a5f70=>!_0x1a5f70)]}}),this['buttonViews']['on']('add',(_0x1d016a,_0x44dba3)=>{_0x44dba3['set']('withText',!0x1);});}},cs=class extends _0x7ceac6{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a6dd2){if(super(_0x3a6dd2),!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 _0x10ba68=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x10ba68['showResizeButton']&&(this['showResizeButton']=_0x10ba68['showResizeButton']),'sidebar'!==_0x10ba68['type']&&'overlay'!==_0x10ba68['type']||_0x10ba68['side']&&(this['side']=_0x10ba68['side']),'sidebar'===_0x10ba68['type']){if(this['container']=_0x10ba68['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x10ba68['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':_0x10ba68['visibleByDefault'],'collapsible':_0x10ba68['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 _0x3d3542&&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'](_0x3904d2){if(_0x3904d2&&this['type']!==_0x3904d2){if(!os['includes'](_0x3904d2))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x3904d2;}}['switchSide'](_0x3dd558){if(_0x3dd558&&this['side']!==_0x3dd558){if(!as['includes'](_0x3dd558))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x3dd558;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x7ceac6{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x4f40da];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2ea0d0){if(super(_0x2ea0d0),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 _0x14592b=this['context']['plugins']['get'](_0x4f40da);if(!_0x14592b['token'])throw new ht('ai-missing-token',this);this['_token']=_0x14592b['token'];}['startConversation'](_0x269ab5,_0x5cf61f){const _0x27c59e=this['_sendApiRequest']('/conversations','POST',{'id':_0x269ab5,'group':_0x5cf61f});return{'getConversation':async()=>(await _0x27c59e['request'])['json'](),'abortController':_0x27c59e['abortController']};}['queryAssistant']({message:_0x40e0d2,conversationId:_0x2991bd,parts:_0x5f543c,capabilities:_0x197ac6,model:_0x5ae0f6,attributes:_0x2c17a2}){const _0x20e632={'prompt':_0x40e0d2,'content':_0x5f543c,'model':_0x5ae0f6,..._0x197ac6&&{'capabilities':_0x197ac6},..._0x2c17a2&&{'attributes':_0x2c17a2}},_0x18574e=this['_sendApiRequest']('/conversations/'+_0x2991bd+'/messages','POST',_0x20e632,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2ed054=(await _0x18574e['request'])['body'];return this['_getStreamReader'](_0x2ed054);},'abortController':_0x18574e['abortController']};}['executeCustomAction']({content:_0x28febb,message:_0x12ff66,model:_0x92f795,outputFormat:_0x244692}){const _0x3ed824={'content':[{'type':'text','content':_0x28febb}],'prompt':_0x12ff66,'model':_0x92f795,'outputFormat':_0x244692},_0x3b6c74=this['_sendApiRequest']('/actions/custom/calls','POST',_0x3ed824);return{'getStream':async()=>{const _0x45d4eb=(await _0x3b6c74['request'])['body'];return this['_getStreamReader'](_0x45d4eb);},'abortController':_0x3b6c74['abortController']};}['executeAction']({actionName:_0x31577b,content:_0x22e3df,args:_0x36f8bd}){const _0x46abbe={'content':[{'type':'text','content':_0x22e3df}],'args':_0x36f8bd},_0xafa0b4=this['_sendApiRequest']('/actions/system/'+_0x31577b+'/calls','POST',_0x46abbe);return{'getStream':async()=>{const _0x27bec3=(await _0xafa0b4['request'])['body'];return this['_getStreamReader'](_0x27bec3);},'abortController':_0xafa0b4['abortController']};}['uploadFile'](_0x183216,_0xda6ed8,_0x5472b8){const _0x44be65=new FormData();_0x44be65['append']('file',_0xda6ed8,_0xda6ed8['name']),_0x5472b8&&_0x44be65['append']('attributes',JSON['stringify'](_0x5472b8));const _0x2e7a41=this['_sendApiRequest']('/conversations/'+_0x183216+'/files','POST',_0x44be65);return{'getId':async()=>(await _0x2e7a41['request'])['json'](),'abortController':_0x2e7a41['abortController']};}['uploadDocuments'](_0x946394,_0x356b51){const _0x3a32fd={'documents':_0x356b51['map'](_0x20fa7c=>({'content':_0x20fa7c['content'],'attributes':{'version':_0x20fa7c['version'],'sessionId':_0x20fa7c['sessionId'],'channelId':_0x20fa7c['channelId'],'rootName':_0x20fa7c['rootName'],'selections':_0x20fa7c['selections']},...void 0x0!==_0x20fa7c['name']?{'name':_0x20fa7c['name']}:{},...void 0x0!==_0x20fa7c['description']?{'description':_0x20fa7c['description']}:{}}))},_0x17826e=this['_sendApiRequest']('/conversations/'+_0x946394+'/documents/batch','POST',_0x3a32fd);return{'getIds':async()=>(await _0x17826e['request'])['json'](),'abortController':_0x17826e['abortController']};}['fetchDocuments'](_0x444aab,_0x119fdd){const _0x2fe1f5=new URLSearchParams();_0x2fe1f5['append']('documentIds',_0x119fdd['join'](','));const _0x4181c4=this['_sendApiRequest']('/conversations/'+_0x444aab+'/documents/batch?'+_0x2fe1f5['toString'](),'GET');return{'getDocuments':async()=>(await _0x4181c4['request'])['json'](),'abortController':_0x4181c4['abortController']};}['fetchConversations'](_0x21cae5,_0x44a23f={}){const _0x46517d=new URLSearchParams();_0x46517d['append']('group',_0x21cae5),_0x46517d['append']('excludeEmpty',!0x1!==_0x44a23f['excludeEmpty']?'true':'false'),_0x46517d['append']('limit',_0x44a23f['limit']?_0x44a23f['limit']['toString']():'100'),_0x46517d['append']('sortBy',_0x44a23f['sortBy']?_0x44a23f['sortBy']:'createdAt'),_0x46517d['append']('order',_0x44a23f['order']?_0x44a23f['order']:'desc');const _0x5a4119=this['_sendApiRequest']('/conversations?'+_0x46517d['toString'](),'GET');return{'getConversations':async()=>(await(await _0x5a4119['request'])['json']())['items'],'abortController':_0x5a4119['abortController']};}['deleteConversation'](_0x41d0d0){const _0x47fa6c=this['_sendApiRequest']('/conversations/'+_0x41d0d0,'DELETE');return{'execute':async()=>{await _0x47fa6c['request'];},'abortController':_0x47fa6c['abortController']};}['updateConversation'](_0x8f5e4d,_0x51080c){const _0x263af5=this['_sendApiRequest']('/conversations/'+_0x8f5e4d,'PATCH',_0x51080c);return{'getResult':async()=>(await _0x263af5['request'],_0x51080c),'abortController':_0x263af5['abortController']};}['fetchConversation'](_0x538e11){const _0x5afe25=this['_sendApiRequest']('/conversations/'+_0x538e11,'GET');return{'getConversation':async()=>(await _0x5afe25['request'])['json'](),'abortController':_0x5afe25['abortController']};}['fetchConversationMessages'](_0x275823){const _0x238e86=this['_sendApiRequest']('/conversations/'+_0x275823+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x238e86['request'])['json']())['items'],'abortController':_0x238e86['abortController']};}['uploadUrl'](_0x5c2cc1,_0x1a2c23,_0x36bab3){const _0x33eb13=this['_sendApiRequest']('/conversations/'+_0x5c2cc1+'/web-resources','POST',{'url':_0x1a2c23,'attributes':_0x36bab3});return{'getId':async()=>(await _0x33eb13['request'])['json'](),'abortController':_0x33eb13['abortController']};}['getModels'](_0x726c5='en'){const _0x20ec55=new URLSearchParams();_0x20ec55['append']('language',_0x726c5);const _0xdb62b9='/models/1?'+_0x20ec55['toString'](),_0x26e9b4=this['_sendApiRequest'](_0xdb62b9,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x26e9b4['request'])['json'](),'abortController':_0x26e9b4['abortController']};}['deleteFile'](_0x177d5b,_0x5f2135){const _0x47c75e=this['_sendApiRequest']('/conversations/'+_0x177d5b+'/files/'+_0x5f2135,'DELETE');return{'execute':async()=>{await _0x47c75e['request'];},'abortController':_0x47c75e['abortController']};}['deleteDocument'](_0x505d8c,_0x2e2533){const _0x2e93f8=this['_sendApiRequest']('/conversations/'+_0x505d8c+'/documents/'+_0x2e2533,'DELETE');return{'execute':async()=>{await _0x2e93f8['request'];},'abortController':_0x2e93f8['abortController']};}['deleteWebResource'](_0x3d13a1,_0x2b5ecd){const _0x138be0=this['_sendApiRequest']('/conversations/'+_0x3d13a1+'/web-resources/'+_0x2b5ecd,'DELETE');return{'execute':async()=>{await _0x138be0['request'];},'abortController':_0x138be0['abortController']};}['cancelStream'](_0x5f7f48,_0xefcf42){const _0xc9231e=this['_sendApiRequest']('/conversations/'+_0x5f7f48+'/messages/'+_0xefcf42+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0xc9231e['request'];},'abortController':_0xc9231e['abortController']};}['resumeStream'](_0x52fe85,_0x19d2e1,_0x1408c8='0-0'){const _0x387ee0=new URLSearchParams({'lastEventId':_0x1408c8}),_0x3f2e5e=this['_sendApiRequest']('/conversations/'+_0x52fe85+'/messages/'+_0x19d2e1+'/stream?'+_0x387ee0['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2e4231=await _0x3f2e5e['request'];return this['_getStreamReader'](_0x2e4231['body']);},'abortController':_0x3f2e5e['abortController']};}['callSystemReview']({reviewName:_0x154bb1,content:_0x571ea5,args:_0x22bde1}){const _0x202bdd=this['_sendApiRequest']('/reviews/system/'+_0x154bb1+'/calls','POST',{'content':[{'type':'text','content':_0x571ea5}],'args':_0x22bde1});return{'getStream':async()=>{const _0x1d3f45=(await _0x202bdd['request'])['body'];return this['_getStreamReader'](_0x1d3f45);},'abortController':_0x202bdd['abortController']};}['processDocument']({document:_0x2ecf59,prompt:_0x4499b4,model:_0x4a364e}){const _0x1e4ceb=this['_sendApiRequest']('/documents/process','POST',{'document':_0x2ecf59,'prompt':_0x4499b4,'model':_0x4a364e});return{'getResult':async()=>(await _0x1e4ceb['request'])['json'](),'abortController':_0x1e4ceb['abortController']};}['callCustomReview']({content:_0x36599f,prompt:_0x3d3b7c,model:_0x3efe37}){const _0x577a40=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x36599f}],'prompt':_0x3d3b7c,'model':_0x3efe37});return{'getStream':async()=>{const _0xe9fe72=(await _0x577a40['request'])['body'];return this['_getStreamReader'](_0xe9fe72);},'abortController':_0x577a40['abortController']};}['upsertAIChatRating'](_0x3eeb45,_0xbde035,_0x39ffd1){const _0x1ed218=this['_sendApiRequest']('/conversations/'+_0x3eeb45+'/messages/'+_0xbde035+'/ratings','PUT',{'positiveCount':_0x39ffd1['positiveCount'],'totalCount':_0x39ffd1['totalCount'],'modificationId':_0x39ffd1['modificationId']});return{'execute':async()=>{await _0x1ed218['request'];},'abortController':_0x1ed218['abortController']};}['upsertAIActionRating'](_0x3ef8f0,_0xbb4d51,_0x4dbec3){const _0x4d36ad=this['_sendApiRequest']('/actions/system/'+_0x3ef8f0+'/calls/'+_0xbb4d51+'/ratings','PUT',{'positiveCount':_0x4dbec3['positiveCount'],'totalCount':_0x4dbec3['totalCount']});return{'execute':async()=>{await _0x4d36ad['request'];},'abortController':_0x4d36ad['abortController']};}['upsertCustomAIActionRating'](_0x2637c2,_0x3322e8){const _0x2dad07=this['_sendApiRequest']('/actions/custom/calls/'+_0x2637c2+'/ratings','PUT',{'positiveCount':_0x3322e8['positiveCount'],'totalCount':_0x3322e8['totalCount']});return{'execute':async()=>{await _0x2dad07['request'];},'abortController':_0x2dad07['abortController']};}['upsertAIReviewRating'](_0x39e5df,_0x36776d,_0x1301db,_0x2cec19){const _0x23902d=this['_sendApiRequest']('/reviews/system/'+_0x39e5df+'/calls/'+_0x36776d+'/ratings','PUT',{'positiveCount':_0x1301db['positiveCount'],'totalCount':_0x1301db['totalCount'],'dataId':_0x2cec19});return{'execute':async()=>{await _0x23902d['request'];},'abortController':_0x23902d['abortController']};}['upsertCustomAIReviewRating'](_0x142b0d,_0x188e6c,_0x3da59c){const _0x3ffc90=this['_sendApiRequest']('/reviews/custom/calls/'+_0x142b0d+'/ratings','PUT',{'positiveCount':_0x188e6c['positiveCount'],'totalCount':_0x188e6c['totalCount'],'dataId':_0x3da59c});return{'execute':async()=>{await _0x3ffc90['request'];},'abortController':_0x3ffc90['abortController']};}['_sendApiRequest'](_0x33178d,_0x2ab5c8,_0x102d19,_0x5a2eba={}){const {useCache:_0x5c853d=!0x1,apiUrl:_0x40a79f=this['_apiUrl']}=_0x5a2eba,_0xcd107=new AbortController(),_0x3592ad=_0x5c853d?_0x2ab5c8+':'+_0x33178d:null;if(_0x3592ad){const _0xf48562=this['_responseCache']['get'](_0x3592ad);if(_0xf48562)return{'request':_0xf48562['then'](_0x1a5bba=>_0x1a5bba['clone']()),'abortController':_0xcd107};}const _0x460820=_0x102d19 instanceof FormData,_0x53f086={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x102d19&&!_0x460820&&(_0x53f086['Content-Type']='application/json');const _0x42e4a2={'method':_0x2ab5c8,'headers':_0x53f086,'signal':_0xcd107['signal']};_0x102d19&&(_0x42e4a2['body']=_0x460820?_0x102d19:JSON['stringify'](_0x102d19));const _0x259748=fetch(''+_0x40a79f+_0x33178d,_0x42e4a2)['catch'](_0x4b7a47=>{_0x3592ad&&this['_responseCache']['delete'](_0x3592ad),this['_handleError'](_0x4b7a47);})['then'](_0x2c6558=>_0x2c6558['ok']?_0x2c6558:_0x2c6558['json']()['then'](_0x42dbd9=>{throw _0x3592ad&&this['_responseCache']['delete'](_0x3592ad),{'url':_0x40a79f,'path':_0x33178d,'method':_0x2ab5c8,'body':_0x102d19,'status':(_0x2c6558||{})['status'],'statusText':(_0x2c6558||{})['statusText'],'code':_0x42dbd9['code'],'message':_0x42dbd9['message'],'traceId':_0x42dbd9['traceId']};}));return _0x3592ad&&this['_responseCache']['set'](_0x3592ad,_0x259748['then'](_0x3550d5=>_0x3550d5['clone']())),{'request':_0x259748,'abortController':_0xcd107};}async*['_getStreamReader'](_0x48b45a){const _0x245f06=[],_0x4c13ae=_0x48b45a['getReader'](),_0x390a1a=_0x22545b({'onError':_0x17cc87=>{this['_handleError'](_0x17cc87);},'onEvent':_0x129f42=>{_0x129f42['data']=JSON['parse'](_0x129f42['data']),_0x245f06['push'](_0x129f42);}});try{let _0x505fe8=!0x1;for(;!_0x505fe8;){const {done:_0x36e0ec,value:_0x11e98d}=await _0x4c13ae['read']();_0x36e0ec&&(_0x505fe8=!0x0),_0x390a1a['feed'](this['_decoder']['decode'](_0x11e98d,{'stream':!0x0})),yield*_0x245f06,_0x245f06['length']=0x0;}}catch(_0x52da03){this['_handleError'](_0x52da03);}finally{_0x4c13ae['releaseLock'](),_0x390a1a['reset']();}}['_handleError'](_0x33b823){if(_0x33b823 instanceof ht)throw _0x33b823;if(_0x33b823 instanceof Error&&'AbortError'===_0x33b823['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x33b823});throw new ht('ai-request-failed',this,{'originalError':_0x33b823});}};function us(_0x5bcf00,_0x1324e9,_0x47d14d){const t=_0x5bcf00['t'];switch(_0x1324e9){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'},_0x47d14d);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.'},_0x47d14d);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.'},_0x47d14d);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.'},_0x47d14d);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'},_0x47d14d);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x47d14d);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'},_0x47d14d);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.'},_0x47d14d);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.'},_0x47d14d);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.'},_0x47d14d);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.'},_0x47d14d);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'},_0x47d14d);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.'},_0x47d14d);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 _0x1324e9;}}function ds(_0x292c34){return _0x292c34?_0x292c34 instanceof _0x3d3542?[_0x292c34]:_0x292c34['editors']&&0x0!==_0x292c34['editors']['length']?Array['from'](_0x292c34['editors']):[]:[];}function _s(_0xb9ad39){const _0x1e9659=ds(_0xb9ad39);if(!_0x1e9659['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x1e9659['length'])return _0x1e9659[0x0];const _0x588b80=_0x1e9659['find'](_0x524f08=>_0x524f08['ui']?.['focusTracker']?.['isFocused']);if(_0x588b80)return _0x588b80;const _0x455d41=function(_0x1bb8a6){if(_0x1bb8a6 instanceof _0x3d3542)return;const _0x213715=_0x1bb8a6;if(!_0x213715['plugins']||!_0x213715['plugins']['has']('AIEditing'))return;return _0x213715['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0xb9ad39);return _0x455d41&&_0x1e9659['includes'](_0x455d41)?_0x455d41:_0x1e9659[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x7ceac6{constructor(_0x155c50){super(_0x155c50),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'](_0x2e85b2){let _0x452805=this['_sessionIdByEditor']['get'](_0x2e85b2);return _0x452805||(_0x452805=_0x2e85b2['plugins']['has']('RealTimeCollaborationClient')&&_0x2e85b2['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x2e85b2,_0x452805)),_0x452805;}async['getDocumentData'](){const _0x300598=ds(this['context']);if(!_0x300598['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x5b884c=[],_0x370a04=new Set();for(const _0x16df88 of _0x300598){const _0x2b50bc=_0x16df88['config']['get']('roots')||{};for(const _0x3d7d29 of _0x16df88['model']['document']['getRoots']()){if('$graveyard'===_0x3d7d29['rootName'])continue;const _0x20316e=await this['_getDocumentDataForEditorRoot'](_0x16df88,_0x3d7d29,_0x370a04),_0x56280f=_0x2b50bc[_0x3d7d29['rootName']],_0x59f21f=_0x3d7d29['getAttribute']('$description')??_0x56280f?.['description'];let _0x8eee2f=_0x3d7d29['getAttribute']('$title')??_0x56280f?.['title'];_0x8eee2f||(_0x8eee2f=_0x3d7d29['getAttribute']('$rootEditableOptions')?.['label']??_0x56280f?.['label']),_0x8eee2f||(bt('ai-document-root-missing-title',{'editor':_0x16df88,'rootName':_0x3d7d29['rootName']}),_0x8eee2f=_0x3d7d29['rootName']),_0x5b884c['push']({'editor':_0x16df88,'rootName':_0x3d7d29['rootName'],'content':_0x20316e['content'],'version':_0x20316e['version'],'sessionId':this['getSessionId'](_0x16df88),'channelId':_0x16df88['config']['get']('collaboration.channelId'),'selections':_0x20316e['selections'],'name':_0x8eee2f,'description':_0x59f21f});}}return _0x5b884c;}async['_getDocumentDataForEditorRoot'](_0x237ddb,_0x48e35b,_0x4943ef){const _0x3e9d2f=_0x237ddb['data']['toView'](_0x48e35b,{'convertAiChatSelectionMarker':!0x0}),_0x275d53=new _0xdfa425(_0x237ddb['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x3e9d2f,_0x275d53,_0x4943ef);let _0x234d18=await this['_getDocumentDataStringFromView'](_0x3e9d2f,_0x237ddb);const _0x4451cc=this['_getMarkersInDocumentOrder'](_0x237ddb,_0x48e35b),_0x390c19=[];for(const _0x50ca63 of _0x4451cc){const _0x123c34='<'+_0x50ca63['name']+':start></'+_0x50ca63['name']+':start>',_0x3946cc=_0x234d18['indexOf'](_0x123c34);_0x234d18=_0x234d18['substring'](0x0,_0x3946cc)+_0x234d18['substring'](_0x3946cc+_0x123c34['length']);const _0x47c719='<'+_0x50ca63['name']+':end></'+_0x50ca63['name']+':end>',_0x160610=_0x234d18['indexOf'](_0x47c719);_0x234d18=_0x234d18['substring'](0x0,_0x160610)+_0x234d18['substring'](_0x160610+_0x47c719['length']),_0x390c19['push']({'markerName':_0x50ca63['name'],'start':_0x3946cc,'end':_0x160610,'htmlFragment':_0x234d18['substring'](_0x3946cc,_0x160610)});}return{'content':_0x234d18,'version':_0x237ddb['model']['document']['version'],'selections':_0x390c19};}['afterInit'](){this['context']instanceof _0x3d3542?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x565be7,_0x265aff)=>{_0x265aff['on']('ready',()=>{this['_integrateEditor'](_0x265aff);});});}['_setOutputDataProcessor'](_0x4a9389){this['_outputDataProcessor']=_0x4a9389;}async['_getDocumentDataStringFromView'](_0x225e78,_0x67b2bb){let _0x1af5dd;if(this['_outputDataProcessor']){const _0xdbf4c=_0x67b2bb['data']['processor']['domConverter']['viewToDom'](_0x225e78),_0x58a248=await this['_outputDataProcessor'](_0xdbf4c);_0x1af5dd=_0x67b2bb['data']['processor']['htmlWriter']['getHtml'](_0x58a248);}else _0x1af5dd=_0x67b2bb['data']['processor']['toData'](_0x225e78);return _0x1af5dd;}['_integrateEditor'](_0xae64ef){if(!_0xae64ef['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0xae64ef);_0xae64ef['ui']['focusTracker']['on']('change:isFocused',(_0x3af10d,_0xe6cd2d,_0x54573a)=>{_0x54573a&&(this['_lastContentFocusedEditor']=_0xae64ef);}),_0xae64ef['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0xae64ef&&(this['_lastContentFocusedEditor']=void 0x0);}),_0xae64ef['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x59eec0})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x59eec0['split'](':')[0x1]],'priority':0xc})}),_0xae64ef['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x1270f1,{writer:_0x584c14,options:_0x477c98})=>_0x477c98['convertAiChatSelectionMarker']?_0x584c14['createUIElement'](_0x1270f1['markerName']+':'+(_0x1270f1['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x17e35c){const _0x3dd3ab=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x17e35c);const _0x2c124c=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3dd3ab,_0x2c124c);}['hideFakeVisualSelection'](_0x4cc845){const _0x23145e=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x4cc845);const _0x502625=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x23145e,_0x502625);}async['modelToDataWithIds'](_0x1e108f,_0x177cec){const _0xaef0bf=_0x177cec['data']['toView'](_0x1e108f),_0x40ad46=new _0xdfa425(_0x177cec['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0xaef0bf,_0x40ad46),this['_getDocumentDataStringFromView'](_0xaef0bf,_0x177cec);}['_setDataIdsOnChildren'](_0x4c10ef,_0x458201,_0x46034e=new Set()){let _0x24e43e=!0x1;for(const _0x195f47 of _0x4c10ef['getChildren']()){if(!_0x195f47['is']('view:element')||As['includes'](_0x195f47['name']))continue;const _0x15fb0a=_0x195f47['is']('view:containerElement'),_0xf11b07=_0x195f47['is']('view:emptyElement'),_0x22f3d5=_0x195f47['is']('view:rawElement'),_0x320d45=this['_setDataIdsOnChildren'](_0x195f47,_0x458201,_0x46034e);_0x195f47['hasAttribute']('data-id')?(_0x24e43e=!0x0,_0x46034e['add'](_0x195f47['getAttribute']('data-id'))):(_0x15fb0a||_0xf11b07||_0x22f3d5||_0x320d45)&&(_0x458201['setAttribute']('data-id',this['_nextDataId'](_0x46034e),_0x195f47),_0x24e43e=!0x0);}return _0x24e43e;}['_nextDataId'](_0x222ff7){let _0x33b28f;do{_0x33b28f='';for(let _0x5af232=0x0;_0x5af232<0x4;_0x5af232++)_0x33b28f+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x222ff7['has'](_0x33b28f));return _0x222ff7['add'](_0x33b28f),_0x33b28f;}['getSelectionText'](_0x187415){const _0x5671d2=(_0x187415?_0x187415['model']:_s(this['context'])['model'])['document']['selection'],_0x4c7f29=[],_0x5f7762=Array['from'](_0x5671d2['getRanges']());_0x5f7762['sort']((_0x229512,_0x402e26)=>_0x229512['start']['isBefore'](_0x402e26['start'])?-0x1:0x1);for(const _0x21c558 of _0x5f7762)for(const _0x2d5a30 of _0x21c558['getItems']())_0x2d5a30['is']('$textProxy')?_0x4c7f29['push'](_0x2d5a30['data']):_0x2d5a30['is']('element')&&_0x4c7f29['length']>0x0&&'\x20'!==_0x4c7f29[_0x4c7f29['length']-0x1]&&_0x4c7f29['push']('\x20');return _0x4c7f29['length']?'\x22'+_0x4c7f29['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0xf04d1c){for(let _0x1f43b9=0x0;_0x1f43b9<this['_fakeSelections']['length'];_0x1f43b9++)if(this['_fakeSelections'][_0x1f43b9]['id']==_0xf04d1c)return void this['_fakeSelections']['splice'](_0x1f43b9,0x1);}['_addFakeSelection'](_0x3138d7){this['_removeFakeSelectionById'](_0x3138d7['id']),wt(this['_fakeSelections'],_0x3138d7);}['_refreshFakeSelection'](_0x23f3f5,_0x140cf7){if(_0x23f3f5==_0x140cf7)return;const _0x22fdd2=_0x23f3f5?_0x23f3f5['editor']:null,_0x337a45=_0x140cf7?_0x140cf7['editor']:null,_0x195388=(_0x4548de,_0x7c6a5f)=>{const _0x5f561c=_0x7c6a5f['model']['markers']['getMarkersGroup'](gs);for(const _0x5790e0 of _0x5f561c)_0x4548de['removeMarker'](_0x5790e0);},_0x4136c8=(_0x3180df,_0x2ea27e,_0x2cfc13)=>{const _0x2a98bc=_0x2ea27e['model'];for(let _0x16d817=0x0;_0x16d817<_0x2cfc13['ranges']['length'];_0x16d817++){let _0xb8eb55=_0x2cfc13['ranges'][_0x16d817];const _0x13b2bd=gs+':'+_0x2cfc13['id']+':'+_0x16d817;if(_0xb8eb55['start']['isAtEnd']){const _0x1e242a=_0xb8eb55['start']['getLastMatchingPosition'](({item:_0x3654fc})=>!_0x2a98bc['schema']['isContent'](_0x3654fc),{'boundaries':_0xb8eb55});_0xb8eb55=_0x3180df['createRange'](_0x1e242a,_0xb8eb55['end']);}_0x3180df['addMarker'](_0x13b2bd,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xb8eb55});}};_0x22fdd2&&_0x337a45&&_0x22fdd2===_0x337a45&&_0x140cf7?_0x22fdd2['model']['change'](_0x7abbd=>{_0x195388(_0x7abbd,_0x22fdd2),_0x4136c8(_0x7abbd,_0x337a45,_0x140cf7);}):(_0x22fdd2&&_0x22fdd2['model']['change'](_0x54dd96=>_0x195388(_0x54dd96,_0x22fdd2)),_0x337a45&&_0x140cf7&&_0x337a45['model']['change'](_0x153883=>_0x4136c8(_0x153883,_0x337a45,_0x140cf7)));}['_getMarkersInDocumentOrder'](_0x435490,_0x17b569){const _0x2b1141=Array['from'](_0x435490['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x17b569?_0x2b1141['filter'](_0x1fa64f=>{const _0x28587f=_0x1fa64f['getRange']();return _0x28587f&&_0x28587f['root']['rootName']===_0x17b569['rootName'];}):_0x2b1141)['sort']((_0x522881,_0x32a09b)=>_0x522881['getStart']()['isBefore'](_0x32a09b['getStart']())?-0x1:_0x522881['getStart']()['isAfter'](_0x32a09b['getStart']())?0x1:0x0);}};function ps(_0x36a56a,_0x352aa5){return _0x374aa9(_0x36a56a,_0x352aa5);}function ms(_0x2dd8d9,_0x42f09c){return _0x12c7a7(_0x2dd8d9,_0x42f09c);}function Es(_0x2560b1,_0x5b23c6,_0xfe19ae){const _0x2eced9=null!==_0x5b23c6?_0x474127=>_0x474127['attribs'][_0x2560b1]===_0x5b23c6:_0x28ec29=>Boolean(_0x28ec29['attribs'][_0x2560b1]);return ti(_0x579460=>_0x5769a6(_0x579460)&&_0x2eced9(_0x579460),_0xfe19ae);}function Ts(_0x4547dc,_0x137301,_0x3b2f83){const _0x46cc4b=null!==_0x137301?_0x50e170=>_0x50e170['attribs'][_0x4547dc]===_0x137301:_0x21187=>Boolean(_0x21187['attribs'][_0x4547dc]);return _0x16747b(_0x2c64ed=>_0x5769a6(_0x2c64ed)&&_0x46cc4b(_0x2c64ed),_0x3b2f83);}function ws(_0x231e25){return _0x16747b(_0x45f26c=>_0x5769a6(_0x45f26c)&&function(_0x19a583){const _0x544ac5=_0x19a583['toLowerCase']();return'script'===_0x544ac5||'style'===_0x544ac5||_0x544ac5['includes']('-');}(_0x45f26c['name']),_0x231e25);}function Cs(_0x3d5db6){return _0x41f6ef(_0xc63c0d=>_0x5da664(_0xc63c0d),_0x3d5db6,!0x0,0x1/0x0);}function fs(_0x365653,_0x51980f){return _0x365653&&_0x5769a6(_0x365653)?_0x365653['attribs'][_0x51980f]:null;}function bs(_0xe178e3,_0x23144b,_0x354157){_0x5769a6(_0xe178e3)&&(null===_0x354157?delete _0xe178e3['attribs'][_0x23144b]:_0xe178e3['attribs'][_0x23144b]=_0x354157);}function Ss(_0x734d41,_0x170672,_0x51816c){const _0x53380b=_0x170672['cloneNode'](!0x0);'beforebegin'===_0x51816c?_0x22c1dd(_0x734d41,_0x53380b):'afterbegin'===_0x51816c?_0x82f7d2(_0x734d41,_0x53380b):'beforeend'===_0x51816c?_0x3fb410(_0x734d41,_0x53380b):'afterend'===_0x51816c&&_0x37093c(_0x734d41,_0x53380b);}function Rs(_0x506b0e){const _0x289059=[];let _0x172123=_0x506b0e;for(;_0x172123;)_0x172123=_0x128397(_0x172123),_0x172123&&_0x289059['push'](_0x172123);return _0x289059;}function Os(_0x2254b7){return _0x2254b7['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x184937){let _0x719fe9=0x0;for(;_0x184937['parentNode'];)_0x184937=_0x184937['parentNode'],_0x719fe9++;return _0x719fe9;}function ks(_0x4ca8eb){const _0x122c1c=[];let _0x2e62fd=_0x4ca8eb['nextSibling'];for(;_0x2e62fd;)_0x122c1c['push'](_0x2e62fd),_0x2e62fd=_0x2e62fd['nextSibling'];_0x122c1c['forEach'](_0x5d0dc3=>{_0x4e4767(_0x5d0dc3);});}const Ns=/* #__PURE__ -- @preserve */
25
+ gt();var ys=class extends Ns{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0xac7772){super(),this['_generateUid']=_0xac7772||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x483459,_0xf0ea1b,_0x53dbe3){this['_uidCounter']=0x0;const _0x4c87bb=_0x483459['cloneNode'](!0x0);Ds(_0xf0ea1b,_0x4c87bb);const _0x4658c8=_0x4c87bb['childNodes'],_0x2ad330=Array['from'](_0x4658c8)['filter'](_0x5f162a=>!(0x3===_0x5f162a['nodeType']&&''===ms(_0x5f162a)['trim']())),_0x22ac0e=_0x2ad330['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0xf0ea1b)['map'](_0x17f115=>fs(_0x17f115,'data-id'))['filter'](_0x44d5cd=>!!_0x44d5cd));for(const _0x10f15d of _0x2ad330)_0x10f15d&&_0x5769a6(_0x10f15d)&&void 0x0===_0x10f15d['attribs']['data-id']&&bs(_0x10f15d,'data-id','new-element');if(Ts('data-id',null,_0x4c87bb)['forEach'](_0x49e5c6=>{const _0xf52b8f=fs(_0x49e5c6,'data-id');'new-element'===_0xf52b8f||this['_existingDataIds']['has'](_0xf52b8f)||bs(_0x49e5c6,'data-id','new-element');}),0x0===_0xf0ea1b['childNodes']['length']){const _0x1baffe=[];return Ts('data-id','new-element',_0x4c87bb)['forEach'](_0x43d659=>{const _0x2ca80b=this['_generateUid']();bs(_0x43d659,'data-id',_0x2ca80b),_0x1baffe['push'](_0x2ca80b);}),this['_removeSpecialComments'](_0x4c87bb),{'parsedContent':_0x4c87bb,'newNodeIds':_0x1baffe,'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 _0x27eeb4=-0x1,_0x3c63c9=!0x1;for(let _0x1aa25b=0x0;_0x1aa25b<_0x22ac0e;_0x1aa25b++){const _0x162f1a=_0x2ad330[_0x1aa25b],_0x16c5a0=_0x2ad330[_0x1aa25b+0x1];if(this['_isNewNode'](_0x162f1a)){if(-0x1===_0x27eeb4&&(_0x27eeb4=_0x1aa25b),this['_markWrappedElements'](_0x162f1a),!this['_isNewNode'](_0x16c5a0)){const [_0x4dcd49,_0x99def2]=this['_findReferenceNode'](_0x162f1a,_0x3c63c9,_0xf0ea1b);if(_0x4dcd49){const _0x52af9e=Array['from'](_0x2ad330)['slice'](_0x27eeb4,_0x1aa25b+0x1);this['_insertNodes'](_0x4dcd49,_0x52af9e,_0x99def2),_0x27eeb4=-0x1;}}}else{if(this['_isExistingContentComment'](_0x162f1a))_0x3c63c9=!0x0;else{if(this['_isExistingNode'](_0x162f1a)){const _0x1fe6ca=fs(_0x162f1a,'data-id');if(_0x1fe6ca&&this['_existingDataIds']['has'](_0x1fe6ca)){this['_referencedExistingIds']['add'](_0x1fe6ca);const _0x59bee1=Es('data-id',_0x1fe6ca,_0xf0ea1b);this['_replaceNode'](_0x59bee1,_0x162f1a);}}else{if(xs(_0x162f1a)){const _0x473842=Ls(_0x162f1a);Es('data-id',_0x473842,_0x4c87bb)||this['_touchedNodesState']['removedIds']['push'](_0x473842);}}}}}for(const _0x4ad5e8 of this['_touchedNodesState']['removedIds']){const _0x976acc=Es('data-id',_0x4ad5e8,_0xf0ea1b);_0x976acc&&(this['_rescueUnwrappedElements'](_0x976acc),this['_removeNode'](_0x976acc,_0x4ad5e8,_0x53dbe3));}if(Ts('data-id','new-element',_0xf0ea1b)['forEach'](_0x3d19c9=>{const _0x4bbb21=this['_getUid'](_0x3d19c9);bs(_0x3d19c9,'data-id',_0x4bbb21),this['_touchedNodesState']['newIds']['push'](_0x4bbb21);}),this['_removeSpecialComments'](_0xf0ea1b),_0x53dbe3&&_0x53dbe3['cutAfterUnstable']){const _0x22004d=this['_findLastConfirmationPoint'](_0x2ad330),_0x5d70c8=this['_getLastStableElement'](_0xf0ea1b,_0x22004d);this['_markUnstableElements'](_0xf0ea1b,_0x5d70c8);}if(this['_processWrappedElements'](_0xf0ea1b,_0x53dbe3),_0x53dbe3&&_0x53dbe3['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0xd09e16=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0xf0ea1b);let _0x204de9=_0xd09e16[_0xd09e16['length']-0x1];for(;_0x204de9;)ks(_0x204de9),_0x204de9=_0x204de9['parentNode'];}return{'parsedContent':_0xf0ea1b,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x228743,_0x51e84d,_0x42d654){for(const _0x3538d0 of _0x51e84d){const _0x55876c=this['_getUid'](_0x3538d0);bs(_0x3538d0,'data-id',_0x55876c),this['_touchedNodesState']['newIds']['push'](_0x55876c),this['_touchedNodesState']['lastTouchedId']=_0x55876c;}const _0x5de9a0='afterbegin'===_0x42d654||'afterend'===_0x42d654?_0x51e84d['reverse']():_0x51e84d;for(const _0x301af4 of _0x5de9a0)Ss(_0x228743,_0x301af4,_0x42d654);}['_replaceNode'](_0x1d0c3d,_0xb2f0b0){if(!_0x1d0c3d)return;if(_0x29e10b=_0xb2f0b0,Os(ms(_0x1d0c3d))===Os(ms(_0x29e10b)))return;var _0x29e10b;const _0x288c58=fs(_0x1d0c3d,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x288c58),this['_touchedNodesState']['lastTouchedId']=_0x288c58,_0x2b89b7(_0x1d0c3d,_0xb2f0b0['cloneNode'](!0x0));}['_removeNode'](_0x426baf,_0x121a56,_0x178b95){if(_0x178b95&&_0x178b95['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x121a56;const _0x4c8694=_0x178b95['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x4c8694,'data-id',_0x121a56),bs(_0x4c8694,'data-removed','true'),_0x2b89b7(_0x426baf,_0x4c8694);}else _0x4e4767(_0x426baf);}['_findReferenceNode'](_0x3eadd2,_0x36db34,_0x3abfc5){const _0x40cc26=this['_findPrevElementWithDataId'](_0x3eadd2,!0x1);if(_0x40cc26){const _0xb5f79d=Ls(_0x40cc26),_0x11b75c=Es('data-id',_0xb5f79d,_0x3abfc5);if(_0x11b75c)return[_0x11b75c,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0xb5f79d);}const _0x9b624=this['_findNextElementWithDataId'](_0x3eadd2,!0x1);if(_0x9b624){const _0x44d90d=Ls(_0x9b624),_0x4fd582=Es('data-id',_0x44d90d,_0x3abfc5);if(_0x4fd582)return[_0x4fd582,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x44d90d);}return _0x36db34?_0x3eadd2['nextSibling']?this['_findFallbackReferenceNode'](_0x3eadd2,_0x3abfc5):[_0x3abfc5['childNodes'][_0x3abfc5['childNodes']['length']-0x1],'afterend']:[_0x3abfc5['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x4b6e2c,_0x66f39b){const _0x4f26d3=[],_0x14a52f=this['_findPrevElementWithDataId'](_0x4b6e2c,!0x0);if(_0x14a52f){const _0x2c1c50=Es('data-id',Ls(_0x14a52f),_0x66f39b);_0x2c1c50&&_0x4f26d3['push']([_0x2c1c50,'afterend']);}const _0x27f2b6=this['_findNextElementWithDataId'](_0x4b6e2c,!0x0);if(_0x27f2b6){const _0x140994=Es('data-id',Ls(_0x27f2b6),_0x66f39b);_0x140994&&_0x4f26d3['push']([_0x140994,'beforebegin']);}return _0x4f26d3['length']>0x1?vs(_0x4f26d3[0x0][0x0])<=vs(_0x4f26d3[0x1][0x0])?_0x4f26d3[0x0]:_0x4f26d3[0x1]:0x1===_0x4f26d3['length']?_0x4f26d3[0x0]:[_0x66f39b['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x46a6e3,_0x695d8c){let _0x578761=_0x46a6e3['nextSibling'],_0x35c342=null,_0x5b4d7c=!0x1;for(;_0x578761;){if(_0x5da664(_0x578761)){if(xs(_0x578761)&&(_0x35c342=_0x578761),this['_isExistingContentComment'](_0x578761)&&_0x695d8c&&!_0x5b4d7c){_0x5b4d7c=!0x0,_0x578761=_0x578761['nextSibling'];continue;}break;}const _0x1937c1=fs(_0x578761,'data-id');if(_0x1937c1&&'new-element'!==_0x1937c1&&this['_existingDataIds']['has'](_0x1937c1)){_0x35c342=_0x578761;break;}_0x578761=_0x578761['nextSibling'];}return _0x35c342;}['_findPrevElementWithDataId'](_0x469e05,_0x2b861a){let _0x112cfc=_0x469e05['previousSibling'],_0x3ad8fd=null,_0x5ba429=!0x1;for(;_0x112cfc;){if(_0x5da664(_0x112cfc)){if(xs(_0x112cfc)&&(_0x3ad8fd=_0x112cfc),this['_isExistingContentComment'](_0x112cfc)&&_0x2b861a&&!_0x5ba429){_0x5ba429=!0x0,_0x112cfc=_0x112cfc['previousSibling'];continue;}break;}const _0xbfa9f0=fs(_0x112cfc,'data-id');if(_0xbfa9f0&&'new-element'!==_0xbfa9f0&&this['_existingDataIds']['has'](_0xbfa9f0)){_0x3ad8fd=_0x112cfc;break;}_0x112cfc=_0x112cfc['previousSibling'];}return _0x3ad8fd;}['_markWrappedElements'](_0x15c13f){_0x5769a6(_0x15c13f)&&Ts('data-id',null,_0x15c13f)['forEach'](_0x39ce9c=>{this['_isExistingNode'](_0x39ce9c)&&(bs(_0x39ce9c,'data-wrapped-id',fs(_0x39ce9c,'data-id')),bs(_0x39ce9c,'data-id',null));});}['_processWrappedElements'](_0x4dcbc0,_0x197335){Ts('data-wrapped-id',null,_0x4dcbc0)['forEach'](_0x37097d=>{const _0x34b82e=fs(_0x37097d,'data-wrapped-id');if(this['_hasUnstableParent'](_0x37097d))return;const _0x4ff22e=Es('data-id',_0x34b82e,_0x4dcbc0);bs(_0x37097d,'data-id',_0x34b82e),_0x4ff22e&&(this['_removeNode'](_0x4ff22e,_0x34b82e,_0x197335),this['_touchedNodesState']['removedIds']['push'](_0x34b82e),this['_touchedNodesState']['lastTouchedId']=_0x34b82e);});}['_hasUnstableParent'](_0x4c1190){let _0x536f90=_0x4c1190['parentNode'];for(;_0x536f90;){if(fs(_0x536f90,'data-unstable'))return!0x0;_0x536f90=_0x536f90['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x8882b3){const _0x257adf=new Set(this['_touchedNodesState']['removedIds']),_0x885f47=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x8882b3)['forEach'](_0x396c=>{const _0x5ceba7=fs(_0x396c,'data-id'),_0x37e789=!!_0x5ceba7&&this['_referencedExistingIds']['has'](_0x5ceba7),_0x12e4ff=!!_0x5ceba7&&_0x885f47['has'](_0x5ceba7);if(!_0x5ceba7||!_0x37e789&&!_0x12e4ff)return;if(_0x257adf['has'](_0x5ceba7))return;let _0x1aca65=_0x396c['parentNode'],_0x4996fe=!0x1;for(;_0x1aca65;){if(_0x1aca65===_0x8882b3){_0x4996fe=!0x0;break;}const _0x440945=fs(_0x1aca65,'data-id');if(_0x440945&&(this['_referencedExistingIds']['has'](_0x440945)||_0x885f47['has'](_0x440945)))return;_0x1aca65=_0x1aca65['parentNode'];}if(_0x4996fe){if(_0x22c1dd(_0x8882b3,_0x396c),_0x37e789){const _0x1473c8=this['_generateUid'](),_0x51cd21=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x5ceba7);-0x1!==_0x51cd21&&this['_touchedNodesState']['modifiedIds']['splice'](_0x51cd21,0x1),bs(_0x396c,'data-unwrapped-id',_0x5ceba7),bs(_0x396c,'data-id',_0x1473c8),this['_touchedNodesState']['newIds']['push'](_0x1473c8),this['_touchedNodesState']['rescuedNewIds']['add'](_0x1473c8),this['_touchedNodesState']['lastTouchedId']=_0x1473c8;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x5ceba7),this['_touchedNodesState']['lastTouchedId']=_0x5ceba7;}});}['_getUid'](_0x4019fb){return this['_isExistingNode'](_0x4019fb)?fs(_0x4019fb,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x292380){Cs(_0x292380)['filter'](_0x2bb3e3=>xs(_0x2bb3e3)||this['_isExistingContentComment'](_0x2bb3e3))['forEach'](_0x502f37=>{_0x4e4767(_0x502f37);});}['_findLastConfirmationPoint'](_0x37d63f){let _0x5ea7f7=null,_0x205cb9=null,_0x3cc726=null,_0x5a87db=null;const _0x54cd17=_0x44667a=>{_0x44667a&&(_0x5ea7f7=_0x44667a),_0x3cc726=null,_0x5a87db=null;};for(let _0x13fce2=0x0;_0x13fce2<_0x37d63f['length'];_0x13fce2++){const _0x1a269c=_0x37d63f[_0x13fce2];if(this['_isExistingContentComment'](_0x1a269c)){_0x54cd17(_0x205cb9);continue;}if(_0x5769a6(_0x1a269c)){const _0x57043d=fs(_0x1a269c,'data-id'),_0x7a40ea=_0x13fce2===_0x37d63f['length']-0x1;if(_0x57043d&&'new-element'!==_0x57043d&&this['_touchedNodesState']['modifiedIds']['includes'](_0x57043d)&&!_0x7a40ea){_0x54cd17(_0x57043d),_0x205cb9=_0x57043d;continue;}}let _0x1a8a6e=null;const _0x3a4697=Ls(_0x1a269c);if(_0x3a4697&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x3a4697))_0x205cb9=_0x3a4697;else{if(_0x3a4697&&this['_touchedNodesState']['newIds']['includes'](_0x3a4697))_0x1a8a6e='N';else{if(!xs(_0x1a269c))continue;_0x1a8a6e='R';}_0x1a8a6e===_0x5a87db||null===_0x5a87db?_0x5a87db=_0x1a8a6e:null!==_0x3cc726?(_0x54cd17(_0x205cb9),_0x5a87db=_0x1a8a6e):(_0x3cc726=_0x5a87db,_0x5a87db=_0x1a8a6e),_0x205cb9=_0x3a4697;}}const _0x2f2de9=_0x37d63f[_0x37d63f['length']-0x1];return _0x2f2de9&&!_0x5769a6(_0x2f2de9)&&!xs(_0x2f2de9)&&_0x205cb9&&_0x54cd17(_0x205cb9),_0x5ea7f7;}['_getLastStableElement'](_0x3d0aec,_0x19b7c1){if(!_0x19b7c1)return null;const _0x155ee4=Es('data-id',_0x19b7c1,_0x3d0aec);if(!_0x155ee4)return null;const _0x58b20f=[_0x155ee4,...Rs(_0x155ee4)]['at'](-0x2);if(_0x58b20f===_0x155ee4)return _0x155ee4;let _0x3de440=_0x58b20f['previousSibling'];for(;_0x3de440&&!_0x5769a6(_0x3de440);)_0x3de440=_0x3de440['previousSibling'];return _0x3de440;}['_markUnstableElements'](_0x2bdeb0,_0x549a50){const _0x250886=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x4ad60f=_0x549a50?_0x549a50['nextSibling']:_0x2bdeb0['firstChild'];for(;_0x4ad60f;)_0x5769a6(_0x4ad60f)&&(_0x250886['has'](fs(_0x4ad60f,'data-id'))||Ts('data-id',null,_0x4ad60f)['some'](_0x1ab238=>_0x250886['has'](fs(_0x1ab238,'data-id'))))&&bs(_0x4ad60f,'data-unstable','true'),_0x4ad60f=_0x4ad60f['nextSibling'];}['_isNewNode'](_0x52b6af){return Boolean('new-element'===fs(_0x52b6af,'data-id'));}['_isExistingNode'](_0x3ff72b){return Boolean((fs(_0x3ff72b,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x3ff72b,'data-id'));}['_isExistingContentComment'](_0x298c14){return Boolean(_0x5da664(_0x298c14)&&ms(_0x298c14)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function xs(_0x3c07f7){return!!_0x3c07f7&&Boolean(_0x5da664(_0x3c07f7)&&ms(_0x3c07f7)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ls(_0xb4c4d5){if(!_0xb4c4d5)return null;if(_0x5769a6(_0xb4c4d5))return fs(_0xb4c4d5,'data-id')??null;if(_0x5da664(_0xb4c4d5)){const _0x3a1301=ms(_0xb4c4d5)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x3a1301&&_0x3a1301[0x1])return _0x3a1301[0x1];}return null;}function Ds(_0xabc8c7,_0x254805){const _0x2a23fa=new Map();for(const _0x4cc1e1 of ws(_0xabc8c7))_0x2a23fa['set'](fs(_0x4cc1e1,'data-id'),_0x4cc1e1);const _0x1dd8bd=new Set();for(const _0x3a5721 of ws(_0x254805)){const _0x41c85a=fs(_0x3a5721,'data-id'),_0xd2b811=_0x41c85a?_0x2a23fa['get'](_0x41c85a):void 0x0;_0xd2b811?(_0x2b89b7(_0x3a5721,_0xe09a37(_0xd2b811,!0x0)),_0x1dd8bd['add'](_0x41c85a)):_0x4e4767(_0x3a5721);}for(const _0x278c68 of Cs(_0x254805))xs(_0x278c68)&&_0x2a23fa['has'](Ls(_0x278c68))&&_0x4e4767(_0x278c68);const _0x540bff=new Set(Ts('data-id',null,_0x254805)['map'](_0x2b121d=>fs(_0x2b121d,'data-id')));for(const [_0x5e6e5d,_0x3cf264]of _0x2a23fa){if(_0x1dd8bd['has'](_0x5e6e5d))continue;let _0x1b1158=_0x3cf264['parent'],_0x3c2cd3=null;for(;_0x1b1158&&_0x5769a6(_0x1b1158);){const _0x3a58bd=fs(_0x1b1158,'data-id');if(_0x3a58bd&&_0x540bff['has'](_0x3a58bd)){_0x3c2cd3=_0x3a58bd;break;}_0x1b1158=_0x1b1158['parent'];}if(!_0x3c2cd3)continue;const _0x41c797=Es('data-id',_0x3c2cd3,_0x254805);_0x41c797&&_0x3fb410(_0x41c797,_0xe09a37(_0x3cf264,!0x0));}}const Ps=/* #__PURE__ -- @preserve */
26
+ gt();var Hs=class extends Ps{['_m2html'];constructor(){super();const _0x95d8ac=Object['entries'](_0xa04aaf),_0x18e2fd=_0x95d8ac['findIndex'](([_0x5f49f5])=>'rehypeDomRaw'===_0x5f49f5);if(-0x1===_0x18e2fd)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x95d8ac['splice'](_0x18e2fd+0x1,0x0,['rehypeSanitize',_0x4c3032]),this['_m2html']=new _0x366b05({'plugins':Object['fromEntries'](_0x95d8ac)});}['convertMarkdownToHTML'](_0x469e67){const _0x1a2e1b=this['_m2html']['parse'](_0x469e67);return this['parseAndNormalizeHTML'](_0x1a2e1b);}['parseAndNormalizeHTML'](_0x4beae1){return this['_parseHTML'](_0x4beae1);}['_parseHTML'](_0x687b49){const _0x39326a=ps('<dummy>'+_0x687b49['replace'](/<[^>]*?$/g,'')+'</dummy>');return Ms(_0x39326a),_0x39326a['children']=_0x39326a['children'][0x0]['children'],_0x39326a;}};function Ms(_0x580f89){for(const _0xe74dd9 of _0x580f89['children'])_0x5769a6(_0xe74dd9)?'pre'!==_0xe74dd9['name']&&Ms(_0xe74dd9):_0x59c448(_0xe74dd9)&&(_0xe74dd9['data']=_0xe74dd9['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Vs({changeGroups:_0x23e186,documentContextContent:_0x3ee709,showDiff:_0x4cda2e,trimUnchanged:_0x577213=!0x0}){return _0x23e186['map'](_0x5d0da3=>{if(!_0x5d0da3['editor']||'destroyed'===_0x5d0da3['editor']['state'])return null;if(!_0xc7c2a1(_0x5d0da3['editor'],_0x5d0da3['rootName']))return{'type':_0x5d0da3['changes'][0x0]['type'],'index':_0x5d0da3['index'],'content':new _0x37a11f([]),'hasChanges':!0x1};const _0x3b878c=new _0x37a11f([]),_0x600767=new _0x37a11f([]),_0xc948da=new Set();for(const _0x2be5c7 of _0x5d0da3['changes'])'new'==_0x2be5c7['type']&&Ts('data-id',null,_0x2be5c7['node'])['forEach'](_0x43e700=>{_0xc948da['add'](fs(_0x43e700,'data-id'));});for(const _0x547bf4 of _0x5d0da3['changes'])if('removed'!=_0x547bf4['type']?_0x600767['children']['push'](_0x547bf4['node']['cloneNode'](!0x0)):_0x4cda2e||_0xc948da['has'](_0x547bf4['id'])||_0x600767['children']['push'](_0x547bf4['node']['cloneNode'](!0x0)),'new'!=_0x547bf4['type']&&(_0x4cda2e||'removed'!=_0x547bf4['type'])){const _0x540bc2=ti(_0x1bb45a=>fs(_0x1bb45a,'data-id')==_0x547bf4['id'],_0x3ee709['get'](_0x5d0da3['documentId']),!0x0);_0x540bc2&&_0x3b878c['children']['push'](_0x540bc2['cloneNode'](!0x0));}let _0x26bde8,_0x4c9762;try{({content:_0x26bde8,hasChanges:_0x4c9762}=Us(_0x5d0da3['editor'],_0x3b878c,_0x600767,_0x4cda2e,_0x577213));}catch{return{'type':_0x5d0da3['changes'][0x0]['type'],'index':_0x5d0da3['index'],'content':new _0x37a11f([]),'hasChanges':!0x1};}return{'type':_0x5d0da3['changes'][0x0]['type'],'index':_0x5d0da3['index'],'content':_0x26bde8,'hasChanges':_0x4c9762};})['filter'](_0x3e0b82=>null!==_0x3e0b82);}function Us(_0x2004d6,_0x4ba353,_0x529e9d,_0x57cc76,_0x513902=!0x0){const _0x58a2bc=_0x2004d6['plugins']['get']('DocumentCompare'),_0x1eeb1d=ms(_0x4ba353),_0x4cec11=ms(_0x529e9d),_0x5a8581=_0x2004d6['data']['parse'](_0x1eeb1d,'$root'),_0x4b13f9=_0x2004d6['model']['createPositionAt'](_0x5a8581,0x0),_0x220074=_0x58a2bc['getDiff'](_0x1eeb1d,_0x4cec11,{'anchor':_0x4b13f9,'markDeletions':_0x57cc76,'targetEditor':_0x2004d6})['getOperations']();if(0x0==_0x220074['length'])return{'content':_0x4ba353['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x57cc76?function(_0x28dfd1,_0x4bd804,_0x21feda){if(0x0==_0x28dfd1['length'])return;const _0x21269e=_0x21feda['plugins']['get']('DocumentCompare'),_0x124af5=_0x21feda['plugins']['get']('SuggestionsConversion');_0x21feda['model']['change'](_0x560b0b=>{const _0x3fc38c=new Set();for(let _0xd7bd8=0x0;_0xd7bd8<_0x28dfd1['length'];_0xd7bd8++){const _0x5c5787=_0x28dfd1[_0xd7bd8];if(_0x5c5787['baseVersion']=null,_0x5c5787['isDocumentOperation']=!0x1,_0x21269e['isMarkedRemoveOperation'](_0x5c5787)){const _0x599da7=_0x5e2c2d(_0x5c5787['newRange'],_0x21feda['model']),_0x4f6440='suggestion:deletion:'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x4f6440,_0x599da7);}else switch(_0x5c5787['type']){case'rename':{if(_0x5c5787['oldName']==_0x5c5787['newName'])break;_0x560b0b['batch']['addOperation'](_0x5c5787),_0x21feda['model']['applyOperation'](_0x5c5787);const _0x14dae0='$elementName',_0x193204=_0x5c5787['position'],_0x588f3e=_0x21feda['model']['createRange'](_0x193204,_0x21feda['model']['createPositionAt'](_0x193204['nodeAfter'],'end')),_0x48a659='suggestion:attribute:'+_0x14dae0+':'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x48a659,_0x588f3e);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x5c5787['oldValue']==_0x5c5787['newValue'])break;_0x560b0b['batch']['addOperation'](_0x5c5787),_0x21feda['model']['applyOperation'](_0x5c5787);const _0x2670b4=_0x5c5787['key'];if(!_0x124af5['isRegisteredAttribute'](_0x2670b4))break;const _0x56d414=_0x5e2c2d(_0x5c5787['range'],_0x21feda['model']),_0x3cb4b5='suggestion:attribute:'+_0x2670b4+':'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x3cb4b5,_0x56d414);break;}case'insert':{if(_0x560b0b['batch']['addOperation'](_0x5c5787),_0x21feda['model']['applyOperation'](_0x5c5787),Bs(_0x4bd804,_0x5c5787),_0x28dfd1[_0xd7bd8+0x1]&&'move'==_0x28dfd1[_0xd7bd8+0x1]['type'])break;const _0x39ad7f=_0x5c5787['position'],_0x115bab=_0x5c5787['howMany'],_0x277ced=_0x5e2c2d(_0x21feda['model']['createRange'](_0x39ad7f,_0x39ad7f['getShiftedBy'](_0x115bab)),_0x21feda['model']),_0x5960db='suggestion:insertion:'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x5960db,_0x277ced);break;}case'split':{_0x560b0b['batch']['addOperation'](_0x5c5787),_0x21feda['model']['applyOperation'](_0x5c5787),Bs(_0x4bd804,_0x5c5787);const _0x25217d=_0x5c5787['splitPosition'],_0x5687ff=_0x5c5787['moveTargetPosition'],_0x45dfcd=_0x21feda['model']['createRange'](_0x25217d,_0x5687ff),_0x2429db='suggestion:insertion:'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x2429db,_0x45dfcd);break;}case'move':{_0x560b0b['batch']['addOperation'](_0x5c5787),_0x21feda['model']['applyOperation'](_0x5c5787),Bs(_0x4bd804,_0x5c5787);const _0x5d1195=_0x5c5787['getMovedRangeStart'](),_0x46b909=_0x5c5787['howMany'];for(let _0x21b80c=0x0;_0x21b80c<_0x46b909;_0x21b80c++){const _0x29aef9=_0x5d1195['getShiftedBy'](_0x21b80c)['nodeAfter'];_0x3fc38c['add'](_0x29aef9);}break;}case'remove':{const _0x4ac531=_0x5c5787['sourcePosition'],_0x30398a=_0x5c5787['howMany'],_0x2df6bc=new _0x521b81(_0x4ac531,_0x30398a);_0x560b0b['batch']['addOperation'](_0x2df6bc),_0x21feda['model']['applyOperation'](_0x2df6bc),Bs(_0x4bd804,_0x5c5787);break;}}}for(const _0x390176 of _0x3fc38c){const _0x37edc2=_0x21feda['model']['createRangeOn'](_0x390176),_0x321b0c='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0x4bd804['markers']['set'](_0x321b0c,_0x5e2c2d(_0x37edc2,_0x21feda['model']));}});}(_0x220074,_0x5a8581,_0x2004d6):_0x2004d6['model']['change'](_0x4d2143=>{for(const _0x39aa77 of _0x220074)if('remove'==_0x39aa77['type']){const _0x120e63=_0x39aa77['sourcePosition'],_0x502d18=_0x39aa77['howMany'],_0x3d0d46=new _0x521b81(_0x120e63,_0x502d18);_0x4d2143['batch']['addOperation'](_0x3d0d46),_0x2004d6['model']['applyOperation'](_0x3d0d46),Bs(_0x5a8581,_0x39aa77);}else{if('marker'==_0x39aa77['type']){const _0x47fe7f=_0x39aa77['name'],_0x4eff33=_0x39aa77['newRange'];null!==_0x4eff33?_0x5a8581['markers']['set'](_0x47fe7f,_0x4eff33):_0x5a8581['markers']['delete'](_0x47fe7f);}else _0x39aa77['baseVersion']=null,_0x39aa77['isDocumentOperation']=!0x1,_0x4d2143['batch']['addOperation'](_0x39aa77),_0x2004d6['model']['applyOperation'](_0x39aa77),Bs(_0x5a8581,_0x39aa77);}}),_0x513902){const _0x126a15=Gs(_0x2004d6,_0x220074,_0x5a8581);Ks(_0x2004d6['model'],_0x126a15),function(_0x5ae816,_0x580e0d){const _0x50971b=_0x580e0d['getFirstRange']()['start'];let _0x213598=_0x580e0d['getFirstRange']()['end'];const _0x450427=_0x50971b['root'];(_0x213598['textNode']||_0x213598['nodeAfter']&&_0x213598['nodeAfter']['is']('$text'))&&(_0x539ac0(_0x213598,'...'),$s(_0x450427,_0x213598,0x3),_0x213598=_0x213598['getShiftedBy'](0x3)),(_0x50971b['textNode']||_0x50971b['nodeBefore']&&_0x50971b['nodeBefore']['is']('$text'))&&(_0x539ac0(_0x50971b,'...'),$s(_0x450427,_0x50971b,0x3),_0x50971b['parent']==_0x213598['parent']&&(_0x213598=_0x213598['getShiftedBy'](0x3)));const _0x2deee2=_0x5ae816['createRange'](_0x5ae816['createPositionAt'](_0x450427,0x0),_0x50971b),_0x1b11c5=_0x5ae816['createRange'](_0x213598,_0x5ae816['createPositionAt'](_0x450427,'end')),_0x618ea=[..._0x2deee2['getMinimalFlatRanges'](),..._0x1b11c5['getMinimalFlatRanges']()];_0x618ea['reverse']();for(const _0x5e90ae of _0x618ea)_0x3d5521(_0x5e90ae),Ys(_0x450427,_0x5e90ae);}(_0x2004d6['model'],_0x126a15);}return{'content':ps(_0x2004d6['data']['stringify'](_0x5a8581,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Bs(_0x5cb927,_0x2248f2){for(const [_0x3999d1,_0x425bf0]of _0x5cb927['markers']){const _0x5342db=_0x156cfa['_createFromRanges'](_0x425bf0['getTransformedByOperation'](_0x2248f2));_0x5342db['root']==_0x5cb927?_0x5cb927['markers']['set'](_0x3999d1,_0x5342db):_0x5cb927['markers']['delete'](_0x3999d1);}}function Gs(_0x3f51ca,_0x10fada,_0x6cd085){const _0x33b86c=_0x3f51ca['plugins']['get']('DocumentCompare');let _0x18b122=_0x3f51ca['model']['createPositionAt'](_0x6cd085,Number['POSITIVE_INFINITY']),_0x5782df=_0x3f51ca['model']['createPositionAt'](_0x6cd085,0x0);for(const _0x80bb83 of _0x10fada){let _0x47d518,_0x1aa028;if(_0x33b86c['isMarkedRemoveOperation'](_0x80bb83))_0x47d518=_0x80bb83['newRange']['start'],_0x1aa028=_0x80bb83['newRange']['end'];else switch(_0x18b122=Fs(_0x18b122,_0x80bb83),_0x5782df=Fs(_0x5782df,_0x80bb83),_0x80bb83['type']){case'rename':_0x47d518=_0x80bb83['position'],_0x1aa028=_0x47d518['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x47d518=_0x80bb83['range']['start'],_0x1aa028=_0x80bb83['range']['end'];break;case'insert':_0x47d518=_0x80bb83['position'],_0x1aa028=_0x47d518['getShiftedBy'](_0x80bb83['howMany']);break;case'split':_0x47d518=_0x80bb83['splitPosition'],_0x1aa028=_0x80bb83['moveTargetPosition'];break;case'merge':{const _0x2db965=_0x80bb83['targetPosition']['path']['slice'](0x0,-0x1);_0x47d518=_0x3f51ca['model']['createPositionFromPath'](_0x6cd085,_0x2db965),_0x1aa028=_0x47d518['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x38e379=_0x80bb83['howMany'],_0x55ecee=_0x80bb83['sourcePosition']['_getTransformedByInsertion'](_0x80bb83['targetPosition'],_0x38e379),_0x480693=_0x80bb83['getMovedRangeStart']();'remove'==_0x80bb83['type']?(_0x47d518=_0x55ecee,_0x1aa028=_0x55ecee):(_0x47d518=_0x480693,_0x1aa028=_0x480693['getShiftedBy'](_0x38e379));break;}}_0x47d518&&_0x47d518['isBefore'](_0x18b122)&&(_0x18b122=_0x47d518['clone'](),_0x18b122['stickiness']='toNone'),_0x1aa028&&_0x1aa028['isAfter'](_0x5782df)&&(_0x5782df=_0x1aa028['clone'](),_0x5782df['stickiness']='toNone');}return _0x3f51ca['model']['createSelection'](_0x3f51ca['model']['createRange'](_0x18b122,_0x5782df));}function Fs(_0x143ada,_0x469b71){return'move'!=_0x469b71['type']&&'remove'!=_0x469b71['type']||_0x469b71['sourceRange']['containsPosition'](_0x143ada)&&((_0x143ada=_0x469b71['sourcePosition']['clone']())['stickiness']='toNone'),_0x143ada['getTransformedByOperation'](_0x469b71);}function Ks(_0x109ada,_0x3bdc69){Ws(_0x109ada,_0x3bdc69,'forward');const _0x54973b=_0x3bdc69['getFirstRange']();_0x3bdc69['setTo']([]),_0x3bdc69['setTo'](_0x54973b,{'backward':!0x0}),Ws(_0x109ada,_0x3bdc69,'backward');}function Ws(_0x4272d0,_0x4192d3,_0x129125){let _0xcb3de1=0x14;for(;_0xcb3de1;){_0x4272d0['modifySelection'](_0x4192d3,{'unit':'word','direction':_0x129125}),_0xcb3de1--;const _0x244c0d=_0x4192d3['focus']['forward'==_0x129125?'nodeBefore':'nodeAfter'];if(_0x244c0d&&_0x244c0d['is']('element')&&_0x4272d0['schema']['isBlock'](_0x244c0d)&&_0x4272d0['schema']['isObject'](_0x244c0d))break;}}function Ys(_0x5122aa,_0x2ca9db){for(const [_0x5a6475,_0x155c74]of _0x5122aa['markers']){const _0x3d93d2=_0x155c74['_getTransformedByDeletion'](_0x2ca9db['start'],_0x2ca9db['end']['offset']-_0x2ca9db['start']['offset']);null!=_0x3d93d2?_0x5122aa['markers']['set'](_0x5a6475,_0x3d93d2):_0x5122aa['markers']['delete'](_0x5a6475);}}function $s(_0x143232,_0x1197a3,_0x47fc21){for(let [_0x4c6ec1,_0x52b80d]of _0x143232['markers'])_0x52b80d=_0x52b80d['_getTransformedByInsertion'](_0x1197a3,_0x47fc21,!0x1)[0x0],_0x143232['markers']['set'](_0x4c6ec1,_0x52b80d);}const qs=/* #__PURE__ -- @preserve */
27
+ ut();var Qs=class extends qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x2e0151,config:_0x480468,locale:_0x22d168}){super(),this['_connector']=_0x2e0151,this['_config']=_0x480468,this['_locale']=_0x22d168;}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 _0x289200=await this['getAll']();let _0x355480;return _0x355480=this['_availableModels']?this['_filterModels'](_0x289200,this['_availableModels']):_0x289200['filter'](_0x43cc26=>_0x43cc26['recommended']),_0x355480;}async['getModel'](_0x270674){const _0x33293f=await this['getAll']();if(!_0x33293f['length'])return null;if(_0x270674){const _0x776f3d=this['_getModelById'](_0x33293f,_0x270674);if(_0x776f3d)return _0x776f3d;bt('ai-chat-model-id-unrecognized',{'modelId':_0x270674,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x5832ce=await this['getAvailableModels']();if(!_0x5832ce['length'])return null;if(this['_defaultModelId']){const _0x1ee435=this['_getModelById'](_0x5832ce,this['_defaultModelId']);if(_0x1ee435)return _0x1ee435;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x5832ce[0x0]['id']});}return _0x5832ce[0x0];}async['isAvailable'](_0x446e41){return(await this['getAvailableModels']())['some'](_0x5c237b=>_0x5c237b['name']===_0x446e41['name']&&_0x5c237b['provider']===_0x446e41['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x5d61d0=this['_locale']['uiLanguage']||'en',_0x10235e=await this['_connector']['getModels'](_0x5d61d0)['list']();this['_modelList']=_0x10235e['items']['map'](_0x4ba8e1=>Xs(_0x4ba8e1)?{..._0x4ba8e1,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x4ba8e1);}return[...this['_modelList']];}['_filterModels'](_0x30cc77,_0x512f92){let _0x4c6bda;if(_0x512f92){_0x4c6bda=[];const _0x248e6e=new Set(),_0xdd254='string'==typeof _0x512f92?[_0x512f92['toLocaleLowerCase']()]:_0x512f92['map'](_0x4cd0bf=>_0x4cd0bf['toLocaleLowerCase']());for(const _0x175992 of _0xdd254)for(const _0x395bfc of _0x30cc77)!_0x248e6e['has'](_0x395bfc['id'])&&this['_isMatchingFilter'](_0x395bfc,_0x175992)&&(_0x4c6bda['push'](_0x395bfc),_0x248e6e['add'](_0x395bfc['id']));}else _0x4c6bda=_0x30cc77;return _0x4c6bda;}['_isMatchingFilter'](_0x138e65,_0x3656bd){const _0x4d8a33=_0x138e65['id']['toLocaleLowerCase'](),_0x51bd98=_0x138e65['name']['toLocaleLowerCase'](),_0x48552a=_0x138e65['provider']['toLocaleLowerCase']();return _0x4d8a33===_0x3656bd||_0x51bd98===_0x3656bd||Xs(_0x138e65)&&'auto'===_0x3656bd||_0x48552a===_0x3656bd||_0x4d8a33['startsWith'](_0x3656bd);}['_getModelById'](_0x306580,_0x417c30){return _0x306580['find'](_0x3a4b72=>Xs(_0x3a4b72)&&'auto'===_0x417c30?_0x3a4b72:_0x3a4b72['id']===_0x417c30)||null;}};function Xs(_0x367c35){return _0x367c35['id']['startsWith']('agent');}function zs(_0x288084,_0x248917){for(const _0x316685 of _0x288084)'noop'!==_0x316685['type']&&(_0x316685['_aiSource']=_0x248917);}var js=class extends _0x7ceac6{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x4568e8];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Qs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x2b5a00,_0x3d679f){if('completed'!==_0x2b5a00['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x2b5a00['status']});const _0x531b27=_0x2b5a00['editor'],{applyMethod:_0x55c438}=_0x3d679f;if('suggest'===_0x55c438&&!_0x531b27['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0xfde7d='suggest'===_0x55c438,_0x5f1392=this['context']['plugins']['get'](_0x4568e8),_0x543a6c=_0x531b27['model']['createPositionAt'](_0x531b27['model']['document']['getRoot'](),0x0),_0x15bc57=_0x5f1392['getDiff'](_0x2b5a00['contentRawOld'],_0x2b5a00['contentRawNew'],{'anchor':_0x543a6c,'markDeletions':_0xfde7d,'targetEditor':_0x531b27}),_0x50da76=_0x531b27['model']['document']['history']['getOperations'](_0x2b5a00['documentVersion']),_0xbd534e={'document':_0x531b27['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0xcbfbe7=_0x456211(_0x15bc57['getOperations'](),_0x50da76,_0xbd534e)['operationsA'];zs(_0xcbfbe7,_0x3d679f['aiSource']??'api'),_0x531b27['model']['change'](_0x301cf3=>{_0xfde7d?_0x531b27['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0xcbfbe7):_0x5f1392['applyOperations'](_0x301cf3,_0xcbfbe7);});}['mergeChangesIntoContent'](_0x52009d,_0x1761c8,_0x2894a9){const _0x491b77=new Hs(),_0x164921=new ys();let _0x359549=_0x491b77['parseAndNormalizeHTML'](_0x1761c8);for(const _0x18bd7c of _0x52009d)try{const _0x1eec27=_0x491b77['parseAndNormalizeHTML'](_0x18bd7c['content']);_0x359549=_0x164921['merge'](_0x1eec27,_0x359549,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x3c1225){throw new ht('ai-gateway-merge-failed',this,{..._0x18bd7c},_0x3c1225);}return Us(_0x2894a9,_0x491b77['parseAndNormalizeHTML'](_0x1761c8),_0x359549,!0x1,!0x1)['content'];}},Js=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0xd06f83){this['_editor']=_0xd06f83['editor'],this['_rootName']=_0xd06f83['rootName'],this['_channelId']=_0xd06f83['channelId'],this['_sessionId']=_0xd06f83['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'](_0x52fb9f){this['_documentVersion']=_0x52fb9f;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x23b4fc){this['_contentRawOld']=_0x23b4fc;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x533c7e){this['_contentRawNew']=_0x533c7e;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x53d1aa){this['_error']=_0x53d1aa;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x293ee7){return _0x293ee7['replace'](/ data-id="[a-z0-9]+"/g,'');}},Zs=class extends Js{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x499975){this['_summary']=_0x499975;}},tn=class extends _0x7ceac6{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x424f5f,_0x1828fe){if(!_0x424f5f)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x29a304=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x29a304[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x3602f4=new Zs({'editor':_0x29a304[0x0]['editor'],'rootName':_0x29a304[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x29a304[0x0]['sessionId']});if(_0x3602f4['contentRawOld']=_0x29a304[0x0]['content'],_0x3602f4['documentVersion']=_0x29a304[0x0]['version'],_0x1828fe?.['signal']?.['aborted'])return _0x3602f4['abort'](),_0x3602f4;const _0x16a720=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x3602f4['contentRawOld'],'prompt':_0x424f5f,'model':_0x1828fe['model']});let _0x4d4c5f;if(_0x1828fe?.['signal']){if(_0x1828fe['signal']['aborted'])return _0x16a720['abortController']['abort'](),_0x3602f4['abort'](),_0x3602f4;const _0x398bdf=_0x1828fe['signal'],_0x4d1c53=()=>_0x16a720['abortController']['abort']();_0x398bdf['addEventListener']('abort',_0x4d1c53),_0x4d4c5f=()=>_0x398bdf['removeEventListener']('abort',_0x4d1c53);}try{const _0x5aee47=await _0x16a720['getResult']();if(!(_0x5aee47&&_0x5aee47['document']&&_0x5aee47['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x3602f4['contentRawNew']=_0x5aee47['document'],_0x3602f4['summary']=_0x5aee47['summary']||'';}catch(_0x3b0992){_0x3b0992 instanceof Error&&_0x3b0992['message']['includes']('ai-request-aborted')?_0x3602f4['abort']():_0x3602f4['error']=_0x3b0992 instanceof ht?_0x3b0992:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x3b0992);}finally{_0x4d4c5f&&_0x4d4c5f();}return _0x3602f4;}['applyResult'](_0x33acc7,_0xd85685){this['context']['plugins']['get']('AIGateway')['apply'](_0x33acc7,_0xd85685);}};function en(_0x1743c3){return _0x1743c3 instanceof Error&&('AbortError'===_0x1743c3['name']||('AICoreError'===_0x1743c3['name']?!0x0===_0x1743c3['isAbort']:_0x1743c3['message']['startsWith']('ai-request-aborted')));}var sn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x4be655){super(_0x4be655['code'],_0x4be655['cause']instanceof Error?{'cause':_0x4be655['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x4be655['code'],this['severity']=_0x4be655['severity']??'error',this['type']=_0x4be655['type']??'system',this['context']=_0x4be655['context'],this['isAbort']=_0x4be655['isAbort']??en(_0x4be655['cause']);}},nn=class extends _0x7ceac6{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x4f3790){return new rn(this,_0x4f3790);}},rn=class{['_sink'];['_component'];constructor(_0x2328e3,_0x541865){this['_sink']=_0x2328e3,this['_component']=_0x541865;}['logError'](_0x27fcb9,_0x2d1445={}){this['_emit'](_0x27fcb9,_0x2d1445),this['_defaultLog'](_0x27fcb9);}['reportError'](_0xd06eb3,_0x3ae050={}){this['_emit'](_0xd06eb3,_0x3ae050);}['_emit'](_0x17bdb5,_0x15f1fc){en(_0x17bdb5)||this['_sink']['fire']('error',{'error':_0x17bdb5,'component':this['_component'],'context':_0x15f1fc['context']});}['_defaultLog'](_0x11e4bd){if(!en(_0x11e4bd)){if(_0x11e4bd instanceof sn){if('user'===_0x11e4bd['type']||'network'===_0x11e4bd['type'])return;if('warning'===_0x11e4bd['severity'])return void console['warn'](this['_component'],_0x11e4bd);}console['error'](this['_component'],_0x11e4bd);}}};const on='ck-ai-button-primary',an='ck-ai-button-secondary',hn='ck-ai-button-tertiary';function cn(_0x105b2f,_0x3773aa){const _0x585029=new Ht(_0x105b2f),_0x4a44fa=us(_0x105b2f,'AI_TABS_LABEL_MINIMIZE'),_0x251b96=us(_0x105b2f,'AI_TABS_LABEL_MAXIMIZE');return _0x585029['set']({'withText':!0x1,'icon':_0x322c97,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+hn}),_0x585029['bind']('label')['to'](_0x3773aa,'isMaximized',_0x2d4f09=>_0x2d4f09?_0x4a44fa:_0x251b96),_0x585029['bind']('icon')['to'](_0x3773aa,'isMaximized',_0x142115=>_0x142115?_0x2ea4dd:_0x322c97),_0x585029['bind']('isOn')['to'](_0x3773aa,'isMaximized'),_0x585029['on']('execute',()=>{_0x3773aa['fire']('resizeTabs');}),_0x585029;}function ln(_0x53a24e){const _0x9be7ec=new Lt(_0x53a24e);return _0x9be7ec['attachToDom'](),_0x9be7ec['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x9be7ec;}const un=/* #__PURE__ -- @preserve */
28
+ gt();var dn=class extends un{['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:_0x1d1006,isDone:_0x4fa4e4=!0x1,isComplete:_0x3c4fec,interactionId:_0x417ece,areActionsDisabled:_0x233e86,isFromHistory:_0x5e2782=!0x1,documentContextContent:_0x190611,locale:_0x2aefb9,id:_0x17add7,channelsToEditors:_0x51c3c6}){super(),this['id']=_0x17add7||vt(),this['interactionId']=_0x417ece,this['type']=_0x1d1006,this['areActionsDisabled']=!!_0x233e86,this['isFromHistory']=_0x5e2782,this['locale']=_0x2aefb9,this['aiResponseParser']=new Hs(),this['aiResponseApplier']=new ys(),this['documentContextContent']=new Map(_0x190611?.['map'](_0x22356e=>[_0x22356e['id'],ps(_0x22356e['content'])])||[]),this['_documentIdToSource']=new Map(_0x190611?.['map'](_0x14e43d=>[_0x14e43d['id'],{'editor':_0x51c3c6['get'](_0x14e43d['channelId']),'rootName':_0x14e43d['rootName']}])||[]),this['set']('isDone',_0x4fa4e4),this['set']('isComplete',_0x3c4fec??_0x4fa4e4),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x4fa8b1,_0x5cc7d4){const _0xbf2de7='text'===this['type']?'text':_0x5cc7d4;this['content']['has'](_0xbf2de7)||this['content']['set'](_0xbf2de7,''),this['content']['set'](_0xbf2de7,this['content']['get'](_0xbf2de7)+_0x4fa8b1),this['onContentChange'](_0xbf2de7);}['done'](_0x4736de=!0x0){this['isComplete']=_0x4736de,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x471b51,_0x500e6c){this['changeGroups'][_0x471b51]['state']=_0x500e6c,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x471b51,'state':_0x500e6c});}['getContentParts']({showDiff:_0x44ecfb,groupIndex:_0x46f2e5}){const _0x39fc1f=this['_getCachedContentParts'](_0x44ecfb,_0x46f2e5);if(_0x39fc1f)return _0x39fc1f;let _0x2ea4e8=[];if(void 0x0===_0x46f2e5)_0x2ea4e8=this['changeGroups'];else{const _0x2e5bad=this['changeGroups']['find'](({index:_0x493109})=>_0x493109===_0x46f2e5);if(!_0x2e5bad)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x46f2e5});_0x2ea4e8=[_0x2e5bad];}const _0xd2a24f=Vs({'showDiff':_0x44ecfb,'changeGroups':_0x2ea4e8,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x44ecfb,_0xd2a24f),_0xd2a24f;}['_getCachedContentParts'](_0x5bee04,_0xceaf91){const _0x1e0acd=_0x5bee04?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x1e0acd]['length'])return null;const _0x22e6b1=this['cachedSuggestionContentParts'][_0x1e0acd];if(void 0x0===_0xceaf91)return _0x22e6b1['length']>0x0&&_0x22e6b1['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x5bee04,null),null):_0x4a0d84(_0x22e6b1);{const _0x2669ea=_0x22e6b1['find'](({index:_0x13b186})=>_0x13b186===_0xceaf91);if(_0x2669ea)return[_0x4a0d84(_0x2669ea)];}return null;}['_setCachedContentParts'](_0x5b986d,_0x3b1c59){const _0x5e8a23=_0x5b986d?'withDiff':'withoutDiff';_0x3b1c59?_0x3b1c59['forEach'](_0x36f7b4=>{const _0x5e08a5=this['cachedSuggestionContentParts'][_0x5e8a23],_0x37b86a=_0x5e08a5['find'](({index:_0x4dde40})=>_0x4dde40===_0x36f7b4['index']);if(_0x37b86a){const _0x44fc19=_0x5e08a5['indexOf'](_0x37b86a);_0x5e08a5['splice'](_0x44fc19,0x1,_0x36f7b4);}else _0x5e08a5['push'](_0x36f7b4);}):this['cachedSuggestionContentParts'][_0x5e8a23]['length']=0x0;}['onContentChange'](_0x9f6ad5){if('modification'===this['type']){if(_0x9f6ad5)this['parsedContent']['set'](_0x9f6ad5,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x9f6ad5)));else{for(const [_0x3e49e3,_0x8f2fb9]of this['content'])this['parsedContent']['set'](_0x3e49e3,this['aiResponseParser']['parseAndNormalizeHTML'](_0x8f2fb9));}const _0x2f053e=this['changeGroups'];for(const _0x1a91bc of this['content']['keys']())this['updateChangeGroups'](_0x1a91bc);const _0x3cbdf0=this['_getDifferentChangeGroups'](_0x2f053e,this['changeGroups']);(_0x3cbdf0['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x3cbdf0),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'](_0x1ecedf,_0x1da3e5){const _0x632d41=[];for(const _0x10e8dc of _0x1da3e5){const _0x222c66=_0x1ecedf[_0x10e8dc['index']];_0x222c66?_0x222c66['changes']['length']!==_0x10e8dc['changes']['length']?_0x632d41['push'](_0x10e8dc):_0x222c66['changes']['forEach']((_0x57cda1,_0x40080e)=>{const _0x2cb25d=_0x10e8dc['changes'][_0x40080e];_0x57cda1['id']!==_0x2cb25d['id']&&_0x632d41['push'](_0x10e8dc);}):_0x632d41['push'](_0x10e8dc);}return _0x632d41;}['updateChangeGroups'](_0x4b70cb){const _0x3b35ce=this['documentContextContent']['get'](_0x4b70cb),_0x361d99=this['parsedContent']['get'](_0x4b70cb);if(!_0x3b35ce||!_0x361d99)return;const _0x5092fb=new _0x597b04('p',{},[new _0x597b04('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x48552e(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x48997e=this['aiResponseApplier']['merge'](_0x361d99,_0x3b35ce['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x5092fb});this['parsedMergedContent']['set'](_0x4b70cb,_0x48997e['parsedContent']);let _0x4ef4e0=[];if(_0x16747b(_0x1810d4=>{const _0x433614=fs(_0x1810d4,'data-id');if(!_0x433614||!_0x41c411(_0x433614))return!0x1;const _0x214490=[_0x1810d4,...Rs(_0x1810d4)]['at'](-0x2);if(_0x1810d4!=_0x214490){const _0x1afbf3=fs(_0x214490,'data-id');_0x41c411(_0x1afbf3)||(_0x4ef4e0['push']({'node':_0x214490,'id':_0x1afbf3,'type':'modified'}),_0x48997e['modifiedNodeIds']['push'](_0x1afbf3));}else _0x48997e['modifiedNodeIds']['includes'](_0x433614)?_0x4ef4e0['push']({'node':_0x1810d4,'type':'modified','id':_0x433614}):_0x48997e['newNodeIds']['includes'](_0x433614)?_0x4ef4e0['push']({'node':_0x1810d4,'type':'new','id':_0x433614,'anchorId':fs(_0x1810d4['previousSibling'],'data-id')}):_0x4ef4e0['push']({'node':_0x1810d4,'type':'removed','id':_0x433614});return!0x0;},this['parsedMergedContent']['get'](_0x4b70cb)),_0x4ef4e0=_0x4ef4e0['filter'](({node:_0xa252ac})=>[...Rs(_0xa252ac),_0xa252ac]['every'](_0x1cfbe7=>!fs(_0x1cfbe7,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x4b6651=>_0x4b6651['documentId']!==_0x4b70cb),0x0==_0x4ef4e0['length'])return;const _0x59dde9=[[_0x4ef4e0[0x0]]];for(let _0x1a4d0b=0x1;_0x1a4d0b<_0x4ef4e0['length'];_0x1a4d0b++){const _0x1d7102=_0x59dde9[_0x59dde9['length']-0x1],_0x1d1a21=_0x1d7102[_0x1d7102['length']-0x1];_0x4ef4e0[_0x1a4d0b]['node']['previousSibling']==_0x1d1a21['node']&&'modified'!=_0x4ef4e0[_0x1a4d0b]['type']&&'modified'!=_0x1d1a21['type']?_0x1d7102['push'](_0x4ef4e0[_0x1a4d0b]):_0x59dde9['push']([_0x4ef4e0[_0x1a4d0b]]);}for(const _0xbeda1b of _0x59dde9){const _0x5263a3=_0xbeda1b[0x0],_0x65af33=_0xbeda1b[_0xbeda1b['length']-0x1],_0x26d508=_0x2114d7(_0x5263a3['node']['previousSibling']);_0x26d508&&_0xbeda1b['unshift'](_0x26d508);const _0x4228b2=_0x2114d7(_0x65af33['node']['nextSibling']);_0x4228b2&&_0xbeda1b['push'](_0x4228b2);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x4b70cb))['forEach'](_0x155adf=>{bs(_0x155adf,'data-wrapped-id',null);});const _0x183d08=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x4b70cb))['forEach'](_0x40d1c1=>{const _0x133550=fs(_0x40d1c1,'data-unwrapped-id'),_0x14fc89=fs(_0x40d1c1,'data-id');_0x183d08['set'](_0x14fc89,_0x133550),bs(_0x40d1c1,'data-id',_0x133550),bs(_0x40d1c1,'data-unwrapped-id',null);});for(const _0x2fbde1 of _0x4ef4e0){const _0x13024e=_0x183d08['get'](_0x2fbde1['id']);_0x13024e&&(_0x2fbde1['id']=_0x13024e);}this['changeGroups']['push'](..._0x59dde9['map']((_0x280657,_0x26ca7c)=>({'changes':_0x280657,'state':'pending','index':_0x26ca7c,'editor':this['_documentIdToSource']['get'](_0x4b70cb)['editor'],'rootName':this['_documentIdToSource']['get'](_0x4b70cb)['rootName'],'documentId':_0x4b70cb})));const _0x672256=Array['from'](this['documentContextContent']['keys']());function _0x41c411(_0x31db8b){return _0x48997e['modifiedNodeIds']['includes'](_0x31db8b)||_0x48997e['newNodeIds']['includes'](_0x31db8b)||_0x48997e['removedNodeIds']['includes'](_0x31db8b);}function _0x2114d7(_0x7c2a4c){if(_0x7c2a4c&&fs(_0x7c2a4c,'data-id')&&!fs(_0x7c2a4c,'data-unstable')){const _0x4349a7=fs(_0x7c2a4c,'data-id');if(!_0x41c411(_0x4349a7))return{'node':_0x7c2a4c,'type':'context','id':_0x4349a7};}return null;}this['changeGroups']['sort']((_0x3ab231,_0x291243)=>_0x672256['indexOf'](_0x3ab231['documentId'])-_0x672256['indexOf'](_0x291243['documentId'])),this['changeGroups']['forEach']((_0x18a1a1,_0xb5b135)=>{_0x18a1a1['index']=_0xb5b135;});}};const _n=/* #__PURE__ -- @preserve */
29
+ ut(),gn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var An=class extends _n{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x158543,locale:_0x28fa9e,channelsToEditors:_0x4730b4}){super(),this['id']=vt(),this['connector']=_0x158543,this['isStopped']=!0x0,this['locale']=_0x28fa9e,this['_channelsToEditors']=_0x4730b4||new Map();}async['start'](){await this['_run']();}async['resume'](_0x3c3ba9){await this['_run'](_0x3c3ba9);}async['_run'](_0x463fb6){const _0x2f8d35=[];let _0x5acb3b,_0x383721,_0x4a4b6f,_0x97ab4c=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x463fb6||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x3ed37c=await this['currentRequest']['getStream']();for await(const _0x339541 of _0x3ed37c){if(this['isStopped'])return;if('error'==_0x339541['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x339541['event']){case'message-metadata':this['messageId']=_0x339541['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x339541['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x339541['data']['conversationTitle'],!0x0);break;case'source':_0x2f8d35['push'](_0x339541['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'](),_0x5acb3b='modification-delta'==_0x339541['event']?'modification':'text',_0x383721='modification-delta'==_0x339541['event']?_0x339541['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x5acb3b&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x5acb3b,'interactionId':this['id'],'id':_0x383721,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x339541['event']&&{'documentId':_0x339541['data']['documentId']}}),'modification'==_0x5acb3b&&(this['currentReply']['sources']=_0x2f8d35['splice'](0x0))),this['currentReply']['appendContent'](_0x339541['data']['textDelta'],_0x339541['data']['documentId']);break;case'mcp-tool-result':_0x4a4b6f=JSON['parse'](_0x339541['data']['result']),this['_handleToolResultData']({'toolName':_0x339541['data']['toolName'],'data':_0x4a4b6f['data'],'attributes':_0x4a4b6f['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x339541['data']['toolName'],'data':_0x339541['data']['data']});}}_0x97ab4c=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x2f8d35['length']>0x0&&(this['currentReply']['sources']=_0x2f8d35['splice'](0x0)),this['_finalizeInteraction'](_0x97ab4c),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x193b51){return this['replies']['find'](_0x22cb9e=>_0x22cb9e['id']===_0x193b51);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x3729cb=>_0x3729cb['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x2bc21f){const _0x2bb354=this['getDocumentContext'](),_0x39e4d3=new dn({'locale':this['locale'],'documentContextContent':_0x2bb354?.['documents'],..._0x2bc21f});return this['replies']['push'](_0x39e4d3),_0x39e4d3['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x39e4d3),_0x39e4d3;}['setConversationTitle'](_0x4015f4,_0xf2918f=!0x1){this['fire']('setConversationTitle',_0x4015f4,_0xf2918f);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x300910){this['fire']('toolDataReceived',{'type':'result','toolName':_0x300910['toolName'],'data':structuredClone(_0x300910['data']||{}),'attributes':structuredClone(_0x300910['attributes']||{})},this);}['_handleToolNotificationData'](_0x25a59c){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x25a59c['toolName'],'data':structuredClone(_0x25a59c['data'])},this);}['_finalizeInteraction'](_0x31329c=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x31329c),this['currentRequest']=this['currentReply']=void 0x0;}};const In=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']]),pn=/* #__PURE__ -- @preserve */
30
+ gt(),mn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var En=class AIChatContext extends pn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x263ceb,config:_0x134adc,ownerId:_0x38728a}){super(),this['_connector']=_0x263ceb,this['_config']=_0x134adc,this['_ownerId']=_0x38728a;}['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'](_0xfb3012,_0x220887){const _0x6aac68=new Map(),{contextItem:_0x533112,hasUnmatched:_0x445f97}=await this['_populateDocumentContextItem'](_0xfb3012,_0x220887);_0x533112&&_0x6aac68['set'](_0x533112['id'],_0x533112);for(const _0x12a266 of _0xfb3012){if('document'===_0x12a266['type'])continue;const _0x38bae4=await this['_createContextItemFromContent'](_0x12a266);this['_addToConversationContextItem'](_0x38bae4),_0x6aac68['set'](_0x38bae4['id'],_0x38bae4);}return{'contextItems':_0x6aac68,'hasUnmatched':_0x445f97};}async['_populateDocumentContextItem'](_0xa047f8,_0x5674e0){const _0x2ab35b=_0xa047f8['filter'](_0x44af84=>'document'===_0x44af84['type']);if(0x0===_0x2ab35b['length'])return{'hasUnmatched':!0x1};const _0x3f2b5f=_0x2ab35b['map'](_0x431911=>_0x431911['id']),_0x5c726c=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x3f2b5f)['getDocuments'](),_0x25669d=new Map(_0x5c726c['map'](_0x1bcb10=>[_0x1bcb10['id'],_0x1bcb10])),_0xf5d39d=[];let _0x210d22=!0x1;for(const _0x1dd3b0 of _0x2ab35b){const _0x4f9991=_0x25669d['get'](_0x1dd3b0['id']);_0x4f9991&&(this['_matchDocumentToRoot'](_0x4f9991,_0x5674e0)||(_0x210d22=!0x0),_0xf5d39d['push']({'id':_0x4f9991['id'],'content':_0x4f9991['content'],'version':_0x4f9991['attributes']?.['version']??0x0,'sessionId':_0x4f9991['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x4f9991['attributes']?.['channelId']??_0x5674e0[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x4f9991['attributes']?.['rootName']??_0x5674e0[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0xf57eae={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0xf5d39d};return this['_addToConversationContextItem'](_0xf57eae),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0xf57eae,'hasUnmatched':_0x210d22};}['_matchDocumentToRoot'](_0x18afaa,_0x174b0c){const _0x29a333=_0x18afaa['attributes']?.['channelId'],_0x645ea8=_0x18afaa['attributes']?.['rootName'];if(_0x29a333&&_0x645ea8){for(const _0x4de0a2 of _0x174b0c)if(_0x4de0a2['config']['get']('collaboration.channelId')===_0x29a333){for(const _0x5029fe of _0x4de0a2['model']['document']['getRoots']())if('$graveyard'!==_0x5029fe['rootName']&&_0x5029fe['rootName']===_0x645ea8)return{'editor':_0x4de0a2,'rootName':_0x5029fe['rootName']};}}}async['_createContextItemFromContent'](_0x10481d){return'mcp-tool-context'===_0x10481d['type']?{'id':_0x10481d['id'],'uiId':_0x10481d['id'],'label':_0x10481d['data']?.['label']||_0x10481d['id'],'type':'mcp-tool-context','mcpServerName':_0x10481d['mcpServerName'],'toolName':_0x10481d['toolName'],'data':_0x10481d['data']||{}}:{'id':_0x10481d['id'],'uiId':_0x10481d['id'],'label':_0x10481d['attributes']?.['label']||_0x10481d['name']||_0x10481d['url']||_0x10481d['id'],'type':_0x10481d['type'],..._0x10481d?.['attributes']?.['resourceId']?{'resourceId':_0x10481d['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x31ab4b){this['_pendingContextItems']['get'](_0x31ab4b)?.['isReadOnly']||this['_removeContextItem'](_0x31ab4b);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x168283 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x168283['uiId']);const _0x45ecb6=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x45ecb6&&this['_addContextItem']({..._0x45ecb6,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x1ae0a6){for(const _0x2c8e69 of _0x1ae0a6['values']())this['_addToConversationContextItem'](_0x2c8e69);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'](_0x6074e2){return Array['from'](_0x6074e2['values']())['flatMap'](_0x5ebdda=>this['_mapContextItemToRequestData'](_0x5ebdda));}async['addFilesToContext'](_0x8103cb,_0xdaff09,_0xaa6e65='file'){const _0x2e59c9='files-'+vt();this['_startUploadOperation'](_0x2e59c9);try{await Promise['all'](_0x8103cb['map'](async _0x4f92d4=>{const _0x3213e4='file-'+vt(),_0x58d37d=_0x42dd97(_0x4f92d4['name']),_0x5b7074='file'===_0xaa6e65&&_0x4f92d4['type']['startsWith']('image/')?'image':_0xaa6e65;try{this['_addContextItem']({'type':_0x5b7074,'label':_0xdaff09?.['label']||_0x58d37d,'uiId':_0x3213e4,'resourceId':_0xdaff09?.['resourceId']},!0x0);const _0x45e818=this['_connector']['uploadFile'](this['_ownerId'],_0x4f92d4,_0xdaff09);this['_ongoingUploads']['set'](_0x3213e4,_0x45e818['abortController']);const {id:_0xa517d1}=await _0x45e818['getId']();this['_ongoingUploads']['delete'](_0x3213e4),this['_finishContextItemLoading']({'type':_0x5b7074,'id':_0xa517d1,'label':_0xdaff09?.['label']||_0x58d37d,'uiId':_0x3213e4,'resourceId':_0xdaff09?.['resourceId']},!0x1);}catch(_0x265ce0){if(this['_ongoingUploads']['delete'](_0x3213e4),!en(_0x265ce0)){const _0x3c8a69=new sn({'code':In['get'](_0x265ce0['code'])||'ai-chat-file-upload-failed','cause':_0x265ce0,'context':{'fileName':_0x58d37d}});this['fire']('error',{'error':_0x3c8a69});}this['_removeContextItem'](_0x3213e4);}}));}finally{this['_finishUploadOperation'](_0x2e59c9);}}['addCurrentDocumentToContext'](_0x5115ae){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x306c30={'type':'document','uiId':'current-document','label':_0x5115ae,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x306c30);}async['updateCurrentDocuments'](_0x54dfe1){const _0x147bbb=this['_pendingContextItems']['get']('current-document');if(!_0x147bbb||!_0x54dfe1['length']||_0x54dfe1['every'](_0x92e829=>!_0x92e829['content']))return;_0x54dfe1['length']>0x1&&_0x54dfe1['some'](_0x43075c=>!_0x43075c['description'])&&bt('ai-chat-documents-missing-description');try{const _0x4b6ea1=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x54dfe1)['getIds']();if(_0x4b6ea1['length']!==_0x54dfe1['length']||_0x4b6ea1['some'](_0x3d46d1=>!_0x3d46d1?.['id'])){const _0x2785c0=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x2785c0});}_0x147bbb['documents']=_0x54dfe1['map']((_0x3d5eac,_0x8a7b7a)=>{return{'id':_0x4b6ea1[_0x8a7b7a]['id'],'content':_0x3d5eac['content'],'version':_0x3d5eac['version'],'sessionId':_0x3d5eac['sessionId'],'selection':(_0x32435b=_0x3d5eac['selections'],_0x32435b?_0x32435b['map'](_0x25053f=>({'start':_0x25053f['start'],'end':_0x25053f['end']})):[]),'channelId':_0x3d5eac['channelId'],'rootName':_0x3d5eac['rootName']};var _0x32435b;});}catch(_0x1ad9e0){const _0x11f58f=new sn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x1ad9e0});this['fire']('error',{'error':_0x11f58f});}}['addSelectionToContext'](_0x2d7b7c){this['_addContextItem']({'type':'selection','label':_0x2d7b7c,'uiId':'selection','content':_0x2d7b7c});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x1b669f,_0x5e9f72){const _0x3e2a2e='url-'+vt();this['_startUploadOperation'](_0x3e2a2e);const _0x34377f='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x5e9f72?.['label']||_0x1b669f,'uiId':_0x34377f,'resourceId':_0x5e9f72?.['resourceId']},!0x0);const _0x3882d1=this['_connector']['uploadUrl'](this['_ownerId'],_0x1b669f,_0x5e9f72);this['_ongoingUploads']['set'](_0x34377f,_0x3882d1['abortController']);const {id:_0x5437c0}=await _0x3882d1['getId']();this['_ongoingUploads']['delete'](_0x34377f),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5437c0,'label':_0x5e9f72?.['label']||_0x1b669f,'uiId':_0x34377f,'resourceId':_0x5e9f72?.['resourceId']},!0x1);}catch(_0x1e143a){this['_ongoingUploads']['delete'](_0x34377f),en(_0x1e143a)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x1b669f,'originalError':_0x1e143a}),'url':_0x1b669f}),this['_removeContextItem'](_0x34377f);}finally{this['_finishUploadOperation'](_0x3e2a2e);}}['addToolItemToContext'](_0x8e0e43){_0x8e0e43['id']=_0x8e0e43['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x8e0e43['uiId'],_0x8e0e43),this['fire']('contextItemAdded',{'contextItem':_0x8e0e43,'isLoading':!0x1});}async['loadSourceResources'](_0x4c8b7f,_0x38dd33,_0x34d681){const _0x38c2de=this['_addContextOptionsState']['sources']['find'](_0x53bbee=>_0x53bbee['id']===_0x4c8b7f);if(!_0x38c2de)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x4c8b7f}),'sourceId':_0x4c8b7f}),[];try{const _0x24f552=(await _0x38c2de['getResources'](_0x38dd33))['map'](_0x713e3b=>{const _0x2850fa=this['_isResourceInContext'](_0x713e3b['id']);return{..._0x713e3b,'isInContext':_0x2850fa};});return _0x38c2de['resources']=_0x24f552,this['fire']('sourceResourcesLoaded',{'sourceId':_0x4c8b7f,'source':_0x38c2de,'resources':_0x24f552,'uid':_0x34d681}),_0x24f552;}catch(_0xad8095){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x4c8b7f,'originalError':_0xad8095}),'sourceId':_0x4c8b7f,'sourceLabel':_0x38c2de['label']}),[];}}async['addResourceToContext'](_0x3b274f,_0x5a15f2){if(this['_isResourceInContext'](_0x5a15f2['id']))return;let _0x24d205=_0x5a15f2['data'];if(!_0x24d205&&_0x3b274f['getData'])try{_0x24d205=await _0x3b274f['getData'](_0x5a15f2['id']);}catch(_0x2fcfad){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id'],'originalError':_0x2fcfad}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});}if(_0x24d205)switch(_0x5a15f2['type']){case'web-resource':if('string'!=typeof _0x24d205)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id'],'expectedType':'string','actualType':typeof _0x24d205}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});await this['addUrlToContext'](_0x24d205,{'label':_0x5a15f2['label'],'resourceId':_0x5a15f2['id']});break;case'file':if(!(_0x24d205 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id'],'expectedType':'File','actualType':typeof _0x24d205}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});await this['addFilesToContext']([_0x24d205],{'label':_0x5a15f2['label'],'resourceId':_0x5a15f2['id']});break;case'text':if('object'!=typeof _0x24d205||!('content'in _0x24d205)||!('type'in _0x24d205))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x24d205}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});_0x24d205=AIChatContext['_convertTextResourceToFile'](_0x24d205,_0x5a15f2['label']),await this['addFilesToContext']([_0x24d205],{'label':_0x5a15f2['label'],'resourceId':_0x5a15f2['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id'],'resourceType':_0x5a15f2['type']}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']}),'resourceId':_0x5a15f2['id'],'sourceId':_0x3b274f['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x29ae50){if(void 0x0!==_0x29ae50)this['_addContextOptionsState']['document']['isHidden']=!_0x29ae50;else{const _0x39f2f4=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x39f2f4;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x105adb,_0xc9c0c3){switch(_0x105adb['type']){case'markdown':return new File([_0x105adb['content']],_0xc9c0c3,{'type':'text/markdown'});case'html':return new File([_0x105adb['content']],_0xc9c0c3,{'type':'text/html'});default:return new File([_0x105adb['content']],_0xc9c0c3,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0xc0b682){switch(_0xc0b682['type']){case'file':case'image':case'text':return[{'type':'file','id':_0xc0b682['id']}];case'web-resource':return[{'type':'web-resource','id':_0xc0b682['id']}];case'document':return _0xc0b682['documents']?.['length']?_0xc0b682['documents']['map'](_0x46f9b2=>({'type':'document','id':_0x46f9b2['id'],..._0x46f9b2['selection']?.['length']&&{'selection':_0x46f9b2['selection']}})):[];case'mcp-tool-context':{const _0xa73702=_0xc0b682;return[{'type':'mcp-tool-context','mcpServerName':_0xa73702['mcpServerName'],'toolName':_0xa73702['toolName'],'data':{..._0xa73702['data'],'label':_0xa73702['label']||_0xa73702['data']?.['label']||_0xa73702['id']},'id':_0xa73702['id']}];}default:return[];}}['_addContextItem'](_0x7cd0e6,_0x4f7be0=!0x1){if(this['_pendingContextItems']['set'](_0x7cd0e6['uiId'],_0x7cd0e6),_0x7cd0e6['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x7cd0e6,'isLoading':_0x4f7be0}),'current-document'===_0x7cd0e6['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x7cd0e6['resourceId']){const _0x524679=this['_findSourceIdsByResourceId'](_0x7cd0e6['resourceId']);_0x524679&&_0x524679['forEach'](_0x202c86=>{this['_updateResourceInContextState'](_0x202c86,_0x7cd0e6['resourceId'],!0x0);});}}['_removeContextItem'](_0x569a6d){const _0x3e8e38=this['_pendingContextItems']['get'](_0x569a6d),_0x1aca33=this['_ongoingUploads']['get'](_0x569a6d);if(_0x1aca33&&(_0x1aca33['abort'](),this['_ongoingUploads']['delete'](_0x569a6d)),_0x3e8e38?.['resourceId']){const _0x3d01f7=this['_findSourceIdsByResourceId'](_0x3e8e38['resourceId']);_0x3d01f7&&_0x3d01f7['forEach'](_0x5054a9=>{this['_updateResourceInContextState'](_0x5054a9,_0x3e8e38['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x569a6d),this['fire']('contextItemRemoved',{'uiId':_0x569a6d,'type':_0x3e8e38?.['type']}),'current-document'===_0x569a6d&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x284d41,_0x265ef5){if(this['_pendingContextItems']['has'](_0x284d41['uiId'])&&(this['_pendingContextItems']['set'](_0x284d41['uiId'],_0x284d41),this['fire']('contextItemLoadingEnded',{'contextItem':_0x284d41,'isLoading':_0x265ef5}),_0x284d41['resourceId'])){const _0x19f9f4=this['_findSourceIdsByResourceId'](_0x284d41['resourceId']);_0x19f9f4&&_0x19f9f4['forEach'](_0x27484b=>{this['_updateResourceInContextState'](_0x27484b,_0x284d41['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x364747){this['_conversationContextItems']['set'](_0x364747['uiId'],_0x364747);}['_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'](_0x2e11d9=>({..._0x2e11d9,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x1bc1ec=>({..._0x1bc1ec,'resources':[]}))??[];}['_isResourceInContext'](_0x17ed27){for(const _0x58b23a of this['_pendingContextItems']['values']())if(_0x58b23a['resourceId']===_0x17ed27)return!0x0;for(const _0x1a54cc of this['_conversationContextItems']['values']())if(_0x1a54cc['resourceId']===_0x17ed27)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2e6ffc){const _0x3357ac=[];for(const _0x333b37 of this['_addContextOptionsState']['sources'])_0x333b37['resources']['find'](_0x4e789c=>_0x4e789c['id']===_0x2e6ffc)&&_0x3357ac['push'](_0x333b37['id']);return 0x0===_0x3357ac['length']?null:_0x3357ac;}['_updateResourceInContextState'](_0x4b61ed,_0x31ef16,_0x26b5da){const _0x1117b6=this['_addContextOptionsState']['sources']['find'](_0x465191=>_0x465191['id']===_0x4b61ed);if(!_0x1117b6)return;const _0x445255=_0x1117b6['resources']['find'](_0x7c1935=>_0x7c1935['id']===_0x31ef16);_0x445255&&(_0x445255['isInContext']=_0x26b5da,this['fire']('resourceStateChanged',{'sourceId':_0x4b61ed,'resourceId':_0x31ef16,'isInContext':_0x26b5da}));}['_startUploadOperation'](_0x16a737){this['_ongoingUploadOperations']['set'](_0x16a737,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x2f25aa){this['_ongoingUploadOperations']['delete'](_0x2f25aa),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Tn=/* #__PURE__ -- @preserve */
31
+ ut(),wn=['capabilitiesUpdated'];var Cn=class extends Tn{['_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'](_0x35a4f2){const _0x24a4c9={};return _0x35a4f2&&_0x35a4f2['isWebSearchEnabled']&&(_0x24a4c9['webSearch']={}),_0x35a4f2&&_0x35a4f2['isReasoningEnabled']&&(_0x24a4c9['reasoning']={}),_0x24a4c9;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x30f39b){_0x30f39b!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x30f39b,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x2136ec){_0x2136ec!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x2136ec,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},fn=class extends An{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x2485e4){super(_0x2485e4),this['conversationId']=_0x2485e4['conversationId'],this['contextItems']=_0x2485e4['contextItems'],this['capabilities']=_0x2485e4['capabilities'],this['userMessage']=_0x2485e4['userMessage'],this['model']=_0x2485e4['model'],this['attributes']=_0x2485e4['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':En['mapContextItemsToRequestData'](this['contextItems']),'capabilities':Cn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const bn=/* #__PURE__ -- @preserve */
32
+ ut();var Sn=class extends bn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x4e469e){super(),this['options']=_0x4e469e,this['connector']=_0x4e469e['connector'],this['chatModels']=_0x4e469e['chatModels'],this['id']=_0x4e469e['conversationId'],this['isFromHistory']=_0x4e469e['isFromHistory'],this['_channelsToEditors']=_0x4e469e['channelsToEditors'],this['_getSessionId']=_0x4e469e['getSessionId'];}async['init'](_0x571361){try{this['chatContext']=new En({'connector':this['connector'],'config':_0x571361,'ownerId':this['id']}),this['chatContext']['delegate'](...mn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new Cn(),this['chatCapabilities']['delegate'](...wn)['to'](this),this['chatCapabilities']['init']();const _0x21c1d3=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x21c1d3});const _0xe29db3=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0xe29db3&&await this['setModel'](_0xe29db3);}catch(_0x3b08a2){const _0x54ae89=new sn({'code':'ai-chat-conversation-init-failed','cause':_0x3b08a2,'type':'network'});this['fire']('error',{'error':_0x54ae89});}}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:_0x3fadb8}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x3fadb8,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x5dcfdd){const _0x17eae7=new sn({'code':'ai-chat-conversation-start-failed','cause':_0x5dcfdd,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x17eae7}),_0x17eae7;}}async['load'](_0x158210){try{const _0x4a21e1=await this['connector']['fetchConversation'](_0x158210)['getConversation'](),_0x548cd5=await this['connector']['fetchConversationMessages'](_0x158210)['getMessages'](),_0x996f60=_0x548cd5[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x4a21e1['id'],'title'in _0x4a21e1?this['fire']('setConversationTitle',_0x4a21e1['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x82c534=(await this['chatModels']['getAll']())['find'](_0x5d4491=>_0x5d4491['id']['toLowerCase']()===_0x996f60['toLowerCase']());this['selectedModel']=_0x82c534,this['fire']('modelSelected',{'selectedModel':_0x82c534,'isDisabled':!0x0});const {streamingMessageId:_0x8df47}=await this['_processMessagesToInteractions'](_0x548cd5,_0x996f60);return _0x8df47&&this['currentInteraction']?this['_resumeStream'](_0x8df47):this['currentInteraction']=void 0x0,this;}catch(_0x105d31){const _0x661ef7=new sn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x105d31,'type':'network','context':{'conversationId':_0x158210}});throw this['fire']('error',{'error':_0x661ef7}),_0x661ef7;}}async['_processMessagesToInteractions'](_0x5b5d88,_0x271f10){let _0x1f0bf1,_0x5a72dd,_0xa8af0b=!0x1;for(const _0x21be28 of _0x5b5d88)if('user'===_0x21be28['role']){const {contextItems:_0x547c04,hasUnmatched:_0x5a801c}=await this['_extractContextItems'](_0x21be28);_0xa8af0b=_0x5a801c;const _0x1c5586={'isReasoningEnabled':Object['hasOwn'](_0x21be28['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x21be28['capabilities'],'webSearch')};_0x1f0bf1=this['createInteraction']({'userMessage':_0x21be28['prompt'],'contextItems':_0x547c04,'capabilities':_0x1c5586,'modelId':_0x271f10,'attributes':_0x21be28['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x1f0bf1,_0x5a72dd=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x21be28['role']&&_0x1f0bf1){if('streaming'===_0x21be28['status']){_0x5a72dd=_0x21be28['id'];continue;}if('error'===_0x21be28['status'])continue;const _0x4a1e8a=[];for(const _0x56a60f of _0x21be28['content'])switch(_0x56a60f['type']){case'text':case'modification':{const _0x13210c=_0x1f0bf1['getDocumentContext'](),_0x5b3cba=this['_hasSessionMismatch'](_0x13210c)||_0xa8af0b;_0x1f0bf1['currentReply']?.['type']!==_0x56a60f['type']&&(_0x1f0bf1['currentReply']=_0x1f0bf1['createReply']({'type':_0x56a60f['type'],'isDone':!0x0,'interactionId':_0x1f0bf1['id'],'areActionsDisabled':_0x5b3cba,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x4a1e8a['length']>0x0&&(_0x1f0bf1['currentReply']['sources']=_0x4a1e8a['splice'](0x0))),_0x1f0bf1['currentReply']['appendContent'](_0x56a60f['content'],_0x56a60f['documentId']);break;}case'url':_0x4a1e8a['push'](_0x56a60f);break;case'mcp-tool-result':{const {data:_0x484727,attributes:_0x52d51b}=JSON['parse'](_0x56a60f['content']);_0x1f0bf1['_handleToolResultData']({'toolName':_0x56a60f['toolName'],'data':_0x484727,'attributes':_0x52d51b});break;}}'cancelled'===_0x21be28['status']&&this['fire']('error',{'interactionId':_0x1f0bf1['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x5a72dd};}async['_resumeStream'](_0x24fe23){if(this['currentInteraction'])try{const _0x2de0e7=this['connector']['resumeStream'](this['id'],_0x24fe23);await this['currentInteraction']['resume'](_0x2de0e7);}catch(_0x5d815f){_0x5d815f instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x5d815f});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0xca9005){return _0xca9005['content']?this['chatContext']['populateFromMessage'](_0xca9005['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x336fe3,attributes:_0x575ea2}){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 _0x400206=new Map(this['getPendingContextItems']()),_0x1cf8bb=this['chatCapabilities']['getCapabilitiesConfig'](),_0x26521c=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x336fe3,'contextItems':_0x400206,'capabilities':_0x1cf8bb,'modelId':_0x26521c,'attributes':_0x575ea2,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x52504b){if(_0x52504b instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x52504b});else{const _0xb80c4a=In['get'](_0x52504b['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0xb80c4a,null,{'error':_0x52504b})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x20eb34,contextItems:_0x55b7db,capabilities:_0x484b35,modelId:_0xf0a0cc,attributes:_0x4d2559,channelsToEditors:_0x4f0ccc}){const _0x2353d6=new fn({'userMessage':_0x20eb34,'contextItems':_0x55b7db,'capabilities':_0x484b35,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0xf0a0cc,'attributes':_0x4d2559,'channelsToEditors':_0x4f0ccc});return _0x2353d6['delegate'](...gn)['to'](this),this['interactions']['push'](_0x2353d6),this['fire']('interactionCreated',_0x2353d6),_0x2353d6;}['getInteraction'](_0x4a3b24){return this['interactions']['find'](_0x2a4105=>_0x2a4105['id']===_0x4a3b24);}['removeInteraction'](_0x42f4d1){const _0x274306=this['getInteraction'](_0x42f4d1);_0x274306&&(_0x274306['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x274306),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x447be8=this['lastInteraction'];_0x447be8?.['conversationId']&&_0x447be8['messageId']&&this['connector']['cancelStream'](_0x447be8['conversationId'],_0x447be8['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x4232b5){this['chatContext']['addCurrentDocumentToContext'](_0x4232b5);}async['updateCurrentDocumentsInContext'](_0x278920){await this['chatContext']['updateCurrentDocuments'](_0x278920);}['toggleAddCurrentDocumentOptionVisibility'](_0xcb215b){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xcb215b);}['_hasSessionMismatch'](_0x1c3539){return!!_0x1c3539&&_0x1c3539['documents']['some'](_0x1244bf=>{const _0x294eea=this['_channelsToEditors']['get'](_0x1244bf['channelId']);return!_0x294eea||_0x1244bf['sessionId']!==this['_getSessionId'](_0x294eea);});}['addSelectionToContext'](_0x267c2c){this['chatContext']['addSelectionToContext'](_0x267c2c);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x259956){this['chatContext']['addFilesToContext'](_0x259956);}['addUrlToContext'](_0x17c617){this['chatContext']['addUrlToContext'](_0x17c617);}['addToolItemToContext'](_0x5ec053){this['chatContext']['addToolItemToContext'](_0x5ec053);}['addResourceToContext'](_0x16b7e2,_0x21e2e5){this['chatContext']['addResourceToContext'](_0x16b7e2,_0x21e2e5);}['loadSourceResources'](_0x35a66c,_0x25e11c,_0x14857c){return this['chatContext']['loadSourceResources'](_0x35a66c,_0x25e11c,_0x14857c);}['removeFromContext'](_0x16ae2e){this['chatContext']['removeFromContext'](_0x16ae2e);}['setWebSearch'](_0x34fbb4){this['chatCapabilities']['setWebSearch'](_0x34fbb4);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x213ff6){this['chatCapabilities']['setReasoning'](_0x213ff6);}['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'](_0x42fa00){_0x42fa00?!0x1===await this['chatModels']['isAvailable'](_0x42fa00)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x42fa00}),_0x42fa00=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x42fa00=(await this['chatModels']['getAvailableModels']())[0x0]),_0x42fa00['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x42fa00,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x42fa00}));}};function Rn({documentSuggestions:_0x3f659d,transform:_0x280a26,documentCompare:_0x2f5d7a,documentCompareOptions:_0x657411}){const _0x357802=new Map();for(const [_0x41cefd,{groups:_0x4d59b1,documentContext:_0x577d61,documentContent:_0x18df14,editor:_0x5a1a43}]of _0x3f659d){const _0x1f09ca=_0x577d61['content'],_0x3a0ea2=_0x577d61['version'],_0x6b76aa=_0x18df14['cloneNode'](!0x0);for(const {changes:_0x4c8e9d}of _0x4d59b1){const _0x4b9a09=_0x4c8e9d['filter'](_0x131215=>'new'!=_0x131215['type'])['map'](_0x36aaa8=>Es('data-id',_0x36aaa8['id'],_0x6b76aa))['filter'](_0x216028=>null!==_0x216028),_0x341eb8=_0x4c8e9d['filter'](_0x2c2013=>'removed'!=_0x2c2013['type'])['map'](_0x38b642=>_0x38b642['node']['cloneNode'](!0x0));let _0x473bb3=null;if(_0x4b9a09['length']){_0x473bb3=_0x4b9a09[0x0]['previousSibling'];for(let _0x4d3355=0x0;_0x4d3355<_0x4b9a09['length'];_0x4d3355++)_0x4e4767(_0x4b9a09[_0x4d3355]);}if(_0x341eb8['length']){_0x473bb3||(_0x4c8e9d[0x0]['anchorId']?_0x473bb3=Es('data-id',_0x4c8e9d[0x0]['anchorId'],_0x6b76aa):(_0x473bb3=_0x341eb8['shift'](),_0x82f7d2(_0x6b76aa,_0x473bb3)));for(let _0x316b4c=0x0;_0x316b4c<_0x341eb8['length'];_0x316b4c++)_0x37093c(_0x473bb3,_0x341eb8[_0x316b4c]),_0x473bb3=_0x341eb8[_0x316b4c];}}const _0x1f56e8=ms(_0x6b76aa),_0x5806ec=_0x2f5d7a['getDiff'](_0x1f09ca,_0x1f56e8,{'targetEditor':_0x5a1a43,'anchor':_0x577d61['rootName'],..._0x657411})['getOperations']();if(_0x280a26){const _0x57b902=_0x5a1a43['model']['document']['history']['getOperations'](_0x3a0ea2),_0x21edba={'document':_0x5a1a43['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x357802['set'](_0x41cefd,_0x456211(_0x5806ec,_0x57b902,_0x21edba)['operationsA']);}else _0x357802['set'](_0x41cefd,_0x5806ec);}return _0x357802;}function On({groups:_0x1aeac1,documentContextContent:_0x1f824e,documents:_0x28a744}){const _0x280db1=new Map();for(const _0x1e93bf of _0x1aeac1){const {documentId:_0x476862}=_0x1e93bf,_0x383828=_0x280db1['get'](_0x476862);if(_0x383828)_0x383828['groups']['push'](_0x1e93bf),_0x383828['indexes']['push'](_0x1e93bf['index']);else{const _0x279e52=_0x28a744['find'](_0x48129e=>_0x48129e['id']===_0x476862),_0x449202=_0x1f824e['get'](_0x476862);if(!_0x279e52||!_0x449202)continue;_0x280db1['set'](_0x476862,{'groups':[_0x1e93bf],'documentContext':_0x279e52,'documentContent':_0x449202,'editor':_0x1e93bf['editor'],'indexes':[_0x1e93bf['index']]});}}return _0x280db1;}function vn(_0x22907d,_0x2a7691){const _0x2c1661=_0x22907d['files']['length']>0x0&&_0x22907d['files']['every'](_0x12fa6b=>_0x12fa6b['type']['startsWith']('image/')),_0xe0b646=_0x22907d['plainText']['trim']()['length']>0x0;if(_0x22907d['files']['length']>0x0&&_0x2a7691['filesEnabled']&&(!_0x2c1661||!_0xe0b646)){const _0x469732=_0x22907d['files']['filter'](_0x35bdbd=>_0x35bdbd['name']);return _0x469732['length']>0x0?{'type':'file','files':_0x469732}:null;}if(_0x2a7691['urlsEnabled']){const _0x4281d8=function(_0x36a8b8){const _0x281ad1=_0x36a8b8['trim']();if(/\s/['test'](_0x281ad1))return null;try{const _0x25d81f=new URL(_0x281ad1);return'http:'!==_0x25d81f['protocol']&&'https:'!==_0x25d81f['protocol']?null:_0x25d81f['toString']();}catch{return null;}}(_0x22907d['plainText']);if(_0x4281d8)return{'type':'url','url':_0x4281d8};}const _0x5ea14a=_0x22907d['forceTextAttachment']?0x1:_0x2a7691['longTextThreshold']??0x1/0x0;if(_0x22907d['plainText']['length']>=Math['max'](_0x5ea14a,0x1)&&_0x2a7691['filesEnabled']){const _0x56bec2=_0x2a7691['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x22907d['plainText']],_0x56bec2,{'type':'text/plain'})]};}return null;}var kn=class extends _0x7ceac6{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,nn,_0x4568e8];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=ln(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichat'),this['_aiChatModels']=new Qs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x278a78=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0xf53c08,_0x4623cc)=>{this['_handleUIUserMessage']({'message':_0x4623cc});}),this['listenTo'](_0x278a78['view'],'change:activeTab',(_0x5d14d3,_0x4c25e3,_0x292669)=>{'chat'!==_0x292669&&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',(_0x52c32d,_0x5d973d)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x5d973d));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x294efd,_0x16e9a8)=>{this['activeConversation']?.['addUrlToContext'](_0x16e9a8);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x45e000,_0x456931)=>{const _0x47b9c0=this['activeConversation'];if(!_0x47b9c0)return;_0x456931['hasDirectory']&&(_0x456931['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x3bb454=vn(_0x456931,{'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')});_0x3bb454&&(_0x456931['preventDefault'](),'url'===_0x3bb454['type']?_0x47b9c0['addUrlToContext'](_0x3bb454['url']):_0x47b9c0['chatContext']['addFilesToContext'](_0x3bb454['files'],void 0x0,_0x3bb454['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x7c705c,_0xcb8c34)=>{_0xcb8c34['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x90b54,_0x328676)=>{this['activeConversation']?.['addResourceToContext'](_0x328676['source'],_0x328676['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x442520,_0x5ef0a0)=>{this['_removeFromContext'](_0x5ef0a0);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x3cc5dd,_0x389b36)=>{this['activeConversation']?.['loadSourceResources'](_0x389b36['sourceId'],_0x389b36['query'],_0x389b36['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x3d6766,_0xc5a020)=>{this['activeConversation']?.['setModel'](_0xc5a020);}),this['listenTo'](this['_aiChatUi'],'like',(_0xa064d2,{replyId:_0x317f71})=>{console['log']('Liked\x20response',_0x317f71);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x1459bd,{replyId:_0x1f94af})=>{console['log']('Disliked\x20response',_0x1f94af);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x3d3d56,_0x4b171d)=>{this['_insertSuggestion'](_0x4b171d);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x1509f1,{replyId:_0x3c4a12,partIndex:_0x268ffc})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x3c4a12,_0x268ffc);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x11b77d,{replyId:_0x28985b,partIndex:_0x13e8a2})=>{const _0x37b144=this['_getDocumentRangeForReplyChanges'](_0x28985b,_0x13e8a2);if(!_0x37b144)return;const {reply:_0x55ba1b}=this['getInteractionAndReplyById'](_0x28985b);'$graveyard'!=_0x37b144['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x55ba1b['changeGroups'][_0x13e8a2]['editor'],'ranges':[_0x37b144['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x5ad3f5,_0x1d143b)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x1d143b);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x4dfd7d,{replyId:_0x17a63e,showDiff:_0x23d4a3})=>{const {interaction:_0x475da6,reply:_0x4c52a0}=this['getInteractionAndReplyById'](_0x17a63e),_0x31dcd2=_0x4c52a0['getContentParts']({'showDiff':_0x23d4a3});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x475da6['id']+':'+_0x4c52a0['id'],'parts':_0x31dcd2});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x30e506,{replyId:_0x1f375d,partIndex:_0x5bf157})=>{this['_rejectSuggestion']({'replyId':_0x1f375d,'partIndex':_0x5bf157}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x427abe,_0x4c1398)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4c1398);}),this['on']('replyCreated',(_0x47096f,_0x29ae8f)=>{this['_addFeedItemReply'](_0x29ae8f);});}['afterInit'](){this['context']instanceof _0x3d3542?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x4b3c33,_0x348e39)=>{_0x348e39['on']('ready',()=>{this['_integrateEditor'](_0x348e39);});}),this['_initConversation']();}async['_initConversation'](){const _0xbb4eb0=this['context']['config']['get']('ai.chat.initialConversation');let _0x3e3772=_0xbb4eb0;('lastCreated'!=_0xbb4eb0||(_0x3e3772=await this['_getLastCreatedConversationId'](),_0x3e3772))&&('new'==_0x3e3772?await this['_startConversationSafely']():await this['loadConversation'](_0x3e3772));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x4d7228){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'](_0x4d7228)['getConversation'](),await this['_startConversationSafely']({'id':_0x4d7228}),await this['activeConversation']['load'](_0x4d7228),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x57ad7f){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x4d7228}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x57ad7f),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x170e0b){let _0x245468=null,_0x3a5294=null;this['on']('toolDataReceived',(_0x4d173f,_0x296b89,_0x2b3585)=>{_0x2b3585['id']!==_0x245468&&(_0x245468=_0x2b3585['id'],_0x3a5294=this['_getAIChatFeedAPI'](_0x2b3585)),_0x170e0b(_0x296b89,_0x3a5294);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x1af021){const _0x4eed55=this['_aiEditing']['getSelectionText'](_0x1af021);this['activeConversation']?.['addSelectionToContext'](_0x4eed55),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x3980a1){await this['_startConversationSafely']({'modelId':_0x3980a1?.['modelId']});}async['sendMessage'](_0x3d7e69){await this['_handleUIUserMessage'](_0x3d7e69);}['getGroupId'](){const _0x5d85fb=this['context']['config']['get']('collaboration.channelId');if(!_0x5d85fb)throw new ht('ai-missing-channel-id',this);return _0x5d85fb;}['_handleRemovedConversation'](_0x2a265e){this['activeConversation']['id']===_0x2a265e&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x4e9004){const {reply:_0x55978a,interaction:_0x2daf3b}=this['getInteractionAndReplyById'](_0x4e9004['replyId']),_0x398f32=void 0x0!==_0x4e9004['partIndex']?[_0x55978a['changeGroups'][_0x4e9004['partIndex']]]:_0x55978a['changeGroups']['filter'](_0x5a02d2=>'pending'==_0x5a02d2['state']);return _0x398f32['map'](_0x1225bf=>_0x55978a['changeGroups']['indexOf'](_0x1225bf))['forEach'](_0x4caed1=>{const _0xd28c7f=this['_getDocumentRangeForReplyChanges'](_0x4e9004['replyId'],_0x4caed1);_0xd28c7f&&'$graveyard'!=_0xd28c7f['range']['root']['rootName']?(_0x55978a['setChangeGroupState'](_0x4caed1,'accepted'),void 0x0!==_0x4e9004['partIndex']&&this['_scrollToSuggestionRange'](_0xd28c7f['range'],!0x1,_0xd28c7f['targetEditor'])):_0x55978a['setChangeGroupState'](_0x4caed1,'outdated');}),On({'groups':_0x398f32['filter'](_0x3225d7=>'accepted'===_0x3225d7['state']),'documentContextContent':_0x55978a['documentContextContent'],'documents':_0x2daf3b['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x2e6cb5){const _0x158ce8=this['context']['plugins']['get'](_0x4568e8),{reply:_0x37c64d,interaction:_0x2c9c2}=this['getInteractionAndReplyById'](_0x2e6cb5['replyId']),_0x125dca=this['_prepareDocumentSuggestions'](_0x2e6cb5),_0xd93c76=Rn({'documentSuggestions':_0x125dca,'transform':!0x0,'documentCompare':_0x158ce8,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x314087,_0x2e1232]of _0xd93c76){const {editor:_0x572ed8,indexes:_0x3dea35}=_0x125dca['get'](_0x314087);if(!_0x572ed8['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0x572ed8});continue;}let _0x536967;zs(_0x2e1232,'chat'),_0x572ed8['model']['change'](_0x1943b9=>{_0x536967=_0x1943b9['batch'],_0x572ed8['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2e1232),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x536967,{'interactionId':_0x2c9c2['id'],'replyId':_0x37c64d['id'],'indexes':_0x3dea35});}this['_updateRatings'](_0x37c64d);}['_applySuggestion'](_0x2918b2){const _0x2fee62=this['context']['plugins']['get'](_0x4568e8),{reply:_0x5c698a,interaction:_0x54cb78}=this['getInteractionAndReplyById'](_0x2918b2['replyId']),_0x4a9afc=this['_prepareDocumentSuggestions'](_0x2918b2),_0x43df17=Rn({'documentSuggestions':_0x4a9afc,'transform':!0x0,'documentCompare':_0x2fee62,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x17fffc,_0x1ad4b0]of _0x43df17){const {editor:_0x25d9f4,indexes:_0x251822}=_0x4a9afc['get'](_0x17fffc);let _0xc30716;zs(_0x1ad4b0,'chat');try{_0x25d9f4['model']['change'](_0x3445a2=>{_0xc30716=_0x3445a2['batch'],_0x2fee62['applyOperations'](_0x3445a2,_0x1ad4b0);}),this['_batchToChanges']['set'](_0xc30716,{'interactionId':_0x54cb78['id'],'replyId':_0x5c698a['id'],'indexes':_0x251822});}catch(_0xb573e1){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0xb573e1})),_0xb573e1;}}this['_updateRatings'](_0x5c698a);}['_rejectSuggestion'](_0x204691){const {reply:_0x1fa70a}=this['getInteractionAndReplyById'](_0x204691['replyId']);_0x1fa70a['setChangeGroupState'](_0x204691['partIndex'],'rejected');}['_openBalloonFor'](_0x3b8dad,_0x59e1da){if(!this['_hasAIChatBalloon'])return;const {reply:_0x46d0a8}=this['getInteractionAndReplyById'](_0x3b8dad),_0x2b6c32=_0x46d0a8['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x2b6c32['length'])return;let _0x20e9d3,_0x1e584b;if(void 0x0!==_0x59e1da?(_0x1e584b=_0x2b6c32['find'](_0x2368ee=>_0x2368ee['index']==_0x59e1da),_0x20e9d3=_0x1e584b?.['index']):(_0x1e584b=_0x2b6c32[0x0],_0x20e9d3=_0x1e584b['index']),!_0x1e584b)return void _0x46d0a8['setChangeGroupState'](_0x59e1da??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x3b8dad&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x20e9d3)return;const _0x326d5b=this['_getUserPresentableContentPartDocumentRange'](_0x3b8dad,_0x46d0a8,_0x1e584b),_0x175b2c=_0x46d0a8['changeGroups']['find'](_0x351f14=>_0x351f14['index']==_0x20e9d3)['editor'],_0xc5a2d9=_0x175b2c['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0xc5a2d9&&this['_activeBalloon']['close'](),!_0x326d5b)return _0xc5a2d9['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xc5a2d9,this['_currentPreviewedChangeGroup']={'replyId':_0x3b8dad,'partIndex':_0x20e9d3},this['_scrollToSuggestionRange'](_0x326d5b,!0x0,_0x175b2c);const _0x35d32c=this['_getPresentableSiblingContentPartIndex'](_0x3b8dad,_0x20e9d3,'next');_0xc5a2d9['clearContent'](),_0xc5a2d9['updateContent']({'part':_0x1e584b,'renderingStrategy':'static'}),_0xc5a2d9['open']({'index':_0x20e9d3,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x20e9d3+0x1)['toString']()),'showRotator':null!==_0x35d32c,'ranges':[_0x326d5b],'areActionsDisabled':_0x46d0a8['areActionsDisabled'],'targetEditor':_0x175b2c}),_0xc5a2d9['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x3b8dad,_0x20e9d3),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x3b8dad,'index':_0x20e9d3,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x181434,_0x2a1dcd,_0x394294){const {reply:_0x2073b7}=this['getInteractionAndReplyById'](_0x181434),_0x5211f5=_0x2073b7['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x5211f5['length'])return null;const _0x1f3cbf='next'==_0x394294?0x1:-0x1;function _0x15a301(_0x47730a){const _0x5d3fea=(_0x47730a+_0x1f3cbf+_0x5211f5['length'])%_0x5211f5['length'];return{'siblingIndex':_0x5d3fea,'siblingPart':_0x5211f5[_0x5d3fea]};}const _0xb25656=_0x5211f5['findIndex'](_0x2a1938=>_0x2a1938['index']==_0x2a1dcd);let {siblingIndex:_0x5c52f2,siblingPart:_0x580b9b}=_0x15a301(_0xb25656);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x181434,_0x2073b7,_0x580b9b);)if({siblingIndex:_0x5c52f2,siblingPart:_0x580b9b}=_0x15a301(_0x5c52f2),_0x5c52f2===_0xb25656)return null;return _0x580b9b['index'];}['_getUserPresentableContentPartDocumentRange'](_0x3dac77,_0x50ff8b,_0x521db1){const _0x397027=_0x50ff8b['changeGroups'];if(!_0x521db1['hasChanges'])return null;const _0xccde85=_0x397027['find'](_0x2b134e=>_0x2b134e['index']==_0x521db1['index']);if('pending'!==_0xccde85?.['state'])return null;if(!_0xccde85?.['editor']||'destroyed'===_0xccde85['editor']['state'])return _0x50ff8b['setChangeGroupState'](_0x521db1['index'],'outdated'),null;const _0x589c2e=this['_getDocumentRangeForReplyChanges'](_0x3dac77,_0x521db1['index']);if(!_0x589c2e)return _0x50ff8b['setChangeGroupState'](_0x521db1['index'],'outdated'),null;const {range:_0x2b266a,currentIndex:_0xfb6352}=_0x589c2e;return'$graveyard'==_0x2b266a['root']['rootName']?(_0x50ff8b['setChangeGroupState'](_0xfb6352,'outdated'),null):_0x589c2e['range'];}['_getDocumentRangeForReplyChanges'](_0x582b5f,_0x4a5535){const {reply:_0x14fcae,interaction:_0x1a2bb2}=this['getInteractionAndReplyById'](_0x582b5f),_0x21d194=_0x14fcae['changeGroups']['filter'](_0x43066c=>'pending'==_0x43066c['state']),_0x5a4a8b=_0x21d194['map'](_0x3c901a=>_0x14fcae['changeGroups']['indexOf'](_0x3c901a));void 0x0===_0x4a5535&&(_0x4a5535=_0x5a4a8b[0x0]);const _0x2dfd07=_0x5a4a8b['indexOf'](_0x4a5535);if(-0x1==_0x2dfd07)return null;const _0x4fa8b5=_0x21d194[_0x2dfd07],_0x42012d=_0x4fa8b5['editor'];if(!_0x42012d||'destroyed'===_0x42012d['state'])return null;if(!_0xc7c2a1(_0x42012d,_0x4fa8b5['rootName']))return null;const _0x1b37e6=_0x14fcae['documentContextContent']['get'](_0x4fa8b5['documentId']),_0xa8da32=new _0x37a11f([]),_0x537eec=new _0x37a11f([]);for(const _0x1882f8 of _0x4fa8b5['changes'])if('removed'!=_0x1882f8['type']&&_0x537eec['children']['push'](_0x1882f8['node']['cloneNode'](!0x0)),'new'!=_0x1882f8['type']){const _0x29ea82=ti(_0x67452d=>fs(_0x67452d,'data-id')==_0x1882f8['id'],_0x1b37e6,!0x0);_0xa8da32['children']['push'](_0x29ea82['cloneNode'](!0x0));}if(0x0==_0xa8da32['children']['length']){if(_0x4fa8b5['changes'][0x0]['anchorId']){const _0x49a17b=Es('data-id',_0x4fa8b5['changes'][0x0]['anchorId'],_0x1b37e6);_0xa8da32['children']['unshift'](_0x49a17b['cloneNode'](!0x0)),_0x537eec['children']['unshift'](_0x49a17b['cloneNode'](!0x0)),_0x49a17b['nextSibling']&&(_0xa8da32['children']['push'](_0x49a17b['nextSibling']['cloneNode'](!0x0)),_0x537eec['children']['push'](_0x49a17b['nextSibling']['cloneNode'](!0x0)));}else{const _0x11fb9c=_0x1b37e6['children'][0x0];if(!_0x11fb9c)return null;_0xa8da32['children']['push'](_0x11fb9c['cloneNode'](!0x0)),_0x537eec['children']['push'](_0x11fb9c['cloneNode'](!0x0));}}const _0x2b0bc2=_0x1a2bb2['getDocumentContext'](),_0x5c15f3=_0x2b0bc2['documents']['find'](_0x478fa5=>_0x478fa5['id']==_0x4fa8b5['documentId'])['content'],_0x1bba01=_0x42012d['model']['document']['getRoot'](_0x4fa8b5['rootName']),_0x539643=_0x42012d['data']['parse'](_0x5c15f3,_0x1bba01),_0x65e76e=ms(_0xa8da32),_0x1a1781=_0x42012d['data']['parse'](_0x65e76e,_0x1bba01),_0x41d26c=_0x42012d['data']['parse'](_0x65e76e,_0x1bba01),_0x5809d7=_0x42012d['model']['createPositionAt'](_0x1a1781,0x0),_0x3a4fc0=ms(_0x537eec),_0x58d827={'targetEditor':_0x42012d,'anchor':_0x5809d7,'markDeletions':!0x1};let _0x1a79c1;try{_0x1a79c1=_0x42012d['plugins']['get'](_0x4568e8)['getDiff'](_0x65e76e,_0x3a4fc0,_0x58d827)['getOperations']();}catch(_0x4ef08b){return this['_reporter']['reportError'](new sn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x4ef08b,'context':{'replyId':_0x582b5f,'partIndex':_0x4a5535}})),null;}if(!_0x1a79c1['length'])return null;_0x42012d['model']['change'](_0x17d431=>{for(const _0x227e5a of _0x1a79c1)if('remove'==_0x227e5a['type']){const _0x3ddf19=_0x227e5a['sourcePosition'],_0x2e4ee7=_0x227e5a['howMany'],_0x41b308=new _0x521b81(_0x3ddf19,_0x2e4ee7);_0x17d431['batch']['addOperation'](_0x41b308),_0x42012d['model']['applyOperation'](_0x41b308);}else'marker'!==_0x227e5a['type']&&(_0x227e5a['baseVersion']=null,_0x227e5a['isDocumentOperation']=!0x1,_0x17d431['batch']['addOperation'](_0x227e5a),_0x42012d['model']['applyOperation'](_0x227e5a));});const _0x2da00a=Gs(_0x42012d,_0x1a79c1,_0x1a1781);Ks(_0x42012d['model'],_0x2da00a);const _0x2af6b6=_0x2da00a['getFirstRange']()['start']['path']['slice'](),_0x54e9b1=_0x2da00a['getFirstRange']()['end']['path']['slice'](),_0x5b978d=[];let _0x59dc09=_0x1a1781,_0x2061bd=_0x41d26c;for(let _0x38c446=0x0;_0x38c446<_0x54e9b1['length'];_0x38c446++){const _0x512339=_0x59dc09['maxOffset']-_0x54e9b1[_0x38c446];_0x5b978d[_0x38c446]=_0x2061bd['maxOffset']-_0x512339,_0x59dc09=_0x59dc09['getChildAtOffset'](_0x54e9b1[_0x38c446]),_0x2061bd=_0x2061bd['getChildAtOffset'](_0x5b978d[_0x38c446]);}const _0x580d7f=_0x42012d['model']['createRange'](_0x42012d['model']['createPositionFromPath'](_0x41d26c,_0x2af6b6),_0x42012d['model']['createPositionFromPath'](_0x41d26c,_0x5b978d)),_0x331bd0=_0x41d26c['getChild'](0x0)['getAttribute'](_0x9dc3c8),_0x247015=Array['from'](_0x539643['getChildren']())['find'](_0x4bab65=>_0x4bab65['getAttribute'](_0x9dc3c8)==_0x331bd0)['getPath'](),_0x4c89c8=_0x580d7f['start']['path']['slice'](),_0x9b9780=_0x580d7f['end']['path']['slice']();_0x4c89c8[0x0]=_0x247015[0x0]+_0x4c89c8[0x0],_0x9b9780[0x0]=_0x247015[0x0]+_0x9b9780[0x0];let _0x171e98=_0x42012d['model']['createRange'](_0x42012d['model']['createPositionFromPath'](_0x42012d['model']['document']['getRoot'](_0x4fa8b5['rootName']),_0x4c89c8),_0x42012d['model']['createPositionFromPath'](_0x42012d['model']['document']['getRoot'](_0x4fa8b5['rootName']),_0x9b9780));const _0xc7eb21=_0x2b0bc2['documents']['find'](_0x36a724=>_0x36a724['id']==_0x4fa8b5['documentId'])['version'],_0x57eae1=_0x42012d['model']['document']['history']['getOperations'](_0xc7eb21);for(const _0x258772 of _0x57eae1)_0x171e98=_0x156cfa['_createFromRanges'](_0x171e98['getTransformedByOperation'](_0x258772));return{'range':_0x171e98,'currentIndex':_0x4a5535,'targetEditor':_0x42012d};}['_integrateEditorBalloon'](_0x3193f7){if(!_0x3193f7['plugins']['has']('AIChatBalloon'))return;const _0x20cd77=_0x3193f7['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x20cd77['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x20cd77,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x432132,partIndex:_0x5a2de8}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x101f4b}=this['getInteractionAndReplyById'](_0x432132),_0x186037=_0x101f4b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x5a2de8});_0x20cd77['updateContent']({'part':_0x186037[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x20cd77,'applySuggestion',()=>{const {replyId:_0xa9e19d,partIndex:_0x2b7096}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0xa9e19d,'partIndex':_0x2b7096}),_0x20cd77['setState']('accepted');}),this['listenTo'](_0x20cd77,'insertSuggestion',()=>{const {replyId:_0x9003f3,partIndex:_0x5831a6}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x9003f3,'partIndex':_0x5831a6}),_0x20cd77['setState']('accepted');}),this['listenTo'](_0x20cd77,'rejectSuggestion',()=>{const {replyId:_0x46a293,partIndex:_0x39851b}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x46a293,'partIndex':_0x39851b}),_0x20cd77['setState']('rejected');}),this['listenTo'](_0x20cd77,'showNext',()=>{const {replyId:_0x597fdf,partIndex:_0x1e9d9b}=this['_currentPreviewedChangeGroup'],_0x1e5aa2=this['_getPresentableSiblingContentPartIndex'](_0x597fdf,_0x1e9d9b,'next');null!==_0x1e5aa2&&this['_openBalloonFor'](_0x597fdf,_0x1e5aa2);}),this['listenTo'](_0x20cd77,'showPrevious',()=>{const {replyId:_0x73be98,partIndex:_0x414114}=this['_currentPreviewedChangeGroup'],_0x1b4738=this['_getPresentableSiblingContentPartIndex'](_0x73be98,_0x414114,'previous');null!==_0x1b4738&&this['_openBalloonFor'](_0x73be98,_0x1b4738);}),this['listenTo'](_0x20cd77,'dialogClosed',(_0x15c2ee,{id:_0x384481})=>{if('aiChatBalloon'!==_0x384481)return;const {replyId:_0x1d71e2,partIndex:_0x4169f2}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x1d71e2,'index':_0x4169f2,'isActive':!0x1}),this['_activeBalloon']===_0x20cd77&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x37f783){if(this['_channelsToEditors']['set'](_0x37f783['config']['get']('collaboration.channelId'),_0x37f783),this['_integrateEditorBalloon'](_0x37f783),this['addCurrentDocumentToChatContext'](),_0x37f783['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x37f783['plugins']['has']('Undo')){const _0x16ca8b=_0x37f783['commands']['get']('undo'),_0x27a6b1=_0x37f783['commands']['get']('redo');this['listenTo'](_0x16ca8b,'revert',(_0x546148,_0x15b25e,_0x4b12b4)=>{const _0x328535=this['_batchToChanges']['get'](_0x15b25e);if(!_0x328535)return;const _0xa71c8c=this['activeConversation']['getInteraction'](_0x328535['interactionId']),_0x3a76aa=_0xa71c8c?.['getReply'](_0x328535['replyId']);this['_batchToChanges']['delete'](_0x15b25e),_0xa71c8c&&_0x3a76aa&&(_0x328535['indexes']['forEach'](_0x5e871a=>_0x3a76aa['setChangeGroupState'](_0x5e871a,'pending')),this['_batchToChanges']['set'](_0x4b12b4,_0x328535));}),this['listenTo'](_0x27a6b1,'revert',(_0x11ff92,_0x326a37,_0x11bae6)=>{const _0x500775=this['_batchToChanges']['get'](_0x326a37);if(!_0x500775)return;const _0x286aa2=this['activeConversation']['getInteraction'](_0x500775['interactionId']),_0x22e047=_0x286aa2?.['getReply'](_0x500775['replyId']);this['_batchToChanges']['delete'](_0x326a37),_0x286aa2&&_0x22e047&&(_0x500775['indexes']['forEach'](_0x3e0204=>_0x22e047['setChangeGroupState'](_0x3e0204,'accepted')),this['_batchToChanges']['set'](_0x11bae6,_0x500775));});}const _0x55244a=_0x37f783['config']['get']('ai.chat.context');_0x55244a['alwaysAddSelection']&&_0x55244a['document']['enabled']&&this['listenTo'](_0x37f783['model']['document']['selection'],'change:range',(_0x58e937,_0x34a974)=>{_0x34a974['directChange']&&'chat'===_0x37f783['plugins']['get']('AITabs')['view']['activeTab']&&(_0x37f783['model']['hasContent'](_0x37f783['model']['document']['selection'])?this['addSelectionToChatContext'](_0x37f783):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x11c96d=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x1d0768=await _0x11c96d['getConversations']();return _0x1d0768['length']?_0x1d0768[0x0]['id']:'new';}catch(_0x33125e){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':_0x33125e})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x221d91={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x221d91);}catch(_0x4d5d76){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x221d91['id']||vt()}),this['_reporter']['logError'](_0x4d5d76),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x407d3d,modelId:_0x342862}={}){this['_closeActiveBalloon']();let _0xda5f68=_0x342862;_0xda5f68||(_0x407d3d||!this['activeConversation']?_0xda5f68=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0xda5f68=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x2b0137=this['getGroupId'](),_0x5b14e8=_0x407d3d||vt();let _0x17e6c2;this['activeConversation']=new Sn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0xda5f68,'conversationId':_0x5b14e8,'group':_0x2b0137,'locale':this['context']['locale'],'isFromHistory':!!_0x407d3d,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x330aa6=>this['_aiEditing']['getSessionId'](_0x330aa6)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x4ecb17,_0x2161ac)=>{this['_aiChatUi']['createConversation'](_0x2161ac),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x407d3d||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x49d25c,_0x5a8e36)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x5a8e36['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x2d3b72=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x2d3b72);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x3a9251=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x3a9251);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x3ce2d1,_0x3b24b9)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3b24b9,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x1406ac,_0xadf36a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xadf36a,{'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',(_0x4b251c,_0x325e5c)=>{this['_aiChatUi']['removeFeedInteraction'](_0x325e5c['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x2a9f9c,_0x2625cb,_0x2efb38)=>{this['_updateConversationTitle'](_0x2625cb,_0x2efb38);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x2bf607,_0x2d8ed8)=>{void 0x0!==_0x17e6c2&&_0x17e6c2!==_0x2d8ed8['id']&&this['_updateReplyContentThrottled']['flush'](),_0x17e6c2=_0x2d8ed8['id'],_0x2d8ed8['isFromHistory']?await this['_updateReplyContent']({'reply':_0x2d8ed8}):await this['_updateReplyContentThrottled']({'reply':_0x2d8ed8});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x547aeb,{reply:_0x4ca9fb,index:_0x4b9dbf,state:_0x300020})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x4ca9fb['id'],'index':_0x4b9dbf,'state':_0x300020}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x4ca9fb['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4b9dbf&&this['_activeBalloon']?.['setState'](_0x300020);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x50ab86,_0x2dcbc5)=>{if(this['_aiChatUi']['addContextItem'](_0x2dcbc5['contextItem'],_0x2dcbc5['isLoading']),'selection'===_0x2dcbc5['contextItem']['type']){const _0x160e0f=_s(this['context']),_0x56fdba=[..._0x160e0f['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x160e0f,'ranges':_0x56fdba,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0xd8f244,_0x4eeb11)=>{this['_aiChatUi']['removeContextItem'](_0x4eeb11['uiId']),'current-document'==_0x4eeb11['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x4eeb11['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x571a74,_0x2b4409)=>{this['_aiChatUi']['setContextItemLoading'](_0x2b4409['contextItem']['uiId'],_0x2b4409['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x52a754,_0x3e803e)=>{this['_aiChatUi']['setConversationContext'](_0x3e803e['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x3d8a92,_0x18d22e)=>{this['_aiChatUi']['setAddContextOptions'](_0x18d22e['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x3feda8,_0x277041)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x277041['sourceId'],_0x277041['source'],_0x277041['resources'],_0x277041['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x1efc3e,_0x4cd4bd)=>{this['_aiChatUi']['updateResourceState'](_0x4cd4bd['sourceId'],_0x4cd4bd['resourceId'],_0x4cd4bd['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x105fc0,_0x24b776)=>{this['_aiChatUi']['updateCapabilities'](_0x24b776);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x5ec57a,_0x450151)=>{try{const _0x3a0b21=(await this['_aiChatModels']['getAll']())['find'](_0x4384f0=>_0x4384f0['id']===_0x450151['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x3a0b21,_0x450151['isDisabled']);}catch(_0x146365){this['_reporter']['logError'](new sn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x146365}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x539bff,{error:_0x31a6e8,interactionId:_0x512af0,fileName:_0x55b395,url:_0x1d05c3,sourceId:_0x468136,sourceLabel:_0x1e10f4})=>{const _0x3367af=_0x512af0?_0x512af0+':'+vt():vt();this['_reporter']['reportError'](_0x31a6e8),_0x31a6e8['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-conversation-init-failed')||_0x31a6e8['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x55b395),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x1d05c3),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x468136&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x468136),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x1e10f4||'source'),'id':_0x3367af})):_0x31a6e8['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3367af}):_0x31a6e8['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3367af}):_0x31a6e8['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':_0x3367af}):_0x31a6e8['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':_0x3367af}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3367af});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x407d3d||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x3e833a,attributes:_0x38c9f9}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x2b2212=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x2b2212);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x3e833a,'attributes':_0x38c9f9});}['_removeFromContext'](_0x2896f0){this['activeConversation']?.['removeFromContext'](_0x2896f0);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x153b20){const [_0x1fe6fc,_0x144574]=_0x153b20['split'](':'),_0x3a0c7b=this['activeConversation']['getInteraction'](_0x1fe6fc);return{'interaction':_0x3a0c7b,'reply':_0x3a0c7b['getReply'](_0x144574)};}['_scrollToSuggestionRange'](_0x1e303a,_0x5fdc34=!0x1,_0x5e123e){const _0x59d8e3={'target':_0x5e123e['editing']['view']['domConverter']['viewRangeToDom'](_0x5e123e['editing']['mapper']['toViewRange'](_0x1e303a)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x5fdc34};_0x5fdc34&&(_0x59d8e3['alignToTop']=!0x0),Rt(_0x59d8e3);}['_updateConversationTitle'](_0x1b22b4,_0x21a772=!0x1){this['_aiChatUi']['setConversationTitle'](_0x1b22b4||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x21a772);}['_addFeedItemReply'](_0x1f1b32){'text'===_0x1f1b32['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x1f1b32):this['_aiChatUi']['addFeedItemAISuggestion'](_0x1f1b32);}async['_updateReplyContent']({reply:_0x1baffb,renderingStrategy:_0x38b3d2}){const {id:_0x588654,interactionId:_0x229673,isDone:_0x57a4be,type:_0x180109,parsedContent:_0x5ecf79}=_0x1baffb,_0x5e70ea=_0x229673+':'+_0x588654;if('modification'===_0x180109){const _0x5e756a=_0x1baffb['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5e70ea,'parts':_0x5e756a,'isDone':_0x57a4be,'skipLoadingEffects':_0x1baffb['isFromHistory']});}else'text'===_0x180109&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x5e70ea,'parsedContent':_0x5ecf79['get']('text'),'renderingStrategy':_0x38b3d2,'isDone':_0x57a4be});_0x57a4be&&_0x1baffb['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x5e70ea,_0x1baffb['sources']);}['_updateReplyContentThrottled']=_0x271436(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x49eadf=this['activeConversation']?.['lastInteraction'];_0x49eadf&&(_0x49eadf['stop'](),this['_aiChatUi']['stopInteraction'](_0x49eadf)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0xfddb7d=this['activeConversation']?.['lastInteraction'];if(_0xfddb7d){for await(const _0x4e359f of _0xfddb7d['replies'])this['_aiChatUi']['hasFeedItem'](_0x4e359f['id'])||this['_addFeedItemReply'](_0x4e359f),await this['_updateReplyContent']({'reply':_0x4e359f,'renderingStrategy':'static'});}}['_updateRatings'](_0x225c5c){const _0x3cf7ff={'positiveCount':_0x225c5c['changeGroups']['filter'](_0x529cf4=>'accepted'===_0x529cf4['state'])['length'],'totalCount':_0x225c5c['changeGroups']['length'],'modificationId':_0x225c5c['id']},_0x171d3b=this['activeConversation']['getInteraction'](_0x225c5c['interactionId'])['messageId'];_0x171d3b&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x171d3b,_0x3cf7ff);}['_getAIChatFeedAPI'](_0x17a059){const _0x326d78=this['_aiChatUi'],_0x38c0ed=()=>{_0x17a059['resetWebSearchState'](),_0x17a059['resetReasoningState'](),_0x326d78['clearLoadingMessage']();},_0xe5038c=()=>{_0x17a059['currentReply']&&(_0x17a059['currentReply']['done'](),_0x17a059['currentReply']=void 0x0);};return{'insertTextReply':(_0x475314,_0x561dcd)=>{_0xe5038c(),_0x38c0ed();const _0xd70f13=_0x17a059['currentReply']=_0x17a059['createReply']({'type':'text','interactionId':_0x17a059['id'],'id':_0x561dcd||vt(),'channelsToEditors':this['_channelsToEditors']});return _0xd70f13['appendContent'](_0x475314),_0xe5038c(),_0xd70f13;},'insertCustomElement':async(_0x21f93a,_0x5cb8ca)=>(_0xe5038c(),_0x38c0ed(),_0x326d78['addFeedItemCustomElement'](_0x21f93a,_0x5cb8ca||vt())),'setLoadingMessage':_0x34d6a8=>{_0x326d78['setLoadingMessage'](_0x34d6a8);},'clearLoadingMessage':()=>{_0x326d78['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x5cd887=>'destroyed'!==_0x5cd887['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Nn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],yn=[...Nn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function xn(_0x5eb600){const _0x338666=new AbortController();return{'promise':new Promise((_0x497a20,_0x4cf3ab)=>{const _0x501c45=setTimeout(_0x497a20,_0x5eb600);_0x338666['signal']['addEventListener']('abort',()=>{clearTimeout(_0x501c45),_0x4cf3ab();});}),'abortController':_0x338666};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x648ed){this['options']={'delay':_0x648ed?.['delay']??0xa,'textNodeStyle':_0x648ed?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x1bfd43,targetElement:_0x3d8174,abortSignal:_0x3d0c87}){this['isStreaming']&&this['stop'](),_0x3d0c87?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0xe09a37(_0x1bfd43,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x145ebc=0x0;_0x145ebc<this['currentIndex'];_0x145ebc++)this['nodesList'][_0x145ebc]['shouldBeStreamed']=!0x0;do{const _0x35bb83=Date['now'](),_0x440b2f=this['nodesList'][this['currentIndex']],_0x182e0c=_0x35bb83-this['lastUpdateTime'];if(_0x440b2f){_0x440b2f['shouldBeStreamed']=!0x0;let _0xf28f78=_0x440b2f['parent'];for(;_0xf28f78;)_0xf28f78['shouldBeStreamed']=!0x0,_0xf28f78=_0xf28f78['parent'];}if(_0x182e0c<this['options']['delay'])try{const {promise:_0x435487,abortController:_0x428c5c}=xn(this['options']['delay']-_0x182e0c);this['timeoutAbortController']=_0x428c5c,await _0x435487;}catch(_0x3737d4){return;}_0x3aceaf(_0x3d8174,'<'+_0x3d8174['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x3d8174['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:_0xdae78b}){Array['from'](_0xdae78b['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x2eff6a=>{_0x2eff6a['replaceWith'](_0x2eff6a['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x1b3493){let _0x324432='';if(function(_0x487bfe){return _0x9a518f(_0x487bfe);}(_0x1b3493)){for(const _0x1e0dec of _0x1b3493['children'])_0x324432+=this['renderNode'](_0x1e0dec);}else{if(Hn(_0x1b3493)){if(!_0x1b3493['shouldBeStreamed'])return'';const _0x46cb53=_0x1b3493,_0x1a6e2a=Object['entries'](_0x46cb53['attribs'])['map'](([_0x213ae4,_0x1e6c50])=>_0x213ae4+'=\x22'+_0x1e6c50+'\x22')['join']('\x20');_0x324432+='<'+_0x46cb53['tagName']+(_0x1a6e2a?'\x20'+_0x1a6e2a:'')+'>';for(const _0x33a946 of _0x52c55b(_0x46cb53))_0x324432+=this['renderNode'](_0x33a946);_0x324432+='</'+_0x46cb53['tagName']+'>';}else{if(!Pn(_0x1b3493))return'';if(!_0x1b3493['shouldBeStreamed'])return'';!function(_0x35581e){return!(!_0x35581e['parent']||!Hn(_0x35581e['parent']))&&(!!Dn['includes'](_0x35581e['parent']['tagName'])&&!_0xdcf064(_0x35581e)['match'](/^\s*[<>]\s*$/));}(_0x1b3493)?_0x324432+=_0x12c7a7(_0x1b3493):_0x324432+=_0x12c7a7(new _0x597b04('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x1b3493]));}}return _0x324432;}['getParsedDocumentNodeList'](){const _0x22cd33=[];return function(_0x1d7d11,_0x23ad65){const _0x1d77ff=_0x163e8b=>{if(_0x23ad65(_0x163e8b),_0x163e8b instanceof _0x20b480)for(let _0x54562a=0x0;_0x54562a<_0x163e8b['children']['length'];_0x54562a++){const _0x553feb=_0x163e8b['children'][_0x54562a];_0x1d77ff(_0x553feb);}};for(let _0x34e184=0x0;_0x34e184<_0x1d7d11['children']['length'];_0x34e184++)_0x1d77ff(_0x1d7d11['children'][_0x34e184]);}(this['document'],_0x5aa7d9=>{if(Pn(_0x5aa7d9)){const _0x269976=this['splitTextNodeIntoWordNodes'](_0x5aa7d9);_0x269976['length']&&_0x22cd33['push'](..._0x269976);}_0x5aa7d9['isWordSplitSource']||_0x5aa7d9['isWordSplitResult']||_0x22cd33['push'](_0x5aa7d9);}),_0x22cd33;}['splitTextNodeIntoWordNodes'](_0x466d8d){if(_0x466d8d['isWordSplitSource']||_0x466d8d['isWordSplitResult'])return[];const _0x1502f0=_0xdcf064(_0x466d8d)['match'](/(?:\s*\S+\s*)/g),_0x19c1a0=[];if(_0x1502f0&&_0x1502f0['length']>0x1){for(const _0x3db236 of _0x1502f0){const _0x2773ef=new _0x48552e(_0x3db236);_0x2773ef['isWordSplitResult']=!0x0,_0x22c1dd(_0x466d8d,_0x2773ef),_0x19c1a0['push'](_0x2773ef);}_0x466d8d['isWordSplitSource']=!0x0,_0x4e4767(_0x466d8d);}return _0x19c1a0;}};const Dn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Pn(_0x1c6a02){return _0x59c448(_0x1c6a02);}function Hn(_0xc206a3){return _0x5769a6(_0xc206a3);}function Mn(_0x2fee2f,_0x5e58f8){_0x2fee2f['cleanUpAnimations']({'targetElement':_0x5e58f8}),_0x5e58f8['querySelectorAll']('[data-id]')['forEach'](_0x3b88fc=>{_0x3b88fc['removeAttribute']('data-id');});}var Vn=class extends _0x9561fa{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x14fc66){super();const _0x455630=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x14fc66,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x455630['if']('isDone','ck-ai-chat__feed__item_done'),_0x455630['if']('isVisible','ck-hidden',_0x372938=>!_0x372938),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Mn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x45030d,_0x2e68bb,_0x380cd9){await this['htmlStreamer']['stream']({'document':_0x45030d,'targetElement':_0x2e68bb,'abortSignal':_0x380cd9});}},Un=class extends _0x9561fa{['showChangesToggleView'];constructor(_0x199efe,_0x5a74b1){super(_0x199efe),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x199efe),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+hn,'label':us(_0x199efe,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x5a74b1['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x53cc86=>_0x53cc86?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x2fa100=new Yt();_0x2fa100['content']=_0x43d4dc,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x5a74b1['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x2fa100,{'tag':'span','children':[us(_0x199efe,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x251146,'rejected':_0x4bfdfc,'outdated':_0x4bfdfc};var Fn=class extends _0x9561fa{['stateIconView'];constructor(_0x531a2e){super(_0x531a2e);const _0x97e270=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Kn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x97e270['to']('state',_0x37ff2c=>'ck-ai-suggestion__content-part-state_'+_0x37ff2c),_0x97e270['if']('isVisible','ck-hidden',_0x4d2650=>!_0x4d2650)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x97e270['to']('state',_0x9e377e=>{switch(_0x9e377e){case'accepted':return us(_0x531a2e,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0x531a2e,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0x531a2e,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0xcc4a54){this['state']=_0xcc4a54;}},Kn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x411218{['_applyButton'];['_suggestButton'];constructor(_0x40eb7e,_0x4d5034,_0x1c5ad3){super(_0x40eb7e);const _0xa68902=Boolean(_0x1c5ad3);this['set']('isEnabled',!_0xa68902),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x3a054a=[];if(_0xa68902){const _0x1a5028=new Ht(_0x40eb7e);_0x1a5028['set']({'label':us(_0x40eb7e,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x51052c}),_0x1a5028['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x3a054a['push'](_0x1a5028);}else{_0x4d5034['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0x40eb7e),this['_applyButton']['set']({'label':us(_0x40eb7e,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x251146}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x3047f6=>!_0x3047f6),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x3a054a['push'](this['_applyButton'])),_0x4d5034['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0x40eb7e),this['_suggestButton']['set']({'label':us(_0x40eb7e,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x41639c}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x3a054a['push'](this['_suggestButton']));const _0x37cedf=new Ht(_0x40eb7e);_0x37cedf['set']({'label':us(_0x40eb7e,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4bfdfc}),_0x37cedf['bind']('isEnabled')['to'](this),_0x37cedf['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x3a054a['push'](_0x37cedf);}this['items']['addMany'](_0x3a054a);const _0x5cf72b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x5cf72b['if']('isVisible','ck-hidden',_0xbdd38e=>!_0xbdd38e)]}});}['setButtonsVisibility']({showApplyButton:_0x560200,showSuggestButton:_0x3db336}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x560200),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x3db336);}},Yn=class extends _0x9561fa{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x27a4f4,{part:_0x4df2fc,uiIndex:_0x427e52,availableActions:_0x3e808d,areActionsDisabled:_0x31a5e2}){super(_0x27a4f4),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x27a4f4,_0x3e808d,_0x31a5e2),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x4df2fc['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x4df2fc['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x4df2fc['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x27a4f4),this['titleLabelView']=new $n(_0x27a4f4,_0x427e52),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',(_0x3f8b45,_0x4a7972,_0x148087,_0x3f3ade)=>{'pending'===_0x3f3ade?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x148087?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x148087),this['children']['add'](this['stateView']));});}},$n=class extends _0x9561fa{constructor(_0x84c889,_0x2dee4f){super(_0x84c889),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x84c889,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x2dee4f['toString']())]});}},qn=class extends _0x9561fa{['htmlStreamer'];constructor(_0x2bda5c){super(_0x2bda5c),this['htmlStreamer']=new Ln(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x4ae7a5,renderingStrategy:_0x57b573,abortSignal:_0xb3d3c8}){const _0x452af7=_0xe09a37(_0x4ae7a5['content'],!0x0);for(const _0x4bca71 of ws(_0x452af7))_0x4e4767(_0x4bca71);'streaming'===_0x57b573?await this['htmlStreamer']['stream']({'document':_0x452af7,'targetElement':this['element'],'abortSignal':_0xb3d3c8}):_0x3aceaf(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x452af7)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Mn(this['htmlStreamer'],this['element']);}},Qn=class extends _0x9561fa{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x40071f,{part:_0x2ebb4a,uiIndex:_0x1f86d5,areActionsDisabled:_0x48b901,availableActions:_0x32dc65}){super(_0x40071f);const _0x211d2b=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 _0x21224d=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x48b901;};this['on']('change:state',_0x21224d),this['on']('change:isDone',_0x21224d),_0x21224d(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x40071f,{'part':_0x2ebb4a,'uiIndex':_0x1f86d5,'availableActions':_0x32dc65,'areActionsDisabled':_0x48b901}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x40071f),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x211d2b['to']('state',_0x37a17d=>'ck-ai-suggestion__body__content-part_'+_0x37a17d),_0x211d2b['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x211d2b['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x211d2b['if']('isVisible','ck-hidden',_0x1cc3f9=>!_0x1cc3f9)]},'children':this['_children'],'on':{'mouseenter':_0x211d2b['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x2ebb4a['index']});}),'mouseleave':_0x211d2b['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x2ebb4a['index']});}),'click':_0x211d2b['to'](_0x395a9e=>{const _0x30d176=_0x395a9e['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x30d176)&&this['fire']('showChangeInText',{'index':_0x2ebb4a['index']});})}});}async['updateContent']({part:_0x53b56b,showUnchangedParts:_0x54f764=!0x1,abortSignal:_0x30c314}){this['partDefinition']=_0x53b56b,this['isVisible']=this['partDefinition']['hasChanges']||_0x54f764,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x53b56b,'renderingStrategy':'static','abortSignal':_0x30c314});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x9561fa{constructor(_0x2e5bd0,_0x14939a){super(_0x2e5bd0),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2ff89f=>!_0x2ff89f)]},'children':this['_createSkeletonItems'](_0x14939a)});}['_createSkeletonItems'](_0xcc296d){const _0x45299c=['ck','ck-ai-skeleton__item'];return _0xcc296d['map'](_0x1a143b=>{let _0xefa5d='';switch(_0x1a143b['attributes']['align']){case'right':_0xefa5d='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0xefa5d='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0xefa5d='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x1a143b['tag'],'attributes':{'class':[..._0x45299c,_0x1a143b['attributes']['class']?_0x1a143b['attributes']['class']:''],'style':'width:\x20'+_0x1a143b['attributes']['width']+';\x20height:\x20'+_0x1a143b['attributes']['height']+';'+_0xefa5d}};});}};const zn={'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(_0x130913,_0x251c4d,_0x8de2d8,_0x7a7dd0){return new Array(_0x130913)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x251c4d,'height':_0x8de2d8,'align':_0x7a7dd0}}));}const Jn=/* #__PURE__ -- @preserve */
33
+ ut();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x104efd){const _0x1f2ef3=this['createTask'](_0x104efd);return this['queue']['push'](_0x1f2ef3),this['_processQueue'](),_0x1f2ef3['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(_0x5a71b1=>{this['once']('_queueEmpty',()=>{_0x5a71b1();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x493ac9=this['queue']['shift']();try{await _0x493ac9['callback'](this['_abortController']['signal']),_0x493ac9['resolve']();}catch(_0x5c83b4){_0x493ac9['reject'](_0x5c83b4);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x157063){let _0x239941,_0x23454b;const _0x2be307=new Promise((_0x93af43,_0x2c1374)=>{_0x239941=_0x93af43,_0x23454b=_0x2c1374;});return{'callback':_0x157063,'resolve':_0x239941,'reject':_0x23454b,'completePromise':_0x2be307};}},tr=class extends Vn{constructor(_0x1faf30){super(_0x1faf30),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x1faf30['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x3e5106){this['element']['innerHTML']=_0x3e5106;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x9561fa{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x3ed3fa,_0x4b57b6=[...er],_0x1f2386){super(_0x3ed3fa);const _0x2dcf0c=this['bindTemplate'],_0x585f1b=Boolean(_0x1f2386);if(this['set']('isEnabled',!_0x585f1b),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x585f1b){const _0x5476d7=new Ht(_0x3ed3fa);_0x5476d7['set']({'label':us(_0x3ed3fa,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x51052c}),_0x5476d7['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x374b02=new _0x9561fa(_0x3ed3fa);_0x374b02['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x3ed3fa,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x5476d7]}]}),this['children']['add'](_0x374b02);}else this['_applyChangesButton']=new Ht(_0x3ed3fa),this['_applyChangesButton']['set']({'label':us(_0x3ed3fa,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b57b6['includes']('applySuggestion'),'class':on}),this['_insertSuggestionsButton']=new Ht(_0x3ed3fa),this['_insertSuggestionsButton']['set']({'label':us(_0x3ed3fa,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4b57b6['includes']('insertSuggestion'),'class':an}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2367ae=>{_0x2367ae['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',_0x2dcf0c['if']('isVisible','ck-hidden',_0x4c696f=>!_0x4c696f)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x3717fc){this['isVisible']=_0x3717fc;}['_switchButtonLabelsPlurality'](_0xdb924a){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0xdb924a?(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')));}},sr=class extends _0x9561fa{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x3d7b77,_0x4362ee){super(_0x3d7b77),this['bodyCollection']=_0x4362ee,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',_0x4ea052=>!_0x4ea052)]},'children':this['children']});const _0x45aed0=new _0x9561fa(this['locale']),_0x4571c9=new Yt();_0x4571c9['content']=at,_0x45aed0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x4571c9,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x45aed0),this['_setupBalloonPanel'](_0x3d7b77);}['addSource'](_0x8c86da){this['children']['add'](new nr(this['locale'],_0x8c86da,this['balloonPanelView']));}['_setupBalloonPanel'](_0x327866){this['balloonPanelView']=new yt(_0x327866),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x3c5db0,_0x44d33e,_0x5cec3a){super(_0x3c5db0),this['source']=_0x44d33e,this['balloonPanelView']=_0x5cec3a,this['set']({'label':_0x44d33e['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x3d7de9=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x3d7de9['to'](()=>{window['open'](_0x44d33e['url'],'_blank');}),'mouseenter':_0x3d7de9['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x3d7de9['to'](()=>{this['_hideTooltip']();})}}),_0x44d33e['favicon']){const _0x444dbd=new _0x9561fa(_0x3c5db0);_0x444dbd['setTemplate']({'tag':'img','attributes':{'src':_0x44d33e['favicon']||at,'alt':_0x44d33e['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x444dbd);}else this['set']('icon',at);}['_createTooltipContentView'](_0x29cdab,_0x1bffdb){const _0x303ed5=new _0x9561fa(_0x29cdab),_0x384ab3=[];let _0x841a22;_0x1bffdb?.['favicon']?(_0x841a22=new _0x9561fa(_0x29cdab),_0x841a22['setTemplate']({'tag':'img','attributes':{'src':_0x1bffdb['favicon'],'alt':_0x1bffdb['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x841a22=new Yt(),_0x841a22['content']=at,_0x841a22['extendTemplate']({'attributes':{'alt':_0x1bffdb['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x384ab3['push'](_0x841a22);const _0x710ad2=new _0x9561fa(_0x29cdab);_0x710ad2['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x1bffdb['url']},'children':[{'text':new URL(_0x1bffdb['url'])?.['hostname']}]}),_0x384ab3['push'](_0x710ad2);const _0x2fcbf5=new _0x9561fa(_0x29cdab);_0x2fcbf5['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x384ab3});const _0x31f8d1=new _0x9561fa(_0x29cdab);return _0x31f8d1['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x1bffdb['title']['length']>0x190?_0x1bffdb['title']['substring'](0x0,0x190)+'...':_0x1bffdb['title']}]}),_0x303ed5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x2fcbf5,_0x31f8d1]}),_0x303ed5;}['_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 _0x48fbf2=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x48fbf2);}},rr=class extends _0x9561fa{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x14414f(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x4f6abd,_0x30e902){super(_0x4f6abd);const {areActionsDisabled:_0x122c5c,showUnchangedParts:_0x144332,availableActions:_0x9b1e04}=_0x30e902;this['_areActionsDisabled']=_0x122c5c,this['_showUnchangedParts']=_0x144332,this['_availableActions']=_0x9b1e04,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x4f6abd,zn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Zn(),this['_emptyPartsWarningView']=new tr({'id':'empty-parts-warning','initialContent':us(_0x4f6abd,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x4f6abd,_0x30e902['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x30e902['bodyCollection']),_0x30e902['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Nn)['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'](_0x1c9a38=>_0x1c9a38 instanceof Qn);}async['updateContentParts']({parts:_0xc599d3,abortSignal:_0x1fece6,skipLoadingEffects:_0x25f3bf}){this['_cachedContentParts']['length']?_0xc599d3['forEach'](_0x537c39=>{const _0x2971f3=this['_cachedContentParts']['findIndex'](_0x39b39c=>_0x39b39c['index']==_0x537c39['index']);-0x1===_0x2971f3?this['_cachedContentParts']['push'](_0x537c39):this['_cachedContentParts'][_0x2971f3]=_0x537c39;}):this['_cachedContentParts']=_0xc599d3;const _0x794e8=this['_showUnchangedParts']?_0xc599d3:_0xc599d3['filter'](_0x139377=>_0x139377['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x794e8['length']>0x1),_0x25f3bf&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x8150cf of _0x794e8)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x3a31e6=>{let _0x36daf6=this['getPartView'](_0x8150cf['index']);if(!_0x36daf6){if(_0x36daf6=new Qn(this['locale'],{'part':_0x8150cf,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x36daf6['delegate'](...Nn)['to'](this),_0x36daf6['bind']('isTrackChangesOn')['to'](this),!_0x25f3bf&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x3a31e6),_0x3a31e6['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x36daf6,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x25f3bf||this['_showSkeletonDebounced']();}await _0x36daf6['updateContent']({'part':_0x8150cf,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x3a31e6}),_0x36daf6['markAsDone']();});return _0x1fece6?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x55d35a,_0x19e728){const _0x4e896a=this['getPartView'](_0x55d35a);_0x4e896a&&(_0x4e896a['state']=_0x19e728),this['hasPendingParts']='pending'==_0x19e728||this['_contentPartViews']['some'](_0x36ba14=>'pending'==_0x36ba14['state']);}['setPartActive'](_0x74b2f3,_0x206e5f){if(!0x1===_0x74b2f3){for(const _0x2c4605 of this['_contentPartViews'])_0x2c4605['isActive']=!0x1;}else{const _0x441cb0=this['getPartView'](_0x74b2f3);_0x441cb0&&(_0x441cb0['isActive']=_0x206e5f);}}['updateSources'](_0x1afb0b){_0x1afb0b['forEach'](_0x84a7fc=>this['_sourcesView']['addSource'](_0x84a7fc)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x138553){return this['_contentPartViews']['find'](_0xf51e34=>_0xf51e34['partDefinition']['index']==_0x138553)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x354258=!this['_cachedContentParts']['find'](({hasChanges:_0x327ecb})=>_0x327ecb),_0xf84954=!!this['_cachedContentParts']['find'](({hasChanges:_0x3c23b0})=>!_0x3c23b0);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0xf84954,_0x354258?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'](_0x2573fc=>_0x2573fc['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x1f70a6){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x3a5d37=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x3a5d37>0x0){const {promise:_0x18aa76,abortController:_0x2d0d1a}=xn(_0x3a5d37);_0x1f70a6?.['addEventListener']('abort',()=>_0x2d0d1a['abort']()),await _0x18aa76['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x16f2dc=>_0x16f2dc['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x9561fa{['bodyView'];['children'];['headerView'];constructor(_0x2645f4,_0x2678e2,_0x10f4db){super(_0x2645f4);const {showDiff:_0x2b67f2,areActionsDisabled:_0x48544e,showUnchangedParts:_0x4776bf,availableActions:_0x194d26}=_0x2678e2;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x2645f4,{'showDiff':_0x2b67f2}),this['headerView']['on']('toggleShowChanges',(_0x2c3013,_0x104971)=>{this['areChangesVisible']=_0x104971['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x104971['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x2645f4,{'areActionsDisabled':_0x48544e,'showUnchangedParts':!!_0x4776bf,'availableActions':_0x194d26,'bodyCollection':_0x10f4db}),this['bodyView']['delegate'](...Nn)['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'](_0xc35339){await this['bodyView']['updateContentParts'](_0xc35339);}['updateSources'](_0x44b65c){this['bodyView']['updateSources'](_0x44b65c);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x3402ea,_0x4b70a0,_0x2eba5a){super(_0x4b70a0),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x3402ea,{'showDiff':_0x4b70a0['showDiff'],'areActionsDisabled':_0x4b70a0['areActionsDisabled'],'availableActions':_0x4b70a0['availableActions']},_0x2eba5a),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x338f09,_0x34d939)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x34d939['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',(_0xd6aa96,{index:_0x25dacd})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x25dacd});}),this['containerView']['on']('applySuggestion',(_0x51c06d,{index:_0xa7100c}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0xa7100c});}),this['containerView']['on']('insertSuggestion',(_0x5db0f7,{index:_0x332141}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x332141});}),this['containerView']['on']('rejectSuggestion',(_0x5d06ee,{index:_0xe463c9})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0xe463c9});}),this['containerView']['on']('mouseOverSuggestion',(_0xfd6c97,{index:_0x35626d})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x35626d});}),this['containerView']['on']('mouseLeaveSuggestion',(_0xed28dd,{index:_0x4b05db})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4b05db});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x12ac37){await this['containerView']['updateContent'](_0x12ac37);}['updatePartState'](_0x3e3529,_0x230a7b){this['containerView']['bodyView']['updatePartState'](_0x3e3529,_0x230a7b);}['setPartActive'](_0x8e43d5,_0x4c63f9){!0x1===_0x8e43d5?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x8e43d5,_0x4c63f9);}['updateSources'](_0x5c2a42){this['containerView']['updateSources'](_0x5c2a42);}['getPartView'](_0x342196){return this['containerView']['bodyView']['getPartView'](_0x342196);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x48a53b,_0x12a5f1,_0x5cfc52){super(_0x12a5f1),this['_bodyCollection']=_0x5cfc52,this['locale']=_0x48a53b,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x9561fa(),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:_0x3edd3a,renderingStrategy:_0x5f4312,abortSignal:_0x56cd2f}){'streaming'===_0x5f4312?await this['streamIntoElement'](_0x3edd3a,this['replyContainer']['element'],_0x56cd2f):this['replyContainer']['element']['innerHTML']=_0x12c7a7(_0x3edd3a);}['updateSources'](_0x351cf4){const _0x3cec22=new sr(this['locale'],this['_bodyCollection']);_0x3cec22['children']['addMany'](_0x351cf4['map'](_0x1d1c9e=>new nr(this['locale'],_0x1d1c9e,_0x3cec22['balloonPanelView']))),_0x3cec22['isVisible']=!0x0,this['children']['add'](_0x3cec22);}},cr=class extends _0x520d48{constructor(_0x4f986f=void 0x0){super();const _0x29d318=_0x4f986f?'ck-ai-spinner_'+_0x4f986f:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x29d318]}});}};const lr={'file':_0x7d3934,'image':_0x34fbb2,'document':_0x43d4dc,'web-resource':_0x3ef3ff,'text':_0x7d3934,'selection':_0x20160d,'mcp-tool-context':_0x43d4dc},ur='ck-ai-chat-context-chip',dr='ck-ai-chat-context-chip_wide',_r='ck-ai-chat-context-chip_document',gr='ck-ai-chat-context-chip__label',Ar='ck-ai-chat-context-chip__type-icon',Ir='ck-ai-chat-context-controls__chip-tooltip',pr='n';var mr=class extends Ht{constructor(_0x23c28a,_0x1b7360,_0x309c14,_0x5a067a,_0x3f1130=!0x1){super(_0x23c28a),this['_isAnimationOnEnterEnabled']=_0x5a067a,this['_initializeProperties'](_0x1b7360,_0x309c14,_0x3f1130),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'](_0x30608e,_0x13f928,_0x17a206){this['set']('label',_0x30608e['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x30608e['type']),this['set']('id',_0x30608e['uiId']),this['set']('readonly',_0x13f928),this['set']('isLoading',_0x17a206);}['_setupTemplate'](){const _0x413da0=this['_createIconView'](),_0x1efef1=this['_createRemoveButton'](),_0x367e71=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x367e71),'children':this['_createTemplateChildren'](_0x413da0,_0x1efef1,_0x367e71)});}['_createTemplateAttributes'](_0x4afd54){return{'class':[ur,_0x4afd54['if']('itemType',_r,_0x181c95=>'document'==_0x181c95),_0x4afd54['if']('itemType',dr,_0x1faf33=>'selection'==_0x1faf33)],'data-cke-tooltip-text':_0x4afd54['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x1555b8,_0x150efa,_0x54c6f9){const _0x5bde19=this['_createLabelElement'](_0x54c6f9),_0x2c94b3=this['_createLoaderIcon']();return this['readonly']?[_0x1555b8,_0x5bde19]:[_0x1555b8,_0x2c94b3,_0x5bde19,_0x150efa];}['_createLabelElement'](_0x303cc5){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x303cc5['to']('label')}]};}['_createRemoveButton'](){const _0x220104=new Ht(this['locale']);return _0x220104['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x3e4cf9}),this['_setupRemoveButtonEvent'](_0x220104),_0x220104;}['_setupRemoveButtonEvent'](_0x21f2b9){_0x21f2b9['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x228565=this['bindTemplate'],_0x12c2a4=new Yt();return _0x12c2a4['content']=lr[this['itemType']],_0x12c2a4['extendTemplate']({'attributes':{'class':[Ar,_0x228565['if']('isLoading','ck-hidden',_0x2ac58f=>_0x2ac58f)]}}),_0x12c2a4;}['_handleAnimationEndOnce'](_0x16a6d5,_0x572969){if(!_0x16a6d5)return;const _0x4aaa3c=()=>{_0x572969(),_0x16a6d5['removeEventListener']('animationend',_0x4aaa3c),_0x16a6d5['removeEventListener']('webkitAnimationEnd',_0x4aaa3c);};_0x16a6d5['addEventListener']('animationend',_0x4aaa3c),_0x16a6d5['addEventListener']('webkitAnimationEnd',_0x4aaa3c);}['_createLoaderIcon'](){const _0xd941b4=new cr('small');return _0xd941b4['bind']('isVisible')['to'](this,'isLoading',_0x1389d3=>_0x1389d3),_0xd941b4;}};function Er(_0x4cf963){if(!_0x4cf963)return _0x4cf963;if(_0x4cf963['length']<=0x78)return _0x4cf963;const _0x4a1e5b=_0x4cf963['slice'](0x0,0x78),_0x44ca8c=_0x4a1e5b['lastIndexOf']('\x20');return(_0x44ca8c>0x0?_0x4a1e5b['slice'](0x0,_0x44ca8c):_0x4a1e5b)+'…';}const Tr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},wr='300px';var Cr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x11a2c6,_0x3ac7a6,_0x23c19c,_0xe1cb68,_0xc0cb79){this['_locale']=_0x11a2c6,this['_visibleChips']=_0x3ac7a6,this['_config']={...Tr,..._0x23c19c,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x23c19c['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0xe1cb68,this['_parentView']=_0xc0cb79||null;}['setContainerElement'](_0x4aa8a9){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x4aa8a9,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 _0x58d9d8=[...this['_visibleChips'],...this['_overflowChips']],_0x1ccf91=this['_createCalculationContainer'](),_0x3b8c61=this['_calculateOverflowInContainer'](_0x1ccf91,_0x58d9d8),_0x48ac5c=_0x1ccf91['_ancestorsToRestore'];_0x48ac5c&&this['_restoreAncestorVisibility'](_0x48ac5c),_0x1ccf91['remove'](),this['_applyOverflowResults'](_0x58d9d8,_0x3b8c61);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0xf72b9b({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x2720d2=new Ht(this['_locale']);_0x2720d2['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x6c318e=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x6c318e['push'](this['_config']['cssClasses']['controlsButton']),_0x2720d2['extendTemplate']({'attributes':{'class':_0x6c318e}}),_0x2720d2;}['_createShowMoreBalloonPanelView'](){const _0x15c6d0=new yt(this['_locale']);return _0x15c6d0['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x15c6d0),_0x15c6d0;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x19a92f=>{_0x19a92f['disableAnimationOnEnter']();});const _0xa8c357=new _0x9561fa(this['_locale']);_0xa8c357['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0xa8c357);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x5ba1de=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x5ba1de?'':'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'](_0x4e6ca6){const _0x57a9ca=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x238699=this['_containerElement']?.['classList'];if(_0x238699){const _0xd35b7b=_0x238699[0x0]||'',_0x39fcd7=_0x4e6ca6['querySelector']('.'+_0xd35b7b),_0x2ff7f0=_0x4e6ca6['querySelector'](_0x57a9ca);return _0x39fcd7||_0x2ff7f0||_0x4e6ca6;}return _0x4e6ca6['querySelector'](_0x57a9ca)||_0x4e6ca6;}['_calculateContainerWidth'](){const _0x5ba54a=this['_parentView']?.['element']||this['_containerElement'];if(!_0x5ba54a)return wr;const _0x2cf510=window['getComputedStyle'](_0x5ba54a)['width'];if('auto'===_0x2cf510||'0px'===_0x2cf510||!_0x2cf510){const _0xa34fa1=_0x5ba54a['parentElement'];if(_0xa34fa1){const _0x2d789a=window['getComputedStyle'](_0xa34fa1);return'auto'!==_0x2d789a['width']?_0x2d789a['width']:wr;}return wr;}return _0x2cf510;}['_applyCalculationStyles'](_0x30195e,_0x3da20e){this['_config']['cssClasses']['calculationContainer']&&_0x30195e['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x30195e['style']['width']=_0x3da20e,_0x30195e['style']['position']='absolute',_0x30195e['style']['top']='-9999px',_0x30195e['style']['left']='-9999px',_0x30195e['style']['opacity']='0',_0x30195e['style']['pointerEvents']='none',_0x30195e['style']['zIndex']='-1',_0x30195e['style']['visibility']='visible\x20!important',_0x30195e['style']['display']='block\x20!important',_0x30195e['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x18073f){_0x18073f['forEach'](({element:_0x44ec32,originalDisplay:_0x3d85b4,originalVisibility:_0x4ec4f7})=>{_0x44ec32['style']['display']=_0x3d85b4,_0x44ec32['style']['visibility']=_0x4ec4f7;});}['_makeAncestorsVisible'](_0x15cc0b){const _0x1013af=[];let _0x4ac258=_0x15cc0b;for(;_0x4ac258&&_0x4ac258!==document['body'];){const _0x19c8f4=window['getComputedStyle'](_0x4ac258);'none'!==_0x19c8f4['display']&&'hidden'!==_0x19c8f4['visibility']||(_0x1013af['push']({'element':_0x4ac258,'originalDisplay':_0x4ac258['style']['display'],'originalVisibility':_0x4ac258['style']['visibility']}),_0x4ac258['style']['display']='block',_0x4ac258['style']['visibility']='visible'),_0x4ac258=_0x4ac258['parentElement'];}return _0x1013af;}['_createContainerElements'](){let _0x31427d,_0x1fd3f9;return this['_parentView']?.['element']?(_0x31427d=this['_parentView']['element']['cloneNode'](!0x0),_0x1fd3f9=this['_findTargetContainer'](_0x31427d)):(_0x31427d=document['createElement']('div'),_0x1fd3f9=_0x31427d),{'calculationContainer':_0x31427d,'targetContainer':_0x1fd3f9};}['_createCalculationContainer'](){const {calculationContainer:_0x1e554a,targetContainer:_0x7ce5ec}=this['_createContainerElements'](),_0x46f868=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x1e554a,_0x46f868);const _0x563a4a=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x563a4a?_0x563a4a['appendChild'](_0x1e554a):document['body']['appendChild'](_0x1e554a),_0x1e554a['_targetContainer']=_0x7ce5ec;const _0x2c9e0c=this['_makeAncestorsVisible'](_0x563a4a||null);return _0x1e554a['offsetWidth'],_0x1e554a['_ancestorsToRestore']=_0x2c9e0c,_0x1e554a;}['_calculateOverflowInContainer'](_0x145af3,_0x5f52c4){const _0x4df3ce=_0x145af3['_targetContainer']||_0x145af3,_0x51a92a=[],{rowCount:_0x4277b8}=this['_renderChipsAndCountRows'](_0x4df3ce,_0x5f52c4);if(_0x4277b8<=this['_config']['maxVisibleRows'])return _0x51a92a;const _0x49d44b=_0x5f52c4['slice']();for(;_0x49d44b['length']>0x0;){if(this['_testButtonFit'](_0x145af3,_0x4df3ce,_0x49d44b)){const _0x2cbd80=_0x5f52c4['filter'](_0xa905a=>!_0x49d44b['includes'](_0xa905a));_0x51a92a['push'](..._0x2cbd80);break;}if(!_0x49d44b['pop']())break;}return _0x51a92a;}['_renderChipsAndCountRows'](_0x452c09,_0x1bd306){_0x452c09['innerHTML']='',_0x1bd306['forEach'](_0x5c2b8e=>{if(_0x5c2b8e['element']){const _0xe29331=_0x5c2b8e['element']['cloneNode'](!0x0);_0x452c09['appendChild'](_0xe29331);}}),_0x452c09['offsetWidth'];const _0x3ee0d3=_0x452c09['children'],_0x2312fc=[];return Array['from'](_0x3ee0d3)['forEach'](_0x3631df=>{const _0x1495e7=_0x3631df['getBoundingClientRect']()['top'];_0x2312fc['some'](_0x65ee33=>Math['abs'](_0x65ee33-_0x1495e7)<this['_config']['rowDetectionTolerance'])||_0x2312fc['push'](_0x1495e7);}),{'rowCount':_0x2312fc['length']};}['_createMockButton'](){const _0x1edc37=document['createElement']('button');return _0x1edc37['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x1edc37['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x1edc37['textContent']='+\x201',_0x1edc37;}['_testButtonFit'](_0x1dc74c,_0x3aa811,_0x5e3967){this['_renderChipsAndCountRows'](_0x3aa811,_0x5e3967);const _0x480683=this['_createMockButton']();_0x1dc74c['appendChild'](_0x480683),_0x1dc74c['offsetWidth'];const _0x1c13d3=[..._0x3aa811['children'],_0x480683],_0x291726=[];_0x1c13d3['forEach'](_0x17fb6e=>{const _0xb154c4=_0x17fb6e['getBoundingClientRect']()['top'];_0x291726['some'](_0x67f9f8=>Math['abs'](_0x67f9f8-_0xb154c4)<this['_config']['rowDetectionTolerance'])||_0x291726['push'](_0xb154c4);});const _0x113fd5=_0x291726['length'];return _0x480683['remove'](),_0x113fd5<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x489557,_0x39f9c5){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x489557['forEach'](_0x3b570f=>{_0x39f9c5['includes'](_0x3b570f)?this['_overflowChips']['add'](_0x3b570f):this['_visibleChips']['add'](_0x3b570f);});}['_updateOverflowUI'](_0x5cebd6){if(_0x5cebd6>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x5cebd6>0x0&&this['_showMoreButtonView']){const _0x373859=''+this['_config']['showMoreLabelPrefix']+(_0x5cebd6<0x63?_0x5cebd6:'99');this['_showMoreButtonView']['label']=_0x373859;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x410b7a,_0x1dfdb3){this['_distributeChips'](_0x410b7a,_0x1dfdb3),this['_updateOverflowUI'](_0x1dfdb3['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x423668=>{_0x423668[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 _0x43fa63=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x43fa63['width']||0x0===_0x43fa63['height'])return!0x1;const _0xa6cc39=window['innerHeight']||document['documentElement']['clientHeight'],_0x55184a=window['innerWidth']||document['documentElement']['clientWidth'];return _0x43fa63['bottom']>=-0xc8&&_0x43fa63['top']<=_0xa6cc39+0xc8&&_0x43fa63['right']>=-0xc8&&_0x43fa63['left']<=_0x55184a+0xc8;}};const fr='ck-ai-chat__feed__context-chips',br='ck-ai-chat-context-chips-wrapper',Sr='ck-ai-chat-context-chips-wrapper-balloon',Rr='ck-ai-chat-controls-button',Or='ck-ai-chat-controls_context_show-more-button',vr='ck-ai-chat-context-controls__show-more-balloon-panel';var kr=class extends _0x9561fa{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x5a3df6,_0x1434c8,_0x47d8c6){super(_0x5a3df6),this['_bodyCollection']=_0x47d8c6,this['_createContextChips'](_0x1434c8);const _0x513c9a={'cssClasses':{'showMoreButton':Or+'\x20'+hn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x5a3df6,this['_contextChips'],_0x513c9a,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[fr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':br},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x496e86=this['element']['querySelector']('.'+br);_0x496e86&&(this['_overflowManager']['setContainerElement'](_0x496e86),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x5a656e){for(const _0x3538cc of _0x5a656e){const _0x21a858=new mr(this['locale'],_0x3538cc,!0x0,!0x1);this['_contextChips']['add'](_0x21a858);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x7f1e48,_0x2f95ba,_0x171b0a){super(_0x2f95ba),this['_locale']=_0x7f1e48,this['_bodyCollection']=_0x171b0a,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 kr(this['_locale'],this['options']['contextItems']['filter'](_0x20a12f=>!_0x20a12f['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x9561fa(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']();}},yr=class extends Vn{['capabilities'];constructor(_0x1f26b5,_0xabde44){super(_0xabde44);const {isWebSearchEnabled:_0x44b5a3,isReasoningEnabled:_0x2a7442}=_0xabde44['capabilities'],_0x26519f=[];let _0x47bb29='';_0x44b5a3&&_0x2a7442?(_0x47bb29=us(_0x1f26b5,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x26519f['push'](xr(at)),_0x26519f['push'](xr(_0x376593))):_0x44b5a3?(_0x47bb29=us(_0x1f26b5,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x26519f['push'](xr(at))):_0x2a7442&&(_0x47bb29=us(_0x1f26b5,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x26519f['push'](xr(_0x376593))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x47bb29?'':'ck-hidden']}});const _0x5376c0=new _0x9561fa();_0x5376c0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x26519f,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x47bb29]}]}),this['children']['add'](_0x5376c0),this['capabilities']=_0xabde44['capabilities'];}};function xr(_0x1709d6){const _0x32883a=new Yt();return _0x32883a['content']=_0x1709d6,_0x32883a;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x3c197a){this['element']=_0x3c197a,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x13508e of Lr){const _0x305514='keydown'!==_0x13508e;this['element']['addEventListener'](_0x13508e,this['_onUserEvent']['bind'](this),{'passive':_0x305514,'signal':this['abortController']['signal']});}}['start']({smooth:_0x430652=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x430652?'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'](_0x535652){if(this['isRunning']){if('keydown'===_0x535652['type']){const _0x3b7d73=_0x535652['key'];if(!Dr['includes'](_0x3b7d73))return;}_0x535652 instanceof WheelEvent?_0x535652['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x23912f,scrollHeight:_0xd0db64,clientHeight:_0xa34532}=this['element'];return _0xd0db64-_0x23912f-_0xa34532<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Hr=class extends Vn{constructor(_0xd23341){super(_0xd23341),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']);}},Mr=class extends _0x9561fa{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x1a9932,_0x598fc7){super(_0x1a9932),this['_bodyCollection']=_0x598fc7,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...yn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Pr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x26c7fa,_0x1fce90){let _0x186202;return'ai-reply'===_0x26c7fa?_0x186202=new hr(this['locale'],_0x1fce90,this['_bodyCollection']):'ai-suggestion-reply'===_0x26c7fa?(_0x186202=new ar(this['locale'],_0x1fce90,this['_bodyCollection']),_0x186202['bind']('isTrackChangesOn')['to'](this)):_0x186202='user-message'===_0x26c7fa?new Nr(this['locale'],_0x1fce90,this['_bodyCollection']):'interaction-header'===_0x26c7fa?new yr(this['locale'],_0x1fce90):'custom-element'===_0x26c7fa?new Hr(_0x1fce90):new tr(_0x1fce90),this['children']['add'](_0x186202),_0x186202;}async['updateReplyItem']({id:_0x2bea77,parsedContent:_0x5a3640,renderingStrategy:_0x410f04,abortSignal:_0x5cbdea}){const _0x443059=this['getItemById'](_0x2bea77);if(!(_0x443059 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x443059,'id':_0x2bea77,'parsedContent':_0x5a3640});await _0x443059['updateContent']({'parsedContent':_0x5a3640,'renderingStrategy':_0x410f04,'abortSignal':_0x5cbdea});}async['updateWebSources'](_0x24b832,_0x3a1162){const _0x5662c3=this['getItemById'](_0x24b832);if(_0x5662c3 instanceof ar)_0x5662c3['updateSources'](_0x3a1162);else{if(!(_0x5662c3 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x5662c3,'id':_0x24b832,'sources':_0x3a1162});_0x5662c3['updateSources'](_0x3a1162);}}async['updateSuggestionItem']({id:_0xb87263,parts:_0x5c2305,abortSignal:_0x1a1129,skipLoadingEffects:_0x17eed7}){const _0x5c1bdf=this['getItemById'](_0xb87263);if(!(_0x5c1bdf instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x5c1bdf,'id':_0xb87263,'parts':_0x5c2305});await _0x5c1bdf['updateContent']({'parts':_0x5c2305,'abortSignal':_0x1a1129,'skipLoadingEffects':_0x17eed7});}['updateSuggestionPartState']({id:_0x7f2f96,index:_0x372d97,state:_0x2aa66c}){const _0xbdcfd5=this['getItemById'](_0x7f2f96);if(!(_0xbdcfd5 instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x7f2f96});_0xbdcfd5['updatePartState'](_0x372d97,_0x2aa66c);}['setSuggestionPartActive']({id:_0x5bc4d0,index:_0x11a89d,isActive:_0x28098d}){const _0x2b3e3c=this['getItemById'](_0x5bc4d0);if(!(_0x2b3e3c instanceof ar))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5bc4d0});this['children']['filter'](_0x8deee1=>_0x8deee1 instanceof ar)['forEach'](_0x2b035d=>{_0x2b035d['setPartActive'](!0x1);}),_0x2b3e3c['setPartActive'](_0x11a89d,_0x28098d);}['markItemAsDone'](_0x5f03dc){this['getItemById'](_0x5f03dc)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x42b84d=>_0x42b84d['options']['id']);}['removeItem'](_0x4f7291){this['children']['remove'](this['getItemById'](_0x4f7291));}['hasItem'](_0x57d5be){return!!this['children']['find'](_0x1147c9=>_0x1147c9['options']['id']['includes'](_0x57d5be));}['scrollToSuggestion'](_0x1ba066,_0x272ec2){const _0x39fce9=this['getItemById'](_0x1ba066);if(!(_0x39fce9 instanceof ar))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x1ba066,'partIndex':_0x272ec2});const _0x4c950a=_0x39fce9['getPartView'](_0x272ec2);_0x4c950a?St(_0x4c950a['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x1ba066,'partIndex':_0x272ec2});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x3a8591=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x3a8591,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x2f3011=new Xn(this['locale'],zn['aiFeed']);return _0x2f3011['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x2f3011;}['_createFeedItems'](){const _0x220630=new _0x9561fa(this['locale']);return _0x220630['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x220630;}['_createFeedLoader'](){const _0x47292f=new _0x9561fa(this['locale']);return _0x47292f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x137dd5=>!_0x137dd5)]},'children':this['_createLoaderChildren']()}),_0x47292f;}['_createLoaderChildren'](){const _0x37499b=new cr();return _0x37499b['isVisible']=!0x0,[_0x37499b,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x16cc3a){const _0x4f4f49=this['children']['find'](_0x42eb7a=>_0x42eb7a['options']['id']['includes'](_0x16cc3a));if(!_0x4f4f49)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x16cc3a});return _0x4f4f49;}['setLoadingMessage'](_0x4be2e7){this['set']('loadingMessage',_0x4be2e7);}['toggleLoadingSkeleton'](_0x468b54){this['set']('isLoadingSkeletonVisible',_0x468b54);}['startAutoScroll'](_0x192bf1={}){this['scrollManager']['start'](_0x192bf1);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends jt{['filter'](){let _0x3d11d7=0x0;for(const _0x3be7b9 of this['items'])_0x3d11d7+=_0x3be7b9['items']['length'];return{'resultsCount':_0x3d11d7,'totalItemsCount':_0x3d11d7};}};function Ur(_0x227ecb){const _0x2d4005=[];let _0x12fd82=!0x1;for(const _0x2a6be9 of Array['from'](_0x227ecb['items'])){if('file'!==_0x2a6be9['kind'])continue;if(_0x2a6be9['webkitGetAsEntry']()?.['isDirectory']){_0x12fd82=!0x0;continue;}const _0x9ee516=_0x2a6be9['getAsFile']();_0x9ee516&&_0x2d4005['push'](_0x9ee516);}return{'files':_0x2d4005,'hasDirectory':_0x12fd82};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x449d14,_0x5c1493){super(_0x449d14,{'queryView':{'label':'','creator':_0xc793c6,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x449d14),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5c1493,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',(_0x3ee1ba,_0xc65ae1)=>!_0x3ee1ba&&!_0xc65ae1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x4fdb86,_0x50e5dd)=>{this['isUploadInProgress']||this['isEmpty']||_0x4fdb86['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x50e5dd());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x2be639=>this['_handlePaste'](_0x2be639)),this['element']['addEventListener']('drop',_0x108577=>this['_handleDrop'](_0x108577));}['_handlePaste'](_0x238d6f){const _0x5677db=_0x238d6f['clipboardData'];if(!_0x5677db)return;const {files:_0x45dcaa,hasDirectory:_0x30d0cf}=Ur(_0x5677db),_0x2a38e1={'files':_0x45dcaa,'plainText':_0x5677db['getData']('text/plain'),'hasDirectory':_0x30d0cf,'forceTextAttachment':!0x1,'preventDefault':()=>_0x238d6f['preventDefault']()};this['fire']('promptInputPaste',_0x2a38e1);}['_handleDrop'](_0x216801){const _0x54757a=_0x216801['dataTransfer'];if(!_0x54757a)return;const _0x16e11d={'files':[],'plainText':_0x54757a['getData']('text/uri-list')||_0x54757a['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x216801['preventDefault']()};this['fire']('promptInputPaste',_0x16e11d);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x217d87=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x217d87)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x55e18e=_0x42dd97(_0x217d87);this['fire']('sendUserMessage',_0x55e18e),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x11f16f){this['queryView']['fieldView']['set']('placeholder',_0x11f16f);}['focus'](_0x3998db=!0x1){super['focus'](),_0x3998db&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x1bda32=new Ht(this['locale']);return _0x1bda32['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+on,'isEnabled':!0x1}),_0x1bda32['on']('execute',()=>{this['submit']();}),_0x1bda32;}['setIsUploadInProgress'](_0x3bc331){this['isUploadInProgress']=_0x3bc331;}['_setUpAddContextButtonPositioning'](){const _0x7a1b2b=this['locale'],_0x4f23e2=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x47ec33=new At(this['queryView']['fieldView']['element']),_0x49ecd2=new At(this['_addContextButtonView']['element']),_0x4f0109=_0x47ec33['width'],_0x5d0f2e='rtl'===_0x7a1b2b['uiLanguageDirection']?'right':'left';_0x47ec33['excludeScrollbarsAndBorders']();const _0x24f12e=_0x4f0109-_0x47ec33['width']+0x1;this['_addContextButtonView']['element']['style'][_0x5d0f2e]='calc('+(_0x4f0109-_0x49ecd2['width']-_0x24f12e)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x4f23e2),this['on']('render',()=>{_0x4f23e2(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x4f23e2();});});}},Fr=class extends _0x9561fa{constructor(_0xc4183c){super(_0xc4183c);const _0x435aa8=new Yt();_0x435aa8['content']=_0x7d3934,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x435aa8,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0xc4183c,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x14eed2){let _0xb24e17=0x0;_0x14eed2['addEventListener']('dragenter',_0x3a4e52=>{_0x3a4e52['dataTransfer']&&(_0xb24e17++,0x1===_0xb24e17&&this['fire']('dragEnter'),_0x14eed2['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x14eed2['addEventListener']('dragover',_0x277290=>{_0x277290['dataTransfer']&&_0x277290['preventDefault']();}),_0x14eed2['addEventListener']('dragleave',()=>{--_0xb24e17<=0x0&&(_0xb24e17=0x0,_0x14eed2['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x14eed2['addEventListener']('drop',_0x42f56b=>{_0x42f56b['preventDefault'](),_0xb24e17=0x0,_0x14eed2['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x42f56b);});}['_handleDrop'](_0x9ea65){const _0x250c64=_0x9ea65['dataTransfer'];if(!_0x250c64)return;const {files:_0x509c30,hasDirectory:_0x40c6d2}=Ur(_0x250c64),_0x139455={'files':_0x509c30,'plainText':_0x250c64['getData']('text/uri-list')||_0x250c64['getData']('text/plain'),'hasDirectory':_0x40c6d2,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x139455);}};const Kr='ck-ai-chat__prompt-capabilities',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-controls-button--commands',$r='ck-ai-chat-controls__model-selection',qr='ck-ai-chat-controls__model-selection__item-name',Qr='ck-ai-chat-controls__model-selection__item-description',Xr='ck-ai-chat-controls__model-selection__item-capabilities',zr='n';var jr=class extends _0x9561fa{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x8509e){super(_0x8509e),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',_0x1ecfc3=>'selector'===_0x1ecfc3),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x300e9a=>_0x300e9a?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x49c4cd=>_0x49c4cd),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x126e8a=>_0x126e8a),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x47d866=>us(this['locale'],_0x47d866?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x7ba86d=>_0x7ba86d),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x338b3a=>us(this['locale'],_0x338b3a?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Kr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0x2e32a2(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x13c3e2,_0x54b8c1){if(_0x54b8c1)this['set']('modelDisplayMode','hidden');else{const _0x4bfda6=0x1===_0x13c3e2['length'];this['set']('modelDisplayMode',_0x4bfda6?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x13c3e2?.['length'])for(const _0xfd2ea5 of _0x13c3e2){const _0x53fbba=new _0x365b55({'label':_0xfd2ea5['name'],'withText':!0x0,'role':'menuitemradio','id':_0xfd2ea5['id'],'model':_0xfd2ea5});_0x53fbba['bind']('isOn')['to'](this,'activeModelId',_0x464aac=>_0x464aac===_0xfd2ea5['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x53fbba,'labelView':new Jr(this['locale'],_0xfd2ea5)});}}['setWebSearch'](_0x225a17){this['set']('webSearchActive',_0x225a17);}['setReasoning'](_0x55ca23){this['set']('reasoningActive',_0x55ca23);}['setModel'](_0x10470c){if(!_0x10470c)return;this['activeModelId']=_0x10470c['id'],this['activeModelName']=_0x10470c['name']||_0x10470c['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x10470c['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x10470c['name']);const _0x4eb01d=_0x10470c['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x4eb01d),this['_webSearchButton']['set']('isVisible',_0x4eb01d);const _0x3bfbcc=_0x10470c['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3bfbcc),this['_reasoningButton']['set']('isVisible',_0x3bfbcc);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x41e471){this['set']('modelSelectorEnabled',!0x1),_0x41e471&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x51aa48=new Ht();return _0x51aa48['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x51aa48['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x51aa48;}['_createReasoningButton'](){const _0x5f180f=new Ht();return _0x5f180f['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0x376593,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x5f180f['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x5f180f;}['_createCommandsButton'](){const _0xbda48=new Ht();return _0xbda48['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x39c18b,'withText':!0x0,'class':Wr+'\x20'+hn,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0xbda48['extendTemplate']({'attributes':{'class':[Yr]}}),_0xbda48['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0xbda48;}['_createModelSelectionDropdown'](){const _0x37391b=_0x4acf15(this['locale']);return _0x37391b['set']({'panelPosition':'ne','class':[$r]}),_0x37391b['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':hn}),this['listenTo'](_0x37391b,'execute',_0x2381ef=>{this['fire']('selectModel',_0x2381ef['source']['model']);}),_0x37391b;}['_createModelNameView'](){const _0x5854e1=new Zr(this['locale']);return _0x5854e1['bind']('text')['to'](this,'activeModelName',_0x4cf88d=>_0x4cf88d??''),_0x5854e1['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1e53b8=>'name'===_0x1e53b8),_0x5854e1;}},Jr=class extends Dt{constructor(_0x206737,_0x32338c){super();const _0x528d98=this['bindTemplate'],_0x45c257=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x528d98['to']('style'),'id':_0x528d98['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x528d98['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x32338c['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x45c257}]}),_0x45c257['addMany'](this['_getCapabilityParts'](_0x206737,at,'AI_CHAT_SEARCH_WEB',_0x32338c['capabilities']['webSearch']?.['enabled']??!0x1)),_0x45c257['addMany'](this['_getCapabilityParts'](_0x206737,_0x376593,'AI_CHAT_REASONING',_0x32338c['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x46e87d,_0x4278f9,_0x1ebdb8,_0x17c751){const _0x56e531=new Yt();_0x56e531['content']=_0x4278f9;const _0x3e7849=new _0x9561fa(_0x46e87d);_0x3e7849['setTemplate']({'tag':'span','children':[{'text':us(_0x46e87d,_0x1ebdb8)+':\x20'}]});const _0x4fe999=new _0x9561fa(_0x46e87d);return _0x4fe999['setTemplate']({'tag':'span','children':[{'text':us(_0x46e87d,_0x17c751?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x56e531,_0x3e7849,_0x4fe999];}},Zr=class extends _0x9561fa{constructor(_0x3ceeb8){super(_0x3ceeb8),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x3440fb=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x3440fb['if']('isVisible','ck-hidden',_0x19a0ed=>!_0x19a0ed)]},'children':[{'text':_0x3440fb['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x9561fa{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x2d491f){super(_0x2d491f),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'](_0x697e0a=>{this['focusTracker']['add'](_0x697e0a['element']),this['keystrokes']['listenTo'](_0x697e0a['element']);}),_0x3842ab({'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'](_0x5a4af2){this['urlInputField']['errorText']=_0x5a4af2,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x1fa9d1=new Ht(this['locale']);return _0x1fa9d1['set']({'icon':_0x56e661,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x4a3a93,_0x5858d2,_0x590b8e)=>{_0x1fa9d1['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x590b8e?'':'\x20ck-hidden')]});}),_0x1fa9d1;}['_createUrlInputField'](){const _0x12d433=new qt(this['locale'],_0x192bba);return _0x12d433['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x12d433['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x12d433;}['_createConfirmButton'](){const _0x40ae2a=new Ht(this['locale']);return _0x40ae2a['set']({'icon':_0x3afcd8,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x40ae2a;}['_setupTemplate'](){const _0x1e61d0=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'});_0x1e61d0['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x1e61d0,{'tag':'div','attributes':{'class':eo},'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',_0x2abf68=>{_0x2abf68['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x111693,_0x3887f3)=>{this['clear'](),this['fire']('cancel'),_0x3887f3();});}['_handleSubmit'](){const _0xb87f3f=this['getValue']()['trim']();_0xb87f3f?this['_isValidUrl'](_0xb87f3f)?(this['clearError'](),this['fire']('submitUrl',_0xb87f3f)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x1e8b79=this['getValue']()['trim'](),_0x339820=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x1e8b79['length']>0x0&&!_0x339820;}['_isValidUrl'](_0x5e04be){try{return!!new URL(_0x5e04be);}catch{return!0x1;}}};const so='ck-ai-chat-resources__item',no='ck-ai-chat-resources__item--in-context',ro='ck-ai-chat-resources__item-title',oo='ck-ai-chat-resources__item__icon';var ao=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x2ab386,_0x536256){super(_0x2ab386),this['resource']=_0x536256,this['set']('isInContext',!!_0x536256['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x31ea06){if(_0x31ea06['isInContext'])return _0x3afcd8;switch(_0x31ea06['type']){case'document':return _0x43d4dc;case'web-resource':return _0x3ef3ff;case'file':case'text':return _0x7d3934;default:return _0x232d49;}}['highlightText'](_0x3f6f58){if(!_0x3f6f58||''===_0x3f6f58['trim']())return void this['_titleView']['highlightText'](null);const _0x1b2c5e=new RegExp(_0x42acc1(_0x3f6f58),'gi');this['_titleView']['highlightText'](_0x1b2c5e);}['updateResourceState'](_0x4cd9be){this['resource']['isInContext']=_0x4cd9be,this['isInContext']=_0x4cd9be,this['_updateIcon']();}['_createTitleView'](){const _0x4c1d32=new Wt();return _0x4c1d32['text']=this['resource']['label'],_0x4c1d32['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x4c1d32;}['_createIconView'](){const _0x4b9054=new Yt();return _0x4b9054['content']=this['getResourceIcon'](this['resource']),_0x4b9054;}['_setupTemplate'](){const _0x37488=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x37488['if']('isVisible','ck-hidden',_0x56b5ee=>!_0x56b5ee),_0x37488['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x37488['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends jt{['_source'];constructor(_0x5392ee,_0x57a5da){super(_0x5392ee),this['_source']=_0x57a5da,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x4f1ab9,_0x10b64c){this['items']['clear']();let _0x2a508c=_0x4f1ab9;if(this['_source']['useDefaultFiltering']&&_0x10b64c&&''!==_0x10b64c['trim']()){const _0x57e46e=new RegExp(_0x10b64c['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x2a508c=_0x4f1ab9['filter'](_0x1b52fe=>_0x57e46e['test'](_0x1b52fe['label']));}for(const _0xea2319 of _0x2a508c){const _0x2acba5=new ao(this['locale'],_0xea2319);_0x2acba5['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0xea2319);}),this['items']['add'](_0x2acba5);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x10b64c);}['highlightText'](_0x44f7a2){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x269ca0=>{_0x269ca0['highlightText'](_0x44f7a2);});}['updateResourceState'](_0x47d104,_0x2a8e58){for(const _0x3a9b93 of this['items']){const _0x42b297=_0x3a9b93;_0x42b297['resource']['id']===_0x47d104&&_0x42b297['updateResourceState'](_0x2a8e58);}}['_handleResourceSelection'](_0x41ab70,_0x5a6110){this['fire']('addResourceToContext',{'source':_0x41ab70,'resource':_0x5a6110});}},lo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x2a5749){const t=_0x2a5749['t'],_0x7abfe7={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x192bba,'label':us(_0x2a5749,'AI_CHAT_SEARCH_RESOURCES')};super(_0x2a5749,_0x7abfe7['creator']),this['label']=_0x7abfe7['label'],this['_viewConfig']=_0x7abfe7,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x2a5749,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x126252){this['fire']('search',_0x126252);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x785cd,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x3a91d4,t){this['resetButtonView']=new Ht(_0x3a91d4),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x3e4cf9,'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',_0x1fcb0f=>!_0x1fcb0f),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);}},uo=class extends _0x9561fa{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x5d68f3,_0x5b7509){super(_0x5d68f3),this['_source']=_0x5b7509['source'],this['_searchInputVisibleFrom']=_0x5b7509['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 _0x18f546([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new lo(this['locale']);}['_createSearchSection'](){const _0x15aa2e=new _0x9561fa(this['locale']);return _0x15aa2e['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1261cd,_0x32b154)=>{this['loadResources'](_0x32b154),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x32b154);}),_0x15aa2e;}['_createResourcesListView'](){const _0x22c5e3=new co(this['locale'],this['_source']);return _0x22c5e3['delegate']('addResourceToContext')['to'](this),_0x22c5e3['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x22c5e3;}['_createSkeletonView'](){const _0x358c4c=new Xn(this['locale'],zn['aiChatResources']);return _0x358c4c['bind']('isVisible')['to'](this,'isLoading'),_0x358c4c;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x319b54){const _0x59a714=vt();this['_latestLoadResourcesUid']=_0x59a714,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x319b54,'uid':_0x59a714}),this['isLoading']=!0x0;}['setResources'](_0x5e30d2,_0x5bc560){if(_0x5bc560&&_0x5bc560!==this['_latestLoadResourcesUid'])return;const _0x4b9f7e=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5e30d2,_0x4b9f7e),_0x5e30d2['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0xc7f57a,_0x986d2a){this['_resourcesListView']['updateResourceState'](_0xc7f57a,_0x986d2a);}};const _o='ck-ai-chat-context-controls__source-balloon-panel',go='ck-button-icon\x20ck-button-back',Ao='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Io=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x24fb2e,_0x2781ca,_0x4708e0){this['_locale']=_0x24fb2e,this['_bodyCollection']=_0x2781ca,this['_config']=_0x4708e0;}['showSourceResourcesBalloon']({source:_0x38f5cc,withBackButton:_0x46f391}){let _0x2a658b=this['_sourceResourceBalloons']['get'](_0x38f5cc['id']);_0x2a658b||(_0x2a658b=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x38f5cc['id'],_0x2a658b),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x2a658b)),this['_addSourceResourceContent']({'balloonPanel':_0x2a658b,'source':_0x38f5cc,'withBackButton':_0x46f391}),_0x2a658b['show']();const _0x2a6477=this['_config']['getTargetElement']();_0x2a6477&&_0x2a658b['pin']({'target':_0x2a6477,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x33fffa,_0x537a79,_0x553afb){const _0x58a0ab=this['_sourceResourceBalloons']['get'](_0x33fffa);if(!_0x58a0ab)return;const _0x2ce37d=this['_getResourcesViewFromBalloon'](_0x58a0ab);_0x2ce37d&&(_0x2ce37d['setResources'](_0x537a79,_0x553afb),_0x2ce37d['once']('change:isLoading',()=>{_0x58a0ab['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x146f3c){const _0x1aa9b2=this['_sourceResourceBalloons']['get'](_0x146f3c);_0x1aa9b2&&requestAnimationFrame(()=>{_0x1aa9b2['hide'](),this['_sourceResourceBalloons']['delete'](_0x146f3c),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0xf82686 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0xf82686);}['isAnyResourceBalloonVisible'](){for(const _0x355dfc of this['_sourceResourceBalloons']['values']())if(_0x355dfc['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x1876b2,_0x56b770,_0x194e36){const _0x376b08=this['_sourceResourceBalloons']['get'](_0x1876b2);if(!_0x376b08||!_0x376b08['isVisible'])return;const _0x5eae46=this['_config']['getTargetElement']();if(!_0x5eae46)return;_0x376b08['pin']({'target':_0x5eae46,'limiter':this['_config']['getLimiterElement']()});const _0x338c2e=this['_getResourcesViewFromBalloon'](_0x376b08);_0x338c2e&&_0x338c2e['updateResourceState'](_0x56b770,_0x194e36);}['destroy'](){for(const _0x4f982d of this['_sourceResourceBalloons']['values']())_0x4f982d['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x2980ee=new yt(this['_locale']);return _0x2980ee['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x2980ee),_0x2980ee;}['_addSourceResourceContent']({balloonPanel:_0x1ec321,source:_0x2601aa,withBackButton:_0x370421}){_0x1ec321['content']['clear']();const _0x4bde8c=this['_createBalloonHeader']({'balloonPanel':_0x1ec321,'source':_0x2601aa,'withBackButton':_0x370421});_0x1ec321['content']['add'](_0x4bde8c);const _0x4403ba=this['_createBalloonResourcesView'](_0x2601aa);_0x1ec321['content']['add'](_0x4403ba);}['_createBalloonHeader']({balloonPanel:_0x3e8043,source:_0x2bb801,withBackButton:_0x24129b}){const _0x36aec2=new Ft(this['_locale'],{'label':_0x2bb801['label'],'class':Ao});return _0x24129b&&_0x36aec2['children']['add'](this['_createBackButton'](_0x3e8043),0x0),_0x36aec2;}['_createBackButton'](_0x5f0716){const _0x3ea1c8=new Ht(this['_locale']);return _0x3ea1c8['set']({'icon':_0x56e661,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x3ea1c8['on']('execute',()=>{_0x5f0716['hide'](),this['_config']['onBackToContext']();}),_0x3ea1c8;}['_createBalloonResourcesView'](_0x3b0908){const _0xf68a65=new uo(this['_locale'],{'source':_0x3b0908,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xf68a65['on']('loadSourceResources',(_0x36d8f5,_0x180367)=>{this['_config']['onLoadSourceResources'](_0x180367);}),_0xf68a65['on']('addResourceToContext',(_0x513966,_0x4a44d7)=>{this['_config']['onResourceSelected'](_0x4a44d7['source'],_0x4a44d7['resource']),this['closeSourceResourceBalloon'](_0x3b0908['id']);}),_0xf68a65;}['_getResourcesViewFromBalloon'](_0x3dec6d){const _0x411441=_0x3dec6d['content']['get'](0x1);return _0x411441 instanceof uo?_0x411441:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x4e30cf){_0xf72b9b({'emitter':_0x4e30cf,'contextElements':[_0x4e30cf['element']],'callback':()=>{_0x4e30cf['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x4e30cf['isVisible']});}};const po=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],mo='ck-ai-chat-context-controls',Eo='ck-ai-chat-context-controls__pending-contexts',To='ck-ai-chat-context-controls__add-context-balloon-panel',wo='ck-ai-chat-context-controls__add-context-button',Co='ck-ai-chat-context-controls__url-balloon-panel',fo='ck-ai-chat-context-controls__balloon-button',bo='ck-ai-chat-context-controls__balloon-button-source',So='ck-ai-chat-controls-button',Ro='ck-ai-chat-context-chips-wrapper-balloon',Oo='ck-ai-chat-controls_context_show-more-button',vo='ck-ai-chat-context-controls__show-more-balloon-panel',ko='ck-ai-chat',No=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x9561fa{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0xc5bbee,_0x4e5cce){super(_0xc5bbee),this['bodyCollection']=_0x4e5cce['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0xc5bbee),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0xc5bbee),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0xc5bbee),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0xc5bbee,_0x4e5cce);const _0x4b9f50={'cssClasses':{'showMoreButton':Oo+'\x20'+hn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0xc5bbee,this['_currentContextsChips'],_0x4b9f50,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'](_0x283817,_0x5a71f9){const _0x5a3c9d=this['_createContextButton'](_0x283817,'current',!0x0,_0x5a71f9);this['_addContextToCollection'](_0x5a3c9d,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x1911ab){this['_removeContextFromCollection'](_0x1911ab,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x1911ab,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x5f2766,_0xc8e80b){let _0x375d64=this['_currentContextsChips']['find'](_0x50cfbb=>_0x50cfbb['id']===_0x5f2766);_0x375d64||(_0x375d64=this['_overflowManager']['overflowChips']['find'](_0x12d261=>_0x12d261['id']===_0x5f2766)),_0x375d64&&(_0x375d64['isLoading']=_0xc8e80b);}['setConversationContext'](_0x2c50a3){this['_conversationContextsChips']['clear']();for(const _0x5682ad of _0x2c50a3){const _0x9afdda=this['_createContextButton'](_0x5682ad,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x9afdda,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x56b54d,_0x4b33ff,_0x3747e8){this['_resourcesBalloonView']['updateResourceState'](_0x56b54d,_0x4b33ff,_0x3747e8);}['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:_0x1a28bc,withBackButton:_0xa1a0d8}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x1a28bc,'withBackButton':_0xa1a0d8}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x48e9c1,_0x13ef82,_0x145b14,_0x1624c7){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x48e9c1,_0x145b14,_0x1624c7);}['closeSourceResourceBalloon'](_0xefa8f8){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0xefa8f8),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x510823){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x510823),this['_setAddContextButtonEnabled'](_0x510823);}['_setAddContextButtonEnabled'](_0x2cac02){const _0x4cf13b=!_0x2cac02['document']['isHidden']&&_0x2cac02['document']['enabled'],_0x34e098=_0x2cac02['urls']['enabled'],_0x53c98d=_0x2cac02['files']['enabled'],_0x417db9=_0x2cac02['sources']['length']>0x0,_0x315ef7=_0x2cac02['customItems']&&_0x2cac02['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x4cf13b||_0x34e098||_0x53c98d||_0x417db9||_0x315ef7;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[mo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Eo},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x1da779){const _0x168dbe=new Ht(_0x1da779);return _0x168dbe['set']({'label':us(_0x1da779,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+hn,'icon':_0x1bf76f,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x168dbe;}['_createAddContextBalloonPanelView'](_0x4b1d58){return this['_createBaseBalloonPanel'](_0x4b1d58,To);}['_createUrlBalloonPanelView'](_0x5f2cca){const _0x50f062=this['_createBaseBalloonPanel'](_0x5f2cca,Co);return this['_addUrlContent'](_0x50f062,_0x5f2cca),_0x50f062;}['_createResourcesBalloonView'](_0x98766a,_0x1bd672){const _0x4464dc={'searchInputVisibleFrom':_0x1bd672['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x564d68,_0x5f1d05)=>{this['fire']('addResourceToContext',{'source':_0x564d68,'resource':_0x5f1d05});},'onLoadSourceResources':_0x127513=>{this['fire']('loadSourceResources',_0x127513);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x98766a,_0x1bd672['bodyCollection'],_0x4464dc);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x6a2f17,_0x11aa64){const _0x949fc7=new yt(_0x6a2f17);return _0x949fc7['extendTemplate']({'attributes':{'class':_0x11aa64}}),this['bodyCollection']['add'](_0x949fc7),_0x949fc7;}['_setBalloonPanelContent'](_0xb7d836,_0x1460e4,_0x40f66e){if(_0xb7d836['content']['clear'](),!_0x40f66e['document']['isHidden']&&_0x40f66e['document']['enabled']){const _0x1d9166=this['_createBalloonButton'](_0x1460e4,{'label':us(_0x1460e4,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x43d4dc});_0x1d9166['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0xb7d836['content']['add'](_0x1d9166);}if(_0x40f66e['urls']['enabled']){const _0x2024c7=this['_createBalloonButton'](_0x1460e4,{'label':us(_0x1460e4,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x3ef3ff});_0x2024c7['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0xb7d836['content']['add'](_0x2024c7);}if(_0x40f66e['files']['enabled']){const _0x27a614=new Bt(_0x1460e4);_0x27a614['set']({'label':us(_0x1460e4,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x3322f5,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x27a614['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x27a614['on']('done',(_0x1f4099,_0x3cd507)=>{this['fire']('addFileToContext',_0x3cd507);}),_0x27a614['tooltip']=!0x0,_0xb7d836['content']['add'](_0x27a614);}for(const _0x2508fd of _0x40f66e['sources']){const _0x2e37df=this['_createBalloonButton'](_0x1460e4,{'label':_0x2508fd['label'],'icon':_0x2508fd['icon']||_0x232d49,'type':'source'});_0xb7d836['content']['add'](_0x2e37df),_0x2e37df['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x2508fd,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x129322 of _0x40f66e['customItems']||[]){const _0x4e97a0=this['_createBalloonButton'](_0x1460e4,{'label':_0x129322['label'],'icon':_0x129322['icon']||_0x232d49,'type':'customItem'});_0xb7d836['content']['add'](_0x4e97a0),_0x4e97a0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x129322);});}this['_hasExactlyOneSource']=0x1===_0xb7d836['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x4b93ac,_0x22eb90){this['_urlInputView']=new io(_0x22eb90),this['_urlInputView']['on']('submitUrl',(_0x138f7c,_0x3b24c5)=>{this['_handleUrlSubmit'](_0x3b24c5);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});}),_0x4b93ac['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x386460,_0x2721a7){const _0x4b33ec='source'===_0x2721a7['type']?new xo(_0x386460):new Ht(_0x386460);return _0x4b33ec['set']({'label':_0x2721a7['label'],'icon':_0x2721a7['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x4b33ec;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0xf72b9b({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x5bb5e7){const _0xdd87bc=this['_addContextBalloonConfig'];_0xdd87bc['buttonView']['isOn']=_0x5bb5e7,_0x5bb5e7?_0xdd87bc['balloonView']['show']():_0xdd87bc['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x133718,buttonView:_0xdc5077,hideMethod:_0x364126}=this['_addContextBalloonConfig'];_0xf72b9b({'emitter':_0x133718,'contextElements':[_0x133718['element'],_0xdc5077['element']],'callback':()=>{_0x364126();},'activator':()=>_0xdc5077['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x260fad,_0x2cf7fd,_0x1a91d2=!0x1,_0x273b94=!0x1){const _0x3f7c6a='conversation'===_0x2cf7fd||!0x0===_0x260fad['isReadOnly'],_0x1992e7=new mr(this['locale'],_0x260fad,_0x3f7c6a,_0x1a91d2,_0x273b94);return _0x3f7c6a||_0x1992e7['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x1992e7['id']);}),_0x1992e7;}['_addContextToCollection'](_0x2d30eb,_0x8832ae){_0x8832ae['add'](_0x2d30eb,0x0);}['_removeContextFromCollection'](_0x305fb4,_0x29e78c){const _0x563a57=_0x29e78c['find'](_0x14cc1c=>_0x14cc1c['id']===_0x305fb4);_0x563a57&&_0x29e78c['remove'](_0x563a57);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x5dcb46){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x5dcb46);}},xo=class extends Ht{['arrowView'];constructor(_0x4c9dd7){super(_0x4c9dd7),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[bo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x1af61e=new Yt();return _0x1af61e['content']=_0x5b9e25,_0x1af61e['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x1af61e;}},Lo=class extends _0x9561fa{['_cancelButtonView'];['_loaderView'];constructor(_0x286641){super(_0x286641),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 _0x567caf=new Ht(this['locale']);return _0x567caf['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':an+'\x20ck-ai-button-stop-generating','icon':it}),_0x567caf['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x567caf;}['_createLoaderView'](){const _0x585d0b=new _0x9561fa(this['locale']);return _0x585d0b['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')}]}),_0x585d0b;}},Do=class extends _0x9561fa{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x4b7660,_0x32366c){super(_0x4b7660),this['_filesEnabled']=_0x32366c['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x4b7660,{'bodyCollection':_0x32366c['bodyCollection'],'searchInputVisibleFrom':_0x32366c['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x4b7660),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x4b7660),this['_loaderView']=this['_createLoaderView'](_0x4b7660),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x4b7660),this['_dropZoneView']=new Fr(_0x4b7660),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'](...po)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x4cdcdf=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x4cdcdf['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x4cdcdf['if']('isLoading','ck-hidden',_0x38ea03=>_0x38ea03||!this['isModelAvailable']),_0x4cdcdf['if']('isModelAvailable','ck-hidden',_0x105d52=>!_0x105d52||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x4cdcdf['if']('isLoading','ck-hidden',_0x1f375e=>!_0x1f375e)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x4cdcdf['if']('isModelAvailable','ck-hidden',_0x580e1a=>_0x580e1a)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0xf72b9b({'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'](_0x3e533b,_0x226b7b){return new yo(_0x3e533b,_0x226b7b);}['_createPromptInputView'](_0x34b2bd){return new Gr(_0x34b2bd,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x6b5d13){return new jr(_0x6b5d13);}['_createLoaderView'](_0x29d066){return new Lo(_0x29d066);}['_createModelUnavailableMessageView'](_0xd912f9){const _0x3d6691=new Po(_0xd912f9);return _0x3d6691['delegate']('startConversation')['to'](this),_0x3d6691;}['_handlePromptInputFocus'](_0x4a0f16,_0x17daa9,_0x37b1ec){_0x37b1ec?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x54cb5d,_0x5c93e8){this['_contextPanelView']['addContextItem'](_0x54cb5d,_0x5c93e8);}['removeContextItem'](_0x1b4dce){this['_contextPanelView']['removeContextItem'](_0x1b4dce);}['setContextItemLoading'](_0x13a16e,_0x4a58c7){this['_contextPanelView']['setContextItemLoading'](_0x13a16e,_0x4a58c7);}['setIsUploadInProgress'](_0xcbe522){this['_promptInputView']['setIsUploadInProgress'](_0xcbe522);}['setConversationContext'](_0x2807db){this['_contextPanelView']['setConversationContext'](_0x2807db);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x4b760,_0x1b67af,_0x284a31){this['_contextPanelView']['updateResourceState'](_0x4b760,_0x1b67af,_0x284a31);}['setWebSearch'](_0x2611e7){this['_promptCapabilitiesView']['setWebSearch'](_0x2611e7);}['setReasoning'](_0x2dad37){this['_promptCapabilitiesView']['setReasoning'](_0x2dad37);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x3b0745){this['_contextPanelView']['setAddContextOptions'](_0x3b0745);}['setInputPlaceholder'](_0x3168c8){this['_promptInputView']['setPlaceholderText'](_0x3168c8);}['setModelList'](_0x39f475,_0x46fa12){this['_promptCapabilitiesView']['setModelList'](_0x39f475,_0x46fa12);}['setModel'](_0x1860ff){_0x1860ff?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x1860ff)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x467a34){this['_promptCapabilitiesView']['disableModelSelector'](_0x467a34);}['populateSourceResourceBalloon'](_0x752764,_0x54daab,_0x45f8b4,_0x31e5fe){this['_contextPanelView']['populateSourceResourceBalloon'](_0x752764,_0x54daab,_0x45f8b4,_0x31e5fe);}['closeSourceResourceBalloon'](_0x2d74b6){this['_contextPanelView']['closeSourceResourceBalloon'](_0x2d74b6);}['focusPromptInput'](_0x1ace72=!0x1){this['_promptInputView']['focus'](_0x1ace72);}['setPromptInputValue'](_0x11baed){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x11baed;}},Po=class extends _0x9561fa{constructor(_0x7f3d2c){super(_0x7f3d2c);const _0xcdbda1=new Ht(_0x7f3d2c);_0xcdbda1['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0xcdbda1['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'},_0xcdbda1]}]});}},Ho=class extends Ft{['resizeButton'];constructor(_0x39bca7,_0x496886){super(_0x39bca7,{'label':_0x496886['label'],'class':'ck-ai-header\x20'+_0x496886['class'],'icon':_0x496886['icon']}),this['set']('isMaximized',!0x1),_0x496886['content']&&this['children']['add'](_0x496886['content']),_0x496886['showResizeButton']&&(this['resizeButton']=cn(_0x39bca7,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x9561fa{constructor(_0x4f865b){super(_0x4f865b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x4f865b,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x5970ff,_0xedfbdb){const _0x212a64=new Ht(_0x5970ff);return _0x212a64['set']({'label':us(_0x5970ff,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x543d19,'class':'ck-ai-chat__start-conversation\x20'+an}),_0x212a64['on']('execute',()=>{_0xedfbdb['fire']('startConversation');}),_0x212a64;}var Uo=class extends _0x9561fa{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x19b992,_0x5b905d){super(_0x19b992),this['_bodyCollection']=ln(_0x19b992);const _0x514b81=Vo(_0x19b992,this);this['chatHeader']=new Ho(_0x19b992,{'label':us(_0x19b992,'AI_CHAT_HEADING'),'icon':_0x57b32e,'class':'ck-ai-header_chat','content':_0x514b81,'showResizeButton':_0x5b905d['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0x19b992,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0x19b992,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x5b905d['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x5b905d['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0x19b992),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x19b992['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x18b001,_0x7c3d98,_0x561305,_0x2ca52d){this['chatControls']['populateSourceResourceBalloon'](_0x18b001,_0x7c3d98,_0x561305,_0x2ca52d);}['closeSourceResourceBalloon'](_0x3b063e){this['chatControls']['closeSourceResourceBalloon'](_0x3b063e);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x7ceac6{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(_0x289dfa){super(_0x289dfa);const _0x28293c=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x28293c['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'](_0x28293c),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x398d50,{showDiff:_0x256a45})=>{this['showDiff']=_0x256a45;}),this['disableControls'](),_0x28293c['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x57b32e,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x28293c['view'],'isMaximized',_0x16358e=>_0x16358e),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x192c52=>_0x192c52),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x483f76){const _0x5e8288=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'](_0x483f76['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x5e8288}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x30df38,staticMessage:_0x1939ab}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x30df38,'initialContent':'<p>'+_0x1939ab+'</p>'});});}async['addFeedItemUserMessage'](_0x3a81af){const _0x36941d=_0x3a81af['attributes']?.['displayedPrompt']||_0x3a81af['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x3a81af['contextItems']['values']()),'initialContent':'<p>'+_0x36941d+'</p>','id':_0x3a81af['id']});});}async['addFeedItemError']({errorMessage:_0x41b8a7,id:_0x208aef}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x41b8a7+'</p>','id':_0x208aef});});}async['addFeedItemAIReply'](_0x3bfba0){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3bfba0['interactionId']+':'+_0x3bfba0['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x38f200){const _0xb94cf8=ds(this['context']),_0x33c52b=_0xb94cf8['map'](_0x2fd30c=>_0x2fd30c['config']['get']('ai.availableReplyActions')||[...er]);let _0x162b0c=_0x33c52b['reduce']((_0x199f15,_0x1b9921)=>_0x199f15['filter'](_0xd7575a=>_0x1b9921['includes'](_0xd7575a)),_0x33c52b[0x0]||[...er]);const _0x2f2f23=_0xb94cf8['every'](_0x326097=>_0x326097['plugins']['has']('TrackChanges')),_0xead6a2=_0xb94cf8['map'](_0x1667a8=>_0x1667a8['commands']['get']('trackChanges'));return _0x2f2f23?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0xead6a2,'value',(..._0x484ff7)=>_0x484ff7['some'](_0x30673c=>_0x30673c))):_0x162b0c=_0x162b0c['filter'](_0x4b5705=>'insertSuggestion'!=_0x4b5705),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x38f200['interactionId']+':'+_0x38f200['id'],'areActionsDisabled':_0x38f200['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x162b0c}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x167b41,_0x518038){return this['_promiseQueue']['enqueue'](async()=>{const _0x362a6b=this['_view']['chatFeed']['children']['last'];if(_0x362a6b instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x362a6b),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x167b41['id'],'capabilities':{'isWebSearchEnabled':_0x362a6b['capabilities']['isWebSearchEnabled']||_0x518038['isWebSearchEnabled'],'isReasoningEnabled':_0x362a6b['capabilities']['isReasoningEnabled']||_0x518038['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x167b41['id'],'capabilities':_0x518038});});}async['addFeedItemCustomElement'](_0x56bc8f,_0x399f0d){let _0x444eb2;return await this['_promiseQueue']['enqueue'](async()=>{_0x444eb2=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x56bc8f,'id':_0x399f0d});}),_0x444eb2;}['removeFeedItem'](_0x2cac99){this['_view']['chatFeed']['removeItem'](_0x2cac99);}['hasFeedItem'](_0x50fa9b){return this['_view']['chatFeed']['hasItem'](_0x50fa9b);}['updateFeedInteractionHeader'](_0x175106){const _0x4f0394=this['_view']['chatFeed']['children']['find'](_0x4647bb=>_0x4647bb['options']['id']==_0x175106['id']&&_0x4647bb instanceof yr);_0x4f0394&&_0x4f0394['set']('isVisible',_0x175106['isVisible']);}async['updateFeedItemAIReplyContent'](_0x895d8){const _0x543e3f=_0x895d8['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x3b4599=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x895d8,'abortSignal':_0x3b4599,'renderingStrategy':_0x543e3f}),_0x895d8['isDone']&&this['markFeedItemAsDone'](_0x895d8['id']);});}['updateFeedItemAIReplySources'](_0x19ba01,_0x233bf6){this['_view']['chatFeed']['updateWebSources'](_0x19ba01,_0x233bf6);}async['updateFeedItemAIReplySuggestionContent'](_0x3b3342){return this['_promiseQueue']['enqueue'](async _0x42fc5b=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x3b3342,'abortSignal':_0x42fc5b}),_0x3b3342['isDone']&&this['markFeedItemAsDone'](_0x3b3342['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x38270c){this['_view']['chatFeed']['updateSuggestionPartState'](_0x38270c);}['setFeedItemAIReplySuggestionPartActive'](_0x48cfac){this['_view']['chatFeed']['setSuggestionPartActive'](_0x48cfac);}['markFeedItemAsDone'](_0xb28af3){this['_view']['chatFeed']['markItemAsDone'](_0xb28af3);}['removeFeedInteraction'](_0x3bf532){this['_view']['chatFeed']['getItemIds']()['filter'](_0x544d67=>_0x544d67['startsWith'](_0x3bf532))['forEach'](_0x52b27d=>this['_view']['chatFeed']['removeItem'](_0x52b27d));}['startInteraction'](){const _0x567087=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x567087),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0xea4476){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x46a701=>_0x46a701['startsWith'](_0xea4476['id']))['forEach'](_0x4fb88e=>this['markFeedItemAsDone'](_0x4fb88e)),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'](_0x3ecbfd,_0x48f030){this['_view']['chatControls']['addContextItem'](_0x3ecbfd,_0x48f030);}['removeContextItem'](_0x31316e){this['_view']['chatControls']['removeContextItem'](_0x31316e);}['setContextItemLoading'](_0x28fb0c,_0x286d9b){this['_view']['chatControls']['setContextItemLoading'](_0x28fb0c,_0x286d9b);}['setIsUploadInProgress'](_0x2d0be9){this['_view']['chatControls']['setIsUploadInProgress'](_0x2d0be9);}['setConversationContext'](_0x52f6dd){this['_view']['chatControls']['setConversationContext'](_0x52f6dd);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x5f3eb5,_0x1a78df,_0x31226e){this['_view']['chatControls']['updateResourceState'](_0x5f3eb5,_0x1a78df,_0x31226e);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x3d564e){this['_view']['chatControls']['setAddContextOptions'](_0x3d564e);}['updateCapabilities'](_0x115cac){this['_view']['chatControls']['setWebSearch'](_0x115cac['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x115cac['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x115cac));}['setSelectedModel'](_0x4a6d80,_0x47c132){this['_view']['chatControls']['setModel'](_0x4a6d80),_0x47c132&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x3d4260){this['feedItemRenderingStrategy']=_0x3d4260;}['toggleLoadingSkeleton'](_0x4943cd){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x4943cd);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x1baa5c,_0xe78ef8=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0xe78ef8&&!pt()&&_0x1baa5c['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x1baa5c);this['_view']['chatHeader']['label']=_0x1baa5c;}['setLoadingMessage'](_0x21c0bd){this['_view']['chatFeed']['setLoadingMessage'](_0x21c0bd);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x245dcc){let _0xb33f6b=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x245dcc[_0xb33f6b],_0xb33f6b++,_0xb33f6b===_0x245dcc['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x782174){return _0x782174['isWebSearchEnabled']&&_0x782174['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x782174['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x782174['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x2b9918){return _0x2b9918?_0x2b9918['isWebSearchEnabled']&&_0x2b9918['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x2b9918['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x2b9918['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'](_0x5cf1a5,_0x22408d,_0x1e579d,_0x6503c4){this['_view']['populateSourceResourceBalloon'](_0x5cf1a5,_0x22408d,_0x1e579d,_0x6503c4);}['closeSourceResourceBalloon'](_0x3e9c5a){this['_view']['closeSourceResourceBalloon'](_0x3e9c5a);}['setPromptInputValue'](_0x14143){this['_view']['chatControls']['setPromptInputValue'](_0x14143);}['focusPromptInput'](_0x4dcba8=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x4dcba8);}['scrollFeedToSuggestion'](_0x483904,_0x512282){this['_view']['chatFeed']['scrollToSuggestion'](_0x483904,_0x512282);}['startAutoScroll'](_0x19622c={}){this['_view']['chatFeed']['startAutoScroll'](_0x19622c);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends jt{['sections'];constructor(_0x502c28,_0x1a5a1d){super(_0x502c28),this['sections']=_0x1a5a1d,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x331488){let _0x1d9eba=0x0,_0x47947b=0x0;for(const _0x932e14 of this['sections']){const {resultsCount:_0x4f2ceb,totalItemsCount:_0x5933df}=_0x932e14['filter'](_0x331488);_0x1d9eba+=_0x4f2ceb,_0x47947b+=_0x5933df;}return{'resultsCount':_0x1d9eba,'totalItemsCount':_0x47947b};}},Fo=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x1f050e,{title:_0x22ffce,items:_0x204257}){super(_0x1f050e);const _0x2d9708=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x22ffce,this['itemsViews']=_0x204257;const _0x57483c=new _0x9561fa(_0x1f050e);_0x57483c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0x1f050e),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x2d9708['if']('isVisible','ck-hidden',_0x5a6a99=>!_0x5a6a99)]},'children':[_0x57483c,this['_itemsListView']]});}['filter'](_0x39bad0){const _0x14d962=this['itemsViews']['length'];let _0xa8ff34=0x0;for(const _0x254164 of this['itemsViews'])_0x39bad0?(_0x254164['isVisible']=!!_0x254164['isMatching'](_0x39bad0),_0x254164['highlightText'](_0x39bad0)):(_0x254164['isVisible']=!0x0,_0x254164['highlightText'](null)),_0x254164['isVisible']&&_0xa8ff34++;return this['isVisible']=_0xa8ff34>0x0,{'resultsCount':_0xa8ff34,'totalItemsCount':_0x14d962};}['getItem'](_0xde66b0){return this['itemsViews']['find'](_0x2984ca=>_0x2984ca['id']===_0xde66b0);}['removeItem'](_0x4ae3c5){const _0x59dd26=this['itemsViews']['indexOf'](_0x4ae3c5);-0x1!==_0x59dd26&&(this['itemsViews']['splice'](_0x59dd26,0x1),this['_itemsListView']['items']['remove'](_0x4ae3c5));}};const Ko=/* #__PURE__ -- @preserve */
34
+ _0x1a0ec9(zt);var Wo=class AIChatHistoryListItemView extends Ko{['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(_0x21661a,_0x58269a){super(_0x21661a);const _0x2b2eb6=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x58269a['pinned']),this['set']('loadingState',null),this['set']('title',_0x58269a['title']),this['id']=_0x58269a['id'];const {createdAt:_0x48b168,active:_0x3470fd=!0x1}=_0x58269a;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0xc8adcf=this['_createCheckView'](),_0x486cd9=this['_createPinButtonView'](_0x21661a),_0x5404f6=this['_createMenuDropdownView'](),_0x1728b5=this['_createEditInputView'](_0x21661a),_0x15c3cb=this['_createAcceptEditButtonView'](_0x21661a,_0x1728b5),_0x2f1cbe=this['_createCancelEditButtonView'](_0x21661a);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x486cd9),this['actions']['add'](_0x5404f6),this['on']('change:isEdit',(_0x398ad3,_0x9bb9af,_0x3941d3)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x3941d3?(this['actions']['add'](_0x15c3cb),this['actions']['add'](_0x2f1cbe),this['mainContent']['add'](_0x1728b5),_0x1728b5['element']['value']=this['title']||'',_0x1728b5['element']['focus']()):(this['actions']['add'](_0x486cd9),this['actions']['add'](_0x5404f6),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x3470fd?'ck-ai-chat-history__item--active':'',_0x2b2eb6['if']('isVisible','ck-hidden',_0x3a6e3b=>!_0x3a6e3b),_0x2b2eb6['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',_0x2b2eb6['if']('loadingState','ck-hidden',_0x430ff7=>!!_0x430ff7)]},'children':_0x3470fd?[_0xc8adcf]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x2b2eb6['if']('loadingState','ck-hidden',_0x3b869a=>!_0x3b869a)]},'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',_0x2b2eb6['if']('loadingState','ck-hidden',_0x4aa75b=>!!_0x4aa75b)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x2b2eb6['if']('loadingState','ck-hidden',_0x10da84=>!_0x10da84)]},'children':[{'text':_0x2b2eb6['to']('loadingState',_0x3212d9=>_0x3212d9?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x3212d9]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x48b168]}]},{'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'](_0xf1479c){this['set']('title',_0xf1479c);}['updateLoadingState'](_0x30d5f3,_0x4c48cb){this['set']('loadingState',_0x4c48cb?_0x30d5f3:null);}['_createCheckView'](){const _0x4b983f=new Yt();return _0x4b983f['set']({'content':_0x3afcd8}),_0x4b983f;}['_createPinButtonView'](_0x14689e){const _0x58fc75=new Ht(_0x14689e);return _0x58fc75['set']({'label':us(_0x14689e,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x350cc3,'withText':!0x1,'tooltip':!0x0}),_0x58fc75['bind']('isOn')['to'](this,'pinned'),_0x58fc75['on']('execute',()=>{const _0x322f50=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x322f50});}),_0x58fc75;}['_createMenuDropdownView'](){const _0x4d8315=_0x4acf15(this['locale']),_0x4b7d62=_0x4d8315['panelView']['children'];_0x4d8315['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x4d8315['panelPosition']='sw';const _0x59d685=new Ht(this['locale']);_0x59d685['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x59d685['withText']=!0x0,_0x59d685['on']('execute',()=>{this['isEdit']=!0x0;});const _0x226ff4=new Ht(this['locale']);_0x226ff4['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x226ff4['withText']=!0x0,_0x226ff4['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x47df5d=new jt(this['locale']),_0x36de7f=new zt(this['locale']);_0x36de7f['children']['add'](_0x59d685);const _0x302413=new zt(this['locale']);return _0x302413['children']['add'](_0x226ff4),_0x47df5d['items']['addMany']([_0x36de7f,_0x302413]),_0x4b7d62['add'](_0x47df5d),_0x4d8315;}['_createEditInputView'](_0x799e82){const _0x1bcfe8=new $t(_0x799e82),_0x17f0b3=_0x1bcfe8['bindTemplate'];return _0x1bcfe8['extendTemplate']({'on':{'keydown':_0x17f0b3['to'](_0x1f7f49=>{'Enter'==_0x1f7f49['key']&&this['_commitEditInputValue'](_0x1bcfe8);})}}),_0x1bcfe8;}['_createAcceptEditButtonView'](_0x3e0bcc,_0x44d608){const _0x12049e=new Ht(_0x3e0bcc);return _0x12049e['set']({'icon':_0x3afcd8,'withText':!0x1,'tooltip':us(_0x3e0bcc,'AI_CHAT_HISTORY_ACCEPT')}),_0x12049e['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x12049e['on']('execute',()=>{this['_commitEditInputValue'](_0x44d608);}),_0x12049e;}['_commitEditInputValue'](_0x29e50f){const _0x462f3b=_0x29e50f['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x462f3b});}['_createCancelEditButtonView'](_0x3f1447){const _0x1406b2=new Ht(_0x3f1447);return _0x1406b2['set']({'icon':_0x3e4cf9,'withText':!0x1,'tooltip':us(_0x3f1447,'AI_CHAT_HISTORY_CANCEL')}),_0x1406b2['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1406b2['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1406b2;}['_createSpinnerView'](){const _0x519088=new cr('tiny');return _0x519088['isVisible']=!0x0,_0x519088;}['isMatching'](_0x44cd9b){return'string'==typeof this['title']&&this['title']['match'](_0x44cd9b)?{'title':!0x0}:null;}['highlightText'](_0x13da5c){this['_titleView']['highlightText'](_0x13da5c);}},Yo=class extends _0x9561fa{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x9143e8,_0x534f28){super(_0x9143e8),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x582847=Vo(_0x9143e8,this);this['headerView']=new Ho(_0x9143e8,{'label':us(_0x9143e8,'AI_CHAT_HISTORY_HEADING'),'icon':_0x389f69,'class':'ck-ai-header_history','content':_0x582847,'showResizeButton':_0x534f28}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x9143e8,[]),this['sectionsView']['delegate'](...$o)['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',_0x2cc7cd=>!_0x2cc7cd)]}}),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 _0xa0d9d5=new _0x105f16(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x53e9ed=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x53e9ed),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x503ee4=this['_createErrorView']();return _0x503ee4['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x5b5f2d=>!_0x5b5f2d)]}}),_0xa0d9d5['on']('render',()=>{_0xa0d9d5['children']['add'](_0x503ee4,0x1);}),_0xa0d9d5['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x5c5f4b=>!_0x5c5f4b)]}}),_0xa0d9d5;}['_createSkeletonView'](){const _0x2cd75d=new Xn(this['locale'],zn['aiHistory']);return _0x2cd75d['bind']('isVisible')['to'](this,'isLoading'),_0x2cd75d;}['_createErrorView'](){const _0x2957fa=new _0x9561fa(this['locale']),_0x4aae78=new Ht(this['locale']);_0x4aae78['set']({'withText':!0x1,'icon':_0x3e4cf9,'class':'ck-ai-notification_error__dismiss-button'}),_0x4aae78['bind']('isVisible')['to'](this,'hasItems',_0x480f4e=>!!_0x480f4e),_0x4aae78['on']('execute',()=>{this['errorMessage']='';});const _0x5ec70e=this['bindTemplate'];return _0x2957fa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x5ec70e['to']('errorMessage')}]},_0x4aae78]}),_0x2957fa;}['_createEmptyStateView'](){const _0x438f91=new _0x9561fa(this['locale']);return _0x438f91['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4be489=>!_0x4be489)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x438f91;}['_createListItemViews'](_0x455e8f,_0x19ec11){const _0x517a37=[];for(const _0x3166c3 of _0x455e8f){const _0x42bfa6=new Wo(_0x19ec11,_0x3166c3);_0x42bfa6['delegate'](...$o)['to'](this),_0x517a37['push'](_0x42bfa6);}return _0x517a37;}['updateHistoryItemsWithCategories'](_0x6df7ea){const _0x48d67e=this['locale']||'en',_0x536356=[];for(const _0x47f0c6 of _0x6df7ea){const _0x417ae5=this['_createListItemViews'](_0x47f0c6['items'],_0x48d67e);_0x536356['push'](new Fo(_0x48d67e,{'title':_0x47f0c6['title'],'items':_0x417ae5}));}this['sectionsView']['sections']=_0x536356,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x536356),this['hasItems']=_0x6df7ea['some'](_0x1a5969=>_0x1a5969['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x3ce07a){for(const _0x86d7d6 of this['sectionsView']['sections']){const _0x1a9ee5=_0x86d7d6['getItem'](_0x3ce07a);if(_0x1a9ee5){if(_0x86d7d6['removeItem'](_0x1a9ee5),0x0===_0x86d7d6['itemsViews']['length']){const _0x84645e=this['sectionsView']['sections']['indexOf'](_0x86d7d6);-0x1!==_0x84645e&&(this['sectionsView']['sections']['splice'](_0x84645e,0x1),this['sectionsView']['items']['remove'](_0x86d7d6));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x53f1a7,_0x571f51){for(const _0x486f05 of this['sectionsView']['sections']){const _0x5b43c6=_0x486f05['getItem'](_0x53f1a7);if(_0x5b43c6){_0x5b43c6['updateTitle'](_0x571f51);break;}}}['updateItemLoadingState'](_0xb5bba4,_0x2858fc,_0x3cfd4c){for(const _0x549c4f of this['sectionsView']['sections']){const _0x2c1c35=_0x549c4f['getItem'](_0xb5bba4);if(_0x2c1c35){_0x2c1c35['updateLoadingState'](_0x2858fc,_0x3cfd4c);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x2ae9ec=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x2ae9ec);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x7ceac6{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x43828c){super(_0x43828c);const _0x1b139d=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x1b139d['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x1b139d),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x1b139d['view'],'isMaximized',_0x3781be=>_0x3781be),_0x1b139d['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x389f69,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x248bdd){this['_historyView']['removeHistoryItem'](_0x248bdd);}['updateItems'](_0x41ee14){this['_historyView']['updateHistoryItemsWithCategories'](_0x41ee14);}['updateItemTitle'](_0x157511,_0x4b8849){this['_historyView']['updateItemTitle'](_0x157511,_0x4b8849);}['updateItemLoadingState'](_0x1d75ec,_0x55cd3e,_0x51beb5){this['_historyView']['updateItemLoadingState'](_0x1d75ec,_0x55cd3e,_0x51beb5);}['setLoadingSkeleton'](_0x284474){this['_historyView']['isLoading']=_0x284474;}['showError'](_0x3f0825){this['_historyView']['errorMessage']=_0x3f0825;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
+ gt();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x594ce1,title:_0x10719c,createdAt:_0x40a208,updatedAt:_0x6cbcd5,pinned:_0x523607}){super(),this['id']=_0x594ce1,this['createdAt']=new Date(_0x40a208),this['set']('title',_0x10719c),this['set']('updatedAt',_0x6cbcd5?new Date(_0x6cbcd5):null),this['set']('pinned',_0x523607||!0x1);}['updateTitle'](_0x7ee762){this['set']('title',_0x7ee762),this['updatedAt']=new Date();}['updatePinned'](_0x37375a){this['set']('pinned',_0x37375a),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
+ ut();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x48b462,group:_0x281e52}){super(),this['connector']=_0x48b462,this['group']=_0x281e52;}async['init'](){try{const _0x83a2ad=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x83a2ad);}catch(_0x1a5c94){this['fire']('error',{'error':_0x1a5c94,'operation':'init'});}}['addItem'](_0x58758e){this['items']['push'](_0x58758e);}async['removeItem'](_0x527802){const _0xf09b39=this['items']['findIndex'](_0x1d70f3=>_0x1d70f3['id']===_0x527802);if(-0x1===_0xf09b39)return!0x1;try{return await this['connector']['deleteConversation'](_0x527802)['execute'](),this['items']['splice'](_0xf09b39,0x1),this['fire']('itemRemoved',{'itemId':_0x527802}),!0x0;}catch(_0x383ef3){return this['fire']('error',{'error':_0x383ef3,'operation':'removeItem','itemId':_0x527802}),!0x1;}}['getItem'](_0x4f1ac4){return this['items']['find'](_0x3492fe=>_0x3492fe['id']===_0x4f1ac4);}async['updateItemTitle'](_0x398426,_0x4d036e){const _0x2e0287=this['getItem'](_0x398426);if(!_0x2e0287)return!0x1;try{return await this['connector']['updateConversation'](_0x398426,{'title':_0x4d036e})['getResult'](),_0x2e0287['updateTitle'](_0x4d036e),this['fire']('itemUpdated',{'itemId':_0x398426,'updates':{'title':_0x4d036e}}),!0x0;}catch(_0xa1c70f){return this['fire']('error',{'error':_0xa1c70f,'operation':'updateItemTitle','itemId':_0x398426}),!0x1;}}async['updateItemPinned'](_0x2d0e38,_0x59e629){const _0x1c25b3=this['getItem'](_0x2d0e38);if(!_0x1c25b3)return!0x1;try{return await this['connector']['updateConversation'](_0x2d0e38,{'pinned':_0x59e629})['getResult'](),_0x1c25b3['updatePinned'](_0x59e629),this['fire']('itemUpdated',{'itemId':_0x2d0e38,'updates':{'pinned':_0x59e629}}),!0x0;}catch(_0x43aea5){return this['fire']('error',{'error':_0x43aea5,'operation':'updateItemPinned','itemId':_0x2d0e38}),!0x1;}}['loadItems'](_0x4a4c94){try{this['items']=[],_0x4a4c94['map'](_0x181ca9=>{this['addItem'](new Xo(_0x181ca9));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2668e9){this['fire']('error',{'error':_0x2668e9,'operation':'loadItems'});}}['getItems'](_0xc9b630={}){const _0x18d826=void 0x0!==_0xc9b630['pinned']&&_0xc9b630['pinned'],_0x2be6fd=_0xc9b630['from']?new Date(_0xc9b630['from']['getFullYear'](),_0xc9b630['from']['getMonth'](),_0xc9b630['from']['getDate']()):null,_0x4d11d8=_0xc9b630['to']?new Date(_0xc9b630['to']['getFullYear'](),_0xc9b630['to']['getMonth'](),_0xc9b630['to']['getDate']()):null;return this['items']['filter'](_0x3bf799=>{if(_0x3bf799['pinned']!==_0x18d826)return!0x1;if(_0x4d11d8){const _0x3a8431=new Date(_0x3bf799['createdAt']['getFullYear'](),_0x3bf799['createdAt']['getMonth'](),_0x3bf799['createdAt']['getDate']());return _0x2be6fd?_0x2be6fd['getTime']()===_0x4d11d8['getTime']()?_0x3a8431['getTime']()===_0x2be6fd['getTime']():_0x3a8431<_0x4d11d8&&_0x3a8431>=_0x2be6fd:_0x3a8431<_0x4d11d8;}return!0x0;});}},Jo=class extends _0x7ceac6{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,nn,kn,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'](kn),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aichathistory');const _0x177732=this['context']['plugins']['get'](cs);try{const _0x51bde3=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x51bde3}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x5d5694,_0x234163)=>{this['_setItemLoading'](_0x234163['id'],'remove'),this['_handleRemove'](_0x234163['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x238421,_0x107461)=>{this['_setItemLoading'](_0x107461['id'],'rename'),this['_handleEditTitle'](_0x107461['id'],_0x107461['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x165977,_0x3f9564)=>{void 0x0!==_0x3f9564['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x3f9564['itemId'],_0x3f9564['updates']['title']),void 0x0!==_0x3f9564['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x3f9564['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x34bfc3,_0xacc28c)=>{this['_aiChatController']['_handleRemovedConversation'](_0xacc28c['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0xacc28c['itemId']),this['_clearItemLoading'](_0xacc28c['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x3de9eb,_0x59ca62)=>{this['_handleHistoryErrorUI'](_0x59ca62['error'],_0x59ca62['operation'],_0x59ca62['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x247963,_0xe0c955)=>{this['_handleSelectConversation'](_0xe0c955['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x223bcf,_0x1ba590)=>{const _0xbddbce=_0x1ba590['pinned']?'pin':'unpin';this['_setItemLoading'](_0x1ba590['id'],_0xbddbce),this['_handleTogglePin'](_0x1ba590['id'],_0x1ba590['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x177732['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x177732['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x508abe){this['_handleHistoryErrorUI'](_0x508abe,'init');}}async['_handleEditTitle'](_0xc5a348,_0x4a4b55){await this['history']['updateItemTitle'](_0xc5a348,_0x4a4b55);}async['_handleTogglePin'](_0x25dcd4,_0x122b43){await this['history']['updateItemPinned'](_0x25dcd4,_0x122b43);}async['_handleRemove'](_0x17dbd8){await this['history']['removeItem'](_0x17dbd8);}async['_handleSelectConversation'](_0x185186){await this['_aiChatController']['loadConversation'](_0x185186);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x4ddb48=this['_aiChatController']['activeConversation']?.['id'],_0x44dfc5=this['_getCategorizedItems']()['map'](_0x22879e=>({'title':_0x22879e['title'],'items':_0x22879e['items']['map'](_0x5a4579=>({'id':_0x5a4579['id'],'title':_0x5a4579['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x5a4579['createdAt'])['toLocaleDateString'](),'active':_0x5a4579['id']===_0x4ddb48,'pinned':_0x5a4579['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x44dfc5);}['_setItemLoading'](_0x48073a,_0x1da4eb){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x48073a,_0x1da4eb,!0x0);}['_clearItemLoading'](_0x21426b){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x21426b,null,!0x1);}['_handleHistoryErrorUI'](_0x58ea61,_0x13c4eb,_0x388fd2){const _0x2167b7=this['_generateErrorMessage'](_0x13c4eb,_0x388fd2);this['_aiChatHistoryUi']['showError'](_0x2167b7),this['_reporter']['reportError'](_0x58ea61,{'context':{'operation':_0x13c4eb}}),_0x388fd2&&this['_clearItemLoading'](_0x388fd2),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0xd8d9eb,_0x116e2d){const _0x1ea860=_0x116e2d?this['history']['getItem'](_0x116e2d):null,_0x96ca88=_0x1ea860?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0xd8d9eb){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x96ca88);case'updateItemPinned':{const _0xc0fb53=us(this['context']['locale'],_0x1ea860?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0xc0fb53,_0x96ca88]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x96ca88);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 _0xa95b97=new Date(),_0x23b079=new Date(_0xa95b97['getFullYear'](),_0xa95b97['getMonth'](),_0xa95b97['getDate']()),_0x3aaadd=new Date(_0x23b079);_0x3aaadd['setDate'](_0x3aaadd['getDate']()-0x1);const _0x5d73f9=new Date(_0x23b079);_0x5d73f9['setDate'](_0x5d73f9['getDate']()-0xe);const _0x5d8c14=this['history']['getItems']({'pinned':!0x0}),_0x3cb892=this['history']['getItems']({'from':_0x23b079,'to':_0x23b079}),_0x11d15a=this['history']['getItems']({'from':_0x3aaadd,'to':_0x3aaadd}),_0x3103e2=this['history']['getItems']({'from':_0x5d73f9,'to':_0x3aaadd}),_0xa97ede=this['history']['getItems']({'to':_0x5d73f9}),_0x593828=[];return _0x5d8c14['length']>0x0&&_0x593828['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x5d8c14}),_0x3cb892['length']>0x0&&_0x593828['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x3cb892}),_0x11d15a['length']>0x0&&_0x593828['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x11d15a}),_0x3103e2['length']>0x0&&_0x593828['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x3103e2}),_0xa97ede['length']>0x0&&_0x593828['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0xa97ede}),_0x593828;}},Zo=class extends _0x7ceac6{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x7ceac6{static get['requires'](){return[kn,Is,Bo,Zo,tn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x8077fe){super(_0x8077fe),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');}},ea=class extends Ht{['id'];constructor(_0x4398f4,_0x2b4126){super(_0x4398f4);const {id:_0x1ed77e,type:_0x2e5f8a,icon:_0x4c7310}=_0x2b4126;this['id']=_0x1ed77e,this['set']({'label':_0x2b4126['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x2b4126['id']}}),_0x4c7310?this['icon']=_0x4c7310:'chat'===_0x2e5f8a?this['icon']=_0x57b32e:'review'===_0x2e5f8a?this['icon']=_0x13db03:'translate'===_0x2e5f8a&&(this['icon']=_0x23533e);}},ia=class extends _0x9561fa{['listView'];constructor(_0x45212b,_0x7504a4){super(_0x45212b),this['set']('isEnabled',!0x0);const _0xd1db0=_0x7504a4['map'](_0x491f41=>{const _0x5c389f=new zt(this['locale']),_0x5164db=new ea(this['locale'],_0x491f41);return _0x5164db['bind']('isEnabled')['to'](this),_0x5c389f['children']['add'](_0x5164db),_0x5164db['delegate']('execute')['to'](this),_0x5c389f;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0xd1db0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x7ceac6{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Bo];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Bo),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x170d2b=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x6e30c4=_0x170d2b['activeConversation'];_0x6e30c4['isFromHistory']||this['_injectShortcuts'](_0x6e30c4);}),this['listenTo'](_0x170d2b,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x559b74=['chat','review','translate'];this['_shortcuts']['forEach'](_0x42577e=>{let _0x124b14=!0x0;if(_0x42577e['id']&&_0x42577e['label']&&_0x559b74['includes'](_0x42577e['type'])?'chat'===_0x42577e['type']&&(_0x124b14='string'==typeof _0x42577e['prompt']):_0x124b14=!0x1,!_0x124b14)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x42577e});});}['_injectShortcuts'](_0x596688){this['_removeShortcuts'](),this['_shortcutsView']=new ia(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],sa),this['_shortcutsView']['on']('execute',_0x218552=>{const _0x369b11=_0x218552['source']['id'];this['_executeShortcut'](_0x369b11);}),this['_listenedConversation']=_0x596688,this['listenTo'](_0x596688,'uploadProgressChanged',(_0x5e0c05,_0xac3777)=>{this['_shortcutsView']['isEnabled']=!_0xac3777['isUploadInProgress'];});}['_removeShortcuts'](){const _0x76028c=this['context']['plugins']['get'](Bo);_0x76028c['hasFeedItem'](sa)&&_0x76028c['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x4bed64){const _0x48450a=this['_shortcuts']['find'](_0x4fd253=>_0x4fd253['id']===_0x4bed64),_0x42f849=_0x48450a['type'];'chat'===_0x42f849?this['_runChatShortcut'](_0x48450a):'review'===_0x42f849?_0x48450a['commandId']?this['_runReviewShortcut'](_0x48450a):this['_switchTab']('reviewMode'):'translate'===_0x42f849&&(_0x48450a['language']?this['_runTranslateShortcut'](_0x48450a):this['_switchTab']('translate'));}['_switchTab'](_0x5190ff){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x5190ff});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x5190ff);}async['_runChatShortcut']({prompt:_0x125faf,draftMode:_0x3decdc,useWebSearch:_0x1069ff=!0x1,useReasoning:_0x4c0f57=!0x1,model:_0x400345}){const _0x5c5e25=this['context']['plugins']['get']('AIChatController'),_0xfaef07=_0x5c5e25['activeConversation'];let _0xf99410;_0xf99410=_0x400345?await _0xfaef07['chatModels']['getModel'](_0x400345):await _0xfaef07['chatModels']['getDefault'](),_0xf99410&&await _0xfaef07['setModel'](_0xf99410),_0xfaef07['setWebSearch'](_0x1069ff),_0xfaef07['setReasoning'](_0x4c0f57),_0x5c5e25['addCurrentDocumentToChatContext'](),_0x3decdc?(this['_aiChatUI']['setPromptInputValue'](_0x125faf),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x5c5e25['sendMessage']({'message':_0x125faf});}['_runReviewShortcut']({commandId:_0x3fa87c,model:_0x22ac54,prompt:_0x277be3,params:_0x4a7eb3}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0xd0fa5d={'id':_0x3fa87c,'isCustom':'custom'===_0x3fa87c};_0x22ac54&&_0x277be3&&(_0xd0fa5d['args']={'model':_0x22ac54,'prompt':_0x277be3}),_0x4a7eb3&&(_0xd0fa5d['params']=_0x4a7eb3),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0xd0fa5d);}['_runTranslateShortcut']({language:_0x86ce6}){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':_0x86ce6,'args':{'language':_0x86ce6}});}},ra=class extends _0x492f00{constructor(_0x4563be){super(_0x4563be);const _0x41e708=_0x4563be['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x41e708,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x591632=this['editor']['plugins']['get']('AITabs')['view'];_0x591632['isVisible']=!_0x591632['isVisible'];}},oa=class extends _0x3fb090{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x43f995=this['editor'];_0x43f995['commands']['add']('toggleAi',new ra(_0x43f995)),_0x43f995['ui']['componentFactory']['add']('toggleAi',()=>{const _0x230ce0=this['_createAIUIButton'](Ht);return _0x230ce0['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x230ce0;}),_0x43f995['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x294b3a=this['_createAIUIButton'](Jt);return _0x294b3a['set']({'role':'menuitemcheckbox'}),_0x294b3a;});}['_createAIUIButton'](_0x2087f2){const _0x512736=this['editor'],_0x4d7379=_0x512736['commands']['get']('toggleAi'),_0x5aa770=new _0x2087f2(_0x512736['locale']);return _0x5aa770['set']({'label':us(_0x512736['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x1adff3,'isToggleable':!0x0}),_0x5aa770['bind']('isEnabled')['to'](_0x4d7379),_0x5aa770['bind']('isOn')['to'](_0x4d7379,'value',_0x164eb0=>!!_0x164eb0),this['listenTo'](_0x5aa770,'execute',()=>{_0x4d7379['execute']();}),_0x5aa770;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x9561fa{['_errorView'];constructor(_0xefd6){super(_0xefd6),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x11058a){this['showError'](_0x11058a);}['showError'](_0x557647){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x557647,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x2393ca=new _0x9561fa(this['locale']),_0x37bf0b=new _0x9561fa(this['locale']);return _0x37bf0b['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x2393ca['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x187b35=>!_0x187b35)]},'children':[_0x37bf0b]}),_0x2393ca;}};const ca=0xa;var la=class extends _0x7ceac6{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'](_0x6a021a){const {id:_0x4e0cbf}=this['_currentConfig']??{};this['_currentConfig']=_0x6a021a,this['_editor']=_0x6a021a['targetEditor'];const {id:_0x28aa8a}=this['_currentConfig'];this['isOpen']&&_0x4e0cbf===_0x28aa8a?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x5ccf86=this['_editor'];if(!_0x5ccf86)return;const _0x526b6e=_0x5ccf86['plugins']['get']('Dialog');_0x526b6e['isOpen']&&this['_currentConfig']&&_0x526b6e['id']===this['_currentConfig']['id']&&_0x526b6e['hide']();}['_updateDialog'](){const _0x427c71=this['_editor']['plugins']['get']('Dialog'),{icon:_0x1594f8,title:_0x6fcb2f}=this['_currentConfig'];_0x427c71['view']?.['headerView']&&(_0x427c71['view']['headerView']['label']=_0x6fcb2f,_0x427c71['view']['headerView']['iconView']&&_0x1594f8&&(_0x427c71['view']['headerView']['iconView']['content']=_0x1594f8)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x427c71['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 _0x122e86=this['_editor']['plugins']['get']('Dialog'),{id:_0x1bae04,title:_0x35bed2,icon:_0x492fb6,class:_0x372865,mainView:_0x4766df}=this['_currentConfig'];_0x4766df['delegate'](...aa)['to'](this),_0x122e86['show']({'title':_0x35bed2,'icon':_0x492fb6,'hasCloseButton':!0x0,'id':_0x1bae04,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x372865||''),'content':_0x4766df,'onShow':_0xc1ba0e=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0xc1ba0e['view']?.['updatePosition']();const _0x3f8f3a=this['_getSelectionElements']();_0x3f8f3a&&_0x3f8f3a[0x0]&&Rt({'target':_0x3f8f3a[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0xc1ba0e['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x1bae04});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x1bae04}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x2734ff,_0x14825e,_0x7cd10){const _0x37e82c=_0x14825e||_0x7cd10;if(!_0x37e82c)return null;const _0x311cb7=this['_getSelectionElements']();if(!_0x311cb7||0x0===_0x311cb7['length'])return{'left':Math['round'](_0x37e82c['left']+_0x37e82c['width']/0x2-_0x2734ff['width']/0x2),'top':Math['round'](_0x37e82c['top']+_0x37e82c['height']/0x2-_0x2734ff['height']/0x2)};const _0x5a0d52=Math['round'](_0x37e82c['left']+_0x37e82c['width']/0x2-_0x2734ff['width']/0x2),_0x1808e9=_0x311cb7['map'](_0x177c69=>new At(_0x177c69)),_0x3fea47=_0x2734ff['height'];return{'left':_0x5a0d52,'top':this['_calculateOptimalTopPosition'](_0x1808e9,_0x3fea47,_0x37e82c)};}['_calculateOptimalTopPosition'](_0x548a7f,_0x3bdd76,_0x59a2b3){const _0x7fa1cd=new At(Tt['window']),_0x29ac2e=_0x548a7f['map'](_0x5570e1=>_0x5570e1['getVisible']())['filter'](_0x2f75eb=>_0x2f75eb),_0x2b1735=At['getBoundingRect'](_0x29ac2e);if(!_0x2b1735)return Math['round'](_0x59a2b3['top']+_0x59a2b3['height']/0x2);const _0x4c54e0=_0x7fa1cd['getIntersection'](_0x2b1735);if(!_0x4c54e0)return Math['round'](_0x59a2b3['top']+_0x59a2b3['height']/0x2);const _0x13fabd=_0x59a2b3['getVisible'](),_0xb16e73=_0x13fabd&&_0x2b1735['height']>_0x13fabd['height'],_0x4bfa66=_0x4c54e0['top'],_0x1f9217=_0x4c54e0['bottom'];if(_0xb16e73){const _0x28fc65=_0x7fa1cd['top']+_0x7fa1cd['height']/0x2-_0x3bdd76/0x2,_0x50fbd0=_0x4bfa66-ca-_0x7fa1cd['top'],_0x2229b6=_0x7fa1cd['bottom']-_0x1f9217-ca;return _0x50fbd0>=_0x3bdd76?Math['max'](ca,_0x4bfa66-_0x3bdd76-ca):_0x2229b6>=_0x3bdd76?_0x1f9217+ca:Math['max'](ca,_0x28fc65);}const _0x19deff=_0x4bfa66-_0x3bdd76,_0xac85af=_0x7fa1cd['bottom']-_0x1f9217-ca,_0x2788b4=_0x4bfa66-ca-_0x7fa1cd['top'];let _0x22e4ae;return _0x22e4ae=_0xac85af>=_0x3bdd76?_0x1f9217+ca:_0x2788b4>=_0x3bdd76?_0x19deff-ca:_0x4bfa66+_0x2b1735['height']/0x2-_0x3bdd76/0x2,_0x22e4ae;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x33a593=this['_editor'];this['listenTo'](_0x33a593['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x45f871,data:{newRange:_0x1aca9c}}of _0x33a593['model']['document']['differ']['getChangedMarkers']())if(_0x45f871['startsWith']('ai-selection:')&&(_0x1aca9c&&(_0x1aca9c['start']['isEqual'](_0x1aca9c['end'])||'$graveyard'==_0x1aca9c['root']['rootName'])||null==_0x1aca9c)){const _0x7333b9=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x7333b9),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x501962=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x501962['model']['document']);}['_getSelectionElements'](){const _0x25bf9f=this['_editor'];return _0x3f3ea9(_0x25bf9f['editing'],[..._0x25bf9f['model']['markers']['getMarkersGroup']('ai-selection'),..._0x25bf9f['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x2c3ffb=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x2c3ffb&&_0x2c3ffb['rootName']?_0x2c3ffb['rootName']:null;}},ua=class extends _0x411218{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x2fbf39,_0x33919e={}){super(_0x2fbf39),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x33919e};const _0x5f18d3=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x5f18d3?'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'](_0x1831f2){this['showChangesButton']['isEnabled']=_0x1831f2;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':hn,'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':hn,'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':_0x3855bb,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+hn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x58ea49=new Yt();_0x58ea49['set']({'content':_0x3afcd8}),_0x58ea49['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'+hn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+hn;},0x7d0);}),this['copyButton']['children']['add'](_0x58ea49);}['_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':hn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x52db0d=>_0x52db0d?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},da=class extends ha{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x24c7e7,_0x37ecdf){super(_0x24c7e7);const _0x4faaf4=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']=_0x37ecdf,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x24c7e7),this['_partToolbarView']=new Wn(_0x24c7e7,_0x37ecdf['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x37ecdf),this['_stateView']=new Fn(_0x24c7e7),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x24c7e7,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x24c7e7,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0xcfa7e0,_0x3712d6,_0x473ff9,_0x292ef3)=>{let _0x7ccde0,_0x3b75ef;'pending'===_0x292ef3?(_0x7ccde0=this['_partToolbarView'],_0x3b75ef=this['_stateView']):(_0x7ccde0=this['_stateView'],_0x3b75ef=this['_partToolbarView']),this['_stateView']['setState'](_0x473ff9),_0x7ccde0['isVisible']=!0x1,_0x3b75ef['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x4faaf4['to']('_state',_0x1b98f1=>'ck-ai-chat-balloon-main_state_'+_0x1b98f1)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x37ecdf);});}['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'](_0x4504b1){_0x4504b1?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x4504b1);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x967309){this['_state']=_0x967309;}['showError'](_0x179648){super['showError'](_0x179648),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x207981){super['showBlockingError'](_0x207981),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x245040){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x245040;}['togglePartToolbarEnabled'](_0x19660a){this['_partToolbarView']['isEnabled']=_0x19660a;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x14bdb7,showSuggestButton:_0x1d2907}){_0x14bdb7=_0x14bdb7&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x1d2907=_0x1d2907&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x14bdb7,'showSuggestButton':_0x1d2907});}['_createNextButtonView'](){const _0x2f72dd=new Ht(this['locale']);return _0x2f72dd['set']({'icon':_0x45bedb,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x2f72dd['on']('execute',()=>{this['fire']('showNext');}),_0x2f72dd;}['_createPreviousButtonView'](){const _0x2fecbc=new Ht(this['locale']);return _0x2fecbc['set']({'icon':_0x4195d0,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x2fecbc['on']('execute',()=>{this['fire']('showPrevious');}),_0x2fecbc;}},_a=class extends _0x9561fa{constructor(_0x55aac2,_0x3c9fc7){super(_0x55aac2),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x3c9fc7});}},ga=class extends _0x3fb090{static get['requires'](){return[Mt,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x4a8c6){super(_0x4a8c6),this['set']('showDiff',!0x1);}['open'](_0x5a37de){const _0x1a4dfa=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x1a4dfa['plugins']['get']('AIBalloon')['open']({..._0x5a37de,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x5a37de['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x5a37de['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x7365ed){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x7365ed);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x294889){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x294889);}['_createChatBalloonView'](){const _0x16e492=this['editor'],_0x133d3e=_0x16e492['plugins']['get']('AIBalloon'),_0x416da6=_0x16e492['commands']['get']('trackChanges');let _0x310f17=_0x16e492['config']['get']('ai.availableReplyActions')||[...er];_0x16e492['plugins']['has']('TrackChanges')||(_0x310f17=_0x310f17['filter'](_0x368c1d=>'insertSuggestion'!=_0x368c1d));const _0x2f5ea1=new da(_0x16e492['locale'],{'availableActions':_0x310f17,'showApplyButton':!0x0,'showSuggestButton':!!_0x416da6});return _0x2f5ea1['bind']('showDiff')['to'](this),_0x2f5ea1['delegate'](...Nn)['to'](this),_0x2f5ea1['delegate']('showPrevious','showNext')['to'](this),_0x133d3e['delegate']('dialogClosed')['to'](this),_0x2f5ea1['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x2f5ea1['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x2f5ea1['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x416da6&&_0x2f5ea1['bind']('isTrackChangesOn')['to'](_0x416da6,'value'),_0x2f5ea1['render'](),_0x2f5ea1;}['_toggleRotatorButtonsInDialogHeader'](_0xb52848){const _0x120ade=this['editor'],_0x52f32d=_0x120ade['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0xb52848),_0x52f32d['has'](this['_chatBalloonView']['previousButtonView'])||(_0x52f32d['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x120ade['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x52f32d['remove'](this['_chatBalloonView']['previousButtonView']),_0x52f32d['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x3fb090{static get['requires'](){return[oa,ga,_0x129c58];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x4c23ea){const {editor:_0x5cf0c3,action:_0x50894f,withText:_0x239d85=!0x1,withIcon:_0x54f634=!0x0,isInDropdown:_0x46bb98=!0x0,shouldPreventFocus:_0x3475f3=!0x1,actionButtons:_0x2e7cff}=_0x4c23ea;return()=>{const _0x1c2069=_0x5cf0c3['locale'],_0x3df236=new Ht(_0x1c2069),_0x2bd46a=_0x3df236['bindTemplate'];_0x46bb98&&_0x3df236['extendTemplate']({'on':{'mouseenter':_0x2bd46a['to'](()=>{_0x3475f3&&_0x3475f3()||_0x3df236['focus']();})}}),_0x2e7cff['push']({'buttonView':_0x3df236,'action':_0x50894f});const _0x20bae0=_0x50894f['icon']??_0x50894f['parent']?.['icon'];return _0x3df236['set']({'label':_0x50894f['label'],'withText':_0x239d85,'role':'menuitem','icon':_0x54f634?_0x20bae0??_0x40e9e1:void 0x0,'tooltip':!_0x239d85,'class':'ck-ai-quick-actions-button','isEnabled':_0x50894f['isEnabled']}),_0x3df236['on']('execute',()=>{_0x5cf0c3['editing']['view']['focus'](),_0x5cf0c3['commands']['execute']('aiQuickAction',_0x50894f);}),_0x3df236;};}var pa=class extends Qt{['arrowView'];constructor(_0x498e65,_0x15e614){super(_0x498e65,_0x15e614);const _0x430aad=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',_0x34b344=>String(_0x34b344)),'data-cke-tooltip-disabled':_0x430aad['to']('isOn')},'on':{'mouseenter':_0x430aad['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x3fdd29=new Yt();return _0x3fdd29['content']=_0x5b9e25,_0x3fdd29['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x3fdd29;}},ma=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x1a9242,_0x2cdb55,_0x1f74cd){super(_0x1a9242),this['_allListItems']=_0x2cdb55,this['_allSearchableItems']=_0x1f74cd;}['filter'](_0x57b1b2){if(!_0x57b1b2)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x33a9a3=_0x57b1b2['source']['toLowerCase']()['trim'](),_0x4c1a74=this['_allSearchableItems']['filter'](_0x33d696=>(_0x33d696['groupLabel']?_0x33d696['label']+'\x20('+_0x33d696['groupLabel']+')':_0x33d696['label'])['toLowerCase']()['includes'](_0x33a9a3));return this['items']['clear'](),this['items']['addMany'](_0x4c1a74['sort']((_0x51167b,_0x2d09a4)=>{const _0xe32d2=_0x51167b['groupLabel'],_0x2c2504=_0x2d09a4['groupLabel'];return _0xe32d2||_0x2c2504?_0xe32d2?0x1:-0x1:0x0;})['map'](_0x505695=>_0x505695['item'])),this['_highlightQuery'](_0x33a9a3,_0x4c1a74),{'resultsCount':_0x4c1a74['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x27224f,_0xb1a350){if(!_0x27224f)return;const _0x178408=new RegExp(_0x42acc1(_0x27224f),'gi');_0xb1a350['forEach'](_0x5816f9=>{_0x5816f9['highlightViews']&&_0x5816f9['highlightViews']['forEach'](_0x23af16=>{'function'==typeof _0x23af16['highlightText']&&_0x23af16['highlightText'](_0x178408);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x5b16e3=>{_0x5b16e3['highlightViews']&&_0x5b16e3['highlightViews']['forEach'](_0x228867=>{'function'==typeof _0x228867['highlightText']&&_0x228867['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x9561fa{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x432f59,_0xbc3de0,_0x1914fe,_0x20a6e3,_0xf5491e=!0x1,_0x486a55=[]){const _0x140170=_0x432f59['locale'];super(_0x140170),this['_bodyCollection']=_0x20a6e3,this['_hasSearch']=_0xf5491e,this['_actionButtons']=_0x486a55;const _0x57c360=this['_createListItems'](_0x432f59,_0xbc3de0,_0x1914fe);this['optionsListView']=new ma(_0x140170,_0x57c360,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x57c360),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0xf5491e&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x57c360,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0xf5491e&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x428958=_0xf5491e&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x18f546(_0x428958),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x140170['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x105f16(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 _0x3eee62=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3eee62);}['_createListItems'](_0x3970ec,_0x20da26,_0x596018){const _0x4d2d6c=new _0x18f546();return _0x20da26['forEach'](_0x324d09=>{if('actions'in _0x324d09){const {listItem:_0x2a8e5d}=this['_createActionGroupButton'](_0x3970ec,_0x324d09,_0x596018);_0x4d2d6c['add'](_0x2a8e5d),_0x324d09['actions']['forEach'](_0x3c5286=>{const {listItem:_0x5eada2,highlightViews:_0x1a389e}=this['_createSearchResultActionButton'](_0x3970ec,_0x3c5286,_0x324d09['label'],_0x324d09['icon']);this['_allSearchableItems']['push']({'item':_0x5eada2,'label':_0x3c5286['label'],'groupLabel':_0x324d09['label'],'highlightViews':_0x1a389e});});}else{const {listItem:_0x3ca62c}=this['_createActionButton'](_0x3970ec,_0x324d09);_0x4d2d6c['add'](_0x3ca62c);const _0x5af635=_0x3ca62c['children']['first'];if(_0x5af635){const {listItem:_0x480978,highlightViews:_0x379b60}=this['_createSearchResultActionButton'](_0x3970ec,_0x324d09);this['_allSearchableItems']['push']({'item':_0x480978,'label':_0x5af635['label']||'','highlightViews':_0x379b60});}}}),_0x4d2d6c;}['_createActionButton'](_0x2b97f1,_0x29d655,_0x3520c3,_0xbe1a34){const _0x2070b3=new zt(this['locale']);if(_0x3520c3&&_0xbe1a34){const _0x337f18=new Ht(this['locale']),_0xd835c0=_0x337f18['bindTemplate'],_0x327cc3=new Wt();_0x327cc3['text']=_0x29d655['label'];const _0x5cceca=new Wt();_0x5cceca['text']=_0x3520c3;const _0x33ebf0=new Yt();_0x33ebf0['content']=_0xbe1a34,_0x33ebf0['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2c7bc9=new _0x9561fa(this['locale']);_0x2c7bc9['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x5c756e=new _0x9561fa(this['locale']);return _0x5c756e['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x337f18['set']({'label':_0x29d655['label']+'\x20('+_0x3520c3+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x29d655['isEnabled']}),_0x337f18['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0xd835c0['if']('isEnabled','ck-disabled',_0x551cfc=>!_0x551cfc)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x327cc3,_0x2c7bc9,_0x33ebf0,_0x5cceca,_0x5c756e],'on':{'mouseenter':_0xd835c0['to'](()=>{this['_isSearchFocused']()||_0x337f18['focus']();}),'click':_0xd835c0['to'](()=>{_0x337f18['fire']('execute');})}}),_0x337f18['on']('execute',()=>{_0x337f18['isEnabled']&&(_0x2b97f1['editing']['view']['focus'](),_0x2b97f1['commands']['execute']('aiQuickAction',_0x29d655));}),_0x2070b3['children']['add'](_0x337f18),this['_actionButtons']['push']({'buttonView':_0x337f18,'action':_0x29d655}),{'listItem':_0x2070b3,'highlightViews':[_0x327cc3,_0x5cceca]};}{const _0x12d9d1=new Pt(),_0x5dbe18=new Ht(this['locale'],_0x12d9d1),_0x343cc8=_0x5dbe18['bindTemplate'],_0x347686=_0x29d655['icon']??_0x29d655['parent']?.['icon'],_0xdee13=void 0x0!==_0x29d655['icon'];return _0x5dbe18['set']({'label':_0x29d655['label'],'withText':!0x0,'role':'menuitem','icon':_0xdee13?_0x347686??_0x40e9e1:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x29d655['isEnabled']}),_0x5dbe18['extendTemplate']({'on':{'mouseenter':_0x343cc8['to'](()=>{this['_isSearchFocused']()||_0x5dbe18['focus']();})}}),_0x5dbe18['on']('execute',()=>{_0x2b97f1['editing']['view']['focus'](),_0x2b97f1['commands']['execute']('aiQuickAction',_0x29d655);}),_0x2070b3['children']['add'](_0x5dbe18),this['_actionButtons']['push']({'buttonView':_0x5dbe18,'action':_0x29d655}),{'listItem':_0x2070b3,'highlightViews':[_0x12d9d1]};}}['_createSearchResultActionButton'](_0x1ca0fe,_0x3d31c9,_0x18c404,_0x2fd15d){return _0x18c404&&_0x2fd15d?this['_createSearchResultGroupedActionButton'](_0x1ca0fe,_0x3d31c9,_0x18c404,_0x2fd15d):this['_createSearchResultIndividualActionButton'](_0x1ca0fe,_0x3d31c9);}['_createSearchResultGroupedActionButton'](_0x1be140,_0xa3bd2,_0x5604be,_0x1445e5){const _0x35a37a=new zt(this['locale']),_0x5de40f=new Ht(this['locale']),_0x1dced0=_0x5de40f['bindTemplate'],{view:_0x4e3e58,highlightView:_0x46e84c}=this['_createSearchResultGroupRow'](_0x5604be,_0x1445e5),{view:_0x2d1729,highlightView:_0x3e8ce6}=this['_createSearchResultActionRow'](_0xa3bd2['label']),_0x5a44a6=this['_createSearchResultContentView'](_0x4e3e58,_0x2d1729);return _0x5de40f['set']({'label':_0xa3bd2['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':_0xa3bd2['isEnabled']}),_0x5de40f['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',_0x1dced0['if']('isEnabled','ck-disabled',_0x56021b=>!_0x56021b)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x5a44a6],'on':{'mouseenter':_0x1dced0['to'](()=>{this['_isSearchFocused']()||_0x5de40f['focus']();}),'click':_0x1dced0['to'](()=>{this['_handleSearchResultButtonClick'](_0x5de40f);})}}),this['_setupActionButtonExecution'](_0x5de40f,_0x1be140,_0xa3bd2),_0x35a37a['children']['add'](_0x5de40f),this['_actionButtons']['push']({'buttonView':_0x5de40f,'action':_0xa3bd2}),{'listItem':_0x35a37a,'highlightViews':[_0x46e84c,_0x3e8ce6]};}['_createSearchResultIndividualActionButton'](_0x18b161,_0x5cc5f8){const _0x2a0481=new zt(this['locale']),_0x3b1115=new Pt(),_0x13aea9=new Ht(this['locale'],_0x3b1115),_0x1676dd=_0x13aea9['bindTemplate'];return _0x13aea9['set']({'label':_0x5cc5f8['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x5cc5f8['isEnabled']}),_0x13aea9['extendTemplate']({'on':{'mouseenter':_0x1676dd['to'](()=>{this['_isSearchFocused']()||_0x13aea9['focus']();})}}),this['_setupActionButtonExecution'](_0x13aea9,_0x18b161,_0x5cc5f8),_0x2a0481['children']['add'](_0x13aea9),this['_actionButtons']['push']({'buttonView':_0x13aea9,'action':_0x5cc5f8}),{'listItem':_0x2a0481,'highlightViews':[_0x3b1115]};}['_createSearchResultGroupRow'](_0x2ba511,_0x1a680f){const _0x3ac0e4=new _0x9561fa(this['locale']),_0x344db3=new Yt();_0x344db3['content']=_0x1a680f,_0x344db3['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x998b79=new Wt();return _0x998b79['text']=_0x2ba511,_0x3ac0e4['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x344db3,_0x998b79]}),{'view':_0x3ac0e4,'highlightView':_0x998b79};}['_createSearchResultActionRow'](_0x50784f){const _0x1b4557=new _0x9561fa(this['locale']),_0x420d0f=new Wt();return _0x420d0f['text']=_0x50784f,_0x1b4557['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x420d0f]}),{'view':_0x1b4557,'highlightView':_0x420d0f};}['_createSearchResultContentView'](_0x16b2fe,_0x639b16){const _0x4d2dcc=new _0x9561fa(this['locale']);return _0x4d2dcc['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x16b2fe,_0x639b16]}),_0x4d2dcc;}['_setupActionButtonExecution'](_0x5e3280,_0x1a7087,_0x2e817b){_0x5e3280['on']('execute',()=>{_0x5e3280['isEnabled']&&(_0x1a7087['editing']['view']['focus'](),_0x1a7087['commands']['execute']('aiQuickAction',_0x2e817b));});}['_createActionGroupButton'](_0x1d738b,_0x4b9a75,_0x453c79){const _0x387c5f=new zt(this['locale']),_0x2d23d5=new Pt(),_0x7b8aa1=new pa(this['locale'],_0x2d23d5),_0x5494c1=_0x7b8aa1['bindTemplate'],_0x558218=this['_getPanelKeystroke'](_0x453c79),_0x2f0e8c=this['_createGroupActionsList'](_0x1d738b,_0x4b9a75['actions'],_0x453c79);_0x7b8aa1['set']({'label':_0x4b9a75['label'],'withText':!0x0,'role':Ta,'icon':_0x4b9a75['icon']??_0x40e9e1,'isEnabled':_0x4b9a75['actions']['some'](_0x2ae416=>_0x2ae416['isEnabled'])}),_0x7b8aa1['extendTemplate']({'on':{'mouseenter':_0x5494c1['to'](()=>{this['_isSearchFocused']()||_0x7b8aa1['focus']();})}});const _0x57a243=new yt(this['locale']);return _0x57a243['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x5494c1['to'](_0x549fbb=>{this['_handlePanelKeydown'](_0x549fbb,_0x558218,_0x7b8aa1,_0x57a243);})}}),_0x7b8aa1['bind']('isOn')['to'](_0x57a243,'isVisible'),this['_bodyCollection']['add'](_0x57a243),_0x57a243['content']['add'](_0x2f0e8c),this['_setupGroupMenuBehavior'](_0x7b8aa1,_0x57a243),_0x387c5f['children']['add'](_0x7b8aa1),this['_actionButtons']['push']({'buttonView':_0x7b8aa1,'action':_0x4b9a75}),{'listItem':_0x387c5f,'highlightView':_0x2d23d5};}['_createGroupActionsList'](_0x1644e8,_0x2a1ad1,_0x3fcdbd){const _0x10613b=new jt(this['locale']);return _0x10613b['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x2a1ad1['forEach'](_0x2fde96=>{const _0x136355=new zt(this['locale']),_0x3e25f8=Ia({'editor':_0x1644e8,'action':_0x2fde96,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x136355['children']['add'](_0x3e25f8),_0x3fcdbd['focusTracker']['add'](_0x3e25f8),_0x10613b['items']['add'](_0x136355);}),_0x10613b;}['_setupGroupMenuBehavior'](_0xa0f1d5,_0x21ae2f){const _0x583047=_0xa0f1d5['bindTemplate'],_0x239215=this['_getButtonKeystroke'](_0xa0f1d5);_0xa0f1d5['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x583047['to'](()=>{this['_showNestedPanel'](_0x21ae2f,_0xa0f1d5);}),'mouseleave':_0x583047['to'](_0x45b70c=>{const _0x22599f=_0x45b70c['relatedTarget'];this['_isMovingToNestedMenu'](_0x22599f,_0x21ae2f)||this['_hideNestedPanel'](_0x21ae2f);}),'keydown':_0x583047['to'](_0xeb6bd=>{_0xeb6bd['key']==_0x239215&&(this['_showNestedPanel'](_0x21ae2f,_0xa0f1d5),_0x21ae2f['content']['get'](0x0)['focus']());})}}),_0x21ae2f['on']('render',()=>{_0x21ae2f['element']?.['addEventListener']('mouseleave',_0x50dea6=>{const _0x10c792=_0x50dea6['relatedTarget'];_0xa0f1d5['element']?.['contains'](_0x10c792)||this['_isMovingToNestedMenu'](_0x10c792,_0x21ae2f)||this['_hideNestedPanel'](_0x21ae2f);});});}['_showNestedPanel'](_0xc75df3,_0x290f93){this['_openNestedPanels']['forEach'](_0x20d87c=>{_0x20d87c!==_0xc75df3&&_0x20d87c['isVisible']&&_0x20d87c['hide']();}),_0xc75df3['show'](),_0xc75df3['pin']({'positions':[Ut['eastSouth']],'target':_0x290f93['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0xc75df3);}['_hideNestedPanel'](_0x4ac0b7){_0x4ac0b7['hide'](),this['_openNestedPanels']['delete'](_0x4ac0b7);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x28a2d9=>_0x28a2d9['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x492d7c,_0x319f5e){if(!_0x492d7c)return!0x1;if(_0x319f5e['element']?.['contains'](_0x492d7c))return!0x0;const _0x3ebf7e=_0x492d7c;return _0x3ebf7e['closest']&&(null!==_0x3ebf7e['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x3ebf7e['closest']('.ck-ai-quick-actions-group-list')||null!==_0x3ebf7e['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'](_0x55e23b){return'rtl'===_0x55e23b['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x289327){return'rtl'===_0x289327['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x1afad2,_0x3602b6,_0x3713c2,_0x2f9229){_0x1afad2['key']==_0x3602b6&&(_0x3713c2['focus'](),this['_hideNestedPanel'](_0x2f9229));}['_handleSearchResultButtonClick'](_0x56b984){_0x56b984['fire']('execute');}};function Ca(_0x581a70){const {editor:_0xa980d2,content:_0x13260e,buttonDefinition:_0x5a49da,bodyCollection:_0x4ef183,hasSearch:_0x114e3a=!0x1,actionButtons:_0x2f7bb4}=_0x581a70;return()=>{const _0x3b2a43=_0xa980d2['locale'],_0x3ad68f=_0xa980d2['commands']['get']('aiQuickAction'),_0x534a3e=_0x4acf15(_0x3b2a43);_0x534a3e['bind']('isEnabled')['to'](_0x3ad68f),_0x534a3e['buttonView']['set']({'icon':_0x5a49da['icon']??_0x40e9e1,'label':_0x5a49da['label'],'tooltip':!0x0}),_0x534a3e['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x545934=new wa(_0xa980d2,_0x13260e,_0x534a3e,_0x4ef183,_0x114e3a,_0x2f7bb4);return _0x534a3e['panelView']['children']['add'](_0x545934),_0x114e3a&&_0x534a3e['on']('change:isOpen',(_0x289022,_0x5998f5,_0x291d55)=>{if(_0x291d55){if(_0xa980d2['plugins']['has']('AIEditing')){const _0x1d5162=_0xa980d2['plugins']['get'](Is),_0x5a07d4=_0xa980d2['model']['document']['selection'],_0x71bfd3=Array['from'](_0x5a07d4['getRanges']());_0x71bfd3['length']>0x0&&_0x1d5162['showFakeVisualSelection']({'editor':_0xa980d2,'ranges':_0x71bfd3,'id':'quick-action','priority':0x14});}}else _0xa980d2['plugins']['has']('AIEditing')&&_0xa980d2['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x545934['resetSearch']();}),_0x534a3e;};}const fa='<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>',ba='<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>',Sa='<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>',Ra=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var Oa=class AIQuickActionsUI extends _0x3fb090{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,nn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiquickactions');const _0x6b202f=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x6b202f),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x54ecbb){return function(_0x140c06){const _0x2e9c19=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x140c06['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x140c06,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x4ebdfa},{'id':'chat-commands','label':us(_0x140c06,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x4ebdfa,'actions':[{'id':'explain','label':us(_0x140c06,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x140c06,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x2e9c19),'type':'chat'},{'id':'summarize','label':us(_0x140c06,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x140c06,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x2e9c19),'type':'chat'},{'id':'highlight-key-points','label':us(_0x140c06,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x140c06,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x2e9c19),'type':'chat'}]},{'id':'improve-writing','label':us(_0x140c06,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x502ed5},{'id':'continue','label':us(_0x140c06,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x3578f6},{'id':'fix-grammar','label':us(_0x140c06,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x36b440},{'id':'adjust-length','label':us(_0x140c06,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2419c3,'actions':[{'id':'make-shorter','label':us(_0x140c06,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x140c06,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x140c06,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3bdecd,'actions':[{'id':'make-tone-casual','label':us(_0x140c06,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x140c06,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x140c06,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x140c06,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x140c06,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x23533e,'actions':[{'id':'translate-to-english','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x140c06,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x140c06,'AI_QUICK_ACTIONS_OTHER'),'icon':_0xae41ea,'actions':[]}];}(_0x54ecbb);}['_getDefaultAndCustomActions'](){const _0x2b80af=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x27e240=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x559dca=>({..._0x559dca,'type':'chat'===_0x559dca['type']?'chat':'action','icon':void 0x0}));return _0x2b80af['find'](_0x4f603c=>'other'===_0x4f603c['id'])['actions']['push'](..._0x27e240),_0x2b80af;}async['_initActionTypeQuickActions'](){try{const _0x2685df=new Qs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x2b80ce=await _0x2685df['getAll'](),_0x18b884=(await _0x2685df['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x18b884),this['_enableButtonsByType']('action',_0x4e0288=>!!_0x2b80ce['find'](_0x1a2236=>_0x1a2236['id']===_0x4e0288['model'])||void 0x0===_0x4e0288['model']);}catch(_0x5345ff){const _0x43b67e=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x5345ff});this['_reporter']['logError'](_0x43b67e);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x45f61a=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x45f61a,'change:isConversationReady',(_0x23ec3c,_0x1038ea,_0x25d2c9)=>{_0x25d2c9&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x45f61a['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3c945c,_0x42fca5){this['_quickActionsDefinition']['forEach'](_0x166856=>{'actions'in _0x166856?_0x166856['actions']['forEach'](_0x3f6a35=>{_0x3f6a35['type']===_0x3c945c&&(_0x3f6a35['isEnabled']=_0x42fca5(_0x3f6a35));}):_0x166856['type']===_0x3c945c&&(_0x166856['isEnabled']=_0x42fca5(_0x166856));}),this['_actionButtons']['forEach'](_0x25d8df=>{if(va(_0x25d8df['action']))return;if(_0x25d8df['action']['type']!==_0x3c945c)return;const _0x74cff7=_0x42fca5(_0x25d8df['action']);if(_0x25d8df['action']['isEnabled']=_0x74cff7,_0x25d8df['buttonView']['isEnabled']=_0x74cff7,!_0x74cff7&&_0x25d8df['action']['model']){const _0x3816a7=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x25d8df['action']['id'],'modelId':_0x25d8df['action']['model']});this['_reporter']['logError'](_0x3816a7);}}),this['_actionButtons']['filter'](_0x53ad71=>va(_0x53ad71['action']))['forEach'](_0x3d9421=>{_0x3d9421['buttonView']['isEnabled']=_0x3d9421['action']['actions']['some'](_0x7d61d2=>_0x7d61d2['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x17fcea,group:_0x7d9de1})=>{_0x17fcea['isEnabled']=_0x7d9de1['actions']['some'](_0x5580f1=>_0x5580f1['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x462e91){this['_actionButtons']['forEach'](_0x1ab8e4=>{va(_0x1ab8e4['action'])||'action'===_0x1ab8e4['action']['type']&&(_0x1ab8e4['action']['model']||(_0x1ab8e4['action']['model']=_0x462e91));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x339684=new Lt(this['editor']['locale']);_0x339684['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x339684),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x339684);}['_initializeQuickActionsDropdown'](_0x18ae6b){const _0x2bbbd9=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x40e9e1,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x18ae6b,'hasSearch':_0x2bbbd9,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0xb88103){this['_quickActionsDefinition']=_0xb88103['map'](_0x1992fc=>{if('actions'in _0x1992fc){const _0x3e16f7=_0x1992fc;return{..._0x3e16f7,'actions':_0x3e16f7['actions']['map'](_0x32c0fa=>{const {actions:_0x38afd9,..._0x52e9d8}=_0x3e16f7;return{..._0x32c0fa,'isEnabled':!0x1,'parent':_0x52e9d8};})['filter'](_0xc5f8e8=>this['_shouldIncludeAction'](_0xc5f8e8))};}return{..._0x1992fc,'isEnabled':!0x1};})['filter'](_0x4ca3b9=>'actions'in _0x4ca3b9?_0x4ca3b9['actions']['length']>0x0:this['_shouldIncludeAction'](_0x4ca3b9));}['_shouldIncludeAction'](_0x48a5d1){const _0x47e8d3=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x48a5d1['type']])&&!_0x47e8d3['includes'](_0x48a5d1['id'])&&!('chat'===_0x48a5d1['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x651665){this['_quickActionsDefinition']['forEach'](_0x1ddef1=>{if('actions'in _0x1ddef1){const _0x5a2eca=Ca({'editor':this['editor'],'content':_0x1ddef1['actions'],'buttonDefinition':_0x1ddef1,'bodyCollection':_0x651665,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1ddef1['id'],_0x5a2eca),_0x1ddef1['actions']['forEach'](_0x475a0e=>{const _0xf7303b=Ia({'editor':this['editor'],'action':_0x475a0e,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x475a0e['id'],_0xf7303b);});}else{const _0x2e30f5=Ia({'editor':this['editor'],'action':_0x1ddef1,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1ddef1['id'],_0x2e30f5);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x92f572=>{const _0x5466d8=this['editor']['commands']['get']('aiQuickAction'),_0x5d0962=new _0x512173(_0x92f572),_0x19096d=us(_0x92f572,'AI_QUICK_ACTIONS_HEADING');_0x5d0962['buttonView']['set']({'label':_0x19096d,'icon':_0x40e9e1});const _0x39b8ed=new te(_0x92f572);return _0x39b8ed['set']({'ariaLabel':_0x19096d,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x3e9e15=>{if('actions'in _0x3e9e15){const _0x512d9d=_0x3e9e15,_0x522403=new Zt(_0x92f572,_0x5d0962),_0x5b6d36=new _0x512173(_0x92f572),_0x3bd56e=new te(_0x92f572);_0x5b6d36['buttonView']['set']({'label':_0x512d9d['label'],'icon':_0x512d9d['icon']}),_0x512d9d['actions']['forEach'](_0x2b8f1f=>{const _0x34ed22=new Zt(_0x92f572,_0x5b6d36),_0x293e7f=new Jt(_0x92f572);_0x293e7f['set']({'label':_0x2b8f1f['label'],'icon':_0x2b8f1f['icon'],'role':'menuitem','isEnabled':_0x2b8f1f['isEnabled']}),_0x293e7f['on']('execute',()=>{this['_executeQuickAction'](_0x2b8f1f);}),this['_actionButtons']['push']({'buttonView':_0x293e7f,'action':_0x2b8f1f}),_0x293e7f['delegate']('execute')['to'](_0x5b6d36),_0x34ed22['children']['add'](_0x293e7f),_0x3bd56e['items']['add'](_0x34ed22);}),_0x5b6d36['isEnabled']=_0x512d9d['actions']['some'](_0x59f334=>_0x59f334['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x5b6d36,'group':_0x512d9d}),_0x5b6d36['panelView']['children']['add'](_0x3bd56e),_0x522403['children']['add'](_0x5b6d36),_0x39b8ed['items']['add'](_0x522403);}else{const _0x4fde2f=_0x3e9e15,_0x54a952=new Zt(_0x92f572,_0x5d0962),_0x52a72b=new Jt(_0x92f572);_0x52a72b['set']({'label':_0x4fde2f['label'],'icon':_0x4fde2f['icon'],'role':'menuitem','isEnabled':_0x4fde2f['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x52a72b,'action':_0x4fde2f}),_0x52a72b['on']('execute',()=>{this['_executeQuickAction'](_0x4fde2f);}),_0x52a72b['delegate']('execute')['to'](_0x5d0962),_0x54a952['children']['add'](_0x52a72b),_0x39b8ed['items']['add'](_0x54a952);}}),Object['values'](Ra)['some'](_0x389fb0=>this['editor']['plugins']['has'](_0x389fb0))?_0x5d0962['bind']('isEnabled')['to'](_0x5466d8):_0x5d0962['set']({'isEnabled':!0x1}),_0x5d0962['panelView']['children']['add'](_0x39b8ed),_0x5d0962;});}['_executeQuickAction'](_0x7b7614){const _0x2f75a7=this['editor'];_0x2f75a7['editing']['view']['focus'](),_0x2f75a7['commands']['execute']('aiQuickAction',_0x7b7614);const _0xe52418=_0x2f75a7['ui']['view']['menuBarView'];_0xe52418&&_0xe52418['close']&&_0xe52418['close']();}};function va(_0x20cdf7){return'actions'in _0x20cdf7;}function ka(_0x48fb1e,_0x17650b){const _0x55be90=_0x48fb1e['plugins']['get']('AITabs')['view'];_0x55be90['isVisible']=!0x0,_0x55be90['activateTab'](_0x17650b);}var Na=class extends _0x492f00{['execute'](_0x2d5852){switch(this['_expandSelectionIfCollapsed'](),_0x2d5852['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3c9e09=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3c9e09});}this['_handleAIChatAction'](_0x2d5852);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x4194e3=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x4194e3});}this['_handleAIActionsAction'](_0x2d5852);}}async['_handleAIChatAction'](_0x232bd6){const _0xa69dce=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x232bd6['id'])_0xa69dce['removeSelectionFromChatContext'](),_0xa69dce['addSelectionToChatContext'](this['editor']),_0xa69dce['focusPromptInput']();else await _0xa69dce['startConversation']({'modelId':_0x232bd6['model']}),_0xa69dce['removeSelectionFromChatContext'](),_0xa69dce['addSelectionToChatContext'](this['editor']),_0xa69dce['focusPromptInput'](),await _0xa69dce['sendMessage']({'message':_0x232bd6['prompt']||_0x232bd6['displayedPrompt']||_0x232bd6['label'],'attributes':{'quickActionData':{'id':_0x232bd6['id']},'displayedPrompt':_0x232bd6['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x155281=this['editor'],_0x2260ad=_0x155281['model']['document']['selection'];if(!_0x2260ad['isCollapsed'])return;const _0x55d5f4=mt(_0x2260ad['getSelectedBlocks']())||_0x155281['model']['schema']['getLimitElement'](_0x2260ad);_0x155281['model']['change'](_0x3bc571=>{_0x3bc571['setSelection'](_0x55d5f4,'in');});}['_handleAIActionsActionLabel'](_0x1c478a){return _0x1c478a['parent']?.['label']&&'other'!==_0x1c478a['parent']?.['id']?_0x1c478a['parent']['label']+':\x20'+_0x1c478a['label']:_0x1c478a['label'];}async['_handleAIActionsAction'](_0x438381){const _0x2b1e8d=this['editor']['plugins']['get']('AIActions'),_0x1ad915=_0x438381['prompt']?{'userMessage':_0x438381['prompt'],'model':_0x438381['model']}:{'actionName':_0x438381['actionName']||_0x438381['id'],'args':_0x438381['args']},_0xf4b915=this['_handleAIActionsActionLabel'](_0x438381);await _0x2b1e8d['executeAction'](_0x1ad915,_0xf4b915,_0x438381['icon']);}},ya=class extends _0x3fb090{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x23dca8=this['editor'],_0x519428=new Na(this['editor']);if(_0x23dca8['commands']['add']('aiQuickAction',_0x519428),_0x23dca8['plugins']['has']('AIChat')){const _0x1e9e2a=this['editor']['plugins']['get']('AIChatController');_0x23dca8['model']['document']['selection']['on']('change:range',(_0x1568a2,_0x471290)=>{_0x471290['directChange']&&_0x1e9e2a['removeSelectionFromChatContext']();});}}},xa=class extends dn{['appendContent'](_0x4d661c,_0x413e7e='text'){'modification'===this['type']&&'text'===_0x413e7e&&(_0x413e7e=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x4d661c,_0x413e7e);}['updateChangeGroups'](_0x1d2073){const _0x3a1ef7=this['parsedContent']['get'](_0x1d2073)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1d2073,_0x3a1ef7),this['changeGroups']=[],0x0==_0x3a1ef7['childNodes']['length'])return;Ds(this['documentContextContent']['get'](_0x1d2073),this['parsedMergedContent']['get'](_0x1d2073));const _0x4e7164=_0x47a983(this['documentContextContent']['get'](_0x1d2073)['children']['map'](_0x303b08=>({'node':_0x303b08,'id':fs(_0x303b08,'data-id')})),_0x3a1ef7['children']['map'](_0x1a401f=>({'node':_0x1a401f,'id':fs(_0x1a401f,'data-id')||vt()})),{'comparator':(_0x3f9840,_0x2f06a7)=>_0x3f9840['id']==_0x2f06a7['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x4e7164['length']&&_0x4e7164[_0x4e7164['length']-0x1]['removed'];)_0x4e7164['pop']();}const _0x2d8e72=_0x4e7164['map'](_0x54f046=>{const _0xf72a9d=_0x54f046['added']?'new':_0x54f046['removed']?'removed':'modified';return{'node':_0x54f046['value'][0x0]['node'],'type':_0xf72a9d,'id':_0x54f046['value'][0x0]['id']};}),_0x1cef25=this['_documentIdToSource']['get'](_0x1d2073);this['changeGroups']['push']({'changes':_0x2d8e72,'state':'pending','index':this['changeGroups']['length'],'editor':_0x1cef25['editor'],'rootName':_0x1cef25['rootName'],'documentId':_0x1d2073});}['_getDifferentChangeGroups'](_0x4c5de7,_0x44dd4a){return _0x44dd4a;}},La=class extends An{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x1cefcf){super(_0x1cefcf),this['content']=_0x1cefcf['content'],this['version']=_0x1cefcf['version'],this['editor']=_0x1cefcf['editor'],this['rootName']=_0x1cefcf['rootName'],this['actionName']=_0x1cefcf['actionName'],this['args']=_0x1cefcf['args'],this['userMessage']=_0x1cefcf['userMessage'],this['model']=_0x1cefcf['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'](_0x33191c){const _0x4affc3=this['editor']['config']['get']('collaboration.channelId'),_0x199fdb=new xa({..._0x33191c,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x4affc3,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x4affc3,this['editor']]])});return this['replies']['push'](_0x199fdb),_0x199fdb['delegate'](...gn)['to'](this),this['fire']('replyCreated',_0x199fdb),_0x199fdb;}},Da=class extends _0x411218{constructor(_0x496088,_0x569f2c=!0x0,_0x17e90c=!0x0){super(_0x496088),this['set']('isEnabled',!0x1),_0x569f2c&&(this['applyButton']=this['_createButton'](us(_0x496088,'AI_BALLOON_APPLY_BUTTON'),on),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x17e90c&&(this['suggestButton']=this['_createButton'](us(_0x496088,'AI_BALLOON_SUGGEST_BUTTON'),_0x569f2c?an:on),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x569f2c,'showSuggestButton':_0x17e90c}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x4c586b,showSuggestButton:_0x585625}){this['applyButton']&&(this['applyButton']['isVisible']=_0x4c586b),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x585625);}['_createButton'](_0x36f6ae,_0x45945){const _0x55dba2=new Ht(this['locale']);return _0x55dba2['set']({'label':_0x36f6ae,'class':_0x45945,'isVisible':!0x0,'withText':!0x0}),_0x55dba2;}},Pa=class extends _0x9561fa{constructor(_0x5ec2d6){super(_0x5ec2d6),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(_0x5ec2d6,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x9561fa{constructor(_0x2d4d61){super(_0x2d4d61),this['set']('isVisible',!0x0);const _0x10e4fc=new cr('small');_0x10e4fc['isVisible']=!0x0;const _0x5dbeb1=new _0x9561fa(this['locale']);_0x5dbeb1['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',_0xd8c7f1=>!_0xd8c7f1)]},'children':[_0x10e4fc,_0x5dbeb1]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x3d44ea,_0x51ef16){super(_0x3d44ea),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x51ef16,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 _0x18f546(),this['_addContentWrapper'](_0x51ef16),this['_addDisclaimerView'](),this['_addToolbar'](_0x51ef16),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'](_0x51ef16);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x66840e of this['_focusables'])this['_focusTracker']['add'](_0x66840e['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x1ac82a){-0x1===_0x1ac82a?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x4588be){this['_isLoading']=_0x4588be;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x1c7423){super['showError'](_0x1c7423),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x5be414){super['showBlockingError'](_0x5be414),this['setErrorState']();}['addMiniToolbarItem'](_0xae2fdc){this['_miniToolbarView']['items']['has'](_0xae2fdc)||this['_miniToolbarView']['items']['add'](_0xae2fdc);}['removeMiniToolbarItem'](_0xff0d8c){this['_miniToolbarView']['items']['has'](_0xff0d8c)&&this['_miniToolbarView']['items']['remove'](_0xff0d8c);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x85418d,showSuggestButton:_0x4899d9}){_0x85418d=_0x85418d&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x4899d9=_0x4899d9&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x85418d,'showSuggestButton':_0x4899d9});}async['updateContent'](_0x4f897d){await this['_streamableContentView']['update'](_0x4f897d);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x557579){this['_contentWrapper']=new _0x9561fa(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'](_0x557579['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x36a10c,showSuggestButton:_0x486c37}){this['_toolbarView']=new Da(this['locale'],_0x36a10c,_0x486c37),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',(_0x21c60f,_0x5ac972,_0x155a7f)=>!(_0x21c60f||_0x5ac972||_0x155a7f)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x36a10c,'showSuggestButton':_0x486c37}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x542288){return this['_miniToolbarView']=new ua(this['locale'],_0x542288),this['_miniToolbarView']['delegate'](...Nn)['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',(_0x4ae1dd,_0x4bd7ab)=>!(_0x4ae1dd||_0x4bd7ab)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ha(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x535b7f=new Ht(this['locale']),_0x39265f=new Ht(this['locale']),_0x27d03a=new Va(this['locale']),_0x2adcfd=new Ht(this['locale']);_0x535b7f['set']({'icon':_0x1f7099,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+hn}),_0x39265f['set']({'icon':_0x56e661,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+hn}),_0x2adcfd['set']({'icon':_0x1513ef,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+hn}),_0x535b7f['bind']('isEnabled')['to'](this,'isBusy',_0xb06638=>!_0xb06638),_0x535b7f['on']('execute',()=>{this['fire']('tryAgain');}),_0x39265f['bind']('isEnabled')['to'](this,'isBusy',_0x493356=>!_0x493356),_0x39265f['on']('execute',()=>{this['fire']('showPrevious');}),_0x2adcfd['bind']('isEnabled')['to'](this,'isBusy',_0xfa26b8=>!_0xfa26b8),_0x2adcfd['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x39265f,this['_navigationCounter']=_0x27d03a,this['_navigationNextButton']=_0x2adcfd,this['_navigationTryAgainButton']=_0x535b7f;}['updateMiniToolbarButtons'](_0x27baa5,_0x191c5a){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x475a13=_0x27baa5>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x475a13){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x2fe890=_0x27baa5-_0x191c5a;this['_navigationCounter']['setInteractionCount'](_0x2fe890+'/'+_0x27baa5),this['_navigationPreviousButton']['isEnabled']=_0x191c5a<_0x27baa5-0x1,this['_navigationNextButton']['isEnabled']=_0x191c5a>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'](_0x88cc0a){this['_isLoading']=_0x88cc0a;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x2ef532=this['_streamableContentView']['element'],_0x1a22d5=this['_miniToolbarView']['element'],_0x186dc7=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x14a375=_0x2ef532['offsetWidth']-_0x2ef532['clientWidth'];_0x1a22d5['style']['right']='calc('+_0x14a375+'px\x20+\x20var(--ck-spacing-large))';});};_0x186dc7(),this['_miniToolbarResizeObserver']=new It(_0x2ef532,()=>{_0x186dc7();});}['_initializeScrollManager'](){const _0x1f43a9=this['_getScrollableElement']();_0x1f43a9&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x1f43a9));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x9561fa{constructor(_0x37ac25){super(_0x37ac25);const _0x1f0f6d=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x1f0f6d['to']('interactionCount')}]});}['setInteractionCount'](_0x515e78){this['set']('interactionCount',_0x515e78);}},Ua=class extends _0x3fb090{static get['requires'](){return[ls,nn,Mt,Is,la,_0x4568e8];}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(_0x41cb29){super(_0x41cb29),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](nn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x3dcd0c,_0x13523e,_0x3179ef){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0xfce61c,anchorData:_0x288b96,root:_0xd48297}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3dcd0c,_0xfce61c,_0x288b96,_0xd48297,_0x13523e,_0x3179ef);}const {modelFragment:_0x186b1a,anchorData:_0x1e7a4d,root:_0x4d3500}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3dcd0c,_0x186b1a,_0x1e7a4d,_0x4d3500,_0x13523e,_0x3179ef);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x17515c=this['editor']['plugins']['has']('TrackChanges');let _0x10c4be=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x17515c||(_0x10c4be=_0x10c4be['filter'](_0x2b50d5=>'insertSuggestion'!=_0x2b50d5));const _0x3a5b8a=this['editor']['commands']['get']('trackChanges'),_0x44a86b=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x17515c,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x10c4be});return _0x44a86b['bind']('isBusy')['to'](this),_0x3a5b8a&&_0x44a86b['bind']('isTrackChangesOn')['to'](_0x3a5b8a,'value'),_0x44a86b['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x44a86b['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x44a86b['on']('showNext',()=>{this['_navigateToNext']();}),_0x44a86b;}['_normalizeSelectionStart'](){const _0xc341a3=this['editor']['model'],_0x2f27b3=_0xc341a3['document']['selection'],_0x49d144=_0x2f27b3['getFirstRange']();if(!_0x49d144||_0x49d144['isCollapsed'])return;const _0x390fc9=mt(_0x2f27b3['getSelectedBlocks']());if(!_0x390fc9)return;const _0xb22e51=_0xc341a3['createPositionAt'](_0x390fc9,0x0);_0xb22e51['isAfter'](_0x49d144['start'])&&_0xc341a3['change'](_0x400336=>{_0x400336['setSelection'](_0x400336['createRange'](_0xb22e51,_0x49d144['end']));});}['_getExecuteDataRegular'](){const _0x2b096d=this['editor']['model']['document']['selection'],_0x5a0daa=_0x2b096d['getFirstRange']()['start']['root'];if(_0x2b096d['isCollapsed']){const _0x229257=mt(_0x2b096d['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x2b096d);this['editor']['model']['change'](_0x435ec3=>{_0x435ec3['setSelection'](_0x229257,'in');});}this['_normalizeSelectionStart']();const _0x244d99=_0x2b096d['getFirstRange'](),_0x4346e6=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x2b096d),_0x244d99['start'],_0x244d99['end']);this['_copyMarkersToFragment'](_0x4346e6,_0x2b096d,{'isTableSelection':!0x1});const _0x496f3d=_0x2b096d['getFirstRange']()['start'],_0x38d2d0=new Map();let _0x3daa67=_0x4346e6;for(let _0x33b9d3=0x0;_0x33b9d3<_0x496f3d['path']['length'];_0x33b9d3++)_0x38d2d0['set'](_0x3daa67,_0x496f3d['path'][_0x33b9d3]),_0x3daa67=_0x3daa67['getChild'](0x0);return{'modelFragment':_0x4346e6,'anchorData':_0x38d2d0,'root':_0x5a0daa};}['_getExecuteDataInTable'](){const _0x3121c4=this['editor']['model']['document']['selection'],_0x422a60=this['editor']['plugins']['get']('TableSelection'),_0x3e4855=_0x3121c4['getFirstRange']()['start']['root'],_0xeadf16=_0x422a60['getSelectionAsFragment'](),_0xc23f86=_0x3121c4['getFirstRange']()['start']['parent']['parent'],_0x2a1f59=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0xc23f86),this['editor']['model']['createPositionAfter'](_0xc23f86)),_0x1175be=this['_wrapWithCommonAncestors'](_0xeadf16,_0x2a1f59['start'],_0x2a1f59['end']);this['_copyMarkersToFragment'](_0x1175be,_0x3121c4,{'isTableSelection':!0x0});const _0x18f3d1=_0x3121c4['getFirstRange']()['start'],_0x587e6d=new Map();let _0x244e05=_0x1175be;for(let _0x4c770e=0x0;_0x4c770e<_0x18f3d1['path']['length'];_0x4c770e++)if(_0x587e6d['set'](_0x244e05,_0x18f3d1['path'][_0x4c770e]),_0x4c770e<_0x18f3d1['path']['length']-0x1)_0x244e05=_0x244e05['getChild'](0x0);else{let _0x2fe3eb=_0x244e05['nextSibling'];for(;_0x2fe3eb;)_0x587e6d['set'](_0x2fe3eb,_0x18f3d1['path'][_0x4c770e]),_0x2fe3eb=_0x2fe3eb['nextSibling'];}return{'modelFragment':_0x1175be,'anchorData':_0x587e6d,'root':_0x3e4855};}async['_executeAction'](_0x1834ed,_0x1b464a,_0x57a666,_0x289ffc,_0x4dc2aa,_0x2ef23d){const _0x1c8323=this['editor']['plugins']['get'](Is),_0x36de36=this['editor']['plugins']['get'](la),_0x355035=this['editor']['model']['document']['selection'],_0xceafaf=await _0x1c8323['modelToDataWithIds'](_0x1b464a,this['editor']),_0x12f0bf=this['editor']['model']['document']['version'],_0x176ced=[..._0x355035['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x36de36['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x4dc2aa,'icon':_0x2ef23d||_0x40e9e1,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x176ced,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x36de36),this['_interactionParams']={'action':_0x1834ed,'content':_0xceafaf,'version':_0x12f0bf,'aiBalloon':_0x36de36,'modelFragment':_0x1b464a,'anchorData':_0x57a666,'root':_0x289ffc},this['_setupApplyListeners'](),this['listenTo'](_0x36de36,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x36de36,'dialogClosed',(_0x1fa96f,{id:_0x4c4776})=>{if('aiActionsBalloon'===_0x4c4776){for(const _0x4e0d8b of this['_interactions']){if(0x0===_0x4e0d8b['replies']['length']||_0x4e0d8b['stoppedExplicitly'])continue;const _0x15362f=_0x4e0d8b['replies'][_0x4e0d8b['replies']['length']-0x1],_0x3fe1c6=_0x15362f['changeGroups'][0x0];_0x3fe1c6&&'pending'===_0x3fe1c6['state']&&_0x15362f['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x36de36);}}),this['_createInteraction'](_0xceafaf,_0x12f0bf,_0x36de36,_0x1834ed);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x1ca154,anchorData:_0x132fd0,root:_0x41e8db}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x1ca154,_0x132fd0,_0x41e8db,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x1ca154,_0x132fd0,_0x41e8db,!0x0);});}['_wrapWithCommonAncestors'](_0x10bc7a,_0x5e954c,_0x4ebe48){const _0x3af158=this['editor']['model']['createRange'](_0x5e954c,_0x4ebe48)['getCommonAncestor'](),_0x3a8bf6=_0x3af158['is']('documentFragment')?[]:_0x3af158['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x3a8bf6['length']){const _0x4ce453=_0x3a8bf6['map'](_0x1b94c4=>_0x1b94c4['_clone'](!0x1));for(let _0x2299d2=0x1;_0x2299d2<_0x4ce453['length'];_0x2299d2++)_0x4ce453[_0x2299d2-0x1]['_appendChild'](_0x4ce453[_0x2299d2]);return _0x4ce453[_0x4ce453['length']-0x1]['_appendChild'](_0x10bc7a),new _0x38a201(_0x4ce453[0x0]);}return _0x10bc7a;}['_copyMarkersToFragment'](_0x4fee01,_0x2f684a,_0xee81a8={'isTableSelection':!0x1}){const _0x201e03=this['editor']['model'],_0x13870f=Array['from'](_0x2f684a['getRanges']()),_0xab0c86=_0x2f684a['getFirstRange']()['start'];for(const _0x3a5fd3 of _0x201e03['markers']){if(_0x3a5fd3['name']['startsWith']('ai-selection')||!_0x3a5fd3['affectsData'])continue;const _0x3889e1=_0x3a5fd3['getRange']();if(!_0x13870f['some'](_0x2d014e=>_0x2d014e['containsRange'](_0x3889e1,!0x0)))continue;const _0x60d15b=this['_regularCalculateMarkerPath'](_0x3889e1['start'],_0xab0c86,_0xee81a8['isTableSelection']),_0x41a923=this['_regularCalculateMarkerPath'](_0x3889e1['end'],_0xab0c86,_0xee81a8['isTableSelection']),_0x33c2b2=_0x201e03['createPositionFromPath'](_0x4fee01,_0x60d15b),_0x6b68bd=_0x201e03['createPositionFromPath'](_0x4fee01,_0x41a923);if(!_0x33c2b2['isEqual'](_0x6b68bd)){const _0x503a5a=_0x201e03['createRange'](_0x33c2b2,_0x6b68bd);_0x4fee01['markers']['set'](_0x3a5fd3['name'],_0x503a5a);}}}['_regularCalculateMarkerPath'](_0x250287,_0x4806fa,_0x25ff25=!0x1){const _0x10751a=[..._0x250287['path']['slice']()];for(let _0x44a8fd=0x0;_0x44a8fd<Math['max'](_0x4806fa['path']['length'],_0x250287['path']['length']);_0x44a8fd++){const _0x505b19=_0x4806fa['path'][_0x44a8fd]||0x0,_0x305457=(_0x250287['path'][_0x44a8fd]||0x0)-_0x505b19;if(_0x10751a[_0x44a8fd]=_0x305457,0x0!==_0x305457&&!_0x25ff25)break;}return _0x10751a;}async['_createInteraction'](_0x5e7cb6,_0xb51324,_0x8c9f93,_0x4ad68f){const _0x40e080=this['editor'],_0x1a6120=_0x40e080['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0xc7c2a1(_0x40e080,_0x1a6120['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x4ad68f,'content':_0x5e7cb6,'version':_0xb51324,'aiBalloon':_0x8c9f93,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x1a6120});const _0x4da2d7=new La({'connector':this['_aiConnector'],'locale':_0x40e080['locale'],'content':_0x5e7cb6,'version':_0xb51324,'editor':_0x40e080,'rootName':_0x1a6120['rootName'],..._0x4ad68f});this['_interactions']['push'](_0x4da2d7);const _0x2a6de3=(_0x3cdaed,_0x32e428=!0x1,_0x3e88dc='streaming')=>{const {isDone:_0x247e07}=_0x3cdaed;return this['_promiseQueue']['enqueue'](async _0x5b4aa6=>{try{const _0x271e60=Vs({'changeGroups':_0x3cdaed['changeGroups'],'documentContextContent':_0x3cdaed['documentContextContent'],'showDiff':_0x32e428,'trimUnchanged':!0x1});_0x271e60['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x271e60[0x0],'renderingStrategy':_0x3e88dc,'abortSignal':_0x5b4aa6}),_0x247e07&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x5e5539){if(en(_0x5e5539))return;throw _0x5e5539;}});};_0x4da2d7['on']('replyCreated',(_0x2eaf8c,_0x3802e1)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x2a6de3(_0x3802e1)['catch'](_0x1c0e27=>{this['_reporter']['logError'](_0x1c0e27,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x4da2d7,_0x1c0e27);});}),_0x4da2d7['on']('replyContentUpdated',(_0x3be0ff,_0x28f3d3)=>{_0x2a6de3(_0x28f3d3)['catch'](_0xf5b286=>{this['_reporter']['logError'](_0xf5b286,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x4da2d7,_0xf5b286);});}),_0x4da2d7['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x57400d){this['_reporter']['logError'](_0x57400d,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x4da2d7,_0x57400d);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x4d04c4,{showDiff:_0xb54a0f})=>{try{this['_balloonShowDiff']=_0xb54a0f;const _0x5e3f04=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x5e3f04&&await _0x2a6de3(_0x5e3f04,_0xb54a0f,'static');}catch(_0x17f656){this['_reporter']['logError'](_0x17f656,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x4da2d7,_0x17f656);}}),_0x4da2d7['on']('replyChangeGroupStateUpdated',()=>{const _0x1f9a94={'positiveCount':_0x4da2d7['replies']['reduce']((_0x5e76ab,_0x11925e)=>_0x5e76ab+_0x11925e['changeGroups']['filter'](_0x35a2f6=>'accepted'===_0x35a2f6['state'])['length'],0x0),'totalCount':_0x4da2d7['replies']['reduce']((_0x1c5083,_0x42e20e)=>_0x1c5083+_0x42e20e['changeGroups']['length'],0x0)},_0x282b68=_0x4da2d7['actionCallId'],_0x134e11=_0x4da2d7['actionName'];_0x134e11?this['_aiConnector']['upsertAIActionRating'](_0x134e11,_0x282b68,_0x1f9a94):this['_aiConnector']['upsertCustomAIActionRating'](_0x282b68,_0x1f9a94);}),this['_setLoadingState']();try{const _0x444aa7=await _0x4da2d7['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x444aa7;}catch(_0x15fb68){en(_0x15fb68)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x15fb68,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x4da2d7,_0x15fb68);}}['_applyChanges'](_0x45ff9b,_0x35cd61,_0x4b41ce,_0x239b88){const _0x4908a4=this['editor'];if(_0x239b88&&!_0x4908a4['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x3be15c=this['editor']['plugins']['get'](_0x4568e8),_0x5177a4=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5177a4||!_0x5177a4['replies']['length'])return;const _0x327bd3=_0x5177a4['replies'][_0x5177a4['replies']['length']-0x1];_0x327bd3['setChangeGroupState'](0x0,'accepted');const _0x31686b=Rn({'documentSuggestions':On({'groups':[_0x327bd3['changeGroups'][0x0]],'documentContextContent':_0x327bd3['documentContextContent'],'documents':_0x5177a4['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x3be15c,'documentCompareOptions':{'anchor':_0x4908a4['model']['createPositionAt'](_0x45ff9b,0x0),'markDeletions':_0x239b88}})['values']()['next']()['value']??[],_0xc48bad=this['_filterOperationsOutsideRange'](_0x31686b,_0x35cd61);for(const _0x3ca135 of _0xc48bad)this['_anchorOperation'](_0x35cd61,_0x3ca135,_0x4b41ce);const _0x41f41b=_0x5177a4['getDocumentContext']()['documents'][0x0]['version'],_0x5f539b=_0x456211(_0xc48bad,_0x4908a4['model']['document']['history']['getOperations'](_0x41f41b),{'document':_0x4908a4['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];zs(_0x5f539b,'quickActions');try{_0x4908a4['model']['change'](_0x580490=>{_0x580490['setSelection'](_0x4908a4['model']['document']['selection']['focus']),_0x239b88?_0x4908a4['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x5f539b):_0x3be15c['applyOperations'](_0x580490,_0x5f539b);});}catch(_0xb6e67a){throw this['_reporter']['logError'](new sn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0xb6e67a})),_0xb6e67a;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x5f370b,_0x2fcfaa){return _0x5f370b['filter'](_0xaa628e=>{if('rename'==_0xaa628e['type']){const _0x4c33f0=_0xaa628e['position']['nodeAfter'];return!_0x2fcfaa['has'](_0x4c33f0);}if(_0xaa628e['type']['indexOf']('Attribute')>-0x1){const _0x3b952b=_0xaa628e['range']['start']['nodeAfter'];return!_0x2fcfaa['has'](_0x3b952b);}return!0x0;});}['_anchorOperation'](_0x57be81,_0x8f208c,_0x5e0481){const _0xd015=_0x8f208c['clone']();for(const _0x24990f in _0x8f208c){const _0x3976eb=_0x8f208c[_0x24990f];_0x3976eb instanceof _0x156cfa?_0x8f208c[_0x24990f]=new _0x156cfa(_0x442fd6(_0x3976eb['start']),_0x442fd6(_0x3976eb['end'])):_0x3976eb instanceof _0x435e4b&&(_0x8f208c[_0x24990f]=_0x442fd6(_0x3976eb));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0xd015['type'])){if(_0xd015['isDocumentOperation']=!0x1,_0xd015['baseVersion']=null,'remove'==_0xd015['type']){const _0x48361d=_0xd015['sourcePosition'],_0x36aa5b=_0xd015['howMany'];new _0x521b81(_0x48361d,_0x36aa5b)['_execute']();}else _0xd015['_execute']();}function _0x442fd6(_0x525a45){if('$graveyard'==_0x525a45['root']['rootName'])return _0x525a45;const _0x253624=[];let _0x5dff76=_0x525a45['root'];for(let _0xd3f390=0x0;_0xd3f390<_0x525a45['path']['length'];_0xd3f390++){const _0x220092=_0x57be81['get'](_0x5dff76)||0x0;_0x253624[_0xd3f390]=_0x525a45['path'][_0xd3f390]+_0x220092,_0x5dff76=_0x5dff76['getChildAtOffset'](_0x525a45['path'][_0xd3f390]);}return new _0x435e4b(_0x5e0481,_0x253624,_0x525a45['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x5b2e64,content:_0x36d0a5,version:_0x4f1ba8,aiBalloon:_0x4e053a}=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'](_0x36d0a5,_0x4f1ba8,_0x4e053a,_0x5b2e64)['catch'](_0x4e81d7=>{this['_reporter']['logError'](_0x4e81d7,{'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 _0x4d317e=this['_interactions']['length'];this['_currentInteractionIndex']<_0x4d317e-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x4989f3){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x4989f3;const _0xb749e7=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0xb749e7)return;if(_0xb749e7['hasError'])return this['_setErrorState'](_0xb749e7),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0xb749e7['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x547d07=_0xb749e7['replies'][_0xb749e7['replies']['length']-0x1];if(_0x547d07)try{const _0x5bc4ba=Vs({'changeGroups':_0x547d07['changeGroups'],'documentContextContent':_0x547d07['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x22f4ef=>setTimeout(_0x22f4ef,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x5bc4ba[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x46d042){this['_reporter']['logError'](_0x46d042,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x9343ce,_0x4195bc){if(void 0x0!==_0x4195bc&&en(_0x4195bc))return;const _0x49fcf3=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x49fcf3),_0x9343ce['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);}},Ba=class extends _0x3fb090{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x160005){super(_0x160005),_0x160005['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x9561fa{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x424681,_0x2af2b0){super(_0x424681),this['id']=_0x2af2b0,this['set']('status','pending'),this['set']('changeId',_0x2af2b0),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',(_0x43e2a0,_0x30304e)=>{_0x30304e&&_0x30304e['target']&&'A'===_0x30304e['target']['tagName']&&_0x30304e['preventDefault'](),this['fire']('activateChange',{'id':_0x2af2b0,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x2af2b0,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x2af2b0,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x1fef7e=new _0x9561fa(this['locale']);return _0x1fef7e['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',_0x5ac83f=>!_0x5ac83f)]}}),_0x1fef7e;}['_createAcceptButtonView'](){const _0xc8a4cc=new Ht(this['locale']);return _0xc8a4cc['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0xc8a4cc['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2fb2e7=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x2fb2e7['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x3b59a5=>'pending'!==_0x3b59a5&&'accepted'!==_0x3b59a5),this['bindTemplate']['if']('status',an,_0x4f784f=>'pending'===_0x4f784f),this['bindTemplate']['if']('status',hn,_0x36ffe5=>'pending'!==_0x36ffe5),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2052b8=>'accepted'===_0x2052b8)]}}),this['on']('change:status',(_0xb134d7,_0x463df4,_0x169ff5)=>{_0xc8a4cc['isEnabled']='pending'===_0x169ff5,'accepted'===_0x169ff5&&(_0xc8a4cc['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0xc8a4cc['icon']=_0x3afcd8);}),_0xc8a4cc;}['_createDismissButtonView'](){const _0x3dc06e=new Ht(this['locale']);return _0x3dc06e['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x3dc06e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x27e2b0=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x27e2b0['stopPropagation']();})},'attributes':{'class':[hn,this['bindTemplate']['if']('status','ck-hidden',_0x5bc0c6=>'pending'!==_0x5bc0c6&&'rejected'!==_0x5bc0c6),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x5bac33=>'pending'===_0x5bac33),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2b93dc=>'rejected'===_0x2b93dc)]}}),this['on']('change:status',(_0x2dabd5,_0x4be903,_0x5996ad)=>{_0x3dc06e['isEnabled']='pending'===_0x5996ad,'rejected'===_0x5996ad&&(_0x3dc06e['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x3dc06e['icon']=_0x3e4cf9);}),_0x3dc06e;}['_createInfoButtonView'](){const _0x1a6b23=new Ht(this['locale']);return _0x1a6b23['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x51052c,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':hn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1a6b23['bind']('isOn')['to'](this,'isInfoToggleOn',_0x41894b=>_0x41894b),_0x1a6b23['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1a6b23;}['_createOutdatedButtonView'](){const _0x935429=new Ht(this['locale']);return _0x935429['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x15f2a4,'withText':!0x0,'isEnabled':!0x1}),_0x935429['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x3459bf=>'outdated'!==_0x3459bf)],'disabled':'disabled'}}),_0x935429;}},Fa=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x3e4326,_0x1fdbd6){super(_0x3e4326),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']()),_0x1fdbd6['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x22c521){this['resultItemView']['changeId']=_0x22c521['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x22c521['contentDiffed'];}['showBalloon'](_0x581d25,_0x1e0181,_0x5c6fd3,_0x227ee7,_0x53bdb0,_0x36a950){const _0x1016bc=_0x1e0181();if(!_0x1016bc)return;this['updateContent'](_0x581d25),this['show']();const _0x5aaa02=Array['from'](_0x1016bc['getClientRects']())['reverse'](),_0x1cccbe=this['_getPointedRectIndexFromEvent'](_0x5c6fd3,_0x5aaa02),_0x3555b9=_0x5aaa02[_0x1cccbe??0x0];'click'===_0x227ee7?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x1e0181(),_0x1cccbe,_0x581d25['id'],_0x53bdb0,_0x36a950)||_0x3555b9})):'hover'===_0x227ee7&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x1e0181(),_0x1cccbe,_0x581d25['id'])||_0x3555b9}));}['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'](){_0xf72b9b({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x3ab5fb=[this['element']];return this['_pinnedTargetElement']&&_0x3ab5fb['push'](this['_pinnedTargetElement']),_0x3ab5fb;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x275b99=new _0x9561fa();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x275b99['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']]}]}),_0x275b99;}['_getBestRectPositionOnClick'](_0x5a8a07,_0x55fc61,_0x1b4f13,_0x3be8ff,_0x177b96){if(!_0x5a8a07)return null;const _0xb7e0e=this['position']['replace']('arrow_',''),_0x10a669=Array['from'](_0x5a8a07['getClientRects']());let _0x2db73b,_0x2e0ea5=_0x10a669['reverse']();return void 0x0!==_0x55fc61&&this['_isPinnedRectVisible'](_0x2e0ea5[_0x55fc61],_0x3be8ff,_0x177b96)?(_0x2db73b=_0x2e0ea5[_0x55fc61],this['_pinnedRectIndex']=_0x55fc61):this['_isPinnedRectVisible'](_0x2e0ea5[0x0],_0x3be8ff,_0x177b96)&&void 0x0===_0x55fc61?_0x2db73b=_0x2e0ea5[0x0]:(_0x2e0ea5='s'==_0xb7e0e[0x0]?[..._0x10a669]['reverse']():_0x10a669,_0x2e0ea5['forEach'](_0x5bb2c8=>{this['_isPinnedRectVisible'](_0x5bb2c8,_0x3be8ff,_0x177b96)&&(_0x2db73b=_0x5bb2c8);})),this['_pinnedTargetChangeId']=_0x1b4f13,this['_pinnedTargetElement']=_0x5a8a07,_0x2db73b||_0x5a8a07['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x387730,_0xf44ab0,_0x42db8d){if(!_0x387730)return null;const _0x56b138=Array['from'](_0x387730['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0xf44ab0&&this['_pinnedTargetChangeId']!==_0x42db8d?(this['_pinnedRectIndex']=_0xf44ab0,this['_pinnedTargetElement']=_0x387730,this['_pinnedTargetChangeId']=_0x42db8d,_0x56b138[_0xf44ab0]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x42db8d?_0x387730!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x56b138[this['_pinnedRectIndex']]:void 0x0!==_0xf44ab0&&this['_pinnedTargetChangeId']!==_0x42db8d?(this['_pinnedRectIndex']=_0xf44ab0,this['_pinnedTargetElement']=_0x387730,this['_pinnedTargetChangeId']=_0x42db8d,_0x56b138[_0xf44ab0]):_0x387730['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x4e0310,_0x1b093b){if(_0x4e0310)for(let _0x1a912d=0x0;_0x1a912d<_0x1b093b['length'];_0x1a912d++){const _0x1fada8=_0x1b093b[_0x1a912d];if(_0x4e0310['clientX']>=_0x1fada8['left']-0x3&&_0x4e0310['clientX']<=_0x1fada8['right']+0x3&&_0x4e0310['clientY']>=_0x1fada8['top']-0x3&&_0x4e0310['clientY']<=_0x1fada8['bottom']+0x3)return _0x1a912d;}}['_isPinnedRectVisible'](_0x4b7c69,_0x35151f,_0x13a415){const _0x3f702e=new At(_0x4b7c69),_0x5255da=_0x35151f||document['documentElement'],_0x1c5d98=_0x3f702e['getIntersection'](Et(_0x13a415)),_0x283b06=new At(_0x5255da)['getIntersection'](_0x3f702e);return!!(_0x1c5d98&&_0x283b06&&_0x3f702e['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x7ceac6{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4810fe){super(_0x4810fe),this['_bodyCollection']=ln(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Ka)['to'](this),this['_balloonSuggestionView']=new Fa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x497da1=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x497da1);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x2a57b4){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x17833f=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x2a57b4,_0x17833f);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x41aab8){_0x41aab8&&('error-general'!==_0x41aab8['status']?'error-chunk'!==_0x41aab8['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x2d6b9f){this['_mainView']['addCheckRunResult'](_0x2d6b9f);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x55ca20){this['_mainView']['showGeneralReviewCoreErrorView'](_0x55ca20??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x35116e,_0x13db6c){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x35116e,_0x13db6c);}['setActiveStateInResults'](_0x32fe60){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x4b69ee=>{_0x4b69ee['id']===_0x32fe60&&_0x4b69ee['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x370dd9=>_0x370dd9['setItemAsInactive']());}['updateChangeState'](_0x5673c5,_0x375a46){'accepted'===_0x375a46||'rejected'===_0x375a46||'outdated'===_0x375a46?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x5673c5,_0x375a46):this['_mainView']['reviewCheckResultsView']['showResult'](_0x5673c5,_0x375a46);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x33029e,_0x425e44,_0x226724,_0x1c3085,_0x40e6d7,_0x305b0c){this['_balloonSuggestionView']['showBalloon'](_0x33029e,_0x425e44,_0x226724,_0x1c3085,_0x40e6d7,_0x305b0c);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x2aaab2){const _0x400507=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x4ba4b=>_0x4ba4b['id']===_0x2aaab2);return _0x400507?_0x400507['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x9561fa{constructor(_0x3b708e){super(_0x3b708e),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x4fb185=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x4fb185['if']('isVisible','ck-hidden',_0x4771b6=>!_0x4771b6)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x4fb185['to']('errorMessage')}]}]});}},$a=class extends _0x9561fa{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x443216,_0x179a6a){super(_0x443216),this['reviewCoreHeader']=_0x179a6a['header'],this['generalErrorView']=new Ya(_0x443216),this['reviewCheckListView']=_0x179a6a['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x179a6a['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x179a6a['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'](_0x194234){this['reviewCheckResultsView']['addResult'](_0x194234),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'](_0x303def){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x303def;}['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(_0x5269a7,_0x2c76bd){super(_0x2c76bd),this['set']({'label':_0x5269a7,'withText':!0x0,'class':on}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x591388,_0x2f7194){super(_0x591388),this['_contents']=_0x2f7194,this['_resultViews']=new _0x18f546(),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 Mo(_0x591388),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 _0x2482b4=this['_createCombinedSkeletonLoader'](),_0x270a5c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x270a5c['if']('isLoading','ck-ai_review__check-run_loading',_0x11d43b=>_0x11d43b),_0x270a5c['if']('isResultReady','ck-ai_review__check-run_ready',_0x9edddf=>_0x9edddf),_0x270a5c['if']('isVisible','ck-hidden',_0x41ed43=>!_0x41ed43)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x2482b4,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x44b767){const _0x1d3dde=new Ga(this['locale'],_0x44b767['id']);_0x1d3dde['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x1d3dde),_0x1d3dde['resultResponseView']['element']['innerHTML']=_0x44b767['contentDiffed'];}['hideResult'](_0x1a9b86,_0x52a019){if('pending'===_0x52a019)return;const _0x35c1bc=this['_resultViews']['find'](_0xfd2936=>_0xfd2936['id']===_0x1a9b86);_0x35c1bc&&(_0x35c1bc['status']=_0x52a019,_0x35c1bc['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x15ebd4,_0x41759b){if('pending'!==_0x41759b)return;const _0x3c408b=this['_resultViews']['find'](_0x3bb3c9=>_0x3bb3c9['id']===_0x15ebd4);_0x3c408b&&(_0x3c408b['status']=_0x41759b,_0x3c408b['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x2288f5,_0x3ae9f0){this['headerTitle']=_0x2288f5,this['headerSubtitle']=_0x3ae9f0||'';}['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 Xn(this['locale'],zn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x5e1c3b=new _0x9561fa(this['locale']),_0x6ddb92=[];for(let _0x3ef628=0x0;_0x3ef628<0x10;_0x3ef628++){const _0x304f78=this['_createSkeletonLoader']();_0x304f78['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x6ddb92['push'](_0x304f78);}return _0x5e1c3b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x4a564b=>!_0x4a564b)]},'children':_0x6ddb92}),_0x5e1c3b;}['_createResultsBodyView'](){const _0x3a70ff=new _0x9561fa(this['locale']);return _0x3a70ff['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x2651aa=>_0x2651aa)]},'children':this['_resultViews']}),_0x3a70ff;}['_createErrorView'](){const _0x268c2f=new _0x9561fa(this['locale']),_0x2f249a=new Ht(this['locale']),t=this['locale']['t'];return _0x268c2f['delegate']('retryReview')['to'](this),_0x2f249a['set']({'label':t('Try\x20again'),'withText':!0x0,'class':an+'\x20ck-ai_review__check-run-error-retry-button'}),_0x2f249a['on']('execute',()=>{this['fire']('retryReview');}),_0x268c2f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x1e5671=>!_0x1e5671),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x55c972=>'chunk'===_0x55c972)]},'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',_0x48e67d=>'chunk'===_0x48e67d)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x14ecac=>'general'!==_0x14ecac)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x22fd77=>'chunk'!==_0x22fd77)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x2f249a]}),_0x268c2f;}['_createCancelButtonView'](){const _0x14ad88=new Ht(this['locale']);return _0x14ad88['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[an+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x14ad88['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0xb62f73=>_0xb62f73),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4773b9=>_0x4773b9)]}}),_0x14ad88['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x14ad88;}['_createToggleDiffButtonView'](){const _0x354451=new Ht(this['locale']);_0x354451['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x354451['bind']('isEnabled')['to'](this,'isError',_0x41540f=>!_0x41540f),_0x354451['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x8acb5d=>!_0x8acb5d),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x447479=>_0x447479)]}});const _0x218002=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x593f5d=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x354451['bind']('isOn')['to'](this,'isToggleDiffOn',_0x5397c0=>_0x5397c0),_0x354451['bind']('icon')['to'](this,'isToggleDiffOn',_0x500b8a=>_0x500b8a?_0x56116e:_0x3564bb),_0x354451['bind']('label')['to'](this,'isToggleDiffOn',_0x4a4828=>_0x4a4828?_0x218002:_0x593f5d),_0x354451['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x354451;}['_createAcceptAllButtonView'](){const _0x42a778=new Ht(this['locale']);return _0x42a778['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x42a778['bind']('isEnabled')['to'](this,'isError',_0x4d8024=>!_0x4d8024),_0x42a778['extendTemplate']({'attributes':{'class':[on,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x15c71a=>!_0x15c71a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3a38d6=>_0x3a38d6)]}}),_0x42a778['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x42a778;}['_createExitReviewButtonView'](){const _0x1567da=new Ht(this['locale']);return _0x1567da['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x1567da['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x41a58a=>!_0x41a58a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x27c1a4=>_0x27c1a4)]}}),_0x1567da['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x1567da;}['_createResultHeaderView'](){const _0x86abf7=new _0x9561fa(this['locale']),_0x594def=this['_createTitleView']();return _0x86abf7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x4d3167=>_0x4d3167)]},'children':[_0x594def,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x356442=>!_0x356442)],'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']]}]}),_0x86abf7;}['_createTitleView'](){const _0x2054fe=new _0x9561fa(this['locale']),_0x4b5fe1=new cr();return _0x4b5fe1['bind']('isVisible')['to'](this,'isResultReady',_0x4448b9=>!_0x4448b9),_0x2054fe['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xe965d0=>_0xe965d0)]},'children':[_0x4b5fe1,{'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')}]}]}]}),_0x2054fe;}['_createFinishReviewButtonView'](){const _0xd3edcd=new qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0xd3edcd['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x58c399=>!_0x58c399)]}}),_0xd3edcd['delegate']('finishReview')['to'](this),_0xd3edcd;}},Xa=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x6fdbcf,_0x4a434d){super(_0x6fdbcf),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x4a434d['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x4a434d['headerText']);const _0x2843cf=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x2843cf['if']('isVisible','ck-hidden',_0x3e8268=>!_0x3e8268)]},'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':_0x4a434d['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x40696b){const _0x2a0026=new qa(_0x40696b,this['locale']);return _0x2a0026['delegate']('finishReview')['to'](this),_0x2a0026;}['_createResultHeaderView'](_0x23c48d){const _0x36433a=new _0x9561fa(this['locale']);return _0x36433a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x23c48d},'children':[{'text':_0x23c48d}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x36433a;}},za=class extends _0x9561fa{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x522a8c,_0x231a6a){super(_0x522a8c),this['_defaultValue']=_0x231a6a['default']||(_0x231a6a['data']['length']>0x0?_0x231a6a['data'][0x0]['id']:''),this['_defaultLabel']=_0x231a6a['data']['find'](_0x5b8a58=>_0x5b8a58['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x4acf15(this['locale']);const _0x329337=this['_prepareListOptions'](_0x231a6a['data']);_0x2e32a2(this['_dropdownView'],_0x329337,{'role':'menu','ariaLabel':_0x231a6a['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1c8e0d=>{_0x1c8e0d['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x8ad3e=>{this['formValue']=_0x8ad3e['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x8ad3e['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'](_0x2cc32a=[]){const _0x315e3a=new ct();this['resetToDefault']();for(const _0xb9ab93 of _0x2cc32a){const _0x4ed381=new _0x365b55({'label':_0xb9ab93['label'],'withText':!0x0,'role':'menuitemradio','id':_0xb9ab93['id'],'model':_0xb9ab93});_0x4ed381['bind']('isOn')['to'](this,'formValue',_0x572daa=>_0x572daa===_0x4ed381['id']);const _0x575a17={'type':'button','model':_0x4ed381};_0x315e3a['add'](_0x575a17);}return _0x315e3a;}},ja=class extends zt{['_formItem']=null;constructor(_0x5ef085,_0x57ac07,_0x5bbcdf){if(super(_0x5ef085),this['argsKey']=_0x57ac07?.['argsKey'],'dropdown'===_0x57ac07['formType'])this['_formItem']=new za(this['locale'],_0x57ac07);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x11a07d=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x5bbcdf?'ck-form__row_with-submit':'']});_0x5bbcdf&&_0x11a07d['children']['add'](_0x5bbcdf),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x11a07d]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x32a77f{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x447edf){super(_0x447edf),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']);}},Za=class extends _0x9561fa{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x18f546();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x3d9b8b,_0x5f4758,_0x5a9b31=!0x1){super(_0x3d9b8b),this['_check']=_0x5f4758,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x5f4758['defaultModel']?_0x5f4758['defaultModel']['id']:'',this['_defaultLabel']=_0x5f4758['defaultModel']?_0x5f4758['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Ja(_0x3d9b8b)),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'](_0x5a9b31),_0x2e32a2(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',(_0x46d4cd,_0xfde0be)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0xfde0be()):_0xfde0be();}),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'](_0x462a70=>{this['_focusables']['add'](_0x462a70),this['focusTracker']['add'](_0x462a70['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 _0x5b5fb4 of this['_getFormValidators']()){const _0x54d07b=_0x5b5fb4();if(_0x54d07b)return this['promptInputView']['errorText']=_0x54d07b,!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 _0x287a10=new Ht(this['locale']),t=this['locale']['t'];return _0x287a10['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x287a10['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x287a10;}['_createCancelButtonView'](){const _0x70edc8=new Ht(this['locale']),t=this['locale']['t'];return _0x70edc8['set']({'label':t('Cancel'),'withText':!0x0,'class':hn}),_0x70edc8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x10cd88=>{_0x10cd88['stopPropagation']();})}}),_0x70edc8['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x70edc8;}['_setModelList'](_0x3c14b2){this['_modelSelectionDropdownItems']['clear']();const _0x31ca07=this['_check']['models'];if(_0x3c14b2)this['set']('modelDisplayMode','hidden');else{const _0x8e7166=0x1===_0x31ca07['length'];this['set']('modelDisplayMode',_0x8e7166?'name':'selector');}if(this['resetToDefault'](),_0x31ca07?.['length']){0x1===_0x31ca07['length']&&this['set']('activeModelName',_0x31ca07[0x0]['name']||_0x31ca07[0x0]['id']);for(const _0x505913 of _0x31ca07){const _0x4f6958=new _0x365b55({'label':_0x505913['name'],'withText':!0x0,'role':'menuitemradio','id':_0x505913['id'],'model':_0x505913});_0x4f6958['bind']('isOn')['to'](this,'modelId',_0xc4f927=>_0xc4f927===_0x505913['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x4f6958,'labelView':new eh(this['locale'],_0x505913)});}}}['_createModelSelectionDropdown'](){const _0x1db958=_0x4acf15(this['locale']);return _0x1db958['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x1db958['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':hn}),_0x1db958['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2fcdcc=>'selector'===_0x2fcdcc),this['listenTo'](_0x1db958,'execute',_0xd4856e=>{this['modelId']=_0xd4856e['source']['model']['id'],_0x1db958['buttonView']['label']=_0xd4856e['source']['label'];}),_0x1db958;}['_createModelNameView'](){const _0x3d9327=new th(this['locale']);return _0x3d9327['bind']('text')['to'](this,'activeModelName',_0x538d7a=>_0x538d7a??''),_0x3d9327['bind']('isVisible')['to'](this,'modelDisplayMode',_0x47b52e=>'name'===_0x47b52e),_0x3d9327;}['_createActionsFooterView'](){const _0x6e605b=new _0x9561fa(this['locale']);return _0x6e605b['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']]}]}),_0x6e605b;}},th=class extends _0x9561fa{constructor(_0x15da8b){super(_0x15da8b),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2cc425=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x2cc425['if']('isVisible','ck-hidden',_0x166bcb=>!_0x166bcb)]},'children':[{'text':_0x2cc425['to']('text')}]});}},eh=class extends Dt{constructor(_0x4b2581,_0x53ae78){super();const _0x210d10=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x210d10['to']('style'),'id':_0x210d10['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x210d10['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x53ae78['description']||'']}]}]});}},ih=class extends zt{['_formItemsCollection']=new _0x18f546();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x1801e1,_0x32a267,_0x5e6ff4,_0x4b79d3=!0x1){super(_0x1801e1),this['_hideModels']=_0x4b79d3,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x32a267['isParameterized']);const _0x51f60a=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',_0x53ab7d=>_0x53ab7d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x3c4221=>_0x3c4221)],'style':{'--ck-ai-review-check-list-item-index':_0x5e6ff4}},'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':_0x32a267['title']}]},_0x51f60a]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x32a267['description']?[{'text':_0x32a267['description']}]:[]}]}]},..._0x32a267['isParameterized']?[this['_createParameterizedView'](_0x32a267)]:[],...'custom'===_0x32a267['id']?[this['_createCustomView'](_0x32a267,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x32a267['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x32a267['id'],'args':_0x32a267['useArgs']?_0x32a267['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0xf72b9b({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x5b47c3=>{_0x5b47c3['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x451752=new Yt();return _0x451752['content']=_0xeefee8,_0x451752['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x451752;}['_createParameterizedView'](_0x1de1ab){const _0x3c6096=new _0x9561fa(),_0x545f8d=this['_createFormView'](_0x1de1ab);return _0x3c6096['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x4c538c=>!_0x4c538c)]},'children':[_0x545f8d]}),_0x3c6096;}['_createFormView'](_0x5b17d8){const _0x3f7a44=new _0x9561fa(),_0x4caf62=Array['isArray'](_0x5b17d8['options'])?_0x5b17d8['options']:[],_0x482c57=new Ht(this['locale']),t=this['locale']['t'];_0x482c57['set']({'label':t('Submit'),'withText':!0x0,'class':on}),_0x482c57['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x493b01=>{_0x493b01['stopPropagation']();})}}),_0x482c57['on']('execute',()=>{const _0x2b9795=[],_0xe604cb={};this['_formItemsCollection']['forEach'](_0x3a507b=>{_0x2b9795['push'](_0x3a507b['value']),_0x5b17d8['useArgs']&&_0x5b17d8['options']&&(_0xe604cb[_0x3a507b['argsKey']]=_0x3a507b['value']);}),this['fire']('runReviewCheck',{'id':_0x5b17d8['id'],'params':_0x2b9795['length']?_0x2b9795:void 0x0,'args':Object['keys'](_0xe604cb)['length']?_0xe604cb:void 0x0});});const _0x356dee=_0x4caf62['length'];return _0x4caf62['forEach']((_0x2b3417,_0xbe4ac1)=>{const _0x3fb9ad=_0xbe4ac1===_0x356dee-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x2b3417,_0x3fb9ad?_0x482c57:null));}),_0x3f7a44['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x3f7a44;}['_createCustomView'](_0x5397cf,_0x41e29f=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x5397cf,_0x41e29f),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',_0x3edb38=>!_0x3edb38)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x1351b2,_0x480b7f,_0x163be9)=>{_0x163be9||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends zt{['_checkViews'];constructor(_0x2cce28){super(_0x2cce28),this['_checkViews']=new _0x18f546(),this['_setupTemplate']();}['setChecks'](_0x243307,_0x223672=!0x1){this['_checkViews']['clear']();for(const [_0x265391,_0x52bcb5]of _0x243307['entries']()){const _0x1d3285=new ih(this['locale'],_0x52bcb5,_0x265391,_0x223672);_0x1d3285['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x1d3285);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0xf7bf58 of this['_checkViews'])_0xf7bf58 instanceof ih&&_0xf7bf58['resetToDefault']();}['_setupTemplate'](){const _0x5386a9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x5386a9['if']('isVisible','ck-hidden',_0x3af10a=>!_0x3af10a)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x48033a=this['context']['plugins']['get']('AITabs'),_0x46411d=this['context']['locale'],_0x4e3fa8=new Ho(_0x46411d,{'label':us(_0x46411d,'AI_REVIEW_MODE'),'icon':_0x13db03,'class':'ck-ai-header_review','showResizeButton':_0x48033a['showResizeButton']});return _0x4e3fa8['delegate']('resizeTabs')['to'](_0x48033a),_0x4e3fa8['bind']('isMaximized')['to'](_0x48033a['view'],'isMaximized',_0x139ce9=>_0x139ce9),new $a(this['context']['locale'],{'header':_0x4e3fa8,'list':new sh(_0x46411d),'results':new Qa(_0x46411d,{'generalErrorText':us(_0x46411d,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x46411d,{'headerText':us(_0x46411d,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x46411d,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x46411d,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x4aa978=this['context']['plugins']['get']('AITabs');_0x4aa978['view']['on']('activateTab',(_0x333c0c,{newTab:_0x526bf0,oldTab:_0x5e9ae9})=>{'reviewMode'===_0x526bf0?this['fire']('getReviewCheckList'):'reviewMode'===_0x5e9ae9&&this['fire']('leaveReview');}),_0x4aa978['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x13db03,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x7ceac6{static get['requires'](){return[_0x4568e8,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(_0x3e6d8c){super(_0x3e6d8c),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x6537d=_0x4533ff=>this['_scheduleAttachReviewEditingToEditor'](_0x4533ff);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x3d3542)return void _0x6537d(this['context']);const _0x394cfe=this['context'];for(const _0x154c6f of _0x394cfe['editors'])_0x6537d(_0x154c6f);this['listenTo'](_0x394cfe['editors'],'add',(_0x28014a,_0xcaa9b6)=>{_0x6537d(_0xcaa9b6);}),this['listenTo'](_0x394cfe['editors'],'remove',(_0xfa8e8,_0x4bf44b)=>{for(const [_0x484a53,_0xdb848b]of this['_markers'])_0xdb848b['editor']===_0x4bf44b&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x484a53,'changeId':_0xdb848b['groupId']}),this['_markers']['delete'](_0x484a53));});}['_scheduleAttachReviewEditingToEditor'](_0x22964a){const _0x4052ea=()=>{'destroyed'!==_0x22964a['state']&&_0x22964a['conversion']&&this['_attachReviewEditingToEditor'](_0x22964a);};if('ready'===_0x22964a['state'])return void _0x4052ea();const _0x254222=()=>{this['stopListening'](_0x22964a,'ready',_0x254222),_0x4052ea();};this['listenTo'](_0x22964a,'ready',_0x254222);}['_attachReviewEditingToEditor'](_0x21ed6e){this['_reviewEditingAttachedEditors']['has'](_0x21ed6e)||(_0x21ed6e['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x4e6beb,{writer:_0x79c0ff})=>{const _0x232b3d=this['_markers']['get'](_0x4e6beb['markerName']),_0x39fd5c={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x232b3d?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4e6beb['markerName']};return _0x79c0ff['createUIElement']('span',_0x39fd5c,function(_0x263fe2){const _0x5bd3c2=this['toDomElement'](_0x263fe2);return _0x5bd3c2['innerHTML']=_0x232b3d?.['content']?.['asString']||'',_0x5bd3c2;});}}),_0x21ed6e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x1628b0=>{const _0x120414=this['_markers']['get'](_0x1628b0['markerName']),_0x54323b=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x120414?.['id']||'')&&_0x54323b['push']('ck-ai_review__change_active'),{'classes':_0x54323b,'attributes':{'data-marker-id':_0x1628b0['markerName']}};}}),_0x21ed6e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x2cb9d1=>{const _0x5c2822=this['_markers']['get'](_0x2cb9d1['markerName']),_0x333c18=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x5c2822?.['id']||'')&&_0x333c18['push']('ck-ai_review__change_active'),{'classes':_0x333c18,'attributes':{'data-marker-id':_0x2cb9d1['markerName']}};}}),_0x21ed6e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x4ebf49=>{const _0x857b05=this['_markers']['get'](_0x4ebf49['markerName']),_0x2596f5=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x857b05?.['id']||'')&&_0x2596f5['push']('ck-ai_review__change_active'),{'classes':_0x2596f5,'attributes':{'data-marker-id':_0x4ebf49['markerName']}};}}),_0x21ed6e['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x3ac81a,{writer:_0x47ae48})=>_0x47ae48['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x3ac81a['isOpening']?'start':'end')})}),_0x21ed6e['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x9dc3c8,'view':_0x322327}),this['_updateMouseMarkerInteractionListeners'](_0x21ed6e),this['listenTo'](_0x21ed6e,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x21ed6e),{'priority':'lowest'}),this['listenTo'](_0x21ed6e,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x21ed6e),{'priority':'lowest'}),_0x21ed6e['model']['document']['registerPostFixer'](_0x6c5e5c=>this['_validateMarkers'](_0x21ed6e,_0x6c5e5c)),_0x21ed6e['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x21ed6e)),this['_reviewEditingAttachedEditors']['add'](_0x21ed6e));}['_updateMouseMarkerInteractionListeners'](_0x3d2658){let _0x2ef18f=this['_boundEditables']['get'](_0x3d2658);_0x2ef18f||(_0x2ef18f=new Map(),this['_boundEditables']['set'](_0x3d2658,_0x2ef18f));const _0x3f1a68=new Set(_0x3d2658['ui']['getEditableElementsNames']());for(const _0x35659f of _0x3f1a68){if(_0x2ef18f['has'](_0x35659f))continue;const _0x5713ba=_0x3d2658['ui']['getEditableElement'](_0x35659f);_0x2ef18f['set'](_0x35659f,_0x5713ba),this['_attachMouseMarkerInteractionListeners'](_0x5713ba);}for(const [_0x333eb8,_0x17e46c]of _0x2ef18f)_0x3f1a68['has'](_0x333eb8)||(_0x2ef18f['delete'](_0x333eb8),this['_domEmitter']['stopListening'](_0x17e46c));}['_attachMouseMarkerInteractionListeners'](_0x4db29f){this['_domEmitter']['listenTo'](_0x4db29f,'mouseup',(_0x1f2fad,_0x4c2c6e)=>{const _0x42f235=_0x4c2c6e['target'],_0x407243=this['_findMarkerElement'](_0x42f235);if(!_0x407243)return;const _0x3ad361=_0x407243['getAttribute']('data-marker-id'),_0x435fe4=_0x3ad361['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x3ad361,'changeId':_0x435fe4,'markerElement':()=>this['_findMarkerElementById'](_0x3ad361),'domEvent':_0x4c2c6e});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x4db29f,'mouseover',(_0x510442,_0x1775b0)=>{const _0x29ce17=_0x1775b0['target'],_0x2d0213=_0x1775b0['relatedTarget'];let _0x36286f=this['_findMarkerElement'](_0x29ce17);if(!_0x36286f&&_0x2d0213&&(_0x36286f=this['_findMarkerElement'](_0x2d0213)),!_0x36286f)return;const _0x1a1af4=_0x36286f['getAttribute']('data-marker-id'),_0xcb7ed6=_0x1a1af4['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0xcb7ed6,'markerElement':()=>this['_findMarkerElementById'](_0x1a1af4),'domEvent':_0x1775b0});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x14414f((_0x537412,_0xa69208)=>{const _0xb2496d=_0xa69208['target'];this['_findMarkerElement'](_0xb2496d)||_0xb2496d['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0xc5a885=this['context']['plugins']['get']('AIEditing'),_0x3b08b1=ds(this['context']);if(!_0x3b08b1['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x344f37=new Set(),_0x560a00=[],_0x2ee8f9=new Map();for(const _0x5c7cff of _0x3b08b1)for(const _0x55415c of _0x5c7cff['model']['document']['getRoots']()){if('$graveyard'===_0x55415c['rootName'])continue;const _0x149d14=this['_buildDocumentDataSliceForRoot'](_0x5c7cff,_0x55415c,_0xc5a885,_0x344f37);_0x560a00['push'](_0x149d14['content']);for(const [_0xb15ee1,_0x299926]of _0x149d14['elements'])_0x2ee8f9['set'](_0xb15ee1,_0x299926);}return{'elements':_0x2ee8f9,'content':_0x560a00['join']('')};}['_buildDocumentDataSliceForRoot'](_0x149639,_0x13a89,_0x50c253,_0xaa024){const _0x458538=_0x149639['model'],_0x1ce700=new _0x38a201();for(const _0x123aa6 of _0x13a89['getChildren']())_0x1ce700['_appendChild'](_0x123aa6['_clone'](!0x0));for(const _0x39fc69 of _0x458538['markers']){const _0x46415c=_0x39fc69['getRange']();_0x46415c&&_0x46415c['root']['rootName']===_0x13a89['rootName']&&_0x1ce700['markers']['set'](_0x39fc69['name'],this['_changeRangeOwnerDocument'](_0x46415c['clone'](),_0x1ce700));}const _0x2a46b8=new Map(),_0x300412=_0x458538['document']['version'],_0x13f063=new _0x2d6fc5({'ignoreElementEnd':!0x0,'startPosition':_0x458538['createPositionAt'](_0x1ce700,0x0)});for(const {item:_0x2db417}of _0x13f063){if(_0x2db417['is']('element')&&_0x2db417['name']&&ah['includes'](_0x2db417['name'])){const _0x94e9ce=this['_upsertDataId'](_0x2db417,()=>_0x50c253['_nextDataId'](_0xaa024));_0xaa024['add'](_0x94e9ce);}if(!_0x2db417['is']('$textProxy'))continue;const _0x2b6c73=_0x2db417['parent'];if(!_0x2b6c73||!_0x2b6c73['is']('element'))continue;const _0x3cfee8=this['_upsertDataId'](_0x2b6c73,()=>_0x50c253['_nextDataId'](_0xaa024));_0xaa024['add'](_0x3cfee8);for(const _0x1c3112 of _0x2b6c73['getChildren']())_0x1c3112['is']('element')&&(_0x1c3112['name']&&oh['includes'](_0x1c3112['name'])||_0xaa024['add'](this['_upsertDataId'](_0x1c3112,()=>_0x50c253['_nextDataId'](_0xaa024))));let _0x1a6b97=_0x2b6c73;for(;_0x1a6b97['parent']&&!_0x1a6b97['parent']['is']('documentFragment');)_0x1a6b97=_0x1a6b97['parent'],_0x1a6b97['hasAttribute'](_0x9dc3c8)&&_0x1a6b97['_removeAttribute'](_0x9dc3c8);_0x2a46b8['set'](_0x3cfee8,{'editor':_0x149639,'rootName':_0x13a89['rootName'],'path':_0x2b6c73['getPath'](),'documentVersion':_0x300412,'getContent':this['_createGetContentUsingDataIdFn'](_0x1a6b97['_clone'](!0x0),_0x3cfee8,_0x149639['data'])}),_0x13f063['jumpTo'](_0x458538['createPositionAfter'](_0x2b6c73));}return{'content':_0x149639['data']['processor']['toData'](_0x149639['data']['toView'](_0x1ce700)),'elements':_0x2a46b8};}['diffContent'](_0x259736,_0x5e6a69,_0x40d94e,_0xdceeb6=!0x1){const {contentInitial:_0x195f48,contentNew:_0x11cc17}=this['_neutralizeChangesOnUnsupportedElements'](_0x5e6a69,_0x40d94e),_0x23ea54=[],_0xf3d50f=_0x259736['data']['parse'](_0x11cc17,'$documentFragment'),_0x112848=_0x259736['data']['parse'](_0x195f48,'$documentFragment'),_0xc82ed7=_0x259736['model']['createPositionAt'](_0x112848,0x0);if(this['_haveSingleTopLevelElement'](_0xf3d50f)){if(!this['_hasSameTopLevelElement'](_0x112848,_0xf3d50f))return _0x23ea54;}else{const _0x14c284=_0x259736['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x112848,_0x14c284)||!this['_haveOnlyInlineContent'](_0xf3d50f,_0x14c284))return _0x23ea54;}const _0x21808b=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x195f48,_0x11cc17,{'targetEditor':_0x259736,'anchor':_0xc82ed7,'markDeletions':!0x0})['getOperations']()['filter'](_0x321876=>'insert'===_0x321876['type']||'marker'===_0x321876['type']&&_0x321876['name']['startsWith']('$markedRemove')),_0x330e9b=this['_groupAdjacentOperations'](_0x21808b),_0x5ad76f=[];if(_0xdceeb6){if(_0x330e9b['length']){const _0x556e5d=_0x330e9b[0x0]['operations'][0x0],_0xbf9b80='insert'===_0x556e5d['type']?_0x556e5d['position']:_0x556e5d['newRange']['start'],_0x5cf217=this['_getPositionLimitingRange'](_0xbf9b80,_0x259736,'inside'),_0x282c86=_0x5cf217?_0xf3d50f['getChild'](0x0)['getChildren']():_0xf3d50f['getChildren'](),_0x5ed1cc=_0x5cf217||_0x259736['model']['createRangeIn'](_0x112848),_0xc8f86c=[new _0xbdce83('$markedRemove:synthetic'+vt(),null,_0x5ed1cc,_0x259736['model']['document']['model']['markers'],!0x0,_0x259736['model']['document']['version']+0x1),new _0x2b44dc(_0x5ed1cc['end'],_0x282c86,_0x259736['model']['document']['version']+0x2)];_0x5ad76f['push']({'operations':_0xc8f86c,'operationsIsolated':_0xc8f86c,'groupOffset':0x0});}}else _0x5ad76f['push'](..._0x330e9b);let _0x2ea08e=0x0;return _0x259736['model']['change'](_0x1d1027=>{for(let _0x30f827=0x0;_0x30f827<_0x5ad76f['length'];_0x30f827++){const _0x22a010=_0x5ad76f[_0x30f827],_0x51a038=_0x1d1027['createDocumentFragment']();for(const _0x192819 of _0x112848['getChildren']())_0x1d1027['append'](_0x192819['_clone'](!0x0),_0x51a038);for(const _0x475313 of _0x22a010['operationsIsolated'])if('insert'===_0x475313['type']){const _0x506bc6=_0x475313;_0x506bc6['baseVersion']=null,_0x506bc6['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x506bc6,_0x51a038),_0x1d1027['batch']['addOperation'](_0x475313),_0x259736['model']['applyOperation'](_0x475313);const _0xcb354e='suggestion:insertion:id:authorId:'+_0x2ea08e++,_0x831f06=_0x259736['model']['createRange'](_0x506bc6['position'],_0x506bc6['position']['getShiftedBy'](_0x506bc6['howMany']));_0x51a038['markers']['set'](_0xcb354e,_0x831f06);}else{if('marker'===_0x475313['type']&&_0x475313['name']['startsWith']('$markedRemove')){const _0x568a85=_0x475313,_0x1e5d90='suggestion:deletion:id:authorId:'+_0x2ea08e++;this['_changeOperationOwnerDocument'](_0x568a85,_0x51a038),_0x51a038['markers']['set'](_0x1e5d90,_0x568a85['newRange']);}}if(_0xdceeb6)_0x23ea54['push']({..._0x22a010,'context':this['_createGetContentFn'](_0x112848,_0x259736['data']),'content':this['_createGetContentFn'](_0x112848,_0x259736['data'])});else{const _0x56f27a=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x22a010['operationsIsolated'][0x0]),_0x51a038),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x22a010['operationsIsolated'][_0x22a010['operationsIsolated']['length']-0x1]),_0x51a038),_0x259736);_0x51a038['markers']['set'](rh+'suggestion-context',new _0x156cfa(_0x56f27a['start'],_0x56f27a['end'])),_0x23ea54['push']({..._0x22a010,'context':this['_createGetContextFn'](_0x51a038,_0x259736['data'],{'ellipsisBefore':_0x56f27a['hasContentBefore'],'ellipsisAfter':_0x56f27a['hasContentAfter']}),'content':this['_createGetContentFn'](_0x51a038,_0x259736['data'])});}}}),_0x23ea54;}['markChangePositionInEditorContent'](_0x21f8e4,_0x5d2c77){if(!_0x21f8e4['length'])return;const _0x2d71df=_0x21f8e4[0x0]['parent']['id'],_0x3a625d=_0x5d2c77['elements']['get'](_0x2d71df);if(!_0x3a625d)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x2d71df);const _0x1ec1e5=_0x3a625d['path'],_0x90245a=_0x3a625d['editor'],_0x2d8d50=_0x90245a['model']['document']['getRoot'](_0x3a625d['rootName']);if(!_0x2d8d50)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x3a625d['rootName']);const _0x3ad99=_0x90245a['model']['document']['history']['getOperations'](_0x3a625d['documentVersion']),_0x675d7e=[];for(const _0x1376f6 of _0x21f8e4){const _0x982ca0=_0x1376f6['operationsIsolated']['map'](_0x3fd1ef=>this['_translateOperationToEditorContent'](_0x3fd1ef,_0x1ec1e5,_0x2d8d50));if(!_0x982ca0||!_0x982ca0['length'])continue;const _0x4e806c=_0x982ca0['every'](_0x186d7e=>'marker'===_0x186d7e['type']&&_0x186d7e['name']['startsWith']('$markedRemove')),_0x14790d=_0x456211(_0x982ca0,_0x3ad99,{'document':_0x90245a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x2007f8 of _0x14790d)if('insert'===_0x2007f8['type']){const _0x16c6f0=_0x2007f8,_0x11d718=_0x16c6f0['nodes'];_0x90245a['model']['change'](_0x49fe5a=>{const _0x523990=_0x49fe5a['createDocumentFragment']();for(const _0x42eb6b of _0x11d718)_0x49fe5a['append'](_0x42eb6b['_clone'](!0x0),_0x523990);_0x675d7e['push']({'start':_0x16c6f0['position'],'end':_0x16c6f0['position'],'type':'insert','groupId':_0x1376f6['id'],'content':{'asString':this['_createGetContentFn'](_0x523990,_0x90245a['data'])(),'asFragment':_0x523990}});});}else{if('marker'===_0x2007f8['type']&&_0x2007f8['name']['startsWith']('$markedRemove')){const _0x477b62=_0x2007f8;let _0x1af7ec='remove-text';if(_0x4e806c){const _0x4d8371=this['_findAdjacentContextDistance'](_0x477b62['newRange']['start'],'backward',_0x90245a['model']['schema']),_0x21cdc5=this['_findAdjacentContextDistance'](_0x477b62['newRange']['end'],'forward',_0x90245a['model']['schema']);if(_0x4d8371||_0x21cdc5){const _0x30bc36=_0x477b62['newRange']['start']['getShiftedBy'](-_0x4d8371),_0x1ac90e=_0x477b62['newRange']['end']['getShiftedBy'](_0x21cdc5);_0x675d7e['push']({'start':_0x30bc36,'end':_0x1ac90e,'groupId':_0x1376f6['id'],'type':'remove-context'});}else _0x1af7ec='remove-only';}_0x675d7e['push']({'start':_0x477b62['newRange']['start'],'end':_0x477b62['newRange']['end'],'groupId':_0x1376f6['id'],'type':_0x1af7ec});}}}this['_insertMarkers'](_0x675d7e,_0x90245a);}['clearAllMarkers'](){const _0x5e21da=new Map();for(const _0x54bbd4 of this['_markers']['keys']()){const _0x333107=this['_markers']['get'](_0x54bbd4);_0x333107?.['editor']&&(_0x5e21da['has'](_0x333107['editor'])||_0x5e21da['set'](_0x333107['editor'],[]),_0x5e21da['get'](_0x333107['editor'])['push'](_0x54bbd4));}for(const [_0x38197a,_0x5c23bd]of _0x5e21da)_0x38197a['model']['change'](_0x268b68=>{for(const _0x21741c of _0x5c23bd)_0x38197a['model']['markers']['get'](_0x21741c)&&_0x268b68['removeMarker'](_0x21741c);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x11e814 of ds(this['context']))_0x11e814['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x50ff3c of ds(this['context']))_0x50ff3c['disableReadOnlyMode']('ai-review');}['applyChange'](_0x54e9fc,_0x44e2e5=null){const _0x54d842=_0x54e9fc['map'](_0x1ec976=>this['_getMarkersDataForGroup'](_0x1ec976))['flat'](),_0x50f6ec=new Map();for(const _0x42483b of _0x54d842)_0x50f6ec['has'](_0x42483b['editor'])||_0x50f6ec['set'](_0x42483b['editor'],[]),_0x50f6ec['get'](_0x42483b['editor'])['push'](_0x42483b);for(const [_0x56563b,_0xcf2c74]of _0x50f6ec){const _0x2b9c50=_0x56563b['model'],_0x3239a1=_0x56563b['plugins']['has']('TrackChangesEditing')?_0x56563b['plugins']['get']('TrackChangesEditing'):null,_0x1b002a=_0x44e2e5&&_0x3239a1?new Set(_0x3239a1['getSuggestions']()['map'](_0x3de52a=>_0x3de52a['id'])):null;_0x2b9c50['change'](_0x1834cf=>{const _0x123de7=_0x1834cf['batch']['operations']['length'];for(const _0x577bbe of _0xcf2c74){const _0x2f3306=_0x56563b['model']['markers']['get'](_0x577bbe['id']);if(_0x2f3306){if('insert'===_0x577bbe['type']){if(!_0x577bbe['content'])continue;_0x2b9c50['insertContent'](_0x577bbe['content']['asFragment']||null,_0x2f3306['getRange']()['start']);}else'remove-text'!==_0x577bbe['type']&&'remove-only'!==_0x577bbe['type']||_0x2b9c50['deleteContent'](_0x2b9c50['createSelection'](_0x2f3306['getRange']()));_0x1834cf['removeMarker'](_0x577bbe['id']),this['_markers']['delete'](_0x577bbe['id']);}}if(_0x44e2e5&&(zs(_0x1834cf['batch']['operations']['slice'](_0x123de7),_0x44e2e5),_0x3239a1)){for(const _0x79848c of _0x3239a1['getSuggestions']())_0x1b002a['has'](_0x79848c['id'])||_0x79848c['setAttribute']('@ai',{'type':_0x44e2e5});}});}}['rejectChange'](_0x5d747d){const _0x458b8c=this['_getMarkersDataForGroup'](_0x5d747d),_0x1fa0b7=new Map();for(const _0x15c3da of _0x458b8c)_0x1fa0b7['has'](_0x15c3da['editor'])||_0x1fa0b7['set'](_0x15c3da['editor'],[]),_0x1fa0b7['get'](_0x15c3da['editor'])['push'](_0x15c3da);for(const [_0x26570e,_0x242bb1]of _0x1fa0b7)_0x26570e['model']['change'](_0x269557=>{for(const _0x4f2464 of _0x242bb1)_0x269557['removeMarker'](_0x4f2464['id']),this['_markers']['delete'](_0x4f2464['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x4ee1c3){return this['_getMarkersDataForGroup'](_0x4ee1c3)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x13021a){const _0x58b19d=Array['from'](this['_markers']['values']())['filter'](_0x288ceb=>_0x288ceb['groupId']===_0x13021a);if(!_0x58b19d['length'])return null;const _0x32a594=0x1===_0x58b19d['length']?_0x58b19d[0x0]:this['_sortMarkers'](_0x58b19d)[0x0],_0x5dfc22=_0x32a594['editor']['model']['markers']['get'](_0x32a594['id']);return _0x5dfc22?{'modelRange':_0x5dfc22['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x32a594['id'])}:null;}['getContentElementForChange'](_0xd15b76){const _0xdfb84c=Array['from'](this['_markers']['values']())['filter'](_0x1ea03e=>_0x1ea03e['groupId']===_0xd15b76);if(!_0xdfb84c['length'])return null;const _0x1a4540=0x1===_0xdfb84c['length']?_0xdfb84c[0x0]:this['_sortMarkers'](_0xdfb84c)[0x0],_0x2512aa=_0x1a4540['editor'],_0x309c47=_0x2512aa['model']['markers']['get'](_0x1a4540['id']);if(!_0x309c47)return null;const _0x37c9fe=_0x309c47['getRange'](),_0xc3266=_0x2512aa['editing']['view']['getDomRoot'](_0x37c9fe['root']['rootName'])||_0x2512aa['editing']['view']['getDomRoot']();if(!_0xc3266||!_0x37c9fe)return null;let _0x2a5f62=_0x37c9fe['start']['parent'];for(;_0x2a5f62['parent']&&!_0x2a5f62['parent']['is']('rootElement');)_0x2a5f62=_0x2a5f62['parent'];if(!_0x2a5f62||!_0x2a5f62['name'])return null;const _0x484d50=_0xc3266['querySelector']('[data-marker-id=\x22'+_0x1a4540['id']+'\x22]');if(!_0x484d50)return null;let _0x3749cd=null;_0x2512aa['model']['change'](_0x28051d=>{_0x3749cd=_0x28051d['createDocumentFragment'](),_0x28051d['append'](_0x2a5f62['_clone'](!0x0),_0x3749cd);});const _0x3fab8b=_0x2512aa['data']['toView'](_0x3749cd)['getChild'](0x0);return _0x484d50['closest'](_0x3fab8b['name']);}['reactivateMarkers'](_0x26adc1){const _0x5d3892=this['_getMarkersDataForGroup'](_0x26adc1);if(!_0x5d3892['length'])return;const _0x5df3e8=Array['from'](this['_activeMarkers'])['sort'](),_0x2b2edc=Array['from'](new Set(_0x5d3892['map'](_0x14c49b=>_0x14c49b['id'])))['sort']();_0x5df3e8['join']('|')!==_0x2b2edc['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x26adc1));}['setMarkersInElementAsActive'](_0x46acc7){const _0x356b76=this['_getMarkersDataForGroup'](_0x46acc7);if(!_0x356b76['length'])return;const _0x1e5e44=_0x356b76[0x0]['editor'],_0x5898f1=new Set(_0x356b76['map'](_0x4ce3b4=>_0x4ce3b4['id'])),_0x93515d=Array['from'](_0x5898f1['values']())['map'](_0x3ed60b=>_0x1e5e44['model']['markers']['get'](_0x3ed60b))['filter'](_0xa152e7=>!!_0xa152e7);_0x5898f1['forEach'](_0x5a0c7f=>{this['_activeMarkers']['add'](_0x5a0c7f);}),_0x1e5e44['model']['change'](()=>{_0x93515d['forEach'](_0x6b861=>{_0x1e5e44['editing']['reconvertMarker'](_0x6b861);});});}['setAllMarkersAsInactive'](){const _0x386d7f=Array['from'](this['_activeMarkers']);if(!_0x386d7f['length'])return;this['_activeMarkers']['clear']();const _0x159ae5=new Map();for(const _0x1bf7ff of _0x386d7f){const _0x59a95c=this['_markers']['get'](_0x1bf7ff);if(!_0x59a95c)continue;const _0x262357=_0x59a95c['editor'],_0x384223=_0x262357['model']['markers']['get'](_0x1bf7ff);_0x384223&&(_0x159ae5['has'](_0x262357)||_0x159ae5['set'](_0x262357,[]),_0x159ae5['get'](_0x262357)['push'](_0x384223));}for(const [_0x186efd,_0x137a90]of _0x159ae5)_0x186efd['model']['change'](()=>{_0x137a90['forEach'](_0x5badfd=>{_0x186efd['editing']['reconvertMarker'](_0x5badfd);});});}['_getPositionLimitingRange'](_0x2ba7d7,_0x22863e,_0x26cd6c='outside'){if(!_0x2ba7d7)return null;let _0x2bdea0=_0x2ba7d7['parent'];for(;_0x2bdea0&&_0x2bdea0['parent']&&!_0x2bdea0['parent']['is']('rootElement')&&!_0x22863e['model']['schema']['isLimit'](_0x2bdea0)&&!_0x22863e['model']['schema']['isBlock'](_0x2bdea0);)_0x2bdea0=_0x2bdea0['parent'];if(!_0x2bdea0||!_0x2bdea0['name']||_0x2bdea0['is']('rootElement'))return null;let _0x3894a3=null;return _0x22863e['model']['change'](_0x475dbe=>{_0x3894a3='inside'===_0x26cd6c?_0x475dbe['createRangeIn'](_0x2bdea0):_0x475dbe['createRangeOn'](_0x2bdea0);}),_0x3894a3;}['_validateMarkers'](_0x5004bb,_0x5bf45e){const _0x134063=Array['from'](this['_markers']['keys']()),_0x202d6d=new Map();for(const _0x4b176f of _0x134063){const _0x8f685b=_0x5004bb['model']['markers']['get'](_0x4b176f);if(!_0x8f685b)continue;const _0x120cc9=_0x8f685b['getStart']()['root']['rootName']+':'+_0x8f685b['getStart']()['path'][0x0];_0x202d6d['has'](_0x120cc9)||_0x202d6d['set'](_0x120cc9,[]),_0x202d6d['get'](_0x120cc9)['push'](_0x8f685b);}const _0x94e807=new Set();for(const _0x2f9cb6 of _0x5004bb['model']['document']['differ']['getChanges']()){let _0x1d5240='',_0x285d72=null;if('insert'===_0x2f9cb6['type'])_0x285d72=new _0x156cfa(_0x2f9cb6['position'],_0x2f9cb6['position']['getShiftedBy'](_0x2f9cb6['length'])),_0x1d5240=_0x2f9cb6['position']['root']['rootName']+':'+_0x2f9cb6['position']['path'][0x0];else{if('remove'!==_0x2f9cb6['type'])continue;_0x285d72=new _0x156cfa(_0x2f9cb6['position']),_0x1d5240=_0x2f9cb6['position']['root']['rootName']+':'+_0x2f9cb6['position']['path'][0x0];}const _0xed8e02=_0x202d6d['get'](_0x1d5240)||[];if(_0xed8e02['length']){for(const _0x4390d7 of _0xed8e02)if(_0x285d72['root']['rootName']===_0x4390d7['getRange']()['root']['rootName']&&('insert'!==_0x2f9cb6['type']||!_0x285d72['containsRange'](_0x4390d7['getRange']()))&&(_0x285d72['isIntersecting'](_0x4390d7['getRange']())||_0x285d72['start']['isTouching'](_0x4390d7['getRange']()['end'])||_0x285d72['end']['isTouching'](_0x4390d7['getRange']()['start']))){const _0x1131a9=this['_parseMarkerName'](_0x4390d7['name']);Array['from'](this['_markers']['values']())['filter'](_0x47901b=>_0x47901b['groupId']===_0x1131a9['groupId'])['forEach'](_0x2ba7d2=>_0x94e807['add'](_0x2ba7d2['id']));}}}if(_0x94e807['size']){for(const _0x2ad551 of _0x94e807)_0x5bf45e['removeMarker'](_0x2ad551);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x41844f){for(const {name:_0x47a1b2,data:_0x332262}of _0x41844f['model']['document']['differ']['getChangedMarkers']()){if(!_0x47a1b2['startsWith'](rh))continue;const _0x564bac=_0x332262['oldRange'],_0x792feb=_0x332262['newRange'],_0x233d9d=_0x564bac&&'$graveyard'===_0x564bac['root']['rootName'],_0x39901b=_0x792feb&&'$graveyard'===_0x792feb['root']['rootName'];if(_0x233d9d&&_0x39901b)continue;const _0x26348a=this['_parseMarkerName'](_0x47a1b2);this['_markers']['get'](_0x47a1b2)&&(_0x39901b||!_0x792feb?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x47a1b2,'changeId':_0x26348a['groupId']}):_0x233d9d&&_0x792feb&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x47a1b2,'changeId':_0x26348a['groupId']}));}}['_parseMarkerName'](_0x226b8e){const _0x4e5357=_0x226b8e['split'](':'),_0x48801f=(_0x4e5357[0x1]||'')['split']('_');return{'prefix':_0x4e5357[0x0],'groupId':_0x48801f[0x0],'suffix':_0x48801f[0x1]};}['_translateOperationToEditorContent'](_0x4258c3,_0x2ae333,_0x307d92){if('insert'===_0x4258c3['type']){const _0x507a55=_0x4258c3;return new _0x2b44dc(this['_changePosition'](_0x2ae333['concat'](_0x507a55['position']['offset']),_0x307d92),_0x507a55['nodes'],_0x507a55['baseVersion']);}if('marker'===_0x4258c3['type']&&_0x4258c3['name']['startsWith']('$markedRemove')){const _0x3a6524=_0x4258c3;return new _0xbdce83(_0x3a6524['name'],_0x3a6524['oldRange'],this['_changeRange'](_0x3a6524['newRange'],_0x2ae333['concat'](_0x3a6524['newRange']['start']['offset']),_0x2ae333['concat'](_0x3a6524['newRange']['end']['offset']),_0x307d92),_0x3a6524['_markers'],_0x3a6524['affectsData'],_0x3a6524['baseVersion']);}return _0x4258c3;}['_groupAdjacentOperations'](_0x16b26d){if(!_0x16b26d['length'])return[];const _0x9a1235=[];let _0x5f08a6=0x0,_0x48f70c=0x0,_0x103ddb=[];for(let _0xb49ed8=0x0;_0xb49ed8<=_0x16b26d['length'];_0xb49ed8++){const _0x174dcf=_0x16b26d[_0xb49ed8],_0x4d5311=_0x16b26d[_0xb49ed8-0x1];!_0x174dcf||_0x4d5311&&!this['_getOperationEnd'](_0x4d5311)['isTouching'](this['_getOperationStart'](_0x174dcf))?(_0x9a1235['push']({'operations':_0x103ddb,'operationsIsolated':_0x103ddb['map'](_0x10f837=>this['_shiftOperation'](_0x10f837['clone'](),-_0x48f70c)),'groupOffset':_0x5f08a6}),_0x103ddb=_0x174dcf?[_0x174dcf]:[],_0x48f70c+=_0x5f08a6,_0x5f08a6=0x0):_0x103ddb['push'](_0x174dcf),_0x174dcf&&'insert'===_0x174dcf['type']&&(_0x5f08a6+=_0x174dcf['howMany']);}return _0x9a1235;}['_findAdjacentContextDistance'](_0x2a70d5,_0x5be29d,_0x11f371,_0x5afcfa=0x1){const _0x5a8631=new _0x2d6fc5({'startPosition':_0x2a70d5,'direction':_0x5be29d});let _0x2e485f=0x0;for(let _0xc0b761=0x0;_0xc0b761<_0x5afcfa;_0xc0b761++){let _0x3b02c4=0x0,_0x1a952a=!0x1,_0x10ee41='forward'===_0x5be29d?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x10bb99}of _0x5a8631)if(_0x10bb99['is']('$textProxy')){const _0x5aad41=_0x10ee41['exec'](_0x10bb99['data']);if(_0x5aad41&&_0x5aad41['length']){if(_0x3b02c4+='forward'===_0x5be29d?_0x5aad41['index']+_0x5aad41[0x0]['length']:_0x10bb99['data']['length']-_0x5aad41['index'],_0x5aad41[0x0]['length']!==_0x10bb99['data']['length'])break;_0x1a952a=!0x0,_0x10ee41='forward'===_0x5be29d?/^\w+/:/\w+$/;}else{if(_0x1a952a)break;_0x3b02c4+=_0x10bb99['offsetSize'];}}else{if(_0x10bb99['is']('element')){_0x11f371['isInline'](_0x10bb99)&&!_0x1a952a&&(_0x3b02c4+=0x1);break;}}_0x2e485f+=_0x3b02c4,_0x5a8631['jumpTo'](_0x2a70d5['getShiftedBy']('forward'===_0x5be29d?_0x2e485f:-_0x2e485f));}return _0x2e485f;}['_getChangeContext'](_0x5a34f4,_0x5993a8,_0x578d44){const _0x3823ab=_0x578d44['model']['schema'],_0x1dd02f=this['_findAdjacentContextDistance'](_0x5a34f4,'backward',_0x3823ab,0x6),_0x19fecb=this['_findAdjacentContextDistance'](_0x5993a8,'forward',_0x3823ab,0x6),_0x559a00=_0x5a34f4['getShiftedBy'](-_0x1dd02f),_0x49de57=_0x5993a8['getShiftedBy'](_0x19fecb);return{'start':_0x559a00,'end':_0x49de57,'hasContentBefore':!_0x559a00['isAtStart'],'hasContentAfter':!_0x49de57['isAtEnd']};}['_insertMarkers'](_0x4f3937,_0x472176){const _0x1fc5f4=this['context']['plugins']['get']('AIEditing'),_0x4efd47=new Set();_0x472176['model']['change'](_0x1959d1=>{for(const _0x41e7d3 of _0x4f3937){const _0x2f10a3=''+rh+_0x41e7d3['type']+':'+_0x41e7d3['groupId']+'_'+_0x1fc5f4['_nextDataId'](_0x4efd47);this['_markers']['set'](_0x2f10a3,{'id':_0x2f10a3,'groupId':_0x41e7d3['groupId'],'type':_0x41e7d3['type'],'content':_0x41e7d3['content'],'editor':_0x472176}),_0x1959d1['addMarker'](_0x2f10a3,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1959d1['createRange'](_0x41e7d3['start'],_0x41e7d3['end'])});}});}['_createGetContextFn'](_0x2022c1,_0x171498,_0x517596){let _0xe2e591='';return()=>{if(!_0xe2e591){const _0x411d48=_0x171498['toView'](_0x2022c1,{'showSuggestionHighlights':!0x0});let _0x3da47c=_0x411d48['getChild'](0x0);if(_0x3da47c['is']('containerElement')||(_0x3da47c=_0x411d48),!_0x3da47c)return'';let _0x1dc2c4=!0x1;const _0x22f4e1=[];for(const _0x2eb550 of _0x3da47c['getChildren']())_0x2eb550['is']('element','span')&&_0x2eb550['hasClass']('ck-ai_review-marker_context-end')&&(_0x1dc2c4=!0x1),_0x1dc2c4&&_0x22f4e1['push'](_0x2eb550),_0x2eb550['is']('element','span')&&_0x2eb550['hasClass']('ck-ai_review-marker_context-start')&&(_0x1dc2c4=!0x0);_0x3da47c['_removeChildren'](0x0,_0x3da47c['childCount']),_0x517596?.['ellipsisBefore']&&_0x3da47c['_appendChild']('…'),_0x3da47c['_appendChild'](_0x22f4e1),_0x517596?.['ellipsisAfter']&&_0x3da47c['_appendChild']('…');const _0xf59ea6=_0x171498['htmlProcessor']['domConverter']['viewToDom'](_0x411d48),_0xd0438a=_0x171498['htmlProcessor']['htmlWriter']['getHtml'](_0xf59ea6);_0xe2e591=this['_removeUnsupportedElements'](_0xd0438a);}return _0xe2e591;};}['_createGetContentFn'](_0xfad8b9,_0x54df74){let _0xbeedca='';return()=>(_0xbeedca||(_0xbeedca=this['_removeUnsupportedElements'](_0x54df74['stringify'](_0xfad8b9,{'showSuggestionHighlights':!0x0}))),_0xbeedca);}['_createGetContentUsingDataIdFn'](_0x2f454a,_0x276c2f,_0x540179){let _0x1e17c1='';return()=>{if(!_0x1e17c1){const _0x90bb3=_0x540179['toView'](new _0x38a201(_0x2f454a));_0x1e17c1=_0x540179['htmlProcessor']['domConverter']['viewToDom'](_0x90bb3)['querySelector']('[data-id=\x22'+_0x276c2f+'\x22]')?.['outerHTML']||'';}return _0x1e17c1;};}['_removeUnsupportedElements'](_0x16aadd){if(!_0x16aadd)return'';const _0x23e31a=ps(_0x16aadd,{'decodeEntities':!0x1}),_0x3f6a2f=ws(_0x23e31a);if(!_0x3f6a2f['length'])return _0x16aadd;for(const _0x2e23e1 of _0x3f6a2f)_0x4e4767(_0x2e23e1);return ms(_0x23e31a,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x3c08e4,_0x30e25b){const _0x1ec066=ps(_0x3c08e4,{'decodeEntities':!0x1}),_0x148efd=ps(_0x30e25b,{'decodeEntities':!0x1}),_0x4f7d7f=ws(_0x1ec066),_0x424980=ws(_0x148efd);if(!_0x4f7d7f['length']&&!_0x424980['length'])return{'contentInitial':_0x3c08e4,'contentNew':_0x30e25b};const _0x140b1c=new Map();for(const _0x2ac142 of _0x4f7d7f)_0x140b1c['set'](fs(_0x2ac142,'data-id'),_0x2ac142);for(const _0x37dc57 of _0x424980){const _0x57eefd=fs(_0x37dc57,'data-id'),_0x543d67=_0x57eefd?_0x140b1c['get'](_0x57eefd):void 0x0;_0x543d67?_0x2b89b7(_0x37dc57,_0xe09a37(_0x543d67,!0x0)):_0x4e4767(_0x37dc57);}return{'contentInitial':ms(_0x1ec066,{'encodeEntities':!0x1}),'contentNew':ms(_0x148efd,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x17ae27,_0x11024f=0x5){let _0xf87523=_0x17ae27,_0x52338c=null;for(let _0x33b2d6=0x0;_0x33b2d6<_0x11024f&&_0xf87523;_0x33b2d6++)if(_0xf87523['className']){if((''+_0xf87523['className'])['includes']('ck-ai_review-marker_')){if(!_0xf87523['getAttribute']('data-marker-id'))break;_0x52338c=_0xf87523;break;}_0xf87523=_0xf87523['parentElement'];}else _0xf87523=_0xf87523['parentElement'];return _0x52338c;}['_findMarkerElementById'](_0x115363){const _0x1a0550=this['_markers']['get'](_0x115363);if(!_0x1a0550)return null;const _0x4cf607=_0x1a0550['editor']['model']['markers']['get'](_0x115363);return _0x4cf607?_0xca6049(_0x1a0550['editor']['editing'],_0x4cf607):null;}['_getMarkersDataForGroup'](_0x646e34){return Array['from'](this['_markers']['values']())['filter'](_0x14c6e4=>_0x14c6e4['groupId']===_0x646e34);}['_getOperationStart'](_0x398061){return'insert'===_0x398061['type']?_0x398061['position']:_0x398061['newRange']['start'];}['_getOperationEnd'](_0x24865a,_0x58abd4=!0x1){return'insert'===_0x24865a['type']?_0x58abd4?_0x24865a['position']:_0x24865a['position']['getShiftedBy'](_0x24865a['howMany']):_0x24865a['newRange']['end'];}['_shiftOperation'](_0x32892a,_0x7973d8){return'insert'===_0x32892a['type']?_0x32892a['position']=_0x32892a['position']['getShiftedBy'](_0x7973d8):'marker'===_0x32892a['type']&&_0x32892a['newRange']&&(_0x32892a['newRange']=new _0x156cfa(_0x32892a['newRange']['start']['getShiftedBy'](_0x7973d8),_0x32892a['newRange']['end']['getShiftedBy'](_0x7973d8))),_0x32892a;}['_changeOperationOwnerDocument'](_0x5254b2,_0x5da32a){'insert'===_0x5254b2['type']?_0x5254b2['position']=this['_changePositionOwnerDocument'](_0x5254b2['position'],_0x5da32a):'marker'===_0x5254b2['type']&&_0x5254b2['newRange']&&(_0x5254b2['newRange']=this['_changeRangeOwnerDocument'](_0x5254b2['newRange'],_0x5da32a));}['_changePositionOwnerDocument'](_0x34bec8,_0x4aeec0){return new _0x435e4b(_0x4aeec0,_0x34bec8['path']);}['_changeRangeOwnerDocument'](_0x48b045,_0x157563){return new _0x156cfa(this['_changePositionOwnerDocument'](_0x48b045['start'],_0x157563),this['_changePositionOwnerDocument'](_0x48b045['end'],_0x157563));}['_changePosition'](_0x19b0ca,_0x4037e9){return new _0x435e4b(_0x4037e9,[..._0x19b0ca]);}['_changeRange'](_0x2d923a,_0x2198c5,_0x140fca,_0x38c4d1){return new _0x156cfa(this['_changePosition'](_0x2198c5,_0x38c4d1),this['_changePosition'](_0x140fca,_0x38c4d1));}['_sortMarkers'](_0x11b0d8){const _0xb40461=_0x289463=>{switch(_0x289463){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x11b0d8['sort']((_0x79c152,_0x3b6148)=>_0xb40461(_0x79c152['type'])-_0xb40461(_0x3b6148['type']));}['_hasSameTopLevelElement'](_0x43dbbf,_0x497302){const _0x3bad49=_0x43dbbf['getChild'](0x0),_0x3ea974=_0x497302['getChild'](0x0);return!(!_0x3bad49||!_0x3ea974)&&((!_0x3bad49['is']('element')||!_0x3ea974['is']('element')||_0x3bad49['name']===_0x3ea974['name'])&&!(_0x3bad49['is']('element')&&!_0x3ea974['is']('element')||!_0x3bad49['is']('element')&&_0x3ea974['is']('element')));}['_haveSingleTopLevelElement'](_0x38e42c){return 0x1===_0x38e42c['childCount'];}['_haveOnlyInlineContent'](_0xf87653,_0x56ee27){for(const _0x3e953e of _0xf87653['getChildren']())if(_0x3e953e['is']('element')&&!_0x56ee27['isInline'](_0x3e953e))return!0x1;return!0x0;}['_upsertDataId'](_0x3d5d10,_0x4ce462){let _0x51185a=_0x3d5d10['getAttribute'](_0x9dc3c8);return _0x51185a||(_0x51185a=_0x4ce462(),_0x3d5d10['_setAttribute'](_0x9dc3c8,_0x51185a)),_0x51185a;}};const ch=/* #__PURE__ -- @preserve */
38
+ ut();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x18e5a0,contentNew:_0x5f44eb,contentInitial:_0x44a7f6,documentVersion:_0x13766f}){super(),this['id']=_0x18e5a0,this['contentNew']=_0x5f44eb,this['contentInitial']=_0x44a7f6,this['documentVersion']=_0x13766f;}};const uh=/* #__PURE__ -- @preserve */
39
+ gt();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x10ec06,_0x37a134,_0x3937c4){super(),this['id']=_0x10ec06,this['parent']=_0x3937c4,this['_data']=_0x37a134,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 _h=/* #__PURE__ -- @preserve */
40
+ gt();var gh=class extends _h{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x51c78e,_0x212948,_0x2edcf6,_0x41c5ee,_0x4fa048){super(),this['_sourceCheck']=_0x212948,this['_documentData']=_0x51c78e,this['_aiConnector']=_0x2edcf6,this['_reviewParams']=_0x41c5ee,this['_reviewArgs']=_0x4fa048,this['on']('change:status',(_0x2470ea,_0x5f0d7f,_0x1a116c)=>{'aborted'==_0x1a116c&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x1a116c,'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'](_0x519b38=>'pending'===_0x519b38['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x3d450f){this['_documentData']=_0x3d450f;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x4ea5ae=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x2fb9bc of _0x4ea5ae)'unmodified'!==_0x2fb9bc['data']['operation']&&('error'!==_0x2fb9bc['data']['operation']?'review-metadata'!==_0x2fb9bc['event']?this['_addReviewCheckResult'](_0x2fb9bc['data']['dataId'],_0x2fb9bc['data']['textDelta']):this['callId']=_0x2fb9bc['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(_0x5ca62d){this['_currentError']=_0x5ca62d,en(_0x5ca62d)?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'](_0x16e0ac,_0x3555d0){const _0x5617cb=this['_results']['get'](_0x16e0ac);if(!_0x5617cb)return;if(0x0===_0x3555d0['length'])return;const _0x3bbb6b=[];_0x3555d0['forEach']((_0x1bf702,_0x2fdc8b)=>{const _0x13bafc=new dh(_0x5617cb['id']+'-'+_0x2fdc8b,_0x1bf702,_0x5617cb);_0x13bafc['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x13bafc,'status':_0x13bafc['status']});}),_0x13bafc['on']('change:isActivated',()=>{_0x13bafc['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x13bafc}):this['fire']('reviewCheckResultDeactivated',{'change':_0x13bafc});}),this['_changes']['push'](_0x13bafc),_0x3bbb6b['push'](_0x13bafc);}),this['fire']('reviewCheckResultReady',{'changes':_0x3bbb6b,'result':_0x5617cb,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0xacb22){const _0x35330a=this['_changes']['find'](_0xb6e510=>_0xb6e510['id']===_0xacb22);return!(!_0x35330a||'pending'!==_0x35330a['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x3e9225=>!0x0===_0x3e9225['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x3e1f16=>'pending'===_0x3e1f16['status']);}['getChangeById'](_0x37cccf){return this['_changes']['find'](_0x5de36e=>_0x5de36e['id']===_0x37cccf);}['markAllChangesAsAccepted'](){for(const _0x5b4774 of this['_changes'])'pending'===_0x5b4774['status']&&(_0x5b4774['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x3ef8e8){const _0xef19fb=this['_changes']['find'](_0x4d7055=>_0x4d7055['id']===_0x3ef8e8);_0xef19fb&&'pending'===_0xef19fb['status']&&(_0xef19fb['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x1b9d5d){const _0x2f7c20=this['_changes']['find'](_0xabaef3=>_0xabaef3['id']===_0x1b9d5d);_0x2f7c20&&'pending'===_0x2f7c20['status']&&(_0x2f7c20['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x1d7021){const _0x518cb1=this['_changes']['find'](_0x546c6d=>_0x546c6d['id']===_0x1d7021);_0x518cb1&&'pending'===_0x518cb1['status']&&(_0x518cb1['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x5856bd){const _0x23d9e2=this['_changes']['find'](_0xc1848d=>_0xc1848d['id']===_0x5856bd);_0x23d9e2&&'outdated'===_0x23d9e2['status']&&(_0x23d9e2['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x4805e4){this['_changes']['filter'](_0x533502=>_0x533502['isActivated']&&_0x533502['id']!==_0x4805e4)['forEach'](_0x531a49=>{_0x531a49['isActivated']=!0x1;});const _0x22bb34=this['_changes']['find'](_0x1a485a=>_0x1a485a['id']===_0x4805e4);_0x22bb34&&'pending'===_0x22bb34['status']&&(_0x22bb34['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x40d75a=>_0x40d75a['isActivated'])['forEach'](_0x3685e1=>{_0x3685e1['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x4dbead){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0xe18a4a;if(_0x4dbead){const _0x3c2fe9=this['_changes']['find'](_0x19664a=>_0x19664a['id']===_0x4dbead);if(_0x3c2fe9&&_0x3c2fe9['isRated'])return;_0x3c2fe9&&(_0xe18a4a=_0x3c2fe9['parent']['id'],_0x3c2fe9['isRated']=!0x0);}const _0xcfd9c={'positiveCount':this['_changes']['filter'](_0x35c2d0=>'accepted'===_0x35c2d0['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0xcfd9c,this['callId'],_0xe18a4a);}['_addReviewCheckResult'](_0x1528c7,_0x12c54b){const _0x5cffac=this['_documentData']['elements']['get'](_0x1528c7);if(!_0x5cffac)return;const _0x4b1c53=_0x5cffac['getContent']();if(_0x4b1c53===_0x12c54b)return;const _0x418538=new lh({'id':_0x1528c7,'contentInitial':_0x4b1c53,'contentNew':_0x12c54b,'documentVersion':_0x5cffac['documentVersion']});this['_results']['set'](_0x418538['id'],_0x418538),this['fire']('reviewCheckResultAdded',{'result':_0x418538,'source':this,'editor':_0x5cffac['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x3c2f48=>'pending'===_0x3c2f48['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x252d05=>'pending'===_0x252d05['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2dffb1=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x187cb9=0x0;_0x187cb9<this['_reviewParams']['length'];_0x187cb9++){if(!this['_reviewParams'][_0x187cb9]||!this['_sourceCheck']['options'][_0x187cb9])continue;const _0x75c27d=this['_sourceCheck']['options'][_0x187cb9]['data']?.['find'](_0xec9c0a=>_0xec9c0a['id']===this['_reviewParams'][_0x187cb9]);_0x75c27d&&_0x2dffb1['push'](_0x75c27d['label']);}return _0x2dffb1['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x13f288,_0x12576d,_0xb8827c){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x12576d,_0x13f288,_0xb8827c);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x7ceac6{['_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',(_0xcaf918,_0x2a7e31)=>this['runCheck'](_0x2a7e31)),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 _0x17a4f4=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x17a4f4['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x17a4f4['map'](_0x13f81f=>_0x13f81f['id']),this['_aiSource']);const _0x2ac766=this['_currentReviewCheckRun'];_0x2ac766['markAllChangesAsAccepted'](),_0x2ac766['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x4342cf,_0x4552f9)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4552f9['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x4552f9['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x4552f9['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4552f9['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x1a5054,_0x3abde0)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x3abde0['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x3abde0['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x3abde0['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x3abde0['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',(_0x285516,_0x4b05f2)=>{this['_onActivateChange'](_0x4b05f2);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2b79f4,_0x123063)=>{this['_onDeactivateChange'](_0x123063);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x51ec76,_0x4f1644)=>{this['_onChangeMarkerClicked'](_0x51ec76,_0x4f1644);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x2d1752,_0x1b8cdd)=>{this['_onChangeMarkerHovered'](_0x2d1752,_0x1b8cdd);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x1361b6,_0x2320a2)=>{this['_onChangeMarkerRemoved'](_0x1361b6,_0x2320a2);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x584676,_0x2a8671)=>{this['_onChangeMarkerRestored'](_0x584676,_0x2a8671);});}async['runCheck'](_0x23f9d3){if(!this['_availableReviewChecks'])return;const _0x5011b9=this['_availableReviewChecks']['find'](_0x1d5eef=>_0x1d5eef['id']===_0x23f9d3['id']);if(_0x5011b9){this['_onReviewCheckRun'](_0x23f9d3),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x23f9d3,_0x5011b9),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x2d89da,_0x29bb76)=>{switch(_0x29bb76['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x29bb76);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'!==_0x29bb76['status']&&'error-chunk'!==_0x29bb76['status']&&'error-general'!==_0x29bb76['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2d6806,_0x10855b)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x205c5e=this['_diffContent'](_0x10855b['editor'],_0x10855b['result']['contentInitial'],_0x10855b['result']['contentNew']);_0x10855b['source']['addResultChanges'](_0x10855b['result']['id'],_0x205c5e);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x2d16ad,_0x503002)=>{for(const _0x5dc53d of _0x503002['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x5dc53d);this['_markChangePositionInEditorContent'](_0x503002['changes'],_0x503002['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x1085af,_0x4d08ca)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x4d08ca['change']['id'],_0x4d08ca['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x5ed16f,_0x41cb95)=>{this['_onReviewCheckResultActivated'](_0x41cb95);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x386725){if(en(_0x386725))return;_0x386725 instanceof ht?this['_logError'](_0x386725):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x386725));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x23f9d3['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x4a599c,_0x355603){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x355603,this['_aiConnector'],_0x4a599c['params'],_0x4a599c['args']);}['_onChangeMarkerRemoved'](_0x3d948b,_0x1c2525){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x1c2525['changeId']);}['_onChangeMarkerRestored'](_0x1d1b22,_0x26649e){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x26649e['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x58b7bd=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x58b7bd&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1fe05e of this['_aiReviewCoreEditing']['getEditors']())_0x1fe05e['editing']['view']['change'](_0x35e8d4=>{for(const _0x5db9a8 of _0x1fe05e['editing']['view']['document']['getRoots']())_0x35e8d4['removeClass']('ck-ai_review-diff',_0x5db9a8),_0x35e8d4['removeClass']('ck-ai_review-highlights',_0x5db9a8),_0x35e8d4['removeClass']('ck-ai-translate-mode-content',_0x5db9a8);});}['_logError'](_0x410a11){this['_reporter']['logError'](_0x410a11),'ai-review-mode-models-unable-to-retrieve'===function(_0x5d3ac9){return _0x5d3ac9 instanceof sn?_0x5d3ac9['code']:_0x5d3ac9 instanceof Error?_0x5d3ac9['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x410a11)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0xea9cc5){if('content'===this['_changeActivationSource']){const _0x299eaf=this['_aiReviewCoreUi']['getChangeElement'](_0xea9cc5);_0x299eaf&&St(_0x299eaf['closest']('.ck-ai_review__check-run-result')||_0x299eaf);}else{if('panel'===this['_changeActivationSource']){const _0x1e08df=this['_getChangeContentElement'](_0xea9cc5);if(!_0x1e08df)return;Rt({'target':_0x1e08df,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x284acf,_0x4eef2d,_0x20d60c,_0x530c33,_0x11aee6){super(_0x20d60c,_0x530c33,_0x11aee6),this['_prompt']=_0x284acf,this['_model']=_0x4eef2d;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5b6774,_0x6f66c6,_0x4db971){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x6f66c6,_0x5b6774,_0x4db971);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x1853ab){this['id']=_0x1853ab['id'],this['commandId']=_0x1853ab['commandId'],this['title']=_0x1853ab['title'],this['description']=_0x1853ab['description'],this['isParameterized']=_0x1853ab['isParameterized'],this['useArgs']=_0x1853ab['useArgs'],this['options']=_0x1853ab['options'],this['args']=_0x1853ab['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x183318,_0x37d832,_0x49af0b){super(_0x183318),this['prompt']=_0x183318['prompt'],this['model']=_0x183318['model'],this['model']?this['_defaultModel']=_0x37d832['find'](_0x438afa=>_0x438afa['id']===this['model'])||null:this['_defaultModel']=_0x49af0b;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x24bc46){this['_prompt']=_0x24bc46;}set['model'](_0x2ea323){this['_model']=_0x2ea323;}},wh=class extends _0x7ceac6{static get['requires'](){return[ls,nn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](nn)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ch=[{'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'}]}]}],fh=/* #__PURE__ -- @preserve */
41
+ gt();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x5855e4){this['_checks']=_0x5855e4['map'](_0x5db05d=>new mh(_0x5db05d));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x46941c){return this['checks']['find'](_0x54ea95=>_0x54ea95['id']===_0x46941c);}['removeCheckById'](_0x217d9b){this['_checks']=this['_checks']['filter'](_0x56a635=>_0x56a635['id']!==_0x217d9b);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x54299d,_0x53e368,_0x221b85){super(_0x54299d),this['_models']=_0x53e368,this['_defaultModel']=_0x221b85;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x5a4deb,_0x224fb2,_0x2ff22a){super(),this['_allModels']=_0x5a4deb,this['_recommendedModels']=_0x224fb2,this['_defaultModel']=_0x2ff22a;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x2d242e){this['_checks']=_0x2d242e['map'](_0x1df2c8=>!0x0===_0x1df2c8['isExtra']?new Eh(_0x1df2c8,this['_allModels'],this['_defaultModel']):'custom'===_0x1df2c8['id']?new Sh(_0x1df2c8,this['_recommendedModels'],this['_defaultModel']):new mh(_0x1df2c8));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x508df1){super(_0x508df1),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5c841b=>({'id':_0x5c841b['id'],'commandId':_0x5c841b['id'],'title':_0x5c841b['label'],'description':_0x5c841b['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5c841b['prompt'],'model':_0x5c841b['model']}));}async['_loadChecksList'](){const _0x19ca02=[...Ch,...this['getExtraChecks']()]['map'](_0x5471ff=>_0x5471ff['isExtra']?_0x5471ff:this['_translateReviewCheck'](_0x5471ff)),_0x4d2f7e=await this['_getModels'](),_0xbf4bef=new Rh(_0x4d2f7e['all'],_0x4d2f7e['recommended'],_0x4d2f7e['default']);return _0xbf4bef['setupChecks'](_0x19ca02),_0xbf4bef;}async['_getModels'](){const _0x5222ce=this['context']['plugins']['get']('AIConnector');try{const _0xc3f3ee=new Qs({'connector':_0x5222ce,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x70b059={'all':await _0xc3f3ee['getAll'](),'recommended':await _0xc3f3ee['getAvailableModels'](),'default':await _0xc3f3ee['getDefault']()};return this['_modelsLoadError']=null,_0x70b059;}catch(_0x1f3642){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x1f3642),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0xa5288b){const _0x565182='AI_REVIEW_CHECK_'+_0xa5288b['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x270b82={..._0xa5288b,'title':this['_translate'](_0x565182+'_TITLE',_0xa5288b['title']),'description':this['_translate'](_0x565182+'_DESCRIPTION',_0xa5288b['description'])};return _0xa5288b['options']&&(_0x270b82['options']=_0xa5288b['options']['map'](_0x492080=>({..._0x492080,'label':this['_translate'](_0x565182+'_OPTIONS_LABEL',_0x492080['label']||''),'data':_0x492080['data']?_0x492080['data']['map'](_0x5083a8=>({..._0x5083a8,'label':this['_translate'](_0x565182+'_OPTIONS_DATA_'+_0x5083a8['id']['toUpperCase'](),_0x5083a8['label'])})):void 0x0}))),_0x270b82;}['_translate'](_0x875f85,_0x2033c8){const _0x2ada4e=us(this['context']['locale'],_0x875f85);return _0x2ada4e===_0x875f85?_0x2033c8:_0x2ada4e;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[nn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x3f8cb3){super(_0x3f8cb3),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x274c3=>_0x274c3['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x510cce,_0x12c3c3)=>{this['_isDiffOn']=_0x12c3c3['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x6e04c1,_0x1ca894){if(_0x6e04c1['isCustom'])return new ph(_0x6e04c1['args']['prompt'],_0x6e04c1['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1ca894,this['_aiConnector']);if(_0x1ca894['isExtra']){const _0x1916f9=_0x1ca894;return new Th(_0x6e04c1['args']?.['prompt']??_0x1916f9['prompt'],_0x6e04c1['args']?.['model']??_0x1916f9['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x1ca894,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1ca894,this['_aiConnector'],_0x6e04c1['params'],_0x6e04c1['args']);}['_onReviewCheckResultActivated'](_0x5597e1){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5597e1['change']['id']),this['_scrollToChange'](_0x5597e1['change']['id']);const _0xb0d2fc=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5597e1['change']['id']);if(!_0xb0d2fc)return;const _0x5c93ba=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5597e1['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5597e1['change'],()=>_0xb0d2fc['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x5c93ba,_0xb0d2fc['modelRange']['root']['rootName']),_0x5c93ba?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5597e1['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x3bea80){this['_currentReviewCheckRun']&&'click'===_0x3bea80['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x3bea80['id']));}['_onDeactivateChange'](_0x2f4a3a){this['_currentReviewCheckRun']&&'balloon'===_0x2f4a3a['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x25ba6d,_0x2d497b){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2d497b['changeId']);const _0x5ee9e1=this['_currentReviewCheckRun']['getChangeById'](_0x2d497b['changeId']);if(!_0x5ee9e1)return;const _0x1f649e=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2d497b['changeId']),_0x6e620d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2d497b['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5ee9e1,_0x2d497b['markerElement'],_0x2d497b['domEvent'],'click',this['_getBalloonDomRoot'](_0x6e620d,_0x1f649e?.['modelRange']['root']['rootName']),_0x6e620d?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x5631b2,_0x3a80e1){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x5591d7=this['_currentReviewCheckRun']['getChangeById'](_0x3a80e1['changeId']);if(!_0x5591d7)return;const _0x27ad62=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3a80e1['changeId']),_0x2529a7=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3a80e1['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5591d7,_0x3a80e1['markerElement'],_0x3a80e1['domEvent'],'hover',this['_getBalloonDomRoot'](_0x2529a7,_0x27ad62?.['modelRange']['root']['rootName']),_0x2529a7?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x441abe){const _0x48be0b=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x441abe);return _0x48be0b?_0x48be0b['getElement']():null;}['_markChangePositionInEditorContent'](_0x3e91a7,_0x102c1a){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3e91a7,_0x102c1a);}['_diffContent'](_0x531c67,_0x12ff5e,_0x314706){return this['_aiReviewCoreEditing']['diffContent'](_0x531c67,_0x12ff5e,_0x314706,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x16c334){_0x16c334?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x3cbe2e of this['_aiReviewCoreEditing']['getEditors']())_0x3cbe2e['editing']['view']['change'](_0x3a7876=>{for(const _0x364412 of _0x3cbe2e['editing']['view']['document']['getRoots']()){for(const _0x1e0bae of _0x364412['getClassNames']())_0x1e0bae['startsWith']('ck-ai_review-')&&_0x3a7876['removeClass'](_0x1e0bae,_0x364412);_0x3a7876['addClass'](_0x16c334?'ck-ai_review-diff':'ck-ai_review-highlights',_0x364412);}});}['_getBalloonDomRoot'](_0x30b6f9,_0x7c232d){const _0x4197cf=_0x30b6f9['editing']['view'];if(_0x7c232d){const _0xbe054d=_0x4197cf['getDomRoot'](_0x7c232d);if(_0xbe054d)return _0xbe054d;}return _0x4197cf['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x1841a4=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x5b644a=await _0x1841a4['getChecksList']();_0x1841a4['modelsLoadError']&&this['_logError'](_0x1841a4['modelsLoadError']);let _0x14efa3=_0x5b644a['checks'];const _0x50cba3=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x50cba3,_0x14efa3),this['_usesAvailableCommandsConfig']&&(_0x14efa3=_0x50cba3['map'](_0x3e02dc=>_0x14efa3['find'](_0x2add60=>_0x2add60['id']===_0x3e02dc))['filter'](_0x4d2074=>!!_0x4d2074)),this['_filterChecksWithMissingModel'](_0x14efa3);}['_logWarningForNonExistentChecks'](_0x1d407b,_0x35f7d1){const _0x2d1d79=_0x1d407b['filter'](_0x432976=>!_0x35f7d1['some'](_0x18b4f6=>_0x18b4f6['id']===_0x432976));_0x2d1d79['length']&&this['_reporter']['logError'](new sn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2d1d79['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x40a850){const _0x431db2=[];return _0x40a850['forEach'](_0x18515a=>{(_0x18515a instanceof Eh&&!_0x18515a['defaultModel']||_0x18515a instanceof Sh&&!_0x18515a['models']['length'])&&_0x431db2['push'](_0x18515a['id']);}),_0x431db2['length']&&_0x431db2['forEach'](_0x5cba7a=>{_0x40a850=_0x40a850['filter'](_0x361181=>_0x361181['id']!==_0x5cba7a),this['_reporter']['logError'](new sn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x5cba7a}}));}),_0x40a850;}};function kh(_0x2bebb8,_0x12b742,_0x190ab3,_0x157159){return _0x2bebb8 instanceof ht?_0x2bebb8:new ht(_0x12b742,_0x190ab3,_0x157159,_0x2bebb8);}var Nh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x1f36ed){this['_affectedBlocks']=_0x1f36ed;}},yh=class extends _0x7ceac6{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x141dd8=>{const _0xd5318c={'id':_0x141dd8['id'],'title':_0x141dd8['title'],'description':_0x141dd8['description']};return'custom'!==_0x141dd8['id']&&_0x141dd8['options']?.['length']&&(_0xd5318c['parameters']=_0x141dd8['options'][0x0]['data']['map'](_0x212e58=>({..._0x212e58}))),_0xd5318c;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x49754a,_0x5562b2){return await this['_runReviewCheck'](_0x49754a,()=>this['_createReviewCheckRun'](_0x49754a,_0x5562b2?.['parameterId']),_0x5562b2?.['signal']);}async['runCustomReview'](_0x1aa0cc,_0x3113aa){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x1aa0cc,_0x3113aa?.['model']),_0x3113aa?.['signal']);}['applyReview'](_0x1975f4,_0x587e63){this['context']['plugins']['get']('AIGateway')['apply'](_0x1975f4,{'applyMethod':_0x587e63,'aiSource':'review'});}async['_runReviewCheck'](_0x579912,_0x5ae8ea,_0x4a0a90){const _0x1730b3=_s(this['context']),_0x4ccb7f=new Nh({'editor':_0x1730b3,'rootName':_0x1730b3['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x1730b3['plugins']['get']('AIEditing')['getSessionId'](_0x1730b3)});let _0x3d3588,_0x3017c1;if(_0x4a0a90){if(_0x4a0a90['aborted'])return _0x4ccb7f['abort'](),_0x4ccb7f;const _0x1b3a1f=()=>{_0x4ccb7f['error']||(_0x4ccb7f['abort'](),_0x3d3588&&_0x3d3588['abort']());};_0x4a0a90['addEventListener']('abort',_0x1b3a1f),_0x3017c1=()=>_0x4a0a90['removeEventListener']('abort',_0x1b3a1f);}try{_0x3d3588=await _0x5ae8ea(),_0x4ccb7f['contentRawOld']=_0x3d3588['documentData']['content'],_0x4ccb7f['documentVersion']=Array['from'](_0x3d3588['documentData']['elements'])['find'](([,_0x2e4b1e])=>_0x2e4b1e['rootName']===_0x4ccb7f['rootName'])?.[0x1]['documentVersion']??0x1,_0x3d3588['on']('reviewCheckRunUpdated',(_0x394262,_0x42b17e)=>{'aborted'===_0x42b17e['status']?_0x4ccb7f['abort']():'error-general'!==_0x42b17e['status']&&'error-chunk'!==_0x42b17e['status']||(_0x4ccb7f['error']=kh(_0x42b17e['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x579912}));}),'aborted'!==_0x4ccb7f['status']&&await _0x3d3588['start']();}catch(_0x5a2fcf){_0x4ccb7f['error']=kh(_0x5a2fcf,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x579912});}finally{_0x3017c1&&_0x3017c1();}if(!_0x3d3588||'aborted'===_0x4ccb7f['status']||'error'===_0x4ccb7f['status'])return _0x4ccb7f;_0x4ccb7f['affectedBlocks']=_0x3d3588['results']['map'](_0x4927fe=>({'id':_0x4927fe['id'],'content':_0x4927fe['contentNew']}));try{_0x4ccb7f['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x4ccb7f['affectedBlocks'],_0x4ccb7f['contentRawOld'],_0x4ccb7f['editor']));}catch(_0x2afc53){_0x4ccb7f['error']=kh(_0x2afc53,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x579912});}return _0x4ccb7f;}async['_createReviewCheckRun'](_0x295b1b,_0xe5a5f6){const _0x26fa36=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x11e645=>_0x11e645['id']===_0x295b1b);if(!_0x26fa36)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x295b1b});if(_0x26fa36 instanceof Sh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x295b1b});const _0x3f7929=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x56f106=this['context']['plugins']['get']('AIConnector');if(_0x26fa36 instanceof Eh){if(!_0x26fa36['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x295b1b});return new Th(_0x26fa36['prompt'],_0x26fa36['defaultModel']['id'],_0x3f7929,_0x26fa36,_0x56f106);}return new Ah(_0x3f7929,_0x26fa36,_0x56f106,_0xe5a5f6?[_0xe5a5f6]:void 0x0);}async['_createCustomReviewCheckRun'](_0x2dcf6b,_0x14a575,_0x4a6fe8){const _0xbe39b4=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x11838c=>_0x11838c['id']===_0x2dcf6b);if(!_0xbe39b4)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x2dcf6b});if(!(_0xbe39b4 instanceof Sh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x2dcf6b});const _0x36a274=_0x4a6fe8??_0xbe39b4['defaultModel']?.['id'];if(!_0x14a575)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x2dcf6b});if(!_0x36a274)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x2dcf6b});return new ph(_0x14a575,_0x36a274,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0xbe39b4,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x7ceac6{static get['requires'](){return[vh,nh,hh,yh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x439bd1,_0xb303c1){if(this['assertStartReviewPreconditions'](_0x439bd1)instanceof Sh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x439bd1});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x439bd1,'params':_0xb303c1?.['parameterId']?[_0xb303c1['parameterId']]:void 0x0});}async['startCustomReview'](_0x3aad5c,_0x1ee52c){if(!_0x3aad5c)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x7cb24b=Ch['find'](_0x3380c4=>'custom'===_0x3380c4['commandId'])['id'],_0x19bc5c=this['assertStartReviewPreconditions'](_0x7cb24b),_0x48ebd3=_0x1ee52c?.['model']??_0x19bc5c['defaultModel']?.['id'];if(!_0x48ebd3)throw new ht('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x7cb24b,'isCustom':!0x0,'args':{'prompt':_0x3aad5c,'model':_0x48ebd3}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x4c21ab=>{const _0x107298={'id':_0x4c21ab['id'],'title':_0x4c21ab['title'],'description':_0x4c21ab['description']};return'custom'!==_0x4c21ab['id']&&_0x4c21ab['options']?.['length']&&(_0x107298['parameters']=_0x4c21ab['options'][0x0]['data']['map'](_0x3bca7c=>({..._0x3bca7c}))),_0x107298;});}['assertStartReviewPreconditions'](_0x13e094){const _0x2c6565=this['context']['plugins']['get']('AIReviewModeController');if(_0x2c6565['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0xca9d28=_0x2c6565['getAvailableChecks']()['find'](_0x4e4716=>_0x4e4716['id']===_0x13e094);if(!_0xca9d28)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x13e094});return _0xca9d28;}},Lh=class extends Ah{['_title'];constructor(_0x4e1a37,_0x1c292f,_0x4627a4,_0x4700c4,_0x50b17c,_0x4a1e43){super(_0x4e1a37,_0x1c292f,_0x4627a4,_0x50b17c,_0x4a1e43),this['_title']=_0x4700c4;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x6be43d){this['_checks']=_0x6be43d['map'](_0x58447c=>new Dh(_0x58447c));}};const Hh=[{'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 Mh=class extends wh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x5827de){super(_0x5827de),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x4b2cbc=[],_0x1a7ce2=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x43a7e5 of _0x1a7ce2)_0x4b2cbc['push']({'title':_0x43a7e5['label'],'id':_0x43a7e5['id'],'commandId':_0x43a7e5['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x43a7e5['id']}});const _0x34d0f3=new Ph();return _0x34d0f3['setupChecks'](this['_translateChecks'](_0x4b2cbc)),_0x34d0f3;}['_translateChecks'](_0x3f3e20){const _0x1bcd7d=this['context']['locale'];return _0x3f3e20['map'](_0x50a889=>{const _0x2313ef='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x50a889['title']['toUpperCase']()['replaceAll']('-','_'),_0x45da16=us(_0x1bcd7d,_0x2313ef);return{..._0x50a889,'title':_0x45da16===_0x2313ef?_0x50a889['title']:_0x45da16};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[nn,Mh];}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'](_0x2dc6eb,_0x1ba441){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1ba441,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x2dc6eb['params'],_0x2dc6eb['args']);}['_onReviewCheckResultActivated'](_0x55e4d2){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x55e4d2['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x55e4d2['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x41bd3f){this['_currentReviewCheckRun']&&('hover'===_0x41bd3f['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x41bd3f['id'])),'click'===_0x41bd3f['uiInteraction']&&this['_scrollToChange'](_0x41bd3f['id']));}['_onDeactivateChange'](_0x49736f){this['_currentReviewCheckRun']&&'panel'===_0x49736f['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x325e5f,_0x30c9c2){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x30c9c2['changeId']),this['_scrollToChange'](_0x30c9c2['changeId']));}['_onChangeMarkerHovered'](_0x500cb4,_0x7598db){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x7598db['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x7598db['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x327e84){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x327e84);}['_markChangePositionInEditorContent'](_0x7e3037,_0x24fee5){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x7e3037,_0x24fee5);}['_diffContent'](_0x6e556d,_0x4c549d,_0x1d0834){return this['_aiReviewCoreEditing']['diffContent'](_0x6e556d,_0x4c549d,_0x1d0834,!0x0);}['_onReviewCheckRun'](){for(const _0x59a63b of this['_aiReviewCoreEditing']['getEditors']())_0x59a63b['editing']['view']['change'](_0xc8446e=>{for(const _0x483225 of _0x59a63b['editing']['view']['document']['getRoots']())_0xc8446e['addClass']('ck-ai-translate-mode-content',_0x483225);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x371031,_0x3f3e9d){super(_0x371031,_0x3f3e9d),this['on']('set:isLoading',(_0x8092c4,_0x2c54bf,_0x42cfaf)=>{_0x42cfaf&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x1235d0,_0x19d2a1,_0x7357dc)=>{_0x7357dc&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x1a9e55=super['_createAcceptAllButtonView']();return _0x1a9e55['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x1a9e55;}['_createExitReviewButtonView'](){const _0x26ae41=super['_createExitReviewButtonView']();return _0x26ae41['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x26ae41;}},Bh=class extends sh{['_setupTemplate'](){const _0x3f0e9c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x3f0e9c['if']('isVisible','ck-hidden',_0x278c78=>!_0x278c78)]},'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',_0x3f0e9c['if']('isVisible','ck-hidden',_0x211c0c=>!_0x211c0c)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x4ee3c1=this['context']['plugins']['get']('AITabs'),_0x31e48f=this['context']['locale'],_0x3ad862=new Ho(_0x31e48f,{'label':us(_0x31e48f,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x23533e,'class':'ck-ai-header_review-translate','showResizeButton':_0x4ee3c1['showResizeButton']});_0x3ad862['delegate']('resizeTabs')['to'](_0x4ee3c1),_0x3ad862['bind']('isMaximized')['to'](_0x4ee3c1['view'],'isMaximized',_0x506df9=>_0x506df9);const _0x4700fa=new $a(_0x31e48f,{'header':_0x3ad862,'list':new Bh(_0x31e48f),'results':new Uh(_0x31e48f,{'generalErrorText':us(_0x31e48f,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x31e48f,{'headerText':us(_0x31e48f,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x31e48f,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x31e48f,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x4700fa['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x4700fa;}['registerTab'](){const _0x3fb2d3=this['context']['plugins']['get']('AITabs');_0x3fb2d3['view']['on']('activateTab',(_0x80b91e,{newTab:_0x304b1d,oldTab:_0x499bd9})=>{'translate'===_0x304b1d?this['fire']('getReviewCheckList'):'translate'===_0x499bd9&&this['fire']('leaveReview');}),_0x3fb2d3['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x23533e,'order':0x0,'content':this['_mainView']});}},Fh=class extends Js{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x329765){this['_affectedBlocks']=_0x329765;}},Kh=class extends _0x7ceac6{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,ls,Is,js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x52a0f8,_0x4fa840){return await this['_runTranslateCheck'](_0x52a0f8,()=>this['_createTranslateCheckRun'](_0x52a0f8),_0x4fa840?.['signal']);}['applyTranslate'](_0x1b4d8a,_0x227e7a){this['context']['plugins']['get']('AIGateway')['apply'](_0x1b4d8a,_0x227e7a);}async['_runTranslateCheck'](_0x29c284,_0x4e5a6b,_0x5a0dd0){const _0x308cb8=_s(this['context']),_0x215305=new Fh({'editor':_0x308cb8,'rootName':_0x308cb8['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x308cb8['plugins']['get']('AIEditing')['getSessionId'](_0x308cb8)});let _0x76687c,_0x27919d;if(_0x5a0dd0){if(_0x5a0dd0['aborted'])return _0x215305['abort'](),_0x215305;const _0x11d0ae=()=>{_0x215305['error']||(_0x215305['abort'](),_0x76687c&&_0x76687c['abort']());};_0x5a0dd0['addEventListener']('abort',_0x11d0ae),_0x27919d=()=>_0x5a0dd0['removeEventListener']('abort',_0x11d0ae);}try{_0x76687c=await _0x4e5a6b(),_0x215305['contentRawOld']=_0x76687c['documentData']['content'],_0x215305['documentVersion']=Array['from'](_0x76687c['documentData']['elements'])['find'](([,_0x1147f2])=>_0x1147f2['rootName']===_0x215305['rootName'])?.[0x1]['documentVersion']??0x1,_0x76687c['on']('reviewCheckRunUpdated',(_0x4a0454,_0x46b04e)=>{'aborted'===_0x46b04e['status']?_0x215305['abort']():'error-general'!==_0x46b04e['status']&&'error-chunk'!==_0x46b04e['status']||(_0x215305['error']=kh(_0x46b04e['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x29c284}));}),'aborted'!==_0x215305['status']&&await _0x76687c['start']();}catch(_0x139aba){_0x215305['error']=kh(_0x139aba,'ai-translategateway-translation-run-failed',this,{'language':_0x29c284});}finally{_0x27919d&&_0x27919d();}if(!_0x76687c||'aborted'===_0x215305['status']||'error'===_0x215305['status'])return _0x215305;_0x215305['affectedBlocks']=_0x76687c['results']['map'](_0x4824a4=>({'id':_0x4824a4['id'],'content':_0x4824a4['contentNew']}));try{_0x215305['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x215305['affectedBlocks'],_0x215305['contentRawOld'],_0x215305['editor']));}catch(_0x4a8fa3){_0x215305['error']=kh(_0x4a8fa3,'ai-translategateway-translation-run-failed',this,{'language':_0x29c284});}return _0x215305;}async['_createTranslateCheckRun'](_0x32760f){const _0x121838=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x588817=this['context']['plugins']['get']('AIConnector');return new Lh(_0x121838,new Dh({'id':_0x32760f,'commandId':_0x32760f,'title':_0x32760f,'description':'','isParameterized':!0x1}),_0x588817,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x32760f});}},Wh=class extends _0x7ceac6{static get['requires'](){return[Vh,Gh,hh,Kh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x29e2c3){const _0xa8378e=this['assertStartTranslatePreconditions'](_0x29e2c3);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0xa8378e['id'],'args':_0xa8378e['useArgs']?_0xa8378e['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x59aefd=>({'id':_0x59aefd['id'],'label':_0x59aefd['title']}));}['assertStartTranslatePreconditions'](_0x3b5d1b){const _0x355f10=this['context']['plugins']['get']('AITranslateController');if(_0x355f10['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x2ada95=_0x355f10['getAvailableChecks']()['find'](_0x426b32=>_0x426b32['id']===_0x3b5d1b);if(!_0x2ada95)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x3b5d1b});return _0x2ada95;}};export{Ua as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,fn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,ls as AIConnector,sn as AICoreError,tn as AIDocumentProcessingGateway,Zs as AIDocumentProcessingRunResult,Is as AIEditing,Aa as AIEditorIntegration,rn as AIErrorReporter,nn as AIErrorSink,js as AIGateway,An as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,dn as AIReply,ki as AIRequestError,mh as AIReviewCheck,lh as AIReviewCheckResult,dh as AIReviewCheckResultChange,gh as AIReviewCheckRun,yh as AIReviewGateway,xh as AIReviewMode,Ih as AIReviewModeController,hh as AIReviewModeEditing,nh as AIReviewModeUI,Nh as AIReviewRunResult,Js as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,ra as ToggleAICommand,cn as createResizeButton,Zi as getDefaultAICommands,zs as markOperationsAsAI};