@ckeditor/ckeditor5-ai 48.3.0-alpha.1 → 48.3.0-alpha.2

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 _0x2f2e2c,ContextPlugin as _0x3abc0e,Editor as _0x5a1597,Plugin as _0x5bc74c}from'@ckeditor/ckeditor5-core';import{IconAI as _0x17fb3f,IconAIAdjustLength as _0x2279d3,IconAIAskAI as _0x425345,IconAIChangeTone as _0x4d510a,IconAIChat as _0x433c60,IconAIChatCommands as _0x3eaea4,IconAIContinueWriting as _0x16808c,IconAIGrammarCheck as _0x597aae,IconAIHistory as _0x4f0239,IconAIImproveWriting as _0x234164,IconAIOther as _0x47ef5b,IconAIQuickActions as _0x2a6bd4,IconAIReview as _0x2f914c,IconAITranslate as _0x3de69e,IconBoxWithCheck as _0x3c414c,IconBoxWithCross as _0x56ff1c,IconBoxWithMarker as _0xa46cb9,IconBrowseFiles as _0x32d23c,IconBulb as _0xae43e5,IconCancel as _0x544e33,IconCheck as _0x1fb55b,IconChevronDown as _0x4f154b,IconChevronRight as _0x50ee10,IconChevronUp as _0x8aee51,IconCopy as _0x2213d2,IconDocument as _0x1445d9,IconDocumentOutline as _0x27bd8d,IconDropdownArrow as _0x599889,IconError as _0x25a3d8,IconEye as _0x2e3b97,IconEyeCrossedOut as _0x225cf3,IconFileUpload as _0x1bcaaf,IconImage as _0x196f31,IconInfo as _0x181c93,IconLink as _0x3ee98b,IconLoupe as _0xc1f191,IconMagicWand as _0xa22694,IconMaximize as _0x3b264e,IconMinimize as _0x1b8488,IconNextArrow as _0xa46100,IconOutdated as _0x37848a,IconPaperClip as _0x19e50c,IconPin as _0x384872,IconPlus as _0x2013b1,IconPreviousArrow as _0x2db01d,IconRefresh as _0x3affd5,IconRobotPencil as _0x5b145b,IconSelection as _0xab00a8,IconShowChangesOff as _0x2973b4,IconShowChangesOn as tt,IconStop as et,IconSubmit as it,IconThreeHorizontalDots as st,IconThumbDown as nt,IconThumbUp as rt,IconWeb as ot}from'@ckeditor/ckeditor5-icons';import{CKEditorError as at,Collection as ht,DomEmitterMixin as ct,EmitterMixin as lt,FocusTracker as ut,KeystrokeHandler as dt,ObservableMixin as _t,Rect as gt,ResizeObserver as At,_isMotionReduced as It,first as pt,getConstrainedViewportRect as mt,global as Et,insertToPriorityArray as Tt,isVisible as wt,logError as Ct,logWarning as ft,scrollAncestorsToShowTarget as bt,scrollViewportToShowTarget as St,toArray as Rt,uid as Ot,version as vt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as kt,BalloonPanelView as Nt,BalloonToolbar as yt,BodyCollection as xt,ButtonLabelView as Lt,ButtonLabelWithHighlightView as Dt,ButtonView as Pt,Dialog as Ht,DialogViewPosition as Mt,DropdownMenuPanelPositioningFunctions as Vt,FileDialogButtonView as Ut,FocusCycler as Bt,FormHeaderView as Gt,FormRowView as Ft,HighlightedTextView as Kt,IconView as Wt,InputTextView as Yt,LabeledFieldView as $t,ListItemButtonView as qt,ListItemGroupView as Qt,ListItemView as Xt,ListView as zt,MenuBarMenuListItemButtonView as jt,MenuBarMenuListItemView as Jt,MenuBarMenuListView as Zt,MenuBarMenuView as te,SearchTextView as _0x853608,SpinnerView as _0x17e663,TextareaView as _0xd400c4,ToolbarView as _0x4b90d1,UIModel as _0x2d4237,View as _0x4708a3,ViewCollection as _0x4f88bc,addListToDropdown as _0x41c9a7,addMenuToDropdown as _0x4fe6d6,clickOutsideHandler as _0xfcbf0e,createDropdown as _0x353e74,createLabeledInputText as _0xc4912a,createLabeledTextarea as _0x46d7e1,submitHandler as _0xfe4486}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x360802,ClipboardPipeline as _0x72a589}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x40b89f,MarkerOperation as _0x414b93,Matcher as _0x4f355c,ModelDocumentFragment as _0xc7ecd7,ModelPosition as _0x4c52aa,ModelRange as _0x5cca78,ModelTreeWalker as _0x7bd257,ViewDataTransfer as _0xa3026c,ViewDocumentDomEventData as _0x3ecc64,ViewDowncastWriter as _0x4554d0,ViewUpcastWriter as _0x11238b,_DetachOperation as _0x1bbc64,_insertIntoModelNodeList as _0x141f19,_removeFromModelNodeList as _0x2ce61c,transformOperationSets as _0x1790d4}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x163ee1,debounce as _0x1c2d83,escape as _0x47dde7,escapeRegExp as _0x2cddd7,throttle as _0x57ffe3,unescape as _0xe9b4ed}from'es-toolkit/compat';import{createParser as _0x43c815}from'eventsource-parser';import{CloudServices as _0x1e4e93}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0xd046de,DATA_ID_MODEL_ATTRIBUTE as _0x32a933,DATA_ID_VIEW_ATTRIBUTE as _0x4907b2,DocumentCompare as _0x3ea65d,SuggestionsConversion as _0x3cdc25,fixElementSuggestionRange as _0x5f13c7,getAllMarkersDomElementsSorted as _0x2f8615,getMarkerDomElement as _0x178cd1}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x2f5649}from'htmlparser2';import{append as _0x3c432c,appendChild as _0x18873b,find as _0x188519,findAll as _0x210655,findOne as _0x103707,getChildren as ti,getParent as _0x4fbc65,isComment as _0x3bd54b,isTag as _0x314fbd,prepend as _0x28f757,prependChild as _0x49cc30,removeElement as _0x46f92a,replaceElement as _0x4cf7f1,textContent as _0x4452ef}from'domutils';import _0x425375 from'dom-serializer';import{Document as _0x428e8a,Element as _0x11613c,NodeWithChildren as _0x1b5cde,Text as _0x1b2c94,cloneNode as _0x2c8968,isDocument as _0x779624,isText as _0x238b68}from'domhandler';import{MarkdownGfmMdToHtml as _0x48adef,MarkdownGfmMdToHtmlDefaultPlugins as _0x340a16}from'@ckeditor/ckeditor5-markdown-gfm';import _0x28237c from'rehype-sanitize';import _0x320955 from'morphdom';import{diffArrays as _0x52bd71}from'diff';const Ci='_ungrouppedCommands';function fi(_0x4cf3c8,_0x1c288f){const _0x3568f0=(0x0,_0x1c288f['t'])('Other');return _0x4cf3c8['length']?'groupId'in _0x4cf3c8[0x0]?_0x4cf3c8:[{'groupId':Ci,'groupLabel':_0x3568f0,'order':0x1/0x0,'commands':_0x4cf3c8}]:[{'groupId':Ci,'groupLabel':_0x3568f0,'order':0x1/0x0,'commands':[]}];}const bi=globalThis['DataTransfer'],Si='ai-ui';var Ri=class extends _0x5bc74c{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x13d51c}=this,_0x125b23=['ck-fake-ai-selection'];_0x13d51c['config']['get']('ai.assistant.useTheme')&&_0x125b23['push']('ck-ai-assistant-ui_theme'),_0x13d51c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x125b23,'priority':0xc}}),_0x13d51c['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x106cff,{writer:_0x366979})=>{if(!_0x106cff['markerRange']['isCollapsed'])return null;const _0x2a65f3=_0x366979['createUIElement']('span');return _0x366979['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x2a65f3),_0x2a65f3;}});}['afterInit'](){!async function(_0x2e58b0){const _0x4dd3db='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x347016=0x78df8,_0x447e7a=window['Date']['now'](),_0x2a20d4=_0x2e58b0['editor'],_0x5a0e7c=new window['Promise'](_0x340ada=>{_0x2a20d4['once']('ready',_0x340ada);}),_0x27ffcd={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x4e9215=_0x2a20d4['config']['get']('licenseKey');async function _0x5bda94(){let _0xdbdfde,_0x3f195d=null,_0x504c46=null;try{return'GPL'==_0x4e9215?'NotAllowed':(_0xdbdfde=_0x23546c(),_0xdbdfde?(_0xdbdfde['usageEndpoint']&&(_0x504c46=_0x5cf3fd(_0xdbdfde['usageEndpoint'],_0xdbdfde['jti'])),await _0x7bd46c()?_0x28fe15()?_0x35213b()?'Expired':_0x25408f()?('evaluation'==_0xdbdfde['licenseType']&&(_0x3f195d=_0x4a37db('EvaluationLimit')),await _0x948a67()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x35213b(){const _0x2c10eb=['evaluation','trial']['includes'](_0xdbdfde['licenseType'])?_0x447e7a/0x3e8:0xe10*_0x347016;return _0xdbdfde['exp']<_0x2c10eb;}function _0x28fe15(){const _0x485378=_0xdbdfde['features'];return!!_0x485378&&(!!_0x485378['includes']('*')||!!_0x485378['includes']('AI'));}function _0x25408f(){const _0x2ad58f=_0xdbdfde['licensedHosts'];if(!_0x2ad58f||0x0==_0x2ad58f['length'])return!0x0;const {hostname:_0x38dfa9}=new URL(window['location']['href']);if(_0x2ad58f['includes'](_0x38dfa9))return!0x0;const _0x4271fd=_0x38dfa9['split']('.');return _0x2ad58f['filter'](_0x147da8=>_0x147da8['includes']('*'))['map'](_0x4db721=>_0x4db721['split']('.'))['filter'](_0x4329cf=>_0x4329cf['length']<=_0x4271fd['length'])['map'](_0x52f8de=>Array(_0x4271fd['length']-_0x52f8de['length'])['fill']('*'===_0x52f8de[0x0]?'*':'')['concat'](_0x52f8de))['some'](_0x48ddc7=>_0x4271fd['every']((_0x188189,_0x10fcd0)=>_0x48ddc7[_0x10fcd0]===_0x188189||'*'===_0x48ddc7[_0x10fcd0]));}function _0x948a67(){return _0x3f195d&&_0x504c46?new window['Promise']((_0x1016ef,_0x4ed618)=>{_0x3f195d['then'](_0x1016ef,_0x4ed618),_0x504c46['then'](_0x5a537b=>{'Valid'!=_0x5a537b&&_0x1016ef(_0x5a537b);},_0x4ed618);}):_0x3f195d||_0x504c46||'Valid';}}function _0x5cf3fd(_0x9f2875,_0x1847e8){return new window['Promise'](_0x918ca8=>{if(_0x341576())return _0x918ca8('Valid');_0x498532(),_0x2a20d4['decorate']('_sendUsageRequest');let _0x408f33=!0x1;const _0x79c520=Ot();function _0x528dfa(_0x2d3b48){return!!_0x2d3b48&&('object'==typeof _0x2d3b48||'function'==typeof _0x2d3b48)&&'function'==typeof _0x2d3b48['then']&&'function'==typeof _0x2d3b48['catch'];}function _0x56b0f7(_0x36fe57){_0x7f0f1c(_0x36fe57)['then'](_0x2a55a3=>_0x2a55a3&&'ok'==_0x2a55a3['status']?_0x138b27(_0x2452ae(_0x79c520+_0x1847e8))!=_0x2a55a3['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x4fc19b=>(_0x4d45b6(),_0x4fc19b),()=>{const _0x273cb8=_0x34581b();return null==_0x273cb8?(_0x4d45b6(),'Valid'):_0x447e7a-_0x273cb8>0x240c8400?'UsageLimit':'Valid';})['then'](_0x918ca8)['catch'](()=>{_0x918ca8('UsageLimit');});const _0x3f8a30=0x36ee80;function _0x4d45b6(){const _0x30549c='llct-'+_0x138b27(_0x2452ae(_0x9f2875)),_0x25222e=_0x498007(_0x138b27(window['Math']['ceil'](_0x447e7a/_0x3f8a30)));window['localStorage']['setItem'](_0x30549c,_0x25222e);}function _0x34581b(){const _0x3e4db9='llct-'+_0x138b27(_0x2452ae(_0x9f2875)),_0x450303=window['localStorage']['getItem'](_0x3e4db9);return _0x450303?window['parseInt'](_0x498007(_0x450303),0x10)*_0x3f8a30:null;}function _0x7f0f1c(_0x4d05f7){return new window['Promise']((_0x507540,_0x1dcef2)=>{_0x4d05f7['then'](_0x507540,_0x1dcef2),window['setTimeout'](_0x1dcef2,0x1d4c0);});}}_0x2a20d4['on']('_sendUsageRequest',(_0x475632,_0x429e24)=>{if(_0x429e24[0x0]!=_0x9f2875)return _0x918ca8('UsageLimit');_0x429e24[0x1]={..._0x429e24[0x1],'requestId':_0x79c520};},{'priority':'high'}),_0x2a20d4['on']('_sendUsageRequest',_0x5e5abd=>{_0x528dfa(_0x5e5abd['return'])&&(_0x408f33=!0x0,_0x56b0f7(_0x5e5abd['return']));},{'priority':'low'}),_0x5a0e7c['then'](()=>{_0x408f33||_0x918ca8('UsageLimit');});});function _0x341576(){return'auto'==_0x2a20d4['editing']['view']['_overlayModeHint'];}function _0x498532(){_0x2a20d4['editing']['view']['_overlayModeHint']='auto';}}function _0x4a37db(_0x11bcde){const _0x4e2e53=[new window['Promise'](_0x335320=>setTimeout(_0x335320,0x93ecc)),_0x5a0e7c['then'](()=>new window['Promise'](_0x4209bf=>{let _0x236a16=0x0;_0x2a20d4['model']['on']('applyOperation',(_0x2407bc,_0x568abe)=>{_0x568abe[0x0]['isDocumentOperation']&&_0x236a16++,0x5e8==_0x236a16&&(_0x4209bf(),_0x2407bc['off']());});}))];return window['Promise']['race'](_0x4e2e53)['then'](()=>_0x11bcde);}async function _0x1d5be6(){await _0x5a0e7c,_0x2a20d4['model']['change']=_0x1d415e,_0x2a20d4['model']['enqueueChange']=_0x1d415e,_0x2a20d4['enableReadOnlyMode']('model');}function _0x4de588(_0x2c5aea){const _0x829297=_0x3ed512();_0x2a20d4[_0x829297]='aiLicenseKey'+_0x2c5aea,'Valid'!=_0x2c5aea&&_0x1d5be6();}function _0x3ed512(){const _0x3e40c3=window['String'](window['performance']['now']())['replace']('.','');let _0x44f54b='n';for(let _0xe6b39c=0x0;_0xe6b39c<_0x3e40c3['length'];_0xe6b39c+=0x2){let _0xa916c5=window['parseInt'](_0x3e40c3['substring'](_0xe6b39c,_0xe6b39c+0x2));_0xa916c5>=0x3e&&(_0xa916c5-=0x3e),_0x44f54b+=_0x4dd3db[_0xa916c5];}return _0x44f54b;}function _0x23546c(){const _0x2ffad8=_0x4e9215['split']('.');if(0x3!=_0x2ffad8['length'])return null;return _0x4468e4(_0x2ffad8[0x1]);function _0x4468e4(_0x40accd){const _0x1f8f28=_0x20c317(_0x40accd);return _0x1f8f28&&_0x1c427c()?_0x1f8f28:null;function _0x1c427c(){const _0x220e8d=_0x1f8f28['jti'],_0x3a2642=window['parseInt'](_0x220e8d['substring'](_0x220e8d['length']-0x8),0x10),_0x200dd8={..._0x1f8f28,'jti':_0x220e8d['substring'](0x0,_0x220e8d['length']-0x8)};return delete _0x200dd8['vc'],_0x2452ae(_0x200dd8)==_0x3a2642;}}}async function _0x7bd46c(){let _0x39c6cf=!0x0;try{const [_0x515ad2,_0x4859ab,_0x27c420]=_0x4e9215['split']('.');return _0x496468(_0x515ad2),await _0x2487c1(_0x515ad2,_0x4859ab,_0x27c420),_0x39c6cf;}catch{return!0x1;}function _0x496468(_0x4aff44){const _0x5832b4=_0x20c317(_0x4aff44);_0x5832b4&&'ES256'==_0x5832b4['alg']||(_0x39c6cf=!0x1);}async function _0x2487c1(_0xe1a92b,_0x360a72,_0x11596a){const _0x2eaa4e=window['Uint8Array']['from'](_0x31526c(_0x11596a),_0x4ad032=>_0x4ad032['charCodeAt'](0x0)),_0x174c5e=new window['TextEncoder']()['encode'](_0xe1a92b+'.'+_0x360a72),_0x1d222e=window['crypto']['subtle'];if(!_0x1d222e)return;const _0x2bb010=await _0x1d222e['importKey']('jwk',_0x27ffcd,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x1d222e['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x2bb010,_0x2eaa4e,_0x174c5e)||(_0x39c6cf=!0x1);}}function _0x20c317(_0x109354){return _0x109354['startsWith']('ey')?JSON['parse'](_0x31526c(_0x109354)):null;}function _0x31526c(_0x43fe3c){return window['atob'](_0x43fe3c['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x2452ae(_0x28ad75){let _0x11ff4d=0x1505;function _0x21716d(_0x7b4bb4){for(let _0x5a21bf=0x0;_0x5a21bf<_0x7b4bb4['length'];_0x5a21bf++){const _0x3f06e4=_0x7b4bb4['charCodeAt'](_0x5a21bf);_0x11ff4d=(_0x11ff4d<<0x5)+_0x11ff4d+_0x3f06e4,_0x11ff4d&=_0x11ff4d;}}function _0x1a0d52(_0x31a965){Array['isArray'](_0x31a965)?_0x31a965['forEach'](_0x1a0d52):_0x31a965&&'object'==typeof _0x31a965?Object['entries'](_0x31a965)['sort']()['forEach'](([_0x297f9c,_0x30cbc8])=>{_0x21716d(_0x297f9c),_0x1a0d52(_0x30cbc8);}):_0x21716d(window['String'](_0x31a965));}return _0x1a0d52(_0x28ad75),_0x11ff4d>>>0x0;}function _0x138b27(_0x4441d3){return _0x4441d3['toString'](0x10)['padStart'](0x8,'0');}function _0x498007(_0x36a753){return _0x36a753['split']('')['reverse']()['join']('');}function _0x1d415e(){}_0x4de588(await _0x5bda94());}(this);}['showFakeVisualSelection'](){const _0x502afe=this['editor']['model'];_0x502afe['change'](_0x1f134f=>{const _0x391ab9=_0x502afe['document']['selection']['getRanges']();let _0x3bf8ae=0x0;for(const _0x34e59b of _0x391ab9){const _0x2746cf=Si+':'+_0x3bf8ae;if(_0x502afe['markers']['has'](_0x2746cf))_0x1f134f['updateMarker'](_0x2746cf,{'range':_0x34e59b});else{if(_0x34e59b['start']['isAtEnd']){const _0x42b9fd=_0x34e59b['start']['getLastMatchingPosition'](({item:_0x493194})=>!_0x502afe['schema']['isContent'](_0x493194),{'boundaries':_0x34e59b});_0x1f134f['addMarker'](_0x2746cf,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1f134f['createRange'](_0x42b9fd,_0x34e59b['end'])});}else _0x1f134f['addMarker'](_0x2746cf,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x34e59b});}_0x3bf8ae++;}});}['hideFakeVisualSelection'](){const _0x1d39b9=this['editor']['model'],_0x19a63a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x19a63a['length']&&_0x1d39b9['change'](_0x45e606=>{_0x19a63a['forEach'](_0x374fbc=>{_0x45e606['removeMarker'](_0x374fbc);});});}['insertContent'](_0x5dc34c,_0x53eefe){const _0x58f616=this['_getAISelection'](),_0x1af2d0=_0x53eefe||_0x58f616['getFirstRange']();this['editor']['model']['canEditAt'](_0x1af2d0)&&this['editor']['model']['change'](_0x350355=>{this['hideFakeVisualSelection'](),_0x53eefe||this['_resetContentOfSelectedTableCells'](_0x350355,_0x58f616),this['_pasteHTMLUsingClipboard']({'insertAt':_0x1af2d0,'writer':_0x350355,'html':_0x5dc34c});});}['insertContentBelow'](_0x557b5e){const {model:_0x4de397}=this['editor'],_0x4c0d4f=this['_getAISelection']();_0x4de397['change'](()=>{const _0x2b86ad=this['_prepareTableInsertBelowPosition'](_0x557b5e,_0x4c0d4f)||this['_getDefaultInsertBelowPosition'](_0x4c0d4f);this['insertContent'](_0x557b5e,_0x2b86ad);});}['_getAISelection'](){const _0x3decb2=this['editor']['model'],_0x546e41=Array['from'](_0x3decb2['markers']['getMarkersGroup'](Si))['map'](_0x55ab4a=>_0x55ab4a['getRange']());return _0x3decb2['createSelection'](_0x546e41);}['_pasteHTMLUsingClipboard']({writer:_0x5bb817,html:_0x164a17,insertAt:_0x1d5919}){const {view:_0x5ede7a}=this['editor']['editing'],_0x63304a=this['editor']['plugins']['get'](_0x72a589),_0x722fa0=new bi();_0x722fa0['setData']('text/html',_0x164a17);const _0x14186f=new _0x3ecc64(_0x5ede7a,new ClipboardEvent('paste',{'clipboardData':_0x722fa0}),{'dataTransfer':new _0xa3026c(_0x722fa0)});_0x5bb817['setSelection'](_0x1d5919);const _0x165516=(_0x567b2f,_0x4502a0)=>{_0x4502a0['resultRange']&&_0x5bb817['setSelection'](_0x4502a0['resultRange']);};_0x63304a['once']('contentInsertion',_0x165516,{'priority':'lowest'}),_0x5ede7a['document']['fire']('paste',_0x14186f),_0x63304a['off']('contentInsertion',_0x165516);}['_getDefaultInsertBelowPosition'](_0x2af3ce){const {model:_0x51b66d}=this['editor'],_0x1d7d29=Array['from'](_0x2af3ce['getSelectedBlocks']());return _0x1d7d29['length']?_0x51b66d['createPositionAfter'](_0x1d7d29['pop']()):_0x2af3ce['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0xd1df4d,_0x4bcfa4){const {model:_0x271c68,plugins:_0x4281ea}=this['editor'];if(_0x4281ea['has']('TableUtils')){const _0x486c8b=_0x4281ea['get']('TableUtils')['getSelectedTableCells'](_0x4bcfa4);if(_0x486c8b['length']){const _0x5023b4=this['_getTableRowCountFromContent'](_0xd1df4d),_0x50565a=this['_createEmptyTableRows'](_0x486c8b,_0x5023b4);return _0x271c68['createPositionAt'](_0x50565a,0x0);}}return null;}['_getTableRowCountFromContent'](_0x33fdb4){const _0x4bbdc9=this['editor']['plugins']['get']('TableUtils'),_0x16ea92=this['editor']['data']['parse'](_0x33fdb4,'$documentFragment'),_0x584484=Array['from'](_0x16ea92['getChildren']())['filter'](_0x430b12=>_0x430b12['is']('element','table'));let _0x435e6a=0x0;return _0x584484['forEach'](_0x5409bb=>{_0x435e6a+=_0x4bbdc9['getRows'](_0x5409bb);}),_0x435e6a;}['_createEmptyTableRows'](_0x571007,_0x3c0c92){const _0x1161f5=this['editor']['plugins']['get']('TableUtils'),_0x2113cb=_0x1161f5['getRowIndexes'](_0x571007),_0x450fda=_0x1161f5['getColumnIndexes'](_0x571007),_0x12fb04=_0x2113cb['last']+0x1,_0x5f0f3d=_0x450fda['first'],_0x43bb4f=_0x571007[0x0]['findAncestor']('table');for(let _0x2adeae=0x0;_0x2adeae<_0x3c0c92;_0x2adeae++)_0x1161f5['insertRows'](_0x43bb4f,{'at':_0x12fb04});return _0x43bb4f['getChild'](_0x12fb04)['getChild'](_0x5f0f3d);}['_resetContentOfSelectedTableCells'](_0x302735,_0x3d12a0){const {plugins:_0x1a1f4e}=this['editor'],{model:_0x4e01fd}=_0x302735;_0x1a1f4e['has']('TableUtils')&&_0x1a1f4e['get']('TableUtils')['getSelectedTableCells'](_0x3d12a0)['length']&&_0x4e01fd['deleteContent'](_0x3d12a0);}},Oi=class extends _0x5bc74c{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}},vi=class extends Error{constructor(_0x40bdcf){super(_0x40bdcf),this['name']='AIRequestError';}};function ki(_0xb922d5,_0x52884f,_0x2ab5c4){const t=_0xb922d5['t'];switch(_0x52884f){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',_0x2ab5c4);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x2ab5c4);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'},_0x2ab5c4);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 _0x52884f;}}var Ni=class extends _0x2f2e2c{['_commandDefinitions'];constructor(_0x1c1e76,_0x40fef7){super(_0x1c1e76),this['_commandDefinitions']=_0x40fef7,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xd54f14,_0x25cb02,_0x285d4c)=>{this['isEnabled']&&(this['enabledCommandsIds']=yi(this['_commandDefinitions'],_0x285d4c));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x1b18e9,_0x806e51,_0x32d410)=>{this['enabledCommandsIds']=_0x32d410?yi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x213234=this['editor']['model'];this['_hasContext']=function(_0xb3690f){const _0x285b86=_0xb3690f['document']['selection'];return _0x285b86['isCollapsed']?0x0!==[..._0x285b86['getSelectedBlocks']()]['length']&&![..._0x285b86['getSelectedBlocks']()][0x0]['isEmpty']:!!_0xb3690f['hasContent'](_0x285b86['getFirstRange']());}(_0x213234);const _0x369cd3=_0x213234['document']['selection'],_0x3c36ff=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x594403 of _0x369cd3['getRanges']())for(const _0x34b42e of _0x594403['getItems']())if(_0x34b42e['is']('element')&&_0x3c36ff['includes'](_0x34b42e['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x3c8653='',_0x593a1d='',_0x189750='custom'){this['editor']['plugins']['get'](Qi)['showUI'](_0x3c8653,_0x593a1d,_0x189750);}};function yi(_0x35cd74,_0x24e64d){const _0x1da492=new Set();for(const _0x2b55b7 of _0x35cd74['values']())(_0x24e64d||!0x1===_0x2b55b7['requiresContent'])&&_0x1da492['add'](_0x2b55b7['id']);return Array['from'](_0x1da492);}const xi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Li=/* #__PURE__ -- @preserve */
24
- _t();var Di=class extends Li{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x4a6ef4,_0x165500,_0x318597){super(),this['editor']=_0x4a6ef4,this['textAdapter']=_0x165500,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x318597,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x5022fa,_0x5a5ec2,_0x23e432)=>{this['view']['value']=this['_sanitizeHTML'](_0x23e432);}),this['listenTo'](this['view'],'submitPrompt',(_0x4b872f,_0x4cc5c8)=>{const _0xe3adff=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x4cc5c8,_0xe3adff,'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:_0x47e5fd,query:_0x4a4037,htmlContent:_0x52dcce,label:_0x46f796,mainActionLabel:_0x2b8cc4}){this['view']['prompt']=_0x46f796,this['view']['mainAction']=_0x2b8cc4,this['initialContext']=_0x52dcce,_0x4a4037&&(this['view']['isRendered']?this['_handleQuery'](_0x4a4037,_0x52dcce,_0x47e5fd,_0x46f796):this['view']['once']('render',()=>{this['_handleQuery'](_0x4a4037,_0x52dcce,_0x47e5fd,_0x46f796);}));}['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'](_0x24b7a4,_0x106452,_0x114c68,_0x259aba){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x106452,this['previousQuery']=_0x24b7a4,this['previousLabel']=_0x259aba||_0x24b7a4,this['previousActionId']=_0x114c68,new Promise(_0x477d6e=>{this['textAdapter']['makeRequest']({'query':_0x24b7a4,'context':_0x106452,'onData':_0x21a4af=>{this['currentResponse']=_0x21a4af,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x114c68})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x5af03e=>{_0x5af03e instanceof vi?this['view']['handleError'](_0x5af03e['message']):this['view']['handleError'](),_0x477d6e();})['finally'](()=>{this['stopProcessing'](),_0x477d6e();});});}['_parseAndNormalizeContent'](_0x12092e,_0x28a85e=!0x1){const _0x3e8763=xi['exec'](_0x12092e);_0x12092e=_0x3e8763?_0x12092e['substring'](_0x3e8763[0x1]['length']):_0x12092e['length']<0x64&&!_0x28a85e?'':this['_stripMarkdownSyntax'](_0x12092e);const _0x324308=this['_domParser']['parseFromString'](_0x12092e,'text/html');if(_0x3e8763){const _0x278145=Array['from'](_0x324308['body']['childNodes']);_0x278145['reverse']();for(const _0x2ffdf5 of _0x278145){if(_0x2ffdf5['nodeType']==Node['ELEMENT_NODE'])break;_0x2ffdf5['remove']();}}const _0x317194=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x324308['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x317194);const _0x4149ff=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x1d48f7=this['editor']['data']['toModel'](_0x317194);return _0x4149ff||_0x1d48f7['markers']['clear'](),this['editor']['data']['stringify'](_0x1d48f7);}['_normalizeResponseHeadings'](_0x30f7aa){const _0x102f0c=new _0x11238b(this['editor']['editing']['view']['document']),_0x2378f6=new _0x4f355c({'name':/^h[1-5]$/}),_0x23bee5=[];let _0x2062eb=!0x1;for(const _0x2f0661 of _0x30f7aa)_0x2f0661['is']('element')&&_0x2378f6['match'](_0x2f0661)&&(_0x23bee5['push'](_0x2f0661),'h1'==_0x2f0661['name']&&(_0x2062eb=!0x0));if(_0x2062eb){for(const _0x5a6095 of _0x23bee5)_0x102f0c['rename']('h'+(parseInt(_0x5a6095['name'][0x1])+0x1),_0x5a6095);}}['_isH1TagSupportEnabled'](){const {data:_0x4eda3d,editing:_0x25a6cc}=this['editor'],_0x358c52=_0x4eda3d['htmlProcessor']['toView']('<h1></h1>'),_0x14f1ef=_0x4eda3d['toView'](_0x4eda3d['toModel'](_0x358c52));return!!_0x25a6cc['view']['domConverter']['viewToDom'](_0x14f1ef)['querySelector']('h1');}['_sanitizeHTML'](_0x16928f){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x16928f),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x4628d4){const _0x2a76fd=_0x4628d4['trim']();return _0x2a76fd['startsWith']('```html')?_0x2a76fd['endsWith']('```')?_0x2a76fd['substring'](0x7,_0x2a76fd['length']-0x3):_0x2a76fd['substring'](0x7):_0x4628d4;}};const Pi={'REPLACE':'replace','INSERT':'insert'};var Hi=class extends _0x4b90d1{constructor(_0x57a5ec){super(_0x57a5ec),this['set']('isVisible',!0x1),this['set']('mainAction',Pi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x2db111=>ki(_0x57a5ec,'AI_'+_0x2db111['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](ki(_0x57a5ec,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](ki(_0x57a5ec,'Try\x20again')),this['stopButton']=this['_createButton'](ki(_0x57a5ec,'Stop'));const _0x13184d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x13184d['if']('isVisible','ck-hidden',_0x39f20d=>!_0x39f20d)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x4dbce6,_0xd40881){const _0x26539c=new Pt(this['locale']);return _0x26539c['set']({'label':_0x4dbce6,'class':_0xd40881||'','isVisible':!0x0,'withText':!0x0}),_0x26539c;}},Mi=class extends _0x4708a3{['contentFieldView'];['copyButtonView'];constructor(_0x54fb29,_0x3b3d78=''){super(_0x54fb29),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0xc9a713=this['bindTemplate'];this['contentFieldView']=new Vi(_0x54fb29,_0x3b3d78),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0xc9a713['if']('isVisible','ck-hidden',_0x43410c=>!_0x43410c)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0xc9a713['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 _0x361617=!0x1;this['on']('change:value',(_0x3686e7,_0x426944,_0x11184e)=>{const _0x24fd8e=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x11184e),this['isProcessing']&&_0x24fd8e&&!_0x361617&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x27ffc8,_0x3d080b,_0x902348)=>{_0x361617=!0x1,_0x902348?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x361617=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x361617=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x171fed=this['locale'],_0x5a9369=new Pt(this['locale']),_0x57476f='ck-ai-form__copy-button';return _0x5a9369['set']({'label':ki(_0x171fed,'Copy'),'icon':_0x2213d2,'class':_0x57476f,'tooltip':!0x0}),_0x5a9369['bind']('isVisible')['to'](this,'value',_0x3c70d8=>!!_0x3c70d8),_0x5a9369['bind']('isEnabled')['to'](this,'isProcessing',_0x94f13d=>!_0x94f13d),_0x5a9369['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5a9369['icon']=_0x1fb55b,_0x5a9369['class']=_0x57476f+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5a9369['icon']=_0x2213d2,_0x5a9369['class']=_0x57476f;},0x3e8);}),_0x5a9369;}['_copyHTMLToClipboard'](_0x341c68){const {window:_0x32012d,document:_0x3150c5}=Et;if(_0x32012d['ClipboardItem']){const {Blob:_0x429530,ClipboardItem:_0x25e317}=_0x32012d,_0x4af9ea=[new _0x25e317({'text/html':new _0x429530([_0x341c68['innerHTML']],{'type':'text/html'}),'text/plain':new _0x429530([_0x341c68['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x4af9ea);}else{const _0x219d7a=_0x3150c5['createElement']('div');_0x219d7a['style']['position']='absolute',_0x219d7a['style']['left']='-9999px',_0x219d7a['innerHTML']='<span>[</span>'+_0x341c68['innerHTML']+'<span>]</span>',_0x3150c5['body']['appendChild'](_0x219d7a);const _0x477b5a=_0x3150c5['createRange']();_0x477b5a['setStartAfter'](_0x219d7a['firstElementChild']),_0x477b5a['setEndBefore'](_0x219d7a['lastElementChild']);const _0x3c0763=_0x32012d['getSelection']();_0x3c0763['removeAllRanges'](),_0x3c0763['addRange'](_0x477b5a),_0x3150c5['execCommand']('copy'),_0x219d7a['remove']();}}},Vi=class extends _0x4708a3{constructor(_0x1bc65c,_0xe4274f=''){super(_0x1bc65c),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0xe4274f,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0xcecb48){this['element']['innerHTML']=_0xcecb48;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x2a3ac0=new _0x4708a3(),_0x4d0609=this['locale'],_0x501a81=new _0x17e663();return _0x501a81['isVisible']=!0x0,_0x2a3ac0['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x501a81,{'text':ki(_0x4d0609,'AI\x20is\x20writing...')}]}),_0x2a3ac0['render'](),_0x2a3ac0;}},Ui=class extends _0x4708a3{constructor(_0x3af2df,_0x267bac=''){super(_0x3af2df);const _0x38063d=new Wt(),_0xa7aee1=this['bindTemplate'];this['set']('text',_0x267bac),_0x38063d['content']=_0x25a3d8,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x38063d,{'text':_0xa7aee1['to']('text')}]});}},Bi=class extends kt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x53fadb,_0x520a78){super(_0x53fadb,_0x520a78),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',(_0x42f898,_0x5f4602)=>{_0x42f898['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x5f4602());});}['_createSubmitButton'](){const _0x241764=new Pt(this['locale']),_0x428736=this['locale'];return _0x241764['set']({'icon':it,'label':ki(_0x428736,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x241764['on']('execute',()=>{this['submit']();}),_0x241764['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x3d42c0,_0xcbf82b)=>!_0x3d42c0&&_0xcbf82b),_0x241764;}['_createShowHistoryButton'](){const _0x3c527b=new Pt(this['locale']),_0x397e3b=this['resultsView'],_0x78c6c2=this['locale'];_0x3c527b['set']({'label':ki(_0x78c6c2,'History'),'withText':!0x1,'icon':_0x4f0239,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x3c527b['bind']('isOn')['to'](_0x397e3b,'isVisible'),_0x3c527b['bind']('isEnabled')['to'](this,'isEnabled'),_0x3c527b['on']('execute',()=>{_0x397e3b['isVisible']=!_0x397e3b['isVisible'],_0x397e3b['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x6effda=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x567637=new gt(this['queryView']['fieldView']['element']),_0xc8509f=_0x567637['width'],_0x50d824='rtl'===_0x78c6c2['uiLanguageDirection']?'left':'right';_0x567637['excludeScrollbarsAndBorders'](),_0x3c527b['element']['style'][_0x50d824]=_0xc8509f-_0x567637['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x6effda),this['on']('render',_0x6effda),_0x3c527b;}['submit'](){const _0x468ae8=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x468ae8);}['focus'](_0x3a6de4){-0x1===_0x3a6de4?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Gi=class extends zt{['historyGroupView'];['clearHistoryButton'];constructor(_0x4fcab6){super(_0x4fcab6),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Qt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=ki(_0x4fcab6,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x4dba63=0x0;for(const _0x4a8dc3 of this['items'])_0x4dba63+=_0x4a8dc3['items']['length'];return{'resultsCount':_0x4dba63,'totalItemsCount':_0x4dba63};}['_createClearHistoryButton'](){const _0x4624ae=this['locale'],_0x4aca14=new Pt(this['locale']);return _0x4aca14['set']({'label':'('+ki(_0x4624ae,'Clear')+')','withText':!0x0}),_0x4aca14['on']('execute',()=>this['fire']('clearHistory')),_0x4aca14;}},Fi=class extends Xt{constructor(_0x21491f){super();const _0x5db9db=new Lt(),_0x11a4d6=new Pt(this['locale'],_0x5db9db);this['children']['add'](_0x11a4d6),_0x11a4d6['set']({'label':_0x21491f['prompt'],'withText':!0x0}),_0x11a4d6['on']('execute',()=>{this['fire']('execute',{'value':_0xe9b4ed(_0x21491f['prompt'])});});}};const Ki='CKEditor/AIFormView/PromptHistory';var Wi=class extends ht{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x5400da,_0x566a81)=>{const _0x20efb8=Yi(_0x566a81['prompt']);for(const _0x20f7c of this)if(_0x20f7c!=_0x566a81&&Yi(_0x20f7c['prompt'])===_0x20efb8){this['remove'](_0x20f7c);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x47331f=sessionStorage['getItem'](Ki)||'[]';this['addMany'](JSON['parse'](_0x47331f));}['_saveToSessionStorage'](){sessionStorage['setItem'](Ki,JSON['stringify'](this['map'](_0x41eb67=>_0x41eb67)));}};function Yi(_0x84e11){return _0x84e11['toLowerCase']()['trim']();}var $i=class extends _0x4708a3{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x1420de,_0x29a088,_0x264ce4=''){super(_0x1420de),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Pi['REPLACE']),this['_promptHistory']=new Wi(),this['errorView']=new Ui(_0x1420de),this['contentArea']=new Mi(_0x1420de,_0x264ce4),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 ut(),this['keystrokes']=new dt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Bt({'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 _0x1cf4c0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x29a088],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x1cf4c0['if']('isError','ck-hidden',_0x196c03=>!_0x196c03)]},'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'](_0x2c3376=0x1){-0x1===_0x2c3376?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 _0x48cdd1=this['locale'],_0x509a23=new Bi(_0x48cdd1,{'queryView':{'label':ki(_0x48cdd1,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x46d7e1,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':ki(_0x48cdd1,'Empty\x20history'),'secondary':ki(_0x48cdd1,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x509a23['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x26c7e3,_0x5d20ec)=>_0x26c7e3&&!_0x5d20ec),this['listenTo'](_0x509a23,'submit',(_0x116c44,_0xa7dfea)=>{this['prompt']=_0xa7dfea;const _0x32d120=_0x47dde7(_0xa7dfea);this['fire']('submitPrompt',_0x32d120),_0xa7dfea['trim']()&&this['_promptHistory']['add']({'prompt':_0x32d120},0x0);},{'priority':'high'}),_0x509a23;}['_createHistoryView'](){const _0x1690af=new Gi(this['locale']);return _0x1690af['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Fi),_0x1690af['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x1690af;}['_createToolbar'](){const _0x599676=new Hi(this['locale']);return _0x599676['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x165d03,_0x4f5b92,_0x5bf54a)=>_0x165d03&&!_0x4f5b92&&!!_0x5bf54a),_0x599676['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x599676['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x5c3d9b,_0xf5015d,_0x3552ca)=>_0x5c3d9b&&!_0xf5015d&&!!_0x3552ca),_0x599676['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x599676['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3cbcfe,_0x35865b)=>_0x3cbcfe&&!_0x35865b),_0x599676['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x599676['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x599676['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x599676;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x17461d=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=ki(_0x17461d,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x30a817){const _0x4f2a4d=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x30a817||ki(_0x4f2a4d,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const qi=globalThis['DataTransfer'];var Qi=class extends _0x5bc74c{['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[_0x360802,Ri,Oi,Ht];}constructor(_0x2be2e0){super(_0x2be2e0),_0x2be2e0['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x2be2e0['config']['define']('ai.assistant.contentAreaCssClass',''),_0x2be2e0['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x2be2e0['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x18452c}=this;this['_aiAdapter']=_0x18452c['plugins']['get'](Oi),this['_dialog']=_0x18452c['plugins']['get'](Ht),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x14d79c=new Ni(_0x18452c,Array['from'](this['_commandDefinitions']['values']()));_0x18452c['commands']['add']('showAIAssistant',_0x14d79c),_0x18452c['ui']['componentFactory']['add']('aiCommands',_0xe94e3c=>{const _0x4662bb=_0x353e74(_0xe94e3c);return _0x4662bb['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x4662bb['buttonView']['set']({'label':ki(_0xe94e3c,'AI\x20Commands'),'icon':_0xa22694,'tooltip':!0x0}),_0x4662bb['on']('execute',_0x4f305b=>this['_onExecute'](_0x4f305b['source']['id'])),_0x4fe6d6(_0x4662bb,_0x18452c['ui']['view']['body'],function(_0x258d58){const _0x4a5f54=zi(_0x258d58,fi(_0x258d58['config']['get']('ai.assistant.commands'),_0x258d58['locale']))['filter'](_0x18db0c=>_0x18db0c['commands']['length']);return 0x1===_0x4a5f54['length']?zi(_0x258d58,_0x4a5f54[0x0]['commands'])['map'](_0x51ef0e=>({'id':_0x51ef0e['id'],'label':_0x51ef0e['label']})):_0x4a5f54['map'](_0x541488=>{const {groupId:_0x1c91ad,groupLabel:_0x33d506,commands:_0x83a0b2}=_0x541488,_0x3cdb1f=zi(_0x258d58,_0x83a0b2)['map'](_0x1c2989=>({'id':_0x1c2989['id'],'label':_0x1c2989['label']}));return{'id':_0x1c91ad,'menu':_0x33d506||_0x1c91ad,'children':_0x3cdb1f};});}(_0x18452c),{'ariaLabel':ki(_0xe94e3c,'AI\x20Commands')}),_0x4662bb['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x14d79c['on']('change:enabledCommandsIds',_0x5a2a04),_0x4662bb['menuView']['once']('render',_0x5a2a04),_0x4662bb;function _0x5a2a04(){_0x4662bb['isEnabled']=_0x14d79c['enabledCommandsIds']['length']>0x0;for(const _0x1b93e1 of _0x4662bb['menuView']['buttons'])_0x1b93e1['isEnabled']=_0x14d79c['enabledCommandsIds']['includes'](_0x1b93e1['id']);}}),_0x18452c['ui']['componentFactory']['add']('menuBar:aiCommands',_0x74152=>{const _0x51af21=new te(_0x74152);_0x51af21['buttonView']['set']({'label':ki(_0x74152,'AI\x20Commands'),'icon':_0xa22694}),_0x51af21['bind']('isEnabled')['to'](_0x14d79c,'enabledCommandsIds',_0xab2cdf=>_0xab2cdf['length']>0x0);const _0x4056f2=fi(_0x18452c['config']['get']('ai.assistant.commands'),_0x74152);return this['_populateMenuBarMenu'](_0x14d79c,_0x51af21,_0x4056f2,_0x522d1f=>this['_onExecute'](_0x522d1f)),_0x51af21;}),_0x18452c['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x4ea931=this['_createAIAssistantUIButton'](Pt);return _0x4ea931['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x4ea931;}),_0x18452c['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x1fdd11=this['_createAIAssistantUIButton'](jt);return _0x1fdd11['set']({'role':'menuitemcheckbox'}),_0x1fdd11;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x4e3df7=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x34c3e6;for(const _0x50f85a in _0x4e3df7){const _0x2c1c09=_0x50f85a,_0x575667=_0x4e3df7[_0x2c1c09];if('aiLicenseKeyValid'==_0x575667||'aiLicenseKeyInvalid'==_0x575667||'aiLicenseKeyExpired'==_0x575667||'aiLicenseKeyDomainLimit'==_0x575667||'aiLicenseKeyNotAllowed'==_0x575667||'aiLicenseKeyEvaluationLimit'==_0x575667||'aiLicenseKeyUsageLimit'==_0x575667){delete _0x4e3df7[_0x2c1c09],_0x34c3e6=_0x575667,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x34c3e6&&_0x4e3df7['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x37ba33='',_0x1835c0='',_0x4efcd7='custom'){const _0x2f4881=this['editor'],_0x357fad=_0x2f4881['editing']['view'],_0x533607=_0x2f4881['plugins']['get'](Ri),_0x4e9836=_0x2f4881['plugins']['get'](_0x360802);_0x533607['showFakeVisualSelection']();const _0x4cb31f=new qi(),_0x155278=new ClipboardEvent('copy',{'clipboardData':_0x4cb31f}),_0x1b85d8=new _0xa3026c(_0x4cb31f),_0x123310=new _0x3ecc64(_0x357fad,_0x155278,{'dataTransfer':_0x1b85d8});_0x4e9836['_forceMarkersCopy']('comment',()=>{_0x357fad['document']['fire']('copy',_0x123310);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Di(_0x2f4881,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x102b0a=_0x1b85d8['getData']('text/html');const _0x56ad56=_0x2f4881['model']['document']['selection'],_0x12aed9=Array['from'](_0x56ad56['getRanges']());0x1===_0x12aed9['length']&&_0x12aed9[0x0]['isFlat']&&!_0x56ad56['getSelectedElement']()&&''!==_0x102b0a['replace'](/&nbsp;/g,'')['trim']()&&(_0x102b0a='<p>'+_0x102b0a+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x4efcd7,'query':_0x37ba33,'htmlContent':_0x102b0a,'label':_0x1835c0,'mainActionLabel':Pi[_0x2f4881['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x5b145b,'title':ki(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Mt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x533607['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x36c020=new Map(),_0x51eb1f=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0xe6d72d of _0x51eb1f)for(const _0x485731 of _0xe6d72d['commands'])_0x36c020['set'](_0x485731['id'],{..._0x485731,'groupId':_0xe6d72d['groupId'],'groupLabel':_0xe6d72d['groupLabel']||_0xe6d72d['groupId']});return _0x36c020;}['_createAIAssistantUIButton'](_0x2574a6){const _0x155bec=this['editor'],_0x26e977=_0x155bec['commands']['get']('showAIAssistant'),_0x162523=new _0x2574a6(_0x155bec['locale']);return _0x162523['set']({'label':ki(_0x155bec['locale'],'AI\x20Assistant'),'icon':_0x5b145b,'isToggleable':!0x0}),_0x162523['bind']('isEnabled')['to'](_0x26e977),_0x162523['bind']('isOn')['to'](this['_dialog'],'id',_0x5d7c6a=>'aiAssistant'===_0x5d7c6a),this['listenTo'](_0x162523,'execute',()=>{_0x162523['isOn']?this['hideUI']():_0x26e977['execute']();}),_0x162523;}['_initView'](){const _0x5052c1=this['editor']['plugins']['get'](Ri);this['_formView']=new $i(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',()=>{_0x5052c1['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x5052c1['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x147364,ui:{ariaLiveAnnouncer:_0x42a2ea}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x5f2cb1,_0x5e8f2e,_0x5ef144)=>{const _0x41ee46=this['_aiAssistantController']['currentContext'];_0x5ef144?_0x42a2ea['announce'](ki(_0x147364,'AI\x20is\x20writing')):_0x41ee46&&_0x42a2ea['announce'](ki(_0x147364,'Generated\x20content:\x20%0',_0x41ee46),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1efde2,_0x53cd8a,_0x31fa7e)=>{if(_0x31fa7e){const _0x1cf36b=this['_formView']['errorView']['text'];_0x42a2ea['announce'](ki(_0x147364,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1cf36b));}});}['_onExecute'](_0x44dfdb){const _0x44443e=this['_commandDefinitions']['get'](_0x44dfdb),_0x2af6c6=this['editor'],_0x310c97=_0x2af6c6['model']['document']['selection'],_0x141387=_0x2af6c6['commands']['get']('showAIAssistant'),_0x5a004f=_0x2af6c6['plugins']['get'](Ri),_0x43aeb0=''+('_ungrouppedCommands'!==_0x44443e['groupId']?_0x44443e['groupLabel']+':\x20':'')+_0x44443e['label'];if(!0x1!==_0x44443e['requiresContent']&&_0x310c97['isCollapsed']){const _0x508866=pt(_0x310c97['getSelectedBlocks']())||_0x2af6c6['model']['schema']['getLimitElement'](_0x310c97);_0x2af6c6['model']['change'](_0x2113fe=>{_0x2113fe['setSelection'](_0x508866,'in');});}_0x5a004f['showFakeVisualSelection'](),_0x141387['execute'](_0x44443e['prompt'],_0x43aeb0,'command:'+_0x44dfdb);}['_populateMenuBarMenu'](_0x161c7d,_0xe7d2c0,_0x17c734,_0x1a4cd1){const _0x534874=this['editor'],_0x10adf7=_0x534874['locale'],_0x47f7fd=new Zt(_0x10adf7),_0xb9db2c=zi(_0x534874,_0x17c734)['filter'](_0x555837=>_0x555837['commands']['length']);0x1===_0xb9db2c['length']?this['_getMenuBarGroupButtons']({'command':_0x161c7d,'commands':_0xb9db2c[0x0]['commands'],'parentMenuView':_0xe7d2c0,'onExecute':_0x1a4cd1})['forEach'](_0x8afe29=>_0x47f7fd['items']['add'](_0x8afe29)):_0xb9db2c['forEach'](({groupId:_0x48ec9d,groupLabel:_0x341e0a,commands:_0x529121})=>{const _0x571e4a=new Jt(_0x10adf7,_0xe7d2c0),_0x195b2e=new te(_0x10adf7),_0x895cea=new Zt(_0x10adf7),_0x4c501e=this['_getMenuBarGroupButtons']({'command':_0x161c7d,'commands':_0x529121,'parentMenuView':_0x195b2e,'onExecute':_0x1a4cd1});_0x195b2e['buttonView']['set']({'label':_0x341e0a||_0x48ec9d}),_0x195b2e['delegate']('execute')['to'](_0xe7d2c0),_0x895cea['items']['addMany'](_0x4c501e),_0x195b2e['panelView']['children']['add'](_0x895cea),_0x571e4a['children']['add'](_0x195b2e),_0x47f7fd['items']['add'](_0x571e4a);}),_0xe7d2c0['panelView']['children']['add'](_0x47f7fd);}['_getMenuBarGroupButtons']({command:_0x1b629c,commands:_0x327fa9,parentMenuView:_0x53931c,onExecute:_0x4f28bb}){const _0x2328a3=this['editor'],_0x58c495=_0x2328a3['locale'];return zi(_0x2328a3,_0x327fa9)['map'](_0x5d947c=>{const _0x255d32=new Jt(_0x58c495,_0x53931c),_0x255091=new jt(_0x58c495);return _0x255091['set']({'label':_0x5d947c['label']}),_0x255091['delegate']('execute')['to'](_0x53931c),_0x255091['on']('execute',()=>_0x4f28bb(_0x5d947c['id'])),_0x255091['bind']('isEnabled')['to'](_0x1b629c,'enabledCommandsIds',_0xad67a=>_0xad67a['includes'](_0x5d947c['id'])),_0x255d32['children']['add'](_0x255091),_0x255d32;});}};function Xi(_0x30280c,_0x5c526a){return void 0x0!==_0x30280c['order']&&void 0x0===_0x5c526a['order']?0x1:void 0x0===_0x30280c['order']&&void 0x0!==_0x5c526a['order']?-0x1:void 0x0!==_0x30280c['order']&&void 0x0!==_0x5c526a['order']?_0x30280c['order']-_0x5c526a['order']:0x0;}function zi(_0x3c8597,_0x3a6b2b){_0x3a6b2b['sort'](Xi);const _0x3c470e={},_0x4d7b53=[];for(const _0x200b71 of _0x3a6b2b)if(void 0x0!==_0x200b71['order']){if(_0x200b71['order']in _0x3c470e)throw new at('ai-commands-config-order-collision',_0x3c8597,{'conflictingDefinitions':[_0x200b71,_0x3c470e[_0x200b71['order']]]});_0x3c470e[_0x200b71['order']]=_0x200b71,_0x4d7b53['splice'](_0x200b71['order'],0x0,_0x200b71);}else _0x4d7b53['push'](_0x200b71);return _0x4d7b53;}var ji=class extends _0x5bc74c{static get['requires'](){return[Qi,Ri];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x11b64e){super(_0x11b64e);const _0x22ec89=_0x11b64e['config'],_0x2688c9=_0x11b64e['locale'];_0x22ec89['define']('ai.assistant.preserveComments',!0x0),_0x22ec89['define']('ai.assistant.commands',Ji(_0x2688c9)),_0x22ec89['define']('ai.assistant.extraCommandGroups',[]),_0x22ec89['define']('ai.assistant.removeCommands',[]);let _0x276588=fi(_0x22ec89['get']('ai.assistant.commands'),_0x2688c9);const _0x69f7d9=_0x22ec89['get']('ai.assistant.extraCommandGroups'),_0x26278e=_0x22ec89['get']('ai.assistant.removeCommands');_0x69f7d9['forEach'](_0x1a0300=>{const _0x79cf71=_0x276588['find'](_0x486248=>_0x486248['groupId']===_0x1a0300['groupId']);_0x79cf71?_0x79cf71['commands']=_0x79cf71['commands']['concat'](_0x1a0300['commands']):_0x276588['push'](_0x1a0300);}),_0x276588=_0x276588['filter'](_0x94505e=>!_0x26278e['includes'](_0x94505e['groupId'])),_0x276588['forEach'](_0x26c23c=>{_0x26c23c['commands']=_0x26c23c['commands']['filter'](_0x58e18a=>!_0x26278e['includes'](_0x58e18a['id']));}),_0x22ec89['set']('ai.assistant.commands',_0x276588);}};function Ji(_0x2dabc9){return[{'groupId':'editOrReview','groupLabel':ki(_0x2dabc9,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':ki(_0x2dabc9,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':ki(_0x2dabc9,'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':ki(_0x2dabc9,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':ki(_0x2dabc9,'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':ki(_0x2dabc9,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':ki(_0x2dabc9,'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':ki(_0x2dabc9,'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':ki(_0x2dabc9,'Change\x20tone'),'commands':[{'id':'professional','label':ki(_0x2dabc9,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':ki(_0x2dabc9,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':ki(_0x2dabc9,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':ki(_0x2dabc9,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':ki(_0x2dabc9,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':ki(_0x2dabc9,'Change\x20style'),'commands':[{'id':'business','label':ki(_0x2dabc9,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':ki(_0x2dabc9,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':ki(_0x2dabc9,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':ki(_0x2dabc9,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':ki(_0x2dabc9,'Translate'),'commands':[{'id':'translateEnglish','label':ki(_0x2dabc9,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':ki(_0x2dabc9,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':ki(_0x2dabc9,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':ki(_0x2dabc9,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':ki(_0x2dabc9,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':ki(_0x2dabc9,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':ki(_0x2dabc9,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':ki(_0x2dabc9,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var Zi=class extends _0x5bc74c{['abortController'];static get['requires'](){return[Oi];}constructor(_0x5ca9a7){super(_0x5ca9a7),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](Oi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x479d82){return this['sendRequest'](_0x479d82)['catch'](_0x45941d=>{if(_0x45941d instanceof vi)return Promise['reject'](_0x45941d);if('AbortError'==_0x45941d['name'])return Promise['resolve']();throw console['error'](_0x45941d),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x4cd5c4,_0x1b370a){const _0x38b9f0=this['editor']['locale'],_0x3b5a0e={'Content-Type':'application/json'};if('object'==typeof _0x4cd5c4)Object['assign'](_0x3b5a0e,_0x4cd5c4);else{if(_0x4cd5c4)try{const _0x197b9f=await _0x4cd5c4(_0x1b370a);Object['assign'](_0x3b5a0e,_0x197b9f);}catch{return Promise['reject'](new vi(ki(_0x38b9f0,'AI_ERROR_GET_HEADERS')));}}return _0x3b5a0e;}async['_prepareRequestParameters'](_0x5ac7a9,_0xa2f0d){const _0x8be5ca=this['editor']['locale'];if('object'==typeof _0x5ac7a9)return _0x5ac7a9;try{return await _0x5ac7a9(_0xa2f0d);}catch{return Promise['reject'](new vi(ki(_0x8be5ca,'AI_ERROR_GET_PARAMETERS')));}}},ts=class extends Zi{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x9cf043){super(_0x9cf043),_0x9cf043['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x9cf043['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x9cf043['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x9cf043['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x9cf043['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x9cf043['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x3d5282,context:_0x3cc820,onData:_0x2d37d1,actionId:_0x5a2004}){const _0x209aca=this['editor']['locale'],_0x216173=await this['prepareMessages'](_0x3d5282,_0x3cc820,_0x5a2004),_0x3b2b59=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x5a2004),_0x2aa824=await this['_prepareRequestParameters'](this['_requestParameters'],_0x5a2004),_0x1b5cd2={'messages':_0x216173,..._0x2aa824},_0x4b261b={'method':'POST','headers':_0x3b2b59,'body':JSON['stringify'](_0x1b5cd2),'signal':this['abortController']['signal']},_0x2ffe6b=await fetch(this['_apiUrl'],_0x4b261b);if(_0x2ffe6b['ok'])return _0x2aa824['stream']?await this['_readStreamableResponse'](_0x2ffe6b,_0x2d37d1):await this['_readStaticResponse'](_0x2ffe6b,_0x2d37d1),Promise['resolve']();{const _0x1a1784=await _0x2ffe6b['text']();return _0x1a1784['includes']('context_length_exceeded')?Promise['reject'](new vi(ki(_0x209aca,'AI_ERROR_CONTEXT_LENGTH'))):_0x1a1784['includes']('Moderation')?Promise['reject'](new vi(ki(_0x209aca,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x1a1784));}}async['prepareMessages'](_0x4528b2,_0x21f125,_0x4badc7){let _0x497a87,_0x183e0f;return _0x21f125?(_0x497a87='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.',_0x183e0f='Instruction:\x0a'+_0x4528b2+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x21f125):(_0x497a87='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.',_0x183e0f=_0x4528b2),[{'role':'system','content':_0x497a87},{'role':'user','content':_0x183e0f}];}async['_readStreamableResponse'](_0x33c370,_0x2383bd){const _0x34c1a7=_0x33c370['body']['getReader'](),_0x44b898=new TextDecoder();let _0x914e85='',_0x81bba9='',_0x2f8aa8='',_0x6d38cd=!0x1;for(;!_0x6d38cd;){const {done:_0x57fef0,value:_0x54c5aa}=await _0x34c1a7['read'](),_0x9070d=_0x914e85+_0x44b898['decode'](_0x54c5aa);let _0x40d699='';_0x6d38cd=_0x57fef0;try{_0x40d699=this['_cleanUpData'](_0x9070d),_0x914e85='';}catch{_0x914e85=_0x9070d;continue;}_0x81bba9+=_0x40d699,!_0x6d38cd&&this['_isBufferIncomplete'](_0x81bba9)||_0x81bba9&&(_0x2f8aa8+=_0x81bba9,_0x81bba9='',_0x2383bd(_0x2f8aa8));}return Promise['resolve']();}async['_readStaticResponse'](_0x448443,_0x32a930){return _0x32a930((await _0x448443['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x45b03b){const _0x14a421=_0x45b03b['split']('<')['length']!==_0x45b03b['split']('>')['length'],_0x17191f=_0x45b03b['length']<0x1e;return _0x14a421&&_0x17191f;}['_cleanUpData'](_0x45eecc){return _0x45eecc['split'](/\n(?![^{]*\})/g)['map'](_0x233f57=>_0x233f57['replace']('data:\x20',''))['filter'](_0x33e9ac=>_0x33e9ac&&_0x33e9ac['length']>0x0&&'[DONE]'!==_0x33e9ac)['map'](_0x4f8ae2=>{const {choices:_0x53b75b}=JSON['parse'](_0x4f8ae2);if(_0x53b75b[0x0]?.['delta']?.['content'])return _0x53b75b[0x0]['delta']['content'];})['filter'](_0x1adb2c=>_0x1adb2c)['join']('');}},es=class extends Zi{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),ft('ai-aws-adapter-not-supported');}async['sendRequest'](_0x21e89a){throw Ct('ai-aws-adapter-not-supported'),new vi(ki(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},is=class extends Pt{constructor(_0x489e27,_0x3f11df={}){super(_0x489e27),this['isToggleable']=!0x0,this['set']('side',_0x3f11df['side']||'top');const _0x1b4c58=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Rt(_0x3f11df['class']||[]),_0x1b4c58['to']('side',_0xd77ad8=>'ck-tab-button_'+_0xd77ad8),_0x1b4c58['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ss=class extends _0x4708a3{['children'];constructor(_0x3f30f6,_0x5b34e5={}){super(_0x3f30f6);const _0x4ff73f=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Rt(_0x5b34e5['class']||[]),_0x4ff73f['to']('class'),_0x4ff73f['if']('isVisible','ck-hidden',_0x55f0a8=>!_0x55f0a8)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x4708a3{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x3ff501,_0x27aa15={}){super(_0x3ff501),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x27aa15['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x27aa15['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x11f38a,_0x426a25)=>_0x11f38a&&!_0x426a25);const _0x4464e9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Rt(_0x27aa15['class']||[]),_0x4464e9['to']('side',_0x54e3aa=>'ck-tabs_'+_0x54e3aa),_0x4464e9['to']('class'),_0x4464e9['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x4464e9['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x4464e9['to']('side',_0x22e8bd=>'ck-tabs__buttons-container_'+_0x22e8bd)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x4464e9['to']('side',_0x4ef5f1=>'ck-tabs__panels-container_'+_0x4ef5f1)]},'children':this['panelViews']},...Rt(_0x27aa15['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x1223c4){const _0x3010d6=this['_tabs']['get'](_0x1223c4);return _0x3010d6||null;}['addTab'](_0x143491){const _0x37a35e=this['_setupButton']({'id':_0x143491['id'],'label':_0x143491['buttonLabel'],'icon':_0x143491['buttonIcon'],'order':_0x143491['order']}),_0x5ddfb3=new ss(this['locale']);return _0x5ddfb3['render'](),_0x143491['content']&&_0x5ddfb3['children']['add'](_0x143491['content']),this['panelViews']['add'](_0x5ddfb3),this['_tabs']['set'](_0x143491['id'],{'button':_0x37a35e,'panel':_0x5ddfb3,'order':void 0x0!==_0x143491['order']?_0x143491['order']:null}),this['fire']('addTab:'+_0x143491['id'],{'id':_0x143491['id'],'button':_0x37a35e,'panel':_0x5ddfb3}),null===this['activeTab']?this['activateTab'](_0x143491['id']):this['_hidePanel'](_0x143491['id']),{'button':_0x37a35e,'panel':_0x5ddfb3};}['activateTab'](_0x4e794a){if(null!==_0x4e794a&&!this['getTab'](_0x4e794a))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4e794a});if(this['isCollapsed']=!0x1,this['activeTab']===_0x4e794a)return;const _0x2ef28d=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x4e794a,_0x4e794a&&this['_showPanel'](_0x4e794a),this['fire']('activateTab:'+_0x4e794a,{'newTab':_0x4e794a,'oldTab':_0x2ef28d});}['toggleTabPanel'](_0x28fa00){this['activeTab']===_0x28fa00?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x28fa00);}['showTab'](_0x50950d){if(!this['getTab'](_0x50950d))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x50950d});this['_showPanel'](_0x50950d),this['_showButton'](_0x50950d),this['fire']('show:'+_0x50950d,_0x50950d);}['hideTab'](_0xd7c87e){if(!this['getTab'](_0xd7c87e))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xd7c87e});const _0x112253=this['activeTab'];this['_hidePanel'](_0xd7c87e),this['_hideButton'](_0xd7c87e);const _0x4407d0=this['getTabIds']();_0x112253===_0xd7c87e&&_0x4407d0['length']>0x1&&this['activateTab'](_0x4407d0['find'](_0x3b43fd=>_0x3b43fd!==_0xd7c87e)),this['fire']('hide:'+_0xd7c87e,_0xd7c87e);}['_getPanel'](_0x59634b){const _0x3ea402=this['_tabs']['get'](_0x59634b);return _0x3ea402?_0x3ea402['panel']:null;}['_showPanel'](_0x4c9e1d){null!==this['activeTab']&&this['activeTab']!==_0x4c9e1d||this['_getPanel'](_0x4c9e1d)['show']();}['_hidePanel'](_0x31e208){const _0x50831f=this['_getPanel'](_0x31e208);_0x50831f['isVisible']&&(this['activeTab']===_0x31e208&&(this['activeTab']=null),_0x50831f['hide']());}['_getButton'](_0x2a65b5){const _0x4a5f1d=this['_tabs']['get'](_0x2a65b5);return _0x4a5f1d?_0x4a5f1d['button']:null;}['_showButton'](_0xe09f5a){this['_getButton'](_0xe09f5a)['show']();}['_hideButton'](_0x3a4453){this['_getButton'](_0x3a4453)['hide']();}['_setupButton'](_0xfc2292){const _0x12e59d=new is(this['locale'],{'side':this['side']}),_0x328d57=this['buttonViews'];if(_0x12e59d['set']({'label':_0xfc2292['label'],'icon':_0xfc2292['icon'],'tooltip':!0x0,'withText':!0x0}),_0x12e59d['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0xf25402,_0x362225)=>_0xf25402===_0xfc2292['id']&&!_0x362225),_0x12e59d['bind']('side')['to'](this,'side'),_0xfc2292['order']){const _0x1ba0ef=[...this['_tabs']]['reduce']((_0x981f35,_0x1ff97f)=>{const _0x4e311a=_0x1ff97f[0x0],{order:_0x4ea022}=_0x1ff97f[0x1];return!_0x4ea022||_0x4ea022>_0xfc2292['order']?_0x981f35:_0x4ea022>=_0x981f35['order']?{'id':_0x4e311a,'order':_0x4ea022}:_0x981f35;},{'id':'','order':0x0}),_0x3e49d9=_0x328d57['getIndex'](this['_getButton'](_0x1ba0ef['id']));_0x328d57['add'](_0x12e59d,_0x3e49d9+0x1);}else _0x328d57['add'](_0x12e59d);return _0x12e59d['on']('execute',()=>{this['toggleTabPanel'](_0xfc2292['id']);}),_0x12e59d;}};const rs=['overlay','sidebar','custom'],os=['left','right'];var as=class extends ns{constructor(_0x517e68,_0x372ca5={}){super(_0x517e68,_0x372ca5),this['set']('type',_0x372ca5['type']||'sidebar'),this['set']('side',_0x372ca5['side']||'right'),this['set']('isVisible',_0x372ca5['visibleByDefault']??!0x0);const _0x4bb332=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x4bb332['if']('type','ck-ai-tabs__overlay',_0x178649=>'overlay'===_0x178649),_0x4bb332['if']('type','ck-ai-tabs__sidebar',_0x3c8f7b=>'sidebar'===_0x3c8f7b),_0x4bb332['if']('isVisible','ck-hidden',_0x2cd40f=>!_0x2cd40f)]}}),this['buttonViews']['on']('add',(_0x33a250,_0x32bdfc)=>{_0x32bdfc['set']('withText',!0x1);});}},hs=class extends _0x3abc0e{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x530ca3){if(super(_0x530ca3),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0xa87c42=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0xa87c42['showResizeButton']&&(this['showResizeButton']=_0xa87c42['showResizeButton']),'sidebar'!==_0xa87c42['type']&&'overlay'!==_0xa87c42['type']||_0xa87c42['side']&&(this['side']=_0xa87c42['side']),'sidebar'===_0xa87c42['type']){if(this['container']=_0xa87c42['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0xa87c42['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new as(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0xa87c42['visibleByDefault'],'collapsible':_0xa87c42['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 _0x5a1597&&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'](_0x193b85){if(_0x193b85&&this['type']!==_0x193b85){if(!rs['includes'](_0x193b85))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x193b85;}}['switchSide'](_0x265e46){if(_0x265e46&&this['side']!==_0x265e46){if(!os['includes'](_0x265e46))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x265e46;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},cs=class extends _0x3abc0e{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x1e4e93];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x35c698){if(super(_0x35c698),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 at('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x5cc078=this['context']['plugins']['get'](_0x1e4e93);if(!_0x5cc078['token'])throw new at('ai-missing-token',this);this['_token']=_0x5cc078['token'];}['startConversation'](_0x557438,_0x443c36){const _0x639dbd=this['_sendApiRequest']('/conversations','POST',{'id':_0x557438,'group':_0x443c36});return{'getConversation':async()=>(await _0x639dbd['request'])['json'](),'abortController':_0x639dbd['abortController']};}['queryAssistant']({message:_0xd23144,conversationId:_0x35d293,parts:_0x18c027,capabilities:_0x5c928c,model:_0x2bdac4,attributes:_0x5d50c6}){const _0x4727a2={'prompt':_0xd23144,'content':_0x18c027,'model':_0x2bdac4,..._0x5c928c&&{'capabilities':_0x5c928c},..._0x5d50c6&&{'attributes':_0x5d50c6}},_0x3176eb=this['_sendApiRequest']('/conversations/'+_0x35d293+'/messages','POST',_0x4727a2,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2e173d=(await _0x3176eb['request'])['body'];return this['_getStreamReader'](_0x2e173d);},'abortController':_0x3176eb['abortController']};}['executeCustomAction']({content:_0x5f3022,message:_0x51c7ff,model:_0x28d8ff,outputFormat:_0x4edb24}){const _0x1178e2={'content':[{'type':'text','content':_0x5f3022}],'prompt':_0x51c7ff,'model':_0x28d8ff,'outputFormat':_0x4edb24},_0x3cb642=this['_sendApiRequest']('/actions/custom/calls','POST',_0x1178e2);return{'getStream':async()=>{const _0x143673=(await _0x3cb642['request'])['body'];return this['_getStreamReader'](_0x143673);},'abortController':_0x3cb642['abortController']};}['executeAction']({actionName:_0x1b7be4,content:_0xd2f197,args:_0x4e656c}){const _0x1a8671={'content':[{'type':'text','content':_0xd2f197}],'args':_0x4e656c},_0xaae319=this['_sendApiRequest']('/actions/system/'+_0x1b7be4+'/calls','POST',_0x1a8671);return{'getStream':async()=>{const _0x52ffad=(await _0xaae319['request'])['body'];return this['_getStreamReader'](_0x52ffad);},'abortController':_0xaae319['abortController']};}['uploadFile'](_0xe85a86,_0x2beb7c,_0x7db95c){const _0x53b1d4=new FormData();_0x53b1d4['append']('file',_0x2beb7c,_0x2beb7c['name']),_0x7db95c&&_0x53b1d4['append']('attributes',JSON['stringify'](_0x7db95c));const _0x4a99ed=this['_sendApiRequest']('/conversations/'+_0xe85a86+'/files','POST',_0x53b1d4);return{'getId':async()=>(await _0x4a99ed['request'])['json'](),'abortController':_0x4a99ed['abortController']};}['uploadDocuments'](_0x1ae41a,_0x4de16b){const _0x3d8cb0={'documents':_0x4de16b['map'](_0x127ac8=>({'content':_0x127ac8['content'],'attributes':{'version':_0x127ac8['version'],'sessionId':_0x127ac8['sessionId'],'channelId':_0x127ac8['channelId'],'rootName':_0x127ac8['rootName'],'selections':_0x127ac8['selections']},...void 0x0!==_0x127ac8['name']?{'name':_0x127ac8['name']}:{},...void 0x0!==_0x127ac8['description']?{'description':_0x127ac8['description']}:{}}))},_0x4e9883=this['_sendApiRequest']('/conversations/'+_0x1ae41a+'/documents/batch','POST',_0x3d8cb0);return{'getIds':async()=>(await _0x4e9883['request'])['json'](),'abortController':_0x4e9883['abortController']};}['fetchDocuments'](_0x1698c3,_0x41d989){const _0x7571f6=new URLSearchParams();_0x7571f6['append']('documentIds',_0x41d989['join'](','));const _0x37de58=this['_sendApiRequest']('/conversations/'+_0x1698c3+'/documents/batch?'+_0x7571f6['toString'](),'GET');return{'getDocuments':async()=>(await _0x37de58['request'])['json'](),'abortController':_0x37de58['abortController']};}['fetchConversations'](_0x7502d5,_0x9d826a={}){const _0x53fec6=new URLSearchParams();_0x53fec6['append']('group',_0x7502d5),_0x53fec6['append']('excludeEmpty',!0x1!==_0x9d826a['excludeEmpty']?'true':'false'),_0x53fec6['append']('limit',_0x9d826a['limit']?_0x9d826a['limit']['toString']():'100'),_0x53fec6['append']('sortBy',_0x9d826a['sortBy']?_0x9d826a['sortBy']:'createdAt'),_0x53fec6['append']('order',_0x9d826a['order']?_0x9d826a['order']:'desc');const _0x5bd2b1=this['_sendApiRequest']('/conversations?'+_0x53fec6['toString'](),'GET');return{'getConversations':async()=>(await(await _0x5bd2b1['request'])['json']())['items'],'abortController':_0x5bd2b1['abortController']};}['deleteConversation'](_0x17ad62){const _0x5c3164=this['_sendApiRequest']('/conversations/'+_0x17ad62,'DELETE');return{'execute':async()=>{await _0x5c3164['request'];},'abortController':_0x5c3164['abortController']};}['updateConversation'](_0x4d52da,_0x185769){const _0x2b7ca8=this['_sendApiRequest']('/conversations/'+_0x4d52da,'PATCH',_0x185769);return{'getResult':async()=>(await _0x2b7ca8['request'],_0x185769),'abortController':_0x2b7ca8['abortController']};}['fetchConversation'](_0x38fa3e){const _0x473df2=this['_sendApiRequest']('/conversations/'+_0x38fa3e,'GET');return{'getConversation':async()=>(await _0x473df2['request'])['json'](),'abortController':_0x473df2['abortController']};}['fetchConversationMessages'](_0x264c21){const _0x4e61b9=this['_sendApiRequest']('/conversations/'+_0x264c21+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x4e61b9['request'])['json']())['items'],'abortController':_0x4e61b9['abortController']};}['uploadUrl'](_0xf181ac,_0xf655ad,_0x3c9bc6){const _0x315429=this['_sendApiRequest']('/conversations/'+_0xf181ac+'/web-resources','POST',{'url':_0xf655ad,'attributes':_0x3c9bc6});return{'getId':async()=>(await _0x315429['request'])['json'](),'abortController':_0x315429['abortController']};}['getModels'](_0x140943='en'){const _0x257bba=new URLSearchParams();_0x257bba['append']('language',_0x140943);const _0x2a257a='/models/1?'+_0x257bba['toString'](),_0x1dba5d=this['_sendApiRequest'](_0x2a257a,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x1dba5d['request'])['json'](),'abortController':_0x1dba5d['abortController']};}['deleteFile'](_0x18da2f,_0x3c664f){const _0x26d8ab=this['_sendApiRequest']('/conversations/'+_0x18da2f+'/files/'+_0x3c664f,'DELETE');return{'execute':async()=>{await _0x26d8ab['request'];},'abortController':_0x26d8ab['abortController']};}['deleteDocument'](_0x1363ab,_0x475973){const _0x128079=this['_sendApiRequest']('/conversations/'+_0x1363ab+'/documents/'+_0x475973,'DELETE');return{'execute':async()=>{await _0x128079['request'];},'abortController':_0x128079['abortController']};}['deleteWebResource'](_0x16cc72,_0x1c8a4b){const _0xf953bd=this['_sendApiRequest']('/conversations/'+_0x16cc72+'/web-resources/'+_0x1c8a4b,'DELETE');return{'execute':async()=>{await _0xf953bd['request'];},'abortController':_0xf953bd['abortController']};}['cancelStream'](_0x14af8c,_0x3fb1da){const _0x50aee7=this['_sendApiRequest']('/conversations/'+_0x14af8c+'/messages/'+_0x3fb1da+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x50aee7['request'];},'abortController':_0x50aee7['abortController']};}['resumeStream'](_0x1c9e46,_0x3d69d7,_0x48346a='0-0'){const _0x1da02d=new URLSearchParams({'lastEventId':_0x48346a}),_0x3a1427=this['_sendApiRequest']('/conversations/'+_0x1c9e46+'/messages/'+_0x3d69d7+'/stream?'+_0x1da02d['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x4ca5ad=await _0x3a1427['request'];return this['_getStreamReader'](_0x4ca5ad['body']);},'abortController':_0x3a1427['abortController']};}['callSystemReview']({reviewName:_0x167a72,content:_0x311297,args:_0xa927d4}){const _0x51c256=this['_sendApiRequest']('/reviews/system/'+_0x167a72+'/calls','POST',{'content':[{'type':'text','content':_0x311297}],'args':_0xa927d4});return{'getStream':async()=>{const _0x22c28b=(await _0x51c256['request'])['body'];return this['_getStreamReader'](_0x22c28b);},'abortController':_0x51c256['abortController']};}['processDocument']({document:_0x53ce5c,prompt:_0x17c52a,model:_0x481bb9}){const _0x163dd7=this['_sendApiRequest']('/documents/process','POST',{'document':_0x53ce5c,'prompt':_0x17c52a,'model':_0x481bb9});return{'getResult':async()=>(await _0x163dd7['request'])['json'](),'abortController':_0x163dd7['abortController']};}['callCustomReview']({content:_0x79a96f,prompt:_0xbca9fb,model:_0x49baa6}){const _0x52b2f3=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x79a96f}],'prompt':_0xbca9fb,'model':_0x49baa6});return{'getStream':async()=>{const _0x4f71b7=(await _0x52b2f3['request'])['body'];return this['_getStreamReader'](_0x4f71b7);},'abortController':_0x52b2f3['abortController']};}['upsertAIChatRating'](_0x3df155,_0x5b1986,_0x1f83a3){const _0x325aa1=this['_sendApiRequest']('/conversations/'+_0x3df155+'/messages/'+_0x5b1986+'/ratings','PUT',{'positiveCount':_0x1f83a3['positiveCount'],'totalCount':_0x1f83a3['totalCount'],'modificationId':_0x1f83a3['modificationId']});return{'execute':async()=>{await _0x325aa1['request'];},'abortController':_0x325aa1['abortController']};}['upsertAIActionRating'](_0x19bc7e,_0x253f3a,_0x37f549){const _0x2d7138=this['_sendApiRequest']('/actions/system/'+_0x19bc7e+'/calls/'+_0x253f3a+'/ratings','PUT',{'positiveCount':_0x37f549['positiveCount'],'totalCount':_0x37f549['totalCount']});return{'execute':async()=>{await _0x2d7138['request'];},'abortController':_0x2d7138['abortController']};}['upsertCustomAIActionRating'](_0x7c605b,_0x293384){const _0x4c5e5b=this['_sendApiRequest']('/actions/custom/calls/'+_0x7c605b+'/ratings','PUT',{'positiveCount':_0x293384['positiveCount'],'totalCount':_0x293384['totalCount']});return{'execute':async()=>{await _0x4c5e5b['request'];},'abortController':_0x4c5e5b['abortController']};}['upsertAIReviewRating'](_0x442df5,_0x14ae8a,_0xc0b5a0,_0x46aa82){const _0x31fe59=this['_sendApiRequest']('/reviews/system/'+_0x442df5+'/calls/'+_0x14ae8a+'/ratings','PUT',{'positiveCount':_0xc0b5a0['positiveCount'],'totalCount':_0xc0b5a0['totalCount'],'dataId':_0x46aa82});return{'execute':async()=>{await _0x31fe59['request'];},'abortController':_0x31fe59['abortController']};}['upsertCustomAIReviewRating'](_0x423859,_0x14e153,_0x1618b1){const _0x529a9b=this['_sendApiRequest']('/reviews/custom/calls/'+_0x423859+'/ratings','PUT',{'positiveCount':_0x14e153['positiveCount'],'totalCount':_0x14e153['totalCount'],'dataId':_0x1618b1});return{'execute':async()=>{await _0x529a9b['request'];},'abortController':_0x529a9b['abortController']};}['_sendApiRequest'](_0x3e6f2c,_0x4b1952,_0x37f659,_0x9e8284={}){const {useCache:_0x1069ea=!0x1,apiUrl:_0xe53f9d=this['_apiUrl']}=_0x9e8284,_0x1c8d0b=new AbortController(),_0x2aae80=_0x1069ea?_0x4b1952+':'+_0x3e6f2c:null;if(_0x2aae80){const _0x34c6e4=this['_responseCache']['get'](_0x2aae80);if(_0x34c6e4)return{'request':_0x34c6e4['then'](_0x429cf6=>_0x429cf6['clone']()),'abortController':_0x1c8d0b};}const _0x856939=_0x37f659 instanceof FormData,_0x26cda6={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':vt};_0x37f659&&!_0x856939&&(_0x26cda6['Content-Type']='application/json');const _0x264e5e={'method':_0x4b1952,'headers':_0x26cda6,'signal':_0x1c8d0b['signal']};_0x37f659&&(_0x264e5e['body']=_0x856939?_0x37f659:JSON['stringify'](_0x37f659));const _0x1b3543=fetch(''+_0xe53f9d+_0x3e6f2c,_0x264e5e)['catch'](_0x39bd44=>{_0x2aae80&&this['_responseCache']['delete'](_0x2aae80),this['_handleError'](_0x39bd44);})['then'](_0x4e5224=>_0x4e5224['ok']?_0x4e5224:_0x4e5224['json']()['then'](_0x5878ca=>{throw _0x2aae80&&this['_responseCache']['delete'](_0x2aae80),{'url':_0xe53f9d,'path':_0x3e6f2c,'method':_0x4b1952,'body':_0x37f659,'status':(_0x4e5224||{})['status'],'statusText':(_0x4e5224||{})['statusText'],'code':_0x5878ca['code'],'message':_0x5878ca['message'],'traceId':_0x5878ca['traceId']};}));return _0x2aae80&&this['_responseCache']['set'](_0x2aae80,_0x1b3543['then'](_0x2686ee=>_0x2686ee['clone']())),{'request':_0x1b3543,'abortController':_0x1c8d0b};}async*['_getStreamReader'](_0xc10244){const _0x8fe07a=[],_0xf32bcb=_0xc10244['getReader'](),_0xf305df=_0x43c815({'onError':_0x4420c2=>{this['_handleError'](_0x4420c2);},'onEvent':_0x4c210d=>{_0x4c210d['data']=JSON['parse'](_0x4c210d['data']),_0x8fe07a['push'](_0x4c210d);}});try{let _0x40df92=!0x1;for(;!_0x40df92;){const {done:_0x213473,value:_0x3b27c0}=await _0xf32bcb['read']();_0x213473&&(_0x40df92=!0x0),_0xf305df['feed'](this['_decoder']['decode'](_0x3b27c0,{'stream':!0x0})),yield*_0x8fe07a,_0x8fe07a['length']=0x0;}}catch(_0x3359e7){this['_handleError'](_0x3359e7);}finally{_0xf32bcb['releaseLock'](),_0xf305df['reset']();}}['_handleError'](_0x127f42){if(_0x127f42 instanceof at)throw _0x127f42;if(_0x127f42 instanceof Error&&'AbortError'===_0x127f42['name'])throw new at('ai-request-aborted',this,{'originalError':_0x127f42});throw new at('ai-request-failed',this,{'originalError':_0x127f42});}};function ls(_0x2f5d04,_0x1262fc,_0x1c1ebc){const t=_0x2f5d04['t'];switch(_0x1262fc){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'},_0x1c1ebc);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.'},_0x1c1ebc);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.'},_0x1c1ebc);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.'},_0x1c1ebc);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'},_0x1c1ebc);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x1c1ebc);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'},_0x1c1ebc);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.'},_0x1c1ebc);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.'},_0x1c1ebc);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.'},_0x1c1ebc);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.'},_0x1c1ebc);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'},_0x1c1ebc);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.'},_0x1c1ebc);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 _0x1262fc;}}function us(_0x3d93b7){return _0x3d93b7?_0x3d93b7 instanceof _0x5a1597?[_0x3d93b7]:_0x3d93b7['editors']&&0x0!==_0x3d93b7['editors']['length']?Array['from'](_0x3d93b7['editors']):[]:[];}function ds(_0x50377c){const _0x4eb780=us(_0x50377c);if(!_0x4eb780['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x4eb780['length'])return _0x4eb780[0x0];const _0x1af048=_0x4eb780['find'](_0x656b4b=>_0x656b4b['ui']?.['focusTracker']?.['isFocused']);if(_0x1af048)return _0x1af048;const _0x371c77=function(_0x5469c1){if(_0x5469c1 instanceof _0x5a1597)return;const _0x5de0de=_0x5469c1;if(!_0x5de0de['plugins']||!_0x5de0de['plugins']['has']('AIEditing'))return;return _0x5de0de['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x50377c);return _0x371c77&&_0x4eb780['includes'](_0x371c77)?_0x371c77:_0x4eb780[0x0];}const _s='ai-selection',gs=['br'];var As=class extends _0x3abc0e{constructor(_0x28db9f){super(_0x28db9f),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'](_0x4681d7){let _0x38a8c6=this['_sessionIdByEditor']['get'](_0x4681d7);return _0x38a8c6||(_0x38a8c6=_0x4681d7['plugins']['has']('RealTimeCollaborationClient')&&_0x4681d7['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Ot(),this['_sessionIdByEditor']['set'](_0x4681d7,_0x38a8c6)),_0x38a8c6;}async['getDocumentData'](){const _0x162e1a=us(this['context']);if(!_0x162e1a['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x336b50=[],_0x313664=new Set();for(const _0x39249b of _0x162e1a){const _0x2a435d=_0x39249b['config']['get']('roots')||{};for(const _0x5e3c55 of _0x39249b['model']['document']['getRoots']()){if('$graveyard'===_0x5e3c55['rootName'])continue;const _0xb0eca1=await this['_getDocumentDataForEditorRoot'](_0x39249b,_0x5e3c55,_0x313664),_0x3d5f7e=_0x2a435d[_0x5e3c55['rootName']],_0x527d61=_0x5e3c55['getAttribute']('$description')??_0x3d5f7e?.['description'];let _0x4fc1e7=_0x5e3c55['getAttribute']('$title')??_0x3d5f7e?.['title'];_0x4fc1e7||(_0x4fc1e7=_0x5e3c55['getAttribute']('$rootEditableOptions')?.['label']??_0x3d5f7e?.['label']),_0x4fc1e7||(ft('ai-document-root-missing-title',{'editor':_0x39249b,'rootName':_0x5e3c55['rootName']}),_0x4fc1e7=_0x5e3c55['rootName']),_0x336b50['push']({'editor':_0x39249b,'rootName':_0x5e3c55['rootName'],'content':_0xb0eca1['content'],'version':_0xb0eca1['version'],'sessionId':this['getSessionId'](_0x39249b),'channelId':_0x39249b['config']['get']('collaboration.channelId'),'selections':_0xb0eca1['selections'],'name':_0x4fc1e7,'description':_0x527d61});}}return _0x336b50;}async['_getDocumentDataForEditorRoot'](_0x57b0f7,_0x4a22d4,_0x340a07){const _0x2c4cd9=_0x57b0f7['data']['toView'](_0x4a22d4,{'convertAiChatSelectionMarker':!0x0}),_0x13be42=new _0x4554d0(_0x57b0f7['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x2c4cd9,_0x13be42,_0x340a07);let _0x4785b0=await this['_getDocumentDataStringFromView'](_0x2c4cd9,_0x57b0f7);const _0x2a9d9d=this['_getMarkersInDocumentOrder'](_0x57b0f7,_0x4a22d4),_0x5579f1=[];for(const _0x43f381 of _0x2a9d9d){const _0x4c5286='<'+_0x43f381['name']+':start></'+_0x43f381['name']+':start>',_0x3129c2=_0x4785b0['indexOf'](_0x4c5286);_0x4785b0=_0x4785b0['substring'](0x0,_0x3129c2)+_0x4785b0['substring'](_0x3129c2+_0x4c5286['length']);const _0x274671='<'+_0x43f381['name']+':end></'+_0x43f381['name']+':end>',_0x3e8fb8=_0x4785b0['indexOf'](_0x274671);_0x4785b0=_0x4785b0['substring'](0x0,_0x3e8fb8)+_0x4785b0['substring'](_0x3e8fb8+_0x274671['length']),_0x5579f1['push']({'markerName':_0x43f381['name'],'start':_0x3129c2,'end':_0x3e8fb8,'htmlFragment':_0x4785b0['substring'](_0x3129c2,_0x3e8fb8)});}return{'content':_0x4785b0,'version':_0x57b0f7['model']['document']['version'],'selections':_0x5579f1};}['afterInit'](){this['context']instanceof _0x5a1597?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x4de22b,_0x54c01c)=>{_0x54c01c['on']('ready',()=>{this['_integrateEditor'](_0x54c01c);});});}['_setOutputDataProcessor'](_0x70f083){this['_outputDataProcessor']=_0x70f083;}async['_getDocumentDataStringFromView'](_0x1f0169,_0x5eb679){let _0x51e6d2;if(this['_outputDataProcessor']){const _0x28fa23=_0x5eb679['data']['processor']['domConverter']['viewToDom'](_0x1f0169),_0x2f08b3=await this['_outputDataProcessor'](_0x28fa23);_0x51e6d2=_0x5eb679['data']['processor']['htmlWriter']['getHtml'](_0x2f08b3);}else _0x51e6d2=_0x5eb679['data']['processor']['toData'](_0x1f0169);return _0x51e6d2;}['_integrateEditor'](_0x3bae3d){if(!_0x3bae3d['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x3bae3d);_0x3bae3d['ui']['focusTracker']['on']('change:isFocused',(_0x222c8a,_0x3e50f6,_0xe457ec)=>{_0xe457ec&&(this['_lastContentFocusedEditor']=_0x3bae3d);}),_0x3bae3d['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3bae3d&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3bae3d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':_s,'view':({markerName:_0x5c7828})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x5c7828['split'](':')[0x1]],'priority':0xc})}),_0x3bae3d['conversion']['for']('dataDowncast')['markerToElement']({'model':_s+':context','view':(_0x54617c,{writer:_0x384053,options:_0x3554a4})=>_0x3554a4['convertAiChatSelectionMarker']?_0x384053['createUIElement'](_0x54617c['markerName']+':'+(_0x54617c['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x334f37){const _0x12fd83=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x334f37);const _0x52db7d=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x12fd83,_0x52db7d);}['hideFakeVisualSelection'](_0x3086df){const _0x59e83c=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x3086df);const _0x4faa3d=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x59e83c,_0x4faa3d);}async['modelToDataWithIds'](_0x3992c3,_0x5ef35a){const _0x4650f0=_0x5ef35a['data']['toView'](_0x3992c3),_0x4cbfeb=new _0x4554d0(_0x5ef35a['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x4650f0,_0x4cbfeb),this['_getDocumentDataStringFromView'](_0x4650f0,_0x5ef35a);}['_setDataIdsOnChildren'](_0x13c927,_0x234e27,_0x81fd1f=new Set()){let _0x939d68=!0x1;for(const _0x5ca171 of _0x13c927['getChildren']()){if(!_0x5ca171['is']('view:element')||gs['includes'](_0x5ca171['name']))continue;const _0x37e2a3=_0x5ca171['is']('view:containerElement'),_0x4e93f3=_0x5ca171['is']('view:emptyElement'),_0x32654e=_0x5ca171['is']('view:rawElement'),_0x4a689e=this['_setDataIdsOnChildren'](_0x5ca171,_0x234e27,_0x81fd1f);_0x5ca171['hasAttribute']('data-id')?(_0x939d68=!0x0,_0x81fd1f['add'](_0x5ca171['getAttribute']('data-id'))):(_0x37e2a3||_0x4e93f3||_0x32654e||_0x4a689e)&&(_0x234e27['setAttribute']('data-id',this['_nextDataId'](_0x81fd1f),_0x5ca171),_0x939d68=!0x0);}return _0x939d68;}['_nextDataId'](_0x120fd1){let _0x3af896;do{_0x3af896='';for(let _0x592f87=0x0;_0x592f87<0x4;_0x592f87++)_0x3af896+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x120fd1['has'](_0x3af896));return _0x120fd1['add'](_0x3af896),_0x3af896;}['getSelectionText'](_0x294c03){const _0x3dbf5c=(_0x294c03?_0x294c03['model']:ds(this['context'])['model'])['document']['selection'],_0x159b55=[],_0x824688=Array['from'](_0x3dbf5c['getRanges']());_0x824688['sort']((_0xea1bed,_0x241fb7)=>_0xea1bed['start']['isBefore'](_0x241fb7['start'])?-0x1:0x1);for(const _0x5d63b0 of _0x824688)for(const _0x3259bd of _0x5d63b0['getItems']())_0x3259bd['is']('$textProxy')?_0x159b55['push'](_0x3259bd['data']):_0x3259bd['is']('element')&&_0x159b55['length']>0x0&&'\x20'!==_0x159b55[_0x159b55['length']-0x1]&&_0x159b55['push']('\x20');return _0x159b55['length']?'\x22'+_0x159b55['join']('')['trim']()+'\x22':ls(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x54b578){for(let _0x5ab302=0x0;_0x5ab302<this['_fakeSelections']['length'];_0x5ab302++)if(this['_fakeSelections'][_0x5ab302]['id']==_0x54b578)return void this['_fakeSelections']['splice'](_0x5ab302,0x1);}['_addFakeSelection'](_0x890bc7){this['_removeFakeSelectionById'](_0x890bc7['id']),Tt(this['_fakeSelections'],_0x890bc7);}['_refreshFakeSelection'](_0x2ef6c4,_0x4774f6){if(_0x2ef6c4==_0x4774f6)return;const _0x8b2384=_0x2ef6c4?_0x2ef6c4['editor']:null,_0x2b47c4=_0x4774f6?_0x4774f6['editor']:null,_0x34bcec=(_0x13f42f,_0x13a2c2)=>{const _0x286323=_0x13a2c2['model']['markers']['getMarkersGroup'](_s);for(const _0x4bdc9c of _0x286323)_0x13f42f['removeMarker'](_0x4bdc9c);},_0x274356=(_0x1a4f4,_0x253597,_0x51036e)=>{const _0x57b860=_0x253597['model'];for(let _0x402213=0x0;_0x402213<_0x51036e['ranges']['length'];_0x402213++){let _0x2de030=_0x51036e['ranges'][_0x402213];const _0x178eec=_s+':'+_0x51036e['id']+':'+_0x402213;if(_0x2de030['start']['isAtEnd']){const _0x11b232=_0x2de030['start']['getLastMatchingPosition'](({item:_0x55d1d5})=>!_0x57b860['schema']['isContent'](_0x55d1d5),{'boundaries':_0x2de030});_0x2de030=_0x1a4f4['createRange'](_0x11b232,_0x2de030['end']);}_0x1a4f4['addMarker'](_0x178eec,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2de030});}};_0x8b2384&&_0x2b47c4&&_0x8b2384===_0x2b47c4&&_0x4774f6?_0x8b2384['model']['change'](_0x34adf4=>{_0x34bcec(_0x34adf4,_0x8b2384),_0x274356(_0x34adf4,_0x2b47c4,_0x4774f6);}):(_0x8b2384&&_0x8b2384['model']['change'](_0x80eae8=>_0x34bcec(_0x80eae8,_0x8b2384)),_0x2b47c4&&_0x4774f6&&_0x2b47c4['model']['change'](_0x599a0a=>_0x274356(_0x599a0a,_0x2b47c4,_0x4774f6)));}['_getMarkersInDocumentOrder'](_0x2b10c0,_0x376fd2){const _0x1a6ed1=Array['from'](_0x2b10c0['model']['markers']['getMarkersGroup'](_s+':context'));return(_0x376fd2?_0x1a6ed1['filter'](_0x9f4937=>{const _0x13a683=_0x9f4937['getRange']();return _0x13a683&&_0x13a683['root']['rootName']===_0x376fd2['rootName'];}):_0x1a6ed1)['sort']((_0x48009a,_0x495207)=>_0x48009a['getStart']()['isBefore'](_0x495207['getStart']())?-0x1:_0x48009a['getStart']()['isAfter'](_0x495207['getStart']())?0x1:0x0);}};function Is(_0x56238f,_0x1af614){return _0x2f5649(_0x56238f,_0x1af614);}function ps(_0x581caa,_0x5893af){return _0x425375(_0x581caa,_0x5893af);}function ms(_0x55dd9e,_0xc6ceaf,_0x193b5e){const _0x101a09=null!==_0xc6ceaf?_0x5511b1=>_0x5511b1['attribs'][_0x55dd9e]===_0xc6ceaf:_0x49d042=>Boolean(_0x49d042['attribs'][_0x55dd9e]);return _0x103707(_0x1c295e=>_0x314fbd(_0x1c295e)&&_0x101a09(_0x1c295e),_0x193b5e);}function Es(_0xa9dcaa,_0x4550e0,_0x23b8b8){const _0x2b6c0b=null!==_0x4550e0?_0x2a5de1=>_0x2a5de1['attribs'][_0xa9dcaa]===_0x4550e0:_0x3033b6=>Boolean(_0x3033b6['attribs'][_0xa9dcaa]);return _0x210655(_0x3a7a49=>_0x314fbd(_0x3a7a49)&&_0x2b6c0b(_0x3a7a49),_0x23b8b8);}function Ts(_0x4d49a3){return _0x210655(_0x33ae50=>_0x314fbd(_0x33ae50)&&function(_0x25a323){const _0x2ef91f=_0x25a323['toLowerCase']();return'script'===_0x2ef91f||'style'===_0x2ef91f||_0x2ef91f['includes']('-');}(_0x33ae50['name']),_0x4d49a3);}function ws(_0x372647){return _0x188519(_0x3cba93=>_0x3bd54b(_0x3cba93),_0x372647,!0x0,0x1/0x0);}function Cs(_0x537b4b,_0x53ec90){return _0x537b4b&&_0x314fbd(_0x537b4b)?_0x537b4b['attribs'][_0x53ec90]:null;}function fs(_0x3c57c2,_0x4fc40d,_0x1e66d3){_0x314fbd(_0x3c57c2)&&(null===_0x1e66d3?delete _0x3c57c2['attribs'][_0x4fc40d]:_0x3c57c2['attribs'][_0x4fc40d]=_0x1e66d3);}function bs(_0x50d64b,_0x520a02,_0x2557b8){const _0x2d2e6f=_0x520a02['cloneNode'](!0x0);'beforebegin'===_0x2557b8?_0x28f757(_0x50d64b,_0x2d2e6f):'afterbegin'===_0x2557b8?_0x49cc30(_0x50d64b,_0x2d2e6f):'beforeend'===_0x2557b8?_0x18873b(_0x50d64b,_0x2d2e6f):'afterend'===_0x2557b8&&_0x3c432c(_0x50d64b,_0x2d2e6f);}function Ss(_0x287ad4){const _0x9514=[];let _0x564bbb=_0x287ad4;for(;_0x564bbb;)_0x564bbb=_0x4fbc65(_0x564bbb),_0x564bbb&&_0x9514['push'](_0x564bbb);return _0x9514;}function Rs(_0x490630){return _0x490630['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Os(_0x4edd4b){let _0xb1610b=0x0;for(;_0x4edd4b['parentNode'];)_0x4edd4b=_0x4edd4b['parentNode'],_0xb1610b++;return _0xb1610b;}function vs(_0x4130c6){const _0x497387=[];let _0x55d4b3=_0x4130c6['nextSibling'];for(;_0x55d4b3;)_0x497387['push'](_0x55d4b3),_0x55d4b3=_0x55d4b3['nextSibling'];_0x497387['forEach'](_0x3ad2e4=>{_0x46f92a(_0x3ad2e4);});}function ks({documentSuggestions:_0x4a19fb,transform:_0x4dfb9e,documentCompare:_0x47d95a,documentCompareOptions:_0x56bb8b}){const _0x58ecea=new Map();for(const [_0x2496dc,{groups:_0x86bed0,documentContext:_0x372b8d,documentContent:_0x1a5b3a,editor:_0x40a12a}]of _0x4a19fb){const _0x270312=_0x372b8d['content'],_0x52369e=_0x372b8d['version'],_0x1ee1e7=_0x1a5b3a['cloneNode'](!0x0);for(const {changes:_0x2ed35f}of _0x86bed0){const _0x2d213a=_0x2ed35f['filter'](_0x38b940=>'new'!=_0x38b940['type'])['map'](_0x1c637e=>ms('data-id',_0x1c637e['id'],_0x1ee1e7)),_0x525423=_0x2ed35f['filter'](_0x2e21bb=>'removed'!=_0x2e21bb['type'])['map'](_0x3ce615=>_0x3ce615['node']['cloneNode'](!0x0));let _0x484908=null;if(_0x2d213a['length']){_0x484908=_0x2d213a[0x0]['previousSibling'];for(let _0x2d7d2d=0x0;_0x2d7d2d<_0x2d213a['length'];_0x2d7d2d++)_0x46f92a(_0x2d213a[_0x2d7d2d]);}if(_0x525423['length']){_0x484908||(_0x2ed35f[0x0]['anchorId']?_0x484908=ms('data-id',_0x2ed35f[0x0]['anchorId'],_0x1ee1e7):(_0x484908=_0x525423['shift'](),_0x49cc30(_0x1ee1e7,_0x484908)));for(let _0x60d0be=0x0;_0x60d0be<_0x525423['length'];_0x60d0be++)_0x3c432c(_0x484908,_0x525423[_0x60d0be]),_0x484908=_0x525423[_0x60d0be];}}const _0x49821a=ps(_0x1ee1e7),_0x14259a=_0x47d95a['getDiff'](_0x270312,_0x49821a,{'targetEditor':_0x40a12a,'anchor':_0x372b8d['rootName'],..._0x56bb8b})['getOperations']();if(_0x4dfb9e){const _0x5b161d=_0x40a12a['model']['document']['history']['getOperations'](_0x52369e),_0x25c548={'document':_0x40a12a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x58ecea['set'](_0x2496dc,_0x1790d4(_0x14259a,_0x5b161d,_0x25c548)['operationsA']);}else _0x58ecea['set'](_0x2496dc,_0x14259a);}return _0x58ecea;}function Ns(_0x4f33ce,_0x4ad6ca){if('marker'!=_0x4ad6ca['type'])return;const _0x1533a9=_0x4f33ce['model']['markers']['get'](_0x4ad6ca['name']);_0x1533a9&&(_0x4ad6ca['oldRange']=_0x1533a9['getRange']());}const ys=/* #__PURE__ -- @preserve */
25
- _t();var xs=class extends ys{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x3af325){super(),this['_generateUid']=_0x3af325||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x4c34f9,_0x2bef18,_0x4cbebc){this['_uidCounter']=0x0;const _0x537023=_0x4c34f9['cloneNode'](!0x0);Ps(_0x2bef18,_0x537023);const _0xad8e80=_0x537023['childNodes'],_0x4a53d8=Array['from'](_0xad8e80)['filter'](_0x304858=>!(0x3===_0x304858['nodeType']&&''===ps(_0x304858)['trim']())),_0x13d2cc=_0x4a53d8['length'];this['_existingDataIds']=new Set(Es('data-id',null,_0x2bef18)['map'](_0x2b6f5e=>Cs(_0x2b6f5e,'data-id'))['filter'](_0x5ca0a0=>!!_0x5ca0a0));for(const _0x26a3ce of _0x4a53d8)_0x26a3ce&&_0x314fbd(_0x26a3ce)&&void 0x0===_0x26a3ce['attribs']['data-id']&&fs(_0x26a3ce,'data-id','new-element');if(Es('data-id',null,_0x537023)['forEach'](_0x4ee509=>{const _0x4f23ad=Cs(_0x4ee509,'data-id');'new-element'===_0x4f23ad||this['_existingDataIds']['has'](_0x4f23ad)||fs(_0x4ee509,'data-id','new-element');}),0x0===_0x2bef18['childNodes']['length']){const _0x1b914f=[];return Es('data-id','new-element',_0x537023)['forEach'](_0x211936=>{const _0x275859=this['_generateUid']();fs(_0x211936,'data-id',_0x275859),_0x1b914f['push'](_0x275859);}),this['_removeSpecialComments'](_0x537023),{'parsedContent':_0x537023,'newNodeIds':_0x1b914f,'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 _0x441003=-0x1,_0x4fd4ae=!0x1;for(let _0x1b4dc2=0x0;_0x1b4dc2<_0x13d2cc;_0x1b4dc2++){const _0x480d44=_0x4a53d8[_0x1b4dc2],_0x4371a3=_0x4a53d8[_0x1b4dc2+0x1];if(this['_isNewNode'](_0x480d44)){if(-0x1===_0x441003&&(_0x441003=_0x1b4dc2),this['_markWrappedElements'](_0x480d44),!this['_isNewNode'](_0x4371a3)){const [_0x172964,_0x5be642]=this['_findReferenceNode'](_0x480d44,_0x4fd4ae,_0x2bef18);if(_0x172964){const _0x450844=Array['from'](_0x4a53d8)['slice'](_0x441003,_0x1b4dc2+0x1);this['_insertNodes'](_0x172964,_0x450844,_0x5be642),_0x441003=-0x1;}}}else{if(this['_isExistingContentComment'](_0x480d44))_0x4fd4ae=!0x0;else{if(this['_isExistingNode'](_0x480d44)){const _0x11c7ca=Cs(_0x480d44,'data-id');if(_0x11c7ca&&this['_existingDataIds']['has'](_0x11c7ca)){this['_referencedExistingIds']['add'](_0x11c7ca);const _0x32da9a=ms('data-id',_0x11c7ca,_0x2bef18);this['_replaceNode'](_0x32da9a,_0x480d44);}}else{if(Ls(_0x480d44)){const _0xb429d7=Ds(_0x480d44);ms('data-id',_0xb429d7,_0x537023)||this['_touchedNodesState']['removedIds']['push'](_0xb429d7);}}}}}for(const _0x2883ba of this['_touchedNodesState']['removedIds']){const _0x42f541=ms('data-id',_0x2883ba,_0x2bef18);_0x42f541&&(this['_rescueUnwrappedElements'](_0x42f541),this['_removeNode'](_0x42f541,_0x2883ba,_0x4cbebc));}if(Es('data-id','new-element',_0x2bef18)['forEach'](_0x517751=>{const _0xc14735=this['_getUid'](_0x517751);fs(_0x517751,'data-id',_0xc14735),this['_touchedNodesState']['newIds']['push'](_0xc14735);}),this['_removeSpecialComments'](_0x2bef18),_0x4cbebc&&_0x4cbebc['cutAfterUnstable']){const _0x3b3005=this['_findLastConfirmationPoint'](_0x4a53d8),_0x28649a=this['_getLastStableElement'](_0x2bef18,_0x3b3005);this['_markUnstableElements'](_0x2bef18,_0x28649a);}if(this['_processWrappedElements'](_0x2bef18,_0x4cbebc),_0x4cbebc&&_0x4cbebc['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0xde08d9=Es('data-id',this['_touchedNodesState']['lastTouchedId'],_0x2bef18);let _0x10a45b=_0xde08d9[_0xde08d9['length']-0x1];for(;_0x10a45b;)vs(_0x10a45b),_0x10a45b=_0x10a45b['parentNode'];}return{'parsedContent':_0x2bef18,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x1841a3,_0x343bd8,_0x1c509b){for(const _0x2dc7bf of _0x343bd8){const _0x226130=this['_getUid'](_0x2dc7bf);fs(_0x2dc7bf,'data-id',_0x226130),this['_touchedNodesState']['newIds']['push'](_0x226130),this['_touchedNodesState']['lastTouchedId']=_0x226130;}const _0x1bdc04='afterbegin'===_0x1c509b||'afterend'===_0x1c509b?_0x343bd8['reverse']():_0x343bd8;for(const _0x5cc54a of _0x1bdc04)bs(_0x1841a3,_0x5cc54a,_0x1c509b);}['_replaceNode'](_0x51e7c1,_0x395ca1){if(!_0x51e7c1)return;if(_0x496615=_0x395ca1,Rs(ps(_0x51e7c1))===Rs(ps(_0x496615)))return;var _0x496615;const _0x1b5d8a=Cs(_0x51e7c1,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x1b5d8a),this['_touchedNodesState']['lastTouchedId']=_0x1b5d8a,_0x4cf7f1(_0x51e7c1,_0x395ca1['cloneNode'](!0x0));}['_removeNode'](_0x24b94f,_0x14ebc1,_0x2b61a1){if(_0x2b61a1&&_0x2b61a1['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x14ebc1;const _0x26d1d7=_0x2b61a1['replaceRemovedWith']['cloneNode'](!0x0);fs(_0x26d1d7,'data-id',_0x14ebc1),fs(_0x26d1d7,'data-removed','true'),_0x4cf7f1(_0x24b94f,_0x26d1d7);}else _0x46f92a(_0x24b94f);}['_findReferenceNode'](_0x5aaaac,_0x13c838,_0x2fe983){const _0x2e3eca=this['_findPrevElementWithDataId'](_0x5aaaac,!0x1);if(_0x2e3eca){const _0x3e2420=Ds(_0x2e3eca),_0xeeffe9=ms('data-id',_0x3e2420,_0x2fe983);if(_0xeeffe9)return[_0xeeffe9,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x3e2420);}const _0xee8b44=this['_findNextElementWithDataId'](_0x5aaaac,!0x1);if(_0xee8b44){const _0x32ef70=Ds(_0xee8b44),_0x3c899d=ms('data-id',_0x32ef70,_0x2fe983);if(_0x3c899d)return[_0x3c899d,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x32ef70);}return _0x13c838?_0x5aaaac['nextSibling']?this['_findFallbackReferenceNode'](_0x5aaaac,_0x2fe983):[_0x2fe983['childNodes'][_0x2fe983['childNodes']['length']-0x1],'afterend']:[_0x2fe983['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x383f3c,_0x324ff9){const _0x126be1=[],_0x4307cc=this['_findPrevElementWithDataId'](_0x383f3c,!0x0);if(_0x4307cc){const _0x4f6df5=ms('data-id',Ds(_0x4307cc),_0x324ff9);_0x4f6df5&&_0x126be1['push']([_0x4f6df5,'afterend']);}const _0xce9e9d=this['_findNextElementWithDataId'](_0x383f3c,!0x0);if(_0xce9e9d){const _0xe61249=ms('data-id',Ds(_0xce9e9d),_0x324ff9);_0xe61249&&_0x126be1['push']([_0xe61249,'beforebegin']);}return _0x126be1['length']>0x1?Os(_0x126be1[0x0][0x0])<=Os(_0x126be1[0x1][0x0])?_0x126be1[0x0]:_0x126be1[0x1]:0x1===_0x126be1['length']?_0x126be1[0x0]:[_0x324ff9['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x3a7f18,_0x20c9c7){let _0x529365=_0x3a7f18['nextSibling'],_0x255789=null,_0x136a50=!0x1;for(;_0x529365;){if(_0x3bd54b(_0x529365)){if(Ls(_0x529365)&&(_0x255789=_0x529365),this['_isExistingContentComment'](_0x529365)&&_0x20c9c7&&!_0x136a50){_0x136a50=!0x0,_0x529365=_0x529365['nextSibling'];continue;}break;}const _0x5a2cab=Cs(_0x529365,'data-id');if(_0x5a2cab&&'new-element'!==_0x5a2cab&&this['_existingDataIds']['has'](_0x5a2cab)){_0x255789=_0x529365;break;}_0x529365=_0x529365['nextSibling'];}return _0x255789;}['_findPrevElementWithDataId'](_0x1d368c,_0x8ffaa4){let _0x1596b9=_0x1d368c['previousSibling'],_0x5695bb=null,_0x49a084=!0x1;for(;_0x1596b9;){if(_0x3bd54b(_0x1596b9)){if(Ls(_0x1596b9)&&(_0x5695bb=_0x1596b9),this['_isExistingContentComment'](_0x1596b9)&&_0x8ffaa4&&!_0x49a084){_0x49a084=!0x0,_0x1596b9=_0x1596b9['previousSibling'];continue;}break;}const _0x464749=Cs(_0x1596b9,'data-id');if(_0x464749&&'new-element'!==_0x464749&&this['_existingDataIds']['has'](_0x464749)){_0x5695bb=_0x1596b9;break;}_0x1596b9=_0x1596b9['previousSibling'];}return _0x5695bb;}['_markWrappedElements'](_0x38e23a){_0x314fbd(_0x38e23a)&&Es('data-id',null,_0x38e23a)['forEach'](_0xc7af21=>{this['_isExistingNode'](_0xc7af21)&&(fs(_0xc7af21,'data-wrapped-id',Cs(_0xc7af21,'data-id')),fs(_0xc7af21,'data-id',null));});}['_processWrappedElements'](_0x186bd,_0x45bbf9){Es('data-wrapped-id',null,_0x186bd)['forEach'](_0x3f647e=>{const _0x49bac3=Cs(_0x3f647e,'data-wrapped-id');if(this['_hasUnstableParent'](_0x3f647e))return;const _0x552669=ms('data-id',_0x49bac3,_0x186bd);fs(_0x3f647e,'data-id',_0x49bac3),_0x552669&&(this['_removeNode'](_0x552669,_0x49bac3,_0x45bbf9),this['_touchedNodesState']['removedIds']['push'](_0x49bac3),this['_touchedNodesState']['lastTouchedId']=_0x49bac3);});}['_hasUnstableParent'](_0x8622c8){let _0x2d46a3=_0x8622c8['parentNode'];for(;_0x2d46a3;){if(Cs(_0x2d46a3,'data-unstable'))return!0x0;_0x2d46a3=_0x2d46a3['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x221073){const _0x3c2322=new Set(this['_touchedNodesState']['removedIds']),_0x50052d=new Set(this['_touchedNodesState']['newIds']);Es('data-id',null,_0x221073)['forEach'](_0x564695=>{const _0x40a7c9=Cs(_0x564695,'data-id'),_0x17923f=!!_0x40a7c9&&this['_referencedExistingIds']['has'](_0x40a7c9),_0x47b71f=!!_0x40a7c9&&_0x50052d['has'](_0x40a7c9);if(!_0x40a7c9||!_0x17923f&&!_0x47b71f)return;if(_0x3c2322['has'](_0x40a7c9))return;let _0x2bf7e0=_0x564695['parentNode'],_0x1fe7db=!0x1;for(;_0x2bf7e0;){if(_0x2bf7e0===_0x221073){_0x1fe7db=!0x0;break;}const _0x2bb944=Cs(_0x2bf7e0,'data-id');if(_0x2bb944&&(this['_referencedExistingIds']['has'](_0x2bb944)||_0x50052d['has'](_0x2bb944)))return;_0x2bf7e0=_0x2bf7e0['parentNode'];}if(_0x1fe7db){if(_0x28f757(_0x221073,_0x564695),_0x17923f){const _0x48ff49=this['_generateUid'](),_0x4581a8=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x40a7c9);-0x1!==_0x4581a8&&this['_touchedNodesState']['modifiedIds']['splice'](_0x4581a8,0x1),fs(_0x564695,'data-unwrapped-id',_0x40a7c9),fs(_0x564695,'data-id',_0x48ff49),this['_touchedNodesState']['newIds']['push'](_0x48ff49),this['_touchedNodesState']['rescuedNewIds']['add'](_0x48ff49),this['_touchedNodesState']['lastTouchedId']=_0x48ff49;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x40a7c9),this['_touchedNodesState']['lastTouchedId']=_0x40a7c9;}});}['_getUid'](_0x437c5f){return this['_isExistingNode'](_0x437c5f)?Cs(_0x437c5f,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x4f8a13){ws(_0x4f8a13)['filter'](_0x170823=>Ls(_0x170823)||this['_isExistingContentComment'](_0x170823))['forEach'](_0x161a4e=>{_0x46f92a(_0x161a4e);});}['_findLastConfirmationPoint'](_0xd4376e){let _0x489370=null,_0x4718a1=null,_0xf5c278=null,_0x431c27=null;const _0x384fbc=_0xdc5000=>{_0xdc5000&&(_0x489370=_0xdc5000),_0xf5c278=null,_0x431c27=null;};for(let _0x49776a=0x0;_0x49776a<_0xd4376e['length'];_0x49776a++){const _0x5a9d5c=_0xd4376e[_0x49776a];if(this['_isExistingContentComment'](_0x5a9d5c)){_0x384fbc(_0x4718a1);continue;}if(_0x314fbd(_0x5a9d5c)){const _0x23a795=Cs(_0x5a9d5c,'data-id'),_0x62ee8a=_0x49776a===_0xd4376e['length']-0x1;if(_0x23a795&&'new-element'!==_0x23a795&&this['_touchedNodesState']['modifiedIds']['includes'](_0x23a795)&&!_0x62ee8a){_0x384fbc(_0x23a795),_0x4718a1=_0x23a795;continue;}}let _0x4a588c=null;const _0x5aeac5=Ds(_0x5a9d5c);if(_0x5aeac5&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x5aeac5))_0x4718a1=_0x5aeac5;else{if(_0x5aeac5&&this['_touchedNodesState']['newIds']['includes'](_0x5aeac5))_0x4a588c='N';else{if(!Ls(_0x5a9d5c))continue;_0x4a588c='R';}_0x4a588c===_0x431c27||null===_0x431c27?_0x431c27=_0x4a588c:null!==_0xf5c278?(_0x384fbc(_0x4718a1),_0x431c27=_0x4a588c):(_0xf5c278=_0x431c27,_0x431c27=_0x4a588c),_0x4718a1=_0x5aeac5;}}const _0x5cedff=_0xd4376e[_0xd4376e['length']-0x1];return _0x5cedff&&!_0x314fbd(_0x5cedff)&&!Ls(_0x5cedff)&&_0x4718a1&&_0x384fbc(_0x4718a1),_0x489370;}['_getLastStableElement'](_0x2da736,_0x9ae7c7){if(!_0x9ae7c7)return null;const _0x577d92=ms('data-id',_0x9ae7c7,_0x2da736);if(!_0x577d92)return null;const _0x5e4e02=[_0x577d92,...Ss(_0x577d92)]['at'](-0x2);if(_0x5e4e02===_0x577d92)return _0x577d92;let _0x555d29=_0x5e4e02['previousSibling'];for(;_0x555d29&&!_0x314fbd(_0x555d29);)_0x555d29=_0x555d29['previousSibling'];return _0x555d29;}['_markUnstableElements'](_0x494b0b,_0x5218e8){const _0x365a6c=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x593ca1=_0x5218e8?_0x5218e8['nextSibling']:_0x494b0b['firstChild'];for(;_0x593ca1;)_0x314fbd(_0x593ca1)&&(_0x365a6c['has'](Cs(_0x593ca1,'data-id'))||Es('data-id',null,_0x593ca1)['some'](_0x3068b5=>_0x365a6c['has'](Cs(_0x3068b5,'data-id'))))&&fs(_0x593ca1,'data-unstable','true'),_0x593ca1=_0x593ca1['nextSibling'];}['_isNewNode'](_0x143eff){return Boolean('new-element'===Cs(_0x143eff,'data-id'));}['_isExistingNode'](_0x266a92){return Boolean((Cs(_0x266a92,'data-id')||'')['length']>0x0&&'new-element'!==Cs(_0x266a92,'data-id'));}['_isExistingContentComment'](_0x1e0114){return Boolean(_0x3bd54b(_0x1e0114)&&ps(_0x1e0114)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ls(_0x442b44){return!!_0x442b44&&Boolean(_0x3bd54b(_0x442b44)&&ps(_0x442b44)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ds(_0x50f04c){if(!_0x50f04c)return null;if(_0x314fbd(_0x50f04c))return Cs(_0x50f04c,'data-id')??null;if(_0x3bd54b(_0x50f04c)){const _0x24106a=ps(_0x50f04c)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x24106a&&_0x24106a[0x1])return _0x24106a[0x1];}return null;}function Ps(_0x1c0424,_0x207f28){const _0x315a37=new Map();for(const _0x3727c5 of Ts(_0x1c0424))_0x315a37['set'](Cs(_0x3727c5,'data-id'),_0x3727c5);const _0x47a48d=new Set();for(const _0x33b69d of Ts(_0x207f28)){const _0x287023=Cs(_0x33b69d,'data-id'),_0x31c511=_0x287023?_0x315a37['get'](_0x287023):void 0x0;_0x31c511?(_0x4cf7f1(_0x33b69d,_0x2c8968(_0x31c511,!0x0)),_0x47a48d['add'](_0x287023)):_0x46f92a(_0x33b69d);}for(const _0x4b52b5 of ws(_0x207f28))Ls(_0x4b52b5)&&_0x315a37['has'](Ds(_0x4b52b5))&&_0x46f92a(_0x4b52b5);const _0x54ba4c=new Set(Es('data-id',null,_0x207f28)['map'](_0x57f9f8=>Cs(_0x57f9f8,'data-id')));for(const [_0x179590,_0x4ec859]of _0x315a37){if(_0x47a48d['has'](_0x179590))continue;let _0x13a092=_0x4ec859['parent'],_0x5ea230=null;for(;_0x13a092&&_0x314fbd(_0x13a092);){const _0x15081c=Cs(_0x13a092,'data-id');if(_0x15081c&&_0x54ba4c['has'](_0x15081c)){_0x5ea230=_0x15081c;break;}_0x13a092=_0x13a092['parent'];}if(!_0x5ea230)continue;const _0x378228=ms('data-id',_0x5ea230,_0x207f28);_0x378228&&_0x18873b(_0x378228,_0x2c8968(_0x4ec859,!0x0));}}const Hs=/* #__PURE__ -- @preserve */
26
- _t();var Ms=class extends Hs{['_m2html'];constructor(){super();const _0x310f87=Object['entries'](_0x340a16),_0x56d048=_0x310f87['findIndex'](([_0x38023a])=>'rehypeDomRaw'===_0x38023a);if(-0x1===_0x56d048)throw new at('ai-response-parser-unable-to-set-up-parser');_0x310f87['splice'](_0x56d048+0x1,0x0,['rehypeSanitize',_0x28237c]),this['_m2html']=new _0x48adef({'plugins':Object['fromEntries'](_0x310f87)});}['convertMarkdownToHTML'](_0x323c0b){const _0x42fc59=this['_m2html']['parse'](_0x323c0b);return this['parseAndNormalizeHTML'](_0x42fc59);}['parseAndNormalizeHTML'](_0x21d09e){return this['_parseHTML'](_0x21d09e);}['_parseHTML'](_0x1b864b){const _0x5ea8ea=Is('<dummy>'+_0x1b864b['replace'](/<[^>]*?$/g,'')+'</dummy>');return Vs(_0x5ea8ea),_0x5ea8ea['children']=_0x5ea8ea['children'][0x0]['children'],_0x5ea8ea;}};function Vs(_0x70c7fa){for(const _0x572777 of _0x70c7fa['children'])_0x314fbd(_0x572777)?'pre'!==_0x572777['name']&&Vs(_0x572777):_0x238b68(_0x572777)&&(_0x572777['data']=_0x572777['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Us({changeGroups:_0xde1d61,documentContextContent:_0x187c97,showDiff:_0x25308a,trimUnchanged:_0x2231b4=!0x0}){return _0xde1d61['map'](_0x45cf9b=>{if(!_0x45cf9b['editor']||'destroyed'===_0x45cf9b['editor']['state'])return null;const _0x391234=new _0x428e8a([]),_0x21290e=new _0x428e8a([]),_0x4e30ca=new Set();for(const _0x4b3916 of _0x45cf9b['changes'])'new'==_0x4b3916['type']&&Es('data-id',null,_0x4b3916['node'])['forEach'](_0x3e5261=>{_0x4e30ca['add'](Cs(_0x3e5261,'data-id'));});for(const _0x2d92c2 of _0x45cf9b['changes'])if('removed'!=_0x2d92c2['type']?_0x21290e['children']['push'](_0x2d92c2['node']['cloneNode'](!0x0)):_0x25308a||_0x4e30ca['has'](_0x2d92c2['id'])||_0x21290e['children']['push'](_0x2d92c2['node']['cloneNode'](!0x0)),'new'!=_0x2d92c2['type']&&(_0x25308a||'removed'!=_0x2d92c2['type'])){const _0x1208f0=_0x103707(_0x415809=>Cs(_0x415809,'data-id')==_0x2d92c2['id'],_0x187c97['get'](_0x45cf9b['documentId']),!0x0);_0x1208f0&&_0x391234['children']['push'](_0x1208f0['cloneNode'](!0x0));}const {content:_0x4d75c8,hasChanges:_0x547823}=Bs(_0x45cf9b['editor'],_0x391234,_0x21290e,_0x25308a,_0x2231b4);return{'type':_0x45cf9b['changes'][0x0]['type'],'index':_0x45cf9b['index'],'content':_0x4d75c8,'hasChanges':_0x547823};})['filter'](_0x24d3d9=>null!==_0x24d3d9);}function Bs(_0x43c9cb,_0x11d34b,_0x1ea2c2,_0x49dfc7,_0x23a8c8=!0x0){const _0x3e3cc8=_0x43c9cb['plugins']['get']('DocumentCompare'),_0x531c4a=ps(_0x11d34b),_0x3aa37a=ps(_0x1ea2c2),_0x5a192a=_0x43c9cb['data']['parse'](_0x531c4a,'$root'),_0x162bd5=_0x43c9cb['model']['createPositionAt'](_0x5a192a,0x0),_0x8684e7=_0x3e3cc8['getDiff'](_0x531c4a,_0x3aa37a,{'anchor':_0x162bd5,'markDeletions':_0x49dfc7,'targetEditor':_0x43c9cb})['getOperations']();if(0x0==_0x8684e7['length'])return{'content':_0x11d34b['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x49dfc7?function(_0x2b977c,_0x27e958,_0x300c6b){if(0x0==_0x2b977c['length'])return;const _0x1a426b=_0x300c6b['plugins']['get']('DocumentCompare'),_0x5d7009=_0x300c6b['plugins']['get']('SuggestionsConversion');_0x300c6b['model']['change'](_0x4aa21a=>{const _0x486cd9=new Set();for(let _0x1ee79f=0x0;_0x1ee79f<_0x2b977c['length'];_0x1ee79f++){const _0x559ed1=_0x2b977c[_0x1ee79f];if(_0x559ed1['baseVersion']=null,_0x559ed1['isDocumentOperation']=!0x1,_0x1a426b['isMarkedRemoveOperation'](_0x559ed1)){const _0x202b22=_0x5f13c7(_0x559ed1['newRange'],_0x300c6b['model']),_0x425583='suggestion:deletion:'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x425583,_0x202b22);}else switch(_0x559ed1['type']){case'rename':{if(_0x559ed1['oldName']==_0x559ed1['newName'])break;_0x4aa21a['batch']['addOperation'](_0x559ed1),_0x300c6b['model']['applyOperation'](_0x559ed1);const _0x579acb='$elementName',_0x450466=_0x559ed1['position'],_0x47d4b8=_0x300c6b['model']['createRange'](_0x450466,_0x300c6b['model']['createPositionAt'](_0x450466['nodeAfter'],'end')),_0x27baec='suggestion:attribute:'+_0x579acb+':'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x27baec,_0x47d4b8);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x559ed1['oldValue']==_0x559ed1['newValue'])break;_0x4aa21a['batch']['addOperation'](_0x559ed1),_0x300c6b['model']['applyOperation'](_0x559ed1);const _0x3135ac=_0x559ed1['key'];if(!_0x5d7009['isRegisteredAttribute'](_0x3135ac))break;const _0x1309fa=_0x5f13c7(_0x559ed1['range'],_0x300c6b['model']),_0x4e89ad='suggestion:attribute:'+_0x3135ac+':'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x4e89ad,_0x1309fa);break;}case'insert':{if(_0x4aa21a['batch']['addOperation'](_0x559ed1),_0x300c6b['model']['applyOperation'](_0x559ed1),Gs(_0x27e958,_0x559ed1),_0x2b977c[_0x1ee79f+0x1]&&'move'==_0x2b977c[_0x1ee79f+0x1]['type'])break;const _0x221d61=_0x559ed1['position'],_0x256a7a=_0x559ed1['howMany'],_0x5832a4=_0x5f13c7(_0x300c6b['model']['createRange'](_0x221d61,_0x221d61['getShiftedBy'](_0x256a7a)),_0x300c6b['model']),_0x304913='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x304913,_0x5832a4);break;}case'split':{_0x4aa21a['batch']['addOperation'](_0x559ed1),_0x300c6b['model']['applyOperation'](_0x559ed1),Gs(_0x27e958,_0x559ed1);const _0xf273ea=_0x559ed1['splitPosition'],_0x2d4e48=_0x559ed1['moveTargetPosition'],_0x52e01f=_0x300c6b['model']['createRange'](_0xf273ea,_0x2d4e48),_0x6da591='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x6da591,_0x52e01f);break;}case'move':{_0x4aa21a['batch']['addOperation'](_0x559ed1),_0x300c6b['model']['applyOperation'](_0x559ed1),Gs(_0x27e958,_0x559ed1);const _0x975774=_0x559ed1['getMovedRangeStart'](),_0x198079=_0x559ed1['howMany'];for(let _0x4ba41f=0x0;_0x4ba41f<_0x198079;_0x4ba41f++){const _0x5df255=_0x975774['getShiftedBy'](_0x4ba41f)['nodeAfter'];_0x486cd9['add'](_0x5df255);}break;}case'remove':{const _0x28619a=_0x559ed1['sourcePosition'],_0x22a1e2=_0x559ed1['howMany'],_0x3ed284=new _0x1bbc64(_0x28619a,_0x22a1e2);_0x4aa21a['batch']['addOperation'](_0x3ed284),_0x300c6b['model']['applyOperation'](_0x3ed284),Gs(_0x27e958,_0x559ed1);break;}}}for(const _0x48a25a of _0x486cd9){const _0x12d014=_0x300c6b['model']['createRangeOn'](_0x48a25a),_0x1260d9='suggestion:formatBlock:$fakeWrap:'+Ot()+':$aiSuggestion';_0x27e958['markers']['set'](_0x1260d9,_0x5f13c7(_0x12d014,_0x300c6b['model']));}});}(_0x8684e7,_0x5a192a,_0x43c9cb):_0x43c9cb['model']['change'](_0x289c02=>{for(const _0x48b5e6 of _0x8684e7)if('remove'==_0x48b5e6['type']){const _0x88e95e=_0x48b5e6['sourcePosition'],_0x2e7c9f=_0x48b5e6['howMany'],_0x44ad33=new _0x1bbc64(_0x88e95e,_0x2e7c9f);_0x289c02['batch']['addOperation'](_0x44ad33),_0x43c9cb['model']['applyOperation'](_0x44ad33),Gs(_0x5a192a,_0x48b5e6);}else{if('marker'==_0x48b5e6['type']){const _0x157e4b=_0x48b5e6['name'],_0x458660=_0x48b5e6['newRange'];null!==_0x458660?_0x5a192a['markers']['set'](_0x157e4b,_0x458660):_0x5a192a['markers']['delete'](_0x157e4b);}else _0x48b5e6['baseVersion']=null,_0x48b5e6['isDocumentOperation']=!0x1,_0x289c02['batch']['addOperation'](_0x48b5e6),_0x43c9cb['model']['applyOperation'](_0x48b5e6),Gs(_0x5a192a,_0x48b5e6);}}),_0x23a8c8){const _0x143e1b=Fs(_0x43c9cb,_0x8684e7,_0x5a192a);Ws(_0x43c9cb['model'],_0x143e1b),function(_0xad2ac1,_0x58a8ae){const _0x409772=_0x58a8ae['getFirstRange']()['start'];let _0x3838fe=_0x58a8ae['getFirstRange']()['end'];const _0x54fefd=_0x409772['root'];(_0x3838fe['textNode']||_0x3838fe['nodeAfter']&&_0x3838fe['nodeAfter']['is']('$text'))&&(_0x141f19(_0x3838fe,'...'),qs(_0x54fefd,_0x3838fe,0x3),_0x3838fe=_0x3838fe['getShiftedBy'](0x3)),(_0x409772['textNode']||_0x409772['nodeBefore']&&_0x409772['nodeBefore']['is']('$text'))&&(_0x141f19(_0x409772,'...'),qs(_0x54fefd,_0x409772,0x3),_0x409772['parent']==_0x3838fe['parent']&&(_0x3838fe=_0x3838fe['getShiftedBy'](0x3)));const _0x2cf53a=_0xad2ac1['createRange'](_0xad2ac1['createPositionAt'](_0x54fefd,0x0),_0x409772),_0x29aade=_0xad2ac1['createRange'](_0x3838fe,_0xad2ac1['createPositionAt'](_0x54fefd,'end')),_0x1f2c36=[..._0x2cf53a['getMinimalFlatRanges'](),..._0x29aade['getMinimalFlatRanges']()];_0x1f2c36['reverse']();for(const _0x1db356 of _0x1f2c36)_0x2ce61c(_0x1db356),$s(_0x54fefd,_0x1db356);}(_0x43c9cb['model'],_0x143e1b);}return{'content':Is(_0x43c9cb['data']['stringify'](_0x5a192a,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Gs(_0xadd55b,_0x58f9b8){for(const [_0x1d252a,_0x56fd17]of _0xadd55b['markers']){const _0x4b3fed=_0x5cca78['_createFromRanges'](_0x56fd17['getTransformedByOperation'](_0x58f9b8));_0x4b3fed['root']==_0xadd55b?_0xadd55b['markers']['set'](_0x1d252a,_0x4b3fed):_0xadd55b['markers']['delete'](_0x1d252a);}}function Fs(_0x4259a3,_0x530678,_0x334b0c){const _0x22b8cb=_0x4259a3['plugins']['get']('DocumentCompare');let _0x7be47b=_0x4259a3['model']['createPositionAt'](_0x334b0c,Number['POSITIVE_INFINITY']),_0x2fd090=_0x4259a3['model']['createPositionAt'](_0x334b0c,0x0);for(const _0x38e777 of _0x530678){let _0x49c314,_0x24924a;if(_0x22b8cb['isMarkedRemoveOperation'](_0x38e777))_0x49c314=_0x38e777['newRange']['start'],_0x24924a=_0x38e777['newRange']['end'];else switch(_0x7be47b=Ks(_0x7be47b,_0x38e777),_0x2fd090=Ks(_0x2fd090,_0x38e777),_0x38e777['type']){case'rename':_0x49c314=_0x38e777['position'],_0x24924a=_0x49c314['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x49c314=_0x38e777['range']['start'],_0x24924a=_0x38e777['range']['end'];break;case'insert':_0x49c314=_0x38e777['position'],_0x24924a=_0x49c314['getShiftedBy'](_0x38e777['howMany']);break;case'split':_0x49c314=_0x38e777['splitPosition'],_0x24924a=_0x38e777['moveTargetPosition'];break;case'merge':{const _0x4e094e=_0x38e777['targetPosition']['path']['slice'](0x0,-0x1);_0x49c314=_0x4259a3['model']['createPositionFromPath'](_0x334b0c,_0x4e094e),_0x24924a=_0x49c314['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x55412e=_0x38e777['howMany'],_0xf83112=_0x38e777['sourcePosition']['_getTransformedByInsertion'](_0x38e777['targetPosition'],_0x55412e),_0x32515e=_0x38e777['getMovedRangeStart']();'remove'==_0x38e777['type']?(_0x49c314=_0xf83112,_0x24924a=_0xf83112):(_0x49c314=_0x32515e,_0x24924a=_0x32515e['getShiftedBy'](_0x55412e));break;}}_0x49c314&&_0x49c314['isBefore'](_0x7be47b)&&(_0x7be47b=_0x49c314['clone'](),_0x7be47b['stickiness']='toNone'),_0x24924a&&_0x24924a['isAfter'](_0x2fd090)&&(_0x2fd090=_0x24924a['clone'](),_0x2fd090['stickiness']='toNone');}return _0x4259a3['model']['createSelection'](_0x4259a3['model']['createRange'](_0x7be47b,_0x2fd090));}function Ks(_0x358c50,_0x2c4b22){return'move'!=_0x2c4b22['type']&&'remove'!=_0x2c4b22['type']||_0x2c4b22['sourceRange']['containsPosition'](_0x358c50)&&((_0x358c50=_0x2c4b22['sourcePosition']['clone']())['stickiness']='toNone'),_0x358c50['getTransformedByOperation'](_0x2c4b22);}function Ws(_0x41781c,_0x42300b){Ys(_0x41781c,_0x42300b,'forward');const _0x1c1aff=_0x42300b['getFirstRange']();_0x42300b['setTo']([]),_0x42300b['setTo'](_0x1c1aff,{'backward':!0x0}),Ys(_0x41781c,_0x42300b,'backward');}function Ys(_0x2ef66e,_0x223313,_0x1d334f){let _0x2dd877=0x14;for(;_0x2dd877;){_0x2ef66e['modifySelection'](_0x223313,{'unit':'word','direction':_0x1d334f}),_0x2dd877--;const _0x269526=_0x223313['focus']['forward'==_0x1d334f?'nodeBefore':'nodeAfter'];if(_0x269526&&_0x269526['is']('element')&&_0x2ef66e['schema']['isBlock'](_0x269526)&&_0x2ef66e['schema']['isObject'](_0x269526))break;}}function $s(_0x592143,_0x13f3ba){for(const [_0x390e09,_0x3604d8]of _0x592143['markers']){const _0x5d107d=_0x3604d8['_getTransformedByDeletion'](_0x13f3ba['start'],_0x13f3ba['end']['offset']-_0x13f3ba['start']['offset']);null!=_0x5d107d?_0x592143['markers']['set'](_0x390e09,_0x5d107d):_0x592143['markers']['delete'](_0x390e09);}}function qs(_0x52c86d,_0x2770ff,_0x1139e2){for(let [_0x12a260,_0x2044f5]of _0x52c86d['markers'])_0x2044f5=_0x2044f5['_getTransformedByInsertion'](_0x2770ff,_0x1139e2,!0x1)[0x0],_0x52c86d['markers']['set'](_0x12a260,_0x2044f5);}const Qs=/* #__PURE__ -- @preserve */
27
- lt();var Xs=class extends Qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x5d6a55,config:_0x1da16b,locale:_0x28954e}){super(),this['_connector']=_0x5d6a55,this['_config']=_0x1da16b,this['_locale']=_0x28954e;}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 _0x2b8ce3=await this['getAll']();let _0x779599;return _0x779599=this['_availableModels']?this['_filterModels'](_0x2b8ce3,this['_availableModels']):_0x2b8ce3['filter'](_0x384821=>_0x384821['recommended']),_0x779599;}async['getModel'](_0x4b4d0b){const _0x4496ff=await this['getAll']();if(!_0x4496ff['length'])return null;if(_0x4b4d0b){const _0x1bbed3=this['_getModelById'](_0x4496ff,_0x4b4d0b);if(_0x1bbed3)return _0x1bbed3;ft('ai-chat-model-id-unrecognized',{'modelId':_0x4b4d0b,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x27c07a=await this['getAvailableModels']();if(!_0x27c07a['length'])return null;if(this['_defaultModelId']){const _0x9d8367=this['_getModelById'](_0x27c07a,this['_defaultModelId']);if(_0x9d8367)return _0x9d8367;ft('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x27c07a[0x0]['id']});}return _0x27c07a[0x0];}async['isAvailable'](_0x5d5fcf){return(await this['getAvailableModels']())['some'](_0x323535=>_0x323535['name']===_0x5d5fcf['name']&&_0x323535['provider']===_0x5d5fcf['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x79d855=this['_locale']['uiLanguage']||'en',_0x46dc0d=await this['_connector']['getModels'](_0x79d855)['list']();this['_modelList']=_0x46dc0d['items']['map'](_0x528435=>zs(_0x528435)?{..._0x528435,'name':ls(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x528435);}return[...this['_modelList']];}['_filterModels'](_0x395d93,_0x259f9a){let _0x3b6451;if(_0x259f9a){_0x3b6451=[];const _0x1bdc67=new Set(),_0x480ede='string'==typeof _0x259f9a?[_0x259f9a['toLocaleLowerCase']()]:_0x259f9a['map'](_0x203c65=>_0x203c65['toLocaleLowerCase']());for(const _0x3ff362 of _0x480ede)for(const _0x381c68 of _0x395d93)!_0x1bdc67['has'](_0x381c68['id'])&&this['_isMatchingFilter'](_0x381c68,_0x3ff362)&&(_0x3b6451['push'](_0x381c68),_0x1bdc67['add'](_0x381c68['id']));}else _0x3b6451=_0x395d93;return _0x3b6451;}['_isMatchingFilter'](_0x3b6202,_0x1794d6){const _0x26ed12=_0x3b6202['id']['toLocaleLowerCase'](),_0x1d1c1b=_0x3b6202['name']['toLocaleLowerCase'](),_0x22bad4=_0x3b6202['provider']['toLocaleLowerCase']();return _0x26ed12===_0x1794d6||_0x1d1c1b===_0x1794d6||zs(_0x3b6202)&&'auto'===_0x1794d6||_0x22bad4===_0x1794d6||_0x26ed12['startsWith'](_0x1794d6);}['_getModelById'](_0x372840,_0x187470){return _0x372840['find'](_0x1e0ded=>zs(_0x1e0ded)&&'auto'===_0x187470?_0x1e0ded:_0x1e0ded['id']===_0x187470)||null;}};function zs(_0x145e96){return _0x145e96['id']['startsWith']('agent');}function js(_0x4959dc,_0x1cac83){for(const _0x594cc4 of _0x4959dc)'noop'!==_0x594cc4['type']&&(_0x594cc4['_aiSource']=_0x1cac83);}var Js=class extends _0x3abc0e{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x3ea65d];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Xs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x29341e,_0x152505){if('completed'!==_0x29341e['status'])throw new at('ai-gateway-apply-invalid-status',this,{'status':_0x29341e['status']});const _0x2e5b6b=_0x29341e['editor'],{applyMethod:_0xc1b850}=_0x152505;if('suggest'===_0xc1b850&&!_0x2e5b6b['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',this);const _0x584cb9='suggest'===_0xc1b850,_0x14f9c0=this['context']['plugins']['get'](_0x3ea65d),_0x7fb009=_0x2e5b6b['model']['createPositionAt'](_0x2e5b6b['model']['document']['getRoot'](),0x0),_0x185086=_0x14f9c0['getDiff'](_0x29341e['contentRawOld'],_0x29341e['contentRawNew'],{'anchor':_0x7fb009,'markDeletions':_0x584cb9,'targetEditor':_0x2e5b6b}),_0x33b67b=_0x2e5b6b['model']['document']['history']['getOperations'](_0x29341e['documentVersion']),_0x4a13e7={'document':_0x2e5b6b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x323613=_0x1790d4(_0x185086['getOperations'](),_0x33b67b,_0x4a13e7)['operationsA'];js(_0x323613,_0x152505['aiSource']??'api'),_0x2e5b6b['model']['change'](_0x38c22c=>{if(_0x584cb9)_0x2e5b6b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x323613);else{for(const _0x38614d of _0x323613)_0x38614d['baseVersion']=_0x2e5b6b['model']['document']['version'],Ns(_0x2e5b6b,_0x38614d),_0x38c22c['batch']['addOperation'](_0x38614d),_0x2e5b6b['model']['applyOperation'](_0x38614d);}});}['mergeChangesIntoContent'](_0x3d3126,_0x1015b4,_0x3e2054){const _0x42f5de=new Ms(),_0x29eff4=new xs();let _0x34b9d1=_0x42f5de['parseAndNormalizeHTML'](_0x1015b4);for(const _0xd6fc1d of _0x3d3126)try{const _0x2fdd54=_0x42f5de['parseAndNormalizeHTML'](_0xd6fc1d['content']);_0x34b9d1=_0x29eff4['merge'](_0x2fdd54,_0x34b9d1,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x4a109c){throw new at('ai-gateway-merge-failed',this,{..._0xd6fc1d},_0x4a109c);}return Bs(_0x3e2054,_0x42f5de['parseAndNormalizeHTML'](_0x1015b4),_0x34b9d1,!0x1,!0x1)['content'];}},Zs=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x517e02){this['_editor']=_0x517e02['editor'],this['_rootName']=_0x517e02['rootName'],this['_channelId']=_0x517e02['channelId'],this['_sessionId']=_0x517e02['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'](_0x237697){this['_documentVersion']=_0x237697;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x29098b){this['_contentRawOld']=_0x29098b;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x1108ab){this['_contentRawNew']=_0x1108ab;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x124cf4){this['_error']=_0x124cf4;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0xa8bbd5){return _0xa8bbd5['replace'](/ data-id="[a-z0-9]+"/g,'');}},tn=class extends Zs{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x553bd7){this['_summary']=_0x553bd7;}},en=class extends _0x3abc0e{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x5624b2,_0x164887){if(!_0x5624b2)throw new at('ai-documentprocessinggateway-missing-prompt',this);const _0x391ea2=await this['context']['plugins']['get'](As)['getDocumentData']();if(!_0x391ea2[0x0])throw new at('ai-documentprocessinggateway-missing-document',this);const _0x3eae55=new tn({'editor':_0x391ea2[0x0]['editor'],'rootName':_0x391ea2[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x391ea2[0x0]['sessionId']});if(_0x3eae55['contentRawOld']=_0x391ea2[0x0]['content'],_0x3eae55['documentVersion']=_0x391ea2[0x0]['version'],_0x164887?.['signal']?.['aborted'])return _0x3eae55['abort'](),_0x3eae55;const _0x27cbde=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x3eae55['contentRawOld'],'prompt':_0x5624b2,'model':_0x164887['model']});let _0x529382;if(_0x164887?.['signal']){if(_0x164887['signal']['aborted'])return _0x27cbde['abortController']['abort'](),_0x3eae55['abort'](),_0x3eae55;const _0x3f1898=_0x164887['signal'],_0x10a75f=()=>_0x27cbde['abortController']['abort']();_0x3f1898['addEventListener']('abort',_0x10a75f),_0x529382=()=>_0x3f1898['removeEventListener']('abort',_0x10a75f);}try{const _0x33d054=await _0x27cbde['getResult']();if(!(_0x33d054&&_0x33d054['document']&&_0x33d054['document']['length']>0x0))throw new at('ai-documentprocessinggateway-empty-reply',this);_0x3eae55['contentRawNew']=_0x33d054['document'],_0x3eae55['summary']=_0x33d054['summary']||'';}catch(_0x2a7f8e){_0x2a7f8e instanceof Error&&_0x2a7f8e['message']['includes']('ai-request-aborted')?_0x3eae55['abort']():_0x3eae55['error']=_0x2a7f8e instanceof at?_0x2a7f8e:new at('ai-documentprocessinggateway-run-failed',this,{},_0x2a7f8e);}finally{_0x529382&&_0x529382();}return _0x3eae55;}['applyResult'](_0x9143e6,_0x339e77){this['context']['plugins']['get']('AIGateway')['apply'](_0x9143e6,_0x339e77);}};function sn(_0x1d0c4a){return _0x1d0c4a instanceof Error&&('AbortError'===_0x1d0c4a['name']||('AICoreError'===_0x1d0c4a['name']?!0x0===_0x1d0c4a['isAbort']:_0x1d0c4a['message']['startsWith']('ai-request-aborted')));}var nn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x11073f){super(_0x11073f['code'],_0x11073f['cause']instanceof Error?{'cause':_0x11073f['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x11073f['code'],this['severity']=_0x11073f['severity']??'error',this['type']=_0x11073f['type']??'system',this['context']=_0x11073f['context'],this['isAbort']=_0x11073f['isAbort']??sn(_0x11073f['cause']);}},rn=class extends _0x3abc0e{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x2c2931){return new on(this,_0x2c2931);}},on=class{['_sink'];['_component'];constructor(_0x40ea19,_0x3ba598){this['_sink']=_0x40ea19,this['_component']=_0x3ba598;}['logError'](_0x2f0ef1,_0x19056e={}){this['_emit'](_0x2f0ef1,_0x19056e),this['_defaultLog'](_0x2f0ef1);}['reportError'](_0x5af263,_0x42c21b={}){this['_emit'](_0x5af263,_0x42c21b);}['_emit'](_0x190504,_0x2eec36){sn(_0x190504)||this['_sink']['fire']('error',{'error':_0x190504,'component':this['_component'],'context':_0x2eec36['context']});}['_defaultLog'](_0x61b1d3){if(!sn(_0x61b1d3)){if(_0x61b1d3 instanceof nn){if('user'===_0x61b1d3['type']||'network'===_0x61b1d3['type'])return;if('warning'===_0x61b1d3['severity'])return void console['warn'](this['_component'],_0x61b1d3);}console['error'](this['_component'],_0x61b1d3);}}};const an='ck-ai-button-primary',hn='ck-ai-button-secondary',cn='ck-ai-button-tertiary';function ln(_0x2e26a3,_0x24ccb1){const _0x1bf27e=new Pt(_0x2e26a3),_0xf3cc6c=ls(_0x2e26a3,'AI_TABS_LABEL_MINIMIZE'),_0x4cbdd8=ls(_0x2e26a3,'AI_TABS_LABEL_MAXIMIZE');return _0x1bf27e['set']({'withText':!0x1,'icon':_0x3b264e,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+cn}),_0x1bf27e['bind']('label')['to'](_0x24ccb1,'isMaximized',_0xbd371a=>_0xbd371a?_0xf3cc6c:_0x4cbdd8),_0x1bf27e['bind']('icon')['to'](_0x24ccb1,'isMaximized',_0x148589=>_0x148589?_0x1b8488:_0x3b264e),_0x1bf27e['bind']('isOn')['to'](_0x24ccb1,'isMaximized'),_0x1bf27e['on']('execute',()=>{_0x24ccb1['fire']('resizeTabs');}),_0x1bf27e;}function un(_0x3ed801){const _0x40c8d0=new xt(_0x3ed801);return _0x40c8d0['attachToDom'](),_0x40c8d0['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x40c8d0;}const dn=/* #__PURE__ -- @preserve */
28
- _t();var _n=class extends dn{['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:_0x558181,isDone:_0x4072fd=!0x1,isComplete:_0x27e7e7,interactionId:_0x302abd,areActionsDisabled:_0x20c74f,isFromHistory:_0xf3e358=!0x1,documentContextContent:_0x3badb8,locale:_0x36dc9a,id:_0x2091b1,channelsToEditors:_0x53de45}){super(),this['id']=_0x2091b1||Ot(),this['interactionId']=_0x302abd,this['type']=_0x558181,this['areActionsDisabled']=!!_0x20c74f,this['isFromHistory']=_0xf3e358,this['locale']=_0x36dc9a,this['aiResponseParser']=new Ms(),this['aiResponseApplier']=new xs(),this['documentContextContent']=new Map(_0x3badb8?.['map'](_0x5f13a9=>[_0x5f13a9['id'],Is(_0x5f13a9['content'])])||[]),this['_documentIdToSource']=new Map(_0x3badb8?.['map'](_0x23f325=>[_0x23f325['id'],{'editor':_0x53de45['get'](_0x23f325['channelId']),'rootName':_0x23f325['rootName']}])||[]),this['set']('isDone',_0x4072fd),this['set']('isComplete',_0x27e7e7??_0x4072fd),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x5e50d1,_0x44db2d){const _0x596caf='text'===this['type']?'text':_0x44db2d;this['content']['has'](_0x596caf)||this['content']['set'](_0x596caf,''),this['content']['set'](_0x596caf,this['content']['get'](_0x596caf)+_0x5e50d1),this['onContentChange'](_0x596caf);}['done'](_0x29764c=!0x0){this['isComplete']=_0x29764c,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x1f8ed1,_0x2f4048){this['changeGroups'][_0x1f8ed1]['state']=_0x2f4048,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x1f8ed1,'state':_0x2f4048});}['getContentParts']({showDiff:_0xae9219,groupIndex:_0x39fcea}){const _0x4ba9ab=this['_getCachedContentParts'](_0xae9219,_0x39fcea);if(_0x4ba9ab)return _0x4ba9ab;let _0x55d32c=[];if(void 0x0===_0x39fcea)_0x55d32c=this['changeGroups'];else{const _0x123d10=this['changeGroups']['find'](({index:_0x2de022})=>_0x2de022===_0x39fcea);if(!_0x123d10)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x39fcea});_0x55d32c=[_0x123d10];}const _0x428d5=Us({'showDiff':_0xae9219,'changeGroups':_0x55d32c,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0xae9219,_0x428d5),_0x428d5;}['_getCachedContentParts'](_0x1f0d35,_0x1e3f9a){const _0xd537cc=_0x1f0d35?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0xd537cc]['length'])return null;const _0x27e3cf=this['cachedSuggestionContentParts'][_0xd537cc];if(void 0x0===_0x1e3f9a)return _0x27e3cf['length']>0x0&&_0x27e3cf['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x1f0d35,null),null):_0x163ee1(_0x27e3cf);{const _0x26ae08=_0x27e3cf['find'](({index:_0x9c82aa})=>_0x9c82aa===_0x1e3f9a);if(_0x26ae08)return[_0x163ee1(_0x26ae08)];}return null;}['_setCachedContentParts'](_0x165547,_0x29f90c){const _0x4ce6af=_0x165547?'withDiff':'withoutDiff';_0x29f90c?_0x29f90c['forEach'](_0x56d598=>{const _0x53cc51=this['cachedSuggestionContentParts'][_0x4ce6af],_0x28b8a9=_0x53cc51['find'](({index:_0x120355})=>_0x120355===_0x56d598['index']);if(_0x28b8a9){const _0xc1c09b=_0x53cc51['indexOf'](_0x28b8a9);_0x53cc51['splice'](_0xc1c09b,0x1,_0x56d598);}else _0x53cc51['push'](_0x56d598);}):this['cachedSuggestionContentParts'][_0x4ce6af]['length']=0x0;}['onContentChange'](_0x3f5c72){if('modification'===this['type']){if(_0x3f5c72)this['parsedContent']['set'](_0x3f5c72,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x3f5c72)));else{for(const [_0x384ece,_0x5d13fb]of this['content'])this['parsedContent']['set'](_0x384ece,this['aiResponseParser']['parseAndNormalizeHTML'](_0x5d13fb));}const _0x120b8e=this['changeGroups'];for(const _0x365333 of this['content']['keys']())this['updateChangeGroups'](_0x365333);const _0x5a17ea=this['_getDifferentChangeGroups'](_0x120b8e,this['changeGroups']);(_0x5a17ea['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x5a17ea),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'](_0x2fbe6e,_0x4e9bd2){const _0x27b0b1=[];for(const _0x27d482 of _0x4e9bd2){const _0x3a0ee8=_0x2fbe6e[_0x27d482['index']];_0x3a0ee8?_0x3a0ee8['changes']['length']!==_0x27d482['changes']['length']?_0x27b0b1['push'](_0x27d482):_0x3a0ee8['changes']['forEach']((_0x244419,_0x5abf7f)=>{const _0x259038=_0x27d482['changes'][_0x5abf7f];_0x244419['id']!==_0x259038['id']&&_0x27b0b1['push'](_0x27d482);}):_0x27b0b1['push'](_0x27d482);}return _0x27b0b1;}['updateChangeGroups'](_0x5ce119){const _0x39e348=this['documentContextContent']['get'](_0x5ce119),_0x897f19=this['parsedContent']['get'](_0x5ce119);if(!_0x39e348||!_0x897f19)return;const _0x3458b6=new _0x11613c('p',{},[new _0x11613c('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x1b2c94(ls(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x47c2a3=this['aiResponseApplier']['merge'](_0x897f19,_0x39e348['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x3458b6});this['parsedMergedContent']['set'](_0x5ce119,_0x47c2a3['parsedContent']);let _0x2ee06b=[];if(_0x210655(_0x506f27=>{const _0x1f93e8=Cs(_0x506f27,'data-id');if(!_0x1f93e8||!_0x4fd2da(_0x1f93e8))return!0x1;const _0x5708b5=[_0x506f27,...Ss(_0x506f27)]['at'](-0x2);if(_0x506f27!=_0x5708b5){const _0x5ec00d=Cs(_0x5708b5,'data-id');_0x4fd2da(_0x5ec00d)||(_0x2ee06b['push']({'node':_0x5708b5,'id':_0x5ec00d,'type':'modified'}),_0x47c2a3['modifiedNodeIds']['push'](_0x5ec00d));}else _0x47c2a3['modifiedNodeIds']['includes'](_0x1f93e8)?_0x2ee06b['push']({'node':_0x506f27,'type':'modified','id':_0x1f93e8}):_0x47c2a3['newNodeIds']['includes'](_0x1f93e8)?_0x2ee06b['push']({'node':_0x506f27,'type':'new','id':_0x1f93e8,'anchorId':Cs(_0x506f27['previousSibling'],'data-id')}):_0x2ee06b['push']({'node':_0x506f27,'type':'removed','id':_0x1f93e8});return!0x0;},this['parsedMergedContent']['get'](_0x5ce119)),_0x2ee06b=_0x2ee06b['filter'](({node:_0xa70606})=>[...Ss(_0xa70606),_0xa70606]['every'](_0x20960f=>!Cs(_0x20960f,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x1b26d0=>_0x1b26d0['documentId']!==_0x5ce119),0x0==_0x2ee06b['length'])return;const _0x10dc99=[[_0x2ee06b[0x0]]];for(let _0x18c486=0x1;_0x18c486<_0x2ee06b['length'];_0x18c486++){const _0x1b9620=_0x10dc99[_0x10dc99['length']-0x1],_0x3dbe74=_0x1b9620[_0x1b9620['length']-0x1];_0x2ee06b[_0x18c486]['node']['previousSibling']==_0x3dbe74['node']&&'modified'!=_0x2ee06b[_0x18c486]['type']&&'modified'!=_0x3dbe74['type']?_0x1b9620['push'](_0x2ee06b[_0x18c486]):_0x10dc99['push']([_0x2ee06b[_0x18c486]]);}for(const _0x5b9112 of _0x10dc99){const _0x430f17=_0x5b9112[0x0],_0x1772d9=_0x5b9112[_0x5b9112['length']-0x1],_0x136112=_0x53e1ee(_0x430f17['node']['previousSibling']);_0x136112&&_0x5b9112['unshift'](_0x136112);const _0x823c75=_0x53e1ee(_0x1772d9['node']['nextSibling']);_0x823c75&&_0x5b9112['push'](_0x823c75);}Es('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x5ce119))['forEach'](_0x4e4e69=>{fs(_0x4e4e69,'data-wrapped-id',null);});const _0x5754c4=new Map();Es('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x5ce119))['forEach'](_0x2b4d2e=>{const _0x3fb7c2=Cs(_0x2b4d2e,'data-unwrapped-id'),_0x4b99be=Cs(_0x2b4d2e,'data-id');_0x5754c4['set'](_0x4b99be,_0x3fb7c2),fs(_0x2b4d2e,'data-id',_0x3fb7c2),fs(_0x2b4d2e,'data-unwrapped-id',null);});for(const _0x2135c1 of _0x2ee06b){const _0x23ef8c=_0x5754c4['get'](_0x2135c1['id']);_0x23ef8c&&(_0x2135c1['id']=_0x23ef8c);}this['changeGroups']['push'](..._0x10dc99['map']((_0x8836c8,_0x573df0)=>({'changes':_0x8836c8,'state':'pending','index':_0x573df0,'editor':this['_documentIdToSource']['get'](_0x5ce119)['editor'],'rootName':this['_documentIdToSource']['get'](_0x5ce119)['rootName'],'documentId':_0x5ce119})));const _0x3e4c95=Array['from'](this['documentContextContent']['keys']());function _0x4fd2da(_0x1b8346){return _0x47c2a3['modifiedNodeIds']['includes'](_0x1b8346)||_0x47c2a3['newNodeIds']['includes'](_0x1b8346)||_0x47c2a3['removedNodeIds']['includes'](_0x1b8346);}function _0x53e1ee(_0x2d315b){if(_0x2d315b&&Cs(_0x2d315b,'data-id')&&!Cs(_0x2d315b,'data-unstable')){const _0x5e1a86=Cs(_0x2d315b,'data-id');if(!_0x4fd2da(_0x5e1a86))return{'node':_0x2d315b,'type':'context','id':_0x5e1a86};}return null;}this['changeGroups']['sort']((_0x49f90d,_0x89e84a)=>_0x3e4c95['indexOf'](_0x49f90d['documentId'])-_0x3e4c95['indexOf'](_0x89e84a['documentId'])),this['changeGroups']['forEach']((_0x2a9cda,_0x42d326)=>{_0x2a9cda['index']=_0x42d326;});}};const gn=/* #__PURE__ -- @preserve */
29
- lt(),An=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var In=class extends gn{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x2d44bb,locale:_0x520a87,channelsToEditors:_0xdb9f42}){super(),this['id']=Ot(),this['connector']=_0x2d44bb,this['isStopped']=!0x0,this['locale']=_0x520a87,this['_channelsToEditors']=_0xdb9f42||new Map();}async['start'](){await this['_run']();}async['resume'](_0x53bc3c){await this['_run'](_0x53bc3c);}async['_run'](_0x224fc8){const _0x1fc073=[];let _0x35ccae,_0x1df4b2,_0x7bc8a3,_0x5e98a4=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x224fc8||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x40c416=await this['currentRequest']['getStream']();for await(const _0x4173b5 of _0x40c416){if(this['isStopped'])return;if('error'==_0x4173b5['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x4173b5['event']){case'message-metadata':this['messageId']=_0x4173b5['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x4173b5['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x4173b5['data']['conversationTitle'],!0x0);break;case'source':_0x1fc073['push'](_0x4173b5['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'](),_0x35ccae='modification-delta'==_0x4173b5['event']?'modification':'text',_0x1df4b2='modification-delta'==_0x4173b5['event']?_0x4173b5['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x35ccae&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x35ccae,'interactionId':this['id'],'id':_0x1df4b2,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x4173b5['event']&&{'documentId':_0x4173b5['data']['documentId']}}),'modification'==_0x35ccae&&(this['currentReply']['sources']=_0x1fc073['splice'](0x0))),this['currentReply']['appendContent'](_0x4173b5['data']['textDelta'],_0x4173b5['data']['documentId']);break;case'mcp-tool-result':_0x7bc8a3=JSON['parse'](_0x4173b5['data']['result']),this['_handleToolResultData']({'toolName':_0x4173b5['data']['toolName'],'data':_0x7bc8a3['data'],'attributes':_0x7bc8a3['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x4173b5['data']['toolName'],'data':_0x4173b5['data']['data']});}}_0x5e98a4=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x1fc073['length']>0x0&&(this['currentReply']['sources']=_0x1fc073['splice'](0x0)),this['_finalizeInteraction'](_0x5e98a4),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x21cf92){return this['replies']['find'](_0x28f148=>_0x28f148['id']===_0x21cf92);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x1700e=>_0x1700e['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x50c260){const _0x19f1b0=this['getDocumentContext'](),_0x30cbee=new _n({'locale':this['locale'],'documentContextContent':_0x19f1b0?.['documents'],..._0x50c260});return this['replies']['push'](_0x30cbee),_0x30cbee['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x30cbee),_0x30cbee;}['setConversationTitle'](_0x32ad79,_0x1c60c0=!0x1){this['fire']('setConversationTitle',_0x32ad79,_0x1c60c0);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x383764){this['fire']('toolDataReceived',{'type':'result','toolName':_0x383764['toolName'],'data':structuredClone(_0x383764['data']||{}),'attributes':structuredClone(_0x383764['attributes']||{})},this);}['_handleToolNotificationData'](_0x576a19){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x576a19['toolName'],'data':structuredClone(_0x576a19['data'])},this);}['_finalizeInteraction'](_0x1385ae=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x1385ae),this['currentRequest']=this['currentReply']=void 0x0;}};const pn=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']]),mn=/* #__PURE__ -- @preserve */
30
- _t(),En=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Tn=class AIChatContext extends mn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x17c85c,config:_0x452e67,ownerId:_0x5348fa}){super(),this['_connector']=_0x17c85c,this['_config']=_0x452e67,this['_ownerId']=_0x5348fa;}['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'](_0x2e11f6,_0x3d14d2){const _0x1d65d7=new Map(),{contextItem:_0x198032,hasUnmatched:_0x5a6623}=await this['_populateDocumentContextItem'](_0x2e11f6,_0x3d14d2);_0x198032&&_0x1d65d7['set'](_0x198032['id'],_0x198032);for(const _0x19a339 of _0x2e11f6){if('document'===_0x19a339['type'])continue;const _0x1d4fb4=await this['_createContextItemFromContent'](_0x19a339);this['_addToConversationContextItem'](_0x1d4fb4),_0x1d65d7['set'](_0x1d4fb4['id'],_0x1d4fb4);}return{'contextItems':_0x1d65d7,'hasUnmatched':_0x5a6623};}async['_populateDocumentContextItem'](_0xb92849,_0x1bacca){const _0x5b72b3=_0xb92849['filter'](_0x650d62=>'document'===_0x650d62['type']);if(0x0===_0x5b72b3['length'])return{'hasUnmatched':!0x1};const _0x2c2b27=_0x5b72b3['map'](_0x1f04f3=>_0x1f04f3['id']),_0xfda509=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x2c2b27)['getDocuments'](),_0x18d19d=new Map(_0xfda509['map'](_0x1cbe59=>[_0x1cbe59['id'],_0x1cbe59])),_0xe3068c=[];let _0x54dc5d=!0x1;for(const _0x34e8e0 of _0x5b72b3){const _0x443213=_0x18d19d['get'](_0x34e8e0['id']);_0x443213&&(this['_matchDocumentToRoot'](_0x443213,_0x1bacca)||(_0x54dc5d=!0x0),_0xe3068c['push']({'id':_0x443213['id'],'content':_0x443213['content'],'version':_0x443213['attributes']?.['version']??0x0,'sessionId':_0x443213['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x443213['attributes']?.['channelId']??_0x1bacca[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x443213['attributes']?.['rootName']??_0x1bacca[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x3b08aa={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0xe3068c};return this['_addToConversationContextItem'](_0x3b08aa),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3b08aa,'hasUnmatched':_0x54dc5d};}['_matchDocumentToRoot'](_0x27e38c,_0x2f1776){const _0x22ee63=_0x27e38c['attributes']?.['channelId'],_0x59ddca=_0x27e38c['attributes']?.['rootName'];if(_0x22ee63&&_0x59ddca){for(const _0xf27e41 of _0x2f1776)if(_0xf27e41['config']['get']('collaboration.channelId')===_0x22ee63){for(const _0x17aaa4 of _0xf27e41['model']['document']['getRoots']())if('$graveyard'!==_0x17aaa4['rootName']&&_0x17aaa4['rootName']===_0x59ddca)return{'editor':_0xf27e41,'rootName':_0x17aaa4['rootName']};}}}async['_createContextItemFromContent'](_0x9de489){return'mcp-tool-context'===_0x9de489['type']?{'id':_0x9de489['id'],'uiId':_0x9de489['id'],'label':_0x9de489['data']?.['label']||_0x9de489['id'],'type':'mcp-tool-context','mcpServerName':_0x9de489['mcpServerName'],'toolName':_0x9de489['toolName'],'data':_0x9de489['data']||{}}:{'id':_0x9de489['id'],'uiId':_0x9de489['id'],'label':_0x9de489['attributes']?.['label']||_0x9de489['name']||_0x9de489['url']||_0x9de489['id'],'type':_0x9de489['type'],..._0x9de489?.['attributes']?.['resourceId']?{'resourceId':_0x9de489['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x23b034){this['_pendingContextItems']['get'](_0x23b034)?.['isReadOnly']||this['_removeContextItem'](_0x23b034);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x498f26 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x498f26['uiId']);const _0x208037=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x208037&&this['_addContextItem']({..._0x208037,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x3bdfac){for(const _0x36377a of _0x3bdfac['values']())this['_addToConversationContextItem'](_0x36377a);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'](_0x492be1){return Array['from'](_0x492be1['values']())['flatMap'](_0x2830a2=>this['_mapContextItemToRequestData'](_0x2830a2));}async['addFilesToContext'](_0x8e4fdd,_0x313618,_0x26d0ea='file'){const _0x146a51='files-'+Ot();this['_startUploadOperation'](_0x146a51);try{await Promise['all'](_0x8e4fdd['map'](async _0xe7aa25=>{const _0x39c1c2='file-'+Ot(),_0x4e1bbf=_0x47dde7(_0xe7aa25['name']),_0x2422c7='file'===_0x26d0ea&&_0xe7aa25['type']['startsWith']('image/')?'image':_0x26d0ea;try{this['_addContextItem']({'type':_0x2422c7,'label':_0x313618?.['label']||_0x4e1bbf,'uiId':_0x39c1c2,'resourceId':_0x313618?.['resourceId']},!0x0);const _0x56ebc6=this['_connector']['uploadFile'](this['_ownerId'],_0xe7aa25,_0x313618);this['_ongoingUploads']['set'](_0x39c1c2,_0x56ebc6['abortController']);const {id:_0x26ca88}=await _0x56ebc6['getId']();this['_ongoingUploads']['delete'](_0x39c1c2),this['_finishContextItemLoading']({'type':_0x2422c7,'id':_0x26ca88,'label':_0x313618?.['label']||_0x4e1bbf,'uiId':_0x39c1c2,'resourceId':_0x313618?.['resourceId']},!0x1);}catch(_0x157e90){if(this['_ongoingUploads']['delete'](_0x39c1c2),!sn(_0x157e90)){const _0x2ab771=new nn({'code':pn['get'](_0x157e90['code'])||'ai-chat-file-upload-failed','cause':_0x157e90,'context':{'fileName':_0x4e1bbf}});this['fire']('error',{'error':_0x2ab771});}this['_removeContextItem'](_0x39c1c2);}}));}finally{this['_finishUploadOperation'](_0x146a51);}}['addCurrentDocumentToContext'](_0x891d59){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x2a5387={'type':'document','uiId':'current-document','label':_0x891d59,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x2a5387);}async['updateCurrentDocuments'](_0x30c877){const _0x1630b9=this['_pendingContextItems']['get']('current-document');if(!_0x1630b9||!_0x30c877['length']||_0x30c877['every'](_0x5f49d2=>!_0x5f49d2['content']))return;_0x30c877['length']>0x1&&_0x30c877['some'](_0x490c05=>!_0x490c05['description'])&&ft('ai-chat-documents-missing-description');try{const _0x281e71=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x30c877)['getIds']();if(_0x281e71['length']!==_0x30c877['length']||_0x281e71['some'](_0x488526=>!_0x488526?.['id'])){const _0x214b84=new at('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x214b84});}_0x1630b9['documents']=_0x30c877['map']((_0x3a75a5,_0x394836)=>{return{'id':_0x281e71[_0x394836]['id'],'content':_0x3a75a5['content'],'version':_0x3a75a5['version'],'sessionId':_0x3a75a5['sessionId'],'selection':(_0x5a5890=_0x3a75a5['selections'],_0x5a5890?_0x5a5890['map'](_0xaa92d3=>({'start':_0xaa92d3['start'],'end':_0xaa92d3['end']})):[]),'channelId':_0x3a75a5['channelId'],'rootName':_0x3a75a5['rootName']};var _0x5a5890;});}catch(_0x1488bf){const _0x46f26e=new nn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x1488bf});this['fire']('error',{'error':_0x46f26e});}}['addSelectionToContext'](_0xe3a2e8){this['_addContextItem']({'type':'selection','label':_0xe3a2e8,'uiId':'selection','content':_0xe3a2e8});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0xf154d6,_0x59cbdc){const _0xcc23f6='url-'+Ot();this['_startUploadOperation'](_0xcc23f6);const _0x58386d='url-'+Ot();try{this['_addContextItem']({'type':'web-resource','label':_0x59cbdc?.['label']||_0xf154d6,'uiId':_0x58386d,'resourceId':_0x59cbdc?.['resourceId']},!0x0);const _0x220e9e=this['_connector']['uploadUrl'](this['_ownerId'],_0xf154d6,_0x59cbdc);this['_ongoingUploads']['set'](_0x58386d,_0x220e9e['abortController']);const {id:_0x3031f5}=await _0x220e9e['getId']();this['_ongoingUploads']['delete'](_0x58386d),this['_finishContextItemLoading']({'type':'web-resource','id':_0x3031f5,'label':_0x59cbdc?.['label']||_0xf154d6,'uiId':_0x58386d,'resourceId':_0x59cbdc?.['resourceId']},!0x1);}catch(_0x178648){this['_ongoingUploads']['delete'](_0x58386d),sn(_0x178648)||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0xf154d6,'originalError':_0x178648}),'url':_0xf154d6}),this['_removeContextItem'](_0x58386d);}finally{this['_finishUploadOperation'](_0xcc23f6);}}['addToolItemToContext'](_0x51a03a){_0x51a03a['id']=_0x51a03a['id']??Ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x51a03a['uiId'],_0x51a03a),this['fire']('contextItemAdded',{'contextItem':_0x51a03a,'isLoading':!0x1});}async['loadSourceResources'](_0x20de66,_0x278519,_0x5a3f59){const _0x317720=this['_addContextOptionsState']['sources']['find'](_0x24fdc0=>_0x24fdc0['id']===_0x20de66);if(!_0x317720)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x20de66}),'sourceId':_0x20de66}),[];try{const _0x327c1a=(await _0x317720['getResources'](_0x278519))['map'](_0x435efd=>{const _0x1c172c=this['_isResourceInContext'](_0x435efd['id']);return{..._0x435efd,'isInContext':_0x1c172c};});return _0x317720['resources']=_0x327c1a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x20de66,'source':_0x317720,'resources':_0x327c1a,'uid':_0x5a3f59}),_0x327c1a;}catch(_0x2efdf1){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x20de66,'originalError':_0x2efdf1}),'sourceId':_0x20de66,'sourceLabel':_0x317720['label']}),[];}}async['addResourceToContext'](_0xfbf2e9,_0x1e994e){if(this['_isResourceInContext'](_0x1e994e['id']))return;let _0x7e46c8=_0x1e994e['data'];if(!_0x7e46c8&&_0xfbf2e9['getData'])try{_0x7e46c8=await _0xfbf2e9['getData'](_0x1e994e['id']);}catch(_0x41d07b){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id'],'originalError':_0x41d07b}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});}if(_0x7e46c8)switch(_0x1e994e['type']){case'web-resource':if('string'!=typeof _0x7e46c8)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id'],'expectedType':'string','actualType':typeof _0x7e46c8}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});await this['addUrlToContext'](_0x7e46c8,{'label':_0x1e994e['label'],'resourceId':_0x1e994e['id']});break;case'file':if(!(_0x7e46c8 instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id'],'expectedType':'File','actualType':typeof _0x7e46c8}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});await this['addFilesToContext']([_0x7e46c8],{'label':_0x1e994e['label'],'resourceId':_0x1e994e['id']});break;case'text':if('object'!=typeof _0x7e46c8||!('content'in _0x7e46c8)||!('type'in _0x7e46c8))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x7e46c8}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});_0x7e46c8=AIChatContext['_convertTextResourceToFile'](_0x7e46c8,_0x1e994e['label']),await this['addFilesToContext']([_0x7e46c8],{'label':_0x1e994e['label'],'resourceId':_0x1e994e['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id'],'resourceType':_0x1e994e['type']}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']}),'resourceId':_0x1e994e['id'],'sourceId':_0xfbf2e9['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x30a4a6){if(void 0x0!==_0x30a4a6)this['_addContextOptionsState']['document']['isHidden']=!_0x30a4a6;else{const _0x4590e4=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x4590e4;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x99c587,_0x49dfae){switch(_0x99c587['type']){case'markdown':return new File([_0x99c587['content']],_0x49dfae,{'type':'text/markdown'});case'html':return new File([_0x99c587['content']],_0x49dfae,{'type':'text/html'});default:return new File([_0x99c587['content']],_0x49dfae,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x1f2b97){switch(_0x1f2b97['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x1f2b97['id']}];case'web-resource':return[{'type':'web-resource','id':_0x1f2b97['id']}];case'document':return _0x1f2b97['documents']?.['length']?_0x1f2b97['documents']['map'](_0x10d158=>({'type':'document','id':_0x10d158['id'],..._0x10d158['selection']?.['length']&&{'selection':_0x10d158['selection']}})):[];case'mcp-tool-context':{const _0x229d46=_0x1f2b97;return[{'type':'mcp-tool-context','mcpServerName':_0x229d46['mcpServerName'],'toolName':_0x229d46['toolName'],'data':{..._0x229d46['data'],'label':_0x229d46['label']||_0x229d46['data']?.['label']||_0x229d46['id']},'id':_0x229d46['id']}];}default:return[];}}['_addContextItem'](_0x483926,_0x228a31=!0x1){if(this['_pendingContextItems']['set'](_0x483926['uiId'],_0x483926),_0x483926['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x483926,'isLoading':_0x228a31}),'current-document'===_0x483926['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x483926['resourceId']){const _0x294560=this['_findSourceIdsByResourceId'](_0x483926['resourceId']);_0x294560&&_0x294560['forEach'](_0x3238fc=>{this['_updateResourceInContextState'](_0x3238fc,_0x483926['resourceId'],!0x0);});}}['_removeContextItem'](_0x401ed7){const _0x3c41b9=this['_pendingContextItems']['get'](_0x401ed7),_0x4e06bd=this['_ongoingUploads']['get'](_0x401ed7);if(_0x4e06bd&&(_0x4e06bd['abort'](),this['_ongoingUploads']['delete'](_0x401ed7)),_0x3c41b9?.['resourceId']){const _0x1548ff=this['_findSourceIdsByResourceId'](_0x3c41b9['resourceId']);_0x1548ff&&_0x1548ff['forEach'](_0x210d2c=>{this['_updateResourceInContextState'](_0x210d2c,_0x3c41b9['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x401ed7),this['fire']('contextItemRemoved',{'uiId':_0x401ed7,'type':_0x3c41b9?.['type']}),'current-document'===_0x401ed7&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x554b08,_0x1aee16){if(this['_pendingContextItems']['has'](_0x554b08['uiId'])&&(this['_pendingContextItems']['set'](_0x554b08['uiId'],_0x554b08),this['fire']('contextItemLoadingEnded',{'contextItem':_0x554b08,'isLoading':_0x1aee16}),_0x554b08['resourceId'])){const _0x2b9ee8=this['_findSourceIdsByResourceId'](_0x554b08['resourceId']);_0x2b9ee8&&_0x2b9ee8['forEach'](_0x45b465=>{this['_updateResourceInContextState'](_0x45b465,_0x554b08['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x16c9e9){this['_conversationContextItems']['set'](_0x16c9e9['uiId'],_0x16c9e9);}['_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'](_0x472349=>({..._0x472349,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0xf32ab6=>({..._0xf32ab6,'resources':[]}))??[];}['_isResourceInContext'](_0x3a9664){for(const _0x136e78 of this['_pendingContextItems']['values']())if(_0x136e78['resourceId']===_0x3a9664)return!0x0;for(const _0x1dd6cc of this['_conversationContextItems']['values']())if(_0x1dd6cc['resourceId']===_0x3a9664)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x376eba){const _0xb06f6e=[];for(const _0x30db98 of this['_addContextOptionsState']['sources'])_0x30db98['resources']['find'](_0x5ad70c=>_0x5ad70c['id']===_0x376eba)&&_0xb06f6e['push'](_0x30db98['id']);return 0x0===_0xb06f6e['length']?null:_0xb06f6e;}['_updateResourceInContextState'](_0x2f78a8,_0x1049d4,_0x4e5be3){const _0x548206=this['_addContextOptionsState']['sources']['find'](_0x4500fc=>_0x4500fc['id']===_0x2f78a8);if(!_0x548206)return;const _0x4b8359=_0x548206['resources']['find'](_0x254c15=>_0x254c15['id']===_0x1049d4);_0x4b8359&&(_0x4b8359['isInContext']=_0x4e5be3,this['fire']('resourceStateChanged',{'sourceId':_0x2f78a8,'resourceId':_0x1049d4,'isInContext':_0x4e5be3}));}['_startUploadOperation'](_0x3c0224){this['_ongoingUploadOperations']['set'](_0x3c0224,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x37419e){this['_ongoingUploadOperations']['delete'](_0x37419e),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const wn=/* #__PURE__ -- @preserve */
31
- lt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_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'](_0x50f4a2){const _0xf454e9={};return _0x50f4a2&&_0x50f4a2['isWebSearchEnabled']&&(_0xf454e9['webSearch']={}),_0x50f4a2&&_0x50f4a2['isReasoningEnabled']&&(_0xf454e9['reasoning']={}),_0xf454e9;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x48b1c7){_0x48b1c7!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x48b1c7,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x460487){_0x460487!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x460487,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},bn=class extends In{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x2d5e4d){super(_0x2d5e4d),this['conversationId']=_0x2d5e4d['conversationId'],this['contextItems']=_0x2d5e4d['contextItems'],this['capabilities']=_0x2d5e4d['capabilities'],this['userMessage']=_0x2d5e4d['userMessage'],this['model']=_0x2d5e4d['model'],this['attributes']=_0x2d5e4d['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':Tn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Sn=/* #__PURE__ -- @preserve */
32
- lt();var Rn=class extends Sn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x3c089f){super(),this['options']=_0x3c089f,this['connector']=_0x3c089f['connector'],this['chatModels']=_0x3c089f['chatModels'],this['id']=_0x3c089f['conversationId'],this['isFromHistory']=_0x3c089f['isFromHistory'],this['_channelsToEditors']=_0x3c089f['channelsToEditors'],this['_getSessionId']=_0x3c089f['getSessionId'];}async['init'](_0x339ba0){try{this['chatContext']=new Tn({'connector':this['connector'],'config':_0x339ba0,'ownerId':this['id']}),this['chatContext']['delegate'](...En)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x6d78a4=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x6d78a4});const _0x2b635e=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x2b635e&&await this['setModel'](_0x2b635e);}catch(_0x1d4950){const _0x5c1c36=new nn({'code':'ai-chat-conversation-init-failed','cause':_0x1d4950,'type':'network'});this['fire']('error',{'error':_0x5c1c36});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x2053c5}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x2053c5,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0xa93736){const _0x43c961=new nn({'code':'ai-chat-conversation-start-failed','cause':_0xa93736,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x43c961}),_0x43c961;}}async['load'](_0x2242bd){try{const _0x984111=await this['connector']['fetchConversation'](_0x2242bd)['getConversation'](),_0x57fa92=await this['connector']['fetchConversationMessages'](_0x2242bd)['getMessages'](),_0x52d3e9=_0x57fa92[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x984111['id'],'title'in _0x984111?this['fire']('setConversationTitle',_0x984111['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x22c3a3=(await this['chatModels']['getAll']())['find'](_0x215ccb=>_0x215ccb['id']['toLowerCase']()===_0x52d3e9['toLowerCase']());this['selectedModel']=_0x22c3a3,this['fire']('modelSelected',{'selectedModel':_0x22c3a3,'isDisabled':!0x0});const {streamingMessageId:_0x341476}=await this['_processMessagesToInteractions'](_0x57fa92,_0x52d3e9);return _0x341476&&this['currentInteraction']?this['_resumeStream'](_0x341476):this['currentInteraction']=void 0x0,this;}catch(_0x18cce5){const _0x4f50fd=new nn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x18cce5,'type':'network','context':{'conversationId':_0x2242bd}});throw this['fire']('error',{'error':_0x4f50fd}),_0x4f50fd;}}async['_processMessagesToInteractions'](_0x3ec03d,_0x5cd184){let _0x502444,_0xf84e69,_0x344341=!0x1;for(const _0x1a070c of _0x3ec03d)if('user'===_0x1a070c['role']){const {contextItems:_0x5a43d6,hasUnmatched:_0x408074}=await this['_extractContextItems'](_0x1a070c);_0x344341=_0x408074;const _0x1e899d={'isReasoningEnabled':Object['hasOwn'](_0x1a070c['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x1a070c['capabilities'],'webSearch')};_0x502444=this['createInteraction']({'userMessage':_0x1a070c['prompt'],'contextItems':_0x5a43d6,'capabilities':_0x1e899d,'modelId':_0x5cd184,'attributes':_0x1a070c['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x502444,_0xf84e69=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x1a070c['role']&&_0x502444){if('streaming'===_0x1a070c['status']){_0xf84e69=_0x1a070c['id'];continue;}if('error'===_0x1a070c['status'])continue;const _0x2b0376=[];for(const _0x4bda94 of _0x1a070c['content'])switch(_0x4bda94['type']){case'text':case'modification':{const _0x3fe8db=_0x502444['getDocumentContext'](),_0x1feb8c=this['_hasSessionMismatch'](_0x3fe8db)||_0x344341;_0x502444['currentReply']?.['type']!==_0x4bda94['type']&&(_0x502444['currentReply']=_0x502444['createReply']({'type':_0x4bda94['type'],'isDone':!0x0,'interactionId':_0x502444['id'],'areActionsDisabled':_0x1feb8c,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x2b0376['length']>0x0&&(_0x502444['currentReply']['sources']=_0x2b0376['splice'](0x0))),_0x502444['currentReply']['appendContent'](_0x4bda94['content'],_0x4bda94['documentId']);break;}case'url':_0x2b0376['push'](_0x4bda94);break;case'mcp-tool-result':{const {data:_0x4f1314,attributes:_0x1d23b4}=JSON['parse'](_0x4bda94['content']);_0x502444['_handleToolResultData']({'toolName':_0x4bda94['toolName'],'data':_0x4f1314,'attributes':_0x1d23b4});break;}}'cancelled'===_0x1a070c['status']&&this['fire']('error',{'interactionId':_0x502444['id'],'error':new at('ai-request-aborted',this)});}}return{'streamingMessageId':_0xf84e69};}async['_resumeStream'](_0x42e6e7){if(this['currentInteraction'])try{const _0x45ab50=this['connector']['resumeStream'](this['id'],_0x42e6e7);await this['currentInteraction']['resume'](_0x45ab50);}catch(_0x5df400){_0x5df400 instanceof at&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x5df400});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0xcea4e6){return _0xcea4e6['content']?this['chatContext']['populateFromMessage'](_0xcea4e6['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x2fd2ba,attributes:_0x2dcfe5}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x5b8845=new Map(this['getPendingContextItems']()),_0x4b2c45=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4ef0c8=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x2fd2ba,'contextItems':_0x5b8845,'capabilities':_0x4b2c45,'modelId':_0x4ef0c8,'attributes':_0x2dcfe5,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x2d38ae){if(_0x2d38ae instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x2d38ae});else{const _0xc3dd49=pn['get'](_0x2d38ae['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0xc3dd49,null,{'error':_0x2d38ae})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x5638f1,contextItems:_0x47514c,capabilities:_0x6235c7,modelId:_0x31461e,attributes:_0x380029,channelsToEditors:_0x1996ba}){const _0x52723b=new bn({'userMessage':_0x5638f1,'contextItems':_0x47514c,'capabilities':_0x6235c7,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x31461e,'attributes':_0x380029,'channelsToEditors':_0x1996ba});return _0x52723b['delegate'](...An)['to'](this),this['interactions']['push'](_0x52723b),this['fire']('interactionCreated',_0x52723b),_0x52723b;}['getInteraction'](_0x14e53d){return this['interactions']['find'](_0x498e88=>_0x498e88['id']===_0x14e53d);}['removeInteraction'](_0x1fcc9c){const _0x3e4f67=this['getInteraction'](_0x1fcc9c);_0x3e4f67&&(_0x3e4f67['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x3e4f67),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x2aa7f9=this['lastInteraction'];_0x2aa7f9?.['conversationId']&&_0x2aa7f9['messageId']&&this['connector']['cancelStream'](_0x2aa7f9['conversationId'],_0x2aa7f9['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x4ef4b8){this['chatContext']['addCurrentDocumentToContext'](_0x4ef4b8);}async['updateCurrentDocumentsInContext'](_0x76b5ab){await this['chatContext']['updateCurrentDocuments'](_0x76b5ab);}['toggleAddCurrentDocumentOptionVisibility'](_0xcaee8d){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xcaee8d);}['_hasSessionMismatch'](_0x1a82ae){return!!_0x1a82ae&&_0x1a82ae['documents']['some'](_0x2ccaa7=>{const _0x31e60a=this['_channelsToEditors']['get'](_0x2ccaa7['channelId']);return!_0x31e60a||_0x2ccaa7['sessionId']!==this['_getSessionId'](_0x31e60a);});}['addSelectionToContext'](_0xb7c260){this['chatContext']['addSelectionToContext'](_0xb7c260);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x49f95f){this['chatContext']['addFilesToContext'](_0x49f95f);}['addUrlToContext'](_0x5f48ec){this['chatContext']['addUrlToContext'](_0x5f48ec);}['addToolItemToContext'](_0x3040a1){this['chatContext']['addToolItemToContext'](_0x3040a1);}['addResourceToContext'](_0x5089ec,_0x47a14c){this['chatContext']['addResourceToContext'](_0x5089ec,_0x47a14c);}['loadSourceResources'](_0x2bdd9d,_0x1a3331,_0x39b829){return this['chatContext']['loadSourceResources'](_0x2bdd9d,_0x1a3331,_0x39b829);}['removeFromContext'](_0x21fd25){this['chatContext']['removeFromContext'](_0x21fd25);}['setWebSearch'](_0x46c08d){this['chatCapabilities']['setWebSearch'](_0x46c08d);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x406bbf){this['chatCapabilities']['setReasoning'](_0x406bbf);}['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'](_0x49743d){_0x49743d?!0x1===await this['chatModels']['isAvailable'](_0x49743d)&&(ft('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x49743d}),_0x49743d=(await this['chatModels']['getAvailableModels']())[0x0]):(ft('ai-chat-conversation-set-model-null',{'conversation':this}),_0x49743d=(await this['chatModels']['getAvailableModels']())[0x0]),_0x49743d['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x49743d,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x49743d}));}};function On({groups:_0x319773,documentContextContent:_0x194683,documents:_0x4aad93}){const _0x511000=new Map();for(const _0x28eda8 of _0x319773){const {documentId:_0x4384e8}=_0x28eda8,_0x32403c=_0x511000['get'](_0x4384e8);if(_0x32403c)_0x32403c['groups']['push'](_0x28eda8),_0x32403c['indexes']['push'](_0x28eda8['index']);else{const _0x5c98b9=_0x4aad93['find'](_0xc74f4c=>_0xc74f4c['id']===_0x4384e8),_0x574a90=_0x194683['get'](_0x4384e8);if(!_0x5c98b9||!_0x574a90)continue;_0x511000['set'](_0x4384e8,{'groups':[_0x28eda8],'documentContext':_0x5c98b9,'documentContent':_0x574a90,'editor':_0x28eda8['editor'],'indexes':[_0x28eda8['index']]});}}return _0x511000;}function vn(_0x5ce2cd,_0x1ae6e5){const _0x4544be=_0x5ce2cd['files']['length']>0x0&&_0x5ce2cd['files']['every'](_0x40325e=>_0x40325e['type']['startsWith']('image/')),_0x27b41e=_0x5ce2cd['plainText']['trim']()['length']>0x0;if(_0x5ce2cd['files']['length']>0x0&&_0x1ae6e5['filesEnabled']&&(!_0x4544be||!_0x27b41e)){const _0x48833f=_0x5ce2cd['files']['filter'](_0x309a64=>_0x309a64['name']);return _0x48833f['length']>0x0?{'type':'file','files':_0x48833f}:null;}if(_0x1ae6e5['urlsEnabled']){const _0x5e8002=function(_0xd9c3c6){const _0x5c57a8=_0xd9c3c6['trim']();if(/\s/['test'](_0x5c57a8))return null;try{const _0x36c9da=new URL(_0x5c57a8);return'http:'!==_0x36c9da['protocol']&&'https:'!==_0x36c9da['protocol']?null:_0x36c9da['toString']();}catch{return null;}}(_0x5ce2cd['plainText']);if(_0x5e8002)return{'type':'url','url':_0x5e8002};}const _0x2f461f=_0x5ce2cd['forceTextAttachment']?0x1:_0x1ae6e5['longTextThreshold']??0x1/0x0;if(_0x5ce2cd['plainText']['length']>=Math['max'](_0x2f461f,0x1)&&_0x1ae6e5['filesEnabled']){const _0x233717=_0x1ae6e5['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x5ce2cd['plainText']],_0x233717,{'type':'text/plain'})]};}return null;}var kn=class extends _0x3abc0e{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[cs,rn,_0x3ea65d];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=un(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'](rn)['createReporter']('aichat'),this['_aiChatModels']=new Xs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x59047e=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x29e6a1,_0x1a104a)=>{this['_handleUIUserMessage']({'message':_0x1a104a});}),this['listenTo'](_0x59047e['view'],'change:activeTab',(_0x3f06dd,_0x12651c,_0xf2ba92)=>{'chat'!==_0xf2ba92&&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',(_0x4d00aa,_0x376b36)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x376b36));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0xdd0dff,_0x5658d7)=>{this['activeConversation']?.['addUrlToContext'](_0x5658d7);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x811606,_0xb775f2)=>{const _0x47d07b=this['activeConversation'];if(!_0x47d07b)return;_0xb775f2['hasDirectory']&&(_0xb775f2['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Ot()}));const _0x280305=vn(_0xb775f2,{'pastedTextLabel':ls(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')});_0x280305&&(_0xb775f2['preventDefault'](),'url'===_0x280305['type']?_0x47d07b['addUrlToContext'](_0x280305['url']):_0x47d07b['chatContext']['addFilesToContext'](_0x280305['files'],void 0x0,_0x280305['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x2fc07b,_0x230e48)=>{_0x230e48['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x29e08e,_0x13d793)=>{this['activeConversation']?.['addResourceToContext'](_0x13d793['source'],_0x13d793['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x5be59e,_0x317e6c)=>{this['_removeFromContext'](_0x317e6c);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x417cb1,_0x2234c5)=>{this['activeConversation']?.['loadSourceResources'](_0x2234c5['sourceId'],_0x2234c5['query'],_0x2234c5['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x54ee0d,_0x2456df)=>{this['activeConversation']?.['setModel'](_0x2456df);}),this['listenTo'](this['_aiChatUi'],'like',(_0x190e10,{replyId:_0x45e148})=>{console['log']('Liked\x20response',_0x45e148);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x5c89e7,{replyId:_0x25bd5e})=>{console['log']('Disliked\x20response',_0x25bd5e);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x3dd80b,_0x29f2a9)=>{this['_insertSuggestion'](_0x29f2a9);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x5a27ac,{replyId:_0x17297f,partIndex:_0x5c1c3b})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x17297f,_0x5c1c3b);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x59fb58,{replyId:_0x5f3d5a,partIndex:_0x1a6425})=>{const _0x50e87b=this['_getDocumentRangeForReplyChanges'](_0x5f3d5a,_0x1a6425);if(!_0x50e87b)return;const {reply:_0x25c8d7}=this['getInteractionAndReplyById'](_0x5f3d5a);'$graveyard'!=_0x50e87b['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x25c8d7['changeGroups'][_0x1a6425]['editor'],'ranges':[_0x50e87b['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x8740e2,_0xdcb09f)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0xdcb09f);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x79d8b3,{replyId:_0x4a26e8,showDiff:_0x37b7d2})=>{const {interaction:_0x26f5be,reply:_0x2e638f}=this['getInteractionAndReplyById'](_0x4a26e8),_0x15449d=_0x2e638f['getContentParts']({'showDiff':_0x37b7d2});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x26f5be['id']+':'+_0x2e638f['id'],'parts':_0x15449d});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x122ce9,{replyId:_0x24064b,partIndex:_0x2446af})=>{this['_rejectSuggestion']({'replyId':_0x24064b,'partIndex':_0x2446af}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x41be0b,_0x4056c6)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4056c6);}),this['on']('replyCreated',(_0x10c6af,_0xe36d1e)=>{this['_addFeedItemReply'](_0xe36d1e);});}['afterInit'](){this['context']instanceof _0x5a1597?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x25ec52,_0x207b27)=>{_0x207b27['on']('ready',()=>{this['_integrateEditor'](_0x207b27);});}),this['_initConversation']();}async['_initConversation'](){const _0x1e78de=this['context']['config']['get']('ai.chat.initialConversation');let _0x1d5826=_0x1e78de;('lastCreated'!=_0x1e78de||(_0x1d5826=await this['_getLastCreatedConversationId'](),_0x1d5826))&&('new'==_0x1d5826?await this['_startConversationSafely']():await this['loadConversation'](_0x1d5826));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x2f70fd){this['_closeActiveBalloon'](),this['context']['plugins']['get'](hs)['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'](_0x2f70fd)['getConversation'](),await this['_startConversationSafely']({'id':_0x2f70fd}),await this['activeConversation']['load'](_0x2f70fd),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x12b5c9){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x2f70fd}),this['_reporter']['logError'](new at('ai-chat-conversation-not-found',this,void 0x0,_0x12b5c9),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x299a2a){let _0x3a49ea=null,_0x2de8b0=null;this['on']('toolDataReceived',(_0x53445e,_0x1f9407,_0x1fc34b)=>{_0x1fc34b['id']!==_0x3a49ea&&(_0x3a49ea=_0x1fc34b['id'],_0x2de8b0=this['_getAIChatFeedAPI'](_0x1fc34b)),_0x299a2a(_0x1f9407,_0x2de8b0);});}['addCurrentDocumentToChatContext'](){us(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](ls(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x2a6bfe){const _0x389c1b=this['_aiEditing']['getSelectionText'](_0x2a6bfe);this['activeConversation']?.['addSelectionToContext'](_0x389c1b),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x544390){await this['_startConversationSafely']({'modelId':_0x544390?.['modelId']});}async['sendMessage'](_0x364f80){await this['_handleUIUserMessage'](_0x364f80);}['getGroupId'](){const _0x4f79f4=this['context']['config']['get']('collaboration.channelId');if(!_0x4f79f4)throw new at('ai-missing-channel-id',this);return _0x4f79f4;}['_handleRemovedConversation'](_0x2b6fed){this['activeConversation']['id']===_0x2b6fed&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x3e3012){const {reply:_0x1d1187,interaction:_0x1dd8a2}=this['getInteractionAndReplyById'](_0x3e3012['replyId']),_0x54e4be=void 0x0!==_0x3e3012['partIndex']?[_0x1d1187['changeGroups'][_0x3e3012['partIndex']]]:_0x1d1187['changeGroups']['filter'](_0x3f466b=>'pending'==_0x3f466b['state']);return _0x54e4be['map'](_0xf12e65=>_0x1d1187['changeGroups']['indexOf'](_0xf12e65))['forEach'](_0x52cc2e=>{const _0x535ed0=this['_getDocumentRangeForReplyChanges'](_0x3e3012['replyId'],_0x52cc2e);_0x535ed0&&'$graveyard'!=_0x535ed0['range']['root']['rootName']?(_0x1d1187['setChangeGroupState'](_0x52cc2e,'accepted'),void 0x0!==_0x3e3012['partIndex']&&this['_scrollToSuggestionRange'](_0x535ed0['range'],!0x1,_0x535ed0['targetEditor'])):_0x1d1187['setChangeGroupState'](_0x52cc2e,'outdated');}),On({'groups':_0x54e4be['filter'](_0x34eedc=>'accepted'===_0x34eedc['state']),'documentContextContent':_0x1d1187['documentContextContent'],'documents':_0x1dd8a2['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x28ae75){const _0x32505f=this['context']['plugins']['get'](_0x3ea65d),{reply:_0x496b36,interaction:_0x457764}=this['getInteractionAndReplyById'](_0x28ae75['replyId']),_0x448ba4=this['_prepareDocumentSuggestions'](_0x28ae75),_0x5c4476=ks({'documentSuggestions':_0x448ba4,'transform':!0x0,'documentCompare':_0x32505f,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x2fb1bf,_0x252039]of _0x5c4476){const {editor:_0x30ba5e,indexes:_0x242695}=_0x448ba4['get'](_0x2fb1bf);if(!_0x30ba5e['plugins']['has']('TrackChanges')){ft('ai-no-track-changes',{'editor':_0x30ba5e});continue;}let _0x5cadba;js(_0x252039,'chat'),_0x30ba5e['model']['change'](_0x57aa9b=>{_0x5cadba=_0x57aa9b['batch'],_0x30ba5e['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x252039),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x5cadba,{'interactionId':_0x457764['id'],'replyId':_0x496b36['id'],'indexes':_0x242695});}this['_updateRatings'](_0x496b36);}['_applySuggestion'](_0x29d656){const _0x4630a6=this['context']['plugins']['get'](_0x3ea65d),{reply:_0x13f1b3,interaction:_0xdbe757}=this['getInteractionAndReplyById'](_0x29d656['replyId']),_0x52e2e0=this['_prepareDocumentSuggestions'](_0x29d656),_0x1f30b3=ks({'documentSuggestions':_0x52e2e0,'transform':!0x0,'documentCompare':_0x4630a6,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x5f02bf,_0x3643bd]of _0x1f30b3){const {editor:_0x16ffc3,indexes:_0x2c6879}=_0x52e2e0['get'](_0x5f02bf);let _0x2362a3;js(_0x3643bd,'chat');try{_0x16ffc3['model']['change'](_0x7a6d7d=>{_0x2362a3=_0x7a6d7d['batch'];for(const _0x160ec1 of _0x3643bd)_0x160ec1['baseVersion']=_0x16ffc3['model']['document']['version'],Ns(_0x16ffc3,_0x160ec1),_0x7a6d7d['batch']['addOperation'](_0x160ec1),_0x16ffc3['model']['applyOperation'](_0x160ec1);}),this['_batchToChanges']['set'](_0x2362a3,{'interactionId':_0xdbe757['id'],'replyId':_0x13f1b3['id'],'indexes':_0x2c6879});}catch(_0x102cc3){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x102cc3})),_0x102cc3;}}this['_updateRatings'](_0x13f1b3);}['_rejectSuggestion'](_0x2f0044){const {reply:_0x33e38c}=this['getInteractionAndReplyById'](_0x2f0044['replyId']);_0x33e38c['setChangeGroupState'](_0x2f0044['partIndex'],'rejected');}['_openBalloonFor'](_0x42f0e3,_0x1bbea8){if(!this['_hasAIChatBalloon'])return;const {reply:_0x5cb707}=this['getInteractionAndReplyById'](_0x42f0e3),_0x3e0d61=_0x5cb707['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x3e0d61['length'])return;let _0x4f25a0,_0x11091f;if(void 0x0!==_0x1bbea8?(_0x11091f=_0x3e0d61['find'](_0x45275a=>_0x45275a['index']==_0x1bbea8),_0x4f25a0=_0x11091f?.['index']):(_0x11091f=_0x3e0d61[0x0],_0x4f25a0=_0x11091f['index']),!_0x11091f)return void _0x5cb707['setChangeGroupState'](_0x1bbea8??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x42f0e3&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4f25a0)return;const _0x30531a=this['_getUserPresentableContentPartDocumentRange'](_0x42f0e3,_0x5cb707,_0x11091f),_0x1fb451=_0x5cb707['changeGroups']['find'](_0x3ad91f=>_0x3ad91f['index']==_0x4f25a0)['editor'],_0x3cafd7=_0x1fb451['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x3cafd7&&this['_activeBalloon']['close'](),!_0x30531a)return _0x3cafd7['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x3cafd7,this['_currentPreviewedChangeGroup']={'replyId':_0x42f0e3,'partIndex':_0x4f25a0},this['_scrollToSuggestionRange'](_0x30531a,!0x0,_0x1fb451);const _0x153c41=this['_getPresentableSiblingContentPartIndex'](_0x42f0e3,_0x4f25a0,'next');_0x3cafd7['clearContent'](),_0x3cafd7['updateContent']({'part':_0x11091f,'renderingStrategy':'static'}),_0x3cafd7['open']({'index':_0x4f25a0,'title':ls(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x4f25a0+0x1)['toString']()),'showRotator':null!==_0x153c41,'ranges':[_0x30531a],'areActionsDisabled':_0x5cb707['areActionsDisabled'],'targetEditor':_0x1fb451}),_0x3cafd7['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x42f0e3,_0x4f25a0),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x42f0e3,'index':_0x4f25a0,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x2c9bef,_0x51d51a,_0x473886){const {reply:_0x4b91f0}=this['getInteractionAndReplyById'](_0x2c9bef),_0x149bb0=_0x4b91f0['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x149bb0['length'])return null;const _0x5cd674='next'==_0x473886?0x1:-0x1;function _0x1429fb(_0x140901){const _0x501376=(_0x140901+_0x5cd674+_0x149bb0['length'])%_0x149bb0['length'];return{'siblingIndex':_0x501376,'siblingPart':_0x149bb0[_0x501376]};}const _0x1909f8=_0x149bb0['findIndex'](_0xa2ddb6=>_0xa2ddb6['index']==_0x51d51a);let {siblingIndex:_0x111929,siblingPart:_0x2a35ea}=_0x1429fb(_0x1909f8);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x2c9bef,_0x4b91f0,_0x2a35ea);)if({siblingIndex:_0x111929,siblingPart:_0x2a35ea}=_0x1429fb(_0x111929),_0x111929===_0x1909f8)return null;return _0x2a35ea['index'];}['_getUserPresentableContentPartDocumentRange'](_0x5b6638,_0x1673f4,_0x4b58eb){const _0x6ca17c=_0x1673f4['changeGroups'];if(!_0x4b58eb['hasChanges'])return null;const _0x8d84d8=_0x6ca17c['find'](_0x71a7c4=>_0x71a7c4['index']==_0x4b58eb['index']);if('pending'!==_0x8d84d8?.['state'])return null;if(!_0x8d84d8?.['editor']||'destroyed'===_0x8d84d8['editor']['state'])return _0x1673f4['setChangeGroupState'](_0x4b58eb['index'],'outdated'),null;const _0x512ace=this['_getDocumentRangeForReplyChanges'](_0x5b6638,_0x4b58eb['index']);if(!_0x512ace)return _0x1673f4['setChangeGroupState'](_0x4b58eb['index'],'outdated'),null;const {range:_0x312413,currentIndex:_0x4acf6b}=_0x512ace;return'$graveyard'==_0x312413['root']['rootName']?(_0x1673f4['setChangeGroupState'](_0x4acf6b,'outdated'),null):_0x512ace['range'];}['_getDocumentRangeForReplyChanges'](_0x31404d,_0x477572){const {reply:_0x536ded,interaction:_0x2c2feb}=this['getInteractionAndReplyById'](_0x31404d),_0x3e894b=_0x536ded['changeGroups']['filter'](_0x396ef7=>'pending'==_0x396ef7['state']),_0xa97b27=_0x3e894b['map'](_0x3cd0af=>_0x536ded['changeGroups']['indexOf'](_0x3cd0af));void 0x0===_0x477572&&(_0x477572=_0xa97b27[0x0]);const _0x5cd6ae=_0xa97b27['indexOf'](_0x477572);if(-0x1==_0x5cd6ae)return null;const _0x54c2dc=_0x3e894b[_0x5cd6ae],_0x122353=_0x54c2dc['editor'];if(!_0x122353||'destroyed'===_0x122353['state'])return null;const _0x20fb07=_0x536ded['documentContextContent']['get'](_0x54c2dc['documentId']),_0x765852=new _0x428e8a([]),_0x36f9df=new _0x428e8a([]);for(const _0x1de52e of _0x54c2dc['changes'])if('removed'!=_0x1de52e['type']&&_0x36f9df['children']['push'](_0x1de52e['node']['cloneNode'](!0x0)),'new'!=_0x1de52e['type']){const _0x5b91aa=_0x103707(_0x4bc4f9=>Cs(_0x4bc4f9,'data-id')==_0x1de52e['id'],_0x20fb07,!0x0);_0x765852['children']['push'](_0x5b91aa['cloneNode'](!0x0));}if(0x0==_0x765852['children']['length']){if(_0x54c2dc['changes'][0x0]['anchorId']){const _0x1ced26=ms('data-id',_0x54c2dc['changes'][0x0]['anchorId'],_0x20fb07);_0x765852['children']['unshift'](_0x1ced26['cloneNode'](!0x0)),_0x36f9df['children']['unshift'](_0x1ced26['cloneNode'](!0x0)),_0x1ced26['nextSibling']&&(_0x765852['children']['push'](_0x1ced26['nextSibling']['cloneNode'](!0x0)),_0x36f9df['children']['push'](_0x1ced26['nextSibling']['cloneNode'](!0x0)));}else{const _0x1376e6=_0x20fb07['children'][0x0];if(!_0x1376e6)return null;_0x765852['children']['push'](_0x1376e6['cloneNode'](!0x0)),_0x36f9df['children']['push'](_0x1376e6['cloneNode'](!0x0));}}const _0x242fc3=_0x2c2feb['getDocumentContext'](),_0xd8b9a6=_0x242fc3['documents']['find'](_0x2e4127=>_0x2e4127['id']==_0x54c2dc['documentId'])['content'],_0x2aff8=_0x122353['model']['document']['getRoot'](_0x54c2dc['rootName']),_0x42344f=_0x122353['data']['parse'](_0xd8b9a6,_0x2aff8),_0x35d946=ps(_0x765852),_0x1ce5a1=_0x122353['data']['parse'](_0x35d946,_0x2aff8),_0x5c04d3=_0x122353['data']['parse'](_0x35d946,_0x2aff8),_0x3caa68=_0x122353['model']['createPositionAt'](_0x1ce5a1,0x0),_0x21d06c=ps(_0x36f9df),_0x1a7425={'targetEditor':_0x122353,'anchor':_0x3caa68,'markDeletions':!0x1},_0x2cb926=_0x122353['plugins']['get'](_0x3ea65d)['getDiff'](_0x35d946,_0x21d06c,_0x1a7425)['getOperations']();if(!_0x2cb926['length'])return null;_0x122353['model']['change'](_0x5c9460=>{for(const _0x321c0c of _0x2cb926)if('remove'==_0x321c0c['type']){const _0x5709c8=_0x321c0c['sourcePosition'],_0x4961b6=_0x321c0c['howMany'],_0x580bdb=new _0x1bbc64(_0x5709c8,_0x4961b6);_0x5c9460['batch']['addOperation'](_0x580bdb),_0x122353['model']['applyOperation'](_0x580bdb);}else'marker'!==_0x321c0c['type']&&(_0x321c0c['baseVersion']=null,_0x321c0c['isDocumentOperation']=!0x1,_0x5c9460['batch']['addOperation'](_0x321c0c),_0x122353['model']['applyOperation'](_0x321c0c));});const _0x330768=Fs(_0x122353,_0x2cb926,_0x1ce5a1);Ws(_0x122353['model'],_0x330768);const _0x38f30d=_0x330768['getFirstRange']()['start']['path']['slice'](),_0x2315ad=_0x330768['getFirstRange']()['end']['path']['slice'](),_0x5196d3=[];let _0x396735=_0x1ce5a1,_0x21a10c=_0x5c04d3;for(let _0x5121ff=0x0;_0x5121ff<_0x2315ad['length'];_0x5121ff++){const _0x3dd991=_0x396735['maxOffset']-_0x2315ad[_0x5121ff];_0x5196d3[_0x5121ff]=_0x21a10c['maxOffset']-_0x3dd991,_0x396735=_0x396735['getChildAtOffset'](_0x2315ad[_0x5121ff]),_0x21a10c=_0x21a10c['getChildAtOffset'](_0x5196d3[_0x5121ff]);}const _0x275739=_0x122353['model']['createRange'](_0x122353['model']['createPositionFromPath'](_0x5c04d3,_0x38f30d),_0x122353['model']['createPositionFromPath'](_0x5c04d3,_0x5196d3)),_0x236660=_0x5c04d3['getChild'](0x0)['getAttribute'](_0x32a933),_0x5259ba=Array['from'](_0x42344f['getChildren']())['find'](_0x2023b5=>_0x2023b5['getAttribute'](_0x32a933)==_0x236660)['getPath'](),_0x5141c=_0x275739['start']['path']['slice'](),_0x7073a6=_0x275739['end']['path']['slice']();_0x5141c[0x0]=_0x5259ba[0x0]+_0x5141c[0x0],_0x7073a6[0x0]=_0x5259ba[0x0]+_0x7073a6[0x0];let _0x5eb542=_0x122353['model']['createRange'](_0x122353['model']['createPositionFromPath'](_0x122353['model']['document']['getRoot'](_0x54c2dc['rootName']),_0x5141c),_0x122353['model']['createPositionFromPath'](_0x122353['model']['document']['getRoot'](_0x54c2dc['rootName']),_0x7073a6));const _0x10509a=_0x242fc3['documents']['find'](_0x4ce75e=>_0x4ce75e['id']==_0x54c2dc['documentId'])['version'],_0x4e40ee=_0x122353['model']['document']['history']['getOperations'](_0x10509a);for(const _0xa2c7bf of _0x4e40ee)_0x5eb542=_0x5cca78['_createFromRanges'](_0x5eb542['getTransformedByOperation'](_0xa2c7bf));return{'range':_0x5eb542,'currentIndex':_0x477572,'targetEditor':_0x122353};}['_integrateEditorBalloon'](_0x15628b){if(!_0x15628b['plugins']['has']('AIChatBalloon'))return;const _0x3a83a7=_0x15628b['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x3a83a7['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x3a83a7,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x48720e,partIndex:_0xe46acc}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x944465}=this['getInteractionAndReplyById'](_0x48720e),_0x1e0ebb=_0x944465['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0xe46acc});_0x3a83a7['updateContent']({'part':_0x1e0ebb[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x3a83a7,'applySuggestion',()=>{const {replyId:_0x7665a1,partIndex:_0x49859a}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x7665a1,'partIndex':_0x49859a}),_0x3a83a7['setState']('accepted');}),this['listenTo'](_0x3a83a7,'insertSuggestion',()=>{const {replyId:_0x51a2f7,partIndex:_0x110d23}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x51a2f7,'partIndex':_0x110d23}),_0x3a83a7['setState']('accepted');}),this['listenTo'](_0x3a83a7,'rejectSuggestion',()=>{const {replyId:_0x3ee30f,partIndex:_0x3fa480}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x3ee30f,'partIndex':_0x3fa480}),_0x3a83a7['setState']('rejected');}),this['listenTo'](_0x3a83a7,'showNext',()=>{const {replyId:_0x643b4e,partIndex:_0x4f5bbf}=this['_currentPreviewedChangeGroup'],_0xa27b2=this['_getPresentableSiblingContentPartIndex'](_0x643b4e,_0x4f5bbf,'next');null!==_0xa27b2&&this['_openBalloonFor'](_0x643b4e,_0xa27b2);}),this['listenTo'](_0x3a83a7,'showPrevious',()=>{const {replyId:_0x3ca014,partIndex:_0xfa4201}=this['_currentPreviewedChangeGroup'],_0x48cffa=this['_getPresentableSiblingContentPartIndex'](_0x3ca014,_0xfa4201,'previous');null!==_0x48cffa&&this['_openBalloonFor'](_0x3ca014,_0x48cffa);}),this['listenTo'](_0x3a83a7,'dialogClosed',(_0x12aa8b,{id:_0x1b7dc4})=>{if('aiChatBalloon'!==_0x1b7dc4)return;const {replyId:_0x85650a,partIndex:_0x19b37d}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x85650a,'index':_0x19b37d,'isActive':!0x1}),this['_activeBalloon']===_0x3a83a7&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x4bf9a8){if(this['_channelsToEditors']['set'](_0x4bf9a8['config']['get']('collaboration.channelId'),_0x4bf9a8),this['_integrateEditorBalloon'](_0x4bf9a8),this['addCurrentDocumentToChatContext'](),_0x4bf9a8['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x4bf9a8['plugins']['has']('Undo')){const _0x2413f3=_0x4bf9a8['commands']['get']('undo'),_0x350f53=_0x4bf9a8['commands']['get']('redo');this['listenTo'](_0x2413f3,'revert',(_0x2dd79e,_0x42846b,_0x160347)=>{const _0x83b354=this['_batchToChanges']['get'](_0x42846b);if(!_0x83b354)return;const _0x4a18e1=this['activeConversation']['getInteraction'](_0x83b354['interactionId']),_0x10cc68=_0x4a18e1?.['getReply'](_0x83b354['replyId']);this['_batchToChanges']['delete'](_0x42846b),_0x4a18e1&&_0x10cc68&&(_0x83b354['indexes']['forEach'](_0x337ff2=>_0x10cc68['setChangeGroupState'](_0x337ff2,'pending')),this['_batchToChanges']['set'](_0x160347,_0x83b354));}),this['listenTo'](_0x350f53,'revert',(_0x482488,_0x3909e8,_0x9450d)=>{const _0x1eff1b=this['_batchToChanges']['get'](_0x3909e8);if(!_0x1eff1b)return;const _0x11848a=this['activeConversation']['getInteraction'](_0x1eff1b['interactionId']),_0x338c33=_0x11848a?.['getReply'](_0x1eff1b['replyId']);this['_batchToChanges']['delete'](_0x3909e8),_0x11848a&&_0x338c33&&(_0x1eff1b['indexes']['forEach'](_0x3c6837=>_0x338c33['setChangeGroupState'](_0x3c6837,'accepted')),this['_batchToChanges']['set'](_0x9450d,_0x1eff1b));});}const _0x1466bf=_0x4bf9a8['config']['get']('ai.chat.context');_0x1466bf['alwaysAddSelection']&&_0x1466bf['document']['enabled']&&this['listenTo'](_0x4bf9a8['model']['document']['selection'],'change:range',(_0xfdde1c,_0x2eda66)=>{_0x2eda66['directChange']&&'chat'===_0x4bf9a8['plugins']['get']('AITabs')['view']['activeTab']&&(_0x4bf9a8['model']['hasContent'](_0x4bf9a8['model']['document']['selection'])?this['addSelectionToChatContext'](_0x4bf9a8):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x4c18df=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x218caf=await _0x4c18df['getConversations']();return _0x218caf['length']?_0x218caf[0x0]['id']:'new';}catch(_0x181751){return this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':Ot()}),this['_reporter']['logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x181751})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x4627db={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x4627db);}catch(_0xfb8692){this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4627db['id']||Ot()}),this['_reporter']['logError'](_0xfb8692),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x4a4fa5,modelId:_0xe94d7d}={}){this['_closeActiveBalloon']();let _0x5c057b=_0xe94d7d;_0x5c057b||(_0x4a4fa5||!this['activeConversation']?_0x5c057b=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x5c057b=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x26fe7b=this['getGroupId'](),_0x53e231=_0x4a4fa5||Ot();let _0x483681;this['activeConversation']=new Rn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x5c057b,'conversationId':_0x53e231,'group':_0x26fe7b,'locale':this['context']['locale'],'isFromHistory':!!_0x4a4fa5,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x4e0343=>this['_aiEditing']['getSessionId'](_0x4e0343)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x51dcce,_0xd4c62c)=>{this['_aiChatUi']['createConversation'](_0xd4c62c),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x4a4fa5||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x21dec9,_0x4bac6e)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x4bac6e['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0xcd9c46=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0xcd9c46);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x1ca07c=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x1ca07c);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x34cf64,_0x5e856a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x5e856a,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x41f283,_0x33fabd)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x33fabd,{'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',(_0x56a59c,_0x5973d9)=>{this['_aiChatUi']['removeFeedInteraction'](_0x5973d9['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x39c84b,_0x5098ae,_0x4fdbb9)=>{this['_updateConversationTitle'](_0x5098ae,_0x4fdbb9);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x2eb342,_0x5af540)=>{void 0x0!==_0x483681&&_0x483681!==_0x5af540['id']&&this['_updateReplyContentThrottled']['flush'](),_0x483681=_0x5af540['id'],_0x5af540['isFromHistory']?await this['_updateReplyContent']({'reply':_0x5af540}):await this['_updateReplyContentThrottled']({'reply':_0x5af540});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x5e0814,{reply:_0x26df9c,index:_0x4e4209,state:_0x8dc7c5})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x26df9c['id'],'index':_0x4e4209,'state':_0x8dc7c5}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x26df9c['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4e4209&&this['_activeBalloon']?.['setState'](_0x8dc7c5);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x2b578b,_0x55653d)=>{if(this['_aiChatUi']['addContextItem'](_0x55653d['contextItem'],_0x55653d['isLoading']),'selection'===_0x55653d['contextItem']['type']){const _0x21dbdc=ds(this['context']),_0x3825a5=[..._0x21dbdc['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x21dbdc,'ranges':_0x3825a5,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x1ce11e,_0x5af6d0)=>{this['_aiChatUi']['removeContextItem'](_0x5af6d0['uiId']),'current-document'==_0x5af6d0['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x5af6d0['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0xafd0c8,_0x43d655)=>{this['_aiChatUi']['setContextItemLoading'](_0x43d655['contextItem']['uiId'],_0x43d655['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x5f273e,_0x2afaac)=>{this['_aiChatUi']['setConversationContext'](_0x2afaac['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x4b2614,_0x38982c)=>{this['_aiChatUi']['setAddContextOptions'](_0x38982c['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1b4c3a,_0x146f85)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x146f85['sourceId'],_0x146f85['source'],_0x146f85['resources'],_0x146f85['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x53b98e,_0x462347)=>{this['_aiChatUi']['updateResourceState'](_0x462347['sourceId'],_0x462347['resourceId'],_0x462347['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x2f2617,_0x26b786)=>{this['_aiChatUi']['updateCapabilities'](_0x26b786);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x1db2dc,_0x43b264)=>{try{const _0x79d1b2=(await this['_aiChatModels']['getAll']())['find'](_0x235e19=>_0x235e19['id']===_0x43b264['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x79d1b2,_0x43b264['isDisabled']);}catch(_0x29559f){this['_reporter']['logError'](new nn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x29559f}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x2605d2,{error:_0x326e38,interactionId:_0x5cfbae,fileName:_0x4389bb,url:_0x56a9bb,sourceId:_0x1f9e2b,sourceLabel:_0x137adc})=>{const _0x33b405=_0x5cfbae?_0x5cfbae+':'+Ot():Ot();this['_reporter']['reportError'](_0x326e38),_0x326e38['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':ls(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-conversation-init-failed')||_0x326e38['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x4389bb),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x56a9bb),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x1f9e2b&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x1f9e2b),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x137adc||'source'),'id':_0x33b405})):_0x326e38['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x33b405}):_0x326e38['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x33b405}):this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x33b405});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x4a4fa5||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x13093d,attributes:_0x511389}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0xe0554b=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0xe0554b);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x13093d,'attributes':_0x511389});}['_removeFromContext'](_0x24beea){this['activeConversation']?.['removeFromContext'](_0x24beea);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x3c8912){const [_0x2c56d4,_0x7a22ca]=_0x3c8912['split'](':'),_0x20da74=this['activeConversation']['getInteraction'](_0x2c56d4);return{'interaction':_0x20da74,'reply':_0x20da74['getReply'](_0x7a22ca)};}['_scrollToSuggestionRange'](_0xc87f28,_0x3523a6=!0x1,_0x1a7b0b){const _0x288630={'target':_0x1a7b0b['editing']['view']['domConverter']['viewRangeToDom'](_0x1a7b0b['editing']['mapper']['toViewRange'](_0xc87f28)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x3523a6};_0x3523a6&&(_0x288630['alignToTop']=!0x0),St(_0x288630);}['_updateConversationTitle'](_0x165e22,_0x168e35=!0x1){this['_aiChatUi']['setConversationTitle'](_0x165e22||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x168e35);}['_addFeedItemReply'](_0x3a6d67){'text'===_0x3a6d67['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x3a6d67):this['_aiChatUi']['addFeedItemAISuggestion'](_0x3a6d67);}async['_updateReplyContent']({reply:_0x3715c3,renderingStrategy:_0x19a1ed}){const {id:_0x2547eb,interactionId:_0x40835d,isDone:_0x4cb64f,type:_0x210638,parsedContent:_0x485262}=_0x3715c3,_0x27ae17=_0x40835d+':'+_0x2547eb;if('modification'===_0x210638){const _0x8f55f4=_0x3715c3['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x27ae17,'parts':_0x8f55f4,'isDone':_0x4cb64f,'skipLoadingEffects':_0x3715c3['isFromHistory']});}else'text'===_0x210638&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x27ae17,'parsedContent':_0x485262['get']('text'),'renderingStrategy':_0x19a1ed,'isDone':_0x4cb64f});_0x4cb64f&&_0x3715c3['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x27ae17,_0x3715c3['sources']);}['_updateReplyContentThrottled']=_0x57ffe3(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x5cb877=this['activeConversation']?.['lastInteraction'];_0x5cb877&&(_0x5cb877['stop'](),this['_aiChatUi']['stopInteraction'](_0x5cb877)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x219236=this['activeConversation']?.['lastInteraction'];if(_0x219236){for await(const _0x5b2c18 of _0x219236['replies'])this['_aiChatUi']['hasFeedItem'](_0x5b2c18['id'])||this['_addFeedItemReply'](_0x5b2c18),await this['_updateReplyContent']({'reply':_0x5b2c18,'renderingStrategy':'static'});}}['_updateRatings'](_0x328a07){const _0x3ff386={'positiveCount':_0x328a07['changeGroups']['filter'](_0x2e1894=>'accepted'===_0x2e1894['state'])['length'],'totalCount':_0x328a07['changeGroups']['length'],'modificationId':_0x328a07['id']},_0xd12191=this['activeConversation']['getInteraction'](_0x328a07['interactionId'])['messageId'];_0xd12191&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0xd12191,_0x3ff386);}['_getAIChatFeedAPI'](_0x35cad6){const _0x15b297=this['_aiChatUi'],_0x39fdb6=()=>{_0x35cad6['resetWebSearchState'](),_0x35cad6['resetReasoningState'](),_0x15b297['clearLoadingMessage']();},_0x586607=()=>{_0x35cad6['currentReply']&&(_0x35cad6['currentReply']['done'](),_0x35cad6['currentReply']=void 0x0);};return{'insertTextReply':(_0x490c32,_0x1e8f33)=>{_0x586607(),_0x39fdb6();const _0xf5b710=_0x35cad6['currentReply']=_0x35cad6['createReply']({'type':'text','interactionId':_0x35cad6['id'],'id':_0x1e8f33||Ot(),'channelsToEditors':this['_channelsToEditors']});return _0xf5b710['appendContent'](_0x490c32),_0x586607(),_0xf5b710;},'insertCustomElement':async(_0x253287,_0x16980a)=>(_0x586607(),_0x39fdb6(),_0x15b297['addFeedItemCustomElement'](_0x253287,_0x16980a||Ot())),'setLoadingMessage':_0x1ea7a6=>{_0x15b297['setLoadingMessage'](_0x1ea7a6);},'clearLoadingMessage':()=>{_0x15b297['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){us(this['context'])['find'](_0x1402ef=>'destroyed'!==_0x1402ef['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(_0x351e54){const _0x28cee0=new AbortController();return{'promise':new Promise((_0x14dd70,_0x1c1a94)=>{const _0x1f44bd=setTimeout(_0x14dd70,_0x351e54);_0x28cee0['signal']['addEventListener']('abort',()=>{clearTimeout(_0x1f44bd),_0x1c1a94();});}),'abortController':_0x28cee0};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x2258fa){this['options']={'delay':_0x2258fa?.['delay']??0xa,'textNodeStyle':_0x2258fa?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0xd52a07,targetElement:_0x22c9d6,abortSignal:_0x19d647}){this['isStreaming']&&this['stop'](),_0x19d647?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x2c8968(_0xd52a07,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x8e5638=0x0;_0x8e5638<this['currentIndex'];_0x8e5638++)this['nodesList'][_0x8e5638]['shouldBeStreamed']=!0x0;do{const _0x4780a6=Date['now'](),_0x487449=this['nodesList'][this['currentIndex']],_0x95450d=_0x4780a6-this['lastUpdateTime'];if(_0x487449){_0x487449['shouldBeStreamed']=!0x0;let _0x2a5403=_0x487449['parent'];for(;_0x2a5403;)_0x2a5403['shouldBeStreamed']=!0x0,_0x2a5403=_0x2a5403['parent'];}if(_0x95450d<this['options']['delay'])try{const {promise:_0x403289,abortController:_0x4b540e}=xn(this['options']['delay']-_0x95450d);this['timeoutAbortController']=_0x4b540e,await _0x403289;}catch(_0x23d592){return;}_0x320955(_0x22c9d6,'<'+_0x22c9d6['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x22c9d6['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:_0x284d54}){Array['from'](_0x284d54['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x4c6f0d=>{_0x4c6f0d['replaceWith'](_0x4c6f0d['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0xf3e928){let _0x23a2f4='';if(function(_0x4d0d4a){return _0x779624(_0x4d0d4a);}(_0xf3e928)){for(const _0x435834 of _0xf3e928['children'])_0x23a2f4+=this['renderNode'](_0x435834);}else{if(Hn(_0xf3e928)){if(!_0xf3e928['shouldBeStreamed'])return'';const _0x4c427b=_0xf3e928,_0x4202b5=Object['entries'](_0x4c427b['attribs'])['map'](([_0x293df4,_0x182cc0])=>_0x293df4+'=\x22'+_0x182cc0+'\x22')['join']('\x20');_0x23a2f4+='<'+_0x4c427b['tagName']+(_0x4202b5?'\x20'+_0x4202b5:'')+'>';for(const _0x2fa1fa of ti(_0x4c427b))_0x23a2f4+=this['renderNode'](_0x2fa1fa);_0x23a2f4+='</'+_0x4c427b['tagName']+'>';}else{if(!Pn(_0xf3e928))return'';if(!_0xf3e928['shouldBeStreamed'])return'';!function(_0x43b1d2){return!(!_0x43b1d2['parent']||!Hn(_0x43b1d2['parent']))&&(!!Dn['includes'](_0x43b1d2['parent']['tagName'])&&!_0x4452ef(_0x43b1d2)['match'](/^\s*[<>]\s*$/));}(_0xf3e928)?_0x23a2f4+=_0x425375(_0xf3e928):_0x23a2f4+=_0x425375(new _0x11613c('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0xf3e928]));}}return _0x23a2f4;}['getParsedDocumentNodeList'](){const _0x3d1634=[];return function(_0x2ec421,_0x4336b7){const _0x4e2eef=_0x55486e=>{if(_0x4336b7(_0x55486e),_0x55486e instanceof _0x1b5cde)for(let _0x16d007=0x0;_0x16d007<_0x55486e['children']['length'];_0x16d007++){const _0x58c570=_0x55486e['children'][_0x16d007];_0x4e2eef(_0x58c570);}};for(let _0x51f9dd=0x0;_0x51f9dd<_0x2ec421['children']['length'];_0x51f9dd++)_0x4e2eef(_0x2ec421['children'][_0x51f9dd]);}(this['document'],_0x40592d=>{if(Pn(_0x40592d)){const _0x23d2bd=this['splitTextNodeIntoWordNodes'](_0x40592d);_0x23d2bd['length']&&_0x3d1634['push'](..._0x23d2bd);}_0x40592d['isWordSplitSource']||_0x40592d['isWordSplitResult']||_0x3d1634['push'](_0x40592d);}),_0x3d1634;}['splitTextNodeIntoWordNodes'](_0x432819){if(_0x432819['isWordSplitSource']||_0x432819['isWordSplitResult'])return[];const _0x28692b=_0x4452ef(_0x432819)['match'](/(?:\s*\S+\s*)/g),_0x586a46=[];if(_0x28692b&&_0x28692b['length']>0x1){for(const _0x509a24 of _0x28692b){const _0x14f0a8=new _0x1b2c94(_0x509a24);_0x14f0a8['isWordSplitResult']=!0x0,_0x28f757(_0x432819,_0x14f0a8),_0x586a46['push'](_0x14f0a8);}_0x432819['isWordSplitSource']=!0x0,_0x46f92a(_0x432819);}return _0x586a46;}};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(_0x152dfd){return _0x238b68(_0x152dfd);}function Hn(_0x5a528d){return _0x314fbd(_0x5a528d);}function Mn(_0x311674,_0x13fab3){_0x311674['cleanUpAnimations']({'targetElement':_0x13fab3}),_0x13fab3['querySelectorAll']('[data-id]')['forEach'](_0x3a990b=>{_0x3a990b['removeAttribute']('data-id');});}var Vn=class extends _0x4708a3{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x2ccb3b){super();const _0x4b374b=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x2ccb3b,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x4b374b['if']('isDone','ck-ai-chat__feed__item_done'),_0x4b374b['if']('isVisible','ck-hidden',_0x383f02=>!_0x383f02),'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'](_0x185332,_0x12c84d,_0x1b73ef){await this['htmlStreamer']['stream']({'document':_0x185332,'targetElement':_0x12c84d,'abortSignal':_0x1b73ef});}},Un=class extends _0x4708a3{['showChangesToggleView'];constructor(_0xf26bb0,_0x11b2ae){super(_0xf26bb0),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0xf26bb0),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+cn,'label':ls(_0xf26bb0,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x11b2ae['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x559cb4=>_0x559cb4?tt:_0x2973b4),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x27c41e=new Wt();_0x27c41e['content']=_0x1445d9,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x11b2ae['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x27c41e,{'tag':'span','children':[ls(_0xf26bb0,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Pt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x3c414c,'rejected':_0x56ff1c,'outdated':_0x56ff1c};var Fn=class extends _0x4708a3{['stateIconView'];constructor(_0x208a2b){super(_0x208a2b);const _0x3e3109=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',_0x3e3109['to']('state',_0x13d2d4=>'ck-ai-suggestion__content-part-state_'+_0x13d2d4),_0x3e3109['if']('isVisible','ck-hidden',_0x4da710=>!_0x4da710)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x3e3109['to']('state',_0x457289=>{switch(_0x457289){case'accepted':return ls(_0x208a2b,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return ls(_0x208a2b,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return ls(_0x208a2b,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x310c5d){this['state']=_0x310c5d;}},Kn=class extends Wt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x4b90d1{['_applyButton'];['_suggestButton'];constructor(_0x52e51c,_0x201abd,_0x387161){super(_0x52e51c);const _0x46061e=Boolean(_0x387161);this['set']('isEnabled',!_0x46061e),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x45ce82=[];if(_0x46061e){const _0x1fa93e=new Pt(_0x52e51c);_0x1fa93e['set']({'label':ls(_0x52e51c,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x181c93}),_0x1fa93e['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x45ce82['push'](_0x1fa93e);}else{_0x201abd['includes']('applySuggestion')&&(this['_applyButton']=new Pt(_0x52e51c),this['_applyButton']['set']({'label':ls(_0x52e51c,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3c414c}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x3fbc0f=>!_0x3fbc0f),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x45ce82['push'](this['_applyButton'])),_0x201abd['includes']('insertSuggestion')&&(this['_suggestButton']=new Pt(_0x52e51c),this['_suggestButton']['set']({'label':ls(_0x52e51c,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0xa46cb9}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x45ce82['push'](this['_suggestButton']));const _0x331ca3=new Pt(_0x52e51c);_0x331ca3['set']({'label':ls(_0x52e51c,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x56ff1c}),_0x331ca3['bind']('isEnabled')['to'](this),_0x331ca3['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x45ce82['push'](_0x331ca3);}this['items']['addMany'](_0x45ce82);const _0x4a5a24=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x4a5a24['if']('isVisible','ck-hidden',_0xdf0d86=>!_0xdf0d86)]}});}['setButtonsVisibility']({showApplyButton:_0x4713a1,showSuggestButton:_0x77f74b}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x4713a1),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x77f74b);}},Yn=class extends _0x4708a3{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x345bc9,{part:_0x41f2e4,uiIndex:_0x52d904,availableActions:_0x521fbd,areActionsDisabled:_0x1edc05}){super(_0x345bc9),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x345bc9,_0x521fbd,_0x1edc05),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x41f2e4['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x41f2e4['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x41f2e4['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x345bc9),this['titleLabelView']=new $n(_0x345bc9,_0x52d904),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',(_0x44be2d,_0x16ddba,_0x28bbe2,_0x286a90)=>{'pending'===_0x286a90?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x28bbe2?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x28bbe2),this['children']['add'](this['stateView']));});}},$n=class extends _0x4708a3{constructor(_0x278338,_0x33982c){super(_0x278338),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[ls(_0x278338,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x33982c['toString']())]});}},qn=class extends _0x4708a3{['htmlStreamer'];constructor(_0x598287){super(_0x598287),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:_0x43466b,renderingStrategy:_0x6ae58,abortSignal:_0x253a3f}){const _0x156561=_0x2c8968(_0x43466b['content'],!0x0);for(const _0x46e7c7 of Ts(_0x156561))_0x46f92a(_0x46e7c7);'streaming'===_0x6ae58?await this['htmlStreamer']['stream']({'document':_0x156561,'targetElement':this['element'],'abortSignal':_0x253a3f}):_0x320955(this['element'],'<'+this['element']['tagName']+'>'+ps(_0x156561)+'</'+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 _0x4708a3{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x3b248b,{part:_0x1d4aae,uiIndex:_0x5dfc8d,areActionsDisabled:_0x8f7ef9,availableActions:_0x54de18}){super(_0x3b248b);const _0x4aa17d=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 _0x3bee96=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x8f7ef9;};this['on']('change:state',_0x3bee96),this['on']('change:isDone',_0x3bee96),_0x3bee96(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x3b248b,{'part':_0x1d4aae,'uiIndex':_0x5dfc8d,'availableActions':_0x54de18,'areActionsDisabled':_0x8f7ef9}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x3b248b),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x4aa17d['to']('state',_0x207738=>'ck-ai-suggestion__body__content-part_'+_0x207738),_0x4aa17d['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x4aa17d['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x4aa17d['if']('isVisible','ck-hidden',_0x450856=>!_0x450856)]},'children':this['_children'],'on':{'mouseenter':_0x4aa17d['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x1d4aae['index']});}),'mouseleave':_0x4aa17d['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x1d4aae['index']});}),'click':_0x4aa17d['to'](_0x595f28=>{const _0x2c2ea5=_0x595f28['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2c2ea5)&&this['fire']('showChangeInText',{'index':_0x1d4aae['index']});})}});}async['updateContent']({part:_0x5ec49c,showUnchangedParts:_0x203f91=!0x1,abortSignal:_0x2438df}){this['partDefinition']=_0x5ec49c,this['isVisible']=this['partDefinition']['hasChanges']||_0x203f91,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x5ec49c,'renderingStrategy':'static','abortSignal':_0x2438df});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x4708a3{constructor(_0x28b334,_0x1b8b60){super(_0x28b334),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x186cbc=>!_0x186cbc)]},'children':this['_createSkeletonItems'](_0x1b8b60)});}['_createSkeletonItems'](_0x15e848){const _0x4ed03c=['ck','ck-ai-skeleton__item'];return _0x15e848['map'](_0x5191a1=>{let _0x3a57d8='';switch(_0x5191a1['attributes']['align']){case'right':_0x3a57d8='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x3a57d8='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x3a57d8='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x5191a1['tag'],'attributes':{'class':[..._0x4ed03c,_0x5191a1['attributes']['class']?_0x5191a1['attributes']['class']:''],'style':'width:\x20'+_0x5191a1['attributes']['width']+';\x20height:\x20'+_0x5191a1['attributes']['height']+';'+_0x3a57d8}};});}};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(_0x2c0b81,_0x3fd8d9,_0xf072ce,_0x5cf0e7){return new Array(_0x2c0b81)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x3fd8d9,'height':_0xf072ce,'align':_0x5cf0e7}}));}const Jn=/* #__PURE__ -- @preserve */
33
- lt();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x320c9b){const _0x1d4a87=this['createTask'](_0x320c9b);return this['queue']['push'](_0x1d4a87),this['_processQueue'](),_0x1d4a87['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(_0x2ca355=>{this['once']('_queueEmpty',()=>{_0x2ca355();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1aac4b=this['queue']['shift']();try{await _0x1aac4b['callback'](this['_abortController']['signal']),_0x1aac4b['resolve']();}catch(_0x44e643){_0x1aac4b['reject'](_0x44e643);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x4c2ee2){let _0x2669cf,_0x35158b;const _0x6a060b=new Promise((_0x105b38,_0x1d0023)=>{_0x2669cf=_0x105b38,_0x35158b=_0x1d0023;});return{'callback':_0x4c2ee2,'resolve':_0x2669cf,'reject':_0x35158b,'completePromise':_0x6a060b};}},tr=class extends Vn{constructor(_0x4607d2){super(_0x4607d2),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x4607d2['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x309968){this['element']['innerHTML']=_0x309968;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x4708a3{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x29c45d,_0x3e93ba=[...er],_0x5eb19b){super(_0x29c45d);const _0x31c04=this['bindTemplate'],_0x12943c=Boolean(_0x5eb19b);if(this['set']('isEnabled',!_0x12943c),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x12943c){const _0x100816=new Pt(_0x29c45d);_0x100816['set']({'label':ls(_0x29c45d,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x181c93}),_0x100816['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x2211db=new _0x4708a3(_0x29c45d);_0x2211db['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[ls(_0x29c45d,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x100816]}]}),this['children']['add'](_0x2211db);}else this['_applyChangesButton']=new Pt(_0x29c45d),this['_applyChangesButton']['set']({'label':ls(_0x29c45d,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3e93ba['includes']('applySuggestion'),'class':an}),this['_insertSuggestionsButton']=new Pt(_0x29c45d),this['_insertSuggestionsButton']['set']({'label':ls(_0x29c45d,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x3e93ba['includes']('insertSuggestion'),'class':hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x28df10=>{_0x28df10['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',_0x31c04['if']('isVisible','ck-hidden',_0x1e5659=>!_0x1e5659)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x2fc055){this['isVisible']=_0x2fc055;}['_switchButtonLabelsPlurality'](_0x5b98df){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x5b98df?(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},sr=class extends _0x4708a3{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x526153,_0x507789){super(_0x526153),this['bodyCollection']=_0x507789,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',_0x1c36e5=>!_0x1c36e5)]},'children':this['children']});const _0x501760=new _0x4708a3(this['locale']),_0x3e55b7=new Wt();_0x3e55b7['content']=ot,_0x501760['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3e55b7,{'tag':'span','children':[{'text':ls(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x501760),this['_setupBalloonPanel'](_0x526153);}['addSource'](_0x567648){this['children']['add'](new nr(this['locale'],_0x567648,this['balloonPanelView']));}['_setupBalloonPanel'](_0x1c1470){this['balloonPanelView']=new Nt(_0x1c1470),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Pt{['balloonPanelView'];['source'];constructor(_0x2603cc,_0x28cc4f,_0x5387a1){super(_0x2603cc),this['source']=_0x28cc4f,this['balloonPanelView']=_0x5387a1,this['set']({'label':_0x28cc4f['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x56e053=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x56e053['to'](()=>{window['open'](_0x28cc4f['url'],'_blank');}),'mouseenter':_0x56e053['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x56e053['to'](()=>{this['_hideTooltip']();})}}),_0x28cc4f['favicon']){const _0x91f88b=new _0x4708a3(_0x2603cc);_0x91f88b['setTemplate']({'tag':'img','attributes':{'src':_0x28cc4f['favicon']||ot,'alt':_0x28cc4f['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x91f88b);}else this['set']('icon',ot);}['_createTooltipContentView'](_0x1a928c,_0x588c14){const _0x5aa8a7=new _0x4708a3(_0x1a928c),_0x30ae29=[];let _0x4c74ab;_0x588c14?.['favicon']?(_0x4c74ab=new _0x4708a3(_0x1a928c),_0x4c74ab['setTemplate']({'tag':'img','attributes':{'src':_0x588c14['favicon'],'alt':_0x588c14['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x4c74ab=new Wt(),_0x4c74ab['content']=ot,_0x4c74ab['extendTemplate']({'attributes':{'alt':_0x588c14['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x30ae29['push'](_0x4c74ab);const _0x1e8dc7=new _0x4708a3(_0x1a928c);_0x1e8dc7['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x588c14['url']},'children':[{'text':new URL(_0x588c14['url'])?.['hostname']}]}),_0x30ae29['push'](_0x1e8dc7);const _0x4a03da=new _0x4708a3(_0x1a928c);_0x4a03da['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x30ae29});const _0x3f3bd1=new _0x4708a3(_0x1a928c);return _0x3f3bd1['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x588c14['title']['length']>0x190?_0x588c14['title']['substring'](0x0,0x190)+'...':_0x588c14['title']}]}),_0x5aa8a7['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x4a03da,_0x3f3bd1]}),_0x5aa8a7;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthWest'],Nt['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 _0x5183a3=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5183a3);}},rr=class extends _0x4708a3{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x1c2d83(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x32bca6,_0x1bae68){super(_0x32bca6);const {areActionsDisabled:_0x3e08f2,showUnchangedParts:_0x2bc417,availableActions:_0xa7439c}=_0x1bae68;this['_areActionsDisabled']=_0x3e08f2,this['_showUnchangedParts']=_0x2bc417,this['_availableActions']=_0xa7439c,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x32bca6,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':ls(_0x32bca6,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x32bca6,_0x1bae68['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x1bae68['bodyCollection']),_0x1bae68['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'](_0x50b67c=>_0x50b67c instanceof Qn);}async['updateContentParts']({parts:_0x347422,abortSignal:_0x55a28a,skipLoadingEffects:_0x2e9bf5}){this['_cachedContentParts']['length']?_0x347422['forEach'](_0x13291c=>{const _0x284ac1=this['_cachedContentParts']['findIndex'](_0x436076=>_0x436076['index']==_0x13291c['index']);-0x1===_0x284ac1?this['_cachedContentParts']['push'](_0x13291c):this['_cachedContentParts'][_0x284ac1]=_0x13291c;}):this['_cachedContentParts']=_0x347422;const _0x41c1bb=this['_showUnchangedParts']?_0x347422:_0x347422['filter'](_0x2f7509=>_0x2f7509['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x41c1bb['length']>0x1),_0x2e9bf5&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x29db9b of _0x41c1bb)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x44ef65=>{let _0x158665=this['getPartView'](_0x29db9b['index']);if(!_0x158665){if(_0x158665=new Qn(this['locale'],{'part':_0x29db9b,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x158665['delegate'](...Nn)['to'](this),_0x158665['bind']('isTrackChangesOn')['to'](this),!_0x2e9bf5&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x44ef65),_0x44ef65['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x158665,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x2e9bf5||this['_showSkeletonDebounced']();}await _0x158665['updateContent']({'part':_0x29db9b,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x44ef65}),_0x158665['markAsDone']();});return _0x55a28a?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x4a722f,_0x2667a2){const _0x1ecb70=this['getPartView'](_0x4a722f);_0x1ecb70&&(_0x1ecb70['state']=_0x2667a2),this['hasPendingParts']='pending'==_0x2667a2||this['_contentPartViews']['some'](_0x66fa0f=>'pending'==_0x66fa0f['state']);}['setPartActive'](_0x121187,_0x7a628){if(!0x1===_0x121187){for(const _0x2ef2b6 of this['_contentPartViews'])_0x2ef2b6['isActive']=!0x1;}else{const _0x4eab0f=this['getPartView'](_0x121187);_0x4eab0f&&(_0x4eab0f['isActive']=_0x7a628);}}['updateSources'](_0x7ad93f){_0x7ad93f['forEach'](_0xb2755a=>this['_sourcesView']['addSource'](_0xb2755a)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x558f4f){return this['_contentPartViews']['find'](_0xdc0b18=>_0xdc0b18['partDefinition']['index']==_0x558f4f)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x149d50=!this['_cachedContentParts']['find'](({hasChanges:_0x36b90f})=>_0x36b90f),_0x2ce446=!!this['_cachedContentParts']['find'](({hasChanges:_0x12ffae})=>!_0x12ffae);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x2ce446,_0x149d50?this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x248846=>_0x248846['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x5e6ee7){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x241acf=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x241acf>0x0){const {promise:_0x494f9b,abortController:_0x1f17d2}=xn(_0x241acf);_0x5e6ee7?.['addEventListener']('abort',()=>_0x1f17d2['abort']()),await _0x494f9b['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x459a89=>_0x459a89['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x4708a3{['bodyView'];['children'];['headerView'];constructor(_0x5452c0,_0x5053a1,_0x46a1c1){super(_0x5452c0);const {showDiff:_0x1fd3c8,areActionsDisabled:_0x1024d0,showUnchangedParts:_0x380709,availableActions:_0xf91ac2}=_0x5053a1;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x5452c0,{'showDiff':_0x1fd3c8}),this['headerView']['on']('toggleShowChanges',(_0x28c2ce,_0x3b1c12)=>{this['areChangesVisible']=_0x3b1c12['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x3b1c12['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x5452c0,{'areActionsDisabled':_0x1024d0,'showUnchangedParts':!!_0x380709,'availableActions':_0xf91ac2,'bodyCollection':_0x46a1c1}),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'](_0xa0894b){await this['bodyView']['updateContentParts'](_0xa0894b);}['updateSources'](_0x25cf33){this['bodyView']['updateSources'](_0x25cf33);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x49823e,_0xd74535,_0x40153b){super(_0xd74535),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x49823e,{'showDiff':_0xd74535['showDiff'],'areActionsDisabled':_0xd74535['areActionsDisabled'],'availableActions':_0xd74535['availableActions']},_0x40153b),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x3ae36c,_0x323000)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x323000['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',(_0x257a72,{index:_0xa3ddd})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0xa3ddd});}),this['containerView']['on']('applySuggestion',(_0x549071,{index:_0x36af1d}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x36af1d});}),this['containerView']['on']('insertSuggestion',(_0x33e513,{index:_0xcb51b9}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0xcb51b9});}),this['containerView']['on']('rejectSuggestion',(_0x405dc4,{index:_0x527af3})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x527af3});}),this['containerView']['on']('mouseOverSuggestion',(_0x36f21e,{index:_0x3d3ba6})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3d3ba6});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x1537f3,{index:_0x799fe9})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x799fe9});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x181001){await this['containerView']['updateContent'](_0x181001);}['updatePartState'](_0x30474d,_0x352663){this['containerView']['bodyView']['updatePartState'](_0x30474d,_0x352663);}['setPartActive'](_0x477eb5,_0x21b6b6){!0x1===_0x477eb5?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x477eb5,_0x21b6b6);}['updateSources'](_0x7de688){this['containerView']['updateSources'](_0x7de688);}['getPartView'](_0x1a864f){return this['containerView']['bodyView']['getPartView'](_0x1a864f);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x22a51c,_0x47a154,_0x3afaec){super(_0x47a154),this['_bodyCollection']=_0x3afaec,this['locale']=_0x22a51c,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x4708a3(),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':Is(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x308762,renderingStrategy:_0x14601e,abortSignal:_0x111a5d}){'streaming'===_0x14601e?await this['streamIntoElement'](_0x308762,this['replyContainer']['element'],_0x111a5d):this['replyContainer']['element']['innerHTML']=_0x425375(_0x308762);}['updateSources'](_0x10da34){const _0x47e4f3=new sr(this['locale'],this['_bodyCollection']);_0x47e4f3['children']['addMany'](_0x10da34['map'](_0x3d2388=>new nr(this['locale'],_0x3d2388,_0x47e4f3['balloonPanelView']))),_0x47e4f3['isVisible']=!0x0,this['children']['add'](_0x47e4f3);}},cr=class extends _0x17e663{constructor(_0x56cd38=void 0x0){super();const _0x2efe3b=_0x56cd38?'ck-ai-spinner_'+_0x56cd38:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x2efe3b]}});}};const lr={'file':_0x1bcaaf,'image':_0x196f31,'document':_0x1445d9,'web-resource':_0x3ee98b,'text':_0x1bcaaf,'selection':_0xab00a8,'mcp-tool-context':_0x1445d9},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 Pt{constructor(_0x1408ff,_0x2c2d99,_0xadf665,_0x38e3bf,_0x3d5c83=!0x1){super(_0x1408ff),this['_isAnimationOnEnterEnabled']=_0x38e3bf,this['_initializeProperties'](_0x2c2d99,_0xadf665,_0x3d5c83),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'](_0x26d345,_0x1d219e,_0x28a81a){this['set']('label',_0x26d345['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x26d345['type']),this['set']('id',_0x26d345['uiId']),this['set']('readonly',_0x1d219e),this['set']('isLoading',_0x28a81a);}['_setupTemplate'](){const _0x431e05=this['_createIconView'](),_0x4462dc=this['_createRemoveButton'](),_0x35150c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x35150c),'children':this['_createTemplateChildren'](_0x431e05,_0x4462dc,_0x35150c)});}['_createTemplateAttributes'](_0xd11930){return{'class':[ur,_0xd11930['if']('itemType',_r,_0xa4a176=>'document'==_0xa4a176),_0xd11930['if']('itemType',dr,_0x4813ef=>'selection'==_0x4813ef)],'data-cke-tooltip-text':_0xd11930['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x3ec1ee,_0x44b02b,_0x458c8d){const _0x50c2f7=this['_createLabelElement'](_0x458c8d),_0x3d96f7=this['_createLoaderIcon']();return this['readonly']?[_0x3ec1ee,_0x50c2f7]:[_0x3ec1ee,_0x3d96f7,_0x50c2f7,_0x44b02b];}['_createLabelElement'](_0x5a99a5){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x5a99a5['to']('label')}]};}['_createRemoveButton'](){const _0x2767a0=new Pt(this['locale']);return _0x2767a0['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x544e33}),this['_setupRemoveButtonEvent'](_0x2767a0),_0x2767a0;}['_setupRemoveButtonEvent'](_0x4847d7){_0x4847d7['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x50e98c=this['bindTemplate'],_0xf76216=new Wt();return _0xf76216['content']=lr[this['itemType']],_0xf76216['extendTemplate']({'attributes':{'class':[Ar,_0x50e98c['if']('isLoading','ck-hidden',_0x35ce18=>_0x35ce18)]}}),_0xf76216;}['_handleAnimationEndOnce'](_0x3be593,_0x539c93){if(!_0x3be593)return;const _0x25b819=()=>{_0x539c93(),_0x3be593['removeEventListener']('animationend',_0x25b819),_0x3be593['removeEventListener']('webkitAnimationEnd',_0x25b819);};_0x3be593['addEventListener']('animationend',_0x25b819),_0x3be593['addEventListener']('webkitAnimationEnd',_0x25b819);}['_createLoaderIcon'](){const _0x2c866a=new cr('small');return _0x2c866a['bind']('isVisible')['to'](this,'isLoading',_0x5b4df0=>_0x5b4df0),_0x2c866a;}};function Er(_0x1f49b1){if(!_0x1f49b1)return _0x1f49b1;if(_0x1f49b1['length']<=0x78)return _0x1f49b1;const _0x55cf02=_0x1f49b1['slice'](0x0,0x78),_0x84d0de=_0x55cf02['lastIndexOf']('\x20');return(_0x84d0de>0x0?_0x55cf02['slice'](0x0,_0x84d0de):_0x55cf02)+'…';}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(_0x4416ca,_0x4d3650,_0x332c18,_0x469cd1,_0x4b27a5){this['_locale']=_0x4416ca,this['_visibleChips']=_0x4d3650,this['_config']={...Tr,..._0x332c18,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x332c18['cssClasses']}},this['_overflowChips']=new ht(),this['_bodyCollection']=_0x469cd1,this['_parentView']=_0x4b27a5||null;}['setContainerElement'](_0x31478c){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x31478c,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 _0x3d721e=[...this['_visibleChips'],...this['_overflowChips']],_0x1fd292=this['_createCalculationContainer'](),_0x5bd084=this['_calculateOverflowInContainer'](_0x1fd292,_0x3d721e),_0x38177f=_0x1fd292['_ancestorsToRestore'];_0x38177f&&this['_restoreAncestorVisibility'](_0x38177f),_0x1fd292['remove'](),this['_applyOverflowResults'](_0x3d721e,_0x5bd084);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0xfcbf0e({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0xc0f412=new Pt(this['_locale']);_0xc0f412['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x5ac771=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x5ac771['push'](this['_config']['cssClasses']['controlsButton']),_0xc0f412['extendTemplate']({'attributes':{'class':_0x5ac771}}),_0xc0f412;}['_createShowMoreBalloonPanelView'](){const _0x33aa69=new Nt(this['_locale']);return _0x33aa69['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x33aa69),_0x33aa69;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x13a8e1=>{_0x13a8e1['disableAnimationOnEnter']();});const _0x30b4b5=new _0x4708a3(this['_locale']);_0x30b4b5['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x30b4b5);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x4f56f7=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x4f56f7?'':'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'](_0x3d7cd3){const _0xd78a77=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x4339a1=this['_containerElement']?.['classList'];if(_0x4339a1){const _0x286cf0=_0x4339a1[0x0]||'',_0x1ce93f=_0x3d7cd3['querySelector']('.'+_0x286cf0),_0x376396=_0x3d7cd3['querySelector'](_0xd78a77);return _0x1ce93f||_0x376396||_0x3d7cd3;}return _0x3d7cd3['querySelector'](_0xd78a77)||_0x3d7cd3;}['_calculateContainerWidth'](){const _0x529ace=this['_parentView']?.['element']||this['_containerElement'];if(!_0x529ace)return wr;const _0x52b975=window['getComputedStyle'](_0x529ace)['width'];if('auto'===_0x52b975||'0px'===_0x52b975||!_0x52b975){const _0x4ee5c7=_0x529ace['parentElement'];if(_0x4ee5c7){const _0x561a39=window['getComputedStyle'](_0x4ee5c7);return'auto'!==_0x561a39['width']?_0x561a39['width']:wr;}return wr;}return _0x52b975;}['_applyCalculationStyles'](_0x159e04,_0xbb7aeb){this['_config']['cssClasses']['calculationContainer']&&_0x159e04['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x159e04['style']['width']=_0xbb7aeb,_0x159e04['style']['position']='absolute',_0x159e04['style']['top']='-9999px',_0x159e04['style']['left']='-9999px',_0x159e04['style']['opacity']='0',_0x159e04['style']['pointerEvents']='none',_0x159e04['style']['zIndex']='-1',_0x159e04['style']['visibility']='visible\x20!important',_0x159e04['style']['display']='block\x20!important',_0x159e04['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x164bc7){_0x164bc7['forEach'](({element:_0x5a3908,originalDisplay:_0x3ebaa6,originalVisibility:_0x5ae499})=>{_0x5a3908['style']['display']=_0x3ebaa6,_0x5a3908['style']['visibility']=_0x5ae499;});}['_makeAncestorsVisible'](_0x1cb6b1){const _0x528608=[];let _0x470b8b=_0x1cb6b1;for(;_0x470b8b&&_0x470b8b!==document['body'];){const _0x407140=window['getComputedStyle'](_0x470b8b);'none'!==_0x407140['display']&&'hidden'!==_0x407140['visibility']||(_0x528608['push']({'element':_0x470b8b,'originalDisplay':_0x470b8b['style']['display'],'originalVisibility':_0x470b8b['style']['visibility']}),_0x470b8b['style']['display']='block',_0x470b8b['style']['visibility']='visible'),_0x470b8b=_0x470b8b['parentElement'];}return _0x528608;}['_createContainerElements'](){let _0x51a0cd,_0x639cc4;return this['_parentView']?.['element']?(_0x51a0cd=this['_parentView']['element']['cloneNode'](!0x0),_0x639cc4=this['_findTargetContainer'](_0x51a0cd)):(_0x51a0cd=document['createElement']('div'),_0x639cc4=_0x51a0cd),{'calculationContainer':_0x51a0cd,'targetContainer':_0x639cc4};}['_createCalculationContainer'](){const {calculationContainer:_0xa64866,targetContainer:_0x675d83}=this['_createContainerElements'](),_0x40a86f=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0xa64866,_0x40a86f);const _0x26ee01=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x26ee01?_0x26ee01['appendChild'](_0xa64866):document['body']['appendChild'](_0xa64866),_0xa64866['_targetContainer']=_0x675d83;const _0x4e1649=this['_makeAncestorsVisible'](_0x26ee01||null);return _0xa64866['offsetWidth'],_0xa64866['_ancestorsToRestore']=_0x4e1649,_0xa64866;}['_calculateOverflowInContainer'](_0x125b35,_0x32cd64){const _0x481dd9=_0x125b35['_targetContainer']||_0x125b35,_0x18dcc2=[],{rowCount:_0xd608f4}=this['_renderChipsAndCountRows'](_0x481dd9,_0x32cd64);if(_0xd608f4<=this['_config']['maxVisibleRows'])return _0x18dcc2;const _0x54dd53=_0x32cd64['slice']();for(;_0x54dd53['length']>0x0;){if(this['_testButtonFit'](_0x125b35,_0x481dd9,_0x54dd53)){const _0xec31ec=_0x32cd64['filter'](_0x7a2fc8=>!_0x54dd53['includes'](_0x7a2fc8));_0x18dcc2['push'](..._0xec31ec);break;}if(!_0x54dd53['pop']())break;}return _0x18dcc2;}['_renderChipsAndCountRows'](_0x44b23c,_0x2d3f0a){_0x44b23c['innerHTML']='',_0x2d3f0a['forEach'](_0x5a3f5a=>{if(_0x5a3f5a['element']){const _0x422860=_0x5a3f5a['element']['cloneNode'](!0x0);_0x44b23c['appendChild'](_0x422860);}}),_0x44b23c['offsetWidth'];const _0x4b98e6=_0x44b23c['children'],_0x236878=[];return Array['from'](_0x4b98e6)['forEach'](_0x16c9ef=>{const _0x2a6eb3=_0x16c9ef['getBoundingClientRect']()['top'];_0x236878['some'](_0x4736bb=>Math['abs'](_0x4736bb-_0x2a6eb3)<this['_config']['rowDetectionTolerance'])||_0x236878['push'](_0x2a6eb3);}),{'rowCount':_0x236878['length']};}['_createMockButton'](){const _0x13d1e4=document['createElement']('button');return _0x13d1e4['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x13d1e4['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x13d1e4['textContent']='+\x201',_0x13d1e4;}['_testButtonFit'](_0x346a1d,_0x177923,_0x481ae1){this['_renderChipsAndCountRows'](_0x177923,_0x481ae1);const _0x3b2f6f=this['_createMockButton']();_0x346a1d['appendChild'](_0x3b2f6f),_0x346a1d['offsetWidth'];const _0x1294d6=[..._0x177923['children'],_0x3b2f6f],_0x3bcbdc=[];_0x1294d6['forEach'](_0x42c4de=>{const _0x572fc9=_0x42c4de['getBoundingClientRect']()['top'];_0x3bcbdc['some'](_0x234ca7=>Math['abs'](_0x234ca7-_0x572fc9)<this['_config']['rowDetectionTolerance'])||_0x3bcbdc['push'](_0x572fc9);});const _0xbf62f9=_0x3bcbdc['length'];return _0x3b2f6f['remove'](),_0xbf62f9<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x5c5cf2,_0x171527){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x5c5cf2['forEach'](_0x41e19e=>{_0x171527['includes'](_0x41e19e)?this['_overflowChips']['add'](_0x41e19e):this['_visibleChips']['add'](_0x41e19e);});}['_updateOverflowUI'](_0x51389b){if(_0x51389b>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x51389b>0x0&&this['_showMoreButtonView']){const _0x43ba86=''+this['_config']['showMoreLabelPrefix']+(_0x51389b<0x63?_0x51389b:'99');this['_showMoreButtonView']['label']=_0x43ba86;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x2bff8a,_0x5a6448){this['_distributeChips'](_0x2bff8a,_0x5a6448),this['_updateOverflowUI'](_0x5a6448['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x122755=>{_0x122755[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 _0x11850a=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x11850a['width']||0x0===_0x11850a['height'])return!0x1;const _0x5b362f=window['innerHeight']||document['documentElement']['clientHeight'],_0x1b0be8=window['innerWidth']||document['documentElement']['clientWidth'];return _0x11850a['bottom']>=-0xc8&&_0x11850a['top']<=_0x5b362f+0xc8&&_0x11850a['right']>=-0xc8&&_0x11850a['left']<=_0x1b0be8+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 _0x4708a3{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x414a77,_0x26ec36,_0x17c25c){super(_0x414a77),this['_bodyCollection']=_0x17c25c,this['_createContextChips'](_0x26ec36);const _0x1a2110={'cssClasses':{'showMoreButton':Or+'\x20'+cn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x414a77,this['_contextChips'],_0x1a2110,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 _0x320647=this['element']['querySelector']('.'+br);_0x320647&&(this['_overflowManager']['setContainerElement'](_0x320647),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x323f9e){for(const _0x8b6465 of _0x323f9e){const _0x9ca3e5=new mr(this['locale'],_0x8b6465,!0x0,!0x1);this['_contextChips']['add'](_0x9ca3e5);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0xa9bdb4,_0x3d32cf,_0x51b7e1){super(_0x3d32cf),this['_locale']=_0xa9bdb4,this['_bodyCollection']=_0x51b7e1,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'](_0x36890d=>!_0x36890d['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x4708a3(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(_0x11b896,_0x7568f7){super(_0x7568f7);const {isWebSearchEnabled:_0x1ff472,isReasoningEnabled:_0x6a6606}=_0x7568f7['capabilities'],_0x26098c=[];let _0x2ca5ee='';_0x1ff472&&_0x6a6606?(_0x2ca5ee=ls(_0x11b896,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x26098c['push'](xr(ot)),_0x26098c['push'](xr(_0xae43e5))):_0x1ff472?(_0x2ca5ee=ls(_0x11b896,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x26098c['push'](xr(ot))):_0x6a6606&&(_0x2ca5ee=ls(_0x11b896,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x26098c['push'](xr(_0xae43e5))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x2ca5ee?'':'ck-hidden']}});const _0x175621=new _0x4708a3();_0x175621['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x26098c,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x2ca5ee]}]}),this['children']['add'](_0x175621),this['capabilities']=_0x7568f7['capabilities'];}};function xr(_0x598a30){const _0x2914b9=new Wt();return _0x2914b9['content']=_0x598a30,_0x2914b9;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x63ce0){this['element']=_0x63ce0,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x52cd66 of Lr){const _0x47da9f='keydown'!==_0x52cd66;this['element']['addEventListener'](_0x52cd66,this['_onUserEvent']['bind'](this),{'passive':_0x47da9f,'signal':this['abortController']['signal']});}}['start']({smooth:_0x1359e3=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x1359e3?'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'](_0x5dce3e){if(this['isRunning']){if('keydown'===_0x5dce3e['type']){const _0x3552c8=_0x5dce3e['key'];if(!Dr['includes'](_0x3552c8))return;}_0x5dce3e instanceof WheelEvent?_0x5dce3e['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x21e012,scrollHeight:_0x595bbc,clientHeight:_0x2e5ace}=this['element'];return _0x595bbc-_0x21e012-_0x2e5ace<=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(_0x30d794){super(_0x30d794),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 _0x4708a3{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x13f297,_0x419021){super(_0x13f297),this['_bodyCollection']=_0x419021,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'](_0x2fddbf,_0x1f419d){let _0x1d3129;return'ai-reply'===_0x2fddbf?_0x1d3129=new hr(this['locale'],_0x1f419d,this['_bodyCollection']):'ai-suggestion-reply'===_0x2fddbf?(_0x1d3129=new ar(this['locale'],_0x1f419d,this['_bodyCollection']),_0x1d3129['bind']('isTrackChangesOn')['to'](this)):_0x1d3129='user-message'===_0x2fddbf?new Nr(this['locale'],_0x1f419d,this['_bodyCollection']):'interaction-header'===_0x2fddbf?new yr(this['locale'],_0x1f419d):'custom-element'===_0x2fddbf?new Hr(_0x1f419d):new tr(_0x1f419d),this['children']['add'](_0x1d3129),_0x1d3129;}async['updateReplyItem']({id:_0xbb8d32,parsedContent:_0x551af0,renderingStrategy:_0x19bc86,abortSignal:_0x10b614}){const _0x50ddfb=this['getItemById'](_0xbb8d32);if(!(_0x50ddfb instanceof hr))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x50ddfb,'id':_0xbb8d32,'parsedContent':_0x551af0});await _0x50ddfb['updateContent']({'parsedContent':_0x551af0,'renderingStrategy':_0x19bc86,'abortSignal':_0x10b614});}async['updateWebSources'](_0x4a9a73,_0xd2c0df){const _0x5ad3e9=this['getItemById'](_0x4a9a73);if(_0x5ad3e9 instanceof ar)_0x5ad3e9['updateSources'](_0xd2c0df);else{if(!(_0x5ad3e9 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x5ad3e9,'id':_0x4a9a73,'sources':_0xd2c0df});_0x5ad3e9['updateSources'](_0xd2c0df);}}async['updateSuggestionItem']({id:_0x1e1a5d,parts:_0x1c7bb6,abortSignal:_0x37d26b,skipLoadingEffects:_0x137d16}){const _0x29ef09=this['getItemById'](_0x1e1a5d);if(!(_0x29ef09 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x29ef09,'id':_0x1e1a5d,'parts':_0x1c7bb6});await _0x29ef09['updateContent']({'parts':_0x1c7bb6,'abortSignal':_0x37d26b,'skipLoadingEffects':_0x137d16});}['updateSuggestionPartState']({id:_0x4a6717,index:_0x3b23f8,state:_0x59bbdf}){const _0x28bb15=this['getItemById'](_0x4a6717);if(!(_0x28bb15 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4a6717});_0x28bb15['updatePartState'](_0x3b23f8,_0x59bbdf);}['setSuggestionPartActive']({id:_0x3ba8c2,index:_0x538655,isActive:_0x41ecf7}){const _0x184716=this['getItemById'](_0x3ba8c2);if(!(_0x184716 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3ba8c2});this['children']['filter'](_0x34ba6c=>_0x34ba6c instanceof ar)['forEach'](_0xd4c5ce=>{_0xd4c5ce['setPartActive'](!0x1);}),_0x184716['setPartActive'](_0x538655,_0x41ecf7);}['markItemAsDone'](_0x218b2c){this['getItemById'](_0x218b2c)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5fcba4=>_0x5fcba4['options']['id']);}['removeItem'](_0x2e8bd2){this['children']['remove'](this['getItemById'](_0x2e8bd2));}['hasItem'](_0x25775a){return!!this['children']['find'](_0x19786e=>_0x19786e['options']['id']['includes'](_0x25775a));}['scrollToSuggestion'](_0x17ca99,_0xa19db8){const _0x557938=this['getItemById'](_0x17ca99);if(!(_0x557938 instanceof ar))return void ft('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x17ca99,'partIndex':_0xa19db8});const _0x183591=_0x557938['getPartView'](_0xa19db8);_0x183591?bt(_0x183591['element'],0x14,this['element']['parentElement'],!0x0,!0x0):ft('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x17ca99,'partIndex':_0xa19db8});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x422e91=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x422e91,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0xc713e0=new Xn(this['locale'],zn['aiFeed']);return _0xc713e0['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0xc713e0;}['_createFeedItems'](){const _0x1911ac=new _0x4708a3(this['locale']);return _0x1911ac['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1911ac;}['_createFeedLoader'](){const _0x391f92=new _0x4708a3(this['locale']);return _0x391f92['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x2e661d=>!_0x2e661d)]},'children':this['_createLoaderChildren']()}),_0x391f92;}['_createLoaderChildren'](){const _0x2517d4=new cr();return _0x2517d4['isVisible']=!0x0,[_0x2517d4,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x4169fe){const _0x322fc7=this['children']['find'](_0x1f9e49=>_0x1f9e49['options']['id']['includes'](_0x4169fe));if(!_0x322fc7)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x4169fe});return _0x322fc7;}['setLoadingMessage'](_0x107515){this['set']('loadingMessage',_0x107515);}['toggleLoadingSkeleton'](_0xccd558){this['set']('isLoadingSkeletonVisible',_0xccd558);}['startAutoScroll'](_0x5dc606={}){this['scrollManager']['start'](_0x5dc606);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends zt{['filter'](){let _0x4fc7a5=0x0;for(const _0xdcc99b of this['items'])_0x4fc7a5+=_0xdcc99b['items']['length'];return{'resultsCount':_0x4fc7a5,'totalItemsCount':_0x4fc7a5};}};function Ur(_0xfb08cf){const _0x4209b5=[];let _0x177a21=!0x1;for(const _0x3e2525 of Array['from'](_0xfb08cf['items'])){if('file'!==_0x3e2525['kind'])continue;if(_0x3e2525['webkitGetAsEntry']()?.['isDirectory']){_0x177a21=!0x0;continue;}const _0x5271e6=_0x3e2525['getAsFile']();_0x5271e6&&_0x4209b5['push'](_0x5271e6);}return{'files':_0x4209b5,'hasDirectory':_0x177a21};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends kt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x8cfb67,_0x265190){super(_0x8cfb67,{'queryView':{'label':'','creator':_0x46d7e1,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x8cfb67),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x265190,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',(_0x3b6bce,_0x52db69)=>!_0x3b6bce&&!_0x52db69),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x5c6bd2,_0x1097b5)=>{this['isUploadInProgress']||this['isEmpty']||_0x5c6bd2['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1097b5());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x4c2d45=>this['_handlePaste'](_0x4c2d45)),this['element']['addEventListener']('drop',_0x2d64cc=>this['_handleDrop'](_0x2d64cc));}['_handlePaste'](_0x1a7e85){const _0x53a443=_0x1a7e85['clipboardData'];if(!_0x53a443)return;const {files:_0x2bd4fe,hasDirectory:_0xd45c61}=Ur(_0x53a443),_0x3adcfd={'files':_0x2bd4fe,'plainText':_0x53a443['getData']('text/plain'),'hasDirectory':_0xd45c61,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1a7e85['preventDefault']()};this['fire']('promptInputPaste',_0x3adcfd);}['_handleDrop'](_0x38b209){const _0x412a20=_0x38b209['dataTransfer'];if(!_0x412a20)return;const _0x53de5d={'files':[],'plainText':_0x412a20['getData']('text/uri-list')||_0x412a20['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x38b209['preventDefault']()};this['fire']('promptInputPaste',_0x53de5d);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x79901=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x79901)return this['queryView']['errorText']=ls(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x3d0a90=_0x47dde7(_0x79901);this['fire']('sendUserMessage',_0x3d0a90),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x3520f1){this['queryView']['fieldView']['set']('placeholder',_0x3520f1);}['focus'](_0x112d4f=!0x1){super['focus'](),_0x112d4f&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x28cab4=new Pt(this['locale']);return _0x28cab4['set']({'icon':it,'label':ls(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+an,'isEnabled':!0x1}),_0x28cab4['on']('execute',()=>{this['submit']();}),_0x28cab4;}['setIsUploadInProgress'](_0x20d53f){this['isUploadInProgress']=_0x20d53f;}['_setUpAddContextButtonPositioning'](){const _0x46fb14=this['locale'],_0x33081a=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x1ab10b=new gt(this['queryView']['fieldView']['element']),_0x4ca52a=new gt(this['_addContextButtonView']['element']),_0x42df83=_0x1ab10b['width'],_0x3ebfe8='rtl'===_0x46fb14['uiLanguageDirection']?'right':'left';_0x1ab10b['excludeScrollbarsAndBorders']();const _0x1acf5e=_0x42df83-_0x1ab10b['width']+0x1;this['_addContextButtonView']['element']['style'][_0x3ebfe8]='calc('+(_0x42df83-_0x4ca52a['width']-_0x1acf5e)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x33081a),this['on']('render',()=>{_0x33081a(),this['_queryViewResizeObserver']=new At(this['queryView']['fieldView']['element'],()=>{_0x33081a();});});}},Fr=class extends _0x4708a3{constructor(_0x165d63){super(_0x165d63);const _0x2bd4a3=new Wt();_0x2bd4a3['content']=_0x1bcaaf,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x2bd4a3,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':ls(_0x165d63,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x4be48a){let _0x4f9a99=0x0;_0x4be48a['addEventListener']('dragenter',_0x449b36=>{_0x449b36['dataTransfer']&&(_0x4f9a99++,0x1===_0x4f9a99&&this['fire']('dragEnter'),_0x4be48a['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x4be48a['addEventListener']('dragover',_0x166ed1=>{_0x166ed1['dataTransfer']&&_0x166ed1['preventDefault']();}),_0x4be48a['addEventListener']('dragleave',()=>{--_0x4f9a99<=0x0&&(_0x4f9a99=0x0,_0x4be48a['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x4be48a['addEventListener']('drop',_0x1bb6f4=>{_0x1bb6f4['preventDefault'](),_0x4f9a99=0x0,_0x4be48a['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x1bb6f4);});}['_handleDrop'](_0x1ce6b5){const _0x520c91=_0x1ce6b5['dataTransfer'];if(!_0x520c91)return;const {files:_0x368139,hasDirectory:_0x130944}=Ur(_0x520c91),_0x51576f={'files':_0x368139,'plainText':_0x520c91['getData']('text/uri-list')||_0x520c91['getData']('text/plain'),'hasDirectory':_0x130944,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x51576f);}};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 _0x4708a3{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x442c87){super(_0x442c87),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',_0x15e93c=>'selector'===_0x15e93c),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x5a5a4c=>_0x5a5a4c?this['_modelSelectionDropdown']['buttonView']['label']:ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0xfc8e73=>_0xfc8e73),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x8d6963=>_0x8d6963),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x3cfe73=>ls(this['locale'],_0x3cfe73?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x5d035f=>_0x5d035f),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x245ab1=>ls(this['locale'],_0x245ab1?'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 ht(),_0x41c9a7(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x508c8c,_0x121975){if(_0x121975)this['set']('modelDisplayMode','hidden');else{const _0x3c912e=0x1===_0x508c8c['length'];this['set']('modelDisplayMode',_0x3c912e?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x508c8c?.['length'])for(const _0x2dc59b of _0x508c8c){const _0xaa165e=new _0x2d4237({'label':_0x2dc59b['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2dc59b['id'],'model':_0x2dc59b});_0xaa165e['bind']('isOn')['to'](this,'activeModelId',_0x3f96fe=>_0x3f96fe===_0x2dc59b['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0xaa165e,'labelView':new Jr(this['locale'],_0x2dc59b)});}}['setWebSearch'](_0x51b388){this['set']('webSearchActive',_0x51b388);}['setReasoning'](_0x2b8ab1){this['set']('reasoningActive',_0x2b8ab1);}['setModel'](_0x20f4d4){if(!_0x20f4d4)return;this['activeModelId']=_0x20f4d4['id'],this['activeModelName']=_0x20f4d4['name']||_0x20f4d4['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x20f4d4['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x20f4d4['name']);const _0x4d64a6=_0x20f4d4['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x4d64a6),this['_webSearchButton']['set']('isVisible',_0x4d64a6);const _0x31b806=_0x20f4d4['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x31b806),this['_reasoningButton']['set']('isVisible',_0x31b806);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x19c3be){this['set']('modelSelectorEnabled',!0x1),_0x19c3be&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x4cc35e=new Pt();return _0x4cc35e['set']({'label':ls(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ot,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x4cc35e['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x4cc35e;}['_createReasoningButton'](){const _0x22e07d=new Pt();return _0x22e07d['set']({'label':ls(this['locale'],'AI_CHAT_REASONING'),'icon':_0xae43e5,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x22e07d['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x22e07d;}['_createCommandsButton'](){const _0x24e811=new Pt();return _0x24e811['set']({'label':ls(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x17fb3f,'withText':!0x0,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltip':ls(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x24e811['extendTemplate']({'attributes':{'class':[Yr]}}),_0x24e811['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x24e811;}['_createModelSelectionDropdown'](){const _0x183eec=_0x353e74(this['locale']);return _0x183eec['set']({'panelPosition':'ne','class':[$r]}),_0x183eec['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':cn}),this['listenTo'](_0x183eec,'execute',_0x1a5c08=>{this['fire']('selectModel',_0x1a5c08['source']['model']);}),_0x183eec;}['_createModelNameView'](){const _0x450b1c=new Zr(this['locale']);return _0x450b1c['bind']('text')['to'](this,'activeModelName',_0x4ef624=>_0x4ef624??''),_0x450b1c['bind']('isVisible')['to'](this,'modelDisplayMode',_0xcb0799=>'name'===_0xcb0799),_0x450b1c;}},Jr=class extends Lt{constructor(_0x532763,_0x2f7692){super();const _0x4c0dae=this['bindTemplate'],_0x1996e3=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x4c0dae['to']('style'),'id':_0x4c0dae['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x4c0dae['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x2f7692['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x1996e3}]}),_0x1996e3['addMany'](this['_getCapabilityParts'](_0x532763,ot,'AI_CHAT_SEARCH_WEB',_0x2f7692['capabilities']['webSearch']?.['enabled']??!0x1)),_0x1996e3['addMany'](this['_getCapabilityParts'](_0x532763,_0xae43e5,'AI_CHAT_REASONING',_0x2f7692['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x55735e,_0x3b3928,_0x4896ef,_0x33b7ba){const _0xfb2a0=new Wt();_0xfb2a0['content']=_0x3b3928;const _0x30c6f7=new _0x4708a3(_0x55735e);_0x30c6f7['setTemplate']({'tag':'span','children':[{'text':ls(_0x55735e,_0x4896ef)+':\x20'}]});const _0x136ebe=new _0x4708a3(_0x55735e);return _0x136ebe['setTemplate']({'tag':'span','children':[{'text':ls(_0x55735e,_0x33b7ba?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0xfb2a0,_0x30c6f7,_0x136ebe];}},Zr=class extends _0x4708a3{constructor(_0x23c7c8){super(_0x23c7c8),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x465c37=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x465c37['if']('isVisible','ck-hidden',_0x57d7f7=>!_0x57d7f7)]},'children':[{'text':_0x465c37['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x4708a3{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x2ad1f3){super(_0x2ad1f3),this['focusTracker']=new ut(),this['keystrokes']=new dt(),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 Bt({'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'](_0x19e2b9=>{this['focusTracker']['add'](_0x19e2b9['element']),this['keystrokes']['listenTo'](_0x19e2b9['element']);}),_0xfe4486({'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'](_0x20f41c){this['urlInputField']['errorText']=_0x20f41c,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x5c638b=new Pt(this['locale']);return _0x5c638b['set']({'icon':_0x2db01d,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x3c1195,_0x30ed41,_0x3940a7)=>{_0x5c638b['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x3940a7?'':'\x20ck-hidden')]});}),_0x5c638b;}['_createUrlInputField'](){const _0x2c39f4=new $t(this['locale'],_0xc4912a);return _0x2c39f4['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x2c39f4['fieldView']['set']({'placeholder':ls(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x2c39f4;}['_createConfirmButton'](){const _0x29dce6=new Pt(this['locale']);return _0x29dce6['set']({'icon':_0x1fb55b,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x29dce6;}['_setupTemplate'](){const _0x17cee7=new Gt(this['locale'],{'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x17cee7['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x17cee7,{'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',_0x5904dc=>{_0x5904dc['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x32d764,_0xa85682)=>{this['clear'](),this['fire']('cancel'),_0xa85682();});}['_handleSubmit'](){const _0xaae6e1=this['getValue']()['trim']();_0xaae6e1?this['_isValidUrl'](_0xaae6e1)?(this['clearError'](),this['fire']('submitUrl',_0xaae6e1)):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x53ca24=this['getValue']()['trim'](),_0x548c82=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x53ca24['length']>0x0&&!_0x548c82;}['_isValidUrl'](_0x3b2b16){try{return!!new URL(_0x3b2b16);}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 Xt{['resource'];['_titleView'];['_iconView'];constructor(_0x26b9ef,_0x3ebd6b){super(_0x26b9ef),this['resource']=_0x3ebd6b,this['set']('isInContext',!!_0x3ebd6b['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x25337f){if(_0x25337f['isInContext'])return _0x1fb55b;switch(_0x25337f['type']){case'document':return _0x1445d9;case'web-resource':return _0x3ee98b;case'file':case'text':return _0x1bcaaf;default:return _0x27bd8d;}}['highlightText'](_0x3c9817){if(!_0x3c9817||''===_0x3c9817['trim']())return void this['_titleView']['highlightText'](null);const _0x1d8154=new RegExp(_0x2cddd7(_0x3c9817),'gi');this['_titleView']['highlightText'](_0x1d8154);}['updateResourceState'](_0x44543e){this['resource']['isInContext']=_0x44543e,this['isInContext']=_0x44543e,this['_updateIcon']();}['_createTitleView'](){const _0x1c513b=new Kt();return _0x1c513b['text']=this['resource']['label'],_0x1c513b['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x1c513b;}['_createIconView'](){const _0x489362=new Wt();return _0x489362['content']=this['getResourceIcon'](this['resource']),_0x489362;}['_setupTemplate'](){const _0x250428=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x250428['if']('isVisible','ck-hidden',_0x498663=>!_0x498663),_0x250428['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x250428['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends zt{['_source'];constructor(_0x564f42,_0x5962de){super(_0x564f42),this['_source']=_0x5962de,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x3c7175,_0x484cca){this['items']['clear']();let _0x47a3bd=_0x3c7175;if(this['_source']['useDefaultFiltering']&&_0x484cca&&''!==_0x484cca['trim']()){const _0x48161d=new RegExp(_0x484cca['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x47a3bd=_0x3c7175['filter'](_0x121b74=>_0x48161d['test'](_0x121b74['label']));}for(const _0x475a40 of _0x47a3bd){const _0x5035dd=new ao(this['locale'],_0x475a40);_0x5035dd['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x475a40);}),this['items']['add'](_0x5035dd);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x484cca);}['highlightText'](_0xf8b1){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x41f6aa=>{_0x41f6aa['highlightText'](_0xf8b1);});}['updateResourceState'](_0x457ac4,_0xad2221){for(const _0x54896b of this['items']){const _0x477a7f=_0x54896b;_0x477a7f['resource']['id']===_0x457ac4&&_0x477a7f['updateResourceState'](_0xad2221);}}['_handleResourceSelection'](_0x1d8f90,_0x55742f){this['fire']('addResourceToContext',{'source':_0x1d8f90,'resource':_0x55742f});}},lo=class extends $t{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x5094a6){const t=_0x5094a6['t'],_0x4b6df5={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0xc4912a,'label':ls(_0x5094a6,'AI_CHAT_SEARCH_RESOURCES')};super(_0x5094a6,_0x4b6df5['creator']),this['label']=_0x4b6df5['label'],this['_viewConfig']=_0x4b6df5,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x5094a6,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x3aa862){this['fire']('search',_0x3aa862);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Wt(),this['iconView']['content']=_0xc1f191,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x52814a,t){this['resetButtonView']=new Pt(_0x52814a),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x544e33,'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',_0x223718=>!_0x223718),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 _0x4708a3{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x5d6b4b,_0x5f537a){super(_0x5d6b4b),this['_source']=_0x5f537a['source'],this['_searchInputVisibleFrom']=_0x5f537a['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 _0x4f88bc([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 _0x59fe6c=new _0x4708a3(this['locale']);return _0x59fe6c['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x471a0a,_0x5538e2)=>{this['loadResources'](_0x5538e2),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x5538e2);}),_0x59fe6c;}['_createResourcesListView'](){const _0x3f81c9=new co(this['locale'],this['_source']);return _0x3f81c9['delegate']('addResourceToContext')['to'](this),_0x3f81c9['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x3f81c9;}['_createSkeletonView'](){const _0xe8d1a=new Xn(this['locale'],zn['aiChatResources']);return _0xe8d1a['bind']('isVisible')['to'](this,'isLoading'),_0xe8d1a;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x10045b){const _0xac0434=Ot();this['_latestLoadResourcesUid']=_0xac0434,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x10045b,'uid':_0xac0434}),this['isLoading']=!0x0;}['setResources'](_0x512151,_0x102f24){if(_0x102f24&&_0x102f24!==this['_latestLoadResourcesUid'])return;const _0x157376=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x512151,_0x157376),_0x512151['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x3ea4ca,_0x104782){this['_resourcesListView']['updateResourceState'](_0x3ea4ca,_0x104782);}};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(_0x47ca8e,_0x238a36,_0x75bc3c){this['_locale']=_0x47ca8e,this['_bodyCollection']=_0x238a36,this['_config']=_0x75bc3c;}['showSourceResourcesBalloon']({source:_0x1bd1e4,withBackButton:_0x2efa00}){let _0x388768=this['_sourceResourceBalloons']['get'](_0x1bd1e4['id']);_0x388768||(_0x388768=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x1bd1e4['id'],_0x388768),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x388768)),this['_addSourceResourceContent']({'balloonPanel':_0x388768,'source':_0x1bd1e4,'withBackButton':_0x2efa00}),_0x388768['show']();const _0x341cc3=this['_config']['getTargetElement']();_0x341cc3&&_0x388768['pin']({'target':_0x341cc3,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x38200b,_0x57c5eb,_0x8e7834){const _0x3260c0=this['_sourceResourceBalloons']['get'](_0x38200b);if(!_0x3260c0)return;const _0x5b101b=this['_getResourcesViewFromBalloon'](_0x3260c0);_0x5b101b&&(_0x5b101b['setResources'](_0x57c5eb,_0x8e7834),_0x5b101b['once']('change:isLoading',()=>{_0x3260c0['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x34629e){const _0x5d283f=this['_sourceResourceBalloons']['get'](_0x34629e);_0x5d283f&&requestAnimationFrame(()=>{_0x5d283f['hide'](),this['_sourceResourceBalloons']['delete'](_0x34629e),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x1fcd34 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x1fcd34);}['isAnyResourceBalloonVisible'](){for(const _0x33a0f9 of this['_sourceResourceBalloons']['values']())if(_0x33a0f9['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x51ea84,_0x471bc2,_0x5aa6fe){const _0x575ed0=this['_sourceResourceBalloons']['get'](_0x51ea84);if(!_0x575ed0||!_0x575ed0['isVisible'])return;const _0x223520=this['_config']['getTargetElement']();if(!_0x223520)return;_0x575ed0['pin']({'target':_0x223520,'limiter':this['_config']['getLimiterElement']()});const _0x4c9144=this['_getResourcesViewFromBalloon'](_0x575ed0);_0x4c9144&&_0x4c9144['updateResourceState'](_0x471bc2,_0x5aa6fe);}['destroy'](){for(const _0x2b7d54 of this['_sourceResourceBalloons']['values']())_0x2b7d54['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x69f0ed=new Nt(this['_locale']);return _0x69f0ed['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x69f0ed),_0x69f0ed;}['_addSourceResourceContent']({balloonPanel:_0x51065a,source:_0x13c256,withBackButton:_0x570207}){_0x51065a['content']['clear']();const _0x177bbd=this['_createBalloonHeader']({'balloonPanel':_0x51065a,'source':_0x13c256,'withBackButton':_0x570207});_0x51065a['content']['add'](_0x177bbd);const _0x2cafb1=this['_createBalloonResourcesView'](_0x13c256);_0x51065a['content']['add'](_0x2cafb1);}['_createBalloonHeader']({balloonPanel:_0x1820f8,source:_0x574bda,withBackButton:_0x32d1e3}){const _0xfe0491=new Gt(this['_locale'],{'label':_0x574bda['label'],'class':Ao});return _0x32d1e3&&_0xfe0491['children']['add'](this['_createBackButton'](_0x1820f8),0x0),_0xfe0491;}['_createBackButton'](_0xdee4a6){const _0x425cf0=new Pt(this['_locale']);return _0x425cf0['set']({'icon':_0x2db01d,'tooltip':ls(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x425cf0['on']('execute',()=>{_0xdee4a6['hide'](),this['_config']['onBackToContext']();}),_0x425cf0;}['_createBalloonResourcesView'](_0x49afd5){const _0x17c22b=new uo(this['_locale'],{'source':_0x49afd5,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x17c22b['on']('loadSourceResources',(_0x5760b9,_0x4108d9)=>{this['_config']['onLoadSourceResources'](_0x4108d9);}),_0x17c22b['on']('addResourceToContext',(_0x13adc7,_0x1662e1)=>{this['_config']['onResourceSelected'](_0x1662e1['source'],_0x1662e1['resource']),this['closeSourceResourceBalloon'](_0x49afd5['id']);}),_0x17c22b;}['_getResourcesViewFromBalloon'](_0x475266){const _0x245737=_0x475266['content']['get'](0x1);return _0x245737 instanceof uo?_0x245737:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x11606f){_0xfcbf0e({'emitter':_0x11606f,'contextElements':[_0x11606f['element']],'callback':()=>{_0x11606f['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x11606f['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=[Nt['defaultPositions']['northArrowSouthWest'],Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthEast'],Nt['defaultPositions']['southArrowNorthWest'],Nt['defaultPositions']['southArrowNorth'],Nt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x4708a3{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x528ebc,_0x554483){super(_0x528ebc),this['bodyCollection']=_0x554483['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x528ebc),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x528ebc),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x528ebc),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x528ebc,_0x554483);const _0x145f10={'cssClasses':{'showMoreButton':Oo+'\x20'+cn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x528ebc,this['_currentContextsChips'],_0x145f10,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'](_0x5e8dc1,_0x31ecb4){const _0x3371bf=this['_createContextButton'](_0x5e8dc1,'current',!0x0,_0x31ecb4);this['_addContextToCollection'](_0x3371bf,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x3e3796){this['_removeContextFromCollection'](_0x3e3796,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x3e3796,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x3a97f3,_0x5ac967){let _0x4e50cb=this['_currentContextsChips']['find'](_0x164523=>_0x164523['id']===_0x3a97f3);_0x4e50cb||(_0x4e50cb=this['_overflowManager']['overflowChips']['find'](_0x3e4963=>_0x3e4963['id']===_0x3a97f3)),_0x4e50cb&&(_0x4e50cb['isLoading']=_0x5ac967);}['setConversationContext'](_0x423ba8){this['_conversationContextsChips']['clear']();for(const _0x57f00d of _0x423ba8){const _0x166878=this['_createContextButton'](_0x57f00d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x166878,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x191bd1,_0x32dcd5,_0x541b25){this['_resourcesBalloonView']['updateResourceState'](_0x191bd1,_0x32dcd5,_0x541b25);}['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:_0x22da5d,withBackButton:_0x179790}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x22da5d,'withBackButton':_0x179790}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x1c11d5,_0x3297ae,_0x1c83a4,_0xc3cf3e){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x1c11d5,_0x1c83a4,_0xc3cf3e);}['closeSourceResourceBalloon'](_0x55aa78){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x55aa78),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x1ee771){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x1ee771),this['_setAddContextButtonEnabled'](_0x1ee771);}['_setAddContextButtonEnabled'](_0x150f12){const _0x375b5c=!_0x150f12['document']['isHidden']&&_0x150f12['document']['enabled'],_0x56e6ca=_0x150f12['urls']['enabled'],_0x25961d=_0x150f12['files']['enabled'],_0x4967c6=_0x150f12['sources']['length']>0x0,_0x422d98=_0x150f12['customItems']&&_0x150f12['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x375b5c||_0x56e6ca||_0x25961d||_0x4967c6||_0x422d98;}['_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'](_0x3b5f67){const _0x27dfc8=new Pt(_0x3b5f67);return _0x27dfc8['set']({'label':ls(_0x3b5f67,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+cn,'icon':_0x19e50c,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x27dfc8;}['_createAddContextBalloonPanelView'](_0x2370ee){return this['_createBaseBalloonPanel'](_0x2370ee,To);}['_createUrlBalloonPanelView'](_0x2421b3){const _0x239be1=this['_createBaseBalloonPanel'](_0x2421b3,Co);return this['_addUrlContent'](_0x239be1,_0x2421b3),_0x239be1;}['_createResourcesBalloonView'](_0x554a8e,_0x522e7b){const _0x578532={'searchInputVisibleFrom':_0x522e7b['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x37f445,_0x31f842)=>{this['fire']('addResourceToContext',{'source':_0x37f445,'resource':_0x31f842});},'onLoadSourceResources':_0x57f691=>{this['fire']('loadSourceResources',_0x57f691);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x554a8e,_0x522e7b['bodyCollection'],_0x578532);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x4b7e0b,_0x1e3ce0){const _0x35be7c=new Nt(_0x4b7e0b);return _0x35be7c['extendTemplate']({'attributes':{'class':_0x1e3ce0}}),this['bodyCollection']['add'](_0x35be7c),_0x35be7c;}['_setBalloonPanelContent'](_0x5867eb,_0x2c568e,_0x53d8b0){if(_0x5867eb['content']['clear'](),!_0x53d8b0['document']['isHidden']&&_0x53d8b0['document']['enabled']){const _0x33342f=this['_createBalloonButton'](_0x2c568e,{'label':ls(_0x2c568e,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x1445d9});_0x33342f['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x5867eb['content']['add'](_0x33342f);}if(_0x53d8b0['urls']['enabled']){const _0x145314=this['_createBalloonButton'](_0x2c568e,{'label':ls(_0x2c568e,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x3ee98b});_0x145314['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x5867eb['content']['add'](_0x145314);}if(_0x53d8b0['files']['enabled']){const _0xb5a86d=new Ut(_0x2c568e);_0xb5a86d['set']({'label':ls(_0x2c568e,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x32d23c,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0xb5a86d['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0xb5a86d['on']('done',(_0x9a101a,_0x1f2c3f)=>{this['fire']('addFileToContext',_0x1f2c3f);}),_0xb5a86d['tooltip']=!0x0,_0x5867eb['content']['add'](_0xb5a86d);}for(const _0x5d1138 of _0x53d8b0['sources']){const _0x5f0b48=this['_createBalloonButton'](_0x2c568e,{'label':_0x5d1138['label'],'icon':_0x5d1138['icon']||_0x27bd8d,'type':'source'});_0x5867eb['content']['add'](_0x5f0b48),_0x5f0b48['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x5d1138,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x2e472b of _0x53d8b0['customItems']||[]){const _0x39d5d5=this['_createBalloonButton'](_0x2c568e,{'label':_0x2e472b['label'],'icon':_0x2e472b['icon']||_0x27bd8d,'type':'customItem'});_0x5867eb['content']['add'](_0x39d5d5),_0x39d5d5['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x2e472b);});}this['_hasExactlyOneSource']=0x1===_0x5867eb['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x5b9b01,_0x167b0f){this['_urlInputView']=new io(_0x167b0f),this['_urlInputView']['on']('submitUrl',(_0x559b49,_0xd09bb8)=>{this['_handleUrlSubmit'](_0xd09bb8);}),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});}),_0x5b9b01['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x3bda07,_0x7a0992){const _0x5bb7db='source'===_0x7a0992['type']?new xo(_0x3bda07):new Pt(_0x3bda07);return _0x5bb7db['set']({'label':_0x7a0992['label'],'icon':_0x7a0992['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x5bb7db;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0xfcbf0e({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x5c4672){const _0x4f91ea=this['_addContextBalloonConfig'];_0x4f91ea['buttonView']['isOn']=_0x5c4672,_0x5c4672?_0x4f91ea['balloonView']['show']():_0x4f91ea['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x39de07,buttonView:_0x1b254b,hideMethod:_0x1997b3}=this['_addContextBalloonConfig'];_0xfcbf0e({'emitter':_0x39de07,'contextElements':[_0x39de07['element'],_0x1b254b['element']],'callback':()=>{_0x1997b3();},'activator':()=>_0x1b254b['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x3f6d11,_0xcf7623,_0x4098c0=!0x1,_0x45ac32=!0x1){const _0x3c8f8e='conversation'===_0xcf7623||!0x0===_0x3f6d11['isReadOnly'],_0xab91f3=new mr(this['locale'],_0x3f6d11,_0x3c8f8e,_0x4098c0,_0x45ac32);return _0x3c8f8e||_0xab91f3['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0xab91f3['id']);}),_0xab91f3;}['_addContextToCollection'](_0x4de365,_0x285c5c){_0x285c5c['add'](_0x4de365,0x0);}['_removeContextFromCollection'](_0x5c79f9,_0x51c35d){const _0x4782c6=_0x51c35d['find'](_0x40f6d7=>_0x40f6d7['id']===_0x5c79f9);_0x4782c6&&_0x51c35d['remove'](_0x4782c6);}['_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'](_0x28e2dd){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x28e2dd);}},xo=class extends Pt{['arrowView'];constructor(_0x5d4ea4){super(_0x5d4ea4),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 _0x3391fb=new Wt();return _0x3391fb['content']=_0x599889,_0x3391fb['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x3391fb;}},Lo=class extends _0x4708a3{['_cancelButtonView'];['_loaderView'];constructor(_0x1cf941){super(_0x1cf941),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 _0x56a427=new Pt(this['locale']);return _0x56a427['set']({'label':ls(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':hn+'\x20ck-ai-button-stop-generating','icon':et}),_0x56a427['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x56a427;}['_createLoaderView'](){const _0xc1ab84=new _0x4708a3(this['locale']);return _0xc1ab84['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':ls(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0xc1ab84;}},Do=class extends _0x4708a3{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x3aa389,_0x1c32be){super(_0x3aa389),this['_filesEnabled']=_0x1c32be['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x3aa389,{'bodyCollection':_0x1c32be['bodyCollection'],'searchInputVisibleFrom':_0x1c32be['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x3aa389),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x3aa389),this['_loaderView']=this['_createLoaderView'](_0x3aa389),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x3aa389),this['_dropZoneView']=new Fr(_0x3aa389),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 _0x435b5e=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x435b5e['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x435b5e['if']('isLoading','ck-hidden',_0x427311=>_0x427311||!this['isModelAvailable']),_0x435b5e['if']('isModelAvailable','ck-hidden',_0x1f1d26=>!_0x1f1d26||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x435b5e['if']('isLoading','ck-hidden',_0x23e7f7=>!_0x23e7f7)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x435b5e['if']('isModelAvailable','ck-hidden',_0x463175=>_0x463175)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0xfcbf0e({'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'](_0x234e44,_0x4e7792){return new yo(_0x234e44,_0x4e7792);}['_createPromptInputView'](_0x466de7){return new Gr(_0x466de7,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0xaa872f){return new jr(_0xaa872f);}['_createLoaderView'](_0x22bf3b){return new Lo(_0x22bf3b);}['_createModelUnavailableMessageView'](_0x6b269d){const _0xbc6aee=new Po(_0x6b269d);return _0xbc6aee['delegate']('startConversation')['to'](this),_0xbc6aee;}['_handlePromptInputFocus'](_0x4ee757,_0x76b93b,_0x15efe8){_0x15efe8?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x3ab063,_0x3eec11){this['_contextPanelView']['addContextItem'](_0x3ab063,_0x3eec11);}['removeContextItem'](_0x27f00a){this['_contextPanelView']['removeContextItem'](_0x27f00a);}['setContextItemLoading'](_0x12b751,_0x305dc3){this['_contextPanelView']['setContextItemLoading'](_0x12b751,_0x305dc3);}['setIsUploadInProgress'](_0x352757){this['_promptInputView']['setIsUploadInProgress'](_0x352757);}['setConversationContext'](_0x4d85e9){this['_contextPanelView']['setConversationContext'](_0x4d85e9);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x4c439b,_0xe372a7,_0x18f87c){this['_contextPanelView']['updateResourceState'](_0x4c439b,_0xe372a7,_0x18f87c);}['setWebSearch'](_0x42b539){this['_promptCapabilitiesView']['setWebSearch'](_0x42b539);}['setReasoning'](_0x4e4734){this['_promptCapabilitiesView']['setReasoning'](_0x4e4734);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x3c80a3){this['_contextPanelView']['setAddContextOptions'](_0x3c80a3);}['setInputPlaceholder'](_0x37c66f){this['_promptInputView']['setPlaceholderText'](_0x37c66f);}['setModelList'](_0x1df238,_0x454963){this['_promptCapabilitiesView']['setModelList'](_0x1df238,_0x454963);}['setModel'](_0x119fce){_0x119fce?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x119fce)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x335ff1){this['_promptCapabilitiesView']['disableModelSelector'](_0x335ff1);}['populateSourceResourceBalloon'](_0x2859b0,_0x12050e,_0x1959ba,_0x5b5913){this['_contextPanelView']['populateSourceResourceBalloon'](_0x2859b0,_0x12050e,_0x1959ba,_0x5b5913);}['closeSourceResourceBalloon'](_0x11c772){this['_contextPanelView']['closeSourceResourceBalloon'](_0x11c772);}['focusPromptInput'](_0x3a16be=!0x1){this['_promptInputView']['focus'](_0x3a16be);}['setPromptInputValue'](_0x140fc2){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x140fc2;}},Po=class extends _0x4708a3{constructor(_0x15f623){super(_0x15f623);const _0xde6451=new Pt(_0x15f623);_0xde6451['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0xde6451['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0xde6451]}]});}},Ho=class extends Gt{['resizeButton'];constructor(_0x264a47,_0x22802f){super(_0x264a47,{'label':_0x22802f['label'],'class':'ck-ai-header\x20'+_0x22802f['class'],'icon':_0x22802f['icon']}),this['set']('isMaximized',!0x1),_0x22802f['content']&&this['children']['add'](_0x22802f['content']),_0x22802f['showResizeButton']&&(this['resizeButton']=ln(_0x264a47,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x4708a3{constructor(_0x6c38a4){super(_0x6c38a4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':ls(_0x6c38a4,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x16b319,_0x421a9f){const _0x5118ce=new Pt(_0x16b319);return _0x5118ce['set']({'label':ls(_0x16b319,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x2013b1,'class':'ck-ai-chat__start-conversation\x20'+hn}),_0x5118ce['on']('execute',()=>{_0x421a9f['fire']('startConversation');}),_0x5118ce;}var Uo=class extends _0x4708a3{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x158b0d,_0x374df2){super(_0x158b0d),this['_bodyCollection']=un(_0x158b0d);const _0x394226=Vo(_0x158b0d,this);this['chatHeader']=new Ho(_0x158b0d,{'label':ls(_0x158b0d,'AI_CHAT_HEADING'),'icon':_0x433c60,'class':'ck-ai-header_chat','content':_0x394226,'showResizeButton':_0x374df2['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0x158b0d,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0x158b0d,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x374df2['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x374df2['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0x158b0d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x158b0d['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x539a30,_0x474e98,_0x379adc,_0x5a1621){this['chatControls']['populateSourceResourceBalloon'](_0x539a30,_0x474e98,_0x379adc,_0x5a1621);}['closeSourceResourceBalloon'](_0x290c99){this['chatControls']['closeSourceResourceBalloon'](_0x290c99);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x3abc0e{static get['requires'](){return[hs];}['_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(_0x11d194){super(_0x11d194);const _0x13904f=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x13904f['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'](_0x13904f),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x24d98e,{showDiff:_0x5694e4})=>{this['showDiff']=_0x5694e4;}),this['disableControls'](),_0x13904f['view']['addTab']({'id':'chat','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x433c60,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x13904f['view'],'isMaximized',_0x5406d2=>_0x5406d2),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x23aa89=>_0x23aa89),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x4b5959){const _0x559ce8=this['context']['config']['get']('ai.chat.welcomeMessage')??ls(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x4b5959['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x559ce8}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x6c5c38,staticMessage:_0x288923}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x6c5c38,'initialContent':'<p>'+_0x288923+'</p>'});});}async['addFeedItemUserMessage'](_0x303440){const _0xa7a0bb=_0x303440['attributes']?.['displayedPrompt']||_0x303440['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x303440['contextItems']['values']()),'initialContent':'<p>'+_0xa7a0bb+'</p>','id':_0x303440['id']});});}async['addFeedItemError']({errorMessage:_0x4cfebf,id:_0x481923}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4cfebf+'</p>','id':_0x481923});});}async['addFeedItemAIReply'](_0x35beb8){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x35beb8['interactionId']+':'+_0x35beb8['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x3163d3){const _0x4b1578=us(this['context']),_0x3c4d2=_0x4b1578['map'](_0x14aa14=>_0x14aa14['config']['get']('ai.availableReplyActions')||[...er]);let _0xb33b5f=_0x3c4d2['reduce']((_0x414e3e,_0x516711)=>_0x414e3e['filter'](_0x93382d=>_0x516711['includes'](_0x93382d)),_0x3c4d2[0x0]||[...er]);const _0x3b4b38=_0x4b1578['every'](_0x5bdc1b=>_0x5bdc1b['plugins']['has']('TrackChanges')),_0x5411a7=_0x4b1578['map'](_0x1a3261=>_0x1a3261['commands']['get']('trackChanges'));return _0x3b4b38?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x5411a7,'value',(..._0x1e6d7c)=>_0x1e6d7c['some'](_0x2f8abd=>_0x2f8abd))):_0xb33b5f=_0xb33b5f['filter'](_0x1e378d=>'insertSuggestion'!=_0x1e378d),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x3163d3['interactionId']+':'+_0x3163d3['id'],'areActionsDisabled':_0x3163d3['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0xb33b5f}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x46d126,_0x254d20){return this['_promiseQueue']['enqueue'](async()=>{const _0x5a4484=this['_view']['chatFeed']['children']['last'];if(_0x5a4484 instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x5a4484),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x46d126['id'],'capabilities':{'isWebSearchEnabled':_0x5a4484['capabilities']['isWebSearchEnabled']||_0x254d20['isWebSearchEnabled'],'isReasoningEnabled':_0x5a4484['capabilities']['isReasoningEnabled']||_0x254d20['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x46d126['id'],'capabilities':_0x254d20});});}async['addFeedItemCustomElement'](_0x348b62,_0x3e7380){let _0x304861;return await this['_promiseQueue']['enqueue'](async()=>{_0x304861=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x348b62,'id':_0x3e7380});}),_0x304861;}['removeFeedItem'](_0x408c26){this['_view']['chatFeed']['removeItem'](_0x408c26);}['hasFeedItem'](_0x282ed8){return this['_view']['chatFeed']['hasItem'](_0x282ed8);}['updateFeedInteractionHeader'](_0xa3a3e9){const _0x2a92ee=this['_view']['chatFeed']['children']['find'](_0xbf7fac=>_0xbf7fac['options']['id']==_0xa3a3e9['id']&&_0xbf7fac instanceof yr);_0x2a92ee&&_0x2a92ee['set']('isVisible',_0xa3a3e9['isVisible']);}async['updateFeedItemAIReplyContent'](_0x34523f){const _0x1ecc7c=_0x34523f['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x1fc8ba=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x34523f,'abortSignal':_0x1fc8ba,'renderingStrategy':_0x1ecc7c}),_0x34523f['isDone']&&this['markFeedItemAsDone'](_0x34523f['id']);});}['updateFeedItemAIReplySources'](_0x39f556,_0x1ebbb5){this['_view']['chatFeed']['updateWebSources'](_0x39f556,_0x1ebbb5);}async['updateFeedItemAIReplySuggestionContent'](_0x3187e5){return this['_promiseQueue']['enqueue'](async _0x523eb4=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x3187e5,'abortSignal':_0x523eb4}),_0x3187e5['isDone']&&this['markFeedItemAsDone'](_0x3187e5['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x17c222){this['_view']['chatFeed']['updateSuggestionPartState'](_0x17c222);}['setFeedItemAIReplySuggestionPartActive'](_0x1e1439){this['_view']['chatFeed']['setSuggestionPartActive'](_0x1e1439);}['markFeedItemAsDone'](_0x4273c2){this['_view']['chatFeed']['markItemAsDone'](_0x4273c2);}['removeFeedInteraction'](_0x442063){this['_view']['chatFeed']['getItemIds']()['filter'](_0x2ebab8=>_0x2ebab8['startsWith'](_0x442063))['forEach'](_0xee5ad9=>this['_view']['chatFeed']['removeItem'](_0xee5ad9));}['startInteraction'](){const _0x331b86=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x331b86),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x4c708f){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x2b4ad1=>_0x2b4ad1['startsWith'](_0x4c708f['id']))['forEach'](_0x6d9745=>this['markFeedItemAsDone'](_0x6d9745)),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'](_0x10be30,_0xa74743){this['_view']['chatControls']['addContextItem'](_0x10be30,_0xa74743);}['removeContextItem'](_0x146a20){this['_view']['chatControls']['removeContextItem'](_0x146a20);}['setContextItemLoading'](_0x5f4976,_0xc094de){this['_view']['chatControls']['setContextItemLoading'](_0x5f4976,_0xc094de);}['setIsUploadInProgress'](_0x3dddd6){this['_view']['chatControls']['setIsUploadInProgress'](_0x3dddd6);}['setConversationContext'](_0x101379){this['_view']['chatControls']['setConversationContext'](_0x101379);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x2786a9,_0x4fa1c7,_0x1dac86){this['_view']['chatControls']['updateResourceState'](_0x2786a9,_0x4fa1c7,_0x1dac86);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x472843){this['_view']['chatControls']['setAddContextOptions'](_0x472843);}['updateCapabilities'](_0x3421fe){this['_view']['chatControls']['setWebSearch'](_0x3421fe['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x3421fe['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x3421fe));}['setSelectedModel'](_0x256ec8,_0x19d813){this['_view']['chatControls']['setModel'](_0x256ec8),_0x19d813&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x38a43f){this['feedItemRenderingStrategy']=_0x38a43f;}['toggleLoadingSkeleton'](_0xd16349){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0xd16349);}['resetConversationTitle'](){this['setConversationTitle'](ls(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x1721f3,_0x5331e8=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x5331e8&&!It()&&_0x1721f3['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x1721f3);this['_view']['chatHeader']['label']=_0x1721f3;}['setLoadingMessage'](_0x5561c7){this['_view']['chatFeed']['setLoadingMessage'](_0x5561c7);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x35a965){let _0x12472a=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x35a965[_0x12472a],_0x12472a++,_0x12472a===_0x35a965['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3fa742){return _0x3fa742['isWebSearchEnabled']&&_0x3fa742['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3fa742['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3fa742['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x1ac022){return _0x1ac022?_0x1ac022['isWebSearchEnabled']&&_0x1ac022['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x1ac022['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x1ac022['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x5e3f0a,_0x33d00c,_0x41adc1,_0x25c4ca){this['_view']['populateSourceResourceBalloon'](_0x5e3f0a,_0x33d00c,_0x41adc1,_0x25c4ca);}['closeSourceResourceBalloon'](_0x757dc1){this['_view']['closeSourceResourceBalloon'](_0x757dc1);}['setPromptInputValue'](_0x565e24){this['_view']['chatControls']['setPromptInputValue'](_0x565e24);}['focusPromptInput'](_0x5a6774=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x5a6774);}['scrollFeedToSuggestion'](_0x3dc181,_0x3d8c35){this['_view']['chatFeed']['scrollToSuggestion'](_0x3dc181,_0x3d8c35);}['startAutoScroll'](_0x5558e7={}){this['_view']['chatFeed']['startAutoScroll'](_0x5558e7);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends zt{['sections'];constructor(_0x4dadda,_0x54bc4e){super(_0x4dadda),this['sections']=_0x54bc4e,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x19f2d7){let _0x5db360=0x0,_0xb323ee=0x0;for(const _0xbd6a64 of this['sections']){const {resultsCount:_0x39348d,totalItemsCount:_0x13d1e0}=_0xbd6a64['filter'](_0x19f2d7);_0x5db360+=_0x39348d,_0xb323ee+=_0x13d1e0;}return{'resultsCount':_0x5db360,'totalItemsCount':_0xb323ee};}},Fo=class extends Xt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x3255e1,{title:_0x1773a2,items:_0x329257}){super(_0x3255e1);const _0x1b82a1=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x1773a2,this['itemsViews']=_0x329257;const _0x2b394f=new _0x4708a3(_0x3255e1);_0x2b394f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new zt(_0x3255e1),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x1b82a1['if']('isVisible','ck-hidden',_0x1e9744=>!_0x1e9744)]},'children':[_0x2b394f,this['_itemsListView']]});}['filter'](_0x3c33d2){const _0x57859e=this['itemsViews']['length'];let _0x1e5924=0x0;for(const _0x14aabc of this['itemsViews'])_0x3c33d2?(_0x14aabc['isVisible']=!!_0x14aabc['isMatching'](_0x3c33d2),_0x14aabc['highlightText'](_0x3c33d2)):(_0x14aabc['isVisible']=!0x0,_0x14aabc['highlightText'](null)),_0x14aabc['isVisible']&&_0x1e5924++;return this['isVisible']=_0x1e5924>0x0,{'resultsCount':_0x1e5924,'totalItemsCount':_0x57859e};}['getItem'](_0x55eef6){return this['itemsViews']['find'](_0x441015=>_0x441015['id']===_0x55eef6);}['removeItem'](_0x16c9ce){const _0x32a32e=this['itemsViews']['indexOf'](_0x16c9ce);-0x1!==_0x32a32e&&(this['itemsViews']['splice'](_0x32a32e,0x1),this['_itemsListView']['items']['remove'](_0x16c9ce));}};const Ko=/* #__PURE__ -- @preserve */
34
- _0xd046de(Xt);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(_0x1ca3dd,_0x28b55d){super(_0x1ca3dd);const _0x309794=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x28b55d['pinned']),this['set']('loadingState',null),this['set']('title',_0x28b55d['title']),this['id']=_0x28b55d['id'];const {createdAt:_0x22c679,active:_0x9e494=!0x1}=_0x28b55d;this['_titleView']=new Kt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x344322=this['_createCheckView'](),_0x1d9b6e=this['_createPinButtonView'](_0x1ca3dd),_0x37ecc=this['_createMenuDropdownView'](),_0x4f7a70=this['_createEditInputView'](_0x1ca3dd),_0x5d0d46=this['_createAcceptEditButtonView'](_0x1ca3dd,_0x4f7a70),_0xe3700e=this['_createCancelEditButtonView'](_0x1ca3dd);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x1d9b6e),this['actions']['add'](_0x37ecc),this['on']('change:isEdit',(_0x5a70d3,_0x134de2,_0xf7609c)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0xf7609c?(this['actions']['add'](_0x5d0d46),this['actions']['add'](_0xe3700e),this['mainContent']['add'](_0x4f7a70),_0x4f7a70['element']['value']=this['title']||'',_0x4f7a70['element']['focus']()):(this['actions']['add'](_0x1d9b6e),this['actions']['add'](_0x37ecc),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x9e494?'ck-ai-chat-history__item--active':'',_0x309794['if']('isVisible','ck-hidden',_0x4c40bf=>!_0x4c40bf),_0x309794['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',_0x309794['if']('loadingState','ck-hidden',_0x5e9c07=>!!_0x5e9c07)]},'children':_0x9e494?[_0x344322]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x309794['if']('loadingState','ck-hidden',_0x5c5663=>!_0x5c5663)]},'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',_0x309794['if']('loadingState','ck-hidden',_0x1c4f01=>!!_0x1c4f01)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x309794['if']('loadingState','ck-hidden',_0x3e6c11=>!_0x3e6c11)]},'children':[{'text':_0x309794['to']('loadingState',_0x329376=>_0x329376?ls(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x329376]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x22c679]}]},{'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'](_0x3c8d38){this['set']('title',_0x3c8d38);}['updateLoadingState'](_0x3945b8,_0x259eba){this['set']('loadingState',_0x259eba?_0x3945b8:null);}['_createCheckView'](){const _0x162f0a=new Wt();return _0x162f0a['set']({'content':_0x1fb55b}),_0x162f0a;}['_createPinButtonView'](_0x516ec6){const _0xf89de5=new Pt(_0x516ec6);return _0xf89de5['set']({'label':ls(_0x516ec6,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x384872,'withText':!0x1,'tooltip':!0x0}),_0xf89de5['bind']('isOn')['to'](this,'pinned'),_0xf89de5['on']('execute',()=>{const _0x15af1a=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x15af1a});}),_0xf89de5;}['_createMenuDropdownView'](){const _0x13daf3=_0x353e74(this['locale']),_0x4068f2=_0x13daf3['panelView']['children'];_0x13daf3['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':st}),_0x13daf3['panelPosition']='sw';const _0xcf5c35=new Pt(this['locale']);_0xcf5c35['label']=ls(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xcf5c35['withText']=!0x0,_0xcf5c35['on']('execute',()=>{this['isEdit']=!0x0;});const _0x3fe55c=new Pt(this['locale']);_0x3fe55c['label']=ls(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x3fe55c['withText']=!0x0,_0x3fe55c['on']('execute',()=>{this['showConfirm'](ls(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x5147eb=new zt(this['locale']),_0x190444=new Xt(this['locale']);_0x190444['children']['add'](_0xcf5c35);const _0x37300d=new Xt(this['locale']);return _0x37300d['children']['add'](_0x3fe55c),_0x5147eb['items']['addMany']([_0x190444,_0x37300d]),_0x4068f2['add'](_0x5147eb),_0x13daf3;}['_createEditInputView'](_0x64166e){const _0x51bd9c=new Yt(_0x64166e),_0x58af77=_0x51bd9c['bindTemplate'];return _0x51bd9c['extendTemplate']({'on':{'keydown':_0x58af77['to'](_0x51fbf9=>{'Enter'==_0x51fbf9['key']&&this['_commitEditInputValue'](_0x51bd9c);})}}),_0x51bd9c;}['_createAcceptEditButtonView'](_0xd84747,_0x4da5fc){const _0x5e7a47=new Pt(_0xd84747);return _0x5e7a47['set']({'icon':_0x1fb55b,'withText':!0x1,'tooltip':ls(_0xd84747,'AI_CHAT_HISTORY_ACCEPT')}),_0x5e7a47['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5e7a47['on']('execute',()=>{this['_commitEditInputValue'](_0x4da5fc);}),_0x5e7a47;}['_commitEditInputValue'](_0x3740c1){const _0x52b96d=_0x3740c1['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x52b96d});}['_createCancelEditButtonView'](_0x30892a){const _0x1659f7=new Pt(_0x30892a);return _0x1659f7['set']({'icon':_0x544e33,'withText':!0x1,'tooltip':ls(_0x30892a,'AI_CHAT_HISTORY_CANCEL')}),_0x1659f7['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1659f7['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1659f7;}['_createSpinnerView'](){const _0x1561e8=new cr('tiny');return _0x1561e8['isVisible']=!0x0,_0x1561e8;}['isMatching'](_0x31305c){return'string'==typeof this['title']&&this['title']['match'](_0x31305c)?{'title':!0x0}:null;}['highlightText'](_0x37a97e){this['_titleView']['highlightText'](_0x37a97e);}},Yo=class extends _0x4708a3{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x53a31a,_0x16b6f0){super(_0x53a31a),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x541073=Vo(_0x53a31a,this);this['headerView']=new Ho(_0x53a31a,{'label':ls(_0x53a31a,'AI_CHAT_HISTORY_HEADING'),'icon':_0x4f0239,'class':'ck-ai-header_history','content':_0x541073,'showResizeButton':_0x16b6f0}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x53a31a,[]),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',_0x492d93=>!_0x492d93)]}}),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 _0x43b8f2=new _0x853608(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x504601=>ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x504601),'secondary':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4b794e=this['_createErrorView']();return _0x4b794e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x207204=>!_0x207204)]}}),_0x43b8f2['on']('render',()=>{_0x43b8f2['children']['add'](_0x4b794e,0x1);}),_0x43b8f2['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x30a7d2=>!_0x30a7d2)]}}),_0x43b8f2;}['_createSkeletonView'](){const _0x35be6b=new Xn(this['locale'],zn['aiHistory']);return _0x35be6b['bind']('isVisible')['to'](this,'isLoading'),_0x35be6b;}['_createErrorView'](){const _0x3fead2=new _0x4708a3(this['locale']),_0xa9c7df=new Pt(this['locale']);_0xa9c7df['set']({'withText':!0x1,'icon':_0x544e33,'class':'ck-ai-notification_error__dismiss-button'}),_0xa9c7df['bind']('isVisible')['to'](this,'hasItems',_0x1dfb6d=>!!_0x1dfb6d),_0xa9c7df['on']('execute',()=>{this['errorMessage']='';});const _0x4d562e=this['bindTemplate'];return _0x3fead2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x4d562e['to']('errorMessage')}]},_0xa9c7df]}),_0x3fead2;}['_createEmptyStateView'](){const _0x11c5aa=new _0x4708a3(this['locale']);return _0x11c5aa['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x41764e=>!_0x41764e)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[ls(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x11c5aa;}['_createListItemViews'](_0x90d850,_0x318e1c){const _0x3db7e5=[];for(const _0x2a2469 of _0x90d850){const _0x1930e2=new Wo(_0x318e1c,_0x2a2469);_0x1930e2['delegate'](...$o)['to'](this),_0x3db7e5['push'](_0x1930e2);}return _0x3db7e5;}['updateHistoryItemsWithCategories'](_0x25dabc){const _0x587b42=this['locale']||'en',_0x40c0cd=[];for(const _0x28c86f of _0x25dabc){const _0x481710=this['_createListItemViews'](_0x28c86f['items'],_0x587b42);_0x40c0cd['push'](new Fo(_0x587b42,{'title':_0x28c86f['title'],'items':_0x481710}));}this['sectionsView']['sections']=_0x40c0cd,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x40c0cd),this['hasItems']=_0x25dabc['some'](_0xd0ecad=>_0xd0ecad['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x908d72){for(const _0x46e6dd of this['sectionsView']['sections']){const _0x27be45=_0x46e6dd['getItem'](_0x908d72);if(_0x27be45){if(_0x46e6dd['removeItem'](_0x27be45),0x0===_0x46e6dd['itemsViews']['length']){const _0x23feb7=this['sectionsView']['sections']['indexOf'](_0x46e6dd);-0x1!==_0x23feb7&&(this['sectionsView']['sections']['splice'](_0x23feb7,0x1),this['sectionsView']['items']['remove'](_0x46e6dd));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x492ac7,_0x59b70e){for(const _0x17989c of this['sectionsView']['sections']){const _0x4fac02=_0x17989c['getItem'](_0x492ac7);if(_0x4fac02){_0x4fac02['updateTitle'](_0x59b70e);break;}}}['updateItemLoadingState'](_0x3cb317,_0xba0d6f,_0x4fd93b){for(const _0x9c19dc of this['sectionsView']['sections']){const _0x6a9063=_0x9c19dc['getItem'](_0x3cb317);if(_0x6a9063){_0x6a9063['updateLoadingState'](_0xba0d6f,_0x4fd93b);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x14cec1=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x14cec1);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x3abc0e{static get['requires'](){return[hs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x32c681){super(_0x32c681);const _0x21a19d=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x21a19d['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x21a19d),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x21a19d['view'],'isMaximized',_0x4b78db=>_0x4b78db),_0x21a19d['view']['addTab']({'id':'history','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x4f0239,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x1dd484){this['_historyView']['removeHistoryItem'](_0x1dd484);}['updateItems'](_0x400e36){this['_historyView']['updateHistoryItemsWithCategories'](_0x400e36);}['updateItemTitle'](_0x21fe6d,_0x103e19){this['_historyView']['updateItemTitle'](_0x21fe6d,_0x103e19);}['updateItemLoadingState'](_0x2429d9,_0x56ff6b,_0x358bb3){this['_historyView']['updateItemLoadingState'](_0x2429d9,_0x56ff6b,_0x358bb3);}['setLoadingSkeleton'](_0x245230){this['_historyView']['isLoading']=_0x245230;}['showError'](_0x1a4961){this['_historyView']['errorMessage']=_0x1a4961;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
- _t();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x370ceb,title:_0x53e040,createdAt:_0x491ac6,updatedAt:_0x3936d5,pinned:_0x537f69}){super(),this['id']=_0x370ceb,this['createdAt']=new Date(_0x491ac6),this['set']('title',_0x53e040),this['set']('updatedAt',_0x3936d5?new Date(_0x3936d5):null),this['set']('pinned',_0x537f69||!0x1);}['updateTitle'](_0x5dac5f){this['set']('title',_0x5dac5f),this['updatedAt']=new Date();}['updatePinned'](_0x53788b){this['set']('pinned',_0x53788b),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
- lt();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x186063,group:_0x230598}){super(),this['connector']=_0x186063,this['group']=_0x230598;}async['init'](){try{const _0x1e9b9e=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x1e9b9e);}catch(_0x2f8e3e){this['fire']('error',{'error':_0x2f8e3e,'operation':'init'});}}['addItem'](_0x52073c){this['items']['push'](_0x52073c);}async['removeItem'](_0x77188b){const _0x450c69=this['items']['findIndex'](_0x316027=>_0x316027['id']===_0x77188b);if(-0x1===_0x450c69)return!0x1;try{return await this['connector']['deleteConversation'](_0x77188b)['execute'](),this['items']['splice'](_0x450c69,0x1),this['fire']('itemRemoved',{'itemId':_0x77188b}),!0x0;}catch(_0x11003a){return this['fire']('error',{'error':_0x11003a,'operation':'removeItem','itemId':_0x77188b}),!0x1;}}['getItem'](_0x2599ff){return this['items']['find'](_0x1ecf4b=>_0x1ecf4b['id']===_0x2599ff);}async['updateItemTitle'](_0x2e05ae,_0x5d616b){const _0x437415=this['getItem'](_0x2e05ae);if(!_0x437415)return!0x1;try{return await this['connector']['updateConversation'](_0x2e05ae,{'title':_0x5d616b})['getResult'](),_0x437415['updateTitle'](_0x5d616b),this['fire']('itemUpdated',{'itemId':_0x2e05ae,'updates':{'title':_0x5d616b}}),!0x0;}catch(_0x1235c0){return this['fire']('error',{'error':_0x1235c0,'operation':'updateItemTitle','itemId':_0x2e05ae}),!0x1;}}async['updateItemPinned'](_0xb110d9,_0x3d8606){const _0x4e4ef6=this['getItem'](_0xb110d9);if(!_0x4e4ef6)return!0x1;try{return await this['connector']['updateConversation'](_0xb110d9,{'pinned':_0x3d8606})['getResult'](),_0x4e4ef6['updatePinned'](_0x3d8606),this['fire']('itemUpdated',{'itemId':_0xb110d9,'updates':{'pinned':_0x3d8606}}),!0x0;}catch(_0x3ceb98){return this['fire']('error',{'error':_0x3ceb98,'operation':'updateItemPinned','itemId':_0xb110d9}),!0x1;}}['loadItems'](_0x164f9e){try{this['items']=[],_0x164f9e['map'](_0x229969=>{this['addItem'](new Xo(_0x229969));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x1fe61f){this['fire']('error',{'error':_0x1fe61f,'operation':'loadItems'});}}['getItems'](_0x487e39={}){const _0x223134=void 0x0!==_0x487e39['pinned']&&_0x487e39['pinned'],_0x426ff0=_0x487e39['from']?new Date(_0x487e39['from']['getFullYear'](),_0x487e39['from']['getMonth'](),_0x487e39['from']['getDate']()):null,_0x318e56=_0x487e39['to']?new Date(_0x487e39['to']['getFullYear'](),_0x487e39['to']['getMonth'](),_0x487e39['to']['getDate']()):null;return this['items']['filter'](_0x36619a=>{if(_0x36619a['pinned']!==_0x223134)return!0x1;if(_0x318e56){const _0xf55b25=new Date(_0x36619a['createdAt']['getFullYear'](),_0x36619a['createdAt']['getMonth'](),_0x36619a['createdAt']['getDate']());return _0x426ff0?_0x426ff0['getTime']()===_0x318e56['getTime']()?_0xf55b25['getTime']()===_0x426ff0['getTime']():_0xf55b25<_0x318e56&&_0xf55b25>=_0x426ff0:_0xf55b25<_0x318e56;}return!0x0;});}},Jo=class extends _0x3abc0e{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[cs,rn,kn,qo,hs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](cs),this['_aiChatHistoryUi']=this['context']['plugins']['get'](qo),this['_aiChatController']=this['context']['plugins']['get'](kn),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aichathistory');const _0x5e2621=this['context']['plugins']['get'](hs);try{const _0x510721=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x510721}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x1712df,_0x58d32b)=>{this['_setItemLoading'](_0x58d32b['id'],'remove'),this['_handleRemove'](_0x58d32b['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x291ab7,_0x5770d0)=>{this['_setItemLoading'](_0x5770d0['id'],'rename'),this['_handleEditTitle'](_0x5770d0['id'],_0x5770d0['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x33d18a,_0x172e66)=>{void 0x0!==_0x172e66['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x172e66['itemId'],_0x172e66['updates']['title']),void 0x0!==_0x172e66['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x172e66['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x1e4394,_0x49c7b3)=>{this['_aiChatController']['_handleRemovedConversation'](_0x49c7b3['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x49c7b3['itemId']),this['_clearItemLoading'](_0x49c7b3['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x3448e2,_0x358b11)=>{this['_handleHistoryErrorUI'](_0x358b11['error'],_0x358b11['operation'],_0x358b11['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x1fd992,_0x285d26)=>{this['_handleSelectConversation'](_0x285d26['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x3fb37b,_0x1637d1)=>{const _0x3b8ff0=_0x1637d1['pinned']?'pin':'unpin';this['_setItemLoading'](_0x1637d1['id'],_0x3b8ff0),this['_handleTogglePin'](_0x1637d1['id'],_0x1637d1['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x5e2621['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x5e2621['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x39f2b0){this['_handleHistoryErrorUI'](_0x39f2b0,'init');}}async['_handleEditTitle'](_0x2fd075,_0x51f8f1){await this['history']['updateItemTitle'](_0x2fd075,_0x51f8f1);}async['_handleTogglePin'](_0x47a205,_0x54b027){await this['history']['updateItemPinned'](_0x47a205,_0x54b027);}async['_handleRemove'](_0x1ff218){await this['history']['removeItem'](_0x1ff218);}async['_handleSelectConversation'](_0xd0c937){await this['_aiChatController']['loadConversation'](_0xd0c937);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x34be10=this['_aiChatController']['activeConversation']?.['id'],_0x4bb609=this['_getCategorizedItems']()['map'](_0xe8b670=>({'title':_0xe8b670['title'],'items':_0xe8b670['items']['map'](_0x3f815c=>({'id':_0x3f815c['id'],'title':_0x3f815c['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x3f815c['createdAt'])['toLocaleDateString'](),'active':_0x3f815c['id']===_0x34be10,'pinned':_0x3f815c['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x4bb609);}['_setItemLoading'](_0x39c7ae,_0x462447){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x39c7ae,_0x462447,!0x0);}['_clearItemLoading'](_0x1f645f){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1f645f,null,!0x1);}['_handleHistoryErrorUI'](_0xc9c910,_0x3ec2b5,_0x1a2cdc){const _0x232f9a=this['_generateErrorMessage'](_0x3ec2b5,_0x1a2cdc);this['_aiChatHistoryUi']['showError'](_0x232f9a),this['_reporter']['reportError'](_0xc9c910,{'context':{'operation':_0x3ec2b5}}),_0x1a2cdc&&this['_clearItemLoading'](_0x1a2cdc),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x31f458,_0x5e1ffa){const _0x5777fd=_0x5e1ffa?this['history']['getItem'](_0x5e1ffa):null,_0x500de1=_0x5777fd?.['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x31f458){case'updateItemTitle':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x500de1);case'updateItemPinned':{const _0x24dc15=ls(this['context']['locale'],_0x5777fd?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x24dc15,_0x500de1]);}case'removeItem':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x500de1);case'init':case'loadItems':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0xd54cc3=new Date(),_0x28c9a4=new Date(_0xd54cc3['getFullYear'](),_0xd54cc3['getMonth'](),_0xd54cc3['getDate']()),_0x19229a=new Date(_0x28c9a4);_0x19229a['setDate'](_0x19229a['getDate']()-0x1);const _0x5b671e=new Date(_0x28c9a4);_0x5b671e['setDate'](_0x5b671e['getDate']()-0xe);const _0x3e5b68=this['history']['getItems']({'pinned':!0x0}),_0x46ccbf=this['history']['getItems']({'from':_0x28c9a4,'to':_0x28c9a4}),_0xac97b1=this['history']['getItems']({'from':_0x19229a,'to':_0x19229a}),_0x53f523=this['history']['getItems']({'from':_0x5b671e,'to':_0x19229a}),_0x49ce0f=this['history']['getItems']({'to':_0x5b671e}),_0x5d89cc=[];return _0x3e5b68['length']>0x0&&_0x5d89cc['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x3e5b68}),_0x46ccbf['length']>0x0&&_0x5d89cc['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x46ccbf}),_0xac97b1['length']>0x0&&_0x5d89cc['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0xac97b1}),_0x53f523['length']>0x0&&_0x5d89cc['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x53f523}),_0x49ce0f['length']>0x0&&_0x5d89cc['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x49ce0f}),_0x5d89cc;}},Zo=class extends _0x3abc0e{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x3abc0e{static get['requires'](){return[kn,As,Bo,Zo,en];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4dd323){super(_0x4dd323),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 Pt{['id'];constructor(_0xb8ada0,_0x9db882){super(_0xb8ada0);const {id:_0x52a5fa,type:_0x165540,icon:_0x2e3106}=_0x9db882;this['id']=_0x52a5fa,this['set']({'label':_0x9db882['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x9db882['id']}}),_0x2e3106?this['icon']=_0x2e3106:'chat'===_0x165540?this['icon']=_0x433c60:'review'===_0x165540?this['icon']=_0x2f914c:'translate'===_0x165540&&(this['icon']=_0x3de69e);}},ia=class extends _0x4708a3{['listView'];constructor(_0x11787e,_0x54ad8c){super(_0x11787e),this['set']('isEnabled',!0x0);const _0x51b0bd=_0x54ad8c['map'](_0x5ae9df=>{const _0x17c8e6=new Xt(this['locale']),_0x4219bd=new ea(this['locale'],_0x5ae9df);return _0x4219bd['bind']('isEnabled')['to'](this),_0x17c8e6['children']['add'](_0x4219bd),_0x4219bd['delegate']('execute')['to'](this),_0x17c8e6;});this['listView']=new zt(this['locale']),this['listView']['items']['addMany'](_0x51b0bd),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x3abc0e{['_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 _0x1fdb73=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x35093b=_0x1fdb73['activeConversation'];_0x35093b['isFromHistory']||this['_injectShortcuts'](_0x35093b);}),this['listenTo'](_0x1fdb73,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x15fab6=['chat','review','translate'];this['_shortcuts']['forEach'](_0x3c89fd=>{let _0x9482d4=!0x0;if(_0x3c89fd['id']&&_0x3c89fd['label']&&_0x15fab6['includes'](_0x3c89fd['type'])?'chat'===_0x3c89fd['type']&&(_0x9482d4='string'==typeof _0x3c89fd['prompt']):_0x9482d4=!0x1,!_0x9482d4)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x3c89fd});});}['_injectShortcuts'](_0x186f8f){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',_0x123f12=>{const _0xf6ee69=_0x123f12['source']['id'];this['_executeShortcut'](_0xf6ee69);}),this['_listenedConversation']=_0x186f8f,this['listenTo'](_0x186f8f,'uploadProgressChanged',(_0xf49c1f,_0x1935c2)=>{this['_shortcutsView']['isEnabled']=!_0x1935c2['isUploadInProgress'];});}['_removeShortcuts'](){const _0x4dbe7f=this['context']['plugins']['get'](Bo);_0x4dbe7f['hasFeedItem'](sa)&&_0x4dbe7f['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x3a55ad){const _0x53de27=this['_shortcuts']['find'](_0x2a3430=>_0x2a3430['id']===_0x3a55ad),_0x26ef9a=_0x53de27['type'];'chat'===_0x26ef9a?this['_runChatShortcut'](_0x53de27):'review'===_0x26ef9a?_0x53de27['commandId']?this['_runReviewShortcut'](_0x53de27):this['_switchTab']('reviewMode'):'translate'===_0x26ef9a&&(_0x53de27['language']?this['_runTranslateShortcut'](_0x53de27):this['_switchTab']('translate'));}['_switchTab'](_0xb3a36b){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0xb3a36b});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0xb3a36b);}async['_runChatShortcut']({prompt:_0x2dea5b,draftMode:_0x5d58a1,useWebSearch:_0x143720=!0x1,useReasoning:_0x2a1846=!0x1,model:_0x21e1bd}){const _0x35f6eb=this['context']['plugins']['get']('AIChatController'),_0x25f4e5=_0x35f6eb['activeConversation'];let _0x2a2426;_0x2a2426=_0x21e1bd?await _0x25f4e5['chatModels']['getModel'](_0x21e1bd):await _0x25f4e5['chatModels']['getDefault'](),_0x2a2426&&await _0x25f4e5['setModel'](_0x2a2426),_0x25f4e5['setWebSearch'](_0x143720),_0x25f4e5['setReasoning'](_0x2a1846),_0x35f6eb['addCurrentDocumentToChatContext'](),_0x5d58a1?(this['_aiChatUI']['setPromptInputValue'](_0x2dea5b),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x35f6eb['sendMessage']({'message':_0x2dea5b});}['_runReviewShortcut']({commandId:_0x2ac22d,model:_0x524a24,prompt:_0x5b2d36,params:_0x1dc9aa}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x46f224={'id':_0x2ac22d,'isCustom':'custom'===_0x2ac22d};_0x524a24&&_0x5b2d36&&(_0x46f224['args']={'model':_0x524a24,'prompt':_0x5b2d36}),_0x1dc9aa&&(_0x46f224['params']=_0x1dc9aa),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x46f224);}['_runTranslateShortcut']({language:_0x15f6e9}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x15f6e9,'args':{'language':_0x15f6e9}});}},ra=class extends _0x2f2e2c{constructor(_0x4cd7d7){super(_0x4cd7d7);const _0x1da148=_0x4cd7d7['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1da148,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x22050a=this['editor']['plugins']['get']('AITabs')['view'];_0x22050a['isVisible']=!_0x22050a['isVisible'];}},oa=class extends _0x5bc74c{static get['requires'](){return[hs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2eea3f=this['editor'];_0x2eea3f['commands']['add']('toggleAi',new ra(_0x2eea3f)),_0x2eea3f['ui']['componentFactory']['add']('toggleAi',()=>{const _0x2ec4ac=this['_createAIUIButton'](Pt);return _0x2ec4ac['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x2ec4ac;}),_0x2eea3f['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x248830=this['_createAIUIButton'](jt);return _0x248830['set']({'role':'menuitemcheckbox'}),_0x248830;});}['_createAIUIButton'](_0x81756e){const _0x11e823=this['editor'],_0x1bdfbb=_0x11e823['commands']['get']('toggleAi'),_0x14f70c=new _0x81756e(_0x11e823['locale']);return _0x14f70c['set']({'label':ls(_0x11e823['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x425345,'isToggleable':!0x0}),_0x14f70c['bind']('isEnabled')['to'](_0x1bdfbb),_0x14f70c['bind']('isOn')['to'](_0x1bdfbb,'value',_0x7e3ab7=>!!_0x7e3ab7),this['listenTo'](_0x14f70c,'execute',()=>{_0x1bdfbb['execute']();}),_0x14f70c;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x4708a3{['_errorView'];constructor(_0x5a47c3){super(_0x5a47c3),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x2478e5){this['showError'](_0x2478e5);}['showError'](_0x3f64fb){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x3f64fb,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x10e3c4=new _0x4708a3(this['locale']),_0x35b556=new _0x4708a3(this['locale']);return _0x35b556['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x10e3c4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x489ec7=>!_0x489ec7)]},'children':[_0x35b556]}),_0x10e3c4;}};const ca=0xa;var la=class extends _0x3abc0e{static get['requires'](){return[As];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x5204a1){const {id:_0x55e21e}=this['_currentConfig']??{};this['_currentConfig']=_0x5204a1,this['_editor']=_0x5204a1['targetEditor'];const {id:_0x39280b}=this['_currentConfig'];this['isOpen']&&_0x55e21e===_0x39280b?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x128481=this['_editor'];if(!_0x128481)return;const _0x15dd1=_0x128481['plugins']['get']('Dialog');_0x15dd1['isOpen']&&this['_currentConfig']&&_0x15dd1['id']===this['_currentConfig']['id']&&_0x15dd1['hide']();}['_updateDialog'](){const _0x32556d=this['_editor']['plugins']['get']('Dialog'),{icon:_0x30d317,title:_0x240393}=this['_currentConfig'];_0x32556d['view']?.['headerView']&&(_0x32556d['view']['headerView']['label']=_0x240393,_0x32556d['view']['headerView']['iconView']&&_0x30d317&&(_0x32556d['view']['headerView']['iconView']['content']=_0x30d317)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x32556d['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](As)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](As)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x351b37=this['_editor']['plugins']['get']('Dialog'),{id:_0x4b023e,title:_0x160fa1,icon:_0x5e2232,class:_0x109d5c,mainView:_0x1617c1}=this['_currentConfig'];_0x1617c1['delegate'](...aa)['to'](this),_0x351b37['show']({'title':_0x160fa1,'icon':_0x5e2232,'hasCloseButton':!0x0,'id':_0x4b023e,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x109d5c||''),'content':_0x1617c1,'onShow':_0x430dbc=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x430dbc['view']?.['updatePosition']();const _0xacc3bf=this['_getSelectionElements']();_0xacc3bf&&_0xacc3bf[0x0]&&St({'target':_0xacc3bf[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x430dbc['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x4b023e});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x4b023e}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x1eac2a,_0x1b7336,_0x447f26){if(!_0x447f26)return null;const _0x5297d6=this['_getSelectionElements']();if(!_0x5297d6||0x0===_0x5297d6['length'])return{'left':Math['round'](_0x447f26['left']+_0x447f26['width']/0x2-_0x1eac2a['width']/0x2),'top':Math['round'](_0x447f26['top']+_0x447f26['height']/0x2-_0x1eac2a['height']/0x2)};const _0x2a28db=Math['round'](_0x447f26['left']+_0x447f26['width']/0x2-_0x1eac2a['width']/0x2),_0xc7f57b=_0x5297d6['map'](_0x3263fd=>new gt(_0x3263fd)),_0x32e120=_0x1eac2a['height'];return{'left':_0x2a28db,'top':this['_calculateOptimalTopPosition'](_0xc7f57b,_0x32e120,_0x447f26)};}['_calculateOptimalTopPosition'](_0xda1956,_0x2f2b55,_0x5862ea){const _0x34005c=new gt(Et['window']),_0x50d0e6=_0xda1956['map'](_0x543a8b=>_0x543a8b['getVisible']())['filter'](_0x755497=>_0x755497),_0x33f1ef=gt['getBoundingRect'](_0x50d0e6);if(!_0x33f1ef)return Math['round'](_0x5862ea['top']+_0x5862ea['height']/0x2);const _0x333c94=_0x34005c['getIntersection'](_0x33f1ef);if(!_0x333c94)return Math['round'](_0x5862ea['top']+_0x5862ea['height']/0x2);const _0x21139a=_0x5862ea['getVisible'](),_0x2c0347=_0x21139a&&_0x33f1ef['height']>_0x21139a['height'],_0x3054b4=_0x333c94['top'],_0x11eef3=_0x333c94['bottom'];if(_0x2c0347){const _0x9bcdf8=(_0x21139a||_0x34005c)['height']/0x2-_0x2f2b55/0x2,_0x712bab=_0x3054b4-ca-_0x5862ea['top'],_0x3f0a96=_0x5862ea['bottom']-_0x11eef3-ca;return _0x712bab>=_0x2f2b55?Math['max'](ca,_0x3054b4-_0x2f2b55-ca):_0x3f0a96>=_0x2f2b55?_0x11eef3+ca:Math['max'](ca,_0x9bcdf8);}const _0x37e4eb=_0x3054b4-_0x2f2b55,_0x1762d8=_0x5862ea['bottom']-_0x11eef3-ca,_0x331110=_0x3054b4-ca-_0x5862ea['top'];let _0x49570a;return _0x49570a=_0x1762d8>=_0x2f2b55?_0x11eef3+ca:_0x331110>=_0x2f2b55?_0x37e4eb-ca:_0x3054b4+_0x33f1ef['height']/0x2-_0x2f2b55/0x2,_0x49570a;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x202faa=this['_editor'];this['listenTo'](_0x202faa['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x57c71d,data:{newRange:_0x1f8cfe}}of _0x202faa['model']['document']['differ']['getChangedMarkers']())if(_0x57c71d['startsWith']('ai-selection:')&&(_0x1f8cfe&&(_0x1f8cfe['start']['isEqual'](_0x1f8cfe['end'])||'$graveyard'==_0x1f8cfe['root']['rootName'])||null==_0x1f8cfe)){const _0x52c750=ls(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x52c750),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x3239b0=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x3239b0['model']['document']);}['_getSelectionElements'](){const _0x311417=this['_editor'];return _0x2f8615(_0x311417['editing'],[..._0x311417['model']['markers']['getMarkersGroup']('ai-selection'),..._0x311417['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x56660d=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x56660d&&_0x56660d['rootName']?_0x56660d['rootName']:null;}},ua=class extends _0x4b90d1{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x26af14,_0x357083={}){super(_0x26af14),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x357083};const _0x5dca3d=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x5dca3d?'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'](_0x581f35){this['showChangesButton']['isEnabled']=_0x581f35;}['_setupRatingButtons'](){this['likeButton']=new Pt(this['locale']),this['likeButton']['set']({'icon':rt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':cn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Pt(this['locale']),this['dislikeButton']['set']({'icon':nt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':cn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Pt(this['locale']),this['copyButton']['set']({'icon':_0x2213d2,'label':ls(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+cn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x188f9f=new Wt();_0x188f9f['set']({'content':_0x1fb55b}),_0x188f9f['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'+cn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+cn;},0x7d0);}),this['copyButton']['children']['add'](_0x188f9f);}['_setupShowChangesButton'](){this['showChangesButton']=new Pt(this['locale']),this['showChangesButton']['set']({'icon':_0x2973b4,'label':ls(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':cn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0xa64e65=>_0xa64e65?tt:_0x2973b4),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(_0x4c93a3,_0x3f636e){super(_0x4c93a3);const _0x19de3c=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x3f636e,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x4c93a3),this['_partToolbarView']=new Wn(_0x4c93a3,_0x3f636e['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x3f636e),this['_stateView']=new Fn(_0x4c93a3),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x4c93a3,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x4c93a3,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x37e9b3,_0x5b009,_0x2ac5f2,_0x1527b9)=>{let _0x4a67a4,_0x591c38;'pending'===_0x1527b9?(_0x4a67a4=this['_partToolbarView'],_0x591c38=this['_stateView']):(_0x4a67a4=this['_stateView'],_0x591c38=this['_partToolbarView']),this['_stateView']['setState'](_0x2ac5f2),_0x4a67a4['isVisible']=!0x1,_0x591c38['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x19de3c['to']('_state',_0x360a41=>'ck-ai-chat-balloon-main_state_'+_0x360a41)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x3f636e);});}['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'](_0x4b7b52){_0x4b7b52?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x4b7b52);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x5b5c62){this['_state']=_0x5b5c62;}['showError'](_0xc3d502){super['showError'](_0xc3d502),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x488a8e){super['showBlockingError'](_0x488a8e),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x54267d){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x54267d;}['togglePartToolbarEnabled'](_0x3a702c){this['_partToolbarView']['isEnabled']=_0x3a702c;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x3c33d3,showSuggestButton:_0xa222d1}){_0x3c33d3=_0x3c33d3&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0xa222d1=_0xa222d1&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x3c33d3,'showSuggestButton':_0xa222d1});}['_createNextButtonView'](){const _0x35e0da=new Pt(this['locale']);return _0x35e0da['set']({'icon':_0x4f154b,'label':ls(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x35e0da['on']('execute',()=>{this['fire']('showNext');}),_0x35e0da;}['_createPreviousButtonView'](){const _0x480fe1=new Pt(this['locale']);return _0x480fe1['set']({'icon':_0x8aee51,'label':ls(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x480fe1['on']('execute',()=>{this['fire']('showPrevious');}),_0x480fe1;}},_a=class extends _0x4708a3{constructor(_0x56c0e9,_0xabd4ce){super(_0x56c0e9),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0xabd4ce});}},ga=class extends _0x5bc74c{static get['requires'](){return[Ht,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x53b371){super(_0x53b371),this['set']('showDiff',!0x1);}['open'](_0x383cdd){const _0x18c305=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x18c305['plugins']['get']('AIBalloon')['open']({..._0x383cdd,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x383cdd['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x383cdd['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x59b01c){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x59b01c);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x5a0e30){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x5a0e30);}['_createChatBalloonView'](){const _0x15d12c=this['editor'],_0x563e73=_0x15d12c['plugins']['get']('AIBalloon'),_0xee6ac6=_0x15d12c['commands']['get']('trackChanges');let _0x3bfbdc=_0x15d12c['config']['get']('ai.availableReplyActions')||[...er];_0x15d12c['plugins']['has']('TrackChanges')||(_0x3bfbdc=_0x3bfbdc['filter'](_0x35a3ca=>'insertSuggestion'!=_0x35a3ca));const _0x6508ea=new da(_0x15d12c['locale'],{'availableActions':_0x3bfbdc,'showApplyButton':!0x0,'showSuggestButton':!!_0xee6ac6});return _0x6508ea['bind']('showDiff')['to'](this),_0x6508ea['delegate'](...Nn)['to'](this),_0x6508ea['delegate']('showPrevious','showNext')['to'](this),_0x563e73['delegate']('dialogClosed')['to'](this),_0x6508ea['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x6508ea['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x6508ea['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xee6ac6&&_0x6508ea['bind']('isTrackChangesOn')['to'](_0xee6ac6,'value'),_0x6508ea['render'](),_0x6508ea;}['_toggleRotatorButtonsInDialogHeader'](_0x2fac47){const _0xc451b3=this['editor'],_0x4a515a=_0xc451b3['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x2fac47),_0x4a515a['has'](this['_chatBalloonView']['previousButtonView'])||(_0x4a515a['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0xc451b3['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x4a515a['remove'](this['_chatBalloonView']['previousButtonView']),_0x4a515a['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x5bc74c{static get['requires'](){return[oa,ga,_0x3cdc25];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x4780f1){const {editor:_0xf28530,action:_0x19e59e,withText:_0x585e1e=!0x1,withIcon:_0x416cdc=!0x0,isInDropdown:_0x2bce87=!0x0,shouldPreventFocus:_0xd4e266=!0x1,actionButtons:_0x96d00c}=_0x4780f1;return()=>{const _0x29f727=_0xf28530['locale'],_0x107056=new Pt(_0x29f727),_0x5328f8=_0x107056['bindTemplate'];_0x2bce87&&_0x107056['extendTemplate']({'on':{'mouseenter':_0x5328f8['to'](()=>{_0xd4e266&&_0xd4e266()||_0x107056['focus']();})}}),_0x96d00c['push']({'buttonView':_0x107056,'action':_0x19e59e});const _0x2a31f7=_0x19e59e['icon']??_0x19e59e['parent']?.['icon'];return _0x107056['set']({'label':_0x19e59e['label'],'withText':_0x585e1e,'role':'menuitem','icon':_0x416cdc?_0x2a31f7??_0x2a6bd4:void 0x0,'tooltip':!_0x585e1e,'class':'ck-ai-quick-actions-button','isEnabled':_0x19e59e['isEnabled']}),_0x107056['on']('execute',()=>{_0xf28530['editing']['view']['focus'](),_0xf28530['commands']['execute']('aiQuickAction',_0x19e59e);}),_0x107056;};}var pa=class extends qt{['arrowView'];constructor(_0x457c01,_0x44f571){super(_0x457c01,_0x44f571);const _0x3587e1=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',_0x9b6153=>String(_0x9b6153)),'data-cke-tooltip-disabled':_0x3587e1['to']('isOn')},'on':{'mouseenter':_0x3587e1['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x173c6f=new Wt();return _0x173c6f['content']=_0x599889,_0x173c6f['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x173c6f;}},ma=class extends zt{['_allListItems'];['_allSearchableItems'];constructor(_0x1c89d0,_0x7237ca,_0x271b4a){super(_0x1c89d0),this['_allListItems']=_0x7237ca,this['_allSearchableItems']=_0x271b4a;}['filter'](_0xaa5c25){if(!_0xaa5c25)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x5bda93=_0xaa5c25['source']['toLowerCase']()['trim'](),_0x3a1b55=this['_allSearchableItems']['filter'](_0x2036a2=>(_0x2036a2['groupLabel']?_0x2036a2['label']+'\x20('+_0x2036a2['groupLabel']+')':_0x2036a2['label'])['toLowerCase']()['includes'](_0x5bda93));return this['items']['clear'](),this['items']['addMany'](_0x3a1b55['sort']((_0x163f14,_0x1c1e50)=>{const _0x3c2694=_0x163f14['groupLabel'],_0x835f01=_0x1c1e50['groupLabel'];return _0x3c2694||_0x835f01?_0x3c2694?0x1:-0x1:0x0;})['map'](_0x1b714b=>_0x1b714b['item'])),this['_highlightQuery'](_0x5bda93,_0x3a1b55),{'resultsCount':_0x3a1b55['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x59fb16,_0x3f337d){if(!_0x59fb16)return;const _0x11e562=new RegExp(_0x2cddd7(_0x59fb16),'gi');_0x3f337d['forEach'](_0x5263f4=>{_0x5263f4['highlightViews']&&_0x5263f4['highlightViews']['forEach'](_0x5ba0e4=>{'function'==typeof _0x5ba0e4['highlightText']&&_0x5ba0e4['highlightText'](_0x11e562);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x2f4535=>{_0x2f4535['highlightViews']&&_0x2f4535['highlightViews']['forEach'](_0x1e415c=>{'function'==typeof _0x1e415c['highlightText']&&_0x1e415c['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x4708a3{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x454976,_0x19185d,_0x3b8df9,_0x2cfbea,_0x39ad38=!0x1,_0x1be390=[]){const _0x3fa09b=_0x454976['locale'];super(_0x3fa09b),this['_bodyCollection']=_0x2cfbea,this['_hasSearch']=_0x39ad38,this['_actionButtons']=_0x1be390;const _0x47d149=this['_createListItems'](_0x454976,_0x19185d,_0x3b8df9);this['optionsListView']=new ma(_0x3fa09b,_0x47d149,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x47d149),this['focusTracker']=new ut(),this['keystrokes']=new dt(),_0x39ad38&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x47d149,this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x39ad38&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x1189a7=_0x39ad38&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x4f88bc(_0x1189a7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x3fa09b['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x853608(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x49be78=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x49be78);}['_createListItems'](_0x2f5287,_0x5a25ff,_0x458e69){const _0x482770=new _0x4f88bc();return _0x5a25ff['forEach'](_0x1dc7d4=>{if('actions'in _0x1dc7d4){const {listItem:_0x33bc67}=this['_createActionGroupButton'](_0x2f5287,_0x1dc7d4,_0x458e69);_0x482770['add'](_0x33bc67),_0x1dc7d4['actions']['forEach'](_0x44dd38=>{const {listItem:_0x4a8925,highlightViews:_0x77e1b0}=this['_createSearchResultActionButton'](_0x2f5287,_0x44dd38,_0x1dc7d4['label'],_0x1dc7d4['icon']);this['_allSearchableItems']['push']({'item':_0x4a8925,'label':_0x44dd38['label'],'groupLabel':_0x1dc7d4['label'],'highlightViews':_0x77e1b0});});}else{const {listItem:_0x34a72f}=this['_createActionButton'](_0x2f5287,_0x1dc7d4);_0x482770['add'](_0x34a72f);const _0x530038=_0x34a72f['children']['first'];if(_0x530038){const {listItem:_0x2bcc0e,highlightViews:_0x5bc4d1}=this['_createSearchResultActionButton'](_0x2f5287,_0x1dc7d4);this['_allSearchableItems']['push']({'item':_0x2bcc0e,'label':_0x530038['label']||'','highlightViews':_0x5bc4d1});}}}),_0x482770;}['_createActionButton'](_0x5b40fd,_0x2d2646,_0x379d3e,_0x3af763){const _0x37ed9f=new Xt(this['locale']);if(_0x379d3e&&_0x3af763){const _0x57e985=new Pt(this['locale']),_0x333dad=_0x57e985['bindTemplate'],_0x1de536=new Kt();_0x1de536['text']=_0x2d2646['label'];const _0x374f41=new Kt();_0x374f41['text']=_0x379d3e;const _0x3eaf2b=new Wt();_0x3eaf2b['content']=_0x3af763,_0x3eaf2b['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0xbb7511=new _0x4708a3(this['locale']);_0xbb7511['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x472ce6=new _0x4708a3(this['locale']);return _0x472ce6['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x57e985['set']({'label':_0x2d2646['label']+'\x20('+_0x379d3e+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x2d2646['isEnabled']}),_0x57e985['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x333dad['if']('isEnabled','ck-disabled',_0x26f5ce=>!_0x26f5ce)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1de536,_0xbb7511,_0x3eaf2b,_0x374f41,_0x472ce6],'on':{'mouseenter':_0x333dad['to'](()=>{this['_isSearchFocused']()||_0x57e985['focus']();}),'click':_0x333dad['to'](()=>{_0x57e985['fire']('execute');})}}),_0x57e985['on']('execute',()=>{_0x57e985['isEnabled']&&(_0x5b40fd['editing']['view']['focus'](),_0x5b40fd['commands']['execute']('aiQuickAction',_0x2d2646));}),_0x37ed9f['children']['add'](_0x57e985),this['_actionButtons']['push']({'buttonView':_0x57e985,'action':_0x2d2646}),{'listItem':_0x37ed9f,'highlightViews':[_0x1de536,_0x374f41]};}{const _0x4ded1d=new Dt(),_0x56305b=new Pt(this['locale'],_0x4ded1d),_0x14b948=_0x56305b['bindTemplate'],_0x48881a=_0x2d2646['icon']??_0x2d2646['parent']?.['icon'],_0x26c96d=void 0x0!==_0x2d2646['icon'];return _0x56305b['set']({'label':_0x2d2646['label'],'withText':!0x0,'role':'menuitem','icon':_0x26c96d?_0x48881a??_0x2a6bd4:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x2d2646['isEnabled']}),_0x56305b['extendTemplate']({'on':{'mouseenter':_0x14b948['to'](()=>{this['_isSearchFocused']()||_0x56305b['focus']();})}}),_0x56305b['on']('execute',()=>{_0x5b40fd['editing']['view']['focus'](),_0x5b40fd['commands']['execute']('aiQuickAction',_0x2d2646);}),_0x37ed9f['children']['add'](_0x56305b),this['_actionButtons']['push']({'buttonView':_0x56305b,'action':_0x2d2646}),{'listItem':_0x37ed9f,'highlightViews':[_0x4ded1d]};}}['_createSearchResultActionButton'](_0x542081,_0x2880a2,_0x5edf99,_0x1a1a66){return _0x5edf99&&_0x1a1a66?this['_createSearchResultGroupedActionButton'](_0x542081,_0x2880a2,_0x5edf99,_0x1a1a66):this['_createSearchResultIndividualActionButton'](_0x542081,_0x2880a2);}['_createSearchResultGroupedActionButton'](_0x2b0ebb,_0x4bd2c8,_0x37ca20,_0x1e3189){const _0x778644=new Xt(this['locale']),_0x381922=new Pt(this['locale']),_0xb8633a=_0x381922['bindTemplate'],{view:_0x4aa62c,highlightView:_0x50135b}=this['_createSearchResultGroupRow'](_0x37ca20,_0x1e3189),{view:_0x11f811,highlightView:_0x132b95}=this['_createSearchResultActionRow'](_0x4bd2c8['label']),_0xb159d7=this['_createSearchResultContentView'](_0x4aa62c,_0x11f811);return _0x381922['set']({'label':_0x4bd2c8['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':_0x4bd2c8['isEnabled']}),_0x381922['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',_0xb8633a['if']('isEnabled','ck-disabled',_0x43585d=>!_0x43585d)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0xb159d7],'on':{'mouseenter':_0xb8633a['to'](()=>{this['_isSearchFocused']()||_0x381922['focus']();}),'click':_0xb8633a['to'](()=>{this['_handleSearchResultButtonClick'](_0x381922);})}}),this['_setupActionButtonExecution'](_0x381922,_0x2b0ebb,_0x4bd2c8),_0x778644['children']['add'](_0x381922),this['_actionButtons']['push']({'buttonView':_0x381922,'action':_0x4bd2c8}),{'listItem':_0x778644,'highlightViews':[_0x50135b,_0x132b95]};}['_createSearchResultIndividualActionButton'](_0x1ef399,_0x548f95){const _0x4895ca=new Xt(this['locale']),_0x55e2eb=new Dt(),_0x309ac1=new Pt(this['locale'],_0x55e2eb),_0x222af2=_0x309ac1['bindTemplate'];return _0x309ac1['set']({'label':_0x548f95['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x548f95['isEnabled']}),_0x309ac1['extendTemplate']({'on':{'mouseenter':_0x222af2['to'](()=>{this['_isSearchFocused']()||_0x309ac1['focus']();})}}),this['_setupActionButtonExecution'](_0x309ac1,_0x1ef399,_0x548f95),_0x4895ca['children']['add'](_0x309ac1),this['_actionButtons']['push']({'buttonView':_0x309ac1,'action':_0x548f95}),{'listItem':_0x4895ca,'highlightViews':[_0x55e2eb]};}['_createSearchResultGroupRow'](_0x411879,_0x14ac73){const _0x305e29=new _0x4708a3(this['locale']),_0x55b8f6=new Wt();_0x55b8f6['content']=_0x14ac73,_0x55b8f6['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x30461d=new Kt();return _0x30461d['text']=_0x411879,_0x305e29['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x55b8f6,_0x30461d]}),{'view':_0x305e29,'highlightView':_0x30461d};}['_createSearchResultActionRow'](_0x3e81dd){const _0xcc32e8=new _0x4708a3(this['locale']),_0x19b410=new Kt();return _0x19b410['text']=_0x3e81dd,_0xcc32e8['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x19b410]}),{'view':_0xcc32e8,'highlightView':_0x19b410};}['_createSearchResultContentView'](_0x5cfb7b,_0x306fc6){const _0x5965d7=new _0x4708a3(this['locale']);return _0x5965d7['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x5cfb7b,_0x306fc6]}),_0x5965d7;}['_setupActionButtonExecution'](_0x5cc0af,_0xc3fd51,_0x2dddb2){_0x5cc0af['on']('execute',()=>{_0x5cc0af['isEnabled']&&(_0xc3fd51['editing']['view']['focus'](),_0xc3fd51['commands']['execute']('aiQuickAction',_0x2dddb2));});}['_createActionGroupButton'](_0x5de5f4,_0x3ee3b6,_0x39fc03){const _0x645df1=new Xt(this['locale']),_0x55092d=new Dt(),_0x554aba=new pa(this['locale'],_0x55092d),_0x3d5907=_0x554aba['bindTemplate'],_0x42e99e=this['_getPanelKeystroke'](_0x39fc03),_0x453a91=this['_createGroupActionsList'](_0x5de5f4,_0x3ee3b6['actions'],_0x39fc03);_0x554aba['set']({'label':_0x3ee3b6['label'],'withText':!0x0,'role':Ta,'icon':_0x3ee3b6['icon']??_0x2a6bd4,'isEnabled':_0x3ee3b6['actions']['some'](_0x31b3c2=>_0x31b3c2['isEnabled'])}),_0x554aba['extendTemplate']({'on':{'mouseenter':_0x3d5907['to'](()=>{this['_isSearchFocused']()||_0x554aba['focus']();})}});const _0x55638e=new Nt(this['locale']);return _0x55638e['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x3d5907['to'](_0x2ebf89=>{this['_handlePanelKeydown'](_0x2ebf89,_0x42e99e,_0x554aba,_0x55638e);})}}),_0x554aba['bind']('isOn')['to'](_0x55638e,'isVisible'),this['_bodyCollection']['add'](_0x55638e),_0x55638e['content']['add'](_0x453a91),this['_setupGroupMenuBehavior'](_0x554aba,_0x55638e),_0x645df1['children']['add'](_0x554aba),this['_actionButtons']['push']({'buttonView':_0x554aba,'action':_0x3ee3b6}),{'listItem':_0x645df1,'highlightView':_0x55092d};}['_createGroupActionsList'](_0x323c65,_0x412083,_0x4e2744){const _0x25d13a=new zt(this['locale']);return _0x25d13a['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x412083['forEach'](_0x1fcb16=>{const _0x99a660=new Xt(this['locale']),_0x391082=Ia({'editor':_0x323c65,'action':_0x1fcb16,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x99a660['children']['add'](_0x391082),_0x4e2744['focusTracker']['add'](_0x391082),_0x25d13a['items']['add'](_0x99a660);}),_0x25d13a;}['_setupGroupMenuBehavior'](_0x4ac330,_0x5bb51c){const _0x544b36=_0x4ac330['bindTemplate'],_0x282e68=this['_getButtonKeystroke'](_0x4ac330);_0x4ac330['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x544b36['to'](()=>{this['_showNestedPanel'](_0x5bb51c,_0x4ac330);}),'mouseleave':_0x544b36['to'](_0x2f9487=>{const _0x2c3e5b=_0x2f9487['relatedTarget'];this['_isMovingToNestedMenu'](_0x2c3e5b,_0x5bb51c)||this['_hideNestedPanel'](_0x5bb51c);}),'keydown':_0x544b36['to'](_0xf4c777=>{_0xf4c777['key']==_0x282e68&&(this['_showNestedPanel'](_0x5bb51c,_0x4ac330),_0x5bb51c['content']['get'](0x0)['focus']());})}}),_0x5bb51c['on']('render',()=>{_0x5bb51c['element']?.['addEventListener']('mouseleave',_0x105da9=>{const _0x4383b1=_0x105da9['relatedTarget'];_0x4ac330['element']?.['contains'](_0x4383b1)||this['_isMovingToNestedMenu'](_0x4383b1,_0x5bb51c)||this['_hideNestedPanel'](_0x5bb51c);});});}['_showNestedPanel'](_0x21dfa2,_0x3aff47){this['_openNestedPanels']['forEach'](_0x2021a2=>{_0x2021a2!==_0x21dfa2&&_0x2021a2['isVisible']&&_0x2021a2['hide']();}),_0x21dfa2['show'](),_0x21dfa2['pin']({'positions':[Vt['eastSouth']],'target':_0x3aff47['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x21dfa2);}['_hideNestedPanel'](_0x270a27){_0x270a27['hide'](),this['_openNestedPanels']['delete'](_0x270a27);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x3c92c3=>_0x3c92c3['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x5c8484,_0x5addac){if(!_0x5c8484)return!0x1;if(_0x5addac['element']?.['contains'](_0x5c8484))return!0x0;const _0x5372e0=_0x5c8484;return _0x5372e0['closest']&&(null!==_0x5372e0['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x5372e0['closest']('.ck-ai-quick-actions-group-list')||null!==_0x5372e0['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'](_0x108057){return'rtl'===_0x108057['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x5b38d7){return'rtl'===_0x5b38d7['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x3e0938,_0x58ee51,_0x4cd8e3,_0x307c34){_0x3e0938['key']==_0x58ee51&&(_0x4cd8e3['focus'](),this['_hideNestedPanel'](_0x307c34));}['_handleSearchResultButtonClick'](_0x1aab99){_0x1aab99['fire']('execute');}};function Ca(_0x3ce4c8){const {editor:_0xcac7df,content:_0x218b3e,buttonDefinition:_0x248e9f,bodyCollection:_0x5d2b04,hasSearch:_0x152dae=!0x1,actionButtons:_0x1aa4fe}=_0x3ce4c8;return()=>{const _0x5bafb3=_0xcac7df['locale'],_0x2e93ef=_0xcac7df['commands']['get']('aiQuickAction'),_0x54c136=_0x353e74(_0x5bafb3);_0x54c136['bind']('isEnabled')['to'](_0x2e93ef),_0x54c136['buttonView']['set']({'icon':_0x248e9f['icon']??_0x2a6bd4,'label':_0x248e9f['label'],'tooltip':!0x0}),_0x54c136['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x1c40a3=new wa(_0xcac7df,_0x218b3e,_0x54c136,_0x5d2b04,_0x152dae,_0x1aa4fe);return _0x54c136['panelView']['children']['add'](_0x1c40a3),_0x152dae&&_0x54c136['on']('change:isOpen',(_0x29092,_0x561e70,_0x101ed3)=>{if(_0x101ed3){if(_0xcac7df['plugins']['has']('AIEditing')){const _0xe9bb60=_0xcac7df['plugins']['get'](As),_0x421274=_0xcac7df['model']['document']['selection'],_0x25bb53=Array['from'](_0x421274['getRanges']());_0x25bb53['length']>0x0&&_0xe9bb60['showFakeVisualSelection']({'editor':_0xcac7df,'ranges':_0x25bb53,'id':'quick-action','priority':0x14});}}else _0xcac7df['plugins']['has']('AIEditing')&&_0xcac7df['plugins']['get'](As)['hideFakeVisualSelection']('quick-action'),_0x1c40a3['resetSearch']();}),_0x54c136;};}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 _0x5bc74c{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[yt,cs,rn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiquickactions');const _0x37c79a=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x37c79a),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x4b4c05){return function(_0x22a2e6){const _0x1759c5=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x22a2e6['uiLanguage'])||'English';return[{'id':'ask-ai','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x3eaea4},{'id':'chat-commands','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x3eaea4,'actions':[{'id':'explain','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':ls(_0x22a2e6,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x1759c5),'type':'chat'},{'id':'summarize','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':ls(_0x22a2e6,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x1759c5),'type':'chat'},{'id':'highlight-key-points','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':ls(_0x22a2e6,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x1759c5),'type':'chat'}]},{'id':'improve-writing','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x234164},{'id':'continue','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x16808c},{'id':'fix-grammar','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x597aae},{'id':'adjust-length','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2279d3,'actions':[{'id':'make-shorter','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x4d510a,'actions':[{'id':'make-tone-casual','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x3de69e,'actions':[{'id':'translate-to-english','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':ls(_0x22a2e6,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x47ef5b,'actions':[]}];}(_0x4b4c05);}['_getDefaultAndCustomActions'](){const _0x55fc8c=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x419c1c=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x4846f8=>({..._0x4846f8,'type':'chat'===_0x4846f8['type']?'chat':'action','icon':void 0x0}));return _0x55fc8c['find'](_0xdf8e53=>'other'===_0xdf8e53['id'])['actions']['push'](..._0x419c1c),_0x55fc8c;}async['_initActionTypeQuickActions'](){try{const _0x5d549d=new Xs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x71a696=await _0x5d549d['getAll'](),_0x4ced27=(await _0x5d549d['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x4ced27),this['_enableButtonsByType']('action',_0x4cf7b8=>!!_0x71a696['find'](_0x5a86a5=>_0x5a86a5['id']===_0x4cf7b8['model'])||void 0x0===_0x4cf7b8['model']);}catch(_0x417ba0){const _0x495349=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x417ba0});this['_reporter']['logError'](_0x495349);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x1d19a1=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x1d19a1,'change:isConversationReady',(_0x2b3eba,_0x1c285b,_0x37ee9e)=>{_0x37ee9e&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x1d19a1['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3c2078,_0x19c904){this['_quickActionsDefinition']['forEach'](_0x18a3c6=>{'actions'in _0x18a3c6?_0x18a3c6['actions']['forEach'](_0x2312fe=>{_0x2312fe['type']===_0x3c2078&&(_0x2312fe['isEnabled']=_0x19c904(_0x2312fe));}):_0x18a3c6['type']===_0x3c2078&&(_0x18a3c6['isEnabled']=_0x19c904(_0x18a3c6));}),this['_actionButtons']['forEach'](_0x2d9f96=>{if(va(_0x2d9f96['action']))return;if(_0x2d9f96['action']['type']!==_0x3c2078)return;const _0x493f58=_0x19c904(_0x2d9f96['action']);if(_0x2d9f96['action']['isEnabled']=_0x493f58,_0x2d9f96['buttonView']['isEnabled']=_0x493f58,!_0x493f58&&_0x2d9f96['action']['model']){const _0x21c922=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x2d9f96['action']['id'],'modelId':_0x2d9f96['action']['model']});this['_reporter']['logError'](_0x21c922);}}),this['_actionButtons']['filter'](_0x25b6b8=>va(_0x25b6b8['action']))['forEach'](_0x2e1850=>{_0x2e1850['buttonView']['isEnabled']=_0x2e1850['action']['actions']['some'](_0x32bffd=>_0x32bffd['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x124d28,group:_0x1ea18})=>{_0x124d28['isEnabled']=_0x1ea18['actions']['some'](_0x4701c4=>_0x4701c4['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x32cb87){this['_actionButtons']['forEach'](_0x1cbe75=>{va(_0x1cbe75['action'])||'action'===_0x1cbe75['action']['type']&&(_0x1cbe75['action']['model']||(_0x1cbe75['action']['model']=_0x32cb87));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x176bf7=new xt(this['editor']['locale']);_0x176bf7['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x176bf7),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x176bf7);}['_initializeQuickActionsDropdown'](_0x70dbdb){const _0xdb0e8a=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x2a6bd4,'label':ls(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x70dbdb,'hasSearch':_0xdb0e8a,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x3648ee){this['_quickActionsDefinition']=_0x3648ee['map'](_0x3b8b16=>{if('actions'in _0x3b8b16){const _0x2f4389=_0x3b8b16;return{..._0x2f4389,'actions':_0x2f4389['actions']['map'](_0x299da8=>{const {actions:_0x3d400e,..._0x5eb2c9}=_0x2f4389;return{..._0x299da8,'isEnabled':!0x1,'parent':_0x5eb2c9};})['filter'](_0x2924a9=>this['_shouldIncludeAction'](_0x2924a9))};}return{..._0x3b8b16,'isEnabled':!0x1};})['filter'](_0x26f273=>'actions'in _0x26f273?_0x26f273['actions']['length']>0x0:this['_shouldIncludeAction'](_0x26f273));}['_shouldIncludeAction'](_0x11da02){const _0x109e15=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x11da02['type']])&&!_0x109e15['includes'](_0x11da02['id'])&&!('chat'===_0x11da02['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x3ca96b){this['_quickActionsDefinition']['forEach'](_0x34e2da=>{if('actions'in _0x34e2da){const _0x2802bf=Ca({'editor':this['editor'],'content':_0x34e2da['actions'],'buttonDefinition':_0x34e2da,'bodyCollection':_0x3ca96b,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x34e2da['id'],_0x2802bf),_0x34e2da['actions']['forEach'](_0x71315d=>{const _0x36eb8e=Ia({'editor':this['editor'],'action':_0x71315d,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x71315d['id'],_0x36eb8e);});}else{const _0x4aea55=Ia({'editor':this['editor'],'action':_0x34e2da,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x34e2da['id'],_0x4aea55);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x4b4a7d=>{const _0x1ca1ad=this['editor']['commands']['get']('aiQuickAction'),_0x12a62d=new te(_0x4b4a7d),_0x44e89b=ls(_0x4b4a7d,'AI_QUICK_ACTIONS_HEADING');_0x12a62d['buttonView']['set']({'label':_0x44e89b,'icon':_0x2a6bd4});const _0xf768bc=new Zt(_0x4b4a7d);return _0xf768bc['set']({'ariaLabel':_0x44e89b,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x49305f=>{if('actions'in _0x49305f){const _0x26b452=_0x49305f,_0xdfb349=new Jt(_0x4b4a7d,_0x12a62d),_0x55723f=new te(_0x4b4a7d),_0x25f563=new Zt(_0x4b4a7d);_0x55723f['buttonView']['set']({'label':_0x26b452['label'],'icon':_0x26b452['icon']}),_0x26b452['actions']['forEach'](_0x137459=>{const _0x2b1d2b=new Jt(_0x4b4a7d,_0x55723f),_0x3f88d5=new jt(_0x4b4a7d);_0x3f88d5['set']({'label':_0x137459['label'],'icon':_0x137459['icon'],'role':'menuitem','isEnabled':_0x137459['isEnabled']}),_0x3f88d5['on']('execute',()=>{this['_executeQuickAction'](_0x137459);}),this['_actionButtons']['push']({'buttonView':_0x3f88d5,'action':_0x137459}),_0x3f88d5['delegate']('execute')['to'](_0x55723f),_0x2b1d2b['children']['add'](_0x3f88d5),_0x25f563['items']['add'](_0x2b1d2b);}),_0x55723f['isEnabled']=_0x26b452['actions']['some'](_0x466f94=>_0x466f94['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x55723f,'group':_0x26b452}),_0x55723f['panelView']['children']['add'](_0x25f563),_0xdfb349['children']['add'](_0x55723f),_0xf768bc['items']['add'](_0xdfb349);}else{const _0x16bd72=_0x49305f,_0x535faf=new Jt(_0x4b4a7d,_0x12a62d),_0x113a28=new jt(_0x4b4a7d);_0x113a28['set']({'label':_0x16bd72['label'],'icon':_0x16bd72['icon'],'role':'menuitem','isEnabled':_0x16bd72['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x113a28,'action':_0x16bd72}),_0x113a28['on']('execute',()=>{this['_executeQuickAction'](_0x16bd72);}),_0x113a28['delegate']('execute')['to'](_0x12a62d),_0x535faf['children']['add'](_0x113a28),_0xf768bc['items']['add'](_0x535faf);}}),Object['values'](Ra)['some'](_0x3b214d=>this['editor']['plugins']['has'](_0x3b214d))?_0x12a62d['bind']('isEnabled')['to'](_0x1ca1ad):_0x12a62d['set']({'isEnabled':!0x1}),_0x12a62d['panelView']['children']['add'](_0xf768bc),_0x12a62d;});}['_executeQuickAction'](_0x312859){const _0x5a0a46=this['editor'];_0x5a0a46['editing']['view']['focus'](),_0x5a0a46['commands']['execute']('aiQuickAction',_0x312859);const _0x1e36eb=_0x5a0a46['ui']['view']['menuBarView'];_0x1e36eb&&_0x1e36eb['close']&&_0x1e36eb['close']();}};function va(_0x4f18b2){return'actions'in _0x4f18b2;}function ka(_0x4e57ea,_0x1259e1){const _0xdea668=_0x4e57ea['plugins']['get']('AITabs')['view'];_0xdea668['isVisible']=!0x0,_0xdea668['activateTab'](_0x1259e1);}var Na=class extends _0x2f2e2c{['execute'](_0xc01ba7){switch(this['_expandSelectionIfCollapsed'](),_0xc01ba7['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x2416a1=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2416a1});}this['_handleAIChatAction'](_0xc01ba7);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x4ebf9b=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x4ebf9b});}this['_handleAIActionsAction'](_0xc01ba7);}}async['_handleAIChatAction'](_0x333796){const _0xb56bc0=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x333796['id'])_0xb56bc0['removeSelectionFromChatContext'](),_0xb56bc0['addSelectionToChatContext'](this['editor']),_0xb56bc0['focusPromptInput']();else await _0xb56bc0['startConversation']({'modelId':_0x333796['model']}),_0xb56bc0['removeSelectionFromChatContext'](),_0xb56bc0['addSelectionToChatContext'](this['editor']),_0xb56bc0['focusPromptInput'](),await _0xb56bc0['sendMessage']({'message':_0x333796['prompt']||_0x333796['displayedPrompt']||_0x333796['label'],'attributes':{'quickActionData':{'id':_0x333796['id']},'displayedPrompt':_0x333796['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x40be8c=this['editor'],_0xd8c543=_0x40be8c['model']['document']['selection'];if(!_0xd8c543['isCollapsed'])return;const _0x5707e7=pt(_0xd8c543['getSelectedBlocks']())||_0x40be8c['model']['schema']['getLimitElement'](_0xd8c543);_0x40be8c['model']['change'](_0x148659=>{_0x148659['setSelection'](_0x5707e7,'in');});}['_handleAIActionsActionLabel'](_0x1299e9){return _0x1299e9['parent']?.['label']&&'other'!==_0x1299e9['parent']?.['id']?_0x1299e9['parent']['label']+':\x20'+_0x1299e9['label']:_0x1299e9['label'];}async['_handleAIActionsAction'](_0x5d22e8){const _0x371b28=this['editor']['plugins']['get']('AIActions'),_0x5c8e84=_0x5d22e8['prompt']?{'userMessage':_0x5d22e8['prompt'],'model':_0x5d22e8['model']}:{'actionName':_0x5d22e8['actionName']||_0x5d22e8['id'],'args':_0x5d22e8['args']},_0x3b0686=this['_handleAIActionsActionLabel'](_0x5d22e8);await _0x371b28['executeAction'](_0x5c8e84,_0x3b0686,_0x5d22e8['icon']);}},ya=class extends _0x5bc74c{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4b2be0=this['editor'],_0x7fa463=new Na(this['editor']);if(_0x4b2be0['commands']['add']('aiQuickAction',_0x7fa463),_0x4b2be0['plugins']['has']('AIChat')){const _0x1bcb8c=this['editor']['plugins']['get']('AIChatController');_0x4b2be0['model']['document']['selection']['on']('change:range',(_0x251ac7,_0x505063)=>{_0x505063['directChange']&&_0x1bcb8c['removeSelectionFromChatContext']();});}}},xa=class extends _n{['appendContent'](_0x2dc27b,_0x2045b2='text'){'modification'===this['type']&&'text'===_0x2045b2&&(_0x2045b2=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x2dc27b,_0x2045b2);}['updateChangeGroups'](_0x1d5e17){const _0x3c4938=this['parsedContent']['get'](_0x1d5e17)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1d5e17,_0x3c4938),this['changeGroups']=[],0x0==_0x3c4938['childNodes']['length'])return;Ps(this['documentContextContent']['get'](_0x1d5e17),this['parsedMergedContent']['get'](_0x1d5e17));const _0xa4276a=_0x52bd71(this['documentContextContent']['get'](_0x1d5e17)['children']['map'](_0x130db3=>({'node':_0x130db3,'id':Cs(_0x130db3,'data-id')})),_0x3c4938['children']['map'](_0x4eff0a=>({'node':_0x4eff0a,'id':Cs(_0x4eff0a,'data-id')||Ot()})),{'comparator':(_0xaa58db,_0x456c72)=>_0xaa58db['id']==_0x456c72['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0xa4276a['length']&&_0xa4276a[_0xa4276a['length']-0x1]['removed'];)_0xa4276a['pop']();}const _0x31440d=_0xa4276a['map'](_0x44c95b=>{const _0x29bd55=_0x44c95b['added']?'new':_0x44c95b['removed']?'removed':'modified';return{'node':_0x44c95b['value'][0x0]['node'],'type':_0x29bd55,'id':_0x44c95b['value'][0x0]['id']};}),_0x5ef345=this['_documentIdToSource']['get'](_0x1d5e17);this['changeGroups']['push']({'changes':_0x31440d,'state':'pending','index':this['changeGroups']['length'],'editor':_0x5ef345['editor'],'rootName':_0x5ef345['rootName'],'documentId':_0x1d5e17});}['_getDifferentChangeGroups'](_0x38f77e,_0x5e8f83){return _0x5e8f83;}},La=class extends In{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x5bcb62){super(_0x5bcb62),this['content']=_0x5bcb62['content'],this['version']=_0x5bcb62['version'],this['editor']=_0x5bcb62['editor'],this['rootName']=_0x5bcb62['rootName'],this['actionName']=_0x5bcb62['actionName'],this['args']=_0x5bcb62['args'],this['userMessage']=_0x5bcb62['userMessage'],this['model']=_0x5bcb62['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':Ot(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x584eef){const _0x37efae=this['editor']['config']['get']('collaboration.channelId'),_0x2e1fdb=new xa({..._0x584eef,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x37efae,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x37efae,this['editor']]])});return this['replies']['push'](_0x2e1fdb),_0x2e1fdb['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x2e1fdb),_0x2e1fdb;}},Da=class extends _0x4b90d1{constructor(_0x3d307d,_0x5ed798=!0x0,_0x5517e4=!0x0){super(_0x3d307d),this['set']('isEnabled',!0x1),_0x5ed798&&(this['applyButton']=this['_createButton'](ls(_0x3d307d,'AI_BALLOON_APPLY_BUTTON'),an),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x5517e4&&(this['suggestButton']=this['_createButton'](ls(_0x3d307d,'AI_BALLOON_SUGGEST_BUTTON'),_0x5ed798?hn:an),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x5ed798,'showSuggestButton':_0x5517e4}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x30918d,showSuggestButton:_0x49b5cd}){this['applyButton']&&(this['applyButton']['isVisible']=_0x30918d),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x49b5cd);}['_createButton'](_0x3ef634,_0x37ad16){const _0x37b169=new Pt(this['locale']);return _0x37b169['set']({'label':_0x3ef634,'class':_0x37ad16,'isVisible':!0x0,'withText':!0x0}),_0x37b169;}},Pa=class extends _0x4708a3{constructor(_0x3c22ad){super(_0x3c22ad),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':ls(_0x3c22ad,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x4708a3{constructor(_0x2b051e){super(_0x2b051e),this['set']('isVisible',!0x0);const _0x6c5f5a=new cr('small');_0x6c5f5a['isVisible']=!0x0;const _0x4d4d56=new _0x4708a3(this['locale']);_0x4d4d56['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[ls(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4e4804=>!_0x4e4804)]},'children':[_0x6c5f5a,_0x4d4d56]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x32401a,_0x437291){super(_0x32401a),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x437291,this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x4f88bc(),this['_addContentWrapper'](_0x437291),this['_addDisclaimerView'](),this['_addToolbar'](_0x437291),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'](_0x437291);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x22b8dc of this['_focusables'])this['_focusTracker']['add'](_0x22b8dc['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x4bc365){-0x1===_0x4bc365?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x4c01de){this['_isLoading']=_0x4c01de;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x29e086){super['showError'](_0x29e086),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x78c3b6){super['showBlockingError'](_0x78c3b6),this['setErrorState']();}['addMiniToolbarItem'](_0x423f0a){this['_miniToolbarView']['items']['has'](_0x423f0a)||this['_miniToolbarView']['items']['add'](_0x423f0a);}['removeMiniToolbarItem'](_0x420253){this['_miniToolbarView']['items']['has'](_0x420253)&&this['_miniToolbarView']['items']['remove'](_0x420253);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x44c2b4,showSuggestButton:_0x28736f}){_0x44c2b4=_0x44c2b4&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x28736f=_0x28736f&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x44c2b4,'showSuggestButton':_0x28736f});}async['updateContent'](_0x4812da){await this['_streamableContentView']['update'](_0x4812da);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x3e352e){this['_contentWrapper']=new _0x4708a3(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x3e352e['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x2de1a8,showSuggestButton:_0x103bc3}){this['_toolbarView']=new Da(this['locale'],_0x2de1a8,_0x103bc3),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',(_0x56c79d,_0x57d2db,_0x1d56ce)=>!(_0x56c79d||_0x57d2db||_0x1d56ce)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x2de1a8,'showSuggestButton':_0x103bc3}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x51c1f7){return this['_miniToolbarView']=new ua(this['locale'],_0x51c1f7),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',(_0xf339b3,_0x35633e)=>!(_0xf339b3||_0x35633e)),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 _0xfdd0=new Pt(this['locale']),_0x2879aa=new Pt(this['locale']),_0x550947=new Va(this['locale']),_0x4134e2=new Pt(this['locale']);_0xfdd0['set']({'icon':_0x3affd5,'label':ls(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+cn}),_0x2879aa['set']({'icon':_0x2db01d,'tooltip':ls(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+cn}),_0x4134e2['set']({'icon':_0xa46100,'tooltip':ls(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+cn}),_0xfdd0['bind']('isEnabled')['to'](this,'isBusy',_0x3f13cc=>!_0x3f13cc),_0xfdd0['on']('execute',()=>{this['fire']('tryAgain');}),_0x2879aa['bind']('isEnabled')['to'](this,'isBusy',_0x2f2788=>!_0x2f2788),_0x2879aa['on']('execute',()=>{this['fire']('showPrevious');}),_0x4134e2['bind']('isEnabled')['to'](this,'isBusy',_0x5c3cdc=>!_0x5c3cdc),_0x4134e2['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x2879aa,this['_navigationCounter']=_0x550947,this['_navigationNextButton']=_0x4134e2,this['_navigationTryAgainButton']=_0xfdd0;}['updateMiniToolbarButtons'](_0x1d73c0,_0xfcb26){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x45b5a7=_0x1d73c0>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x45b5a7){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0xffc751=_0x1d73c0-_0xfcb26;this['_navigationCounter']['setInteractionCount'](_0xffc751+'/'+_0x1d73c0),this['_navigationPreviousButton']['isEnabled']=_0xfcb26<_0x1d73c0-0x1,this['_navigationNextButton']['isEnabled']=_0xfcb26>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'](_0x34a358){this['_isLoading']=_0x34a358;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x3e641c=this['_streamableContentView']['element'],_0xc59354=this['_miniToolbarView']['element'],_0x30b536=()=>{Et['window']['requestAnimationFrame'](()=>{const _0x43de64=_0x3e641c['offsetWidth']-_0x3e641c['clientWidth'];_0xc59354['style']['right']='calc('+_0x43de64+'px\x20+\x20var(--ck-spacing-large))';});};_0x30b536(),this['_miniToolbarResizeObserver']=new At(_0x3e641c,()=>{_0x30b536();});}['_initializeScrollManager'](){const _0x5c0345=this['_getScrollableElement']();_0x5c0345&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x5c0345));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x4708a3{constructor(_0x363735){super(_0x363735);const _0x1ab52b=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x1ab52b['to']('interactionCount')}]});}['setInteractionCount'](_0x120b78){this['set']('interactionCount',_0x120b78);}},Ua=class extends _0x5bc74c{static get['requires'](){return[cs,rn,Ht,As,la,_0x3ea65d];}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(_0x3d683e){super(_0x3d683e),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x2d207e,_0x2b3062,_0x267cf9){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x4847a5,anchorData:_0x16402a,root:_0x765d01}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x2d207e,_0x4847a5,_0x16402a,_0x765d01,_0x2b3062,_0x267cf9);}const {modelFragment:_0x2ff8cd,anchorData:_0x48361b,root:_0x577e19}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x2d207e,_0x2ff8cd,_0x48361b,_0x577e19,_0x2b3062,_0x267cf9);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x643bd8=this['editor']['plugins']['has']('TrackChanges');let _0x2d4621=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x643bd8||(_0x2d4621=_0x2d4621['filter'](_0x38270c=>'insertSuggestion'!=_0x38270c));const _0x19d477=this['editor']['commands']['get']('trackChanges'),_0x5bb5f9=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x643bd8,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x2d4621});return _0x5bb5f9['bind']('isBusy')['to'](this),_0x19d477&&_0x5bb5f9['bind']('isTrackChangesOn')['to'](_0x19d477,'value'),_0x5bb5f9['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x5bb5f9['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x5bb5f9['on']('showNext',()=>{this['_navigateToNext']();}),_0x5bb5f9;}['_normalizeSelectionStart'](){const _0x30533f=this['editor']['model'],_0x55ee42=_0x30533f['document']['selection'],_0x28e087=_0x55ee42['getFirstRange']();if(!_0x28e087||_0x28e087['isCollapsed'])return;const _0x5f0703=pt(_0x55ee42['getSelectedBlocks']());if(!_0x5f0703)return;const _0x29bd12=_0x30533f['createPositionAt'](_0x5f0703,0x0);_0x29bd12['isAfter'](_0x28e087['start'])&&_0x30533f['change'](_0x44cfc3=>{_0x44cfc3['setSelection'](_0x44cfc3['createRange'](_0x29bd12,_0x28e087['end']));});}['_getExecuteDataRegular'](){const _0x56e019=this['editor']['model']['document']['selection'],_0x5a40f6=_0x56e019['getFirstRange']()['start']['root'];if(_0x56e019['isCollapsed']){const _0x12c566=pt(_0x56e019['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x56e019);this['editor']['model']['change'](_0xb1069d=>{_0xb1069d['setSelection'](_0x12c566,'in');});}this['_normalizeSelectionStart']();const _0x408ce9=_0x56e019['getFirstRange'](),_0x3d7852=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x56e019),_0x408ce9['start'],_0x408ce9['end']);this['_copyMarkersToFragment'](_0x3d7852,_0x56e019,{'isTableSelection':!0x1});const _0x127d15=_0x56e019['getFirstRange']()['start'],_0x2cb51b=new Map();let _0x211cba=_0x3d7852;for(let _0x541f14=0x0;_0x541f14<_0x127d15['path']['length'];_0x541f14++)_0x2cb51b['set'](_0x211cba,_0x127d15['path'][_0x541f14]),_0x211cba=_0x211cba['getChild'](0x0);return{'modelFragment':_0x3d7852,'anchorData':_0x2cb51b,'root':_0x5a40f6};}['_getExecuteDataInTable'](){const _0x357382=this['editor']['model']['document']['selection'],_0x215852=this['editor']['plugins']['get']('TableSelection'),_0x55951e=_0x357382['getFirstRange']()['start']['root'],_0x2ee045=_0x215852['getSelectionAsFragment'](),_0x510c69=_0x357382['getFirstRange']()['start']['parent']['parent'],_0x3f6ab2=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x510c69),this['editor']['model']['createPositionAfter'](_0x510c69)),_0x14b8b6=this['_wrapWithCommonAncestors'](_0x2ee045,_0x3f6ab2['start'],_0x3f6ab2['end']);this['_copyMarkersToFragment'](_0x14b8b6,_0x357382,{'isTableSelection':!0x0});const _0x538eae=_0x357382['getFirstRange']()['start'],_0x179d08=new Map();let _0x477cd8=_0x14b8b6;for(let _0x2c2edd=0x0;_0x2c2edd<_0x538eae['path']['length'];_0x2c2edd++)if(_0x179d08['set'](_0x477cd8,_0x538eae['path'][_0x2c2edd]),_0x2c2edd<_0x538eae['path']['length']-0x1)_0x477cd8=_0x477cd8['getChild'](0x0);else{let _0x504a90=_0x477cd8['nextSibling'];for(;_0x504a90;)_0x179d08['set'](_0x504a90,_0x538eae['path'][_0x2c2edd]),_0x504a90=_0x504a90['nextSibling'];}return{'modelFragment':_0x14b8b6,'anchorData':_0x179d08,'root':_0x55951e};}async['_executeAction'](_0x1b2a07,_0x4dd799,_0x2c5af8,_0x452123,_0x71815e,_0x507e03){const _0x3ea095=this['editor']['plugins']['get'](As),_0x242fed=this['editor']['plugins']['get'](la),_0x6b6da0=this['editor']['model']['document']['selection'],_0xfc3ed7=await _0x3ea095['modelToDataWithIds'](_0x4dd799,this['editor']),_0x296e36=this['editor']['model']['document']['version'],_0x91e626=[..._0x6b6da0['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x242fed['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x71815e,'icon':_0x507e03||_0x2a6bd4,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x91e626,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x242fed),this['_interactionParams']={'action':_0x1b2a07,'content':_0xfc3ed7,'version':_0x296e36,'aiBalloon':_0x242fed,'modelFragment':_0x4dd799,'anchorData':_0x2c5af8,'root':_0x452123},this['_setupApplyListeners'](),this['listenTo'](_0x242fed,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x242fed,'dialogClosed',(_0x4c3b99,{id:_0x6c8299})=>{if('aiActionsBalloon'===_0x6c8299){for(const _0xc03f2 of this['_interactions']){if(0x0===_0xc03f2['replies']['length']||_0xc03f2['stoppedExplicitly'])continue;const _0x482e57=_0xc03f2['replies'][_0xc03f2['replies']['length']-0x1],_0x4f671f=_0x482e57['changeGroups'][0x0];_0x4f671f&&'pending'===_0x4f671f['state']&&_0x482e57['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x242fed);}}),this['_createInteraction'](_0xfc3ed7,_0x296e36,_0x242fed,_0x1b2a07);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x455c2e,anchorData:_0x332a76,root:_0x56a4e8}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x455c2e,_0x332a76,_0x56a4e8,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x455c2e,_0x332a76,_0x56a4e8,!0x0);});}['_wrapWithCommonAncestors'](_0x3e2d8d,_0x422de8,_0x8939a7){const _0xe85a2d=this['editor']['model']['createRange'](_0x422de8,_0x8939a7)['getCommonAncestor'](),_0x43f80c=_0xe85a2d['is']('documentFragment')?[]:_0xe85a2d['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x43f80c['length']){const _0x50697f=_0x43f80c['map'](_0x3bef9c=>_0x3bef9c['_clone'](!0x1));for(let _0x11770e=0x1;_0x11770e<_0x50697f['length'];_0x11770e++)_0x50697f[_0x11770e-0x1]['_appendChild'](_0x50697f[_0x11770e]);return _0x50697f[_0x50697f['length']-0x1]['_appendChild'](_0x3e2d8d),new _0xc7ecd7(_0x50697f[0x0]);}return _0x3e2d8d;}['_copyMarkersToFragment'](_0x161d4d,_0x558c5b,_0x12e4a6={'isTableSelection':!0x1}){const _0x18371d=this['editor']['model'],_0x5632ac=Array['from'](_0x558c5b['getRanges']()),_0x541412=_0x558c5b['getFirstRange']()['start'];for(const _0x49aa9e of _0x18371d['markers']){if(_0x49aa9e['name']['startsWith']('ai-selection')||!_0x49aa9e['affectsData'])continue;const _0x3fa740=_0x49aa9e['getRange']();if(!_0x5632ac['some'](_0x5bce6a=>_0x5bce6a['containsRange'](_0x3fa740,!0x0)))continue;const _0x477ffd=this['_regularCalculateMarkerPath'](_0x3fa740['start'],_0x541412,_0x12e4a6['isTableSelection']),_0x2b145f=this['_regularCalculateMarkerPath'](_0x3fa740['end'],_0x541412,_0x12e4a6['isTableSelection']),_0x4ceb1a=_0x18371d['createPositionFromPath'](_0x161d4d,_0x477ffd),_0x386c9f=_0x18371d['createPositionFromPath'](_0x161d4d,_0x2b145f);if(!_0x4ceb1a['isEqual'](_0x386c9f)){const _0x591302=_0x18371d['createRange'](_0x4ceb1a,_0x386c9f);_0x161d4d['markers']['set'](_0x49aa9e['name'],_0x591302);}}}['_regularCalculateMarkerPath'](_0xe95488,_0x516f5b,_0x3e01f2=!0x1){const _0x16e88a=[..._0xe95488['path']['slice']()];for(let _0x1f92cd=0x0;_0x1f92cd<Math['max'](_0x516f5b['path']['length'],_0xe95488['path']['length']);_0x1f92cd++){const _0x4cd353=_0x516f5b['path'][_0x1f92cd]||0x0,_0x1acca3=(_0xe95488['path'][_0x1f92cd]||0x0)-_0x4cd353;if(_0x16e88a[_0x1f92cd]=_0x1acca3,0x0!==_0x1acca3&&!_0x3e01f2)break;}return _0x16e88a;}async['_createInteraction'](_0x1b9aa6,_0x57fe90,_0x2c8e84,_0x432800){const _0x116a1f=this['editor'],_0x2715bb=_0x116a1f['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x432800,'content':_0x1b9aa6,'version':_0x57fe90,'aiBalloon':_0x2c8e84,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x2715bb});const _0x585197=new La({'connector':this['_aiConnector'],'locale':_0x116a1f['locale'],'content':_0x1b9aa6,'version':_0x57fe90,'editor':_0x116a1f,'rootName':_0x2715bb['rootName'],..._0x432800});this['_interactions']['push'](_0x585197);const _0x11c831=(_0x5be86b,_0x328d6a=!0x1,_0x2c1a34='streaming')=>{const {isDone:_0x39b28c}=_0x5be86b;return this['_promiseQueue']['enqueue'](async _0x512c53=>{try{const _0x1e5ac3=Us({'changeGroups':_0x5be86b['changeGroups'],'documentContextContent':_0x5be86b['documentContextContent'],'showDiff':_0x328d6a,'trimUnchanged':!0x1});_0x1e5ac3['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x1e5ac3[0x0],'renderingStrategy':_0x2c1a34,'abortSignal':_0x512c53}),_0x39b28c&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x587b47){if(sn(_0x587b47))return;throw _0x587b47;}});};_0x585197['on']('replyCreated',(_0x4a633a,_0x35f986)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x11c831(_0x35f986)['catch'](_0x287f8c=>{this['_reporter']['logError'](_0x287f8c,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x585197,_0x287f8c);});}),_0x585197['on']('replyContentUpdated',(_0x5459b8,_0x46f749)=>{_0x11c831(_0x46f749)['catch'](_0x54466f=>{this['_reporter']['logError'](_0x54466f,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x585197,_0x54466f);});}),_0x585197['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x4d24e0){this['_reporter']['logError'](_0x4d24e0,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x585197,_0x4d24e0);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x5042b2,{showDiff:_0x4d1ade})=>{try{this['_balloonShowDiff']=_0x4d1ade;const _0x10d545=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x10d545&&await _0x11c831(_0x10d545,_0x4d1ade,'static');}catch(_0x530e7f){this['_reporter']['logError'](_0x530e7f,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x585197,_0x530e7f);}}),_0x585197['on']('replyChangeGroupStateUpdated',()=>{const _0x45579b={'positiveCount':_0x585197['replies']['reduce']((_0x3689e8,_0x5eefd5)=>_0x3689e8+_0x5eefd5['changeGroups']['filter'](_0x25b1d3=>'accepted'===_0x25b1d3['state'])['length'],0x0),'totalCount':_0x585197['replies']['reduce']((_0x28a613,_0x7a1472)=>_0x28a613+_0x7a1472['changeGroups']['length'],0x0)},_0x529f04=_0x585197['actionCallId'],_0x28cae5=_0x585197['actionName'];_0x28cae5?this['_aiConnector']['upsertAIActionRating'](_0x28cae5,_0x529f04,_0x45579b):this['_aiConnector']['upsertCustomAIActionRating'](_0x529f04,_0x45579b);}),this['_setLoadingState']();try{const _0x335af0=await _0x585197['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x335af0;}catch(_0x503256){sn(_0x503256)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x503256,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x585197,_0x503256);}}['_applyChanges'](_0x2287c2,_0x4f455d,_0x488acc,_0x396c38){const _0xbc66e0=this['editor'];if(_0x396c38&&!_0xbc66e0['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x7d1dc5=this['editor']['plugins']['get'](_0x3ea65d),_0x564857=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x564857||!_0x564857['replies']['length'])return;const _0x5de3cb=_0x564857['replies'][_0x564857['replies']['length']-0x1];_0x5de3cb['setChangeGroupState'](0x0,'accepted');const _0x5dd7c9=ks({'documentSuggestions':On({'groups':[_0x5de3cb['changeGroups'][0x0]],'documentContextContent':_0x5de3cb['documentContextContent'],'documents':_0x564857['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x7d1dc5,'documentCompareOptions':{'anchor':_0xbc66e0['model']['createPositionAt'](_0x2287c2,0x0),'markDeletions':_0x396c38}})['values']()['next']()['value']??[],_0x325a28=this['_filterOperationsOutsideRange'](_0x5dd7c9,_0x4f455d);for(const _0x131481 of _0x325a28)this['_anchorOperation'](_0x4f455d,_0x131481,_0x488acc);const _0x58afe2=_0x564857['getDocumentContext']()['documents'][0x0]['version'],_0x1f00ed=_0x1790d4(_0x325a28,_0xbc66e0['model']['document']['history']['getOperations'](_0x58afe2),{'document':_0xbc66e0['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];js(_0x1f00ed,'quickActions');try{_0xbc66e0['model']['change'](_0x43367b=>{if(_0x43367b['setSelection'](_0xbc66e0['model']['document']['selection']['focus']),_0x396c38)_0xbc66e0['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1f00ed);else{for(const _0xc33d19 of _0x1f00ed)_0xc33d19['baseVersion']=_0xbc66e0['model']['document']['version'],Ns(_0xbc66e0,_0xc33d19),_0x43367b['batch']['addOperation'](_0xc33d19),_0xbc66e0['model']['applyOperation'](_0xc33d19);}});}catch(_0x4b82ff){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x4b82ff})),_0x4b82ff;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x5d1f9f,_0xeadbe4){return _0x5d1f9f['filter'](_0x532fc2=>{if('rename'==_0x532fc2['type']){const _0x2deba0=_0x532fc2['position']['nodeAfter'];return!_0xeadbe4['has'](_0x2deba0);}if(_0x532fc2['type']['indexOf']('Attribute')>-0x1){const _0x1ba89d=_0x532fc2['range']['start']['nodeAfter'];return!_0xeadbe4['has'](_0x1ba89d);}return!0x0;});}['_anchorOperation'](_0x415c39,_0xafc38d,_0x2ecf43){const _0x4bc19c=_0xafc38d['clone']();for(const _0x56a2bb in _0xafc38d){const _0x33b8db=_0xafc38d[_0x56a2bb];_0x33b8db instanceof _0x5cca78?_0xafc38d[_0x56a2bb]=new _0x5cca78(_0x1d612e(_0x33b8db['start']),_0x1d612e(_0x33b8db['end'])):_0x33b8db instanceof _0x4c52aa&&(_0xafc38d[_0x56a2bb]=_0x1d612e(_0x33b8db));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x4bc19c['type'])){if(_0x4bc19c['isDocumentOperation']=!0x1,_0x4bc19c['baseVersion']=null,'remove'==_0x4bc19c['type']){const _0x20f44f=_0x4bc19c['sourcePosition'],_0x4a5b81=_0x4bc19c['howMany'];new _0x1bbc64(_0x20f44f,_0x4a5b81)['_execute']();}else _0x4bc19c['_execute']();}function _0x1d612e(_0x330cde){if('$graveyard'==_0x330cde['root']['rootName'])return _0x330cde;const _0xbdb2c6=[];let _0x3eef45=_0x330cde['root'];for(let _0x245340=0x0;_0x245340<_0x330cde['path']['length'];_0x245340++){const _0x1d88ae=_0x415c39['get'](_0x3eef45)||0x0;_0xbdb2c6[_0x245340]=_0x330cde['path'][_0x245340]+_0x1d88ae,_0x3eef45=_0x3eef45['getChildAtOffset'](_0x330cde['path'][_0x245340]);}return new _0x4c52aa(_0x2ecf43,_0xbdb2c6,_0x330cde['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x26cdb1,content:_0x34f810,version:_0x1d85ec,aiBalloon:_0x536abc}=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'](_0x34f810,_0x1d85ec,_0x536abc,_0x26cdb1)['catch'](_0x56928b=>{this['_reporter']['logError'](_0x56928b,{'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 _0x2a4420=this['_interactions']['length'];this['_currentInteractionIndex']<_0x2a4420-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x21e15a){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x21e15a;const _0x306241=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x306241)return;if(_0x306241['hasError'])return this['_setErrorState'](_0x306241),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x306241['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x51ea9e=_0x306241['replies'][_0x306241['replies']['length']-0x1];if(_0x51ea9e)try{const _0x518d96=Us({'changeGroups':_0x51ea9e['changeGroups'],'documentContextContent':_0x51ea9e['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x3fb1b3=>setTimeout(_0x3fb1b3,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x518d96[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x44701b){this['_reporter']['logError'](_0x44701b,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x52cc6f,_0x40d2f0){if(void 0x0!==_0x40d2f0&&sn(_0x40d2f0))return;const _0x39de00=ls(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x39de00),_0x52cc6f['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 _0x5bc74c{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x170fc6){super(_0x170fc6),_0x170fc6['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x4708a3{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x2eb848,_0x3bec9e){super(_0x2eb848),this['id']=_0x3bec9e,this['set']('status','pending'),this['set']('changeId',_0x3bec9e),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',(_0x201e51,_0x5b0e6d)=>{_0x5b0e6d&&_0x5b0e6d['target']&&'A'===_0x5b0e6d['target']['tagName']&&_0x5b0e6d['preventDefault'](),this['fire']('activateChange',{'id':_0x3bec9e,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x3bec9e,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x3bec9e,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x3b54b0=new _0x4708a3(this['locale']);return _0x3b54b0['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',_0x10c12a=>!_0x10c12a)]}}),_0x3b54b0;}['_createAcceptButtonView'](){const _0x267c92=new Pt(this['locale']);return _0x267c92['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x267c92['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x40bc97=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x40bc97['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x116b64=>'pending'!==_0x116b64&&'accepted'!==_0x116b64),this['bindTemplate']['if']('status',hn,_0x5b0594=>'pending'===_0x5b0594),this['bindTemplate']['if']('status',cn,_0x343087=>'pending'!==_0x343087),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3201b5=>'accepted'===_0x3201b5)]}}),this['on']('change:status',(_0x47d4e8,_0x31368d,_0x59750c)=>{_0x267c92['isEnabled']='pending'===_0x59750c,'accepted'===_0x59750c&&(_0x267c92['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x267c92['icon']=_0x1fb55b);}),_0x267c92;}['_createDismissButtonView'](){const _0x6d63cc=new Pt(this['locale']);return _0x6d63cc['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x6d63cc['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x51e47d=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x51e47d['stopPropagation']();})},'attributes':{'class':[cn,this['bindTemplate']['if']('status','ck-hidden',_0x50b04a=>'pending'!==_0x50b04a&&'rejected'!==_0x50b04a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x5d7bdf=>'pending'===_0x5d7bdf),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xfc1a2f=>'rejected'===_0xfc1a2f)]}}),this['on']('change:status',(_0x114ddf,_0x3f5d8a,_0x134861)=>{_0x6d63cc['isEnabled']='pending'===_0x134861,'rejected'===_0x134861&&(_0x6d63cc['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x6d63cc['icon']=_0x544e33);}),_0x6d63cc;}['_createInfoButtonView'](){const _0x30abb3=new Pt(this['locale']);return _0x30abb3['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x181c93,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':cn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x30abb3['bind']('isOn')['to'](this,'isInfoToggleOn',_0x3da429=>_0x3da429),_0x30abb3['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x30abb3;}['_createOutdatedButtonView'](){const _0x486eb6=new Pt(this['locale']);return _0x486eb6['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x37848a,'withText':!0x0,'isEnabled':!0x1}),_0x486eb6['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x4827d5=>'outdated'!==_0x4827d5)],'disabled':'disabled'}}),_0x486eb6;}},Fa=class extends Nt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x77152b,_0x43fe71){super(_0x77152b),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']()),_0x43fe71['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x44246e){this['resultItemView']['changeId']=_0x44246e['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x44246e['contentDiffed'];}['showBalloon'](_0x550c13,_0x2a2d09,_0xd5bf0c,_0x2b182f,_0x29f344,_0x4106af){const _0x2d1c4a=_0x2a2d09();if(!_0x2d1c4a)return;this['updateContent'](_0x550c13),this['show']();const _0x134d30=Array['from'](_0x2d1c4a['getClientRects']())['reverse'](),_0x3ecc30=this['_getPointedRectIndexFromEvent'](_0xd5bf0c,_0x134d30),_0x3784f4=_0x134d30[_0x3ecc30??0x0];'click'===_0x2b182f?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x2a2d09(),_0x3ecc30,_0x550c13['id'],_0x29f344,_0x4106af)||_0x3784f4})):'hover'===_0x2b182f&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x2a2d09(),_0x3ecc30,_0x550c13['id'])||_0x3784f4}));}['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'](){_0xfcbf0e({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x54faba=[this['element']];return this['_pinnedTargetElement']&&_0x54faba['push'](this['_pinnedTargetElement']),_0x54faba;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x39d131=new _0x4708a3();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x39d131['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']]}]}),_0x39d131;}['_getBestRectPositionOnClick'](_0x4588f4,_0xdbab87,_0x14039b,_0x18bf2e,_0x4171f0){if(!_0x4588f4)return null;const _0x4d351d=this['position']['replace']('arrow_',''),_0x1716e0=Array['from'](_0x4588f4['getClientRects']());let _0xaea994,_0x15ed93=_0x1716e0['reverse']();return void 0x0!==_0xdbab87&&this['_isPinnedRectVisible'](_0x15ed93[_0xdbab87],_0x18bf2e,_0x4171f0)?(_0xaea994=_0x15ed93[_0xdbab87],this['_pinnedRectIndex']=_0xdbab87):this['_isPinnedRectVisible'](_0x15ed93[0x0],_0x18bf2e,_0x4171f0)&&void 0x0===_0xdbab87?_0xaea994=_0x15ed93[0x0]:(_0x15ed93='s'==_0x4d351d[0x0]?[..._0x1716e0]['reverse']():_0x1716e0,_0x15ed93['forEach'](_0x22dc76=>{this['_isPinnedRectVisible'](_0x22dc76,_0x18bf2e,_0x4171f0)&&(_0xaea994=_0x22dc76);})),this['_pinnedTargetChangeId']=_0x14039b,this['_pinnedTargetElement']=_0x4588f4,_0xaea994||_0x4588f4['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x171cc1,_0x4a3dac,_0x1b1abb){if(!_0x171cc1)return null;const _0xbb4801=Array['from'](_0x171cc1['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x4a3dac&&this['_pinnedTargetChangeId']!==_0x1b1abb?(this['_pinnedRectIndex']=_0x4a3dac,this['_pinnedTargetElement']=_0x171cc1,this['_pinnedTargetChangeId']=_0x1b1abb,_0xbb4801[_0x4a3dac]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x1b1abb?_0x171cc1!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0xbb4801[this['_pinnedRectIndex']]:void 0x0!==_0x4a3dac&&this['_pinnedTargetChangeId']!==_0x1b1abb?(this['_pinnedRectIndex']=_0x4a3dac,this['_pinnedTargetElement']=_0x171cc1,this['_pinnedTargetChangeId']=_0x1b1abb,_0xbb4801[_0x4a3dac]):_0x171cc1['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x7fc5fc,_0x4ecd48){if(_0x7fc5fc)for(let _0xa7dd85=0x0;_0xa7dd85<_0x4ecd48['length'];_0xa7dd85++){const _0x1a45b6=_0x4ecd48[_0xa7dd85];if(_0x7fc5fc['clientX']>=_0x1a45b6['left']-0x3&&_0x7fc5fc['clientX']<=_0x1a45b6['right']+0x3&&_0x7fc5fc['clientY']>=_0x1a45b6['top']-0x3&&_0x7fc5fc['clientY']<=_0x1a45b6['bottom']+0x3)return _0xa7dd85;}}['_isPinnedRectVisible'](_0x8a5a8e,_0xa0e4df,_0x4becfc){const _0x1fab86=new gt(_0x8a5a8e),_0x5e3d65=_0xa0e4df||document['documentElement'],_0x3ea27c=_0x1fab86['getIntersection'](mt(_0x4becfc)),_0x5496f1=new gt(_0x5e3d65)['getIntersection'](_0x1fab86);return!!(_0x3ea27c&&_0x5496f1&&_0x1fab86['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x3abc0e{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[hs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x28264f){super(_0x28264f),this['_bodyCollection']=un(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 _0x60a837=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x60a837);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x47d277){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x43b680=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x47d277,_0x43b680);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x1c4116){_0x1c4116&&('error-general'!==_0x1c4116['status']?'error-chunk'!==_0x1c4116['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x47ea43){this['_mainView']['addCheckRunResult'](_0x47ea43);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x4930){this['_mainView']['showGeneralReviewCoreErrorView'](_0x4930??ls(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x49ca52,_0xf4da88){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x49ca52,_0xf4da88);}['setActiveStateInResults'](_0x5a2363){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x36337b=>{_0x36337b['id']===_0x5a2363&&_0x36337b['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x43b4ae=>_0x43b4ae['setItemAsInactive']());}['updateChangeState'](_0x4b3126,_0x5e6992){'accepted'===_0x5e6992||'rejected'===_0x5e6992||'outdated'===_0x5e6992?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x4b3126,_0x5e6992):this['_mainView']['reviewCheckResultsView']['showResult'](_0x4b3126,_0x5e6992);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x22bd96,_0x36ae5f,_0x549bc3,_0xeb73a9,_0x276b52,_0x3a7d0c){this['_balloonSuggestionView']['showBalloon'](_0x22bd96,_0x36ae5f,_0x549bc3,_0xeb73a9,_0x276b52,_0x3a7d0c);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x60fb93){const _0x569cdc=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x309d69=>_0x309d69['id']===_0x60fb93);return _0x569cdc?_0x569cdc['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x4708a3{constructor(_0x45a75b){super(_0x45a75b),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x27470e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x27470e['if']('isVisible','ck-hidden',_0x334076=>!_0x334076)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x27470e['to']('errorMessage')}]}]});}},$a=class extends _0x4708a3{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x29e6cc,_0x2f3201){super(_0x29e6cc),this['reviewCoreHeader']=_0x2f3201['header'],this['generalErrorView']=new Ya(_0x29e6cc),this['reviewCheckListView']=_0x2f3201['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x2f3201['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x2f3201['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'](_0x4ad0b8){this['reviewCheckResultsView']['addResult'](_0x4ad0b8),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'](_0x203d15){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x203d15;}['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 Pt{constructor(_0x7d0b94,_0x1ceee4){super(_0x1ceee4),this['set']({'label':_0x7d0b94,'withText':!0x0,'class':an}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends Xt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x394e20,_0x300061){super(_0x394e20),this['_contents']=_0x300061,this['_resultViews']=new _0x4f88bc(),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(_0x394e20),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 _0x2e86c4=this['_createCombinedSkeletonLoader'](),_0x1620d2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x1620d2['if']('isLoading','ck-ai_review__check-run_loading',_0x37ba63=>_0x37ba63),_0x1620d2['if']('isResultReady','ck-ai_review__check-run_ready',_0x572a4c=>_0x572a4c),_0x1620d2['if']('isVisible','ck-hidden',_0x18471c=>!_0x18471c)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x2e86c4,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x4176cb){const _0x170a9d=new Ga(this['locale'],_0x4176cb['id']);_0x170a9d['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x170a9d),_0x170a9d['resultResponseView']['element']['innerHTML']=_0x4176cb['contentDiffed'];}['hideResult'](_0x3d578b,_0x3e6c58){if('pending'===_0x3e6c58)return;const _0x5b2fb1=this['_resultViews']['find'](_0x3f864c=>_0x3f864c['id']===_0x3d578b);_0x5b2fb1&&(_0x5b2fb1['status']=_0x3e6c58,_0x5b2fb1['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x5e5116,_0x565114){if('pending'!==_0x565114)return;const _0x528913=this['_resultViews']['find'](_0x204ea5=>_0x204ea5['id']===_0x5e5116);_0x528913&&(_0x528913['status']=_0x565114,_0x528913['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0xbdd38f,_0x190f51){this['headerTitle']=_0xbdd38f,this['headerSubtitle']=_0x190f51||'';}['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 _0x589790=new _0x4708a3(this['locale']),_0x16333e=[];for(let _0x3ee374=0x0;_0x3ee374<0x10;_0x3ee374++){const _0x117e2a=this['_createSkeletonLoader']();_0x117e2a['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x16333e['push'](_0x117e2a);}return _0x589790['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0xd15814=>!_0xd15814)]},'children':_0x16333e}),_0x589790;}['_createResultsBodyView'](){const _0x337059=new _0x4708a3(this['locale']);return _0x337059['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x6b4e86=>_0x6b4e86)]},'children':this['_resultViews']}),_0x337059;}['_createErrorView'](){const _0xde967=new _0x4708a3(this['locale']),_0x3285eb=new Pt(this['locale']),t=this['locale']['t'];return _0xde967['delegate']('retryReview')['to'](this),_0x3285eb['set']({'label':t('Try\x20again'),'withText':!0x0,'class':hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x3285eb['on']('execute',()=>{this['fire']('retryReview');}),_0xde967['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x24557a=>!_0x24557a),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x50d084=>'chunk'===_0x50d084)]},'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',_0x4df38b=>'chunk'===_0x4df38b)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2c834b=>'general'!==_0x2c834b)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x1ed803=>'chunk'!==_0x1ed803)]},'children':[{'text':ls(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x3285eb]}),_0xde967;}['_createCancelButtonView'](){const _0x47e989=new Pt(this['locale']);return _0x47e989['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[hn+'\x20ck-ai-button-stop-generating'],'icon':et}),_0x47e989['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x40423e=>_0x40423e),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3a82e2=>_0x3a82e2)]}}),_0x47e989['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x47e989;}['_createToggleDiffButtonView'](){const _0x2d9445=new Pt(this['locale']);_0x2d9445['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x2d9445['bind']('isEnabled')['to'](this,'isError',_0x4dbf8a=>!_0x4dbf8a),_0x2d9445['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5ef2d4=>!_0x5ef2d4),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5c0cf5=>_0x5c0cf5)]}});const _0x30dd63=ls(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x56a130=ls(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x2d9445['bind']('isOn')['to'](this,'isToggleDiffOn',_0x450523=>_0x450523),_0x2d9445['bind']('icon')['to'](this,'isToggleDiffOn',_0x45effe=>_0x45effe?_0x2e3b97:_0x225cf3),_0x2d9445['bind']('label')['to'](this,'isToggleDiffOn',_0x18fff0=>_0x18fff0?_0x30dd63:_0x56a130),_0x2d9445['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x2d9445;}['_createAcceptAllButtonView'](){const _0x551992=new Pt(this['locale']);return _0x551992['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x551992['bind']('isEnabled')['to'](this,'isError',_0x92bb38=>!_0x92bb38),_0x551992['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1d2000=>!_0x1d2000),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x247bb2=>_0x247bb2)]}}),_0x551992['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x551992;}['_createExitReviewButtonView'](){const _0x379345=new Pt(this['locale']);return _0x379345['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x379345['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5ca80e=>!_0x5ca80e),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x7e66cc=>_0x7e66cc)]}}),_0x379345['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x379345;}['_createResultHeaderView'](){const _0x1ff4b7=new _0x4708a3(this['locale']),_0x37c170=this['_createTitleView']();return _0x1ff4b7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x2993e8=>_0x2993e8)]},'children':[_0x37c170,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xec92f9=>!_0xec92f9)],'title':ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':ls(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']]}]}),_0x1ff4b7;}['_createTitleView'](){const _0x2b10ea=new _0x4708a3(this['locale']),_0x56c7fc=new cr();return _0x56c7fc['bind']('isVisible')['to'](this,'isResultReady',_0x4c53e4=>!_0x4c53e4),_0x2b10ea['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x143cdf=>_0x143cdf)]},'children':[_0x56c7fc,{'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')}]}]}]}),_0x2b10ea;}['_createFinishReviewButtonView'](){const _0x1d2086=new qa(ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x1d2086['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2eeebf=>!_0x2eeebf)]}}),_0x1d2086['delegate']('finishReview')['to'](this),_0x1d2086;}},Xa=class extends Xt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x1ba60e,_0x292b9b){super(_0x1ba60e),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x292b9b['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x292b9b['headerText']);const _0x32015a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x32015a['if']('isVisible','ck-hidden',_0x4dd96c=>!_0x4dd96c)]},'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':_0x292b9b['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x78fcd0){const _0x3486ef=new qa(_0x78fcd0,this['locale']);return _0x3486ef['delegate']('finishReview')['to'](this),_0x3486ef;}['_createResultHeaderView'](_0x2c0218){const _0x448793=new _0x4708a3(this['locale']);return _0x448793['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x2c0218},'children':[{'text':_0x2c0218}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x448793;}},za=class extends _0x4708a3{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0xcc6dd2,_0x460534){super(_0xcc6dd2),this['_defaultValue']=_0x460534['default']||(_0x460534['data']['length']>0x0?_0x460534['data'][0x0]['id']:''),this['_defaultLabel']=_0x460534['data']['find'](_0x3d6c18=>_0x3d6c18['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x353e74(this['locale']);const _0x2a0509=this['_prepareListOptions'](_0x460534['data']);_0x41c9a7(this['_dropdownView'],_0x2a0509,{'role':'menu','ariaLabel':_0x460534['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4d550a=>{_0x4d550a['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x792d2a=>{this['formValue']=_0x792d2a['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x792d2a['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'](_0x55b4c3=[]){const _0xe6edcd=new ht();this['resetToDefault']();for(const _0x4f7055 of _0x55b4c3){const _0x128088=new _0x2d4237({'label':_0x4f7055['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4f7055['id'],'model':_0x4f7055});_0x128088['bind']('isOn')['to'](this,'formValue',_0x5f35e5=>_0x5f35e5===_0x128088['id']);const _0x4e4544={'type':'button','model':_0x128088};_0xe6edcd['add'](_0x4e4544);}return _0xe6edcd;}},ja=class extends Xt{['_formItem']=null;constructor(_0x34eac4,_0x1d9c53,_0x3f1b7a){if(super(_0x34eac4),this['argsKey']=_0x1d9c53?.['argsKey'],'dropdown'===_0x1d9c53['formType'])this['_formItem']=new za(this['locale'],_0x1d9c53);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x17aec=new Ft(this['locale'],{'children':[this['_formItem']],'class':[_0x3f1b7a?'ck-form__row_with-submit':'']});_0x3f1b7a&&_0x17aec['children']['add'](_0x3f1b7a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x17aec]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0xd400c4{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x1c804b){super(_0x1c804b),this['set']('isEmpty',!0x0),this['keystrokes']=new dt(),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 _0x4708a3{['focusTracker']=new ut();['keystrokes']=new dt();['focusCycler'];['_focusables']=new _0x4f88bc();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x370f04,_0xd16276,_0x266003=!0x1){super(_0x370f04),this['_check']=_0xd16276,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0xd16276['defaultModel']?_0xd16276['defaultModel']['id']:'',this['_defaultLabel']=_0xd16276['defaultModel']?_0xd16276['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new $t(this['locale'],()=>new Ja(_0x370f04)),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 ht(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x266003),_0x41c9a7(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Ft(this['locale'],{'children':[this['promptInputView']]}),new Ft(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x57b8dc,_0x4e7878)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x4e7878()):_0x4e7878();}),this['focusCycler']=new Bt({'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'](_0x1bb80d=>{this['_focusables']['add'](_0x1bb80d),this['focusTracker']['add'](_0x1bb80d['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 _0x58e255 of this['_getFormValidators']()){const _0x552dba=_0x58e255();if(_0x552dba)return this['promptInputView']['errorText']=_0x552dba,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return ls(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x169bff=new Pt(this['locale']),t=this['locale']['t'];return _0x169bff['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x169bff['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x169bff;}['_createCancelButtonView'](){const _0x102961=new Pt(this['locale']),t=this['locale']['t'];return _0x102961['set']({'label':t('Cancel'),'withText':!0x0,'class':cn}),_0x102961['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3eee34=>{_0x3eee34['stopPropagation']();})}}),_0x102961['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x102961;}['_setModelList'](_0x48c7b8){this['_modelSelectionDropdownItems']['clear']();const _0x7be5c=this['_check']['models'];if(_0x48c7b8)this['set']('modelDisplayMode','hidden');else{const _0x3d0bd2=0x1===_0x7be5c['length'];this['set']('modelDisplayMode',_0x3d0bd2?'name':'selector');}if(this['resetToDefault'](),_0x7be5c?.['length']){0x1===_0x7be5c['length']&&this['set']('activeModelName',_0x7be5c[0x0]['name']||_0x7be5c[0x0]['id']);for(const _0x1b85cb of _0x7be5c){const _0x17db51=new _0x2d4237({'label':_0x1b85cb['name'],'withText':!0x0,'role':'menuitemradio','id':_0x1b85cb['id'],'model':_0x1b85cb});_0x17db51['bind']('isOn')['to'](this,'modelId',_0x5721e2=>_0x5721e2===_0x1b85cb['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x17db51,'labelView':new eh(this['locale'],_0x1b85cb)});}}}['_createModelSelectionDropdown'](){const _0x56259c=_0x353e74(this['locale']);return _0x56259c['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x56259c['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':cn}),_0x56259c['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3cc79f=>'selector'===_0x3cc79f),this['listenTo'](_0x56259c,'execute',_0x330552=>{this['modelId']=_0x330552['source']['model']['id'],_0x56259c['buttonView']['label']=_0x330552['source']['label'];}),_0x56259c;}['_createModelNameView'](){const _0x38698d=new th(this['locale']);return _0x38698d['bind']('text')['to'](this,'activeModelName',_0x20c180=>_0x20c180??''),_0x38698d['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3e771f=>'name'===_0x3e771f),_0x38698d;}['_createActionsFooterView'](){const _0x7eb915=new _0x4708a3(this['locale']);return _0x7eb915['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']]}]}),_0x7eb915;}},th=class extends _0x4708a3{constructor(_0x28a9c6){super(_0x28a9c6),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x4cd246=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x4cd246['if']('isVisible','ck-hidden',_0x382bcd=>!_0x382bcd)]},'children':[{'text':_0x4cd246['to']('text')}]});}},eh=class extends Lt{constructor(_0x3cf0c0,_0x4da8fc){super();const _0x29dd9d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x29dd9d['to']('style'),'id':_0x29dd9d['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x29dd9d['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x4da8fc['description']||'']}]}]});}},ih=class extends Xt{['_formItemsCollection']=new _0x4f88bc();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x57800f,_0x3ec7cb,_0x31ef7d,_0x59e5af=!0x1){super(_0x57800f),this['_hideModels']=_0x59e5af,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x3ec7cb['isParameterized']);const _0xbeca85=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',_0x510806=>_0x510806),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x3048cc=>_0x3048cc)],'style':{'--ck-ai-review-check-list-item-index':_0x31ef7d}},'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':_0x3ec7cb['title']}]},_0xbeca85]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x3ec7cb['description']?[{'text':_0x3ec7cb['description']}]:[]}]}]},..._0x3ec7cb['isParameterized']?[this['_createParameterizedView'](_0x3ec7cb)]:[],...'custom'===_0x3ec7cb['id']?[this['_createCustomView'](_0x3ec7cb,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x3ec7cb['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x3ec7cb['id'],'args':_0x3ec7cb['useArgs']?_0x3ec7cb['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0xfcbf0e({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x978594=>{_0x978594['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x45a1b2=new Wt();return _0x45a1b2['content']=_0x50ee10,_0x45a1b2['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x45a1b2;}['_createParameterizedView'](_0x105d17){const _0x1e418a=new _0x4708a3(),_0x4b8299=this['_createFormView'](_0x105d17);return _0x1e418a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x2cc897=>!_0x2cc897)]},'children':[_0x4b8299]}),_0x1e418a;}['_createFormView'](_0x5b0bcc){const _0x1b6c97=new _0x4708a3(),_0x6565e2=Array['isArray'](_0x5b0bcc['options'])?_0x5b0bcc['options']:[],_0x58638b=new Pt(this['locale']),t=this['locale']['t'];_0x58638b['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x58638b['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2f3f72=>{_0x2f3f72['stopPropagation']();})}}),_0x58638b['on']('execute',()=>{const _0xf44044=[],_0x2e429b={};this['_formItemsCollection']['forEach'](_0x14f66b=>{_0xf44044['push'](_0x14f66b['value']),_0x5b0bcc['useArgs']&&_0x5b0bcc['options']&&(_0x2e429b[_0x14f66b['argsKey']]=_0x14f66b['value']);}),this['fire']('runReviewCheck',{'id':_0x5b0bcc['id'],'params':_0xf44044['length']?_0xf44044:void 0x0,'args':Object['keys'](_0x2e429b)['length']?_0x2e429b:void 0x0});});const _0x440a09=_0x6565e2['length'];return _0x6565e2['forEach']((_0x73bf1,_0x40439c)=>{const _0x49ac03=_0x40439c===_0x440a09-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x73bf1,_0x49ac03?_0x58638b:null));}),_0x1b6c97['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x1b6c97;}['_createCustomView'](_0x45b367,_0x520a5d=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x45b367,_0x520a5d),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',_0xdd5885=>!_0xdd5885)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x1a1277,_0x158f94,_0x10d563)=>{_0x10d563||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends Xt{['_checkViews'];constructor(_0x52e8fb){super(_0x52e8fb),this['_checkViews']=new _0x4f88bc(),this['_setupTemplate']();}['setChecks'](_0x14d969,_0x31a652=!0x1){this['_checkViews']['clear']();for(const [_0x18ac8e,_0x4eff6f]of _0x14d969['entries']()){const _0x17652c=new ih(this['locale'],_0x4eff6f,_0x18ac8e,_0x31a652);_0x17652c['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x17652c);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x1a4bd1 of this['_checkViews'])_0x1a4bd1 instanceof ih&&_0x1a4bd1['resetToDefault']();}['_setupTemplate'](){const _0x556b26=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x556b26['if']('isVisible','ck-hidden',_0x3bd610=>!_0x3bd610)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x29ea0e=this['context']['plugins']['get']('AITabs'),_0x54fd67=this['context']['locale'],_0xafbaff=new Ho(_0x54fd67,{'label':ls(_0x54fd67,'AI_REVIEW_MODE'),'icon':_0x2f914c,'class':'ck-ai-header_review','showResizeButton':_0x29ea0e['showResizeButton']});return _0xafbaff['delegate']('resizeTabs')['to'](_0x29ea0e),_0xafbaff['bind']('isMaximized')['to'](_0x29ea0e['view'],'isMaximized',_0x321cad=>_0x321cad),new $a(this['context']['locale'],{'header':_0xafbaff,'list':new sh(_0x54fd67),'results':new Qa(_0x54fd67,{'generalErrorText':ls(_0x54fd67,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x54fd67,{'headerText':ls(_0x54fd67,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':ls(_0x54fd67,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x54fd67,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x1ef95a=this['context']['plugins']['get']('AITabs');_0x1ef95a['view']['on']('activateTab',(_0xded163,{newTab:_0x2e2c59,oldTab:_0x2695ff})=>{'reviewMode'===_0x2e2c59?this['fire']('getReviewCheckList'):'reviewMode'===_0x2695ff&&this['fire']('leaveReview');}),_0x1ef95a['view']['addTab']({'id':'reviewMode','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x2f914c,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x3abc0e{static get['requires'](){return[_0x3ea65d,As];}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(_0x4f77a2){super(_0x4f77a2),this['_domEmitter']=new(ct())(),this['_eventEmitter']=new(lt())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x37f96c=_0x4c4283=>this['_scheduleAttachReviewEditingToEditor'](_0x4c4283);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x5a1597)return void _0x37f96c(this['context']);const _0x452057=this['context'];for(const _0x5eac20 of _0x452057['editors'])_0x37f96c(_0x5eac20);this['listenTo'](_0x452057['editors'],'add',(_0x3be8e0,_0x10744c)=>{_0x37f96c(_0x10744c);}),this['listenTo'](_0x452057['editors'],'remove',(_0x551cce,_0x3bb223)=>{for(const [_0x1b6a67,_0xf28fda]of this['_markers'])_0xf28fda['editor']===_0x3bb223&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x1b6a67,'changeId':_0xf28fda['groupId']}),this['_markers']['delete'](_0x1b6a67));});}['_scheduleAttachReviewEditingToEditor'](_0xe5e25a){const _0x390b06=()=>{'destroyed'!==_0xe5e25a['state']&&_0xe5e25a['conversion']&&this['_attachReviewEditingToEditor'](_0xe5e25a);};if('ready'===_0xe5e25a['state'])return void _0x390b06();const _0x3c1aa7=()=>{this['stopListening'](_0xe5e25a,'ready',_0x3c1aa7),_0x390b06();};this['listenTo'](_0xe5e25a,'ready',_0x3c1aa7);}['_attachReviewEditingToEditor'](_0x11fac8){this['_reviewEditingAttachedEditors']['has'](_0x11fac8)||(_0x11fac8['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0xa0a1f1,{writer:_0x273553})=>{const _0x19b6b1=this['_markers']['get'](_0xa0a1f1['markerName']),_0x1793c9={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x19b6b1?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0xa0a1f1['markerName']};return _0x273553['createUIElement']('span',_0x1793c9,function(_0x5a706c){const _0x2bdaf6=this['toDomElement'](_0x5a706c);return _0x2bdaf6['innerHTML']=_0x19b6b1?.['content']?.['asString']||'',_0x2bdaf6;});}}),_0x11fac8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x14d241=>{const _0x11a657=this['_markers']['get'](_0x14d241['markerName']),_0x381873=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x11a657?.['id']||'')&&_0x381873['push']('ck-ai_review__change_active'),{'classes':_0x381873,'attributes':{'data-marker-id':_0x14d241['markerName']}};}}),_0x11fac8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x3fe61c=>{const _0x18b4b9=this['_markers']['get'](_0x3fe61c['markerName']),_0x3cdc8b=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x18b4b9?.['id']||'')&&_0x3cdc8b['push']('ck-ai_review__change_active'),{'classes':_0x3cdc8b,'attributes':{'data-marker-id':_0x3fe61c['markerName']}};}}),_0x11fac8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x5316fb=>{const _0x43c999=this['_markers']['get'](_0x5316fb['markerName']),_0x1d02e1=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x43c999?.['id']||'')&&_0x1d02e1['push']('ck-ai_review__change_active'),{'classes':_0x1d02e1,'attributes':{'data-marker-id':_0x5316fb['markerName']}};}}),_0x11fac8['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x10e3e8,{writer:_0x1f858b})=>_0x1f858b['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x10e3e8['isOpening']?'start':'end')})}),_0x11fac8['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x32a933,'view':_0x4907b2}),this['_updateMouseMarkerInteractionListeners'](_0x11fac8),this['listenTo'](_0x11fac8,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x11fac8),{'priority':'lowest'}),this['listenTo'](_0x11fac8,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x11fac8),{'priority':'lowest'}),_0x11fac8['model']['document']['registerPostFixer'](_0xa2e435=>this['_validateMarkers'](_0x11fac8,_0xa2e435)),_0x11fac8['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x11fac8)),this['_reviewEditingAttachedEditors']['add'](_0x11fac8));}['_updateMouseMarkerInteractionListeners'](_0x2313f2){let _0x4f2e7c=this['_boundEditables']['get'](_0x2313f2);_0x4f2e7c||(_0x4f2e7c=new Map(),this['_boundEditables']['set'](_0x2313f2,_0x4f2e7c));const _0x2540e6=new Set(_0x2313f2['ui']['getEditableElementsNames']());for(const _0x1d292b of _0x2540e6){if(_0x4f2e7c['has'](_0x1d292b))continue;const _0x586996=_0x2313f2['ui']['getEditableElement'](_0x1d292b);_0x4f2e7c['set'](_0x1d292b,_0x586996),this['_attachMouseMarkerInteractionListeners'](_0x586996);}for(const [_0x1a6aef,_0x4114ff]of _0x4f2e7c)_0x2540e6['has'](_0x1a6aef)||(_0x4f2e7c['delete'](_0x1a6aef),this['_domEmitter']['stopListening'](_0x4114ff));}['_attachMouseMarkerInteractionListeners'](_0x4d2de3){this['_domEmitter']['listenTo'](_0x4d2de3,'mouseup',(_0x1efe4e,_0x1635e5)=>{const _0x47560d=_0x1635e5['target'],_0x30548f=this['_findMarkerElement'](_0x47560d);if(!_0x30548f)return;const _0x359c37=_0x30548f['getAttribute']('data-marker-id'),_0x1cddd4=_0x359c37['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x359c37,'changeId':_0x1cddd4,'markerElement':()=>this['_findMarkerElementById'](_0x359c37),'domEvent':_0x1635e5});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x4d2de3,'mouseover',(_0x3505dd,_0x17e8a3)=>{const _0x532bc2=_0x17e8a3['target'],_0x25d0f0=_0x17e8a3['relatedTarget'];let _0x27b52e=this['_findMarkerElement'](_0x532bc2);if(!_0x27b52e&&_0x25d0f0&&(_0x27b52e=this['_findMarkerElement'](_0x25d0f0)),!_0x27b52e)return;const _0x10ecec=_0x27b52e['getAttribute']('data-marker-id'),_0x278362=_0x10ecec['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x278362,'markerElement':()=>this['_findMarkerElementById'](_0x10ecec),'domEvent':_0x17e8a3});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x1c2d83((_0x1cfb94,_0x26a56e)=>{const _0x13bf4f=_0x26a56e['target'];this['_findMarkerElement'](_0x13bf4f)||_0x13bf4f['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x24138d=this['context']['plugins']['get']('AIEditing'),_0x5223dd=us(this['context']);if(!_0x5223dd['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x4c7b15=new Set(),_0x54bf54=[],_0x281c2=new Map();for(const _0x15d85e of _0x5223dd)for(const _0x49f8bd of _0x15d85e['model']['document']['getRoots']()){if('$graveyard'===_0x49f8bd['rootName'])continue;const _0x5d7d39=this['_buildDocumentDataSliceForRoot'](_0x15d85e,_0x49f8bd,_0x24138d,_0x4c7b15);_0x54bf54['push'](_0x5d7d39['content']);for(const [_0xe5e75f,_0x3ea46e]of _0x5d7d39['elements'])_0x281c2['set'](_0xe5e75f,_0x3ea46e);}return{'elements':_0x281c2,'content':_0x54bf54['join']('')};}['_buildDocumentDataSliceForRoot'](_0x2e27c7,_0x55e3cb,_0x3361ed,_0x21d070){const _0x251663=_0x2e27c7['model'],_0x18cc1d=new _0xc7ecd7();for(const _0x194822 of _0x55e3cb['getChildren']())_0x18cc1d['_appendChild'](_0x194822['_clone'](!0x0));for(const _0x124325 of _0x251663['markers']){const _0x1db0ff=_0x124325['getRange']();_0x1db0ff&&_0x1db0ff['root']['rootName']===_0x55e3cb['rootName']&&_0x18cc1d['markers']['set'](_0x124325['name'],this['_changeRangeOwnerDocument'](_0x1db0ff['clone'](),_0x18cc1d));}const _0x388e94=new Map(),_0x5cd14f=_0x251663['document']['version'],_0x5396d0=new _0x7bd257({'ignoreElementEnd':!0x0,'startPosition':_0x251663['createPositionAt'](_0x18cc1d,0x0)});for(const {item:_0x5417fc}of _0x5396d0){if(_0x5417fc['is']('element')&&_0x5417fc['name']&&ah['includes'](_0x5417fc['name'])){const _0x528a0f=this['_upsertDataId'](_0x5417fc,()=>_0x3361ed['_nextDataId'](_0x21d070));_0x21d070['add'](_0x528a0f);}if(!_0x5417fc['is']('$textProxy'))continue;const _0x596cdc=_0x5417fc['parent'];if(!_0x596cdc||!_0x596cdc['is']('element'))continue;const _0x8ad90d=this['_upsertDataId'](_0x596cdc,()=>_0x3361ed['_nextDataId'](_0x21d070));_0x21d070['add'](_0x8ad90d);for(const _0x2e20f7 of _0x596cdc['getChildren']())_0x2e20f7['is']('element')&&(_0x2e20f7['name']&&oh['includes'](_0x2e20f7['name'])||_0x21d070['add'](this['_upsertDataId'](_0x2e20f7,()=>_0x3361ed['_nextDataId'](_0x21d070))));let _0x111c23=_0x596cdc;for(;_0x111c23['parent']&&!_0x111c23['parent']['is']('documentFragment');)_0x111c23=_0x111c23['parent'],_0x111c23['hasAttribute'](_0x32a933)&&_0x111c23['_removeAttribute'](_0x32a933);_0x388e94['set'](_0x8ad90d,{'editor':_0x2e27c7,'rootName':_0x55e3cb['rootName'],'path':_0x596cdc['getPath'](),'documentVersion':_0x5cd14f,'getContent':this['_createGetContentUsingDataIdFn'](_0x111c23['_clone'](!0x0),_0x8ad90d,_0x2e27c7['data'])}),_0x5396d0['jumpTo'](_0x251663['createPositionAfter'](_0x596cdc));}return{'content':_0x2e27c7['data']['processor']['toData'](_0x2e27c7['data']['toView'](_0x18cc1d)),'elements':_0x388e94};}['diffContent'](_0x4728cd,_0x4204a8,_0x5a68cc,_0x4bdc14=!0x1){const {contentInitial:_0x353c0a,contentNew:_0x507913}=this['_neutralizeChangesOnUnsupportedElements'](_0x4204a8,_0x5a68cc),_0x1372c8=[],_0x5e65d1=_0x4728cd['data']['parse'](_0x507913,'$documentFragment'),_0x384e9e=_0x4728cd['data']['parse'](_0x353c0a,'$documentFragment'),_0x953eea=_0x4728cd['model']['createPositionAt'](_0x384e9e,0x0);if(this['_haveSingleTopLevelElement'](_0x5e65d1)){if(!this['_hasSameTopLevelElement'](_0x384e9e,_0x5e65d1))return _0x1372c8;}else{const _0x417521=_0x4728cd['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x384e9e,_0x417521)||!this['_haveOnlyInlineContent'](_0x5e65d1,_0x417521))return _0x1372c8;}const _0x2e6d4d=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x353c0a,_0x507913,{'targetEditor':_0x4728cd,'anchor':_0x953eea,'markDeletions':!0x0})['getOperations']()['filter'](_0x1199f5=>'insert'===_0x1199f5['type']||'marker'===_0x1199f5['type']&&_0x1199f5['name']['startsWith']('$markedRemove')),_0x36e858=this['_groupAdjacentOperations'](_0x2e6d4d),_0x44492e=[];if(_0x4bdc14){if(_0x36e858['length']){const _0x420e36=_0x36e858[0x0]['operations'][0x0],_0x5d9647='insert'===_0x420e36['type']?_0x420e36['position']:_0x420e36['newRange']['start'],_0x5cfbcb=this['_getPositionLimitingRange'](_0x5d9647,_0x4728cd,'inside'),_0x2d27ee=_0x5cfbcb?_0x5e65d1['getChild'](0x0)['getChildren']():_0x5e65d1['getChildren'](),_0x36576a=_0x5cfbcb||_0x4728cd['model']['createRangeIn'](_0x384e9e),_0x354715=[new _0x414b93('$markedRemove:synthetic'+Ot(),null,_0x36576a,_0x4728cd['model']['document']['model']['markers'],!0x0,_0x4728cd['model']['document']['version']+0x1),new _0x40b89f(_0x36576a['end'],_0x2d27ee,_0x4728cd['model']['document']['version']+0x2)];_0x44492e['push']({'operations':_0x354715,'operationsIsolated':_0x354715,'groupOffset':0x0});}}else _0x44492e['push'](..._0x36e858);let _0x1801fc=0x0;return _0x4728cd['model']['change'](_0x491f02=>{for(let _0x4aec6a=0x0;_0x4aec6a<_0x44492e['length'];_0x4aec6a++){const _0x2374a9=_0x44492e[_0x4aec6a],_0x9677ed=_0x491f02['createDocumentFragment']();for(const _0x3822fe of _0x384e9e['getChildren']())_0x491f02['append'](_0x3822fe['_clone'](!0x0),_0x9677ed);for(const _0x22c79b of _0x2374a9['operationsIsolated'])if('insert'===_0x22c79b['type']){const _0x2b22c8=_0x22c79b;_0x2b22c8['baseVersion']=null,_0x2b22c8['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x2b22c8,_0x9677ed),_0x491f02['batch']['addOperation'](_0x22c79b),_0x4728cd['model']['applyOperation'](_0x22c79b);const _0x16970f='suggestion:insertion:id:authorId:'+_0x1801fc++,_0x336ca0=_0x4728cd['model']['createRange'](_0x2b22c8['position'],_0x2b22c8['position']['getShiftedBy'](_0x2b22c8['howMany']));_0x9677ed['markers']['set'](_0x16970f,_0x336ca0);}else{if('marker'===_0x22c79b['type']&&_0x22c79b['name']['startsWith']('$markedRemove')){const _0xef4f18=_0x22c79b,_0x3d9ed1='suggestion:deletion:id:authorId:'+_0x1801fc++;this['_changeOperationOwnerDocument'](_0xef4f18,_0x9677ed),_0x9677ed['markers']['set'](_0x3d9ed1,_0xef4f18['newRange']);}}if(_0x4bdc14)_0x1372c8['push']({..._0x2374a9,'context':this['_createGetContentFn'](_0x384e9e,_0x4728cd['data']),'content':this['_createGetContentFn'](_0x384e9e,_0x4728cd['data'])});else{const _0x1d3c0c=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x2374a9['operationsIsolated'][0x0]),_0x9677ed),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x2374a9['operationsIsolated'][_0x2374a9['operationsIsolated']['length']-0x1]),_0x9677ed),_0x4728cd);_0x9677ed['markers']['set'](rh+'suggestion-context',new _0x5cca78(_0x1d3c0c['start'],_0x1d3c0c['end'])),_0x1372c8['push']({..._0x2374a9,'context':this['_createGetContextFn'](_0x9677ed,_0x4728cd['data'],{'ellipsisBefore':_0x1d3c0c['hasContentBefore'],'ellipsisAfter':_0x1d3c0c['hasContentAfter']}),'content':this['_createGetContentFn'](_0x9677ed,_0x4728cd['data'])});}}}),_0x1372c8;}['markChangePositionInEditorContent'](_0x3ba20c,_0x44611a){if(!_0x3ba20c['length'])return;const _0x39cdf7=_0x3ba20c[0x0]['parent']['id'],_0xc7d3cd=_0x44611a['elements']['get'](_0x39cdf7);if(!_0xc7d3cd)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x39cdf7);const _0x266013=_0xc7d3cd['path'],_0x508a1e=_0xc7d3cd['editor'],_0x90dcc6=_0x508a1e['model']['document']['getRoot'](_0xc7d3cd['rootName']);if(!_0x90dcc6)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0xc7d3cd['rootName']);const _0x2c4a46=_0x508a1e['model']['document']['history']['getOperations'](_0xc7d3cd['documentVersion']),_0x41b575=[];for(const _0x2e83a1 of _0x3ba20c){const _0x5307b4=_0x2e83a1['operationsIsolated']['map'](_0x303878=>this['_translateOperationToEditorContent'](_0x303878,_0x266013,_0x90dcc6));if(!_0x5307b4||!_0x5307b4['length'])continue;const _0x224948=_0x5307b4['every'](_0x4e2210=>'marker'===_0x4e2210['type']&&_0x4e2210['name']['startsWith']('$markedRemove')),_0x37b09e=_0x1790d4(_0x5307b4,_0x2c4a46,{'document':_0x508a1e['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x148c57 of _0x37b09e)if('insert'===_0x148c57['type']){const _0x4cc67d=_0x148c57,_0x1045be=_0x4cc67d['nodes'];_0x508a1e['model']['change'](_0x364092=>{const _0x4018d1=_0x364092['createDocumentFragment']();for(const _0x17d5c5 of _0x1045be)_0x364092['append'](_0x17d5c5['_clone'](!0x0),_0x4018d1);_0x41b575['push']({'start':_0x4cc67d['position'],'end':_0x4cc67d['position'],'type':'insert','groupId':_0x2e83a1['id'],'content':{'asString':this['_createGetContentFn'](_0x4018d1,_0x508a1e['data'])(),'asFragment':_0x4018d1}});});}else{if('marker'===_0x148c57['type']&&_0x148c57['name']['startsWith']('$markedRemove')){const _0x5d4c9d=_0x148c57;let _0x46c94a='remove-text';if(_0x224948){const _0x76906f=this['_findAdjacentContextDistance'](_0x5d4c9d['newRange']['start'],'backward',_0x508a1e['model']['schema']),_0x59692a=this['_findAdjacentContextDistance'](_0x5d4c9d['newRange']['end'],'forward',_0x508a1e['model']['schema']);if(_0x76906f||_0x59692a){const _0x1d0e10=_0x5d4c9d['newRange']['start']['getShiftedBy'](-_0x76906f),_0x28c94c=_0x5d4c9d['newRange']['end']['getShiftedBy'](_0x59692a);_0x41b575['push']({'start':_0x1d0e10,'end':_0x28c94c,'groupId':_0x2e83a1['id'],'type':'remove-context'});}else _0x46c94a='remove-only';}_0x41b575['push']({'start':_0x5d4c9d['newRange']['start'],'end':_0x5d4c9d['newRange']['end'],'groupId':_0x2e83a1['id'],'type':_0x46c94a});}}}this['_insertMarkers'](_0x41b575,_0x508a1e);}['clearAllMarkers'](){const _0x16e966=new Map();for(const _0x54a579 of this['_markers']['keys']()){const _0x5a092f=this['_markers']['get'](_0x54a579);_0x5a092f?.['editor']&&(_0x16e966['has'](_0x5a092f['editor'])||_0x16e966['set'](_0x5a092f['editor'],[]),_0x16e966['get'](_0x5a092f['editor'])['push'](_0x54a579));}for(const [_0x5292a6,_0xf1eda2]of _0x16e966)_0x5292a6['model']['change'](_0x4b16e5=>{for(const _0x585f41 of _0xf1eda2)_0x5292a6['model']['markers']['get'](_0x585f41)&&_0x4b16e5['removeMarker'](_0x585f41);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x21cb3d of us(this['context']))_0x21cb3d['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x32b144 of us(this['context']))_0x32b144['disableReadOnlyMode']('ai-review');}['applyChange'](_0x562081,_0x33973c=null){const _0xe92b40=_0x562081['map'](_0x170b15=>this['_getMarkersDataForGroup'](_0x170b15))['flat'](),_0x18e797=new Map();for(const _0x5804dd of _0xe92b40)_0x18e797['has'](_0x5804dd['editor'])||_0x18e797['set'](_0x5804dd['editor'],[]),_0x18e797['get'](_0x5804dd['editor'])['push'](_0x5804dd);for(const [_0x40a959,_0x18420f]of _0x18e797){const _0x5302ad=_0x40a959['model'],_0x400e32=_0x40a959['plugins']['has']('TrackChangesEditing')?_0x40a959['plugins']['get']('TrackChangesEditing'):null,_0x138a30=_0x33973c&&_0x400e32?new Set(_0x400e32['getSuggestions']()['map'](_0x1547f6=>_0x1547f6['id'])):null;_0x5302ad['change'](_0x4816ff=>{const _0x7b11e=_0x4816ff['batch']['operations']['length'];for(const _0x53cf22 of _0x18420f){const _0x3a0ceb=_0x40a959['model']['markers']['get'](_0x53cf22['id']);if(_0x3a0ceb){if('insert'===_0x53cf22['type']){if(!_0x53cf22['content'])continue;_0x5302ad['insertContent'](_0x53cf22['content']['asFragment']||null,_0x3a0ceb['getRange']()['start']);}else'remove-text'!==_0x53cf22['type']&&'remove-only'!==_0x53cf22['type']||_0x5302ad['deleteContent'](_0x5302ad['createSelection'](_0x3a0ceb['getRange']()));_0x4816ff['removeMarker'](_0x53cf22['id']),this['_markers']['delete'](_0x53cf22['id']);}}if(_0x33973c&&(js(_0x4816ff['batch']['operations']['slice'](_0x7b11e),_0x33973c),_0x400e32)){for(const _0x16763e of _0x400e32['getSuggestions']())_0x138a30['has'](_0x16763e['id'])||_0x16763e['setAttribute']('@ai',{'type':_0x33973c});}});}}['rejectChange'](_0x1ccb29){const _0x33b5d7=this['_getMarkersDataForGroup'](_0x1ccb29),_0x3b36f3=new Map();for(const _0x3d8ce0 of _0x33b5d7)_0x3b36f3['has'](_0x3d8ce0['editor'])||_0x3b36f3['set'](_0x3d8ce0['editor'],[]),_0x3b36f3['get'](_0x3d8ce0['editor'])['push'](_0x3d8ce0);for(const [_0x2424e1,_0x417d2c]of _0x3b36f3)_0x2424e1['model']['change'](_0x1608e9=>{for(const _0x224042 of _0x417d2c)_0x1608e9['removeMarker'](_0x224042['id']),this['_markers']['delete'](_0x224042['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return us(this['context']);}['getEditorForChange'](_0x59c3e){return this['_getMarkersDataForGroup'](_0x59c3e)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x1adf6a){const _0x50739e=Array['from'](this['_markers']['values']())['filter'](_0x2fd4f3=>_0x2fd4f3['groupId']===_0x1adf6a);if(!_0x50739e['length'])return null;const _0x8a8db5=0x1===_0x50739e['length']?_0x50739e[0x0]:this['_sortMarkers'](_0x50739e)[0x0],_0x7ca58a=_0x8a8db5['editor']['model']['markers']['get'](_0x8a8db5['id']);return _0x7ca58a?{'modelRange':_0x7ca58a['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x8a8db5['id'])}:null;}['getContentElementForChange'](_0x11e3bf){const _0x561e79=Array['from'](this['_markers']['values']())['filter'](_0x3e6673=>_0x3e6673['groupId']===_0x11e3bf);if(!_0x561e79['length'])return null;const _0x129a90=0x1===_0x561e79['length']?_0x561e79[0x0]:this['_sortMarkers'](_0x561e79)[0x0],_0x19f4f4=_0x129a90['editor'],_0x27e378=_0x19f4f4['model']['markers']['get'](_0x129a90['id']);if(!_0x27e378)return null;const _0x142f41=_0x27e378['getRange'](),_0x17e64c=_0x19f4f4['editing']['view']['getDomRoot'](_0x142f41['root']['rootName'])||_0x19f4f4['editing']['view']['getDomRoot']();if(!_0x17e64c||!_0x142f41)return null;let _0x3da0b2=_0x142f41['start']['parent'];for(;_0x3da0b2['parent']&&!_0x3da0b2['parent']['is']('rootElement');)_0x3da0b2=_0x3da0b2['parent'];if(!_0x3da0b2||!_0x3da0b2['name'])return null;const _0x26abb6=_0x17e64c['querySelector']('[data-marker-id=\x22'+_0x129a90['id']+'\x22]');if(!_0x26abb6)return null;let _0x39a1a6=null;_0x19f4f4['model']['change'](_0x554e75=>{_0x39a1a6=_0x554e75['createDocumentFragment'](),_0x554e75['append'](_0x3da0b2['_clone'](!0x0),_0x39a1a6);});const _0x5ab19f=_0x19f4f4['data']['toView'](_0x39a1a6)['getChild'](0x0);return _0x26abb6['closest'](_0x5ab19f['name']);}['reactivateMarkers'](_0x11537e){const _0xa5ae58=this['_getMarkersDataForGroup'](_0x11537e);if(!_0xa5ae58['length'])return;const _0x5df3d2=Array['from'](this['_activeMarkers'])['sort'](),_0x510501=Array['from'](new Set(_0xa5ae58['map'](_0x5052ff=>_0x5052ff['id'])))['sort']();_0x5df3d2['join']('|')!==_0x510501['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x11537e));}['setMarkersInElementAsActive'](_0x580bd0){const _0x2d27f7=this['_getMarkersDataForGroup'](_0x580bd0);if(!_0x2d27f7['length'])return;const _0x590d29=_0x2d27f7[0x0]['editor'],_0x3b617=new Set(_0x2d27f7['map'](_0x29714a=>_0x29714a['id'])),_0x3a5dcb=Array['from'](_0x3b617['values']())['map'](_0x529d78=>_0x590d29['model']['markers']['get'](_0x529d78))['filter'](_0x21994d=>!!_0x21994d);_0x3b617['forEach'](_0x235b7b=>{this['_activeMarkers']['add'](_0x235b7b);}),_0x590d29['model']['change'](()=>{_0x3a5dcb['forEach'](_0x5d3b53=>{_0x590d29['editing']['reconvertMarker'](_0x5d3b53);});});}['setAllMarkersAsInactive'](){const _0x3efa52=Array['from'](this['_activeMarkers']);if(!_0x3efa52['length'])return;this['_activeMarkers']['clear']();const _0x27661f=new Map();for(const _0x14d58c of _0x3efa52){const _0x1976c8=this['_markers']['get'](_0x14d58c);if(!_0x1976c8)continue;const _0x56affb=_0x1976c8['editor'],_0x111e4f=_0x56affb['model']['markers']['get'](_0x14d58c);_0x111e4f&&(_0x27661f['has'](_0x56affb)||_0x27661f['set'](_0x56affb,[]),_0x27661f['get'](_0x56affb)['push'](_0x111e4f));}for(const [_0x30e810,_0x11d6e7]of _0x27661f)_0x30e810['model']['change'](()=>{_0x11d6e7['forEach'](_0x48aa36=>{_0x30e810['editing']['reconvertMarker'](_0x48aa36);});});}['_getPositionLimitingRange'](_0x266509,_0x566d33,_0x52acfa='outside'){if(!_0x266509)return null;let _0x19e378=_0x266509['parent'];for(;_0x19e378&&_0x19e378['parent']&&!_0x19e378['parent']['is']('rootElement')&&!_0x566d33['model']['schema']['isLimit'](_0x19e378)&&!_0x566d33['model']['schema']['isBlock'](_0x19e378);)_0x19e378=_0x19e378['parent'];if(!_0x19e378||!_0x19e378['name']||_0x19e378['is']('rootElement'))return null;let _0x449fcb=null;return _0x566d33['model']['change'](_0x4cc211=>{_0x449fcb='inside'===_0x52acfa?_0x4cc211['createRangeIn'](_0x19e378):_0x4cc211['createRangeOn'](_0x19e378);}),_0x449fcb;}['_validateMarkers'](_0x1f20c7,_0x4ca90f){const _0x5ab410=Array['from'](this['_markers']['keys']()),_0x34ce44=new Map();for(const _0x49131e of _0x5ab410){const _0x4db79e=_0x1f20c7['model']['markers']['get'](_0x49131e);if(!_0x4db79e)continue;const _0x1dd402=_0x4db79e['getStart']()['root']['rootName']+':'+_0x4db79e['getStart']()['path'][0x0];_0x34ce44['has'](_0x1dd402)||_0x34ce44['set'](_0x1dd402,[]),_0x34ce44['get'](_0x1dd402)['push'](_0x4db79e);}const _0x2f576c=new Set();for(const _0x1be190 of _0x1f20c7['model']['document']['differ']['getChanges']()){let _0x41a540='',_0x3e613b=null;if('insert'===_0x1be190['type'])_0x3e613b=new _0x5cca78(_0x1be190['position'],_0x1be190['position']['getShiftedBy'](_0x1be190['length'])),_0x41a540=_0x1be190['position']['root']['rootName']+':'+_0x1be190['position']['path'][0x0];else{if('remove'!==_0x1be190['type'])continue;_0x3e613b=new _0x5cca78(_0x1be190['position']),_0x41a540=_0x1be190['position']['root']['rootName']+':'+_0x1be190['position']['path'][0x0];}const _0x868407=_0x34ce44['get'](_0x41a540)||[];if(_0x868407['length']){for(const _0x1ba3d4 of _0x868407)if(_0x3e613b['root']['rootName']===_0x1ba3d4['getRange']()['root']['rootName']&&('insert'!==_0x1be190['type']||!_0x3e613b['containsRange'](_0x1ba3d4['getRange']()))&&(_0x3e613b['isIntersecting'](_0x1ba3d4['getRange']())||_0x3e613b['start']['isTouching'](_0x1ba3d4['getRange']()['end'])||_0x3e613b['end']['isTouching'](_0x1ba3d4['getRange']()['start']))){const _0x567179=this['_parseMarkerName'](_0x1ba3d4['name']);Array['from'](this['_markers']['values']())['filter'](_0x226145=>_0x226145['groupId']===_0x567179['groupId'])['forEach'](_0x4319f4=>_0x2f576c['add'](_0x4319f4['id']));}}}if(_0x2f576c['size']){for(const _0x3ea71c of _0x2f576c)_0x4ca90f['removeMarker'](_0x3ea71c);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x2a169d){for(const {name:_0x478cf6,data:_0x4f413c}of _0x2a169d['model']['document']['differ']['getChangedMarkers']()){if(!_0x478cf6['startsWith'](rh))continue;const _0x12bd87=_0x4f413c['oldRange'],_0x3273dd=_0x4f413c['newRange'],_0x2666db=_0x12bd87&&'$graveyard'===_0x12bd87['root']['rootName'],_0xcf5d83=_0x3273dd&&'$graveyard'===_0x3273dd['root']['rootName'];if(_0x2666db&&_0xcf5d83)continue;const _0x5616c1=this['_parseMarkerName'](_0x478cf6);this['_markers']['get'](_0x478cf6)&&(_0xcf5d83||!_0x3273dd?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x478cf6,'changeId':_0x5616c1['groupId']}):_0x2666db&&_0x3273dd&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x478cf6,'changeId':_0x5616c1['groupId']}));}}['_parseMarkerName'](_0x5e0224){const _0x1c4676=_0x5e0224['split'](':'),_0x43ecc3=(_0x1c4676[0x1]||'')['split']('_');return{'prefix':_0x1c4676[0x0],'groupId':_0x43ecc3[0x0],'suffix':_0x43ecc3[0x1]};}['_translateOperationToEditorContent'](_0x343a30,_0xeece80,_0x54b32a){if('insert'===_0x343a30['type']){const _0x118ddc=_0x343a30;return new _0x40b89f(this['_changePosition'](_0xeece80['concat'](_0x118ddc['position']['offset']),_0x54b32a),_0x118ddc['nodes'],_0x118ddc['baseVersion']);}if('marker'===_0x343a30['type']&&_0x343a30['name']['startsWith']('$markedRemove')){const _0x33788e=_0x343a30;return new _0x414b93(_0x33788e['name'],_0x33788e['oldRange'],this['_changeRange'](_0x33788e['newRange'],_0xeece80['concat'](_0x33788e['newRange']['start']['offset']),_0xeece80['concat'](_0x33788e['newRange']['end']['offset']),_0x54b32a),_0x33788e['_markers'],_0x33788e['affectsData'],_0x33788e['baseVersion']);}return _0x343a30;}['_groupAdjacentOperations'](_0x3665f9){if(!_0x3665f9['length'])return[];const _0x2924c8=[];let _0x2499df=0x0,_0x2f2d69=0x0,_0x1b5159=[];for(let _0x4ae7c5=0x0;_0x4ae7c5<=_0x3665f9['length'];_0x4ae7c5++){const _0x253da9=_0x3665f9[_0x4ae7c5],_0x18d3ac=_0x3665f9[_0x4ae7c5-0x1];!_0x253da9||_0x18d3ac&&!this['_getOperationEnd'](_0x18d3ac)['isTouching'](this['_getOperationStart'](_0x253da9))?(_0x2924c8['push']({'operations':_0x1b5159,'operationsIsolated':_0x1b5159['map'](_0x2b2da0=>this['_shiftOperation'](_0x2b2da0['clone'](),-_0x2f2d69)),'groupOffset':_0x2499df}),_0x1b5159=_0x253da9?[_0x253da9]:[],_0x2f2d69+=_0x2499df,_0x2499df=0x0):_0x1b5159['push'](_0x253da9),_0x253da9&&'insert'===_0x253da9['type']&&(_0x2499df+=_0x253da9['howMany']);}return _0x2924c8;}['_findAdjacentContextDistance'](_0x3118cd,_0x2db0d3,_0xc24ef1,_0x2a908a=0x1){const _0x503c08=new _0x7bd257({'startPosition':_0x3118cd,'direction':_0x2db0d3});let _0x1a89a6=0x0;for(let _0x3e26dc=0x0;_0x3e26dc<_0x2a908a;_0x3e26dc++){let _0x5afb88=0x0,_0x5bb2ef=!0x1,_0x7ceff0='forward'===_0x2db0d3?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x51d716}of _0x503c08)if(_0x51d716['is']('$textProxy')){const _0x2e0040=_0x7ceff0['exec'](_0x51d716['data']);if(_0x2e0040&&_0x2e0040['length']){if(_0x5afb88+='forward'===_0x2db0d3?_0x2e0040['index']+_0x2e0040[0x0]['length']:_0x51d716['data']['length']-_0x2e0040['index'],_0x2e0040[0x0]['length']!==_0x51d716['data']['length'])break;_0x5bb2ef=!0x0,_0x7ceff0='forward'===_0x2db0d3?/^\w+/:/\w+$/;}else{if(_0x5bb2ef)break;_0x5afb88+=_0x51d716['offsetSize'];}}else{if(_0x51d716['is']('element')){_0xc24ef1['isInline'](_0x51d716)&&!_0x5bb2ef&&(_0x5afb88+=0x1);break;}}_0x1a89a6+=_0x5afb88,_0x503c08['jumpTo'](_0x3118cd['getShiftedBy']('forward'===_0x2db0d3?_0x1a89a6:-_0x1a89a6));}return _0x1a89a6;}['_getChangeContext'](_0xc182d7,_0x1f66a1,_0x42032d){const _0x5011d7=_0x42032d['model']['schema'],_0x1c31fa=this['_findAdjacentContextDistance'](_0xc182d7,'backward',_0x5011d7,0x6),_0xd34329=this['_findAdjacentContextDistance'](_0x1f66a1,'forward',_0x5011d7,0x6),_0x63c804=_0xc182d7['getShiftedBy'](-_0x1c31fa),_0x511e07=_0x1f66a1['getShiftedBy'](_0xd34329);return{'start':_0x63c804,'end':_0x511e07,'hasContentBefore':!_0x63c804['isAtStart'],'hasContentAfter':!_0x511e07['isAtEnd']};}['_insertMarkers'](_0x148b0c,_0x56da4d){const _0x22ac1a=this['context']['plugins']['get']('AIEditing'),_0x4690e8=new Set();_0x56da4d['model']['change'](_0x691ee=>{for(const _0x52b045 of _0x148b0c){const _0x46b5f4=''+rh+_0x52b045['type']+':'+_0x52b045['groupId']+'_'+_0x22ac1a['_nextDataId'](_0x4690e8);this['_markers']['set'](_0x46b5f4,{'id':_0x46b5f4,'groupId':_0x52b045['groupId'],'type':_0x52b045['type'],'content':_0x52b045['content'],'editor':_0x56da4d}),_0x691ee['addMarker'](_0x46b5f4,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x691ee['createRange'](_0x52b045['start'],_0x52b045['end'])});}});}['_createGetContextFn'](_0x283595,_0x17e032,_0x17733a){let _0x536472='';return()=>{if(!_0x536472){const _0x2e6fbe=_0x17e032['toView'](_0x283595,{'showSuggestionHighlights':!0x0});let _0x18b079=_0x2e6fbe['getChild'](0x0);if(_0x18b079['is']('containerElement')||(_0x18b079=_0x2e6fbe),!_0x18b079)return'';let _0x13dc1a=!0x1;const _0x4a77b3=[];for(const _0x211f27 of _0x18b079['getChildren']())_0x211f27['is']('element','span')&&_0x211f27['hasClass']('ck-ai_review-marker_context-end')&&(_0x13dc1a=!0x1),_0x13dc1a&&_0x4a77b3['push'](_0x211f27),_0x211f27['is']('element','span')&&_0x211f27['hasClass']('ck-ai_review-marker_context-start')&&(_0x13dc1a=!0x0);_0x18b079['_removeChildren'](0x0,_0x18b079['childCount']),_0x17733a?.['ellipsisBefore']&&_0x18b079['_appendChild']('…'),_0x18b079['_appendChild'](_0x4a77b3),_0x17733a?.['ellipsisAfter']&&_0x18b079['_appendChild']('…');const _0x2aa023=_0x17e032['htmlProcessor']['domConverter']['viewToDom'](_0x2e6fbe),_0x35f85a=_0x17e032['htmlProcessor']['htmlWriter']['getHtml'](_0x2aa023);_0x536472=this['_removeUnsupportedElements'](_0x35f85a);}return _0x536472;};}['_createGetContentFn'](_0x5459b2,_0x3b72f4){let _0x5bc8fc='';return()=>(_0x5bc8fc||(_0x5bc8fc=this['_removeUnsupportedElements'](_0x3b72f4['stringify'](_0x5459b2,{'showSuggestionHighlights':!0x0}))),_0x5bc8fc);}['_createGetContentUsingDataIdFn'](_0x4824fb,_0x328d3e,_0x2e2ed4){let _0x2d5c0a='';return()=>{if(!_0x2d5c0a){const _0x3cde72=_0x2e2ed4['toView'](new _0xc7ecd7(_0x4824fb));_0x2d5c0a=_0x2e2ed4['htmlProcessor']['domConverter']['viewToDom'](_0x3cde72)['querySelector']('[data-id=\x22'+_0x328d3e+'\x22]')?.['outerHTML']||'';}return _0x2d5c0a;};}['_removeUnsupportedElements'](_0x17a27d){if(!_0x17a27d)return'';const _0x2b461b=Is(_0x17a27d,{'decodeEntities':!0x1}),_0x335b9f=Ts(_0x2b461b);if(!_0x335b9f['length'])return _0x17a27d;for(const _0xa10a0d of _0x335b9f)_0x46f92a(_0xa10a0d);return ps(_0x2b461b,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x3295eb,_0x5a3b5e){const _0xeffa10=Is(_0x3295eb,{'decodeEntities':!0x1}),_0x3c23d1=Is(_0x5a3b5e,{'decodeEntities':!0x1}),_0x252ef8=Ts(_0xeffa10),_0x188805=Ts(_0x3c23d1);if(!_0x252ef8['length']&&!_0x188805['length'])return{'contentInitial':_0x3295eb,'contentNew':_0x5a3b5e};const _0x4cf0fa=new Map();for(const _0x329919 of _0x252ef8)_0x4cf0fa['set'](Cs(_0x329919,'data-id'),_0x329919);for(const _0x1199d5 of _0x188805){const _0x486ef7=Cs(_0x1199d5,'data-id'),_0x502500=_0x486ef7?_0x4cf0fa['get'](_0x486ef7):void 0x0;_0x502500?_0x4cf7f1(_0x1199d5,_0x2c8968(_0x502500,!0x0)):_0x46f92a(_0x1199d5);}return{'contentInitial':ps(_0xeffa10,{'encodeEntities':!0x1}),'contentNew':ps(_0x3c23d1,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x79f15b,_0x37af1d=0x5){let _0x2c0c4e=_0x79f15b,_0x224d87=null;for(let _0x29d766=0x0;_0x29d766<_0x37af1d&&_0x2c0c4e;_0x29d766++)if(_0x2c0c4e['className']){if((''+_0x2c0c4e['className'])['includes']('ck-ai_review-marker_')){if(!_0x2c0c4e['getAttribute']('data-marker-id'))break;_0x224d87=_0x2c0c4e;break;}_0x2c0c4e=_0x2c0c4e['parentElement'];}else _0x2c0c4e=_0x2c0c4e['parentElement'];return _0x224d87;}['_findMarkerElementById'](_0x1d6bc1){const _0x1264fa=this['_markers']['get'](_0x1d6bc1);if(!_0x1264fa)return null;const _0x4ff39=_0x1264fa['editor']['model']['markers']['get'](_0x1d6bc1);return _0x4ff39?_0x178cd1(_0x1264fa['editor']['editing'],_0x4ff39):null;}['_getMarkersDataForGroup'](_0x60a7d8){return Array['from'](this['_markers']['values']())['filter'](_0x4deaf9=>_0x4deaf9['groupId']===_0x60a7d8);}['_getOperationStart'](_0xce39c7){return'insert'===_0xce39c7['type']?_0xce39c7['position']:_0xce39c7['newRange']['start'];}['_getOperationEnd'](_0x6066fb,_0x2bd6bc=!0x1){return'insert'===_0x6066fb['type']?_0x2bd6bc?_0x6066fb['position']:_0x6066fb['position']['getShiftedBy'](_0x6066fb['howMany']):_0x6066fb['newRange']['end'];}['_shiftOperation'](_0x29748d,_0x10fa68){return'insert'===_0x29748d['type']?_0x29748d['position']=_0x29748d['position']['getShiftedBy'](_0x10fa68):'marker'===_0x29748d['type']&&_0x29748d['newRange']&&(_0x29748d['newRange']=new _0x5cca78(_0x29748d['newRange']['start']['getShiftedBy'](_0x10fa68),_0x29748d['newRange']['end']['getShiftedBy'](_0x10fa68))),_0x29748d;}['_changeOperationOwnerDocument'](_0x25163c,_0x190d07){'insert'===_0x25163c['type']?_0x25163c['position']=this['_changePositionOwnerDocument'](_0x25163c['position'],_0x190d07):'marker'===_0x25163c['type']&&_0x25163c['newRange']&&(_0x25163c['newRange']=this['_changeRangeOwnerDocument'](_0x25163c['newRange'],_0x190d07));}['_changePositionOwnerDocument'](_0x1d132b,_0x1b1542){return new _0x4c52aa(_0x1b1542,_0x1d132b['path']);}['_changeRangeOwnerDocument'](_0x10c363,_0x3d3877){return new _0x5cca78(this['_changePositionOwnerDocument'](_0x10c363['start'],_0x3d3877),this['_changePositionOwnerDocument'](_0x10c363['end'],_0x3d3877));}['_changePosition'](_0x3c691d,_0x2ae64b){return new _0x4c52aa(_0x2ae64b,[..._0x3c691d]);}['_changeRange'](_0x63cc4a,_0x8cb585,_0x67b44,_0x5e3492){return new _0x5cca78(this['_changePosition'](_0x8cb585,_0x5e3492),this['_changePosition'](_0x67b44,_0x5e3492));}['_sortMarkers'](_0x463740){const _0x3df692=_0x19f9c9=>{switch(_0x19f9c9){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x463740['sort']((_0x409efd,_0x20e860)=>_0x3df692(_0x409efd['type'])-_0x3df692(_0x20e860['type']));}['_hasSameTopLevelElement'](_0x5ebbb9,_0x32241c){const _0x17def2=_0x5ebbb9['getChild'](0x0),_0x1a0871=_0x32241c['getChild'](0x0);return!(!_0x17def2||!_0x1a0871)&&((!_0x17def2['is']('element')||!_0x1a0871['is']('element')||_0x17def2['name']===_0x1a0871['name'])&&!(_0x17def2['is']('element')&&!_0x1a0871['is']('element')||!_0x17def2['is']('element')&&_0x1a0871['is']('element')));}['_haveSingleTopLevelElement'](_0x5c0dcf){return 0x1===_0x5c0dcf['childCount'];}['_haveOnlyInlineContent'](_0x41847e,_0x1d6a5e){for(const _0x2705ca of _0x41847e['getChildren']())if(_0x2705ca['is']('element')&&!_0x1d6a5e['isInline'](_0x2705ca))return!0x1;return!0x0;}['_upsertDataId'](_0xd2160d,_0x5603ed){let _0x7402d5=_0xd2160d['getAttribute'](_0x32a933);return _0x7402d5||(_0x7402d5=_0x5603ed(),_0xd2160d['_setAttribute'](_0x32a933,_0x7402d5)),_0x7402d5;}};const ch=/* #__PURE__ -- @preserve */
38
- lt();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x29fc3c,contentNew:_0x27ad22,contentInitial:_0x3f10eb,documentVersion:_0x2c6e8d}){super(),this['id']=_0x29fc3c,this['contentNew']=_0x27ad22,this['contentInitial']=_0x3f10eb,this['documentVersion']=_0x2c6e8d;}};const uh=/* #__PURE__ -- @preserve */
39
- _t();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x6f3319,_0x53b887,_0x5bde61){super(),this['id']=_0x6f3319,this['parent']=_0x5bde61,this['_data']=_0x53b887,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
- _t();var gh=class extends _h{['id']=Ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x3f5c59,_0x21b0ec,_0x48e965,_0x58b665,_0x306104){super(),this['_sourceCheck']=_0x21b0ec,this['_documentData']=_0x3f5c59,this['_aiConnector']=_0x48e965,this['_reviewParams']=_0x58b665,this['_reviewArgs']=_0x306104,this['on']('change:status',(_0x3e876a,_0x46ae00,_0x3e7b92)=>{'aborted'==_0x3e7b92&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x3e7b92,'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'](_0x346abb=>'pending'===_0x346abb['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x5993c6){this['_documentData']=_0x5993c6;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x557a46=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0xe51603 of _0x557a46)'unmodified'!==_0xe51603['data']['operation']&&('error'!==_0xe51603['data']['operation']?'review-metadata'!==_0xe51603['event']?this['_addReviewCheckResult'](_0xe51603['data']['dataId'],_0xe51603['data']['textDelta']):this['callId']=_0xe51603['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(_0x41822f){this['_currentError']=_0x41822f,sn(_0x41822f)?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'](_0x2edc6d,_0x39db2b){const _0x5d60de=this['_results']['get'](_0x2edc6d);if(!_0x5d60de)return;if(0x0===_0x39db2b['length'])return;const _0x141031=[];_0x39db2b['forEach']((_0x5514dc,_0x13663c)=>{const _0x189cca=new dh(_0x5d60de['id']+'-'+_0x13663c,_0x5514dc,_0x5d60de);_0x189cca['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x189cca,'status':_0x189cca['status']});}),_0x189cca['on']('change:isActivated',()=>{_0x189cca['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x189cca}):this['fire']('reviewCheckResultDeactivated',{'change':_0x189cca});}),this['_changes']['push'](_0x189cca),_0x141031['push'](_0x189cca);}),this['fire']('reviewCheckResultReady',{'changes':_0x141031,'result':_0x5d60de,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x165819){const _0x542bba=this['_changes']['find'](_0x51cac2=>_0x51cac2['id']===_0x165819);return!(!_0x542bba||'pending'!==_0x542bba['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x5bf4e4=>!0x0===_0x5bf4e4['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x5c1efe=>'pending'===_0x5c1efe['status']);}['getChangeById'](_0x11a673){return this['_changes']['find'](_0x1371a1=>_0x1371a1['id']===_0x11a673);}['markAllChangesAsAccepted'](){for(const _0x4e326d of this['_changes'])'pending'===_0x4e326d['status']&&(_0x4e326d['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x119da3){const _0x46b0a4=this['_changes']['find'](_0x1129fc=>_0x1129fc['id']===_0x119da3);_0x46b0a4&&'pending'===_0x46b0a4['status']&&(_0x46b0a4['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x2822d8){const _0x400265=this['_changes']['find'](_0x5051d2=>_0x5051d2['id']===_0x2822d8);_0x400265&&'pending'===_0x400265['status']&&(_0x400265['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x30be1c){const _0x583094=this['_changes']['find'](_0x1e493e=>_0x1e493e['id']===_0x30be1c);_0x583094&&'pending'===_0x583094['status']&&(_0x583094['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x5f167e){const _0x165063=this['_changes']['find'](_0x2d88aa=>_0x2d88aa['id']===_0x5f167e);_0x165063&&'outdated'===_0x165063['status']&&(_0x165063['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x376391){this['_changes']['filter'](_0x37f14a=>_0x37f14a['isActivated']&&_0x37f14a['id']!==_0x376391)['forEach'](_0x4c75f9=>{_0x4c75f9['isActivated']=!0x1;});const _0x3c74b6=this['_changes']['find'](_0x46df78=>_0x46df78['id']===_0x376391);_0x3c74b6&&'pending'===_0x3c74b6['status']&&(_0x3c74b6['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0xb6d5c8=>_0xb6d5c8['isActivated'])['forEach'](_0x58d15c=>{_0x58d15c['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x3ae38f){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x5e8df0;if(_0x3ae38f){const _0x41cf7e=this['_changes']['find'](_0x3ae124=>_0x3ae124['id']===_0x3ae38f);if(_0x41cf7e&&_0x41cf7e['isRated'])return;_0x41cf7e&&(_0x5e8df0=_0x41cf7e['parent']['id'],_0x41cf7e['isRated']=!0x0);}const _0x38a5a8={'positiveCount':this['_changes']['filter'](_0x1fc122=>'accepted'===_0x1fc122['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x38a5a8,this['callId'],_0x5e8df0);}['_addReviewCheckResult'](_0x37dd65,_0xcd4395){const _0x3b6388=this['_documentData']['elements']['get'](_0x37dd65);if(!_0x3b6388)return;const _0xfb0f7f=_0x3b6388['getContent']();if(_0xfb0f7f===_0xcd4395)return;const _0xc7c223=new lh({'id':_0x37dd65,'contentInitial':_0xfb0f7f,'contentNew':_0xcd4395,'documentVersion':_0x3b6388['documentVersion']});this['_results']['set'](_0xc7c223['id'],_0xc7c223),this['fire']('reviewCheckResultAdded',{'result':_0xc7c223,'source':this,'editor':_0x3b6388['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0xe9e995=>'pending'===_0xe9e995['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x4e6f2a=>'pending'===_0x4e6f2a['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2a2212=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x294c19=0x0;_0x294c19<this['_reviewParams']['length'];_0x294c19++){if(!this['_reviewParams'][_0x294c19]||!this['_sourceCheck']['options'][_0x294c19])continue;const _0x2e3ec0=this['_sourceCheck']['options'][_0x294c19]['data']?.['find'](_0x2a785d=>_0x2a785d['id']===this['_reviewParams'][_0x294c19]);_0x2e3ec0&&_0x2a2212['push'](_0x2e3ec0['label']);}return _0x2a2212['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x48e863,_0x21f29f,_0x38be0d){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x21f29f,_0x48e863,_0x38be0d);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x3abc0e{['_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',(_0x2fffef,_0x2e90fb)=>this['runCheck'](_0x2e90fb)),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 _0x1e426c=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x1e426c['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x1e426c['map'](_0x5dffcb=>_0x5dffcb['id']),this['_aiSource']);const _0x15d1ae=this['_currentReviewCheckRun'];_0x15d1ae['markAllChangesAsAccepted'](),_0x15d1ae['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x45be69,_0x1da1d5)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x1da1d5['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x1da1d5['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x1da1d5['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x1da1d5['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x2db728,_0x51a926)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x51a926['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x51a926['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x51a926['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x51a926['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',(_0x2f0f8f,_0x5569c9)=>{this['_onActivateChange'](_0x5569c9);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x497d2f,_0x3959db)=>{this['_onDeactivateChange'](_0x3959db);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x5e93cc,_0x1d285d)=>{this['_onChangeMarkerClicked'](_0x5e93cc,_0x1d285d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x4cfddb,_0xdd64cb)=>{this['_onChangeMarkerHovered'](_0x4cfddb,_0xdd64cb);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x1b8cc3,_0x38f39b)=>{this['_onChangeMarkerRemoved'](_0x1b8cc3,_0x38f39b);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x9dcd2b,_0x48f435)=>{this['_onChangeMarkerRestored'](_0x9dcd2b,_0x48f435);});}async['runCheck'](_0x156191){if(!this['_availableReviewChecks'])return;const _0x2315c8=this['_availableReviewChecks']['find'](_0x5c5188=>_0x5c5188['id']===_0x156191['id']);if(_0x2315c8){this['_onReviewCheckRun'](_0x156191),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x156191,_0x2315c8),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x3ef9e2,_0x21d2ff)=>{switch(_0x21d2ff['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x21d2ff);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 at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('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'!==_0x21d2ff['status']&&'error-chunk'!==_0x21d2ff['status']&&'error-general'!==_0x21d2ff['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x185ded,_0x2d0b20)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x5c7907=this['_diffContent'](_0x2d0b20['editor'],_0x2d0b20['result']['contentInitial'],_0x2d0b20['result']['contentNew']);_0x2d0b20['source']['addResultChanges'](_0x2d0b20['result']['id'],_0x5c7907);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x397ef6,_0x312baa)=>{for(const _0x171619 of _0x312baa['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x171619);this['_markChangePositionInEditorContent'](_0x312baa['changes'],_0x312baa['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x4287f5,_0x26cf75)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x26cf75['change']['id'],_0x26cf75['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0xd7b14d,_0x4aff22)=>{this['_onReviewCheckResultActivated'](_0x4aff22);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x3a8604){if(sn(_0x3a8604))return;_0x3a8604 instanceof at?this['_logError'](_0x3a8604):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x3a8604));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x156191['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0xa1647,_0x1ff30d){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1ff30d,this['_aiConnector'],_0xa1647['params'],_0xa1647['args']);}['_onChangeMarkerRemoved'](_0x48feac,_0x69353e){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x69353e['changeId']);}['_onChangeMarkerRestored'](_0x551070,_0x3cd333){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x3cd333['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x1571f4=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x1571f4&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2b3f68 of this['_aiReviewCoreEditing']['getEditors']())_0x2b3f68['editing']['view']['change'](_0x2ebece=>{for(const _0x8a763f of _0x2b3f68['editing']['view']['document']['getRoots']())_0x2ebece['removeClass']('ck-ai_review-diff',_0x8a763f),_0x2ebece['removeClass']('ck-ai_review-highlights',_0x8a763f),_0x2ebece['removeClass']('ck-ai-translate-mode-content',_0x8a763f);});}['_logError'](_0x1333d7){this['_reporter']['logError'](_0x1333d7),'ai-review-mode-models-unable-to-retrieve'===function(_0xb04868){return _0xb04868 instanceof nn?_0xb04868['code']:_0xb04868 instanceof Error?_0xb04868['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x1333d7)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x274261){if('content'===this['_changeActivationSource']){const _0x1227ef=this['_aiReviewCoreUi']['getChangeElement'](_0x274261);_0x1227ef&&bt(_0x1227ef['closest']('.ck-ai_review__check-run-result')||_0x1227ef);}else{if('panel'===this['_changeActivationSource']){const _0x3df736=this['_getChangeContentElement'](_0x274261);if(!_0x3df736)return;St({'target':_0x3df736,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x514ccf,_0x41a2c5,_0xfd3a0d,_0x3593a6,_0x3ad4e5){super(_0xfd3a0d,_0x3593a6,_0x3ad4e5),this['_prompt']=_0x514ccf,this['_model']=_0x41a2c5;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x53efef,_0x34c7f4,_0x307dd6){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x34c7f4,_0x53efef,_0x307dd6);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x36a650){this['id']=_0x36a650['id'],this['commandId']=_0x36a650['commandId'],this['title']=_0x36a650['title'],this['description']=_0x36a650['description'],this['isParameterized']=_0x36a650['isParameterized'],this['useArgs']=_0x36a650['useArgs'],this['options']=_0x36a650['options'],this['args']=_0x36a650['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x12a910,_0x9778d1,_0x252e3a){super(_0x12a910),this['prompt']=_0x12a910['prompt'],this['model']=_0x12a910['model'],this['model']?this['_defaultModel']=_0x9778d1['find'](_0x3bb93c=>_0x3bb93c['id']===this['model'])||null:this['_defaultModel']=_0x252e3a;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x21d65f){this['_prompt']=_0x21d65f;}set['model'](_0x3a3916){this['_model']=_0x3a3916;}},wh=class extends _0x3abc0e{static get['requires'](){return[cs,rn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](rn)['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
- _t();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x1aafa4){this['_checks']=_0x1aafa4['map'](_0x384693=>new mh(_0x384693));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x3a83e2){return this['checks']['find'](_0x404f98=>_0x404f98['id']===_0x3a83e2);}['removeCheckById'](_0x3e7fd0){this['_checks']=this['_checks']['filter'](_0x1098f0=>_0x1098f0['id']!==_0x3e7fd0);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x393c52,_0x2bde00,_0x1ca0dc){super(_0x393c52),this['_models']=_0x2bde00,this['_defaultModel']=_0x1ca0dc;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x48cc3b,_0x20e7a,_0x3b0698){super(),this['_allModels']=_0x48cc3b,this['_recommendedModels']=_0x20e7a,this['_defaultModel']=_0x3b0698;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x5e980b){this['_checks']=_0x5e980b['map'](_0x39997e=>!0x0===_0x39997e['isExtra']?new Eh(_0x39997e,this['_allModels'],this['_defaultModel']):'custom'===_0x39997e['id']?new Sh(_0x39997e,this['_recommendedModels'],this['_defaultModel']):new mh(_0x39997e));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x53e110){super(_0x53e110),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x1b9add=>({'id':_0x1b9add['id'],'commandId':_0x1b9add['id'],'title':_0x1b9add['label'],'description':_0x1b9add['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x1b9add['prompt'],'model':_0x1b9add['model']}));}async['_loadChecksList'](){const _0x703884=[...Ch,...this['getExtraChecks']()]['map'](_0x2ce812=>_0x2ce812['isExtra']?_0x2ce812:this['_translateReviewCheck'](_0x2ce812)),_0x3fa474=await this['_getModels'](),_0x10527a=new Rh(_0x3fa474['all'],_0x3fa474['recommended'],_0x3fa474['default']);return _0x10527a['setupChecks'](_0x703884),_0x10527a;}async['_getModels'](){const _0x1fe1f0=this['context']['plugins']['get']('AIConnector');try{const _0x3c9bc9=new Xs({'connector':_0x1fe1f0,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x318419={'all':await _0x3c9bc9['getAll'](),'recommended':await _0x3c9bc9['getAvailableModels'](),'default':await _0x3c9bc9['getDefault']()};return this['_modelsLoadError']=null,_0x318419;}catch(_0x29092e){return this['_modelsLoadError']=new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x29092e),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x4a68d1){const _0x567197='AI_REVIEW_CHECK_'+_0x4a68d1['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x1c178a={..._0x4a68d1,'title':this['_translate'](_0x567197+'_TITLE',_0x4a68d1['title']),'description':this['_translate'](_0x567197+'_DESCRIPTION',_0x4a68d1['description'])};return _0x4a68d1['options']&&(_0x1c178a['options']=_0x4a68d1['options']['map'](_0x26685b=>({..._0x26685b,'label':this['_translate'](_0x567197+'_OPTIONS_LABEL',_0x26685b['label']||''),'data':_0x26685b['data']?_0x26685b['data']['map'](_0x393354=>({..._0x393354,'label':this['_translate'](_0x567197+'_OPTIONS_DATA_'+_0x393354['id']['toUpperCase'](),_0x393354['label'])})):void 0x0}))),_0x1c178a;}['_translate'](_0x475687,_0x1ba76b){const _0x469052=ls(this['context']['locale'],_0x475687);return _0x469052===_0x475687?_0x1ba76b:_0x469052;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[rn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x4ebc6b){super(_0x4ebc6b),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x45ba3f=>_0x45ba3f['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x454a24,_0x23fc17)=>{this['_isDiffOn']=_0x23fc17['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x25ea79,_0x34d1ac){if(_0x25ea79['isCustom'])return new ph(_0x25ea79['args']['prompt'],_0x25ea79['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x34d1ac,this['_aiConnector']);if(_0x34d1ac['isExtra']){const _0x143b2d=_0x34d1ac;return new Th(_0x25ea79['args']?.['prompt']??_0x143b2d['prompt'],_0x25ea79['args']?.['model']??_0x143b2d['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x34d1ac,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x34d1ac,this['_aiConnector'],_0x25ea79['params'],_0x25ea79['args']);}['_onReviewCheckResultActivated'](_0x529a1f){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x529a1f['change']['id']),this['_scrollToChange'](_0x529a1f['change']['id']);const _0x1733e3=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x529a1f['change']['id']);if(!_0x1733e3)return;const _0x54f814=this['_aiReviewCoreEditing']['getEditorForChange'](_0x529a1f['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x529a1f['change'],()=>_0x1733e3['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x54f814,_0x1733e3['modelRange']['root']['rootName']),_0x54f814?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x529a1f['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x5a6ec8){this['_currentReviewCheckRun']&&'click'===_0x5a6ec8['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5a6ec8['id']));}['_onDeactivateChange'](_0x43ae69){this['_currentReviewCheckRun']&&'balloon'===_0x43ae69['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3c4958,_0x156285){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x156285['changeId']);const _0x70fee1=this['_currentReviewCheckRun']['getChangeById'](_0x156285['changeId']);if(!_0x70fee1)return;const _0x3d5f10=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x156285['changeId']),_0x366376=this['_aiReviewCoreEditing']['getEditorForChange'](_0x156285['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x70fee1,_0x156285['markerElement'],_0x156285['domEvent'],'click',this['_getBalloonDomRoot'](_0x366376,_0x3d5f10?.['modelRange']['root']['rootName']),_0x366376?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x327f35,_0x3e0208){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x118777=this['_currentReviewCheckRun']['getChangeById'](_0x3e0208['changeId']);if(!_0x118777)return;const _0x4197e2=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3e0208['changeId']),_0x39d71d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3e0208['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x118777,_0x3e0208['markerElement'],_0x3e0208['domEvent'],'hover',this['_getBalloonDomRoot'](_0x39d71d,_0x4197e2?.['modelRange']['root']['rootName']),_0x39d71d?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x3fbc03){const _0x5a2faa=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3fbc03);return _0x5a2faa?_0x5a2faa['getElement']():null;}['_markChangePositionInEditorContent'](_0x5ced01,_0x52ac39){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x5ced01,_0x52ac39);}['_diffContent'](_0x533b6e,_0x4ec51a,_0x5895fb){return this['_aiReviewCoreEditing']['diffContent'](_0x533b6e,_0x4ec51a,_0x5895fb,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x31b5dc){_0x31b5dc?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x1690b8 of this['_aiReviewCoreEditing']['getEditors']())_0x1690b8['editing']['view']['change'](_0x35c285=>{for(const _0x97604 of _0x1690b8['editing']['view']['document']['getRoots']()){for(const _0x3f3d77 of _0x97604['getClassNames']())_0x3f3d77['startsWith']('ck-ai_review-')&&_0x35c285['removeClass'](_0x3f3d77,_0x97604);_0x35c285['addClass'](_0x31b5dc?'ck-ai_review-diff':'ck-ai_review-highlights',_0x97604);}});}['_getBalloonDomRoot'](_0xa7a7ea,_0x490742){const _0x1e745a=_0xa7a7ea['editing']['view'];if(_0x490742){const _0x483290=_0x1e745a['getDomRoot'](_0x490742);if(_0x483290)return _0x483290;}return _0x1e745a['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x112ff4=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x8a9947=await _0x112ff4['getChecksList']();_0x112ff4['modelsLoadError']&&this['_logError'](_0x112ff4['modelsLoadError']);let _0x20e7d4=_0x8a9947['checks'];const _0x3c0840=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x3c0840,_0x20e7d4),this['_usesAvailableCommandsConfig']&&(_0x20e7d4=_0x3c0840['map'](_0x319259=>_0x20e7d4['find'](_0x41c5fe=>_0x41c5fe['id']===_0x319259))['filter'](_0x5226de=>!!_0x5226de)),this['_filterChecksWithMissingModel'](_0x20e7d4);}['_logWarningForNonExistentChecks'](_0x40f0a9,_0x15ced9){const _0x3596c4=_0x40f0a9['filter'](_0x233ddd=>!_0x15ced9['some'](_0x35f8f8=>_0x35f8f8['id']===_0x233ddd));_0x3596c4['length']&&this['_reporter']['logError'](new nn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x3596c4['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x41a1a3){const _0x44dc24=[];return _0x41a1a3['forEach'](_0x1a75bc=>{(_0x1a75bc instanceof Eh&&!_0x1a75bc['defaultModel']||_0x1a75bc instanceof Sh&&!_0x1a75bc['models']['length'])&&_0x44dc24['push'](_0x1a75bc['id']);}),_0x44dc24['length']&&_0x44dc24['forEach'](_0x66762b=>{_0x41a1a3=_0x41a1a3['filter'](_0x602513=>_0x602513['id']!==_0x66762b),this['_reporter']['logError'](new nn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x66762b}}));}),_0x41a1a3;}};function kh(_0xa706fe,_0x139988,_0x3520bf,_0x3f1b31){return _0xa706fe instanceof at?_0xa706fe:new at(_0x139988,_0x3520bf,_0x3f1b31,_0xa706fe);}var Nh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x4808d2){this['_affectedBlocks']=_0x4808d2;}},yh=class extends _0x3abc0e{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0xad01f4=>{const _0x2c6694={'id':_0xad01f4['id'],'title':_0xad01f4['title'],'description':_0xad01f4['description']};return'custom'!==_0xad01f4['id']&&_0xad01f4['options']?.['length']&&(_0x2c6694['parameters']=_0xad01f4['options'][0x0]['data']['map'](_0x508230=>({..._0x508230}))),_0x2c6694;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x324ac8,_0x5cdd7e){return await this['_runReviewCheck'](_0x324ac8,()=>this['_createReviewCheckRun'](_0x324ac8,_0x5cdd7e?.['parameterId']),_0x5cdd7e?.['signal']);}async['runCustomReview'](_0x290fee,_0x3db77c){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x290fee,_0x3db77c?.['model']),_0x3db77c?.['signal']);}['applyReview'](_0x511b07,_0x26456){this['context']['plugins']['get']('AIGateway')['apply'](_0x511b07,{'applyMethod':_0x26456,'aiSource':'review'});}async['_runReviewCheck'](_0x593e49,_0xeb56d6,_0x21d825){const _0x31807a=ds(this['context']),_0x2122d6=new Nh({'editor':_0x31807a,'rootName':_0x31807a['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x31807a['plugins']['get']('AIEditing')['getSessionId'](_0x31807a)});let _0x150780,_0x5e3529;if(_0x21d825){if(_0x21d825['aborted'])return _0x2122d6['abort'](),_0x2122d6;const _0x54a149=()=>{_0x2122d6['error']||(_0x2122d6['abort'](),_0x150780&&_0x150780['abort']());};_0x21d825['addEventListener']('abort',_0x54a149),_0x5e3529=()=>_0x21d825['removeEventListener']('abort',_0x54a149);}try{_0x150780=await _0xeb56d6(),_0x2122d6['contentRawOld']=_0x150780['documentData']['content'],_0x2122d6['documentVersion']=Array['from'](_0x150780['documentData']['elements'])['find'](([,_0x1d7a3e])=>_0x1d7a3e['rootName']===_0x2122d6['rootName'])?.[0x1]['documentVersion']??0x1,_0x150780['on']('reviewCheckRunUpdated',(_0x5c9d89,_0x571e8e)=>{'aborted'===_0x571e8e['status']?_0x2122d6['abort']():'error-general'!==_0x571e8e['status']&&'error-chunk'!==_0x571e8e['status']||(_0x2122d6['error']=kh(_0x571e8e['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x593e49}));}),'aborted'!==_0x2122d6['status']&&await _0x150780['start']();}catch(_0x31ba38){_0x2122d6['error']=kh(_0x31ba38,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x593e49});}finally{_0x5e3529&&_0x5e3529();}if(!_0x150780||'aborted'===_0x2122d6['status']||'error'===_0x2122d6['status'])return _0x2122d6;_0x2122d6['affectedBlocks']=_0x150780['results']['map'](_0x32b6d1=>({'id':_0x32b6d1['id'],'content':_0x32b6d1['contentNew']}));try{_0x2122d6['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x2122d6['affectedBlocks'],_0x2122d6['contentRawOld'],_0x2122d6['editor']));}catch(_0x63511f){_0x2122d6['error']=kh(_0x63511f,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x593e49});}return _0x2122d6;}async['_createReviewCheckRun'](_0x5e6898,_0x4030d8){const _0x10989c=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x3f2ced=>_0x3f2ced['id']===_0x5e6898);if(!_0x10989c)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x5e6898});if(_0x10989c instanceof Sh)throw new at('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x5e6898});const _0x468147=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2585a2=this['context']['plugins']['get']('AIConnector');if(_0x10989c instanceof Eh){if(!_0x10989c['defaultModel']?.['id'])throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x5e6898});return new Th(_0x10989c['prompt'],_0x10989c['defaultModel']['id'],_0x468147,_0x10989c,_0x2585a2);}return new Ah(_0x468147,_0x10989c,_0x2585a2,_0x4030d8?[_0x4030d8]:void 0x0);}async['_createCustomReviewCheckRun'](_0x997111,_0x29d8bd,_0x6ea5f1){const _0x1aa8e9=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x34f4f2=>_0x34f4f2['id']===_0x997111);if(!_0x1aa8e9)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x997111});if(!(_0x1aa8e9 instanceof Sh))throw new at('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x997111});const _0x5926d2=_0x6ea5f1??_0x1aa8e9['defaultModel']?.['id'];if(!_0x29d8bd)throw new at('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x997111});if(!_0x5926d2)throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x997111});return new ph(_0x29d8bd,_0x5926d2,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1aa8e9,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x3abc0e{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'](_0x5f4a84,_0x4694c0){if(this['assertStartReviewPreconditions'](_0x5f4a84)instanceof Sh)throw new at('ai-reviewmode-not-a-system-command',this,{'commandId':_0x5f4a84});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x5f4a84,'params':_0x4694c0?.['parameterId']?[_0x4694c0['parameterId']]:void 0x0});}async['startCustomReview'](_0xc2052b,_0x358764){if(!_0xc2052b)throw new at('ai-reviewmode-missing-custom-command-prompt',this);const _0x42a7c4=Ch['find'](_0x5e1355=>'custom'===_0x5e1355['commandId'])['id'],_0x5c7f8b=this['assertStartReviewPreconditions'](_0x42a7c4),_0x275035=_0x358764?.['model']??_0x5c7f8b['defaultModel']?.['id'];if(!_0x275035)throw new at('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x42a7c4,'isCustom':!0x0,'args':{'prompt':_0xc2052b,'model':_0x275035}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x21b9b8=>{const _0x42de7a={'id':_0x21b9b8['id'],'title':_0x21b9b8['title'],'description':_0x21b9b8['description']};return'custom'!==_0x21b9b8['id']&&_0x21b9b8['options']?.['length']&&(_0x42de7a['parameters']=_0x21b9b8['options'][0x0]['data']['map'](_0x11e1f2=>({..._0x11e1f2}))),_0x42de7a;});}['assertStartReviewPreconditions'](_0x463c95){const _0x38fd0f=this['context']['plugins']['get']('AIReviewModeController');if(_0x38fd0f['getCurrentCheckRun']())throw new at('ai-reviewmode-review-already-running',this);const _0x3d6b16=_0x38fd0f['getAvailableChecks']()['find'](_0x5a1ec0=>_0x5a1ec0['id']===_0x463c95);if(!_0x3d6b16)throw new at('ai-reviewmode-unknown-command',this,{'commandId':_0x463c95});return _0x3d6b16;}},Lh=class extends Ah{['_title'];constructor(_0x2bf896,_0x4a4e1b,_0x2b8b12,_0x1a024e,_0x32dff5,_0x5e27fb){super(_0x2bf896,_0x4a4e1b,_0x2b8b12,_0x32dff5,_0x5e27fb),this['_title']=_0x1a024e;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x52e9d8){this['_checks']=_0x52e9d8['map'](_0x3633c0=>new Dh(_0x3633c0));}};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(_0x22f9dd){super(_0x22f9dd),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x4f3319=[],_0x534f89=this['context']['config']['get']('ai.translate.languages')||[];for(const _0xc9ae23 of _0x534f89)_0x4f3319['push']({'title':_0xc9ae23['label'],'id':_0xc9ae23['id'],'commandId':_0xc9ae23['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0xc9ae23['id']}});const _0x5c573b=new Ph();return _0x5c573b['setupChecks'](this['_translateChecks'](_0x4f3319)),_0x5c573b;}['_translateChecks'](_0x11bc62){const _0x1256b5=this['context']['locale'];return _0x11bc62['map'](_0x227336=>{const _0x34c8eb='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x227336['title']['toUpperCase']()['replaceAll']('-','_'),_0x3ea3f2=ls(_0x1256b5,_0x34c8eb);return{..._0x227336,'title':_0x3ea3f2===_0x34c8eb?_0x227336['title']:_0x3ea3f2};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[rn,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'](_0x3b79f7,_0x3c1d11){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x3c1d11,this['_aiConnector'],ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x3b79f7['params'],_0x3b79f7['args']);}['_onReviewCheckResultActivated'](_0x699b55){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x699b55['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x699b55['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x4d3169){this['_currentReviewCheckRun']&&('hover'===_0x4d3169['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4d3169['id'])),'click'===_0x4d3169['uiInteraction']&&this['_scrollToChange'](_0x4d3169['id']));}['_onDeactivateChange'](_0x5a1a8e){this['_currentReviewCheckRun']&&'panel'===_0x5a1a8e['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x19dc4c,_0x55c39d){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x55c39d['changeId']),this['_scrollToChange'](_0x55c39d['changeId']));}['_onChangeMarkerHovered'](_0x1fa7cb,_0x42fe5a){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x42fe5a['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x42fe5a['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x47bb28){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x47bb28);}['_markChangePositionInEditorContent'](_0x537e62,_0x59e6be){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x537e62,_0x59e6be);}['_diffContent'](_0x46e655,_0x59925a,_0x4420fa){return this['_aiReviewCoreEditing']['diffContent'](_0x46e655,_0x59925a,_0x4420fa,!0x0);}['_onReviewCheckRun'](){for(const _0x3e8874 of this['_aiReviewCoreEditing']['getEditors']())_0x3e8874['editing']['view']['change'](_0x522ebf=>{for(const _0x48b241 of _0x3e8874['editing']['view']['document']['getRoots']())_0x522ebf['addClass']('ck-ai-translate-mode-content',_0x48b241);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x524263,_0x2b5d2a){super(_0x524263,_0x2b5d2a),this['on']('set:isLoading',(_0x53a25c,_0x53e2de,_0x55da8c)=>{_0x55da8c&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x47ff14,_0x345d5d,_0x385f45)=>{_0x385f45&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x5eaa76=super['_createAcceptAllButtonView']();return _0x5eaa76['set']('label',ls(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x5eaa76;}['_createExitReviewButtonView'](){const _0x38cc9d=super['_createExitReviewButtonView']();return _0x38cc9d['set']('label',ls(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x38cc9d;}},Bh=class extends sh{['_setupTemplate'](){const _0x1a77bb=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x1a77bb['if']('isVisible','ck-hidden',_0x133cc1=>!_0x133cc1)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1a77bb['if']('isVisible','ck-hidden',_0x1b6942=>!_0x1b6942)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x285409=this['context']['plugins']['get']('AITabs'),_0x52264f=this['context']['locale'],_0x3a8fed=new Ho(_0x52264f,{'label':ls(_0x52264f,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x3de69e,'class':'ck-ai-header_review-translate','showResizeButton':_0x285409['showResizeButton']});_0x3a8fed['delegate']('resizeTabs')['to'](_0x285409),_0x3a8fed['bind']('isMaximized')['to'](_0x285409['view'],'isMaximized',_0x1bc783=>_0x1bc783);const _0x4a0c30=new $a(_0x52264f,{'header':_0x3a8fed,'list':new Bh(_0x52264f),'results':new Uh(_0x52264f,{'generalErrorText':ls(_0x52264f,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x52264f,{'headerText':ls(_0x52264f,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':ls(_0x52264f,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x52264f,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x4a0c30['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x4a0c30;}['registerTab'](){const _0x512f86=this['context']['plugins']['get']('AITabs');_0x512f86['view']['on']('activateTab',(_0x87c66b,{newTab:_0x1d0857,oldTab:_0x2a104e})=>{'translate'===_0x1d0857?this['fire']('getReviewCheckList'):'translate'===_0x2a104e&&this['fire']('leaveReview');}),_0x512f86['view']['addTab']({'id':'translate','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x3de69e,'order':0x0,'content':this['_mainView']});}},Fh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x5ec615){this['_affectedBlocks']=_0x5ec615;}},Kh=class extends _0x3abc0e{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x5e2586,_0x5c81a9){return await this['_runTranslateCheck'](_0x5e2586,()=>this['_createTranslateCheckRun'](_0x5e2586),_0x5c81a9?.['signal']);}['applyTranslate'](_0x482b53,_0x23df3e){this['context']['plugins']['get']('AIGateway')['apply'](_0x482b53,_0x23df3e);}async['_runTranslateCheck'](_0x5603e5,_0x2081d6,_0x121ff9){const _0x480d7d=ds(this['context']),_0x321112=new Fh({'editor':_0x480d7d,'rootName':_0x480d7d['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x480d7d['plugins']['get']('AIEditing')['getSessionId'](_0x480d7d)});let _0x5e214e,_0x16ade6;if(_0x121ff9){if(_0x121ff9['aborted'])return _0x321112['abort'](),_0x321112;const _0x4ac1a1=()=>{_0x321112['error']||(_0x321112['abort'](),_0x5e214e&&_0x5e214e['abort']());};_0x121ff9['addEventListener']('abort',_0x4ac1a1),_0x16ade6=()=>_0x121ff9['removeEventListener']('abort',_0x4ac1a1);}try{_0x5e214e=await _0x2081d6(),_0x321112['contentRawOld']=_0x5e214e['documentData']['content'],_0x321112['documentVersion']=Array['from'](_0x5e214e['documentData']['elements'])['find'](([,_0xeb4784])=>_0xeb4784['rootName']===_0x321112['rootName'])?.[0x1]['documentVersion']??0x1,_0x5e214e['on']('reviewCheckRunUpdated',(_0x241997,_0x2f2ef0)=>{'aborted'===_0x2f2ef0['status']?_0x321112['abort']():'error-general'!==_0x2f2ef0['status']&&'error-chunk'!==_0x2f2ef0['status']||(_0x321112['error']=kh(_0x2f2ef0['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x5603e5}));}),'aborted'!==_0x321112['status']&&await _0x5e214e['start']();}catch(_0x36b39f){_0x321112['error']=kh(_0x36b39f,'ai-translategateway-translation-run-failed',this,{'language':_0x5603e5});}finally{_0x16ade6&&_0x16ade6();}if(!_0x5e214e||'aborted'===_0x321112['status']||'error'===_0x321112['status'])return _0x321112;_0x321112['affectedBlocks']=_0x5e214e['results']['map'](_0x204341=>({'id':_0x204341['id'],'content':_0x204341['contentNew']}));try{_0x321112['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x321112['affectedBlocks'],_0x321112['contentRawOld'],_0x321112['editor']));}catch(_0x54c88f){_0x321112['error']=kh(_0x54c88f,'ai-translategateway-translation-run-failed',this,{'language':_0x5603e5});}return _0x321112;}async['_createTranslateCheckRun'](_0x1ffcc9){const _0x61dd56=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x4c2e34=this['context']['plugins']['get']('AIConnector');return new Lh(_0x61dd56,new Dh({'id':_0x1ffcc9,'commandId':_0x1ffcc9,'title':_0x1ffcc9,'description':'','isParameterized':!0x1}),_0x4c2e34,ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x1ffcc9});}},Wh=class extends _0x3abc0e{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'](_0x4e6874){const _0x3c244f=this['assertStartTranslatePreconditions'](_0x4e6874);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x3c244f['id'],'args':_0x3c244f['useArgs']?_0x3c244f['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x31bee1=>({'id':_0x31bee1['id'],'label':_0x31bee1['title']}));}['assertStartTranslatePreconditions'](_0x3abf5b){const _0x4a66d0=this['context']['plugins']['get']('AITranslateController');if(_0x4a66d0['getCurrentCheckRun']())throw new at('ai-translate-translation-already-running',this);const _0x3a4082=_0x4a66d0['getAvailableChecks']()['find'](_0x18be72=>_0x18be72['id']===_0x3abf5b);if(!_0x3a4082)throw new at('ai-translate-unknown-language',this,{'languageId':_0x3abf5b});return _0x3a4082;}};export{Ua as AIActions,Oi as AIAdapter,ji as AIAssistant,Qi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,bn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,cs as AIConnector,nn as AICoreError,en as AIDocumentProcessingGateway,tn as AIDocumentProcessingRunResult,As as AIEditing,Aa as AIEditorIntegration,on as AIErrorReporter,rn as AIErrorSink,Js as AIGateway,In as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,_n as AIReply,vi 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,Zs as AIRunResult,hs as AITabs,as as AITabsMainView,ns as AITabsView,Zi as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,es as AWSTextAdapter,ts as OpenAITextAdapter,Ni as ShowAIAssistantCommand,ra as ToggleAICommand,ln as createResizeButton,Ji as getDefaultAICommands,js as markOperationsAsAI};
23
+ import{Command as _0x89658f,ContextPlugin as _0x59670e,Editor as _0x1603c4,Plugin as _0x429cfd}from'@ckeditor/ckeditor5-core';import{IconAI as _0x11cdab,IconAIAdjustLength as _0x31df35,IconAIAskAI as _0x50283e,IconAIChangeTone as _0x4c5b73,IconAIChat as _0x302265,IconAIChatCommands as _0x2c7ef3,IconAIContinueWriting as _0x20bbc6,IconAIGrammarCheck as _0x3c37ef,IconAIHistory as _0x39f555,IconAIImproveWriting as _0x2f3c90,IconAIOther as _0x4773f5,IconAIQuickActions as _0x12a5a7,IconAIReview as _0x8bcc78,IconAITranslate as _0x4b87f0,IconBoxWithCheck as _0x2ae1b,IconBoxWithCross as _0x257f37,IconBoxWithMarker as _0x4fbfea,IconBrowseFiles as _0x21283a,IconBulb as _0x51f037,IconCancel as _0x1a57f6,IconCheck as _0xdd186f,IconChevronDown as _0x18a6f5,IconChevronRight as _0x27abce,IconChevronUp as _0x5bdf9d,IconCopy as _0x197b5b,IconDocument as _0x547315,IconDocumentOutline as _0x28f992,IconDropdownArrow as _0x119e79,IconError as _0x43f8a6,IconEye as _0x2db77e,IconEyeCrossedOut as _0x240b16,IconFileUpload as _0x31e25e,IconImage as _0x3b5ca7,IconInfo as _0x2ef372,IconLink as _0x56c964,IconLoupe as _0x976e16,IconMagicWand as _0x3642e2,IconMaximize as _0xd33959,IconMinimize as _0xae34ac,IconNextArrow as _0x25d6ef,IconOutdated as _0x167b8e,IconPaperClip as _0x1a91f0,IconPin as _0x411df4,IconPlus as _0x3db3c3,IconPreviousArrow as _0x59b1a0,IconRefresh as _0x4bb8fd,IconRobotPencil as _0x37b0e9,IconSelection as _0x1b7e91,IconShowChangesOff as _0x461a07,IconShowChangesOn as tt,IconStop as et,IconSubmit as it,IconThreeHorizontalDots as st,IconThumbDown as nt,IconThumbUp as rt,IconWeb as ot}from'@ckeditor/ckeditor5-icons';import{CKEditorError as at,Collection as ht,DomEmitterMixin as ct,EmitterMixin as lt,FocusTracker as ut,KeystrokeHandler as dt,ObservableMixin as _t,Rect as gt,ResizeObserver as At,_isMotionReduced as It,first as pt,getConstrainedViewportRect as mt,global as Et,insertToPriorityArray as Tt,isVisible as wt,logError as Ct,logWarning as ft,scrollAncestorsToShowTarget as bt,scrollViewportToShowTarget as St,toArray as Rt,uid as Ot,version as vt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as kt,BalloonPanelView as Nt,BalloonToolbar as yt,BodyCollection as xt,ButtonLabelView as Lt,ButtonLabelWithHighlightView as Dt,ButtonView as Pt,Dialog as Ht,DialogViewPosition as Mt,DropdownMenuPanelPositioningFunctions as Vt,FileDialogButtonView as Ut,FocusCycler as Bt,FormHeaderView as Gt,FormRowView as Ft,HighlightedTextView as Kt,IconView as Wt,InputTextView as Yt,LabeledFieldView as $t,ListItemButtonView as qt,ListItemGroupView as Qt,ListItemView as Xt,ListView as zt,MenuBarMenuListItemButtonView as jt,MenuBarMenuListItemView as Jt,MenuBarMenuListView as Zt,MenuBarMenuView as te,SearchTextView as _0x4cebc3,SpinnerView as _0xccf9dc,TextareaView as _0x3c1f64,ToolbarView as _0x2fd27a,UIModel as _0x52a6d8,View as _0x294569,ViewCollection as _0x2776cd,addListToDropdown as _0x1e8284,addMenuToDropdown as _0x5b1dca,clickOutsideHandler as _0x1dec34,createDropdown as _0x3a7b01,createLabeledInputText as _0x442fb3,createLabeledTextarea as _0x461940,submitHandler as _0x3fc16e}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x179cb7,ClipboardPipeline as _0x2ac219}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x49bd28,MarkerOperation as _0x2831e3,Matcher as _0x157927,ModelDocumentFragment as _0x322aab,ModelPosition as _0x1e3dd8,ModelRange as _0x5677e3,ModelTreeWalker as _0x28a378,ViewDataTransfer as _0x2bdc37,ViewDocumentDomEventData as _0x1fca39,ViewDowncastWriter as _0x55f7bf,ViewUpcastWriter as _0x1dea1b,_DetachOperation as _0x4f23de,_insertIntoModelNodeList as _0x7e539,_removeFromModelNodeList as _0x316b4a,transformOperationSets as _0x426a31}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x3922f4,debounce as _0x2a623b,escape as _0x59b4a8,escapeRegExp as _0x4c3f28,throttle as _0x1aa2a4,unescape as _0x1f6a08}from'es-toolkit/compat';import{createParser as _0x621125}from'eventsource-parser';import{CloudServices as _0x346715}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x4c7492,DATA_ID_MODEL_ATTRIBUTE as _0x98c166,DATA_ID_VIEW_ATTRIBUTE as _0x2b9b7e,DocumentCompare as _0x303ea9,SuggestionsConversion as _0x51d298,fixElementSuggestionRange as _0x383dd5,getAllMarkersDomElementsSorted as _0x40c926,getMarkerDomElement as _0x3fe9cc}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x3b1d00}from'htmlparser2';import{append as _0x52293c,appendChild as _0x2858d4,find as _0x1ea495,findAll as _0x4384fd,findOne as _0x51339e,getChildren as ti,getParent as _0x9aaffd,isComment as _0x16f861,isTag as _0x218f48,prepend as _0x3bef2c,prependChild as _0x4c31f2,removeElement as _0x505dba,replaceElement as _0x50261f,textContent as _0x12589a}from'domutils';import _0x2a1923 from'dom-serializer';import{Document as _0x365804,Element as _0x1582af,NodeWithChildren as _0x9e44dd,Text as _0x3064e5,cloneNode as _0x5bc24e,isDocument as _0x2ae05e,isText as _0xf76cfa}from'domhandler';import{MarkdownGfmMdToHtml as _0x329004,MarkdownGfmMdToHtmlDefaultPlugins as _0x115097}from'@ckeditor/ckeditor5-markdown-gfm';import _0x5b499a from'rehype-sanitize';import _0x53d0ae from'morphdom';import{diffArrays as _0x4c67eb}from'diff';const Ci='_ungrouppedCommands';function fi(_0x5f4c87,_0x1f1af7){const _0x309fd9=(0x0,_0x1f1af7['t'])('Other');return _0x5f4c87['length']?'groupId'in _0x5f4c87[0x0]?_0x5f4c87:[{'groupId':Ci,'groupLabel':_0x309fd9,'order':0x1/0x0,'commands':_0x5f4c87}]:[{'groupId':Ci,'groupLabel':_0x309fd9,'order':0x1/0x0,'commands':[]}];}const bi=globalThis['DataTransfer'],Si='ai-ui';var Ri=class extends _0x429cfd{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0xf26dfe}=this,_0x2a6515=['ck-fake-ai-selection'];_0xf26dfe['config']['get']('ai.assistant.useTheme')&&_0x2a6515['push']('ck-ai-assistant-ui_theme'),_0xf26dfe['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x2a6515,'priority':0xc}}),_0xf26dfe['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x4f5d3a,{writer:_0x1483cc})=>{if(!_0x4f5d3a['markerRange']['isCollapsed'])return null;const _0x5e90ef=_0x1483cc['createUIElement']('span');return _0x1483cc['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5e90ef),_0x5e90ef;}});}['afterInit'](){!async function(_0x5abd87){const _0x4b20c7='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x18b20d=0x78e10,_0x5eacaf=window['Date']['now'](),_0x414b89=_0x5abd87['editor'],_0x494c2e=new window['Promise'](_0x26efcb=>{_0x414b89['once']('ready',_0x26efcb);}),_0x5d6438={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x103223=_0x414b89['config']['get']('licenseKey');async function _0x2568ca(){let _0x595a71,_0x111a9c=null,_0x3850d4=null;try{return'GPL'==_0x103223?'NotAllowed':(_0x595a71=_0x4c97b9(),_0x595a71?(_0x595a71['usageEndpoint']&&(_0x3850d4=_0x2c7b04(_0x595a71['usageEndpoint'],_0x595a71['jti'])),await _0x582137()?_0x2472c5()?_0x5bd52d()?'Expired':_0x3dd3c4()?('evaluation'==_0x595a71['licenseType']&&(_0x111a9c=_0x12d3fe('EvaluationLimit')),await _0x5c74e4()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x5bd52d(){const _0x8b44c8=['evaluation','trial']['includes'](_0x595a71['licenseType'])?_0x5eacaf/0x3e8:0xe10*_0x18b20d;return _0x595a71['exp']<_0x8b44c8;}function _0x2472c5(){const _0xaaaf2e=_0x595a71['features'];return!!_0xaaaf2e&&(!!_0xaaaf2e['includes']('*')||!!_0xaaaf2e['includes']('AI'));}function _0x3dd3c4(){const _0x42e39b=_0x595a71['licensedHosts'];if(!_0x42e39b||0x0==_0x42e39b['length'])return!0x0;const {hostname:_0x448348}=new URL(window['location']['href']);if(_0x42e39b['includes'](_0x448348))return!0x0;const _0x1f5c60=_0x448348['split']('.');return _0x42e39b['filter'](_0x29b285=>_0x29b285['includes']('*'))['map'](_0xcda3b=>_0xcda3b['split']('.'))['filter'](_0x29932e=>_0x29932e['length']<=_0x1f5c60['length'])['map'](_0x33e540=>Array(_0x1f5c60['length']-_0x33e540['length'])['fill']('*'===_0x33e540[0x0]?'*':'')['concat'](_0x33e540))['some'](_0x3f4c98=>_0x1f5c60['every']((_0x1675d1,_0x22c13f)=>_0x3f4c98[_0x22c13f]===_0x1675d1||'*'===_0x3f4c98[_0x22c13f]));}function _0x5c74e4(){return _0x111a9c&&_0x3850d4?new window['Promise']((_0x1affbb,_0x5b19c8)=>{_0x111a9c['then'](_0x1affbb,_0x5b19c8),_0x3850d4['then'](_0x2aba7c=>{'Valid'!=_0x2aba7c&&_0x1affbb(_0x2aba7c);},_0x5b19c8);}):_0x111a9c||_0x3850d4||'Valid';}}function _0x2c7b04(_0x48f85f,_0x5d3e85){return new window['Promise'](_0x507155=>{if(_0x498c37())return _0x507155('Valid');_0x3be7e0(),_0x414b89['decorate']('_sendUsageRequest');let _0x109bc9=!0x1;const _0x38b076=Ot();function _0x1c6709(_0x1fcddf){return!!_0x1fcddf&&('object'==typeof _0x1fcddf||'function'==typeof _0x1fcddf)&&'function'==typeof _0x1fcddf['then']&&'function'==typeof _0x1fcddf['catch'];}function _0x383f69(_0x2d6c71){_0x3bb1ab(_0x2d6c71)['then'](_0x11fd80=>_0x11fd80&&'ok'==_0x11fd80['status']?_0x31be01(_0x1ef695(_0x38b076+_0x5d3e85))!=_0x11fd80['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0xa21346=>(_0x17b5dd(),_0xa21346),()=>{const _0xfed3b5=_0x35942e();return null==_0xfed3b5?(_0x17b5dd(),'Valid'):_0x5eacaf-_0xfed3b5>0x240c8400?'UsageLimit':'Valid';})['then'](_0x507155)['catch'](()=>{_0x507155('UsageLimit');});const _0x5e7937=0x36ee80;function _0x17b5dd(){const _0x15a81e='llct-'+_0x31be01(_0x1ef695(_0x48f85f)),_0x35a2a5=_0xa73ba2(_0x31be01(window['Math']['ceil'](_0x5eacaf/_0x5e7937)));window['localStorage']['setItem'](_0x15a81e,_0x35a2a5);}function _0x35942e(){const _0xeec1ae='llct-'+_0x31be01(_0x1ef695(_0x48f85f)),_0x17e1ce=window['localStorage']['getItem'](_0xeec1ae);return _0x17e1ce?window['parseInt'](_0xa73ba2(_0x17e1ce),0x10)*_0x5e7937:null;}function _0x3bb1ab(_0x250a5c){return new window['Promise']((_0x1ef0cf,_0x2bd49f)=>{_0x250a5c['then'](_0x1ef0cf,_0x2bd49f),window['setTimeout'](_0x2bd49f,0x1d4c0);});}}_0x414b89['on']('_sendUsageRequest',(_0x598885,_0x3dc4a5)=>{if(_0x3dc4a5[0x0]!=_0x48f85f)return _0x507155('UsageLimit');_0x3dc4a5[0x1]={..._0x3dc4a5[0x1],'requestId':_0x38b076};},{'priority':'high'}),_0x414b89['on']('_sendUsageRequest',_0x14ccac=>{_0x1c6709(_0x14ccac['return'])&&(_0x109bc9=!0x0,_0x383f69(_0x14ccac['return']));},{'priority':'low'}),_0x494c2e['then'](()=>{_0x109bc9||_0x507155('UsageLimit');});});function _0x498c37(){return'auto'==_0x414b89['editing']['view']['_overlayModeHint'];}function _0x3be7e0(){_0x414b89['editing']['view']['_overlayModeHint']='auto';}}function _0x12d3fe(_0x4cefa4){const _0x3353b4=[new window['Promise'](_0x5a65f0=>setTimeout(_0x5a65f0,0x93ecc)),_0x494c2e['then'](()=>new window['Promise'](_0x5a1009=>{let _0x290fc9=0x0;_0x414b89['model']['on']('applyOperation',(_0x1c4942,_0x2103de)=>{_0x2103de[0x0]['isDocumentOperation']&&_0x290fc9++,0x5e8==_0x290fc9&&(_0x5a1009(),_0x1c4942['off']());});}))];return window['Promise']['race'](_0x3353b4)['then'](()=>_0x4cefa4);}async function _0x44fdb6(){await _0x494c2e,_0x414b89['model']['change']=_0x13135f,_0x414b89['model']['enqueueChange']=_0x13135f,_0x414b89['enableReadOnlyMode']('model');}function _0x2a6706(_0x3a0b5f){const _0x51b47c=_0x13941d();_0x414b89[_0x51b47c]='aiLicenseKey'+_0x3a0b5f,'Valid'!=_0x3a0b5f&&_0x44fdb6();}function _0x13941d(){const _0x2879f0=window['String'](window['performance']['now']())['replace']('.','');let _0x34ca67='n';for(let _0x43731d=0x0;_0x43731d<_0x2879f0['length'];_0x43731d+=0x2){let _0x294bc5=window['parseInt'](_0x2879f0['substring'](_0x43731d,_0x43731d+0x2));_0x294bc5>=0x3e&&(_0x294bc5-=0x3e),_0x34ca67+=_0x4b20c7[_0x294bc5];}return _0x34ca67;}function _0x4c97b9(){const _0x1846fd=_0x103223['split']('.');if(0x3!=_0x1846fd['length'])return null;return _0x4d61a1(_0x1846fd[0x1]);function _0x4d61a1(_0x5154ad){const _0x2b95ac=_0x39e261(_0x5154ad);return _0x2b95ac&&_0x1258c5()?_0x2b95ac:null;function _0x1258c5(){const _0xaeae1=_0x2b95ac['jti'],_0x2719b0=window['parseInt'](_0xaeae1['substring'](_0xaeae1['length']-0x8),0x10),_0x14cc92={..._0x2b95ac,'jti':_0xaeae1['substring'](0x0,_0xaeae1['length']-0x8)};return delete _0x14cc92['vc'],_0x1ef695(_0x14cc92)==_0x2719b0;}}}async function _0x582137(){let _0x5366db=!0x0;try{const [_0x4cbf46,_0x48893a,_0x56bab6]=_0x103223['split']('.');return _0x35151f(_0x4cbf46),await _0x53184d(_0x4cbf46,_0x48893a,_0x56bab6),_0x5366db;}catch{return!0x1;}function _0x35151f(_0x548205){const _0x382f98=_0x39e261(_0x548205);_0x382f98&&'ES256'==_0x382f98['alg']||(_0x5366db=!0x1);}async function _0x53184d(_0x3addaa,_0x397dc1,_0x4c4a91){const _0xcc63ac=window['Uint8Array']['from'](_0x5a63d0(_0x4c4a91),_0x5d7a94=>_0x5d7a94['charCodeAt'](0x0)),_0x2b9e11=new window['TextEncoder']()['encode'](_0x3addaa+'.'+_0x397dc1),_0x21be26=window['crypto']['subtle'];if(!_0x21be26)return;const _0x142bb0=await _0x21be26['importKey']('jwk',_0x5d6438,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x21be26['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x142bb0,_0xcc63ac,_0x2b9e11)||(_0x5366db=!0x1);}}function _0x39e261(_0x539f77){return _0x539f77['startsWith']('ey')?JSON['parse'](_0x5a63d0(_0x539f77)):null;}function _0x5a63d0(_0x308cb3){return window['atob'](_0x308cb3['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x1ef695(_0x48348c){let _0x2284ff=0x1505;function _0x2b3493(_0x1596f0){for(let _0xd8d696=0x0;_0xd8d696<_0x1596f0['length'];_0xd8d696++){const _0x41fddc=_0x1596f0['charCodeAt'](_0xd8d696);_0x2284ff=(_0x2284ff<<0x5)+_0x2284ff+_0x41fddc,_0x2284ff&=_0x2284ff;}}function _0x1bdff1(_0x55b04c){Array['isArray'](_0x55b04c)?_0x55b04c['forEach'](_0x1bdff1):_0x55b04c&&'object'==typeof _0x55b04c?Object['entries'](_0x55b04c)['sort']()['forEach'](([_0x9152,_0x50810e])=>{_0x2b3493(_0x9152),_0x1bdff1(_0x50810e);}):_0x2b3493(window['String'](_0x55b04c));}return _0x1bdff1(_0x48348c),_0x2284ff>>>0x0;}function _0x31be01(_0x29dac4){return _0x29dac4['toString'](0x10)['padStart'](0x8,'0');}function _0xa73ba2(_0x2d75fa){return _0x2d75fa['split']('')['reverse']()['join']('');}function _0x13135f(){}_0x2a6706(await _0x2568ca());}(this);}['showFakeVisualSelection'](){const _0xf21abb=this['editor']['model'];_0xf21abb['change'](_0x84e6d6=>{const _0x2ced35=_0xf21abb['document']['selection']['getRanges']();let _0x30bdd0=0x0;for(const _0x3f8628 of _0x2ced35){const _0x37bd67=Si+':'+_0x30bdd0;if(_0xf21abb['markers']['has'](_0x37bd67))_0x84e6d6['updateMarker'](_0x37bd67,{'range':_0x3f8628});else{if(_0x3f8628['start']['isAtEnd']){const _0x51428e=_0x3f8628['start']['getLastMatchingPosition'](({item:_0x4db18f})=>!_0xf21abb['schema']['isContent'](_0x4db18f),{'boundaries':_0x3f8628});_0x84e6d6['addMarker'](_0x37bd67,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x84e6d6['createRange'](_0x51428e,_0x3f8628['end'])});}else _0x84e6d6['addMarker'](_0x37bd67,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3f8628});}_0x30bdd0++;}});}['hideFakeVisualSelection'](){const _0x94a0b0=this['editor']['model'],_0x7f2e8e=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x7f2e8e['length']&&_0x94a0b0['change'](_0x5791c8=>{_0x7f2e8e['forEach'](_0x57647c=>{_0x5791c8['removeMarker'](_0x57647c);});});}['insertContent'](_0x3ea9ac,_0x105a59){const _0x3ef2b8=this['_getAISelection'](),_0x35e28a=_0x105a59||_0x3ef2b8['getFirstRange']();this['editor']['model']['canEditAt'](_0x35e28a)&&this['editor']['model']['change'](_0x1b7790=>{this['hideFakeVisualSelection'](),_0x105a59||this['_resetContentOfSelectedTableCells'](_0x1b7790,_0x3ef2b8),this['_pasteHTMLUsingClipboard']({'insertAt':_0x35e28a,'writer':_0x1b7790,'html':_0x3ea9ac});});}['insertContentBelow'](_0x4b2d37){const {model:_0x31eb2f}=this['editor'],_0x53d08d=this['_getAISelection']();_0x31eb2f['change'](()=>{const _0x1f7da1=this['_prepareTableInsertBelowPosition'](_0x4b2d37,_0x53d08d)||this['_getDefaultInsertBelowPosition'](_0x53d08d);this['insertContent'](_0x4b2d37,_0x1f7da1);});}['_getAISelection'](){const _0x315ce4=this['editor']['model'],_0xab59c7=Array['from'](_0x315ce4['markers']['getMarkersGroup'](Si))['map'](_0x40d2fb=>_0x40d2fb['getRange']());return _0x315ce4['createSelection'](_0xab59c7);}['_pasteHTMLUsingClipboard']({writer:_0x593e44,html:_0x4c70d9,insertAt:_0x35355f}){const {view:_0x3efbe3}=this['editor']['editing'],_0x3f92b9=this['editor']['plugins']['get'](_0x2ac219),_0x3a8df2=new bi();_0x3a8df2['setData']('text/html',_0x4c70d9);const _0x10dbc3=new _0x1fca39(_0x3efbe3,new ClipboardEvent('paste',{'clipboardData':_0x3a8df2}),{'dataTransfer':new _0x2bdc37(_0x3a8df2)});_0x593e44['setSelection'](_0x35355f);const _0x1e87b4=(_0x126736,_0x494bd2)=>{_0x494bd2['resultRange']&&_0x593e44['setSelection'](_0x494bd2['resultRange']);};_0x3f92b9['once']('contentInsertion',_0x1e87b4,{'priority':'lowest'}),_0x3efbe3['document']['fire']('paste',_0x10dbc3),_0x3f92b9['off']('contentInsertion',_0x1e87b4);}['_getDefaultInsertBelowPosition'](_0x53f332){const {model:_0x1c7d7c}=this['editor'],_0x511f8c=Array['from'](_0x53f332['getSelectedBlocks']());return _0x511f8c['length']?_0x1c7d7c['createPositionAfter'](_0x511f8c['pop']()):_0x53f332['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x4789d0,_0x3f255d){const {model:_0x5c00eb,plugins:_0x2c0ab9}=this['editor'];if(_0x2c0ab9['has']('TableUtils')){const _0x1e9be9=_0x2c0ab9['get']('TableUtils')['getSelectedTableCells'](_0x3f255d);if(_0x1e9be9['length']){const _0x584a64=this['_getTableRowCountFromContent'](_0x4789d0),_0x31880b=this['_createEmptyTableRows'](_0x1e9be9,_0x584a64);return _0x5c00eb['createPositionAt'](_0x31880b,0x0);}}return null;}['_getTableRowCountFromContent'](_0x131d39){const _0x11541d=this['editor']['plugins']['get']('TableUtils'),_0x55bbf4=this['editor']['data']['parse'](_0x131d39,'$documentFragment'),_0x726a63=Array['from'](_0x55bbf4['getChildren']())['filter'](_0x37ce96=>_0x37ce96['is']('element','table'));let _0x28773b=0x0;return _0x726a63['forEach'](_0x3a8925=>{_0x28773b+=_0x11541d['getRows'](_0x3a8925);}),_0x28773b;}['_createEmptyTableRows'](_0x5a2835,_0x1a7bf3){const _0x27b282=this['editor']['plugins']['get']('TableUtils'),_0x55e741=_0x27b282['getRowIndexes'](_0x5a2835),_0x4f20f4=_0x27b282['getColumnIndexes'](_0x5a2835),_0x1a8019=_0x55e741['last']+0x1,_0x2c061b=_0x4f20f4['first'],_0x531a86=_0x5a2835[0x0]['findAncestor']('table');for(let _0x533819=0x0;_0x533819<_0x1a7bf3;_0x533819++)_0x27b282['insertRows'](_0x531a86,{'at':_0x1a8019});return _0x531a86['getChild'](_0x1a8019)['getChild'](_0x2c061b);}['_resetContentOfSelectedTableCells'](_0x318a9c,_0x6542b9){const {plugins:_0x3f80fa}=this['editor'],{model:_0x33ff48}=_0x318a9c;_0x3f80fa['has']('TableUtils')&&_0x3f80fa['get']('TableUtils')['getSelectedTableCells'](_0x6542b9)['length']&&_0x33ff48['deleteContent'](_0x6542b9);}},Oi=class extends _0x429cfd{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}},vi=class extends Error{constructor(_0x23220f){super(_0x23220f),this['name']='AIRequestError';}};function ki(_0x448216,_0x1c16f0,_0x48aeee){const t=_0x448216['t'];switch(_0x1c16f0){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',_0x48aeee);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x48aeee);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'},_0x48aeee);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 _0x1c16f0;}}var Ni=class extends _0x89658f{['_commandDefinitions'];constructor(_0x472c33,_0x4be9c3){super(_0x472c33),this['_commandDefinitions']=_0x4be9c3,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x6715e1,_0x3eca1c,_0x391eb9)=>{this['isEnabled']&&(this['enabledCommandsIds']=yi(this['_commandDefinitions'],_0x391eb9));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x45daa5,_0x159c67,_0x53201d)=>{this['enabledCommandsIds']=_0x53201d?yi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2039bb=this['editor']['model'];this['_hasContext']=function(_0x4a18e3){const _0x575999=_0x4a18e3['document']['selection'];return _0x575999['isCollapsed']?0x0!==[..._0x575999['getSelectedBlocks']()]['length']&&![..._0x575999['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x4a18e3['hasContent'](_0x575999['getFirstRange']());}(_0x2039bb);const _0x584551=_0x2039bb['document']['selection'],_0x409be9=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x151387 of _0x584551['getRanges']())for(const _0x2c30f4 of _0x151387['getItems']())if(_0x2c30f4['is']('element')&&_0x409be9['includes'](_0x2c30f4['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x4d8a91='',_0x8110f3='',_0x55c226='custom'){this['editor']['plugins']['get'](Qi)['showUI'](_0x4d8a91,_0x8110f3,_0x55c226);}};function yi(_0x482e35,_0x2eedc7){const _0x10580b=new Set();for(const _0x17da1f of _0x482e35['values']())(_0x2eedc7||!0x1===_0x17da1f['requiresContent'])&&_0x10580b['add'](_0x17da1f['id']);return Array['from'](_0x10580b);}const xi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Li=/* #__PURE__ -- @preserve */
24
+ _t();var Di=class extends Li{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x18c166,_0x331531,_0x4d6ce5){super(),this['editor']=_0x18c166,this['textAdapter']=_0x331531,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x4d6ce5,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x4538a9,_0x443162,_0x48604d)=>{this['view']['value']=this['_sanitizeHTML'](_0x48604d);}),this['listenTo'](this['view'],'submitPrompt',(_0x5740bb,_0x32b332)=>{const _0x13805e=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x32b332,_0x13805e,'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:_0x25c9ff,query:_0x29e55e,htmlContent:_0x55d412,label:_0xbe111b,mainActionLabel:_0x46b496}){this['view']['prompt']=_0xbe111b,this['view']['mainAction']=_0x46b496,this['initialContext']=_0x55d412,_0x29e55e&&(this['view']['isRendered']?this['_handleQuery'](_0x29e55e,_0x55d412,_0x25c9ff,_0xbe111b):this['view']['once']('render',()=>{this['_handleQuery'](_0x29e55e,_0x55d412,_0x25c9ff,_0xbe111b);}));}['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'](_0x45743c,_0x669b6,_0x1fd9a4,_0x25ce7){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x669b6,this['previousQuery']=_0x45743c,this['previousLabel']=_0x25ce7||_0x45743c,this['previousActionId']=_0x1fd9a4,new Promise(_0x4d54ed=>{this['textAdapter']['makeRequest']({'query':_0x45743c,'context':_0x669b6,'onData':_0x21544c=>{this['currentResponse']=_0x21544c,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x1fd9a4})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x4295e3=>{_0x4295e3 instanceof vi?this['view']['handleError'](_0x4295e3['message']):this['view']['handleError'](),_0x4d54ed();})['finally'](()=>{this['stopProcessing'](),_0x4d54ed();});});}['_parseAndNormalizeContent'](_0xe241b2,_0x388d19=!0x1){const _0x363bae=xi['exec'](_0xe241b2);_0xe241b2=_0x363bae?_0xe241b2['substring'](_0x363bae[0x1]['length']):_0xe241b2['length']<0x64&&!_0x388d19?'':this['_stripMarkdownSyntax'](_0xe241b2);const _0x22fa09=this['_domParser']['parseFromString'](_0xe241b2,'text/html');if(_0x363bae){const _0x11a10a=Array['from'](_0x22fa09['body']['childNodes']);_0x11a10a['reverse']();for(const _0x5a1bd1 of _0x11a10a){if(_0x5a1bd1['nodeType']==Node['ELEMENT_NODE'])break;_0x5a1bd1['remove']();}}const _0x1128c9=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x22fa09['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x1128c9);const _0x10cdbc=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x200c19=this['editor']['data']['toModel'](_0x1128c9);return _0x10cdbc||_0x200c19['markers']['clear'](),this['editor']['data']['stringify'](_0x200c19);}['_normalizeResponseHeadings'](_0x5bec2c){const _0x2c1ebb=new _0x1dea1b(this['editor']['editing']['view']['document']),_0x289272=new _0x157927({'name':/^h[1-5]$/}),_0xd7f78f=[];let _0x9ff5e=!0x1;for(const _0x5bc250 of _0x5bec2c)_0x5bc250['is']('element')&&_0x289272['match'](_0x5bc250)&&(_0xd7f78f['push'](_0x5bc250),'h1'==_0x5bc250['name']&&(_0x9ff5e=!0x0));if(_0x9ff5e){for(const _0x1de1d7 of _0xd7f78f)_0x2c1ebb['rename']('h'+(parseInt(_0x1de1d7['name'][0x1])+0x1),_0x1de1d7);}}['_isH1TagSupportEnabled'](){const {data:_0xfd3a98,editing:_0x2b0e17}=this['editor'],_0x4261a3=_0xfd3a98['htmlProcessor']['toView']('<h1></h1>'),_0x179660=_0xfd3a98['toView'](_0xfd3a98['toModel'](_0x4261a3));return!!_0x2b0e17['view']['domConverter']['viewToDom'](_0x179660)['querySelector']('h1');}['_sanitizeHTML'](_0xe9519f){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0xe9519f),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x71722e){const _0x56e2cd=_0x71722e['trim']();return _0x56e2cd['startsWith']('```html')?_0x56e2cd['endsWith']('```')?_0x56e2cd['substring'](0x7,_0x56e2cd['length']-0x3):_0x56e2cd['substring'](0x7):_0x71722e;}};const Pi={'REPLACE':'replace','INSERT':'insert'};var Hi=class extends _0x2fd27a{constructor(_0x34a7af){super(_0x34a7af),this['set']('isVisible',!0x1),this['set']('mainAction',Pi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0xd52124=>ki(_0x34a7af,'AI_'+_0xd52124['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](ki(_0x34a7af,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](ki(_0x34a7af,'Try\x20again')),this['stopButton']=this['_createButton'](ki(_0x34a7af,'Stop'));const _0x3bf53e=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x3bf53e['if']('isVisible','ck-hidden',_0x5bff81=>!_0x5bff81)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x2af6e9,_0x30fa5b){const _0x3eb4f6=new Pt(this['locale']);return _0x3eb4f6['set']({'label':_0x2af6e9,'class':_0x30fa5b||'','isVisible':!0x0,'withText':!0x0}),_0x3eb4f6;}},Mi=class extends _0x294569{['contentFieldView'];['copyButtonView'];constructor(_0x4f88da,_0x2be2b0=''){super(_0x4f88da),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x58a2e4=this['bindTemplate'];this['contentFieldView']=new Vi(_0x4f88da,_0x2be2b0),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x58a2e4['if']('isVisible','ck-hidden',_0x5a163a=>!_0x5a163a)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x58a2e4['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 _0x506855=!0x1;this['on']('change:value',(_0x5b42d2,_0x2a85a5,_0x290c80)=>{const _0x20fe7f=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x290c80),this['isProcessing']&&_0x20fe7f&&!_0x506855&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x1190e1,_0x279fcf,_0x23c8a5)=>{_0x506855=!0x1,_0x23c8a5?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x506855=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x506855=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x35b4b7=this['locale'],_0x5009b9=new Pt(this['locale']),_0x242894='ck-ai-form__copy-button';return _0x5009b9['set']({'label':ki(_0x35b4b7,'Copy'),'icon':_0x197b5b,'class':_0x242894,'tooltip':!0x0}),_0x5009b9['bind']('isVisible')['to'](this,'value',_0x1e179b=>!!_0x1e179b),_0x5009b9['bind']('isEnabled')['to'](this,'isProcessing',_0x516633=>!_0x516633),_0x5009b9['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5009b9['icon']=_0xdd186f,_0x5009b9['class']=_0x242894+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5009b9['icon']=_0x197b5b,_0x5009b9['class']=_0x242894;},0x3e8);}),_0x5009b9;}['_copyHTMLToClipboard'](_0x441b7a){const {window:_0x5c30b9,document:_0x26184a}=Et;if(_0x5c30b9['ClipboardItem']){const {Blob:_0x493a57,ClipboardItem:_0x1faee3}=_0x5c30b9,_0x1ae785=[new _0x1faee3({'text/html':new _0x493a57([_0x441b7a['innerHTML']],{'type':'text/html'}),'text/plain':new _0x493a57([_0x441b7a['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x1ae785);}else{const _0x2a0002=_0x26184a['createElement']('div');_0x2a0002['style']['position']='absolute',_0x2a0002['style']['left']='-9999px',_0x2a0002['innerHTML']='<span>[</span>'+_0x441b7a['innerHTML']+'<span>]</span>',_0x26184a['body']['appendChild'](_0x2a0002);const _0x12655e=_0x26184a['createRange']();_0x12655e['setStartAfter'](_0x2a0002['firstElementChild']),_0x12655e['setEndBefore'](_0x2a0002['lastElementChild']);const _0x59c5c4=_0x5c30b9['getSelection']();_0x59c5c4['removeAllRanges'](),_0x59c5c4['addRange'](_0x12655e),_0x26184a['execCommand']('copy'),_0x2a0002['remove']();}}},Vi=class extends _0x294569{constructor(_0x7bfe13,_0x856cd8=''){super(_0x7bfe13),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x856cd8,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x43dec7){this['element']['innerHTML']=_0x43dec7;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x2bd57b=new _0x294569(),_0x4ea5f1=this['locale'],_0x705451=new _0xccf9dc();return _0x705451['isVisible']=!0x0,_0x2bd57b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x705451,{'text':ki(_0x4ea5f1,'AI\x20is\x20writing...')}]}),_0x2bd57b['render'](),_0x2bd57b;}},Ui=class extends _0x294569{constructor(_0x57725c,_0x459c5f=''){super(_0x57725c);const _0x5571a0=new Wt(),_0xcd11e2=this['bindTemplate'];this['set']('text',_0x459c5f),_0x5571a0['content']=_0x43f8a6,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x5571a0,{'text':_0xcd11e2['to']('text')}]});}},Bi=class extends kt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x5417a6,_0x2e633d){super(_0x5417a6,_0x2e633d),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',(_0x144d2d,_0x301f90)=>{_0x144d2d['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x301f90());});}['_createSubmitButton'](){const _0x69e6c5=new Pt(this['locale']),_0x56e669=this['locale'];return _0x69e6c5['set']({'icon':it,'label':ki(_0x56e669,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x69e6c5['on']('execute',()=>{this['submit']();}),_0x69e6c5['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x336fe2,_0x3016bc)=>!_0x336fe2&&_0x3016bc),_0x69e6c5;}['_createShowHistoryButton'](){const _0x4cc5f4=new Pt(this['locale']),_0x4d6271=this['resultsView'],_0x45fe24=this['locale'];_0x4cc5f4['set']({'label':ki(_0x45fe24,'History'),'withText':!0x1,'icon':_0x39f555,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4cc5f4['bind']('isOn')['to'](_0x4d6271,'isVisible'),_0x4cc5f4['bind']('isEnabled')['to'](this,'isEnabled'),_0x4cc5f4['on']('execute',()=>{_0x4d6271['isVisible']=!_0x4d6271['isVisible'],_0x4d6271['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x9f91c5=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x174a79=new gt(this['queryView']['fieldView']['element']),_0x5b48a3=_0x174a79['width'],_0x3dbe36='rtl'===_0x45fe24['uiLanguageDirection']?'left':'right';_0x174a79['excludeScrollbarsAndBorders'](),_0x4cc5f4['element']['style'][_0x3dbe36]=_0x5b48a3-_0x174a79['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x9f91c5),this['on']('render',_0x9f91c5),_0x4cc5f4;}['submit'](){const _0x5ba823=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5ba823);}['focus'](_0x34cfc7){-0x1===_0x34cfc7?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Gi=class extends zt{['historyGroupView'];['clearHistoryButton'];constructor(_0x160464){super(_0x160464),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Qt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=ki(_0x160464,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0xb688b0=0x0;for(const _0x4e18b2 of this['items'])_0xb688b0+=_0x4e18b2['items']['length'];return{'resultsCount':_0xb688b0,'totalItemsCount':_0xb688b0};}['_createClearHistoryButton'](){const _0x584afa=this['locale'],_0x2dd9a5=new Pt(this['locale']);return _0x2dd9a5['set']({'label':'('+ki(_0x584afa,'Clear')+')','withText':!0x0}),_0x2dd9a5['on']('execute',()=>this['fire']('clearHistory')),_0x2dd9a5;}},Fi=class extends Xt{constructor(_0x229310){super();const _0x43d79f=new Lt(),_0x3781f6=new Pt(this['locale'],_0x43d79f);this['children']['add'](_0x3781f6),_0x3781f6['set']({'label':_0x229310['prompt'],'withText':!0x0}),_0x3781f6['on']('execute',()=>{this['fire']('execute',{'value':_0x1f6a08(_0x229310['prompt'])});});}};const Ki='CKEditor/AIFormView/PromptHistory';var Wi=class extends ht{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x1526db,_0x1b1121)=>{const _0x1d97cb=Yi(_0x1b1121['prompt']);for(const _0x1e2a3d of this)if(_0x1e2a3d!=_0x1b1121&&Yi(_0x1e2a3d['prompt'])===_0x1d97cb){this['remove'](_0x1e2a3d);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x5b64f9=sessionStorage['getItem'](Ki)||'[]';this['addMany'](JSON['parse'](_0x5b64f9));}['_saveToSessionStorage'](){sessionStorage['setItem'](Ki,JSON['stringify'](this['map'](_0xfc8f34=>_0xfc8f34)));}};function Yi(_0x4a6fca){return _0x4a6fca['toLowerCase']()['trim']();}var $i=class extends _0x294569{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x5dd627,_0x58a669,_0x114714=''){super(_0x5dd627),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Pi['REPLACE']),this['_promptHistory']=new Wi(),this['errorView']=new Ui(_0x5dd627),this['contentArea']=new Mi(_0x5dd627,_0x114714),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 ut(),this['keystrokes']=new dt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Bt({'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 _0xb18ed2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x58a669],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xb18ed2['if']('isError','ck-hidden',_0x35fa74=>!_0x35fa74)]},'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'](_0x41fb2c=0x1){-0x1===_0x41fb2c?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 _0x451fe6=this['locale'],_0x455a2e=new Bi(_0x451fe6,{'queryView':{'label':ki(_0x451fe6,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x461940,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':ki(_0x451fe6,'Empty\x20history'),'secondary':ki(_0x451fe6,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x455a2e['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2cfcd0,_0x124242)=>_0x2cfcd0&&!_0x124242),this['listenTo'](_0x455a2e,'submit',(_0x2504fc,_0x242cef)=>{this['prompt']=_0x242cef;const _0x47b496=_0x59b4a8(_0x242cef);this['fire']('submitPrompt',_0x47b496),_0x242cef['trim']()&&this['_promptHistory']['add']({'prompt':_0x47b496},0x0);},{'priority':'high'}),_0x455a2e;}['_createHistoryView'](){const _0x17d24c=new Gi(this['locale']);return _0x17d24c['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Fi),_0x17d24c['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x17d24c;}['_createToolbar'](){const _0x56848c=new Hi(this['locale']);return _0x56848c['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x54d84a,_0x4957a9,_0x138f63)=>_0x54d84a&&!_0x4957a9&&!!_0x138f63),_0x56848c['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x56848c['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3dce4b,_0x36f04a,_0x3b0cb5)=>_0x3dce4b&&!_0x36f04a&&!!_0x3b0cb5),_0x56848c['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x56848c['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2ff9b5,_0x40b609)=>_0x2ff9b5&&!_0x40b609),_0x56848c['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x56848c['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x56848c['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x56848c;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x10b0f4=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=ki(_0x10b0f4,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4b3057){const _0x296f4b=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4b3057||ki(_0x296f4b,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const qi=globalThis['DataTransfer'];var Qi=class extends _0x429cfd{['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[_0x179cb7,Ri,Oi,Ht];}constructor(_0x2af8c4){super(_0x2af8c4),_0x2af8c4['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x2af8c4['config']['define']('ai.assistant.contentAreaCssClass',''),_0x2af8c4['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x2af8c4['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x41a1db}=this;this['_aiAdapter']=_0x41a1db['plugins']['get'](Oi),this['_dialog']=_0x41a1db['plugins']['get'](Ht),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0xe6505e=new Ni(_0x41a1db,Array['from'](this['_commandDefinitions']['values']()));_0x41a1db['commands']['add']('showAIAssistant',_0xe6505e),_0x41a1db['ui']['componentFactory']['add']('aiCommands',_0x2e14a9=>{const _0x26928f=_0x3a7b01(_0x2e14a9);return _0x26928f['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x26928f['buttonView']['set']({'label':ki(_0x2e14a9,'AI\x20Commands'),'icon':_0x3642e2,'tooltip':!0x0}),_0x26928f['on']('execute',_0x1a7740=>this['_onExecute'](_0x1a7740['source']['id'])),_0x5b1dca(_0x26928f,_0x41a1db['ui']['view']['body'],function(_0x3487eb){const _0x5dc531=zi(_0x3487eb,fi(_0x3487eb['config']['get']('ai.assistant.commands'),_0x3487eb['locale']))['filter'](_0x5a728b=>_0x5a728b['commands']['length']);return 0x1===_0x5dc531['length']?zi(_0x3487eb,_0x5dc531[0x0]['commands'])['map'](_0x3b07fc=>({'id':_0x3b07fc['id'],'label':_0x3b07fc['label']})):_0x5dc531['map'](_0x85d1ab=>{const {groupId:_0x120eb1,groupLabel:_0x348daa,commands:_0xa3bb8b}=_0x85d1ab,_0x3a45aa=zi(_0x3487eb,_0xa3bb8b)['map'](_0x3d713c=>({'id':_0x3d713c['id'],'label':_0x3d713c['label']}));return{'id':_0x120eb1,'menu':_0x348daa||_0x120eb1,'children':_0x3a45aa};});}(_0x41a1db),{'ariaLabel':ki(_0x2e14a9,'AI\x20Commands')}),_0x26928f['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0xe6505e['on']('change:enabledCommandsIds',_0xde48d4),_0x26928f['menuView']['once']('render',_0xde48d4),_0x26928f;function _0xde48d4(){_0x26928f['isEnabled']=_0xe6505e['enabledCommandsIds']['length']>0x0;for(const _0x23a50f of _0x26928f['menuView']['buttons'])_0x23a50f['isEnabled']=_0xe6505e['enabledCommandsIds']['includes'](_0x23a50f['id']);}}),_0x41a1db['ui']['componentFactory']['add']('menuBar:aiCommands',_0x1d002b=>{const _0x2d511a=new te(_0x1d002b);_0x2d511a['buttonView']['set']({'label':ki(_0x1d002b,'AI\x20Commands'),'icon':_0x3642e2}),_0x2d511a['bind']('isEnabled')['to'](_0xe6505e,'enabledCommandsIds',_0xc5662a=>_0xc5662a['length']>0x0);const _0x58eabf=fi(_0x41a1db['config']['get']('ai.assistant.commands'),_0x1d002b);return this['_populateMenuBarMenu'](_0xe6505e,_0x2d511a,_0x58eabf,_0x3b4967=>this['_onExecute'](_0x3b4967)),_0x2d511a;}),_0x41a1db['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x1a4294=this['_createAIAssistantUIButton'](Pt);return _0x1a4294['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x1a4294;}),_0x41a1db['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x466a91=this['_createAIAssistantUIButton'](jt);return _0x466a91['set']({'role':'menuitemcheckbox'}),_0x466a91;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x5dc8d1=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x151a9b;for(const _0x4c5eea in _0x5dc8d1){const _0x147225=_0x4c5eea,_0x5d13b7=_0x5dc8d1[_0x147225];if('aiLicenseKeyValid'==_0x5d13b7||'aiLicenseKeyInvalid'==_0x5d13b7||'aiLicenseKeyExpired'==_0x5d13b7||'aiLicenseKeyDomainLimit'==_0x5d13b7||'aiLicenseKeyNotAllowed'==_0x5d13b7||'aiLicenseKeyEvaluationLimit'==_0x5d13b7||'aiLicenseKeyUsageLimit'==_0x5d13b7){delete _0x5dc8d1[_0x147225],_0x151a9b=_0x5d13b7,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x151a9b&&_0x5dc8d1['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x483d17='',_0x87fe98='',_0x223337='custom'){const _0x38f6c2=this['editor'],_0x52e34e=_0x38f6c2['editing']['view'],_0x33dbf9=_0x38f6c2['plugins']['get'](Ri),_0x28808d=_0x38f6c2['plugins']['get'](_0x179cb7);_0x33dbf9['showFakeVisualSelection']();const _0x12c4dd=new qi(),_0x13ae96=new ClipboardEvent('copy',{'clipboardData':_0x12c4dd}),_0x30d577=new _0x2bdc37(_0x12c4dd),_0x32d536=new _0x1fca39(_0x52e34e,_0x13ae96,{'dataTransfer':_0x30d577});_0x28808d['_forceMarkersCopy']('comment',()=>{_0x52e34e['document']['fire']('copy',_0x32d536);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Di(_0x38f6c2,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x475319=_0x30d577['getData']('text/html');const _0xd05c7d=_0x38f6c2['model']['document']['selection'],_0x5a08d0=Array['from'](_0xd05c7d['getRanges']());0x1===_0x5a08d0['length']&&_0x5a08d0[0x0]['isFlat']&&!_0xd05c7d['getSelectedElement']()&&''!==_0x475319['replace'](/&nbsp;/g,'')['trim']()&&(_0x475319='<p>'+_0x475319+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x223337,'query':_0x483d17,'htmlContent':_0x475319,'label':_0x87fe98,'mainActionLabel':Pi[_0x38f6c2['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x37b0e9,'title':ki(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Mt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x33dbf9['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x3213f1=new Map(),_0x3f568f=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x506467 of _0x3f568f)for(const _0x1e224f of _0x506467['commands'])_0x3213f1['set'](_0x1e224f['id'],{..._0x1e224f,'groupId':_0x506467['groupId'],'groupLabel':_0x506467['groupLabel']||_0x506467['groupId']});return _0x3213f1;}['_createAIAssistantUIButton'](_0x470536){const _0x5070a2=this['editor'],_0x9b80d3=_0x5070a2['commands']['get']('showAIAssistant'),_0x3e33cf=new _0x470536(_0x5070a2['locale']);return _0x3e33cf['set']({'label':ki(_0x5070a2['locale'],'AI\x20Assistant'),'icon':_0x37b0e9,'isToggleable':!0x0}),_0x3e33cf['bind']('isEnabled')['to'](_0x9b80d3),_0x3e33cf['bind']('isOn')['to'](this['_dialog'],'id',_0x1eb0e4=>'aiAssistant'===_0x1eb0e4),this['listenTo'](_0x3e33cf,'execute',()=>{_0x3e33cf['isOn']?this['hideUI']():_0x9b80d3['execute']();}),_0x3e33cf;}['_initView'](){const _0xa14ae8=this['editor']['plugins']['get'](Ri);this['_formView']=new $i(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',()=>{_0xa14ae8['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0xa14ae8['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0xa6b6b6,ui:{ariaLiveAnnouncer:_0x35462d}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x262b58,_0x5ea996,_0x1766a0)=>{const _0x1ba503=this['_aiAssistantController']['currentContext'];_0x1766a0?_0x35462d['announce'](ki(_0xa6b6b6,'AI\x20is\x20writing')):_0x1ba503&&_0x35462d['announce'](ki(_0xa6b6b6,'Generated\x20content:\x20%0',_0x1ba503),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x669b9c,_0x52042f,_0x10d5df)=>{if(_0x10d5df){const _0xdefdab=this['_formView']['errorView']['text'];_0x35462d['announce'](ki(_0xa6b6b6,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0xdefdab));}});}['_onExecute'](_0x4c76c8){const _0x561738=this['_commandDefinitions']['get'](_0x4c76c8),_0x17603c=this['editor'],_0x330646=_0x17603c['model']['document']['selection'],_0x4ddedb=_0x17603c['commands']['get']('showAIAssistant'),_0x5954bb=_0x17603c['plugins']['get'](Ri),_0x13a58d=''+('_ungrouppedCommands'!==_0x561738['groupId']?_0x561738['groupLabel']+':\x20':'')+_0x561738['label'];if(!0x1!==_0x561738['requiresContent']&&_0x330646['isCollapsed']){const _0x3c76fe=pt(_0x330646['getSelectedBlocks']())||_0x17603c['model']['schema']['getLimitElement'](_0x330646);_0x17603c['model']['change'](_0x4b6651=>{_0x4b6651['setSelection'](_0x3c76fe,'in');});}_0x5954bb['showFakeVisualSelection'](),_0x4ddedb['execute'](_0x561738['prompt'],_0x13a58d,'command:'+_0x4c76c8);}['_populateMenuBarMenu'](_0x477f7c,_0x1375aa,_0xb71205,_0x4ff490){const _0x1c85db=this['editor'],_0x1b2348=_0x1c85db['locale'],_0x1fe8c8=new Zt(_0x1b2348),_0x3173a8=zi(_0x1c85db,_0xb71205)['filter'](_0x217502=>_0x217502['commands']['length']);0x1===_0x3173a8['length']?this['_getMenuBarGroupButtons']({'command':_0x477f7c,'commands':_0x3173a8[0x0]['commands'],'parentMenuView':_0x1375aa,'onExecute':_0x4ff490})['forEach'](_0x36e59e=>_0x1fe8c8['items']['add'](_0x36e59e)):_0x3173a8['forEach'](({groupId:_0x5b64b4,groupLabel:_0x26f772,commands:_0x45c309})=>{const _0x294ac8=new Jt(_0x1b2348,_0x1375aa),_0x4caf4e=new te(_0x1b2348),_0xcba49c=new Zt(_0x1b2348),_0x2cd1df=this['_getMenuBarGroupButtons']({'command':_0x477f7c,'commands':_0x45c309,'parentMenuView':_0x4caf4e,'onExecute':_0x4ff490});_0x4caf4e['buttonView']['set']({'label':_0x26f772||_0x5b64b4}),_0x4caf4e['delegate']('execute')['to'](_0x1375aa),_0xcba49c['items']['addMany'](_0x2cd1df),_0x4caf4e['panelView']['children']['add'](_0xcba49c),_0x294ac8['children']['add'](_0x4caf4e),_0x1fe8c8['items']['add'](_0x294ac8);}),_0x1375aa['panelView']['children']['add'](_0x1fe8c8);}['_getMenuBarGroupButtons']({command:_0x1729b0,commands:_0x2f6354,parentMenuView:_0x272241,onExecute:_0xc7eb04}){const _0x537837=this['editor'],_0x43c885=_0x537837['locale'];return zi(_0x537837,_0x2f6354)['map'](_0x5ab45a=>{const _0x1d298c=new Jt(_0x43c885,_0x272241),_0x2cc8a4=new jt(_0x43c885);return _0x2cc8a4['set']({'label':_0x5ab45a['label']}),_0x2cc8a4['delegate']('execute')['to'](_0x272241),_0x2cc8a4['on']('execute',()=>_0xc7eb04(_0x5ab45a['id'])),_0x2cc8a4['bind']('isEnabled')['to'](_0x1729b0,'enabledCommandsIds',_0x351f2d=>_0x351f2d['includes'](_0x5ab45a['id'])),_0x1d298c['children']['add'](_0x2cc8a4),_0x1d298c;});}};function Xi(_0x4e9e41,_0x1b35dd){return void 0x0!==_0x4e9e41['order']&&void 0x0===_0x1b35dd['order']?0x1:void 0x0===_0x4e9e41['order']&&void 0x0!==_0x1b35dd['order']?-0x1:void 0x0!==_0x4e9e41['order']&&void 0x0!==_0x1b35dd['order']?_0x4e9e41['order']-_0x1b35dd['order']:0x0;}function zi(_0x1c9c48,_0xfe6ae6){_0xfe6ae6['sort'](Xi);const _0x4ec049={},_0x3b3a0d=[];for(const _0x356659 of _0xfe6ae6)if(void 0x0!==_0x356659['order']){if(_0x356659['order']in _0x4ec049)throw new at('ai-commands-config-order-collision',_0x1c9c48,{'conflictingDefinitions':[_0x356659,_0x4ec049[_0x356659['order']]]});_0x4ec049[_0x356659['order']]=_0x356659,_0x3b3a0d['splice'](_0x356659['order'],0x0,_0x356659);}else _0x3b3a0d['push'](_0x356659);return _0x3b3a0d;}var ji=class extends _0x429cfd{static get['requires'](){return[Qi,Ri];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3689fa){super(_0x3689fa);const _0x33da9a=_0x3689fa['config'],_0x331a88=_0x3689fa['locale'];_0x33da9a['define']('ai.assistant.preserveComments',!0x0),_0x33da9a['define']('ai.assistant.commands',Ji(_0x331a88)),_0x33da9a['define']('ai.assistant.extraCommandGroups',[]),_0x33da9a['define']('ai.assistant.removeCommands',[]);let _0x3f31bd=fi(_0x33da9a['get']('ai.assistant.commands'),_0x331a88);const _0x1bd757=_0x33da9a['get']('ai.assistant.extraCommandGroups'),_0x1b6d5a=_0x33da9a['get']('ai.assistant.removeCommands');_0x1bd757['forEach'](_0x1fa831=>{const _0x2c34f7=_0x3f31bd['find'](_0x3b5f29=>_0x3b5f29['groupId']===_0x1fa831['groupId']);_0x2c34f7?_0x2c34f7['commands']=_0x2c34f7['commands']['concat'](_0x1fa831['commands']):_0x3f31bd['push'](_0x1fa831);}),_0x3f31bd=_0x3f31bd['filter'](_0x1f0297=>!_0x1b6d5a['includes'](_0x1f0297['groupId'])),_0x3f31bd['forEach'](_0x358d27=>{_0x358d27['commands']=_0x358d27['commands']['filter'](_0x3e61b2=>!_0x1b6d5a['includes'](_0x3e61b2['id']));}),_0x33da9a['set']('ai.assistant.commands',_0x3f31bd);}};function Ji(_0x3705fb){return[{'groupId':'editOrReview','groupLabel':ki(_0x3705fb,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':ki(_0x3705fb,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':ki(_0x3705fb,'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':ki(_0x3705fb,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':ki(_0x3705fb,'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':ki(_0x3705fb,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':ki(_0x3705fb,'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':ki(_0x3705fb,'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':ki(_0x3705fb,'Change\x20tone'),'commands':[{'id':'professional','label':ki(_0x3705fb,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':ki(_0x3705fb,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':ki(_0x3705fb,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':ki(_0x3705fb,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':ki(_0x3705fb,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':ki(_0x3705fb,'Change\x20style'),'commands':[{'id':'business','label':ki(_0x3705fb,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':ki(_0x3705fb,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':ki(_0x3705fb,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':ki(_0x3705fb,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':ki(_0x3705fb,'Translate'),'commands':[{'id':'translateEnglish','label':ki(_0x3705fb,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':ki(_0x3705fb,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':ki(_0x3705fb,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':ki(_0x3705fb,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':ki(_0x3705fb,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':ki(_0x3705fb,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':ki(_0x3705fb,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':ki(_0x3705fb,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var Zi=class extends _0x429cfd{['abortController'];static get['requires'](){return[Oi];}constructor(_0x4d16c3){super(_0x4d16c3),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](Oi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x416b31){return this['sendRequest'](_0x416b31)['catch'](_0x55405a=>{if(_0x55405a instanceof vi)return Promise['reject'](_0x55405a);if('AbortError'==_0x55405a['name'])return Promise['resolve']();throw console['error'](_0x55405a),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x3c592b,_0x2d4c73){const _0x3764fe=this['editor']['locale'],_0x4be57a={'Content-Type':'application/json'};if('object'==typeof _0x3c592b)Object['assign'](_0x4be57a,_0x3c592b);else{if(_0x3c592b)try{const _0x24ea21=await _0x3c592b(_0x2d4c73);Object['assign'](_0x4be57a,_0x24ea21);}catch{return Promise['reject'](new vi(ki(_0x3764fe,'AI_ERROR_GET_HEADERS')));}}return _0x4be57a;}async['_prepareRequestParameters'](_0x4494a8,_0x1ca16a){const _0x946308=this['editor']['locale'];if('object'==typeof _0x4494a8)return _0x4494a8;try{return await _0x4494a8(_0x1ca16a);}catch{return Promise['reject'](new vi(ki(_0x946308,'AI_ERROR_GET_PARAMETERS')));}}},ts=class extends Zi{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x157e07){super(_0x157e07),_0x157e07['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x157e07['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x157e07['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x157e07['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x157e07['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x157e07['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x280a78,context:_0x1c57e1,onData:_0x2f2b7a,actionId:_0x4548be}){const _0x12267a=this['editor']['locale'],_0x169ac9=await this['prepareMessages'](_0x280a78,_0x1c57e1,_0x4548be),_0x545ac9=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4548be),_0x421097=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4548be),_0x3f1226={'messages':_0x169ac9,..._0x421097},_0x168eb6={'method':'POST','headers':_0x545ac9,'body':JSON['stringify'](_0x3f1226),'signal':this['abortController']['signal']},_0x240f25=await fetch(this['_apiUrl'],_0x168eb6);if(_0x240f25['ok'])return _0x421097['stream']?await this['_readStreamableResponse'](_0x240f25,_0x2f2b7a):await this['_readStaticResponse'](_0x240f25,_0x2f2b7a),Promise['resolve']();{const _0x4becae=await _0x240f25['text']();return _0x4becae['includes']('context_length_exceeded')?Promise['reject'](new vi(ki(_0x12267a,'AI_ERROR_CONTEXT_LENGTH'))):_0x4becae['includes']('Moderation')?Promise['reject'](new vi(ki(_0x12267a,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x4becae));}}async['prepareMessages'](_0x196b08,_0x4a0fb2,_0x8ead1e){let _0x202833,_0x299412;return _0x4a0fb2?(_0x202833='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.',_0x299412='Instruction:\x0a'+_0x196b08+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x4a0fb2):(_0x202833='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.',_0x299412=_0x196b08),[{'role':'system','content':_0x202833},{'role':'user','content':_0x299412}];}async['_readStreamableResponse'](_0x22cb5e,_0x29e757){const _0x4b68ab=_0x22cb5e['body']['getReader'](),_0x30a59b=new TextDecoder();let _0x1ac0ef='',_0x225723='',_0x2c23cb='',_0xb75642=!0x1;for(;!_0xb75642;){const {done:_0x22ba0c,value:_0x84f23a}=await _0x4b68ab['read'](),_0x3dd251=_0x1ac0ef+_0x30a59b['decode'](_0x84f23a);let _0x5bfe5b='';_0xb75642=_0x22ba0c;try{_0x5bfe5b=this['_cleanUpData'](_0x3dd251),_0x1ac0ef='';}catch{_0x1ac0ef=_0x3dd251;continue;}_0x225723+=_0x5bfe5b,!_0xb75642&&this['_isBufferIncomplete'](_0x225723)||_0x225723&&(_0x2c23cb+=_0x225723,_0x225723='',_0x29e757(_0x2c23cb));}return Promise['resolve']();}async['_readStaticResponse'](_0x470ecc,_0x1128cc){return _0x1128cc((await _0x470ecc['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x798042){const _0x1720c8=_0x798042['split']('<')['length']!==_0x798042['split']('>')['length'],_0x22a55e=_0x798042['length']<0x1e;return _0x1720c8&&_0x22a55e;}['_cleanUpData'](_0x229b1d){return _0x229b1d['split'](/\n(?![^{]*\})/g)['map'](_0x2f06e7=>_0x2f06e7['replace']('data:\x20',''))['filter'](_0x298f53=>_0x298f53&&_0x298f53['length']>0x0&&'[DONE]'!==_0x298f53)['map'](_0x44f298=>{const {choices:_0x369de9}=JSON['parse'](_0x44f298);if(_0x369de9[0x0]?.['delta']?.['content'])return _0x369de9[0x0]['delta']['content'];})['filter'](_0x5df71c=>_0x5df71c)['join']('');}},es=class extends Zi{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),ft('ai-aws-adapter-not-supported');}async['sendRequest'](_0x379a50){throw Ct('ai-aws-adapter-not-supported'),new vi(ki(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},is=class extends Pt{constructor(_0x479f41,_0x566aa9={}){super(_0x479f41),this['isToggleable']=!0x0,this['set']('side',_0x566aa9['side']||'top');const _0x24f870=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Rt(_0x566aa9['class']||[]),_0x24f870['to']('side',_0x3f0589=>'ck-tab-button_'+_0x3f0589),_0x24f870['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ss=class extends _0x294569{['children'];constructor(_0x264938,_0x530341={}){super(_0x264938);const _0x416197=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Rt(_0x530341['class']||[]),_0x416197['to']('class'),_0x416197['if']('isVisible','ck-hidden',_0x4c3ae5=>!_0x4c3ae5)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x294569{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x4844e6,_0x4f764f={}){super(_0x4844e6),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x4f764f['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x4f764f['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x3db783,_0x1993c1)=>_0x3db783&&!_0x1993c1);const _0x315b23=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Rt(_0x4f764f['class']||[]),_0x315b23['to']('side',_0x1ad53f=>'ck-tabs_'+_0x1ad53f),_0x315b23['to']('class'),_0x315b23['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x315b23['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x315b23['to']('side',_0x2cd7d4=>'ck-tabs__buttons-container_'+_0x2cd7d4)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x315b23['to']('side',_0x262524=>'ck-tabs__panels-container_'+_0x262524)]},'children':this['panelViews']},...Rt(_0x4f764f['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x19def5){const _0x966967=this['_tabs']['get'](_0x19def5);return _0x966967||null;}['addTab'](_0x3c2652){const _0x491617=this['_setupButton']({'id':_0x3c2652['id'],'label':_0x3c2652['buttonLabel'],'icon':_0x3c2652['buttonIcon'],'order':_0x3c2652['order']}),_0x228551=new ss(this['locale']);return _0x228551['render'](),_0x3c2652['content']&&_0x228551['children']['add'](_0x3c2652['content']),this['panelViews']['add'](_0x228551),this['_tabs']['set'](_0x3c2652['id'],{'button':_0x491617,'panel':_0x228551,'order':void 0x0!==_0x3c2652['order']?_0x3c2652['order']:null}),this['fire']('addTab:'+_0x3c2652['id'],{'id':_0x3c2652['id'],'button':_0x491617,'panel':_0x228551}),null===this['activeTab']?this['activateTab'](_0x3c2652['id']):this['_hidePanel'](_0x3c2652['id']),{'button':_0x491617,'panel':_0x228551};}['activateTab'](_0x59dcf4){if(null!==_0x59dcf4&&!this['getTab'](_0x59dcf4))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x59dcf4});if(this['isCollapsed']=!0x1,this['activeTab']===_0x59dcf4)return;const _0x2e8570=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x59dcf4,_0x59dcf4&&this['_showPanel'](_0x59dcf4),this['fire']('activateTab:'+_0x59dcf4,{'newTab':_0x59dcf4,'oldTab':_0x2e8570});}['toggleTabPanel'](_0x3aa9bd){this['activeTab']===_0x3aa9bd?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x3aa9bd);}['showTab'](_0x2fd8fd){if(!this['getTab'](_0x2fd8fd))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2fd8fd});this['_showPanel'](_0x2fd8fd),this['_showButton'](_0x2fd8fd),this['fire']('show:'+_0x2fd8fd,_0x2fd8fd);}['hideTab'](_0x38300b){if(!this['getTab'](_0x38300b))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x38300b});const _0x2c9622=this['activeTab'];this['_hidePanel'](_0x38300b),this['_hideButton'](_0x38300b);const _0x4474bf=this['getTabIds']();_0x2c9622===_0x38300b&&_0x4474bf['length']>0x1&&this['activateTab'](_0x4474bf['find'](_0x30c2a4=>_0x30c2a4!==_0x38300b)),this['fire']('hide:'+_0x38300b,_0x38300b);}['_getPanel'](_0x19d6e3){const _0x2f9fea=this['_tabs']['get'](_0x19d6e3);return _0x2f9fea?_0x2f9fea['panel']:null;}['_showPanel'](_0x4baf50){null!==this['activeTab']&&this['activeTab']!==_0x4baf50||this['_getPanel'](_0x4baf50)['show']();}['_hidePanel'](_0x18c961){const _0x26365e=this['_getPanel'](_0x18c961);_0x26365e['isVisible']&&(this['activeTab']===_0x18c961&&(this['activeTab']=null),_0x26365e['hide']());}['_getButton'](_0x2d4a8e){const _0x5958c5=this['_tabs']['get'](_0x2d4a8e);return _0x5958c5?_0x5958c5['button']:null;}['_showButton'](_0x185f15){this['_getButton'](_0x185f15)['show']();}['_hideButton'](_0x531644){this['_getButton'](_0x531644)['hide']();}['_setupButton'](_0x2a3abc){const _0x56fa16=new is(this['locale'],{'side':this['side']}),_0x23d325=this['buttonViews'];if(_0x56fa16['set']({'label':_0x2a3abc['label'],'icon':_0x2a3abc['icon'],'tooltip':!0x0,'withText':!0x0}),_0x56fa16['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x2f28d6,_0x34ead8)=>_0x2f28d6===_0x2a3abc['id']&&!_0x34ead8),_0x56fa16['bind']('side')['to'](this,'side'),_0x2a3abc['order']){const _0x2ebc32=[...this['_tabs']]['reduce']((_0x9dd103,_0x35f30d)=>{const _0x3025cb=_0x35f30d[0x0],{order:_0x53a905}=_0x35f30d[0x1];return!_0x53a905||_0x53a905>_0x2a3abc['order']?_0x9dd103:_0x53a905>=_0x9dd103['order']?{'id':_0x3025cb,'order':_0x53a905}:_0x9dd103;},{'id':'','order':0x0}),_0x11542e=_0x23d325['getIndex'](this['_getButton'](_0x2ebc32['id']));_0x23d325['add'](_0x56fa16,_0x11542e+0x1);}else _0x23d325['add'](_0x56fa16);return _0x56fa16['on']('execute',()=>{this['toggleTabPanel'](_0x2a3abc['id']);}),_0x56fa16;}};const rs=['overlay','sidebar','custom'],os=['left','right'];var as=class extends ns{constructor(_0x544497,_0x21e0c0={}){super(_0x544497,_0x21e0c0),this['set']('type',_0x21e0c0['type']||'sidebar'),this['set']('side',_0x21e0c0['side']||'right'),this['set']('isVisible',_0x21e0c0['visibleByDefault']??!0x0);const _0x1dfd66=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x1dfd66['if']('type','ck-ai-tabs__overlay',_0x950f9c=>'overlay'===_0x950f9c),_0x1dfd66['if']('type','ck-ai-tabs__sidebar',_0x175055=>'sidebar'===_0x175055),_0x1dfd66['if']('isVisible','ck-hidden',_0x3db352=>!_0x3db352)]}}),this['buttonViews']['on']('add',(_0x31f26e,_0x52e7c9)=>{_0x52e7c9['set']('withText',!0x1);});}},hs=class extends _0x59670e{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xe9e762){if(super(_0xe9e762),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x30b1e0=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x30b1e0['showResizeButton']&&(this['showResizeButton']=_0x30b1e0['showResizeButton']),'sidebar'!==_0x30b1e0['type']&&'overlay'!==_0x30b1e0['type']||_0x30b1e0['side']&&(this['side']=_0x30b1e0['side']),'sidebar'===_0x30b1e0['type']){if(this['container']=_0x30b1e0['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x30b1e0['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new as(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x30b1e0['visibleByDefault'],'collapsible':_0x30b1e0['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 _0x1603c4&&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'](_0x503c20){if(_0x503c20&&this['type']!==_0x503c20){if(!rs['includes'](_0x503c20))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x503c20;}}['switchSide'](_0x2976e4){if(_0x2976e4&&this['side']!==_0x2976e4){if(!os['includes'](_0x2976e4))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x2976e4;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},cs=class extends _0x59670e{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x346715];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1af009){if(super(_0x1af009),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 at('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x210f8e=this['context']['plugins']['get'](_0x346715);if(!_0x210f8e['token'])throw new at('ai-missing-token',this);this['_token']=_0x210f8e['token'];}['startConversation'](_0x3eca57,_0x38b2a7){const _0x3a7f47=this['_sendApiRequest']('/conversations','POST',{'id':_0x3eca57,'group':_0x38b2a7});return{'getConversation':async()=>(await _0x3a7f47['request'])['json'](),'abortController':_0x3a7f47['abortController']};}['queryAssistant']({message:_0x580488,conversationId:_0xdaa09a,parts:_0x228a29,capabilities:_0x56f62e,model:_0x303130,attributes:_0x33bb9a}){const _0x11aea4={'prompt':_0x580488,'content':_0x228a29,'model':_0x303130,..._0x56f62e&&{'capabilities':_0x56f62e},..._0x33bb9a&&{'attributes':_0x33bb9a}},_0x3e8497=this['_sendApiRequest']('/conversations/'+_0xdaa09a+'/messages','POST',_0x11aea4,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2f87fb=(await _0x3e8497['request'])['body'];return this['_getStreamReader'](_0x2f87fb);},'abortController':_0x3e8497['abortController']};}['executeCustomAction']({content:_0x1966ec,message:_0x3fd100,model:_0x1b23d1,outputFormat:_0x2ea6a8}){const _0xf80ba1={'content':[{'type':'text','content':_0x1966ec}],'prompt':_0x3fd100,'model':_0x1b23d1,'outputFormat':_0x2ea6a8},_0x5f0635=this['_sendApiRequest']('/actions/custom/calls','POST',_0xf80ba1);return{'getStream':async()=>{const _0x55d7c6=(await _0x5f0635['request'])['body'];return this['_getStreamReader'](_0x55d7c6);},'abortController':_0x5f0635['abortController']};}['executeAction']({actionName:_0x52d936,content:_0x26bf71,args:_0x1ad9ce}){const _0x268cd0={'content':[{'type':'text','content':_0x26bf71}],'args':_0x1ad9ce},_0x105564=this['_sendApiRequest']('/actions/system/'+_0x52d936+'/calls','POST',_0x268cd0);return{'getStream':async()=>{const _0xd99abc=(await _0x105564['request'])['body'];return this['_getStreamReader'](_0xd99abc);},'abortController':_0x105564['abortController']};}['uploadFile'](_0x4f8a0f,_0x31f793,_0x41f232){const _0x5a2aec=new FormData();_0x5a2aec['append']('file',_0x31f793,_0x31f793['name']),_0x41f232&&_0x5a2aec['append']('attributes',JSON['stringify'](_0x41f232));const _0x58e550=this['_sendApiRequest']('/conversations/'+_0x4f8a0f+'/files','POST',_0x5a2aec);return{'getId':async()=>(await _0x58e550['request'])['json'](),'abortController':_0x58e550['abortController']};}['uploadDocuments'](_0x48df6e,_0x3bc477){const _0x4b55e2={'documents':_0x3bc477['map'](_0x5d62c5=>({'content':_0x5d62c5['content'],'attributes':{'version':_0x5d62c5['version'],'sessionId':_0x5d62c5['sessionId'],'channelId':_0x5d62c5['channelId'],'rootName':_0x5d62c5['rootName'],'selections':_0x5d62c5['selections']},...void 0x0!==_0x5d62c5['name']?{'name':_0x5d62c5['name']}:{},...void 0x0!==_0x5d62c5['description']?{'description':_0x5d62c5['description']}:{}}))},_0x4960f6=this['_sendApiRequest']('/conversations/'+_0x48df6e+'/documents/batch','POST',_0x4b55e2);return{'getIds':async()=>(await _0x4960f6['request'])['json'](),'abortController':_0x4960f6['abortController']};}['fetchDocuments'](_0x53ca47,_0x178078){const _0x430db4=new URLSearchParams();_0x430db4['append']('documentIds',_0x178078['join'](','));const _0x166fac=this['_sendApiRequest']('/conversations/'+_0x53ca47+'/documents/batch?'+_0x430db4['toString'](),'GET');return{'getDocuments':async()=>(await _0x166fac['request'])['json'](),'abortController':_0x166fac['abortController']};}['fetchConversations'](_0x85bf5f,_0x2a9e7c={}){const _0x48e47d=new URLSearchParams();_0x48e47d['append']('group',_0x85bf5f),_0x48e47d['append']('excludeEmpty',!0x1!==_0x2a9e7c['excludeEmpty']?'true':'false'),_0x48e47d['append']('limit',_0x2a9e7c['limit']?_0x2a9e7c['limit']['toString']():'100'),_0x48e47d['append']('sortBy',_0x2a9e7c['sortBy']?_0x2a9e7c['sortBy']:'createdAt'),_0x48e47d['append']('order',_0x2a9e7c['order']?_0x2a9e7c['order']:'desc');const _0x4957b5=this['_sendApiRequest']('/conversations?'+_0x48e47d['toString'](),'GET');return{'getConversations':async()=>(await(await _0x4957b5['request'])['json']())['items'],'abortController':_0x4957b5['abortController']};}['deleteConversation'](_0x1274ab){const _0x3fa4f9=this['_sendApiRequest']('/conversations/'+_0x1274ab,'DELETE');return{'execute':async()=>{await _0x3fa4f9['request'];},'abortController':_0x3fa4f9['abortController']};}['updateConversation'](_0x15b747,_0x2937c1){const _0x57a4fa=this['_sendApiRequest']('/conversations/'+_0x15b747,'PATCH',_0x2937c1);return{'getResult':async()=>(await _0x57a4fa['request'],_0x2937c1),'abortController':_0x57a4fa['abortController']};}['fetchConversation'](_0x45681b){const _0x4e09d1=this['_sendApiRequest']('/conversations/'+_0x45681b,'GET');return{'getConversation':async()=>(await _0x4e09d1['request'])['json'](),'abortController':_0x4e09d1['abortController']};}['fetchConversationMessages'](_0x1a699f){const _0x44de9e=this['_sendApiRequest']('/conversations/'+_0x1a699f+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x44de9e['request'])['json']())['items'],'abortController':_0x44de9e['abortController']};}['uploadUrl'](_0x3ee6ae,_0x4e7387,_0x2aabce){const _0x1b4785=this['_sendApiRequest']('/conversations/'+_0x3ee6ae+'/web-resources','POST',{'url':_0x4e7387,'attributes':_0x2aabce});return{'getId':async()=>(await _0x1b4785['request'])['json'](),'abortController':_0x1b4785['abortController']};}['getModels'](_0x5e1f7c='en'){const _0x1b5291=new URLSearchParams();_0x1b5291['append']('language',_0x5e1f7c);const _0x5e978d='/models/1?'+_0x1b5291['toString'](),_0x718575=this['_sendApiRequest'](_0x5e978d,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x718575['request'])['json'](),'abortController':_0x718575['abortController']};}['deleteFile'](_0x126d1f,_0x3ecae3){const _0x529ef3=this['_sendApiRequest']('/conversations/'+_0x126d1f+'/files/'+_0x3ecae3,'DELETE');return{'execute':async()=>{await _0x529ef3['request'];},'abortController':_0x529ef3['abortController']};}['deleteDocument'](_0x14ca7a,_0x5e2f21){const _0x536cfa=this['_sendApiRequest']('/conversations/'+_0x14ca7a+'/documents/'+_0x5e2f21,'DELETE');return{'execute':async()=>{await _0x536cfa['request'];},'abortController':_0x536cfa['abortController']};}['deleteWebResource'](_0x51e806,_0x24aea9){const _0x1a4e09=this['_sendApiRequest']('/conversations/'+_0x51e806+'/web-resources/'+_0x24aea9,'DELETE');return{'execute':async()=>{await _0x1a4e09['request'];},'abortController':_0x1a4e09['abortController']};}['cancelStream'](_0x341501,_0x778fd1){const _0x525809=this['_sendApiRequest']('/conversations/'+_0x341501+'/messages/'+_0x778fd1+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x525809['request'];},'abortController':_0x525809['abortController']};}['resumeStream'](_0x2edb41,_0x22a766,_0x2aed51='0-0'){const _0x50fe2f=new URLSearchParams({'lastEventId':_0x2aed51}),_0x8346a5=this['_sendApiRequest']('/conversations/'+_0x2edb41+'/messages/'+_0x22a766+'/stream?'+_0x50fe2f['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x5468d7=await _0x8346a5['request'];return this['_getStreamReader'](_0x5468d7['body']);},'abortController':_0x8346a5['abortController']};}['callSystemReview']({reviewName:_0x523a1c,content:_0x101638,args:_0x56cb6b}){const _0x1c4782=this['_sendApiRequest']('/reviews/system/'+_0x523a1c+'/calls','POST',{'content':[{'type':'text','content':_0x101638}],'args':_0x56cb6b});return{'getStream':async()=>{const _0x13fdeb=(await _0x1c4782['request'])['body'];return this['_getStreamReader'](_0x13fdeb);},'abortController':_0x1c4782['abortController']};}['processDocument']({document:_0xf06ba1,prompt:_0x5b700b,model:_0x26ed07}){const _0x3a309c=this['_sendApiRequest']('/documents/process','POST',{'document':_0xf06ba1,'prompt':_0x5b700b,'model':_0x26ed07});return{'getResult':async()=>(await _0x3a309c['request'])['json'](),'abortController':_0x3a309c['abortController']};}['callCustomReview']({content:_0xa2667,prompt:_0x47ca6b,model:_0x19484a}){const _0x1a7878=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0xa2667}],'prompt':_0x47ca6b,'model':_0x19484a});return{'getStream':async()=>{const _0x4b7b86=(await _0x1a7878['request'])['body'];return this['_getStreamReader'](_0x4b7b86);},'abortController':_0x1a7878['abortController']};}['upsertAIChatRating'](_0x4539ab,_0x25aa82,_0x5686a1){const _0xd41f31=this['_sendApiRequest']('/conversations/'+_0x4539ab+'/messages/'+_0x25aa82+'/ratings','PUT',{'positiveCount':_0x5686a1['positiveCount'],'totalCount':_0x5686a1['totalCount'],'modificationId':_0x5686a1['modificationId']});return{'execute':async()=>{await _0xd41f31['request'];},'abortController':_0xd41f31['abortController']};}['upsertAIActionRating'](_0x3d1185,_0x3802c5,_0x22a437){const _0x4cfa72=this['_sendApiRequest']('/actions/system/'+_0x3d1185+'/calls/'+_0x3802c5+'/ratings','PUT',{'positiveCount':_0x22a437['positiveCount'],'totalCount':_0x22a437['totalCount']});return{'execute':async()=>{await _0x4cfa72['request'];},'abortController':_0x4cfa72['abortController']};}['upsertCustomAIActionRating'](_0x3e215e,_0x461d7e){const _0x40c3a0=this['_sendApiRequest']('/actions/custom/calls/'+_0x3e215e+'/ratings','PUT',{'positiveCount':_0x461d7e['positiveCount'],'totalCount':_0x461d7e['totalCount']});return{'execute':async()=>{await _0x40c3a0['request'];},'abortController':_0x40c3a0['abortController']};}['upsertAIReviewRating'](_0x289231,_0x53bad4,_0x2a334e,_0x2d054e){const _0x2b2104=this['_sendApiRequest']('/reviews/system/'+_0x289231+'/calls/'+_0x53bad4+'/ratings','PUT',{'positiveCount':_0x2a334e['positiveCount'],'totalCount':_0x2a334e['totalCount'],'dataId':_0x2d054e});return{'execute':async()=>{await _0x2b2104['request'];},'abortController':_0x2b2104['abortController']};}['upsertCustomAIReviewRating'](_0x221dc5,_0xb69dea,_0x561634){const _0x2bf466=this['_sendApiRequest']('/reviews/custom/calls/'+_0x221dc5+'/ratings','PUT',{'positiveCount':_0xb69dea['positiveCount'],'totalCount':_0xb69dea['totalCount'],'dataId':_0x561634});return{'execute':async()=>{await _0x2bf466['request'];},'abortController':_0x2bf466['abortController']};}['_sendApiRequest'](_0x5aff6c,_0x4a6399,_0x1699b0,_0x285cc2={}){const {useCache:_0x479c8e=!0x1,apiUrl:_0x5efc21=this['_apiUrl']}=_0x285cc2,_0x2bea43=new AbortController(),_0x2098ca=_0x479c8e?_0x4a6399+':'+_0x5aff6c:null;if(_0x2098ca){const _0x427670=this['_responseCache']['get'](_0x2098ca);if(_0x427670)return{'request':_0x427670['then'](_0x346268=>_0x346268['clone']()),'abortController':_0x2bea43};}const _0xf1481d=_0x1699b0 instanceof FormData,_0x220b86={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':vt};_0x1699b0&&!_0xf1481d&&(_0x220b86['Content-Type']='application/json');const _0x3082e5={'method':_0x4a6399,'headers':_0x220b86,'signal':_0x2bea43['signal']};_0x1699b0&&(_0x3082e5['body']=_0xf1481d?_0x1699b0:JSON['stringify'](_0x1699b0));const _0x56c545=fetch(''+_0x5efc21+_0x5aff6c,_0x3082e5)['catch'](_0x5022e0=>{_0x2098ca&&this['_responseCache']['delete'](_0x2098ca),this['_handleError'](_0x5022e0);})['then'](_0xa47f7c=>_0xa47f7c['ok']?_0xa47f7c:_0xa47f7c['json']()['then'](_0x102f95=>{throw _0x2098ca&&this['_responseCache']['delete'](_0x2098ca),{'url':_0x5efc21,'path':_0x5aff6c,'method':_0x4a6399,'body':_0x1699b0,'status':(_0xa47f7c||{})['status'],'statusText':(_0xa47f7c||{})['statusText'],'code':_0x102f95['code'],'message':_0x102f95['message'],'traceId':_0x102f95['traceId']};}));return _0x2098ca&&this['_responseCache']['set'](_0x2098ca,_0x56c545['then'](_0x2de6e2=>_0x2de6e2['clone']())),{'request':_0x56c545,'abortController':_0x2bea43};}async*['_getStreamReader'](_0x8ad5dc){const _0x25d820=[],_0xb2e26=_0x8ad5dc['getReader'](),_0x58c792=_0x621125({'onError':_0x26ca83=>{this['_handleError'](_0x26ca83);},'onEvent':_0x210da1=>{_0x210da1['data']=JSON['parse'](_0x210da1['data']),_0x25d820['push'](_0x210da1);}});try{let _0xca48af=!0x1;for(;!_0xca48af;){const {done:_0x5c04f3,value:_0x7373d9}=await _0xb2e26['read']();_0x5c04f3&&(_0xca48af=!0x0),_0x58c792['feed'](this['_decoder']['decode'](_0x7373d9,{'stream':!0x0})),yield*_0x25d820,_0x25d820['length']=0x0;}}catch(_0x2dad56){this['_handleError'](_0x2dad56);}finally{_0xb2e26['releaseLock'](),_0x58c792['reset']();}}['_handleError'](_0x42c24f){if(_0x42c24f instanceof at)throw _0x42c24f;if(_0x42c24f instanceof Error&&'AbortError'===_0x42c24f['name'])throw new at('ai-request-aborted',this,{'originalError':_0x42c24f});throw new at('ai-request-failed',this,{'originalError':_0x42c24f});}};function ls(_0x565d28,_0x17b533,_0xccb1b3){const t=_0x565d28['t'];switch(_0x17b533){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'},_0xccb1b3);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.'},_0xccb1b3);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.'},_0xccb1b3);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.'},_0xccb1b3);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'},_0xccb1b3);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0xccb1b3);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'},_0xccb1b3);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.'},_0xccb1b3);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.'},_0xccb1b3);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.'},_0xccb1b3);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.'},_0xccb1b3);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'},_0xccb1b3);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.'},_0xccb1b3);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 _0x17b533;}}function us(_0x2f63f0){return _0x2f63f0?_0x2f63f0 instanceof _0x1603c4?[_0x2f63f0]:_0x2f63f0['editors']&&0x0!==_0x2f63f0['editors']['length']?Array['from'](_0x2f63f0['editors']):[]:[];}function ds(_0x53e808){const _0x21f3d6=us(_0x53e808);if(!_0x21f3d6['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x21f3d6['length'])return _0x21f3d6[0x0];const _0x2842a4=_0x21f3d6['find'](_0x2b38cc=>_0x2b38cc['ui']?.['focusTracker']?.['isFocused']);if(_0x2842a4)return _0x2842a4;const _0x2ec3a9=function(_0x4d340e){if(_0x4d340e instanceof _0x1603c4)return;const _0x25aaaa=_0x4d340e;if(!_0x25aaaa['plugins']||!_0x25aaaa['plugins']['has']('AIEditing'))return;return _0x25aaaa['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x53e808);return _0x2ec3a9&&_0x21f3d6['includes'](_0x2ec3a9)?_0x2ec3a9:_0x21f3d6[0x0];}const _s='ai-selection',gs=['br'];var As=class extends _0x59670e{constructor(_0x416de0){super(_0x416de0),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'](_0x191ce0){let _0x3867d9=this['_sessionIdByEditor']['get'](_0x191ce0);return _0x3867d9||(_0x3867d9=_0x191ce0['plugins']['has']('RealTimeCollaborationClient')&&_0x191ce0['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Ot(),this['_sessionIdByEditor']['set'](_0x191ce0,_0x3867d9)),_0x3867d9;}async['getDocumentData'](){const _0xa0be85=us(this['context']);if(!_0xa0be85['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x18ce5c=[],_0x546615=new Set();for(const _0x188a39 of _0xa0be85){const _0x49d9f6=_0x188a39['config']['get']('roots')||{};for(const _0x68b2d8 of _0x188a39['model']['document']['getRoots']()){if('$graveyard'===_0x68b2d8['rootName'])continue;const _0x418a1b=await this['_getDocumentDataForEditorRoot'](_0x188a39,_0x68b2d8,_0x546615),_0x4b0c1d=_0x49d9f6[_0x68b2d8['rootName']],_0x29e02a=_0x68b2d8['getAttribute']('$description')??_0x4b0c1d?.['description'];let _0x593bbb=_0x68b2d8['getAttribute']('$title')??_0x4b0c1d?.['title'];_0x593bbb||(_0x593bbb=_0x68b2d8['getAttribute']('$rootEditableOptions')?.['label']??_0x4b0c1d?.['label']),_0x593bbb||(ft('ai-document-root-missing-title',{'editor':_0x188a39,'rootName':_0x68b2d8['rootName']}),_0x593bbb=_0x68b2d8['rootName']),_0x18ce5c['push']({'editor':_0x188a39,'rootName':_0x68b2d8['rootName'],'content':_0x418a1b['content'],'version':_0x418a1b['version'],'sessionId':this['getSessionId'](_0x188a39),'channelId':_0x188a39['config']['get']('collaboration.channelId'),'selections':_0x418a1b['selections'],'name':_0x593bbb,'description':_0x29e02a});}}return _0x18ce5c;}async['_getDocumentDataForEditorRoot'](_0x208f7d,_0x4ec600,_0x370ac8){const _0x4a27d7=_0x208f7d['data']['toView'](_0x4ec600,{'convertAiChatSelectionMarker':!0x0}),_0x958634=new _0x55f7bf(_0x208f7d['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4a27d7,_0x958634,_0x370ac8);let _0x218c05=await this['_getDocumentDataStringFromView'](_0x4a27d7,_0x208f7d);const _0x319302=this['_getMarkersInDocumentOrder'](_0x208f7d,_0x4ec600),_0x581cde=[];for(const _0x236489 of _0x319302){const _0x29ebb5='<'+_0x236489['name']+':start></'+_0x236489['name']+':start>',_0x5d9136=_0x218c05['indexOf'](_0x29ebb5);_0x218c05=_0x218c05['substring'](0x0,_0x5d9136)+_0x218c05['substring'](_0x5d9136+_0x29ebb5['length']);const _0x34b877='<'+_0x236489['name']+':end></'+_0x236489['name']+':end>',_0x4c6a00=_0x218c05['indexOf'](_0x34b877);_0x218c05=_0x218c05['substring'](0x0,_0x4c6a00)+_0x218c05['substring'](_0x4c6a00+_0x34b877['length']),_0x581cde['push']({'markerName':_0x236489['name'],'start':_0x5d9136,'end':_0x4c6a00,'htmlFragment':_0x218c05['substring'](_0x5d9136,_0x4c6a00)});}return{'content':_0x218c05,'version':_0x208f7d['model']['document']['version'],'selections':_0x581cde};}['afterInit'](){this['context']instanceof _0x1603c4?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2f5a6e,_0x337d80)=>{_0x337d80['on']('ready',()=>{this['_integrateEditor'](_0x337d80);});});}['_setOutputDataProcessor'](_0x275451){this['_outputDataProcessor']=_0x275451;}async['_getDocumentDataStringFromView'](_0xfc2899,_0x39832c){let _0x5847e0;if(this['_outputDataProcessor']){const _0xb7907b=_0x39832c['data']['processor']['domConverter']['viewToDom'](_0xfc2899),_0x5b9ee5=await this['_outputDataProcessor'](_0xb7907b);_0x5847e0=_0x39832c['data']['processor']['htmlWriter']['getHtml'](_0x5b9ee5);}else _0x5847e0=_0x39832c['data']['processor']['toData'](_0xfc2899);return _0x5847e0;}['_integrateEditor'](_0x3427c0){if(!_0x3427c0['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x3427c0);_0x3427c0['ui']['focusTracker']['on']('change:isFocused',(_0x430a1c,_0x1a61c8,_0x192c7f)=>{_0x192c7f&&(this['_lastContentFocusedEditor']=_0x3427c0);}),_0x3427c0['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3427c0&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3427c0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':_s,'view':({markerName:_0x2771e7})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2771e7['split'](':')[0x1]],'priority':0xc})}),_0x3427c0['conversion']['for']('dataDowncast')['markerToElement']({'model':_s+':context','view':(_0x3c8615,{writer:_0xe5956f,options:_0x3626d8})=>_0x3626d8['convertAiChatSelectionMarker']?_0xe5956f['createUIElement'](_0x3c8615['markerName']+':'+(_0x3c8615['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0xd4133b){const _0x1b1bf5=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0xd4133b);const _0x5a8b92=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x1b1bf5,_0x5a8b92);}['hideFakeVisualSelection'](_0x85598b){const _0x4de2e8=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x85598b);const _0x10e42a=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4de2e8,_0x10e42a);}async['modelToDataWithIds'](_0x181e8a,_0x4b850e){const _0x432e46=_0x4b850e['data']['toView'](_0x181e8a),_0x132049=new _0x55f7bf(_0x4b850e['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x432e46,_0x132049),this['_getDocumentDataStringFromView'](_0x432e46,_0x4b850e);}['_setDataIdsOnChildren'](_0x17bf92,_0x350772,_0x20cd1d=new Set()){let _0x370e9e=!0x1;for(const _0x34d944 of _0x17bf92['getChildren']()){if(!_0x34d944['is']('view:element')||gs['includes'](_0x34d944['name']))continue;const _0x384ec6=_0x34d944['is']('view:containerElement'),_0x339139=_0x34d944['is']('view:emptyElement'),_0x958ea7=_0x34d944['is']('view:rawElement'),_0x31f282=this['_setDataIdsOnChildren'](_0x34d944,_0x350772,_0x20cd1d);_0x34d944['hasAttribute']('data-id')?(_0x370e9e=!0x0,_0x20cd1d['add'](_0x34d944['getAttribute']('data-id'))):(_0x384ec6||_0x339139||_0x958ea7||_0x31f282)&&(_0x350772['setAttribute']('data-id',this['_nextDataId'](_0x20cd1d),_0x34d944),_0x370e9e=!0x0);}return _0x370e9e;}['_nextDataId'](_0x541968){let _0x281731;do{_0x281731='';for(let _0x125b36=0x0;_0x125b36<0x4;_0x125b36++)_0x281731+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x541968['has'](_0x281731));return _0x541968['add'](_0x281731),_0x281731;}['getSelectionText'](_0x113054){const _0x3e2a78=(_0x113054?_0x113054['model']:ds(this['context'])['model'])['document']['selection'],_0x2c42e0=[],_0x10cad4=Array['from'](_0x3e2a78['getRanges']());_0x10cad4['sort']((_0x3a9820,_0x5cee57)=>_0x3a9820['start']['isBefore'](_0x5cee57['start'])?-0x1:0x1);for(const _0x2fa2d6 of _0x10cad4)for(const _0x43bc52 of _0x2fa2d6['getItems']())_0x43bc52['is']('$textProxy')?_0x2c42e0['push'](_0x43bc52['data']):_0x43bc52['is']('element')&&_0x2c42e0['length']>0x0&&'\x20'!==_0x2c42e0[_0x2c42e0['length']-0x1]&&_0x2c42e0['push']('\x20');return _0x2c42e0['length']?'\x22'+_0x2c42e0['join']('')['trim']()+'\x22':ls(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x13402a){for(let _0x260ef4=0x0;_0x260ef4<this['_fakeSelections']['length'];_0x260ef4++)if(this['_fakeSelections'][_0x260ef4]['id']==_0x13402a)return void this['_fakeSelections']['splice'](_0x260ef4,0x1);}['_addFakeSelection'](_0x466b0d){this['_removeFakeSelectionById'](_0x466b0d['id']),Tt(this['_fakeSelections'],_0x466b0d);}['_refreshFakeSelection'](_0x4170f1,_0x5ccf7e){if(_0x4170f1==_0x5ccf7e)return;const _0x5121bb=_0x4170f1?_0x4170f1['editor']:null,_0x4703e5=_0x5ccf7e?_0x5ccf7e['editor']:null,_0x358c23=(_0x51613e,_0x3f9656)=>{const _0x299dc1=_0x3f9656['model']['markers']['getMarkersGroup'](_s);for(const _0x517637 of _0x299dc1)_0x51613e['removeMarker'](_0x517637);},_0x226b4c=(_0x10b0c1,_0x3c0259,_0x2abafe)=>{const _0x11336e=_0x3c0259['model'];for(let _0x2dea16=0x0;_0x2dea16<_0x2abafe['ranges']['length'];_0x2dea16++){let _0x3fa3d9=_0x2abafe['ranges'][_0x2dea16];const _0x24bff1=_s+':'+_0x2abafe['id']+':'+_0x2dea16;if(_0x3fa3d9['start']['isAtEnd']){const _0x45f2f0=_0x3fa3d9['start']['getLastMatchingPosition'](({item:_0x408994})=>!_0x11336e['schema']['isContent'](_0x408994),{'boundaries':_0x3fa3d9});_0x3fa3d9=_0x10b0c1['createRange'](_0x45f2f0,_0x3fa3d9['end']);}_0x10b0c1['addMarker'](_0x24bff1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3fa3d9});}};_0x5121bb&&_0x4703e5&&_0x5121bb===_0x4703e5&&_0x5ccf7e?_0x5121bb['model']['change'](_0x31d7aa=>{_0x358c23(_0x31d7aa,_0x5121bb),_0x226b4c(_0x31d7aa,_0x4703e5,_0x5ccf7e);}):(_0x5121bb&&_0x5121bb['model']['change'](_0x2ef808=>_0x358c23(_0x2ef808,_0x5121bb)),_0x4703e5&&_0x5ccf7e&&_0x4703e5['model']['change'](_0x22d7dd=>_0x226b4c(_0x22d7dd,_0x4703e5,_0x5ccf7e)));}['_getMarkersInDocumentOrder'](_0x499d9f,_0x4547cc){const _0x136ea6=Array['from'](_0x499d9f['model']['markers']['getMarkersGroup'](_s+':context'));return(_0x4547cc?_0x136ea6['filter'](_0xd09528=>{const _0x110266=_0xd09528['getRange']();return _0x110266&&_0x110266['root']['rootName']===_0x4547cc['rootName'];}):_0x136ea6)['sort']((_0x3ec319,_0x36e083)=>_0x3ec319['getStart']()['isBefore'](_0x36e083['getStart']())?-0x1:_0x3ec319['getStart']()['isAfter'](_0x36e083['getStart']())?0x1:0x0);}};function Is(_0xd9453c,_0x4eaffd){return _0x3b1d00(_0xd9453c,_0x4eaffd);}function ps(_0x5aedbc,_0x554efa){return _0x2a1923(_0x5aedbc,_0x554efa);}function ms(_0x1d8bfc,_0x15eec1,_0x277d02){const _0x1b1fea=null!==_0x15eec1?_0x557739=>_0x557739['attribs'][_0x1d8bfc]===_0x15eec1:_0xe9b01c=>Boolean(_0xe9b01c['attribs'][_0x1d8bfc]);return _0x51339e(_0x110d71=>_0x218f48(_0x110d71)&&_0x1b1fea(_0x110d71),_0x277d02);}function Es(_0x487416,_0x1f1c7a,_0x6166f6){const _0x18c679=null!==_0x1f1c7a?_0x3f0a88=>_0x3f0a88['attribs'][_0x487416]===_0x1f1c7a:_0x58cfd2=>Boolean(_0x58cfd2['attribs'][_0x487416]);return _0x4384fd(_0x5aff3d=>_0x218f48(_0x5aff3d)&&_0x18c679(_0x5aff3d),_0x6166f6);}function Ts(_0x81bd7c){return _0x4384fd(_0x4250b9=>_0x218f48(_0x4250b9)&&function(_0x3cc15f){const _0x4ab5d5=_0x3cc15f['toLowerCase']();return'script'===_0x4ab5d5||'style'===_0x4ab5d5||_0x4ab5d5['includes']('-');}(_0x4250b9['name']),_0x81bd7c);}function ws(_0x157498){return _0x1ea495(_0x7f4a9=>_0x16f861(_0x7f4a9),_0x157498,!0x0,0x1/0x0);}function Cs(_0x4072a0,_0x215f18){return _0x4072a0&&_0x218f48(_0x4072a0)?_0x4072a0['attribs'][_0x215f18]:null;}function fs(_0x5876af,_0x5cc926,_0x229c88){_0x218f48(_0x5876af)&&(null===_0x229c88?delete _0x5876af['attribs'][_0x5cc926]:_0x5876af['attribs'][_0x5cc926]=_0x229c88);}function bs(_0x29547f,_0x387f55,_0x496ad5){const _0x3a1eae=_0x387f55['cloneNode'](!0x0);'beforebegin'===_0x496ad5?_0x3bef2c(_0x29547f,_0x3a1eae):'afterbegin'===_0x496ad5?_0x4c31f2(_0x29547f,_0x3a1eae):'beforeend'===_0x496ad5?_0x2858d4(_0x29547f,_0x3a1eae):'afterend'===_0x496ad5&&_0x52293c(_0x29547f,_0x3a1eae);}function Ss(_0x2923af){const _0x500f8b=[];let _0x577271=_0x2923af;for(;_0x577271;)_0x577271=_0x9aaffd(_0x577271),_0x577271&&_0x500f8b['push'](_0x577271);return _0x500f8b;}function Rs(_0x3cbb36){return _0x3cbb36['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Os(_0x17ba5d){let _0x2731db=0x0;for(;_0x17ba5d['parentNode'];)_0x17ba5d=_0x17ba5d['parentNode'],_0x2731db++;return _0x2731db;}function vs(_0x4b2bd2){const _0x2f3753=[];let _0xe8419a=_0x4b2bd2['nextSibling'];for(;_0xe8419a;)_0x2f3753['push'](_0xe8419a),_0xe8419a=_0xe8419a['nextSibling'];_0x2f3753['forEach'](_0x44d3de=>{_0x505dba(_0x44d3de);});}function ks({documentSuggestions:_0x48bf51,transform:_0x1f7332,documentCompare:_0x51800a,documentCompareOptions:_0x496efa}){const _0x4db728=new Map();for(const [_0x494b3d,{groups:_0x58f433,documentContext:_0x55b64d,documentContent:_0x4bf1a9,editor:_0x9dca71}]of _0x48bf51){const _0x29da85=_0x55b64d['content'],_0x15e355=_0x55b64d['version'],_0x42c922=_0x4bf1a9['cloneNode'](!0x0);for(const {changes:_0x1429f5}of _0x58f433){const _0x25ec5e=_0x1429f5['filter'](_0x5118c4=>'new'!=_0x5118c4['type'])['map'](_0x20f2d0=>ms('data-id',_0x20f2d0['id'],_0x42c922)),_0x316a9e=_0x1429f5['filter'](_0x4601ec=>'removed'!=_0x4601ec['type'])['map'](_0x2ee4c7=>_0x2ee4c7['node']['cloneNode'](!0x0));let _0x21e6c0=null;if(_0x25ec5e['length']){_0x21e6c0=_0x25ec5e[0x0]['previousSibling'];for(let _0x433861=0x0;_0x433861<_0x25ec5e['length'];_0x433861++)_0x505dba(_0x25ec5e[_0x433861]);}if(_0x316a9e['length']){_0x21e6c0||(_0x1429f5[0x0]['anchorId']?_0x21e6c0=ms('data-id',_0x1429f5[0x0]['anchorId'],_0x42c922):(_0x21e6c0=_0x316a9e['shift'](),_0x4c31f2(_0x42c922,_0x21e6c0)));for(let _0x1c90d2=0x0;_0x1c90d2<_0x316a9e['length'];_0x1c90d2++)_0x52293c(_0x21e6c0,_0x316a9e[_0x1c90d2]),_0x21e6c0=_0x316a9e[_0x1c90d2];}}const _0x45f775=ps(_0x42c922),_0x202d41=_0x51800a['getDiff'](_0x29da85,_0x45f775,{'targetEditor':_0x9dca71,'anchor':_0x55b64d['rootName'],..._0x496efa})['getOperations']();if(_0x1f7332){const _0x2fe745=_0x9dca71['model']['document']['history']['getOperations'](_0x15e355),_0xd10ca={'document':_0x9dca71['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x4db728['set'](_0x494b3d,_0x426a31(_0x202d41,_0x2fe745,_0xd10ca)['operationsA']);}else _0x4db728['set'](_0x494b3d,_0x202d41);}return _0x4db728;}function Ns(_0x45660e,_0x2036dd){if('marker'!=_0x2036dd['type'])return;const _0x190ff4=_0x45660e['model']['markers']['get'](_0x2036dd['name']);_0x190ff4&&(_0x2036dd['oldRange']=_0x190ff4['getRange']());}const ys=/* #__PURE__ -- @preserve */
25
+ _t();var xs=class extends ys{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x594b1c){super(),this['_generateUid']=_0x594b1c||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x3f2dcb,_0x2ed29a,_0x46bf13){this['_uidCounter']=0x0;const _0x2fffe5=_0x3f2dcb['cloneNode'](!0x0);Ps(_0x2ed29a,_0x2fffe5);const _0x562381=_0x2fffe5['childNodes'],_0x32f734=Array['from'](_0x562381)['filter'](_0x26e371=>!(0x3===_0x26e371['nodeType']&&''===ps(_0x26e371)['trim']())),_0x2dec32=_0x32f734['length'];this['_existingDataIds']=new Set(Es('data-id',null,_0x2ed29a)['map'](_0x25057b=>Cs(_0x25057b,'data-id'))['filter'](_0x49d0bc=>!!_0x49d0bc));for(const _0x177e33 of _0x32f734)_0x177e33&&_0x218f48(_0x177e33)&&void 0x0===_0x177e33['attribs']['data-id']&&fs(_0x177e33,'data-id','new-element');if(Es('data-id',null,_0x2fffe5)['forEach'](_0x596201=>{const _0x1ad0da=Cs(_0x596201,'data-id');'new-element'===_0x1ad0da||this['_existingDataIds']['has'](_0x1ad0da)||fs(_0x596201,'data-id','new-element');}),0x0===_0x2ed29a['childNodes']['length']){const _0x5d1d9e=[];return Es('data-id','new-element',_0x2fffe5)['forEach'](_0x37d49c=>{const _0x1c3744=this['_generateUid']();fs(_0x37d49c,'data-id',_0x1c3744),_0x5d1d9e['push'](_0x1c3744);}),this['_removeSpecialComments'](_0x2fffe5),{'parsedContent':_0x2fffe5,'newNodeIds':_0x5d1d9e,'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 _0x462059=-0x1,_0x15d12a=!0x1;for(let _0x2ac3b9=0x0;_0x2ac3b9<_0x2dec32;_0x2ac3b9++){const _0x21a2d7=_0x32f734[_0x2ac3b9],_0x50547a=_0x32f734[_0x2ac3b9+0x1];if(this['_isNewNode'](_0x21a2d7)){if(-0x1===_0x462059&&(_0x462059=_0x2ac3b9),this['_markWrappedElements'](_0x21a2d7),!this['_isNewNode'](_0x50547a)){const [_0x19e38c,_0xb82dc1]=this['_findReferenceNode'](_0x21a2d7,_0x15d12a,_0x2ed29a);if(_0x19e38c){const _0x371797=Array['from'](_0x32f734)['slice'](_0x462059,_0x2ac3b9+0x1);this['_insertNodes'](_0x19e38c,_0x371797,_0xb82dc1),_0x462059=-0x1;}}}else{if(this['_isExistingContentComment'](_0x21a2d7))_0x15d12a=!0x0;else{if(this['_isExistingNode'](_0x21a2d7)){const _0x5253b8=Cs(_0x21a2d7,'data-id');if(_0x5253b8&&this['_existingDataIds']['has'](_0x5253b8)){this['_referencedExistingIds']['add'](_0x5253b8);const _0x15f625=ms('data-id',_0x5253b8,_0x2ed29a);this['_replaceNode'](_0x15f625,_0x21a2d7);}}else{if(Ls(_0x21a2d7)){const _0x4efcdd=Ds(_0x21a2d7);ms('data-id',_0x4efcdd,_0x2fffe5)||this['_touchedNodesState']['removedIds']['push'](_0x4efcdd);}}}}}for(const _0x88e2fd of this['_touchedNodesState']['removedIds']){const _0x365f6f=ms('data-id',_0x88e2fd,_0x2ed29a);_0x365f6f&&(this['_rescueUnwrappedElements'](_0x365f6f),this['_removeNode'](_0x365f6f,_0x88e2fd,_0x46bf13));}if(Es('data-id','new-element',_0x2ed29a)['forEach'](_0xc883a=>{const _0x53b4f3=this['_getUid'](_0xc883a);fs(_0xc883a,'data-id',_0x53b4f3),this['_touchedNodesState']['newIds']['push'](_0x53b4f3);}),this['_removeSpecialComments'](_0x2ed29a),_0x46bf13&&_0x46bf13['cutAfterUnstable']){const _0x4af8d7=this['_findLastConfirmationPoint'](_0x32f734),_0x4835a2=this['_getLastStableElement'](_0x2ed29a,_0x4af8d7);this['_markUnstableElements'](_0x2ed29a,_0x4835a2);}if(this['_processWrappedElements'](_0x2ed29a,_0x46bf13),_0x46bf13&&_0x46bf13['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x5f2250=Es('data-id',this['_touchedNodesState']['lastTouchedId'],_0x2ed29a);let _0x343a11=_0x5f2250[_0x5f2250['length']-0x1];for(;_0x343a11;)vs(_0x343a11),_0x343a11=_0x343a11['parentNode'];}return{'parsedContent':_0x2ed29a,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x187c9f,_0x2c3c1a,_0x1643d3){for(const _0x58d74d of _0x2c3c1a){const _0x4afa5b=this['_getUid'](_0x58d74d);fs(_0x58d74d,'data-id',_0x4afa5b),this['_touchedNodesState']['newIds']['push'](_0x4afa5b),this['_touchedNodesState']['lastTouchedId']=_0x4afa5b;}const _0x32cfd3='afterbegin'===_0x1643d3||'afterend'===_0x1643d3?_0x2c3c1a['reverse']():_0x2c3c1a;for(const _0x7c7450 of _0x32cfd3)bs(_0x187c9f,_0x7c7450,_0x1643d3);}['_replaceNode'](_0x38f70e,_0x483036){if(!_0x38f70e)return;if(_0x7088a3=_0x483036,Rs(ps(_0x38f70e))===Rs(ps(_0x7088a3)))return;var _0x7088a3;const _0x3eccb8=Cs(_0x38f70e,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x3eccb8),this['_touchedNodesState']['lastTouchedId']=_0x3eccb8,_0x50261f(_0x38f70e,_0x483036['cloneNode'](!0x0));}['_removeNode'](_0x110076,_0x3d6f7c,_0x25a5b3){if(_0x25a5b3&&_0x25a5b3['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x3d6f7c;const _0x4c539d=_0x25a5b3['replaceRemovedWith']['cloneNode'](!0x0);fs(_0x4c539d,'data-id',_0x3d6f7c),fs(_0x4c539d,'data-removed','true'),_0x50261f(_0x110076,_0x4c539d);}else _0x505dba(_0x110076);}['_findReferenceNode'](_0x1ddaec,_0x3b2bc4,_0x5e363c){const _0x15e730=this['_findPrevElementWithDataId'](_0x1ddaec,!0x1);if(_0x15e730){const _0x82d03c=Ds(_0x15e730),_0x18eb86=ms('data-id',_0x82d03c,_0x5e363c);if(_0x18eb86)return[_0x18eb86,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x82d03c);}const _0x218473=this['_findNextElementWithDataId'](_0x1ddaec,!0x1);if(_0x218473){const _0x2be26c=Ds(_0x218473),_0x502077=ms('data-id',_0x2be26c,_0x5e363c);if(_0x502077)return[_0x502077,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x2be26c);}return _0x3b2bc4?_0x1ddaec['nextSibling']?this['_findFallbackReferenceNode'](_0x1ddaec,_0x5e363c):[_0x5e363c['childNodes'][_0x5e363c['childNodes']['length']-0x1],'afterend']:[_0x5e363c['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x1abab5,_0x3503cc){const _0x5c79a0=[],_0x3385f2=this['_findPrevElementWithDataId'](_0x1abab5,!0x0);if(_0x3385f2){const _0x53455e=ms('data-id',Ds(_0x3385f2),_0x3503cc);_0x53455e&&_0x5c79a0['push']([_0x53455e,'afterend']);}const _0x206c52=this['_findNextElementWithDataId'](_0x1abab5,!0x0);if(_0x206c52){const _0x2a9a06=ms('data-id',Ds(_0x206c52),_0x3503cc);_0x2a9a06&&_0x5c79a0['push']([_0x2a9a06,'beforebegin']);}return _0x5c79a0['length']>0x1?Os(_0x5c79a0[0x0][0x0])<=Os(_0x5c79a0[0x1][0x0])?_0x5c79a0[0x0]:_0x5c79a0[0x1]:0x1===_0x5c79a0['length']?_0x5c79a0[0x0]:[_0x3503cc['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x385afd,_0x3f016f){let _0x97da50=_0x385afd['nextSibling'],_0x3aa52e=null,_0xf01627=!0x1;for(;_0x97da50;){if(_0x16f861(_0x97da50)){if(Ls(_0x97da50)&&(_0x3aa52e=_0x97da50),this['_isExistingContentComment'](_0x97da50)&&_0x3f016f&&!_0xf01627){_0xf01627=!0x0,_0x97da50=_0x97da50['nextSibling'];continue;}break;}const _0x2fb027=Cs(_0x97da50,'data-id');if(_0x2fb027&&'new-element'!==_0x2fb027&&this['_existingDataIds']['has'](_0x2fb027)){_0x3aa52e=_0x97da50;break;}_0x97da50=_0x97da50['nextSibling'];}return _0x3aa52e;}['_findPrevElementWithDataId'](_0x1a82d7,_0x1d831d){let _0x864472=_0x1a82d7['previousSibling'],_0x44de46=null,_0x25cc72=!0x1;for(;_0x864472;){if(_0x16f861(_0x864472)){if(Ls(_0x864472)&&(_0x44de46=_0x864472),this['_isExistingContentComment'](_0x864472)&&_0x1d831d&&!_0x25cc72){_0x25cc72=!0x0,_0x864472=_0x864472['previousSibling'];continue;}break;}const _0x29039a=Cs(_0x864472,'data-id');if(_0x29039a&&'new-element'!==_0x29039a&&this['_existingDataIds']['has'](_0x29039a)){_0x44de46=_0x864472;break;}_0x864472=_0x864472['previousSibling'];}return _0x44de46;}['_markWrappedElements'](_0x4535a5){_0x218f48(_0x4535a5)&&Es('data-id',null,_0x4535a5)['forEach'](_0x232c9c=>{this['_isExistingNode'](_0x232c9c)&&(fs(_0x232c9c,'data-wrapped-id',Cs(_0x232c9c,'data-id')),fs(_0x232c9c,'data-id',null));});}['_processWrappedElements'](_0x336645,_0x594ae6){Es('data-wrapped-id',null,_0x336645)['forEach'](_0x240072=>{const _0x400e19=Cs(_0x240072,'data-wrapped-id');if(this['_hasUnstableParent'](_0x240072))return;const _0x5b5014=ms('data-id',_0x400e19,_0x336645);fs(_0x240072,'data-id',_0x400e19),_0x5b5014&&(this['_removeNode'](_0x5b5014,_0x400e19,_0x594ae6),this['_touchedNodesState']['removedIds']['push'](_0x400e19),this['_touchedNodesState']['lastTouchedId']=_0x400e19);});}['_hasUnstableParent'](_0x588cf5){let _0x4880eb=_0x588cf5['parentNode'];for(;_0x4880eb;){if(Cs(_0x4880eb,'data-unstable'))return!0x0;_0x4880eb=_0x4880eb['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x270e5e){const _0x43bc38=new Set(this['_touchedNodesState']['removedIds']),_0xb06a7b=new Set(this['_touchedNodesState']['newIds']);Es('data-id',null,_0x270e5e)['forEach'](_0x2952b9=>{const _0xbabb4d=Cs(_0x2952b9,'data-id'),_0x47907c=!!_0xbabb4d&&this['_referencedExistingIds']['has'](_0xbabb4d),_0x2ebe33=!!_0xbabb4d&&_0xb06a7b['has'](_0xbabb4d);if(!_0xbabb4d||!_0x47907c&&!_0x2ebe33)return;if(_0x43bc38['has'](_0xbabb4d))return;let _0xcb62=_0x2952b9['parentNode'],_0x3bfcc3=!0x1;for(;_0xcb62;){if(_0xcb62===_0x270e5e){_0x3bfcc3=!0x0;break;}const _0x4e7100=Cs(_0xcb62,'data-id');if(_0x4e7100&&(this['_referencedExistingIds']['has'](_0x4e7100)||_0xb06a7b['has'](_0x4e7100)))return;_0xcb62=_0xcb62['parentNode'];}if(_0x3bfcc3){if(_0x3bef2c(_0x270e5e,_0x2952b9),_0x47907c){const _0x5dd222=this['_generateUid'](),_0x13ad42=this['_touchedNodesState']['modifiedIds']['indexOf'](_0xbabb4d);-0x1!==_0x13ad42&&this['_touchedNodesState']['modifiedIds']['splice'](_0x13ad42,0x1),fs(_0x2952b9,'data-unwrapped-id',_0xbabb4d),fs(_0x2952b9,'data-id',_0x5dd222),this['_touchedNodesState']['newIds']['push'](_0x5dd222),this['_touchedNodesState']['rescuedNewIds']['add'](_0x5dd222),this['_touchedNodesState']['lastTouchedId']=_0x5dd222;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0xbabb4d),this['_touchedNodesState']['lastTouchedId']=_0xbabb4d;}});}['_getUid'](_0x306c9f){return this['_isExistingNode'](_0x306c9f)?Cs(_0x306c9f,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x1b4cb2){ws(_0x1b4cb2)['filter'](_0x126be1=>Ls(_0x126be1)||this['_isExistingContentComment'](_0x126be1))['forEach'](_0x30da6c=>{_0x505dba(_0x30da6c);});}['_findLastConfirmationPoint'](_0x40f56c){let _0x22300d=null,_0x5f218b=null,_0x35183f=null,_0xf6ed80=null;const _0x456752=_0x58717=>{_0x58717&&(_0x22300d=_0x58717),_0x35183f=null,_0xf6ed80=null;};for(let _0x33cdda=0x0;_0x33cdda<_0x40f56c['length'];_0x33cdda++){const _0x38e867=_0x40f56c[_0x33cdda];if(this['_isExistingContentComment'](_0x38e867)){_0x456752(_0x5f218b);continue;}if(_0x218f48(_0x38e867)){const _0x19e973=Cs(_0x38e867,'data-id'),_0x57bc92=_0x33cdda===_0x40f56c['length']-0x1;if(_0x19e973&&'new-element'!==_0x19e973&&this['_touchedNodesState']['modifiedIds']['includes'](_0x19e973)&&!_0x57bc92){_0x456752(_0x19e973),_0x5f218b=_0x19e973;continue;}}let _0x4f791a=null;const _0x2afcc0=Ds(_0x38e867);if(_0x2afcc0&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x2afcc0))_0x5f218b=_0x2afcc0;else{if(_0x2afcc0&&this['_touchedNodesState']['newIds']['includes'](_0x2afcc0))_0x4f791a='N';else{if(!Ls(_0x38e867))continue;_0x4f791a='R';}_0x4f791a===_0xf6ed80||null===_0xf6ed80?_0xf6ed80=_0x4f791a:null!==_0x35183f?(_0x456752(_0x5f218b),_0xf6ed80=_0x4f791a):(_0x35183f=_0xf6ed80,_0xf6ed80=_0x4f791a),_0x5f218b=_0x2afcc0;}}const _0x19cd77=_0x40f56c[_0x40f56c['length']-0x1];return _0x19cd77&&!_0x218f48(_0x19cd77)&&!Ls(_0x19cd77)&&_0x5f218b&&_0x456752(_0x5f218b),_0x22300d;}['_getLastStableElement'](_0x30ca61,_0x1245f0){if(!_0x1245f0)return null;const _0x5271f4=ms('data-id',_0x1245f0,_0x30ca61);if(!_0x5271f4)return null;const _0x43281b=[_0x5271f4,...Ss(_0x5271f4)]['at'](-0x2);if(_0x43281b===_0x5271f4)return _0x5271f4;let _0x1b2281=_0x43281b['previousSibling'];for(;_0x1b2281&&!_0x218f48(_0x1b2281);)_0x1b2281=_0x1b2281['previousSibling'];return _0x1b2281;}['_markUnstableElements'](_0xeb717a,_0x41955b){const _0x5012b6=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x29c6f4=_0x41955b?_0x41955b['nextSibling']:_0xeb717a['firstChild'];for(;_0x29c6f4;)_0x218f48(_0x29c6f4)&&(_0x5012b6['has'](Cs(_0x29c6f4,'data-id'))||Es('data-id',null,_0x29c6f4)['some'](_0x34de83=>_0x5012b6['has'](Cs(_0x34de83,'data-id'))))&&fs(_0x29c6f4,'data-unstable','true'),_0x29c6f4=_0x29c6f4['nextSibling'];}['_isNewNode'](_0x24600a){return Boolean('new-element'===Cs(_0x24600a,'data-id'));}['_isExistingNode'](_0x479285){return Boolean((Cs(_0x479285,'data-id')||'')['length']>0x0&&'new-element'!==Cs(_0x479285,'data-id'));}['_isExistingContentComment'](_0x6a9cad){return Boolean(_0x16f861(_0x6a9cad)&&ps(_0x6a9cad)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ls(_0x55721f){return!!_0x55721f&&Boolean(_0x16f861(_0x55721f)&&ps(_0x55721f)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ds(_0x4d9b98){if(!_0x4d9b98)return null;if(_0x218f48(_0x4d9b98))return Cs(_0x4d9b98,'data-id')??null;if(_0x16f861(_0x4d9b98)){const _0x3cb8c8=ps(_0x4d9b98)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x3cb8c8&&_0x3cb8c8[0x1])return _0x3cb8c8[0x1];}return null;}function Ps(_0x253e9d,_0x721423){const _0x267468=new Map();for(const _0x92aed of Ts(_0x253e9d))_0x267468['set'](Cs(_0x92aed,'data-id'),_0x92aed);const _0x1d1b14=new Set();for(const _0x53e697 of Ts(_0x721423)){const _0x152c35=Cs(_0x53e697,'data-id'),_0x10d228=_0x152c35?_0x267468['get'](_0x152c35):void 0x0;_0x10d228?(_0x50261f(_0x53e697,_0x5bc24e(_0x10d228,!0x0)),_0x1d1b14['add'](_0x152c35)):_0x505dba(_0x53e697);}for(const _0x439e55 of ws(_0x721423))Ls(_0x439e55)&&_0x267468['has'](Ds(_0x439e55))&&_0x505dba(_0x439e55);const _0x418ec8=new Set(Es('data-id',null,_0x721423)['map'](_0x5339e3=>Cs(_0x5339e3,'data-id')));for(const [_0x596b0c,_0x11f455]of _0x267468){if(_0x1d1b14['has'](_0x596b0c))continue;let _0xb2133a=_0x11f455['parent'],_0x1c89ef=null;for(;_0xb2133a&&_0x218f48(_0xb2133a);){const _0x5cb899=Cs(_0xb2133a,'data-id');if(_0x5cb899&&_0x418ec8['has'](_0x5cb899)){_0x1c89ef=_0x5cb899;break;}_0xb2133a=_0xb2133a['parent'];}if(!_0x1c89ef)continue;const _0x4b28ef=ms('data-id',_0x1c89ef,_0x721423);_0x4b28ef&&_0x2858d4(_0x4b28ef,_0x5bc24e(_0x11f455,!0x0));}}const Hs=/* #__PURE__ -- @preserve */
26
+ _t();var Ms=class extends Hs{['_m2html'];constructor(){super();const _0x47b7e4=Object['entries'](_0x115097),_0x51b621=_0x47b7e4['findIndex'](([_0x1c8a41])=>'rehypeDomRaw'===_0x1c8a41);if(-0x1===_0x51b621)throw new at('ai-response-parser-unable-to-set-up-parser');_0x47b7e4['splice'](_0x51b621+0x1,0x0,['rehypeSanitize',_0x5b499a]),this['_m2html']=new _0x329004({'plugins':Object['fromEntries'](_0x47b7e4)});}['convertMarkdownToHTML'](_0x36ba6c){const _0x3f11f1=this['_m2html']['parse'](_0x36ba6c);return this['parseAndNormalizeHTML'](_0x3f11f1);}['parseAndNormalizeHTML'](_0x225c45){return this['_parseHTML'](_0x225c45);}['_parseHTML'](_0x29681e){const _0x2bfac9=Is('<dummy>'+_0x29681e['replace'](/<[^>]*?$/g,'')+'</dummy>');return Vs(_0x2bfac9),_0x2bfac9['children']=_0x2bfac9['children'][0x0]['children'],_0x2bfac9;}};function Vs(_0x53eeae){for(const _0x316559 of _0x53eeae['children'])_0x218f48(_0x316559)?'pre'!==_0x316559['name']&&Vs(_0x316559):_0xf76cfa(_0x316559)&&(_0x316559['data']=_0x316559['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Us({changeGroups:_0x3f6258,documentContextContent:_0x5aafd7,showDiff:_0x35a7c9,trimUnchanged:_0x36ad17=!0x0}){return _0x3f6258['map'](_0x3b5cce=>{if(!_0x3b5cce['editor']||'destroyed'===_0x3b5cce['editor']['state'])return null;const _0x5c9eab=new _0x365804([]),_0xce53d0=new _0x365804([]),_0x541958=new Set();for(const _0x243f8f of _0x3b5cce['changes'])'new'==_0x243f8f['type']&&Es('data-id',null,_0x243f8f['node'])['forEach'](_0x1d952f=>{_0x541958['add'](Cs(_0x1d952f,'data-id'));});for(const _0xd334c1 of _0x3b5cce['changes'])if('removed'!=_0xd334c1['type']?_0xce53d0['children']['push'](_0xd334c1['node']['cloneNode'](!0x0)):_0x35a7c9||_0x541958['has'](_0xd334c1['id'])||_0xce53d0['children']['push'](_0xd334c1['node']['cloneNode'](!0x0)),'new'!=_0xd334c1['type']&&(_0x35a7c9||'removed'!=_0xd334c1['type'])){const _0x2e1bad=_0x51339e(_0x1e2a96=>Cs(_0x1e2a96,'data-id')==_0xd334c1['id'],_0x5aafd7['get'](_0x3b5cce['documentId']),!0x0);_0x2e1bad&&_0x5c9eab['children']['push'](_0x2e1bad['cloneNode'](!0x0));}const {content:_0x1bbfaf,hasChanges:_0x42ccac}=Bs(_0x3b5cce['editor'],_0x5c9eab,_0xce53d0,_0x35a7c9,_0x36ad17);return{'type':_0x3b5cce['changes'][0x0]['type'],'index':_0x3b5cce['index'],'content':_0x1bbfaf,'hasChanges':_0x42ccac};})['filter'](_0x3cde71=>null!==_0x3cde71);}function Bs(_0xb5245,_0x346767,_0x102fa8,_0x275e43,_0x2da8ef=!0x0){const _0x1dc7db=_0xb5245['plugins']['get']('DocumentCompare'),_0x199b15=ps(_0x346767),_0x336d1f=ps(_0x102fa8),_0x5606d4=_0xb5245['data']['parse'](_0x199b15,'$root'),_0x1385df=_0xb5245['model']['createPositionAt'](_0x5606d4,0x0),_0x17a175=_0x1dc7db['getDiff'](_0x199b15,_0x336d1f,{'anchor':_0x1385df,'markDeletions':_0x275e43,'targetEditor':_0xb5245})['getOperations']();if(0x0==_0x17a175['length'])return{'content':_0x346767['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x275e43?function(_0x14ee03,_0x35183c,_0x2c2e09){if(0x0==_0x14ee03['length'])return;const _0x5496d1=_0x2c2e09['plugins']['get']('DocumentCompare'),_0x320d7b=_0x2c2e09['plugins']['get']('SuggestionsConversion');_0x2c2e09['model']['change'](_0x25cc99=>{const _0x1a0ff3=new Set();for(let _0x11b039=0x0;_0x11b039<_0x14ee03['length'];_0x11b039++){const _0x56bc91=_0x14ee03[_0x11b039];if(_0x56bc91['baseVersion']=null,_0x56bc91['isDocumentOperation']=!0x1,_0x5496d1['isMarkedRemoveOperation'](_0x56bc91)){const _0x1227b5=_0x383dd5(_0x56bc91['newRange'],_0x2c2e09['model']),_0x2090f7='suggestion:deletion:'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0x2090f7,_0x1227b5);}else switch(_0x56bc91['type']){case'rename':{if(_0x56bc91['oldName']==_0x56bc91['newName'])break;_0x25cc99['batch']['addOperation'](_0x56bc91),_0x2c2e09['model']['applyOperation'](_0x56bc91);const _0x20225e='$elementName',_0x1cca03=_0x56bc91['position'],_0xd2d527=_0x2c2e09['model']['createRange'](_0x1cca03,_0x2c2e09['model']['createPositionAt'](_0x1cca03['nodeAfter'],'end')),_0x27c173='suggestion:attribute:'+_0x20225e+':'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0x27c173,_0xd2d527);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x56bc91['oldValue']==_0x56bc91['newValue'])break;_0x25cc99['batch']['addOperation'](_0x56bc91),_0x2c2e09['model']['applyOperation'](_0x56bc91);const _0x3b38d1=_0x56bc91['key'];if(!_0x320d7b['isRegisteredAttribute'](_0x3b38d1))break;const _0x5c7f34=_0x383dd5(_0x56bc91['range'],_0x2c2e09['model']),_0x3d64c1='suggestion:attribute:'+_0x3b38d1+':'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0x3d64c1,_0x5c7f34);break;}case'insert':{if(_0x25cc99['batch']['addOperation'](_0x56bc91),_0x2c2e09['model']['applyOperation'](_0x56bc91),Gs(_0x35183c,_0x56bc91),_0x14ee03[_0x11b039+0x1]&&'move'==_0x14ee03[_0x11b039+0x1]['type'])break;const _0x2378a8=_0x56bc91['position'],_0x2340b7=_0x56bc91['howMany'],_0x47f856=_0x383dd5(_0x2c2e09['model']['createRange'](_0x2378a8,_0x2378a8['getShiftedBy'](_0x2340b7)),_0x2c2e09['model']),_0x28b72a='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0x28b72a,_0x47f856);break;}case'split':{_0x25cc99['batch']['addOperation'](_0x56bc91),_0x2c2e09['model']['applyOperation'](_0x56bc91),Gs(_0x35183c,_0x56bc91);const _0x261b3c=_0x56bc91['splitPosition'],_0x88f39a=_0x56bc91['moveTargetPosition'],_0x375f2c=_0x2c2e09['model']['createRange'](_0x261b3c,_0x88f39a),_0xf8eeb3='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0xf8eeb3,_0x375f2c);break;}case'move':{_0x25cc99['batch']['addOperation'](_0x56bc91),_0x2c2e09['model']['applyOperation'](_0x56bc91),Gs(_0x35183c,_0x56bc91);const _0x47275d=_0x56bc91['getMovedRangeStart'](),_0x3620b8=_0x56bc91['howMany'];for(let _0x52f2a3=0x0;_0x52f2a3<_0x3620b8;_0x52f2a3++){const _0x4db3a9=_0x47275d['getShiftedBy'](_0x52f2a3)['nodeAfter'];_0x1a0ff3['add'](_0x4db3a9);}break;}case'remove':{const _0x1700ed=_0x56bc91['sourcePosition'],_0x25c69a=_0x56bc91['howMany'],_0x25767c=new _0x4f23de(_0x1700ed,_0x25c69a);_0x25cc99['batch']['addOperation'](_0x25767c),_0x2c2e09['model']['applyOperation'](_0x25767c),Gs(_0x35183c,_0x56bc91);break;}}}for(const _0x2345fc of _0x1a0ff3){const _0x1cc0c0=_0x2c2e09['model']['createRangeOn'](_0x2345fc),_0x4e107b='suggestion:formatBlock:$fakeWrap:'+Ot()+':$aiSuggestion';_0x35183c['markers']['set'](_0x4e107b,_0x383dd5(_0x1cc0c0,_0x2c2e09['model']));}});}(_0x17a175,_0x5606d4,_0xb5245):_0xb5245['model']['change'](_0x577ab2=>{for(const _0x1977de of _0x17a175)if('remove'==_0x1977de['type']){const _0x4d696d=_0x1977de['sourcePosition'],_0x1e7bbb=_0x1977de['howMany'],_0x4f8d8f=new _0x4f23de(_0x4d696d,_0x1e7bbb);_0x577ab2['batch']['addOperation'](_0x4f8d8f),_0xb5245['model']['applyOperation'](_0x4f8d8f),Gs(_0x5606d4,_0x1977de);}else{if('marker'==_0x1977de['type']){const _0x51398b=_0x1977de['name'],_0x147cae=_0x1977de['newRange'];null!==_0x147cae?_0x5606d4['markers']['set'](_0x51398b,_0x147cae):_0x5606d4['markers']['delete'](_0x51398b);}else _0x1977de['baseVersion']=null,_0x1977de['isDocumentOperation']=!0x1,_0x577ab2['batch']['addOperation'](_0x1977de),_0xb5245['model']['applyOperation'](_0x1977de),Gs(_0x5606d4,_0x1977de);}}),_0x2da8ef){const _0x40ebb1=Fs(_0xb5245,_0x17a175,_0x5606d4);Ws(_0xb5245['model'],_0x40ebb1),function(_0x352ca8,_0x49932a){const _0x15375a=_0x49932a['getFirstRange']()['start'];let _0x263e67=_0x49932a['getFirstRange']()['end'];const _0x2ce769=_0x15375a['root'];(_0x263e67['textNode']||_0x263e67['nodeAfter']&&_0x263e67['nodeAfter']['is']('$text'))&&(_0x7e539(_0x263e67,'...'),qs(_0x2ce769,_0x263e67,0x3),_0x263e67=_0x263e67['getShiftedBy'](0x3)),(_0x15375a['textNode']||_0x15375a['nodeBefore']&&_0x15375a['nodeBefore']['is']('$text'))&&(_0x7e539(_0x15375a,'...'),qs(_0x2ce769,_0x15375a,0x3),_0x15375a['parent']==_0x263e67['parent']&&(_0x263e67=_0x263e67['getShiftedBy'](0x3)));const _0xa6eac8=_0x352ca8['createRange'](_0x352ca8['createPositionAt'](_0x2ce769,0x0),_0x15375a),_0x3aaaba=_0x352ca8['createRange'](_0x263e67,_0x352ca8['createPositionAt'](_0x2ce769,'end')),_0x52aefe=[..._0xa6eac8['getMinimalFlatRanges'](),..._0x3aaaba['getMinimalFlatRanges']()];_0x52aefe['reverse']();for(const _0x14b068 of _0x52aefe)_0x316b4a(_0x14b068),$s(_0x2ce769,_0x14b068);}(_0xb5245['model'],_0x40ebb1);}return{'content':Is(_0xb5245['data']['stringify'](_0x5606d4,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Gs(_0x4ef030,_0x2ce89f){for(const [_0x26cf3f,_0x300060]of _0x4ef030['markers']){const _0x85986e=_0x5677e3['_createFromRanges'](_0x300060['getTransformedByOperation'](_0x2ce89f));_0x85986e['root']==_0x4ef030?_0x4ef030['markers']['set'](_0x26cf3f,_0x85986e):_0x4ef030['markers']['delete'](_0x26cf3f);}}function Fs(_0x1675e2,_0x597b0f,_0x258ba2){const _0x59a71a=_0x1675e2['plugins']['get']('DocumentCompare');let _0x98926a=_0x1675e2['model']['createPositionAt'](_0x258ba2,Number['POSITIVE_INFINITY']),_0x9f915b=_0x1675e2['model']['createPositionAt'](_0x258ba2,0x0);for(const _0x4fb69c of _0x597b0f){let _0xe2ff54,_0x443d39;if(_0x59a71a['isMarkedRemoveOperation'](_0x4fb69c))_0xe2ff54=_0x4fb69c['newRange']['start'],_0x443d39=_0x4fb69c['newRange']['end'];else switch(_0x98926a=Ks(_0x98926a,_0x4fb69c),_0x9f915b=Ks(_0x9f915b,_0x4fb69c),_0x4fb69c['type']){case'rename':_0xe2ff54=_0x4fb69c['position'],_0x443d39=_0xe2ff54['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0xe2ff54=_0x4fb69c['range']['start'],_0x443d39=_0x4fb69c['range']['end'];break;case'insert':_0xe2ff54=_0x4fb69c['position'],_0x443d39=_0xe2ff54['getShiftedBy'](_0x4fb69c['howMany']);break;case'split':_0xe2ff54=_0x4fb69c['splitPosition'],_0x443d39=_0x4fb69c['moveTargetPosition'];break;case'merge':{const _0x38f377=_0x4fb69c['targetPosition']['path']['slice'](0x0,-0x1);_0xe2ff54=_0x1675e2['model']['createPositionFromPath'](_0x258ba2,_0x38f377),_0x443d39=_0xe2ff54['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x1edd6b=_0x4fb69c['howMany'],_0x528773=_0x4fb69c['sourcePosition']['_getTransformedByInsertion'](_0x4fb69c['targetPosition'],_0x1edd6b),_0x324790=_0x4fb69c['getMovedRangeStart']();'remove'==_0x4fb69c['type']?(_0xe2ff54=_0x528773,_0x443d39=_0x528773):(_0xe2ff54=_0x324790,_0x443d39=_0x324790['getShiftedBy'](_0x1edd6b));break;}}_0xe2ff54&&_0xe2ff54['isBefore'](_0x98926a)&&(_0x98926a=_0xe2ff54['clone'](),_0x98926a['stickiness']='toNone'),_0x443d39&&_0x443d39['isAfter'](_0x9f915b)&&(_0x9f915b=_0x443d39['clone'](),_0x9f915b['stickiness']='toNone');}return _0x1675e2['model']['createSelection'](_0x1675e2['model']['createRange'](_0x98926a,_0x9f915b));}function Ks(_0x1568a6,_0x31d53e){return'move'!=_0x31d53e['type']&&'remove'!=_0x31d53e['type']||_0x31d53e['sourceRange']['containsPosition'](_0x1568a6)&&((_0x1568a6=_0x31d53e['sourcePosition']['clone']())['stickiness']='toNone'),_0x1568a6['getTransformedByOperation'](_0x31d53e);}function Ws(_0x2a5fe3,_0xbcc62){Ys(_0x2a5fe3,_0xbcc62,'forward');const _0x36686c=_0xbcc62['getFirstRange']();_0xbcc62['setTo']([]),_0xbcc62['setTo'](_0x36686c,{'backward':!0x0}),Ys(_0x2a5fe3,_0xbcc62,'backward');}function Ys(_0x3bb3cf,_0x2ec932,_0x2d3ce1){let _0x5a95ed=0x14;for(;_0x5a95ed;){_0x3bb3cf['modifySelection'](_0x2ec932,{'unit':'word','direction':_0x2d3ce1}),_0x5a95ed--;const _0xd59fd=_0x2ec932['focus']['forward'==_0x2d3ce1?'nodeBefore':'nodeAfter'];if(_0xd59fd&&_0xd59fd['is']('element')&&_0x3bb3cf['schema']['isBlock'](_0xd59fd)&&_0x3bb3cf['schema']['isObject'](_0xd59fd))break;}}function $s(_0x3544f6,_0x5e1a1a){for(const [_0x4967a6,_0x5c99f8]of _0x3544f6['markers']){const _0x187560=_0x5c99f8['_getTransformedByDeletion'](_0x5e1a1a['start'],_0x5e1a1a['end']['offset']-_0x5e1a1a['start']['offset']);null!=_0x187560?_0x3544f6['markers']['set'](_0x4967a6,_0x187560):_0x3544f6['markers']['delete'](_0x4967a6);}}function qs(_0x434e0f,_0x9649d2,_0x49e7f2){for(let [_0x41d3e5,_0x450280]of _0x434e0f['markers'])_0x450280=_0x450280['_getTransformedByInsertion'](_0x9649d2,_0x49e7f2,!0x1)[0x0],_0x434e0f['markers']['set'](_0x41d3e5,_0x450280);}const Qs=/* #__PURE__ -- @preserve */
27
+ lt();var Xs=class extends Qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x1933ff,config:_0x9c4105,locale:_0x39046d}){super(),this['_connector']=_0x1933ff,this['_config']=_0x9c4105,this['_locale']=_0x39046d;}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 _0x1cacd3=await this['getAll']();let _0x21e16f;return _0x21e16f=this['_availableModels']?this['_filterModels'](_0x1cacd3,this['_availableModels']):_0x1cacd3['filter'](_0x2cb680=>_0x2cb680['recommended']),_0x21e16f;}async['getModel'](_0x45c3e){const _0x3558c0=await this['getAll']();if(!_0x3558c0['length'])return null;if(_0x45c3e){const _0x522f36=this['_getModelById'](_0x3558c0,_0x45c3e);if(_0x522f36)return _0x522f36;ft('ai-chat-model-id-unrecognized',{'modelId':_0x45c3e,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x1b2681=await this['getAvailableModels']();if(!_0x1b2681['length'])return null;if(this['_defaultModelId']){const _0x17de9f=this['_getModelById'](_0x1b2681,this['_defaultModelId']);if(_0x17de9f)return _0x17de9f;ft('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x1b2681[0x0]['id']});}return _0x1b2681[0x0];}async['isAvailable'](_0x56f1a7){return(await this['getAvailableModels']())['some'](_0x43e780=>_0x43e780['name']===_0x56f1a7['name']&&_0x43e780['provider']===_0x56f1a7['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x5c3205=this['_locale']['uiLanguage']||'en',_0x3bb6b9=await this['_connector']['getModels'](_0x5c3205)['list']();this['_modelList']=_0x3bb6b9['items']['map'](_0x54019d=>zs(_0x54019d)?{..._0x54019d,'name':ls(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x54019d);}return[...this['_modelList']];}['_filterModels'](_0x82e7eb,_0x27d7ec){let _0x3ffd8f;if(_0x27d7ec){_0x3ffd8f=[];const _0x1195da=new Set(),_0x5191ee='string'==typeof _0x27d7ec?[_0x27d7ec['toLocaleLowerCase']()]:_0x27d7ec['map'](_0x51cce3=>_0x51cce3['toLocaleLowerCase']());for(const _0x137c6b of _0x5191ee)for(const _0x36138b of _0x82e7eb)!_0x1195da['has'](_0x36138b['id'])&&this['_isMatchingFilter'](_0x36138b,_0x137c6b)&&(_0x3ffd8f['push'](_0x36138b),_0x1195da['add'](_0x36138b['id']));}else _0x3ffd8f=_0x82e7eb;return _0x3ffd8f;}['_isMatchingFilter'](_0x144de1,_0x53bb04){const _0x30e455=_0x144de1['id']['toLocaleLowerCase'](),_0x2dab38=_0x144de1['name']['toLocaleLowerCase'](),_0x50e539=_0x144de1['provider']['toLocaleLowerCase']();return _0x30e455===_0x53bb04||_0x2dab38===_0x53bb04||zs(_0x144de1)&&'auto'===_0x53bb04||_0x50e539===_0x53bb04||_0x30e455['startsWith'](_0x53bb04);}['_getModelById'](_0x2014b4,_0x3e0511){return _0x2014b4['find'](_0x1d026d=>zs(_0x1d026d)&&'auto'===_0x3e0511?_0x1d026d:_0x1d026d['id']===_0x3e0511)||null;}};function zs(_0x113e69){return _0x113e69['id']['startsWith']('agent');}function js(_0x2e1cba,_0x23e045){for(const _0x1538f4 of _0x2e1cba)'noop'!==_0x1538f4['type']&&(_0x1538f4['_aiSource']=_0x23e045);}var Js=class extends _0x59670e{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x303ea9];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Xs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x10e68d,_0x3b1d50){if('completed'!==_0x10e68d['status'])throw new at('ai-gateway-apply-invalid-status',this,{'status':_0x10e68d['status']});const _0x16db9e=_0x10e68d['editor'],{applyMethod:_0x2e830a}=_0x3b1d50;if('suggest'===_0x2e830a&&!_0x16db9e['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',this);const _0x1c7404='suggest'===_0x2e830a,_0x2dc29a=this['context']['plugins']['get'](_0x303ea9),_0x211dd4=_0x16db9e['model']['createPositionAt'](_0x16db9e['model']['document']['getRoot'](),0x0),_0x179b97=_0x2dc29a['getDiff'](_0x10e68d['contentRawOld'],_0x10e68d['contentRawNew'],{'anchor':_0x211dd4,'markDeletions':_0x1c7404,'targetEditor':_0x16db9e}),_0x7c60ff=_0x16db9e['model']['document']['history']['getOperations'](_0x10e68d['documentVersion']),_0x27b45d={'document':_0x16db9e['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x1ec069=_0x426a31(_0x179b97['getOperations'](),_0x7c60ff,_0x27b45d)['operationsA'];js(_0x1ec069,_0x3b1d50['aiSource']??'api'),_0x16db9e['model']['change'](_0x1a32a6=>{if(_0x1c7404)_0x16db9e['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1ec069);else{for(const _0xe1c910 of _0x1ec069)_0xe1c910['baseVersion']=_0x16db9e['model']['document']['version'],Ns(_0x16db9e,_0xe1c910),_0x1a32a6['batch']['addOperation'](_0xe1c910),_0x16db9e['model']['applyOperation'](_0xe1c910);}});}['mergeChangesIntoContent'](_0x45fb52,_0x3cf458,_0x11a0a4){const _0x3870a6=new Ms(),_0x250c98=new xs();let _0x37e042=_0x3870a6['parseAndNormalizeHTML'](_0x3cf458);for(const _0x37c60d of _0x45fb52)try{const _0x1f58b3=_0x3870a6['parseAndNormalizeHTML'](_0x37c60d['content']);_0x37e042=_0x250c98['merge'](_0x1f58b3,_0x37e042,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x1552da){throw new at('ai-gateway-merge-failed',this,{..._0x37c60d},_0x1552da);}return Bs(_0x11a0a4,_0x3870a6['parseAndNormalizeHTML'](_0x3cf458),_0x37e042,!0x1,!0x1)['content'];}},Zs=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x5d15ba){this['_editor']=_0x5d15ba['editor'],this['_rootName']=_0x5d15ba['rootName'],this['_channelId']=_0x5d15ba['channelId'],this['_sessionId']=_0x5d15ba['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'](_0x5f541b){this['_documentVersion']=_0x5f541b;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x5afb59){this['_contentRawOld']=_0x5afb59;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x1f2c24){this['_contentRawNew']=_0x1f2c24;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x6e7021){this['_error']=_0x6e7021;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x2a72d6){return _0x2a72d6['replace'](/ data-id="[a-z0-9]+"/g,'');}},tn=class extends Zs{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0xeea5fb){this['_summary']=_0xeea5fb;}},en=class extends _0x59670e{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x2c4ac6,_0x1d3fd7){if(!_0x2c4ac6)throw new at('ai-documentprocessinggateway-missing-prompt',this);const _0x2fa71e=await this['context']['plugins']['get'](As)['getDocumentData']();if(!_0x2fa71e[0x0])throw new at('ai-documentprocessinggateway-missing-document',this);const _0x30896c=new tn({'editor':_0x2fa71e[0x0]['editor'],'rootName':_0x2fa71e[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x2fa71e[0x0]['sessionId']});if(_0x30896c['contentRawOld']=_0x2fa71e[0x0]['content'],_0x30896c['documentVersion']=_0x2fa71e[0x0]['version'],_0x1d3fd7?.['signal']?.['aborted'])return _0x30896c['abort'](),_0x30896c;const _0x1abd2b=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x30896c['contentRawOld'],'prompt':_0x2c4ac6,'model':_0x1d3fd7['model']});let _0x171af7;if(_0x1d3fd7?.['signal']){if(_0x1d3fd7['signal']['aborted'])return _0x1abd2b['abortController']['abort'](),_0x30896c['abort'](),_0x30896c;const _0x3f2a7e=_0x1d3fd7['signal'],_0x5bfc01=()=>_0x1abd2b['abortController']['abort']();_0x3f2a7e['addEventListener']('abort',_0x5bfc01),_0x171af7=()=>_0x3f2a7e['removeEventListener']('abort',_0x5bfc01);}try{const _0x3b4d60=await _0x1abd2b['getResult']();if(!(_0x3b4d60&&_0x3b4d60['document']&&_0x3b4d60['document']['length']>0x0))throw new at('ai-documentprocessinggateway-empty-reply',this);_0x30896c['contentRawNew']=_0x3b4d60['document'],_0x30896c['summary']=_0x3b4d60['summary']||'';}catch(_0x4c9b81){_0x4c9b81 instanceof Error&&_0x4c9b81['message']['includes']('ai-request-aborted')?_0x30896c['abort']():_0x30896c['error']=_0x4c9b81 instanceof at?_0x4c9b81:new at('ai-documentprocessinggateway-run-failed',this,{},_0x4c9b81);}finally{_0x171af7&&_0x171af7();}return _0x30896c;}['applyResult'](_0xb68654,_0x12630a){this['context']['plugins']['get']('AIGateway')['apply'](_0xb68654,_0x12630a);}};function sn(_0x32a4e1){return _0x32a4e1 instanceof Error&&('AbortError'===_0x32a4e1['name']||('AICoreError'===_0x32a4e1['name']?!0x0===_0x32a4e1['isAbort']:_0x32a4e1['message']['startsWith']('ai-request-aborted')));}var nn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0xca9d2a){super(_0xca9d2a['code'],_0xca9d2a['cause']instanceof Error?{'cause':_0xca9d2a['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0xca9d2a['code'],this['severity']=_0xca9d2a['severity']??'error',this['type']=_0xca9d2a['type']??'system',this['context']=_0xca9d2a['context'],this['isAbort']=_0xca9d2a['isAbort']??sn(_0xca9d2a['cause']);}},rn=class extends _0x59670e{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x35a8f3){return new on(this,_0x35a8f3);}},on=class{['_sink'];['_component'];constructor(_0x3ea09b,_0x19bb61){this['_sink']=_0x3ea09b,this['_component']=_0x19bb61;}['logError'](_0xb5a9f8,_0x5b5807={}){this['_emit'](_0xb5a9f8,_0x5b5807),this['_defaultLog'](_0xb5a9f8);}['reportError'](_0x24e9a7,_0x47efc0={}){this['_emit'](_0x24e9a7,_0x47efc0);}['_emit'](_0x55b342,_0x167b99){sn(_0x55b342)||this['_sink']['fire']('error',{'error':_0x55b342,'component':this['_component'],'context':_0x167b99['context']});}['_defaultLog'](_0x54e9af){if(!sn(_0x54e9af)){if(_0x54e9af instanceof nn){if('user'===_0x54e9af['type']||'network'===_0x54e9af['type'])return;if('warning'===_0x54e9af['severity'])return void console['warn'](this['_component'],_0x54e9af);}console['error'](this['_component'],_0x54e9af);}}};const an='ck-ai-button-primary',hn='ck-ai-button-secondary',cn='ck-ai-button-tertiary';function ln(_0x21012c,_0x93e83a){const _0x314522=new Pt(_0x21012c),_0x42c8e8=ls(_0x21012c,'AI_TABS_LABEL_MINIMIZE'),_0x472870=ls(_0x21012c,'AI_TABS_LABEL_MAXIMIZE');return _0x314522['set']({'withText':!0x1,'icon':_0xd33959,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+cn}),_0x314522['bind']('label')['to'](_0x93e83a,'isMaximized',_0x1591f5=>_0x1591f5?_0x42c8e8:_0x472870),_0x314522['bind']('icon')['to'](_0x93e83a,'isMaximized',_0x35c10c=>_0x35c10c?_0xae34ac:_0xd33959),_0x314522['bind']('isOn')['to'](_0x93e83a,'isMaximized'),_0x314522['on']('execute',()=>{_0x93e83a['fire']('resizeTabs');}),_0x314522;}function un(_0x3d9e72){const _0x30f42e=new xt(_0x3d9e72);return _0x30f42e['attachToDom'](),_0x30f42e['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x30f42e;}const dn=/* #__PURE__ -- @preserve */
28
+ _t();var _n=class extends dn{['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:_0x2e9bd6,isDone:_0x478935=!0x1,isComplete:_0x4c04bf,interactionId:_0x4ad007,areActionsDisabled:_0x28c21d,isFromHistory:_0x183844=!0x1,documentContextContent:_0x41eed2,locale:_0x3de76b,id:_0x1cc698,channelsToEditors:_0x3e8e0d}){super(),this['id']=_0x1cc698||Ot(),this['interactionId']=_0x4ad007,this['type']=_0x2e9bd6,this['areActionsDisabled']=!!_0x28c21d,this['isFromHistory']=_0x183844,this['locale']=_0x3de76b,this['aiResponseParser']=new Ms(),this['aiResponseApplier']=new xs(),this['documentContextContent']=new Map(_0x41eed2?.['map'](_0x3195be=>[_0x3195be['id'],Is(_0x3195be['content'])])||[]),this['_documentIdToSource']=new Map(_0x41eed2?.['map'](_0x259e0f=>[_0x259e0f['id'],{'editor':_0x3e8e0d['get'](_0x259e0f['channelId']),'rootName':_0x259e0f['rootName']}])||[]),this['set']('isDone',_0x478935),this['set']('isComplete',_0x4c04bf??_0x478935),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x57ab2e,_0x5034c0){const _0x38dc19='text'===this['type']?'text':_0x5034c0;this['content']['has'](_0x38dc19)||this['content']['set'](_0x38dc19,''),this['content']['set'](_0x38dc19,this['content']['get'](_0x38dc19)+_0x57ab2e),this['onContentChange'](_0x38dc19);}['done'](_0x445d02=!0x0){this['isComplete']=_0x445d02,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x3f7657,_0x2873ac){this['changeGroups'][_0x3f7657]['state']=_0x2873ac,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x3f7657,'state':_0x2873ac});}['getContentParts']({showDiff:_0x544660,groupIndex:_0x41497b}){const _0x1e9027=this['_getCachedContentParts'](_0x544660,_0x41497b);if(_0x1e9027)return _0x1e9027;let _0x29153f=[];if(void 0x0===_0x41497b)_0x29153f=this['changeGroups'];else{const _0x2f4180=this['changeGroups']['find'](({index:_0x285914})=>_0x285914===_0x41497b);if(!_0x2f4180)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x41497b});_0x29153f=[_0x2f4180];}const _0x3a7c15=Us({'showDiff':_0x544660,'changeGroups':_0x29153f,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x544660,_0x3a7c15),_0x3a7c15;}['_getCachedContentParts'](_0x448e6b,_0x1394eb){const _0x5630dc=_0x448e6b?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x5630dc]['length'])return null;const _0x60551f=this['cachedSuggestionContentParts'][_0x5630dc];if(void 0x0===_0x1394eb)return _0x60551f['length']>0x0&&_0x60551f['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x448e6b,null),null):_0x3922f4(_0x60551f);{const _0x432155=_0x60551f['find'](({index:_0x230691})=>_0x230691===_0x1394eb);if(_0x432155)return[_0x3922f4(_0x432155)];}return null;}['_setCachedContentParts'](_0x5297bc,_0xbceb59){const _0x193a15=_0x5297bc?'withDiff':'withoutDiff';_0xbceb59?_0xbceb59['forEach'](_0x82e90c=>{const _0x452226=this['cachedSuggestionContentParts'][_0x193a15],_0x400137=_0x452226['find'](({index:_0x3c988c})=>_0x3c988c===_0x82e90c['index']);if(_0x400137){const _0xcbeff0=_0x452226['indexOf'](_0x400137);_0x452226['splice'](_0xcbeff0,0x1,_0x82e90c);}else _0x452226['push'](_0x82e90c);}):this['cachedSuggestionContentParts'][_0x193a15]['length']=0x0;}['onContentChange'](_0x1b3ca7){if('modification'===this['type']){if(_0x1b3ca7)this['parsedContent']['set'](_0x1b3ca7,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x1b3ca7)));else{for(const [_0x142faa,_0x7888a3]of this['content'])this['parsedContent']['set'](_0x142faa,this['aiResponseParser']['parseAndNormalizeHTML'](_0x7888a3));}const _0x2689b5=this['changeGroups'];for(const _0x5ac90f of this['content']['keys']())this['updateChangeGroups'](_0x5ac90f);const _0x49762c=this['_getDifferentChangeGroups'](_0x2689b5,this['changeGroups']);(_0x49762c['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x49762c),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'](_0x41a29b,_0x3e004){const _0x12d687=[];for(const _0x45d4d5 of _0x3e004){const _0x3ba3f8=_0x41a29b[_0x45d4d5['index']];_0x3ba3f8?_0x3ba3f8['changes']['length']!==_0x45d4d5['changes']['length']?_0x12d687['push'](_0x45d4d5):_0x3ba3f8['changes']['forEach']((_0x1cd148,_0x246e9b)=>{const _0x3e7067=_0x45d4d5['changes'][_0x246e9b];_0x1cd148['id']!==_0x3e7067['id']&&_0x12d687['push'](_0x45d4d5);}):_0x12d687['push'](_0x45d4d5);}return _0x12d687;}['updateChangeGroups'](_0x2f37e2){const _0x22159f=this['documentContextContent']['get'](_0x2f37e2),_0x74d6f=this['parsedContent']['get'](_0x2f37e2);if(!_0x22159f||!_0x74d6f)return;const _0x2c8840=new _0x1582af('p',{},[new _0x1582af('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x3064e5(ls(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x31f663=this['aiResponseApplier']['merge'](_0x74d6f,_0x22159f['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x2c8840});this['parsedMergedContent']['set'](_0x2f37e2,_0x31f663['parsedContent']);let _0x2b3c8e=[];if(_0x4384fd(_0x3d8d43=>{const _0x28b060=Cs(_0x3d8d43,'data-id');if(!_0x28b060||!_0x1d8fd3(_0x28b060))return!0x1;const _0x11f360=[_0x3d8d43,...Ss(_0x3d8d43)]['at'](-0x2);if(_0x3d8d43!=_0x11f360){const _0x187912=Cs(_0x11f360,'data-id');_0x1d8fd3(_0x187912)||(_0x2b3c8e['push']({'node':_0x11f360,'id':_0x187912,'type':'modified'}),_0x31f663['modifiedNodeIds']['push'](_0x187912));}else _0x31f663['modifiedNodeIds']['includes'](_0x28b060)?_0x2b3c8e['push']({'node':_0x3d8d43,'type':'modified','id':_0x28b060}):_0x31f663['newNodeIds']['includes'](_0x28b060)?_0x2b3c8e['push']({'node':_0x3d8d43,'type':'new','id':_0x28b060,'anchorId':Cs(_0x3d8d43['previousSibling'],'data-id')}):_0x2b3c8e['push']({'node':_0x3d8d43,'type':'removed','id':_0x28b060});return!0x0;},this['parsedMergedContent']['get'](_0x2f37e2)),_0x2b3c8e=_0x2b3c8e['filter'](({node:_0xaf1cd9})=>[...Ss(_0xaf1cd9),_0xaf1cd9]['every'](_0x1acf7d=>!Cs(_0x1acf7d,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x1500db=>_0x1500db['documentId']!==_0x2f37e2),0x0==_0x2b3c8e['length'])return;const _0x465f32=[[_0x2b3c8e[0x0]]];for(let _0x1b0aac=0x1;_0x1b0aac<_0x2b3c8e['length'];_0x1b0aac++){const _0x4262fe=_0x465f32[_0x465f32['length']-0x1],_0x452d1e=_0x4262fe[_0x4262fe['length']-0x1];_0x2b3c8e[_0x1b0aac]['node']['previousSibling']==_0x452d1e['node']&&'modified'!=_0x2b3c8e[_0x1b0aac]['type']&&'modified'!=_0x452d1e['type']?_0x4262fe['push'](_0x2b3c8e[_0x1b0aac]):_0x465f32['push']([_0x2b3c8e[_0x1b0aac]]);}for(const _0x1076ef of _0x465f32){const _0x2e3fba=_0x1076ef[0x0],_0x5e6df5=_0x1076ef[_0x1076ef['length']-0x1],_0x5d2a89=_0x3be5a2(_0x2e3fba['node']['previousSibling']);_0x5d2a89&&_0x1076ef['unshift'](_0x5d2a89);const _0x325d6f=_0x3be5a2(_0x5e6df5['node']['nextSibling']);_0x325d6f&&_0x1076ef['push'](_0x325d6f);}Es('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x2f37e2))['forEach'](_0xf443e4=>{fs(_0xf443e4,'data-wrapped-id',null);});const _0x2db187=new Map();Es('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x2f37e2))['forEach'](_0xbbb68e=>{const _0x286913=Cs(_0xbbb68e,'data-unwrapped-id'),_0x2c64ac=Cs(_0xbbb68e,'data-id');_0x2db187['set'](_0x2c64ac,_0x286913),fs(_0xbbb68e,'data-id',_0x286913),fs(_0xbbb68e,'data-unwrapped-id',null);});for(const _0x35ca37 of _0x2b3c8e){const _0x5cac34=_0x2db187['get'](_0x35ca37['id']);_0x5cac34&&(_0x35ca37['id']=_0x5cac34);}this['changeGroups']['push'](..._0x465f32['map']((_0x5b453f,_0xc00516)=>({'changes':_0x5b453f,'state':'pending','index':_0xc00516,'editor':this['_documentIdToSource']['get'](_0x2f37e2)['editor'],'rootName':this['_documentIdToSource']['get'](_0x2f37e2)['rootName'],'documentId':_0x2f37e2})));const _0x5d4c16=Array['from'](this['documentContextContent']['keys']());function _0x1d8fd3(_0x3554e1){return _0x31f663['modifiedNodeIds']['includes'](_0x3554e1)||_0x31f663['newNodeIds']['includes'](_0x3554e1)||_0x31f663['removedNodeIds']['includes'](_0x3554e1);}function _0x3be5a2(_0x284799){if(_0x284799&&Cs(_0x284799,'data-id')&&!Cs(_0x284799,'data-unstable')){const _0x54b87f=Cs(_0x284799,'data-id');if(!_0x1d8fd3(_0x54b87f))return{'node':_0x284799,'type':'context','id':_0x54b87f};}return null;}this['changeGroups']['sort']((_0x3a9a37,_0x1d283b)=>_0x5d4c16['indexOf'](_0x3a9a37['documentId'])-_0x5d4c16['indexOf'](_0x1d283b['documentId'])),this['changeGroups']['forEach']((_0x538250,_0x6e8209)=>{_0x538250['index']=_0x6e8209;});}};const gn=/* #__PURE__ -- @preserve */
29
+ lt(),An=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var In=class extends gn{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x17bacf,locale:_0x4d6b59,channelsToEditors:_0x20e0c0}){super(),this['id']=Ot(),this['connector']=_0x17bacf,this['isStopped']=!0x0,this['locale']=_0x4d6b59,this['_channelsToEditors']=_0x20e0c0||new Map();}async['start'](){await this['_run']();}async['resume'](_0xd3d37b){await this['_run'](_0xd3d37b);}async['_run'](_0x4ceac3){const _0x506d33=[];let _0x2c23da,_0x251b48,_0x13645c,_0x269598=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x4ceac3||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x42a551=await this['currentRequest']['getStream']();for await(const _0x164746 of _0x42a551){if(this['isStopped'])return;if('error'==_0x164746['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x164746['event']){case'message-metadata':this['messageId']=_0x164746['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x164746['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x164746['data']['conversationTitle'],!0x0);break;case'source':_0x506d33['push'](_0x164746['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'](),_0x2c23da='modification-delta'==_0x164746['event']?'modification':'text',_0x251b48='modification-delta'==_0x164746['event']?_0x164746['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x2c23da&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x2c23da,'interactionId':this['id'],'id':_0x251b48,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x164746['event']&&{'documentId':_0x164746['data']['documentId']}}),'modification'==_0x2c23da&&(this['currentReply']['sources']=_0x506d33['splice'](0x0))),this['currentReply']['appendContent'](_0x164746['data']['textDelta'],_0x164746['data']['documentId']);break;case'mcp-tool-result':_0x13645c=JSON['parse'](_0x164746['data']['result']),this['_handleToolResultData']({'toolName':_0x164746['data']['toolName'],'data':_0x13645c['data'],'attributes':_0x13645c['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x164746['data']['toolName'],'data':_0x164746['data']['data']});}}_0x269598=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x506d33['length']>0x0&&(this['currentReply']['sources']=_0x506d33['splice'](0x0)),this['_finalizeInteraction'](_0x269598),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x2df37b){return this['replies']['find'](_0xee0805=>_0xee0805['id']===_0x2df37b);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x218681=>_0x218681['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x39f1da){const _0x3ac720=this['getDocumentContext'](),_0x3aed22=new _n({'locale':this['locale'],'documentContextContent':_0x3ac720?.['documents'],..._0x39f1da});return this['replies']['push'](_0x3aed22),_0x3aed22['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x3aed22),_0x3aed22;}['setConversationTitle'](_0x6610dd,_0xa195c2=!0x1){this['fire']('setConversationTitle',_0x6610dd,_0xa195c2);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x98194){this['fire']('toolDataReceived',{'type':'result','toolName':_0x98194['toolName'],'data':structuredClone(_0x98194['data']||{}),'attributes':structuredClone(_0x98194['attributes']||{})},this);}['_handleToolNotificationData'](_0x20e5fc){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x20e5fc['toolName'],'data':structuredClone(_0x20e5fc['data'])},this);}['_finalizeInteraction'](_0x1075b4=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x1075b4),this['currentRequest']=this['currentReply']=void 0x0;}};const pn=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']]),mn=/* #__PURE__ -- @preserve */
30
+ _t(),En=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Tn=class AIChatContext extends mn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x32a22b,config:_0xe38f2,ownerId:_0x289e1a}){super(),this['_connector']=_0x32a22b,this['_config']=_0xe38f2,this['_ownerId']=_0x289e1a;}['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'](_0x50f8e4,_0x3844ad){const _0x3658bc=new Map(),{contextItem:_0x3da2f9,hasUnmatched:_0x1c970a}=await this['_populateDocumentContextItem'](_0x50f8e4,_0x3844ad);_0x3da2f9&&_0x3658bc['set'](_0x3da2f9['id'],_0x3da2f9);for(const _0x1fe97a of _0x50f8e4){if('document'===_0x1fe97a['type'])continue;const _0x4a9d7a=await this['_createContextItemFromContent'](_0x1fe97a);this['_addToConversationContextItem'](_0x4a9d7a),_0x3658bc['set'](_0x4a9d7a['id'],_0x4a9d7a);}return{'contextItems':_0x3658bc,'hasUnmatched':_0x1c970a};}async['_populateDocumentContextItem'](_0x40382c,_0x17d3f5){const _0x155bc2=_0x40382c['filter'](_0x480729=>'document'===_0x480729['type']);if(0x0===_0x155bc2['length'])return{'hasUnmatched':!0x1};const _0x42cfe9=_0x155bc2['map'](_0x550d4a=>_0x550d4a['id']),_0x2a36bf=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x42cfe9)['getDocuments'](),_0x2fc895=new Map(_0x2a36bf['map'](_0x37aee6=>[_0x37aee6['id'],_0x37aee6])),_0x364dd0=[];let _0x2859db=!0x1;for(const _0x3776e9 of _0x155bc2){const _0x38d34a=_0x2fc895['get'](_0x3776e9['id']);_0x38d34a&&(this['_matchDocumentToRoot'](_0x38d34a,_0x17d3f5)||(_0x2859db=!0x0),_0x364dd0['push']({'id':_0x38d34a['id'],'content':_0x38d34a['content'],'version':_0x38d34a['attributes']?.['version']??0x0,'sessionId':_0x38d34a['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x38d34a['attributes']?.['channelId']??_0x17d3f5[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x38d34a['attributes']?.['rootName']??_0x17d3f5[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0xfa6598={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x364dd0};return this['_addToConversationContextItem'](_0xfa6598),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0xfa6598,'hasUnmatched':_0x2859db};}['_matchDocumentToRoot'](_0x307af3,_0x3730e3){const _0x4b6f9f=_0x307af3['attributes']?.['channelId'],_0x2dbb84=_0x307af3['attributes']?.['rootName'];if(_0x4b6f9f&&_0x2dbb84){for(const _0x264884 of _0x3730e3)if(_0x264884['config']['get']('collaboration.channelId')===_0x4b6f9f){for(const _0x3927d3 of _0x264884['model']['document']['getRoots']())if('$graveyard'!==_0x3927d3['rootName']&&_0x3927d3['rootName']===_0x2dbb84)return{'editor':_0x264884,'rootName':_0x3927d3['rootName']};}}}async['_createContextItemFromContent'](_0x13e618){return'mcp-tool-context'===_0x13e618['type']?{'id':_0x13e618['id'],'uiId':_0x13e618['id'],'label':_0x13e618['data']?.['label']||_0x13e618['id'],'type':'mcp-tool-context','mcpServerName':_0x13e618['mcpServerName'],'toolName':_0x13e618['toolName'],'data':_0x13e618['data']||{}}:{'id':_0x13e618['id'],'uiId':_0x13e618['id'],'label':_0x13e618['attributes']?.['label']||_0x13e618['name']||_0x13e618['url']||_0x13e618['id'],'type':_0x13e618['type'],..._0x13e618?.['attributes']?.['resourceId']?{'resourceId':_0x13e618['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x439156){this['_pendingContextItems']['get'](_0x439156)?.['isReadOnly']||this['_removeContextItem'](_0x439156);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x2cc6e1 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x2cc6e1['uiId']);const _0x46d587=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x46d587&&this['_addContextItem']({..._0x46d587,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x926285){for(const _0x56bbfd of _0x926285['values']())this['_addToConversationContextItem'](_0x56bbfd);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'](_0x19052b){return Array['from'](_0x19052b['values']())['flatMap'](_0x140426=>this['_mapContextItemToRequestData'](_0x140426));}async['addFilesToContext'](_0x5ebe1d,_0x26e2d5,_0x5a10ba='file'){const _0x4dea5c='files-'+Ot();this['_startUploadOperation'](_0x4dea5c);try{await Promise['all'](_0x5ebe1d['map'](async _0x5d8b26=>{const _0x3d260f='file-'+Ot(),_0x5d8b68=_0x59b4a8(_0x5d8b26['name']),_0x522fb4='file'===_0x5a10ba&&_0x5d8b26['type']['startsWith']('image/')?'image':_0x5a10ba;try{this['_addContextItem']({'type':_0x522fb4,'label':_0x26e2d5?.['label']||_0x5d8b68,'uiId':_0x3d260f,'resourceId':_0x26e2d5?.['resourceId']},!0x0);const _0x3b2520=this['_connector']['uploadFile'](this['_ownerId'],_0x5d8b26,_0x26e2d5);this['_ongoingUploads']['set'](_0x3d260f,_0x3b2520['abortController']);const {id:_0x2d8345}=await _0x3b2520['getId']();this['_ongoingUploads']['delete'](_0x3d260f),this['_finishContextItemLoading']({'type':_0x522fb4,'id':_0x2d8345,'label':_0x26e2d5?.['label']||_0x5d8b68,'uiId':_0x3d260f,'resourceId':_0x26e2d5?.['resourceId']},!0x1);}catch(_0x24478f){if(this['_ongoingUploads']['delete'](_0x3d260f),!sn(_0x24478f)){const _0x51eb0b=new nn({'code':pn['get'](_0x24478f['code'])||'ai-chat-file-upload-failed','cause':_0x24478f,'context':{'fileName':_0x5d8b68}});this['fire']('error',{'error':_0x51eb0b});}this['_removeContextItem'](_0x3d260f);}}));}finally{this['_finishUploadOperation'](_0x4dea5c);}}['addCurrentDocumentToContext'](_0x3c6eab){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x401c14={'type':'document','uiId':'current-document','label':_0x3c6eab,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x401c14);}async['updateCurrentDocuments'](_0x170020){const _0x1e43ff=this['_pendingContextItems']['get']('current-document');if(!_0x1e43ff||!_0x170020['length']||_0x170020['every'](_0x1e9f38=>!_0x1e9f38['content']))return;_0x170020['length']>0x1&&_0x170020['some'](_0x2af22c=>!_0x2af22c['description'])&&ft('ai-chat-documents-missing-description');try{const _0x272398=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x170020)['getIds']();if(_0x272398['length']!==_0x170020['length']||_0x272398['some'](_0x44aed0=>!_0x44aed0?.['id'])){const _0x443934=new at('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x443934});}_0x1e43ff['documents']=_0x170020['map']((_0x398d48,_0x774b8)=>{return{'id':_0x272398[_0x774b8]['id'],'content':_0x398d48['content'],'version':_0x398d48['version'],'sessionId':_0x398d48['sessionId'],'selection':(_0x174d87=_0x398d48['selections'],_0x174d87?_0x174d87['map'](_0xc903fa=>({'start':_0xc903fa['start'],'end':_0xc903fa['end']})):[]),'channelId':_0x398d48['channelId'],'rootName':_0x398d48['rootName']};var _0x174d87;});}catch(_0x286154){const _0x4de1b8=new nn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x286154});this['fire']('error',{'error':_0x4de1b8});}}['addSelectionToContext'](_0x2f5593){this['_addContextItem']({'type':'selection','label':_0x2f5593,'uiId':'selection','content':_0x2f5593});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x2207cb,_0x224576){const _0xe8ea36='url-'+Ot();this['_startUploadOperation'](_0xe8ea36);const _0x47b591='url-'+Ot();try{this['_addContextItem']({'type':'web-resource','label':_0x224576?.['label']||_0x2207cb,'uiId':_0x47b591,'resourceId':_0x224576?.['resourceId']},!0x0);const _0x3880d0=this['_connector']['uploadUrl'](this['_ownerId'],_0x2207cb,_0x224576);this['_ongoingUploads']['set'](_0x47b591,_0x3880d0['abortController']);const {id:_0x20166f}=await _0x3880d0['getId']();this['_ongoingUploads']['delete'](_0x47b591),this['_finishContextItemLoading']({'type':'web-resource','id':_0x20166f,'label':_0x224576?.['label']||_0x2207cb,'uiId':_0x47b591,'resourceId':_0x224576?.['resourceId']},!0x1);}catch(_0x3b2456){this['_ongoingUploads']['delete'](_0x47b591),sn(_0x3b2456)||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x2207cb,'originalError':_0x3b2456}),'url':_0x2207cb}),this['_removeContextItem'](_0x47b591);}finally{this['_finishUploadOperation'](_0xe8ea36);}}['addToolItemToContext'](_0xbaedf7){_0xbaedf7['id']=_0xbaedf7['id']??Ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0xbaedf7['uiId'],_0xbaedf7),this['fire']('contextItemAdded',{'contextItem':_0xbaedf7,'isLoading':!0x1});}async['loadSourceResources'](_0x462b9c,_0x131590,_0x793470){const _0x327d65=this['_addContextOptionsState']['sources']['find'](_0x413774=>_0x413774['id']===_0x462b9c);if(!_0x327d65)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x462b9c}),'sourceId':_0x462b9c}),[];try{const _0x5a6393=(await _0x327d65['getResources'](_0x131590))['map'](_0x52c2a0=>{const _0x3b1d0a=this['_isResourceInContext'](_0x52c2a0['id']);return{..._0x52c2a0,'isInContext':_0x3b1d0a};});return _0x327d65['resources']=_0x5a6393,this['fire']('sourceResourcesLoaded',{'sourceId':_0x462b9c,'source':_0x327d65,'resources':_0x5a6393,'uid':_0x793470}),_0x5a6393;}catch(_0x5ca49e){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x462b9c,'originalError':_0x5ca49e}),'sourceId':_0x462b9c,'sourceLabel':_0x327d65['label']}),[];}}async['addResourceToContext'](_0x57abc9,_0x2b089f){if(this['_isResourceInContext'](_0x2b089f['id']))return;let _0x16ab1c=_0x2b089f['data'];if(!_0x16ab1c&&_0x57abc9['getData'])try{_0x16ab1c=await _0x57abc9['getData'](_0x2b089f['id']);}catch(_0x48a6e6){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id'],'originalError':_0x48a6e6}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});}if(_0x16ab1c)switch(_0x2b089f['type']){case'web-resource':if('string'!=typeof _0x16ab1c)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id'],'expectedType':'string','actualType':typeof _0x16ab1c}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});await this['addUrlToContext'](_0x16ab1c,{'label':_0x2b089f['label'],'resourceId':_0x2b089f['id']});break;case'file':if(!(_0x16ab1c instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id'],'expectedType':'File','actualType':typeof _0x16ab1c}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});await this['addFilesToContext']([_0x16ab1c],{'label':_0x2b089f['label'],'resourceId':_0x2b089f['id']});break;case'text':if('object'!=typeof _0x16ab1c||!('content'in _0x16ab1c)||!('type'in _0x16ab1c))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x16ab1c}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});_0x16ab1c=AIChatContext['_convertTextResourceToFile'](_0x16ab1c,_0x2b089f['label']),await this['addFilesToContext']([_0x16ab1c],{'label':_0x2b089f['label'],'resourceId':_0x2b089f['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id'],'resourceType':_0x2b089f['type']}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']}),'resourceId':_0x2b089f['id'],'sourceId':_0x57abc9['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x1d81bc){if(void 0x0!==_0x1d81bc)this['_addContextOptionsState']['document']['isHidden']=!_0x1d81bc;else{const _0x11c4d7=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x11c4d7;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x431c3b,_0x38822f){switch(_0x431c3b['type']){case'markdown':return new File([_0x431c3b['content']],_0x38822f,{'type':'text/markdown'});case'html':return new File([_0x431c3b['content']],_0x38822f,{'type':'text/html'});default:return new File([_0x431c3b['content']],_0x38822f,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x5aef55){switch(_0x5aef55['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x5aef55['id']}];case'web-resource':return[{'type':'web-resource','id':_0x5aef55['id']}];case'document':return _0x5aef55['documents']?.['length']?_0x5aef55['documents']['map'](_0x2a7a12=>({'type':'document','id':_0x2a7a12['id'],..._0x2a7a12['selection']?.['length']&&{'selection':_0x2a7a12['selection']}})):[];case'mcp-tool-context':{const _0x53b9cd=_0x5aef55;return[{'type':'mcp-tool-context','mcpServerName':_0x53b9cd['mcpServerName'],'toolName':_0x53b9cd['toolName'],'data':{..._0x53b9cd['data'],'label':_0x53b9cd['label']||_0x53b9cd['data']?.['label']||_0x53b9cd['id']},'id':_0x53b9cd['id']}];}default:return[];}}['_addContextItem'](_0x475479,_0xb5e0e=!0x1){if(this['_pendingContextItems']['set'](_0x475479['uiId'],_0x475479),_0x475479['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x475479,'isLoading':_0xb5e0e}),'current-document'===_0x475479['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x475479['resourceId']){const _0x257095=this['_findSourceIdsByResourceId'](_0x475479['resourceId']);_0x257095&&_0x257095['forEach'](_0x8eb49c=>{this['_updateResourceInContextState'](_0x8eb49c,_0x475479['resourceId'],!0x0);});}}['_removeContextItem'](_0x3f0593){const _0x14c344=this['_pendingContextItems']['get'](_0x3f0593),_0x46cef5=this['_ongoingUploads']['get'](_0x3f0593);if(_0x46cef5&&(_0x46cef5['abort'](),this['_ongoingUploads']['delete'](_0x3f0593)),_0x14c344?.['resourceId']){const _0x50f7a5=this['_findSourceIdsByResourceId'](_0x14c344['resourceId']);_0x50f7a5&&_0x50f7a5['forEach'](_0x510e72=>{this['_updateResourceInContextState'](_0x510e72,_0x14c344['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x3f0593),this['fire']('contextItemRemoved',{'uiId':_0x3f0593,'type':_0x14c344?.['type']}),'current-document'===_0x3f0593&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x59d8cc,_0x2599c8){if(this['_pendingContextItems']['has'](_0x59d8cc['uiId'])&&(this['_pendingContextItems']['set'](_0x59d8cc['uiId'],_0x59d8cc),this['fire']('contextItemLoadingEnded',{'contextItem':_0x59d8cc,'isLoading':_0x2599c8}),_0x59d8cc['resourceId'])){const _0x15ebed=this['_findSourceIdsByResourceId'](_0x59d8cc['resourceId']);_0x15ebed&&_0x15ebed['forEach'](_0x534f92=>{this['_updateResourceInContextState'](_0x534f92,_0x59d8cc['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x42375a){this['_conversationContextItems']['set'](_0x42375a['uiId'],_0x42375a);}['_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'](_0x5184c5=>({..._0x5184c5,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x562de3=>({..._0x562de3,'resources':[]}))??[];}['_isResourceInContext'](_0xa100aa){for(const _0x2aecc9 of this['_pendingContextItems']['values']())if(_0x2aecc9['resourceId']===_0xa100aa)return!0x0;for(const _0x23d900 of this['_conversationContextItems']['values']())if(_0x23d900['resourceId']===_0xa100aa)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x1eefff){const _0x4de9e2=[];for(const _0x47c9c3 of this['_addContextOptionsState']['sources'])_0x47c9c3['resources']['find'](_0x3ab9cc=>_0x3ab9cc['id']===_0x1eefff)&&_0x4de9e2['push'](_0x47c9c3['id']);return 0x0===_0x4de9e2['length']?null:_0x4de9e2;}['_updateResourceInContextState'](_0x28e239,_0x5a45bb,_0x5aac43){const _0x156b06=this['_addContextOptionsState']['sources']['find'](_0x4fb490=>_0x4fb490['id']===_0x28e239);if(!_0x156b06)return;const _0x48b322=_0x156b06['resources']['find'](_0x5aae8f=>_0x5aae8f['id']===_0x5a45bb);_0x48b322&&(_0x48b322['isInContext']=_0x5aac43,this['fire']('resourceStateChanged',{'sourceId':_0x28e239,'resourceId':_0x5a45bb,'isInContext':_0x5aac43}));}['_startUploadOperation'](_0x39ecaa){this['_ongoingUploadOperations']['set'](_0x39ecaa,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x3e9a75){this['_ongoingUploadOperations']['delete'](_0x3e9a75),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const wn=/* #__PURE__ -- @preserve */
31
+ lt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_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'](_0x5d0afd){const _0x1a3df7={};return _0x5d0afd&&_0x5d0afd['isWebSearchEnabled']&&(_0x1a3df7['webSearch']={}),_0x5d0afd&&_0x5d0afd['isReasoningEnabled']&&(_0x1a3df7['reasoning']={}),_0x1a3df7;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x31327a){_0x31327a!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x31327a,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x151212){_0x151212!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x151212,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},bn=class extends In{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x3def18){super(_0x3def18),this['conversationId']=_0x3def18['conversationId'],this['contextItems']=_0x3def18['contextItems'],this['capabilities']=_0x3def18['capabilities'],this['userMessage']=_0x3def18['userMessage'],this['model']=_0x3def18['model'],this['attributes']=_0x3def18['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':Tn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Sn=/* #__PURE__ -- @preserve */
32
+ lt();var Rn=class extends Sn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x5556c3){super(),this['options']=_0x5556c3,this['connector']=_0x5556c3['connector'],this['chatModels']=_0x5556c3['chatModels'],this['id']=_0x5556c3['conversationId'],this['isFromHistory']=_0x5556c3['isFromHistory'],this['_channelsToEditors']=_0x5556c3['channelsToEditors'],this['_getSessionId']=_0x5556c3['getSessionId'];}async['init'](_0x575ad6){try{this['chatContext']=new Tn({'connector':this['connector'],'config':_0x575ad6,'ownerId':this['id']}),this['chatContext']['delegate'](...En)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x2f1f42=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x2f1f42});const _0x85fbd=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x85fbd&&await this['setModel'](_0x85fbd);}catch(_0x40099d){const _0x5dbe2e=new nn({'code':'ai-chat-conversation-init-failed','cause':_0x40099d,'type':'network'});this['fire']('error',{'error':_0x5dbe2e});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x352635}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x352635,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x520b6){const _0x352223=new nn({'code':'ai-chat-conversation-start-failed','cause':_0x520b6,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x352223}),_0x352223;}}async['load'](_0x14e337){try{const _0x5f220d=await this['connector']['fetchConversation'](_0x14e337)['getConversation'](),_0x1ae8cc=await this['connector']['fetchConversationMessages'](_0x14e337)['getMessages'](),_0x25bb25=_0x1ae8cc[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x5f220d['id'],'title'in _0x5f220d?this['fire']('setConversationTitle',_0x5f220d['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x11b051=(await this['chatModels']['getAll']())['find'](_0x43bf3a=>_0x43bf3a['id']['toLowerCase']()===_0x25bb25['toLowerCase']());this['selectedModel']=_0x11b051,this['fire']('modelSelected',{'selectedModel':_0x11b051,'isDisabled':!0x0});const {streamingMessageId:_0x3feef9}=await this['_processMessagesToInteractions'](_0x1ae8cc,_0x25bb25);return _0x3feef9&&this['currentInteraction']?this['_resumeStream'](_0x3feef9):this['currentInteraction']=void 0x0,this;}catch(_0x25713e){const _0x32f33b=new nn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x25713e,'type':'network','context':{'conversationId':_0x14e337}});throw this['fire']('error',{'error':_0x32f33b}),_0x32f33b;}}async['_processMessagesToInteractions'](_0x5f3a11,_0x28be39){let _0x3fa270,_0x2a7c24,_0x1ca7f8=!0x1;for(const _0x5c8452 of _0x5f3a11)if('user'===_0x5c8452['role']){const {contextItems:_0x5f35ed,hasUnmatched:_0x27c471}=await this['_extractContextItems'](_0x5c8452);_0x1ca7f8=_0x27c471;const _0x4a51b9={'isReasoningEnabled':Object['hasOwn'](_0x5c8452['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x5c8452['capabilities'],'webSearch')};_0x3fa270=this['createInteraction']({'userMessage':_0x5c8452['prompt'],'contextItems':_0x5f35ed,'capabilities':_0x4a51b9,'modelId':_0x28be39,'attributes':_0x5c8452['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x3fa270,_0x2a7c24=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x5c8452['role']&&_0x3fa270){if('streaming'===_0x5c8452['status']){_0x2a7c24=_0x5c8452['id'];continue;}if('error'===_0x5c8452['status'])continue;const _0x5a3111=[];for(const _0x501bcd of _0x5c8452['content'])switch(_0x501bcd['type']){case'text':case'modification':{const _0x4c1223=_0x3fa270['getDocumentContext'](),_0x3922de=this['_hasSessionMismatch'](_0x4c1223)||_0x1ca7f8;_0x3fa270['currentReply']?.['type']!==_0x501bcd['type']&&(_0x3fa270['currentReply']=_0x3fa270['createReply']({'type':_0x501bcd['type'],'isDone':!0x0,'interactionId':_0x3fa270['id'],'areActionsDisabled':_0x3922de,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x5a3111['length']>0x0&&(_0x3fa270['currentReply']['sources']=_0x5a3111['splice'](0x0))),_0x3fa270['currentReply']['appendContent'](_0x501bcd['content'],_0x501bcd['documentId']);break;}case'url':_0x5a3111['push'](_0x501bcd);break;case'mcp-tool-result':{const {data:_0x499ca6,attributes:_0xad00ce}=JSON['parse'](_0x501bcd['content']);_0x3fa270['_handleToolResultData']({'toolName':_0x501bcd['toolName'],'data':_0x499ca6,'attributes':_0xad00ce});break;}}'cancelled'===_0x5c8452['status']&&this['fire']('error',{'interactionId':_0x3fa270['id'],'error':new at('ai-request-aborted',this)});}}return{'streamingMessageId':_0x2a7c24};}async['_resumeStream'](_0x3e29b0){if(this['currentInteraction'])try{const _0x4a620d=this['connector']['resumeStream'](this['id'],_0x3e29b0);await this['currentInteraction']['resume'](_0x4a620d);}catch(_0x1990a8){_0x1990a8 instanceof at&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x1990a8});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x2d83d1){return _0x2d83d1['content']?this['chatContext']['populateFromMessage'](_0x2d83d1['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x9a23b,attributes:_0x49653e}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4682ae=new Map(this['getPendingContextItems']()),_0x1b3f41=this['chatCapabilities']['getCapabilitiesConfig'](),_0x3f58ec=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x9a23b,'contextItems':_0x4682ae,'capabilities':_0x1b3f41,'modelId':_0x3f58ec,'attributes':_0x49653e,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x152405){if(_0x152405 instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x152405});else{const _0x57a6ab=pn['get'](_0x152405['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x57a6ab,null,{'error':_0x152405})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x481db1,contextItems:_0x26872d,capabilities:_0x4a9bbf,modelId:_0xe90b5a,attributes:_0x3eef7b,channelsToEditors:_0x43ffc7}){const _0x3745d5=new bn({'userMessage':_0x481db1,'contextItems':_0x26872d,'capabilities':_0x4a9bbf,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0xe90b5a,'attributes':_0x3eef7b,'channelsToEditors':_0x43ffc7});return _0x3745d5['delegate'](...An)['to'](this),this['interactions']['push'](_0x3745d5),this['fire']('interactionCreated',_0x3745d5),_0x3745d5;}['getInteraction'](_0x380134){return this['interactions']['find'](_0xa37750=>_0xa37750['id']===_0x380134);}['removeInteraction'](_0x29c4b1){const _0x19fc80=this['getInteraction'](_0x29c4b1);_0x19fc80&&(_0x19fc80['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x19fc80),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x375ddd=this['lastInteraction'];_0x375ddd?.['conversationId']&&_0x375ddd['messageId']&&this['connector']['cancelStream'](_0x375ddd['conversationId'],_0x375ddd['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x8231d1){this['chatContext']['addCurrentDocumentToContext'](_0x8231d1);}async['updateCurrentDocumentsInContext'](_0x436931){await this['chatContext']['updateCurrentDocuments'](_0x436931);}['toggleAddCurrentDocumentOptionVisibility'](_0xa0d8d3){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xa0d8d3);}['_hasSessionMismatch'](_0x3981de){return!!_0x3981de&&_0x3981de['documents']['some'](_0x6c442c=>{const _0x56a920=this['_channelsToEditors']['get'](_0x6c442c['channelId']);return!_0x56a920||_0x6c442c['sessionId']!==this['_getSessionId'](_0x56a920);});}['addSelectionToContext'](_0x3fd4e2){this['chatContext']['addSelectionToContext'](_0x3fd4e2);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x42109b){this['chatContext']['addFilesToContext'](_0x42109b);}['addUrlToContext'](_0x4d90){this['chatContext']['addUrlToContext'](_0x4d90);}['addToolItemToContext'](_0x228a19){this['chatContext']['addToolItemToContext'](_0x228a19);}['addResourceToContext'](_0x2399d2,_0x357221){this['chatContext']['addResourceToContext'](_0x2399d2,_0x357221);}['loadSourceResources'](_0x109217,_0x1a64e7,_0x562706){return this['chatContext']['loadSourceResources'](_0x109217,_0x1a64e7,_0x562706);}['removeFromContext'](_0x33168e){this['chatContext']['removeFromContext'](_0x33168e);}['setWebSearch'](_0x3789fa){this['chatCapabilities']['setWebSearch'](_0x3789fa);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x5c2c26){this['chatCapabilities']['setReasoning'](_0x5c2c26);}['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'](_0x5dd084){_0x5dd084?!0x1===await this['chatModels']['isAvailable'](_0x5dd084)&&(ft('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x5dd084}),_0x5dd084=(await this['chatModels']['getAvailableModels']())[0x0]):(ft('ai-chat-conversation-set-model-null',{'conversation':this}),_0x5dd084=(await this['chatModels']['getAvailableModels']())[0x0]),_0x5dd084['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x5dd084,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x5dd084}));}};function On({groups:_0x5b116e,documentContextContent:_0x219c5f,documents:_0x3e868f}){const _0x224099=new Map();for(const _0x4ddd0c of _0x5b116e){const {documentId:_0x236da5}=_0x4ddd0c,_0x248776=_0x224099['get'](_0x236da5);if(_0x248776)_0x248776['groups']['push'](_0x4ddd0c),_0x248776['indexes']['push'](_0x4ddd0c['index']);else{const _0x5870a5=_0x3e868f['find'](_0x31a2d9=>_0x31a2d9['id']===_0x236da5),_0x4a3d8c=_0x219c5f['get'](_0x236da5);if(!_0x5870a5||!_0x4a3d8c)continue;_0x224099['set'](_0x236da5,{'groups':[_0x4ddd0c],'documentContext':_0x5870a5,'documentContent':_0x4a3d8c,'editor':_0x4ddd0c['editor'],'indexes':[_0x4ddd0c['index']]});}}return _0x224099;}function vn(_0x2155fc,_0x2d193f){const _0x46b4d3=_0x2155fc['files']['length']>0x0&&_0x2155fc['files']['every'](_0x5407ce=>_0x5407ce['type']['startsWith']('image/')),_0x13e6f8=_0x2155fc['plainText']['trim']()['length']>0x0;if(_0x2155fc['files']['length']>0x0&&_0x2d193f['filesEnabled']&&(!_0x46b4d3||!_0x13e6f8)){const _0x5c24e2=_0x2155fc['files']['filter'](_0x2fce56=>_0x2fce56['name']);return _0x5c24e2['length']>0x0?{'type':'file','files':_0x5c24e2}:null;}if(_0x2d193f['urlsEnabled']){const _0x17be84=function(_0x1b4de2){const _0xa09bf4=_0x1b4de2['trim']();if(/\s/['test'](_0xa09bf4))return null;try{const _0x2ba6b5=new URL(_0xa09bf4);return'http:'!==_0x2ba6b5['protocol']&&'https:'!==_0x2ba6b5['protocol']?null:_0x2ba6b5['toString']();}catch{return null;}}(_0x2155fc['plainText']);if(_0x17be84)return{'type':'url','url':_0x17be84};}const _0x702571=_0x2155fc['forceTextAttachment']?0x1:_0x2d193f['longTextThreshold']??0x1/0x0;if(_0x2155fc['plainText']['length']>=Math['max'](_0x702571,0x1)&&_0x2d193f['filesEnabled']){const _0x452730=_0x2d193f['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x2155fc['plainText']],_0x452730,{'type':'text/plain'})]};}return null;}var kn=class extends _0x59670e{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[cs,rn,_0x303ea9];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=un(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'](rn)['createReporter']('aichat'),this['_aiChatModels']=new Xs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x112917=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x4eae1d,_0x1c8fad)=>{this['_handleUIUserMessage']({'message':_0x1c8fad});}),this['listenTo'](_0x112917['view'],'change:activeTab',(_0x57c963,_0x5b1ab4,_0x1cd01a)=>{'chat'!==_0x1cd01a&&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',(_0x765bea,_0x48849b)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x48849b));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x561581,_0x3c2773)=>{this['activeConversation']?.['addUrlToContext'](_0x3c2773);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x24e6b7,_0x304e8c)=>{const _0x1c9d68=this['activeConversation'];if(!_0x1c9d68)return;_0x304e8c['hasDirectory']&&(_0x304e8c['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Ot()}));const _0x1f5956=vn(_0x304e8c,{'pastedTextLabel':ls(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')});_0x1f5956&&(_0x304e8c['preventDefault'](),'url'===_0x1f5956['type']?_0x1c9d68['addUrlToContext'](_0x1f5956['url']):_0x1c9d68['chatContext']['addFilesToContext'](_0x1f5956['files'],void 0x0,_0x1f5956['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x3e5119,_0x30cf74)=>{_0x30cf74['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x42471f,_0x44dee8)=>{this['activeConversation']?.['addResourceToContext'](_0x44dee8['source'],_0x44dee8['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x5985d0,_0x4663a1)=>{this['_removeFromContext'](_0x4663a1);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x36cce0,_0x4398a1)=>{this['activeConversation']?.['loadSourceResources'](_0x4398a1['sourceId'],_0x4398a1['query'],_0x4398a1['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0xac1762,_0x457f0f)=>{this['activeConversation']?.['setModel'](_0x457f0f);}),this['listenTo'](this['_aiChatUi'],'like',(_0x66d849,{replyId:_0x3ad697})=>{console['log']('Liked\x20response',_0x3ad697);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x102b81,{replyId:_0x2e6549})=>{console['log']('Disliked\x20response',_0x2e6549);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x35516b,_0x1b4211)=>{this['_insertSuggestion'](_0x1b4211);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x50f81e,{replyId:_0x50b478,partIndex:_0x2e7b6d})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x50b478,_0x2e7b6d);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x165bac,{replyId:_0xd224fc,partIndex:_0xa7aa7f})=>{const _0x156cb=this['_getDocumentRangeForReplyChanges'](_0xd224fc,_0xa7aa7f);if(!_0x156cb)return;const {reply:_0x53049a}=this['getInteractionAndReplyById'](_0xd224fc);'$graveyard'!=_0x156cb['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x53049a['changeGroups'][_0xa7aa7f]['editor'],'ranges':[_0x156cb['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x4ced0a,_0x7ae8b0)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x7ae8b0);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x55d903,{replyId:_0x3083a9,showDiff:_0x285212})=>{const {interaction:_0xf52e8d,reply:_0x5527b9}=this['getInteractionAndReplyById'](_0x3083a9),_0x30c6e7=_0x5527b9['getContentParts']({'showDiff':_0x285212});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xf52e8d['id']+':'+_0x5527b9['id'],'parts':_0x30c6e7});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x4b757a,{replyId:_0x45fdaf,partIndex:_0x13ecc5})=>{this['_rejectSuggestion']({'replyId':_0x45fdaf,'partIndex':_0x13ecc5}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x12e7e8,_0x1faa87)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x1faa87);}),this['on']('replyCreated',(_0x3473be,_0x328004)=>{this['_addFeedItemReply'](_0x328004);});}['afterInit'](){this['context']instanceof _0x1603c4?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x27d541,_0xddbc36)=>{_0xddbc36['on']('ready',()=>{this['_integrateEditor'](_0xddbc36);});}),this['_initConversation']();}async['_initConversation'](){const _0x2f5cb1=this['context']['config']['get']('ai.chat.initialConversation');let _0x30cf63=_0x2f5cb1;('lastCreated'!=_0x2f5cb1||(_0x30cf63=await this['_getLastCreatedConversationId'](),_0x30cf63))&&('new'==_0x30cf63?await this['_startConversationSafely']():await this['loadConversation'](_0x30cf63));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x4421d6){this['_closeActiveBalloon'](),this['context']['plugins']['get'](hs)['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'](_0x4421d6)['getConversation'](),await this['_startConversationSafely']({'id':_0x4421d6}),await this['activeConversation']['load'](_0x4421d6),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x24be13){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x4421d6}),this['_reporter']['logError'](new at('ai-chat-conversation-not-found',this,void 0x0,_0x24be13),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x5bc858){let _0x3f1ac4=null,_0x23618c=null;this['on']('toolDataReceived',(_0x2d0139,_0x38f058,_0x33926b)=>{_0x33926b['id']!==_0x3f1ac4&&(_0x3f1ac4=_0x33926b['id'],_0x23618c=this['_getAIChatFeedAPI'](_0x33926b)),_0x5bc858(_0x38f058,_0x23618c);});}['addCurrentDocumentToChatContext'](){us(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](ls(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x4540a2){const _0x16dc14=this['_aiEditing']['getSelectionText'](_0x4540a2);this['activeConversation']?.['addSelectionToContext'](_0x16dc14),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x552ec2){await this['_startConversationSafely']({'modelId':_0x552ec2?.['modelId']});}async['sendMessage'](_0x439042){await this['_handleUIUserMessage'](_0x439042);}['getGroupId'](){const _0x1c6105=this['context']['config']['get']('collaboration.channelId');if(!_0x1c6105)throw new at('ai-missing-channel-id',this);return _0x1c6105;}['_handleRemovedConversation'](_0x2af921){this['activeConversation']['id']===_0x2af921&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x29b615){const {reply:_0x2968b9,interaction:_0xa6a6e8}=this['getInteractionAndReplyById'](_0x29b615['replyId']),_0x1c83a4=void 0x0!==_0x29b615['partIndex']?[_0x2968b9['changeGroups'][_0x29b615['partIndex']]]:_0x2968b9['changeGroups']['filter'](_0x138a5d=>'pending'==_0x138a5d['state']);return _0x1c83a4['map'](_0x48eb7c=>_0x2968b9['changeGroups']['indexOf'](_0x48eb7c))['forEach'](_0x3f33c3=>{const _0x54ace1=this['_getDocumentRangeForReplyChanges'](_0x29b615['replyId'],_0x3f33c3);_0x54ace1&&'$graveyard'!=_0x54ace1['range']['root']['rootName']?(_0x2968b9['setChangeGroupState'](_0x3f33c3,'accepted'),void 0x0!==_0x29b615['partIndex']&&this['_scrollToSuggestionRange'](_0x54ace1['range'],!0x1,_0x54ace1['targetEditor'])):_0x2968b9['setChangeGroupState'](_0x3f33c3,'outdated');}),On({'groups':_0x1c83a4['filter'](_0x5218f3=>'accepted'===_0x5218f3['state']),'documentContextContent':_0x2968b9['documentContextContent'],'documents':_0xa6a6e8['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x38e4f7){const _0x103158=this['context']['plugins']['get'](_0x303ea9),{reply:_0x18a2bc,interaction:_0x91bac4}=this['getInteractionAndReplyById'](_0x38e4f7['replyId']),_0x1897e8=this['_prepareDocumentSuggestions'](_0x38e4f7),_0x14a9f6=ks({'documentSuggestions':_0x1897e8,'transform':!0x0,'documentCompare':_0x103158,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0xd6661c,_0x265650]of _0x14a9f6){const {editor:_0x2d762b,indexes:_0x49fcd1}=_0x1897e8['get'](_0xd6661c);if(!_0x2d762b['plugins']['has']('TrackChanges')){ft('ai-no-track-changes',{'editor':_0x2d762b});continue;}let _0xd8273b;js(_0x265650,'chat'),_0x2d762b['model']['change'](_0xbd58af=>{_0xd8273b=_0xbd58af['batch'],_0x2d762b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x265650),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xd8273b,{'interactionId':_0x91bac4['id'],'replyId':_0x18a2bc['id'],'indexes':_0x49fcd1});}this['_updateRatings'](_0x18a2bc);}['_applySuggestion'](_0x354945){const _0x34a849=this['context']['plugins']['get'](_0x303ea9),{reply:_0x2de026,interaction:_0xbbbcf8}=this['getInteractionAndReplyById'](_0x354945['replyId']),_0x3ae17a=this['_prepareDocumentSuggestions'](_0x354945),_0x11eea3=ks({'documentSuggestions':_0x3ae17a,'transform':!0x0,'documentCompare':_0x34a849,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x3e2320,_0x2d9c42]of _0x11eea3){const {editor:_0x464c8f,indexes:_0x196316}=_0x3ae17a['get'](_0x3e2320);let _0x5aeaf1;js(_0x2d9c42,'chat');try{_0x464c8f['model']['change'](_0x20465b=>{_0x5aeaf1=_0x20465b['batch'];for(const _0x47b5bb of _0x2d9c42)_0x47b5bb['baseVersion']=_0x464c8f['model']['document']['version'],Ns(_0x464c8f,_0x47b5bb),_0x20465b['batch']['addOperation'](_0x47b5bb),_0x464c8f['model']['applyOperation'](_0x47b5bb);}),this['_batchToChanges']['set'](_0x5aeaf1,{'interactionId':_0xbbbcf8['id'],'replyId':_0x2de026['id'],'indexes':_0x196316});}catch(_0x9362b4){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x9362b4})),_0x9362b4;}}this['_updateRatings'](_0x2de026);}['_rejectSuggestion'](_0x4bac65){const {reply:_0x3b2154}=this['getInteractionAndReplyById'](_0x4bac65['replyId']);_0x3b2154['setChangeGroupState'](_0x4bac65['partIndex'],'rejected');}['_openBalloonFor'](_0x3ee2d6,_0x506129){if(!this['_hasAIChatBalloon'])return;const {reply:_0x30b2da}=this['getInteractionAndReplyById'](_0x3ee2d6),_0x595877=_0x30b2da['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x595877['length'])return;let _0x33b587,_0x2d61c2;if(void 0x0!==_0x506129?(_0x2d61c2=_0x595877['find'](_0x5ecd1c=>_0x5ecd1c['index']==_0x506129),_0x33b587=_0x2d61c2?.['index']):(_0x2d61c2=_0x595877[0x0],_0x33b587=_0x2d61c2['index']),!_0x2d61c2)return void _0x30b2da['setChangeGroupState'](_0x506129??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x3ee2d6&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x33b587)return;const _0x413e43=this['_getUserPresentableContentPartDocumentRange'](_0x3ee2d6,_0x30b2da,_0x2d61c2),_0x18d5a8=_0x30b2da['changeGroups']['find'](_0x50f816=>_0x50f816['index']==_0x33b587)['editor'],_0x110933=_0x18d5a8['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x110933&&this['_activeBalloon']['close'](),!_0x413e43)return _0x110933['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x110933,this['_currentPreviewedChangeGroup']={'replyId':_0x3ee2d6,'partIndex':_0x33b587},this['_scrollToSuggestionRange'](_0x413e43,!0x0,_0x18d5a8);const _0x55c14b=this['_getPresentableSiblingContentPartIndex'](_0x3ee2d6,_0x33b587,'next');_0x110933['clearContent'](),_0x110933['updateContent']({'part':_0x2d61c2,'renderingStrategy':'static'}),_0x110933['open']({'index':_0x33b587,'title':ls(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x33b587+0x1)['toString']()),'showRotator':null!==_0x55c14b,'ranges':[_0x413e43],'areActionsDisabled':_0x30b2da['areActionsDisabled'],'targetEditor':_0x18d5a8}),_0x110933['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x3ee2d6,_0x33b587),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x3ee2d6,'index':_0x33b587,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x27544f,_0x4fa5c0,_0x105292){const {reply:_0x52eb88}=this['getInteractionAndReplyById'](_0x27544f),_0x4e197a=_0x52eb88['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x4e197a['length'])return null;const _0x28e536='next'==_0x105292?0x1:-0x1;function _0x52fe4b(_0x18542c){const _0x4a3ca2=(_0x18542c+_0x28e536+_0x4e197a['length'])%_0x4e197a['length'];return{'siblingIndex':_0x4a3ca2,'siblingPart':_0x4e197a[_0x4a3ca2]};}const _0x111d7b=_0x4e197a['findIndex'](_0x4666f7=>_0x4666f7['index']==_0x4fa5c0);let {siblingIndex:_0x1b170c,siblingPart:_0x12609a}=_0x52fe4b(_0x111d7b);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x27544f,_0x52eb88,_0x12609a);)if({siblingIndex:_0x1b170c,siblingPart:_0x12609a}=_0x52fe4b(_0x1b170c),_0x1b170c===_0x111d7b)return null;return _0x12609a['index'];}['_getUserPresentableContentPartDocumentRange'](_0x2d6781,_0x55ecc1,_0x4e674){const _0x17f3bb=_0x55ecc1['changeGroups'];if(!_0x4e674['hasChanges'])return null;const _0xb768d5=_0x17f3bb['find'](_0x24d665=>_0x24d665['index']==_0x4e674['index']);if('pending'!==_0xb768d5?.['state'])return null;if(!_0xb768d5?.['editor']||'destroyed'===_0xb768d5['editor']['state'])return _0x55ecc1['setChangeGroupState'](_0x4e674['index'],'outdated'),null;const _0x180846=this['_getDocumentRangeForReplyChanges'](_0x2d6781,_0x4e674['index']);if(!_0x180846)return _0x55ecc1['setChangeGroupState'](_0x4e674['index'],'outdated'),null;const {range:_0x595ab7,currentIndex:_0x3a5168}=_0x180846;return'$graveyard'==_0x595ab7['root']['rootName']?(_0x55ecc1['setChangeGroupState'](_0x3a5168,'outdated'),null):_0x180846['range'];}['_getDocumentRangeForReplyChanges'](_0x2326b2,_0x362b4d){const {reply:_0x3bc924,interaction:_0x5346df}=this['getInteractionAndReplyById'](_0x2326b2),_0xdd7935=_0x3bc924['changeGroups']['filter'](_0x48648d=>'pending'==_0x48648d['state']),_0x5b8396=_0xdd7935['map'](_0x3fec93=>_0x3bc924['changeGroups']['indexOf'](_0x3fec93));void 0x0===_0x362b4d&&(_0x362b4d=_0x5b8396[0x0]);const _0x2f273d=_0x5b8396['indexOf'](_0x362b4d);if(-0x1==_0x2f273d)return null;const _0x2c4c0c=_0xdd7935[_0x2f273d],_0x5bbd3d=_0x2c4c0c['editor'];if(!_0x5bbd3d||'destroyed'===_0x5bbd3d['state'])return null;const _0x85e104=_0x3bc924['documentContextContent']['get'](_0x2c4c0c['documentId']),_0x10f1cb=new _0x365804([]),_0x2c44ed=new _0x365804([]);for(const _0xf90f4a of _0x2c4c0c['changes'])if('removed'!=_0xf90f4a['type']&&_0x2c44ed['children']['push'](_0xf90f4a['node']['cloneNode'](!0x0)),'new'!=_0xf90f4a['type']){const _0x124cd5=_0x51339e(_0x751277=>Cs(_0x751277,'data-id')==_0xf90f4a['id'],_0x85e104,!0x0);_0x10f1cb['children']['push'](_0x124cd5['cloneNode'](!0x0));}if(0x0==_0x10f1cb['children']['length']){if(_0x2c4c0c['changes'][0x0]['anchorId']){const _0x2894ab=ms('data-id',_0x2c4c0c['changes'][0x0]['anchorId'],_0x85e104);_0x10f1cb['children']['unshift'](_0x2894ab['cloneNode'](!0x0)),_0x2c44ed['children']['unshift'](_0x2894ab['cloneNode'](!0x0)),_0x2894ab['nextSibling']&&(_0x10f1cb['children']['push'](_0x2894ab['nextSibling']['cloneNode'](!0x0)),_0x2c44ed['children']['push'](_0x2894ab['nextSibling']['cloneNode'](!0x0)));}else{const _0x5b8a55=_0x85e104['children'][0x0];if(!_0x5b8a55)return null;_0x10f1cb['children']['push'](_0x5b8a55['cloneNode'](!0x0)),_0x2c44ed['children']['push'](_0x5b8a55['cloneNode'](!0x0));}}const _0x14efcc=_0x5346df['getDocumentContext'](),_0xb72fc7=_0x14efcc['documents']['find'](_0x333473=>_0x333473['id']==_0x2c4c0c['documentId'])['content'],_0x529766=_0x5bbd3d['model']['document']['getRoot'](_0x2c4c0c['rootName']),_0x1a4714=_0x5bbd3d['data']['parse'](_0xb72fc7,_0x529766),_0x516ae6=ps(_0x10f1cb),_0x485e2e=_0x5bbd3d['data']['parse'](_0x516ae6,_0x529766),_0x2a72ed=_0x5bbd3d['data']['parse'](_0x516ae6,_0x529766),_0x41bf0b=_0x5bbd3d['model']['createPositionAt'](_0x485e2e,0x0),_0x19a444=ps(_0x2c44ed),_0xfcdf9c={'targetEditor':_0x5bbd3d,'anchor':_0x41bf0b,'markDeletions':!0x1},_0x48b9f3=_0x5bbd3d['plugins']['get'](_0x303ea9)['getDiff'](_0x516ae6,_0x19a444,_0xfcdf9c)['getOperations']();if(!_0x48b9f3['length'])return null;_0x5bbd3d['model']['change'](_0x5e30ce=>{for(const _0x4af0b7 of _0x48b9f3)if('remove'==_0x4af0b7['type']){const _0x519551=_0x4af0b7['sourcePosition'],_0x4d988f=_0x4af0b7['howMany'],_0x2950b4=new _0x4f23de(_0x519551,_0x4d988f);_0x5e30ce['batch']['addOperation'](_0x2950b4),_0x5bbd3d['model']['applyOperation'](_0x2950b4);}else'marker'!==_0x4af0b7['type']&&(_0x4af0b7['baseVersion']=null,_0x4af0b7['isDocumentOperation']=!0x1,_0x5e30ce['batch']['addOperation'](_0x4af0b7),_0x5bbd3d['model']['applyOperation'](_0x4af0b7));});const _0x2d6608=Fs(_0x5bbd3d,_0x48b9f3,_0x485e2e);Ws(_0x5bbd3d['model'],_0x2d6608);const _0xe9baff=_0x2d6608['getFirstRange']()['start']['path']['slice'](),_0x24bd14=_0x2d6608['getFirstRange']()['end']['path']['slice'](),_0x1631cd=[];let _0x348d34=_0x485e2e,_0x3c6e8a=_0x2a72ed;for(let _0x3b0dce=0x0;_0x3b0dce<_0x24bd14['length'];_0x3b0dce++){const _0x4c0999=_0x348d34['maxOffset']-_0x24bd14[_0x3b0dce];_0x1631cd[_0x3b0dce]=_0x3c6e8a['maxOffset']-_0x4c0999,_0x348d34=_0x348d34['getChildAtOffset'](_0x24bd14[_0x3b0dce]),_0x3c6e8a=_0x3c6e8a['getChildAtOffset'](_0x1631cd[_0x3b0dce]);}const _0x3c38bf=_0x5bbd3d['model']['createRange'](_0x5bbd3d['model']['createPositionFromPath'](_0x2a72ed,_0xe9baff),_0x5bbd3d['model']['createPositionFromPath'](_0x2a72ed,_0x1631cd)),_0x5a58a1=_0x2a72ed['getChild'](0x0)['getAttribute'](_0x98c166),_0x103370=Array['from'](_0x1a4714['getChildren']())['find'](_0x35a57e=>_0x35a57e['getAttribute'](_0x98c166)==_0x5a58a1)['getPath'](),_0xf8175=_0x3c38bf['start']['path']['slice'](),_0x241794=_0x3c38bf['end']['path']['slice']();_0xf8175[0x0]=_0x103370[0x0]+_0xf8175[0x0],_0x241794[0x0]=_0x103370[0x0]+_0x241794[0x0];let _0x473c09=_0x5bbd3d['model']['createRange'](_0x5bbd3d['model']['createPositionFromPath'](_0x5bbd3d['model']['document']['getRoot'](_0x2c4c0c['rootName']),_0xf8175),_0x5bbd3d['model']['createPositionFromPath'](_0x5bbd3d['model']['document']['getRoot'](_0x2c4c0c['rootName']),_0x241794));const _0x3376cc=_0x14efcc['documents']['find'](_0x14932b=>_0x14932b['id']==_0x2c4c0c['documentId'])['version'],_0xdfe70f=_0x5bbd3d['model']['document']['history']['getOperations'](_0x3376cc);for(const _0x2dd101 of _0xdfe70f)_0x473c09=_0x5677e3['_createFromRanges'](_0x473c09['getTransformedByOperation'](_0x2dd101));return{'range':_0x473c09,'currentIndex':_0x362b4d,'targetEditor':_0x5bbd3d};}['_integrateEditorBalloon'](_0x3a2e6b){if(!_0x3a2e6b['plugins']['has']('AIChatBalloon'))return;const _0x2e54fc=_0x3a2e6b['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x2e54fc['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x2e54fc,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x483619,partIndex:_0x42adb3}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x107c70}=this['getInteractionAndReplyById'](_0x483619),_0x163cc9=_0x107c70['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x42adb3});_0x2e54fc['updateContent']({'part':_0x163cc9[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x2e54fc,'applySuggestion',()=>{const {replyId:_0x277683,partIndex:_0x30f5ad}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x277683,'partIndex':_0x30f5ad}),_0x2e54fc['setState']('accepted');}),this['listenTo'](_0x2e54fc,'insertSuggestion',()=>{const {replyId:_0xbc3b75,partIndex:_0x184961}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0xbc3b75,'partIndex':_0x184961}),_0x2e54fc['setState']('accepted');}),this['listenTo'](_0x2e54fc,'rejectSuggestion',()=>{const {replyId:_0x32eb8d,partIndex:_0x4a2b8a}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x32eb8d,'partIndex':_0x4a2b8a}),_0x2e54fc['setState']('rejected');}),this['listenTo'](_0x2e54fc,'showNext',()=>{const {replyId:_0x44cec4,partIndex:_0x4c23ea}=this['_currentPreviewedChangeGroup'],_0x46c200=this['_getPresentableSiblingContentPartIndex'](_0x44cec4,_0x4c23ea,'next');null!==_0x46c200&&this['_openBalloonFor'](_0x44cec4,_0x46c200);}),this['listenTo'](_0x2e54fc,'showPrevious',()=>{const {replyId:_0x130c73,partIndex:_0x3b03ce}=this['_currentPreviewedChangeGroup'],_0x53f27f=this['_getPresentableSiblingContentPartIndex'](_0x130c73,_0x3b03ce,'previous');null!==_0x53f27f&&this['_openBalloonFor'](_0x130c73,_0x53f27f);}),this['listenTo'](_0x2e54fc,'dialogClosed',(_0x52c8a7,{id:_0x5e81f4})=>{if('aiChatBalloon'!==_0x5e81f4)return;const {replyId:_0x3e02a2,partIndex:_0x495024}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x3e02a2,'index':_0x495024,'isActive':!0x1}),this['_activeBalloon']===_0x2e54fc&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x5e8ad8){if(this['_channelsToEditors']['set'](_0x5e8ad8['config']['get']('collaboration.channelId'),_0x5e8ad8),this['_integrateEditorBalloon'](_0x5e8ad8),this['addCurrentDocumentToChatContext'](),_0x5e8ad8['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x5e8ad8['plugins']['has']('Undo')){const _0x4b41c2=_0x5e8ad8['commands']['get']('undo'),_0x31ed7d=_0x5e8ad8['commands']['get']('redo');this['listenTo'](_0x4b41c2,'revert',(_0x2276e7,_0x195f3b,_0x3da2bf)=>{const _0x480500=this['_batchToChanges']['get'](_0x195f3b);if(!_0x480500)return;const _0x5aed93=this['activeConversation']['getInteraction'](_0x480500['interactionId']),_0x569680=_0x5aed93?.['getReply'](_0x480500['replyId']);this['_batchToChanges']['delete'](_0x195f3b),_0x5aed93&&_0x569680&&(_0x480500['indexes']['forEach'](_0x22837f=>_0x569680['setChangeGroupState'](_0x22837f,'pending')),this['_batchToChanges']['set'](_0x3da2bf,_0x480500));}),this['listenTo'](_0x31ed7d,'revert',(_0x3638b3,_0x59bd68,_0x58a2c6)=>{const _0x4aa008=this['_batchToChanges']['get'](_0x59bd68);if(!_0x4aa008)return;const _0x5f367d=this['activeConversation']['getInteraction'](_0x4aa008['interactionId']),_0x1ab4cf=_0x5f367d?.['getReply'](_0x4aa008['replyId']);this['_batchToChanges']['delete'](_0x59bd68),_0x5f367d&&_0x1ab4cf&&(_0x4aa008['indexes']['forEach'](_0x707279=>_0x1ab4cf['setChangeGroupState'](_0x707279,'accepted')),this['_batchToChanges']['set'](_0x58a2c6,_0x4aa008));});}const _0x261f01=_0x5e8ad8['config']['get']('ai.chat.context');_0x261f01['alwaysAddSelection']&&_0x261f01['document']['enabled']&&this['listenTo'](_0x5e8ad8['model']['document']['selection'],'change:range',(_0x469011,_0x24eef8)=>{_0x24eef8['directChange']&&'chat'===_0x5e8ad8['plugins']['get']('AITabs')['view']['activeTab']&&(_0x5e8ad8['model']['hasContent'](_0x5e8ad8['model']['document']['selection'])?this['addSelectionToChatContext'](_0x5e8ad8):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x4802ef=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x1da2f9=await _0x4802ef['getConversations']();return _0x1da2f9['length']?_0x1da2f9[0x0]['id']:'new';}catch(_0x2f16dd){return this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':Ot()}),this['_reporter']['logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x2f16dd})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x414906={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x414906);}catch(_0x1e863a){this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x414906['id']||Ot()}),this['_reporter']['logError'](_0x1e863a),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x2e1bce,modelId:_0xf9116a}={}){this['_closeActiveBalloon']();let _0x498c50=_0xf9116a;_0x498c50||(_0x2e1bce||!this['activeConversation']?_0x498c50=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x498c50=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x4e4a5c=this['getGroupId'](),_0x20569b=_0x2e1bce||Ot();let _0x40ec83;this['activeConversation']=new Rn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x498c50,'conversationId':_0x20569b,'group':_0x4e4a5c,'locale':this['context']['locale'],'isFromHistory':!!_0x2e1bce,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x804091=>this['_aiEditing']['getSessionId'](_0x804091)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x582e71,_0x4f62fc)=>{this['_aiChatUi']['createConversation'](_0x4f62fc),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x2e1bce||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x3740e4,_0x57dac4)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x57dac4['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x22b627=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x22b627);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x223ae5=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x223ae5);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x49ba5b,_0xde909)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xde909,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x1141da,_0x51351e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x51351e,{'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',(_0x47f14f,_0xf9e066)=>{this['_aiChatUi']['removeFeedInteraction'](_0xf9e066['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0xdc332,_0x4eaa41,_0x2ef8ab)=>{this['_updateConversationTitle'](_0x4eaa41,_0x2ef8ab);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0xe1a069,_0xd70a31)=>{void 0x0!==_0x40ec83&&_0x40ec83!==_0xd70a31['id']&&this['_updateReplyContentThrottled']['flush'](),_0x40ec83=_0xd70a31['id'],_0xd70a31['isFromHistory']?await this['_updateReplyContent']({'reply':_0xd70a31}):await this['_updateReplyContentThrottled']({'reply':_0xd70a31});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0xeab924,{reply:_0x5462e5,index:_0x1d3f11,state:_0x166675})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x5462e5['id'],'index':_0x1d3f11,'state':_0x166675}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x5462e5['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x1d3f11&&this['_activeBalloon']?.['setState'](_0x166675);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x441101,_0x1fc4f4)=>{if(this['_aiChatUi']['addContextItem'](_0x1fc4f4['contextItem'],_0x1fc4f4['isLoading']),'selection'===_0x1fc4f4['contextItem']['type']){const _0x26eaa8=ds(this['context']),_0x3230c7=[..._0x26eaa8['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x26eaa8,'ranges':_0x3230c7,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x49fb89,_0x30dffd)=>{this['_aiChatUi']['removeContextItem'](_0x30dffd['uiId']),'current-document'==_0x30dffd['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x30dffd['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x437f32,_0x2d2607)=>{this['_aiChatUi']['setContextItemLoading'](_0x2d2607['contextItem']['uiId'],_0x2d2607['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x33390b,_0x39d939)=>{this['_aiChatUi']['setConversationContext'](_0x39d939['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x43b765,_0x4b6cbe)=>{this['_aiChatUi']['setAddContextOptions'](_0x4b6cbe['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x5bcbbf,_0x352309)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x352309['sourceId'],_0x352309['source'],_0x352309['resources'],_0x352309['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x13ffbb,_0x5489e8)=>{this['_aiChatUi']['updateResourceState'](_0x5489e8['sourceId'],_0x5489e8['resourceId'],_0x5489e8['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x237d26,_0x35860a)=>{this['_aiChatUi']['updateCapabilities'](_0x35860a);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0xb82334,_0x7e31b9)=>{try{const _0x1fa3d8=(await this['_aiChatModels']['getAll']())['find'](_0x48cde0=>_0x48cde0['id']===_0x7e31b9['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x1fa3d8,_0x7e31b9['isDisabled']);}catch(_0x45473b){this['_reporter']['logError'](new nn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x45473b}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x362501,{error:_0x9dbe26,interactionId:_0x360d17,fileName:_0x178e13,url:_0x400c0a,sourceId:_0x233025,sourceLabel:_0xa73c90})=>{const _0x1754fb=_0x360d17?_0x360d17+':'+Ot():Ot();this['_reporter']['reportError'](_0x9dbe26),_0x9dbe26['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':ls(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-conversation-init-failed')||_0x9dbe26['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x178e13),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x400c0a),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x233025&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x233025),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0xa73c90||'source'),'id':_0x1754fb})):_0x9dbe26['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x1754fb}):_0x9dbe26['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x1754fb}):this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x1754fb});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x2e1bce||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x31add8,attributes:_0x271229}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3a5767=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3a5767);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x31add8,'attributes':_0x271229});}['_removeFromContext'](_0x2b6b0e){this['activeConversation']?.['removeFromContext'](_0x2b6b0e);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x197594){const [_0x40df00,_0xd734da]=_0x197594['split'](':'),_0x4e2791=this['activeConversation']['getInteraction'](_0x40df00);return{'interaction':_0x4e2791,'reply':_0x4e2791['getReply'](_0xd734da)};}['_scrollToSuggestionRange'](_0x328ddd,_0x530b54=!0x1,_0x47bee5){const _0x4afee5={'target':_0x47bee5['editing']['view']['domConverter']['viewRangeToDom'](_0x47bee5['editing']['mapper']['toViewRange'](_0x328ddd)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x530b54};_0x530b54&&(_0x4afee5['alignToTop']=!0x0),St(_0x4afee5);}['_updateConversationTitle'](_0x500f0f,_0x5cb75e=!0x1){this['_aiChatUi']['setConversationTitle'](_0x500f0f||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x5cb75e);}['_addFeedItemReply'](_0x527b28){'text'===_0x527b28['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x527b28):this['_aiChatUi']['addFeedItemAISuggestion'](_0x527b28);}async['_updateReplyContent']({reply:_0x2a19f0,renderingStrategy:_0x97450c}){const {id:_0xd339d1,interactionId:_0x15b69e,isDone:_0x3e96b2,type:_0x51acac,parsedContent:_0x1ebd07}=_0x2a19f0,_0x1378b5=_0x15b69e+':'+_0xd339d1;if('modification'===_0x51acac){const _0x52c754=_0x2a19f0['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1378b5,'parts':_0x52c754,'isDone':_0x3e96b2,'skipLoadingEffects':_0x2a19f0['isFromHistory']});}else'text'===_0x51acac&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x1378b5,'parsedContent':_0x1ebd07['get']('text'),'renderingStrategy':_0x97450c,'isDone':_0x3e96b2});_0x3e96b2&&_0x2a19f0['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x1378b5,_0x2a19f0['sources']);}['_updateReplyContentThrottled']=_0x1aa2a4(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x1fab8b=this['activeConversation']?.['lastInteraction'];_0x1fab8b&&(_0x1fab8b['stop'](),this['_aiChatUi']['stopInteraction'](_0x1fab8b)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x1cba18=this['activeConversation']?.['lastInteraction'];if(_0x1cba18){for await(const _0x47ea89 of _0x1cba18['replies'])this['_aiChatUi']['hasFeedItem'](_0x47ea89['id'])||this['_addFeedItemReply'](_0x47ea89),await this['_updateReplyContent']({'reply':_0x47ea89,'renderingStrategy':'static'});}}['_updateRatings'](_0x720667){const _0x12aeae={'positiveCount':_0x720667['changeGroups']['filter'](_0x57ece4=>'accepted'===_0x57ece4['state'])['length'],'totalCount':_0x720667['changeGroups']['length'],'modificationId':_0x720667['id']},_0x85700f=this['activeConversation']['getInteraction'](_0x720667['interactionId'])['messageId'];_0x85700f&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x85700f,_0x12aeae);}['_getAIChatFeedAPI'](_0x308792){const _0x4ebabf=this['_aiChatUi'],_0x1e79f8=()=>{_0x308792['resetWebSearchState'](),_0x308792['resetReasoningState'](),_0x4ebabf['clearLoadingMessage']();},_0x596d69=()=>{_0x308792['currentReply']&&(_0x308792['currentReply']['done'](),_0x308792['currentReply']=void 0x0);};return{'insertTextReply':(_0x2371e5,_0x2ca333)=>{_0x596d69(),_0x1e79f8();const _0x595444=_0x308792['currentReply']=_0x308792['createReply']({'type':'text','interactionId':_0x308792['id'],'id':_0x2ca333||Ot(),'channelsToEditors':this['_channelsToEditors']});return _0x595444['appendContent'](_0x2371e5),_0x596d69(),_0x595444;},'insertCustomElement':async(_0x415306,_0x3a99c8)=>(_0x596d69(),_0x1e79f8(),_0x4ebabf['addFeedItemCustomElement'](_0x415306,_0x3a99c8||Ot())),'setLoadingMessage':_0x341c01=>{_0x4ebabf['setLoadingMessage'](_0x341c01);},'clearLoadingMessage':()=>{_0x4ebabf['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){us(this['context'])['find'](_0x1f991c=>'destroyed'!==_0x1f991c['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(_0x5570ad){const _0x413e00=new AbortController();return{'promise':new Promise((_0x587d5b,_0xe4e8ed)=>{const _0x11de45=setTimeout(_0x587d5b,_0x5570ad);_0x413e00['signal']['addEventListener']('abort',()=>{clearTimeout(_0x11de45),_0xe4e8ed();});}),'abortController':_0x413e00};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x1594fb){this['options']={'delay':_0x1594fb?.['delay']??0xa,'textNodeStyle':_0x1594fb?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x3d9f46,targetElement:_0x5911b2,abortSignal:_0x2236b5}){this['isStreaming']&&this['stop'](),_0x2236b5?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x5bc24e(_0x3d9f46,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x465d0c=0x0;_0x465d0c<this['currentIndex'];_0x465d0c++)this['nodesList'][_0x465d0c]['shouldBeStreamed']=!0x0;do{const _0x40055a=Date['now'](),_0x27b273=this['nodesList'][this['currentIndex']],_0x2585cf=_0x40055a-this['lastUpdateTime'];if(_0x27b273){_0x27b273['shouldBeStreamed']=!0x0;let _0x2780b9=_0x27b273['parent'];for(;_0x2780b9;)_0x2780b9['shouldBeStreamed']=!0x0,_0x2780b9=_0x2780b9['parent'];}if(_0x2585cf<this['options']['delay'])try{const {promise:_0x559c53,abortController:_0x436886}=xn(this['options']['delay']-_0x2585cf);this['timeoutAbortController']=_0x436886,await _0x559c53;}catch(_0x3e473c){return;}_0x53d0ae(_0x5911b2,'<'+_0x5911b2['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x5911b2['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:_0x51b9ce}){Array['from'](_0x51b9ce['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x42fded=>{_0x42fded['replaceWith'](_0x42fded['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x320917){let _0x3f8cfa='';if(function(_0x4f297f){return _0x2ae05e(_0x4f297f);}(_0x320917)){for(const _0xfbe887 of _0x320917['children'])_0x3f8cfa+=this['renderNode'](_0xfbe887);}else{if(Hn(_0x320917)){if(!_0x320917['shouldBeStreamed'])return'';const _0x53c1e9=_0x320917,_0x231ff1=Object['entries'](_0x53c1e9['attribs'])['map'](([_0x363582,_0x1f3d45])=>_0x363582+'=\x22'+_0x1f3d45+'\x22')['join']('\x20');_0x3f8cfa+='<'+_0x53c1e9['tagName']+(_0x231ff1?'\x20'+_0x231ff1:'')+'>';for(const _0x5bfeb8 of ti(_0x53c1e9))_0x3f8cfa+=this['renderNode'](_0x5bfeb8);_0x3f8cfa+='</'+_0x53c1e9['tagName']+'>';}else{if(!Pn(_0x320917))return'';if(!_0x320917['shouldBeStreamed'])return'';!function(_0x4427e6){return!(!_0x4427e6['parent']||!Hn(_0x4427e6['parent']))&&(!!Dn['includes'](_0x4427e6['parent']['tagName'])&&!_0x12589a(_0x4427e6)['match'](/^\s*[<>]\s*$/));}(_0x320917)?_0x3f8cfa+=_0x2a1923(_0x320917):_0x3f8cfa+=_0x2a1923(new _0x1582af('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x320917]));}}return _0x3f8cfa;}['getParsedDocumentNodeList'](){const _0x14e4ed=[];return function(_0x2eb68d,_0x2721b2){const _0x493bd0=_0x38700a=>{if(_0x2721b2(_0x38700a),_0x38700a instanceof _0x9e44dd)for(let _0x195692=0x0;_0x195692<_0x38700a['children']['length'];_0x195692++){const _0x5a420e=_0x38700a['children'][_0x195692];_0x493bd0(_0x5a420e);}};for(let _0x2217b9=0x0;_0x2217b9<_0x2eb68d['children']['length'];_0x2217b9++)_0x493bd0(_0x2eb68d['children'][_0x2217b9]);}(this['document'],_0xd71a94=>{if(Pn(_0xd71a94)){const _0x2d528f=this['splitTextNodeIntoWordNodes'](_0xd71a94);_0x2d528f['length']&&_0x14e4ed['push'](..._0x2d528f);}_0xd71a94['isWordSplitSource']||_0xd71a94['isWordSplitResult']||_0x14e4ed['push'](_0xd71a94);}),_0x14e4ed;}['splitTextNodeIntoWordNodes'](_0x11352e){if(_0x11352e['isWordSplitSource']||_0x11352e['isWordSplitResult'])return[];const _0x561734=_0x12589a(_0x11352e)['match'](/(?:\s*\S+\s*)/g),_0x8ee94d=[];if(_0x561734&&_0x561734['length']>0x1){for(const _0x3aa74f of _0x561734){const _0x44dcb0=new _0x3064e5(_0x3aa74f);_0x44dcb0['isWordSplitResult']=!0x0,_0x3bef2c(_0x11352e,_0x44dcb0),_0x8ee94d['push'](_0x44dcb0);}_0x11352e['isWordSplitSource']=!0x0,_0x505dba(_0x11352e);}return _0x8ee94d;}};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(_0x590b23){return _0xf76cfa(_0x590b23);}function Hn(_0x14b70c){return _0x218f48(_0x14b70c);}function Mn(_0x93d50f,_0x1d29e0){_0x93d50f['cleanUpAnimations']({'targetElement':_0x1d29e0}),_0x1d29e0['querySelectorAll']('[data-id]')['forEach'](_0x4c9b97=>{_0x4c9b97['removeAttribute']('data-id');});}var Vn=class extends _0x294569{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x1daaa4){super();const _0x48945b=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x1daaa4,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x48945b['if']('isDone','ck-ai-chat__feed__item_done'),_0x48945b['if']('isVisible','ck-hidden',_0x2bf546=>!_0x2bf546),'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'](_0x5543ab,_0x38d4b2,_0x57e4e4){await this['htmlStreamer']['stream']({'document':_0x5543ab,'targetElement':_0x38d4b2,'abortSignal':_0x57e4e4});}},Un=class extends _0x294569{['showChangesToggleView'];constructor(_0x54fb80,_0x32828a){super(_0x54fb80),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x54fb80),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+cn,'label':ls(_0x54fb80,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x32828a['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x441185=>_0x441185?tt:_0x461a07),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x4c8801=new Wt();_0x4c8801['content']=_0x547315,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x32828a['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x4c8801,{'tag':'span','children':[ls(_0x54fb80,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Pt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x2ae1b,'rejected':_0x257f37,'outdated':_0x257f37};var Fn=class extends _0x294569{['stateIconView'];constructor(_0x39308b){super(_0x39308b);const _0x4761f6=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',_0x4761f6['to']('state',_0xbe689d=>'ck-ai-suggestion__content-part-state_'+_0xbe689d),_0x4761f6['if']('isVisible','ck-hidden',_0x108519=>!_0x108519)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x4761f6['to']('state',_0x133452=>{switch(_0x133452){case'accepted':return ls(_0x39308b,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return ls(_0x39308b,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return ls(_0x39308b,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x282268){this['state']=_0x282268;}},Kn=class extends Wt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x2fd27a{['_applyButton'];['_suggestButton'];constructor(_0x440cfe,_0x571c1f,_0xc7267f){super(_0x440cfe);const _0x1f1337=Boolean(_0xc7267f);this['set']('isEnabled',!_0x1f1337),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x2e8e58=[];if(_0x1f1337){const _0x105080=new Pt(_0x440cfe);_0x105080['set']({'label':ls(_0x440cfe,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2ef372}),_0x105080['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x2e8e58['push'](_0x105080);}else{_0x571c1f['includes']('applySuggestion')&&(this['_applyButton']=new Pt(_0x440cfe),this['_applyButton']['set']({'label':ls(_0x440cfe,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2ae1b}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x56c13f=>!_0x56c13f),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x2e8e58['push'](this['_applyButton'])),_0x571c1f['includes']('insertSuggestion')&&(this['_suggestButton']=new Pt(_0x440cfe),this['_suggestButton']['set']({'label':ls(_0x440cfe,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4fbfea}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x2e8e58['push'](this['_suggestButton']));const _0x3d5880=new Pt(_0x440cfe);_0x3d5880['set']({'label':ls(_0x440cfe,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x257f37}),_0x3d5880['bind']('isEnabled')['to'](this),_0x3d5880['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x2e8e58['push'](_0x3d5880);}this['items']['addMany'](_0x2e8e58);const _0x38d47c=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x38d47c['if']('isVisible','ck-hidden',_0x4ded39=>!_0x4ded39)]}});}['setButtonsVisibility']({showApplyButton:_0x5438b4,showSuggestButton:_0x393cbc}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x5438b4),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x393cbc);}},Yn=class extends _0x294569{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x3595b9,{part:_0x2aa910,uiIndex:_0x51bad3,availableActions:_0x14e2cf,areActionsDisabled:_0x2f7117}){super(_0x3595b9),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x3595b9,_0x14e2cf,_0x2f7117),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x2aa910['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x2aa910['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x2aa910['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x3595b9),this['titleLabelView']=new $n(_0x3595b9,_0x51bad3),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',(_0x4865ee,_0x242712,_0x212c58,_0x1b6999)=>{'pending'===_0x1b6999?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x212c58?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x212c58),this['children']['add'](this['stateView']));});}},$n=class extends _0x294569{constructor(_0x212e16,_0x4dc1f8){super(_0x212e16),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[ls(_0x212e16,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x4dc1f8['toString']())]});}},qn=class extends _0x294569{['htmlStreamer'];constructor(_0x29f017){super(_0x29f017),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:_0x3675b9,renderingStrategy:_0xeb71a9,abortSignal:_0xb264cc}){const _0x5df00b=_0x5bc24e(_0x3675b9['content'],!0x0);for(const _0x35066f of Ts(_0x5df00b))_0x505dba(_0x35066f);'streaming'===_0xeb71a9?await this['htmlStreamer']['stream']({'document':_0x5df00b,'targetElement':this['element'],'abortSignal':_0xb264cc}):_0x53d0ae(this['element'],'<'+this['element']['tagName']+'>'+ps(_0x5df00b)+'</'+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 _0x294569{['_children'];['_headerView'];['_streamableContentView'];constructor(_0xed900e,{part:_0x2fa944,uiIndex:_0x56e791,areActionsDisabled:_0x585b10,availableActions:_0x7a2c69}){super(_0xed900e);const _0x559148=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 _0x8b394a=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x585b10;};this['on']('change:state',_0x8b394a),this['on']('change:isDone',_0x8b394a),_0x8b394a(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0xed900e,{'part':_0x2fa944,'uiIndex':_0x56e791,'availableActions':_0x7a2c69,'areActionsDisabled':_0x585b10}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0xed900e),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x559148['to']('state',_0x1fdc68=>'ck-ai-suggestion__body__content-part_'+_0x1fdc68),_0x559148['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x559148['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x559148['if']('isVisible','ck-hidden',_0x44afe0=>!_0x44afe0)]},'children':this['_children'],'on':{'mouseenter':_0x559148['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x2fa944['index']});}),'mouseleave':_0x559148['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x2fa944['index']});}),'click':_0x559148['to'](_0x4abd7e=>{const _0x2beaec=_0x4abd7e['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2beaec)&&this['fire']('showChangeInText',{'index':_0x2fa944['index']});})}});}async['updateContent']({part:_0x13b523,showUnchangedParts:_0xaa16be=!0x1,abortSignal:_0x132547}){this['partDefinition']=_0x13b523,this['isVisible']=this['partDefinition']['hasChanges']||_0xaa16be,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x13b523,'renderingStrategy':'static','abortSignal':_0x132547});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x294569{constructor(_0x3a226e,_0x524922){super(_0x3a226e),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x38c203=>!_0x38c203)]},'children':this['_createSkeletonItems'](_0x524922)});}['_createSkeletonItems'](_0xb6092b){const _0x17c743=['ck','ck-ai-skeleton__item'];return _0xb6092b['map'](_0x33025a=>{let _0x36aa84='';switch(_0x33025a['attributes']['align']){case'right':_0x36aa84='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x36aa84='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x36aa84='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x33025a['tag'],'attributes':{'class':[..._0x17c743,_0x33025a['attributes']['class']?_0x33025a['attributes']['class']:''],'style':'width:\x20'+_0x33025a['attributes']['width']+';\x20height:\x20'+_0x33025a['attributes']['height']+';'+_0x36aa84}};});}};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(_0x17c848,_0x49073f,_0x2d3db3,_0x26e581){return new Array(_0x17c848)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x49073f,'height':_0x2d3db3,'align':_0x26e581}}));}const Jn=/* #__PURE__ -- @preserve */
33
+ lt();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x2fa0a7){const _0x19f7c9=this['createTask'](_0x2fa0a7);return this['queue']['push'](_0x19f7c9),this['_processQueue'](),_0x19f7c9['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(_0x1e1ba6=>{this['once']('_queueEmpty',()=>{_0x1e1ba6();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x2ffe66=this['queue']['shift']();try{await _0x2ffe66['callback'](this['_abortController']['signal']),_0x2ffe66['resolve']();}catch(_0x43b5d9){_0x2ffe66['reject'](_0x43b5d9);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x40ee85){let _0x2dec82,_0x5ca741;const _0x2885ba=new Promise((_0x21535e,_0x4ea722)=>{_0x2dec82=_0x21535e,_0x5ca741=_0x4ea722;});return{'callback':_0x40ee85,'resolve':_0x2dec82,'reject':_0x5ca741,'completePromise':_0x2885ba};}},tr=class extends Vn{constructor(_0x1594d1){super(_0x1594d1),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x1594d1['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x4974e9){this['element']['innerHTML']=_0x4974e9;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x294569{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x1f7ec4,_0x287a27=[...er],_0x3c2ccd){super(_0x1f7ec4);const _0x22aa6c=this['bindTemplate'],_0x48bc2f=Boolean(_0x3c2ccd);if(this['set']('isEnabled',!_0x48bc2f),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x48bc2f){const _0x180bf3=new Pt(_0x1f7ec4);_0x180bf3['set']({'label':ls(_0x1f7ec4,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2ef372}),_0x180bf3['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x3812c8=new _0x294569(_0x1f7ec4);_0x3812c8['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[ls(_0x1f7ec4,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x180bf3]}]}),this['children']['add'](_0x3812c8);}else this['_applyChangesButton']=new Pt(_0x1f7ec4),this['_applyChangesButton']['set']({'label':ls(_0x1f7ec4,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x287a27['includes']('applySuggestion'),'class':an}),this['_insertSuggestionsButton']=new Pt(_0x1f7ec4),this['_insertSuggestionsButton']['set']({'label':ls(_0x1f7ec4,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x287a27['includes']('insertSuggestion'),'class':hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x38b328=>{_0x38b328['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',_0x22aa6c['if']('isVisible','ck-hidden',_0x4284e7=>!_0x4284e7)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x43da68){this['isVisible']=_0x43da68;}['_switchButtonLabelsPlurality'](_0x19e1fa){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x19e1fa?(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},sr=class extends _0x294569{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x190418,_0x401ee7){super(_0x190418),this['bodyCollection']=_0x401ee7,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',_0x2fa256=>!_0x2fa256)]},'children':this['children']});const _0x3b7396=new _0x294569(this['locale']),_0x536003=new Wt();_0x536003['content']=ot,_0x3b7396['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x536003,{'tag':'span','children':[{'text':ls(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x3b7396),this['_setupBalloonPanel'](_0x190418);}['addSource'](_0x14366d){this['children']['add'](new nr(this['locale'],_0x14366d,this['balloonPanelView']));}['_setupBalloonPanel'](_0x4e4e6a){this['balloonPanelView']=new Nt(_0x4e4e6a),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Pt{['balloonPanelView'];['source'];constructor(_0x509066,_0x3271e1,_0x5a287e){super(_0x509066),this['source']=_0x3271e1,this['balloonPanelView']=_0x5a287e,this['set']({'label':_0x3271e1['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x389e8e=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x389e8e['to'](()=>{window['open'](_0x3271e1['url'],'_blank');}),'mouseenter':_0x389e8e['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x389e8e['to'](()=>{this['_hideTooltip']();})}}),_0x3271e1['favicon']){const _0x6e276d=new _0x294569(_0x509066);_0x6e276d['setTemplate']({'tag':'img','attributes':{'src':_0x3271e1['favicon']||ot,'alt':_0x3271e1['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x6e276d);}else this['set']('icon',ot);}['_createTooltipContentView'](_0x4d2636,_0x5daed7){const _0x2c3901=new _0x294569(_0x4d2636),_0x44c777=[];let _0x23eb3c;_0x5daed7?.['favicon']?(_0x23eb3c=new _0x294569(_0x4d2636),_0x23eb3c['setTemplate']({'tag':'img','attributes':{'src':_0x5daed7['favicon'],'alt':_0x5daed7['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x23eb3c=new Wt(),_0x23eb3c['content']=ot,_0x23eb3c['extendTemplate']({'attributes':{'alt':_0x5daed7['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x44c777['push'](_0x23eb3c);const _0x1237f5=new _0x294569(_0x4d2636);_0x1237f5['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x5daed7['url']},'children':[{'text':new URL(_0x5daed7['url'])?.['hostname']}]}),_0x44c777['push'](_0x1237f5);const _0x3c7934=new _0x294569(_0x4d2636);_0x3c7934['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x44c777});const _0x36f1b0=new _0x294569(_0x4d2636);return _0x36f1b0['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x5daed7['title']['length']>0x190?_0x5daed7['title']['substring'](0x0,0x190)+'...':_0x5daed7['title']}]}),_0x2c3901['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x3c7934,_0x36f1b0]}),_0x2c3901;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthWest'],Nt['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 _0x3c9540=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x3c9540);}},rr=class extends _0x294569{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x2a623b(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x1d9863,_0x123b60){super(_0x1d9863);const {areActionsDisabled:_0x4d78e8,showUnchangedParts:_0x52f3d1,availableActions:_0x240d5c}=_0x123b60;this['_areActionsDisabled']=_0x4d78e8,this['_showUnchangedParts']=_0x52f3d1,this['_availableActions']=_0x240d5c,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x1d9863,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':ls(_0x1d9863,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x1d9863,_0x123b60['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x123b60['bodyCollection']),_0x123b60['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'](_0xd4adb5=>_0xd4adb5 instanceof Qn);}async['updateContentParts']({parts:_0x7a3be4,abortSignal:_0x6cebe9,skipLoadingEffects:_0x51537b}){this['_cachedContentParts']['length']?_0x7a3be4['forEach'](_0x455a51=>{const _0x241580=this['_cachedContentParts']['findIndex'](_0x3c6852=>_0x3c6852['index']==_0x455a51['index']);-0x1===_0x241580?this['_cachedContentParts']['push'](_0x455a51):this['_cachedContentParts'][_0x241580]=_0x455a51;}):this['_cachedContentParts']=_0x7a3be4;const _0x385806=this['_showUnchangedParts']?_0x7a3be4:_0x7a3be4['filter'](_0x17ebc5=>_0x17ebc5['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x385806['length']>0x1),_0x51537b&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x1cad26 of _0x385806)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x21b8d2=>{let _0x3218c5=this['getPartView'](_0x1cad26['index']);if(!_0x3218c5){if(_0x3218c5=new Qn(this['locale'],{'part':_0x1cad26,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3218c5['delegate'](...Nn)['to'](this),_0x3218c5['bind']('isTrackChangesOn')['to'](this),!_0x51537b&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x21b8d2),_0x21b8d2['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3218c5,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x51537b||this['_showSkeletonDebounced']();}await _0x3218c5['updateContent']({'part':_0x1cad26,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x21b8d2}),_0x3218c5['markAsDone']();});return _0x6cebe9?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x2c0fed,_0x5a559f){const _0x5b0bf8=this['getPartView'](_0x2c0fed);_0x5b0bf8&&(_0x5b0bf8['state']=_0x5a559f),this['hasPendingParts']='pending'==_0x5a559f||this['_contentPartViews']['some'](_0x17afaf=>'pending'==_0x17afaf['state']);}['setPartActive'](_0x1f8a63,_0x5b00d6){if(!0x1===_0x1f8a63){for(const _0x33546d of this['_contentPartViews'])_0x33546d['isActive']=!0x1;}else{const _0x17bfe6=this['getPartView'](_0x1f8a63);_0x17bfe6&&(_0x17bfe6['isActive']=_0x5b00d6);}}['updateSources'](_0x3fc3c4){_0x3fc3c4['forEach'](_0x463598=>this['_sourcesView']['addSource'](_0x463598)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x5c7574){return this['_contentPartViews']['find'](_0xa10f3f=>_0xa10f3f['partDefinition']['index']==_0x5c7574)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x127a31=!this['_cachedContentParts']['find'](({hasChanges:_0x84b0c1})=>_0x84b0c1),_0x431b6d=!!this['_cachedContentParts']['find'](({hasChanges:_0x4e3bef})=>!_0x4e3bef);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x431b6d,_0x127a31?this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x543262=>_0x543262['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x126454){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x5ab2fc=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x5ab2fc>0x0){const {promise:_0x59c87e,abortController:_0x1bc4bb}=xn(_0x5ab2fc);_0x126454?.['addEventListener']('abort',()=>_0x1bc4bb['abort']()),await _0x59c87e['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x5e0e99=>_0x5e0e99['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x294569{['bodyView'];['children'];['headerView'];constructor(_0x3872a6,_0x3fa146,_0x29a7d5){super(_0x3872a6);const {showDiff:_0x1406ea,areActionsDisabled:_0x98a2fa,showUnchangedParts:_0x163982,availableActions:_0x59f2f3}=_0x3fa146;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x3872a6,{'showDiff':_0x1406ea}),this['headerView']['on']('toggleShowChanges',(_0x46bf02,_0x169e25)=>{this['areChangesVisible']=_0x169e25['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x169e25['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x3872a6,{'areActionsDisabled':_0x98a2fa,'showUnchangedParts':!!_0x163982,'availableActions':_0x59f2f3,'bodyCollection':_0x29a7d5}),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'](_0x5b98ab){await this['bodyView']['updateContentParts'](_0x5b98ab);}['updateSources'](_0x2db3c6){this['bodyView']['updateSources'](_0x2db3c6);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x1c4076,_0x3f7437,_0x302fa4){super(_0x3f7437),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x1c4076,{'showDiff':_0x3f7437['showDiff'],'areActionsDisabled':_0x3f7437['areActionsDisabled'],'availableActions':_0x3f7437['availableActions']},_0x302fa4),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x9017e3,_0x4fb025)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4fb025['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',(_0xe87e15,{index:_0x5759ff})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x5759ff});}),this['containerView']['on']('applySuggestion',(_0x24a172,{index:_0x5009b1}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x5009b1});}),this['containerView']['on']('insertSuggestion',(_0x39e4cd,{index:_0x3eb298}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3eb298});}),this['containerView']['on']('rejectSuggestion',(_0x437654,{index:_0x401352})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x401352});}),this['containerView']['on']('mouseOverSuggestion',(_0x151318,{index:_0x5e4883})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5e4883});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x3eca42,{index:_0x47787f})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x47787f});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x599a1a){await this['containerView']['updateContent'](_0x599a1a);}['updatePartState'](_0x4e59ea,_0x5e19f7){this['containerView']['bodyView']['updatePartState'](_0x4e59ea,_0x5e19f7);}['setPartActive'](_0x2bfe12,_0x32911f){!0x1===_0x2bfe12?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x2bfe12,_0x32911f);}['updateSources'](_0x5048a2){this['containerView']['updateSources'](_0x5048a2);}['getPartView'](_0x31ef40){return this['containerView']['bodyView']['getPartView'](_0x31ef40);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x1c4094,_0x500666,_0x1eebf1){super(_0x500666),this['_bodyCollection']=_0x1eebf1,this['locale']=_0x1c4094,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x294569(),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':Is(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x41c354,renderingStrategy:_0x503343,abortSignal:_0x116538}){'streaming'===_0x503343?await this['streamIntoElement'](_0x41c354,this['replyContainer']['element'],_0x116538):this['replyContainer']['element']['innerHTML']=_0x2a1923(_0x41c354);}['updateSources'](_0x19f407){const _0x228936=new sr(this['locale'],this['_bodyCollection']);_0x228936['children']['addMany'](_0x19f407['map'](_0x445ab4=>new nr(this['locale'],_0x445ab4,_0x228936['balloonPanelView']))),_0x228936['isVisible']=!0x0,this['children']['add'](_0x228936);}},cr=class extends _0xccf9dc{constructor(_0x2a8242=void 0x0){super();const _0x36818d=_0x2a8242?'ck-ai-spinner_'+_0x2a8242:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x36818d]}});}};const lr={'file':_0x31e25e,'image':_0x3b5ca7,'document':_0x547315,'web-resource':_0x56c964,'text':_0x31e25e,'selection':_0x1b7e91,'mcp-tool-context':_0x547315},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 Pt{constructor(_0x44ad15,_0x1adfd5,_0x4532d6,_0x379b24,_0x4d420c=!0x1){super(_0x44ad15),this['_isAnimationOnEnterEnabled']=_0x379b24,this['_initializeProperties'](_0x1adfd5,_0x4532d6,_0x4d420c),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'](_0x133271,_0x17fafe,_0x3824ee){this['set']('label',_0x133271['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x133271['type']),this['set']('id',_0x133271['uiId']),this['set']('readonly',_0x17fafe),this['set']('isLoading',_0x3824ee);}['_setupTemplate'](){const _0x279c00=this['_createIconView'](),_0x5ef8f0=this['_createRemoveButton'](),_0xdb3aec=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0xdb3aec),'children':this['_createTemplateChildren'](_0x279c00,_0x5ef8f0,_0xdb3aec)});}['_createTemplateAttributes'](_0x9a2ec0){return{'class':[ur,_0x9a2ec0['if']('itemType',_r,_0x6b5b03=>'document'==_0x6b5b03),_0x9a2ec0['if']('itemType',dr,_0x263fed=>'selection'==_0x263fed)],'data-cke-tooltip-text':_0x9a2ec0['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x11d6bc,_0x4fb7d0,_0x1f8a02){const _0x1f4ad8=this['_createLabelElement'](_0x1f8a02),_0x40b922=this['_createLoaderIcon']();return this['readonly']?[_0x11d6bc,_0x1f4ad8]:[_0x11d6bc,_0x40b922,_0x1f4ad8,_0x4fb7d0];}['_createLabelElement'](_0x2fd83a){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x2fd83a['to']('label')}]};}['_createRemoveButton'](){const _0x150b4e=new Pt(this['locale']);return _0x150b4e['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x1a57f6}),this['_setupRemoveButtonEvent'](_0x150b4e),_0x150b4e;}['_setupRemoveButtonEvent'](_0xc3e77d){_0xc3e77d['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x294c91=this['bindTemplate'],_0x25d710=new Wt();return _0x25d710['content']=lr[this['itemType']],_0x25d710['extendTemplate']({'attributes':{'class':[Ar,_0x294c91['if']('isLoading','ck-hidden',_0x27ef63=>_0x27ef63)]}}),_0x25d710;}['_handleAnimationEndOnce'](_0x28def6,_0x2eea8d){if(!_0x28def6)return;const _0x13ac4b=()=>{_0x2eea8d(),_0x28def6['removeEventListener']('animationend',_0x13ac4b),_0x28def6['removeEventListener']('webkitAnimationEnd',_0x13ac4b);};_0x28def6['addEventListener']('animationend',_0x13ac4b),_0x28def6['addEventListener']('webkitAnimationEnd',_0x13ac4b);}['_createLoaderIcon'](){const _0x5f4fff=new cr('small');return _0x5f4fff['bind']('isVisible')['to'](this,'isLoading',_0x720ffa=>_0x720ffa),_0x5f4fff;}};function Er(_0x4ffeb7){if(!_0x4ffeb7)return _0x4ffeb7;if(_0x4ffeb7['length']<=0x78)return _0x4ffeb7;const _0x4beb03=_0x4ffeb7['slice'](0x0,0x78),_0x2552ad=_0x4beb03['lastIndexOf']('\x20');return(_0x2552ad>0x0?_0x4beb03['slice'](0x0,_0x2552ad):_0x4beb03)+'…';}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(_0xc114d2,_0x166c45,_0x26f922,_0x24d9fa,_0x432a54){this['_locale']=_0xc114d2,this['_visibleChips']=_0x166c45,this['_config']={...Tr,..._0x26f922,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x26f922['cssClasses']}},this['_overflowChips']=new ht(),this['_bodyCollection']=_0x24d9fa,this['_parentView']=_0x432a54||null;}['setContainerElement'](_0x424e7f){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x424e7f,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 _0x44c8cb=[...this['_visibleChips'],...this['_overflowChips']],_0x3ae611=this['_createCalculationContainer'](),_0x2e2762=this['_calculateOverflowInContainer'](_0x3ae611,_0x44c8cb),_0x8022d9=_0x3ae611['_ancestorsToRestore'];_0x8022d9&&this['_restoreAncestorVisibility'](_0x8022d9),_0x3ae611['remove'](),this['_applyOverflowResults'](_0x44c8cb,_0x2e2762);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x1dec34({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x39f1f6=new Pt(this['_locale']);_0x39f1f6['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0xb974e7=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0xb974e7['push'](this['_config']['cssClasses']['controlsButton']),_0x39f1f6['extendTemplate']({'attributes':{'class':_0xb974e7}}),_0x39f1f6;}['_createShowMoreBalloonPanelView'](){const _0x56cf36=new Nt(this['_locale']);return _0x56cf36['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x56cf36),_0x56cf36;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x576466=>{_0x576466['disableAnimationOnEnter']();});const _0x27eec5=new _0x294569(this['_locale']);_0x27eec5['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x27eec5);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x44a1d6=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x44a1d6?'':'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'](_0x2b7ff6){const _0x53ce0d=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x1c6012=this['_containerElement']?.['classList'];if(_0x1c6012){const _0x24345d=_0x1c6012[0x0]||'',_0x4ff122=_0x2b7ff6['querySelector']('.'+_0x24345d),_0x4cf8f1=_0x2b7ff6['querySelector'](_0x53ce0d);return _0x4ff122||_0x4cf8f1||_0x2b7ff6;}return _0x2b7ff6['querySelector'](_0x53ce0d)||_0x2b7ff6;}['_calculateContainerWidth'](){const _0x5299f8=this['_parentView']?.['element']||this['_containerElement'];if(!_0x5299f8)return wr;const _0x56fc03=window['getComputedStyle'](_0x5299f8)['width'];if('auto'===_0x56fc03||'0px'===_0x56fc03||!_0x56fc03){const _0x1f4e30=_0x5299f8['parentElement'];if(_0x1f4e30){const _0xf5f6bf=window['getComputedStyle'](_0x1f4e30);return'auto'!==_0xf5f6bf['width']?_0xf5f6bf['width']:wr;}return wr;}return _0x56fc03;}['_applyCalculationStyles'](_0x50914c,_0x191d22){this['_config']['cssClasses']['calculationContainer']&&_0x50914c['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x50914c['style']['width']=_0x191d22,_0x50914c['style']['position']='absolute',_0x50914c['style']['top']='-9999px',_0x50914c['style']['left']='-9999px',_0x50914c['style']['opacity']='0',_0x50914c['style']['pointerEvents']='none',_0x50914c['style']['zIndex']='-1',_0x50914c['style']['visibility']='visible\x20!important',_0x50914c['style']['display']='block\x20!important',_0x50914c['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x79d0ef){_0x79d0ef['forEach'](({element:_0xf77679,originalDisplay:_0x5242f4,originalVisibility:_0x3d8974})=>{_0xf77679['style']['display']=_0x5242f4,_0xf77679['style']['visibility']=_0x3d8974;});}['_makeAncestorsVisible'](_0x233039){const _0x4852f4=[];let _0x222ce7=_0x233039;for(;_0x222ce7&&_0x222ce7!==document['body'];){const _0x11ee64=window['getComputedStyle'](_0x222ce7);'none'!==_0x11ee64['display']&&'hidden'!==_0x11ee64['visibility']||(_0x4852f4['push']({'element':_0x222ce7,'originalDisplay':_0x222ce7['style']['display'],'originalVisibility':_0x222ce7['style']['visibility']}),_0x222ce7['style']['display']='block',_0x222ce7['style']['visibility']='visible'),_0x222ce7=_0x222ce7['parentElement'];}return _0x4852f4;}['_createContainerElements'](){let _0x15db9b,_0x25203a;return this['_parentView']?.['element']?(_0x15db9b=this['_parentView']['element']['cloneNode'](!0x0),_0x25203a=this['_findTargetContainer'](_0x15db9b)):(_0x15db9b=document['createElement']('div'),_0x25203a=_0x15db9b),{'calculationContainer':_0x15db9b,'targetContainer':_0x25203a};}['_createCalculationContainer'](){const {calculationContainer:_0x2053a0,targetContainer:_0x339b04}=this['_createContainerElements'](),_0x419964=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x2053a0,_0x419964);const _0x4e24eb=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x4e24eb?_0x4e24eb['appendChild'](_0x2053a0):document['body']['appendChild'](_0x2053a0),_0x2053a0['_targetContainer']=_0x339b04;const _0x2821f9=this['_makeAncestorsVisible'](_0x4e24eb||null);return _0x2053a0['offsetWidth'],_0x2053a0['_ancestorsToRestore']=_0x2821f9,_0x2053a0;}['_calculateOverflowInContainer'](_0x4dedef,_0x192f5f){const _0x3c43e8=_0x4dedef['_targetContainer']||_0x4dedef,_0x2c0f2d=[],{rowCount:_0x4893f5}=this['_renderChipsAndCountRows'](_0x3c43e8,_0x192f5f);if(_0x4893f5<=this['_config']['maxVisibleRows'])return _0x2c0f2d;const _0x123eab=_0x192f5f['slice']();for(;_0x123eab['length']>0x0;){if(this['_testButtonFit'](_0x4dedef,_0x3c43e8,_0x123eab)){const _0x2c036c=_0x192f5f['filter'](_0x5facee=>!_0x123eab['includes'](_0x5facee));_0x2c0f2d['push'](..._0x2c036c);break;}if(!_0x123eab['pop']())break;}return _0x2c0f2d;}['_renderChipsAndCountRows'](_0xaabf06,_0xd35f95){_0xaabf06['innerHTML']='',_0xd35f95['forEach'](_0x585fef=>{if(_0x585fef['element']){const _0x3b90d5=_0x585fef['element']['cloneNode'](!0x0);_0xaabf06['appendChild'](_0x3b90d5);}}),_0xaabf06['offsetWidth'];const _0x34613c=_0xaabf06['children'],_0x5d9766=[];return Array['from'](_0x34613c)['forEach'](_0x372e4c=>{const _0xa8bd77=_0x372e4c['getBoundingClientRect']()['top'];_0x5d9766['some'](_0x1e3549=>Math['abs'](_0x1e3549-_0xa8bd77)<this['_config']['rowDetectionTolerance'])||_0x5d9766['push'](_0xa8bd77);}),{'rowCount':_0x5d9766['length']};}['_createMockButton'](){const _0x494390=document['createElement']('button');return _0x494390['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x494390['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x494390['textContent']='+\x201',_0x494390;}['_testButtonFit'](_0x5bb5a7,_0x41da5a,_0x6d3737){this['_renderChipsAndCountRows'](_0x41da5a,_0x6d3737);const _0x85dd3a=this['_createMockButton']();_0x5bb5a7['appendChild'](_0x85dd3a),_0x5bb5a7['offsetWidth'];const _0x7ece2d=[..._0x41da5a['children'],_0x85dd3a],_0x53b785=[];_0x7ece2d['forEach'](_0x30a8ab=>{const _0x27d694=_0x30a8ab['getBoundingClientRect']()['top'];_0x53b785['some'](_0x389440=>Math['abs'](_0x389440-_0x27d694)<this['_config']['rowDetectionTolerance'])||_0x53b785['push'](_0x27d694);});const _0xcd1141=_0x53b785['length'];return _0x85dd3a['remove'](),_0xcd1141<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x46e400,_0x5c4405){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x46e400['forEach'](_0x351f9d=>{_0x5c4405['includes'](_0x351f9d)?this['_overflowChips']['add'](_0x351f9d):this['_visibleChips']['add'](_0x351f9d);});}['_updateOverflowUI'](_0xc892f4){if(_0xc892f4>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0xc892f4>0x0&&this['_showMoreButtonView']){const _0x31b8fa=''+this['_config']['showMoreLabelPrefix']+(_0xc892f4<0x63?_0xc892f4:'99');this['_showMoreButtonView']['label']=_0x31b8fa;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x4b2bdb,_0x238474){this['_distributeChips'](_0x4b2bdb,_0x238474),this['_updateOverflowUI'](_0x238474['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x2c7217=>{_0x2c7217[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 _0x47d639=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x47d639['width']||0x0===_0x47d639['height'])return!0x1;const _0x5ab9aa=window['innerHeight']||document['documentElement']['clientHeight'],_0x3ef7c6=window['innerWidth']||document['documentElement']['clientWidth'];return _0x47d639['bottom']>=-0xc8&&_0x47d639['top']<=_0x5ab9aa+0xc8&&_0x47d639['right']>=-0xc8&&_0x47d639['left']<=_0x3ef7c6+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 _0x294569{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x5633e9,_0x4e55f7,_0xc4a69a){super(_0x5633e9),this['_bodyCollection']=_0xc4a69a,this['_createContextChips'](_0x4e55f7);const _0x2de72e={'cssClasses':{'showMoreButton':Or+'\x20'+cn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x5633e9,this['_contextChips'],_0x2de72e,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 _0x19aec6=this['element']['querySelector']('.'+br);_0x19aec6&&(this['_overflowManager']['setContainerElement'](_0x19aec6),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x4cb6e6){for(const _0x21de0b of _0x4cb6e6){const _0x49b86e=new mr(this['locale'],_0x21de0b,!0x0,!0x1);this['_contextChips']['add'](_0x49b86e);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x19c97b,_0x374d6e,_0x3b4b58){super(_0x374d6e),this['_locale']=_0x19c97b,this['_bodyCollection']=_0x3b4b58,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'](_0x437d7e=>!_0x437d7e['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x294569(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(_0x118cf0,_0x38034d){super(_0x38034d);const {isWebSearchEnabled:_0x3c15e6,isReasoningEnabled:_0x17f9b4}=_0x38034d['capabilities'],_0x3e4300=[];let _0xa069fd='';_0x3c15e6&&_0x17f9b4?(_0xa069fd=ls(_0x118cf0,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x3e4300['push'](xr(ot)),_0x3e4300['push'](xr(_0x51f037))):_0x3c15e6?(_0xa069fd=ls(_0x118cf0,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x3e4300['push'](xr(ot))):_0x17f9b4&&(_0xa069fd=ls(_0x118cf0,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x3e4300['push'](xr(_0x51f037))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0xa069fd?'':'ck-hidden']}});const _0x17c495=new _0x294569();_0x17c495['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x3e4300,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0xa069fd]}]}),this['children']['add'](_0x17c495),this['capabilities']=_0x38034d['capabilities'];}};function xr(_0x139767){const _0x50e5e0=new Wt();return _0x50e5e0['content']=_0x139767,_0x50e5e0;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x9e675d){this['element']=_0x9e675d,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x2c90d7 of Lr){const _0x13f99e='keydown'!==_0x2c90d7;this['element']['addEventListener'](_0x2c90d7,this['_onUserEvent']['bind'](this),{'passive':_0x13f99e,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3a32f1=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3a32f1?'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'](_0x47acb9){if(this['isRunning']){if('keydown'===_0x47acb9['type']){const _0x36d6be=_0x47acb9['key'];if(!Dr['includes'](_0x36d6be))return;}_0x47acb9 instanceof WheelEvent?_0x47acb9['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x184bd1,scrollHeight:_0x258869,clientHeight:_0x35e4c6}=this['element'];return _0x258869-_0x184bd1-_0x35e4c6<=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(_0x220ca1){super(_0x220ca1),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 _0x294569{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x346071,_0x41bff5){super(_0x346071),this['_bodyCollection']=_0x41bff5,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'](_0x31d1e3,_0x297db0){let _0x8c38fd;return'ai-reply'===_0x31d1e3?_0x8c38fd=new hr(this['locale'],_0x297db0,this['_bodyCollection']):'ai-suggestion-reply'===_0x31d1e3?(_0x8c38fd=new ar(this['locale'],_0x297db0,this['_bodyCollection']),_0x8c38fd['bind']('isTrackChangesOn')['to'](this)):_0x8c38fd='user-message'===_0x31d1e3?new Nr(this['locale'],_0x297db0,this['_bodyCollection']):'interaction-header'===_0x31d1e3?new yr(this['locale'],_0x297db0):'custom-element'===_0x31d1e3?new Hr(_0x297db0):new tr(_0x297db0),this['children']['add'](_0x8c38fd),_0x8c38fd;}async['updateReplyItem']({id:_0xc8c8aa,parsedContent:_0x4d94eb,renderingStrategy:_0x205d45,abortSignal:_0x37306b}){const _0x4858a4=this['getItemById'](_0xc8c8aa);if(!(_0x4858a4 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x4858a4,'id':_0xc8c8aa,'parsedContent':_0x4d94eb});await _0x4858a4['updateContent']({'parsedContent':_0x4d94eb,'renderingStrategy':_0x205d45,'abortSignal':_0x37306b});}async['updateWebSources'](_0x2dad92,_0x3b0f18){const _0xebeb65=this['getItemById'](_0x2dad92);if(_0xebeb65 instanceof ar)_0xebeb65['updateSources'](_0x3b0f18);else{if(!(_0xebeb65 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0xebeb65,'id':_0x2dad92,'sources':_0x3b0f18});_0xebeb65['updateSources'](_0x3b0f18);}}async['updateSuggestionItem']({id:_0x2cab0f,parts:_0x3c9f2c,abortSignal:_0x167790,skipLoadingEffects:_0x500daa}){const _0x521fe7=this['getItemById'](_0x2cab0f);if(!(_0x521fe7 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x521fe7,'id':_0x2cab0f,'parts':_0x3c9f2c});await _0x521fe7['updateContent']({'parts':_0x3c9f2c,'abortSignal':_0x167790,'skipLoadingEffects':_0x500daa});}['updateSuggestionPartState']({id:_0x1e6e74,index:_0xabbb51,state:_0x10fd08}){const _0x15036d=this['getItemById'](_0x1e6e74);if(!(_0x15036d instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1e6e74});_0x15036d['updatePartState'](_0xabbb51,_0x10fd08);}['setSuggestionPartActive']({id:_0x582837,index:_0x2b8f2f,isActive:_0x215efb}){const _0x50a340=this['getItemById'](_0x582837);if(!(_0x50a340 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x582837});this['children']['filter'](_0x3da8a7=>_0x3da8a7 instanceof ar)['forEach'](_0x3962e7=>{_0x3962e7['setPartActive'](!0x1);}),_0x50a340['setPartActive'](_0x2b8f2f,_0x215efb);}['markItemAsDone'](_0x149eab){this['getItemById'](_0x149eab)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x4eae41=>_0x4eae41['options']['id']);}['removeItem'](_0x58976e){this['children']['remove'](this['getItemById'](_0x58976e));}['hasItem'](_0x355c7d){return!!this['children']['find'](_0x3de3bd=>_0x3de3bd['options']['id']['includes'](_0x355c7d));}['scrollToSuggestion'](_0x580e8a,_0x299d6b){const _0x5c4918=this['getItemById'](_0x580e8a);if(!(_0x5c4918 instanceof ar))return void ft('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x580e8a,'partIndex':_0x299d6b});const _0x8d3ee7=_0x5c4918['getPartView'](_0x299d6b);_0x8d3ee7?bt(_0x8d3ee7['element'],0x14,this['element']['parentElement'],!0x0,!0x0):ft('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x580e8a,'partIndex':_0x299d6b});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x45f56b=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x45f56b,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x2a4421=new Xn(this['locale'],zn['aiFeed']);return _0x2a4421['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x2a4421;}['_createFeedItems'](){const _0x4aa8ac=new _0x294569(this['locale']);return _0x4aa8ac['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x4aa8ac;}['_createFeedLoader'](){const _0x4bce83=new _0x294569(this['locale']);return _0x4bce83['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x93c5cf=>!_0x93c5cf)]},'children':this['_createLoaderChildren']()}),_0x4bce83;}['_createLoaderChildren'](){const _0x44d98e=new cr();return _0x44d98e['isVisible']=!0x0,[_0x44d98e,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x286056){const _0x205361=this['children']['find'](_0x46192a=>_0x46192a['options']['id']['includes'](_0x286056));if(!_0x205361)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x286056});return _0x205361;}['setLoadingMessage'](_0x449bf8){this['set']('loadingMessage',_0x449bf8);}['toggleLoadingSkeleton'](_0x25d3e3){this['set']('isLoadingSkeletonVisible',_0x25d3e3);}['startAutoScroll'](_0x5352a3={}){this['scrollManager']['start'](_0x5352a3);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends zt{['filter'](){let _0x40b73b=0x0;for(const _0x353f01 of this['items'])_0x40b73b+=_0x353f01['items']['length'];return{'resultsCount':_0x40b73b,'totalItemsCount':_0x40b73b};}};function Ur(_0x58e03a){const _0x5e9697=[];let _0x225d2c=!0x1;for(const _0x1674ee of Array['from'](_0x58e03a['items'])){if('file'!==_0x1674ee['kind'])continue;if(_0x1674ee['webkitGetAsEntry']()?.['isDirectory']){_0x225d2c=!0x0;continue;}const _0x2849cd=_0x1674ee['getAsFile']();_0x2849cd&&_0x5e9697['push'](_0x2849cd);}return{'files':_0x5e9697,'hasDirectory':_0x225d2c};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends kt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x5d1628,_0x5e5027){super(_0x5d1628,{'queryView':{'label':'','creator':_0x461940,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x5d1628),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x5e5027,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',(_0xe83039,_0x26a36b)=>!_0xe83039&&!_0x26a36b),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x18914d,_0x1fd0d5)=>{this['isUploadInProgress']||this['isEmpty']||_0x18914d['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1fd0d5());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x437b33=>this['_handlePaste'](_0x437b33)),this['element']['addEventListener']('drop',_0x638364=>this['_handleDrop'](_0x638364));}['_handlePaste'](_0x1b57fa){const _0x32f101=_0x1b57fa['clipboardData'];if(!_0x32f101)return;const {files:_0x180c64,hasDirectory:_0x19624c}=Ur(_0x32f101),_0x5d0cf8={'files':_0x180c64,'plainText':_0x32f101['getData']('text/plain'),'hasDirectory':_0x19624c,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1b57fa['preventDefault']()};this['fire']('promptInputPaste',_0x5d0cf8);}['_handleDrop'](_0xff53e){const _0xff44c9=_0xff53e['dataTransfer'];if(!_0xff44c9)return;const _0x322026={'files':[],'plainText':_0xff44c9['getData']('text/uri-list')||_0xff44c9['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0xff53e['preventDefault']()};this['fire']('promptInputPaste',_0x322026);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x2a15cf=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x2a15cf)return this['queryView']['errorText']=ls(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x25bd1d=_0x59b4a8(_0x2a15cf);this['fire']('sendUserMessage',_0x25bd1d),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x5de951){this['queryView']['fieldView']['set']('placeholder',_0x5de951);}['focus'](_0x5b08dd=!0x1){super['focus'](),_0x5b08dd&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x816736=new Pt(this['locale']);return _0x816736['set']({'icon':it,'label':ls(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+an,'isEnabled':!0x1}),_0x816736['on']('execute',()=>{this['submit']();}),_0x816736;}['setIsUploadInProgress'](_0x4aa456){this['isUploadInProgress']=_0x4aa456;}['_setUpAddContextButtonPositioning'](){const _0x4c7f83=this['locale'],_0x3ad8b3=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x50dd29=new gt(this['queryView']['fieldView']['element']),_0x5df40d=new gt(this['_addContextButtonView']['element']),_0x1cb1d4=_0x50dd29['width'],_0x1eb118='rtl'===_0x4c7f83['uiLanguageDirection']?'right':'left';_0x50dd29['excludeScrollbarsAndBorders']();const _0x496f28=_0x1cb1d4-_0x50dd29['width']+0x1;this['_addContextButtonView']['element']['style'][_0x1eb118]='calc('+(_0x1cb1d4-_0x5df40d['width']-_0x496f28)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x3ad8b3),this['on']('render',()=>{_0x3ad8b3(),this['_queryViewResizeObserver']=new At(this['queryView']['fieldView']['element'],()=>{_0x3ad8b3();});});}},Fr=class extends _0x294569{constructor(_0x3ea616){super(_0x3ea616);const _0x54da6d=new Wt();_0x54da6d['content']=_0x31e25e,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x54da6d,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':ls(_0x3ea616,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x1c1313){let _0x20ce49=0x0;_0x1c1313['addEventListener']('dragenter',_0x2433d6=>{_0x2433d6['dataTransfer']&&(_0x20ce49++,0x1===_0x20ce49&&this['fire']('dragEnter'),_0x1c1313['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x1c1313['addEventListener']('dragover',_0x212d06=>{_0x212d06['dataTransfer']&&_0x212d06['preventDefault']();}),_0x1c1313['addEventListener']('dragleave',()=>{--_0x20ce49<=0x0&&(_0x20ce49=0x0,_0x1c1313['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x1c1313['addEventListener']('drop',_0x48f649=>{_0x48f649['preventDefault'](),_0x20ce49=0x0,_0x1c1313['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x48f649);});}['_handleDrop'](_0x7c9a11){const _0xf912a5=_0x7c9a11['dataTransfer'];if(!_0xf912a5)return;const {files:_0x1f2626,hasDirectory:_0x39d441}=Ur(_0xf912a5),_0x35814d={'files':_0x1f2626,'plainText':_0xf912a5['getData']('text/uri-list')||_0xf912a5['getData']('text/plain'),'hasDirectory':_0x39d441,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x35814d);}};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 _0x294569{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x414820){super(_0x414820),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',_0x58225f=>'selector'===_0x58225f),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x3dbfaa=>_0x3dbfaa?this['_modelSelectionDropdown']['buttonView']['label']:ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3ad7ca=>_0x3ad7ca),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x294cbd=>_0x294cbd),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0xea37d=>ls(this['locale'],_0xea37d?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x2124a5=>_0x2124a5),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x426fa7=>ls(this['locale'],_0x426fa7?'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 ht(),_0x1e8284(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x194fc8,_0x3f6487){if(_0x3f6487)this['set']('modelDisplayMode','hidden');else{const _0x1d59fd=0x1===_0x194fc8['length'];this['set']('modelDisplayMode',_0x1d59fd?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x194fc8?.['length'])for(const _0x133f8a of _0x194fc8){const _0x5719a5=new _0x52a6d8({'label':_0x133f8a['name'],'withText':!0x0,'role':'menuitemradio','id':_0x133f8a['id'],'model':_0x133f8a});_0x5719a5['bind']('isOn')['to'](this,'activeModelId',_0x4ae12b=>_0x4ae12b===_0x133f8a['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x5719a5,'labelView':new Jr(this['locale'],_0x133f8a)});}}['setWebSearch'](_0xa899a4){this['set']('webSearchActive',_0xa899a4);}['setReasoning'](_0x46ff6e){this['set']('reasoningActive',_0x46ff6e);}['setModel'](_0x4aa0f1){if(!_0x4aa0f1)return;this['activeModelId']=_0x4aa0f1['id'],this['activeModelName']=_0x4aa0f1['name']||_0x4aa0f1['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x4aa0f1['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x4aa0f1['name']);const _0x3834b8=_0x4aa0f1['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x3834b8),this['_webSearchButton']['set']('isVisible',_0x3834b8);const _0x19cb93=_0x4aa0f1['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x19cb93),this['_reasoningButton']['set']('isVisible',_0x19cb93);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x285599){this['set']('modelSelectorEnabled',!0x1),_0x285599&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x4b7f11=new Pt();return _0x4b7f11['set']({'label':ls(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ot,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x4b7f11['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x4b7f11;}['_createReasoningButton'](){const _0x46b23e=new Pt();return _0x46b23e['set']({'label':ls(this['locale'],'AI_CHAT_REASONING'),'icon':_0x51f037,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x46b23e['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x46b23e;}['_createCommandsButton'](){const _0x55e72d=new Pt();return _0x55e72d['set']({'label':ls(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x11cdab,'withText':!0x0,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltip':ls(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x55e72d['extendTemplate']({'attributes':{'class':[Yr]}}),_0x55e72d['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x55e72d;}['_createModelSelectionDropdown'](){const _0x4db046=_0x3a7b01(this['locale']);return _0x4db046['set']({'panelPosition':'ne','class':[$r]}),_0x4db046['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':cn}),this['listenTo'](_0x4db046,'execute',_0x3e418c=>{this['fire']('selectModel',_0x3e418c['source']['model']);}),_0x4db046;}['_createModelNameView'](){const _0x338728=new Zr(this['locale']);return _0x338728['bind']('text')['to'](this,'activeModelName',_0x5a5abb=>_0x5a5abb??''),_0x338728['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4ced71=>'name'===_0x4ced71),_0x338728;}},Jr=class extends Lt{constructor(_0xda8d0d,_0x2323c5){super();const _0x5a1438=this['bindTemplate'],_0x2f6003=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x5a1438['to']('style'),'id':_0x5a1438['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x5a1438['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x2323c5['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x2f6003}]}),_0x2f6003['addMany'](this['_getCapabilityParts'](_0xda8d0d,ot,'AI_CHAT_SEARCH_WEB',_0x2323c5['capabilities']['webSearch']?.['enabled']??!0x1)),_0x2f6003['addMany'](this['_getCapabilityParts'](_0xda8d0d,_0x51f037,'AI_CHAT_REASONING',_0x2323c5['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x4847e6,_0x4ec97c,_0x46a009,_0xc2d949){const _0x7513da=new Wt();_0x7513da['content']=_0x4ec97c;const _0x207ba5=new _0x294569(_0x4847e6);_0x207ba5['setTemplate']({'tag':'span','children':[{'text':ls(_0x4847e6,_0x46a009)+':\x20'}]});const _0x41cb2a=new _0x294569(_0x4847e6);return _0x41cb2a['setTemplate']({'tag':'span','children':[{'text':ls(_0x4847e6,_0xc2d949?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x7513da,_0x207ba5,_0x41cb2a];}},Zr=class extends _0x294569{constructor(_0x3d1104){super(_0x3d1104),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x23ddc9=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x23ddc9['if']('isVisible','ck-hidden',_0x149eaa=>!_0x149eaa)]},'children':[{'text':_0x23ddc9['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x294569{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0xf7bcf){super(_0xf7bcf),this['focusTracker']=new ut(),this['keystrokes']=new dt(),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 Bt({'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'](_0x11a881=>{this['focusTracker']['add'](_0x11a881['element']),this['keystrokes']['listenTo'](_0x11a881['element']);}),_0x3fc16e({'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'](_0x4b1e2b){this['urlInputField']['errorText']=_0x4b1e2b,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x205bf3=new Pt(this['locale']);return _0x205bf3['set']({'icon':_0x59b1a0,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x38fa7a,_0x3338f8,_0x5e469c)=>{_0x205bf3['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x5e469c?'':'\x20ck-hidden')]});}),_0x205bf3;}['_createUrlInputField'](){const _0x4c4f1e=new $t(this['locale'],_0x442fb3);return _0x4c4f1e['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x4c4f1e['fieldView']['set']({'placeholder':ls(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x4c4f1e;}['_createConfirmButton'](){const _0x174757=new Pt(this['locale']);return _0x174757['set']({'icon':_0xdd186f,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x174757;}['_setupTemplate'](){const _0x567d46=new Gt(this['locale'],{'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x567d46['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x567d46,{'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',_0x4769d9=>{_0x4769d9['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x1fd109,_0x2a541d)=>{this['clear'](),this['fire']('cancel'),_0x2a541d();});}['_handleSubmit'](){const _0x285105=this['getValue']()['trim']();_0x285105?this['_isValidUrl'](_0x285105)?(this['clearError'](),this['fire']('submitUrl',_0x285105)):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x1fc132=this['getValue']()['trim'](),_0x20bfc4=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x1fc132['length']>0x0&&!_0x20bfc4;}['_isValidUrl'](_0x53bcb0){try{return!!new URL(_0x53bcb0);}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 Xt{['resource'];['_titleView'];['_iconView'];constructor(_0x1e2614,_0x65751a){super(_0x1e2614),this['resource']=_0x65751a,this['set']('isInContext',!!_0x65751a['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0xc1243a){if(_0xc1243a['isInContext'])return _0xdd186f;switch(_0xc1243a['type']){case'document':return _0x547315;case'web-resource':return _0x56c964;case'file':case'text':return _0x31e25e;default:return _0x28f992;}}['highlightText'](_0x3de2ee){if(!_0x3de2ee||''===_0x3de2ee['trim']())return void this['_titleView']['highlightText'](null);const _0x23833b=new RegExp(_0x4c3f28(_0x3de2ee),'gi');this['_titleView']['highlightText'](_0x23833b);}['updateResourceState'](_0x1124bf){this['resource']['isInContext']=_0x1124bf,this['isInContext']=_0x1124bf,this['_updateIcon']();}['_createTitleView'](){const _0x37e51a=new Kt();return _0x37e51a['text']=this['resource']['label'],_0x37e51a['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x37e51a;}['_createIconView'](){const _0x551614=new Wt();return _0x551614['content']=this['getResourceIcon'](this['resource']),_0x551614;}['_setupTemplate'](){const _0x3b52d5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x3b52d5['if']('isVisible','ck-hidden',_0x2eab6b=>!_0x2eab6b),_0x3b52d5['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3b52d5['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends zt{['_source'];constructor(_0x34e43a,_0x486ef3){super(_0x34e43a),this['_source']=_0x486ef3,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x4ca8c1,_0x3f2f92){this['items']['clear']();let _0x2a90eb=_0x4ca8c1;if(this['_source']['useDefaultFiltering']&&_0x3f2f92&&''!==_0x3f2f92['trim']()){const _0xe47c04=new RegExp(_0x3f2f92['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x2a90eb=_0x4ca8c1['filter'](_0x598fbc=>_0xe47c04['test'](_0x598fbc['label']));}for(const _0xcb398d of _0x2a90eb){const _0x9bc868=new ao(this['locale'],_0xcb398d);_0x9bc868['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0xcb398d);}),this['items']['add'](_0x9bc868);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x3f2f92);}['highlightText'](_0x266023){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x34010e=>{_0x34010e['highlightText'](_0x266023);});}['updateResourceState'](_0x9375f5,_0x48f48e){for(const _0x416150 of this['items']){const _0x136540=_0x416150;_0x136540['resource']['id']===_0x9375f5&&_0x136540['updateResourceState'](_0x48f48e);}}['_handleResourceSelection'](_0x2434cb,_0x3e218f){this['fire']('addResourceToContext',{'source':_0x2434cb,'resource':_0x3e218f});}},lo=class extends $t{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x35db75){const t=_0x35db75['t'],_0xfc7c40={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x442fb3,'label':ls(_0x35db75,'AI_CHAT_SEARCH_RESOURCES')};super(_0x35db75,_0xfc7c40['creator']),this['label']=_0xfc7c40['label'],this['_viewConfig']=_0xfc7c40,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x35db75,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x20135e){this['fire']('search',_0x20135e);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Wt(),this['iconView']['content']=_0x976e16,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x453d25,t){this['resetButtonView']=new Pt(_0x453d25),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x1a57f6,'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',_0x1e8810=>!_0x1e8810),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 _0x294569{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x52962c,_0x3a309a){super(_0x52962c),this['_source']=_0x3a309a['source'],this['_searchInputVisibleFrom']=_0x3a309a['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 _0x2776cd([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 _0x202a1a=new _0x294569(this['locale']);return _0x202a1a['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1c1143,_0x2fc254)=>{this['loadResources'](_0x2fc254),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x2fc254);}),_0x202a1a;}['_createResourcesListView'](){const _0x3b9865=new co(this['locale'],this['_source']);return _0x3b9865['delegate']('addResourceToContext')['to'](this),_0x3b9865['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x3b9865;}['_createSkeletonView'](){const _0x3e9555=new Xn(this['locale'],zn['aiChatResources']);return _0x3e9555['bind']('isVisible')['to'](this,'isLoading'),_0x3e9555;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4d23e6){const _0x576add=Ot();this['_latestLoadResourcesUid']=_0x576add,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4d23e6,'uid':_0x576add}),this['isLoading']=!0x0;}['setResources'](_0x1d403f,_0x5d7a8f){if(_0x5d7a8f&&_0x5d7a8f!==this['_latestLoadResourcesUid'])return;const _0x16035d=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x1d403f,_0x16035d),_0x1d403f['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x41043f,_0x4e8ad4){this['_resourcesListView']['updateResourceState'](_0x41043f,_0x4e8ad4);}};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(_0xc783ae,_0x397196,_0x435122){this['_locale']=_0xc783ae,this['_bodyCollection']=_0x397196,this['_config']=_0x435122;}['showSourceResourcesBalloon']({source:_0xdac944,withBackButton:_0x4c0638}){let _0x1b5d9a=this['_sourceResourceBalloons']['get'](_0xdac944['id']);_0x1b5d9a||(_0x1b5d9a=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0xdac944['id'],_0x1b5d9a),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x1b5d9a)),this['_addSourceResourceContent']({'balloonPanel':_0x1b5d9a,'source':_0xdac944,'withBackButton':_0x4c0638}),_0x1b5d9a['show']();const _0x529bf7=this['_config']['getTargetElement']();_0x529bf7&&_0x1b5d9a['pin']({'target':_0x529bf7,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x3f0ade,_0x1ea908,_0x2ff6e5){const _0x40f59e=this['_sourceResourceBalloons']['get'](_0x3f0ade);if(!_0x40f59e)return;const _0x22b8e8=this['_getResourcesViewFromBalloon'](_0x40f59e);_0x22b8e8&&(_0x22b8e8['setResources'](_0x1ea908,_0x2ff6e5),_0x22b8e8['once']('change:isLoading',()=>{_0x40f59e['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x1a0089){const _0xc67526=this['_sourceResourceBalloons']['get'](_0x1a0089);_0xc67526&&requestAnimationFrame(()=>{_0xc67526['hide'](),this['_sourceResourceBalloons']['delete'](_0x1a0089),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x1e1a4e of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x1e1a4e);}['isAnyResourceBalloonVisible'](){for(const _0x3622a9 of this['_sourceResourceBalloons']['values']())if(_0x3622a9['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x4b7d2c,_0x104371,_0x844b29){const _0x4e58db=this['_sourceResourceBalloons']['get'](_0x4b7d2c);if(!_0x4e58db||!_0x4e58db['isVisible'])return;const _0x2585df=this['_config']['getTargetElement']();if(!_0x2585df)return;_0x4e58db['pin']({'target':_0x2585df,'limiter':this['_config']['getLimiterElement']()});const _0x2c453a=this['_getResourcesViewFromBalloon'](_0x4e58db);_0x2c453a&&_0x2c453a['updateResourceState'](_0x104371,_0x844b29);}['destroy'](){for(const _0x57bee5 of this['_sourceResourceBalloons']['values']())_0x57bee5['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x438463=new Nt(this['_locale']);return _0x438463['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x438463),_0x438463;}['_addSourceResourceContent']({balloonPanel:_0x5599ba,source:_0x406ed0,withBackButton:_0x28183b}){_0x5599ba['content']['clear']();const _0x305f2c=this['_createBalloonHeader']({'balloonPanel':_0x5599ba,'source':_0x406ed0,'withBackButton':_0x28183b});_0x5599ba['content']['add'](_0x305f2c);const _0x314fd5=this['_createBalloonResourcesView'](_0x406ed0);_0x5599ba['content']['add'](_0x314fd5);}['_createBalloonHeader']({balloonPanel:_0x58c4c0,source:_0x46ac68,withBackButton:_0x19a3a5}){const _0x596364=new Gt(this['_locale'],{'label':_0x46ac68['label'],'class':Ao});return _0x19a3a5&&_0x596364['children']['add'](this['_createBackButton'](_0x58c4c0),0x0),_0x596364;}['_createBackButton'](_0x55f1c8){const _0x132924=new Pt(this['_locale']);return _0x132924['set']({'icon':_0x59b1a0,'tooltip':ls(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x132924['on']('execute',()=>{_0x55f1c8['hide'](),this['_config']['onBackToContext']();}),_0x132924;}['_createBalloonResourcesView'](_0x510b7b){const _0x994764=new uo(this['_locale'],{'source':_0x510b7b,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x994764['on']('loadSourceResources',(_0x1b62ca,_0x22ad15)=>{this['_config']['onLoadSourceResources'](_0x22ad15);}),_0x994764['on']('addResourceToContext',(_0x40a325,_0x549a40)=>{this['_config']['onResourceSelected'](_0x549a40['source'],_0x549a40['resource']),this['closeSourceResourceBalloon'](_0x510b7b['id']);}),_0x994764;}['_getResourcesViewFromBalloon'](_0x26d704){const _0x430b7c=_0x26d704['content']['get'](0x1);return _0x430b7c instanceof uo?_0x430b7c:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x359b13){_0x1dec34({'emitter':_0x359b13,'contextElements':[_0x359b13['element']],'callback':()=>{_0x359b13['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x359b13['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=[Nt['defaultPositions']['northArrowSouthWest'],Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthEast'],Nt['defaultPositions']['southArrowNorthWest'],Nt['defaultPositions']['southArrowNorth'],Nt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x294569{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x5cb646,_0x5518f5){super(_0x5cb646),this['bodyCollection']=_0x5518f5['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x5cb646),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x5cb646),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x5cb646),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x5cb646,_0x5518f5);const _0x510cec={'cssClasses':{'showMoreButton':Oo+'\x20'+cn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x5cb646,this['_currentContextsChips'],_0x510cec,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'](_0x5caf8,_0x259aca){const _0x169e7a=this['_createContextButton'](_0x5caf8,'current',!0x0,_0x259aca);this['_addContextToCollection'](_0x169e7a,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x4ffa0d){this['_removeContextFromCollection'](_0x4ffa0d,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x4ffa0d,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x2132d3,_0x5577c4){let _0x1b300f=this['_currentContextsChips']['find'](_0x262635=>_0x262635['id']===_0x2132d3);_0x1b300f||(_0x1b300f=this['_overflowManager']['overflowChips']['find'](_0x2268f0=>_0x2268f0['id']===_0x2132d3)),_0x1b300f&&(_0x1b300f['isLoading']=_0x5577c4);}['setConversationContext'](_0x30b624){this['_conversationContextsChips']['clear']();for(const _0x492c90 of _0x30b624){const _0x3c0920=this['_createContextButton'](_0x492c90,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x3c0920,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x3282ac,_0x156236,_0x49d18e){this['_resourcesBalloonView']['updateResourceState'](_0x3282ac,_0x156236,_0x49d18e);}['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:_0x58e3be,withBackButton:_0x2a577f}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x58e3be,'withBackButton':_0x2a577f}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x5014c6,_0x38f114,_0x3b4235,_0x25f444){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x5014c6,_0x3b4235,_0x25f444);}['closeSourceResourceBalloon'](_0x2018a9){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x2018a9),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x2dab20){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x2dab20),this['_setAddContextButtonEnabled'](_0x2dab20);}['_setAddContextButtonEnabled'](_0x51a7ab){const _0xb46448=!_0x51a7ab['document']['isHidden']&&_0x51a7ab['document']['enabled'],_0x3ecdc8=_0x51a7ab['urls']['enabled'],_0x8bfd55=_0x51a7ab['files']['enabled'],_0x392f12=_0x51a7ab['sources']['length']>0x0,_0x209df1=_0x51a7ab['customItems']&&_0x51a7ab['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0xb46448||_0x3ecdc8||_0x8bfd55||_0x392f12||_0x209df1;}['_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'](_0x1bdd97){const _0x5e7ecd=new Pt(_0x1bdd97);return _0x5e7ecd['set']({'label':ls(_0x1bdd97,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+cn,'icon':_0x1a91f0,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x5e7ecd;}['_createAddContextBalloonPanelView'](_0x2938aa){return this['_createBaseBalloonPanel'](_0x2938aa,To);}['_createUrlBalloonPanelView'](_0x5e4d72){const _0x285e88=this['_createBaseBalloonPanel'](_0x5e4d72,Co);return this['_addUrlContent'](_0x285e88,_0x5e4d72),_0x285e88;}['_createResourcesBalloonView'](_0x66fc1f,_0x73535c){const _0x2289e5={'searchInputVisibleFrom':_0x73535c['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x587de8,_0x29206f)=>{this['fire']('addResourceToContext',{'source':_0x587de8,'resource':_0x29206f});},'onLoadSourceResources':_0x1ebc4c=>{this['fire']('loadSourceResources',_0x1ebc4c);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x66fc1f,_0x73535c['bodyCollection'],_0x2289e5);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x3ba28d,_0x3353f2){const _0x34f11e=new Nt(_0x3ba28d);return _0x34f11e['extendTemplate']({'attributes':{'class':_0x3353f2}}),this['bodyCollection']['add'](_0x34f11e),_0x34f11e;}['_setBalloonPanelContent'](_0x21cc32,_0xd5d81b,_0x46f5f0){if(_0x21cc32['content']['clear'](),!_0x46f5f0['document']['isHidden']&&_0x46f5f0['document']['enabled']){const _0x406cba=this['_createBalloonButton'](_0xd5d81b,{'label':ls(_0xd5d81b,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x547315});_0x406cba['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x21cc32['content']['add'](_0x406cba);}if(_0x46f5f0['urls']['enabled']){const _0x24fd1b=this['_createBalloonButton'](_0xd5d81b,{'label':ls(_0xd5d81b,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x56c964});_0x24fd1b['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x21cc32['content']['add'](_0x24fd1b);}if(_0x46f5f0['files']['enabled']){const _0x563845=new Ut(_0xd5d81b);_0x563845['set']({'label':ls(_0xd5d81b,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x21283a,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x563845['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x563845['on']('done',(_0x42cb6d,_0x222934)=>{this['fire']('addFileToContext',_0x222934);}),_0x563845['tooltip']=!0x0,_0x21cc32['content']['add'](_0x563845);}for(const _0x213c52 of _0x46f5f0['sources']){const _0x3490e6=this['_createBalloonButton'](_0xd5d81b,{'label':_0x213c52['label'],'icon':_0x213c52['icon']||_0x28f992,'type':'source'});_0x21cc32['content']['add'](_0x3490e6),_0x3490e6['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x213c52,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x1c5edc of _0x46f5f0['customItems']||[]){const _0x43092d=this['_createBalloonButton'](_0xd5d81b,{'label':_0x1c5edc['label'],'icon':_0x1c5edc['icon']||_0x28f992,'type':'customItem'});_0x21cc32['content']['add'](_0x43092d),_0x43092d['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x1c5edc);});}this['_hasExactlyOneSource']=0x1===_0x21cc32['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x4c34a6,_0x23ebc0){this['_urlInputView']=new io(_0x23ebc0),this['_urlInputView']['on']('submitUrl',(_0x2d7d80,_0x4f6e0a)=>{this['_handleUrlSubmit'](_0x4f6e0a);}),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});}),_0x4c34a6['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x4fc13b,_0x27374b){const _0xd6e11a='source'===_0x27374b['type']?new xo(_0x4fc13b):new Pt(_0x4fc13b);return _0xd6e11a['set']({'label':_0x27374b['label'],'icon':_0x27374b['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0xd6e11a;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x1dec34({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x514b34){const _0x6a2963=this['_addContextBalloonConfig'];_0x6a2963['buttonView']['isOn']=_0x514b34,_0x514b34?_0x6a2963['balloonView']['show']():_0x6a2963['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x157888,buttonView:_0x515896,hideMethod:_0xa04bba}=this['_addContextBalloonConfig'];_0x1dec34({'emitter':_0x157888,'contextElements':[_0x157888['element'],_0x515896['element']],'callback':()=>{_0xa04bba();},'activator':()=>_0x515896['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x21eed6,_0x324827,_0x1e87cf=!0x1,_0x3c6352=!0x1){const _0x52d336='conversation'===_0x324827||!0x0===_0x21eed6['isReadOnly'],_0x49cbd3=new mr(this['locale'],_0x21eed6,_0x52d336,_0x1e87cf,_0x3c6352);return _0x52d336||_0x49cbd3['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x49cbd3['id']);}),_0x49cbd3;}['_addContextToCollection'](_0x347815,_0x304588){_0x304588['add'](_0x347815,0x0);}['_removeContextFromCollection'](_0x1af6c7,_0x2a7a64){const _0x4b30ac=_0x2a7a64['find'](_0x55da68=>_0x55da68['id']===_0x1af6c7);_0x4b30ac&&_0x2a7a64['remove'](_0x4b30ac);}['_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'](_0xe63dc8){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0xe63dc8);}},xo=class extends Pt{['arrowView'];constructor(_0x470145){super(_0x470145),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 _0x3b2f38=new Wt();return _0x3b2f38['content']=_0x119e79,_0x3b2f38['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x3b2f38;}},Lo=class extends _0x294569{['_cancelButtonView'];['_loaderView'];constructor(_0x148ba8){super(_0x148ba8),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 _0x1920de=new Pt(this['locale']);return _0x1920de['set']({'label':ls(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':hn+'\x20ck-ai-button-stop-generating','icon':et}),_0x1920de['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x1920de;}['_createLoaderView'](){const _0x546382=new _0x294569(this['locale']);return _0x546382['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':ls(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x546382;}},Do=class extends _0x294569{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x1a8669,_0x3c9538){super(_0x1a8669),this['_filesEnabled']=_0x3c9538['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x1a8669,{'bodyCollection':_0x3c9538['bodyCollection'],'searchInputVisibleFrom':_0x3c9538['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x1a8669),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x1a8669),this['_loaderView']=this['_createLoaderView'](_0x1a8669),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x1a8669),this['_dropZoneView']=new Fr(_0x1a8669),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 _0x285e20=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x285e20['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x285e20['if']('isLoading','ck-hidden',_0x4d518e=>_0x4d518e||!this['isModelAvailable']),_0x285e20['if']('isModelAvailable','ck-hidden',_0x1f4648=>!_0x1f4648||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x285e20['if']('isLoading','ck-hidden',_0x3be621=>!_0x3be621)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x285e20['if']('isModelAvailable','ck-hidden',_0x5ed0a3=>_0x5ed0a3)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x1dec34({'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'](_0x4e44bc,_0x33f866){return new yo(_0x4e44bc,_0x33f866);}['_createPromptInputView'](_0x1a3a91){return new Gr(_0x1a3a91,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x7d6b46){return new jr(_0x7d6b46);}['_createLoaderView'](_0x33013d){return new Lo(_0x33013d);}['_createModelUnavailableMessageView'](_0x2d09f4){const _0x3ffe5d=new Po(_0x2d09f4);return _0x3ffe5d['delegate']('startConversation')['to'](this),_0x3ffe5d;}['_handlePromptInputFocus'](_0x4c05e4,_0x424fc5,_0x5bba73){_0x5bba73?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x21057a,_0x4a933a){this['_contextPanelView']['addContextItem'](_0x21057a,_0x4a933a);}['removeContextItem'](_0x5ac11f){this['_contextPanelView']['removeContextItem'](_0x5ac11f);}['setContextItemLoading'](_0xef4d6c,_0x15d134){this['_contextPanelView']['setContextItemLoading'](_0xef4d6c,_0x15d134);}['setIsUploadInProgress'](_0xfd40b4){this['_promptInputView']['setIsUploadInProgress'](_0xfd40b4);}['setConversationContext'](_0x209c70){this['_contextPanelView']['setConversationContext'](_0x209c70);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x3a2102,_0x103cad,_0x5895b8){this['_contextPanelView']['updateResourceState'](_0x3a2102,_0x103cad,_0x5895b8);}['setWebSearch'](_0x13ddf4){this['_promptCapabilitiesView']['setWebSearch'](_0x13ddf4);}['setReasoning'](_0x29c0e1){this['_promptCapabilitiesView']['setReasoning'](_0x29c0e1);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x5bbc99){this['_contextPanelView']['setAddContextOptions'](_0x5bbc99);}['setInputPlaceholder'](_0x29e1a9){this['_promptInputView']['setPlaceholderText'](_0x29e1a9);}['setModelList'](_0x1a982d,_0xa2b221){this['_promptCapabilitiesView']['setModelList'](_0x1a982d,_0xa2b221);}['setModel'](_0x298ccf){_0x298ccf?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x298ccf)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x80d2c6){this['_promptCapabilitiesView']['disableModelSelector'](_0x80d2c6);}['populateSourceResourceBalloon'](_0x2367f2,_0x4ab55f,_0x3b1de3,_0x17bcf9){this['_contextPanelView']['populateSourceResourceBalloon'](_0x2367f2,_0x4ab55f,_0x3b1de3,_0x17bcf9);}['closeSourceResourceBalloon'](_0x2475cb){this['_contextPanelView']['closeSourceResourceBalloon'](_0x2475cb);}['focusPromptInput'](_0x664408=!0x1){this['_promptInputView']['focus'](_0x664408);}['setPromptInputValue'](_0x3b1cdf){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x3b1cdf;}},Po=class extends _0x294569{constructor(_0x59d915){super(_0x59d915);const _0x4b8658=new Pt(_0x59d915);_0x4b8658['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x4b8658['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x4b8658]}]});}},Ho=class extends Gt{['resizeButton'];constructor(_0x1ce6fe,_0x2ce0b9){super(_0x1ce6fe,{'label':_0x2ce0b9['label'],'class':'ck-ai-header\x20'+_0x2ce0b9['class'],'icon':_0x2ce0b9['icon']}),this['set']('isMaximized',!0x1),_0x2ce0b9['content']&&this['children']['add'](_0x2ce0b9['content']),_0x2ce0b9['showResizeButton']&&(this['resizeButton']=ln(_0x1ce6fe,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x294569{constructor(_0x16e14a){super(_0x16e14a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':ls(_0x16e14a,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x37cc15,_0xb0e04e){const _0x43c772=new Pt(_0x37cc15);return _0x43c772['set']({'label':ls(_0x37cc15,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3db3c3,'class':'ck-ai-chat__start-conversation\x20'+hn}),_0x43c772['on']('execute',()=>{_0xb0e04e['fire']('startConversation');}),_0x43c772;}var Uo=class extends _0x294569{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0xd81424,_0x345129){super(_0xd81424),this['_bodyCollection']=un(_0xd81424);const _0x1bd2e0=Vo(_0xd81424,this);this['chatHeader']=new Ho(_0xd81424,{'label':ls(_0xd81424,'AI_CHAT_HEADING'),'icon':_0x302265,'class':'ck-ai-header_chat','content':_0x1bd2e0,'showResizeButton':_0x345129['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0xd81424,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0xd81424,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x345129['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x345129['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0xd81424),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0xd81424['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x1f2a40,_0x4a4c57,_0x24fb9c,_0x13d02b){this['chatControls']['populateSourceResourceBalloon'](_0x1f2a40,_0x4a4c57,_0x24fb9c,_0x13d02b);}['closeSourceResourceBalloon'](_0xf43d0){this['chatControls']['closeSourceResourceBalloon'](_0xf43d0);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x59670e{static get['requires'](){return[hs];}['_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(_0x79a634){super(_0x79a634);const _0x2d2fbe=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x2d2fbe['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'](_0x2d2fbe),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x7f508d,{showDiff:_0x16147e})=>{this['showDiff']=_0x16147e;}),this['disableControls'](),_0x2d2fbe['view']['addTab']({'id':'chat','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x302265,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x2d2fbe['view'],'isMaximized',_0x537d53=>_0x537d53),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x2cdbe8=>_0x2cdbe8),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x25f449){const _0xb02e32=this['context']['config']['get']('ai.chat.welcomeMessage')??ls(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x25f449['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0xb02e32}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x29053e,staticMessage:_0x3e46a0}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x29053e,'initialContent':'<p>'+_0x3e46a0+'</p>'});});}async['addFeedItemUserMessage'](_0xfb7025){const _0x1a9f1b=_0xfb7025['attributes']?.['displayedPrompt']||_0xfb7025['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xfb7025['contextItems']['values']()),'initialContent':'<p>'+_0x1a9f1b+'</p>','id':_0xfb7025['id']});});}async['addFeedItemError']({errorMessage:_0x2e3cb4,id:_0x451854}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x2e3cb4+'</p>','id':_0x451854});});}async['addFeedItemAIReply'](_0x50cbc0){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x50cbc0['interactionId']+':'+_0x50cbc0['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x3122cd){const _0x1e63d9=us(this['context']),_0x1050ec=_0x1e63d9['map'](_0x5b608c=>_0x5b608c['config']['get']('ai.availableReplyActions')||[...er]);let _0x51dcb3=_0x1050ec['reduce']((_0x2bee6a,_0x41a5ac)=>_0x2bee6a['filter'](_0x332421=>_0x41a5ac['includes'](_0x332421)),_0x1050ec[0x0]||[...er]);const _0x3b5fc=_0x1e63d9['every'](_0x5d142c=>_0x5d142c['plugins']['has']('TrackChanges')),_0x431790=_0x1e63d9['map'](_0x1241f2=>_0x1241f2['commands']['get']('trackChanges'));return _0x3b5fc?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x431790,'value',(..._0x291a65)=>_0x291a65['some'](_0x5817dd=>_0x5817dd))):_0x51dcb3=_0x51dcb3['filter'](_0x4a68cb=>'insertSuggestion'!=_0x4a68cb),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x3122cd['interactionId']+':'+_0x3122cd['id'],'areActionsDisabled':_0x3122cd['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x51dcb3}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x3c5c19,_0x59db97){return this['_promiseQueue']['enqueue'](async()=>{const _0x58a2c2=this['_view']['chatFeed']['children']['last'];if(_0x58a2c2 instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x58a2c2),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x3c5c19['id'],'capabilities':{'isWebSearchEnabled':_0x58a2c2['capabilities']['isWebSearchEnabled']||_0x59db97['isWebSearchEnabled'],'isReasoningEnabled':_0x58a2c2['capabilities']['isReasoningEnabled']||_0x59db97['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x3c5c19['id'],'capabilities':_0x59db97});});}async['addFeedItemCustomElement'](_0xaea1a6,_0x17c75e){let _0x383833;return await this['_promiseQueue']['enqueue'](async()=>{_0x383833=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0xaea1a6,'id':_0x17c75e});}),_0x383833;}['removeFeedItem'](_0x309462){this['_view']['chatFeed']['removeItem'](_0x309462);}['hasFeedItem'](_0x47a682){return this['_view']['chatFeed']['hasItem'](_0x47a682);}['updateFeedInteractionHeader'](_0x47ba74){const _0x77dc5a=this['_view']['chatFeed']['children']['find'](_0x873c9c=>_0x873c9c['options']['id']==_0x47ba74['id']&&_0x873c9c instanceof yr);_0x77dc5a&&_0x77dc5a['set']('isVisible',_0x47ba74['isVisible']);}async['updateFeedItemAIReplyContent'](_0x4daf64){const _0x276637=_0x4daf64['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x254def=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x4daf64,'abortSignal':_0x254def,'renderingStrategy':_0x276637}),_0x4daf64['isDone']&&this['markFeedItemAsDone'](_0x4daf64['id']);});}['updateFeedItemAIReplySources'](_0x1926f6,_0x56f42a){this['_view']['chatFeed']['updateWebSources'](_0x1926f6,_0x56f42a);}async['updateFeedItemAIReplySuggestionContent'](_0x31f465){return this['_promiseQueue']['enqueue'](async _0x3709fc=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x31f465,'abortSignal':_0x3709fc}),_0x31f465['isDone']&&this['markFeedItemAsDone'](_0x31f465['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x22bfbf){this['_view']['chatFeed']['updateSuggestionPartState'](_0x22bfbf);}['setFeedItemAIReplySuggestionPartActive'](_0x153433){this['_view']['chatFeed']['setSuggestionPartActive'](_0x153433);}['markFeedItemAsDone'](_0x4bec7f){this['_view']['chatFeed']['markItemAsDone'](_0x4bec7f);}['removeFeedInteraction'](_0x19603a){this['_view']['chatFeed']['getItemIds']()['filter'](_0x5d50c0=>_0x5d50c0['startsWith'](_0x19603a))['forEach'](_0x1b6414=>this['_view']['chatFeed']['removeItem'](_0x1b6414));}['startInteraction'](){const _0x3a3bf3=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x3a3bf3),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x30cb04){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x1c40c4=>_0x1c40c4['startsWith'](_0x30cb04['id']))['forEach'](_0xae4040=>this['markFeedItemAsDone'](_0xae4040)),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'](_0xb757bd,_0xf95f){this['_view']['chatControls']['addContextItem'](_0xb757bd,_0xf95f);}['removeContextItem'](_0x55c84d){this['_view']['chatControls']['removeContextItem'](_0x55c84d);}['setContextItemLoading'](_0x34d1d1,_0x10924a){this['_view']['chatControls']['setContextItemLoading'](_0x34d1d1,_0x10924a);}['setIsUploadInProgress'](_0x4a8b14){this['_view']['chatControls']['setIsUploadInProgress'](_0x4a8b14);}['setConversationContext'](_0x162a82){this['_view']['chatControls']['setConversationContext'](_0x162a82);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x53b8e8,_0x36c90d,_0x21efd4){this['_view']['chatControls']['updateResourceState'](_0x53b8e8,_0x36c90d,_0x21efd4);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x322ade){this['_view']['chatControls']['setAddContextOptions'](_0x322ade);}['updateCapabilities'](_0x1fac89){this['_view']['chatControls']['setWebSearch'](_0x1fac89['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x1fac89['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x1fac89));}['setSelectedModel'](_0x1fd3c8,_0x5393b5){this['_view']['chatControls']['setModel'](_0x1fd3c8),_0x5393b5&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x566309){this['feedItemRenderingStrategy']=_0x566309;}['toggleLoadingSkeleton'](_0xf36b62){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0xf36b62);}['resetConversationTitle'](){this['setConversationTitle'](ls(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x5c1e38,_0xcd4f09=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0xcd4f09&&!It()&&_0x5c1e38['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x5c1e38);this['_view']['chatHeader']['label']=_0x5c1e38;}['setLoadingMessage'](_0x49da48){this['_view']['chatFeed']['setLoadingMessage'](_0x49da48);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x260267){let _0x4b40bc=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x260267[_0x4b40bc],_0x4b40bc++,_0x4b40bc===_0x260267['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3a772f){return _0x3a772f['isWebSearchEnabled']&&_0x3a772f['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3a772f['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3a772f['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x923adc){return _0x923adc?_0x923adc['isWebSearchEnabled']&&_0x923adc['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x923adc['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x923adc['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x246677,_0x580b27,_0x39497b,_0x7efe58){this['_view']['populateSourceResourceBalloon'](_0x246677,_0x580b27,_0x39497b,_0x7efe58);}['closeSourceResourceBalloon'](_0x4efed4){this['_view']['closeSourceResourceBalloon'](_0x4efed4);}['setPromptInputValue'](_0x10672a){this['_view']['chatControls']['setPromptInputValue'](_0x10672a);}['focusPromptInput'](_0x50ad67=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x50ad67);}['scrollFeedToSuggestion'](_0x38364f,_0x2f9c09){this['_view']['chatFeed']['scrollToSuggestion'](_0x38364f,_0x2f9c09);}['startAutoScroll'](_0x4d5858={}){this['_view']['chatFeed']['startAutoScroll'](_0x4d5858);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends zt{['sections'];constructor(_0x4193f8,_0x3c678f){super(_0x4193f8),this['sections']=_0x3c678f,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x77128a){let _0x196c31=0x0,_0x511291=0x0;for(const _0x1f3556 of this['sections']){const {resultsCount:_0x4e5617,totalItemsCount:_0x2d8352}=_0x1f3556['filter'](_0x77128a);_0x196c31+=_0x4e5617,_0x511291+=_0x2d8352;}return{'resultsCount':_0x196c31,'totalItemsCount':_0x511291};}},Fo=class extends Xt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x4ff0b5,{title:_0x5481c7,items:_0x3165cf}){super(_0x4ff0b5);const _0x33799b=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5481c7,this['itemsViews']=_0x3165cf;const _0x5154b1=new _0x294569(_0x4ff0b5);_0x5154b1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new zt(_0x4ff0b5),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x33799b['if']('isVisible','ck-hidden',_0x55d59f=>!_0x55d59f)]},'children':[_0x5154b1,this['_itemsListView']]});}['filter'](_0x490736){const _0x25c3dc=this['itemsViews']['length'];let _0x26352f=0x0;for(const _0x3dd6f9 of this['itemsViews'])_0x490736?(_0x3dd6f9['isVisible']=!!_0x3dd6f9['isMatching'](_0x490736),_0x3dd6f9['highlightText'](_0x490736)):(_0x3dd6f9['isVisible']=!0x0,_0x3dd6f9['highlightText'](null)),_0x3dd6f9['isVisible']&&_0x26352f++;return this['isVisible']=_0x26352f>0x0,{'resultsCount':_0x26352f,'totalItemsCount':_0x25c3dc};}['getItem'](_0x323603){return this['itemsViews']['find'](_0x33c93c=>_0x33c93c['id']===_0x323603);}['removeItem'](_0x22a12a){const _0x3cbc98=this['itemsViews']['indexOf'](_0x22a12a);-0x1!==_0x3cbc98&&(this['itemsViews']['splice'](_0x3cbc98,0x1),this['_itemsListView']['items']['remove'](_0x22a12a));}};const Ko=/* #__PURE__ -- @preserve */
34
+ _0x4c7492(Xt);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(_0x49c1e5,_0x283c1a){super(_0x49c1e5);const _0x3f8cd4=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x283c1a['pinned']),this['set']('loadingState',null),this['set']('title',_0x283c1a['title']),this['id']=_0x283c1a['id'];const {createdAt:_0x4ef66f,active:_0x228e2b=!0x1}=_0x283c1a;this['_titleView']=new Kt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x101bd3=this['_createCheckView'](),_0x41b11e=this['_createPinButtonView'](_0x49c1e5),_0x5abafb=this['_createMenuDropdownView'](),_0x334b80=this['_createEditInputView'](_0x49c1e5),_0x2016c3=this['_createAcceptEditButtonView'](_0x49c1e5,_0x334b80),_0x402e39=this['_createCancelEditButtonView'](_0x49c1e5);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x41b11e),this['actions']['add'](_0x5abafb),this['on']('change:isEdit',(_0x2b3347,_0x1ac968,_0x28f4e1)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x28f4e1?(this['actions']['add'](_0x2016c3),this['actions']['add'](_0x402e39),this['mainContent']['add'](_0x334b80),_0x334b80['element']['value']=this['title']||'',_0x334b80['element']['focus']()):(this['actions']['add'](_0x41b11e),this['actions']['add'](_0x5abafb),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x228e2b?'ck-ai-chat-history__item--active':'',_0x3f8cd4['if']('isVisible','ck-hidden',_0x54b92d=>!_0x54b92d),_0x3f8cd4['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',_0x3f8cd4['if']('loadingState','ck-hidden',_0x16f080=>!!_0x16f080)]},'children':_0x228e2b?[_0x101bd3]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x3f8cd4['if']('loadingState','ck-hidden',_0x15a02a=>!_0x15a02a)]},'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',_0x3f8cd4['if']('loadingState','ck-hidden',_0x5b2e96=>!!_0x5b2e96)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x3f8cd4['if']('loadingState','ck-hidden',_0x4eb98f=>!_0x4eb98f)]},'children':[{'text':_0x3f8cd4['to']('loadingState',_0x304325=>_0x304325?ls(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x304325]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4ef66f]}]},{'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'](_0x132ec6){this['set']('title',_0x132ec6);}['updateLoadingState'](_0x4f11b6,_0x4691eb){this['set']('loadingState',_0x4691eb?_0x4f11b6:null);}['_createCheckView'](){const _0xf8ccb9=new Wt();return _0xf8ccb9['set']({'content':_0xdd186f}),_0xf8ccb9;}['_createPinButtonView'](_0x442348){const _0x14be73=new Pt(_0x442348);return _0x14be73['set']({'label':ls(_0x442348,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x411df4,'withText':!0x1,'tooltip':!0x0}),_0x14be73['bind']('isOn')['to'](this,'pinned'),_0x14be73['on']('execute',()=>{const _0x6b05cf=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x6b05cf});}),_0x14be73;}['_createMenuDropdownView'](){const _0x136b49=_0x3a7b01(this['locale']),_0x19e5d0=_0x136b49['panelView']['children'];_0x136b49['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':st}),_0x136b49['panelPosition']='sw';const _0x14e51f=new Pt(this['locale']);_0x14e51f['label']=ls(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x14e51f['withText']=!0x0,_0x14e51f['on']('execute',()=>{this['isEdit']=!0x0;});const _0x1da791=new Pt(this['locale']);_0x1da791['label']=ls(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x1da791['withText']=!0x0,_0x1da791['on']('execute',()=>{this['showConfirm'](ls(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x3531b6=new zt(this['locale']),_0x30b5bc=new Xt(this['locale']);_0x30b5bc['children']['add'](_0x14e51f);const _0x51856c=new Xt(this['locale']);return _0x51856c['children']['add'](_0x1da791),_0x3531b6['items']['addMany']([_0x30b5bc,_0x51856c]),_0x19e5d0['add'](_0x3531b6),_0x136b49;}['_createEditInputView'](_0x43eb12){const _0x4b99b4=new Yt(_0x43eb12),_0x325036=_0x4b99b4['bindTemplate'];return _0x4b99b4['extendTemplate']({'on':{'keydown':_0x325036['to'](_0x307a02=>{'Enter'==_0x307a02['key']&&this['_commitEditInputValue'](_0x4b99b4);})}}),_0x4b99b4;}['_createAcceptEditButtonView'](_0x45844b,_0x253519){const _0xc479a0=new Pt(_0x45844b);return _0xc479a0['set']({'icon':_0xdd186f,'withText':!0x1,'tooltip':ls(_0x45844b,'AI_CHAT_HISTORY_ACCEPT')}),_0xc479a0['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0xc479a0['on']('execute',()=>{this['_commitEditInputValue'](_0x253519);}),_0xc479a0;}['_commitEditInputValue'](_0x58dcbc){const _0x4fced6=_0x58dcbc['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x4fced6});}['_createCancelEditButtonView'](_0x4010a0){const _0xfd94c6=new Pt(_0x4010a0);return _0xfd94c6['set']({'icon':_0x1a57f6,'withText':!0x1,'tooltip':ls(_0x4010a0,'AI_CHAT_HISTORY_CANCEL')}),_0xfd94c6['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0xfd94c6['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0xfd94c6;}['_createSpinnerView'](){const _0x26cc39=new cr('tiny');return _0x26cc39['isVisible']=!0x0,_0x26cc39;}['isMatching'](_0x5f14d9){return'string'==typeof this['title']&&this['title']['match'](_0x5f14d9)?{'title':!0x0}:null;}['highlightText'](_0x8a50cb){this['_titleView']['highlightText'](_0x8a50cb);}},Yo=class extends _0x294569{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x55a400,_0x3fc44c){super(_0x55a400),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x28e329=Vo(_0x55a400,this);this['headerView']=new Ho(_0x55a400,{'label':ls(_0x55a400,'AI_CHAT_HISTORY_HEADING'),'icon':_0x39f555,'class':'ck-ai-header_history','content':_0x28e329,'showResizeButton':_0x3fc44c}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x55a400,[]),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',_0x115c74=>!_0x115c74)]}}),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 _0x8af9b0=new _0x4cebc3(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x202e22=>ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x202e22),'secondary':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1f6e04=this['_createErrorView']();return _0x1f6e04['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x4a7b99=>!_0x4a7b99)]}}),_0x8af9b0['on']('render',()=>{_0x8af9b0['children']['add'](_0x1f6e04,0x1);}),_0x8af9b0['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x56493a=>!_0x56493a)]}}),_0x8af9b0;}['_createSkeletonView'](){const _0x152194=new Xn(this['locale'],zn['aiHistory']);return _0x152194['bind']('isVisible')['to'](this,'isLoading'),_0x152194;}['_createErrorView'](){const _0x1bd553=new _0x294569(this['locale']),_0x5c61c6=new Pt(this['locale']);_0x5c61c6['set']({'withText':!0x1,'icon':_0x1a57f6,'class':'ck-ai-notification_error__dismiss-button'}),_0x5c61c6['bind']('isVisible')['to'](this,'hasItems',_0x2324be=>!!_0x2324be),_0x5c61c6['on']('execute',()=>{this['errorMessage']='';});const _0x331100=this['bindTemplate'];return _0x1bd553['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x331100['to']('errorMessage')}]},_0x5c61c6]}),_0x1bd553;}['_createEmptyStateView'](){const _0x3a1004=new _0x294569(this['locale']);return _0x3a1004['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x193421=>!_0x193421)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[ls(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x3a1004;}['_createListItemViews'](_0x2bac5d,_0x37c4a3){const _0x3d4de0=[];for(const _0x523093 of _0x2bac5d){const _0x278a3a=new Wo(_0x37c4a3,_0x523093);_0x278a3a['delegate'](...$o)['to'](this),_0x3d4de0['push'](_0x278a3a);}return _0x3d4de0;}['updateHistoryItemsWithCategories'](_0x43d7c9){const _0x32871a=this['locale']||'en',_0x2d27f4=[];for(const _0x2b3358 of _0x43d7c9){const _0x3b7801=this['_createListItemViews'](_0x2b3358['items'],_0x32871a);_0x2d27f4['push'](new Fo(_0x32871a,{'title':_0x2b3358['title'],'items':_0x3b7801}));}this['sectionsView']['sections']=_0x2d27f4,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x2d27f4),this['hasItems']=_0x43d7c9['some'](_0x3592de=>_0x3592de['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x2e3f30){for(const _0x2ff869 of this['sectionsView']['sections']){const _0x422daf=_0x2ff869['getItem'](_0x2e3f30);if(_0x422daf){if(_0x2ff869['removeItem'](_0x422daf),0x0===_0x2ff869['itemsViews']['length']){const _0x476376=this['sectionsView']['sections']['indexOf'](_0x2ff869);-0x1!==_0x476376&&(this['sectionsView']['sections']['splice'](_0x476376,0x1),this['sectionsView']['items']['remove'](_0x2ff869));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x50af42,_0x221de3){for(const _0x3ee9b2 of this['sectionsView']['sections']){const _0x41c1f5=_0x3ee9b2['getItem'](_0x50af42);if(_0x41c1f5){_0x41c1f5['updateTitle'](_0x221de3);break;}}}['updateItemLoadingState'](_0x1b9ad3,_0xd2f7dc,_0x5bb159){for(const _0x1d2eba of this['sectionsView']['sections']){const _0x30fe0d=_0x1d2eba['getItem'](_0x1b9ad3);if(_0x30fe0d){_0x30fe0d['updateLoadingState'](_0xd2f7dc,_0x5bb159);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x576f7c=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x576f7c);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x59670e{static get['requires'](){return[hs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x54c5b4){super(_0x54c5b4);const _0x20996c=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x20996c['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x20996c),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x20996c['view'],'isMaximized',_0x2b5c58=>_0x2b5c58),_0x20996c['view']['addTab']({'id':'history','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x39f555,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x1c0342){this['_historyView']['removeHistoryItem'](_0x1c0342);}['updateItems'](_0x473120){this['_historyView']['updateHistoryItemsWithCategories'](_0x473120);}['updateItemTitle'](_0x349c77,_0xff650b){this['_historyView']['updateItemTitle'](_0x349c77,_0xff650b);}['updateItemLoadingState'](_0x422644,_0xa74c6e,_0x4f7775){this['_historyView']['updateItemLoadingState'](_0x422644,_0xa74c6e,_0x4f7775);}['setLoadingSkeleton'](_0x52c146){this['_historyView']['isLoading']=_0x52c146;}['showError'](_0x2a9513){this['_historyView']['errorMessage']=_0x2a9513;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
+ _t();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x463afd,title:_0x655cde,createdAt:_0x4dcee4,updatedAt:_0x37b7e3,pinned:_0x835ecc}){super(),this['id']=_0x463afd,this['createdAt']=new Date(_0x4dcee4),this['set']('title',_0x655cde),this['set']('updatedAt',_0x37b7e3?new Date(_0x37b7e3):null),this['set']('pinned',_0x835ecc||!0x1);}['updateTitle'](_0x168f33){this['set']('title',_0x168f33),this['updatedAt']=new Date();}['updatePinned'](_0x76069f){this['set']('pinned',_0x76069f),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
+ lt();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x10ebbd,group:_0x3d3f17}){super(),this['connector']=_0x10ebbd,this['group']=_0x3d3f17;}async['init'](){try{const _0x291aa6=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x291aa6);}catch(_0x4b0415){this['fire']('error',{'error':_0x4b0415,'operation':'init'});}}['addItem'](_0x3e9ac3){this['items']['push'](_0x3e9ac3);}async['removeItem'](_0x125b2c){const _0x5c4674=this['items']['findIndex'](_0x424fad=>_0x424fad['id']===_0x125b2c);if(-0x1===_0x5c4674)return!0x1;try{return await this['connector']['deleteConversation'](_0x125b2c)['execute'](),this['items']['splice'](_0x5c4674,0x1),this['fire']('itemRemoved',{'itemId':_0x125b2c}),!0x0;}catch(_0x2c88f4){return this['fire']('error',{'error':_0x2c88f4,'operation':'removeItem','itemId':_0x125b2c}),!0x1;}}['getItem'](_0x32cdee){return this['items']['find'](_0x29c0f5=>_0x29c0f5['id']===_0x32cdee);}async['updateItemTitle'](_0x2133e5,_0x5f2c47){const _0xd82f0a=this['getItem'](_0x2133e5);if(!_0xd82f0a)return!0x1;try{return await this['connector']['updateConversation'](_0x2133e5,{'title':_0x5f2c47})['getResult'](),_0xd82f0a['updateTitle'](_0x5f2c47),this['fire']('itemUpdated',{'itemId':_0x2133e5,'updates':{'title':_0x5f2c47}}),!0x0;}catch(_0x20a236){return this['fire']('error',{'error':_0x20a236,'operation':'updateItemTitle','itemId':_0x2133e5}),!0x1;}}async['updateItemPinned'](_0x47091c,_0x7e9066){const _0x11ddf2=this['getItem'](_0x47091c);if(!_0x11ddf2)return!0x1;try{return await this['connector']['updateConversation'](_0x47091c,{'pinned':_0x7e9066})['getResult'](),_0x11ddf2['updatePinned'](_0x7e9066),this['fire']('itemUpdated',{'itemId':_0x47091c,'updates':{'pinned':_0x7e9066}}),!0x0;}catch(_0x58c72b){return this['fire']('error',{'error':_0x58c72b,'operation':'updateItemPinned','itemId':_0x47091c}),!0x1;}}['loadItems'](_0x24c673){try{this['items']=[],_0x24c673['map'](_0x26ddc0=>{this['addItem'](new Xo(_0x26ddc0));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x3e8d0d){this['fire']('error',{'error':_0x3e8d0d,'operation':'loadItems'});}}['getItems'](_0x38f4a0={}){const _0x441818=void 0x0!==_0x38f4a0['pinned']&&_0x38f4a0['pinned'],_0x1b0e53=_0x38f4a0['from']?new Date(_0x38f4a0['from']['getFullYear'](),_0x38f4a0['from']['getMonth'](),_0x38f4a0['from']['getDate']()):null,_0x4445a2=_0x38f4a0['to']?new Date(_0x38f4a0['to']['getFullYear'](),_0x38f4a0['to']['getMonth'](),_0x38f4a0['to']['getDate']()):null;return this['items']['filter'](_0x40baca=>{if(_0x40baca['pinned']!==_0x441818)return!0x1;if(_0x4445a2){const _0x4f7437=new Date(_0x40baca['createdAt']['getFullYear'](),_0x40baca['createdAt']['getMonth'](),_0x40baca['createdAt']['getDate']());return _0x1b0e53?_0x1b0e53['getTime']()===_0x4445a2['getTime']()?_0x4f7437['getTime']()===_0x1b0e53['getTime']():_0x4f7437<_0x4445a2&&_0x4f7437>=_0x1b0e53:_0x4f7437<_0x4445a2;}return!0x0;});}},Jo=class extends _0x59670e{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[cs,rn,kn,qo,hs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](cs),this['_aiChatHistoryUi']=this['context']['plugins']['get'](qo),this['_aiChatController']=this['context']['plugins']['get'](kn),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aichathistory');const _0x1ac809=this['context']['plugins']['get'](hs);try{const _0x5fb4e9=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x5fb4e9}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x1f11b7,_0x6c9cf0)=>{this['_setItemLoading'](_0x6c9cf0['id'],'remove'),this['_handleRemove'](_0x6c9cf0['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x4542d5,_0x3e3571)=>{this['_setItemLoading'](_0x3e3571['id'],'rename'),this['_handleEditTitle'](_0x3e3571['id'],_0x3e3571['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0xc93950,_0x262140)=>{void 0x0!==_0x262140['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x262140['itemId'],_0x262140['updates']['title']),void 0x0!==_0x262140['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x262140['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x51f25a,_0x1d30e0)=>{this['_aiChatController']['_handleRemovedConversation'](_0x1d30e0['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x1d30e0['itemId']),this['_clearItemLoading'](_0x1d30e0['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x14027d,_0x131bee)=>{this['_handleHistoryErrorUI'](_0x131bee['error'],_0x131bee['operation'],_0x131bee['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x9c557,_0x2e5fbc)=>{this['_handleSelectConversation'](_0x2e5fbc['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x3d262a,_0x24a801)=>{const _0x2b19b8=_0x24a801['pinned']?'pin':'unpin';this['_setItemLoading'](_0x24a801['id'],_0x2b19b8),this['_handleTogglePin'](_0x24a801['id'],_0x24a801['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x1ac809['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x1ac809['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x5ce1ad){this['_handleHistoryErrorUI'](_0x5ce1ad,'init');}}async['_handleEditTitle'](_0x130acc,_0x581c6c){await this['history']['updateItemTitle'](_0x130acc,_0x581c6c);}async['_handleTogglePin'](_0x1abc64,_0x6cf800){await this['history']['updateItemPinned'](_0x1abc64,_0x6cf800);}async['_handleRemove'](_0x25071b){await this['history']['removeItem'](_0x25071b);}async['_handleSelectConversation'](_0x829e97){await this['_aiChatController']['loadConversation'](_0x829e97);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x2065ae=this['_aiChatController']['activeConversation']?.['id'],_0xd29006=this['_getCategorizedItems']()['map'](_0x459666=>({'title':_0x459666['title'],'items':_0x459666['items']['map'](_0x4a4bb1=>({'id':_0x4a4bb1['id'],'title':_0x4a4bb1['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x4a4bb1['createdAt'])['toLocaleDateString'](),'active':_0x4a4bb1['id']===_0x2065ae,'pinned':_0x4a4bb1['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0xd29006);}['_setItemLoading'](_0x1b64fa,_0x519e41){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1b64fa,_0x519e41,!0x0);}['_clearItemLoading'](_0x43bc36){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x43bc36,null,!0x1);}['_handleHistoryErrorUI'](_0x1f1187,_0x5cbd0b,_0x26981b){const _0x23c8cc=this['_generateErrorMessage'](_0x5cbd0b,_0x26981b);this['_aiChatHistoryUi']['showError'](_0x23c8cc),this['_reporter']['reportError'](_0x1f1187,{'context':{'operation':_0x5cbd0b}}),_0x26981b&&this['_clearItemLoading'](_0x26981b),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x5c9903,_0x55d429){const _0x2269e2=_0x55d429?this['history']['getItem'](_0x55d429):null,_0x5e485d=_0x2269e2?.['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x5c9903){case'updateItemTitle':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x5e485d);case'updateItemPinned':{const _0x244bd3=ls(this['context']['locale'],_0x2269e2?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x244bd3,_0x5e485d]);}case'removeItem':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x5e485d);case'init':case'loadItems':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x454394=new Date(),_0x2900f6=new Date(_0x454394['getFullYear'](),_0x454394['getMonth'](),_0x454394['getDate']()),_0x4a3798=new Date(_0x2900f6);_0x4a3798['setDate'](_0x4a3798['getDate']()-0x1);const _0x143baf=new Date(_0x2900f6);_0x143baf['setDate'](_0x143baf['getDate']()-0xe);const _0x5d474c=this['history']['getItems']({'pinned':!0x0}),_0x3a4429=this['history']['getItems']({'from':_0x2900f6,'to':_0x2900f6}),_0x41cc97=this['history']['getItems']({'from':_0x4a3798,'to':_0x4a3798}),_0xf72e9=this['history']['getItems']({'from':_0x143baf,'to':_0x4a3798}),_0x1fd640=this['history']['getItems']({'to':_0x143baf}),_0x19a8fd=[];return _0x5d474c['length']>0x0&&_0x19a8fd['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x5d474c}),_0x3a4429['length']>0x0&&_0x19a8fd['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x3a4429}),_0x41cc97['length']>0x0&&_0x19a8fd['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x41cc97}),_0xf72e9['length']>0x0&&_0x19a8fd['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0xf72e9}),_0x1fd640['length']>0x0&&_0x19a8fd['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x1fd640}),_0x19a8fd;}},Zo=class extends _0x59670e{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x59670e{static get['requires'](){return[kn,As,Bo,Zo,en];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x515665){super(_0x515665),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 Pt{['id'];constructor(_0x11092a,_0x4fb652){super(_0x11092a);const {id:_0x43a08f,type:_0x21aceb,icon:_0x3c06eb}=_0x4fb652;this['id']=_0x43a08f,this['set']({'label':_0x4fb652['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x4fb652['id']}}),_0x3c06eb?this['icon']=_0x3c06eb:'chat'===_0x21aceb?this['icon']=_0x302265:'review'===_0x21aceb?this['icon']=_0x8bcc78:'translate'===_0x21aceb&&(this['icon']=_0x4b87f0);}},ia=class extends _0x294569{['listView'];constructor(_0x350c4c,_0x42acaf){super(_0x350c4c),this['set']('isEnabled',!0x0);const _0x44fa0b=_0x42acaf['map'](_0x148c1c=>{const _0x52dcae=new Xt(this['locale']),_0x61662f=new ea(this['locale'],_0x148c1c);return _0x61662f['bind']('isEnabled')['to'](this),_0x52dcae['children']['add'](_0x61662f),_0x61662f['delegate']('execute')['to'](this),_0x52dcae;});this['listView']=new zt(this['locale']),this['listView']['items']['addMany'](_0x44fa0b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x59670e{['_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 _0x89c108=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0xf9c883=_0x89c108['activeConversation'];_0xf9c883['isFromHistory']||this['_injectShortcuts'](_0xf9c883);}),this['listenTo'](_0x89c108,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x3a4b93=['chat','review','translate'];this['_shortcuts']['forEach'](_0x468bd6=>{let _0x24af5d=!0x0;if(_0x468bd6['id']&&_0x468bd6['label']&&_0x3a4b93['includes'](_0x468bd6['type'])?'chat'===_0x468bd6['type']&&(_0x24af5d='string'==typeof _0x468bd6['prompt']):_0x24af5d=!0x1,!_0x24af5d)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x468bd6});});}['_injectShortcuts'](_0x4f7100){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',_0x1e2c30=>{const _0x68c097=_0x1e2c30['source']['id'];this['_executeShortcut'](_0x68c097);}),this['_listenedConversation']=_0x4f7100,this['listenTo'](_0x4f7100,'uploadProgressChanged',(_0x11392c,_0xe33927)=>{this['_shortcutsView']['isEnabled']=!_0xe33927['isUploadInProgress'];});}['_removeShortcuts'](){const _0x5e9d72=this['context']['plugins']['get'](Bo);_0x5e9d72['hasFeedItem'](sa)&&_0x5e9d72['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0xfb0eb4){const _0x191f7c=this['_shortcuts']['find'](_0x2d0dae=>_0x2d0dae['id']===_0xfb0eb4),_0x2ffdcb=_0x191f7c['type'];'chat'===_0x2ffdcb?this['_runChatShortcut'](_0x191f7c):'review'===_0x2ffdcb?_0x191f7c['commandId']?this['_runReviewShortcut'](_0x191f7c):this['_switchTab']('reviewMode'):'translate'===_0x2ffdcb&&(_0x191f7c['language']?this['_runTranslateShortcut'](_0x191f7c):this['_switchTab']('translate'));}['_switchTab'](_0x3d33dc){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x3d33dc});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x3d33dc);}async['_runChatShortcut']({prompt:_0xdf11df,draftMode:_0x215f00,useWebSearch:_0x32ef37=!0x1,useReasoning:_0x40d105=!0x1,model:_0x3ed105}){const _0x4c5a1b=this['context']['plugins']['get']('AIChatController'),_0x3a1281=_0x4c5a1b['activeConversation'];let _0x13b84d;_0x13b84d=_0x3ed105?await _0x3a1281['chatModels']['getModel'](_0x3ed105):await _0x3a1281['chatModels']['getDefault'](),_0x13b84d&&await _0x3a1281['setModel'](_0x13b84d),_0x3a1281['setWebSearch'](_0x32ef37),_0x3a1281['setReasoning'](_0x40d105),_0x4c5a1b['addCurrentDocumentToChatContext'](),_0x215f00?(this['_aiChatUI']['setPromptInputValue'](_0xdf11df),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x4c5a1b['sendMessage']({'message':_0xdf11df});}['_runReviewShortcut']({commandId:_0x39b043,model:_0x44ff1b,prompt:_0x4b05ed,params:_0x596639}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x303e7e={'id':_0x39b043,'isCustom':'custom'===_0x39b043};_0x44ff1b&&_0x4b05ed&&(_0x303e7e['args']={'model':_0x44ff1b,'prompt':_0x4b05ed}),_0x596639&&(_0x303e7e['params']=_0x596639),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x303e7e);}['_runTranslateShortcut']({language:_0x5f0071}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x5f0071,'args':{'language':_0x5f0071}});}},ra=class extends _0x89658f{constructor(_0x5bec04){super(_0x5bec04);const _0x2c570a=_0x5bec04['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x2c570a,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x5eaf74=this['editor']['plugins']['get']('AITabs')['view'];_0x5eaf74['isVisible']=!_0x5eaf74['isVisible'];}},oa=class extends _0x429cfd{static get['requires'](){return[hs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xaa39ad=this['editor'];_0xaa39ad['commands']['add']('toggleAi',new ra(_0xaa39ad)),_0xaa39ad['ui']['componentFactory']['add']('toggleAi',()=>{const _0x8bf90d=this['_createAIUIButton'](Pt);return _0x8bf90d['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x8bf90d;}),_0xaa39ad['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x3fecc1=this['_createAIUIButton'](jt);return _0x3fecc1['set']({'role':'menuitemcheckbox'}),_0x3fecc1;});}['_createAIUIButton'](_0x4f17d9){const _0x14b1a5=this['editor'],_0x53b460=_0x14b1a5['commands']['get']('toggleAi'),_0x7c4099=new _0x4f17d9(_0x14b1a5['locale']);return _0x7c4099['set']({'label':ls(_0x14b1a5['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x50283e,'isToggleable':!0x0}),_0x7c4099['bind']('isEnabled')['to'](_0x53b460),_0x7c4099['bind']('isOn')['to'](_0x53b460,'value',_0x52f900=>!!_0x52f900),this['listenTo'](_0x7c4099,'execute',()=>{_0x53b460['execute']();}),_0x7c4099;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x294569{['_errorView'];constructor(_0xab214){super(_0xab214),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x2daf52){this['showError'](_0x2daf52);}['showError'](_0x201807){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x201807,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x4e183a=new _0x294569(this['locale']),_0x33c83c=new _0x294569(this['locale']);return _0x33c83c['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x4e183a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2bc33e=>!_0x2bc33e)]},'children':[_0x33c83c]}),_0x4e183a;}};const ca=0xa;var la=class extends _0x59670e{static get['requires'](){return[As];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x475a50){const {id:_0x467384}=this['_currentConfig']??{};this['_currentConfig']=_0x475a50,this['_editor']=_0x475a50['targetEditor'];const {id:_0x25720a}=this['_currentConfig'];this['isOpen']&&_0x467384===_0x25720a?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x31b9df=this['_editor'];if(!_0x31b9df)return;const _0x3733d8=_0x31b9df['plugins']['get']('Dialog');_0x3733d8['isOpen']&&this['_currentConfig']&&_0x3733d8['id']===this['_currentConfig']['id']&&_0x3733d8['hide']();}['_updateDialog'](){const _0x4c6552=this['_editor']['plugins']['get']('Dialog'),{icon:_0x2a9775,title:_0x12d2ce}=this['_currentConfig'];_0x4c6552['view']?.['headerView']&&(_0x4c6552['view']['headerView']['label']=_0x12d2ce,_0x4c6552['view']['headerView']['iconView']&&_0x2a9775&&(_0x4c6552['view']['headerView']['iconView']['content']=_0x2a9775)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x4c6552['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](As)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](As)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x140251=this['_editor']['plugins']['get']('Dialog'),{id:_0x49c6ae,title:_0x9ba298,icon:_0x586409,class:_0x3601b3,mainView:_0x3cd8c8}=this['_currentConfig'];_0x3cd8c8['delegate'](...aa)['to'](this),_0x140251['show']({'title':_0x9ba298,'icon':_0x586409,'hasCloseButton':!0x0,'id':_0x49c6ae,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x3601b3||''),'content':_0x3cd8c8,'onShow':_0x49c61d=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x49c61d['view']?.['updatePosition']();const _0x432dc8=this['_getSelectionElements']();_0x432dc8&&_0x432dc8[0x0]&&St({'target':_0x432dc8[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x49c61d['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x49c6ae});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x49c6ae}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x2d2a47,_0x10355b,_0x1043f5){if(!_0x1043f5)return null;const _0xa0278f=this['_getSelectionElements']();if(!_0xa0278f||0x0===_0xa0278f['length'])return{'left':Math['round'](_0x1043f5['left']+_0x1043f5['width']/0x2-_0x2d2a47['width']/0x2),'top':Math['round'](_0x1043f5['top']+_0x1043f5['height']/0x2-_0x2d2a47['height']/0x2)};const _0xbfa4c0=Math['round'](_0x1043f5['left']+_0x1043f5['width']/0x2-_0x2d2a47['width']/0x2),_0x5dd293=_0xa0278f['map'](_0x555d41=>new gt(_0x555d41)),_0x52ab85=_0x2d2a47['height'];return{'left':_0xbfa4c0,'top':this['_calculateOptimalTopPosition'](_0x5dd293,_0x52ab85,_0x1043f5)};}['_calculateOptimalTopPosition'](_0x23d891,_0x58696e,_0x436e3c){const _0x3c21cd=new gt(Et['window']),_0x38b05b=_0x23d891['map'](_0x1f0bbd=>_0x1f0bbd['getVisible']())['filter'](_0xea9f40=>_0xea9f40),_0x1a3a03=gt['getBoundingRect'](_0x38b05b);if(!_0x1a3a03)return Math['round'](_0x436e3c['top']+_0x436e3c['height']/0x2);const _0x25c2f5=_0x3c21cd['getIntersection'](_0x1a3a03);if(!_0x25c2f5)return Math['round'](_0x436e3c['top']+_0x436e3c['height']/0x2);const _0x3e12e3=_0x436e3c['getVisible'](),_0x4e465c=_0x3e12e3&&_0x1a3a03['height']>_0x3e12e3['height'],_0x7b35ba=_0x25c2f5['top'],_0x3281a8=_0x25c2f5['bottom'];if(_0x4e465c){const _0x414d25=(_0x3e12e3||_0x3c21cd)['height']/0x2-_0x58696e/0x2,_0x243a03=_0x7b35ba-ca-_0x436e3c['top'],_0x196094=_0x436e3c['bottom']-_0x3281a8-ca;return _0x243a03>=_0x58696e?Math['max'](ca,_0x7b35ba-_0x58696e-ca):_0x196094>=_0x58696e?_0x3281a8+ca:Math['max'](ca,_0x414d25);}const _0xdc7e10=_0x7b35ba-_0x58696e,_0x58843f=_0x436e3c['bottom']-_0x3281a8-ca,_0x34f1a0=_0x7b35ba-ca-_0x436e3c['top'];let _0x57e37f;return _0x57e37f=_0x58843f>=_0x58696e?_0x3281a8+ca:_0x34f1a0>=_0x58696e?_0xdc7e10-ca:_0x7b35ba+_0x1a3a03['height']/0x2-_0x58696e/0x2,_0x57e37f;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x4c5574=this['_editor'];this['listenTo'](_0x4c5574['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x520ff2,data:{newRange:_0x528147}}of _0x4c5574['model']['document']['differ']['getChangedMarkers']())if(_0x520ff2['startsWith']('ai-selection:')&&(_0x528147&&(_0x528147['start']['isEqual'](_0x528147['end'])||'$graveyard'==_0x528147['root']['rootName'])||null==_0x528147)){const _0x10b583=ls(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x10b583),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0xd6421e=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0xd6421e['model']['document']);}['_getSelectionElements'](){const _0x4e45e6=this['_editor'];return _0x40c926(_0x4e45e6['editing'],[..._0x4e45e6['model']['markers']['getMarkersGroup']('ai-selection'),..._0x4e45e6['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x4f2025=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x4f2025&&_0x4f2025['rootName']?_0x4f2025['rootName']:null;}},ua=class extends _0x2fd27a{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x189225,_0x118f65={}){super(_0x189225),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x118f65};const _0x3ccf93=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x3ccf93?'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'](_0x1450a0){this['showChangesButton']['isEnabled']=_0x1450a0;}['_setupRatingButtons'](){this['likeButton']=new Pt(this['locale']),this['likeButton']['set']({'icon':rt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':cn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Pt(this['locale']),this['dislikeButton']['set']({'icon':nt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':cn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Pt(this['locale']),this['copyButton']['set']({'icon':_0x197b5b,'label':ls(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+cn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x41caa3=new Wt();_0x41caa3['set']({'content':_0xdd186f}),_0x41caa3['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'+cn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+cn;},0x7d0);}),this['copyButton']['children']['add'](_0x41caa3);}['_setupShowChangesButton'](){this['showChangesButton']=new Pt(this['locale']),this['showChangesButton']['set']({'icon':_0x461a07,'label':ls(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':cn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x5c2f15=>_0x5c2f15?tt:_0x461a07),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(_0x56deb3,_0x22be52){super(_0x56deb3);const _0xdec6a1=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x22be52,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x56deb3),this['_partToolbarView']=new Wn(_0x56deb3,_0x22be52['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x22be52),this['_stateView']=new Fn(_0x56deb3),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x56deb3,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x56deb3,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x15a1be,_0x4ed802,_0xe06761,_0x4f7f6d)=>{let _0x3bb5d5,_0x2b4207;'pending'===_0x4f7f6d?(_0x3bb5d5=this['_partToolbarView'],_0x2b4207=this['_stateView']):(_0x3bb5d5=this['_stateView'],_0x2b4207=this['_partToolbarView']),this['_stateView']['setState'](_0xe06761),_0x3bb5d5['isVisible']=!0x1,_0x2b4207['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0xdec6a1['to']('_state',_0x4dc8a5=>'ck-ai-chat-balloon-main_state_'+_0x4dc8a5)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x22be52);});}['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'](_0x24ceab){_0x24ceab?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x24ceab);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x31c08b){this['_state']=_0x31c08b;}['showError'](_0x252adc){super['showError'](_0x252adc),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x36cfb5){super['showBlockingError'](_0x36cfb5),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x2ca438){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x2ca438;}['togglePartToolbarEnabled'](_0x2f0459){this['_partToolbarView']['isEnabled']=_0x2f0459;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x481610,showSuggestButton:_0x46365d}){_0x481610=_0x481610&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x46365d=_0x46365d&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x481610,'showSuggestButton':_0x46365d});}['_createNextButtonView'](){const _0x2fdcef=new Pt(this['locale']);return _0x2fdcef['set']({'icon':_0x18a6f5,'label':ls(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x2fdcef['on']('execute',()=>{this['fire']('showNext');}),_0x2fdcef;}['_createPreviousButtonView'](){const _0x4a1e6f=new Pt(this['locale']);return _0x4a1e6f['set']({'icon':_0x5bdf9d,'label':ls(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x4a1e6f['on']('execute',()=>{this['fire']('showPrevious');}),_0x4a1e6f;}},_a=class extends _0x294569{constructor(_0x20f3e5,_0x49257a){super(_0x20f3e5),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x49257a});}},ga=class extends _0x429cfd{static get['requires'](){return[Ht,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x54ed4a){super(_0x54ed4a),this['set']('showDiff',!0x1);}['open'](_0x436754){const _0x52c348=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x52c348['plugins']['get']('AIBalloon')['open']({..._0x436754,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x436754['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x436754['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x58fb65){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x58fb65);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x400e10){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x400e10);}['_createChatBalloonView'](){const _0x4bbd93=this['editor'],_0x33f877=_0x4bbd93['plugins']['get']('AIBalloon'),_0x575c59=_0x4bbd93['commands']['get']('trackChanges');let _0x5670b7=_0x4bbd93['config']['get']('ai.availableReplyActions')||[...er];_0x4bbd93['plugins']['has']('TrackChanges')||(_0x5670b7=_0x5670b7['filter'](_0x5eca4e=>'insertSuggestion'!=_0x5eca4e));const _0x1b38de=new da(_0x4bbd93['locale'],{'availableActions':_0x5670b7,'showApplyButton':!0x0,'showSuggestButton':!!_0x575c59});return _0x1b38de['bind']('showDiff')['to'](this),_0x1b38de['delegate'](...Nn)['to'](this),_0x1b38de['delegate']('showPrevious','showNext')['to'](this),_0x33f877['delegate']('dialogClosed')['to'](this),_0x1b38de['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1b38de['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x1b38de['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x575c59&&_0x1b38de['bind']('isTrackChangesOn')['to'](_0x575c59,'value'),_0x1b38de['render'](),_0x1b38de;}['_toggleRotatorButtonsInDialogHeader'](_0x27d3d6){const _0x2d03fc=this['editor'],_0x2654d7=_0x2d03fc['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x27d3d6),_0x2654d7['has'](this['_chatBalloonView']['previousButtonView'])||(_0x2654d7['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2d03fc['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x2654d7['remove'](this['_chatBalloonView']['previousButtonView']),_0x2654d7['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x429cfd{static get['requires'](){return[oa,ga,_0x51d298];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x3354ed){const {editor:_0x29def7,action:_0x16a23a,withText:_0x521044=!0x1,withIcon:_0x12bc7b=!0x0,isInDropdown:_0x33e5b4=!0x0,shouldPreventFocus:_0x2edd0d=!0x1,actionButtons:_0x3ffe46}=_0x3354ed;return()=>{const _0x47245c=_0x29def7['locale'],_0x44638d=new Pt(_0x47245c),_0x2e3b07=_0x44638d['bindTemplate'];_0x33e5b4&&_0x44638d['extendTemplate']({'on':{'mouseenter':_0x2e3b07['to'](()=>{_0x2edd0d&&_0x2edd0d()||_0x44638d['focus']();})}}),_0x3ffe46['push']({'buttonView':_0x44638d,'action':_0x16a23a});const _0x4c6f89=_0x16a23a['icon']??_0x16a23a['parent']?.['icon'];return _0x44638d['set']({'label':_0x16a23a['label'],'withText':_0x521044,'role':'menuitem','icon':_0x12bc7b?_0x4c6f89??_0x12a5a7:void 0x0,'tooltip':!_0x521044,'class':'ck-ai-quick-actions-button','isEnabled':_0x16a23a['isEnabled']}),_0x44638d['on']('execute',()=>{_0x29def7['editing']['view']['focus'](),_0x29def7['commands']['execute']('aiQuickAction',_0x16a23a);}),_0x44638d;};}var pa=class extends qt{['arrowView'];constructor(_0x5a9b2f,_0x12c9f3){super(_0x5a9b2f,_0x12c9f3);const _0x464422=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',_0x59dbf5=>String(_0x59dbf5)),'data-cke-tooltip-disabled':_0x464422['to']('isOn')},'on':{'mouseenter':_0x464422['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x4a7955=new Wt();return _0x4a7955['content']=_0x119e79,_0x4a7955['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x4a7955;}},ma=class extends zt{['_allListItems'];['_allSearchableItems'];constructor(_0x16212b,_0x5dc952,_0x456c2c){super(_0x16212b),this['_allListItems']=_0x5dc952,this['_allSearchableItems']=_0x456c2c;}['filter'](_0x44ec52){if(!_0x44ec52)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x34884d=_0x44ec52['source']['toLowerCase']()['trim'](),_0x260e3f=this['_allSearchableItems']['filter'](_0x371ddd=>(_0x371ddd['groupLabel']?_0x371ddd['label']+'\x20('+_0x371ddd['groupLabel']+')':_0x371ddd['label'])['toLowerCase']()['includes'](_0x34884d));return this['items']['clear'](),this['items']['addMany'](_0x260e3f['sort']((_0x16906f,_0xc51ec)=>{const _0x2d6b86=_0x16906f['groupLabel'],_0x5b8973=_0xc51ec['groupLabel'];return _0x2d6b86||_0x5b8973?_0x2d6b86?0x1:-0x1:0x0;})['map'](_0x5a9839=>_0x5a9839['item'])),this['_highlightQuery'](_0x34884d,_0x260e3f),{'resultsCount':_0x260e3f['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x5a2330,_0x14620){if(!_0x5a2330)return;const _0x119591=new RegExp(_0x4c3f28(_0x5a2330),'gi');_0x14620['forEach'](_0x4f10c3=>{_0x4f10c3['highlightViews']&&_0x4f10c3['highlightViews']['forEach'](_0x950ad3=>{'function'==typeof _0x950ad3['highlightText']&&_0x950ad3['highlightText'](_0x119591);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x3bc5c3=>{_0x3bc5c3['highlightViews']&&_0x3bc5c3['highlightViews']['forEach'](_0x58f7c3=>{'function'==typeof _0x58f7c3['highlightText']&&_0x58f7c3['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x294569{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x24e645,_0x1fe523,_0x2f479c,_0x4bd082,_0x27ade3=!0x1,_0x5bc9ac=[]){const _0x335de9=_0x24e645['locale'];super(_0x335de9),this['_bodyCollection']=_0x4bd082,this['_hasSearch']=_0x27ade3,this['_actionButtons']=_0x5bc9ac;const _0x41f6f5=this['_createListItems'](_0x24e645,_0x1fe523,_0x2f479c);this['optionsListView']=new ma(_0x335de9,_0x41f6f5,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x41f6f5),this['focusTracker']=new ut(),this['keystrokes']=new dt(),_0x27ade3&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x41f6f5,this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x27ade3&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x1215c1=_0x27ade3&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x2776cd(_0x1215c1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x335de9['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x4cebc3(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x272064=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x272064);}['_createListItems'](_0x249301,_0x4671d0,_0x494674){const _0x2fa95f=new _0x2776cd();return _0x4671d0['forEach'](_0x4e0bde=>{if('actions'in _0x4e0bde){const {listItem:_0x230260}=this['_createActionGroupButton'](_0x249301,_0x4e0bde,_0x494674);_0x2fa95f['add'](_0x230260),_0x4e0bde['actions']['forEach'](_0x4198da=>{const {listItem:_0x24d2eb,highlightViews:_0x320dcd}=this['_createSearchResultActionButton'](_0x249301,_0x4198da,_0x4e0bde['label'],_0x4e0bde['icon']);this['_allSearchableItems']['push']({'item':_0x24d2eb,'label':_0x4198da['label'],'groupLabel':_0x4e0bde['label'],'highlightViews':_0x320dcd});});}else{const {listItem:_0x790689}=this['_createActionButton'](_0x249301,_0x4e0bde);_0x2fa95f['add'](_0x790689);const _0x3cad20=_0x790689['children']['first'];if(_0x3cad20){const {listItem:_0x457d02,highlightViews:_0x2c45d9}=this['_createSearchResultActionButton'](_0x249301,_0x4e0bde);this['_allSearchableItems']['push']({'item':_0x457d02,'label':_0x3cad20['label']||'','highlightViews':_0x2c45d9});}}}),_0x2fa95f;}['_createActionButton'](_0x5196ae,_0x46246b,_0x7caab7,_0x3c6e71){const _0x6f0103=new Xt(this['locale']);if(_0x7caab7&&_0x3c6e71){const _0x2327d5=new Pt(this['locale']),_0x1a8321=_0x2327d5['bindTemplate'],_0x41a638=new Kt();_0x41a638['text']=_0x46246b['label'];const _0x51852a=new Kt();_0x51852a['text']=_0x7caab7;const _0x4e9ef4=new Wt();_0x4e9ef4['content']=_0x3c6e71,_0x4e9ef4['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x2c6c45=new _0x294569(this['locale']);_0x2c6c45['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x28cf94=new _0x294569(this['locale']);return _0x28cf94['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x2327d5['set']({'label':_0x46246b['label']+'\x20('+_0x7caab7+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x46246b['isEnabled']}),_0x2327d5['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x1a8321['if']('isEnabled','ck-disabled',_0x3fc872=>!_0x3fc872)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x41a638,_0x2c6c45,_0x4e9ef4,_0x51852a,_0x28cf94],'on':{'mouseenter':_0x1a8321['to'](()=>{this['_isSearchFocused']()||_0x2327d5['focus']();}),'click':_0x1a8321['to'](()=>{_0x2327d5['fire']('execute');})}}),_0x2327d5['on']('execute',()=>{_0x2327d5['isEnabled']&&(_0x5196ae['editing']['view']['focus'](),_0x5196ae['commands']['execute']('aiQuickAction',_0x46246b));}),_0x6f0103['children']['add'](_0x2327d5),this['_actionButtons']['push']({'buttonView':_0x2327d5,'action':_0x46246b}),{'listItem':_0x6f0103,'highlightViews':[_0x41a638,_0x51852a]};}{const _0x1416c9=new Dt(),_0x4c7029=new Pt(this['locale'],_0x1416c9),_0x505586=_0x4c7029['bindTemplate'],_0x2f69a7=_0x46246b['icon']??_0x46246b['parent']?.['icon'],_0x2f2d13=void 0x0!==_0x46246b['icon'];return _0x4c7029['set']({'label':_0x46246b['label'],'withText':!0x0,'role':'menuitem','icon':_0x2f2d13?_0x2f69a7??_0x12a5a7:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x46246b['isEnabled']}),_0x4c7029['extendTemplate']({'on':{'mouseenter':_0x505586['to'](()=>{this['_isSearchFocused']()||_0x4c7029['focus']();})}}),_0x4c7029['on']('execute',()=>{_0x5196ae['editing']['view']['focus'](),_0x5196ae['commands']['execute']('aiQuickAction',_0x46246b);}),_0x6f0103['children']['add'](_0x4c7029),this['_actionButtons']['push']({'buttonView':_0x4c7029,'action':_0x46246b}),{'listItem':_0x6f0103,'highlightViews':[_0x1416c9]};}}['_createSearchResultActionButton'](_0x1404c5,_0x2d702b,_0x459bf5,_0x4a833b){return _0x459bf5&&_0x4a833b?this['_createSearchResultGroupedActionButton'](_0x1404c5,_0x2d702b,_0x459bf5,_0x4a833b):this['_createSearchResultIndividualActionButton'](_0x1404c5,_0x2d702b);}['_createSearchResultGroupedActionButton'](_0x3d0e0b,_0x512b03,_0x4fb2ec,_0x1887eb){const _0x5719b9=new Xt(this['locale']),_0x3a0f72=new Pt(this['locale']),_0x3b148c=_0x3a0f72['bindTemplate'],{view:_0x28131d,highlightView:_0x4223df}=this['_createSearchResultGroupRow'](_0x4fb2ec,_0x1887eb),{view:_0x17692f,highlightView:_0x33801a}=this['_createSearchResultActionRow'](_0x512b03['label']),_0x52e64b=this['_createSearchResultContentView'](_0x28131d,_0x17692f);return _0x3a0f72['set']({'label':_0x512b03['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':_0x512b03['isEnabled']}),_0x3a0f72['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',_0x3b148c['if']('isEnabled','ck-disabled',_0x362e03=>!_0x362e03)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x52e64b],'on':{'mouseenter':_0x3b148c['to'](()=>{this['_isSearchFocused']()||_0x3a0f72['focus']();}),'click':_0x3b148c['to'](()=>{this['_handleSearchResultButtonClick'](_0x3a0f72);})}}),this['_setupActionButtonExecution'](_0x3a0f72,_0x3d0e0b,_0x512b03),_0x5719b9['children']['add'](_0x3a0f72),this['_actionButtons']['push']({'buttonView':_0x3a0f72,'action':_0x512b03}),{'listItem':_0x5719b9,'highlightViews':[_0x4223df,_0x33801a]};}['_createSearchResultIndividualActionButton'](_0x25e0c3,_0xc05fbe){const _0xd93e2c=new Xt(this['locale']),_0x454eb8=new Dt(),_0x5e2b9e=new Pt(this['locale'],_0x454eb8),_0x3e0b53=_0x5e2b9e['bindTemplate'];return _0x5e2b9e['set']({'label':_0xc05fbe['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0xc05fbe['isEnabled']}),_0x5e2b9e['extendTemplate']({'on':{'mouseenter':_0x3e0b53['to'](()=>{this['_isSearchFocused']()||_0x5e2b9e['focus']();})}}),this['_setupActionButtonExecution'](_0x5e2b9e,_0x25e0c3,_0xc05fbe),_0xd93e2c['children']['add'](_0x5e2b9e),this['_actionButtons']['push']({'buttonView':_0x5e2b9e,'action':_0xc05fbe}),{'listItem':_0xd93e2c,'highlightViews':[_0x454eb8]};}['_createSearchResultGroupRow'](_0x2e8a70,_0x262112){const _0x20e830=new _0x294569(this['locale']),_0x3bbaeb=new Wt();_0x3bbaeb['content']=_0x262112,_0x3bbaeb['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x59d925=new Kt();return _0x59d925['text']=_0x2e8a70,_0x20e830['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x3bbaeb,_0x59d925]}),{'view':_0x20e830,'highlightView':_0x59d925};}['_createSearchResultActionRow'](_0x25dfc3){const _0x2d7ea2=new _0x294569(this['locale']),_0x5dd59f=new Kt();return _0x5dd59f['text']=_0x25dfc3,_0x2d7ea2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x5dd59f]}),{'view':_0x2d7ea2,'highlightView':_0x5dd59f};}['_createSearchResultContentView'](_0x29b4f7,_0x48b75f){const _0x4b65da=new _0x294569(this['locale']);return _0x4b65da['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x29b4f7,_0x48b75f]}),_0x4b65da;}['_setupActionButtonExecution'](_0x5321b5,_0x4f954e,_0x36f7fd){_0x5321b5['on']('execute',()=>{_0x5321b5['isEnabled']&&(_0x4f954e['editing']['view']['focus'](),_0x4f954e['commands']['execute']('aiQuickAction',_0x36f7fd));});}['_createActionGroupButton'](_0xd6329d,_0x2e3ffd,_0x48991d){const _0x10559e=new Xt(this['locale']),_0x425d5a=new Dt(),_0x394c6b=new pa(this['locale'],_0x425d5a),_0x510a2e=_0x394c6b['bindTemplate'],_0x16dc47=this['_getPanelKeystroke'](_0x48991d),_0x3e9b26=this['_createGroupActionsList'](_0xd6329d,_0x2e3ffd['actions'],_0x48991d);_0x394c6b['set']({'label':_0x2e3ffd['label'],'withText':!0x0,'role':Ta,'icon':_0x2e3ffd['icon']??_0x12a5a7,'isEnabled':_0x2e3ffd['actions']['some'](_0x174332=>_0x174332['isEnabled'])}),_0x394c6b['extendTemplate']({'on':{'mouseenter':_0x510a2e['to'](()=>{this['_isSearchFocused']()||_0x394c6b['focus']();})}});const _0x4acc81=new Nt(this['locale']);return _0x4acc81['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x510a2e['to'](_0x4ee511=>{this['_handlePanelKeydown'](_0x4ee511,_0x16dc47,_0x394c6b,_0x4acc81);})}}),_0x394c6b['bind']('isOn')['to'](_0x4acc81,'isVisible'),this['_bodyCollection']['add'](_0x4acc81),_0x4acc81['content']['add'](_0x3e9b26),this['_setupGroupMenuBehavior'](_0x394c6b,_0x4acc81),_0x10559e['children']['add'](_0x394c6b),this['_actionButtons']['push']({'buttonView':_0x394c6b,'action':_0x2e3ffd}),{'listItem':_0x10559e,'highlightView':_0x425d5a};}['_createGroupActionsList'](_0x1d5e48,_0x3b4806,_0x5b19af){const _0x4e96ba=new zt(this['locale']);return _0x4e96ba['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3b4806['forEach'](_0x362b40=>{const _0x2c0353=new Xt(this['locale']),_0x50d2cb=Ia({'editor':_0x1d5e48,'action':_0x362b40,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x2c0353['children']['add'](_0x50d2cb),_0x5b19af['focusTracker']['add'](_0x50d2cb),_0x4e96ba['items']['add'](_0x2c0353);}),_0x4e96ba;}['_setupGroupMenuBehavior'](_0x3bafcb,_0x3d1aa0){const _0x42203e=_0x3bafcb['bindTemplate'],_0x154f9b=this['_getButtonKeystroke'](_0x3bafcb);_0x3bafcb['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x42203e['to'](()=>{this['_showNestedPanel'](_0x3d1aa0,_0x3bafcb);}),'mouseleave':_0x42203e['to'](_0x254c54=>{const _0x14b09e=_0x254c54['relatedTarget'];this['_isMovingToNestedMenu'](_0x14b09e,_0x3d1aa0)||this['_hideNestedPanel'](_0x3d1aa0);}),'keydown':_0x42203e['to'](_0x476cdd=>{_0x476cdd['key']==_0x154f9b&&(this['_showNestedPanel'](_0x3d1aa0,_0x3bafcb),_0x3d1aa0['content']['get'](0x0)['focus']());})}}),_0x3d1aa0['on']('render',()=>{_0x3d1aa0['element']?.['addEventListener']('mouseleave',_0x176941=>{const _0x1ee08a=_0x176941['relatedTarget'];_0x3bafcb['element']?.['contains'](_0x1ee08a)||this['_isMovingToNestedMenu'](_0x1ee08a,_0x3d1aa0)||this['_hideNestedPanel'](_0x3d1aa0);});});}['_showNestedPanel'](_0x6824dc,_0x320ebb){this['_openNestedPanels']['forEach'](_0x3a2bd7=>{_0x3a2bd7!==_0x6824dc&&_0x3a2bd7['isVisible']&&_0x3a2bd7['hide']();}),_0x6824dc['show'](),_0x6824dc['pin']({'positions':[Vt['eastSouth']],'target':_0x320ebb['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x6824dc);}['_hideNestedPanel'](_0x2b6c5a){_0x2b6c5a['hide'](),this['_openNestedPanels']['delete'](_0x2b6c5a);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x3aac30=>_0x3aac30['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x773984,_0x1f733d){if(!_0x773984)return!0x1;if(_0x1f733d['element']?.['contains'](_0x773984))return!0x0;const _0x31a798=_0x773984;return _0x31a798['closest']&&(null!==_0x31a798['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x31a798['closest']('.ck-ai-quick-actions-group-list')||null!==_0x31a798['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'](_0x512526){return'rtl'===_0x512526['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x23cea9){return'rtl'===_0x23cea9['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x5c467c,_0x32f4a9,_0xcd1482,_0x3d1048){_0x5c467c['key']==_0x32f4a9&&(_0xcd1482['focus'](),this['_hideNestedPanel'](_0x3d1048));}['_handleSearchResultButtonClick'](_0x52976c){_0x52976c['fire']('execute');}};function Ca(_0x412928){const {editor:_0x358552,content:_0x3fb0b4,buttonDefinition:_0x5dace2,bodyCollection:_0x46ee66,hasSearch:_0x157928=!0x1,actionButtons:_0x37329d}=_0x412928;return()=>{const _0x1b89d0=_0x358552['locale'],_0x4de0b6=_0x358552['commands']['get']('aiQuickAction'),_0x21ab99=_0x3a7b01(_0x1b89d0);_0x21ab99['bind']('isEnabled')['to'](_0x4de0b6),_0x21ab99['buttonView']['set']({'icon':_0x5dace2['icon']??_0x12a5a7,'label':_0x5dace2['label'],'tooltip':!0x0}),_0x21ab99['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x1bafde=new wa(_0x358552,_0x3fb0b4,_0x21ab99,_0x46ee66,_0x157928,_0x37329d);return _0x21ab99['panelView']['children']['add'](_0x1bafde),_0x157928&&_0x21ab99['on']('change:isOpen',(_0x3b55df,_0x213f95,_0x3321d0)=>{if(_0x3321d0){if(_0x358552['plugins']['has']('AIEditing')){const _0x54d6fa=_0x358552['plugins']['get'](As),_0x75d36f=_0x358552['model']['document']['selection'],_0x3bb9be=Array['from'](_0x75d36f['getRanges']());_0x3bb9be['length']>0x0&&_0x54d6fa['showFakeVisualSelection']({'editor':_0x358552,'ranges':_0x3bb9be,'id':'quick-action','priority':0x14});}}else _0x358552['plugins']['has']('AIEditing')&&_0x358552['plugins']['get'](As)['hideFakeVisualSelection']('quick-action'),_0x1bafde['resetSearch']();}),_0x21ab99;};}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 _0x429cfd{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[yt,cs,rn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiquickactions');const _0x3950e4=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x3950e4),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x5c034f){return function(_0xf4f71c){const _0x375f46=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0xf4f71c['uiLanguage'])||'English';return[{'id':'ask-ai','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x2c7ef3},{'id':'chat-commands','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x2c7ef3,'actions':[{'id':'explain','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':ls(_0xf4f71c,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x375f46),'type':'chat'},{'id':'summarize','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':ls(_0xf4f71c,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x375f46),'type':'chat'},{'id':'highlight-key-points','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':ls(_0xf4f71c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x375f46),'type':'chat'}]},{'id':'improve-writing','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x2f3c90},{'id':'continue','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x20bbc6},{'id':'fix-grammar','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x3c37ef},{'id':'adjust-length','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x31df35,'actions':[{'id':'make-shorter','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x4c5b73,'actions':[{'id':'make-tone-casual','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x4b87f0,'actions':[{'id':'translate-to-english','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':ls(_0xf4f71c,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x4773f5,'actions':[]}];}(_0x5c034f);}['_getDefaultAndCustomActions'](){const _0xdd9be5=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x1d7720=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x35d23f=>({..._0x35d23f,'type':'chat'===_0x35d23f['type']?'chat':'action','icon':void 0x0}));return _0xdd9be5['find'](_0x44c0ce=>'other'===_0x44c0ce['id'])['actions']['push'](..._0x1d7720),_0xdd9be5;}async['_initActionTypeQuickActions'](){try{const _0x5d32fc=new Xs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x2cb609=await _0x5d32fc['getAll'](),_0x18bcf5=(await _0x5d32fc['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x18bcf5),this['_enableButtonsByType']('action',_0x18c5f9=>!!_0x2cb609['find'](_0x88f109=>_0x88f109['id']===_0x18c5f9['model'])||void 0x0===_0x18c5f9['model']);}catch(_0x1b0aa4){const _0x3d188c=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x1b0aa4});this['_reporter']['logError'](_0x3d188c);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x177879=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x177879,'change:isConversationReady',(_0x413f94,_0x2e7942,_0x3281a4)=>{_0x3281a4&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x177879['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3d3d86,_0x31b14c){this['_quickActionsDefinition']['forEach'](_0x1b7720=>{'actions'in _0x1b7720?_0x1b7720['actions']['forEach'](_0x581fb0=>{_0x581fb0['type']===_0x3d3d86&&(_0x581fb0['isEnabled']=_0x31b14c(_0x581fb0));}):_0x1b7720['type']===_0x3d3d86&&(_0x1b7720['isEnabled']=_0x31b14c(_0x1b7720));}),this['_actionButtons']['forEach'](_0x2f58aa=>{if(va(_0x2f58aa['action']))return;if(_0x2f58aa['action']['type']!==_0x3d3d86)return;const _0x286d8f=_0x31b14c(_0x2f58aa['action']);if(_0x2f58aa['action']['isEnabled']=_0x286d8f,_0x2f58aa['buttonView']['isEnabled']=_0x286d8f,!_0x286d8f&&_0x2f58aa['action']['model']){const _0x1758fc=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x2f58aa['action']['id'],'modelId':_0x2f58aa['action']['model']});this['_reporter']['logError'](_0x1758fc);}}),this['_actionButtons']['filter'](_0xc8fb76=>va(_0xc8fb76['action']))['forEach'](_0x1c785c=>{_0x1c785c['buttonView']['isEnabled']=_0x1c785c['action']['actions']['some'](_0x35ac80=>_0x35ac80['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x100630,group:_0x21f433})=>{_0x100630['isEnabled']=_0x21f433['actions']['some'](_0x7f3f9b=>_0x7f3f9b['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0xc6a1e2){this['_actionButtons']['forEach'](_0x1978e3=>{va(_0x1978e3['action'])||'action'===_0x1978e3['action']['type']&&(_0x1978e3['action']['model']||(_0x1978e3['action']['model']=_0xc6a1e2));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x305cc7=new xt(this['editor']['locale']);_0x305cc7['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x305cc7),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x305cc7);}['_initializeQuickActionsDropdown'](_0x5ae86f){const _0x2b321c=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x12a5a7,'label':ls(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x5ae86f,'hasSearch':_0x2b321c,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x59750e){this['_quickActionsDefinition']=_0x59750e['map'](_0x49832b=>{if('actions'in _0x49832b){const _0x30511a=_0x49832b;return{..._0x30511a,'actions':_0x30511a['actions']['map'](_0x24d712=>{const {actions:_0x1380e0,..._0xbbaf7}=_0x30511a;return{..._0x24d712,'isEnabled':!0x1,'parent':_0xbbaf7};})['filter'](_0x2ab992=>this['_shouldIncludeAction'](_0x2ab992))};}return{..._0x49832b,'isEnabled':!0x1};})['filter'](_0x5d0bae=>'actions'in _0x5d0bae?_0x5d0bae['actions']['length']>0x0:this['_shouldIncludeAction'](_0x5d0bae));}['_shouldIncludeAction'](_0x153d45){const _0x4cf1e4=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x153d45['type']])&&!_0x4cf1e4['includes'](_0x153d45['id'])&&!('chat'===_0x153d45['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x3beba4){this['_quickActionsDefinition']['forEach'](_0x3977ee=>{if('actions'in _0x3977ee){const _0x244e7b=Ca({'editor':this['editor'],'content':_0x3977ee['actions'],'buttonDefinition':_0x3977ee,'bodyCollection':_0x3beba4,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3977ee['id'],_0x244e7b),_0x3977ee['actions']['forEach'](_0x238ac4=>{const _0x32285f=Ia({'editor':this['editor'],'action':_0x238ac4,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x238ac4['id'],_0x32285f);});}else{const _0x1acae7=Ia({'editor':this['editor'],'action':_0x3977ee,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3977ee['id'],_0x1acae7);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x41e0fe=>{const _0x44cf24=this['editor']['commands']['get']('aiQuickAction'),_0x519632=new te(_0x41e0fe),_0x233b14=ls(_0x41e0fe,'AI_QUICK_ACTIONS_HEADING');_0x519632['buttonView']['set']({'label':_0x233b14,'icon':_0x12a5a7});const _0x8d594e=new Zt(_0x41e0fe);return _0x8d594e['set']({'ariaLabel':_0x233b14,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x2dfc6f=>{if('actions'in _0x2dfc6f){const _0x497e2f=_0x2dfc6f,_0x4a02c6=new Jt(_0x41e0fe,_0x519632),_0x978293=new te(_0x41e0fe),_0x2d20da=new Zt(_0x41e0fe);_0x978293['buttonView']['set']({'label':_0x497e2f['label'],'icon':_0x497e2f['icon']}),_0x497e2f['actions']['forEach'](_0x23ea16=>{const _0x12a4d9=new Jt(_0x41e0fe,_0x978293),_0x48e827=new jt(_0x41e0fe);_0x48e827['set']({'label':_0x23ea16['label'],'icon':_0x23ea16['icon'],'role':'menuitem','isEnabled':_0x23ea16['isEnabled']}),_0x48e827['on']('execute',()=>{this['_executeQuickAction'](_0x23ea16);}),this['_actionButtons']['push']({'buttonView':_0x48e827,'action':_0x23ea16}),_0x48e827['delegate']('execute')['to'](_0x978293),_0x12a4d9['children']['add'](_0x48e827),_0x2d20da['items']['add'](_0x12a4d9);}),_0x978293['isEnabled']=_0x497e2f['actions']['some'](_0x484519=>_0x484519['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x978293,'group':_0x497e2f}),_0x978293['panelView']['children']['add'](_0x2d20da),_0x4a02c6['children']['add'](_0x978293),_0x8d594e['items']['add'](_0x4a02c6);}else{const _0xb0c6c1=_0x2dfc6f,_0x5aabec=new Jt(_0x41e0fe,_0x519632),_0x14e436=new jt(_0x41e0fe);_0x14e436['set']({'label':_0xb0c6c1['label'],'icon':_0xb0c6c1['icon'],'role':'menuitem','isEnabled':_0xb0c6c1['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x14e436,'action':_0xb0c6c1}),_0x14e436['on']('execute',()=>{this['_executeQuickAction'](_0xb0c6c1);}),_0x14e436['delegate']('execute')['to'](_0x519632),_0x5aabec['children']['add'](_0x14e436),_0x8d594e['items']['add'](_0x5aabec);}}),Object['values'](Ra)['some'](_0xf37de0=>this['editor']['plugins']['has'](_0xf37de0))?_0x519632['bind']('isEnabled')['to'](_0x44cf24):_0x519632['set']({'isEnabled':!0x1}),_0x519632['panelView']['children']['add'](_0x8d594e),_0x519632;});}['_executeQuickAction'](_0x34875f){const _0x53e0c1=this['editor'];_0x53e0c1['editing']['view']['focus'](),_0x53e0c1['commands']['execute']('aiQuickAction',_0x34875f);const _0x4e9e8f=_0x53e0c1['ui']['view']['menuBarView'];_0x4e9e8f&&_0x4e9e8f['close']&&_0x4e9e8f['close']();}};function va(_0x1bc27a){return'actions'in _0x1bc27a;}function ka(_0x1113cd,_0x5efd40){const _0x353132=_0x1113cd['plugins']['get']('AITabs')['view'];_0x353132['isVisible']=!0x0,_0x353132['activateTab'](_0x5efd40);}var Na=class extends _0x89658f{['execute'](_0x14724e){switch(this['_expandSelectionIfCollapsed'](),_0x14724e['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x1f956f=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x1f956f});}this['_handleAIChatAction'](_0x14724e);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x245f1d=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x245f1d});}this['_handleAIActionsAction'](_0x14724e);}}async['_handleAIChatAction'](_0x3c5d7d){const _0xdbcf55=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x3c5d7d['id'])_0xdbcf55['removeSelectionFromChatContext'](),_0xdbcf55['addSelectionToChatContext'](this['editor']),_0xdbcf55['focusPromptInput']();else await _0xdbcf55['startConversation']({'modelId':_0x3c5d7d['model']}),_0xdbcf55['removeSelectionFromChatContext'](),_0xdbcf55['addSelectionToChatContext'](this['editor']),_0xdbcf55['focusPromptInput'](),await _0xdbcf55['sendMessage']({'message':_0x3c5d7d['prompt']||_0x3c5d7d['displayedPrompt']||_0x3c5d7d['label'],'attributes':{'quickActionData':{'id':_0x3c5d7d['id']},'displayedPrompt':_0x3c5d7d['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x1514d8=this['editor'],_0x59210d=_0x1514d8['model']['document']['selection'];if(!_0x59210d['isCollapsed'])return;const _0x5bd8ef=pt(_0x59210d['getSelectedBlocks']())||_0x1514d8['model']['schema']['getLimitElement'](_0x59210d);_0x1514d8['model']['change'](_0x4aa3b2=>{_0x4aa3b2['setSelection'](_0x5bd8ef,'in');});}['_handleAIActionsActionLabel'](_0x5c369b){return _0x5c369b['parent']?.['label']&&'other'!==_0x5c369b['parent']?.['id']?_0x5c369b['parent']['label']+':\x20'+_0x5c369b['label']:_0x5c369b['label'];}async['_handleAIActionsAction'](_0x2ec93c){const _0x203175=this['editor']['plugins']['get']('AIActions'),_0x177329=_0x2ec93c['prompt']?{'userMessage':_0x2ec93c['prompt'],'model':_0x2ec93c['model']}:{'actionName':_0x2ec93c['actionName']||_0x2ec93c['id'],'args':_0x2ec93c['args']},_0x5d8d93=this['_handleAIActionsActionLabel'](_0x2ec93c);await _0x203175['executeAction'](_0x177329,_0x5d8d93,_0x2ec93c['icon']);}},ya=class extends _0x429cfd{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x58e95c=this['editor'],_0x54eb64=new Na(this['editor']);if(_0x58e95c['commands']['add']('aiQuickAction',_0x54eb64),_0x58e95c['plugins']['has']('AIChat')){const _0x406616=this['editor']['plugins']['get']('AIChatController');_0x58e95c['model']['document']['selection']['on']('change:range',(_0x19e82e,_0x234176)=>{_0x234176['directChange']&&_0x406616['removeSelectionFromChatContext']();});}}},xa=class extends _n{['appendContent'](_0x12218e,_0x439de9='text'){'modification'===this['type']&&'text'===_0x439de9&&(_0x439de9=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x12218e,_0x439de9);}['updateChangeGroups'](_0x1c1cc0){const _0x13dcb1=this['parsedContent']['get'](_0x1c1cc0)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x1c1cc0,_0x13dcb1),this['changeGroups']=[],0x0==_0x13dcb1['childNodes']['length'])return;Ps(this['documentContextContent']['get'](_0x1c1cc0),this['parsedMergedContent']['get'](_0x1c1cc0));const _0x426260=_0x4c67eb(this['documentContextContent']['get'](_0x1c1cc0)['children']['map'](_0x34fd68=>({'node':_0x34fd68,'id':Cs(_0x34fd68,'data-id')})),_0x13dcb1['children']['map'](_0x80b7f6=>({'node':_0x80b7f6,'id':Cs(_0x80b7f6,'data-id')||Ot()})),{'comparator':(_0x5ad3a8,_0x1a411a)=>_0x5ad3a8['id']==_0x1a411a['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x426260['length']&&_0x426260[_0x426260['length']-0x1]['removed'];)_0x426260['pop']();}const _0x15a22d=_0x426260['map'](_0x1412f3=>{const _0x425b13=_0x1412f3['added']?'new':_0x1412f3['removed']?'removed':'modified';return{'node':_0x1412f3['value'][0x0]['node'],'type':_0x425b13,'id':_0x1412f3['value'][0x0]['id']};}),_0x14ded7=this['_documentIdToSource']['get'](_0x1c1cc0);this['changeGroups']['push']({'changes':_0x15a22d,'state':'pending','index':this['changeGroups']['length'],'editor':_0x14ded7['editor'],'rootName':_0x14ded7['rootName'],'documentId':_0x1c1cc0});}['_getDifferentChangeGroups'](_0x341ce5,_0x5a3f9b){return _0x5a3f9b;}},La=class extends In{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x2b6d85){super(_0x2b6d85),this['content']=_0x2b6d85['content'],this['version']=_0x2b6d85['version'],this['editor']=_0x2b6d85['editor'],this['rootName']=_0x2b6d85['rootName'],this['actionName']=_0x2b6d85['actionName'],this['args']=_0x2b6d85['args'],this['userMessage']=_0x2b6d85['userMessage'],this['model']=_0x2b6d85['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':Ot(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x1b774b){const _0x244db5=this['editor']['config']['get']('collaboration.channelId'),_0x1d4eeb=new xa({..._0x1b774b,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x244db5,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x244db5,this['editor']]])});return this['replies']['push'](_0x1d4eeb),_0x1d4eeb['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x1d4eeb),_0x1d4eeb;}},Da=class extends _0x2fd27a{constructor(_0x53c100,_0x43fcab=!0x0,_0x512382=!0x0){super(_0x53c100),this['set']('isEnabled',!0x1),_0x43fcab&&(this['applyButton']=this['_createButton'](ls(_0x53c100,'AI_BALLOON_APPLY_BUTTON'),an),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x512382&&(this['suggestButton']=this['_createButton'](ls(_0x53c100,'AI_BALLOON_SUGGEST_BUTTON'),_0x43fcab?hn:an),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x43fcab,'showSuggestButton':_0x512382}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x1f8dce,showSuggestButton:_0x4b5676}){this['applyButton']&&(this['applyButton']['isVisible']=_0x1f8dce),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x4b5676);}['_createButton'](_0x40b0cf,_0x404df5){const _0x4bc51f=new Pt(this['locale']);return _0x4bc51f['set']({'label':_0x40b0cf,'class':_0x404df5,'isVisible':!0x0,'withText':!0x0}),_0x4bc51f;}},Pa=class extends _0x294569{constructor(_0x30b03a){super(_0x30b03a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':ls(_0x30b03a,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x294569{constructor(_0x575dd1){super(_0x575dd1),this['set']('isVisible',!0x0);const _0x3347be=new cr('small');_0x3347be['isVisible']=!0x0;const _0xfccf2b=new _0x294569(this['locale']);_0xfccf2b['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[ls(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x392484=>!_0x392484)]},'children':[_0x3347be,_0xfccf2b]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x498716,_0x4aea0d){super(_0x498716),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x4aea0d,this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x2776cd(),this['_addContentWrapper'](_0x4aea0d),this['_addDisclaimerView'](),this['_addToolbar'](_0x4aea0d),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'](_0x4aea0d);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x4c277e of this['_focusables'])this['_focusTracker']['add'](_0x4c277e['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x2ec0e5){-0x1===_0x2ec0e5?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x3f484f){this['_isLoading']=_0x3f484f;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x5c612c){super['showError'](_0x5c612c),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x3a3c2f){super['showBlockingError'](_0x3a3c2f),this['setErrorState']();}['addMiniToolbarItem'](_0x449c69){this['_miniToolbarView']['items']['has'](_0x449c69)||this['_miniToolbarView']['items']['add'](_0x449c69);}['removeMiniToolbarItem'](_0x3f0197){this['_miniToolbarView']['items']['has'](_0x3f0197)&&this['_miniToolbarView']['items']['remove'](_0x3f0197);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x15e6cb,showSuggestButton:_0x90a2be}){_0x15e6cb=_0x15e6cb&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x90a2be=_0x90a2be&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x15e6cb,'showSuggestButton':_0x90a2be});}async['updateContent'](_0x8b4f76){await this['_streamableContentView']['update'](_0x8b4f76);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x1b32d4){this['_contentWrapper']=new _0x294569(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x1b32d4['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x191c85,showSuggestButton:_0x3f371e}){this['_toolbarView']=new Da(this['locale'],_0x191c85,_0x3f371e),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',(_0x46b409,_0x2e269c,_0xa1269e)=>!(_0x46b409||_0x2e269c||_0xa1269e)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x191c85,'showSuggestButton':_0x3f371e}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x439903){return this['_miniToolbarView']=new ua(this['locale'],_0x439903),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',(_0x4988d9,_0x43fc38)=>!(_0x4988d9||_0x43fc38)),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 _0x5e192a=new Pt(this['locale']),_0x344c9a=new Pt(this['locale']),_0x4570c2=new Va(this['locale']),_0x192d0c=new Pt(this['locale']);_0x5e192a['set']({'icon':_0x4bb8fd,'label':ls(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+cn}),_0x344c9a['set']({'icon':_0x59b1a0,'tooltip':ls(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+cn}),_0x192d0c['set']({'icon':_0x25d6ef,'tooltip':ls(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+cn}),_0x5e192a['bind']('isEnabled')['to'](this,'isBusy',_0x13e0eb=>!_0x13e0eb),_0x5e192a['on']('execute',()=>{this['fire']('tryAgain');}),_0x344c9a['bind']('isEnabled')['to'](this,'isBusy',_0x524573=>!_0x524573),_0x344c9a['on']('execute',()=>{this['fire']('showPrevious');}),_0x192d0c['bind']('isEnabled')['to'](this,'isBusy',_0x44f932=>!_0x44f932),_0x192d0c['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x344c9a,this['_navigationCounter']=_0x4570c2,this['_navigationNextButton']=_0x192d0c,this['_navigationTryAgainButton']=_0x5e192a;}['updateMiniToolbarButtons'](_0x3f5fbb,_0x75b802){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x75f652=_0x3f5fbb>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x75f652){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x11f570=_0x3f5fbb-_0x75b802;this['_navigationCounter']['setInteractionCount'](_0x11f570+'/'+_0x3f5fbb),this['_navigationPreviousButton']['isEnabled']=_0x75b802<_0x3f5fbb-0x1,this['_navigationNextButton']['isEnabled']=_0x75b802>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'](_0x2d3cd6){this['_isLoading']=_0x2d3cd6;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x664fe7=this['_streamableContentView']['element'],_0x11d5d8=this['_miniToolbarView']['element'],_0x12cf0e=()=>{Et['window']['requestAnimationFrame'](()=>{const _0xeecf76=_0x664fe7['offsetWidth']-_0x664fe7['clientWidth'];_0x11d5d8['style']['right']='calc('+_0xeecf76+'px\x20+\x20var(--ck-spacing-large))';});};_0x12cf0e(),this['_miniToolbarResizeObserver']=new At(_0x664fe7,()=>{_0x12cf0e();});}['_initializeScrollManager'](){const _0x195fb2=this['_getScrollableElement']();_0x195fb2&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x195fb2));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x294569{constructor(_0x15d580){super(_0x15d580);const _0x82897a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x82897a['to']('interactionCount')}]});}['setInteractionCount'](_0x15b332){this['set']('interactionCount',_0x15b332);}},Ua=class extends _0x429cfd{static get['requires'](){return[cs,rn,Ht,As,la,_0x303ea9];}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(_0x55d92b){super(_0x55d92b),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x44b30d,_0x482d36,_0x27f985){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x178f3d,anchorData:_0x24b414,root:_0x11426b}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x44b30d,_0x178f3d,_0x24b414,_0x11426b,_0x482d36,_0x27f985);}const {modelFragment:_0x1db765,anchorData:_0x30bc21,root:_0x35b4b4}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x44b30d,_0x1db765,_0x30bc21,_0x35b4b4,_0x482d36,_0x27f985);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x19bac2=this['editor']['plugins']['has']('TrackChanges');let _0x531b85=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x19bac2||(_0x531b85=_0x531b85['filter'](_0x4a6fa3=>'insertSuggestion'!=_0x4a6fa3));const _0x444e6b=this['editor']['commands']['get']('trackChanges'),_0x3eae78=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x19bac2,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x531b85});return _0x3eae78['bind']('isBusy')['to'](this),_0x444e6b&&_0x3eae78['bind']('isTrackChangesOn')['to'](_0x444e6b,'value'),_0x3eae78['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x3eae78['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x3eae78['on']('showNext',()=>{this['_navigateToNext']();}),_0x3eae78;}['_normalizeSelectionStart'](){const _0x5f43f1=this['editor']['model'],_0x537e29=_0x5f43f1['document']['selection'],_0x574fe9=_0x537e29['getFirstRange']();if(!_0x574fe9||_0x574fe9['isCollapsed'])return;const _0x48c3fa=pt(_0x537e29['getSelectedBlocks']());if(!_0x48c3fa)return;const _0x3dec72=_0x5f43f1['createPositionAt'](_0x48c3fa,0x0);_0x3dec72['isAfter'](_0x574fe9['start'])&&_0x5f43f1['change'](_0x2961cf=>{_0x2961cf['setSelection'](_0x2961cf['createRange'](_0x3dec72,_0x574fe9['end']));});}['_getExecuteDataRegular'](){const _0x4f2dbf=this['editor']['model']['document']['selection'],_0x24d04a=_0x4f2dbf['getFirstRange']()['start']['root'];if(_0x4f2dbf['isCollapsed']){const _0x304036=pt(_0x4f2dbf['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x4f2dbf);this['editor']['model']['change'](_0x3524d8=>{_0x3524d8['setSelection'](_0x304036,'in');});}this['_normalizeSelectionStart']();const _0x5dfe15=_0x4f2dbf['getFirstRange'](),_0x3ba45c=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x4f2dbf),_0x5dfe15['start'],_0x5dfe15['end']);this['_copyMarkersToFragment'](_0x3ba45c,_0x4f2dbf,{'isTableSelection':!0x1});const _0x3c9d50=_0x4f2dbf['getFirstRange']()['start'],_0x2fa7ce=new Map();let _0x256f8b=_0x3ba45c;for(let _0x523cb0=0x0;_0x523cb0<_0x3c9d50['path']['length'];_0x523cb0++)_0x2fa7ce['set'](_0x256f8b,_0x3c9d50['path'][_0x523cb0]),_0x256f8b=_0x256f8b['getChild'](0x0);return{'modelFragment':_0x3ba45c,'anchorData':_0x2fa7ce,'root':_0x24d04a};}['_getExecuteDataInTable'](){const _0x23dc78=this['editor']['model']['document']['selection'],_0x3406d5=this['editor']['plugins']['get']('TableSelection'),_0x54869e=_0x23dc78['getFirstRange']()['start']['root'],_0x116907=_0x3406d5['getSelectionAsFragment'](),_0x3a9667=_0x23dc78['getFirstRange']()['start']['parent']['parent'],_0x2f1bf8=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x3a9667),this['editor']['model']['createPositionAfter'](_0x3a9667)),_0x4cbbc0=this['_wrapWithCommonAncestors'](_0x116907,_0x2f1bf8['start'],_0x2f1bf8['end']);this['_copyMarkersToFragment'](_0x4cbbc0,_0x23dc78,{'isTableSelection':!0x0});const _0x808c91=_0x23dc78['getFirstRange']()['start'],_0x30dabe=new Map();let _0x27755d=_0x4cbbc0;for(let _0x3dee47=0x0;_0x3dee47<_0x808c91['path']['length'];_0x3dee47++)if(_0x30dabe['set'](_0x27755d,_0x808c91['path'][_0x3dee47]),_0x3dee47<_0x808c91['path']['length']-0x1)_0x27755d=_0x27755d['getChild'](0x0);else{let _0x5a6155=_0x27755d['nextSibling'];for(;_0x5a6155;)_0x30dabe['set'](_0x5a6155,_0x808c91['path'][_0x3dee47]),_0x5a6155=_0x5a6155['nextSibling'];}return{'modelFragment':_0x4cbbc0,'anchorData':_0x30dabe,'root':_0x54869e};}async['_executeAction'](_0x3bb5d8,_0x28a17d,_0x545ff0,_0x5a905c,_0x1809bf,_0x55409f){const _0x5cb7df=this['editor']['plugins']['get'](As),_0x22888a=this['editor']['plugins']['get'](la),_0x381fd0=this['editor']['model']['document']['selection'],_0xd82673=await _0x5cb7df['modelToDataWithIds'](_0x28a17d,this['editor']),_0x1792a4=this['editor']['model']['document']['version'],_0x37f0e1=[..._0x381fd0['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x22888a['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x1809bf,'icon':_0x55409f||_0x12a5a7,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x37f0e1,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x22888a),this['_interactionParams']={'action':_0x3bb5d8,'content':_0xd82673,'version':_0x1792a4,'aiBalloon':_0x22888a,'modelFragment':_0x28a17d,'anchorData':_0x545ff0,'root':_0x5a905c},this['_setupApplyListeners'](),this['listenTo'](_0x22888a,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x22888a,'dialogClosed',(_0x348d22,{id:_0x58c87c})=>{if('aiActionsBalloon'===_0x58c87c){for(const _0x1c3b4e of this['_interactions']){if(0x0===_0x1c3b4e['replies']['length']||_0x1c3b4e['stoppedExplicitly'])continue;const _0x3a6b2b=_0x1c3b4e['replies'][_0x1c3b4e['replies']['length']-0x1],_0x2006ef=_0x3a6b2b['changeGroups'][0x0];_0x2006ef&&'pending'===_0x2006ef['state']&&_0x3a6b2b['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x22888a);}}),this['_createInteraction'](_0xd82673,_0x1792a4,_0x22888a,_0x3bb5d8);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x298ab8,anchorData:_0x437790,root:_0x59c856}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x298ab8,_0x437790,_0x59c856,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x298ab8,_0x437790,_0x59c856,!0x0);});}['_wrapWithCommonAncestors'](_0x473ee1,_0x20462d,_0x33997e){const _0x518f64=this['editor']['model']['createRange'](_0x20462d,_0x33997e)['getCommonAncestor'](),_0x52073c=_0x518f64['is']('documentFragment')?[]:_0x518f64['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x52073c['length']){const _0xe4a19d=_0x52073c['map'](_0x4e4a2a=>_0x4e4a2a['_clone'](!0x1));for(let _0x42f3d1=0x1;_0x42f3d1<_0xe4a19d['length'];_0x42f3d1++)_0xe4a19d[_0x42f3d1-0x1]['_appendChild'](_0xe4a19d[_0x42f3d1]);return _0xe4a19d[_0xe4a19d['length']-0x1]['_appendChild'](_0x473ee1),new _0x322aab(_0xe4a19d[0x0]);}return _0x473ee1;}['_copyMarkersToFragment'](_0x500b13,_0x320915,_0x547976={'isTableSelection':!0x1}){const _0x3fb40b=this['editor']['model'],_0xec72a2=Array['from'](_0x320915['getRanges']()),_0x158793=_0x320915['getFirstRange']()['start'];for(const _0x289287 of _0x3fb40b['markers']){if(_0x289287['name']['startsWith']('ai-selection')||!_0x289287['affectsData'])continue;const _0x2712bd=_0x289287['getRange']();if(!_0xec72a2['some'](_0x4863d9=>_0x4863d9['containsRange'](_0x2712bd,!0x0)))continue;const _0x565e31=this['_regularCalculateMarkerPath'](_0x2712bd['start'],_0x158793,_0x547976['isTableSelection']),_0xadc48a=this['_regularCalculateMarkerPath'](_0x2712bd['end'],_0x158793,_0x547976['isTableSelection']),_0x9269bb=_0x3fb40b['createPositionFromPath'](_0x500b13,_0x565e31),_0x3147a7=_0x3fb40b['createPositionFromPath'](_0x500b13,_0xadc48a);if(!_0x9269bb['isEqual'](_0x3147a7)){const _0x49aed0=_0x3fb40b['createRange'](_0x9269bb,_0x3147a7);_0x500b13['markers']['set'](_0x289287['name'],_0x49aed0);}}}['_regularCalculateMarkerPath'](_0x498fa2,_0x239540,_0x595bef=!0x1){const _0x56206a=[..._0x498fa2['path']['slice']()];for(let _0x2c92b6=0x0;_0x2c92b6<Math['max'](_0x239540['path']['length'],_0x498fa2['path']['length']);_0x2c92b6++){const _0x2e7e9b=_0x239540['path'][_0x2c92b6]||0x0,_0x2d9116=(_0x498fa2['path'][_0x2c92b6]||0x0)-_0x2e7e9b;if(_0x56206a[_0x2c92b6]=_0x2d9116,0x0!==_0x2d9116&&!_0x595bef)break;}return _0x56206a;}async['_createInteraction'](_0x19d2c5,_0x5991a1,_0x19f7d2,_0x136c40){const _0x4891c9=this['editor'],_0x4ca9fa=_0x4891c9['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x136c40,'content':_0x19d2c5,'version':_0x5991a1,'aiBalloon':_0x19f7d2,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x4ca9fa});const _0x45f6e8=new La({'connector':this['_aiConnector'],'locale':_0x4891c9['locale'],'content':_0x19d2c5,'version':_0x5991a1,'editor':_0x4891c9,'rootName':_0x4ca9fa['rootName'],..._0x136c40});this['_interactions']['push'](_0x45f6e8);const _0x56a7bd=(_0x445ca4,_0x3ab799=!0x1,_0x5f3bcb='streaming')=>{const {isDone:_0xd2b762}=_0x445ca4;return this['_promiseQueue']['enqueue'](async _0x655225=>{try{const _0x6cf77b=Us({'changeGroups':_0x445ca4['changeGroups'],'documentContextContent':_0x445ca4['documentContextContent'],'showDiff':_0x3ab799,'trimUnchanged':!0x1});_0x6cf77b['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x6cf77b[0x0],'renderingStrategy':_0x5f3bcb,'abortSignal':_0x655225}),_0xd2b762&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x18bb71){if(sn(_0x18bb71))return;throw _0x18bb71;}});};_0x45f6e8['on']('replyCreated',(_0x556460,_0x17a509)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x56a7bd(_0x17a509)['catch'](_0x4bee49=>{this['_reporter']['logError'](_0x4bee49,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x45f6e8,_0x4bee49);});}),_0x45f6e8['on']('replyContentUpdated',(_0x1d3a9f,_0x25496f)=>{_0x56a7bd(_0x25496f)['catch'](_0x1580c0=>{this['_reporter']['logError'](_0x1580c0,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x45f6e8,_0x1580c0);});}),_0x45f6e8['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x9a4bd6){this['_reporter']['logError'](_0x9a4bd6,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x45f6e8,_0x9a4bd6);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x2409fd,{showDiff:_0x4760d3})=>{try{this['_balloonShowDiff']=_0x4760d3;const _0x46de99=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x46de99&&await _0x56a7bd(_0x46de99,_0x4760d3,'static');}catch(_0x362aae){this['_reporter']['logError'](_0x362aae,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x45f6e8,_0x362aae);}}),_0x45f6e8['on']('replyChangeGroupStateUpdated',()=>{const _0x17360e={'positiveCount':_0x45f6e8['replies']['reduce']((_0x3ae7a2,_0xd09634)=>_0x3ae7a2+_0xd09634['changeGroups']['filter'](_0x2f4463=>'accepted'===_0x2f4463['state'])['length'],0x0),'totalCount':_0x45f6e8['replies']['reduce']((_0x416c5d,_0x171b32)=>_0x416c5d+_0x171b32['changeGroups']['length'],0x0)},_0x552787=_0x45f6e8['actionCallId'],_0x21a6ad=_0x45f6e8['actionName'];_0x21a6ad?this['_aiConnector']['upsertAIActionRating'](_0x21a6ad,_0x552787,_0x17360e):this['_aiConnector']['upsertCustomAIActionRating'](_0x552787,_0x17360e);}),this['_setLoadingState']();try{const _0x271ea3=await _0x45f6e8['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x271ea3;}catch(_0x4d01c9){sn(_0x4d01c9)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x4d01c9,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x45f6e8,_0x4d01c9);}}['_applyChanges'](_0x3f7a92,_0xe49f80,_0x3e91b3,_0x288424){const _0x1953a5=this['editor'];if(_0x288424&&!_0x1953a5['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x2cfa5f=this['editor']['plugins']['get'](_0x303ea9),_0x230de6=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x230de6||!_0x230de6['replies']['length'])return;const _0x469711=_0x230de6['replies'][_0x230de6['replies']['length']-0x1];_0x469711['setChangeGroupState'](0x0,'accepted');const _0x405cf4=ks({'documentSuggestions':On({'groups':[_0x469711['changeGroups'][0x0]],'documentContextContent':_0x469711['documentContextContent'],'documents':_0x230de6['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x2cfa5f,'documentCompareOptions':{'anchor':_0x1953a5['model']['createPositionAt'](_0x3f7a92,0x0),'markDeletions':_0x288424}})['values']()['next']()['value']??[],_0x24e148=this['_filterOperationsOutsideRange'](_0x405cf4,_0xe49f80);for(const _0x3b209a of _0x24e148)this['_anchorOperation'](_0xe49f80,_0x3b209a,_0x3e91b3);const _0x467d0d=_0x230de6['getDocumentContext']()['documents'][0x0]['version'],_0x17e1be=_0x426a31(_0x24e148,_0x1953a5['model']['document']['history']['getOperations'](_0x467d0d),{'document':_0x1953a5['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];js(_0x17e1be,'quickActions');try{_0x1953a5['model']['change'](_0x43523a=>{if(_0x43523a['setSelection'](_0x1953a5['model']['document']['selection']['focus']),_0x288424)_0x1953a5['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x17e1be);else{for(const _0x15bad6 of _0x17e1be)_0x15bad6['baseVersion']=_0x1953a5['model']['document']['version'],Ns(_0x1953a5,_0x15bad6),_0x43523a['batch']['addOperation'](_0x15bad6),_0x1953a5['model']['applyOperation'](_0x15bad6);}});}catch(_0x16268d){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x16268d})),_0x16268d;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x3b1fb5,_0x13179c){return _0x3b1fb5['filter'](_0x84ca18=>{if('rename'==_0x84ca18['type']){const _0xbd92d4=_0x84ca18['position']['nodeAfter'];return!_0x13179c['has'](_0xbd92d4);}if(_0x84ca18['type']['indexOf']('Attribute')>-0x1){const _0x516308=_0x84ca18['range']['start']['nodeAfter'];return!_0x13179c['has'](_0x516308);}return!0x0;});}['_anchorOperation'](_0x4b148f,_0x11f1a9,_0x46970f){const _0x43ead5=_0x11f1a9['clone']();for(const _0x53661b in _0x11f1a9){const _0x589324=_0x11f1a9[_0x53661b];_0x589324 instanceof _0x5677e3?_0x11f1a9[_0x53661b]=new _0x5677e3(_0x5622b2(_0x589324['start']),_0x5622b2(_0x589324['end'])):_0x589324 instanceof _0x1e3dd8&&(_0x11f1a9[_0x53661b]=_0x5622b2(_0x589324));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x43ead5['type'])){if(_0x43ead5['isDocumentOperation']=!0x1,_0x43ead5['baseVersion']=null,'remove'==_0x43ead5['type']){const _0x57a641=_0x43ead5['sourcePosition'],_0x4db01e=_0x43ead5['howMany'];new _0x4f23de(_0x57a641,_0x4db01e)['_execute']();}else _0x43ead5['_execute']();}function _0x5622b2(_0x568e02){if('$graveyard'==_0x568e02['root']['rootName'])return _0x568e02;const _0x74f28e=[];let _0x137983=_0x568e02['root'];for(let _0x2206dd=0x0;_0x2206dd<_0x568e02['path']['length'];_0x2206dd++){const _0xe10fa2=_0x4b148f['get'](_0x137983)||0x0;_0x74f28e[_0x2206dd]=_0x568e02['path'][_0x2206dd]+_0xe10fa2,_0x137983=_0x137983['getChildAtOffset'](_0x568e02['path'][_0x2206dd]);}return new _0x1e3dd8(_0x46970f,_0x74f28e,_0x568e02['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1341c3,content:_0x587cb7,version:_0x6bcde0,aiBalloon:_0x386b92}=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'](_0x587cb7,_0x6bcde0,_0x386b92,_0x1341c3)['catch'](_0x241043=>{this['_reporter']['logError'](_0x241043,{'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 _0x558df4=this['_interactions']['length'];this['_currentInteractionIndex']<_0x558df4-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x5072d9){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x5072d9;const _0x15ac20=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x15ac20)return;if(_0x15ac20['hasError'])return this['_setErrorState'](_0x15ac20),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x15ac20['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x50aba=_0x15ac20['replies'][_0x15ac20['replies']['length']-0x1];if(_0x50aba)try{const _0x5f53a2=Us({'changeGroups':_0x50aba['changeGroups'],'documentContextContent':_0x50aba['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0xf9c5b5=>setTimeout(_0xf9c5b5,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x5f53a2[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x19a78a){this['_reporter']['logError'](_0x19a78a,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0xfd947b,_0x4f54af){if(void 0x0!==_0x4f54af&&sn(_0x4f54af))return;const _0x449065=ls(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x449065),_0xfd947b['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 _0x429cfd{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbc507c){super(_0xbc507c),_0xbc507c['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x294569{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x259b51,_0x2882e9){super(_0x259b51),this['id']=_0x2882e9,this['set']('status','pending'),this['set']('changeId',_0x2882e9),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',(_0x11ef4d,_0x54b4f2)=>{_0x54b4f2&&_0x54b4f2['target']&&'A'===_0x54b4f2['target']['tagName']&&_0x54b4f2['preventDefault'](),this['fire']('activateChange',{'id':_0x2882e9,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x2882e9,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x2882e9,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x2121e3=new _0x294569(this['locale']);return _0x2121e3['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',_0x3cc040=>!_0x3cc040)]}}),_0x2121e3;}['_createAcceptButtonView'](){const _0x500c6c=new Pt(this['locale']);return _0x500c6c['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x500c6c['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x428a0e=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x428a0e['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x1d6805=>'pending'!==_0x1d6805&&'accepted'!==_0x1d6805),this['bindTemplate']['if']('status',hn,_0x535548=>'pending'===_0x535548),this['bindTemplate']['if']('status',cn,_0x113cac=>'pending'!==_0x113cac),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x30de68=>'accepted'===_0x30de68)]}}),this['on']('change:status',(_0x3bb28b,_0x5444cf,_0x379365)=>{_0x500c6c['isEnabled']='pending'===_0x379365,'accepted'===_0x379365&&(_0x500c6c['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x500c6c['icon']=_0xdd186f);}),_0x500c6c;}['_createDismissButtonView'](){const _0x2ee4ea=new Pt(this['locale']);return _0x2ee4ea['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x2ee4ea['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2502db=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x2502db['stopPropagation']();})},'attributes':{'class':[cn,this['bindTemplate']['if']('status','ck-hidden',_0x13faeb=>'pending'!==_0x13faeb&&'rejected'!==_0x13faeb),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x28faa9=>'pending'===_0x28faa9),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2ee5f7=>'rejected'===_0x2ee5f7)]}}),this['on']('change:status',(_0x424311,_0x1bd7a2,_0x195830)=>{_0x2ee4ea['isEnabled']='pending'===_0x195830,'rejected'===_0x195830&&(_0x2ee4ea['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x2ee4ea['icon']=_0x1a57f6);}),_0x2ee4ea;}['_createInfoButtonView'](){const _0x5a54c1=new Pt(this['locale']);return _0x5a54c1['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2ef372,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':cn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x5a54c1['bind']('isOn')['to'](this,'isInfoToggleOn',_0xe5f913=>_0xe5f913),_0x5a54c1['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x5a54c1;}['_createOutdatedButtonView'](){const _0x4de485=new Pt(this['locale']);return _0x4de485['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x167b8e,'withText':!0x0,'isEnabled':!0x1}),_0x4de485['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x2cc9e8=>'outdated'!==_0x2cc9e8)],'disabled':'disabled'}}),_0x4de485;}},Fa=class extends Nt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x5b12ac,_0x258104){super(_0x5b12ac),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']()),_0x258104['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x480fce){this['resultItemView']['changeId']=_0x480fce['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x480fce['contentDiffed'];}['showBalloon'](_0x1a32ba,_0x49dcdc,_0x5ba5ea,_0x2235d1,_0x5940ab,_0x1c231a){const _0x2b0869=_0x49dcdc();if(!_0x2b0869)return;this['updateContent'](_0x1a32ba),this['show']();const _0x540339=Array['from'](_0x2b0869['getClientRects']())['reverse'](),_0xf39ead=this['_getPointedRectIndexFromEvent'](_0x5ba5ea,_0x540339),_0x4b16d6=_0x540339[_0xf39ead??0x0];'click'===_0x2235d1?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x49dcdc(),_0xf39ead,_0x1a32ba['id'],_0x5940ab,_0x1c231a)||_0x4b16d6})):'hover'===_0x2235d1&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x49dcdc(),_0xf39ead,_0x1a32ba['id'])||_0x4b16d6}));}['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'](){_0x1dec34({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x3d99dc=[this['element']];return this['_pinnedTargetElement']&&_0x3d99dc['push'](this['_pinnedTargetElement']),_0x3d99dc;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x21cef4=new _0x294569();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x21cef4['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']]}]}),_0x21cef4;}['_getBestRectPositionOnClick'](_0x52dca5,_0x275fa4,_0x3d49b6,_0x18df75,_0xe7c43b){if(!_0x52dca5)return null;const _0x2d79fc=this['position']['replace']('arrow_',''),_0x48a67b=Array['from'](_0x52dca5['getClientRects']());let _0x1fc0dd,_0x5a11ee=_0x48a67b['reverse']();return void 0x0!==_0x275fa4&&this['_isPinnedRectVisible'](_0x5a11ee[_0x275fa4],_0x18df75,_0xe7c43b)?(_0x1fc0dd=_0x5a11ee[_0x275fa4],this['_pinnedRectIndex']=_0x275fa4):this['_isPinnedRectVisible'](_0x5a11ee[0x0],_0x18df75,_0xe7c43b)&&void 0x0===_0x275fa4?_0x1fc0dd=_0x5a11ee[0x0]:(_0x5a11ee='s'==_0x2d79fc[0x0]?[..._0x48a67b]['reverse']():_0x48a67b,_0x5a11ee['forEach'](_0x58d8f4=>{this['_isPinnedRectVisible'](_0x58d8f4,_0x18df75,_0xe7c43b)&&(_0x1fc0dd=_0x58d8f4);})),this['_pinnedTargetChangeId']=_0x3d49b6,this['_pinnedTargetElement']=_0x52dca5,_0x1fc0dd||_0x52dca5['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x127dea,_0x2f04ee,_0x5a84f3){if(!_0x127dea)return null;const _0x55203b=Array['from'](_0x127dea['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x2f04ee&&this['_pinnedTargetChangeId']!==_0x5a84f3?(this['_pinnedRectIndex']=_0x2f04ee,this['_pinnedTargetElement']=_0x127dea,this['_pinnedTargetChangeId']=_0x5a84f3,_0x55203b[_0x2f04ee]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x5a84f3?_0x127dea!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x55203b[this['_pinnedRectIndex']]:void 0x0!==_0x2f04ee&&this['_pinnedTargetChangeId']!==_0x5a84f3?(this['_pinnedRectIndex']=_0x2f04ee,this['_pinnedTargetElement']=_0x127dea,this['_pinnedTargetChangeId']=_0x5a84f3,_0x55203b[_0x2f04ee]):_0x127dea['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x23ec0f,_0x24d04d){if(_0x23ec0f)for(let _0x3709c0=0x0;_0x3709c0<_0x24d04d['length'];_0x3709c0++){const _0x47b15a=_0x24d04d[_0x3709c0];if(_0x23ec0f['clientX']>=_0x47b15a['left']-0x3&&_0x23ec0f['clientX']<=_0x47b15a['right']+0x3&&_0x23ec0f['clientY']>=_0x47b15a['top']-0x3&&_0x23ec0f['clientY']<=_0x47b15a['bottom']+0x3)return _0x3709c0;}}['_isPinnedRectVisible'](_0x4b79e1,_0x20fa49,_0x37a4a0){const _0x246e5a=new gt(_0x4b79e1),_0x51da1a=_0x20fa49||document['documentElement'],_0x4e9ed3=_0x246e5a['getIntersection'](mt(_0x37a4a0)),_0x382e9e=new gt(_0x51da1a)['getIntersection'](_0x246e5a);return!!(_0x4e9ed3&&_0x382e9e&&_0x246e5a['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x59670e{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[hs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2f48e8){super(_0x2f48e8),this['_bodyCollection']=un(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 _0x1aeeac=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x1aeeac);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x5fac8d){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x485518=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x5fac8d,_0x485518);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x4f5b83){_0x4f5b83&&('error-general'!==_0x4f5b83['status']?'error-chunk'!==_0x4f5b83['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x26bf9b){this['_mainView']['addCheckRunResult'](_0x26bf9b);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x4d9ed7){this['_mainView']['showGeneralReviewCoreErrorView'](_0x4d9ed7??ls(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x4c5bae,_0x5ccec1){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x4c5bae,_0x5ccec1);}['setActiveStateInResults'](_0x12c22e){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x49348e=>{_0x49348e['id']===_0x12c22e&&_0x49348e['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x299584=>_0x299584['setItemAsInactive']());}['updateChangeState'](_0x5c5188,_0x258e1c){'accepted'===_0x258e1c||'rejected'===_0x258e1c||'outdated'===_0x258e1c?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x5c5188,_0x258e1c):this['_mainView']['reviewCheckResultsView']['showResult'](_0x5c5188,_0x258e1c);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x26b50e,_0x208471,_0x3d1830,_0x2ed505,_0x3fb554,_0x3d28ef){this['_balloonSuggestionView']['showBalloon'](_0x26b50e,_0x208471,_0x3d1830,_0x2ed505,_0x3fb554,_0x3d28ef);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x3ac2fd){const _0xe3258e=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x263e47=>_0x263e47['id']===_0x3ac2fd);return _0xe3258e?_0xe3258e['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x294569{constructor(_0x4299f4){super(_0x4299f4),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x277e1c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x277e1c['if']('isVisible','ck-hidden',_0x2ecb83=>!_0x2ecb83)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x277e1c['to']('errorMessage')}]}]});}},$a=class extends _0x294569{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x45b060,_0x42a640){super(_0x45b060),this['reviewCoreHeader']=_0x42a640['header'],this['generalErrorView']=new Ya(_0x45b060),this['reviewCheckListView']=_0x42a640['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x42a640['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x42a640['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'](_0x4d66d4){this['reviewCheckResultsView']['addResult'](_0x4d66d4),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'](_0x35527e){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x35527e;}['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 Pt{constructor(_0x527eba,_0x349247){super(_0x349247),this['set']({'label':_0x527eba,'withText':!0x0,'class':an}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends Xt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x542873,_0x21f240){super(_0x542873),this['_contents']=_0x21f240,this['_resultViews']=new _0x2776cd(),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(_0x542873),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 _0x36dc61=this['_createCombinedSkeletonLoader'](),_0x16c53a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x16c53a['if']('isLoading','ck-ai_review__check-run_loading',_0x4250a0=>_0x4250a0),_0x16c53a['if']('isResultReady','ck-ai_review__check-run_ready',_0x4174b1=>_0x4174b1),_0x16c53a['if']('isVisible','ck-hidden',_0x3f864e=>!_0x3f864e)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x36dc61,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x142bff){const _0x56fefc=new Ga(this['locale'],_0x142bff['id']);_0x56fefc['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x56fefc),_0x56fefc['resultResponseView']['element']['innerHTML']=_0x142bff['contentDiffed'];}['hideResult'](_0x43ca37,_0x2ef172){if('pending'===_0x2ef172)return;const _0x2b2eef=this['_resultViews']['find'](_0x493960=>_0x493960['id']===_0x43ca37);_0x2b2eef&&(_0x2b2eef['status']=_0x2ef172,_0x2b2eef['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x327417,_0x3fd156){if('pending'!==_0x3fd156)return;const _0x574c4a=this['_resultViews']['find'](_0x39354e=>_0x39354e['id']===_0x327417);_0x574c4a&&(_0x574c4a['status']=_0x3fd156,_0x574c4a['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x2c7f42,_0x5418b6){this['headerTitle']=_0x2c7f42,this['headerSubtitle']=_0x5418b6||'';}['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 _0x39f4a6=new _0x294569(this['locale']),_0x4aab1a=[];for(let _0xbbaa3e=0x0;_0xbbaa3e<0x10;_0xbbaa3e++){const _0x59f8b3=this['_createSkeletonLoader']();_0x59f8b3['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x4aab1a['push'](_0x59f8b3);}return _0x39f4a6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x51d9b1=>!_0x51d9b1)]},'children':_0x4aab1a}),_0x39f4a6;}['_createResultsBodyView'](){const _0xe549cc=new _0x294569(this['locale']);return _0xe549cc['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x32163e=>_0x32163e)]},'children':this['_resultViews']}),_0xe549cc;}['_createErrorView'](){const _0x497c52=new _0x294569(this['locale']),_0x2ac096=new Pt(this['locale']),t=this['locale']['t'];return _0x497c52['delegate']('retryReview')['to'](this),_0x2ac096['set']({'label':t('Try\x20again'),'withText':!0x0,'class':hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x2ac096['on']('execute',()=>{this['fire']('retryReview');}),_0x497c52['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x45450d=>!_0x45450d),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x44f646=>'chunk'===_0x44f646)]},'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',_0x5a259e=>'chunk'===_0x5a259e)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x554401=>'general'!==_0x554401)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x400c06=>'chunk'!==_0x400c06)]},'children':[{'text':ls(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x2ac096]}),_0x497c52;}['_createCancelButtonView'](){const _0x12c33a=new Pt(this['locale']);return _0x12c33a['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[hn+'\x20ck-ai-button-stop-generating'],'icon':et}),_0x12c33a['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3905f7=>_0x3905f7),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1e8ad0=>_0x1e8ad0)]}}),_0x12c33a['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x12c33a;}['_createToggleDiffButtonView'](){const _0x11c98c=new Pt(this['locale']);_0x11c98c['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x11c98c['bind']('isEnabled')['to'](this,'isError',_0x2c2f51=>!_0x2c2f51),_0x11c98c['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x428296=>!_0x428296),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x356e03=>_0x356e03)]}});const _0x157fb1=ls(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x4b9daf=ls(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x11c98c['bind']('isOn')['to'](this,'isToggleDiffOn',_0x105d59=>_0x105d59),_0x11c98c['bind']('icon')['to'](this,'isToggleDiffOn',_0x2fc418=>_0x2fc418?_0x2db77e:_0x240b16),_0x11c98c['bind']('label')['to'](this,'isToggleDiffOn',_0x412ac1=>_0x412ac1?_0x157fb1:_0x4b9daf),_0x11c98c['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x11c98c;}['_createAcceptAllButtonView'](){const _0x5cd040=new Pt(this['locale']);return _0x5cd040['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x5cd040['bind']('isEnabled')['to'](this,'isError',_0x3f7d0b=>!_0x3f7d0b),_0x5cd040['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4d5d6b=>!_0x4d5d6b),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3840a1=>_0x3840a1)]}}),_0x5cd040['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x5cd040;}['_createExitReviewButtonView'](){const _0x2c9f6c=new Pt(this['locale']);return _0x2c9f6c['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x2c9f6c['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4ab1e7=>!_0x4ab1e7),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x244d92=>_0x244d92)]}}),_0x2c9f6c['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x2c9f6c;}['_createResultHeaderView'](){const _0x4a27c0=new _0x294569(this['locale']),_0x229c36=this['_createTitleView']();return _0x4a27c0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x1ec881=>_0x1ec881)]},'children':[_0x229c36,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x8fa901=>!_0x8fa901)],'title':ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':ls(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']]}]}),_0x4a27c0;}['_createTitleView'](){const _0xbc17cb=new _0x294569(this['locale']),_0xcea01c=new cr();return _0xcea01c['bind']('isVisible')['to'](this,'isResultReady',_0x270d3b=>!_0x270d3b),_0xbc17cb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x12b7ae=>_0x12b7ae)]},'children':[_0xcea01c,{'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')}]}]}]}),_0xbc17cb;}['_createFinishReviewButtonView'](){const _0xb4b429=new qa(ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0xb4b429['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x188ea6=>!_0x188ea6)]}}),_0xb4b429['delegate']('finishReview')['to'](this),_0xb4b429;}},Xa=class extends Xt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x1880f9,_0x1b7e1c){super(_0x1880f9),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x1b7e1c['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x1b7e1c['headerText']);const _0x377ee1=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x377ee1['if']('isVisible','ck-hidden',_0x239b20=>!_0x239b20)]},'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':_0x1b7e1c['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x20f84b){const _0x28af5f=new qa(_0x20f84b,this['locale']);return _0x28af5f['delegate']('finishReview')['to'](this),_0x28af5f;}['_createResultHeaderView'](_0x19a36e){const _0x4218f0=new _0x294569(this['locale']);return _0x4218f0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x19a36e},'children':[{'text':_0x19a36e}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x4218f0;}},za=class extends _0x294569{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x26a83c,_0xaf3650){super(_0x26a83c),this['_defaultValue']=_0xaf3650['default']||(_0xaf3650['data']['length']>0x0?_0xaf3650['data'][0x0]['id']:''),this['_defaultLabel']=_0xaf3650['data']['find'](_0x3a981d=>_0x3a981d['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x3a7b01(this['locale']);const _0x20a5a6=this['_prepareListOptions'](_0xaf3650['data']);_0x1e8284(this['_dropdownView'],_0x20a5a6,{'role':'menu','ariaLabel':_0xaf3650['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4e2ea9=>{_0x4e2ea9['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x4e3dc5=>{this['formValue']=_0x4e3dc5['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x4e3dc5['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'](_0x1b3599=[]){const _0x1c81b1=new ht();this['resetToDefault']();for(const _0x15af91 of _0x1b3599){const _0x4f1958=new _0x52a6d8({'label':_0x15af91['label'],'withText':!0x0,'role':'menuitemradio','id':_0x15af91['id'],'model':_0x15af91});_0x4f1958['bind']('isOn')['to'](this,'formValue',_0x30ac64=>_0x30ac64===_0x4f1958['id']);const _0x5b53df={'type':'button','model':_0x4f1958};_0x1c81b1['add'](_0x5b53df);}return _0x1c81b1;}},ja=class extends Xt{['_formItem']=null;constructor(_0x350973,_0x56dcd0,_0x3d653f){if(super(_0x350973),this['argsKey']=_0x56dcd0?.['argsKey'],'dropdown'===_0x56dcd0['formType'])this['_formItem']=new za(this['locale'],_0x56dcd0);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x54b75f=new Ft(this['locale'],{'children':[this['_formItem']],'class':[_0x3d653f?'ck-form__row_with-submit':'']});_0x3d653f&&_0x54b75f['children']['add'](_0x3d653f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x54b75f]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x3c1f64{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x167887){super(_0x167887),this['set']('isEmpty',!0x0),this['keystrokes']=new dt(),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 _0x294569{['focusTracker']=new ut();['keystrokes']=new dt();['focusCycler'];['_focusables']=new _0x2776cd();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x2fe226,_0x41893a,_0x48cca2=!0x1){super(_0x2fe226),this['_check']=_0x41893a,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x41893a['defaultModel']?_0x41893a['defaultModel']['id']:'',this['_defaultLabel']=_0x41893a['defaultModel']?_0x41893a['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new $t(this['locale'],()=>new Ja(_0x2fe226)),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 ht(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x48cca2),_0x1e8284(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Ft(this['locale'],{'children':[this['promptInputView']]}),new Ft(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x48b4f3,_0x47d82f)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x47d82f()):_0x47d82f();}),this['focusCycler']=new Bt({'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'](_0x365dfe=>{this['_focusables']['add'](_0x365dfe),this['focusTracker']['add'](_0x365dfe['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 _0x32e262 of this['_getFormValidators']()){const _0x329b1a=_0x32e262();if(_0x329b1a)return this['promptInputView']['errorText']=_0x329b1a,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return ls(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x2ced15=new Pt(this['locale']),t=this['locale']['t'];return _0x2ced15['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x2ced15['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x2ced15;}['_createCancelButtonView'](){const _0x35f389=new Pt(this['locale']),t=this['locale']['t'];return _0x35f389['set']({'label':t('Cancel'),'withText':!0x0,'class':cn}),_0x35f389['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1e97d3=>{_0x1e97d3['stopPropagation']();})}}),_0x35f389['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x35f389;}['_setModelList'](_0x4d3569){this['_modelSelectionDropdownItems']['clear']();const _0x3d2356=this['_check']['models'];if(_0x4d3569)this['set']('modelDisplayMode','hidden');else{const _0xc8e08=0x1===_0x3d2356['length'];this['set']('modelDisplayMode',_0xc8e08?'name':'selector');}if(this['resetToDefault'](),_0x3d2356?.['length']){0x1===_0x3d2356['length']&&this['set']('activeModelName',_0x3d2356[0x0]['name']||_0x3d2356[0x0]['id']);for(const _0x24cbe4 of _0x3d2356){const _0x5add40=new _0x52a6d8({'label':_0x24cbe4['name'],'withText':!0x0,'role':'menuitemradio','id':_0x24cbe4['id'],'model':_0x24cbe4});_0x5add40['bind']('isOn')['to'](this,'modelId',_0x2aaa60=>_0x2aaa60===_0x24cbe4['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x5add40,'labelView':new eh(this['locale'],_0x24cbe4)});}}}['_createModelSelectionDropdown'](){const _0x2bb07e=_0x3a7b01(this['locale']);return _0x2bb07e['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x2bb07e['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':cn}),_0x2bb07e['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3d9c71=>'selector'===_0x3d9c71),this['listenTo'](_0x2bb07e,'execute',_0x22fb41=>{this['modelId']=_0x22fb41['source']['model']['id'],_0x2bb07e['buttonView']['label']=_0x22fb41['source']['label'];}),_0x2bb07e;}['_createModelNameView'](){const _0x8ab4d5=new th(this['locale']);return _0x8ab4d5['bind']('text')['to'](this,'activeModelName',_0x4322c6=>_0x4322c6??''),_0x8ab4d5['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2cf7d6=>'name'===_0x2cf7d6),_0x8ab4d5;}['_createActionsFooterView'](){const _0x5d2254=new _0x294569(this['locale']);return _0x5d2254['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']]}]}),_0x5d2254;}},th=class extends _0x294569{constructor(_0x562f50){super(_0x562f50),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x134119=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x134119['if']('isVisible','ck-hidden',_0x5e114b=>!_0x5e114b)]},'children':[{'text':_0x134119['to']('text')}]});}},eh=class extends Lt{constructor(_0xb7d1a4,_0x5e1f40){super();const _0x24fbfc=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x24fbfc['to']('style'),'id':_0x24fbfc['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x24fbfc['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x5e1f40['description']||'']}]}]});}},ih=class extends Xt{['_formItemsCollection']=new _0x2776cd();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x2474bf,_0x21cc1f,_0x57674f,_0x3a22d9=!0x1){super(_0x2474bf),this['_hideModels']=_0x3a22d9,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x21cc1f['isParameterized']);const _0x4f662a=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',_0x3c90bb=>_0x3c90bb),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x246837=>_0x246837)],'style':{'--ck-ai-review-check-list-item-index':_0x57674f}},'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':_0x21cc1f['title']}]},_0x4f662a]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x21cc1f['description']?[{'text':_0x21cc1f['description']}]:[]}]}]},..._0x21cc1f['isParameterized']?[this['_createParameterizedView'](_0x21cc1f)]:[],...'custom'===_0x21cc1f['id']?[this['_createCustomView'](_0x21cc1f,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x21cc1f['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x21cc1f['id'],'args':_0x21cc1f['useArgs']?_0x21cc1f['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x1dec34({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x4dad4e=>{_0x4dad4e['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x3db74e=new Wt();return _0x3db74e['content']=_0x27abce,_0x3db74e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x3db74e;}['_createParameterizedView'](_0x4ae893){const _0x3f6b52=new _0x294569(),_0x3a95a3=this['_createFormView'](_0x4ae893);return _0x3f6b52['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x540a46=>!_0x540a46)]},'children':[_0x3a95a3]}),_0x3f6b52;}['_createFormView'](_0x4cc8fc){const _0x2b0200=new _0x294569(),_0x116552=Array['isArray'](_0x4cc8fc['options'])?_0x4cc8fc['options']:[],_0xe639f2=new Pt(this['locale']),t=this['locale']['t'];_0xe639f2['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0xe639f2['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3044e7=>{_0x3044e7['stopPropagation']();})}}),_0xe639f2['on']('execute',()=>{const _0x344505=[],_0x3fef16={};this['_formItemsCollection']['forEach'](_0x24d33b=>{_0x344505['push'](_0x24d33b['value']),_0x4cc8fc['useArgs']&&_0x4cc8fc['options']&&(_0x3fef16[_0x24d33b['argsKey']]=_0x24d33b['value']);}),this['fire']('runReviewCheck',{'id':_0x4cc8fc['id'],'params':_0x344505['length']?_0x344505:void 0x0,'args':Object['keys'](_0x3fef16)['length']?_0x3fef16:void 0x0});});const _0x4cf6d2=_0x116552['length'];return _0x116552['forEach']((_0x103fe3,_0x4d62ab)=>{const _0x31b733=_0x4d62ab===_0x4cf6d2-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x103fe3,_0x31b733?_0xe639f2:null));}),_0x2b0200['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x2b0200;}['_createCustomView'](_0xff10cc,_0x5cd39f=!0x1){return this['_customCheckView']=new Za(this['locale'],_0xff10cc,_0x5cd39f),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',_0x402e1b=>!_0x402e1b)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x3ab969,_0x3ce882,_0x14503d)=>{_0x14503d||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends Xt{['_checkViews'];constructor(_0x5ef42a){super(_0x5ef42a),this['_checkViews']=new _0x2776cd(),this['_setupTemplate']();}['setChecks'](_0x1f6d99,_0x2ca8f6=!0x1){this['_checkViews']['clear']();for(const [_0xcc9846,_0x4d8fc3]of _0x1f6d99['entries']()){const _0x1fe993=new ih(this['locale'],_0x4d8fc3,_0xcc9846,_0x2ca8f6);_0x1fe993['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x1fe993);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x49b3c5 of this['_checkViews'])_0x49b3c5 instanceof ih&&_0x49b3c5['resetToDefault']();}['_setupTemplate'](){const _0x5013e3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x5013e3['if']('isVisible','ck-hidden',_0x41c666=>!_0x41c666)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x22dcad=this['context']['plugins']['get']('AITabs'),_0x2ac09e=this['context']['locale'],_0x24636f=new Ho(_0x2ac09e,{'label':ls(_0x2ac09e,'AI_REVIEW_MODE'),'icon':_0x8bcc78,'class':'ck-ai-header_review','showResizeButton':_0x22dcad['showResizeButton']});return _0x24636f['delegate']('resizeTabs')['to'](_0x22dcad),_0x24636f['bind']('isMaximized')['to'](_0x22dcad['view'],'isMaximized',_0x2f4ef3=>_0x2f4ef3),new $a(this['context']['locale'],{'header':_0x24636f,'list':new sh(_0x2ac09e),'results':new Qa(_0x2ac09e,{'generalErrorText':ls(_0x2ac09e,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x2ac09e,{'headerText':ls(_0x2ac09e,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':ls(_0x2ac09e,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x2ac09e,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x23506f=this['context']['plugins']['get']('AITabs');_0x23506f['view']['on']('activateTab',(_0xb913c9,{newTab:_0x12ef03,oldTab:_0x2f1821})=>{'reviewMode'===_0x12ef03?this['fire']('getReviewCheckList'):'reviewMode'===_0x2f1821&&this['fire']('leaveReview');}),_0x23506f['view']['addTab']({'id':'reviewMode','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x8bcc78,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x59670e{static get['requires'](){return[_0x303ea9,As];}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(_0xe857cf){super(_0xe857cf),this['_domEmitter']=new(ct())(),this['_eventEmitter']=new(lt())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x1b15e1=_0x14d450=>this['_scheduleAttachReviewEditingToEditor'](_0x14d450);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1603c4)return void _0x1b15e1(this['context']);const _0xac5723=this['context'];for(const _0x270462 of _0xac5723['editors'])_0x1b15e1(_0x270462);this['listenTo'](_0xac5723['editors'],'add',(_0x25966d,_0x35a473)=>{_0x1b15e1(_0x35a473);}),this['listenTo'](_0xac5723['editors'],'remove',(_0x44b0ef,_0x16ffa9)=>{for(const [_0x3d2e8c,_0x73ce6]of this['_markers'])_0x73ce6['editor']===_0x16ffa9&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3d2e8c,'changeId':_0x73ce6['groupId']}),this['_markers']['delete'](_0x3d2e8c));});}['_scheduleAttachReviewEditingToEditor'](_0x2e18d4){const _0x98da28=()=>{'destroyed'!==_0x2e18d4['state']&&_0x2e18d4['conversion']&&this['_attachReviewEditingToEditor'](_0x2e18d4);};if('ready'===_0x2e18d4['state'])return void _0x98da28();const _0xb124ae=()=>{this['stopListening'](_0x2e18d4,'ready',_0xb124ae),_0x98da28();};this['listenTo'](_0x2e18d4,'ready',_0xb124ae);}['_attachReviewEditingToEditor'](_0x580b31){this['_reviewEditingAttachedEditors']['has'](_0x580b31)||(_0x580b31['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x10693a,{writer:_0x42112b})=>{const _0x3eb38c=this['_markers']['get'](_0x10693a['markerName']),_0x24a596={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x3eb38c?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x10693a['markerName']};return _0x42112b['createUIElement']('span',_0x24a596,function(_0x49adc5){const _0x29b6eb=this['toDomElement'](_0x49adc5);return _0x29b6eb['innerHTML']=_0x3eb38c?.['content']?.['asString']||'',_0x29b6eb;});}}),_0x580b31['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x39ff81=>{const _0x14e55e=this['_markers']['get'](_0x39ff81['markerName']),_0x20a438=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x14e55e?.['id']||'')&&_0x20a438['push']('ck-ai_review__change_active'),{'classes':_0x20a438,'attributes':{'data-marker-id':_0x39ff81['markerName']}};}}),_0x580b31['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x17fbc8=>{const _0x56dc69=this['_markers']['get'](_0x17fbc8['markerName']),_0x1d6b8c=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x56dc69?.['id']||'')&&_0x1d6b8c['push']('ck-ai_review__change_active'),{'classes':_0x1d6b8c,'attributes':{'data-marker-id':_0x17fbc8['markerName']}};}}),_0x580b31['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x21f808=>{const _0x59074c=this['_markers']['get'](_0x21f808['markerName']),_0x439328=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x59074c?.['id']||'')&&_0x439328['push']('ck-ai_review__change_active'),{'classes':_0x439328,'attributes':{'data-marker-id':_0x21f808['markerName']}};}}),_0x580b31['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x1732c5,{writer:_0xa47cec})=>_0xa47cec['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x1732c5['isOpening']?'start':'end')})}),_0x580b31['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x98c166,'view':_0x2b9b7e}),this['_updateMouseMarkerInteractionListeners'](_0x580b31),this['listenTo'](_0x580b31,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x580b31),{'priority':'lowest'}),this['listenTo'](_0x580b31,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x580b31),{'priority':'lowest'}),_0x580b31['model']['document']['registerPostFixer'](_0x4b1bec=>this['_validateMarkers'](_0x580b31,_0x4b1bec)),_0x580b31['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x580b31)),this['_reviewEditingAttachedEditors']['add'](_0x580b31));}['_updateMouseMarkerInteractionListeners'](_0xd20eb4){let _0x2c10e4=this['_boundEditables']['get'](_0xd20eb4);_0x2c10e4||(_0x2c10e4=new Map(),this['_boundEditables']['set'](_0xd20eb4,_0x2c10e4));const _0x1967eb=new Set(_0xd20eb4['ui']['getEditableElementsNames']());for(const _0x45ef3e of _0x1967eb){if(_0x2c10e4['has'](_0x45ef3e))continue;const _0x576055=_0xd20eb4['ui']['getEditableElement'](_0x45ef3e);_0x2c10e4['set'](_0x45ef3e,_0x576055),this['_attachMouseMarkerInteractionListeners'](_0x576055);}for(const [_0x12da3,_0x25e51b]of _0x2c10e4)_0x1967eb['has'](_0x12da3)||(_0x2c10e4['delete'](_0x12da3),this['_domEmitter']['stopListening'](_0x25e51b));}['_attachMouseMarkerInteractionListeners'](_0x3c4619){this['_domEmitter']['listenTo'](_0x3c4619,'mouseup',(_0x46b9ef,_0x591bfa)=>{const _0x3ccf6e=_0x591bfa['target'],_0x4dc54e=this['_findMarkerElement'](_0x3ccf6e);if(!_0x4dc54e)return;const _0x48ee18=_0x4dc54e['getAttribute']('data-marker-id'),_0x51adce=_0x48ee18['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x48ee18,'changeId':_0x51adce,'markerElement':()=>this['_findMarkerElementById'](_0x48ee18),'domEvent':_0x591bfa});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x3c4619,'mouseover',(_0x33f495,_0x36727b)=>{const _0x4a0d99=_0x36727b['target'],_0x19ed72=_0x36727b['relatedTarget'];let _0xa2447=this['_findMarkerElement'](_0x4a0d99);if(!_0xa2447&&_0x19ed72&&(_0xa2447=this['_findMarkerElement'](_0x19ed72)),!_0xa2447)return;const _0x16492a=_0xa2447['getAttribute']('data-marker-id'),_0x3020ed=_0x16492a['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x3020ed,'markerElement':()=>this['_findMarkerElementById'](_0x16492a),'domEvent':_0x36727b});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x2a623b((_0x4ea727,_0x3f07b8)=>{const _0xd1233e=_0x3f07b8['target'];this['_findMarkerElement'](_0xd1233e)||_0xd1233e['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x4a81eb=this['context']['plugins']['get']('AIEditing'),_0x485410=us(this['context']);if(!_0x485410['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x2e4d27=new Set(),_0x407d69=[],_0x143de7=new Map();for(const _0x5c0fea of _0x485410)for(const _0x32e06c of _0x5c0fea['model']['document']['getRoots']()){if('$graveyard'===_0x32e06c['rootName'])continue;const _0x21fc11=this['_buildDocumentDataSliceForRoot'](_0x5c0fea,_0x32e06c,_0x4a81eb,_0x2e4d27);_0x407d69['push'](_0x21fc11['content']);for(const [_0x4581dc,_0x4dc3d0]of _0x21fc11['elements'])_0x143de7['set'](_0x4581dc,_0x4dc3d0);}return{'elements':_0x143de7,'content':_0x407d69['join']('')};}['_buildDocumentDataSliceForRoot'](_0x5897c6,_0x5c6aaf,_0x2e979e,_0x18477e){const _0x41cf8e=_0x5897c6['model'],_0x15cbbb=new _0x322aab();for(const _0x37e7d5 of _0x5c6aaf['getChildren']())_0x15cbbb['_appendChild'](_0x37e7d5['_clone'](!0x0));for(const _0x1d4346 of _0x41cf8e['markers']){const _0x15397c=_0x1d4346['getRange']();_0x15397c&&_0x15397c['root']['rootName']===_0x5c6aaf['rootName']&&_0x15cbbb['markers']['set'](_0x1d4346['name'],this['_changeRangeOwnerDocument'](_0x15397c['clone'](),_0x15cbbb));}const _0x174aed=new Map(),_0x368e05=_0x41cf8e['document']['version'],_0x1f6ce3=new _0x28a378({'ignoreElementEnd':!0x0,'startPosition':_0x41cf8e['createPositionAt'](_0x15cbbb,0x0)});for(const {item:_0xe5ae44}of _0x1f6ce3){if(_0xe5ae44['is']('element')&&_0xe5ae44['name']&&ah['includes'](_0xe5ae44['name'])){const _0x474dd7=this['_upsertDataId'](_0xe5ae44,()=>_0x2e979e['_nextDataId'](_0x18477e));_0x18477e['add'](_0x474dd7);}if(!_0xe5ae44['is']('$textProxy'))continue;const _0x113d9a=_0xe5ae44['parent'];if(!_0x113d9a||!_0x113d9a['is']('element'))continue;const _0x1af7a4=this['_upsertDataId'](_0x113d9a,()=>_0x2e979e['_nextDataId'](_0x18477e));_0x18477e['add'](_0x1af7a4);for(const _0x41551b of _0x113d9a['getChildren']())_0x41551b['is']('element')&&(_0x41551b['name']&&oh['includes'](_0x41551b['name'])||_0x18477e['add'](this['_upsertDataId'](_0x41551b,()=>_0x2e979e['_nextDataId'](_0x18477e))));let _0x568e4c=_0x113d9a;for(;_0x568e4c['parent']&&!_0x568e4c['parent']['is']('documentFragment');)_0x568e4c=_0x568e4c['parent'],_0x568e4c['hasAttribute'](_0x98c166)&&_0x568e4c['_removeAttribute'](_0x98c166);_0x174aed['set'](_0x1af7a4,{'editor':_0x5897c6,'rootName':_0x5c6aaf['rootName'],'path':_0x113d9a['getPath'](),'documentVersion':_0x368e05,'getContent':this['_createGetContentUsingDataIdFn'](_0x568e4c['_clone'](!0x0),_0x1af7a4,_0x5897c6['data'])}),_0x1f6ce3['jumpTo'](_0x41cf8e['createPositionAfter'](_0x113d9a));}return{'content':_0x5897c6['data']['processor']['toData'](_0x5897c6['data']['toView'](_0x15cbbb)),'elements':_0x174aed};}['diffContent'](_0x2c6bfb,_0x1180bc,_0x1c81cf,_0x3f3562=!0x1){const {contentInitial:_0xffd5b5,contentNew:_0x59d214}=this['_neutralizeChangesOnUnsupportedElements'](_0x1180bc,_0x1c81cf),_0x59a33f=[],_0x188657=_0x2c6bfb['data']['parse'](_0x59d214,'$documentFragment'),_0x3e2f17=_0x2c6bfb['data']['parse'](_0xffd5b5,'$documentFragment'),_0x2a95d4=_0x2c6bfb['model']['createPositionAt'](_0x3e2f17,0x0);if(this['_haveSingleTopLevelElement'](_0x188657)){if(!this['_hasSameTopLevelElement'](_0x3e2f17,_0x188657))return _0x59a33f;}else{const _0x1cb2cb=_0x2c6bfb['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x3e2f17,_0x1cb2cb)||!this['_haveOnlyInlineContent'](_0x188657,_0x1cb2cb))return _0x59a33f;}const _0x596d1d=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0xffd5b5,_0x59d214,{'targetEditor':_0x2c6bfb,'anchor':_0x2a95d4,'markDeletions':!0x0})['getOperations']()['filter'](_0x846eae=>'insert'===_0x846eae['type']||'marker'===_0x846eae['type']&&_0x846eae['name']['startsWith']('$markedRemove')),_0x3223e8=this['_groupAdjacentOperations'](_0x596d1d),_0x2bbca5=[];if(_0x3f3562){if(_0x3223e8['length']){const _0x4171df=_0x3223e8[0x0]['operations'][0x0],_0x1975a4='insert'===_0x4171df['type']?_0x4171df['position']:_0x4171df['newRange']['start'],_0x2d597f=this['_getPositionLimitingRange'](_0x1975a4,_0x2c6bfb,'inside'),_0x5b78c3=_0x2d597f?_0x188657['getChild'](0x0)['getChildren']():_0x188657['getChildren'](),_0x30b1e5=_0x2d597f||_0x2c6bfb['model']['createRangeIn'](_0x3e2f17),_0x25a243=[new _0x2831e3('$markedRemove:synthetic'+Ot(),null,_0x30b1e5,_0x2c6bfb['model']['document']['model']['markers'],!0x0,_0x2c6bfb['model']['document']['version']+0x1),new _0x49bd28(_0x30b1e5['end'],_0x5b78c3,_0x2c6bfb['model']['document']['version']+0x2)];_0x2bbca5['push']({'operations':_0x25a243,'operationsIsolated':_0x25a243,'groupOffset':0x0});}}else _0x2bbca5['push'](..._0x3223e8);let _0x505865=0x0;return _0x2c6bfb['model']['change'](_0x395b49=>{for(let _0x4e1dc6=0x0;_0x4e1dc6<_0x2bbca5['length'];_0x4e1dc6++){const _0x34ea5e=_0x2bbca5[_0x4e1dc6],_0x15d5dc=_0x395b49['createDocumentFragment']();for(const _0x373a69 of _0x3e2f17['getChildren']())_0x395b49['append'](_0x373a69['_clone'](!0x0),_0x15d5dc);for(const _0x42f558 of _0x34ea5e['operationsIsolated'])if('insert'===_0x42f558['type']){const _0x377f11=_0x42f558;_0x377f11['baseVersion']=null,_0x377f11['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x377f11,_0x15d5dc),_0x395b49['batch']['addOperation'](_0x42f558),_0x2c6bfb['model']['applyOperation'](_0x42f558);const _0x2aa282='suggestion:insertion:id:authorId:'+_0x505865++,_0x369814=_0x2c6bfb['model']['createRange'](_0x377f11['position'],_0x377f11['position']['getShiftedBy'](_0x377f11['howMany']));_0x15d5dc['markers']['set'](_0x2aa282,_0x369814);}else{if('marker'===_0x42f558['type']&&_0x42f558['name']['startsWith']('$markedRemove')){const _0x457c42=_0x42f558,_0x4a74bf='suggestion:deletion:id:authorId:'+_0x505865++;this['_changeOperationOwnerDocument'](_0x457c42,_0x15d5dc),_0x15d5dc['markers']['set'](_0x4a74bf,_0x457c42['newRange']);}}if(_0x3f3562)_0x59a33f['push']({..._0x34ea5e,'context':this['_createGetContentFn'](_0x3e2f17,_0x2c6bfb['data']),'content':this['_createGetContentFn'](_0x3e2f17,_0x2c6bfb['data'])});else{const _0x4b2bb1=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x34ea5e['operationsIsolated'][0x0]),_0x15d5dc),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x34ea5e['operationsIsolated'][_0x34ea5e['operationsIsolated']['length']-0x1]),_0x15d5dc),_0x2c6bfb);_0x15d5dc['markers']['set'](rh+'suggestion-context',new _0x5677e3(_0x4b2bb1['start'],_0x4b2bb1['end'])),_0x59a33f['push']({..._0x34ea5e,'context':this['_createGetContextFn'](_0x15d5dc,_0x2c6bfb['data'],{'ellipsisBefore':_0x4b2bb1['hasContentBefore'],'ellipsisAfter':_0x4b2bb1['hasContentAfter']}),'content':this['_createGetContentFn'](_0x15d5dc,_0x2c6bfb['data'])});}}}),_0x59a33f;}['markChangePositionInEditorContent'](_0x9261b4,_0x5de47e){if(!_0x9261b4['length'])return;const _0x38b8f0=_0x9261b4[0x0]['parent']['id'],_0x4b58a9=_0x5de47e['elements']['get'](_0x38b8f0);if(!_0x4b58a9)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x38b8f0);const _0xf78e7d=_0x4b58a9['path'],_0xed49f9=_0x4b58a9['editor'],_0x9e1814=_0xed49f9['model']['document']['getRoot'](_0x4b58a9['rootName']);if(!_0x9e1814)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x4b58a9['rootName']);const _0xf2469e=_0xed49f9['model']['document']['history']['getOperations'](_0x4b58a9['documentVersion']),_0x4aee7b=[];for(const _0x313658 of _0x9261b4){const _0x593b58=_0x313658['operationsIsolated']['map'](_0x5ad583=>this['_translateOperationToEditorContent'](_0x5ad583,_0xf78e7d,_0x9e1814));if(!_0x593b58||!_0x593b58['length'])continue;const _0x344f79=_0x593b58['every'](_0xc94402=>'marker'===_0xc94402['type']&&_0xc94402['name']['startsWith']('$markedRemove')),_0x27134b=_0x426a31(_0x593b58,_0xf2469e,{'document':_0xed49f9['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x15c463 of _0x27134b)if('insert'===_0x15c463['type']){const _0x1d718a=_0x15c463,_0x1eb391=_0x1d718a['nodes'];_0xed49f9['model']['change'](_0x40f793=>{const _0x39e44b=_0x40f793['createDocumentFragment']();for(const _0xf421e0 of _0x1eb391)_0x40f793['append'](_0xf421e0['_clone'](!0x0),_0x39e44b);_0x4aee7b['push']({'start':_0x1d718a['position'],'end':_0x1d718a['position'],'type':'insert','groupId':_0x313658['id'],'content':{'asString':this['_createGetContentFn'](_0x39e44b,_0xed49f9['data'])(),'asFragment':_0x39e44b}});});}else{if('marker'===_0x15c463['type']&&_0x15c463['name']['startsWith']('$markedRemove')){const _0x9d2fc=_0x15c463;let _0x22e955='remove-text';if(_0x344f79){const _0xf2b911=this['_findAdjacentContextDistance'](_0x9d2fc['newRange']['start'],'backward',_0xed49f9['model']['schema']),_0x58b12b=this['_findAdjacentContextDistance'](_0x9d2fc['newRange']['end'],'forward',_0xed49f9['model']['schema']);if(_0xf2b911||_0x58b12b){const _0x5b941e=_0x9d2fc['newRange']['start']['getShiftedBy'](-_0xf2b911),_0x7ff502=_0x9d2fc['newRange']['end']['getShiftedBy'](_0x58b12b);_0x4aee7b['push']({'start':_0x5b941e,'end':_0x7ff502,'groupId':_0x313658['id'],'type':'remove-context'});}else _0x22e955='remove-only';}_0x4aee7b['push']({'start':_0x9d2fc['newRange']['start'],'end':_0x9d2fc['newRange']['end'],'groupId':_0x313658['id'],'type':_0x22e955});}}}this['_insertMarkers'](_0x4aee7b,_0xed49f9);}['clearAllMarkers'](){const _0x3bdd6a=new Map();for(const _0x15569b of this['_markers']['keys']()){const _0x428e94=this['_markers']['get'](_0x15569b);_0x428e94?.['editor']&&(_0x3bdd6a['has'](_0x428e94['editor'])||_0x3bdd6a['set'](_0x428e94['editor'],[]),_0x3bdd6a['get'](_0x428e94['editor'])['push'](_0x15569b));}for(const [_0x58372,_0xa1635]of _0x3bdd6a)_0x58372['model']['change'](_0x187899=>{for(const _0x48aecf of _0xa1635)_0x58372['model']['markers']['get'](_0x48aecf)&&_0x187899['removeMarker'](_0x48aecf);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x3ddedd of us(this['context']))_0x3ddedd['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x5c4f41 of us(this['context']))_0x5c4f41['disableReadOnlyMode']('ai-review');}['applyChange'](_0x1c9017,_0x246a6b=null){const _0x39bebe=_0x1c9017['map'](_0x49a86a=>this['_getMarkersDataForGroup'](_0x49a86a))['flat'](),_0x260986=new Map();for(const _0x128e2e of _0x39bebe)_0x260986['has'](_0x128e2e['editor'])||_0x260986['set'](_0x128e2e['editor'],[]),_0x260986['get'](_0x128e2e['editor'])['push'](_0x128e2e);for(const [_0x318b84,_0x457ce8]of _0x260986){const _0x24718e=_0x318b84['model'],_0xad6a92=_0x318b84['plugins']['has']('TrackChangesEditing')?_0x318b84['plugins']['get']('TrackChangesEditing'):null,_0x12f4e7=_0x246a6b&&_0xad6a92?new Set(_0xad6a92['getSuggestions']()['map'](_0x304be5=>_0x304be5['id'])):null;_0x24718e['change'](_0x4f8987=>{const _0x199ca2=_0x4f8987['batch']['operations']['length'];for(const _0x2a52ec of _0x457ce8){const _0x209d8e=_0x318b84['model']['markers']['get'](_0x2a52ec['id']);if(_0x209d8e){if('insert'===_0x2a52ec['type']){if(!_0x2a52ec['content'])continue;_0x24718e['insertContent'](_0x2a52ec['content']['asFragment']||null,_0x209d8e['getRange']()['start']);}else'remove-text'!==_0x2a52ec['type']&&'remove-only'!==_0x2a52ec['type']||_0x24718e['deleteContent'](_0x24718e['createSelection'](_0x209d8e['getRange']()));_0x4f8987['removeMarker'](_0x2a52ec['id']),this['_markers']['delete'](_0x2a52ec['id']);}}if(_0x246a6b&&(js(_0x4f8987['batch']['operations']['slice'](_0x199ca2),_0x246a6b),_0xad6a92)){for(const _0x511dd8 of _0xad6a92['getSuggestions']())_0x12f4e7['has'](_0x511dd8['id'])||_0x511dd8['setAttribute']('@ai',{'type':_0x246a6b});}});}}['rejectChange'](_0x45333e){const _0x439062=this['_getMarkersDataForGroup'](_0x45333e),_0x3c5c1c=new Map();for(const _0x53fcd5 of _0x439062)_0x3c5c1c['has'](_0x53fcd5['editor'])||_0x3c5c1c['set'](_0x53fcd5['editor'],[]),_0x3c5c1c['get'](_0x53fcd5['editor'])['push'](_0x53fcd5);for(const [_0x282745,_0x153d2d]of _0x3c5c1c)_0x282745['model']['change'](_0x44bcce=>{for(const _0xc89e4d of _0x153d2d)_0x44bcce['removeMarker'](_0xc89e4d['id']),this['_markers']['delete'](_0xc89e4d['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return us(this['context']);}['getEditorForChange'](_0xe069be){return this['_getMarkersDataForGroup'](_0xe069be)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x204553){const _0x11de5c=Array['from'](this['_markers']['values']())['filter'](_0x2cceba=>_0x2cceba['groupId']===_0x204553);if(!_0x11de5c['length'])return null;const _0x2e7a75=0x1===_0x11de5c['length']?_0x11de5c[0x0]:this['_sortMarkers'](_0x11de5c)[0x0],_0x519bbc=_0x2e7a75['editor']['model']['markers']['get'](_0x2e7a75['id']);return _0x519bbc?{'modelRange':_0x519bbc['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x2e7a75['id'])}:null;}['getContentElementForChange'](_0xfa16f9){const _0x299dab=Array['from'](this['_markers']['values']())['filter'](_0x286610=>_0x286610['groupId']===_0xfa16f9);if(!_0x299dab['length'])return null;const _0xb11266=0x1===_0x299dab['length']?_0x299dab[0x0]:this['_sortMarkers'](_0x299dab)[0x0],_0x4c2877=_0xb11266['editor'],_0x9b79d0=_0x4c2877['model']['markers']['get'](_0xb11266['id']);if(!_0x9b79d0)return null;const _0x2f5970=_0x9b79d0['getRange'](),_0x502765=_0x4c2877['editing']['view']['getDomRoot'](_0x2f5970['root']['rootName'])||_0x4c2877['editing']['view']['getDomRoot']();if(!_0x502765||!_0x2f5970)return null;let _0x3e0268=_0x2f5970['start']['parent'];for(;_0x3e0268['parent']&&!_0x3e0268['parent']['is']('rootElement');)_0x3e0268=_0x3e0268['parent'];if(!_0x3e0268||!_0x3e0268['name'])return null;const _0x147a32=_0x502765['querySelector']('[data-marker-id=\x22'+_0xb11266['id']+'\x22]');if(!_0x147a32)return null;let _0x58f6e9=null;_0x4c2877['model']['change'](_0x5b5f49=>{_0x58f6e9=_0x5b5f49['createDocumentFragment'](),_0x5b5f49['append'](_0x3e0268['_clone'](!0x0),_0x58f6e9);});const _0x67486c=_0x4c2877['data']['toView'](_0x58f6e9)['getChild'](0x0);return _0x147a32['closest'](_0x67486c['name']);}['reactivateMarkers'](_0x4ad879){const _0x2d7a49=this['_getMarkersDataForGroup'](_0x4ad879);if(!_0x2d7a49['length'])return;const _0x3dce1f=Array['from'](this['_activeMarkers'])['sort'](),_0x1085bc=Array['from'](new Set(_0x2d7a49['map'](_0x5d8801=>_0x5d8801['id'])))['sort']();_0x3dce1f['join']('|')!==_0x1085bc['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x4ad879));}['setMarkersInElementAsActive'](_0x2a36f4){const _0x10ae79=this['_getMarkersDataForGroup'](_0x2a36f4);if(!_0x10ae79['length'])return;const _0x4d5469=_0x10ae79[0x0]['editor'],_0x30fb81=new Set(_0x10ae79['map'](_0x4468c8=>_0x4468c8['id'])),_0x14b81d=Array['from'](_0x30fb81['values']())['map'](_0x3f160c=>_0x4d5469['model']['markers']['get'](_0x3f160c))['filter'](_0x5b2f99=>!!_0x5b2f99);_0x30fb81['forEach'](_0x4afa79=>{this['_activeMarkers']['add'](_0x4afa79);}),_0x4d5469['model']['change'](()=>{_0x14b81d['forEach'](_0x495585=>{_0x4d5469['editing']['reconvertMarker'](_0x495585);});});}['setAllMarkersAsInactive'](){const _0x468d3a=Array['from'](this['_activeMarkers']);if(!_0x468d3a['length'])return;this['_activeMarkers']['clear']();const _0x1a00c6=new Map();for(const _0x2f84ea of _0x468d3a){const _0x3ad0d6=this['_markers']['get'](_0x2f84ea);if(!_0x3ad0d6)continue;const _0x4fdec9=_0x3ad0d6['editor'],_0x3589a1=_0x4fdec9['model']['markers']['get'](_0x2f84ea);_0x3589a1&&(_0x1a00c6['has'](_0x4fdec9)||_0x1a00c6['set'](_0x4fdec9,[]),_0x1a00c6['get'](_0x4fdec9)['push'](_0x3589a1));}for(const [_0x37ab23,_0x2e505c]of _0x1a00c6)_0x37ab23['model']['change'](()=>{_0x2e505c['forEach'](_0x209823=>{_0x37ab23['editing']['reconvertMarker'](_0x209823);});});}['_getPositionLimitingRange'](_0x4cc7b1,_0x3426f7,_0x27c893='outside'){if(!_0x4cc7b1)return null;let _0x1f5cd4=_0x4cc7b1['parent'];for(;_0x1f5cd4&&_0x1f5cd4['parent']&&!_0x1f5cd4['parent']['is']('rootElement')&&!_0x3426f7['model']['schema']['isLimit'](_0x1f5cd4)&&!_0x3426f7['model']['schema']['isBlock'](_0x1f5cd4);)_0x1f5cd4=_0x1f5cd4['parent'];if(!_0x1f5cd4||!_0x1f5cd4['name']||_0x1f5cd4['is']('rootElement'))return null;let _0xd71ff9=null;return _0x3426f7['model']['change'](_0x3cf699=>{_0xd71ff9='inside'===_0x27c893?_0x3cf699['createRangeIn'](_0x1f5cd4):_0x3cf699['createRangeOn'](_0x1f5cd4);}),_0xd71ff9;}['_validateMarkers'](_0x445625,_0x5bb644){const _0x4533e0=Array['from'](this['_markers']['keys']()),_0x2fe9e3=new Map();for(const _0x2f0200 of _0x4533e0){const _0x326fab=_0x445625['model']['markers']['get'](_0x2f0200);if(!_0x326fab)continue;const _0x3a03e0=_0x326fab['getStart']()['root']['rootName']+':'+_0x326fab['getStart']()['path'][0x0];_0x2fe9e3['has'](_0x3a03e0)||_0x2fe9e3['set'](_0x3a03e0,[]),_0x2fe9e3['get'](_0x3a03e0)['push'](_0x326fab);}const _0x3966a2=new Set();for(const _0x1c15ee of _0x445625['model']['document']['differ']['getChanges']()){let _0xb38ad1='',_0x13c65c=null;if('insert'===_0x1c15ee['type'])_0x13c65c=new _0x5677e3(_0x1c15ee['position'],_0x1c15ee['position']['getShiftedBy'](_0x1c15ee['length'])),_0xb38ad1=_0x1c15ee['position']['root']['rootName']+':'+_0x1c15ee['position']['path'][0x0];else{if('remove'!==_0x1c15ee['type'])continue;_0x13c65c=new _0x5677e3(_0x1c15ee['position']),_0xb38ad1=_0x1c15ee['position']['root']['rootName']+':'+_0x1c15ee['position']['path'][0x0];}const _0x238600=_0x2fe9e3['get'](_0xb38ad1)||[];if(_0x238600['length']){for(const _0x34ff67 of _0x238600)if(_0x13c65c['root']['rootName']===_0x34ff67['getRange']()['root']['rootName']&&('insert'!==_0x1c15ee['type']||!_0x13c65c['containsRange'](_0x34ff67['getRange']()))&&(_0x13c65c['isIntersecting'](_0x34ff67['getRange']())||_0x13c65c['start']['isTouching'](_0x34ff67['getRange']()['end'])||_0x13c65c['end']['isTouching'](_0x34ff67['getRange']()['start']))){const _0x5401de=this['_parseMarkerName'](_0x34ff67['name']);Array['from'](this['_markers']['values']())['filter'](_0x13428d=>_0x13428d['groupId']===_0x5401de['groupId'])['forEach'](_0x51897d=>_0x3966a2['add'](_0x51897d['id']));}}}if(_0x3966a2['size']){for(const _0x22bec4 of _0x3966a2)_0x5bb644['removeMarker'](_0x22bec4);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x3c89e4){for(const {name:_0x3a23ce,data:_0x5e3507}of _0x3c89e4['model']['document']['differ']['getChangedMarkers']()){if(!_0x3a23ce['startsWith'](rh))continue;const _0x51e93e=_0x5e3507['oldRange'],_0x28ff79=_0x5e3507['newRange'],_0x35b18f=_0x51e93e&&'$graveyard'===_0x51e93e['root']['rootName'],_0x2d979e=_0x28ff79&&'$graveyard'===_0x28ff79['root']['rootName'];if(_0x35b18f&&_0x2d979e)continue;const _0x42e231=this['_parseMarkerName'](_0x3a23ce);this['_markers']['get'](_0x3a23ce)&&(_0x2d979e||!_0x28ff79?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3a23ce,'changeId':_0x42e231['groupId']}):_0x35b18f&&_0x28ff79&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x3a23ce,'changeId':_0x42e231['groupId']}));}}['_parseMarkerName'](_0x1dd127){const _0x4b9d41=_0x1dd127['split'](':'),_0x434038=(_0x4b9d41[0x1]||'')['split']('_');return{'prefix':_0x4b9d41[0x0],'groupId':_0x434038[0x0],'suffix':_0x434038[0x1]};}['_translateOperationToEditorContent'](_0x331709,_0x37b043,_0x4119a7){if('insert'===_0x331709['type']){const _0x57db22=_0x331709;return new _0x49bd28(this['_changePosition'](_0x37b043['concat'](_0x57db22['position']['offset']),_0x4119a7),_0x57db22['nodes'],_0x57db22['baseVersion']);}if('marker'===_0x331709['type']&&_0x331709['name']['startsWith']('$markedRemove')){const _0x4954c0=_0x331709;return new _0x2831e3(_0x4954c0['name'],_0x4954c0['oldRange'],this['_changeRange'](_0x4954c0['newRange'],_0x37b043['concat'](_0x4954c0['newRange']['start']['offset']),_0x37b043['concat'](_0x4954c0['newRange']['end']['offset']),_0x4119a7),_0x4954c0['_markers'],_0x4954c0['affectsData'],_0x4954c0['baseVersion']);}return _0x331709;}['_groupAdjacentOperations'](_0x243e6b){if(!_0x243e6b['length'])return[];const _0x439f3c=[];let _0x3ceff4=0x0,_0x298129=0x0,_0xc4ae12=[];for(let _0x487a38=0x0;_0x487a38<=_0x243e6b['length'];_0x487a38++){const _0x55aa65=_0x243e6b[_0x487a38],_0x506687=_0x243e6b[_0x487a38-0x1];!_0x55aa65||_0x506687&&!this['_getOperationEnd'](_0x506687)['isTouching'](this['_getOperationStart'](_0x55aa65))?(_0x439f3c['push']({'operations':_0xc4ae12,'operationsIsolated':_0xc4ae12['map'](_0x113df7=>this['_shiftOperation'](_0x113df7['clone'](),-_0x298129)),'groupOffset':_0x3ceff4}),_0xc4ae12=_0x55aa65?[_0x55aa65]:[],_0x298129+=_0x3ceff4,_0x3ceff4=0x0):_0xc4ae12['push'](_0x55aa65),_0x55aa65&&'insert'===_0x55aa65['type']&&(_0x3ceff4+=_0x55aa65['howMany']);}return _0x439f3c;}['_findAdjacentContextDistance'](_0x10a758,_0xf86165,_0x56e0cc,_0x3a9ce8=0x1){const _0x21fe40=new _0x28a378({'startPosition':_0x10a758,'direction':_0xf86165});let _0x13732d=0x0;for(let _0x195b31=0x0;_0x195b31<_0x3a9ce8;_0x195b31++){let _0x8f8d4b=0x0,_0x3e40a5=!0x1,_0x2d877c='forward'===_0xf86165?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x4edc71}of _0x21fe40)if(_0x4edc71['is']('$textProxy')){const _0xac6731=_0x2d877c['exec'](_0x4edc71['data']);if(_0xac6731&&_0xac6731['length']){if(_0x8f8d4b+='forward'===_0xf86165?_0xac6731['index']+_0xac6731[0x0]['length']:_0x4edc71['data']['length']-_0xac6731['index'],_0xac6731[0x0]['length']!==_0x4edc71['data']['length'])break;_0x3e40a5=!0x0,_0x2d877c='forward'===_0xf86165?/^\w+/:/\w+$/;}else{if(_0x3e40a5)break;_0x8f8d4b+=_0x4edc71['offsetSize'];}}else{if(_0x4edc71['is']('element')){_0x56e0cc['isInline'](_0x4edc71)&&!_0x3e40a5&&(_0x8f8d4b+=0x1);break;}}_0x13732d+=_0x8f8d4b,_0x21fe40['jumpTo'](_0x10a758['getShiftedBy']('forward'===_0xf86165?_0x13732d:-_0x13732d));}return _0x13732d;}['_getChangeContext'](_0x4167aa,_0x280c24,_0x2850b1){const _0x40da8f=_0x2850b1['model']['schema'],_0x58586e=this['_findAdjacentContextDistance'](_0x4167aa,'backward',_0x40da8f,0x6),_0x19623a=this['_findAdjacentContextDistance'](_0x280c24,'forward',_0x40da8f,0x6),_0x41b3e0=_0x4167aa['getShiftedBy'](-_0x58586e),_0x361077=_0x280c24['getShiftedBy'](_0x19623a);return{'start':_0x41b3e0,'end':_0x361077,'hasContentBefore':!_0x41b3e0['isAtStart'],'hasContentAfter':!_0x361077['isAtEnd']};}['_insertMarkers'](_0x115b64,_0x502e20){const _0xbb4836=this['context']['plugins']['get']('AIEditing'),_0x4a47b2=new Set();_0x502e20['model']['change'](_0x47220d=>{for(const _0x5083ff of _0x115b64){const _0x50908a=''+rh+_0x5083ff['type']+':'+_0x5083ff['groupId']+'_'+_0xbb4836['_nextDataId'](_0x4a47b2);this['_markers']['set'](_0x50908a,{'id':_0x50908a,'groupId':_0x5083ff['groupId'],'type':_0x5083ff['type'],'content':_0x5083ff['content'],'editor':_0x502e20}),_0x47220d['addMarker'](_0x50908a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x47220d['createRange'](_0x5083ff['start'],_0x5083ff['end'])});}});}['_createGetContextFn'](_0x240cc0,_0x3ecd18,_0x27c8bf){let _0x15a081='';return()=>{if(!_0x15a081){const _0x56640d=_0x3ecd18['toView'](_0x240cc0,{'showSuggestionHighlights':!0x0});let _0xd6e3b1=_0x56640d['getChild'](0x0);if(_0xd6e3b1['is']('containerElement')||(_0xd6e3b1=_0x56640d),!_0xd6e3b1)return'';let _0x22172a=!0x1;const _0x531369=[];for(const _0x4f580d of _0xd6e3b1['getChildren']())_0x4f580d['is']('element','span')&&_0x4f580d['hasClass']('ck-ai_review-marker_context-end')&&(_0x22172a=!0x1),_0x22172a&&_0x531369['push'](_0x4f580d),_0x4f580d['is']('element','span')&&_0x4f580d['hasClass']('ck-ai_review-marker_context-start')&&(_0x22172a=!0x0);_0xd6e3b1['_removeChildren'](0x0,_0xd6e3b1['childCount']),_0x27c8bf?.['ellipsisBefore']&&_0xd6e3b1['_appendChild']('…'),_0xd6e3b1['_appendChild'](_0x531369),_0x27c8bf?.['ellipsisAfter']&&_0xd6e3b1['_appendChild']('…');const _0x3a030f=_0x3ecd18['htmlProcessor']['domConverter']['viewToDom'](_0x56640d),_0x24728a=_0x3ecd18['htmlProcessor']['htmlWriter']['getHtml'](_0x3a030f);_0x15a081=this['_removeUnsupportedElements'](_0x24728a);}return _0x15a081;};}['_createGetContentFn'](_0x25e707,_0x5989fb){let _0x5adbb7='';return()=>(_0x5adbb7||(_0x5adbb7=this['_removeUnsupportedElements'](_0x5989fb['stringify'](_0x25e707,{'showSuggestionHighlights':!0x0}))),_0x5adbb7);}['_createGetContentUsingDataIdFn'](_0x5aa604,_0x5af14c,_0x42ca25){let _0x11262e='';return()=>{if(!_0x11262e){const _0x42fbca=_0x42ca25['toView'](new _0x322aab(_0x5aa604));_0x11262e=_0x42ca25['htmlProcessor']['domConverter']['viewToDom'](_0x42fbca)['querySelector']('[data-id=\x22'+_0x5af14c+'\x22]')?.['outerHTML']||'';}return _0x11262e;};}['_removeUnsupportedElements'](_0xf2e8e8){if(!_0xf2e8e8)return'';const _0x1ee566=Is(_0xf2e8e8,{'decodeEntities':!0x1}),_0x11cfc0=Ts(_0x1ee566);if(!_0x11cfc0['length'])return _0xf2e8e8;for(const _0x420fcc of _0x11cfc0)_0x505dba(_0x420fcc);return ps(_0x1ee566,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x3382a8,_0x5c2449){const _0x34cd78=Is(_0x3382a8,{'decodeEntities':!0x1}),_0x4b0543=Is(_0x5c2449,{'decodeEntities':!0x1}),_0x22957e=Ts(_0x34cd78),_0x4ed009=Ts(_0x4b0543);if(!_0x22957e['length']&&!_0x4ed009['length'])return{'contentInitial':_0x3382a8,'contentNew':_0x5c2449};const _0x7b06c6=new Map();for(const _0x363745 of _0x22957e)_0x7b06c6['set'](Cs(_0x363745,'data-id'),_0x363745);for(const _0x412a01 of _0x4ed009){const _0x1b8475=Cs(_0x412a01,'data-id'),_0x418aac=_0x1b8475?_0x7b06c6['get'](_0x1b8475):void 0x0;_0x418aac?_0x50261f(_0x412a01,_0x5bc24e(_0x418aac,!0x0)):_0x505dba(_0x412a01);}return{'contentInitial':ps(_0x34cd78,{'encodeEntities':!0x1}),'contentNew':ps(_0x4b0543,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x30c8b6,_0x22d4ff=0x5){let _0x1c03ae=_0x30c8b6,_0x311a7f=null;for(let _0x4a8727=0x0;_0x4a8727<_0x22d4ff&&_0x1c03ae;_0x4a8727++)if(_0x1c03ae['className']){if((''+_0x1c03ae['className'])['includes']('ck-ai_review-marker_')){if(!_0x1c03ae['getAttribute']('data-marker-id'))break;_0x311a7f=_0x1c03ae;break;}_0x1c03ae=_0x1c03ae['parentElement'];}else _0x1c03ae=_0x1c03ae['parentElement'];return _0x311a7f;}['_findMarkerElementById'](_0x175ac8){const _0x24a364=this['_markers']['get'](_0x175ac8);if(!_0x24a364)return null;const _0x32ca93=_0x24a364['editor']['model']['markers']['get'](_0x175ac8);return _0x32ca93?_0x3fe9cc(_0x24a364['editor']['editing'],_0x32ca93):null;}['_getMarkersDataForGroup'](_0x3b1851){return Array['from'](this['_markers']['values']())['filter'](_0x727f05=>_0x727f05['groupId']===_0x3b1851);}['_getOperationStart'](_0x20c0a1){return'insert'===_0x20c0a1['type']?_0x20c0a1['position']:_0x20c0a1['newRange']['start'];}['_getOperationEnd'](_0x111a4d,_0x4e9833=!0x1){return'insert'===_0x111a4d['type']?_0x4e9833?_0x111a4d['position']:_0x111a4d['position']['getShiftedBy'](_0x111a4d['howMany']):_0x111a4d['newRange']['end'];}['_shiftOperation'](_0xb86942,_0x2af436){return'insert'===_0xb86942['type']?_0xb86942['position']=_0xb86942['position']['getShiftedBy'](_0x2af436):'marker'===_0xb86942['type']&&_0xb86942['newRange']&&(_0xb86942['newRange']=new _0x5677e3(_0xb86942['newRange']['start']['getShiftedBy'](_0x2af436),_0xb86942['newRange']['end']['getShiftedBy'](_0x2af436))),_0xb86942;}['_changeOperationOwnerDocument'](_0x534e2f,_0x3e8ba8){'insert'===_0x534e2f['type']?_0x534e2f['position']=this['_changePositionOwnerDocument'](_0x534e2f['position'],_0x3e8ba8):'marker'===_0x534e2f['type']&&_0x534e2f['newRange']&&(_0x534e2f['newRange']=this['_changeRangeOwnerDocument'](_0x534e2f['newRange'],_0x3e8ba8));}['_changePositionOwnerDocument'](_0x2f38f1,_0x595cc5){return new _0x1e3dd8(_0x595cc5,_0x2f38f1['path']);}['_changeRangeOwnerDocument'](_0x2a8ce7,_0x2a2ece){return new _0x5677e3(this['_changePositionOwnerDocument'](_0x2a8ce7['start'],_0x2a2ece),this['_changePositionOwnerDocument'](_0x2a8ce7['end'],_0x2a2ece));}['_changePosition'](_0x587d5f,_0x54cab9){return new _0x1e3dd8(_0x54cab9,[..._0x587d5f]);}['_changeRange'](_0x55a4d6,_0x8d94b6,_0x1968e9,_0x14d681){return new _0x5677e3(this['_changePosition'](_0x8d94b6,_0x14d681),this['_changePosition'](_0x1968e9,_0x14d681));}['_sortMarkers'](_0x54af7f){const _0x2ddf30=_0xe3ddea=>{switch(_0xe3ddea){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x54af7f['sort']((_0x831c2f,_0x1e423f)=>_0x2ddf30(_0x831c2f['type'])-_0x2ddf30(_0x1e423f['type']));}['_hasSameTopLevelElement'](_0x2a03a7,_0x4eb5ef){const _0x29f8aa=_0x2a03a7['getChild'](0x0),_0x5369b8=_0x4eb5ef['getChild'](0x0);return!(!_0x29f8aa||!_0x5369b8)&&((!_0x29f8aa['is']('element')||!_0x5369b8['is']('element')||_0x29f8aa['name']===_0x5369b8['name'])&&!(_0x29f8aa['is']('element')&&!_0x5369b8['is']('element')||!_0x29f8aa['is']('element')&&_0x5369b8['is']('element')));}['_haveSingleTopLevelElement'](_0x2eb2be){return 0x1===_0x2eb2be['childCount'];}['_haveOnlyInlineContent'](_0x3506dd,_0x3b5237){for(const _0x1f94c0 of _0x3506dd['getChildren']())if(_0x1f94c0['is']('element')&&!_0x3b5237['isInline'](_0x1f94c0))return!0x1;return!0x0;}['_upsertDataId'](_0x35f690,_0x510bef){let _0x4922eb=_0x35f690['getAttribute'](_0x98c166);return _0x4922eb||(_0x4922eb=_0x510bef(),_0x35f690['_setAttribute'](_0x98c166,_0x4922eb)),_0x4922eb;}};const ch=/* #__PURE__ -- @preserve */
38
+ lt();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x3ee3e8,contentNew:_0x2f20bd,contentInitial:_0x3d2a8b,documentVersion:_0x9c0636}){super(),this['id']=_0x3ee3e8,this['contentNew']=_0x2f20bd,this['contentInitial']=_0x3d2a8b,this['documentVersion']=_0x9c0636;}};const uh=/* #__PURE__ -- @preserve */
39
+ _t();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x253637,_0x622e81,_0x1f578b){super(),this['id']=_0x253637,this['parent']=_0x1f578b,this['_data']=_0x622e81,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
+ _t();var gh=class extends _h{['id']=Ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x131504,_0xfdc1b4,_0x12f5be,_0xa3afcd,_0x3b8be7){super(),this['_sourceCheck']=_0xfdc1b4,this['_documentData']=_0x131504,this['_aiConnector']=_0x12f5be,this['_reviewParams']=_0xa3afcd,this['_reviewArgs']=_0x3b8be7,this['on']('change:status',(_0x1894b3,_0x50e943,_0x5e12e5)=>{'aborted'==_0x5e12e5&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x5e12e5,'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'](_0x5115a1=>'pending'===_0x5115a1['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x5aebef){this['_documentData']=_0x5aebef;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x4c82bc=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x5d964a of _0x4c82bc)'unmodified'!==_0x5d964a['data']['operation']&&('error'!==_0x5d964a['data']['operation']?'review-metadata'!==_0x5d964a['event']?this['_addReviewCheckResult'](_0x5d964a['data']['dataId'],_0x5d964a['data']['textDelta']):this['callId']=_0x5d964a['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(_0x113235){this['_currentError']=_0x113235,sn(_0x113235)?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'](_0x4775fc,_0x46743d){const _0x5cb2f7=this['_results']['get'](_0x4775fc);if(!_0x5cb2f7)return;if(0x0===_0x46743d['length'])return;const _0x3510dd=[];_0x46743d['forEach']((_0x31b058,_0x49f120)=>{const _0xa3c046=new dh(_0x5cb2f7['id']+'-'+_0x49f120,_0x31b058,_0x5cb2f7);_0xa3c046['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0xa3c046,'status':_0xa3c046['status']});}),_0xa3c046['on']('change:isActivated',()=>{_0xa3c046['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0xa3c046}):this['fire']('reviewCheckResultDeactivated',{'change':_0xa3c046});}),this['_changes']['push'](_0xa3c046),_0x3510dd['push'](_0xa3c046);}),this['fire']('reviewCheckResultReady',{'changes':_0x3510dd,'result':_0x5cb2f7,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x27286f){const _0x282cc3=this['_changes']['find'](_0xaa989f=>_0xaa989f['id']===_0x27286f);return!(!_0x282cc3||'pending'!==_0x282cc3['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x37a826=>!0x0===_0x37a826['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x5d3ed6=>'pending'===_0x5d3ed6['status']);}['getChangeById'](_0x20bc97){return this['_changes']['find'](_0x4408e8=>_0x4408e8['id']===_0x20bc97);}['markAllChangesAsAccepted'](){for(const _0x46930c of this['_changes'])'pending'===_0x46930c['status']&&(_0x46930c['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x5defcc){const _0x22b434=this['_changes']['find'](_0x13de41=>_0x13de41['id']===_0x5defcc);_0x22b434&&'pending'===_0x22b434['status']&&(_0x22b434['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x42a11f){const _0x3837b2=this['_changes']['find'](_0x329723=>_0x329723['id']===_0x42a11f);_0x3837b2&&'pending'===_0x3837b2['status']&&(_0x3837b2['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x1cf95e){const _0x1b19d2=this['_changes']['find'](_0x171349=>_0x171349['id']===_0x1cf95e);_0x1b19d2&&'pending'===_0x1b19d2['status']&&(_0x1b19d2['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x3ad60){const _0x3a6445=this['_changes']['find'](_0x118344=>_0x118344['id']===_0x3ad60);_0x3a6445&&'outdated'===_0x3a6445['status']&&(_0x3a6445['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x29b3bf){this['_changes']['filter'](_0x4d3f5e=>_0x4d3f5e['isActivated']&&_0x4d3f5e['id']!==_0x29b3bf)['forEach'](_0x4ff614=>{_0x4ff614['isActivated']=!0x1;});const _0x1d562a=this['_changes']['find'](_0x25aa7c=>_0x25aa7c['id']===_0x29b3bf);_0x1d562a&&'pending'===_0x1d562a['status']&&(_0x1d562a['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x505b46=>_0x505b46['isActivated'])['forEach'](_0x3c4ef1=>{_0x3c4ef1['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0xf53265){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x4aa4a6;if(_0xf53265){const _0x2f2ea8=this['_changes']['find'](_0x56ce37=>_0x56ce37['id']===_0xf53265);if(_0x2f2ea8&&_0x2f2ea8['isRated'])return;_0x2f2ea8&&(_0x4aa4a6=_0x2f2ea8['parent']['id'],_0x2f2ea8['isRated']=!0x0);}const _0x4b5d52={'positiveCount':this['_changes']['filter'](_0x164c03=>'accepted'===_0x164c03['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x4b5d52,this['callId'],_0x4aa4a6);}['_addReviewCheckResult'](_0x38e60e,_0x37d88c){const _0x6f6f0b=this['_documentData']['elements']['get'](_0x38e60e);if(!_0x6f6f0b)return;const _0x3fc15c=_0x6f6f0b['getContent']();if(_0x3fc15c===_0x37d88c)return;const _0x249694=new lh({'id':_0x38e60e,'contentInitial':_0x3fc15c,'contentNew':_0x37d88c,'documentVersion':_0x6f6f0b['documentVersion']});this['_results']['set'](_0x249694['id'],_0x249694),this['fire']('reviewCheckResultAdded',{'result':_0x249694,'source':this,'editor':_0x6f6f0b['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x2c232a=>'pending'===_0x2c232a['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x1b868b=>'pending'===_0x1b868b['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5c2f03=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x578444=0x0;_0x578444<this['_reviewParams']['length'];_0x578444++){if(!this['_reviewParams'][_0x578444]||!this['_sourceCheck']['options'][_0x578444])continue;const _0x10183e=this['_sourceCheck']['options'][_0x578444]['data']?.['find'](_0x10e24e=>_0x10e24e['id']===this['_reviewParams'][_0x578444]);_0x10183e&&_0x5c2f03['push'](_0x10183e['label']);}return _0x5c2f03['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x7de8f3,_0x99eae,_0x3abccc){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x99eae,_0x7de8f3,_0x3abccc);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x59670e{['_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',(_0x5dc96e,_0xaa25f1)=>this['runCheck'](_0xaa25f1)),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 _0x11e9f5=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x11e9f5['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x11e9f5['map'](_0x5484c0=>_0x5484c0['id']),this['_aiSource']);const _0x1b993f=this['_currentReviewCheckRun'];_0x1b993f['markAllChangesAsAccepted'](),_0x1b993f['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x4f49a3,_0x2db8f9)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x2db8f9['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x2db8f9['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x2db8f9['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x2db8f9['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x47bbec,_0x5537ed)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5537ed['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5537ed['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5537ed['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5537ed['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',(_0xf5095d,_0x5b6ff8)=>{this['_onActivateChange'](_0x5b6ff8);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0xc8a427,_0x4a5284)=>{this['_onDeactivateChange'](_0x4a5284);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x514c6e,_0x30461c)=>{this['_onChangeMarkerClicked'](_0x514c6e,_0x30461c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x1504a3,_0x37685b)=>{this['_onChangeMarkerHovered'](_0x1504a3,_0x37685b);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x5e2e16,_0x1be004)=>{this['_onChangeMarkerRemoved'](_0x5e2e16,_0x1be004);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x367387,_0x42e976)=>{this['_onChangeMarkerRestored'](_0x367387,_0x42e976);});}async['runCheck'](_0x306f4c){if(!this['_availableReviewChecks'])return;const _0x5e9cef=this['_availableReviewChecks']['find'](_0x3356ed=>_0x3356ed['id']===_0x306f4c['id']);if(_0x5e9cef){this['_onReviewCheckRun'](_0x306f4c),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x306f4c,_0x5e9cef),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0xaa0e37,_0x2982b4)=>{switch(_0x2982b4['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x2982b4);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 at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('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'!==_0x2982b4['status']&&'error-chunk'!==_0x2982b4['status']&&'error-general'!==_0x2982b4['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x1eb80a,_0x15d512)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x4bcbfd=this['_diffContent'](_0x15d512['editor'],_0x15d512['result']['contentInitial'],_0x15d512['result']['contentNew']);_0x15d512['source']['addResultChanges'](_0x15d512['result']['id'],_0x4bcbfd);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x561026,_0x18fd20)=>{for(const _0xfe0288 of _0x18fd20['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0xfe0288);this['_markChangePositionInEditorContent'](_0x18fd20['changes'],_0x18fd20['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x5d2051,_0x53a876)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x53a876['change']['id'],_0x53a876['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x1921d6,_0x5ebb09)=>{this['_onReviewCheckResultActivated'](_0x5ebb09);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x39e793){if(sn(_0x39e793))return;_0x39e793 instanceof at?this['_logError'](_0x39e793):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x39e793));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x306f4c['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x43a04e,_0x212ea1){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x212ea1,this['_aiConnector'],_0x43a04e['params'],_0x43a04e['args']);}['_onChangeMarkerRemoved'](_0x3550bb,_0x2d622c){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2d622c['changeId']);}['_onChangeMarkerRestored'](_0x48ddf0,_0x5c123c){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x5c123c['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x3a0319=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x3a0319&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x34e091 of this['_aiReviewCoreEditing']['getEditors']())_0x34e091['editing']['view']['change'](_0x1f9f8d=>{for(const _0x6fe4e of _0x34e091['editing']['view']['document']['getRoots']())_0x1f9f8d['removeClass']('ck-ai_review-diff',_0x6fe4e),_0x1f9f8d['removeClass']('ck-ai_review-highlights',_0x6fe4e),_0x1f9f8d['removeClass']('ck-ai-translate-mode-content',_0x6fe4e);});}['_logError'](_0x32fcac){this['_reporter']['logError'](_0x32fcac),'ai-review-mode-models-unable-to-retrieve'===function(_0x46dfea){return _0x46dfea instanceof nn?_0x46dfea['code']:_0x46dfea instanceof Error?_0x46dfea['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x32fcac)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x5b4f14){if('content'===this['_changeActivationSource']){const _0x11a399=this['_aiReviewCoreUi']['getChangeElement'](_0x5b4f14);_0x11a399&&bt(_0x11a399['closest']('.ck-ai_review__check-run-result')||_0x11a399);}else{if('panel'===this['_changeActivationSource']){const _0xde375=this['_getChangeContentElement'](_0x5b4f14);if(!_0xde375)return;St({'target':_0xde375,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x330139,_0xa429ac,_0x19c278,_0x1cb407,_0x294cb4){super(_0x19c278,_0x1cb407,_0x294cb4),this['_prompt']=_0x330139,this['_model']=_0xa429ac;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x55cee3,_0x1eaf27,_0x20da28){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x1eaf27,_0x55cee3,_0x20da28);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x18549f){this['id']=_0x18549f['id'],this['commandId']=_0x18549f['commandId'],this['title']=_0x18549f['title'],this['description']=_0x18549f['description'],this['isParameterized']=_0x18549f['isParameterized'],this['useArgs']=_0x18549f['useArgs'],this['options']=_0x18549f['options'],this['args']=_0x18549f['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x505331,_0x5e08ea,_0x1ec0e2){super(_0x505331),this['prompt']=_0x505331['prompt'],this['model']=_0x505331['model'],this['model']?this['_defaultModel']=_0x5e08ea['find'](_0x835669=>_0x835669['id']===this['model'])||null:this['_defaultModel']=_0x1ec0e2;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x58a20e){this['_prompt']=_0x58a20e;}set['model'](_0x583a50){this['_model']=_0x583a50;}},wh=class extends _0x59670e{static get['requires'](){return[cs,rn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](rn)['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
+ _t();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x10f4cd){this['_checks']=_0x10f4cd['map'](_0x5832ad=>new mh(_0x5832ad));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x1977c6){return this['checks']['find'](_0x129ada=>_0x129ada['id']===_0x1977c6);}['removeCheckById'](_0x293e3f){this['_checks']=this['_checks']['filter'](_0x565ffb=>_0x565ffb['id']!==_0x293e3f);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x390b1d,_0x3b24a7,_0x29f796){super(_0x390b1d),this['_models']=_0x3b24a7,this['_defaultModel']=_0x29f796;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x184353,_0x1ea5ce,_0x1ce9b1){super(),this['_allModels']=_0x184353,this['_recommendedModels']=_0x1ea5ce,this['_defaultModel']=_0x1ce9b1;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x422f1e){this['_checks']=_0x422f1e['map'](_0x48e9fb=>!0x0===_0x48e9fb['isExtra']?new Eh(_0x48e9fb,this['_allModels'],this['_defaultModel']):'custom'===_0x48e9fb['id']?new Sh(_0x48e9fb,this['_recommendedModels'],this['_defaultModel']):new mh(_0x48e9fb));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x325c2b){super(_0x325c2b),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5a0527=>({'id':_0x5a0527['id'],'commandId':_0x5a0527['id'],'title':_0x5a0527['label'],'description':_0x5a0527['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5a0527['prompt'],'model':_0x5a0527['model']}));}async['_loadChecksList'](){const _0x24f07c=[...Ch,...this['getExtraChecks']()]['map'](_0x3c2412=>_0x3c2412['isExtra']?_0x3c2412:this['_translateReviewCheck'](_0x3c2412)),_0x3623eb=await this['_getModels'](),_0x15105a=new Rh(_0x3623eb['all'],_0x3623eb['recommended'],_0x3623eb['default']);return _0x15105a['setupChecks'](_0x24f07c),_0x15105a;}async['_getModels'](){const _0x263c72=this['context']['plugins']['get']('AIConnector');try{const _0x19e23d=new Xs({'connector':_0x263c72,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0xdae013={'all':await _0x19e23d['getAll'](),'recommended':await _0x19e23d['getAvailableModels'](),'default':await _0x19e23d['getDefault']()};return this['_modelsLoadError']=null,_0xdae013;}catch(_0x764eeb){return this['_modelsLoadError']=new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x764eeb),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x485177){const _0x4473d3='AI_REVIEW_CHECK_'+_0x485177['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x4d44ed={..._0x485177,'title':this['_translate'](_0x4473d3+'_TITLE',_0x485177['title']),'description':this['_translate'](_0x4473d3+'_DESCRIPTION',_0x485177['description'])};return _0x485177['options']&&(_0x4d44ed['options']=_0x485177['options']['map'](_0x3d0c55=>({..._0x3d0c55,'label':this['_translate'](_0x4473d3+'_OPTIONS_LABEL',_0x3d0c55['label']||''),'data':_0x3d0c55['data']?_0x3d0c55['data']['map'](_0x48b959=>({..._0x48b959,'label':this['_translate'](_0x4473d3+'_OPTIONS_DATA_'+_0x48b959['id']['toUpperCase'](),_0x48b959['label'])})):void 0x0}))),_0x4d44ed;}['_translate'](_0x44038e,_0x258558){const _0x174434=ls(this['context']['locale'],_0x44038e);return _0x174434===_0x44038e?_0x258558:_0x174434;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[rn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x4f352a){super(_0x4f352a),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x3b73c4=>_0x3b73c4['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x6965f0,_0x43a63d)=>{this['_isDiffOn']=_0x43a63d['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x5df473,_0x34530f){if(_0x5df473['isCustom'])return new ph(_0x5df473['args']['prompt'],_0x5df473['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x34530f,this['_aiConnector']);if(_0x34530f['isExtra']){const _0x30dbd4=_0x34530f;return new Th(_0x5df473['args']?.['prompt']??_0x30dbd4['prompt'],_0x5df473['args']?.['model']??_0x30dbd4['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x34530f,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x34530f,this['_aiConnector'],_0x5df473['params'],_0x5df473['args']);}['_onReviewCheckResultActivated'](_0x29f0ad){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x29f0ad['change']['id']),this['_scrollToChange'](_0x29f0ad['change']['id']);const _0x2fe7b9=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x29f0ad['change']['id']);if(!_0x2fe7b9)return;const _0x121493=this['_aiReviewCoreEditing']['getEditorForChange'](_0x29f0ad['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x29f0ad['change'],()=>_0x2fe7b9['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x121493,_0x2fe7b9['modelRange']['root']['rootName']),_0x121493?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x29f0ad['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x356545){this['_currentReviewCheckRun']&&'click'===_0x356545['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x356545['id']));}['_onDeactivateChange'](_0x567557){this['_currentReviewCheckRun']&&'balloon'===_0x567557['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x59bcca,_0x5801c9){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5801c9['changeId']);const _0x2d2e59=this['_currentReviewCheckRun']['getChangeById'](_0x5801c9['changeId']);if(!_0x2d2e59)return;const _0x50b4c6=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5801c9['changeId']),_0x54f1c4=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5801c9['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x2d2e59,_0x5801c9['markerElement'],_0x5801c9['domEvent'],'click',this['_getBalloonDomRoot'](_0x54f1c4,_0x50b4c6?.['modelRange']['root']['rootName']),_0x54f1c4?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x54588e,_0x2c4a5a){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x22c20a=this['_currentReviewCheckRun']['getChangeById'](_0x2c4a5a['changeId']);if(!_0x22c20a)return;const _0x235cd9=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2c4a5a['changeId']),_0x217146=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2c4a5a['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x22c20a,_0x2c4a5a['markerElement'],_0x2c4a5a['domEvent'],'hover',this['_getBalloonDomRoot'](_0x217146,_0x235cd9?.['modelRange']['root']['rootName']),_0x217146?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x85557f){const _0x3a1003=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x85557f);return _0x3a1003?_0x3a1003['getElement']():null;}['_markChangePositionInEditorContent'](_0x37d972,_0x2275ba){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x37d972,_0x2275ba);}['_diffContent'](_0x28cfa1,_0x1ecde8,_0x3721e4){return this['_aiReviewCoreEditing']['diffContent'](_0x28cfa1,_0x1ecde8,_0x3721e4,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0xcb3003){_0xcb3003?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x39729a of this['_aiReviewCoreEditing']['getEditors']())_0x39729a['editing']['view']['change'](_0x1be4b5=>{for(const _0x1bf6ca of _0x39729a['editing']['view']['document']['getRoots']()){for(const _0x502546 of _0x1bf6ca['getClassNames']())_0x502546['startsWith']('ck-ai_review-')&&_0x1be4b5['removeClass'](_0x502546,_0x1bf6ca);_0x1be4b5['addClass'](_0xcb3003?'ck-ai_review-diff':'ck-ai_review-highlights',_0x1bf6ca);}});}['_getBalloonDomRoot'](_0x3aaebd,_0x7b08a3){const _0x23630=_0x3aaebd['editing']['view'];if(_0x7b08a3){const _0x175165=_0x23630['getDomRoot'](_0x7b08a3);if(_0x175165)return _0x175165;}return _0x23630['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x3af9ec=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x1505fd=await _0x3af9ec['getChecksList']();_0x3af9ec['modelsLoadError']&&this['_logError'](_0x3af9ec['modelsLoadError']);let _0x4b2a57=_0x1505fd['checks'];const _0x435582=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x435582,_0x4b2a57),this['_usesAvailableCommandsConfig']&&(_0x4b2a57=_0x435582['map'](_0x4b094a=>_0x4b2a57['find'](_0x137cf5=>_0x137cf5['id']===_0x4b094a))['filter'](_0x502602=>!!_0x502602)),this['_filterChecksWithMissingModel'](_0x4b2a57);}['_logWarningForNonExistentChecks'](_0x4edee3,_0x138d1d){const _0x1f3d46=_0x4edee3['filter'](_0x20def3=>!_0x138d1d['some'](_0x442fc2=>_0x442fc2['id']===_0x20def3));_0x1f3d46['length']&&this['_reporter']['logError'](new nn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x1f3d46['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x11a19b){const _0xc6e08f=[];return _0x11a19b['forEach'](_0x544d74=>{(_0x544d74 instanceof Eh&&!_0x544d74['defaultModel']||_0x544d74 instanceof Sh&&!_0x544d74['models']['length'])&&_0xc6e08f['push'](_0x544d74['id']);}),_0xc6e08f['length']&&_0xc6e08f['forEach'](_0x54f2bb=>{_0x11a19b=_0x11a19b['filter'](_0xeed6d4=>_0xeed6d4['id']!==_0x54f2bb),this['_reporter']['logError'](new nn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x54f2bb}}));}),_0x11a19b;}};function kh(_0x239239,_0x47fc9c,_0x4436de,_0x528a99){return _0x239239 instanceof at?_0x239239:new at(_0x47fc9c,_0x4436de,_0x528a99,_0x239239);}var Nh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0xad227e){this['_affectedBlocks']=_0xad227e;}},yh=class extends _0x59670e{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x5adaba=>{const _0x5172da={'id':_0x5adaba['id'],'title':_0x5adaba['title'],'description':_0x5adaba['description']};return'custom'!==_0x5adaba['id']&&_0x5adaba['options']?.['length']&&(_0x5172da['parameters']=_0x5adaba['options'][0x0]['data']['map'](_0x2121c4=>({..._0x2121c4}))),_0x5172da;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x2eb011,_0x4d5b63){return await this['_runReviewCheck'](_0x2eb011,()=>this['_createReviewCheckRun'](_0x2eb011,_0x4d5b63?.['parameterId']),_0x4d5b63?.['signal']);}async['runCustomReview'](_0x4d8798,_0x20235c){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x4d8798,_0x20235c?.['model']),_0x20235c?.['signal']);}['applyReview'](_0x7c1d1f,_0x311f4e){this['context']['plugins']['get']('AIGateway')['apply'](_0x7c1d1f,{'applyMethod':_0x311f4e,'aiSource':'review'});}async['_runReviewCheck'](_0x418293,_0x80c8e4,_0x4a5070){const _0x5da5ff=ds(this['context']),_0x39d373=new Nh({'editor':_0x5da5ff,'rootName':_0x5da5ff['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x5da5ff['plugins']['get']('AIEditing')['getSessionId'](_0x5da5ff)});let _0x537816,_0x1b2e29;if(_0x4a5070){if(_0x4a5070['aborted'])return _0x39d373['abort'](),_0x39d373;const _0x301612=()=>{_0x39d373['error']||(_0x39d373['abort'](),_0x537816&&_0x537816['abort']());};_0x4a5070['addEventListener']('abort',_0x301612),_0x1b2e29=()=>_0x4a5070['removeEventListener']('abort',_0x301612);}try{_0x537816=await _0x80c8e4(),_0x39d373['contentRawOld']=_0x537816['documentData']['content'],_0x39d373['documentVersion']=Array['from'](_0x537816['documentData']['elements'])['find'](([,_0x1c9bbd])=>_0x1c9bbd['rootName']===_0x39d373['rootName'])?.[0x1]['documentVersion']??0x1,_0x537816['on']('reviewCheckRunUpdated',(_0x458dbd,_0x17c4e3)=>{'aborted'===_0x17c4e3['status']?_0x39d373['abort']():'error-general'!==_0x17c4e3['status']&&'error-chunk'!==_0x17c4e3['status']||(_0x39d373['error']=kh(_0x17c4e3['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x418293}));}),'aborted'!==_0x39d373['status']&&await _0x537816['start']();}catch(_0x47bb5a){_0x39d373['error']=kh(_0x47bb5a,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x418293});}finally{_0x1b2e29&&_0x1b2e29();}if(!_0x537816||'aborted'===_0x39d373['status']||'error'===_0x39d373['status'])return _0x39d373;_0x39d373['affectedBlocks']=_0x537816['results']['map'](_0x3e44c8=>({'id':_0x3e44c8['id'],'content':_0x3e44c8['contentNew']}));try{_0x39d373['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x39d373['affectedBlocks'],_0x39d373['contentRawOld'],_0x39d373['editor']));}catch(_0x4fa37e){_0x39d373['error']=kh(_0x4fa37e,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x418293});}return _0x39d373;}async['_createReviewCheckRun'](_0x237bb2,_0x25c12d){const _0x558eb4=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0xf95493=>_0xf95493['id']===_0x237bb2);if(!_0x558eb4)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x237bb2});if(_0x558eb4 instanceof Sh)throw new at('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x237bb2});const _0x429716=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0xb44b34=this['context']['plugins']['get']('AIConnector');if(_0x558eb4 instanceof Eh){if(!_0x558eb4['defaultModel']?.['id'])throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x237bb2});return new Th(_0x558eb4['prompt'],_0x558eb4['defaultModel']['id'],_0x429716,_0x558eb4,_0xb44b34);}return new Ah(_0x429716,_0x558eb4,_0xb44b34,_0x25c12d?[_0x25c12d]:void 0x0);}async['_createCustomReviewCheckRun'](_0x1734c7,_0x28447f,_0x2c3aed){const _0x2e50a9=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x5e432e=>_0x5e432e['id']===_0x1734c7);if(!_0x2e50a9)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x1734c7});if(!(_0x2e50a9 instanceof Sh))throw new at('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x1734c7});const _0x2922e9=_0x2c3aed??_0x2e50a9['defaultModel']?.['id'];if(!_0x28447f)throw new at('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x1734c7});if(!_0x2922e9)throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x1734c7});return new ph(_0x28447f,_0x2922e9,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2e50a9,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x59670e{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'](_0x545aec,_0x3b7452){if(this['assertStartReviewPreconditions'](_0x545aec)instanceof Sh)throw new at('ai-reviewmode-not-a-system-command',this,{'commandId':_0x545aec});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x545aec,'params':_0x3b7452?.['parameterId']?[_0x3b7452['parameterId']]:void 0x0});}async['startCustomReview'](_0x32c9ef,_0x257344){if(!_0x32c9ef)throw new at('ai-reviewmode-missing-custom-command-prompt',this);const _0x42d6e5=Ch['find'](_0x43b478=>'custom'===_0x43b478['commandId'])['id'],_0xe88524=this['assertStartReviewPreconditions'](_0x42d6e5),_0x4c33aa=_0x257344?.['model']??_0xe88524['defaultModel']?.['id'];if(!_0x4c33aa)throw new at('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x42d6e5,'isCustom':!0x0,'args':{'prompt':_0x32c9ef,'model':_0x4c33aa}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x3b043d=>{const _0x299dd9={'id':_0x3b043d['id'],'title':_0x3b043d['title'],'description':_0x3b043d['description']};return'custom'!==_0x3b043d['id']&&_0x3b043d['options']?.['length']&&(_0x299dd9['parameters']=_0x3b043d['options'][0x0]['data']['map'](_0x91a9dd=>({..._0x91a9dd}))),_0x299dd9;});}['assertStartReviewPreconditions'](_0x12b0bd){const _0x5d62ae=this['context']['plugins']['get']('AIReviewModeController');if(_0x5d62ae['getCurrentCheckRun']())throw new at('ai-reviewmode-review-already-running',this);const _0x2f32a7=_0x5d62ae['getAvailableChecks']()['find'](_0x19becf=>_0x19becf['id']===_0x12b0bd);if(!_0x2f32a7)throw new at('ai-reviewmode-unknown-command',this,{'commandId':_0x12b0bd});return _0x2f32a7;}},Lh=class extends Ah{['_title'];constructor(_0x16fd95,_0x4c530e,_0x3de635,_0x809739,_0x4d4858,_0x4d72e6){super(_0x16fd95,_0x4c530e,_0x3de635,_0x4d4858,_0x4d72e6),this['_title']=_0x809739;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0xa41d22){this['_checks']=_0xa41d22['map'](_0x409ca6=>new Dh(_0x409ca6));}};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(_0x4d4770){super(_0x4d4770),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x3adb81=[],_0x2295d9=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x426d87 of _0x2295d9)_0x3adb81['push']({'title':_0x426d87['label'],'id':_0x426d87['id'],'commandId':_0x426d87['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x426d87['id']}});const _0x45c0d6=new Ph();return _0x45c0d6['setupChecks'](this['_translateChecks'](_0x3adb81)),_0x45c0d6;}['_translateChecks'](_0x2d8110){const _0x33d202=this['context']['locale'];return _0x2d8110['map'](_0x108281=>{const _0x47cfe2='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x108281['title']['toUpperCase']()['replaceAll']('-','_'),_0x3d1a12=ls(_0x33d202,_0x47cfe2);return{..._0x108281,'title':_0x3d1a12===_0x47cfe2?_0x108281['title']:_0x3d1a12};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[rn,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'](_0xb3ce4,_0x1f9a66){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1f9a66,this['_aiConnector'],ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0xb3ce4['params'],_0xb3ce4['args']);}['_onReviewCheckResultActivated'](_0x4a8f8d){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x4a8f8d['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x4a8f8d['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x20230f){this['_currentReviewCheckRun']&&('hover'===_0x20230f['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x20230f['id'])),'click'===_0x20230f['uiInteraction']&&this['_scrollToChange'](_0x20230f['id']));}['_onDeactivateChange'](_0x41f8df){this['_currentReviewCheckRun']&&'panel'===_0x41f8df['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x181a19,_0x5e5f8c){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5e5f8c['changeId']),this['_scrollToChange'](_0x5e5f8c['changeId']));}['_onChangeMarkerHovered'](_0x228386,_0x5c058a){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5c058a['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x5c058a['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x404503){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x404503);}['_markChangePositionInEditorContent'](_0x5c9fdb,_0x14209e){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x5c9fdb,_0x14209e);}['_diffContent'](_0x50017c,_0x3cdc01,_0x3808e3){return this['_aiReviewCoreEditing']['diffContent'](_0x50017c,_0x3cdc01,_0x3808e3,!0x0);}['_onReviewCheckRun'](){for(const _0x312319 of this['_aiReviewCoreEditing']['getEditors']())_0x312319['editing']['view']['change'](_0x42be98=>{for(const _0x1686e2 of _0x312319['editing']['view']['document']['getRoots']())_0x42be98['addClass']('ck-ai-translate-mode-content',_0x1686e2);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0xb3ee4f,_0x2806ac){super(_0xb3ee4f,_0x2806ac),this['on']('set:isLoading',(_0x4ef154,_0x4d7f47,_0x582b01)=>{_0x582b01&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0xa03b98,_0x51409f,_0x479e95)=>{_0x479e95&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x1aa335=super['_createAcceptAllButtonView']();return _0x1aa335['set']('label',ls(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x1aa335;}['_createExitReviewButtonView'](){const _0x5b5cdf=super['_createExitReviewButtonView']();return _0x5b5cdf['set']('label',ls(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x5b5cdf;}},Bh=class extends sh{['_setupTemplate'](){const _0x267077=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x267077['if']('isVisible','ck-hidden',_0x1058a1=>!_0x1058a1)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x267077['if']('isVisible','ck-hidden',_0x146da1=>!_0x146da1)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x3b52e2=this['context']['plugins']['get']('AITabs'),_0x4f82df=this['context']['locale'],_0x155beb=new Ho(_0x4f82df,{'label':ls(_0x4f82df,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x4b87f0,'class':'ck-ai-header_review-translate','showResizeButton':_0x3b52e2['showResizeButton']});_0x155beb['delegate']('resizeTabs')['to'](_0x3b52e2),_0x155beb['bind']('isMaximized')['to'](_0x3b52e2['view'],'isMaximized',_0xf56f7c=>_0xf56f7c);const _0x2aafac=new $a(_0x4f82df,{'header':_0x155beb,'list':new Bh(_0x4f82df),'results':new Uh(_0x4f82df,{'generalErrorText':ls(_0x4f82df,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x4f82df,{'headerText':ls(_0x4f82df,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':ls(_0x4f82df,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x4f82df,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2aafac['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2aafac;}['registerTab'](){const _0x3832ec=this['context']['plugins']['get']('AITabs');_0x3832ec['view']['on']('activateTab',(_0x274ea4,{newTab:_0x8bce9a,oldTab:_0x1e58f0})=>{'translate'===_0x8bce9a?this['fire']('getReviewCheckList'):'translate'===_0x1e58f0&&this['fire']('leaveReview');}),_0x3832ec['view']['addTab']({'id':'translate','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x4b87f0,'order':0x0,'content':this['_mainView']});}},Fh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x1fe7d3){this['_affectedBlocks']=_0x1fe7d3;}},Kh=class extends _0x59670e{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0xfc2abf,_0x3f2f85){return await this['_runTranslateCheck'](_0xfc2abf,()=>this['_createTranslateCheckRun'](_0xfc2abf),_0x3f2f85?.['signal']);}['applyTranslate'](_0x328a32,_0x4f57f9){this['context']['plugins']['get']('AIGateway')['apply'](_0x328a32,_0x4f57f9);}async['_runTranslateCheck'](_0xaa9f6,_0x2648e0,_0xf782ee){const _0x1db618=ds(this['context']),_0xb10e34=new Fh({'editor':_0x1db618,'rootName':_0x1db618['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x1db618['plugins']['get']('AIEditing')['getSessionId'](_0x1db618)});let _0x1cb1d7,_0x2c1bf8;if(_0xf782ee){if(_0xf782ee['aborted'])return _0xb10e34['abort'](),_0xb10e34;const _0x38b5e9=()=>{_0xb10e34['error']||(_0xb10e34['abort'](),_0x1cb1d7&&_0x1cb1d7['abort']());};_0xf782ee['addEventListener']('abort',_0x38b5e9),_0x2c1bf8=()=>_0xf782ee['removeEventListener']('abort',_0x38b5e9);}try{_0x1cb1d7=await _0x2648e0(),_0xb10e34['contentRawOld']=_0x1cb1d7['documentData']['content'],_0xb10e34['documentVersion']=Array['from'](_0x1cb1d7['documentData']['elements'])['find'](([,_0x1e974a])=>_0x1e974a['rootName']===_0xb10e34['rootName'])?.[0x1]['documentVersion']??0x1,_0x1cb1d7['on']('reviewCheckRunUpdated',(_0xb6cdd2,_0x33713e)=>{'aborted'===_0x33713e['status']?_0xb10e34['abort']():'error-general'!==_0x33713e['status']&&'error-chunk'!==_0x33713e['status']||(_0xb10e34['error']=kh(_0x33713e['error'],'ai-translategateway-translation-run-failed',this,{'language':_0xaa9f6}));}),'aborted'!==_0xb10e34['status']&&await _0x1cb1d7['start']();}catch(_0x457fb8){_0xb10e34['error']=kh(_0x457fb8,'ai-translategateway-translation-run-failed',this,{'language':_0xaa9f6});}finally{_0x2c1bf8&&_0x2c1bf8();}if(!_0x1cb1d7||'aborted'===_0xb10e34['status']||'error'===_0xb10e34['status'])return _0xb10e34;_0xb10e34['affectedBlocks']=_0x1cb1d7['results']['map'](_0x53cc69=>({'id':_0x53cc69['id'],'content':_0x53cc69['contentNew']}));try{_0xb10e34['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0xb10e34['affectedBlocks'],_0xb10e34['contentRawOld'],_0xb10e34['editor']));}catch(_0x149986){_0xb10e34['error']=kh(_0x149986,'ai-translategateway-translation-run-failed',this,{'language':_0xaa9f6});}return _0xb10e34;}async['_createTranslateCheckRun'](_0x15571f){const _0x5734ef=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x3c0ee3=this['context']['plugins']['get']('AIConnector');return new Lh(_0x5734ef,new Dh({'id':_0x15571f,'commandId':_0x15571f,'title':_0x15571f,'description':'','isParameterized':!0x1}),_0x3c0ee3,ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x15571f});}},Wh=class extends _0x59670e{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'](_0x46a1d2){const _0x234bf5=this['assertStartTranslatePreconditions'](_0x46a1d2);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x234bf5['id'],'args':_0x234bf5['useArgs']?_0x234bf5['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x10b4a9=>({'id':_0x10b4a9['id'],'label':_0x10b4a9['title']}));}['assertStartTranslatePreconditions'](_0x255539){const _0x1f2040=this['context']['plugins']['get']('AITranslateController');if(_0x1f2040['getCurrentCheckRun']())throw new at('ai-translate-translation-already-running',this);const _0x2bdafe=_0x1f2040['getAvailableChecks']()['find'](_0x4fe570=>_0x4fe570['id']===_0x255539);if(!_0x2bdafe)throw new at('ai-translate-unknown-language',this,{'languageId':_0x255539});return _0x2bdafe;}};export{Ua as AIActions,Oi as AIAdapter,ji as AIAssistant,Qi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,bn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,cs as AIConnector,nn as AICoreError,en as AIDocumentProcessingGateway,tn as AIDocumentProcessingRunResult,As as AIEditing,Aa as AIEditorIntegration,on as AIErrorReporter,rn as AIErrorSink,Js as AIGateway,In as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,_n as AIReply,vi 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,Zs as AIRunResult,hs as AITabs,as as AITabsMainView,ns as AITabsView,Zi as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,es as AWSTextAdapter,ts as OpenAITextAdapter,Ni as ShowAIAssistantCommand,ra as ToggleAICommand,ln as createResizeButton,Ji as getDefaultAICommands,js as markOperationsAsAI};