@ckeditor/ckeditor5-ai 48.3.0-alpha.3 → 48.3.0-alpha.5

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 _0x28a08e,ContextPlugin as _0x394116,Editor as _0x3dd3ce,Plugin as _0x57cbc7}from'@ckeditor/ckeditor5-core';import{IconAI as _0x5bd0d6,IconAIAdjustLength as _0x3b6470,IconAIAskAI as _0x59cca9,IconAIChangeTone as _0x3b03c5,IconAIChat as _0x46613e,IconAIChatCommands as _0x4c8f4e,IconAIContinueWriting as _0x47ccb8,IconAIGrammarCheck as _0x153970,IconAIHistory as _0x3fc8c3,IconAIImproveWriting as _0x351374,IconAIOther as _0xd06406,IconAIQuickActions as _0x5f28a7,IconAIReview as _0x57a69d,IconAITranslate as _0x499c30,IconBoxWithCheck as _0x58ccb3,IconBoxWithCross as _0x2fdd39,IconBoxWithMarker as _0x39d162,IconBrowseFiles as _0x546102,IconBulb as _0x518877,IconCancel as _0x3ce603,IconCheck as _0xd806a0,IconChevronDown as _0x7a9038,IconChevronRight as _0x5ddc75,IconChevronUp as _0x3a61a1,IconCopy as _0x55835b,IconDocument as _0x2cb12d,IconDocumentOutline as _0x1be752,IconDropdownArrow as _0x569a5a,IconError as _0x19a980,IconEye as _0x370f19,IconEyeCrossedOut as _0x5946b9,IconFileUpload as _0x366b34,IconImage as _0xd66e63,IconInfo as _0x32b703,IconLink as _0x1f8952,IconLoupe as _0x4425c5,IconMagicWand as _0x207b04,IconMaximize as _0x54d28d,IconMinimize as _0x3a9b7c,IconNextArrow as _0x3683e0,IconOutdated as _0x4663c7,IconPaperClip as _0x537516,IconPin as _0x308705,IconPlus as _0x4560e4,IconPreviousArrow as _0x11934f,IconRefresh as _0x4129a3,IconRobotPencil as _0x46900e,IconSelection as _0x421062,IconShowChangesOff as _0x3bb8cb,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 _0x4c1723,SpinnerView as _0x26babf,TextareaView as _0x357e4e,ToolbarView as _0x226ece,UIModel as _0x56dc21,View as _0x223663,ViewCollection as _0x218b6e,addListToDropdown as _0x2e1c13,addMenuToDropdown as _0x1ba2d6,clickOutsideHandler as _0x36e73c,createDropdown as _0x1c0a67,createLabeledInputText as _0x249f3a,createLabeledTextarea as _0x15956e,submitHandler as _0x527a0f}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x33b3e3,ClipboardPipeline as _0x5f03d6}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x4d3193,MarkerOperation as _0x517bd6,Matcher as _0x1f81b0,ModelDocumentFragment as _0x53f775,ModelPosition as _0x38e1e9,ModelRange as _0x23ea4f,ModelTreeWalker as _0x230f6e,ViewDataTransfer as _0x19e0f1,ViewDocumentDomEventData as _0x5e6b24,ViewDowncastWriter as _0x17583a,ViewUpcastWriter as _0x4b9fcf,_DetachOperation as _0x2142d8,_insertIntoModelNodeList as _0x44ed17,_removeFromModelNodeList as _0x5f25bd,transformOperationSets as _0xd31715}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x5b4d10,debounce as _0x2988fe,escape as _0x548fe1,escapeRegExp as _0x423e56,throttle as _0x398efb,unescape as _0x286a56}from'es-toolkit/compat';import{createParser as _0x46ca60}from'eventsource-parser';import{CloudServices as _0x4df96d}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x45ff7c,DATA_ID_MODEL_ATTRIBUTE as _0x583773,DATA_ID_VIEW_ATTRIBUTE as _0x3bcf90,DocumentCompare as _0x2a9bb4,SuggestionsConversion as _0x98c72c,fixElementSuggestionRange as _0x10d043,getAllMarkersDomElementsSorted as _0x260303,getMarkerDomElement as _0x52b8f8}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x58ed25}from'htmlparser2';import{append as _0x5a71a1,appendChild as _0x5d571b,find as _0x2eb441,findAll as _0x5bd789,findOne as _0x52cdf1,getChildren as ti,getParent as _0x299af8,isComment as _0x5b739d,isTag as _0x3e1b97,prepend as _0x1929bb,prependChild as _0xfc9e1f,removeElement as _0x3d0f4e,replaceElement as _0x2e5842,textContent as _0x2b24b5}from'domutils';import _0x28efca from'dom-serializer';import{Document as _0x389250,Element as _0x9fc879,NodeWithChildren as _0x3961e2,Text as _0x2c2a3b,cloneNode as _0x1163ea,isDocument as _0x186b6f,isText as _0x5e3325}from'domhandler';import{MarkdownGfmMdToHtml as _0x185003,MarkdownGfmMdToHtmlDefaultPlugins as _0x275078}from'@ckeditor/ckeditor5-markdown-gfm';import _0x36b83a from'rehype-sanitize';import _0x3bda12 from'morphdom';import{diffArrays as _0x2800ac}from'diff';const Ci='_ungrouppedCommands';function fi(_0x23ac59,_0x2c5fee){const _0x12285c=(0x0,_0x2c5fee['t'])('Other');return _0x23ac59['length']?'groupId'in _0x23ac59[0x0]?_0x23ac59:[{'groupId':Ci,'groupLabel':_0x12285c,'order':0x1/0x0,'commands':_0x23ac59}]:[{'groupId':Ci,'groupLabel':_0x12285c,'order':0x1/0x0,'commands':[]}];}const bi=globalThis['DataTransfer'],Si='ai-ui';var Ri=class extends _0x57cbc7{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x1aae6b}=this,_0x44b4c2=['ck-fake-ai-selection'];_0x1aae6b['config']['get']('ai.assistant.useTheme')&&_0x44b4c2['push']('ck-ai-assistant-ui_theme'),_0x1aae6b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x44b4c2,'priority':0xc}}),_0x1aae6b['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x519faa,{writer:_0x2d11c4})=>{if(!_0x519faa['markerRange']['isCollapsed'])return null;const _0x35717f=_0x2d11c4['createUIElement']('span');return _0x2d11c4['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x35717f),_0x35717f;}});}['afterInit'](){!async function(_0x178d6c){const _0x143322='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x9bc5e2=0x78e10,_0x508efa=window['Date']['now'](),_0x1bc09d=_0x178d6c['editor'],_0x55107a=new window['Promise'](_0x4a163b=>{_0x1bc09d['once']('ready',_0x4a163b);}),_0x1851b9={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x10c342=_0x1bc09d['config']['get']('licenseKey');async function _0xa57dbd(){let _0x23c522,_0x5d5ac2=null,_0x1f23cc=null;try{return'GPL'==_0x10c342?'NotAllowed':(_0x23c522=_0x29b160(),_0x23c522?(_0x23c522['usageEndpoint']&&(_0x1f23cc=_0x5a55ec(_0x23c522['usageEndpoint'],_0x23c522['jti'])),await _0x2686ed()?_0x33c724()?_0x541d94()?'Expired':_0x43ec53()?('evaluation'==_0x23c522['licenseType']&&(_0x5d5ac2=_0xa28343('EvaluationLimit')),await _0x51e7c0()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x541d94(){const _0x560e0f=['evaluation','trial']['includes'](_0x23c522['licenseType'])?_0x508efa/0x3e8:0xe10*_0x9bc5e2;return _0x23c522['exp']<_0x560e0f;}function _0x33c724(){const _0xa830dc=_0x23c522['features'];return!!_0xa830dc&&(!!_0xa830dc['includes']('*')||!!_0xa830dc['includes']('AI'));}function _0x43ec53(){const _0x293ee2=_0x23c522['licensedHosts'];if(!_0x293ee2||0x0==_0x293ee2['length'])return!0x0;const {hostname:_0x3b6a6f}=new URL(window['location']['href']);if(_0x293ee2['includes'](_0x3b6a6f))return!0x0;const _0x263e89=_0x3b6a6f['split']('.');return _0x293ee2['filter'](_0x1f2d72=>_0x1f2d72['includes']('*'))['map'](_0x266502=>_0x266502['split']('.'))['filter'](_0x8917a9=>_0x8917a9['length']<=_0x263e89['length'])['map'](_0x48ef04=>Array(_0x263e89['length']-_0x48ef04['length'])['fill']('*'===_0x48ef04[0x0]?'*':'')['concat'](_0x48ef04))['some'](_0x376374=>_0x263e89['every']((_0xa9405d,_0x163920)=>_0x376374[_0x163920]===_0xa9405d||'*'===_0x376374[_0x163920]));}function _0x51e7c0(){return _0x5d5ac2&&_0x1f23cc?new window['Promise']((_0x4e9672,_0x1e83d5)=>{_0x5d5ac2['then'](_0x4e9672,_0x1e83d5),_0x1f23cc['then'](_0x8f9e9e=>{'Valid'!=_0x8f9e9e&&_0x4e9672(_0x8f9e9e);},_0x1e83d5);}):_0x5d5ac2||_0x1f23cc||'Valid';}}function _0x5a55ec(_0x17eb55,_0x1b054d){return new window['Promise'](_0x19ae4f=>{if(_0x33c0f5())return _0x19ae4f('Valid');_0x1b935f(),_0x1bc09d['decorate']('_sendUsageRequest');let _0x2b75ec=!0x1;const _0x27186f=Ot();function _0x6980b7(_0x5f9a15){return!!_0x5f9a15&&('object'==typeof _0x5f9a15||'function'==typeof _0x5f9a15)&&'function'==typeof _0x5f9a15['then']&&'function'==typeof _0x5f9a15['catch'];}function _0x1e1f01(_0x41a363){_0x20cc03(_0x41a363)['then'](_0x9f803e=>_0x9f803e&&'ok'==_0x9f803e['status']?_0x138136(_0x2b6156(_0x27186f+_0x1b054d))!=_0x9f803e['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x41fd68=>(_0x2c4ee4(),_0x41fd68),()=>{const _0x3af2c8=_0x58c627();return null==_0x3af2c8?(_0x2c4ee4(),'Valid'):_0x508efa-_0x3af2c8>0x240c8400?'UsageLimit':'Valid';})['then'](_0x19ae4f)['catch'](()=>{_0x19ae4f('UsageLimit');});const _0x7f0a0e=0x36ee80;function _0x2c4ee4(){const _0x5c2479='llct-'+_0x138136(_0x2b6156(_0x17eb55)),_0x5cb73b=_0x1452a5(_0x138136(window['Math']['ceil'](_0x508efa/_0x7f0a0e)));window['localStorage']['setItem'](_0x5c2479,_0x5cb73b);}function _0x58c627(){const _0x39c451='llct-'+_0x138136(_0x2b6156(_0x17eb55)),_0x3a3ac9=window['localStorage']['getItem'](_0x39c451);return _0x3a3ac9?window['parseInt'](_0x1452a5(_0x3a3ac9),0x10)*_0x7f0a0e:null;}function _0x20cc03(_0x406df9){return new window['Promise']((_0x5783fd,_0x417d83)=>{_0x406df9['then'](_0x5783fd,_0x417d83),window['setTimeout'](_0x417d83,0x1d4c0);});}}_0x1bc09d['on']('_sendUsageRequest',(_0x21f029,_0x30384f)=>{if(_0x30384f[0x0]!=_0x17eb55)return _0x19ae4f('UsageLimit');_0x30384f[0x1]={..._0x30384f[0x1],'requestId':_0x27186f};},{'priority':'high'}),_0x1bc09d['on']('_sendUsageRequest',_0x712b47=>{_0x6980b7(_0x712b47['return'])&&(_0x2b75ec=!0x0,_0x1e1f01(_0x712b47['return']));},{'priority':'low'}),_0x55107a['then'](()=>{_0x2b75ec||_0x19ae4f('UsageLimit');});});function _0x33c0f5(){return'auto'==_0x1bc09d['editing']['view']['_overlayModeHint'];}function _0x1b935f(){_0x1bc09d['editing']['view']['_overlayModeHint']='auto';}}function _0xa28343(_0x2f8aff){const _0x3e3961=[new window['Promise'](_0x393cd1=>setTimeout(_0x393cd1,0x93ecc)),_0x55107a['then'](()=>new window['Promise'](_0x2afc88=>{let _0xdd9700=0x0;_0x1bc09d['model']['on']('applyOperation',(_0x41360c,_0x531c4a)=>{_0x531c4a[0x0]['isDocumentOperation']&&_0xdd9700++,0x5e8==_0xdd9700&&(_0x2afc88(),_0x41360c['off']());});}))];return window['Promise']['race'](_0x3e3961)['then'](()=>_0x2f8aff);}async function _0x5ea0bc(){await _0x55107a,_0x1bc09d['model']['change']=_0xa60916,_0x1bc09d['model']['enqueueChange']=_0xa60916,_0x1bc09d['enableReadOnlyMode']('model');}function _0x17906e(_0x3dcc8c){const _0x1254ea=_0x2f2354();_0x1bc09d[_0x1254ea]='aiLicenseKey'+_0x3dcc8c,'Valid'!=_0x3dcc8c&&_0x5ea0bc();}function _0x2f2354(){const _0xc33040=window['String'](window['performance']['now']())['replace']('.','');let _0xa0905c='n';for(let _0x24f3d3=0x0;_0x24f3d3<_0xc33040['length'];_0x24f3d3+=0x2){let _0x4bd6de=window['parseInt'](_0xc33040['substring'](_0x24f3d3,_0x24f3d3+0x2));_0x4bd6de>=0x3e&&(_0x4bd6de-=0x3e),_0xa0905c+=_0x143322[_0x4bd6de];}return _0xa0905c;}function _0x29b160(){const _0x4d77d4=_0x10c342['split']('.');if(0x3!=_0x4d77d4['length'])return null;return _0x483f48(_0x4d77d4[0x1]);function _0x483f48(_0x472b66){const _0x17e01f=_0x592505(_0x472b66);return _0x17e01f&&_0x4c8854()?_0x17e01f:null;function _0x4c8854(){const _0x1be204=_0x17e01f['jti'],_0x37092b=window['parseInt'](_0x1be204['substring'](_0x1be204['length']-0x8),0x10),_0x24d886={..._0x17e01f,'jti':_0x1be204['substring'](0x0,_0x1be204['length']-0x8)};return delete _0x24d886['vc'],_0x2b6156(_0x24d886)==_0x37092b;}}}async function _0x2686ed(){let _0x2d3491=!0x0;try{const [_0x2021d0,_0x353c73,_0x12b32c]=_0x10c342['split']('.');return _0x336ecf(_0x2021d0),await _0x100b18(_0x2021d0,_0x353c73,_0x12b32c),_0x2d3491;}catch{return!0x1;}function _0x336ecf(_0xccf0b7){const _0x522e74=_0x592505(_0xccf0b7);_0x522e74&&'ES256'==_0x522e74['alg']||(_0x2d3491=!0x1);}async function _0x100b18(_0x3310f8,_0x47d308,_0x3e0f4a){const _0x5d5061=window['Uint8Array']['from'](_0x47d893(_0x3e0f4a),_0x16f0ee=>_0x16f0ee['charCodeAt'](0x0)),_0x3fdb58=new window['TextEncoder']()['encode'](_0x3310f8+'.'+_0x47d308),_0x492833=window['crypto']['subtle'];if(!_0x492833)return;const _0x404d95=await _0x492833['importKey']('jwk',_0x1851b9,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x492833['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x404d95,_0x5d5061,_0x3fdb58)||(_0x2d3491=!0x1);}}function _0x592505(_0xef774f){return _0xef774f['startsWith']('ey')?JSON['parse'](_0x47d893(_0xef774f)):null;}function _0x47d893(_0x2a13d4){return window['atob'](_0x2a13d4['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x2b6156(_0x32748a){let _0x538592=0x1505;function _0x46717d(_0x4c0176){for(let _0x1bd477=0x0;_0x1bd477<_0x4c0176['length'];_0x1bd477++){const _0x5f1870=_0x4c0176['charCodeAt'](_0x1bd477);_0x538592=(_0x538592<<0x5)+_0x538592+_0x5f1870,_0x538592&=_0x538592;}}function _0x389e59(_0x1d0156){Array['isArray'](_0x1d0156)?_0x1d0156['forEach'](_0x389e59):_0x1d0156&&'object'==typeof _0x1d0156?Object['entries'](_0x1d0156)['sort']()['forEach'](([_0x48d4d0,_0x22c63e])=>{_0x46717d(_0x48d4d0),_0x389e59(_0x22c63e);}):_0x46717d(window['String'](_0x1d0156));}return _0x389e59(_0x32748a),_0x538592>>>0x0;}function _0x138136(_0x2bb479){return _0x2bb479['toString'](0x10)['padStart'](0x8,'0');}function _0x1452a5(_0x79bd2f){return _0x79bd2f['split']('')['reverse']()['join']('');}function _0xa60916(){}_0x17906e(await _0xa57dbd());}(this);}['showFakeVisualSelection'](){const _0x1434f9=this['editor']['model'];_0x1434f9['change'](_0x2d9161=>{const _0x54f72e=_0x1434f9['document']['selection']['getRanges']();let _0x83a300=0x0;for(const _0x1efd87 of _0x54f72e){const _0x45fc5e=Si+':'+_0x83a300;if(_0x1434f9['markers']['has'](_0x45fc5e))_0x2d9161['updateMarker'](_0x45fc5e,{'range':_0x1efd87});else{if(_0x1efd87['start']['isAtEnd']){const _0xbba490=_0x1efd87['start']['getLastMatchingPosition'](({item:_0x3d6687})=>!_0x1434f9['schema']['isContent'](_0x3d6687),{'boundaries':_0x1efd87});_0x2d9161['addMarker'](_0x45fc5e,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2d9161['createRange'](_0xbba490,_0x1efd87['end'])});}else _0x2d9161['addMarker'](_0x45fc5e,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1efd87});}_0x83a300++;}});}['hideFakeVisualSelection'](){const _0x59341a=this['editor']['model'],_0x33da57=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x33da57['length']&&_0x59341a['change'](_0x45794e=>{_0x33da57['forEach'](_0x2ad817=>{_0x45794e['removeMarker'](_0x2ad817);});});}['insertContent'](_0x140b39,_0x187315){const _0x36c4de=this['_getAISelection'](),_0x3735d6=_0x187315||_0x36c4de['getFirstRange']();this['editor']['model']['canEditAt'](_0x3735d6)&&this['editor']['model']['change'](_0x2dbced=>{this['hideFakeVisualSelection'](),_0x187315||this['_resetContentOfSelectedTableCells'](_0x2dbced,_0x36c4de),this['_pasteHTMLUsingClipboard']({'insertAt':_0x3735d6,'writer':_0x2dbced,'html':_0x140b39});});}['insertContentBelow'](_0x437001){const {model:_0x187342}=this['editor'],_0x265236=this['_getAISelection']();_0x187342['change'](()=>{const _0x1d7152=this['_prepareTableInsertBelowPosition'](_0x437001,_0x265236)||this['_getDefaultInsertBelowPosition'](_0x265236);this['insertContent'](_0x437001,_0x1d7152);});}['_getAISelection'](){const _0x4802a9=this['editor']['model'],_0x4396d4=Array['from'](_0x4802a9['markers']['getMarkersGroup'](Si))['map'](_0x3e0db1=>_0x3e0db1['getRange']());return _0x4802a9['createSelection'](_0x4396d4);}['_pasteHTMLUsingClipboard']({writer:_0x3250ec,html:_0x1bd0ec,insertAt:_0xae034a}){const {view:_0x221318}=this['editor']['editing'],_0x1713d5=this['editor']['plugins']['get'](_0x5f03d6),_0x2589a4=new bi();_0x2589a4['setData']('text/html',_0x1bd0ec);const _0x2ce5aa=new _0x5e6b24(_0x221318,new ClipboardEvent('paste',{'clipboardData':_0x2589a4}),{'dataTransfer':new _0x19e0f1(_0x2589a4)});_0x3250ec['setSelection'](_0xae034a);const _0xed65ff=(_0x251bf5,_0x26659e)=>{_0x26659e['resultRange']&&_0x3250ec['setSelection'](_0x26659e['resultRange']);};_0x1713d5['once']('contentInsertion',_0xed65ff,{'priority':'lowest'}),_0x221318['document']['fire']('paste',_0x2ce5aa),_0x1713d5['off']('contentInsertion',_0xed65ff);}['_getDefaultInsertBelowPosition'](_0x1e1367){const {model:_0xab6d3b}=this['editor'],_0x1e8df1=Array['from'](_0x1e1367['getSelectedBlocks']());return _0x1e8df1['length']?_0xab6d3b['createPositionAfter'](_0x1e8df1['pop']()):_0x1e1367['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x4c28b5,_0x5acca8){const {model:_0x175a7f,plugins:_0x158d80}=this['editor'];if(_0x158d80['has']('TableUtils')){const _0x2ac269=_0x158d80['get']('TableUtils')['getSelectedTableCells'](_0x5acca8);if(_0x2ac269['length']){const _0x196576=this['_getTableRowCountFromContent'](_0x4c28b5),_0x240965=this['_createEmptyTableRows'](_0x2ac269,_0x196576);return _0x175a7f['createPositionAt'](_0x240965,0x0);}}return null;}['_getTableRowCountFromContent'](_0xb6e00e){const _0x45588b=this['editor']['plugins']['get']('TableUtils'),_0x5176ff=this['editor']['data']['parse'](_0xb6e00e,'$documentFragment'),_0x1876af=Array['from'](_0x5176ff['getChildren']())['filter'](_0x2efe47=>_0x2efe47['is']('element','table'));let _0xf8c4d8=0x0;return _0x1876af['forEach'](_0x5b3ad0=>{_0xf8c4d8+=_0x45588b['getRows'](_0x5b3ad0);}),_0xf8c4d8;}['_createEmptyTableRows'](_0x1719aa,_0x10a443){const _0x10f44d=this['editor']['plugins']['get']('TableUtils'),_0x4cc0e7=_0x10f44d['getRowIndexes'](_0x1719aa),_0x5a88ac=_0x10f44d['getColumnIndexes'](_0x1719aa),_0x15322c=_0x4cc0e7['last']+0x1,_0x5ae1fc=_0x5a88ac['first'],_0xd03346=_0x1719aa[0x0]['findAncestor']('table');for(let _0xc1191=0x0;_0xc1191<_0x10a443;_0xc1191++)_0x10f44d['insertRows'](_0xd03346,{'at':_0x15322c});return _0xd03346['getChild'](_0x15322c)['getChild'](_0x5ae1fc);}['_resetContentOfSelectedTableCells'](_0x12d660,_0x157161){const {plugins:_0x30b351}=this['editor'],{model:_0x199c8e}=_0x12d660;_0x30b351['has']('TableUtils')&&_0x30b351['get']('TableUtils')['getSelectedTableCells'](_0x157161)['length']&&_0x199c8e['deleteContent'](_0x157161);}},Oi=class extends _0x57cbc7{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(_0xeb5140){super(_0xeb5140),this['name']='AIRequestError';}};function ki(_0x387050,_0x551351,_0x5c3492){const t=_0x387050['t'];switch(_0x551351){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',_0x5c3492);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5c3492);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'},_0x5c3492);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 _0x551351;}}var Ni=class extends _0x28a08e{['_commandDefinitions'];constructor(_0x3aa708,_0x17a560){super(_0x3aa708),this['_commandDefinitions']=_0x17a560,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x32dbd5,_0x5b4f24,_0x28e39a)=>{this['isEnabled']&&(this['enabledCommandsIds']=yi(this['_commandDefinitions'],_0x28e39a));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x1bef33,_0x4af939,_0x47d2d3)=>{this['enabledCommandsIds']=_0x47d2d3?yi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3507d1=this['editor']['model'];this['_hasContext']=function(_0x584e87){const _0x3e2d59=_0x584e87['document']['selection'];return _0x3e2d59['isCollapsed']?0x0!==[..._0x3e2d59['getSelectedBlocks']()]['length']&&![..._0x3e2d59['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x584e87['hasContent'](_0x3e2d59['getFirstRange']());}(_0x3507d1);const _0x2eaf85=_0x3507d1['document']['selection'],_0x5c4890=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x1947d5 of _0x2eaf85['getRanges']())for(const _0x29987e of _0x1947d5['getItems']())if(_0x29987e['is']('element')&&_0x5c4890['includes'](_0x29987e['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x5e18a4='',_0x59e3db='',_0x167561='custom'){this['editor']['plugins']['get'](Qi)['showUI'](_0x5e18a4,_0x59e3db,_0x167561);}};function yi(_0x337d22,_0x38ca9d){const _0x3fff9c=new Set();for(const _0x163e8c of _0x337d22['values']())(_0x38ca9d||!0x1===_0x163e8c['requiresContent'])&&_0x3fff9c['add'](_0x163e8c['id']);return Array['from'](_0x3fff9c);}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(_0x2e9736,_0x1248dd,_0x3ceb63){super(),this['editor']=_0x2e9736,this['textAdapter']=_0x1248dd,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x3ceb63,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x564086,_0x36d1fc,_0x209973)=>{this['view']['value']=this['_sanitizeHTML'](_0x209973);}),this['listenTo'](this['view'],'submitPrompt',(_0x3f0710,_0x372e0c)=>{const _0x3d5a28=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x372e0c,_0x3d5a28,'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:_0x5be426,query:_0x3917b4,htmlContent:_0x2f1f60,label:_0x5082d6,mainActionLabel:_0x46b82a}){this['view']['prompt']=_0x5082d6,this['view']['mainAction']=_0x46b82a,this['initialContext']=_0x2f1f60,_0x3917b4&&(this['view']['isRendered']?this['_handleQuery'](_0x3917b4,_0x2f1f60,_0x5be426,_0x5082d6):this['view']['once']('render',()=>{this['_handleQuery'](_0x3917b4,_0x2f1f60,_0x5be426,_0x5082d6);}));}['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'](_0x59cfea,_0x113782,_0x2455ad,_0x4e00a5){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x113782,this['previousQuery']=_0x59cfea,this['previousLabel']=_0x4e00a5||_0x59cfea,this['previousActionId']=_0x2455ad,new Promise(_0x50396f=>{this['textAdapter']['makeRequest']({'query':_0x59cfea,'context':_0x113782,'onData':_0x430810=>{this['currentResponse']=_0x430810,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2455ad})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x55f55d=>{_0x55f55d instanceof vi?this['view']['handleError'](_0x55f55d['message']):this['view']['handleError'](),_0x50396f();})['finally'](()=>{this['stopProcessing'](),_0x50396f();});});}['_parseAndNormalizeContent'](_0x4b61f5,_0x31ca13=!0x1){const _0x2fbbba=xi['exec'](_0x4b61f5);_0x4b61f5=_0x2fbbba?_0x4b61f5['substring'](_0x2fbbba[0x1]['length']):_0x4b61f5['length']<0x64&&!_0x31ca13?'':this['_stripMarkdownSyntax'](_0x4b61f5);const _0x593d12=this['_domParser']['parseFromString'](_0x4b61f5,'text/html');if(_0x2fbbba){const _0x582796=Array['from'](_0x593d12['body']['childNodes']);_0x582796['reverse']();for(const _0x59c128 of _0x582796){if(_0x59c128['nodeType']==Node['ELEMENT_NODE'])break;_0x59c128['remove']();}}const _0x1bf118=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x593d12['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x1bf118);const _0x14c14d=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x175210=this['editor']['data']['toModel'](_0x1bf118);return _0x14c14d||_0x175210['markers']['clear'](),this['editor']['data']['stringify'](_0x175210);}['_normalizeResponseHeadings'](_0x303ef8){const _0x9203dc=new _0x4b9fcf(this['editor']['editing']['view']['document']),_0x22cefd=new _0x1f81b0({'name':/^h[1-5]$/}),_0x66c63c=[];let _0x34f511=!0x1;for(const _0x29532d of _0x303ef8)_0x29532d['is']('element')&&_0x22cefd['match'](_0x29532d)&&(_0x66c63c['push'](_0x29532d),'h1'==_0x29532d['name']&&(_0x34f511=!0x0));if(_0x34f511){for(const _0x50f9d6 of _0x66c63c)_0x9203dc['rename']('h'+(parseInt(_0x50f9d6['name'][0x1])+0x1),_0x50f9d6);}}['_isH1TagSupportEnabled'](){const {data:_0x1019f1,editing:_0x201b16}=this['editor'],_0x2d02c5=_0x1019f1['htmlProcessor']['toView']('<h1></h1>'),_0x54fd5d=_0x1019f1['toView'](_0x1019f1['toModel'](_0x2d02c5));return!!_0x201b16['view']['domConverter']['viewToDom'](_0x54fd5d)['querySelector']('h1');}['_sanitizeHTML'](_0x27fd38){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x27fd38),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x4a3d36){const _0x2819c0=_0x4a3d36['trim']();return _0x2819c0['startsWith']('```html')?_0x2819c0['endsWith']('```')?_0x2819c0['substring'](0x7,_0x2819c0['length']-0x3):_0x2819c0['substring'](0x7):_0x4a3d36;}};const Pi={'REPLACE':'replace','INSERT':'insert'};var Hi=class extends _0x226ece{constructor(_0xd0cbdd){super(_0xd0cbdd),this['set']('isVisible',!0x1),this['set']('mainAction',Pi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x31401b=>ki(_0xd0cbdd,'AI_'+_0x31401b['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](ki(_0xd0cbdd,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](ki(_0xd0cbdd,'Try\x20again')),this['stopButton']=this['_createButton'](ki(_0xd0cbdd,'Stop'));const _0x752cd0=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x752cd0['if']('isVisible','ck-hidden',_0x545fd7=>!_0x545fd7)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x2562b6,_0x3dd45e){const _0x20d1ea=new Pt(this['locale']);return _0x20d1ea['set']({'label':_0x2562b6,'class':_0x3dd45e||'','isVisible':!0x0,'withText':!0x0}),_0x20d1ea;}},Mi=class extends _0x223663{['contentFieldView'];['copyButtonView'];constructor(_0x313a8a,_0x560fce=''){super(_0x313a8a),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3108fc=this['bindTemplate'];this['contentFieldView']=new Vi(_0x313a8a,_0x560fce),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3108fc['if']('isVisible','ck-hidden',_0x1c1304=>!_0x1c1304)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3108fc['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 _0x22cc66=!0x1;this['on']('change:value',(_0x21717d,_0x734641,_0x3a1589)=>{const _0x3001af=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3a1589),this['isProcessing']&&_0x3001af&&!_0x22cc66&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5c9085,_0x3558e1,_0x111032)=>{_0x22cc66=!0x1,_0x111032?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x22cc66=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x22cc66=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x3fee85=this['locale'],_0x4cd839=new Pt(this['locale']),_0x136190='ck-ai-form__copy-button';return _0x4cd839['set']({'label':ki(_0x3fee85,'Copy'),'icon':_0x55835b,'class':_0x136190,'tooltip':!0x0}),_0x4cd839['bind']('isVisible')['to'](this,'value',_0x123578=>!!_0x123578),_0x4cd839['bind']('isEnabled')['to'](this,'isProcessing',_0x4b6f69=>!_0x4b6f69),_0x4cd839['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x4cd839['icon']=_0xd806a0,_0x4cd839['class']=_0x136190+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x4cd839['icon']=_0x55835b,_0x4cd839['class']=_0x136190;},0x3e8);}),_0x4cd839;}['_copyHTMLToClipboard'](_0xd7a5dd){const {window:_0x85bfad,document:_0x3a8213}=Et;if(_0x85bfad['ClipboardItem']){const {Blob:_0x446dd0,ClipboardItem:_0x13f7be}=_0x85bfad,_0x3b1a98=[new _0x13f7be({'text/html':new _0x446dd0([_0xd7a5dd['innerHTML']],{'type':'text/html'}),'text/plain':new _0x446dd0([_0xd7a5dd['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x3b1a98);}else{const _0xab1735=_0x3a8213['createElement']('div');_0xab1735['style']['position']='absolute',_0xab1735['style']['left']='-9999px',_0xab1735['innerHTML']='<span>[</span>'+_0xd7a5dd['innerHTML']+'<span>]</span>',_0x3a8213['body']['appendChild'](_0xab1735);const _0x22f966=_0x3a8213['createRange']();_0x22f966['setStartAfter'](_0xab1735['firstElementChild']),_0x22f966['setEndBefore'](_0xab1735['lastElementChild']);const _0x4c6c2b=_0x85bfad['getSelection']();_0x4c6c2b['removeAllRanges'](),_0x4c6c2b['addRange'](_0x22f966),_0x3a8213['execCommand']('copy'),_0xab1735['remove']();}}},Vi=class extends _0x223663{constructor(_0x329197,_0x4f53ed=''){super(_0x329197),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x4f53ed,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x4400bc){this['element']['innerHTML']=_0x4400bc;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x5b8a77=new _0x223663(),_0x4e7cb5=this['locale'],_0x38c7d2=new _0x26babf();return _0x38c7d2['isVisible']=!0x0,_0x5b8a77['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x38c7d2,{'text':ki(_0x4e7cb5,'AI\x20is\x20writing...')}]}),_0x5b8a77['render'](),_0x5b8a77;}},Ui=class extends _0x223663{constructor(_0x382855,_0x318417=''){super(_0x382855);const _0x52c449=new Wt(),_0x5d9d2b=this['bindTemplate'];this['set']('text',_0x318417),_0x52c449['content']=_0x19a980,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x52c449,{'text':_0x5d9d2b['to']('text')}]});}},Bi=class extends kt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x4dcfba,_0x2c1e44){super(_0x4dcfba,_0x2c1e44),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',(_0x3a4934,_0x4c5590)=>{_0x3a4934['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x4c5590());});}['_createSubmitButton'](){const _0x2c4361=new Pt(this['locale']),_0x52c34e=this['locale'];return _0x2c4361['set']({'icon':it,'label':ki(_0x52c34e,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x2c4361['on']('execute',()=>{this['submit']();}),_0x2c4361['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x2861ca,_0x36baae)=>!_0x2861ca&&_0x36baae),_0x2c4361;}['_createShowHistoryButton'](){const _0x4011c4=new Pt(this['locale']),_0x41de99=this['resultsView'],_0x2bd6fa=this['locale'];_0x4011c4['set']({'label':ki(_0x2bd6fa,'History'),'withText':!0x1,'icon':_0x3fc8c3,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4011c4['bind']('isOn')['to'](_0x41de99,'isVisible'),_0x4011c4['bind']('isEnabled')['to'](this,'isEnabled'),_0x4011c4['on']('execute',()=>{_0x41de99['isVisible']=!_0x41de99['isVisible'],_0x41de99['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x35877a=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x31e7ca=new gt(this['queryView']['fieldView']['element']),_0xb1b547=_0x31e7ca['width'],_0x4f28ae='rtl'===_0x2bd6fa['uiLanguageDirection']?'left':'right';_0x31e7ca['excludeScrollbarsAndBorders'](),_0x4011c4['element']['style'][_0x4f28ae]=_0xb1b547-_0x31e7ca['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x35877a),this['on']('render',_0x35877a),_0x4011c4;}['submit'](){const _0x593e1f=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x593e1f);}['focus'](_0x27e405){-0x1===_0x27e405?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Gi=class extends zt{['historyGroupView'];['clearHistoryButton'];constructor(_0x3218e5){super(_0x3218e5),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Qt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=ki(_0x3218e5,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x11272a=0x0;for(const _0x45c92b of this['items'])_0x11272a+=_0x45c92b['items']['length'];return{'resultsCount':_0x11272a,'totalItemsCount':_0x11272a};}['_createClearHistoryButton'](){const _0x10e507=this['locale'],_0x1631ec=new Pt(this['locale']);return _0x1631ec['set']({'label':'('+ki(_0x10e507,'Clear')+')','withText':!0x0}),_0x1631ec['on']('execute',()=>this['fire']('clearHistory')),_0x1631ec;}},Fi=class extends Xt{constructor(_0x55c538){super();const _0x335c77=new Lt(),_0x318f9c=new Pt(this['locale'],_0x335c77);this['children']['add'](_0x318f9c),_0x318f9c['set']({'label':_0x55c538['prompt'],'withText':!0x0}),_0x318f9c['on']('execute',()=>{this['fire']('execute',{'value':_0x286a56(_0x55c538['prompt'])});});}};const Ki='CKEditor/AIFormView/PromptHistory';var Wi=class extends ht{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x285fa6,_0x582e06)=>{const _0x3796ac=Yi(_0x582e06['prompt']);for(const _0x23c834 of this)if(_0x23c834!=_0x582e06&&Yi(_0x23c834['prompt'])===_0x3796ac){this['remove'](_0x23c834);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x50adf8=sessionStorage['getItem'](Ki)||'[]';this['addMany'](JSON['parse'](_0x50adf8));}['_saveToSessionStorage'](){sessionStorage['setItem'](Ki,JSON['stringify'](this['map'](_0x22211f=>_0x22211f)));}};function Yi(_0x9aebd9){return _0x9aebd9['toLowerCase']()['trim']();}var $i=class extends _0x223663{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x506a98,_0x5237a4,_0x347049=''){super(_0x506a98),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(_0x506a98),this['contentArea']=new Mi(_0x506a98,_0x347049),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 _0x228db5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x5237a4],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x228db5['if']('isError','ck-hidden',_0x2acf30=>!_0x2acf30)]},'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'](_0x148f53=0x1){-0x1===_0x148f53?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 _0x59cd68=this['locale'],_0x544422=new Bi(_0x59cd68,{'queryView':{'label':ki(_0x59cd68,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x15956e,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':ki(_0x59cd68,'Empty\x20history'),'secondary':ki(_0x59cd68,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x544422['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x8b234d,_0x35f9fd)=>_0x8b234d&&!_0x35f9fd),this['listenTo'](_0x544422,'submit',(_0x46d5d6,_0x5656bb)=>{this['prompt']=_0x5656bb;const _0x4b7ac3=_0x548fe1(_0x5656bb);this['fire']('submitPrompt',_0x4b7ac3),_0x5656bb['trim']()&&this['_promptHistory']['add']({'prompt':_0x4b7ac3},0x0);},{'priority':'high'}),_0x544422;}['_createHistoryView'](){const _0x5e7fc3=new Gi(this['locale']);return _0x5e7fc3['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Fi),_0x5e7fc3['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x5e7fc3;}['_createToolbar'](){const _0x590622=new Hi(this['locale']);return _0x590622['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xcc934e,_0x1272c6,_0xe9e70e)=>_0xcc934e&&!_0x1272c6&&!!_0xe9e70e),_0x590622['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x590622['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x274cc1,_0x12b02d,_0x395104)=>_0x274cc1&&!_0x12b02d&&!!_0x395104),_0x590622['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x590622['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x5ac299,_0x306f7a)=>_0x5ac299&&!_0x306f7a),_0x590622['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x590622['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x590622['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x590622;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x4c0fb7=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=ki(_0x4c0fb7,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x4b3501){const _0xd97fa=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x4b3501||ki(_0xd97fa,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const qi=globalThis['DataTransfer'];var Qi=class extends _0x57cbc7{['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[_0x33b3e3,Ri,Oi,Ht];}constructor(_0x320abe){super(_0x320abe),_0x320abe['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x320abe['config']['define']('ai.assistant.contentAreaCssClass',''),_0x320abe['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x320abe['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x70c178}=this;this['_aiAdapter']=_0x70c178['plugins']['get'](Oi),this['_dialog']=_0x70c178['plugins']['get'](Ht),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x5ce3cf=new Ni(_0x70c178,Array['from'](this['_commandDefinitions']['values']()));_0x70c178['commands']['add']('showAIAssistant',_0x5ce3cf),_0x70c178['ui']['componentFactory']['add']('aiCommands',_0x7d6ea6=>{const _0x254bed=_0x1c0a67(_0x7d6ea6);return _0x254bed['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x254bed['buttonView']['set']({'label':ki(_0x7d6ea6,'AI\x20Commands'),'icon':_0x207b04,'tooltip':!0x0}),_0x254bed['on']('execute',_0x2dc5be=>this['_onExecute'](_0x2dc5be['source']['id'])),_0x1ba2d6(_0x254bed,_0x70c178['ui']['view']['body'],function(_0x101900){const _0x5005f2=zi(_0x101900,fi(_0x101900['config']['get']('ai.assistant.commands'),_0x101900['locale']))['filter'](_0x4de3e2=>_0x4de3e2['commands']['length']);return 0x1===_0x5005f2['length']?zi(_0x101900,_0x5005f2[0x0]['commands'])['map'](_0x1e7564=>({'id':_0x1e7564['id'],'label':_0x1e7564['label']})):_0x5005f2['map'](_0x9b200=>{const {groupId:_0x4888a0,groupLabel:_0x118c4e,commands:_0x32d554}=_0x9b200,_0xd2aa03=zi(_0x101900,_0x32d554)['map'](_0x1dd8fd=>({'id':_0x1dd8fd['id'],'label':_0x1dd8fd['label']}));return{'id':_0x4888a0,'menu':_0x118c4e||_0x4888a0,'children':_0xd2aa03};});}(_0x70c178),{'ariaLabel':ki(_0x7d6ea6,'AI\x20Commands')}),_0x254bed['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x5ce3cf['on']('change:enabledCommandsIds',_0x41eac0),_0x254bed['menuView']['once']('render',_0x41eac0),_0x254bed;function _0x41eac0(){_0x254bed['isEnabled']=_0x5ce3cf['enabledCommandsIds']['length']>0x0;for(const _0x389410 of _0x254bed['menuView']['buttons'])_0x389410['isEnabled']=_0x5ce3cf['enabledCommandsIds']['includes'](_0x389410['id']);}}),_0x70c178['ui']['componentFactory']['add']('menuBar:aiCommands',_0x5e6b0e=>{const _0x57f341=new te(_0x5e6b0e);_0x57f341['buttonView']['set']({'label':ki(_0x5e6b0e,'AI\x20Commands'),'icon':_0x207b04}),_0x57f341['bind']('isEnabled')['to'](_0x5ce3cf,'enabledCommandsIds',_0x393bef=>_0x393bef['length']>0x0);const _0x1a7962=fi(_0x70c178['config']['get']('ai.assistant.commands'),_0x5e6b0e);return this['_populateMenuBarMenu'](_0x5ce3cf,_0x57f341,_0x1a7962,_0x5c4083=>this['_onExecute'](_0x5c4083)),_0x57f341;}),_0x70c178['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x1864c9=this['_createAIAssistantUIButton'](Pt);return _0x1864c9['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x1864c9;}),_0x70c178['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x2c7390=this['_createAIAssistantUIButton'](jt);return _0x2c7390['set']({'role':'menuitemcheckbox'}),_0x2c7390;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0xbbf157=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x11079f;for(const _0x1e3963 in _0xbbf157){const _0x2ac39c=_0x1e3963,_0x29cbff=_0xbbf157[_0x2ac39c];if('aiLicenseKeyValid'==_0x29cbff||'aiLicenseKeyInvalid'==_0x29cbff||'aiLicenseKeyExpired'==_0x29cbff||'aiLicenseKeyDomainLimit'==_0x29cbff||'aiLicenseKeyNotAllowed'==_0x29cbff||'aiLicenseKeyEvaluationLimit'==_0x29cbff||'aiLicenseKeyUsageLimit'==_0x29cbff){delete _0xbbf157[_0x2ac39c],_0x11079f=_0x29cbff,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x11079f&&_0xbbf157['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x11079f&&_0xbbf157['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x11079f&&_0xbbf157['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x11079f&&_0xbbf157['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x11079f&&_0xbbf157['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x11079f&&_0xbbf157['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x14e2be='',_0x1076b9='',_0x553346='custom'){const _0x261cf9=this['editor'],_0x4c83bf=_0x261cf9['editing']['view'],_0x28052e=_0x261cf9['plugins']['get'](Ri),_0x57e7b0=_0x261cf9['plugins']['get'](_0x33b3e3);_0x28052e['showFakeVisualSelection']();const _0x213cbd=new qi(),_0x535725=new ClipboardEvent('copy',{'clipboardData':_0x213cbd}),_0x3c46c4=new _0x19e0f1(_0x213cbd),_0x2f05c8=new _0x5e6b24(_0x4c83bf,_0x535725,{'dataTransfer':_0x3c46c4});_0x57e7b0['_forceMarkersCopy']('comment',()=>{_0x4c83bf['document']['fire']('copy',_0x2f05c8);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Di(_0x261cf9,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x237ce7=_0x3c46c4['getData']('text/html');const _0x49d372=_0x261cf9['model']['document']['selection'],_0x4ed4a8=Array['from'](_0x49d372['getRanges']());0x1===_0x4ed4a8['length']&&_0x4ed4a8[0x0]['isFlat']&&!_0x49d372['getSelectedElement']()&&''!==_0x237ce7['replace'](/&nbsp;/g,'')['trim']()&&(_0x237ce7='<p>'+_0x237ce7+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x553346,'query':_0x14e2be,'htmlContent':_0x237ce7,'label':_0x1076b9,'mainActionLabel':Pi[_0x261cf9['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x46900e,'title':ki(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Mt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x28052e['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x368f8d=new Map(),_0x4fbc4c=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x38792c of _0x4fbc4c)for(const _0x39abb8 of _0x38792c['commands'])_0x368f8d['set'](_0x39abb8['id'],{..._0x39abb8,'groupId':_0x38792c['groupId'],'groupLabel':_0x38792c['groupLabel']||_0x38792c['groupId']});return _0x368f8d;}['_createAIAssistantUIButton'](_0x36fba4){const _0x287269=this['editor'],_0x5509d5=_0x287269['commands']['get']('showAIAssistant'),_0x3cf07=new _0x36fba4(_0x287269['locale']);return _0x3cf07['set']({'label':ki(_0x287269['locale'],'AI\x20Assistant'),'icon':_0x46900e,'isToggleable':!0x0}),_0x3cf07['bind']('isEnabled')['to'](_0x5509d5),_0x3cf07['bind']('isOn')['to'](this['_dialog'],'id',_0x15fa39=>'aiAssistant'===_0x15fa39),this['listenTo'](_0x3cf07,'execute',()=>{_0x3cf07['isOn']?this['hideUI']():_0x5509d5['execute']();}),_0x3cf07;}['_initView'](){const _0x3d4388=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',()=>{_0x3d4388['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x3d4388['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x4d97c0,ui:{ariaLiveAnnouncer:_0x583640}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x3eda5e,_0x3c0e75,_0x45300e)=>{const _0x5e5782=this['_aiAssistantController']['currentContext'];_0x45300e?_0x583640['announce'](ki(_0x4d97c0,'AI\x20is\x20writing')):_0x5e5782&&_0x583640['announce'](ki(_0x4d97c0,'Generated\x20content:\x20%0',_0x5e5782),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x391165,_0x1cd3bc,_0xa53d6c)=>{if(_0xa53d6c){const _0x1ef7f6=this['_formView']['errorView']['text'];_0x583640['announce'](ki(_0x4d97c0,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1ef7f6));}});}['_onExecute'](_0x5df08b){const _0x1e09ea=this['_commandDefinitions']['get'](_0x5df08b),_0x1c033f=this['editor'],_0x46dbc8=_0x1c033f['model']['document']['selection'],_0x2e3643=_0x1c033f['commands']['get']('showAIAssistant'),_0x557f25=_0x1c033f['plugins']['get'](Ri),_0x35014f=''+('_ungrouppedCommands'!==_0x1e09ea['groupId']?_0x1e09ea['groupLabel']+':\x20':'')+_0x1e09ea['label'];if(!0x1!==_0x1e09ea['requiresContent']&&_0x46dbc8['isCollapsed']){const _0x3d3edd=pt(_0x46dbc8['getSelectedBlocks']())||_0x1c033f['model']['schema']['getLimitElement'](_0x46dbc8);_0x1c033f['model']['change'](_0x21354f=>{_0x21354f['setSelection'](_0x3d3edd,'in');});}_0x557f25['showFakeVisualSelection'](),_0x2e3643['execute'](_0x1e09ea['prompt'],_0x35014f,'command:'+_0x5df08b);}['_populateMenuBarMenu'](_0x482f1a,_0x5c697e,_0x307cd0,_0x1b6847){const _0x2049a1=this['editor'],_0x3b2a6c=_0x2049a1['locale'],_0x27b499=new Zt(_0x3b2a6c),_0xd9bc3e=zi(_0x2049a1,_0x307cd0)['filter'](_0x57ee66=>_0x57ee66['commands']['length']);0x1===_0xd9bc3e['length']?this['_getMenuBarGroupButtons']({'command':_0x482f1a,'commands':_0xd9bc3e[0x0]['commands'],'parentMenuView':_0x5c697e,'onExecute':_0x1b6847})['forEach'](_0x3f00f6=>_0x27b499['items']['add'](_0x3f00f6)):_0xd9bc3e['forEach'](({groupId:_0x33542d,groupLabel:_0x1e111d,commands:_0x3c31e9})=>{const _0xf8a7ca=new Jt(_0x3b2a6c,_0x5c697e),_0x5587e3=new te(_0x3b2a6c),_0x65cb4e=new Zt(_0x3b2a6c),_0x3279d0=this['_getMenuBarGroupButtons']({'command':_0x482f1a,'commands':_0x3c31e9,'parentMenuView':_0x5587e3,'onExecute':_0x1b6847});_0x5587e3['buttonView']['set']({'label':_0x1e111d||_0x33542d}),_0x5587e3['delegate']('execute')['to'](_0x5c697e),_0x65cb4e['items']['addMany'](_0x3279d0),_0x5587e3['panelView']['children']['add'](_0x65cb4e),_0xf8a7ca['children']['add'](_0x5587e3),_0x27b499['items']['add'](_0xf8a7ca);}),_0x5c697e['panelView']['children']['add'](_0x27b499);}['_getMenuBarGroupButtons']({command:_0x3321a1,commands:_0x34c6b9,parentMenuView:_0x20924e,onExecute:_0x4ec7ca}){const _0x38d40a=this['editor'],_0x32c2b4=_0x38d40a['locale'];return zi(_0x38d40a,_0x34c6b9)['map'](_0x56fb6c=>{const _0x3324c1=new Jt(_0x32c2b4,_0x20924e),_0x27fd2d=new jt(_0x32c2b4);return _0x27fd2d['set']({'label':_0x56fb6c['label']}),_0x27fd2d['delegate']('execute')['to'](_0x20924e),_0x27fd2d['on']('execute',()=>_0x4ec7ca(_0x56fb6c['id'])),_0x27fd2d['bind']('isEnabled')['to'](_0x3321a1,'enabledCommandsIds',_0x29ae53=>_0x29ae53['includes'](_0x56fb6c['id'])),_0x3324c1['children']['add'](_0x27fd2d),_0x3324c1;});}};function Xi(_0x3bd080,_0x1d23ce){return void 0x0!==_0x3bd080['order']&&void 0x0===_0x1d23ce['order']?0x1:void 0x0===_0x3bd080['order']&&void 0x0!==_0x1d23ce['order']?-0x1:void 0x0!==_0x3bd080['order']&&void 0x0!==_0x1d23ce['order']?_0x3bd080['order']-_0x1d23ce['order']:0x0;}function zi(_0x2800e0,_0x161c5b){_0x161c5b['sort'](Xi);const _0x5ef78c={},_0x1f565c=[];for(const _0x542afb of _0x161c5b)if(void 0x0!==_0x542afb['order']){if(_0x542afb['order']in _0x5ef78c)throw new at('ai-commands-config-order-collision',_0x2800e0,{'conflictingDefinitions':[_0x542afb,_0x5ef78c[_0x542afb['order']]]});_0x5ef78c[_0x542afb['order']]=_0x542afb,_0x1f565c['splice'](_0x542afb['order'],0x0,_0x542afb);}else _0x1f565c['push'](_0x542afb);return _0x1f565c;}var ji=class extends _0x57cbc7{static get['requires'](){return[Qi,Ri];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b07e6){super(_0x3b07e6);const _0x4b1acf=_0x3b07e6['config'],_0x53f79e=_0x3b07e6['locale'];_0x4b1acf['define']('ai.assistant.preserveComments',!0x0),_0x4b1acf['define']('ai.assistant.commands',Ji(_0x53f79e)),_0x4b1acf['define']('ai.assistant.extraCommandGroups',[]),_0x4b1acf['define']('ai.assistant.removeCommands',[]);let _0xa706af=fi(_0x4b1acf['get']('ai.assistant.commands'),_0x53f79e);const _0x191079=_0x4b1acf['get']('ai.assistant.extraCommandGroups'),_0x2a0941=_0x4b1acf['get']('ai.assistant.removeCommands');_0x191079['forEach'](_0x2e9744=>{const _0x411fe2=_0xa706af['find'](_0xcd5801=>_0xcd5801['groupId']===_0x2e9744['groupId']);_0x411fe2?_0x411fe2['commands']=_0x411fe2['commands']['concat'](_0x2e9744['commands']):_0xa706af['push'](_0x2e9744);}),_0xa706af=_0xa706af['filter'](_0x16c92=>!_0x2a0941['includes'](_0x16c92['groupId'])),_0xa706af['forEach'](_0x5e66c4=>{_0x5e66c4['commands']=_0x5e66c4['commands']['filter'](_0x4029e1=>!_0x2a0941['includes'](_0x4029e1['id']));}),_0x4b1acf['set']('ai.assistant.commands',_0xa706af);}};function Ji(_0x19d47b){return[{'groupId':'editOrReview','groupLabel':ki(_0x19d47b,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':ki(_0x19d47b,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':ki(_0x19d47b,'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(_0x19d47b,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':ki(_0x19d47b,'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(_0x19d47b,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':ki(_0x19d47b,'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(_0x19d47b,'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(_0x19d47b,'Change\x20tone'),'commands':[{'id':'professional','label':ki(_0x19d47b,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':ki(_0x19d47b,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':ki(_0x19d47b,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':ki(_0x19d47b,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':ki(_0x19d47b,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':ki(_0x19d47b,'Change\x20style'),'commands':[{'id':'business','label':ki(_0x19d47b,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':ki(_0x19d47b,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':ki(_0x19d47b,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':ki(_0x19d47b,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':ki(_0x19d47b,'Translate'),'commands':[{'id':'translateEnglish','label':ki(_0x19d47b,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':ki(_0x19d47b,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':ki(_0x19d47b,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':ki(_0x19d47b,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':ki(_0x19d47b,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':ki(_0x19d47b,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':ki(_0x19d47b,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':ki(_0x19d47b,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var Zi=class extends _0x57cbc7{['abortController'];static get['requires'](){return[Oi];}constructor(_0x56e1ed){super(_0x56e1ed),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'](_0x266591){return this['sendRequest'](_0x266591)['catch'](_0x4f4519=>{if(_0x4f4519 instanceof vi)return Promise['reject'](_0x4f4519);if('AbortError'==_0x4f4519['name'])return Promise['resolve']();throw console['error'](_0x4f4519),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x28cf59,_0x2ffd5e){const _0x2783af=this['editor']['locale'],_0x565aeb={'Content-Type':'application/json'};if('object'==typeof _0x28cf59)Object['assign'](_0x565aeb,_0x28cf59);else{if(_0x28cf59)try{const _0x2f1096=await _0x28cf59(_0x2ffd5e);Object['assign'](_0x565aeb,_0x2f1096);}catch{return Promise['reject'](new vi(ki(_0x2783af,'AI_ERROR_GET_HEADERS')));}}return _0x565aeb;}async['_prepareRequestParameters'](_0x131e23,_0x3241ff){const _0x5da6ef=this['editor']['locale'];if('object'==typeof _0x131e23)return _0x131e23;try{return await _0x131e23(_0x3241ff);}catch{return Promise['reject'](new vi(ki(_0x5da6ef,'AI_ERROR_GET_PARAMETERS')));}}},ts=class extends Zi{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x4f81b4){super(_0x4f81b4),_0x4f81b4['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x4f81b4['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x4f81b4['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x4f81b4['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x4f81b4['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x4f81b4['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x2c85e1,context:_0x38c075,onData:_0x21bb88,actionId:_0x346fb9}){const _0x123d9d=this['editor']['locale'],_0x867db7=await this['prepareMessages'](_0x2c85e1,_0x38c075,_0x346fb9),_0x2b81a3=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x346fb9),_0x5b1516=await this['_prepareRequestParameters'](this['_requestParameters'],_0x346fb9),_0x1008e0={'messages':_0x867db7,..._0x5b1516},_0x412d33={'method':'POST','headers':_0x2b81a3,'body':JSON['stringify'](_0x1008e0),'signal':this['abortController']['signal']},_0x477acd=await fetch(this['_apiUrl'],_0x412d33);if(_0x477acd['ok'])return _0x5b1516['stream']?await this['_readStreamableResponse'](_0x477acd,_0x21bb88):await this['_readStaticResponse'](_0x477acd,_0x21bb88),Promise['resolve']();{const _0x3de963=await _0x477acd['text']();return _0x3de963['includes']('context_length_exceeded')?Promise['reject'](new vi(ki(_0x123d9d,'AI_ERROR_CONTEXT_LENGTH'))):_0x3de963['includes']('Moderation')?Promise['reject'](new vi(ki(_0x123d9d,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x3de963));}}async['prepareMessages'](_0x50e316,_0xd8771d,_0x29e1d3){let _0x48ba6c,_0x184a3a;return _0xd8771d?(_0x48ba6c='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.',_0x184a3a='Instruction:\x0a'+_0x50e316+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0xd8771d):(_0x48ba6c='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.',_0x184a3a=_0x50e316),[{'role':'system','content':_0x48ba6c},{'role':'user','content':_0x184a3a}];}async['_readStreamableResponse'](_0x264aa9,_0x2b26b8){const _0x495ef2=_0x264aa9['body']['getReader'](),_0x160cea=new TextDecoder();let _0x1f6d90='',_0x5b6800='',_0x9bd69f='',_0x51751f=!0x1;for(;!_0x51751f;){const {done:_0x37a7db,value:_0xea8b5f}=await _0x495ef2['read'](),_0x58a863=_0x1f6d90+_0x160cea['decode'](_0xea8b5f);let _0x50b580='';_0x51751f=_0x37a7db;try{_0x50b580=this['_cleanUpData'](_0x58a863),_0x1f6d90='';}catch{_0x1f6d90=_0x58a863;continue;}_0x5b6800+=_0x50b580,!_0x51751f&&this['_isBufferIncomplete'](_0x5b6800)||_0x5b6800&&(_0x9bd69f+=_0x5b6800,_0x5b6800='',_0x2b26b8(_0x9bd69f));}return Promise['resolve']();}async['_readStaticResponse'](_0x3db1b4,_0xcd0fca){return _0xcd0fca((await _0x3db1b4['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x42ab4f){const _0x4020d9=_0x42ab4f['split']('<')['length']!==_0x42ab4f['split']('>')['length'],_0x4b10aa=_0x42ab4f['length']<0x1e;return _0x4020d9&&_0x4b10aa;}['_cleanUpData'](_0xfb97f4){return _0xfb97f4['split'](/\n(?![^{]*\})/g)['map'](_0x3e7314=>_0x3e7314['replace']('data:\x20',''))['filter'](_0x41a2c9=>_0x41a2c9&&_0x41a2c9['length']>0x0&&'[DONE]'!==_0x41a2c9)['map'](_0x11b9e0=>{const {choices:_0x4fe40f}=JSON['parse'](_0x11b9e0);if(_0x4fe40f[0x0]?.['delta']?.['content'])return _0x4fe40f[0x0]['delta']['content'];})['filter'](_0xf4a97=>_0xf4a97)['join']('');}},es=class extends Zi{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),ft('ai-aws-adapter-not-supported');}async['sendRequest'](_0x46f31a){throw Ct('ai-aws-adapter-not-supported'),new vi(ki(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},is=class extends Pt{constructor(_0x5d61ad,_0x41ef4f={}){super(_0x5d61ad),this['isToggleable']=!0x0,this['set']('side',_0x41ef4f['side']||'top');const _0x6e6719=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Rt(_0x41ef4f['class']||[]),_0x6e6719['to']('side',_0x16a1b1=>'ck-tab-button_'+_0x16a1b1),_0x6e6719['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ss=class extends _0x223663{['children'];constructor(_0x33f187,_0x27e41f={}){super(_0x33f187);const _0x19fd66=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Rt(_0x27e41f['class']||[]),_0x19fd66['to']('class'),_0x19fd66['if']('isVisible','ck-hidden',_0xabfc42=>!_0xabfc42)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x223663{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x3319ea,_0x548654={}){super(_0x3319ea),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x548654['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x548654['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0xa862bb,_0x3e31f0)=>_0xa862bb&&!_0x3e31f0);const _0x549fab=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Rt(_0x548654['class']||[]),_0x549fab['to']('side',_0x43b48d=>'ck-tabs_'+_0x43b48d),_0x549fab['to']('class'),_0x549fab['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x549fab['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x549fab['to']('side',_0x2e38f3=>'ck-tabs__buttons-container_'+_0x2e38f3)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x549fab['to']('side',_0x26cca6=>'ck-tabs__panels-container_'+_0x26cca6)]},'children':this['panelViews']},...Rt(_0x548654['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x8b1d0){const _0x1bd89=this['_tabs']['get'](_0x8b1d0);return _0x1bd89||null;}['addTab'](_0x5997c3){const _0x424132=this['_setupButton']({'id':_0x5997c3['id'],'label':_0x5997c3['buttonLabel'],'icon':_0x5997c3['buttonIcon'],'order':_0x5997c3['order']}),_0x54bd57=new ss(this['locale']);return _0x54bd57['render'](),_0x5997c3['content']&&_0x54bd57['children']['add'](_0x5997c3['content']),this['panelViews']['add'](_0x54bd57),this['_tabs']['set'](_0x5997c3['id'],{'button':_0x424132,'panel':_0x54bd57,'order':void 0x0!==_0x5997c3['order']?_0x5997c3['order']:null}),this['fire']('addTab:'+_0x5997c3['id'],{'id':_0x5997c3['id'],'button':_0x424132,'panel':_0x54bd57}),null===this['activeTab']?this['activateTab'](_0x5997c3['id']):this['_hidePanel'](_0x5997c3['id']),{'button':_0x424132,'panel':_0x54bd57};}['activateTab'](_0xef882d){if(null!==_0xef882d&&!this['getTab'](_0xef882d))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xef882d});if(this['isCollapsed']=!0x1,this['activeTab']===_0xef882d)return;const _0x12c7f5=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0xef882d,_0xef882d&&this['_showPanel'](_0xef882d),this['fire']('activateTab:'+_0xef882d,{'newTab':_0xef882d,'oldTab':_0x12c7f5});}['toggleTabPanel'](_0x12c258){this['activeTab']===_0x12c258?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x12c258);}['showTab'](_0x3f9c54){if(!this['getTab'](_0x3f9c54))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x3f9c54});this['_showPanel'](_0x3f9c54),this['_showButton'](_0x3f9c54),this['fire']('show:'+_0x3f9c54,_0x3f9c54);}['hideTab'](_0x454736){if(!this['getTab'](_0x454736))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x454736});const _0x2905f7=this['activeTab'];this['_hidePanel'](_0x454736),this['_hideButton'](_0x454736);const _0x5e3183=this['getTabIds']();_0x2905f7===_0x454736&&_0x5e3183['length']>0x1&&this['activateTab'](_0x5e3183['find'](_0x58947c=>_0x58947c!==_0x454736)),this['fire']('hide:'+_0x454736,_0x454736);}['_getPanel'](_0x197a8e){const _0xe03a2e=this['_tabs']['get'](_0x197a8e);return _0xe03a2e?_0xe03a2e['panel']:null;}['_showPanel'](_0x598265){null!==this['activeTab']&&this['activeTab']!==_0x598265||this['_getPanel'](_0x598265)['show']();}['_hidePanel'](_0x5c0d85){const _0x5dffd9=this['_getPanel'](_0x5c0d85);_0x5dffd9['isVisible']&&(this['activeTab']===_0x5c0d85&&(this['activeTab']=null),_0x5dffd9['hide']());}['_getButton'](_0x1a3ccc){const _0xdc207=this['_tabs']['get'](_0x1a3ccc);return _0xdc207?_0xdc207['button']:null;}['_showButton'](_0x107bd4){this['_getButton'](_0x107bd4)['show']();}['_hideButton'](_0x6b23dd){this['_getButton'](_0x6b23dd)['hide']();}['_setupButton'](_0x520778){const _0x588a04=new is(this['locale'],{'side':this['side']}),_0x259f44=this['buttonViews'];if(_0x588a04['set']({'label':_0x520778['label'],'icon':_0x520778['icon'],'tooltip':!0x0,'withText':!0x0}),_0x588a04['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x8c98b3,_0x202312)=>_0x8c98b3===_0x520778['id']&&!_0x202312),_0x588a04['bind']('side')['to'](this,'side'),_0x520778['order']){const _0x10c90c=[...this['_tabs']]['reduce']((_0x539ecc,_0x122e6c)=>{const _0x16980d=_0x122e6c[0x0],{order:_0x32f364}=_0x122e6c[0x1];return!_0x32f364||_0x32f364>_0x520778['order']?_0x539ecc:_0x32f364>=_0x539ecc['order']?{'id':_0x16980d,'order':_0x32f364}:_0x539ecc;},{'id':'','order':0x0}),_0x18ecc4=_0x259f44['getIndex'](this['_getButton'](_0x10c90c['id']));_0x259f44['add'](_0x588a04,_0x18ecc4+0x1);}else _0x259f44['add'](_0x588a04);return _0x588a04['on']('execute',()=>{this['toggleTabPanel'](_0x520778['id']);}),_0x588a04;}};const rs=['overlay','sidebar','custom'],os=['left','right'];var as=class extends ns{constructor(_0x26918d,_0x3c1585={}){super(_0x26918d,_0x3c1585),this['set']('type',_0x3c1585['type']||'sidebar'),this['set']('side',_0x3c1585['side']||'right'),this['set']('isVisible',_0x3c1585['visibleByDefault']??!0x0);const _0x36a4cc=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x36a4cc['if']('type','ck-ai-tabs__overlay',_0xe89fbe=>'overlay'===_0xe89fbe),_0x36a4cc['if']('type','ck-ai-tabs__sidebar',_0x567067=>'sidebar'===_0x567067),_0x36a4cc['if']('isVisible','ck-hidden',_0x13ee73=>!_0x13ee73)]}}),this['buttonViews']['on']('add',(_0x1d09c5,_0x322520)=>{_0x322520['set']('withText',!0x1);});}},hs=class extends _0x394116{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x51751e){if(super(_0x51751e),!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 _0x3b22be=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x3b22be['showResizeButton']&&(this['showResizeButton']=_0x3b22be['showResizeButton']),'sidebar'!==_0x3b22be['type']&&'overlay'!==_0x3b22be['type']||_0x3b22be['side']&&(this['side']=_0x3b22be['side']),'sidebar'===_0x3b22be['type']){if(this['container']=_0x3b22be['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x3b22be['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':_0x3b22be['visibleByDefault'],'collapsible':_0x3b22be['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 _0x3dd3ce&&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'](_0x10ce0f){if(_0x10ce0f&&this['type']!==_0x10ce0f){if(!rs['includes'](_0x10ce0f))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x10ce0f;}}['switchSide'](_0x30afe7){if(_0x30afe7&&this['side']!==_0x30afe7){if(!os['includes'](_0x30afe7))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x30afe7;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},cs=class extends _0x394116{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x4df96d];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5af50f){if(super(_0x5af50f),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 _0x115ed5=this['context']['plugins']['get'](_0x4df96d);if(!_0x115ed5['token'])throw new at('ai-missing-token',this);this['_token']=_0x115ed5['token'];}['startConversation'](_0x4f48d3,_0x426337){const _0x16feb5=this['_sendApiRequest']('/conversations','POST',{'id':_0x4f48d3,'group':_0x426337});return{'getConversation':async()=>(await _0x16feb5['request'])['json'](),'abortController':_0x16feb5['abortController']};}['queryAssistant']({message:_0x530c83,conversationId:_0x4f2312,parts:_0x17d9a3,capabilities:_0x2f66ee,model:_0x39f0e7,attributes:_0xe460b5}){const _0x2e259e={'prompt':_0x530c83,'content':_0x17d9a3,'model':_0x39f0e7,..._0x2f66ee&&{'capabilities':_0x2f66ee},..._0xe460b5&&{'attributes':_0xe460b5}},_0x208f2d=this['_sendApiRequest']('/conversations/'+_0x4f2312+'/messages','POST',_0x2e259e,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x12bdbf=(await _0x208f2d['request'])['body'];return this['_getStreamReader'](_0x12bdbf);},'abortController':_0x208f2d['abortController']};}['executeCustomAction']({content:_0x13cb90,message:_0x352d56,model:_0x77932b,outputFormat:_0x2b5eb9}){const _0x420bec={'content':[{'type':'text','content':_0x13cb90}],'prompt':_0x352d56,'model':_0x77932b,'outputFormat':_0x2b5eb9},_0x39fd85=this['_sendApiRequest']('/actions/custom/calls','POST',_0x420bec);return{'getStream':async()=>{const _0x26616e=(await _0x39fd85['request'])['body'];return this['_getStreamReader'](_0x26616e);},'abortController':_0x39fd85['abortController']};}['executeAction']({actionName:_0x57a3cb,content:_0x346159,args:_0x5ea759}){const _0x5343a0={'content':[{'type':'text','content':_0x346159}],'args':_0x5ea759},_0x14bd7c=this['_sendApiRequest']('/actions/system/'+_0x57a3cb+'/calls','POST',_0x5343a0);return{'getStream':async()=>{const _0x1c1a91=(await _0x14bd7c['request'])['body'];return this['_getStreamReader'](_0x1c1a91);},'abortController':_0x14bd7c['abortController']};}['uploadFile'](_0x5ee94f,_0x5ecd5f,_0x12c9f3){const _0x3e3c05=new FormData();_0x3e3c05['append']('file',_0x5ecd5f,_0x5ecd5f['name']),_0x12c9f3&&_0x3e3c05['append']('attributes',JSON['stringify'](_0x12c9f3));const _0x4dfe63=this['_sendApiRequest']('/conversations/'+_0x5ee94f+'/files','POST',_0x3e3c05);return{'getId':async()=>(await _0x4dfe63['request'])['json'](),'abortController':_0x4dfe63['abortController']};}['uploadDocuments'](_0x34dbc9,_0xb3e729){const _0x5449fa={'documents':_0xb3e729['map'](_0x573337=>({'content':_0x573337['content'],'attributes':{'version':_0x573337['version'],'sessionId':_0x573337['sessionId'],'channelId':_0x573337['channelId'],'rootName':_0x573337['rootName'],'selections':_0x573337['selections']},...void 0x0!==_0x573337['name']?{'name':_0x573337['name']}:{},...void 0x0!==_0x573337['description']?{'description':_0x573337['description']}:{}}))},_0x4a31a6=this['_sendApiRequest']('/conversations/'+_0x34dbc9+'/documents/batch','POST',_0x5449fa);return{'getIds':async()=>(await _0x4a31a6['request'])['json'](),'abortController':_0x4a31a6['abortController']};}['fetchDocuments'](_0x91f63,_0x47c510){const _0x5ae46e=new URLSearchParams();_0x5ae46e['append']('documentIds',_0x47c510['join'](','));const _0xba121b=this['_sendApiRequest']('/conversations/'+_0x91f63+'/documents/batch?'+_0x5ae46e['toString'](),'GET');return{'getDocuments':async()=>(await _0xba121b['request'])['json'](),'abortController':_0xba121b['abortController']};}['fetchConversations'](_0x3ec107,_0x3a327c={}){const _0x13ad7b=new URLSearchParams();_0x13ad7b['append']('group',_0x3ec107),_0x13ad7b['append']('excludeEmpty',!0x1!==_0x3a327c['excludeEmpty']?'true':'false'),_0x13ad7b['append']('limit',_0x3a327c['limit']?_0x3a327c['limit']['toString']():'100'),_0x13ad7b['append']('sortBy',_0x3a327c['sortBy']?_0x3a327c['sortBy']:'createdAt'),_0x13ad7b['append']('order',_0x3a327c['order']?_0x3a327c['order']:'desc');const _0x2a8176=this['_sendApiRequest']('/conversations?'+_0x13ad7b['toString'](),'GET');return{'getConversations':async()=>(await(await _0x2a8176['request'])['json']())['items'],'abortController':_0x2a8176['abortController']};}['deleteConversation'](_0x4af040){const _0x1e2e5b=this['_sendApiRequest']('/conversations/'+_0x4af040,'DELETE');return{'execute':async()=>{await _0x1e2e5b['request'];},'abortController':_0x1e2e5b['abortController']};}['updateConversation'](_0x3abf33,_0x526692){const _0x5c175d=this['_sendApiRequest']('/conversations/'+_0x3abf33,'PATCH',_0x526692);return{'getResult':async()=>(await _0x5c175d['request'],_0x526692),'abortController':_0x5c175d['abortController']};}['fetchConversation'](_0x1a6bd2){const _0x216dce=this['_sendApiRequest']('/conversations/'+_0x1a6bd2,'GET');return{'getConversation':async()=>(await _0x216dce['request'])['json'](),'abortController':_0x216dce['abortController']};}['fetchConversationMessages'](_0x31a5f7){const _0x3a380a=this['_sendApiRequest']('/conversations/'+_0x31a5f7+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x3a380a['request'])['json']())['items'],'abortController':_0x3a380a['abortController']};}['uploadUrl'](_0x27e537,_0x4c9ef2,_0x2c8157){const _0x417094=this['_sendApiRequest']('/conversations/'+_0x27e537+'/web-resources','POST',{'url':_0x4c9ef2,'attributes':_0x2c8157});return{'getId':async()=>(await _0x417094['request'])['json'](),'abortController':_0x417094['abortController']};}['getModels'](_0x5ba6ac='en'){const _0xd3fbbc=new URLSearchParams();_0xd3fbbc['append']('language',_0x5ba6ac);const _0x18d40d='/models/1?'+_0xd3fbbc['toString'](),_0x4075c0=this['_sendApiRequest'](_0x18d40d,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x4075c0['request'])['json'](),'abortController':_0x4075c0['abortController']};}['deleteFile'](_0x485f10,_0x56e177){const _0x21c7c2=this['_sendApiRequest']('/conversations/'+_0x485f10+'/files/'+_0x56e177,'DELETE');return{'execute':async()=>{await _0x21c7c2['request'];},'abortController':_0x21c7c2['abortController']};}['deleteDocument'](_0x59680e,_0x41cbec){const _0x3e13a6=this['_sendApiRequest']('/conversations/'+_0x59680e+'/documents/'+_0x41cbec,'DELETE');return{'execute':async()=>{await _0x3e13a6['request'];},'abortController':_0x3e13a6['abortController']};}['deleteWebResource'](_0x52faa2,_0x44fc6a){const _0x1dbb40=this['_sendApiRequest']('/conversations/'+_0x52faa2+'/web-resources/'+_0x44fc6a,'DELETE');return{'execute':async()=>{await _0x1dbb40['request'];},'abortController':_0x1dbb40['abortController']};}['cancelStream'](_0x217815,_0x506159){const _0x81076b=this['_sendApiRequest']('/conversations/'+_0x217815+'/messages/'+_0x506159+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x81076b['request'];},'abortController':_0x81076b['abortController']};}['resumeStream'](_0x2a07be,_0x536a16,_0x4b21c9='0-0'){const _0x3956df=new URLSearchParams({'lastEventId':_0x4b21c9}),_0x2732c8=this['_sendApiRequest']('/conversations/'+_0x2a07be+'/messages/'+_0x536a16+'/stream?'+_0x3956df['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x192e83=await _0x2732c8['request'];return this['_getStreamReader'](_0x192e83['body']);},'abortController':_0x2732c8['abortController']};}['callSystemReview']({reviewName:_0x3f6065,content:_0x28fd11,args:_0x44d750}){const _0x1cd90b=this['_sendApiRequest']('/reviews/system/'+_0x3f6065+'/calls','POST',{'content':[{'type':'text','content':_0x28fd11}],'args':_0x44d750});return{'getStream':async()=>{const _0x1880f2=(await _0x1cd90b['request'])['body'];return this['_getStreamReader'](_0x1880f2);},'abortController':_0x1cd90b['abortController']};}['processDocument']({document:_0x5ad2c5,prompt:_0x2d47a6,model:_0x32721f}){const _0x24b612=this['_sendApiRequest']('/documents/process','POST',{'document':_0x5ad2c5,'prompt':_0x2d47a6,'model':_0x32721f});return{'getResult':async()=>(await _0x24b612['request'])['json'](),'abortController':_0x24b612['abortController']};}['callCustomReview']({content:_0x548cad,prompt:_0x198252,model:_0x440344}){const _0x464588=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x548cad}],'prompt':_0x198252,'model':_0x440344});return{'getStream':async()=>{const _0xe7b4bf=(await _0x464588['request'])['body'];return this['_getStreamReader'](_0xe7b4bf);},'abortController':_0x464588['abortController']};}['upsertAIChatRating'](_0x4e4168,_0x2ed7b2,_0x58f0a5){const _0x1f40f2=this['_sendApiRequest']('/conversations/'+_0x4e4168+'/messages/'+_0x2ed7b2+'/ratings','PUT',{'positiveCount':_0x58f0a5['positiveCount'],'totalCount':_0x58f0a5['totalCount'],'modificationId':_0x58f0a5['modificationId']});return{'execute':async()=>{await _0x1f40f2['request'];},'abortController':_0x1f40f2['abortController']};}['upsertAIActionRating'](_0x4da668,_0x483bce,_0x466a5a){const _0x64e4fd=this['_sendApiRequest']('/actions/system/'+_0x4da668+'/calls/'+_0x483bce+'/ratings','PUT',{'positiveCount':_0x466a5a['positiveCount'],'totalCount':_0x466a5a['totalCount']});return{'execute':async()=>{await _0x64e4fd['request'];},'abortController':_0x64e4fd['abortController']};}['upsertCustomAIActionRating'](_0x38f573,_0x354bc7){const _0x3652b7=this['_sendApiRequest']('/actions/custom/calls/'+_0x38f573+'/ratings','PUT',{'positiveCount':_0x354bc7['positiveCount'],'totalCount':_0x354bc7['totalCount']});return{'execute':async()=>{await _0x3652b7['request'];},'abortController':_0x3652b7['abortController']};}['upsertAIReviewRating'](_0x5f5822,_0x35e330,_0x2711ed,_0x377a1e){const _0xcf6f8a=this['_sendApiRequest']('/reviews/system/'+_0x5f5822+'/calls/'+_0x35e330+'/ratings','PUT',{'positiveCount':_0x2711ed['positiveCount'],'totalCount':_0x2711ed['totalCount'],'dataId':_0x377a1e});return{'execute':async()=>{await _0xcf6f8a['request'];},'abortController':_0xcf6f8a['abortController']};}['upsertCustomAIReviewRating'](_0x5b60ca,_0x28acea,_0x2be852){const _0x45b0c4=this['_sendApiRequest']('/reviews/custom/calls/'+_0x5b60ca+'/ratings','PUT',{'positiveCount':_0x28acea['positiveCount'],'totalCount':_0x28acea['totalCount'],'dataId':_0x2be852});return{'execute':async()=>{await _0x45b0c4['request'];},'abortController':_0x45b0c4['abortController']};}['_sendApiRequest'](_0x3d117c,_0x3a942f,_0x62d44b,_0xfed982={}){const {useCache:_0xf6befa=!0x1,apiUrl:_0x4787f3=this['_apiUrl']}=_0xfed982,_0x195a0b=new AbortController(),_0x2aac22=_0xf6befa?_0x3a942f+':'+_0x3d117c:null;if(_0x2aac22){const _0x17d57c=this['_responseCache']['get'](_0x2aac22);if(_0x17d57c)return{'request':_0x17d57c['then'](_0x36aa38=>_0x36aa38['clone']()),'abortController':_0x195a0b};}const _0x1b8c1d=_0x62d44b instanceof FormData,_0x19591d={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':vt};_0x62d44b&&!_0x1b8c1d&&(_0x19591d['Content-Type']='application/json');const _0x20e596={'method':_0x3a942f,'headers':_0x19591d,'signal':_0x195a0b['signal']};_0x62d44b&&(_0x20e596['body']=_0x1b8c1d?_0x62d44b:JSON['stringify'](_0x62d44b));const _0x498be0=fetch(''+_0x4787f3+_0x3d117c,_0x20e596)['catch'](_0x222341=>{_0x2aac22&&this['_responseCache']['delete'](_0x2aac22),this['_handleError'](_0x222341);})['then'](_0x10fb15=>_0x10fb15['ok']?_0x10fb15:_0x10fb15['json']()['then'](_0x2423d7=>{throw _0x2aac22&&this['_responseCache']['delete'](_0x2aac22),{'url':_0x4787f3,'path':_0x3d117c,'method':_0x3a942f,'body':_0x62d44b,'status':(_0x10fb15||{})['status'],'statusText':(_0x10fb15||{})['statusText'],'code':_0x2423d7['code'],'message':_0x2423d7['message'],'traceId':_0x2423d7['traceId']};}));return _0x2aac22&&this['_responseCache']['set'](_0x2aac22,_0x498be0['then'](_0x5bf511=>_0x5bf511['clone']())),{'request':_0x498be0,'abortController':_0x195a0b};}async*['_getStreamReader'](_0x16ed63){const _0x2c622d=[],_0x5aa436=_0x16ed63['getReader'](),_0x5afd57=_0x46ca60({'onError':_0x34a591=>{this['_handleError'](_0x34a591);},'onEvent':_0x34ec82=>{_0x34ec82['data']=JSON['parse'](_0x34ec82['data']),_0x2c622d['push'](_0x34ec82);}});try{let _0x46c2e6=!0x1;for(;!_0x46c2e6;){const {done:_0x2d24d3,value:_0x255c8f}=await _0x5aa436['read']();_0x2d24d3&&(_0x46c2e6=!0x0),_0x5afd57['feed'](this['_decoder']['decode'](_0x255c8f,{'stream':!0x0})),yield*_0x2c622d,_0x2c622d['length']=0x0;}}catch(_0x4d0098){this['_handleError'](_0x4d0098);}finally{_0x5aa436['releaseLock'](),_0x5afd57['reset']();}}['_handleError'](_0x266e33){if(_0x266e33 instanceof at)throw _0x266e33;if(_0x266e33 instanceof Error&&'AbortError'===_0x266e33['name'])throw new at('ai-request-aborted',this,{'originalError':_0x266e33});throw new at('ai-request-failed',this,{'originalError':_0x266e33});}};function ls(_0x5b965a,_0x3ded0a,_0x506b1b){const t=_0x5b965a['t'];switch(_0x3ded0a){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'},_0x506b1b);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.'},_0x506b1b);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.'},_0x506b1b);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.'},_0x506b1b);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'},_0x506b1b);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x506b1b);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'},_0x506b1b);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.'},_0x506b1b);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.'},_0x506b1b);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.'},_0x506b1b);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.'},_0x506b1b);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'},_0x506b1b);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.'},_0x506b1b);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 _0x3ded0a;}}function us(_0x2834c3){return _0x2834c3?_0x2834c3 instanceof _0x3dd3ce?[_0x2834c3]:_0x2834c3['editors']&&0x0!==_0x2834c3['editors']['length']?Array['from'](_0x2834c3['editors']):[]:[];}function ds(_0x2d3f10){const _0x310b94=us(_0x2d3f10);if(!_0x310b94['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x310b94['length'])return _0x310b94[0x0];const _0x435b95=_0x310b94['find'](_0x11ddae=>_0x11ddae['ui']?.['focusTracker']?.['isFocused']);if(_0x435b95)return _0x435b95;const _0x1c1fd1=function(_0x43a54f){if(_0x43a54f instanceof _0x3dd3ce)return;const _0x290f88=_0x43a54f;if(!_0x290f88['plugins']||!_0x290f88['plugins']['has']('AIEditing'))return;return _0x290f88['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x2d3f10);return _0x1c1fd1&&_0x310b94['includes'](_0x1c1fd1)?_0x1c1fd1:_0x310b94[0x0];}const _s='ai-selection',gs=['br'];var As=class extends _0x394116{constructor(_0x122215){super(_0x122215),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'](_0xef21f8){let _0x416d36=this['_sessionIdByEditor']['get'](_0xef21f8);return _0x416d36||(_0x416d36=_0xef21f8['plugins']['has']('RealTimeCollaborationClient')&&_0xef21f8['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Ot(),this['_sessionIdByEditor']['set'](_0xef21f8,_0x416d36)),_0x416d36;}async['getDocumentData'](){const _0x15afd8=us(this['context']);if(!_0x15afd8['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x549132=[],_0x11180a=new Set();for(const _0x33c687 of _0x15afd8){const _0x3d7550=_0x33c687['config']['get']('roots')||{};for(const _0x5c10d0 of _0x33c687['model']['document']['getRoots']()){if('$graveyard'===_0x5c10d0['rootName'])continue;const _0x2ea875=await this['_getDocumentDataForEditorRoot'](_0x33c687,_0x5c10d0,_0x11180a),_0x508399=_0x3d7550[_0x5c10d0['rootName']],_0x1af86f=_0x5c10d0['getAttribute']('$description')??_0x508399?.['description'];let _0xc96fb9=_0x5c10d0['getAttribute']('$title')??_0x508399?.['title'];_0xc96fb9||(_0xc96fb9=_0x5c10d0['getAttribute']('$rootEditableOptions')?.['label']??_0x508399?.['label']),_0xc96fb9||(ft('ai-document-root-missing-title',{'editor':_0x33c687,'rootName':_0x5c10d0['rootName']}),_0xc96fb9=_0x5c10d0['rootName']),_0x549132['push']({'editor':_0x33c687,'rootName':_0x5c10d0['rootName'],'content':_0x2ea875['content'],'version':_0x2ea875['version'],'sessionId':this['getSessionId'](_0x33c687),'channelId':_0x33c687['config']['get']('collaboration.channelId'),'selections':_0x2ea875['selections'],'name':_0xc96fb9,'description':_0x1af86f});}}return _0x549132;}async['_getDocumentDataForEditorRoot'](_0x39562e,_0x54ea3d,_0x2fedfb){const _0x4cc2cb=_0x39562e['data']['toView'](_0x54ea3d,{'convertAiChatSelectionMarker':!0x0}),_0x480362=new _0x17583a(_0x39562e['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4cc2cb,_0x480362,_0x2fedfb);let _0xfe1639=await this['_getDocumentDataStringFromView'](_0x4cc2cb,_0x39562e);const _0x20935e=this['_getMarkersInDocumentOrder'](_0x39562e,_0x54ea3d),_0x26d234=[];for(const _0x16dd33 of _0x20935e){const _0x22ea76='<'+_0x16dd33['name']+':start></'+_0x16dd33['name']+':start>',_0x2ccb1d=_0xfe1639['indexOf'](_0x22ea76);_0xfe1639=_0xfe1639['substring'](0x0,_0x2ccb1d)+_0xfe1639['substring'](_0x2ccb1d+_0x22ea76['length']);const _0x546b4b='<'+_0x16dd33['name']+':end></'+_0x16dd33['name']+':end>',_0x5baec8=_0xfe1639['indexOf'](_0x546b4b);_0xfe1639=_0xfe1639['substring'](0x0,_0x5baec8)+_0xfe1639['substring'](_0x5baec8+_0x546b4b['length']),_0x26d234['push']({'markerName':_0x16dd33['name'],'start':_0x2ccb1d,'end':_0x5baec8,'htmlFragment':_0xfe1639['substring'](_0x2ccb1d,_0x5baec8)});}return{'content':_0xfe1639,'version':_0x39562e['model']['document']['version'],'selections':_0x26d234};}['afterInit'](){this['context']instanceof _0x3dd3ce?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x3c0b48,_0x85e0da)=>{_0x85e0da['on']('ready',()=>{this['_integrateEditor'](_0x85e0da);});});}['_setOutputDataProcessor'](_0x53a32e){this['_outputDataProcessor']=_0x53a32e;}async['_getDocumentDataStringFromView'](_0x4b51e5,_0x380fcb){let _0x37d628;if(this['_outputDataProcessor']){const _0x266a9b=_0x380fcb['data']['processor']['domConverter']['viewToDom'](_0x4b51e5),_0x2fa96f=await this['_outputDataProcessor'](_0x266a9b);_0x37d628=_0x380fcb['data']['processor']['htmlWriter']['getHtml'](_0x2fa96f);}else _0x37d628=_0x380fcb['data']['processor']['toData'](_0x4b51e5);return _0x37d628;}['_integrateEditor'](_0x44543b){if(!_0x44543b['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x44543b);_0x44543b['ui']['focusTracker']['on']('change:isFocused',(_0x3e2850,_0x12a00d,_0x41c61e)=>{_0x41c61e&&(this['_lastContentFocusedEditor']=_0x44543b);}),_0x44543b['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x44543b&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x44543b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':_s,'view':({markerName:_0x585e5a})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x585e5a['split'](':')[0x1]],'priority':0xc})}),_0x44543b['conversion']['for']('dataDowncast')['markerToElement']({'model':_s+':context','view':(_0x4b2a85,{writer:_0xe39949,options:_0x3fe787})=>_0x3fe787['convertAiChatSelectionMarker']?_0xe39949['createUIElement'](_0x4b2a85['markerName']+':'+(_0x4b2a85['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x1a2312){const _0x27e213=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x1a2312);const _0x4b43c9=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x27e213,_0x4b43c9);}['hideFakeVisualSelection'](_0x2adb8d){const _0x4297eb=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x2adb8d);const _0x104f17=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4297eb,_0x104f17);}async['modelToDataWithIds'](_0x5002e7,_0xf78417){const _0x59a367=_0xf78417['data']['toView'](_0x5002e7),_0x365c4f=new _0x17583a(_0xf78417['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x59a367,_0x365c4f),this['_getDocumentDataStringFromView'](_0x59a367,_0xf78417);}['_setDataIdsOnChildren'](_0x59c75f,_0x1d7f1b,_0x44e176=new Set()){let _0x3e16bd=!0x1;for(const _0x3f5714 of _0x59c75f['getChildren']()){if(!_0x3f5714['is']('view:element')||gs['includes'](_0x3f5714['name']))continue;const _0x45acd5=_0x3f5714['is']('view:containerElement'),_0x1d6bd9=_0x3f5714['is']('view:emptyElement'),_0x20ed2b=_0x3f5714['is']('view:rawElement'),_0x40ddc8=this['_setDataIdsOnChildren'](_0x3f5714,_0x1d7f1b,_0x44e176);_0x3f5714['hasAttribute']('data-id')?(_0x3e16bd=!0x0,_0x44e176['add'](_0x3f5714['getAttribute']('data-id'))):(_0x45acd5||_0x1d6bd9||_0x20ed2b||_0x40ddc8)&&(_0x1d7f1b['setAttribute']('data-id',this['_nextDataId'](_0x44e176),_0x3f5714),_0x3e16bd=!0x0);}return _0x3e16bd;}['_nextDataId'](_0x26738d){let _0x1517d4;do{_0x1517d4='';for(let _0x2309c1=0x0;_0x2309c1<0x4;_0x2309c1++)_0x1517d4+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x26738d['has'](_0x1517d4));return _0x26738d['add'](_0x1517d4),_0x1517d4;}['getSelectionText'](_0x10380c){const _0x44e2d=(_0x10380c?_0x10380c['model']:ds(this['context'])['model'])['document']['selection'],_0x37a588=[],_0x4f4e4c=Array['from'](_0x44e2d['getRanges']());_0x4f4e4c['sort']((_0xc04b2f,_0x2bc65f)=>_0xc04b2f['start']['isBefore'](_0x2bc65f['start'])?-0x1:0x1);for(const _0x11a532 of _0x4f4e4c)for(const _0x32e181 of _0x11a532['getItems']())_0x32e181['is']('$textProxy')?_0x37a588['push'](_0x32e181['data']):_0x32e181['is']('element')&&_0x37a588['length']>0x0&&'\x20'!==_0x37a588[_0x37a588['length']-0x1]&&_0x37a588['push']('\x20');return _0x37a588['length']?'\x22'+_0x37a588['join']('')['trim']()+'\x22':ls(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x1d43fa){for(let _0x1ad070=0x0;_0x1ad070<this['_fakeSelections']['length'];_0x1ad070++)if(this['_fakeSelections'][_0x1ad070]['id']==_0x1d43fa)return void this['_fakeSelections']['splice'](_0x1ad070,0x1);}['_addFakeSelection'](_0x50a961){this['_removeFakeSelectionById'](_0x50a961['id']),Tt(this['_fakeSelections'],_0x50a961);}['_refreshFakeSelection'](_0x4e843a,_0x30da00){if(_0x4e843a==_0x30da00)return;const _0x38d39f=_0x4e843a?_0x4e843a['editor']:null,_0x5e2911=_0x30da00?_0x30da00['editor']:null,_0x347ddb=(_0x580660,_0x4f2e7e)=>{const _0x56806c=_0x4f2e7e['model']['markers']['getMarkersGroup'](_s);for(const _0x1565e7 of _0x56806c)_0x580660['removeMarker'](_0x1565e7);},_0x54744a=(_0x335f57,_0x2c2680,_0x47272e)=>{const _0x3a7640=_0x2c2680['model'];for(let _0x57b95b=0x0;_0x57b95b<_0x47272e['ranges']['length'];_0x57b95b++){let _0x2e90f3=_0x47272e['ranges'][_0x57b95b];const _0x473d7b=_s+':'+_0x47272e['id']+':'+_0x57b95b;if(_0x2e90f3['start']['isAtEnd']){const _0xb502b2=_0x2e90f3['start']['getLastMatchingPosition'](({item:_0x3ed53e})=>!_0x3a7640['schema']['isContent'](_0x3ed53e),{'boundaries':_0x2e90f3});_0x2e90f3=_0x335f57['createRange'](_0xb502b2,_0x2e90f3['end']);}_0x335f57['addMarker'](_0x473d7b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2e90f3});}};_0x38d39f&&_0x5e2911&&_0x38d39f===_0x5e2911&&_0x30da00?_0x38d39f['model']['change'](_0x1ad195=>{_0x347ddb(_0x1ad195,_0x38d39f),_0x54744a(_0x1ad195,_0x5e2911,_0x30da00);}):(_0x38d39f&&_0x38d39f['model']['change'](_0x3e7630=>_0x347ddb(_0x3e7630,_0x38d39f)),_0x5e2911&&_0x30da00&&_0x5e2911['model']['change'](_0x51129b=>_0x54744a(_0x51129b,_0x5e2911,_0x30da00)));}['_getMarkersInDocumentOrder'](_0x24f8a7,_0x2221a7){const _0x467fbd=Array['from'](_0x24f8a7['model']['markers']['getMarkersGroup'](_s+':context'));return(_0x2221a7?_0x467fbd['filter'](_0x326440=>{const _0xd159f3=_0x326440['getRange']();return _0xd159f3&&_0xd159f3['root']['rootName']===_0x2221a7['rootName'];}):_0x467fbd)['sort']((_0x2d9fa3,_0x581d2e)=>_0x2d9fa3['getStart']()['isBefore'](_0x581d2e['getStart']())?-0x1:_0x2d9fa3['getStart']()['isAfter'](_0x581d2e['getStart']())?0x1:0x0);}};function Is(_0x987080,_0x370917){return _0x58ed25(_0x987080,_0x370917);}function ps(_0x5e518d,_0x19fcd9){return _0x28efca(_0x5e518d,_0x19fcd9);}function ms(_0x55fe32,_0x166452,_0x508d67){const _0x106dae=null!==_0x166452?_0x3b90dc=>_0x3b90dc['attribs'][_0x55fe32]===_0x166452:_0x2b9954=>Boolean(_0x2b9954['attribs'][_0x55fe32]);return _0x52cdf1(_0x3b6d08=>_0x3e1b97(_0x3b6d08)&&_0x106dae(_0x3b6d08),_0x508d67);}function Es(_0x197a42,_0xc1850e,_0x3654e7){const _0x24319b=null!==_0xc1850e?_0x5bc148=>_0x5bc148['attribs'][_0x197a42]===_0xc1850e:_0x436b3a=>Boolean(_0x436b3a['attribs'][_0x197a42]);return _0x5bd789(_0x488022=>_0x3e1b97(_0x488022)&&_0x24319b(_0x488022),_0x3654e7);}function Ts(_0x957f48){return _0x5bd789(_0x21e236=>_0x3e1b97(_0x21e236)&&function(_0x5ce03c){const _0x27ae28=_0x5ce03c['toLowerCase']();return'script'===_0x27ae28||'style'===_0x27ae28||_0x27ae28['includes']('-');}(_0x21e236['name']),_0x957f48);}function ws(_0xc68e28){return _0x2eb441(_0x5e2f4e=>_0x5b739d(_0x5e2f4e),_0xc68e28,!0x0,0x1/0x0);}function Cs(_0x4967af,_0x2ef619){return _0x4967af&&_0x3e1b97(_0x4967af)?_0x4967af['attribs'][_0x2ef619]:null;}function fs(_0x371705,_0x396c98,_0x330087){_0x3e1b97(_0x371705)&&(null===_0x330087?delete _0x371705['attribs'][_0x396c98]:_0x371705['attribs'][_0x396c98]=_0x330087);}function bs(_0x17fc47,_0xa767c5,_0x3db29e){const _0x5c16ca=_0xa767c5['cloneNode'](!0x0);'beforebegin'===_0x3db29e?_0x1929bb(_0x17fc47,_0x5c16ca):'afterbegin'===_0x3db29e?_0xfc9e1f(_0x17fc47,_0x5c16ca):'beforeend'===_0x3db29e?_0x5d571b(_0x17fc47,_0x5c16ca):'afterend'===_0x3db29e&&_0x5a71a1(_0x17fc47,_0x5c16ca);}function Ss(_0x4d5fef){const _0x2c6bed=[];let _0x23ad63=_0x4d5fef;for(;_0x23ad63;)_0x23ad63=_0x299af8(_0x23ad63),_0x23ad63&&_0x2c6bed['push'](_0x23ad63);return _0x2c6bed;}function Rs(_0x176e39){return _0x176e39['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Os(_0xdf097c){let _0x18cd7d=0x0;for(;_0xdf097c['parentNode'];)_0xdf097c=_0xdf097c['parentNode'],_0x18cd7d++;return _0x18cd7d;}function vs(_0x325a6e){const _0x10aadc=[];let _0x29baff=_0x325a6e['nextSibling'];for(;_0x29baff;)_0x10aadc['push'](_0x29baff),_0x29baff=_0x29baff['nextSibling'];_0x10aadc['forEach'](_0x1d3f6d=>{_0x3d0f4e(_0x1d3f6d);});}function ks({documentSuggestions:_0x2d8d13,transform:_0x333809,documentCompare:_0x346787,documentCompareOptions:_0x1559b5}){const _0x5e87c2=new Map();for(const [_0x246084,{groups:_0x8c9e18,documentContext:_0xf4d530,documentContent:_0xdc986f,editor:_0x271d3f}]of _0x2d8d13){const _0x1d50ce=_0xf4d530['content'],_0x2ee4f2=_0xf4d530['version'],_0x356402=_0xdc986f['cloneNode'](!0x0);for(const {changes:_0x1a4472}of _0x8c9e18){const _0x1bd94a=_0x1a4472['filter'](_0x3fd93d=>'new'!=_0x3fd93d['type'])['map'](_0x45605f=>ms('data-id',_0x45605f['id'],_0x356402)),_0x5ec9da=_0x1a4472['filter'](_0x352b62=>'removed'!=_0x352b62['type'])['map'](_0x25a3a6=>_0x25a3a6['node']['cloneNode'](!0x0));let _0x39309c=null;if(_0x1bd94a['length']){_0x39309c=_0x1bd94a[0x0]['previousSibling'];for(let _0x60726b=0x0;_0x60726b<_0x1bd94a['length'];_0x60726b++)_0x3d0f4e(_0x1bd94a[_0x60726b]);}if(_0x5ec9da['length']){_0x39309c||(_0x1a4472[0x0]['anchorId']?_0x39309c=ms('data-id',_0x1a4472[0x0]['anchorId'],_0x356402):(_0x39309c=_0x5ec9da['shift'](),_0xfc9e1f(_0x356402,_0x39309c)));for(let _0x3c285b=0x0;_0x3c285b<_0x5ec9da['length'];_0x3c285b++)_0x5a71a1(_0x39309c,_0x5ec9da[_0x3c285b]),_0x39309c=_0x5ec9da[_0x3c285b];}}const _0x4d42d3=ps(_0x356402),_0x5a5d45=_0x346787['getDiff'](_0x1d50ce,_0x4d42d3,{'targetEditor':_0x271d3f,'anchor':_0xf4d530['rootName'],..._0x1559b5})['getOperations']();if(_0x333809){const _0x405ec9=_0x271d3f['model']['document']['history']['getOperations'](_0x2ee4f2),_0x401e3b={'document':_0x271d3f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x5e87c2['set'](_0x246084,_0xd31715(_0x5a5d45,_0x405ec9,_0x401e3b)['operationsA']);}else _0x5e87c2['set'](_0x246084,_0x5a5d45);}return _0x5e87c2;}function Ns(_0x134ca9,_0x2530b1){if('marker'!=_0x2530b1['type'])return;const _0x149e44=_0x134ca9['model']['markers']['get'](_0x2530b1['name']);_0x149e44&&(_0x2530b1['oldRange']=_0x149e44['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(_0x55d1ff){super(),this['_generateUid']=_0x55d1ff||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x3b86bf,_0x576e09,_0x55eb4a){this['_uidCounter']=0x0;const _0x3dd18d=_0x3b86bf['cloneNode'](!0x0);Ps(_0x576e09,_0x3dd18d);const _0x1b8b20=_0x3dd18d['childNodes'],_0x7506d7=Array['from'](_0x1b8b20)['filter'](_0xad1e53=>!(0x3===_0xad1e53['nodeType']&&''===ps(_0xad1e53)['trim']())),_0x688b62=_0x7506d7['length'];this['_existingDataIds']=new Set(Es('data-id',null,_0x576e09)['map'](_0x44c740=>Cs(_0x44c740,'data-id'))['filter'](_0x239f3f=>!!_0x239f3f));for(const _0x32683b of _0x7506d7)_0x32683b&&_0x3e1b97(_0x32683b)&&void 0x0===_0x32683b['attribs']['data-id']&&fs(_0x32683b,'data-id','new-element');if(Es('data-id',null,_0x3dd18d)['forEach'](_0x74b5=>{const _0x1a6729=Cs(_0x74b5,'data-id');'new-element'===_0x1a6729||this['_existingDataIds']['has'](_0x1a6729)||fs(_0x74b5,'data-id','new-element');}),0x0===_0x576e09['childNodes']['length']){const _0x39836e=[];return Es('data-id','new-element',_0x3dd18d)['forEach'](_0x133a88=>{const _0x58556b=this['_generateUid']();fs(_0x133a88,'data-id',_0x58556b),_0x39836e['push'](_0x58556b);}),this['_removeSpecialComments'](_0x3dd18d),{'parsedContent':_0x3dd18d,'newNodeIds':_0x39836e,'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 _0x49737c=-0x1,_0x64e8ca=!0x1;for(let _0xca63e4=0x0;_0xca63e4<_0x688b62;_0xca63e4++){const _0x1f7bfe=_0x7506d7[_0xca63e4],_0x2d6d30=_0x7506d7[_0xca63e4+0x1];if(this['_isNewNode'](_0x1f7bfe)){if(-0x1===_0x49737c&&(_0x49737c=_0xca63e4),this['_markWrappedElements'](_0x1f7bfe),!this['_isNewNode'](_0x2d6d30)){const [_0x5c0e62,_0x1d74cd]=this['_findReferenceNode'](_0x1f7bfe,_0x64e8ca,_0x576e09);if(_0x5c0e62){const _0x2ae68e=Array['from'](_0x7506d7)['slice'](_0x49737c,_0xca63e4+0x1);this['_insertNodes'](_0x5c0e62,_0x2ae68e,_0x1d74cd),_0x49737c=-0x1;}}}else{if(this['_isExistingContentComment'](_0x1f7bfe))_0x64e8ca=!0x0;else{if(this['_isExistingNode'](_0x1f7bfe)){const _0xe218f=Cs(_0x1f7bfe,'data-id');if(_0xe218f&&this['_existingDataIds']['has'](_0xe218f)){this['_referencedExistingIds']['add'](_0xe218f);const _0x5421d6=ms('data-id',_0xe218f,_0x576e09);this['_replaceNode'](_0x5421d6,_0x1f7bfe);}}else{if(Ls(_0x1f7bfe)){const _0x380d39=Ds(_0x1f7bfe);ms('data-id',_0x380d39,_0x3dd18d)||this['_touchedNodesState']['removedIds']['push'](_0x380d39);}}}}}for(const _0x2b947b of this['_touchedNodesState']['removedIds']){const _0x5fba84=ms('data-id',_0x2b947b,_0x576e09);_0x5fba84&&(this['_rescueUnwrappedElements'](_0x5fba84),this['_removeNode'](_0x5fba84,_0x2b947b,_0x55eb4a));}if(Es('data-id','new-element',_0x576e09)['forEach'](_0x1cb7a7=>{const _0x47930d=this['_getUid'](_0x1cb7a7);fs(_0x1cb7a7,'data-id',_0x47930d),this['_touchedNodesState']['newIds']['push'](_0x47930d);}),this['_removeSpecialComments'](_0x576e09),_0x55eb4a&&_0x55eb4a['cutAfterUnstable']){const _0x4e71d6=this['_findLastConfirmationPoint'](_0x7506d7),_0x20bd0f=this['_getLastStableElement'](_0x576e09,_0x4e71d6);this['_markUnstableElements'](_0x576e09,_0x20bd0f);}if(this['_processWrappedElements'](_0x576e09,_0x55eb4a),_0x55eb4a&&_0x55eb4a['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x10c06f=Es('data-id',this['_touchedNodesState']['lastTouchedId'],_0x576e09);let _0x344206=_0x10c06f[_0x10c06f['length']-0x1];for(;_0x344206;)vs(_0x344206),_0x344206=_0x344206['parentNode'];}return{'parsedContent':_0x576e09,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x26d797,_0x510fb0,_0x4329ef){for(const _0x3753f6 of _0x510fb0){const _0x1dec3d=this['_getUid'](_0x3753f6);fs(_0x3753f6,'data-id',_0x1dec3d),this['_touchedNodesState']['newIds']['push'](_0x1dec3d),this['_touchedNodesState']['lastTouchedId']=_0x1dec3d;}const _0x3d0a89='afterbegin'===_0x4329ef||'afterend'===_0x4329ef?_0x510fb0['reverse']():_0x510fb0;for(const _0x23cd25 of _0x3d0a89)bs(_0x26d797,_0x23cd25,_0x4329ef);}['_replaceNode'](_0xa4fc90,_0x2aec71){if(!_0xa4fc90)return;if(_0xe5c04f=_0x2aec71,Rs(ps(_0xa4fc90))===Rs(ps(_0xe5c04f)))return;var _0xe5c04f;const _0xa64d4a=Cs(_0xa4fc90,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0xa64d4a),this['_touchedNodesState']['lastTouchedId']=_0xa64d4a,_0x2e5842(_0xa4fc90,_0x2aec71['cloneNode'](!0x0));}['_removeNode'](_0xd18f41,_0x4d5205,_0x2f424d){if(_0x2f424d&&_0x2f424d['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x4d5205;const _0x37f5aa=_0x2f424d['replaceRemovedWith']['cloneNode'](!0x0);fs(_0x37f5aa,'data-id',_0x4d5205),fs(_0x37f5aa,'data-removed','true'),_0x2e5842(_0xd18f41,_0x37f5aa);}else _0x3d0f4e(_0xd18f41);}['_findReferenceNode'](_0x2b5421,_0x46ee53,_0x3eaac4){const _0x5ac060=this['_findPrevElementWithDataId'](_0x2b5421,!0x1);if(_0x5ac060){const _0x19b2f7=Ds(_0x5ac060),_0x56b6c8=ms('data-id',_0x19b2f7,_0x3eaac4);if(_0x56b6c8)return[_0x56b6c8,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x19b2f7);}const _0x4b1884=this['_findNextElementWithDataId'](_0x2b5421,!0x1);if(_0x4b1884){const _0x38baf0=Ds(_0x4b1884),_0x130fab=ms('data-id',_0x38baf0,_0x3eaac4);if(_0x130fab)return[_0x130fab,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x38baf0);}return _0x46ee53?_0x2b5421['nextSibling']?this['_findFallbackReferenceNode'](_0x2b5421,_0x3eaac4):[_0x3eaac4['childNodes'][_0x3eaac4['childNodes']['length']-0x1],'afterend']:[_0x3eaac4['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x4cc273,_0x145661){const _0x591c22=[],_0x5a62d0=this['_findPrevElementWithDataId'](_0x4cc273,!0x0);if(_0x5a62d0){const _0x58a801=ms('data-id',Ds(_0x5a62d0),_0x145661);_0x58a801&&_0x591c22['push']([_0x58a801,'afterend']);}const _0x3e762d=this['_findNextElementWithDataId'](_0x4cc273,!0x0);if(_0x3e762d){const _0x324e9c=ms('data-id',Ds(_0x3e762d),_0x145661);_0x324e9c&&_0x591c22['push']([_0x324e9c,'beforebegin']);}return _0x591c22['length']>0x1?Os(_0x591c22[0x0][0x0])<=Os(_0x591c22[0x1][0x0])?_0x591c22[0x0]:_0x591c22[0x1]:0x1===_0x591c22['length']?_0x591c22[0x0]:[_0x145661['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x461f5e,_0x2b1c75){let _0x3d474d=_0x461f5e['nextSibling'],_0x1d672a=null,_0x366f0b=!0x1;for(;_0x3d474d;){if(_0x5b739d(_0x3d474d)){if(Ls(_0x3d474d)&&(_0x1d672a=_0x3d474d),this['_isExistingContentComment'](_0x3d474d)&&_0x2b1c75&&!_0x366f0b){_0x366f0b=!0x0,_0x3d474d=_0x3d474d['nextSibling'];continue;}break;}const _0x3acbb0=Cs(_0x3d474d,'data-id');if(_0x3acbb0&&'new-element'!==_0x3acbb0&&this['_existingDataIds']['has'](_0x3acbb0)){_0x1d672a=_0x3d474d;break;}_0x3d474d=_0x3d474d['nextSibling'];}return _0x1d672a;}['_findPrevElementWithDataId'](_0x33193d,_0x2015cb){let _0x43d686=_0x33193d['previousSibling'],_0x4cf442=null,_0x1fd26c=!0x1;for(;_0x43d686;){if(_0x5b739d(_0x43d686)){if(Ls(_0x43d686)&&(_0x4cf442=_0x43d686),this['_isExistingContentComment'](_0x43d686)&&_0x2015cb&&!_0x1fd26c){_0x1fd26c=!0x0,_0x43d686=_0x43d686['previousSibling'];continue;}break;}const _0x11a27d=Cs(_0x43d686,'data-id');if(_0x11a27d&&'new-element'!==_0x11a27d&&this['_existingDataIds']['has'](_0x11a27d)){_0x4cf442=_0x43d686;break;}_0x43d686=_0x43d686['previousSibling'];}return _0x4cf442;}['_markWrappedElements'](_0x1070dd){_0x3e1b97(_0x1070dd)&&Es('data-id',null,_0x1070dd)['forEach'](_0x259abf=>{this['_isExistingNode'](_0x259abf)&&(fs(_0x259abf,'data-wrapped-id',Cs(_0x259abf,'data-id')),fs(_0x259abf,'data-id',null));});}['_processWrappedElements'](_0x4eef14,_0x29bf56){Es('data-wrapped-id',null,_0x4eef14)['forEach'](_0x1e6b38=>{const _0x14a194=Cs(_0x1e6b38,'data-wrapped-id');if(this['_hasUnstableParent'](_0x1e6b38))return;const _0x5082c7=ms('data-id',_0x14a194,_0x4eef14);fs(_0x1e6b38,'data-id',_0x14a194),_0x5082c7&&(this['_removeNode'](_0x5082c7,_0x14a194,_0x29bf56),this['_touchedNodesState']['removedIds']['push'](_0x14a194),this['_touchedNodesState']['lastTouchedId']=_0x14a194);});}['_hasUnstableParent'](_0x428a2a){let _0x1c1313=_0x428a2a['parentNode'];for(;_0x1c1313;){if(Cs(_0x1c1313,'data-unstable'))return!0x0;_0x1c1313=_0x1c1313['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x59de5a){const _0x30ee40=new Set(this['_touchedNodesState']['removedIds']),_0x2fd6e0=new Set(this['_touchedNodesState']['newIds']);Es('data-id',null,_0x59de5a)['forEach'](_0x2d377c=>{const _0x306081=Cs(_0x2d377c,'data-id'),_0x5c288f=!!_0x306081&&this['_referencedExistingIds']['has'](_0x306081),_0x1435f8=!!_0x306081&&_0x2fd6e0['has'](_0x306081);if(!_0x306081||!_0x5c288f&&!_0x1435f8)return;if(_0x30ee40['has'](_0x306081))return;let _0x302e4d=_0x2d377c['parentNode'],_0x501bcf=!0x1;for(;_0x302e4d;){if(_0x302e4d===_0x59de5a){_0x501bcf=!0x0;break;}const _0x4d3f9c=Cs(_0x302e4d,'data-id');if(_0x4d3f9c&&(this['_referencedExistingIds']['has'](_0x4d3f9c)||_0x2fd6e0['has'](_0x4d3f9c)))return;_0x302e4d=_0x302e4d['parentNode'];}if(_0x501bcf){if(_0x1929bb(_0x59de5a,_0x2d377c),_0x5c288f){const _0x202371=this['_generateUid'](),_0xf5de96=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x306081);-0x1!==_0xf5de96&&this['_touchedNodesState']['modifiedIds']['splice'](_0xf5de96,0x1),fs(_0x2d377c,'data-unwrapped-id',_0x306081),fs(_0x2d377c,'data-id',_0x202371),this['_touchedNodesState']['newIds']['push'](_0x202371),this['_touchedNodesState']['rescuedNewIds']['add'](_0x202371),this['_touchedNodesState']['lastTouchedId']=_0x202371;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x306081),this['_touchedNodesState']['lastTouchedId']=_0x306081;}});}['_getUid'](_0x2daa75){return this['_isExistingNode'](_0x2daa75)?Cs(_0x2daa75,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x28f919){ws(_0x28f919)['filter'](_0xce9621=>Ls(_0xce9621)||this['_isExistingContentComment'](_0xce9621))['forEach'](_0x75d4d6=>{_0x3d0f4e(_0x75d4d6);});}['_findLastConfirmationPoint'](_0x3918de){let _0x1e0ea8=null,_0x5972ae=null,_0x1df07e=null,_0x280fbd=null;const _0x26cf7a=_0x1abac1=>{_0x1abac1&&(_0x1e0ea8=_0x1abac1),_0x1df07e=null,_0x280fbd=null;};for(let _0x1f3673=0x0;_0x1f3673<_0x3918de['length'];_0x1f3673++){const _0x4075b4=_0x3918de[_0x1f3673];if(this['_isExistingContentComment'](_0x4075b4)){_0x26cf7a(_0x5972ae);continue;}if(_0x3e1b97(_0x4075b4)){const _0x3fee82=Cs(_0x4075b4,'data-id'),_0x32516f=_0x1f3673===_0x3918de['length']-0x1;if(_0x3fee82&&'new-element'!==_0x3fee82&&this['_touchedNodesState']['modifiedIds']['includes'](_0x3fee82)&&!_0x32516f){_0x26cf7a(_0x3fee82),_0x5972ae=_0x3fee82;continue;}}let _0xc00f68=null;const _0x28bf78=Ds(_0x4075b4);if(_0x28bf78&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x28bf78))_0x5972ae=_0x28bf78;else{if(_0x28bf78&&this['_touchedNodesState']['newIds']['includes'](_0x28bf78))_0xc00f68='N';else{if(!Ls(_0x4075b4))continue;_0xc00f68='R';}_0xc00f68===_0x280fbd||null===_0x280fbd?_0x280fbd=_0xc00f68:null!==_0x1df07e?(_0x26cf7a(_0x5972ae),_0x280fbd=_0xc00f68):(_0x1df07e=_0x280fbd,_0x280fbd=_0xc00f68),_0x5972ae=_0x28bf78;}}const _0x1bb3c7=_0x3918de[_0x3918de['length']-0x1];return _0x1bb3c7&&!_0x3e1b97(_0x1bb3c7)&&!Ls(_0x1bb3c7)&&_0x5972ae&&_0x26cf7a(_0x5972ae),_0x1e0ea8;}['_getLastStableElement'](_0x3bd722,_0x5a428c){if(!_0x5a428c)return null;const _0x538088=ms('data-id',_0x5a428c,_0x3bd722);if(!_0x538088)return null;const _0xe690c0=[_0x538088,...Ss(_0x538088)]['at'](-0x2);if(_0xe690c0===_0x538088)return _0x538088;let _0x25c0d3=_0xe690c0['previousSibling'];for(;_0x25c0d3&&!_0x3e1b97(_0x25c0d3);)_0x25c0d3=_0x25c0d3['previousSibling'];return _0x25c0d3;}['_markUnstableElements'](_0x17454e,_0x406b53){const _0x58dbb9=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x4c83c=_0x406b53?_0x406b53['nextSibling']:_0x17454e['firstChild'];for(;_0x4c83c;)_0x3e1b97(_0x4c83c)&&(_0x58dbb9['has'](Cs(_0x4c83c,'data-id'))||Es('data-id',null,_0x4c83c)['some'](_0x4d1772=>_0x58dbb9['has'](Cs(_0x4d1772,'data-id'))))&&fs(_0x4c83c,'data-unstable','true'),_0x4c83c=_0x4c83c['nextSibling'];}['_isNewNode'](_0x239420){return Boolean('new-element'===Cs(_0x239420,'data-id'));}['_isExistingNode'](_0x2ebc09){return Boolean((Cs(_0x2ebc09,'data-id')||'')['length']>0x0&&'new-element'!==Cs(_0x2ebc09,'data-id'));}['_isExistingContentComment'](_0x53f3c4){return Boolean(_0x5b739d(_0x53f3c4)&&ps(_0x53f3c4)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ls(_0x1ec6da){return!!_0x1ec6da&&Boolean(_0x5b739d(_0x1ec6da)&&ps(_0x1ec6da)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ds(_0x42d6d0){if(!_0x42d6d0)return null;if(_0x3e1b97(_0x42d6d0))return Cs(_0x42d6d0,'data-id')??null;if(_0x5b739d(_0x42d6d0)){const _0x2bf16e=ps(_0x42d6d0)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x2bf16e&&_0x2bf16e[0x1])return _0x2bf16e[0x1];}return null;}function Ps(_0x5709fd,_0x4eb07e){const _0x23bbf5=new Map();for(const _0x22064f of Ts(_0x5709fd))_0x23bbf5['set'](Cs(_0x22064f,'data-id'),_0x22064f);const _0x37c07b=new Set();for(const _0x1127fc of Ts(_0x4eb07e)){const _0x59303c=Cs(_0x1127fc,'data-id'),_0xc897aa=_0x59303c?_0x23bbf5['get'](_0x59303c):void 0x0;_0xc897aa?(_0x2e5842(_0x1127fc,_0x1163ea(_0xc897aa,!0x0)),_0x37c07b['add'](_0x59303c)):_0x3d0f4e(_0x1127fc);}for(const _0x73be80 of ws(_0x4eb07e))Ls(_0x73be80)&&_0x23bbf5['has'](Ds(_0x73be80))&&_0x3d0f4e(_0x73be80);const _0x5984cd=new Set(Es('data-id',null,_0x4eb07e)['map'](_0x523d2f=>Cs(_0x523d2f,'data-id')));for(const [_0x1071cc,_0x519cad]of _0x23bbf5){if(_0x37c07b['has'](_0x1071cc))continue;let _0x11f2b7=_0x519cad['parent'],_0x494a31=null;for(;_0x11f2b7&&_0x3e1b97(_0x11f2b7);){const _0x3a3671=Cs(_0x11f2b7,'data-id');if(_0x3a3671&&_0x5984cd['has'](_0x3a3671)){_0x494a31=_0x3a3671;break;}_0x11f2b7=_0x11f2b7['parent'];}if(!_0x494a31)continue;const _0xb9b51d=ms('data-id',_0x494a31,_0x4eb07e);_0xb9b51d&&_0x5d571b(_0xb9b51d,_0x1163ea(_0x519cad,!0x0));}}const Hs=/* #__PURE__ -- @preserve */
26
- _t();var Ms=class extends Hs{['_m2html'];constructor(){super();const _0x597b8e=Object['entries'](_0x275078),_0x2b98eb=_0x597b8e['findIndex'](([_0x39fbdf])=>'rehypeDomRaw'===_0x39fbdf);if(-0x1===_0x2b98eb)throw new at('ai-response-parser-unable-to-set-up-parser');_0x597b8e['splice'](_0x2b98eb+0x1,0x0,['rehypeSanitize',_0x36b83a]),this['_m2html']=new _0x185003({'plugins':Object['fromEntries'](_0x597b8e)});}['convertMarkdownToHTML'](_0x2d631e){const _0x246377=this['_m2html']['parse'](_0x2d631e);return this['parseAndNormalizeHTML'](_0x246377);}['parseAndNormalizeHTML'](_0x778750){return this['_parseHTML'](_0x778750);}['_parseHTML'](_0x449e27){const _0x2853dc=Is('<dummy>'+_0x449e27['replace'](/<[^>]*?$/g,'')+'</dummy>');return Vs(_0x2853dc),_0x2853dc['children']=_0x2853dc['children'][0x0]['children'],_0x2853dc;}};function Vs(_0x271809){for(const _0xc7e62f of _0x271809['children'])_0x3e1b97(_0xc7e62f)?'pre'!==_0xc7e62f['name']&&Vs(_0xc7e62f):_0x5e3325(_0xc7e62f)&&(_0xc7e62f['data']=_0xc7e62f['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Us({changeGroups:_0x51989c,documentContextContent:_0x23543b,showDiff:_0x21254a,trimUnchanged:_0x56fa60=!0x0}){return _0x51989c['map'](_0x26f948=>{if(!_0x26f948['editor']||'destroyed'===_0x26f948['editor']['state'])return null;const _0x257d3f=new _0x389250([]),_0x2fc836=new _0x389250([]),_0x7dede1=new Set();for(const _0x35f3ee of _0x26f948['changes'])'new'==_0x35f3ee['type']&&Es('data-id',null,_0x35f3ee['node'])['forEach'](_0x460558=>{_0x7dede1['add'](Cs(_0x460558,'data-id'));});for(const _0x5b1237 of _0x26f948['changes'])if('removed'!=_0x5b1237['type']?_0x2fc836['children']['push'](_0x5b1237['node']['cloneNode'](!0x0)):_0x21254a||_0x7dede1['has'](_0x5b1237['id'])||_0x2fc836['children']['push'](_0x5b1237['node']['cloneNode'](!0x0)),'new'!=_0x5b1237['type']&&(_0x21254a||'removed'!=_0x5b1237['type'])){const _0x48d8d8=_0x52cdf1(_0xcbb989=>Cs(_0xcbb989,'data-id')==_0x5b1237['id'],_0x23543b['get'](_0x26f948['documentId']),!0x0);_0x48d8d8&&_0x257d3f['children']['push'](_0x48d8d8['cloneNode'](!0x0));}const {content:_0x5d20aa,hasChanges:_0x2104c3}=Bs(_0x26f948['editor'],_0x257d3f,_0x2fc836,_0x21254a,_0x56fa60);return{'type':_0x26f948['changes'][0x0]['type'],'index':_0x26f948['index'],'content':_0x5d20aa,'hasChanges':_0x2104c3};})['filter'](_0x1954e4=>null!==_0x1954e4);}function Bs(_0x108860,_0x109655,_0x1c1dd4,_0x5963d2,_0x3ec1b3=!0x0){const _0x5ba987=_0x108860['plugins']['get']('DocumentCompare'),_0x5d7d8b=ps(_0x109655),_0x10019d=ps(_0x1c1dd4),_0x5a3c91=_0x108860['data']['parse'](_0x5d7d8b,'$root'),_0x41d6a6=_0x108860['model']['createPositionAt'](_0x5a3c91,0x0),_0x1d19b9=_0x5ba987['getDiff'](_0x5d7d8b,_0x10019d,{'anchor':_0x41d6a6,'markDeletions':_0x5963d2,'targetEditor':_0x108860})['getOperations']();if(0x0==_0x1d19b9['length'])return{'content':_0x109655['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x5963d2?function(_0x57367f,_0x18d775,_0x57eea5){if(0x0==_0x57367f['length'])return;const _0x4c0e58=_0x57eea5['plugins']['get']('DocumentCompare'),_0x496124=_0x57eea5['plugins']['get']('SuggestionsConversion');_0x57eea5['model']['change'](_0x5ed9b2=>{const _0x2fe2e1=new Set();for(let _0x151f6a=0x0;_0x151f6a<_0x57367f['length'];_0x151f6a++){const _0x14ad84=_0x57367f[_0x151f6a];if(_0x14ad84['baseVersion']=null,_0x14ad84['isDocumentOperation']=!0x1,_0x4c0e58['isMarkedRemoveOperation'](_0x14ad84)){const _0x381fcc=_0x10d043(_0x14ad84['newRange'],_0x57eea5['model']),_0x787436='suggestion:deletion:'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x787436,_0x381fcc);}else switch(_0x14ad84['type']){case'rename':{if(_0x14ad84['oldName']==_0x14ad84['newName'])break;_0x5ed9b2['batch']['addOperation'](_0x14ad84),_0x57eea5['model']['applyOperation'](_0x14ad84);const _0x9a5c39='$elementName',_0x8a7090=_0x14ad84['position'],_0x231700=_0x57eea5['model']['createRange'](_0x8a7090,_0x57eea5['model']['createPositionAt'](_0x8a7090['nodeAfter'],'end')),_0x577cfa='suggestion:attribute:'+_0x9a5c39+':'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x577cfa,_0x231700);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x14ad84['oldValue']==_0x14ad84['newValue'])break;_0x5ed9b2['batch']['addOperation'](_0x14ad84),_0x57eea5['model']['applyOperation'](_0x14ad84);const _0x1aa198=_0x14ad84['key'];if(!_0x496124['isRegisteredAttribute'](_0x1aa198))break;const _0xd07cee=_0x10d043(_0x14ad84['range'],_0x57eea5['model']),_0x2cbe9e='suggestion:attribute:'+_0x1aa198+':'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x2cbe9e,_0xd07cee);break;}case'insert':{if(_0x5ed9b2['batch']['addOperation'](_0x14ad84),_0x57eea5['model']['applyOperation'](_0x14ad84),Gs(_0x18d775,_0x14ad84),_0x57367f[_0x151f6a+0x1]&&'move'==_0x57367f[_0x151f6a+0x1]['type'])break;const _0x25c400=_0x14ad84['position'],_0x21f098=_0x14ad84['howMany'],_0x57015b=_0x10d043(_0x57eea5['model']['createRange'](_0x25c400,_0x25c400['getShiftedBy'](_0x21f098)),_0x57eea5['model']),_0x92545c='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x92545c,_0x57015b);break;}case'split':{_0x5ed9b2['batch']['addOperation'](_0x14ad84),_0x57eea5['model']['applyOperation'](_0x14ad84),Gs(_0x18d775,_0x14ad84);const _0x289d1a=_0x14ad84['splitPosition'],_0xe9e430=_0x14ad84['moveTargetPosition'],_0x2ab4c8=_0x57eea5['model']['createRange'](_0x289d1a,_0xe9e430),_0x6c6a90='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x6c6a90,_0x2ab4c8);break;}case'move':{_0x5ed9b2['batch']['addOperation'](_0x14ad84),_0x57eea5['model']['applyOperation'](_0x14ad84),Gs(_0x18d775,_0x14ad84);const _0x240c50=_0x14ad84['getMovedRangeStart'](),_0x48ecc4=_0x14ad84['howMany'];for(let _0x32da69=0x0;_0x32da69<_0x48ecc4;_0x32da69++){const _0x148346=_0x240c50['getShiftedBy'](_0x32da69)['nodeAfter'];_0x2fe2e1['add'](_0x148346);}break;}case'remove':{const _0x356221=_0x14ad84['sourcePosition'],_0x6f5e09=_0x14ad84['howMany'],_0x5489fb=new _0x2142d8(_0x356221,_0x6f5e09);_0x5ed9b2['batch']['addOperation'](_0x5489fb),_0x57eea5['model']['applyOperation'](_0x5489fb),Gs(_0x18d775,_0x14ad84);break;}}}for(const _0x20ac99 of _0x2fe2e1){const _0x42d875=_0x57eea5['model']['createRangeOn'](_0x20ac99),_0x52c973='suggestion:formatBlock:$fakeWrap:'+Ot()+':$aiSuggestion';_0x18d775['markers']['set'](_0x52c973,_0x10d043(_0x42d875,_0x57eea5['model']));}});}(_0x1d19b9,_0x5a3c91,_0x108860):_0x108860['model']['change'](_0x461f47=>{for(const _0x3a4516 of _0x1d19b9)if('remove'==_0x3a4516['type']){const _0x32289b=_0x3a4516['sourcePosition'],_0x4181c3=_0x3a4516['howMany'],_0x22eff6=new _0x2142d8(_0x32289b,_0x4181c3);_0x461f47['batch']['addOperation'](_0x22eff6),_0x108860['model']['applyOperation'](_0x22eff6),Gs(_0x5a3c91,_0x3a4516);}else{if('marker'==_0x3a4516['type']){const _0x2f26f4=_0x3a4516['name'],_0x2d1f85=_0x3a4516['newRange'];null!==_0x2d1f85?_0x5a3c91['markers']['set'](_0x2f26f4,_0x2d1f85):_0x5a3c91['markers']['delete'](_0x2f26f4);}else _0x3a4516['baseVersion']=null,_0x3a4516['isDocumentOperation']=!0x1,_0x461f47['batch']['addOperation'](_0x3a4516),_0x108860['model']['applyOperation'](_0x3a4516),Gs(_0x5a3c91,_0x3a4516);}}),_0x3ec1b3){const _0x18f358=Fs(_0x108860,_0x1d19b9,_0x5a3c91);Ws(_0x108860['model'],_0x18f358),function(_0xad2495,_0x55efa7){const _0xaee91c=_0x55efa7['getFirstRange']()['start'];let _0x4dbd8d=_0x55efa7['getFirstRange']()['end'];const _0x372de2=_0xaee91c['root'];(_0x4dbd8d['textNode']||_0x4dbd8d['nodeAfter']&&_0x4dbd8d['nodeAfter']['is']('$text'))&&(_0x44ed17(_0x4dbd8d,'...'),qs(_0x372de2,_0x4dbd8d,0x3),_0x4dbd8d=_0x4dbd8d['getShiftedBy'](0x3)),(_0xaee91c['textNode']||_0xaee91c['nodeBefore']&&_0xaee91c['nodeBefore']['is']('$text'))&&(_0x44ed17(_0xaee91c,'...'),qs(_0x372de2,_0xaee91c,0x3),_0xaee91c['parent']==_0x4dbd8d['parent']&&(_0x4dbd8d=_0x4dbd8d['getShiftedBy'](0x3)));const _0x1d2ded=_0xad2495['createRange'](_0xad2495['createPositionAt'](_0x372de2,0x0),_0xaee91c),_0x5ab123=_0xad2495['createRange'](_0x4dbd8d,_0xad2495['createPositionAt'](_0x372de2,'end')),_0x11e24e=[..._0x1d2ded['getMinimalFlatRanges'](),..._0x5ab123['getMinimalFlatRanges']()];_0x11e24e['reverse']();for(const _0x163296 of _0x11e24e)_0x5f25bd(_0x163296),$s(_0x372de2,_0x163296);}(_0x108860['model'],_0x18f358);}return{'content':Is(_0x108860['data']['stringify'](_0x5a3c91,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Gs(_0xa49d75,_0x41814f){for(const [_0x5dff1d,_0x275ee0]of _0xa49d75['markers']){const _0x3e1e42=_0x23ea4f['_createFromRanges'](_0x275ee0['getTransformedByOperation'](_0x41814f));_0x3e1e42['root']==_0xa49d75?_0xa49d75['markers']['set'](_0x5dff1d,_0x3e1e42):_0xa49d75['markers']['delete'](_0x5dff1d);}}function Fs(_0x3b9e48,_0x27cd41,_0xfba0d9){const _0x5c8f28=_0x3b9e48['plugins']['get']('DocumentCompare');let _0x4a91cd=_0x3b9e48['model']['createPositionAt'](_0xfba0d9,Number['POSITIVE_INFINITY']),_0x5d9aee=_0x3b9e48['model']['createPositionAt'](_0xfba0d9,0x0);for(const _0x51b803 of _0x27cd41){let _0x17c46b,_0x11711a;if(_0x5c8f28['isMarkedRemoveOperation'](_0x51b803))_0x17c46b=_0x51b803['newRange']['start'],_0x11711a=_0x51b803['newRange']['end'];else switch(_0x4a91cd=Ks(_0x4a91cd,_0x51b803),_0x5d9aee=Ks(_0x5d9aee,_0x51b803),_0x51b803['type']){case'rename':_0x17c46b=_0x51b803['position'],_0x11711a=_0x17c46b['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x17c46b=_0x51b803['range']['start'],_0x11711a=_0x51b803['range']['end'];break;case'insert':_0x17c46b=_0x51b803['position'],_0x11711a=_0x17c46b['getShiftedBy'](_0x51b803['howMany']);break;case'split':_0x17c46b=_0x51b803['splitPosition'],_0x11711a=_0x51b803['moveTargetPosition'];break;case'merge':{const _0xc6eb8=_0x51b803['targetPosition']['path']['slice'](0x0,-0x1);_0x17c46b=_0x3b9e48['model']['createPositionFromPath'](_0xfba0d9,_0xc6eb8),_0x11711a=_0x17c46b['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x3a9fed=_0x51b803['howMany'],_0x23ef3c=_0x51b803['sourcePosition']['_getTransformedByInsertion'](_0x51b803['targetPosition'],_0x3a9fed),_0x2a24c9=_0x51b803['getMovedRangeStart']();'remove'==_0x51b803['type']?(_0x17c46b=_0x23ef3c,_0x11711a=_0x23ef3c):(_0x17c46b=_0x2a24c9,_0x11711a=_0x2a24c9['getShiftedBy'](_0x3a9fed));break;}}_0x17c46b&&_0x17c46b['isBefore'](_0x4a91cd)&&(_0x4a91cd=_0x17c46b['clone'](),_0x4a91cd['stickiness']='toNone'),_0x11711a&&_0x11711a['isAfter'](_0x5d9aee)&&(_0x5d9aee=_0x11711a['clone'](),_0x5d9aee['stickiness']='toNone');}return _0x3b9e48['model']['createSelection'](_0x3b9e48['model']['createRange'](_0x4a91cd,_0x5d9aee));}function Ks(_0x4a4068,_0x45bb78){return'move'!=_0x45bb78['type']&&'remove'!=_0x45bb78['type']||_0x45bb78['sourceRange']['containsPosition'](_0x4a4068)&&((_0x4a4068=_0x45bb78['sourcePosition']['clone']())['stickiness']='toNone'),_0x4a4068['getTransformedByOperation'](_0x45bb78);}function Ws(_0x1ad2ac,_0x13e1cb){Ys(_0x1ad2ac,_0x13e1cb,'forward');const _0x86ffa=_0x13e1cb['getFirstRange']();_0x13e1cb['setTo']([]),_0x13e1cb['setTo'](_0x86ffa,{'backward':!0x0}),Ys(_0x1ad2ac,_0x13e1cb,'backward');}function Ys(_0x5047d9,_0x3b701a,_0x704f91){let _0x432187=0x14;for(;_0x432187;){_0x5047d9['modifySelection'](_0x3b701a,{'unit':'word','direction':_0x704f91}),_0x432187--;const _0x2ff28e=_0x3b701a['focus']['forward'==_0x704f91?'nodeBefore':'nodeAfter'];if(_0x2ff28e&&_0x2ff28e['is']('element')&&_0x5047d9['schema']['isBlock'](_0x2ff28e)&&_0x5047d9['schema']['isObject'](_0x2ff28e))break;}}function $s(_0x213d54,_0x5b718d){for(const [_0x1264dd,_0x3bca11]of _0x213d54['markers']){const _0x4930a2=_0x3bca11['_getTransformedByDeletion'](_0x5b718d['start'],_0x5b718d['end']['offset']-_0x5b718d['start']['offset']);null!=_0x4930a2?_0x213d54['markers']['set'](_0x1264dd,_0x4930a2):_0x213d54['markers']['delete'](_0x1264dd);}}function qs(_0x2dbf17,_0x31fe53,_0x16fabf){for(let [_0x5cc3c8,_0x543ff2]of _0x2dbf17['markers'])_0x543ff2=_0x543ff2['_getTransformedByInsertion'](_0x31fe53,_0x16fabf,!0x1)[0x0],_0x2dbf17['markers']['set'](_0x5cc3c8,_0x543ff2);}const Qs=/* #__PURE__ -- @preserve */
27
- lt();var Xs=class extends Qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x5d1a55,config:_0x1dbb64,locale:_0x37e802}){super(),this['_connector']=_0x5d1a55,this['_config']=_0x1dbb64,this['_locale']=_0x37e802;}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 _0x5a0ae6=await this['getAll']();let _0x1fc568;return _0x1fc568=this['_availableModels']?this['_filterModels'](_0x5a0ae6,this['_availableModels']):_0x5a0ae6['filter'](_0x35814a=>_0x35814a['recommended']),_0x1fc568;}async['getModel'](_0x9b5c4b){const _0x3ac3b3=await this['getAll']();if(!_0x3ac3b3['length'])return null;if(_0x9b5c4b){const _0x2201f2=this['_getModelById'](_0x3ac3b3,_0x9b5c4b);if(_0x2201f2)return _0x2201f2;ft('ai-chat-model-id-unrecognized',{'modelId':_0x9b5c4b,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x5665a6=await this['getAvailableModels']();if(!_0x5665a6['length'])return null;if(this['_defaultModelId']){const _0x1fc9ab=this['_getModelById'](_0x5665a6,this['_defaultModelId']);if(_0x1fc9ab)return _0x1fc9ab;ft('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x5665a6[0x0]['id']});}return _0x5665a6[0x0];}async['isAvailable'](_0x4d0211){return(await this['getAvailableModels']())['some'](_0x4f6684=>_0x4f6684['name']===_0x4d0211['name']&&_0x4f6684['provider']===_0x4d0211['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x3e43d3=this['_locale']['uiLanguage']||'en',_0x5683b3=await this['_connector']['getModels'](_0x3e43d3)['list']();this['_modelList']=_0x5683b3['items']['map'](_0x3decfc=>zs(_0x3decfc)?{..._0x3decfc,'name':ls(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x3decfc);}return[...this['_modelList']];}['_filterModels'](_0x655dd7,_0x448387){let _0x36783c;if(_0x448387){_0x36783c=[];const _0x504fba=new Set(),_0x3c55e3='string'==typeof _0x448387?[_0x448387['toLocaleLowerCase']()]:_0x448387['map'](_0xf14356=>_0xf14356['toLocaleLowerCase']());for(const _0x52750d of _0x3c55e3)for(const _0x224a1e of _0x655dd7)!_0x504fba['has'](_0x224a1e['id'])&&this['_isMatchingFilter'](_0x224a1e,_0x52750d)&&(_0x36783c['push'](_0x224a1e),_0x504fba['add'](_0x224a1e['id']));}else _0x36783c=_0x655dd7;return _0x36783c;}['_isMatchingFilter'](_0x19ac4c,_0x5aee39){const _0x43007a=_0x19ac4c['id']['toLocaleLowerCase'](),_0x3b2d7c=_0x19ac4c['name']['toLocaleLowerCase'](),_0x318b7f=_0x19ac4c['provider']['toLocaleLowerCase']();return _0x43007a===_0x5aee39||_0x3b2d7c===_0x5aee39||zs(_0x19ac4c)&&'auto'===_0x5aee39||_0x318b7f===_0x5aee39||_0x43007a['startsWith'](_0x5aee39);}['_getModelById'](_0x98aa6d,_0x20bd04){return _0x98aa6d['find'](_0x5a7f94=>zs(_0x5a7f94)&&'auto'===_0x20bd04?_0x5a7f94:_0x5a7f94['id']===_0x20bd04)||null;}};function zs(_0x36d3f3){return _0x36d3f3['id']['startsWith']('agent');}function js(_0x247956,_0x25ddd6){for(const _0x506747 of _0x247956)'noop'!==_0x506747['type']&&(_0x506747['_aiSource']=_0x25ddd6);}var Js=class extends _0x394116{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x2a9bb4];}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'](_0x1766dc,_0x5d07fc){if('completed'!==_0x1766dc['status'])throw new at('ai-gateway-apply-invalid-status',this,{'status':_0x1766dc['status']});const _0x12e1f1=_0x1766dc['editor'],{applyMethod:_0x417395}=_0x5d07fc;if('suggest'===_0x417395&&!_0x12e1f1['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',this);const _0x4d040b='suggest'===_0x417395,_0x28762a=this['context']['plugins']['get'](_0x2a9bb4),_0xb6c32c=_0x12e1f1['model']['createPositionAt'](_0x12e1f1['model']['document']['getRoot'](),0x0),_0x1b2931=_0x28762a['getDiff'](_0x1766dc['contentRawOld'],_0x1766dc['contentRawNew'],{'anchor':_0xb6c32c,'markDeletions':_0x4d040b,'targetEditor':_0x12e1f1}),_0x10a3d2=_0x12e1f1['model']['document']['history']['getOperations'](_0x1766dc['documentVersion']),_0x4dd77a={'document':_0x12e1f1['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x34e1d5=_0xd31715(_0x1b2931['getOperations'](),_0x10a3d2,_0x4dd77a)['operationsA'];js(_0x34e1d5,_0x5d07fc['aiSource']??'api'),_0x12e1f1['model']['change'](_0x2d165f=>{if(_0x4d040b)_0x12e1f1['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x34e1d5);else{for(const _0x282b45 of _0x34e1d5)_0x282b45['baseVersion']=_0x12e1f1['model']['document']['version'],Ns(_0x12e1f1,_0x282b45),_0x2d165f['batch']['addOperation'](_0x282b45),_0x12e1f1['model']['applyOperation'](_0x282b45);}});}['mergeChangesIntoContent'](_0x1e2eee,_0x2aa1bd,_0x472a24){const _0x34935d=new Ms(),_0x2d8671=new xs();let _0x53b16c=_0x34935d['parseAndNormalizeHTML'](_0x2aa1bd);for(const _0x1d8682 of _0x1e2eee)try{const _0x22efb5=_0x34935d['parseAndNormalizeHTML'](_0x1d8682['content']);_0x53b16c=_0x2d8671['merge'](_0x22efb5,_0x53b16c,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x1948be){throw new at('ai-gateway-merge-failed',this,{..._0x1d8682},_0x1948be);}return Bs(_0x472a24,_0x34935d['parseAndNormalizeHTML'](_0x2aa1bd),_0x53b16c,!0x1,!0x1)['content'];}},Zs=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x5ec7e1){this['_editor']=_0x5ec7e1['editor'],this['_rootName']=_0x5ec7e1['rootName'],this['_channelId']=_0x5ec7e1['channelId'],this['_sessionId']=_0x5ec7e1['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'](_0x4cbd3c){this['_documentVersion']=_0x4cbd3c;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x21efbd){this['_contentRawOld']=_0x21efbd;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0xcab2bf){this['_contentRawNew']=_0xcab2bf;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x2e5f79){this['_error']=_0x2e5f79;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x396367){return _0x396367['replace'](/ data-id="[a-z0-9]+"/g,'');}},tn=class extends Zs{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x163ab9){this['_summary']=_0x163ab9;}},en=class extends _0x394116{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'](_0x10d006,_0x14fdf5){if(!_0x10d006)throw new at('ai-documentprocessinggateway-missing-prompt',this);const _0x3d1e46=await this['context']['plugins']['get'](As)['getDocumentData']();if(!_0x3d1e46[0x0])throw new at('ai-documentprocessinggateway-missing-document',this);const _0x456bdd=new tn({'editor':_0x3d1e46[0x0]['editor'],'rootName':_0x3d1e46[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x3d1e46[0x0]['sessionId']});if(_0x456bdd['contentRawOld']=_0x3d1e46[0x0]['content'],_0x456bdd['documentVersion']=_0x3d1e46[0x0]['version'],_0x14fdf5?.['signal']?.['aborted'])return _0x456bdd['abort'](),_0x456bdd;const _0x413e85=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x456bdd['contentRawOld'],'prompt':_0x10d006,'model':_0x14fdf5['model']});let _0x3c85a3;if(_0x14fdf5?.['signal']){if(_0x14fdf5['signal']['aborted'])return _0x413e85['abortController']['abort'](),_0x456bdd['abort'](),_0x456bdd;const _0x39801e=_0x14fdf5['signal'],_0x24bb74=()=>_0x413e85['abortController']['abort']();_0x39801e['addEventListener']('abort',_0x24bb74),_0x3c85a3=()=>_0x39801e['removeEventListener']('abort',_0x24bb74);}try{const _0x3c0984=await _0x413e85['getResult']();if(!(_0x3c0984&&_0x3c0984['document']&&_0x3c0984['document']['length']>0x0))throw new at('ai-documentprocessinggateway-empty-reply',this);_0x456bdd['contentRawNew']=_0x3c0984['document'],_0x456bdd['summary']=_0x3c0984['summary']||'';}catch(_0x42b7c6){_0x42b7c6 instanceof Error&&_0x42b7c6['message']['includes']('ai-request-aborted')?_0x456bdd['abort']():_0x456bdd['error']=_0x42b7c6 instanceof at?_0x42b7c6:new at('ai-documentprocessinggateway-run-failed',this,{},_0x42b7c6);}finally{_0x3c85a3&&_0x3c85a3();}return _0x456bdd;}['applyResult'](_0x51c4c4,_0x168df9){this['context']['plugins']['get']('AIGateway')['apply'](_0x51c4c4,_0x168df9);}};function sn(_0x436725){return _0x436725 instanceof Error&&('AbortError'===_0x436725['name']||('AICoreError'===_0x436725['name']?!0x0===_0x436725['isAbort']:_0x436725['message']['startsWith']('ai-request-aborted')));}var nn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0xc2670d){super(_0xc2670d['code'],_0xc2670d['cause']instanceof Error?{'cause':_0xc2670d['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0xc2670d['code'],this['severity']=_0xc2670d['severity']??'error',this['type']=_0xc2670d['type']??'system',this['context']=_0xc2670d['context'],this['isAbort']=_0xc2670d['isAbort']??sn(_0xc2670d['cause']);}},rn=class extends _0x394116{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x26acf3){return new on(this,_0x26acf3);}},on=class{['_sink'];['_component'];constructor(_0x1adf40,_0x12f64d){this['_sink']=_0x1adf40,this['_component']=_0x12f64d;}['logError'](_0x56e83a,_0x5ee6de={}){this['_emit'](_0x56e83a,_0x5ee6de),this['_defaultLog'](_0x56e83a);}['reportError'](_0x1e5bfb,_0x58d52f={}){this['_emit'](_0x1e5bfb,_0x58d52f);}['_emit'](_0x542163,_0x3541ad){sn(_0x542163)||this['_sink']['fire']('error',{'error':_0x542163,'component':this['_component'],'context':_0x3541ad['context']});}['_defaultLog'](_0x3f212b){if(!sn(_0x3f212b)){if(_0x3f212b instanceof nn){if('user'===_0x3f212b['type']||'network'===_0x3f212b['type'])return;if('warning'===_0x3f212b['severity'])return void console['warn'](this['_component'],_0x3f212b);}console['error'](this['_component'],_0x3f212b);}}};const an='ck-ai-button-primary',hn='ck-ai-button-secondary',cn='ck-ai-button-tertiary';function ln(_0x3f1529,_0x296591){const _0x8aa353=new Pt(_0x3f1529),_0x1aadf7=ls(_0x3f1529,'AI_TABS_LABEL_MINIMIZE'),_0x18b26=ls(_0x3f1529,'AI_TABS_LABEL_MAXIMIZE');return _0x8aa353['set']({'withText':!0x1,'icon':_0x54d28d,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+cn}),_0x8aa353['bind']('label')['to'](_0x296591,'isMaximized',_0x48e76b=>_0x48e76b?_0x1aadf7:_0x18b26),_0x8aa353['bind']('icon')['to'](_0x296591,'isMaximized',_0x40edea=>_0x40edea?_0x3a9b7c:_0x54d28d),_0x8aa353['bind']('isOn')['to'](_0x296591,'isMaximized'),_0x8aa353['on']('execute',()=>{_0x296591['fire']('resizeTabs');}),_0x8aa353;}function un(_0x5d42e4){const _0x26aa45=new xt(_0x5d42e4);return _0x26aa45['attachToDom'](),_0x26aa45['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x26aa45;}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:_0xd3c1f5,isDone:_0x33d5dd=!0x1,isComplete:_0x16f7d3,interactionId:_0x3815bf,areActionsDisabled:_0x5a8f00,isFromHistory:_0x4c0756=!0x1,documentContextContent:_0x4eedaa,locale:_0x2422bc,id:_0x4125d9,channelsToEditors:_0x8db488}){super(),this['id']=_0x4125d9||Ot(),this['interactionId']=_0x3815bf,this['type']=_0xd3c1f5,this['areActionsDisabled']=!!_0x5a8f00,this['isFromHistory']=_0x4c0756,this['locale']=_0x2422bc,this['aiResponseParser']=new Ms(),this['aiResponseApplier']=new xs(),this['documentContextContent']=new Map(_0x4eedaa?.['map'](_0x2a58c0=>[_0x2a58c0['id'],Is(_0x2a58c0['content'])])||[]),this['_documentIdToSource']=new Map(_0x4eedaa?.['map'](_0x3df5df=>[_0x3df5df['id'],{'editor':_0x8db488['get'](_0x3df5df['channelId']),'rootName':_0x3df5df['rootName']}])||[]),this['set']('isDone',_0x33d5dd),this['set']('isComplete',_0x16f7d3??_0x33d5dd),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x49932c,_0x1e8d0b){const _0x28bdee='text'===this['type']?'text':_0x1e8d0b;this['content']['has'](_0x28bdee)||this['content']['set'](_0x28bdee,''),this['content']['set'](_0x28bdee,this['content']['get'](_0x28bdee)+_0x49932c),this['onContentChange'](_0x28bdee);}['done'](_0x2b7e0b=!0x0){this['isComplete']=_0x2b7e0b,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x507976,_0x1bdb1b){this['changeGroups'][_0x507976]['state']=_0x1bdb1b,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x507976,'state':_0x1bdb1b});}['getContentParts']({showDiff:_0x2bdf69,groupIndex:_0x3c3e47}){const _0x403038=this['_getCachedContentParts'](_0x2bdf69,_0x3c3e47);if(_0x403038)return _0x403038;let _0xfdd52d=[];if(void 0x0===_0x3c3e47)_0xfdd52d=this['changeGroups'];else{const _0x52ca6c=this['changeGroups']['find'](({index:_0x535ff6})=>_0x535ff6===_0x3c3e47);if(!_0x52ca6c)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x3c3e47});_0xfdd52d=[_0x52ca6c];}const _0x346dfe=Us({'showDiff':_0x2bdf69,'changeGroups':_0xfdd52d,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x2bdf69,_0x346dfe),_0x346dfe;}['_getCachedContentParts'](_0x52acf2,_0xc27217){const _0x498fd4=_0x52acf2?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x498fd4]['length'])return null;const _0x41ea90=this['cachedSuggestionContentParts'][_0x498fd4];if(void 0x0===_0xc27217)return _0x41ea90['length']>0x0&&_0x41ea90['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x52acf2,null),null):_0x5b4d10(_0x41ea90);{const _0x222ce4=_0x41ea90['find'](({index:_0x47cbd9})=>_0x47cbd9===_0xc27217);if(_0x222ce4)return[_0x5b4d10(_0x222ce4)];}return null;}['_setCachedContentParts'](_0x52cdb2,_0x498621){const _0x2971e1=_0x52cdb2?'withDiff':'withoutDiff';_0x498621?_0x498621['forEach'](_0x124653=>{const _0x39aea5=this['cachedSuggestionContentParts'][_0x2971e1],_0xef4d95=_0x39aea5['find'](({index:_0x1d6c32})=>_0x1d6c32===_0x124653['index']);if(_0xef4d95){const _0x57a8c2=_0x39aea5['indexOf'](_0xef4d95);_0x39aea5['splice'](_0x57a8c2,0x1,_0x124653);}else _0x39aea5['push'](_0x124653);}):this['cachedSuggestionContentParts'][_0x2971e1]['length']=0x0;}['onContentChange'](_0x4e2488){if('modification'===this['type']){if(_0x4e2488)this['parsedContent']['set'](_0x4e2488,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x4e2488)));else{for(const [_0x786052,_0x49c923]of this['content'])this['parsedContent']['set'](_0x786052,this['aiResponseParser']['parseAndNormalizeHTML'](_0x49c923));}const _0x281cd8=this['changeGroups'];for(const _0x459f00 of this['content']['keys']())this['updateChangeGroups'](_0x459f00);const _0x29d370=this['_getDifferentChangeGroups'](_0x281cd8,this['changeGroups']);(_0x29d370['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x29d370),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'](_0x546089,_0x324fb1){const _0x1c775c=[];for(const _0x57a288 of _0x324fb1){const _0x364aec=_0x546089[_0x57a288['index']];_0x364aec?_0x364aec['changes']['length']!==_0x57a288['changes']['length']?_0x1c775c['push'](_0x57a288):_0x364aec['changes']['forEach']((_0x1d2633,_0x28d2a0)=>{const _0xc549c4=_0x57a288['changes'][_0x28d2a0];_0x1d2633['id']!==_0xc549c4['id']&&_0x1c775c['push'](_0x57a288);}):_0x1c775c['push'](_0x57a288);}return _0x1c775c;}['updateChangeGroups'](_0x71284){const _0xd936cc=this['documentContextContent']['get'](_0x71284),_0x4a7b89=this['parsedContent']['get'](_0x71284);if(!_0xd936cc||!_0x4a7b89)return;const _0x474e05=new _0x9fc879('p',{},[new _0x9fc879('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x2c2a3b(ls(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x1a3604=this['aiResponseApplier']['merge'](_0x4a7b89,_0xd936cc['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x474e05});this['parsedMergedContent']['set'](_0x71284,_0x1a3604['parsedContent']);let _0x178694=[];if(_0x5bd789(_0x292978=>{const _0x546ab2=Cs(_0x292978,'data-id');if(!_0x546ab2||!_0x13843b(_0x546ab2))return!0x1;const _0x18714c=[_0x292978,...Ss(_0x292978)]['at'](-0x2);if(_0x292978!=_0x18714c){const _0x534757=Cs(_0x18714c,'data-id');_0x13843b(_0x534757)||(_0x178694['push']({'node':_0x18714c,'id':_0x534757,'type':'modified'}),_0x1a3604['modifiedNodeIds']['push'](_0x534757));}else _0x1a3604['modifiedNodeIds']['includes'](_0x546ab2)?_0x178694['push']({'node':_0x292978,'type':'modified','id':_0x546ab2}):_0x1a3604['newNodeIds']['includes'](_0x546ab2)?_0x178694['push']({'node':_0x292978,'type':'new','id':_0x546ab2,'anchorId':Cs(_0x292978['previousSibling'],'data-id')}):_0x178694['push']({'node':_0x292978,'type':'removed','id':_0x546ab2});return!0x0;},this['parsedMergedContent']['get'](_0x71284)),_0x178694=_0x178694['filter'](({node:_0xaf2d1e})=>[...Ss(_0xaf2d1e),_0xaf2d1e]['every'](_0x31e1bf=>!Cs(_0x31e1bf,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x3db044=>_0x3db044['documentId']!==_0x71284),0x0==_0x178694['length'])return;const _0x2519fc=[[_0x178694[0x0]]];for(let _0x356e18=0x1;_0x356e18<_0x178694['length'];_0x356e18++){const _0x495e41=_0x2519fc[_0x2519fc['length']-0x1],_0x274052=_0x495e41[_0x495e41['length']-0x1];_0x178694[_0x356e18]['node']['previousSibling']==_0x274052['node']&&'modified'!=_0x178694[_0x356e18]['type']&&'modified'!=_0x274052['type']?_0x495e41['push'](_0x178694[_0x356e18]):_0x2519fc['push']([_0x178694[_0x356e18]]);}for(const _0x52a80a of _0x2519fc){const _0x2d3dc7=_0x52a80a[0x0],_0x14829f=_0x52a80a[_0x52a80a['length']-0x1],_0x1f9556=_0x3cfe2b(_0x2d3dc7['node']['previousSibling']);_0x1f9556&&_0x52a80a['unshift'](_0x1f9556);const _0x36a70c=_0x3cfe2b(_0x14829f['node']['nextSibling']);_0x36a70c&&_0x52a80a['push'](_0x36a70c);}Es('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x71284))['forEach'](_0x714169=>{fs(_0x714169,'data-wrapped-id',null);});const _0x17f87d=new Map();Es('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x71284))['forEach'](_0x477230=>{const _0x2e63a3=Cs(_0x477230,'data-unwrapped-id'),_0xf9924=Cs(_0x477230,'data-id');_0x17f87d['set'](_0xf9924,_0x2e63a3),fs(_0x477230,'data-id',_0x2e63a3),fs(_0x477230,'data-unwrapped-id',null);});for(const _0x6f90ff of _0x178694){const _0x3ab3fb=_0x17f87d['get'](_0x6f90ff['id']);_0x3ab3fb&&(_0x6f90ff['id']=_0x3ab3fb);}this['changeGroups']['push'](..._0x2519fc['map']((_0x5db59e,_0x15a0ae)=>({'changes':_0x5db59e,'state':'pending','index':_0x15a0ae,'editor':this['_documentIdToSource']['get'](_0x71284)['editor'],'rootName':this['_documentIdToSource']['get'](_0x71284)['rootName'],'documentId':_0x71284})));const _0x9782f7=Array['from'](this['documentContextContent']['keys']());function _0x13843b(_0x566174){return _0x1a3604['modifiedNodeIds']['includes'](_0x566174)||_0x1a3604['newNodeIds']['includes'](_0x566174)||_0x1a3604['removedNodeIds']['includes'](_0x566174);}function _0x3cfe2b(_0x1f9a82){if(_0x1f9a82&&Cs(_0x1f9a82,'data-id')&&!Cs(_0x1f9a82,'data-unstable')){const _0xcfa0f4=Cs(_0x1f9a82,'data-id');if(!_0x13843b(_0xcfa0f4))return{'node':_0x1f9a82,'type':'context','id':_0xcfa0f4};}return null;}this['changeGroups']['sort']((_0x206787,_0xad4f53)=>_0x9782f7['indexOf'](_0x206787['documentId'])-_0x9782f7['indexOf'](_0xad4f53['documentId'])),this['changeGroups']['forEach']((_0x5a13c8,_0x3b0ef7)=>{_0x5a13c8['index']=_0x3b0ef7;});}};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:_0x4fdbed,locale:_0x482430,channelsToEditors:_0x3efe15}){super(),this['id']=Ot(),this['connector']=_0x4fdbed,this['isStopped']=!0x0,this['locale']=_0x482430,this['_channelsToEditors']=_0x3efe15||new Map();}async['start'](){await this['_run']();}async['resume'](_0x9f2e5c){await this['_run'](_0x9f2e5c);}async['_run'](_0x267827){const _0x550a74=[];let _0x51b912,_0x11ce61,_0x2479e5,_0xe561f9=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x267827||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x100868=await this['currentRequest']['getStream']();for await(const _0x4e1453 of _0x100868){if(this['isStopped'])return;if('error'==_0x4e1453['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x4e1453['event']){case'message-metadata':this['messageId']=_0x4e1453['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x4e1453['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x4e1453['data']['conversationTitle'],!0x0);break;case'source':_0x550a74['push'](_0x4e1453['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'](),_0x51b912='modification-delta'==_0x4e1453['event']?'modification':'text',_0x11ce61='modification-delta'==_0x4e1453['event']?_0x4e1453['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x51b912&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x51b912,'interactionId':this['id'],'id':_0x11ce61,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x4e1453['event']&&{'documentId':_0x4e1453['data']['documentId']}}),'modification'==_0x51b912&&(this['currentReply']['sources']=_0x550a74['splice'](0x0))),this['currentReply']['appendContent'](_0x4e1453['data']['textDelta'],_0x4e1453['data']['documentId']);break;case'mcp-tool-result':_0x2479e5=JSON['parse'](_0x4e1453['data']['result']),this['_handleToolResultData']({'toolName':_0x4e1453['data']['toolName'],'data':_0x2479e5['data'],'attributes':_0x2479e5['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x4e1453['data']['toolName'],'data':_0x4e1453['data']['data']});}}_0xe561f9=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x550a74['length']>0x0&&(this['currentReply']['sources']=_0x550a74['splice'](0x0)),this['_finalizeInteraction'](_0xe561f9),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x26d1e5){return this['replies']['find'](_0x1cf8fa=>_0x1cf8fa['id']===_0x26d1e5);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x89f64=>_0x89f64['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x4980b6){const _0x1a9c7f=this['getDocumentContext'](),_0x3fa317=new _n({'locale':this['locale'],'documentContextContent':_0x1a9c7f?.['documents'],..._0x4980b6});return this['replies']['push'](_0x3fa317),_0x3fa317['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x3fa317),_0x3fa317;}['setConversationTitle'](_0x12bfc5,_0x3cd5d0=!0x1){this['fire']('setConversationTitle',_0x12bfc5,_0x3cd5d0);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x4048fb){this['fire']('toolDataReceived',{'type':'result','toolName':_0x4048fb['toolName'],'data':structuredClone(_0x4048fb['data']||{}),'attributes':structuredClone(_0x4048fb['attributes']||{})},this);}['_handleToolNotificationData'](_0x1d75b5){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x1d75b5['toolName'],'data':structuredClone(_0x1d75b5['data'])},this);}['_finalizeInteraction'](_0x42dc39=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x42dc39),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:_0x18940b,config:_0x2e45ca,ownerId:_0x35fd14}){super(),this['_connector']=_0x18940b,this['_config']=_0x2e45ca,this['_ownerId']=_0x35fd14;}['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'](_0x9a30fa,_0x3c2cf9){const _0x550318=new Map(),{contextItem:_0x51ae94,hasUnmatched:_0x22edff}=await this['_populateDocumentContextItem'](_0x9a30fa,_0x3c2cf9);_0x51ae94&&_0x550318['set'](_0x51ae94['id'],_0x51ae94);for(const _0xb823df of _0x9a30fa){if('document'===_0xb823df['type'])continue;const _0x52f294=await this['_createContextItemFromContent'](_0xb823df);this['_addToConversationContextItem'](_0x52f294),_0x550318['set'](_0x52f294['id'],_0x52f294);}return{'contextItems':_0x550318,'hasUnmatched':_0x22edff};}async['_populateDocumentContextItem'](_0x271928,_0x4120be){const _0x3f6f43=_0x271928['filter'](_0x570d21=>'document'===_0x570d21['type']);if(0x0===_0x3f6f43['length'])return{'hasUnmatched':!0x1};const _0x35ac00=_0x3f6f43['map'](_0x3c035a=>_0x3c035a['id']),_0x92703a=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x35ac00)['getDocuments'](),_0x286a52=new Map(_0x92703a['map'](_0x43348f=>[_0x43348f['id'],_0x43348f])),_0x353970=[];let _0x2a3c70=!0x1;for(const _0x392add of _0x3f6f43){const _0x25cda0=_0x286a52['get'](_0x392add['id']);_0x25cda0&&(this['_matchDocumentToRoot'](_0x25cda0,_0x4120be)||(_0x2a3c70=!0x0),_0x353970['push']({'id':_0x25cda0['id'],'content':_0x25cda0['content'],'version':_0x25cda0['attributes']?.['version']??0x0,'sessionId':_0x25cda0['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x25cda0['attributes']?.['channelId']??_0x4120be[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x25cda0['attributes']?.['rootName']??_0x4120be[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x3d0336={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x353970};return this['_addToConversationContextItem'](_0x3d0336),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3d0336,'hasUnmatched':_0x2a3c70};}['_matchDocumentToRoot'](_0x402f0b,_0x35416c){const _0x4bae8=_0x402f0b['attributes']?.['channelId'],_0x3ae4b8=_0x402f0b['attributes']?.['rootName'];if(_0x4bae8&&_0x3ae4b8){for(const _0x59dbc2 of _0x35416c)if(_0x59dbc2['config']['get']('collaboration.channelId')===_0x4bae8){for(const _0x35a00b of _0x59dbc2['model']['document']['getRoots']())if('$graveyard'!==_0x35a00b['rootName']&&_0x35a00b['rootName']===_0x3ae4b8)return{'editor':_0x59dbc2,'rootName':_0x35a00b['rootName']};}}}async['_createContextItemFromContent'](_0x110fdb){return'mcp-tool-context'===_0x110fdb['type']?{'id':_0x110fdb['id'],'uiId':_0x110fdb['id'],'label':_0x110fdb['data']?.['label']||_0x110fdb['id'],'type':'mcp-tool-context','mcpServerName':_0x110fdb['mcpServerName'],'toolName':_0x110fdb['toolName'],'data':_0x110fdb['data']||{}}:{'id':_0x110fdb['id'],'uiId':_0x110fdb['id'],'label':_0x110fdb['attributes']?.['label']||_0x110fdb['name']||_0x110fdb['url']||_0x110fdb['id'],'type':_0x110fdb['type'],..._0x110fdb?.['attributes']?.['resourceId']?{'resourceId':_0x110fdb['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x1c6fb5){this['_pendingContextItems']['get'](_0x1c6fb5)?.['isReadOnly']||this['_removeContextItem'](_0x1c6fb5);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x1be9b2 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x1be9b2['uiId']);const _0x27bc86=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x27bc86&&this['_addContextItem']({..._0x27bc86,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x3d8d7a){for(const _0x503563 of _0x3d8d7a['values']())this['_addToConversationContextItem'](_0x503563);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'](_0x169081){return Array['from'](_0x169081['values']())['flatMap'](_0x1d2005=>this['_mapContextItemToRequestData'](_0x1d2005));}async['addFilesToContext'](_0x27633a,_0x598105,_0x3583a6='file'){const _0x96ad60='files-'+Ot();this['_startUploadOperation'](_0x96ad60);try{await Promise['all'](_0x27633a['map'](async _0x2edb99=>{const _0x1c6b72='file-'+Ot(),_0x213533=_0x548fe1(_0x2edb99['name']),_0x48ecac='file'===_0x3583a6&&_0x2edb99['type']['startsWith']('image/')?'image':_0x3583a6;try{this['_addContextItem']({'type':_0x48ecac,'label':_0x598105?.['label']||_0x213533,'uiId':_0x1c6b72,'resourceId':_0x598105?.['resourceId']},!0x0);const _0x2b4188=this['_connector']['uploadFile'](this['_ownerId'],_0x2edb99,_0x598105);this['_ongoingUploads']['set'](_0x1c6b72,_0x2b4188['abortController']);const {id:_0x3ad79e}=await _0x2b4188['getId']();this['_ongoingUploads']['delete'](_0x1c6b72),this['_finishContextItemLoading']({'type':_0x48ecac,'id':_0x3ad79e,'label':_0x598105?.['label']||_0x213533,'uiId':_0x1c6b72,'resourceId':_0x598105?.['resourceId']},!0x1);}catch(_0x9d521b){if(this['_ongoingUploads']['delete'](_0x1c6b72),!sn(_0x9d521b)){const _0x81bdf3=new nn({'code':pn['get'](_0x9d521b['code'])||'ai-chat-file-upload-failed','cause':_0x9d521b,'context':{'fileName':_0x213533}});this['fire']('error',{'error':_0x81bdf3});}this['_removeContextItem'](_0x1c6b72);}}));}finally{this['_finishUploadOperation'](_0x96ad60);}}['addCurrentDocumentToContext'](_0x5c484c){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x35664c={'type':'document','uiId':'current-document','label':_0x5c484c,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x35664c);}async['updateCurrentDocuments'](_0x247233){const _0x217f0a=this['_pendingContextItems']['get']('current-document');if(!_0x217f0a||!_0x247233['length']||_0x247233['every'](_0x27bcd9=>!_0x27bcd9['content']))return;_0x247233['length']>0x1&&_0x247233['some'](_0x44a0f2=>!_0x44a0f2['description'])&&ft('ai-chat-documents-missing-description');try{const _0x3692c7=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x247233)['getIds']();if(_0x3692c7['length']!==_0x247233['length']||_0x3692c7['some'](_0x2a7725=>!_0x2a7725?.['id'])){const _0x504666=new at('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x504666});}_0x217f0a['documents']=_0x247233['map']((_0x5bd82d,_0x48d52a)=>{return{'id':_0x3692c7[_0x48d52a]['id'],'content':_0x5bd82d['content'],'version':_0x5bd82d['version'],'sessionId':_0x5bd82d['sessionId'],'selection':(_0x3c4f4c=_0x5bd82d['selections'],_0x3c4f4c?_0x3c4f4c['map'](_0x16ee55=>({'start':_0x16ee55['start'],'end':_0x16ee55['end']})):[]),'channelId':_0x5bd82d['channelId'],'rootName':_0x5bd82d['rootName']};var _0x3c4f4c;});}catch(_0x52b661){const _0xb9d534=new nn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x52b661});this['fire']('error',{'error':_0xb9d534});}}['addSelectionToContext'](_0x44962a){this['_addContextItem']({'type':'selection','label':_0x44962a,'uiId':'selection','content':_0x44962a});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x315f79,_0x4f62c5){const _0x246f26='url-'+Ot();this['_startUploadOperation'](_0x246f26);const _0x34b771='url-'+Ot();try{this['_addContextItem']({'type':'web-resource','label':_0x4f62c5?.['label']||_0x315f79,'uiId':_0x34b771,'resourceId':_0x4f62c5?.['resourceId']},!0x0);const _0x131812=this['_connector']['uploadUrl'](this['_ownerId'],_0x315f79,_0x4f62c5);this['_ongoingUploads']['set'](_0x34b771,_0x131812['abortController']);const {id:_0x2033a1}=await _0x131812['getId']();this['_ongoingUploads']['delete'](_0x34b771),this['_finishContextItemLoading']({'type':'web-resource','id':_0x2033a1,'label':_0x4f62c5?.['label']||_0x315f79,'uiId':_0x34b771,'resourceId':_0x4f62c5?.['resourceId']},!0x1);}catch(_0x2f7438){this['_ongoingUploads']['delete'](_0x34b771),sn(_0x2f7438)||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x315f79,'originalError':_0x2f7438}),'url':_0x315f79}),this['_removeContextItem'](_0x34b771);}finally{this['_finishUploadOperation'](_0x246f26);}}['addToolItemToContext'](_0x4236eb){_0x4236eb['id']=_0x4236eb['id']??Ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x4236eb['uiId'],_0x4236eb),this['fire']('contextItemAdded',{'contextItem':_0x4236eb,'isLoading':!0x1});}async['loadSourceResources'](_0x27d423,_0x7e23c,_0x1724af){const _0x1bfd88=this['_addContextOptionsState']['sources']['find'](_0x52c021=>_0x52c021['id']===_0x27d423);if(!_0x1bfd88)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x27d423}),'sourceId':_0x27d423}),[];try{const _0x2be29e=(await _0x1bfd88['getResources'](_0x7e23c))['map'](_0x30b9b4=>{const _0x3a82a6=this['_isResourceInContext'](_0x30b9b4['id']);return{..._0x30b9b4,'isInContext':_0x3a82a6};});return _0x1bfd88['resources']=_0x2be29e,this['fire']('sourceResourcesLoaded',{'sourceId':_0x27d423,'source':_0x1bfd88,'resources':_0x2be29e,'uid':_0x1724af}),_0x2be29e;}catch(_0x2e465e){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x27d423,'originalError':_0x2e465e}),'sourceId':_0x27d423,'sourceLabel':_0x1bfd88['label']}),[];}}async['addResourceToContext'](_0x3a8e82,_0x37737e){if(this['_isResourceInContext'](_0x37737e['id']))return;let _0x2eef42=_0x37737e['data'];if(!_0x2eef42&&_0x3a8e82['getData'])try{_0x2eef42=await _0x3a8e82['getData'](_0x37737e['id']);}catch(_0x990898){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id'],'originalError':_0x990898}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});}if(_0x2eef42)switch(_0x37737e['type']){case'web-resource':if('string'!=typeof _0x2eef42)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id'],'expectedType':'string','actualType':typeof _0x2eef42}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});await this['addUrlToContext'](_0x2eef42,{'label':_0x37737e['label'],'resourceId':_0x37737e['id']});break;case'file':if(!(_0x2eef42 instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id'],'expectedType':'File','actualType':typeof _0x2eef42}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});await this['addFilesToContext']([_0x2eef42],{'label':_0x37737e['label'],'resourceId':_0x37737e['id']});break;case'text':if('object'!=typeof _0x2eef42||!('content'in _0x2eef42)||!('type'in _0x2eef42))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x2eef42}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});_0x2eef42=AIChatContext['_convertTextResourceToFile'](_0x2eef42,_0x37737e['label']),await this['addFilesToContext']([_0x2eef42],{'label':_0x37737e['label'],'resourceId':_0x37737e['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id'],'resourceType':_0x37737e['type']}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']}),'resourceId':_0x37737e['id'],'sourceId':_0x3a8e82['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0xd6702b){if(void 0x0!==_0xd6702b)this['_addContextOptionsState']['document']['isHidden']=!_0xd6702b;else{const _0x3e6ac4=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x3e6ac4;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x1f8653,_0x354fa1){switch(_0x1f8653['type']){case'markdown':return new File([_0x1f8653['content']],_0x354fa1,{'type':'text/markdown'});case'html':return new File([_0x1f8653['content']],_0x354fa1,{'type':'text/html'});default:return new File([_0x1f8653['content']],_0x354fa1,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x3b2d6e){switch(_0x3b2d6e['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x3b2d6e['id']}];case'web-resource':return[{'type':'web-resource','id':_0x3b2d6e['id']}];case'document':return _0x3b2d6e['documents']?.['length']?_0x3b2d6e['documents']['map'](_0x132aa8=>({'type':'document','id':_0x132aa8['id'],..._0x132aa8['selection']?.['length']&&{'selection':_0x132aa8['selection']}})):[];case'mcp-tool-context':{const _0x2cd1e4=_0x3b2d6e;return[{'type':'mcp-tool-context','mcpServerName':_0x2cd1e4['mcpServerName'],'toolName':_0x2cd1e4['toolName'],'data':{..._0x2cd1e4['data'],'label':_0x2cd1e4['label']||_0x2cd1e4['data']?.['label']||_0x2cd1e4['id']},'id':_0x2cd1e4['id']}];}default:return[];}}['_addContextItem'](_0x19aa4b,_0x331afa=!0x1){if(this['_pendingContextItems']['set'](_0x19aa4b['uiId'],_0x19aa4b),_0x19aa4b['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x19aa4b,'isLoading':_0x331afa}),'current-document'===_0x19aa4b['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x19aa4b['resourceId']){const _0x498772=this['_findSourceIdsByResourceId'](_0x19aa4b['resourceId']);_0x498772&&_0x498772['forEach'](_0x2cd8cb=>{this['_updateResourceInContextState'](_0x2cd8cb,_0x19aa4b['resourceId'],!0x0);});}}['_removeContextItem'](_0x26ee03){const _0x4787fe=this['_pendingContextItems']['get'](_0x26ee03),_0x45b654=this['_ongoingUploads']['get'](_0x26ee03);if(_0x45b654&&(_0x45b654['abort'](),this['_ongoingUploads']['delete'](_0x26ee03)),_0x4787fe?.['resourceId']){const _0x4d22c3=this['_findSourceIdsByResourceId'](_0x4787fe['resourceId']);_0x4d22c3&&_0x4d22c3['forEach'](_0x2cb71a=>{this['_updateResourceInContextState'](_0x2cb71a,_0x4787fe['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x26ee03),this['fire']('contextItemRemoved',{'uiId':_0x26ee03,'type':_0x4787fe?.['type']}),'current-document'===_0x26ee03&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x559762,_0x588dc9){if(this['_pendingContextItems']['has'](_0x559762['uiId'])&&(this['_pendingContextItems']['set'](_0x559762['uiId'],_0x559762),this['fire']('contextItemLoadingEnded',{'contextItem':_0x559762,'isLoading':_0x588dc9}),_0x559762['resourceId'])){const _0x7d45f7=this['_findSourceIdsByResourceId'](_0x559762['resourceId']);_0x7d45f7&&_0x7d45f7['forEach'](_0x3190e1=>{this['_updateResourceInContextState'](_0x3190e1,_0x559762['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x49f6e6){this['_conversationContextItems']['set'](_0x49f6e6['uiId'],_0x49f6e6);}['_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'](_0x395502=>({..._0x395502,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x75accd=>({..._0x75accd,'resources':[]}))??[];}['_isResourceInContext'](_0x29ed2f){for(const _0x246cfc of this['_pendingContextItems']['values']())if(_0x246cfc['resourceId']===_0x29ed2f)return!0x0;for(const _0x439429 of this['_conversationContextItems']['values']())if(_0x439429['resourceId']===_0x29ed2f)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0xe4526f){const _0x55183f=[];for(const _0x905bb5 of this['_addContextOptionsState']['sources'])_0x905bb5['resources']['find'](_0x4b8471=>_0x4b8471['id']===_0xe4526f)&&_0x55183f['push'](_0x905bb5['id']);return 0x0===_0x55183f['length']?null:_0x55183f;}['_updateResourceInContextState'](_0x3def3a,_0x35a5b4,_0x510be1){const _0x19f6b1=this['_addContextOptionsState']['sources']['find'](_0x431571=>_0x431571['id']===_0x3def3a);if(!_0x19f6b1)return;const _0x161cc7=_0x19f6b1['resources']['find'](_0x4b5ff7=>_0x4b5ff7['id']===_0x35a5b4);_0x161cc7&&(_0x161cc7['isInContext']=_0x510be1,this['fire']('resourceStateChanged',{'sourceId':_0x3def3a,'resourceId':_0x35a5b4,'isInContext':_0x510be1}));}['_startUploadOperation'](_0x105870){this['_ongoingUploadOperations']['set'](_0x105870,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x3bd876){this['_ongoingUploadOperations']['delete'](_0x3bd876),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'](_0x4946f8){const _0x57111a={};return _0x4946f8&&_0x4946f8['isWebSearchEnabled']&&(_0x57111a['webSearch']={}),_0x4946f8&&_0x4946f8['isReasoningEnabled']&&(_0x57111a['reasoning']={}),_0x57111a;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x20b4fa){_0x20b4fa!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x20b4fa,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x23f7be){_0x23f7be!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x23f7be,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},bn=class extends In{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x16d450){super(_0x16d450),this['conversationId']=_0x16d450['conversationId'],this['contextItems']=_0x16d450['contextItems'],this['capabilities']=_0x16d450['capabilities'],this['userMessage']=_0x16d450['userMessage'],this['model']=_0x16d450['model'],this['attributes']=_0x16d450['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(_0x1c6b20){super(),this['options']=_0x1c6b20,this['connector']=_0x1c6b20['connector'],this['chatModels']=_0x1c6b20['chatModels'],this['id']=_0x1c6b20['conversationId'],this['isFromHistory']=_0x1c6b20['isFromHistory'],this['_channelsToEditors']=_0x1c6b20['channelsToEditors'],this['_getSessionId']=_0x1c6b20['getSessionId'];}async['init'](_0x29ae0c){try{this['chatContext']=new Tn({'connector':this['connector'],'config':_0x29ae0c,'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 _0x47f61d=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x47f61d});const _0x3c967f=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x3c967f&&await this['setModel'](_0x3c967f);}catch(_0x2ff1e4){const _0x576a6e=new nn({'code':'ai-chat-conversation-init-failed','cause':_0x2ff1e4,'type':'network'});this['fire']('error',{'error':_0x576a6e});}}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:_0x953d0c}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x953d0c,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x288266){const _0x18d13d=new nn({'code':'ai-chat-conversation-start-failed','cause':_0x288266,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x18d13d}),_0x18d13d;}}async['load'](_0x13fc32){try{const _0x3462a8=await this['connector']['fetchConversation'](_0x13fc32)['getConversation'](),_0x22980b=await this['connector']['fetchConversationMessages'](_0x13fc32)['getMessages'](),_0x17bdb3=_0x22980b[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x3462a8['id'],'title'in _0x3462a8?this['fire']('setConversationTitle',_0x3462a8['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x379bb7=(await this['chatModels']['getAll']())['find'](_0x45202f=>_0x45202f['id']['toLowerCase']()===_0x17bdb3['toLowerCase']());this['selectedModel']=_0x379bb7,this['fire']('modelSelected',{'selectedModel':_0x379bb7,'isDisabled':!0x0});const {streamingMessageId:_0x4cf4f}=await this['_processMessagesToInteractions'](_0x22980b,_0x17bdb3);return _0x4cf4f&&this['currentInteraction']?this['_resumeStream'](_0x4cf4f):this['currentInteraction']=void 0x0,this;}catch(_0x4a664d){const _0x501679=new nn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x4a664d,'type':'network','context':{'conversationId':_0x13fc32}});throw this['fire']('error',{'error':_0x501679}),_0x501679;}}async['_processMessagesToInteractions'](_0x23a47f,_0x147585){let _0x3be5b8,_0x320b07,_0xa58611=!0x1;for(const _0x5a17e8 of _0x23a47f)if('user'===_0x5a17e8['role']){const {contextItems:_0x508e1f,hasUnmatched:_0x2713db}=await this['_extractContextItems'](_0x5a17e8);_0xa58611=_0x2713db;const _0x284bca={'isReasoningEnabled':Object['hasOwn'](_0x5a17e8['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x5a17e8['capabilities'],'webSearch')};_0x3be5b8=this['createInteraction']({'userMessage':_0x5a17e8['prompt'],'contextItems':_0x508e1f,'capabilities':_0x284bca,'modelId':_0x147585,'attributes':_0x5a17e8['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x3be5b8,_0x320b07=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x5a17e8['role']&&_0x3be5b8){if('streaming'===_0x5a17e8['status']){_0x320b07=_0x5a17e8['id'];continue;}if('error'===_0x5a17e8['status'])continue;const _0x4578ea=[];for(const _0x530e7e of _0x5a17e8['content'])switch(_0x530e7e['type']){case'text':case'modification':{const _0x2d60d9=_0x3be5b8['getDocumentContext'](),_0x11dbb5=this['_hasSessionMismatch'](_0x2d60d9)||_0xa58611;_0x3be5b8['currentReply']?.['type']!==_0x530e7e['type']&&(_0x3be5b8['currentReply']=_0x3be5b8['createReply']({'type':_0x530e7e['type'],'isDone':!0x0,'interactionId':_0x3be5b8['id'],'areActionsDisabled':_0x11dbb5,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x4578ea['length']>0x0&&(_0x3be5b8['currentReply']['sources']=_0x4578ea['splice'](0x0))),_0x3be5b8['currentReply']['appendContent'](_0x530e7e['content'],_0x530e7e['documentId']);break;}case'url':_0x4578ea['push'](_0x530e7e);break;case'mcp-tool-result':{const {data:_0x2425d7,attributes:_0x5bdeb3}=JSON['parse'](_0x530e7e['content']);_0x3be5b8['_handleToolResultData']({'toolName':_0x530e7e['toolName'],'data':_0x2425d7,'attributes':_0x5bdeb3});break;}}'cancelled'===_0x5a17e8['status']&&this['fire']('error',{'interactionId':_0x3be5b8['id'],'error':new at('ai-request-aborted',this)});}}return{'streamingMessageId':_0x320b07};}async['_resumeStream'](_0x3617f5){if(this['currentInteraction'])try{const _0x1b8216=this['connector']['resumeStream'](this['id'],_0x3617f5);await this['currentInteraction']['resume'](_0x1b8216);}catch(_0x174889){_0x174889 instanceof at&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x174889});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x45da65){return _0x45da65['content']?this['chatContext']['populateFromMessage'](_0x45da65['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x1efa53,attributes:_0xc9dcf8}){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 _0x33cc4f=new Map(this['getPendingContextItems']()),_0x3aa01f=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4c755b=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x1efa53,'contextItems':_0x33cc4f,'capabilities':_0x3aa01f,'modelId':_0x4c755b,'attributes':_0xc9dcf8,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x557585){if(_0x557585 instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x557585});else{const _0x5d2c03=pn['get'](_0x557585['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x5d2c03,null,{'error':_0x557585})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x1d8b58,contextItems:_0x132bf1,capabilities:_0x55d3d3,modelId:_0x4284b5,attributes:_0xb0d6e0,channelsToEditors:_0x299d57}){const _0xeee70e=new bn({'userMessage':_0x1d8b58,'contextItems':_0x132bf1,'capabilities':_0x55d3d3,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x4284b5,'attributes':_0xb0d6e0,'channelsToEditors':_0x299d57});return _0xeee70e['delegate'](...An)['to'](this),this['interactions']['push'](_0xeee70e),this['fire']('interactionCreated',_0xeee70e),_0xeee70e;}['getInteraction'](_0x5e1069){return this['interactions']['find'](_0x4c43b3=>_0x4c43b3['id']===_0x5e1069);}['removeInteraction'](_0xde53b){const _0x5ceae4=this['getInteraction'](_0xde53b);_0x5ceae4&&(_0x5ceae4['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x5ceae4),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x338c2d=this['lastInteraction'];_0x338c2d?.['conversationId']&&_0x338c2d['messageId']&&this['connector']['cancelStream'](_0x338c2d['conversationId'],_0x338c2d['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x1c4086){this['chatContext']['addCurrentDocumentToContext'](_0x1c4086);}async['updateCurrentDocumentsInContext'](_0x599659){await this['chatContext']['updateCurrentDocuments'](_0x599659);}['toggleAddCurrentDocumentOptionVisibility'](_0x916a7a){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x916a7a);}['_hasSessionMismatch'](_0x54611b){return!!_0x54611b&&_0x54611b['documents']['some'](_0xfaaf41=>{const _0x37e498=this['_channelsToEditors']['get'](_0xfaaf41['channelId']);return!_0x37e498||_0xfaaf41['sessionId']!==this['_getSessionId'](_0x37e498);});}['addSelectionToContext'](_0x50266b){this['chatContext']['addSelectionToContext'](_0x50266b);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x480a3f){this['chatContext']['addFilesToContext'](_0x480a3f);}['addUrlToContext'](_0x2b7ca1){this['chatContext']['addUrlToContext'](_0x2b7ca1);}['addToolItemToContext'](_0x2b3219){this['chatContext']['addToolItemToContext'](_0x2b3219);}['addResourceToContext'](_0x505042,_0x4c63e1){this['chatContext']['addResourceToContext'](_0x505042,_0x4c63e1);}['loadSourceResources'](_0x59b330,_0x3e9fa8,_0x28c3e6){return this['chatContext']['loadSourceResources'](_0x59b330,_0x3e9fa8,_0x28c3e6);}['removeFromContext'](_0x46ced2){this['chatContext']['removeFromContext'](_0x46ced2);}['setWebSearch'](_0x8ef158){this['chatCapabilities']['setWebSearch'](_0x8ef158);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x44d45d){this['chatCapabilities']['setReasoning'](_0x44d45d);}['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'](_0x3d4ed1){_0x3d4ed1?!0x1===await this['chatModels']['isAvailable'](_0x3d4ed1)&&(ft('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x3d4ed1}),_0x3d4ed1=(await this['chatModels']['getAvailableModels']())[0x0]):(ft('ai-chat-conversation-set-model-null',{'conversation':this}),_0x3d4ed1=(await this['chatModels']['getAvailableModels']())[0x0]),_0x3d4ed1['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x3d4ed1,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x3d4ed1}));}};function On({groups:_0x5af172,documentContextContent:_0x29a3a7,documents:_0x3e2d77}){const _0x356836=new Map();for(const _0x30095c of _0x5af172){const {documentId:_0x560b77}=_0x30095c,_0x55f5d7=_0x356836['get'](_0x560b77);if(_0x55f5d7)_0x55f5d7['groups']['push'](_0x30095c),_0x55f5d7['indexes']['push'](_0x30095c['index']);else{const _0x51e7d4=_0x3e2d77['find'](_0x258813=>_0x258813['id']===_0x560b77),_0x55da95=_0x29a3a7['get'](_0x560b77);if(!_0x51e7d4||!_0x55da95)continue;_0x356836['set'](_0x560b77,{'groups':[_0x30095c],'documentContext':_0x51e7d4,'documentContent':_0x55da95,'editor':_0x30095c['editor'],'indexes':[_0x30095c['index']]});}}return _0x356836;}function vn(_0x561899,_0x39c4e8){const _0x378150=_0x561899['files']['length']>0x0&&_0x561899['files']['every'](_0x253c99=>_0x253c99['type']['startsWith']('image/')),_0x3f4f29=_0x561899['plainText']['trim']()['length']>0x0;if(_0x561899['files']['length']>0x0&&_0x39c4e8['filesEnabled']&&(!_0x378150||!_0x3f4f29)){const _0xb5071e=_0x561899['files']['filter'](_0x3c5545=>_0x3c5545['name']);return _0xb5071e['length']>0x0?{'type':'file','files':_0xb5071e}:null;}if(_0x39c4e8['urlsEnabled']){const _0x4ad6bb=function(_0x3cce77){const _0x4231fb=_0x3cce77['trim']();if(/\s/['test'](_0x4231fb))return null;try{const _0x18b249=new URL(_0x4231fb);return'http:'!==_0x18b249['protocol']&&'https:'!==_0x18b249['protocol']?null:_0x18b249['toString']();}catch{return null;}}(_0x561899['plainText']);if(_0x4ad6bb)return{'type':'url','url':_0x4ad6bb};}const _0x35c83c=_0x561899['forceTextAttachment']?0x1:_0x39c4e8['longTextThreshold']??0x1/0x0;if(_0x561899['plainText']['length']>=Math['max'](_0x35c83c,0x1)&&_0x39c4e8['filesEnabled']){const _0x537bd1=_0x39c4e8['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x561899['plainText']],_0x537bd1,{'type':'text/plain'})]};}return null;}var kn=class extends _0x394116{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[cs,rn,_0x2a9bb4];}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 _0x4add70=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x44141f,_0x2e8770)=>{this['_handleUIUserMessage']({'message':_0x2e8770});}),this['listenTo'](_0x4add70['view'],'change:activeTab',(_0x1ef50b,_0x581ee1,_0x527043)=>{'chat'!==_0x527043&&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',(_0x187b4e,_0x2949d2)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x2949d2));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x1c8029,_0x43fef0)=>{this['activeConversation']?.['addUrlToContext'](_0x43fef0);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x501a90,_0x2118eb)=>{const _0x2cd4a2=this['activeConversation'];if(!_0x2cd4a2)return;_0x2118eb['hasDirectory']&&(_0x2118eb['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Ot()}));const _0x4d9767=vn(_0x2118eb,{'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')});_0x4d9767&&(_0x2118eb['preventDefault'](),'url'===_0x4d9767['type']?_0x2cd4a2['addUrlToContext'](_0x4d9767['url']):_0x2cd4a2['chatContext']['addFilesToContext'](_0x4d9767['files'],void 0x0,_0x4d9767['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x2efbb3,_0x30ce15)=>{_0x30ce15['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0xbe8a90,_0x6e68ac)=>{this['activeConversation']?.['addResourceToContext'](_0x6e68ac['source'],_0x6e68ac['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x3bd307,_0x4f59d3)=>{this['_removeFromContext'](_0x4f59d3);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x2c3a63,_0x39fa44)=>{this['activeConversation']?.['loadSourceResources'](_0x39fa44['sourceId'],_0x39fa44['query'],_0x39fa44['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x332e5d,_0x371891)=>{this['activeConversation']?.['setModel'](_0x371891);}),this['listenTo'](this['_aiChatUi'],'like',(_0x2f2cef,{replyId:_0x420256})=>{console['log']('Liked\x20response',_0x420256);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x32f35e,{replyId:_0x4cb48c})=>{console['log']('Disliked\x20response',_0x4cb48c);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x315c90,_0x3c4325)=>{this['_insertSuggestion'](_0x3c4325);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x1ffab4,{replyId:_0x3d1a97,partIndex:_0x4275d3})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x3d1a97,_0x4275d3);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x383c08,{replyId:_0x435be9,partIndex:_0x33e471})=>{const _0x28365b=this['_getDocumentRangeForReplyChanges'](_0x435be9,_0x33e471);if(!_0x28365b)return;const {reply:_0x339aa0}=this['getInteractionAndReplyById'](_0x435be9);'$graveyard'!=_0x28365b['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x339aa0['changeGroups'][_0x33e471]['editor'],'ranges':[_0x28365b['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x3dd114,_0x43c9e6)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x43c9e6);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x36148c,{replyId:_0x2ad2a1,showDiff:_0x336865})=>{const {interaction:_0x5d3d7e,reply:_0x1f84d5}=this['getInteractionAndReplyById'](_0x2ad2a1),_0x384a11=_0x1f84d5['getContentParts']({'showDiff':_0x336865});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5d3d7e['id']+':'+_0x1f84d5['id'],'parts':_0x384a11});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x11b542,{replyId:_0x24d769,partIndex:_0x3066db})=>{this['_rejectSuggestion']({'replyId':_0x24d769,'partIndex':_0x3066db}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0xc5e5b4,_0x4b391d)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4b391d);}),this['on']('replyCreated',(_0x1de7b5,_0x3c0d47)=>{this['_addFeedItemReply'](_0x3c0d47);});}['afterInit'](){this['context']instanceof _0x3dd3ce?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2db4a1,_0x181b59)=>{_0x181b59['on']('ready',()=>{this['_integrateEditor'](_0x181b59);});}),this['_initConversation']();}async['_initConversation'](){const _0x3fe9ac=this['context']['config']['get']('ai.chat.initialConversation');let _0x4a82ad=_0x3fe9ac;('lastCreated'!=_0x3fe9ac||(_0x4a82ad=await this['_getLastCreatedConversationId'](),_0x4a82ad))&&('new'==_0x4a82ad?await this['_startConversationSafely']():await this['loadConversation'](_0x4a82ad));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x2e241e){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'](_0x2e241e)['getConversation'](),await this['_startConversationSafely']({'id':_0x2e241e}),await this['activeConversation']['load'](_0x2e241e),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x4420b6){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x2e241e}),this['_reporter']['logError'](new at('ai-chat-conversation-not-found',this,void 0x0,_0x4420b6),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x63ac5){let _0x5a6d62=null,_0x3e8cbb=null;this['on']('toolDataReceived',(_0x142d1e,_0x181757,_0x2767e6)=>{_0x2767e6['id']!==_0x5a6d62&&(_0x5a6d62=_0x2767e6['id'],_0x3e8cbb=this['_getAIChatFeedAPI'](_0x2767e6)),_0x63ac5(_0x181757,_0x3e8cbb);});}['addCurrentDocumentToChatContext'](){us(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](ls(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x2f7e9b){const _0x5f30d3=this['_aiEditing']['getSelectionText'](_0x2f7e9b);this['activeConversation']?.['addSelectionToContext'](_0x5f30d3),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x40f373){await this['_startConversationSafely']({'modelId':_0x40f373?.['modelId']});}async['sendMessage'](_0x1d4218){await this['_handleUIUserMessage'](_0x1d4218);}['getGroupId'](){const _0x2dba36=this['context']['config']['get']('collaboration.channelId');if(!_0x2dba36)throw new at('ai-missing-channel-id',this);return _0x2dba36;}['_handleRemovedConversation'](_0x2075cc){this['activeConversation']['id']===_0x2075cc&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x5c8f52){const {reply:_0x39ab1e,interaction:_0x137b82}=this['getInteractionAndReplyById'](_0x5c8f52['replyId']),_0x435c7b=void 0x0!==_0x5c8f52['partIndex']?[_0x39ab1e['changeGroups'][_0x5c8f52['partIndex']]]:_0x39ab1e['changeGroups']['filter'](_0x41582c=>'pending'==_0x41582c['state']);return _0x435c7b['map'](_0x1759ec=>_0x39ab1e['changeGroups']['indexOf'](_0x1759ec))['forEach'](_0x5628d9=>{const _0x2dec02=this['_getDocumentRangeForReplyChanges'](_0x5c8f52['replyId'],_0x5628d9);_0x2dec02&&'$graveyard'!=_0x2dec02['range']['root']['rootName']?(_0x39ab1e['setChangeGroupState'](_0x5628d9,'accepted'),void 0x0!==_0x5c8f52['partIndex']&&this['_scrollToSuggestionRange'](_0x2dec02['range'],!0x1,_0x2dec02['targetEditor'])):_0x39ab1e['setChangeGroupState'](_0x5628d9,'outdated');}),On({'groups':_0x435c7b['filter'](_0x5558ef=>'accepted'===_0x5558ef['state']),'documentContextContent':_0x39ab1e['documentContextContent'],'documents':_0x137b82['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x384cec){const _0x24c74a=this['context']['plugins']['get'](_0x2a9bb4),{reply:_0x1fc235,interaction:_0x1c8f8d}=this['getInteractionAndReplyById'](_0x384cec['replyId']),_0x1cff09=this['_prepareDocumentSuggestions'](_0x384cec),_0x51d262=ks({'documentSuggestions':_0x1cff09,'transform':!0x0,'documentCompare':_0x24c74a,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x354f4d,_0x178c46]of _0x51d262){const {editor:_0x26f5fd,indexes:_0x3be8b0}=_0x1cff09['get'](_0x354f4d);if(!_0x26f5fd['plugins']['has']('TrackChanges')){ft('ai-no-track-changes',{'editor':_0x26f5fd});continue;}let _0x46b0cb;js(_0x178c46,'chat'),_0x26f5fd['model']['change'](_0x471602=>{_0x46b0cb=_0x471602['batch'],_0x26f5fd['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x178c46),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x46b0cb,{'interactionId':_0x1c8f8d['id'],'replyId':_0x1fc235['id'],'indexes':_0x3be8b0});}this['_updateRatings'](_0x1fc235);}['_applySuggestion'](_0x11b7b5){const _0x36ac26=this['context']['plugins']['get'](_0x2a9bb4),{reply:_0xe1dba2,interaction:_0x5c3929}=this['getInteractionAndReplyById'](_0x11b7b5['replyId']),_0x33884d=this['_prepareDocumentSuggestions'](_0x11b7b5),_0x253495=ks({'documentSuggestions':_0x33884d,'transform':!0x0,'documentCompare':_0x36ac26,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x5bf406,_0x105ce1]of _0x253495){const {editor:_0x2adf6c,indexes:_0x46362a}=_0x33884d['get'](_0x5bf406);let _0x1da1a2;js(_0x105ce1,'chat');try{_0x2adf6c['model']['change'](_0x550cda=>{_0x1da1a2=_0x550cda['batch'];for(const _0x4dd387 of _0x105ce1)_0x4dd387['baseVersion']=_0x2adf6c['model']['document']['version'],Ns(_0x2adf6c,_0x4dd387),_0x550cda['batch']['addOperation'](_0x4dd387),_0x2adf6c['model']['applyOperation'](_0x4dd387);}),this['_batchToChanges']['set'](_0x1da1a2,{'interactionId':_0x5c3929['id'],'replyId':_0xe1dba2['id'],'indexes':_0x46362a});}catch(_0x3e1f55){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x3e1f55})),_0x3e1f55;}}this['_updateRatings'](_0xe1dba2);}['_rejectSuggestion'](_0xcc484b){const {reply:_0x1771a8}=this['getInteractionAndReplyById'](_0xcc484b['replyId']);_0x1771a8['setChangeGroupState'](_0xcc484b['partIndex'],'rejected');}['_openBalloonFor'](_0x7ea765,_0x53b6f4){if(!this['_hasAIChatBalloon'])return;const {reply:_0x20a998}=this['getInteractionAndReplyById'](_0x7ea765),_0x5b0cb0=_0x20a998['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x5b0cb0['length'])return;let _0x50ee1a,_0x43daf8;if(void 0x0!==_0x53b6f4?(_0x43daf8=_0x5b0cb0['find'](_0x44ae7a=>_0x44ae7a['index']==_0x53b6f4),_0x50ee1a=_0x43daf8?.['index']):(_0x43daf8=_0x5b0cb0[0x0],_0x50ee1a=_0x43daf8['index']),!_0x43daf8)return void _0x20a998['setChangeGroupState'](_0x53b6f4??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x7ea765&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x50ee1a)return;const _0x37b8b0=this['_getUserPresentableContentPartDocumentRange'](_0x7ea765,_0x20a998,_0x43daf8),_0x144040=_0x20a998['changeGroups']['find'](_0x2a5cc7=>_0x2a5cc7['index']==_0x50ee1a)['editor'],_0x197035=_0x144040['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x197035&&this['_activeBalloon']['close'](),!_0x37b8b0)return _0x197035['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x197035,this['_currentPreviewedChangeGroup']={'replyId':_0x7ea765,'partIndex':_0x50ee1a},this['_scrollToSuggestionRange'](_0x37b8b0,!0x0,_0x144040);const _0x135d89=this['_getPresentableSiblingContentPartIndex'](_0x7ea765,_0x50ee1a,'next');_0x197035['clearContent'](),_0x197035['updateContent']({'part':_0x43daf8,'renderingStrategy':'static'}),_0x197035['open']({'index':_0x50ee1a,'title':ls(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x50ee1a+0x1)['toString']()),'showRotator':null!==_0x135d89,'ranges':[_0x37b8b0],'areActionsDisabled':_0x20a998['areActionsDisabled'],'targetEditor':_0x144040}),_0x197035['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x7ea765,_0x50ee1a),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x7ea765,'index':_0x50ee1a,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x59bd9f,_0x1ce08f,_0x7e0c74){const {reply:_0x45de6b}=this['getInteractionAndReplyById'](_0x59bd9f),_0x1c8bbe=_0x45de6b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x1c8bbe['length'])return null;const _0x172eb6='next'==_0x7e0c74?0x1:-0x1;function _0x27a84b(_0x34f852){const _0x3b79ab=(_0x34f852+_0x172eb6+_0x1c8bbe['length'])%_0x1c8bbe['length'];return{'siblingIndex':_0x3b79ab,'siblingPart':_0x1c8bbe[_0x3b79ab]};}const _0x331df2=_0x1c8bbe['findIndex'](_0x216f75=>_0x216f75['index']==_0x1ce08f);let {siblingIndex:_0x5257e3,siblingPart:_0x50d6fd}=_0x27a84b(_0x331df2);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x59bd9f,_0x45de6b,_0x50d6fd);)if({siblingIndex:_0x5257e3,siblingPart:_0x50d6fd}=_0x27a84b(_0x5257e3),_0x5257e3===_0x331df2)return null;return _0x50d6fd['index'];}['_getUserPresentableContentPartDocumentRange'](_0x19d0e2,_0x2d0a84,_0x3a8edf){const _0x5b14eb=_0x2d0a84['changeGroups'];if(!_0x3a8edf['hasChanges'])return null;const _0x4b3109=_0x5b14eb['find'](_0xad36f0=>_0xad36f0['index']==_0x3a8edf['index']);if('pending'!==_0x4b3109?.['state'])return null;if(!_0x4b3109?.['editor']||'destroyed'===_0x4b3109['editor']['state'])return _0x2d0a84['setChangeGroupState'](_0x3a8edf['index'],'outdated'),null;const _0x597149=this['_getDocumentRangeForReplyChanges'](_0x19d0e2,_0x3a8edf['index']);if(!_0x597149)return _0x2d0a84['setChangeGroupState'](_0x3a8edf['index'],'outdated'),null;const {range:_0x40ebc4,currentIndex:_0x116ae9}=_0x597149;return'$graveyard'==_0x40ebc4['root']['rootName']?(_0x2d0a84['setChangeGroupState'](_0x116ae9,'outdated'),null):_0x597149['range'];}['_getDocumentRangeForReplyChanges'](_0x3faf56,_0x4c1f32){const {reply:_0x2aae0c,interaction:_0x55a064}=this['getInteractionAndReplyById'](_0x3faf56),_0x14181a=_0x2aae0c['changeGroups']['filter'](_0xbdeb3c=>'pending'==_0xbdeb3c['state']),_0x4273bf=_0x14181a['map'](_0xc05bed=>_0x2aae0c['changeGroups']['indexOf'](_0xc05bed));void 0x0===_0x4c1f32&&(_0x4c1f32=_0x4273bf[0x0]);const _0x4947d5=_0x4273bf['indexOf'](_0x4c1f32);if(-0x1==_0x4947d5)return null;const _0x5c6dbd=_0x14181a[_0x4947d5],_0x45b797=_0x5c6dbd['editor'];if(!_0x45b797||'destroyed'===_0x45b797['state'])return null;const _0x3a1f20=_0x2aae0c['documentContextContent']['get'](_0x5c6dbd['documentId']),_0x1877db=new _0x389250([]),_0x3758a8=new _0x389250([]);for(const _0x552a8f of _0x5c6dbd['changes'])if('removed'!=_0x552a8f['type']&&_0x3758a8['children']['push'](_0x552a8f['node']['cloneNode'](!0x0)),'new'!=_0x552a8f['type']){const _0x58ce7d=_0x52cdf1(_0x2f433c=>Cs(_0x2f433c,'data-id')==_0x552a8f['id'],_0x3a1f20,!0x0);_0x1877db['children']['push'](_0x58ce7d['cloneNode'](!0x0));}if(0x0==_0x1877db['children']['length']){if(_0x5c6dbd['changes'][0x0]['anchorId']){const _0x542fba=ms('data-id',_0x5c6dbd['changes'][0x0]['anchorId'],_0x3a1f20);_0x1877db['children']['unshift'](_0x542fba['cloneNode'](!0x0)),_0x3758a8['children']['unshift'](_0x542fba['cloneNode'](!0x0)),_0x542fba['nextSibling']&&(_0x1877db['children']['push'](_0x542fba['nextSibling']['cloneNode'](!0x0)),_0x3758a8['children']['push'](_0x542fba['nextSibling']['cloneNode'](!0x0)));}else{const _0x32903c=_0x3a1f20['children'][0x0];if(!_0x32903c)return null;_0x1877db['children']['push'](_0x32903c['cloneNode'](!0x0)),_0x3758a8['children']['push'](_0x32903c['cloneNode'](!0x0));}}const _0x5e2d84=_0x55a064['getDocumentContext'](),_0x29f737=_0x5e2d84['documents']['find'](_0x24003d=>_0x24003d['id']==_0x5c6dbd['documentId'])['content'],_0x15d938=_0x45b797['model']['document']['getRoot'](_0x5c6dbd['rootName']),_0x4c9fe5=_0x45b797['data']['parse'](_0x29f737,_0x15d938),_0x2cf350=ps(_0x1877db),_0x1951fc=_0x45b797['data']['parse'](_0x2cf350,_0x15d938),_0x283d64=_0x45b797['data']['parse'](_0x2cf350,_0x15d938),_0x2e9ef6=_0x45b797['model']['createPositionAt'](_0x1951fc,0x0),_0x21ea1a=ps(_0x3758a8),_0x4546ac={'targetEditor':_0x45b797,'anchor':_0x2e9ef6,'markDeletions':!0x1},_0x42a9ab=_0x45b797['plugins']['get'](_0x2a9bb4)['getDiff'](_0x2cf350,_0x21ea1a,_0x4546ac)['getOperations']();if(!_0x42a9ab['length'])return null;_0x45b797['model']['change'](_0x179350=>{for(const _0xc1017f of _0x42a9ab)if('remove'==_0xc1017f['type']){const _0xd995e4=_0xc1017f['sourcePosition'],_0x951f54=_0xc1017f['howMany'],_0x50476c=new _0x2142d8(_0xd995e4,_0x951f54);_0x179350['batch']['addOperation'](_0x50476c),_0x45b797['model']['applyOperation'](_0x50476c);}else'marker'!==_0xc1017f['type']&&(_0xc1017f['baseVersion']=null,_0xc1017f['isDocumentOperation']=!0x1,_0x179350['batch']['addOperation'](_0xc1017f),_0x45b797['model']['applyOperation'](_0xc1017f));});const _0xc4c5f5=Fs(_0x45b797,_0x42a9ab,_0x1951fc);Ws(_0x45b797['model'],_0xc4c5f5);const _0x1df0d2=_0xc4c5f5['getFirstRange']()['start']['path']['slice'](),_0x37e58f=_0xc4c5f5['getFirstRange']()['end']['path']['slice'](),_0x50225c=[];let _0x516809=_0x1951fc,_0x29aa08=_0x283d64;for(let _0xdd3edc=0x0;_0xdd3edc<_0x37e58f['length'];_0xdd3edc++){const _0x8424b7=_0x516809['maxOffset']-_0x37e58f[_0xdd3edc];_0x50225c[_0xdd3edc]=_0x29aa08['maxOffset']-_0x8424b7,_0x516809=_0x516809['getChildAtOffset'](_0x37e58f[_0xdd3edc]),_0x29aa08=_0x29aa08['getChildAtOffset'](_0x50225c[_0xdd3edc]);}const _0x1ed715=_0x45b797['model']['createRange'](_0x45b797['model']['createPositionFromPath'](_0x283d64,_0x1df0d2),_0x45b797['model']['createPositionFromPath'](_0x283d64,_0x50225c)),_0x1483aa=_0x283d64['getChild'](0x0)['getAttribute'](_0x583773),_0x2c3c6b=Array['from'](_0x4c9fe5['getChildren']())['find'](_0x39c051=>_0x39c051['getAttribute'](_0x583773)==_0x1483aa)['getPath'](),_0x54d0c1=_0x1ed715['start']['path']['slice'](),_0x24983e=_0x1ed715['end']['path']['slice']();_0x54d0c1[0x0]=_0x2c3c6b[0x0]+_0x54d0c1[0x0],_0x24983e[0x0]=_0x2c3c6b[0x0]+_0x24983e[0x0];let _0x4b34f8=_0x45b797['model']['createRange'](_0x45b797['model']['createPositionFromPath'](_0x45b797['model']['document']['getRoot'](_0x5c6dbd['rootName']),_0x54d0c1),_0x45b797['model']['createPositionFromPath'](_0x45b797['model']['document']['getRoot'](_0x5c6dbd['rootName']),_0x24983e));const _0x54a6cb=_0x5e2d84['documents']['find'](_0x4e6321=>_0x4e6321['id']==_0x5c6dbd['documentId'])['version'],_0x52cc20=_0x45b797['model']['document']['history']['getOperations'](_0x54a6cb);for(const _0x3ad65a of _0x52cc20)_0x4b34f8=_0x23ea4f['_createFromRanges'](_0x4b34f8['getTransformedByOperation'](_0x3ad65a));return{'range':_0x4b34f8,'currentIndex':_0x4c1f32,'targetEditor':_0x45b797};}['_integrateEditorBalloon'](_0x191cb0){if(!_0x191cb0['plugins']['has']('AIChatBalloon'))return;const _0x154acf=_0x191cb0['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x154acf['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x154acf,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x510774,partIndex:_0x563385}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x4b9848}=this['getInteractionAndReplyById'](_0x510774),_0x16370b=_0x4b9848['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x563385});_0x154acf['updateContent']({'part':_0x16370b[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x154acf,'applySuggestion',()=>{const {replyId:_0x9aa3e8,partIndex:_0x41c3e3}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x9aa3e8,'partIndex':_0x41c3e3}),_0x154acf['setState']('accepted');}),this['listenTo'](_0x154acf,'insertSuggestion',()=>{const {replyId:_0x17b50e,partIndex:_0x5ed4e8}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x17b50e,'partIndex':_0x5ed4e8}),_0x154acf['setState']('accepted');}),this['listenTo'](_0x154acf,'rejectSuggestion',()=>{const {replyId:_0x39e095,partIndex:_0x578998}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x39e095,'partIndex':_0x578998}),_0x154acf['setState']('rejected');}),this['listenTo'](_0x154acf,'showNext',()=>{const {replyId:_0xb092d9,partIndex:_0x43a882}=this['_currentPreviewedChangeGroup'],_0x3dea5f=this['_getPresentableSiblingContentPartIndex'](_0xb092d9,_0x43a882,'next');null!==_0x3dea5f&&this['_openBalloonFor'](_0xb092d9,_0x3dea5f);}),this['listenTo'](_0x154acf,'showPrevious',()=>{const {replyId:_0x57f742,partIndex:_0x311afe}=this['_currentPreviewedChangeGroup'],_0x3fd6b9=this['_getPresentableSiblingContentPartIndex'](_0x57f742,_0x311afe,'previous');null!==_0x3fd6b9&&this['_openBalloonFor'](_0x57f742,_0x3fd6b9);}),this['listenTo'](_0x154acf,'dialogClosed',(_0x20e7e8,{id:_0x8e804d})=>{if('aiChatBalloon'!==_0x8e804d)return;const {replyId:_0x253d1d,partIndex:_0x46df3f}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x253d1d,'index':_0x46df3f,'isActive':!0x1}),this['_activeBalloon']===_0x154acf&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x1ffcf2){if(this['_channelsToEditors']['set'](_0x1ffcf2['config']['get']('collaboration.channelId'),_0x1ffcf2),this['_integrateEditorBalloon'](_0x1ffcf2),this['addCurrentDocumentToChatContext'](),_0x1ffcf2['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x1ffcf2['plugins']['has']('Undo')){const _0x5702a3=_0x1ffcf2['commands']['get']('undo'),_0x43ba51=_0x1ffcf2['commands']['get']('redo');this['listenTo'](_0x5702a3,'revert',(_0x2d6ef1,_0x4c3e6f,_0x3409dd)=>{const _0x333f92=this['_batchToChanges']['get'](_0x4c3e6f);if(!_0x333f92)return;const _0x5d7307=this['activeConversation']['getInteraction'](_0x333f92['interactionId']),_0x8ef1d3=_0x5d7307?.['getReply'](_0x333f92['replyId']);this['_batchToChanges']['delete'](_0x4c3e6f),_0x5d7307&&_0x8ef1d3&&(_0x333f92['indexes']['forEach'](_0x596ac3=>_0x8ef1d3['setChangeGroupState'](_0x596ac3,'pending')),this['_batchToChanges']['set'](_0x3409dd,_0x333f92));}),this['listenTo'](_0x43ba51,'revert',(_0xa50477,_0x29917a,_0x116b73)=>{const _0x4fcc2b=this['_batchToChanges']['get'](_0x29917a);if(!_0x4fcc2b)return;const _0x30855b=this['activeConversation']['getInteraction'](_0x4fcc2b['interactionId']),_0x45b005=_0x30855b?.['getReply'](_0x4fcc2b['replyId']);this['_batchToChanges']['delete'](_0x29917a),_0x30855b&&_0x45b005&&(_0x4fcc2b['indexes']['forEach'](_0x44a6eb=>_0x45b005['setChangeGroupState'](_0x44a6eb,'accepted')),this['_batchToChanges']['set'](_0x116b73,_0x4fcc2b));});}const _0x34eb8c=_0x1ffcf2['config']['get']('ai.chat.context');_0x34eb8c['alwaysAddSelection']&&_0x34eb8c['document']['enabled']&&this['listenTo'](_0x1ffcf2['model']['document']['selection'],'change:range',(_0x503cd9,_0x5d0334)=>{_0x5d0334['directChange']&&'chat'===_0x1ffcf2['plugins']['get']('AITabs')['view']['activeTab']&&(_0x1ffcf2['model']['hasContent'](_0x1ffcf2['model']['document']['selection'])?this['addSelectionToChatContext'](_0x1ffcf2):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x1d097e=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0xb94c25=await _0x1d097e['getConversations']();return _0xb94c25['length']?_0xb94c25[0x0]['id']:'new';}catch(_0x12264b){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':_0x12264b})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x3aca4c={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x3aca4c);}catch(_0x32406b){this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3aca4c['id']||Ot()}),this['_reporter']['logError'](_0x32406b),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x2f258a,modelId:_0x5c000b}={}){this['_closeActiveBalloon']();let _0x4a2199=_0x5c000b;_0x4a2199||(_0x2f258a||!this['activeConversation']?_0x4a2199=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x4a2199=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x3e9e24=this['getGroupId'](),_0x4b7975=_0x2f258a||Ot();let _0xabf5f8;this['activeConversation']=new Rn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x4a2199,'conversationId':_0x4b7975,'group':_0x3e9e24,'locale':this['context']['locale'],'isFromHistory':!!_0x2f258a,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x24bb35=>this['_aiEditing']['getSessionId'](_0x24bb35)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x5a38f2,_0x875c72)=>{this['_aiChatUi']['createConversation'](_0x875c72),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x2f258a||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0xb81d81,_0x28e225)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x28e225['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x1d0e17=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x1d0e17);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x1bd682=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x1bd682);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x4a232e,_0x5184b2)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x5184b2,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x1a8231,_0x3d9e8b)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3d9e8b,{'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',(_0x5ee313,_0x4048be)=>{this['_aiChatUi']['removeFeedInteraction'](_0x4048be['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x674051,_0x30eacb,_0x57cca3)=>{this['_updateConversationTitle'](_0x30eacb,_0x57cca3);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x4ff8f0,_0x33d47d)=>{void 0x0!==_0xabf5f8&&_0xabf5f8!==_0x33d47d['id']&&this['_updateReplyContentThrottled']['flush'](),_0xabf5f8=_0x33d47d['id'],_0x33d47d['isFromHistory']?await this['_updateReplyContent']({'reply':_0x33d47d}):await this['_updateReplyContentThrottled']({'reply':_0x33d47d});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x162d0f,{reply:_0x197e45,index:_0x16406b,state:_0x3b6133})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x197e45['id'],'index':_0x16406b,'state':_0x3b6133}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x197e45['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x16406b&&this['_activeBalloon']?.['setState'](_0x3b6133);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x424a6c,_0x22db51)=>{if(this['_aiChatUi']['addContextItem'](_0x22db51['contextItem'],_0x22db51['isLoading']),'selection'===_0x22db51['contextItem']['type']){const _0x252ec1=ds(this['context']),_0x535cb1=[..._0x252ec1['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x252ec1,'ranges':_0x535cb1,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x5113e0,_0x32ca1b)=>{this['_aiChatUi']['removeContextItem'](_0x32ca1b['uiId']),'current-document'==_0x32ca1b['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x32ca1b['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x498943,_0x1bba58)=>{this['_aiChatUi']['setContextItemLoading'](_0x1bba58['contextItem']['uiId'],_0x1bba58['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x5ebc21,_0x3a86fe)=>{this['_aiChatUi']['setConversationContext'](_0x3a86fe['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x30fb1f,_0x306f91)=>{this['_aiChatUi']['setAddContextOptions'](_0x306f91['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x2452d7,_0x1db0a4)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x1db0a4['sourceId'],_0x1db0a4['source'],_0x1db0a4['resources'],_0x1db0a4['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x59c9d8,_0x65d5f4)=>{this['_aiChatUi']['updateResourceState'](_0x65d5f4['sourceId'],_0x65d5f4['resourceId'],_0x65d5f4['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x29d7ec,_0x199ac5)=>{this['_aiChatUi']['updateCapabilities'](_0x199ac5);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x1349ad,_0x2932cf)=>{try{const _0x448144=(await this['_aiChatModels']['getAll']())['find'](_0x3a1967=>_0x3a1967['id']===_0x2932cf['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x448144,_0x2932cf['isDisabled']);}catch(_0x3db6b3){this['_reporter']['logError'](new nn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x3db6b3}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x2e65b8,{error:_0x540eeb,interactionId:_0x36973b,fileName:_0x3614a9,url:_0x47a491,sourceId:_0x5cf880,sourceLabel:_0x282a9a})=>{const _0x2a39cb=_0x36973b?_0x36973b+':'+Ot():Ot();this['_reporter']['reportError'](_0x540eeb),_0x540eeb['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':ls(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-conversation-init-failed')||_0x540eeb['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x3614a9),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x47a491),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x5cf880&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x5cf880),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x282a9a||'source'),'id':_0x2a39cb})):_0x540eeb['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x2a39cb}):_0x540eeb['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x2a39cb}):_0x540eeb['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':_0x2a39cb}):_0x540eeb['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':_0x2a39cb}):this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x2a39cb});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x2f258a||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x2acd1e,attributes:_0x263b36}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x1eff3a=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x1eff3a);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x2acd1e,'attributes':_0x263b36});}['_removeFromContext'](_0x1e49b9){this['activeConversation']?.['removeFromContext'](_0x1e49b9);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x47877d){const [_0x30e0f1,_0x229520]=_0x47877d['split'](':'),_0x28f15f=this['activeConversation']['getInteraction'](_0x30e0f1);return{'interaction':_0x28f15f,'reply':_0x28f15f['getReply'](_0x229520)};}['_scrollToSuggestionRange'](_0x5f3b1e,_0x256ed7=!0x1,_0x1c6b83){const _0x32eb58={'target':_0x1c6b83['editing']['view']['domConverter']['viewRangeToDom'](_0x1c6b83['editing']['mapper']['toViewRange'](_0x5f3b1e)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x256ed7};_0x256ed7&&(_0x32eb58['alignToTop']=!0x0),St(_0x32eb58);}['_updateConversationTitle'](_0x2fafbc,_0x115391=!0x1){this['_aiChatUi']['setConversationTitle'](_0x2fafbc||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x115391);}['_addFeedItemReply'](_0x43c2b7){'text'===_0x43c2b7['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x43c2b7):this['_aiChatUi']['addFeedItemAISuggestion'](_0x43c2b7);}async['_updateReplyContent']({reply:_0x16d94a,renderingStrategy:_0x577e98}){const {id:_0x5e1f6b,interactionId:_0x479357,isDone:_0x159237,type:_0x438f50,parsedContent:_0xf9d438}=_0x16d94a,_0x4b6b01=_0x479357+':'+_0x5e1f6b;if('modification'===_0x438f50){const _0x3c513d=_0x16d94a['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4b6b01,'parts':_0x3c513d,'isDone':_0x159237,'skipLoadingEffects':_0x16d94a['isFromHistory']});}else'text'===_0x438f50&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x4b6b01,'parsedContent':_0xf9d438['get']('text'),'renderingStrategy':_0x577e98,'isDone':_0x159237});_0x159237&&_0x16d94a['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x4b6b01,_0x16d94a['sources']);}['_updateReplyContentThrottled']=_0x398efb(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x30ba42=this['activeConversation']?.['lastInteraction'];_0x30ba42&&(_0x30ba42['stop'](),this['_aiChatUi']['stopInteraction'](_0x30ba42)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x12a5c2=this['activeConversation']?.['lastInteraction'];if(_0x12a5c2){for await(const _0x67f270 of _0x12a5c2['replies'])this['_aiChatUi']['hasFeedItem'](_0x67f270['id'])||this['_addFeedItemReply'](_0x67f270),await this['_updateReplyContent']({'reply':_0x67f270,'renderingStrategy':'static'});}}['_updateRatings'](_0x2c1c2c){const _0x25acd8={'positiveCount':_0x2c1c2c['changeGroups']['filter'](_0x21fc6c=>'accepted'===_0x21fc6c['state'])['length'],'totalCount':_0x2c1c2c['changeGroups']['length'],'modificationId':_0x2c1c2c['id']},_0x56a78a=this['activeConversation']['getInteraction'](_0x2c1c2c['interactionId'])['messageId'];_0x56a78a&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x56a78a,_0x25acd8);}['_getAIChatFeedAPI'](_0x1fa1a0){const _0x447ad6=this['_aiChatUi'],_0x35ac22=()=>{_0x1fa1a0['resetWebSearchState'](),_0x1fa1a0['resetReasoningState'](),_0x447ad6['clearLoadingMessage']();},_0x1ef17d=()=>{_0x1fa1a0['currentReply']&&(_0x1fa1a0['currentReply']['done'](),_0x1fa1a0['currentReply']=void 0x0);};return{'insertTextReply':(_0x47121f,_0x240d0c)=>{_0x1ef17d(),_0x35ac22();const _0x5e916c=_0x1fa1a0['currentReply']=_0x1fa1a0['createReply']({'type':'text','interactionId':_0x1fa1a0['id'],'id':_0x240d0c||Ot(),'channelsToEditors':this['_channelsToEditors']});return _0x5e916c['appendContent'](_0x47121f),_0x1ef17d(),_0x5e916c;},'insertCustomElement':async(_0x5dd93b,_0xfa0944)=>(_0x1ef17d(),_0x35ac22(),_0x447ad6['addFeedItemCustomElement'](_0x5dd93b,_0xfa0944||Ot())),'setLoadingMessage':_0x5eb95d=>{_0x447ad6['setLoadingMessage'](_0x5eb95d);},'clearLoadingMessage':()=>{_0x447ad6['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){us(this['context'])['find'](_0x321fec=>'destroyed'!==_0x321fec['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(_0x80db8a){const _0x4368fc=new AbortController();return{'promise':new Promise((_0x37aa68,_0x4da85d)=>{const _0x3ed30d=setTimeout(_0x37aa68,_0x80db8a);_0x4368fc['signal']['addEventListener']('abort',()=>{clearTimeout(_0x3ed30d),_0x4da85d();});}),'abortController':_0x4368fc};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x31fdf8){this['options']={'delay':_0x31fdf8?.['delay']??0xa,'textNodeStyle':_0x31fdf8?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x5bd512,targetElement:_0x1fed2d,abortSignal:_0x1f798b}){this['isStreaming']&&this['stop'](),_0x1f798b?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x1163ea(_0x5bd512,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0xb484c8=0x0;_0xb484c8<this['currentIndex'];_0xb484c8++)this['nodesList'][_0xb484c8]['shouldBeStreamed']=!0x0;do{const _0x2f2abb=Date['now'](),_0x3a2ad7=this['nodesList'][this['currentIndex']],_0x3e6c71=_0x2f2abb-this['lastUpdateTime'];if(_0x3a2ad7){_0x3a2ad7['shouldBeStreamed']=!0x0;let _0x32f52d=_0x3a2ad7['parent'];for(;_0x32f52d;)_0x32f52d['shouldBeStreamed']=!0x0,_0x32f52d=_0x32f52d['parent'];}if(_0x3e6c71<this['options']['delay'])try{const {promise:_0x48772e,abortController:_0x5402ef}=xn(this['options']['delay']-_0x3e6c71);this['timeoutAbortController']=_0x5402ef,await _0x48772e;}catch(_0xf3e0f9){return;}_0x3bda12(_0x1fed2d,'<'+_0x1fed2d['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x1fed2d['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:_0x3e8a58}){Array['from'](_0x3e8a58['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x62d0da=>{_0x62d0da['replaceWith'](_0x62d0da['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x1fe851){let _0x1e62ab='';if(function(_0x3d6314){return _0x186b6f(_0x3d6314);}(_0x1fe851)){for(const _0x27549b of _0x1fe851['children'])_0x1e62ab+=this['renderNode'](_0x27549b);}else{if(Hn(_0x1fe851)){if(!_0x1fe851['shouldBeStreamed'])return'';const _0x5ab974=_0x1fe851,_0x3ebdf4=Object['entries'](_0x5ab974['attribs'])['map'](([_0x1b03f3,_0x38229f])=>_0x1b03f3+'=\x22'+_0x38229f+'\x22')['join']('\x20');_0x1e62ab+='<'+_0x5ab974['tagName']+(_0x3ebdf4?'\x20'+_0x3ebdf4:'')+'>';for(const _0x24accc of ti(_0x5ab974))_0x1e62ab+=this['renderNode'](_0x24accc);_0x1e62ab+='</'+_0x5ab974['tagName']+'>';}else{if(!Pn(_0x1fe851))return'';if(!_0x1fe851['shouldBeStreamed'])return'';!function(_0x4d2adc){return!(!_0x4d2adc['parent']||!Hn(_0x4d2adc['parent']))&&(!!Dn['includes'](_0x4d2adc['parent']['tagName'])&&!_0x2b24b5(_0x4d2adc)['match'](/^\s*[<>]\s*$/));}(_0x1fe851)?_0x1e62ab+=_0x28efca(_0x1fe851):_0x1e62ab+=_0x28efca(new _0x9fc879('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x1fe851]));}}return _0x1e62ab;}['getParsedDocumentNodeList'](){const _0x4b10c4=[];return function(_0x4e3009,_0x91208c){const _0x245dfa=_0x3aa641=>{if(_0x91208c(_0x3aa641),_0x3aa641 instanceof _0x3961e2)for(let _0x41a9b8=0x0;_0x41a9b8<_0x3aa641['children']['length'];_0x41a9b8++){const _0x149d22=_0x3aa641['children'][_0x41a9b8];_0x245dfa(_0x149d22);}};for(let _0x55c726=0x0;_0x55c726<_0x4e3009['children']['length'];_0x55c726++)_0x245dfa(_0x4e3009['children'][_0x55c726]);}(this['document'],_0x125199=>{if(Pn(_0x125199)){const _0x17fac7=this['splitTextNodeIntoWordNodes'](_0x125199);_0x17fac7['length']&&_0x4b10c4['push'](..._0x17fac7);}_0x125199['isWordSplitSource']||_0x125199['isWordSplitResult']||_0x4b10c4['push'](_0x125199);}),_0x4b10c4;}['splitTextNodeIntoWordNodes'](_0x390c7a){if(_0x390c7a['isWordSplitSource']||_0x390c7a['isWordSplitResult'])return[];const _0x49d895=_0x2b24b5(_0x390c7a)['match'](/(?:\s*\S+\s*)/g),_0x23892e=[];if(_0x49d895&&_0x49d895['length']>0x1){for(const _0x5cc3dd of _0x49d895){const _0x678dcb=new _0x2c2a3b(_0x5cc3dd);_0x678dcb['isWordSplitResult']=!0x0,_0x1929bb(_0x390c7a,_0x678dcb),_0x23892e['push'](_0x678dcb);}_0x390c7a['isWordSplitSource']=!0x0,_0x3d0f4e(_0x390c7a);}return _0x23892e;}};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(_0x4832f3){return _0x5e3325(_0x4832f3);}function Hn(_0x33dcbd){return _0x3e1b97(_0x33dcbd);}function Mn(_0x1a6625,_0x57a22d){_0x1a6625['cleanUpAnimations']({'targetElement':_0x57a22d}),_0x57a22d['querySelectorAll']('[data-id]')['forEach'](_0x384bff=>{_0x384bff['removeAttribute']('data-id');});}var Vn=class extends _0x223663{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x178ac5){super();const _0x2e3126=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x178ac5,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x2e3126['if']('isDone','ck-ai-chat__feed__item_done'),_0x2e3126['if']('isVisible','ck-hidden',_0x185a58=>!_0x185a58),'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'](_0xc7d13e,_0x31dfaf,_0x3f2db7){await this['htmlStreamer']['stream']({'document':_0xc7d13e,'targetElement':_0x31dfaf,'abortSignal':_0x3f2db7});}},Un=class extends _0x223663{['showChangesToggleView'];constructor(_0xdc23e7,_0x4dd5ce){super(_0xdc23e7),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0xdc23e7),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+cn,'label':ls(_0xdc23e7,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x4dd5ce['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x2b940e=>_0x2b940e?tt:_0x3bb8cb),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x4b37ac=new Wt();_0x4b37ac['content']=_0x2cb12d,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x4dd5ce['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x4b37ac,{'tag':'span','children':[ls(_0xdc23e7,'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':_0x58ccb3,'rejected':_0x2fdd39,'outdated':_0x2fdd39};var Fn=class extends _0x223663{['stateIconView'];constructor(_0x36877c){super(_0x36877c);const _0x481a00=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',_0x481a00['to']('state',_0x3b5d2b=>'ck-ai-suggestion__content-part-state_'+_0x3b5d2b),_0x481a00['if']('isVisible','ck-hidden',_0x39f83f=>!_0x39f83f)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x481a00['to']('state',_0x931abc=>{switch(_0x931abc){case'accepted':return ls(_0x36877c,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return ls(_0x36877c,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return ls(_0x36877c,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0xf7e61b){this['state']=_0xf7e61b;}},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 _0x226ece{['_applyButton'];['_suggestButton'];constructor(_0x2e98c6,_0x36966b,_0x44da64){super(_0x2e98c6);const _0x105b17=Boolean(_0x44da64);this['set']('isEnabled',!_0x105b17),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x44ecb3=[];if(_0x105b17){const _0xd8376c=new Pt(_0x2e98c6);_0xd8376c['set']({'label':ls(_0x2e98c6,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x32b703}),_0xd8376c['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x44ecb3['push'](_0xd8376c);}else{_0x36966b['includes']('applySuggestion')&&(this['_applyButton']=new Pt(_0x2e98c6),this['_applyButton']['set']({'label':ls(_0x2e98c6,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x58ccb3}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x5b6420=>!_0x5b6420),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x44ecb3['push'](this['_applyButton'])),_0x36966b['includes']('insertSuggestion')&&(this['_suggestButton']=new Pt(_0x2e98c6),this['_suggestButton']['set']({'label':ls(_0x2e98c6,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x39d162}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x44ecb3['push'](this['_suggestButton']));const _0xef40db=new Pt(_0x2e98c6);_0xef40db['set']({'label':ls(_0x2e98c6,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2fdd39}),_0xef40db['bind']('isEnabled')['to'](this),_0xef40db['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x44ecb3['push'](_0xef40db);}this['items']['addMany'](_0x44ecb3);const _0x46a7fa=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x46a7fa['if']('isVisible','ck-hidden',_0x5d3ebb=>!_0x5d3ebb)]}});}['setButtonsVisibility']({showApplyButton:_0x3fdc03,showSuggestButton:_0x5a8d18}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x3fdc03),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x5a8d18);}},Yn=class extends _0x223663{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x119ed4,{part:_0x4f30b9,uiIndex:_0x4af2c9,availableActions:_0x410a05,areActionsDisabled:_0x2f2c66}){super(_0x119ed4),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x119ed4,_0x410a05,_0x2f2c66),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x4f30b9['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x4f30b9['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x4f30b9['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x119ed4),this['titleLabelView']=new $n(_0x119ed4,_0x4af2c9),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',(_0x42f576,_0x493eb7,_0x5459c6,_0x53d465)=>{'pending'===_0x53d465?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x5459c6?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x5459c6),this['children']['add'](this['stateView']));});}},$n=class extends _0x223663{constructor(_0x170fa5,_0x305730){super(_0x170fa5),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[ls(_0x170fa5,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x305730['toString']())]});}},qn=class extends _0x223663{['htmlStreamer'];constructor(_0x59c5d7){super(_0x59c5d7),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:_0x268458,renderingStrategy:_0x2f22f9,abortSignal:_0x703238}){const _0x4627e9=_0x1163ea(_0x268458['content'],!0x0);for(const _0x7767f1 of Ts(_0x4627e9))_0x3d0f4e(_0x7767f1);'streaming'===_0x2f22f9?await this['htmlStreamer']['stream']({'document':_0x4627e9,'targetElement':this['element'],'abortSignal':_0x703238}):_0x3bda12(this['element'],'<'+this['element']['tagName']+'>'+ps(_0x4627e9)+'</'+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 _0x223663{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x5c12f9,{part:_0x545ba3,uiIndex:_0x51851c,areActionsDisabled:_0x87c397,availableActions:_0x41a2cb}){super(_0x5c12f9);const _0x557d63=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 _0x26e5b6=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x87c397;};this['on']('change:state',_0x26e5b6),this['on']('change:isDone',_0x26e5b6),_0x26e5b6(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x5c12f9,{'part':_0x545ba3,'uiIndex':_0x51851c,'availableActions':_0x41a2cb,'areActionsDisabled':_0x87c397}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x5c12f9),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x557d63['to']('state',_0x12e90c=>'ck-ai-suggestion__body__content-part_'+_0x12e90c),_0x557d63['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x557d63['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x557d63['if']('isVisible','ck-hidden',_0x2dbe48=>!_0x2dbe48)]},'children':this['_children'],'on':{'mouseenter':_0x557d63['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x545ba3['index']});}),'mouseleave':_0x557d63['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x545ba3['index']});}),'click':_0x557d63['to'](_0x398af8=>{const _0x39c6f2=_0x398af8['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x39c6f2)&&this['fire']('showChangeInText',{'index':_0x545ba3['index']});})}});}async['updateContent']({part:_0x3475b5,showUnchangedParts:_0x45d1d4=!0x1,abortSignal:_0x582eb9}){this['partDefinition']=_0x3475b5,this['isVisible']=this['partDefinition']['hasChanges']||_0x45d1d4,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x3475b5,'renderingStrategy':'static','abortSignal':_0x582eb9});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x223663{constructor(_0x356df1,_0x5669ec){super(_0x356df1),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x1cb32c=>!_0x1cb32c)]},'children':this['_createSkeletonItems'](_0x5669ec)});}['_createSkeletonItems'](_0x4f7888){const _0x16c191=['ck','ck-ai-skeleton__item'];return _0x4f7888['map'](_0x5949e0=>{let _0x4e5800='';switch(_0x5949e0['attributes']['align']){case'right':_0x4e5800='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x4e5800='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x4e5800='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x5949e0['tag'],'attributes':{'class':[..._0x16c191,_0x5949e0['attributes']['class']?_0x5949e0['attributes']['class']:''],'style':'width:\x20'+_0x5949e0['attributes']['width']+';\x20height:\x20'+_0x5949e0['attributes']['height']+';'+_0x4e5800}};});}};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(_0x4084c7,_0x22eb0c,_0x1dfe65,_0x2bc7c8){return new Array(_0x4084c7)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x22eb0c,'height':_0x1dfe65,'align':_0x2bc7c8}}));}const Jn=/* #__PURE__ -- @preserve */
33
- lt();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x596171){const _0xea581e=this['createTask'](_0x596171);return this['queue']['push'](_0xea581e),this['_processQueue'](),_0xea581e['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(_0x498edc=>{this['once']('_queueEmpty',()=>{_0x498edc();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x2b989f=this['queue']['shift']();try{await _0x2b989f['callback'](this['_abortController']['signal']),_0x2b989f['resolve']();}catch(_0x28190d){_0x2b989f['reject'](_0x28190d);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x20c77e){let _0x66b90f,_0xcc5bfa;const _0x7cb821=new Promise((_0xf6d35d,_0x49efea)=>{_0x66b90f=_0xf6d35d,_0xcc5bfa=_0x49efea;});return{'callback':_0x20c77e,'resolve':_0x66b90f,'reject':_0xcc5bfa,'completePromise':_0x7cb821};}},tr=class extends Vn{constructor(_0x37ea42){super(_0x37ea42),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x37ea42['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x31f390){this['element']['innerHTML']=_0x31f390;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x223663{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x335ba7,_0x48573a=[...er],_0x207d94){super(_0x335ba7);const _0x45d3e1=this['bindTemplate'],_0xe99d52=Boolean(_0x207d94);if(this['set']('isEnabled',!_0xe99d52),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0xe99d52){const _0x3813ff=new Pt(_0x335ba7);_0x3813ff['set']({'label':ls(_0x335ba7,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x32b703}),_0x3813ff['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x5ac57d=new _0x223663(_0x335ba7);_0x5ac57d['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[ls(_0x335ba7,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x3813ff]}]}),this['children']['add'](_0x5ac57d);}else this['_applyChangesButton']=new Pt(_0x335ba7),this['_applyChangesButton']['set']({'label':ls(_0x335ba7,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x48573a['includes']('applySuggestion'),'class':an}),this['_insertSuggestionsButton']=new Pt(_0x335ba7),this['_insertSuggestionsButton']['set']({'label':ls(_0x335ba7,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x48573a['includes']('insertSuggestion'),'class':hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x5e020d=>{_0x5e020d['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',_0x45d3e1['if']('isVisible','ck-hidden',_0x40c4fc=>!_0x40c4fc)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x200722){this['isVisible']=_0x200722;}['_switchButtonLabelsPlurality'](_0x41ae8f){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x41ae8f?(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 _0x223663{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x50e26a,_0x5e42d7){super(_0x50e26a),this['bodyCollection']=_0x5e42d7,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',_0x4c6769=>!_0x4c6769)]},'children':this['children']});const _0x233fe5=new _0x223663(this['locale']),_0x58c912=new Wt();_0x58c912['content']=ot,_0x233fe5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x58c912,{'tag':'span','children':[{'text':ls(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x233fe5),this['_setupBalloonPanel'](_0x50e26a);}['addSource'](_0x28c71c){this['children']['add'](new nr(this['locale'],_0x28c71c,this['balloonPanelView']));}['_setupBalloonPanel'](_0x4bf9f8){this['balloonPanelView']=new Nt(_0x4bf9f8),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Pt{['balloonPanelView'];['source'];constructor(_0x27e585,_0x2faa43,_0x3156eb){super(_0x27e585),this['source']=_0x2faa43,this['balloonPanelView']=_0x3156eb,this['set']({'label':_0x2faa43['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x487cb6=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x487cb6['to'](()=>{window['open'](_0x2faa43['url'],'_blank');}),'mouseenter':_0x487cb6['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x487cb6['to'](()=>{this['_hideTooltip']();})}}),_0x2faa43['favicon']){const _0x251c9e=new _0x223663(_0x27e585);_0x251c9e['setTemplate']({'tag':'img','attributes':{'src':_0x2faa43['favicon']||ot,'alt':_0x2faa43['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x251c9e);}else this['set']('icon',ot);}['_createTooltipContentView'](_0x3116ff,_0x21c7b4){const _0x26e85f=new _0x223663(_0x3116ff),_0x2b4468=[];let _0x339d95;_0x21c7b4?.['favicon']?(_0x339d95=new _0x223663(_0x3116ff),_0x339d95['setTemplate']({'tag':'img','attributes':{'src':_0x21c7b4['favicon'],'alt':_0x21c7b4['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x339d95=new Wt(),_0x339d95['content']=ot,_0x339d95['extendTemplate']({'attributes':{'alt':_0x21c7b4['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x2b4468['push'](_0x339d95);const _0xcd16cd=new _0x223663(_0x3116ff);_0xcd16cd['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x21c7b4['url']},'children':[{'text':new URL(_0x21c7b4['url'])?.['hostname']}]}),_0x2b4468['push'](_0xcd16cd);const _0x3e6f9e=new _0x223663(_0x3116ff);_0x3e6f9e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x2b4468});const _0x3e18eb=new _0x223663(_0x3116ff);return _0x3e18eb['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x21c7b4['title']['length']>0x190?_0x21c7b4['title']['substring'](0x0,0x190)+'...':_0x21c7b4['title']}]}),_0x26e85f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x3e6f9e,_0x3e18eb]}),_0x26e85f;}['_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 _0x5e8f2e=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x5e8f2e);}},rr=class extends _0x223663{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x2988fe(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x102472,_0x4a7b21){super(_0x102472);const {areActionsDisabled:_0x1243f6,showUnchangedParts:_0x2db75b,availableActions:_0x4489d4}=_0x4a7b21;this['_areActionsDisabled']=_0x1243f6,this['_showUnchangedParts']=_0x2db75b,this['_availableActions']=_0x4489d4,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x102472,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(_0x102472,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x102472,_0x4a7b21['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x4a7b21['bodyCollection']),_0x4a7b21['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'](_0x551a60=>_0x551a60 instanceof Qn);}async['updateContentParts']({parts:_0x4af023,abortSignal:_0x5418d3,skipLoadingEffects:_0x171fcb}){this['_cachedContentParts']['length']?_0x4af023['forEach'](_0x546774=>{const _0x2a6607=this['_cachedContentParts']['findIndex'](_0x265948=>_0x265948['index']==_0x546774['index']);-0x1===_0x2a6607?this['_cachedContentParts']['push'](_0x546774):this['_cachedContentParts'][_0x2a6607]=_0x546774;}):this['_cachedContentParts']=_0x4af023;const _0x5f296c=this['_showUnchangedParts']?_0x4af023:_0x4af023['filter'](_0x4ef17b=>_0x4ef17b['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x5f296c['length']>0x1),_0x171fcb&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x298c8e of _0x5f296c)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x24a428=>{let _0x3d0d26=this['getPartView'](_0x298c8e['index']);if(!_0x3d0d26){if(_0x3d0d26=new Qn(this['locale'],{'part':_0x298c8e,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3d0d26['delegate'](...Nn)['to'](this),_0x3d0d26['bind']('isTrackChangesOn')['to'](this),!_0x171fcb&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x24a428),_0x24a428['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3d0d26,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x171fcb||this['_showSkeletonDebounced']();}await _0x3d0d26['updateContent']({'part':_0x298c8e,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x24a428}),_0x3d0d26['markAsDone']();});return _0x5418d3?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x5a4f2b,_0x1f0b53){const _0xb328c2=this['getPartView'](_0x5a4f2b);_0xb328c2&&(_0xb328c2['state']=_0x1f0b53),this['hasPendingParts']='pending'==_0x1f0b53||this['_contentPartViews']['some'](_0x218902=>'pending'==_0x218902['state']);}['setPartActive'](_0x2c7664,_0xcddfbf){if(!0x1===_0x2c7664){for(const _0x260866 of this['_contentPartViews'])_0x260866['isActive']=!0x1;}else{const _0x14ec16=this['getPartView'](_0x2c7664);_0x14ec16&&(_0x14ec16['isActive']=_0xcddfbf);}}['updateSources'](_0x372553){_0x372553['forEach'](_0x49fde4=>this['_sourcesView']['addSource'](_0x49fde4)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x1d37f5){return this['_contentPartViews']['find'](_0x17042b=>_0x17042b['partDefinition']['index']==_0x1d37f5)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x45ce1b=!this['_cachedContentParts']['find'](({hasChanges:_0xb9c138})=>_0xb9c138),_0x5b4004=!!this['_cachedContentParts']['find'](({hasChanges:_0x3c3ca3})=>!_0x3c3ca3);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x5b4004,_0x45ce1b?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'](_0x226f5=>_0x226f5['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x2241c0){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x5876de=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x5876de>0x0){const {promise:_0x50aa74,abortController:_0x429e38}=xn(_0x5876de);_0x2241c0?.['addEventListener']('abort',()=>_0x429e38['abort']()),await _0x50aa74['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x3ef2fa=>_0x3ef2fa['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x223663{['bodyView'];['children'];['headerView'];constructor(_0x105311,_0x190d69,_0x52b375){super(_0x105311);const {showDiff:_0x274936,areActionsDisabled:_0x5a822b,showUnchangedParts:_0x497802,availableActions:_0x417018}=_0x190d69;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x105311,{'showDiff':_0x274936}),this['headerView']['on']('toggleShowChanges',(_0x2fb176,_0x1ed212)=>{this['areChangesVisible']=_0x1ed212['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x1ed212['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x105311,{'areActionsDisabled':_0x5a822b,'showUnchangedParts':!!_0x497802,'availableActions':_0x417018,'bodyCollection':_0x52b375}),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'](_0x23fdaa){await this['bodyView']['updateContentParts'](_0x23fdaa);}['updateSources'](_0x3f8f23){this['bodyView']['updateSources'](_0x3f8f23);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x2370a0,_0x4cdc54,_0x5cfb11){super(_0x4cdc54),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x2370a0,{'showDiff':_0x4cdc54['showDiff'],'areActionsDisabled':_0x4cdc54['areActionsDisabled'],'availableActions':_0x4cdc54['availableActions']},_0x5cfb11),this['containerView']['on']('toggleSuggestionDisplayMode',(_0xf14cf5,_0x28f564)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x28f564['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',(_0x2e53c8,{index:_0x38d2ed})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x38d2ed});}),this['containerView']['on']('applySuggestion',(_0x3c82fd,{index:_0x488a49}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x488a49});}),this['containerView']['on']('insertSuggestion',(_0x4dd28e,{index:_0x2d4a0f}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2d4a0f});}),this['containerView']['on']('rejectSuggestion',(_0xb1d614,{index:_0x19bf69})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x19bf69});}),this['containerView']['on']('mouseOverSuggestion',(_0x24b219,{index:_0x4c9bb4})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4c9bb4});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x2d6a49,{index:_0x20b102})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x20b102});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x59d78f){await this['containerView']['updateContent'](_0x59d78f);}['updatePartState'](_0x2bdfdb,_0x1c12bd){this['containerView']['bodyView']['updatePartState'](_0x2bdfdb,_0x1c12bd);}['setPartActive'](_0x98bfc5,_0x5cf71e){!0x1===_0x98bfc5?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x98bfc5,_0x5cf71e);}['updateSources'](_0x31b130){this['containerView']['updateSources'](_0x31b130);}['getPartView'](_0x3cee25){return this['containerView']['bodyView']['getPartView'](_0x3cee25);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x4178d9,_0xe769b7,_0x3a78f7){super(_0xe769b7),this['_bodyCollection']=_0x3a78f7,this['locale']=_0x4178d9,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x223663(),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:_0x5c0b2a,renderingStrategy:_0x3acaa2,abortSignal:_0x43f87d}){'streaming'===_0x3acaa2?await this['streamIntoElement'](_0x5c0b2a,this['replyContainer']['element'],_0x43f87d):this['replyContainer']['element']['innerHTML']=_0x28efca(_0x5c0b2a);}['updateSources'](_0x38616c){const _0x375f62=new sr(this['locale'],this['_bodyCollection']);_0x375f62['children']['addMany'](_0x38616c['map'](_0x41c596=>new nr(this['locale'],_0x41c596,_0x375f62['balloonPanelView']))),_0x375f62['isVisible']=!0x0,this['children']['add'](_0x375f62);}},cr=class extends _0x26babf{constructor(_0x50ec35=void 0x0){super();const _0xddf9bb=_0x50ec35?'ck-ai-spinner_'+_0x50ec35:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0xddf9bb]}});}};const lr={'file':_0x366b34,'image':_0xd66e63,'document':_0x2cb12d,'web-resource':_0x1f8952,'text':_0x366b34,'selection':_0x421062,'mcp-tool-context':_0x2cb12d},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(_0x4c2db6,_0x3aa571,_0x2235cc,_0x464e6c,_0x2d557f=!0x1){super(_0x4c2db6),this['_isAnimationOnEnterEnabled']=_0x464e6c,this['_initializeProperties'](_0x3aa571,_0x2235cc,_0x2d557f),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'](_0x38549f,_0x4c458f,_0x35915b){this['set']('label',_0x38549f['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x38549f['type']),this['set']('id',_0x38549f['uiId']),this['set']('readonly',_0x4c458f),this['set']('isLoading',_0x35915b);}['_setupTemplate'](){const _0x4c8dd1=this['_createIconView'](),_0xc1b206=this['_createRemoveButton'](),_0x221ca0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x221ca0),'children':this['_createTemplateChildren'](_0x4c8dd1,_0xc1b206,_0x221ca0)});}['_createTemplateAttributes'](_0x18e6cd){return{'class':[ur,_0x18e6cd['if']('itemType',_r,_0x41817b=>'document'==_0x41817b),_0x18e6cd['if']('itemType',dr,_0x29b2cf=>'selection'==_0x29b2cf)],'data-cke-tooltip-text':_0x18e6cd['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x4dff52,_0x9cabd1,_0x152b2e){const _0x3d1eee=this['_createLabelElement'](_0x152b2e),_0x2e92a9=this['_createLoaderIcon']();return this['readonly']?[_0x4dff52,_0x3d1eee]:[_0x4dff52,_0x2e92a9,_0x3d1eee,_0x9cabd1];}['_createLabelElement'](_0x46bfd9){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x46bfd9['to']('label')}]};}['_createRemoveButton'](){const _0x230c3c=new Pt(this['locale']);return _0x230c3c['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x3ce603}),this['_setupRemoveButtonEvent'](_0x230c3c),_0x230c3c;}['_setupRemoveButtonEvent'](_0x206575){_0x206575['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x3b8c41=this['bindTemplate'],_0x53d1de=new Wt();return _0x53d1de['content']=lr[this['itemType']],_0x53d1de['extendTemplate']({'attributes':{'class':[Ar,_0x3b8c41['if']('isLoading','ck-hidden',_0x444d5e=>_0x444d5e)]}}),_0x53d1de;}['_handleAnimationEndOnce'](_0x3d16d2,_0x2bddc9){if(!_0x3d16d2)return;const _0x2a629f=()=>{_0x2bddc9(),_0x3d16d2['removeEventListener']('animationend',_0x2a629f),_0x3d16d2['removeEventListener']('webkitAnimationEnd',_0x2a629f);};_0x3d16d2['addEventListener']('animationend',_0x2a629f),_0x3d16d2['addEventListener']('webkitAnimationEnd',_0x2a629f);}['_createLoaderIcon'](){const _0x33bcdf=new cr('small');return _0x33bcdf['bind']('isVisible')['to'](this,'isLoading',_0x5dc2f8=>_0x5dc2f8),_0x33bcdf;}};function Er(_0x2347e9){if(!_0x2347e9)return _0x2347e9;if(_0x2347e9['length']<=0x78)return _0x2347e9;const _0x384ad9=_0x2347e9['slice'](0x0,0x78),_0x164d9b=_0x384ad9['lastIndexOf']('\x20');return(_0x164d9b>0x0?_0x384ad9['slice'](0x0,_0x164d9b):_0x384ad9)+'…';}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(_0x4cf19b,_0x981cae,_0x1b17d5,_0x4b3ab7,_0x30bb3d){this['_locale']=_0x4cf19b,this['_visibleChips']=_0x981cae,this['_config']={...Tr,..._0x1b17d5,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1b17d5['cssClasses']}},this['_overflowChips']=new ht(),this['_bodyCollection']=_0x4b3ab7,this['_parentView']=_0x30bb3d||null;}['setContainerElement'](_0x15dfec){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x15dfec,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 _0x4d8da6=[...this['_visibleChips'],...this['_overflowChips']],_0x5d957e=this['_createCalculationContainer'](),_0x18c31d=this['_calculateOverflowInContainer'](_0x5d957e,_0x4d8da6),_0x3dd91e=_0x5d957e['_ancestorsToRestore'];_0x3dd91e&&this['_restoreAncestorVisibility'](_0x3dd91e),_0x5d957e['remove'](),this['_applyOverflowResults'](_0x4d8da6,_0x18c31d);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x36e73c({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x5f3007=new Pt(this['_locale']);_0x5f3007['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0xbaf20=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0xbaf20['push'](this['_config']['cssClasses']['controlsButton']),_0x5f3007['extendTemplate']({'attributes':{'class':_0xbaf20}}),_0x5f3007;}['_createShowMoreBalloonPanelView'](){const _0x26ad64=new Nt(this['_locale']);return _0x26ad64['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x26ad64),_0x26ad64;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2e548a=>{_0x2e548a['disableAnimationOnEnter']();});const _0x3bd4a=new _0x223663(this['_locale']);_0x3bd4a['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x3bd4a);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x5e985a=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x5e985a?'':'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'](_0x477d6e){const _0x4c2ff3=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x55afd8=this['_containerElement']?.['classList'];if(_0x55afd8){const _0x52bb71=_0x55afd8[0x0]||'',_0x3eea26=_0x477d6e['querySelector']('.'+_0x52bb71),_0x61faf7=_0x477d6e['querySelector'](_0x4c2ff3);return _0x3eea26||_0x61faf7||_0x477d6e;}return _0x477d6e['querySelector'](_0x4c2ff3)||_0x477d6e;}['_calculateContainerWidth'](){const _0x510298=this['_parentView']?.['element']||this['_containerElement'];if(!_0x510298)return wr;const _0x6daee6=window['getComputedStyle'](_0x510298)['width'];if('auto'===_0x6daee6||'0px'===_0x6daee6||!_0x6daee6){const _0x19e67b=_0x510298['parentElement'];if(_0x19e67b){const _0x9c7ac8=window['getComputedStyle'](_0x19e67b);return'auto'!==_0x9c7ac8['width']?_0x9c7ac8['width']:wr;}return wr;}return _0x6daee6;}['_applyCalculationStyles'](_0x28d42b,_0x3a6264){this['_config']['cssClasses']['calculationContainer']&&_0x28d42b['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x28d42b['style']['width']=_0x3a6264,_0x28d42b['style']['position']='absolute',_0x28d42b['style']['top']='-9999px',_0x28d42b['style']['left']='-9999px',_0x28d42b['style']['opacity']='0',_0x28d42b['style']['pointerEvents']='none',_0x28d42b['style']['zIndex']='-1',_0x28d42b['style']['visibility']='visible\x20!important',_0x28d42b['style']['display']='block\x20!important',_0x28d42b['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x2c29af){_0x2c29af['forEach'](({element:_0x342043,originalDisplay:_0x1f11ad,originalVisibility:_0x445f11})=>{_0x342043['style']['display']=_0x1f11ad,_0x342043['style']['visibility']=_0x445f11;});}['_makeAncestorsVisible'](_0x2eb57d){const _0x3e9690=[];let _0x5ce041=_0x2eb57d;for(;_0x5ce041&&_0x5ce041!==document['body'];){const _0x4b3222=window['getComputedStyle'](_0x5ce041);'none'!==_0x4b3222['display']&&'hidden'!==_0x4b3222['visibility']||(_0x3e9690['push']({'element':_0x5ce041,'originalDisplay':_0x5ce041['style']['display'],'originalVisibility':_0x5ce041['style']['visibility']}),_0x5ce041['style']['display']='block',_0x5ce041['style']['visibility']='visible'),_0x5ce041=_0x5ce041['parentElement'];}return _0x3e9690;}['_createContainerElements'](){let _0x5ef862,_0x48ce00;return this['_parentView']?.['element']?(_0x5ef862=this['_parentView']['element']['cloneNode'](!0x0),_0x48ce00=this['_findTargetContainer'](_0x5ef862)):(_0x5ef862=document['createElement']('div'),_0x48ce00=_0x5ef862),{'calculationContainer':_0x5ef862,'targetContainer':_0x48ce00};}['_createCalculationContainer'](){const {calculationContainer:_0x37335b,targetContainer:_0x34cb2e}=this['_createContainerElements'](),_0x48e3e0=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x37335b,_0x48e3e0);const _0x592b5e=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x592b5e?_0x592b5e['appendChild'](_0x37335b):document['body']['appendChild'](_0x37335b),_0x37335b['_targetContainer']=_0x34cb2e;const _0x25af2b=this['_makeAncestorsVisible'](_0x592b5e||null);return _0x37335b['offsetWidth'],_0x37335b['_ancestorsToRestore']=_0x25af2b,_0x37335b;}['_calculateOverflowInContainer'](_0x43aba2,_0x345c8c){const _0x311972=_0x43aba2['_targetContainer']||_0x43aba2,_0xc31885=[],{rowCount:_0xec0e37}=this['_renderChipsAndCountRows'](_0x311972,_0x345c8c);if(_0xec0e37<=this['_config']['maxVisibleRows'])return _0xc31885;const _0x187de8=_0x345c8c['slice']();for(;_0x187de8['length']>0x0;){if(this['_testButtonFit'](_0x43aba2,_0x311972,_0x187de8)){const _0x4f8a18=_0x345c8c['filter'](_0x4c2680=>!_0x187de8['includes'](_0x4c2680));_0xc31885['push'](..._0x4f8a18);break;}if(!_0x187de8['pop']())break;}return _0xc31885;}['_renderChipsAndCountRows'](_0x1e1773,_0x600692){_0x1e1773['innerHTML']='',_0x600692['forEach'](_0x19c6dc=>{if(_0x19c6dc['element']){const _0x215df0=_0x19c6dc['element']['cloneNode'](!0x0);_0x1e1773['appendChild'](_0x215df0);}}),_0x1e1773['offsetWidth'];const _0x1371f1=_0x1e1773['children'],_0x390fad=[];return Array['from'](_0x1371f1)['forEach'](_0x33cf1b=>{const _0x35fd12=_0x33cf1b['getBoundingClientRect']()['top'];_0x390fad['some'](_0x4c7396=>Math['abs'](_0x4c7396-_0x35fd12)<this['_config']['rowDetectionTolerance'])||_0x390fad['push'](_0x35fd12);}),{'rowCount':_0x390fad['length']};}['_createMockButton'](){const _0x40fd51=document['createElement']('button');return _0x40fd51['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x40fd51['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x40fd51['textContent']='+\x201',_0x40fd51;}['_testButtonFit'](_0x11bf7d,_0x4cdc65,_0x47e3a0){this['_renderChipsAndCountRows'](_0x4cdc65,_0x47e3a0);const _0x3059d7=this['_createMockButton']();_0x11bf7d['appendChild'](_0x3059d7),_0x11bf7d['offsetWidth'];const _0x2c13c4=[..._0x4cdc65['children'],_0x3059d7],_0x3f7e43=[];_0x2c13c4['forEach'](_0x5427f3=>{const _0x4c149e=_0x5427f3['getBoundingClientRect']()['top'];_0x3f7e43['some'](_0xa1fe4=>Math['abs'](_0xa1fe4-_0x4c149e)<this['_config']['rowDetectionTolerance'])||_0x3f7e43['push'](_0x4c149e);});const _0x54c186=_0x3f7e43['length'];return _0x3059d7['remove'](),_0x54c186<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x11c9d5,_0x10a701){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x11c9d5['forEach'](_0x348eba=>{_0x10a701['includes'](_0x348eba)?this['_overflowChips']['add'](_0x348eba):this['_visibleChips']['add'](_0x348eba);});}['_updateOverflowUI'](_0x1f491b){if(_0x1f491b>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x1f491b>0x0&&this['_showMoreButtonView']){const _0x4c828d=''+this['_config']['showMoreLabelPrefix']+(_0x1f491b<0x63?_0x1f491b:'99');this['_showMoreButtonView']['label']=_0x4c828d;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x245b2b,_0x1a1b0f){this['_distributeChips'](_0x245b2b,_0x1a1b0f),this['_updateOverflowUI'](_0x1a1b0f['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0xa6bd08=>{_0xa6bd08[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 _0x3e963e=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x3e963e['width']||0x0===_0x3e963e['height'])return!0x1;const _0x2d8795=window['innerHeight']||document['documentElement']['clientHeight'],_0x1d709e=window['innerWidth']||document['documentElement']['clientWidth'];return _0x3e963e['bottom']>=-0xc8&&_0x3e963e['top']<=_0x2d8795+0xc8&&_0x3e963e['right']>=-0xc8&&_0x3e963e['left']<=_0x1d709e+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 _0x223663{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x5ca1d6,_0x3c8eb4,_0x1682b6){super(_0x5ca1d6),this['_bodyCollection']=_0x1682b6,this['_createContextChips'](_0x3c8eb4);const _0x2a2acc={'cssClasses':{'showMoreButton':Or+'\x20'+cn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x5ca1d6,this['_contextChips'],_0x2a2acc,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 _0x2fd0d0=this['element']['querySelector']('.'+br);_0x2fd0d0&&(this['_overflowManager']['setContainerElement'](_0x2fd0d0),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0xbbda59){for(const _0xfb312e of _0xbbda59){const _0x25c3dc=new mr(this['locale'],_0xfb312e,!0x0,!0x1);this['_contextChips']['add'](_0x25c3dc);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x2b1551,_0x465fd9,_0x7a7b0a){super(_0x465fd9),this['_locale']=_0x2b1551,this['_bodyCollection']=_0x7a7b0a,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'](_0x5da2f5=>!_0x5da2f5['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x223663(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(_0x5dcea3,_0x2f2e8b){super(_0x2f2e8b);const {isWebSearchEnabled:_0x2576fd,isReasoningEnabled:_0x5eb6bc}=_0x2f2e8b['capabilities'],_0x2e3e3d=[];let _0x37df6c='';_0x2576fd&&_0x5eb6bc?(_0x37df6c=ls(_0x5dcea3,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x2e3e3d['push'](xr(ot)),_0x2e3e3d['push'](xr(_0x518877))):_0x2576fd?(_0x37df6c=ls(_0x5dcea3,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x2e3e3d['push'](xr(ot))):_0x5eb6bc&&(_0x37df6c=ls(_0x5dcea3,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x2e3e3d['push'](xr(_0x518877))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x37df6c?'':'ck-hidden']}});const _0x3914f5=new _0x223663();_0x3914f5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x2e3e3d,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x37df6c]}]}),this['children']['add'](_0x3914f5),this['capabilities']=_0x2f2e8b['capabilities'];}};function xr(_0x4375ff){const _0x17b10f=new Wt();return _0x17b10f['content']=_0x4375ff,_0x17b10f;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x4ed0c3){this['element']=_0x4ed0c3,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x29a533 of Lr){const _0x2052e4='keydown'!==_0x29a533;this['element']['addEventListener'](_0x29a533,this['_onUserEvent']['bind'](this),{'passive':_0x2052e4,'signal':this['abortController']['signal']});}}['start']({smooth:_0xeef52f=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xeef52f?'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'](_0x284518){if(this['isRunning']){if('keydown'===_0x284518['type']){const _0x3e9309=_0x284518['key'];if(!Dr['includes'](_0x3e9309))return;}_0x284518 instanceof WheelEvent?_0x284518['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0xcb69f4,scrollHeight:_0x49eee0,clientHeight:_0x3e57aa}=this['element'];return _0x49eee0-_0xcb69f4-_0x3e57aa<=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(_0x2aa810){super(_0x2aa810),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 _0x223663{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x291142,_0x43e91a){super(_0x291142),this['_bodyCollection']=_0x43e91a,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'](_0x487874,_0x3393e0){let _0x1552d2;return'ai-reply'===_0x487874?_0x1552d2=new hr(this['locale'],_0x3393e0,this['_bodyCollection']):'ai-suggestion-reply'===_0x487874?(_0x1552d2=new ar(this['locale'],_0x3393e0,this['_bodyCollection']),_0x1552d2['bind']('isTrackChangesOn')['to'](this)):_0x1552d2='user-message'===_0x487874?new Nr(this['locale'],_0x3393e0,this['_bodyCollection']):'interaction-header'===_0x487874?new yr(this['locale'],_0x3393e0):'custom-element'===_0x487874?new Hr(_0x3393e0):new tr(_0x3393e0),this['children']['add'](_0x1552d2),_0x1552d2;}async['updateReplyItem']({id:_0x411c12,parsedContent:_0x2ef0ae,renderingStrategy:_0x466d7a,abortSignal:_0x3703a0}){const _0x3e0651=this['getItemById'](_0x411c12);if(!(_0x3e0651 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x3e0651,'id':_0x411c12,'parsedContent':_0x2ef0ae});await _0x3e0651['updateContent']({'parsedContent':_0x2ef0ae,'renderingStrategy':_0x466d7a,'abortSignal':_0x3703a0});}async['updateWebSources'](_0x194a43,_0x1a4bdf){const _0x17d4e0=this['getItemById'](_0x194a43);if(_0x17d4e0 instanceof ar)_0x17d4e0['updateSources'](_0x1a4bdf);else{if(!(_0x17d4e0 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x17d4e0,'id':_0x194a43,'sources':_0x1a4bdf});_0x17d4e0['updateSources'](_0x1a4bdf);}}async['updateSuggestionItem']({id:_0x20bccc,parts:_0x197e3e,abortSignal:_0x1863e5,skipLoadingEffects:_0x47d2b0}){const _0x1af26a=this['getItemById'](_0x20bccc);if(!(_0x1af26a instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x1af26a,'id':_0x20bccc,'parts':_0x197e3e});await _0x1af26a['updateContent']({'parts':_0x197e3e,'abortSignal':_0x1863e5,'skipLoadingEffects':_0x47d2b0});}['updateSuggestionPartState']({id:_0x3247a8,index:_0x15da54,state:_0x521474}){const _0x1f7721=this['getItemById'](_0x3247a8);if(!(_0x1f7721 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3247a8});_0x1f7721['updatePartState'](_0x15da54,_0x521474);}['setSuggestionPartActive']({id:_0x2b4533,index:_0x2c50bb,isActive:_0x5d92e8}){const _0x5c7573=this['getItemById'](_0x2b4533);if(!(_0x5c7573 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x2b4533});this['children']['filter'](_0x21cd2e=>_0x21cd2e instanceof ar)['forEach'](_0x446acc=>{_0x446acc['setPartActive'](!0x1);}),_0x5c7573['setPartActive'](_0x2c50bb,_0x5d92e8);}['markItemAsDone'](_0x59c8ca){this['getItemById'](_0x59c8ca)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x41350d=>_0x41350d['options']['id']);}['removeItem'](_0x1ee4ff){this['children']['remove'](this['getItemById'](_0x1ee4ff));}['hasItem'](_0x4d74be){return!!this['children']['find'](_0x2a8124=>_0x2a8124['options']['id']['includes'](_0x4d74be));}['scrollToSuggestion'](_0x2e09f4,_0x452363){const _0x47d0d5=this['getItemById'](_0x2e09f4);if(!(_0x47d0d5 instanceof ar))return void ft('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x2e09f4,'partIndex':_0x452363});const _0x2654d8=_0x47d0d5['getPartView'](_0x452363);_0x2654d8?bt(_0x2654d8['element'],0x14,this['element']['parentElement'],!0x0,!0x0):ft('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x2e09f4,'partIndex':_0x452363});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x51618c=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x51618c,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x36cb04=new Xn(this['locale'],zn['aiFeed']);return _0x36cb04['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x36cb04;}['_createFeedItems'](){const _0x27c297=new _0x223663(this['locale']);return _0x27c297['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x27c297;}['_createFeedLoader'](){const _0x2021e2=new _0x223663(this['locale']);return _0x2021e2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x43a7b9=>!_0x43a7b9)]},'children':this['_createLoaderChildren']()}),_0x2021e2;}['_createLoaderChildren'](){const _0x257fb5=new cr();return _0x257fb5['isVisible']=!0x0,[_0x257fb5,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x271f35){const _0x2b39f4=this['children']['find'](_0x24f033=>_0x24f033['options']['id']['includes'](_0x271f35));if(!_0x2b39f4)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x271f35});return _0x2b39f4;}['setLoadingMessage'](_0x1c0b83){this['set']('loadingMessage',_0x1c0b83);}['toggleLoadingSkeleton'](_0x110a21){this['set']('isLoadingSkeletonVisible',_0x110a21);}['startAutoScroll'](_0x50333b={}){this['scrollManager']['start'](_0x50333b);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends zt{['filter'](){let _0x1fb333=0x0;for(const _0x4bfe60 of this['items'])_0x1fb333+=_0x4bfe60['items']['length'];return{'resultsCount':_0x1fb333,'totalItemsCount':_0x1fb333};}};function Ur(_0x4f963c){const _0x5cacf3=[];let _0xcdaf12=!0x1;for(const _0x3c9c53 of Array['from'](_0x4f963c['items'])){if('file'!==_0x3c9c53['kind'])continue;if(_0x3c9c53['webkitGetAsEntry']()?.['isDirectory']){_0xcdaf12=!0x0;continue;}const _0x33dee0=_0x3c9c53['getAsFile']();_0x33dee0&&_0x5cacf3['push'](_0x33dee0);}return{'files':_0x5cacf3,'hasDirectory':_0xcdaf12};}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(_0x1ea0a6,_0x58ec1d){super(_0x1ea0a6,{'queryView':{'label':'','creator':_0x15956e,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x1ea0a6),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x58ec1d,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',(_0x17260e,_0x3ece89)=>!_0x17260e&&!_0x3ece89),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x3bdbb6,_0x39da58)=>{this['isUploadInProgress']||this['isEmpty']||_0x3bdbb6['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x39da58());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x20aa23=>this['_handlePaste'](_0x20aa23)),this['element']['addEventListener']('drop',_0x1384a1=>this['_handleDrop'](_0x1384a1));}['_handlePaste'](_0x4e791b){const _0x220bf5=_0x4e791b['clipboardData'];if(!_0x220bf5)return;const {files:_0x55800b,hasDirectory:_0x30320d}=Ur(_0x220bf5),_0x5c660b={'files':_0x55800b,'plainText':_0x220bf5['getData']('text/plain'),'hasDirectory':_0x30320d,'forceTextAttachment':!0x1,'preventDefault':()=>_0x4e791b['preventDefault']()};this['fire']('promptInputPaste',_0x5c660b);}['_handleDrop'](_0x22d390){const _0xed7f52=_0x22d390['dataTransfer'];if(!_0xed7f52)return;const _0x42b94a={'files':[],'plainText':_0xed7f52['getData']('text/uri-list')||_0xed7f52['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x22d390['preventDefault']()};this['fire']('promptInputPaste',_0x42b94a);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x4eb12a=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x4eb12a)return this['queryView']['errorText']=ls(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x16340f=_0x548fe1(_0x4eb12a);this['fire']('sendUserMessage',_0x16340f),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x15fb42){this['queryView']['fieldView']['set']('placeholder',_0x15fb42);}['focus'](_0x522337=!0x1){super['focus'](),_0x522337&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0xd4ca89=new Pt(this['locale']);return _0xd4ca89['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}),_0xd4ca89['on']('execute',()=>{this['submit']();}),_0xd4ca89;}['setIsUploadInProgress'](_0x13baac){this['isUploadInProgress']=_0x13baac;}['_setUpAddContextButtonPositioning'](){const _0x2caaeb=this['locale'],_0x2a8caf=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x220fb3=new gt(this['queryView']['fieldView']['element']),_0xb770e8=new gt(this['_addContextButtonView']['element']),_0x454229=_0x220fb3['width'],_0x128336='rtl'===_0x2caaeb['uiLanguageDirection']?'right':'left';_0x220fb3['excludeScrollbarsAndBorders']();const _0x5bdae2=_0x454229-_0x220fb3['width']+0x1;this['_addContextButtonView']['element']['style'][_0x128336]='calc('+(_0x454229-_0xb770e8['width']-_0x5bdae2)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x2a8caf),this['on']('render',()=>{_0x2a8caf(),this['_queryViewResizeObserver']=new At(this['queryView']['fieldView']['element'],()=>{_0x2a8caf();});});}},Fr=class extends _0x223663{constructor(_0x21cf9e){super(_0x21cf9e);const _0xf53425=new Wt();_0xf53425['content']=_0x366b34,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0xf53425,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':ls(_0x21cf9e,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0xa7a006){let _0x1a8c70=0x0;_0xa7a006['addEventListener']('dragenter',_0x4e1b07=>{_0x4e1b07['dataTransfer']&&(_0x1a8c70++,0x1===_0x1a8c70&&this['fire']('dragEnter'),_0xa7a006['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0xa7a006['addEventListener']('dragover',_0x2d08c2=>{_0x2d08c2['dataTransfer']&&_0x2d08c2['preventDefault']();}),_0xa7a006['addEventListener']('dragleave',()=>{--_0x1a8c70<=0x0&&(_0x1a8c70=0x0,_0xa7a006['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0xa7a006['addEventListener']('drop',_0x1728de=>{_0x1728de['preventDefault'](),_0x1a8c70=0x0,_0xa7a006['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x1728de);});}['_handleDrop'](_0x4690fa){const _0x50fc16=_0x4690fa['dataTransfer'];if(!_0x50fc16)return;const {files:_0x3aa6ea,hasDirectory:_0x8d73f6}=Ur(_0x50fc16),_0x16e333={'files':_0x3aa6ea,'plainText':_0x50fc16['getData']('text/uri-list')||_0x50fc16['getData']('text/plain'),'hasDirectory':_0x8d73f6,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x16e333);}};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 _0x223663{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x9d8c61){super(_0x9d8c61),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',_0x1febee=>'selector'===_0x1febee),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x31833e=>_0x31833e?this['_modelSelectionDropdown']['buttonView']['label']:ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x427c87=>_0x427c87),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x27e01b=>_0x27e01b),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x41fbd5=>ls(this['locale'],_0x41fbd5?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x26bb63=>_0x26bb63),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x4650a2=>ls(this['locale'],_0x4650a2?'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(),_0x2e1c13(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x42c558,_0x4bea89){if(_0x4bea89)this['set']('modelDisplayMode','hidden');else{const _0x39952e=0x1===_0x42c558['length'];this['set']('modelDisplayMode',_0x39952e?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x42c558?.['length'])for(const _0x2a08d0 of _0x42c558){const _0x5eabc8=new _0x56dc21({'label':_0x2a08d0['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2a08d0['id'],'model':_0x2a08d0});_0x5eabc8['bind']('isOn')['to'](this,'activeModelId',_0x4f0943=>_0x4f0943===_0x2a08d0['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x5eabc8,'labelView':new Jr(this['locale'],_0x2a08d0)});}}['setWebSearch'](_0xbec4bb){this['set']('webSearchActive',_0xbec4bb);}['setReasoning'](_0x207beb){this['set']('reasoningActive',_0x207beb);}['setModel'](_0x3aa999){if(!_0x3aa999)return;this['activeModelId']=_0x3aa999['id'],this['activeModelName']=_0x3aa999['name']||_0x3aa999['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x3aa999['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x3aa999['name']);const _0x5e23cf=_0x3aa999['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x5e23cf),this['_webSearchButton']['set']('isVisible',_0x5e23cf);const _0x5909fb=_0x3aa999['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x5909fb),this['_reasoningButton']['set']('isVisible',_0x5909fb);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x2e46a6){this['set']('modelSelectorEnabled',!0x1),_0x2e46a6&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x4b7dcd=new Pt();return _0x4b7dcd['set']({'label':ls(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ot,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x4b7dcd['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x4b7dcd;}['_createReasoningButton'](){const _0x3b898b=new Pt();return _0x3b898b['set']({'label':ls(this['locale'],'AI_CHAT_REASONING'),'icon':_0x518877,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x3b898b['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x3b898b;}['_createCommandsButton'](){const _0x228133=new Pt();return _0x228133['set']({'label':ls(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x5bd0d6,'withText':!0x0,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltip':ls(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x228133['extendTemplate']({'attributes':{'class':[Yr]}}),_0x228133['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x228133;}['_createModelSelectionDropdown'](){const _0x47b50b=_0x1c0a67(this['locale']);return _0x47b50b['set']({'panelPosition':'ne','class':[$r]}),_0x47b50b['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':cn}),this['listenTo'](_0x47b50b,'execute',_0x6ae93d=>{this['fire']('selectModel',_0x6ae93d['source']['model']);}),_0x47b50b;}['_createModelNameView'](){const _0x192577=new Zr(this['locale']);return _0x192577['bind']('text')['to'](this,'activeModelName',_0x44fc3f=>_0x44fc3f??''),_0x192577['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3b2713=>'name'===_0x3b2713),_0x192577;}},Jr=class extends Lt{constructor(_0x501908,_0x2312b6){super();const _0x3b12a7=this['bindTemplate'],_0x497d6f=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3b12a7['to']('style'),'id':_0x3b12a7['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x3b12a7['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x2312b6['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x497d6f}]}),_0x497d6f['addMany'](this['_getCapabilityParts'](_0x501908,ot,'AI_CHAT_SEARCH_WEB',_0x2312b6['capabilities']['webSearch']?.['enabled']??!0x1)),_0x497d6f['addMany'](this['_getCapabilityParts'](_0x501908,_0x518877,'AI_CHAT_REASONING',_0x2312b6['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x1de9e4,_0x1c2708,_0x1436b8,_0x16c6a8){const _0x40a5ac=new Wt();_0x40a5ac['content']=_0x1c2708;const _0x44cf6c=new _0x223663(_0x1de9e4);_0x44cf6c['setTemplate']({'tag':'span','children':[{'text':ls(_0x1de9e4,_0x1436b8)+':\x20'}]});const _0x26b998=new _0x223663(_0x1de9e4);return _0x26b998['setTemplate']({'tag':'span','children':[{'text':ls(_0x1de9e4,_0x16c6a8?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x40a5ac,_0x44cf6c,_0x26b998];}},Zr=class extends _0x223663{constructor(_0x195b44){super(_0x195b44),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x31691c=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x31691c['if']('isVisible','ck-hidden',_0x1f21f3=>!_0x1f21f3)]},'children':[{'text':_0x31691c['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x223663{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x4e2349){super(_0x4e2349),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'](_0x5de3bc=>{this['focusTracker']['add'](_0x5de3bc['element']),this['keystrokes']['listenTo'](_0x5de3bc['element']);}),_0x527a0f({'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'](_0x16d0d0){this['urlInputField']['errorText']=_0x16d0d0,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x1b14a6=new Pt(this['locale']);return _0x1b14a6['set']({'icon':_0x11934f,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x55853e,_0x372edb,_0x24ff17)=>{_0x1b14a6['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x24ff17?'':'\x20ck-hidden')]});}),_0x1b14a6;}['_createUrlInputField'](){const _0x1f65d8=new $t(this['locale'],_0x249f3a);return _0x1f65d8['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x1f65d8['fieldView']['set']({'placeholder':ls(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x1f65d8;}['_createConfirmButton'](){const _0x7c19f6=new Pt(this['locale']);return _0x7c19f6['set']({'icon':_0xd806a0,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x7c19f6;}['_setupTemplate'](){const _0x14a021=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'});_0x14a021['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x14a021,{'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',_0x3472a4=>{_0x3472a4['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x39aa77,_0x542d16)=>{this['clear'](),this['fire']('cancel'),_0x542d16();});}['_handleSubmit'](){const _0x29a3b8=this['getValue']()['trim']();_0x29a3b8?this['_isValidUrl'](_0x29a3b8)?(this['clearError'](),this['fire']('submitUrl',_0x29a3b8)):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x49ebf6=this['getValue']()['trim'](),_0x4a4184=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x49ebf6['length']>0x0&&!_0x4a4184;}['_isValidUrl'](_0x4614bd){try{return!!new URL(_0x4614bd);}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(_0x49bce2,_0x109722){super(_0x49bce2),this['resource']=_0x109722,this['set']('isInContext',!!_0x109722['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x48aaeb){if(_0x48aaeb['isInContext'])return _0xd806a0;switch(_0x48aaeb['type']){case'document':return _0x2cb12d;case'web-resource':return _0x1f8952;case'file':case'text':return _0x366b34;default:return _0x1be752;}}['highlightText'](_0x1b09f9){if(!_0x1b09f9||''===_0x1b09f9['trim']())return void this['_titleView']['highlightText'](null);const _0x4dbb6e=new RegExp(_0x423e56(_0x1b09f9),'gi');this['_titleView']['highlightText'](_0x4dbb6e);}['updateResourceState'](_0x33cdf1){this['resource']['isInContext']=_0x33cdf1,this['isInContext']=_0x33cdf1,this['_updateIcon']();}['_createTitleView'](){const _0x58a122=new Kt();return _0x58a122['text']=this['resource']['label'],_0x58a122['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x58a122;}['_createIconView'](){const _0x45bed2=new Wt();return _0x45bed2['content']=this['getResourceIcon'](this['resource']),_0x45bed2;}['_setupTemplate'](){const _0x4a4075=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x4a4075['if']('isVisible','ck-hidden',_0x2ec811=>!_0x2ec811),_0x4a4075['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x4a4075['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends zt{['_source'];constructor(_0x2d49b4,_0x14bb5f){super(_0x2d49b4),this['_source']=_0x14bb5f,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x110068,_0x38be9f){this['items']['clear']();let _0x70cc14=_0x110068;if(this['_source']['useDefaultFiltering']&&_0x38be9f&&''!==_0x38be9f['trim']()){const _0x382bd5=new RegExp(_0x38be9f['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x70cc14=_0x110068['filter'](_0x2768dd=>_0x382bd5['test'](_0x2768dd['label']));}for(const _0x296a0c of _0x70cc14){const _0x3b9fc1=new ao(this['locale'],_0x296a0c);_0x3b9fc1['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x296a0c);}),this['items']['add'](_0x3b9fc1);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x38be9f);}['highlightText'](_0x13434f){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x8beae6=>{_0x8beae6['highlightText'](_0x13434f);});}['updateResourceState'](_0x218516,_0x5b9ef1){for(const _0x3ebde7 of this['items']){const _0x59b4e7=_0x3ebde7;_0x59b4e7['resource']['id']===_0x218516&&_0x59b4e7['updateResourceState'](_0x5b9ef1);}}['_handleResourceSelection'](_0x51ae80,_0xd7797c){this['fire']('addResourceToContext',{'source':_0x51ae80,'resource':_0xd7797c});}},lo=class extends $t{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0xf7e38){const t=_0xf7e38['t'],_0x574754={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x249f3a,'label':ls(_0xf7e38,'AI_CHAT_SEARCH_RESOURCES')};super(_0xf7e38,_0x574754['creator']),this['label']=_0x574754['label'],this['_viewConfig']=_0x574754,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0xf7e38,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x36bd97){this['fire']('search',_0x36bd97);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Wt(),this['iconView']['content']=_0x4425c5,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x3854d5,t){this['resetButtonView']=new Pt(_0x3854d5),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x3ce603,'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',_0xf42260=>!_0xf42260),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 _0x223663{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x2e9b51,_0x23ade7){super(_0x2e9b51),this['_source']=_0x23ade7['source'],this['_searchInputVisibleFrom']=_0x23ade7['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 _0x218b6e([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 _0x3519ea=new _0x223663(this['locale']);return _0x3519ea['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x33f863,_0x470cf9)=>{this['loadResources'](_0x470cf9),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x470cf9);}),_0x3519ea;}['_createResourcesListView'](){const _0x1bba31=new co(this['locale'],this['_source']);return _0x1bba31['delegate']('addResourceToContext')['to'](this),_0x1bba31['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x1bba31;}['_createSkeletonView'](){const _0x5096cb=new Xn(this['locale'],zn['aiChatResources']);return _0x5096cb['bind']('isVisible')['to'](this,'isLoading'),_0x5096cb;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x7aac6f){const _0x2e6503=Ot();this['_latestLoadResourcesUid']=_0x2e6503,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x7aac6f,'uid':_0x2e6503}),this['isLoading']=!0x0;}['setResources'](_0x5b8d8a,_0x174287){if(_0x174287&&_0x174287!==this['_latestLoadResourcesUid'])return;const _0x556c0b=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5b8d8a,_0x556c0b),_0x5b8d8a['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x26f7da,_0x1590db){this['_resourcesListView']['updateResourceState'](_0x26f7da,_0x1590db);}};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(_0x3e24b4,_0x21aca8,_0x5a9bd5){this['_locale']=_0x3e24b4,this['_bodyCollection']=_0x21aca8,this['_config']=_0x5a9bd5;}['showSourceResourcesBalloon']({source:_0x23d7c4,withBackButton:_0xa25ff7}){let _0x2dedea=this['_sourceResourceBalloons']['get'](_0x23d7c4['id']);_0x2dedea||(_0x2dedea=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x23d7c4['id'],_0x2dedea),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x2dedea)),this['_addSourceResourceContent']({'balloonPanel':_0x2dedea,'source':_0x23d7c4,'withBackButton':_0xa25ff7}),_0x2dedea['show']();const _0xad41f0=this['_config']['getTargetElement']();_0xad41f0&&_0x2dedea['pin']({'target':_0xad41f0,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x3ad898,_0x445a43,_0x5ea400){const _0x2b00b3=this['_sourceResourceBalloons']['get'](_0x3ad898);if(!_0x2b00b3)return;const _0x43a93c=this['_getResourcesViewFromBalloon'](_0x2b00b3);_0x43a93c&&(_0x43a93c['setResources'](_0x445a43,_0x5ea400),_0x43a93c['once']('change:isLoading',()=>{_0x2b00b3['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x4b8865){const _0x29a4f8=this['_sourceResourceBalloons']['get'](_0x4b8865);_0x29a4f8&&requestAnimationFrame(()=>{_0x29a4f8['hide'](),this['_sourceResourceBalloons']['delete'](_0x4b8865),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x358514 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x358514);}['isAnyResourceBalloonVisible'](){for(const _0x4066b4 of this['_sourceResourceBalloons']['values']())if(_0x4066b4['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x4833d3,_0x24e707,_0x4bd00e){const _0x1ce83c=this['_sourceResourceBalloons']['get'](_0x4833d3);if(!_0x1ce83c||!_0x1ce83c['isVisible'])return;const _0x58d02c=this['_config']['getTargetElement']();if(!_0x58d02c)return;_0x1ce83c['pin']({'target':_0x58d02c,'limiter':this['_config']['getLimiterElement']()});const _0x2bdef9=this['_getResourcesViewFromBalloon'](_0x1ce83c);_0x2bdef9&&_0x2bdef9['updateResourceState'](_0x24e707,_0x4bd00e);}['destroy'](){for(const _0x45a3a0 of this['_sourceResourceBalloons']['values']())_0x45a3a0['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x3439cd=new Nt(this['_locale']);return _0x3439cd['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x3439cd),_0x3439cd;}['_addSourceResourceContent']({balloonPanel:_0x343cc4,source:_0x2db2f5,withBackButton:_0x2ad4d6}){_0x343cc4['content']['clear']();const _0x1fbe51=this['_createBalloonHeader']({'balloonPanel':_0x343cc4,'source':_0x2db2f5,'withBackButton':_0x2ad4d6});_0x343cc4['content']['add'](_0x1fbe51);const _0x1b5271=this['_createBalloonResourcesView'](_0x2db2f5);_0x343cc4['content']['add'](_0x1b5271);}['_createBalloonHeader']({balloonPanel:_0x1bb838,source:_0x3ab7c2,withBackButton:_0x584a1c}){const _0x3241fe=new Gt(this['_locale'],{'label':_0x3ab7c2['label'],'class':Ao});return _0x584a1c&&_0x3241fe['children']['add'](this['_createBackButton'](_0x1bb838),0x0),_0x3241fe;}['_createBackButton'](_0x208144){const _0x47f9d4=new Pt(this['_locale']);return _0x47f9d4['set']({'icon':_0x11934f,'tooltip':ls(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x47f9d4['on']('execute',()=>{_0x208144['hide'](),this['_config']['onBackToContext']();}),_0x47f9d4;}['_createBalloonResourcesView'](_0x3c2916){const _0x47bd45=new uo(this['_locale'],{'source':_0x3c2916,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x47bd45['on']('loadSourceResources',(_0x421b79,_0x3a9891)=>{this['_config']['onLoadSourceResources'](_0x3a9891);}),_0x47bd45['on']('addResourceToContext',(_0x41ba2c,_0x3f5603)=>{this['_config']['onResourceSelected'](_0x3f5603['source'],_0x3f5603['resource']),this['closeSourceResourceBalloon'](_0x3c2916['id']);}),_0x47bd45;}['_getResourcesViewFromBalloon'](_0x441916){const _0x383f6d=_0x441916['content']['get'](0x1);return _0x383f6d instanceof uo?_0x383f6d:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0xb112b4){_0x36e73c({'emitter':_0xb112b4,'contextElements':[_0xb112b4['element']],'callback':()=>{_0xb112b4['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0xb112b4['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 _0x223663{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x3c42f2,_0x44624d){super(_0x3c42f2),this['bodyCollection']=_0x44624d['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x3c42f2),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x3c42f2),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x3c42f2),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x3c42f2,_0x44624d);const _0x321d3e={'cssClasses':{'showMoreButton':Oo+'\x20'+cn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x3c42f2,this['_currentContextsChips'],_0x321d3e,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'](_0x4a1774,_0x3a6b66){const _0xf4c9c8=this['_createContextButton'](_0x4a1774,'current',!0x0,_0x3a6b66);this['_addContextToCollection'](_0xf4c9c8,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0xcb636f){this['_removeContextFromCollection'](_0xcb636f,this['_currentContextsChips']),this['_removeContextFromCollection'](_0xcb636f,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x51f771,_0x269635){let _0x454fa6=this['_currentContextsChips']['find'](_0x5ed512=>_0x5ed512['id']===_0x51f771);_0x454fa6||(_0x454fa6=this['_overflowManager']['overflowChips']['find'](_0x1b2733=>_0x1b2733['id']===_0x51f771)),_0x454fa6&&(_0x454fa6['isLoading']=_0x269635);}['setConversationContext'](_0x1af10d){this['_conversationContextsChips']['clear']();for(const _0x358e10 of _0x1af10d){const _0x4ee279=this['_createContextButton'](_0x358e10,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x4ee279,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x520f05,_0x48235a,_0x48d823){this['_resourcesBalloonView']['updateResourceState'](_0x520f05,_0x48235a,_0x48d823);}['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:_0x5452f0,withBackButton:_0x36ba31}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x5452f0,'withBackButton':_0x36ba31}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x4184f4,_0x422a11,_0x28d8ff,_0x370fa3){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x4184f4,_0x28d8ff,_0x370fa3);}['closeSourceResourceBalloon'](_0x145a77){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x145a77),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x915aef){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x915aef),this['_setAddContextButtonEnabled'](_0x915aef);}['_setAddContextButtonEnabled'](_0x3e7bc6){const _0x33add2=!_0x3e7bc6['document']['isHidden']&&_0x3e7bc6['document']['enabled'],_0x5dfb52=_0x3e7bc6['urls']['enabled'],_0x338012=_0x3e7bc6['files']['enabled'],_0x4c3f0d=_0x3e7bc6['sources']['length']>0x0,_0x270032=_0x3e7bc6['customItems']&&_0x3e7bc6['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x33add2||_0x5dfb52||_0x338012||_0x4c3f0d||_0x270032;}['_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'](_0x1e3850){const _0x3af907=new Pt(_0x1e3850);return _0x3af907['set']({'label':ls(_0x1e3850,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+cn,'icon':_0x537516,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x3af907;}['_createAddContextBalloonPanelView'](_0x164ccf){return this['_createBaseBalloonPanel'](_0x164ccf,To);}['_createUrlBalloonPanelView'](_0x3161ca){const _0x5564ac=this['_createBaseBalloonPanel'](_0x3161ca,Co);return this['_addUrlContent'](_0x5564ac,_0x3161ca),_0x5564ac;}['_createResourcesBalloonView'](_0xcac965,_0x1a7a66){const _0x5e7466={'searchInputVisibleFrom':_0x1a7a66['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x3c025f,_0x28768f)=>{this['fire']('addResourceToContext',{'source':_0x3c025f,'resource':_0x28768f});},'onLoadSourceResources':_0x58bcd9=>{this['fire']('loadSourceResources',_0x58bcd9);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0xcac965,_0x1a7a66['bodyCollection'],_0x5e7466);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x158817,_0x2742c2){const _0x20abc8=new Nt(_0x158817);return _0x20abc8['extendTemplate']({'attributes':{'class':_0x2742c2}}),this['bodyCollection']['add'](_0x20abc8),_0x20abc8;}['_setBalloonPanelContent'](_0x21e975,_0x473b3a,_0x2eb02a){if(_0x21e975['content']['clear'](),!_0x2eb02a['document']['isHidden']&&_0x2eb02a['document']['enabled']){const _0x4d8694=this['_createBalloonButton'](_0x473b3a,{'label':ls(_0x473b3a,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x2cb12d});_0x4d8694['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x21e975['content']['add'](_0x4d8694);}if(_0x2eb02a['urls']['enabled']){const _0x154191=this['_createBalloonButton'](_0x473b3a,{'label':ls(_0x473b3a,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x1f8952});_0x154191['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x21e975['content']['add'](_0x154191);}if(_0x2eb02a['files']['enabled']){const _0x31cee7=new Ut(_0x473b3a);_0x31cee7['set']({'label':ls(_0x473b3a,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x546102,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x31cee7['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x31cee7['on']('done',(_0x4edf48,_0x329fd3)=>{this['fire']('addFileToContext',_0x329fd3);}),_0x31cee7['tooltip']=!0x0,_0x21e975['content']['add'](_0x31cee7);}for(const _0x32bea1 of _0x2eb02a['sources']){const _0x5cc9dc=this['_createBalloonButton'](_0x473b3a,{'label':_0x32bea1['label'],'icon':_0x32bea1['icon']||_0x1be752,'type':'source'});_0x21e975['content']['add'](_0x5cc9dc),_0x5cc9dc['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x32bea1,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x5a622a of _0x2eb02a['customItems']||[]){const _0x3746d1=this['_createBalloonButton'](_0x473b3a,{'label':_0x5a622a['label'],'icon':_0x5a622a['icon']||_0x1be752,'type':'customItem'});_0x21e975['content']['add'](_0x3746d1),_0x3746d1['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x5a622a);});}this['_hasExactlyOneSource']=0x1===_0x21e975['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x16c37e,_0x43b10f){this['_urlInputView']=new io(_0x43b10f),this['_urlInputView']['on']('submitUrl',(_0x150228,_0x290f1)=>{this['_handleUrlSubmit'](_0x290f1);}),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});}),_0x16c37e['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x4aa2e5,_0x396a5f){const _0x476045='source'===_0x396a5f['type']?new xo(_0x4aa2e5):new Pt(_0x4aa2e5);return _0x476045['set']({'label':_0x396a5f['label'],'icon':_0x396a5f['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x476045;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x36e73c({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x59622f){const _0x42f2d9=this['_addContextBalloonConfig'];_0x42f2d9['buttonView']['isOn']=_0x59622f,_0x59622f?_0x42f2d9['balloonView']['show']():_0x42f2d9['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x19704e,buttonView:_0x5aa297,hideMethod:_0x1694f3}=this['_addContextBalloonConfig'];_0x36e73c({'emitter':_0x19704e,'contextElements':[_0x19704e['element'],_0x5aa297['element']],'callback':()=>{_0x1694f3();},'activator':()=>_0x5aa297['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x5dfbe9,_0x1f2804,_0x2cddb4=!0x1,_0x4d8760=!0x1){const _0x95e3c3='conversation'===_0x1f2804||!0x0===_0x5dfbe9['isReadOnly'],_0x5e881c=new mr(this['locale'],_0x5dfbe9,_0x95e3c3,_0x2cddb4,_0x4d8760);return _0x95e3c3||_0x5e881c['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x5e881c['id']);}),_0x5e881c;}['_addContextToCollection'](_0x543815,_0x55a7b7){_0x55a7b7['add'](_0x543815,0x0);}['_removeContextFromCollection'](_0x4979d2,_0xd57de6){const _0x1206d6=_0xd57de6['find'](_0x4f17ef=>_0x4f17ef['id']===_0x4979d2);_0x1206d6&&_0xd57de6['remove'](_0x1206d6);}['_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'](_0x2ee0d0){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x2ee0d0);}},xo=class extends Pt{['arrowView'];constructor(_0x26a056){super(_0x26a056),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 _0x4ac660=new Wt();return _0x4ac660['content']=_0x569a5a,_0x4ac660['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x4ac660;}},Lo=class extends _0x223663{['_cancelButtonView'];['_loaderView'];constructor(_0x49bb37){super(_0x49bb37),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 _0x809efe=new Pt(this['locale']);return _0x809efe['set']({'label':ls(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':hn+'\x20ck-ai-button-stop-generating','icon':et}),_0x809efe['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x809efe;}['_createLoaderView'](){const _0x5b588b=new _0x223663(this['locale']);return _0x5b588b['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')}]}),_0x5b588b;}},Do=class extends _0x223663{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x3a6e1e,_0xb0985c){super(_0x3a6e1e),this['_filesEnabled']=_0xb0985c['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x3a6e1e,{'bodyCollection':_0xb0985c['bodyCollection'],'searchInputVisibleFrom':_0xb0985c['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x3a6e1e),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x3a6e1e),this['_loaderView']=this['_createLoaderView'](_0x3a6e1e),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x3a6e1e),this['_dropZoneView']=new Fr(_0x3a6e1e),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 _0x3ab09d=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x3ab09d['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x3ab09d['if']('isLoading','ck-hidden',_0x33ac0c=>_0x33ac0c||!this['isModelAvailable']),_0x3ab09d['if']('isModelAvailable','ck-hidden',_0x459574=>!_0x459574||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x3ab09d['if']('isLoading','ck-hidden',_0x289933=>!_0x289933)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x3ab09d['if']('isModelAvailable','ck-hidden',_0x38d69c=>_0x38d69c)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x36e73c({'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'](_0x3a2ae5,_0x57ef57){return new yo(_0x3a2ae5,_0x57ef57);}['_createPromptInputView'](_0x611965){return new Gr(_0x611965,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x2a3b65){return new jr(_0x2a3b65);}['_createLoaderView'](_0x130bb7){return new Lo(_0x130bb7);}['_createModelUnavailableMessageView'](_0x4b1953){const _0x3f703c=new Po(_0x4b1953);return _0x3f703c['delegate']('startConversation')['to'](this),_0x3f703c;}['_handlePromptInputFocus'](_0x166710,_0x2e9be9,_0x44574b){_0x44574b?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x3ca39c,_0x2ed3c3){this['_contextPanelView']['addContextItem'](_0x3ca39c,_0x2ed3c3);}['removeContextItem'](_0x3684fd){this['_contextPanelView']['removeContextItem'](_0x3684fd);}['setContextItemLoading'](_0x43ccfe,_0x5aba53){this['_contextPanelView']['setContextItemLoading'](_0x43ccfe,_0x5aba53);}['setIsUploadInProgress'](_0x396b0f){this['_promptInputView']['setIsUploadInProgress'](_0x396b0f);}['setConversationContext'](_0x5b5ce0){this['_contextPanelView']['setConversationContext'](_0x5b5ce0);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x1042c0,_0x5f0ef8,_0x5628e1){this['_contextPanelView']['updateResourceState'](_0x1042c0,_0x5f0ef8,_0x5628e1);}['setWebSearch'](_0x3a767e){this['_promptCapabilitiesView']['setWebSearch'](_0x3a767e);}['setReasoning'](_0x2b4394){this['_promptCapabilitiesView']['setReasoning'](_0x2b4394);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x3c3c66){this['_contextPanelView']['setAddContextOptions'](_0x3c3c66);}['setInputPlaceholder'](_0x3f3eba){this['_promptInputView']['setPlaceholderText'](_0x3f3eba);}['setModelList'](_0x4f24af,_0x3350d7){this['_promptCapabilitiesView']['setModelList'](_0x4f24af,_0x3350d7);}['setModel'](_0xf7522e){_0xf7522e?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0xf7522e)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x282e87){this['_promptCapabilitiesView']['disableModelSelector'](_0x282e87);}['populateSourceResourceBalloon'](_0x524bc2,_0x4b93f2,_0x34f2ca,_0x5b3036){this['_contextPanelView']['populateSourceResourceBalloon'](_0x524bc2,_0x4b93f2,_0x34f2ca,_0x5b3036);}['closeSourceResourceBalloon'](_0x5b30e9){this['_contextPanelView']['closeSourceResourceBalloon'](_0x5b30e9);}['focusPromptInput'](_0x1d3115=!0x1){this['_promptInputView']['focus'](_0x1d3115);}['setPromptInputValue'](_0x3e0d7d){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x3e0d7d;}},Po=class extends _0x223663{constructor(_0x50dfcc){super(_0x50dfcc);const _0x552bad=new Pt(_0x50dfcc);_0x552bad['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x552bad['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'},_0x552bad]}]});}},Ho=class extends Gt{['resizeButton'];constructor(_0x58b158,_0x32a53a){super(_0x58b158,{'label':_0x32a53a['label'],'class':'ck-ai-header\x20'+_0x32a53a['class'],'icon':_0x32a53a['icon']}),this['set']('isMaximized',!0x1),_0x32a53a['content']&&this['children']['add'](_0x32a53a['content']),_0x32a53a['showResizeButton']&&(this['resizeButton']=ln(_0x58b158,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x223663{constructor(_0xb87fd8){super(_0xb87fd8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':ls(_0xb87fd8,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x26f0f2,_0x457cdd){const _0x1d7f45=new Pt(_0x26f0f2);return _0x1d7f45['set']({'label':ls(_0x26f0f2,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x4560e4,'class':'ck-ai-chat__start-conversation\x20'+hn}),_0x1d7f45['on']('execute',()=>{_0x457cdd['fire']('startConversation');}),_0x1d7f45;}var Uo=class extends _0x223663{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x3637f2,_0x2443c6){super(_0x3637f2),this['_bodyCollection']=un(_0x3637f2);const _0x2d7c67=Vo(_0x3637f2,this);this['chatHeader']=new Ho(_0x3637f2,{'label':ls(_0x3637f2,'AI_CHAT_HEADING'),'icon':_0x46613e,'class':'ck-ai-header_chat','content':_0x2d7c67,'showResizeButton':_0x2443c6['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0x3637f2,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0x3637f2,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2443c6['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2443c6['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0x3637f2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x3637f2['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x42d57d,_0x2ac525,_0x1b8e11,_0xaea6ae){this['chatControls']['populateSourceResourceBalloon'](_0x42d57d,_0x2ac525,_0x1b8e11,_0xaea6ae);}['closeSourceResourceBalloon'](_0x5a2dd0){this['chatControls']['closeSourceResourceBalloon'](_0x5a2dd0);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x394116{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(_0x2ea579){super(_0x2ea579);const _0x47357a=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x47357a['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'](_0x47357a),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x245286,{showDiff:_0x214590})=>{this['showDiff']=_0x214590;}),this['disableControls'](),_0x47357a['view']['addTab']({'id':'chat','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x46613e,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x47357a['view'],'isMaximized',_0x250020=>_0x250020),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x1732c8=>_0x1732c8),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x2e2fb4){const _0x2b035b=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'](_0x2e2fb4['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x2b035b}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x34f939,staticMessage:_0x421aab}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x34f939,'initialContent':'<p>'+_0x421aab+'</p>'});});}async['addFeedItemUserMessage'](_0x59ea22){const _0x58d646=_0x59ea22['attributes']?.['displayedPrompt']||_0x59ea22['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x59ea22['contextItems']['values']()),'initialContent':'<p>'+_0x58d646+'</p>','id':_0x59ea22['id']});});}async['addFeedItemError']({errorMessage:_0xe44fa1,id:_0x1d4630}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0xe44fa1+'</p>','id':_0x1d4630});});}async['addFeedItemAIReply'](_0x4792d3){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4792d3['interactionId']+':'+_0x4792d3['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x3dfea1){const _0x5d6fdf=us(this['context']),_0x3c7b8f=_0x5d6fdf['map'](_0x51e44e=>_0x51e44e['config']['get']('ai.availableReplyActions')||[...er]);let _0x318ddd=_0x3c7b8f['reduce']((_0x42d412,_0x486269)=>_0x42d412['filter'](_0x51ccb3=>_0x486269['includes'](_0x51ccb3)),_0x3c7b8f[0x0]||[...er]);const _0x3c7a9b=_0x5d6fdf['every'](_0x37c184=>_0x37c184['plugins']['has']('TrackChanges')),_0x3ec545=_0x5d6fdf['map'](_0x5dab80=>_0x5dab80['commands']['get']('trackChanges'));return _0x3c7a9b?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x3ec545,'value',(..._0x14173f)=>_0x14173f['some'](_0x13d6d=>_0x13d6d))):_0x318ddd=_0x318ddd['filter'](_0x1be841=>'insertSuggestion'!=_0x1be841),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x3dfea1['interactionId']+':'+_0x3dfea1['id'],'areActionsDisabled':_0x3dfea1['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x318ddd}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x43cabc,_0xef2bb6){return this['_promiseQueue']['enqueue'](async()=>{const _0x4aa3fe=this['_view']['chatFeed']['children']['last'];if(_0x4aa3fe instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0x4aa3fe),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x43cabc['id'],'capabilities':{'isWebSearchEnabled':_0x4aa3fe['capabilities']['isWebSearchEnabled']||_0xef2bb6['isWebSearchEnabled'],'isReasoningEnabled':_0x4aa3fe['capabilities']['isReasoningEnabled']||_0xef2bb6['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x43cabc['id'],'capabilities':_0xef2bb6});});}async['addFeedItemCustomElement'](_0x336e93,_0x145e51){let _0x20df04;return await this['_promiseQueue']['enqueue'](async()=>{_0x20df04=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x336e93,'id':_0x145e51});}),_0x20df04;}['removeFeedItem'](_0x2a0dcb){this['_view']['chatFeed']['removeItem'](_0x2a0dcb);}['hasFeedItem'](_0x2e3ab5){return this['_view']['chatFeed']['hasItem'](_0x2e3ab5);}['updateFeedInteractionHeader'](_0x3972e2){const _0x3b316c=this['_view']['chatFeed']['children']['find'](_0x6548a1=>_0x6548a1['options']['id']==_0x3972e2['id']&&_0x6548a1 instanceof yr);_0x3b316c&&_0x3b316c['set']('isVisible',_0x3972e2['isVisible']);}async['updateFeedItemAIReplyContent'](_0x2f48f1){const _0x1c2497=_0x2f48f1['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x2cfdfd=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x2f48f1,'abortSignal':_0x2cfdfd,'renderingStrategy':_0x1c2497}),_0x2f48f1['isDone']&&this['markFeedItemAsDone'](_0x2f48f1['id']);});}['updateFeedItemAIReplySources'](_0x21f896,_0x2aa6a8){this['_view']['chatFeed']['updateWebSources'](_0x21f896,_0x2aa6a8);}async['updateFeedItemAIReplySuggestionContent'](_0x2c24f8){return this['_promiseQueue']['enqueue'](async _0x11061d=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x2c24f8,'abortSignal':_0x11061d}),_0x2c24f8['isDone']&&this['markFeedItemAsDone'](_0x2c24f8['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x5d156c){this['_view']['chatFeed']['updateSuggestionPartState'](_0x5d156c);}['setFeedItemAIReplySuggestionPartActive'](_0x15f3ce){this['_view']['chatFeed']['setSuggestionPartActive'](_0x15f3ce);}['markFeedItemAsDone'](_0x581ab6){this['_view']['chatFeed']['markItemAsDone'](_0x581ab6);}['removeFeedInteraction'](_0x13742e){this['_view']['chatFeed']['getItemIds']()['filter'](_0x43ddfe=>_0x43ddfe['startsWith'](_0x13742e))['forEach'](_0x10808c=>this['_view']['chatFeed']['removeItem'](_0x10808c));}['startInteraction'](){const _0x4cc394=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x4cc394),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x8112fa){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x29f94d=>_0x29f94d['startsWith'](_0x8112fa['id']))['forEach'](_0x383067=>this['markFeedItemAsDone'](_0x383067)),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'](_0x203c11,_0x364d02){this['_view']['chatControls']['addContextItem'](_0x203c11,_0x364d02);}['removeContextItem'](_0x42c5d9){this['_view']['chatControls']['removeContextItem'](_0x42c5d9);}['setContextItemLoading'](_0x5c27d3,_0x3dbad7){this['_view']['chatControls']['setContextItemLoading'](_0x5c27d3,_0x3dbad7);}['setIsUploadInProgress'](_0x55f595){this['_view']['chatControls']['setIsUploadInProgress'](_0x55f595);}['setConversationContext'](_0x30ffce){this['_view']['chatControls']['setConversationContext'](_0x30ffce);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x235dcb,_0x2acb07,_0x1f8019){this['_view']['chatControls']['updateResourceState'](_0x235dcb,_0x2acb07,_0x1f8019);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x2a2a5a){this['_view']['chatControls']['setAddContextOptions'](_0x2a2a5a);}['updateCapabilities'](_0x42dc7f){this['_view']['chatControls']['setWebSearch'](_0x42dc7f['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x42dc7f['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x42dc7f));}['setSelectedModel'](_0x245b09,_0x4f0145){this['_view']['chatControls']['setModel'](_0x245b09),_0x4f0145&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x17ab3a){this['feedItemRenderingStrategy']=_0x17ab3a;}['toggleLoadingSkeleton'](_0x3148f5){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x3148f5);}['resetConversationTitle'](){this['setConversationTitle'](ls(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x4c7528,_0x3401d5=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x3401d5&&!It()&&_0x4c7528['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x4c7528);this['_view']['chatHeader']['label']=_0x4c7528;}['setLoadingMessage'](_0x2ceb05){this['_view']['chatFeed']['setLoadingMessage'](_0x2ceb05);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x1c2ed0){let _0xedd45a=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x1c2ed0[_0xedd45a],_0xedd45a++,_0xedd45a===_0x1c2ed0['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x2cbf07){return _0x2cbf07['isWebSearchEnabled']&&_0x2cbf07['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x2cbf07['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x2cbf07['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0xcf43be){return _0xcf43be?_0xcf43be['isWebSearchEnabled']&&_0xcf43be['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0xcf43be['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0xcf43be['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'](_0x2182b4,_0xb39dc8,_0x216ab1,_0x86b3ce){this['_view']['populateSourceResourceBalloon'](_0x2182b4,_0xb39dc8,_0x216ab1,_0x86b3ce);}['closeSourceResourceBalloon'](_0x445d13){this['_view']['closeSourceResourceBalloon'](_0x445d13);}['setPromptInputValue'](_0x35511d){this['_view']['chatControls']['setPromptInputValue'](_0x35511d);}['focusPromptInput'](_0x54bba0=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x54bba0);}['scrollFeedToSuggestion'](_0x228ddb,_0x525983){this['_view']['chatFeed']['scrollToSuggestion'](_0x228ddb,_0x525983);}['startAutoScroll'](_0x4f1e43={}){this['_view']['chatFeed']['startAutoScroll'](_0x4f1e43);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends zt{['sections'];constructor(_0x2fc8ad,_0x32689f){super(_0x2fc8ad),this['sections']=_0x32689f,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x55ef81){let _0x4b968a=0x0,_0x814823=0x0;for(const _0xc54c25 of this['sections']){const {resultsCount:_0x4a442a,totalItemsCount:_0x27e427}=_0xc54c25['filter'](_0x55ef81);_0x4b968a+=_0x4a442a,_0x814823+=_0x27e427;}return{'resultsCount':_0x4b968a,'totalItemsCount':_0x814823};}},Fo=class extends Xt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x5c80e9,{title:_0x38da6a,items:_0x831581}){super(_0x5c80e9);const _0x4a74f6=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x38da6a,this['itemsViews']=_0x831581;const _0x187006=new _0x223663(_0x5c80e9);_0x187006['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new zt(_0x5c80e9),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x4a74f6['if']('isVisible','ck-hidden',_0x1f870a=>!_0x1f870a)]},'children':[_0x187006,this['_itemsListView']]});}['filter'](_0x551a8d){const _0x2ef2e2=this['itemsViews']['length'];let _0xed341d=0x0;for(const _0x1dc2aa of this['itemsViews'])_0x551a8d?(_0x1dc2aa['isVisible']=!!_0x1dc2aa['isMatching'](_0x551a8d),_0x1dc2aa['highlightText'](_0x551a8d)):(_0x1dc2aa['isVisible']=!0x0,_0x1dc2aa['highlightText'](null)),_0x1dc2aa['isVisible']&&_0xed341d++;return this['isVisible']=_0xed341d>0x0,{'resultsCount':_0xed341d,'totalItemsCount':_0x2ef2e2};}['getItem'](_0x2b5f74){return this['itemsViews']['find'](_0x319940=>_0x319940['id']===_0x2b5f74);}['removeItem'](_0x381220){const _0x261e0f=this['itemsViews']['indexOf'](_0x381220);-0x1!==_0x261e0f&&(this['itemsViews']['splice'](_0x261e0f,0x1),this['_itemsListView']['items']['remove'](_0x381220));}};const Ko=/* #__PURE__ -- @preserve */
34
- _0x45ff7c(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(_0x542b99,_0x17fb1a){super(_0x542b99);const _0xb51528=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x17fb1a['pinned']),this['set']('loadingState',null),this['set']('title',_0x17fb1a['title']),this['id']=_0x17fb1a['id'];const {createdAt:_0x1a1b31,active:_0x38cf19=!0x1}=_0x17fb1a;this['_titleView']=new Kt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x265a32=this['_createCheckView'](),_0x51fe37=this['_createPinButtonView'](_0x542b99),_0x1deb4c=this['_createMenuDropdownView'](),_0x1e2b2f=this['_createEditInputView'](_0x542b99),_0x3ee719=this['_createAcceptEditButtonView'](_0x542b99,_0x1e2b2f),_0x20d0fc=this['_createCancelEditButtonView'](_0x542b99);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x51fe37),this['actions']['add'](_0x1deb4c),this['on']('change:isEdit',(_0x1b7868,_0x1f0133,_0x153681)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x153681?(this['actions']['add'](_0x3ee719),this['actions']['add'](_0x20d0fc),this['mainContent']['add'](_0x1e2b2f),_0x1e2b2f['element']['value']=this['title']||'',_0x1e2b2f['element']['focus']()):(this['actions']['add'](_0x51fe37),this['actions']['add'](_0x1deb4c),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x38cf19?'ck-ai-chat-history__item--active':'',_0xb51528['if']('isVisible','ck-hidden',_0x238c17=>!_0x238c17),_0xb51528['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',_0xb51528['if']('loadingState','ck-hidden',_0x3edf51=>!!_0x3edf51)]},'children':_0x38cf19?[_0x265a32]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0xb51528['if']('loadingState','ck-hidden',_0x40ebc1=>!_0x40ebc1)]},'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',_0xb51528['if']('loadingState','ck-hidden',_0x39914c=>!!_0x39914c)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0xb51528['if']('loadingState','ck-hidden',_0x2b5ef0=>!_0x2b5ef0)]},'children':[{'text':_0xb51528['to']('loadingState',_0x3a1b77=>_0x3a1b77?ls(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x3a1b77]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x1a1b31]}]},{'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'](_0x267765){this['set']('title',_0x267765);}['updateLoadingState'](_0x27705c,_0x29b809){this['set']('loadingState',_0x29b809?_0x27705c:null);}['_createCheckView'](){const _0x4a701c=new Wt();return _0x4a701c['set']({'content':_0xd806a0}),_0x4a701c;}['_createPinButtonView'](_0x197fc5){const _0x2322dc=new Pt(_0x197fc5);return _0x2322dc['set']({'label':ls(_0x197fc5,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x308705,'withText':!0x1,'tooltip':!0x0}),_0x2322dc['bind']('isOn')['to'](this,'pinned'),_0x2322dc['on']('execute',()=>{const _0x162971=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x162971});}),_0x2322dc;}['_createMenuDropdownView'](){const _0x1df9fc=_0x1c0a67(this['locale']),_0x512dfd=_0x1df9fc['panelView']['children'];_0x1df9fc['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':st}),_0x1df9fc['panelPosition']='sw';const _0x20fd07=new Pt(this['locale']);_0x20fd07['label']=ls(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x20fd07['withText']=!0x0,_0x20fd07['on']('execute',()=>{this['isEdit']=!0x0;});const _0x1a83f3=new Pt(this['locale']);_0x1a83f3['label']=ls(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x1a83f3['withText']=!0x0,_0x1a83f3['on']('execute',()=>{this['showConfirm'](ls(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x403125=new zt(this['locale']),_0x4814f2=new Xt(this['locale']);_0x4814f2['children']['add'](_0x20fd07);const _0x2a1c7b=new Xt(this['locale']);return _0x2a1c7b['children']['add'](_0x1a83f3),_0x403125['items']['addMany']([_0x4814f2,_0x2a1c7b]),_0x512dfd['add'](_0x403125),_0x1df9fc;}['_createEditInputView'](_0x205549){const _0x457be6=new Yt(_0x205549),_0x4664cb=_0x457be6['bindTemplate'];return _0x457be6['extendTemplate']({'on':{'keydown':_0x4664cb['to'](_0x1c2136=>{'Enter'==_0x1c2136['key']&&this['_commitEditInputValue'](_0x457be6);})}}),_0x457be6;}['_createAcceptEditButtonView'](_0x4b4c8e,_0xbdb2ab){const _0x3f7f33=new Pt(_0x4b4c8e);return _0x3f7f33['set']({'icon':_0xd806a0,'withText':!0x1,'tooltip':ls(_0x4b4c8e,'AI_CHAT_HISTORY_ACCEPT')}),_0x3f7f33['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x3f7f33['on']('execute',()=>{this['_commitEditInputValue'](_0xbdb2ab);}),_0x3f7f33;}['_commitEditInputValue'](_0x12c085){const _0x43c350=_0x12c085['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x43c350});}['_createCancelEditButtonView'](_0x4d872a){const _0x1b7a6a=new Pt(_0x4d872a);return _0x1b7a6a['set']({'icon':_0x3ce603,'withText':!0x1,'tooltip':ls(_0x4d872a,'AI_CHAT_HISTORY_CANCEL')}),_0x1b7a6a['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1b7a6a['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1b7a6a;}['_createSpinnerView'](){const _0x2f3074=new cr('tiny');return _0x2f3074['isVisible']=!0x0,_0x2f3074;}['isMatching'](_0x35b1df){return'string'==typeof this['title']&&this['title']['match'](_0x35b1df)?{'title':!0x0}:null;}['highlightText'](_0xb59f37){this['_titleView']['highlightText'](_0xb59f37);}},Yo=class extends _0x223663{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x5bc806,_0x2c51f4){super(_0x5bc806),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x46a10e=Vo(_0x5bc806,this);this['headerView']=new Ho(_0x5bc806,{'label':ls(_0x5bc806,'AI_CHAT_HISTORY_HEADING'),'icon':_0x3fc8c3,'class':'ck-ai-header_history','content':_0x46a10e,'showResizeButton':_0x2c51f4}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x5bc806,[]),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',_0x44fc9a=>!_0x44fc9a)]}}),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 _0x14b4c6=new _0x4c1723(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x564091=>ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x564091),'secondary':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4fa096=this['_createErrorView']();return _0x4fa096['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x27e23b=>!_0x27e23b)]}}),_0x14b4c6['on']('render',()=>{_0x14b4c6['children']['add'](_0x4fa096,0x1);}),_0x14b4c6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x4b3ce9=>!_0x4b3ce9)]}}),_0x14b4c6;}['_createSkeletonView'](){const _0x47bf31=new Xn(this['locale'],zn['aiHistory']);return _0x47bf31['bind']('isVisible')['to'](this,'isLoading'),_0x47bf31;}['_createErrorView'](){const _0x47a2a3=new _0x223663(this['locale']),_0xc6d64b=new Pt(this['locale']);_0xc6d64b['set']({'withText':!0x1,'icon':_0x3ce603,'class':'ck-ai-notification_error__dismiss-button'}),_0xc6d64b['bind']('isVisible')['to'](this,'hasItems',_0x17a155=>!!_0x17a155),_0xc6d64b['on']('execute',()=>{this['errorMessage']='';});const _0x4a6f6f=this['bindTemplate'];return _0x47a2a3['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x4a6f6f['to']('errorMessage')}]},_0xc6d64b]}),_0x47a2a3;}['_createEmptyStateView'](){const _0xb184ff=new _0x223663(this['locale']);return _0xb184ff['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x2dae2c=>!_0x2dae2c)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[ls(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0xb184ff;}['_createListItemViews'](_0x1586ca,_0x4774ad){const _0x24dc84=[];for(const _0x13c424 of _0x1586ca){const _0x45b026=new Wo(_0x4774ad,_0x13c424);_0x45b026['delegate'](...$o)['to'](this),_0x24dc84['push'](_0x45b026);}return _0x24dc84;}['updateHistoryItemsWithCategories'](_0x44872f){const _0x4aef46=this['locale']||'en',_0x5754a7=[];for(const _0x3a1b1c of _0x44872f){const _0x1cecac=this['_createListItemViews'](_0x3a1b1c['items'],_0x4aef46);_0x5754a7['push'](new Fo(_0x4aef46,{'title':_0x3a1b1c['title'],'items':_0x1cecac}));}this['sectionsView']['sections']=_0x5754a7,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x5754a7),this['hasItems']=_0x44872f['some'](_0x2fdfed=>_0x2fdfed['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x4d6d14){for(const _0x10c6f1 of this['sectionsView']['sections']){const _0x28f03a=_0x10c6f1['getItem'](_0x4d6d14);if(_0x28f03a){if(_0x10c6f1['removeItem'](_0x28f03a),0x0===_0x10c6f1['itemsViews']['length']){const _0xaf805e=this['sectionsView']['sections']['indexOf'](_0x10c6f1);-0x1!==_0xaf805e&&(this['sectionsView']['sections']['splice'](_0xaf805e,0x1),this['sectionsView']['items']['remove'](_0x10c6f1));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x2605c8,_0x61f84e){for(const _0x97dc39 of this['sectionsView']['sections']){const _0x4723ae=_0x97dc39['getItem'](_0x2605c8);if(_0x4723ae){_0x4723ae['updateTitle'](_0x61f84e);break;}}}['updateItemLoadingState'](_0x8a098b,_0x3d36c5,_0x48e5c5){for(const _0x34dedd of this['sectionsView']['sections']){const _0x1b1a70=_0x34dedd['getItem'](_0x8a098b);if(_0x1b1a70){_0x1b1a70['updateLoadingState'](_0x3d36c5,_0x48e5c5);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x1dfb90=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x1dfb90);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x394116{static get['requires'](){return[hs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x118103){super(_0x118103);const _0x13fb26=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x13fb26['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x13fb26),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x13fb26['view'],'isMaximized',_0x3aa091=>_0x3aa091),_0x13fb26['view']['addTab']({'id':'history','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x3fc8c3,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x3b13d7){this['_historyView']['removeHistoryItem'](_0x3b13d7);}['updateItems'](_0xbf2ede){this['_historyView']['updateHistoryItemsWithCategories'](_0xbf2ede);}['updateItemTitle'](_0x1444b3,_0x410697){this['_historyView']['updateItemTitle'](_0x1444b3,_0x410697);}['updateItemLoadingState'](_0x5929a5,_0xbca94c,_0x222e9c){this['_historyView']['updateItemLoadingState'](_0x5929a5,_0xbca94c,_0x222e9c);}['setLoadingSkeleton'](_0x2fcbfa){this['_historyView']['isLoading']=_0x2fcbfa;}['showError'](_0x522471){this['_historyView']['errorMessage']=_0x522471;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
35
- _t();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x5a9694,title:_0x4d42ec,createdAt:_0x5efda7,updatedAt:_0x1eb896,pinned:_0x200161}){super(),this['id']=_0x5a9694,this['createdAt']=new Date(_0x5efda7),this['set']('title',_0x4d42ec),this['set']('updatedAt',_0x1eb896?new Date(_0x1eb896):null),this['set']('pinned',_0x200161||!0x1);}['updateTitle'](_0x1326e1){this['set']('title',_0x1326e1),this['updatedAt']=new Date();}['updatePinned'](_0x3ecc0e){this['set']('pinned',_0x3ecc0e),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
36
- lt();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x38f69e,group:_0x5c4a40}){super(),this['connector']=_0x38f69e,this['group']=_0x5c4a40;}async['init'](){try{const _0x588493=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x588493);}catch(_0x5e10dd){this['fire']('error',{'error':_0x5e10dd,'operation':'init'});}}['addItem'](_0x3627e1){this['items']['push'](_0x3627e1);}async['removeItem'](_0x3e0ad5){const _0x17a355=this['items']['findIndex'](_0xf25215=>_0xf25215['id']===_0x3e0ad5);if(-0x1===_0x17a355)return!0x1;try{return await this['connector']['deleteConversation'](_0x3e0ad5)['execute'](),this['items']['splice'](_0x17a355,0x1),this['fire']('itemRemoved',{'itemId':_0x3e0ad5}),!0x0;}catch(_0x100f05){return this['fire']('error',{'error':_0x100f05,'operation':'removeItem','itemId':_0x3e0ad5}),!0x1;}}['getItem'](_0x1dbd82){return this['items']['find'](_0x4d8949=>_0x4d8949['id']===_0x1dbd82);}async['updateItemTitle'](_0x303143,_0x374fd5){const _0x6e08cf=this['getItem'](_0x303143);if(!_0x6e08cf)return!0x1;try{return await this['connector']['updateConversation'](_0x303143,{'title':_0x374fd5})['getResult'](),_0x6e08cf['updateTitle'](_0x374fd5),this['fire']('itemUpdated',{'itemId':_0x303143,'updates':{'title':_0x374fd5}}),!0x0;}catch(_0x386a4b){return this['fire']('error',{'error':_0x386a4b,'operation':'updateItemTitle','itemId':_0x303143}),!0x1;}}async['updateItemPinned'](_0x33a443,_0x2f6740){const _0x5d523b=this['getItem'](_0x33a443);if(!_0x5d523b)return!0x1;try{return await this['connector']['updateConversation'](_0x33a443,{'pinned':_0x2f6740})['getResult'](),_0x5d523b['updatePinned'](_0x2f6740),this['fire']('itemUpdated',{'itemId':_0x33a443,'updates':{'pinned':_0x2f6740}}),!0x0;}catch(_0x39409a){return this['fire']('error',{'error':_0x39409a,'operation':'updateItemPinned','itemId':_0x33a443}),!0x1;}}['loadItems'](_0x45aa38){try{this['items']=[],_0x45aa38['map'](_0x4ab65b=>{this['addItem'](new Xo(_0x4ab65b));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x4993c5){this['fire']('error',{'error':_0x4993c5,'operation':'loadItems'});}}['getItems'](_0x1d97b5={}){const _0x4b3c81=void 0x0!==_0x1d97b5['pinned']&&_0x1d97b5['pinned'],_0x2a4681=_0x1d97b5['from']?new Date(_0x1d97b5['from']['getFullYear'](),_0x1d97b5['from']['getMonth'](),_0x1d97b5['from']['getDate']()):null,_0x5e749c=_0x1d97b5['to']?new Date(_0x1d97b5['to']['getFullYear'](),_0x1d97b5['to']['getMonth'](),_0x1d97b5['to']['getDate']()):null;return this['items']['filter'](_0xf42a33=>{if(_0xf42a33['pinned']!==_0x4b3c81)return!0x1;if(_0x5e749c){const _0x226e6e=new Date(_0xf42a33['createdAt']['getFullYear'](),_0xf42a33['createdAt']['getMonth'](),_0xf42a33['createdAt']['getDate']());return _0x2a4681?_0x2a4681['getTime']()===_0x5e749c['getTime']()?_0x226e6e['getTime']()===_0x2a4681['getTime']():_0x226e6e<_0x5e749c&&_0x226e6e>=_0x2a4681:_0x226e6e<_0x5e749c;}return!0x0;});}},Jo=class extends _0x394116{['_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 _0x32b060=this['context']['plugins']['get'](hs);try{const _0x2674c1=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x2674c1}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x47b24c,_0x500fb5)=>{this['_setItemLoading'](_0x500fb5['id'],'remove'),this['_handleRemove'](_0x500fb5['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x3ad6fe,_0x279945)=>{this['_setItemLoading'](_0x279945['id'],'rename'),this['_handleEditTitle'](_0x279945['id'],_0x279945['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x5cc777,_0x400021)=>{void 0x0!==_0x400021['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x400021['itemId'],_0x400021['updates']['title']),void 0x0!==_0x400021['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x400021['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x495bd5,_0x2d1bcc)=>{this['_aiChatController']['_handleRemovedConversation'](_0x2d1bcc['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x2d1bcc['itemId']),this['_clearItemLoading'](_0x2d1bcc['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x30e4ba,_0x332a39)=>{this['_handleHistoryErrorUI'](_0x332a39['error'],_0x332a39['operation'],_0x332a39['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x2e496f,_0x20f87b)=>{this['_handleSelectConversation'](_0x20f87b['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0xdb6b83,_0x4ce55a)=>{const _0x5eabdc=_0x4ce55a['pinned']?'pin':'unpin';this['_setItemLoading'](_0x4ce55a['id'],_0x5eabdc),this['_handleTogglePin'](_0x4ce55a['id'],_0x4ce55a['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x32b060['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x32b060['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x2fc560){this['_handleHistoryErrorUI'](_0x2fc560,'init');}}async['_handleEditTitle'](_0x55f431,_0x1f3435){await this['history']['updateItemTitle'](_0x55f431,_0x1f3435);}async['_handleTogglePin'](_0x1d89c9,_0x527783){await this['history']['updateItemPinned'](_0x1d89c9,_0x527783);}async['_handleRemove'](_0xfa6e2c){await this['history']['removeItem'](_0xfa6e2c);}async['_handleSelectConversation'](_0x578619){await this['_aiChatController']['loadConversation'](_0x578619);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x51b21d=this['_aiChatController']['activeConversation']?.['id'],_0x370759=this['_getCategorizedItems']()['map'](_0x59d8ea=>({'title':_0x59d8ea['title'],'items':_0x59d8ea['items']['map'](_0x55e8b8=>({'id':_0x55e8b8['id'],'title':_0x55e8b8['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x55e8b8['createdAt'])['toLocaleDateString'](),'active':_0x55e8b8['id']===_0x51b21d,'pinned':_0x55e8b8['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x370759);}['_setItemLoading'](_0x29665e,_0x3e7596){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x29665e,_0x3e7596,!0x0);}['_clearItemLoading'](_0x540c3d){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x540c3d,null,!0x1);}['_handleHistoryErrorUI'](_0x1eee4a,_0x4aac16,_0x512177){const _0x140baa=this['_generateErrorMessage'](_0x4aac16,_0x512177);this['_aiChatHistoryUi']['showError'](_0x140baa),this['_reporter']['reportError'](_0x1eee4a,{'context':{'operation':_0x4aac16}}),_0x512177&&this['_clearItemLoading'](_0x512177),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x27e3fc,_0x4ff704){const _0x36d3a7=_0x4ff704?this['history']['getItem'](_0x4ff704):null,_0x421505=_0x36d3a7?.['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x27e3fc){case'updateItemTitle':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x421505);case'updateItemPinned':{const _0x45085b=ls(this['context']['locale'],_0x36d3a7?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x45085b,_0x421505]);}case'removeItem':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x421505);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 _0x3981af=new Date(),_0x42ab40=new Date(_0x3981af['getFullYear'](),_0x3981af['getMonth'](),_0x3981af['getDate']()),_0x4b9352=new Date(_0x42ab40);_0x4b9352['setDate'](_0x4b9352['getDate']()-0x1);const _0xb29ac0=new Date(_0x42ab40);_0xb29ac0['setDate'](_0xb29ac0['getDate']()-0xe);const _0x235ded=this['history']['getItems']({'pinned':!0x0}),_0x5210b1=this['history']['getItems']({'from':_0x42ab40,'to':_0x42ab40}),_0x340886=this['history']['getItems']({'from':_0x4b9352,'to':_0x4b9352}),_0x428921=this['history']['getItems']({'from':_0xb29ac0,'to':_0x4b9352}),_0x4e183e=this['history']['getItems']({'to':_0xb29ac0}),_0x44d00e=[];return _0x235ded['length']>0x0&&_0x44d00e['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x235ded}),_0x5210b1['length']>0x0&&_0x44d00e['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x5210b1}),_0x340886['length']>0x0&&_0x44d00e['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x340886}),_0x428921['length']>0x0&&_0x44d00e['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x428921}),_0x4e183e['length']>0x0&&_0x44d00e['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x4e183e}),_0x44d00e;}},Zo=class extends _0x394116{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x394116{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(_0x1ef83f){super(_0x1ef83f),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(_0xd6d033,_0x1fddca){super(_0xd6d033);const {id:_0x4d3304,type:_0x5df9de,icon:_0x23cea1}=_0x1fddca;this['id']=_0x4d3304,this['set']({'label':_0x1fddca['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x1fddca['id']}}),_0x23cea1?this['icon']=_0x23cea1:'chat'===_0x5df9de?this['icon']=_0x46613e:'review'===_0x5df9de?this['icon']=_0x57a69d:'translate'===_0x5df9de&&(this['icon']=_0x499c30);}},ia=class extends _0x223663{['listView'];constructor(_0x1258e5,_0x499939){super(_0x1258e5),this['set']('isEnabled',!0x0);const _0x367aa0=_0x499939['map'](_0x11d526=>{const _0x4bfb2d=new Xt(this['locale']),_0x12309b=new ea(this['locale'],_0x11d526);return _0x12309b['bind']('isEnabled')['to'](this),_0x4bfb2d['children']['add'](_0x12309b),_0x12309b['delegate']('execute')['to'](this),_0x4bfb2d;});this['listView']=new zt(this['locale']),this['listView']['items']['addMany'](_0x367aa0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x394116{['_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 _0x3c67b6=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x5c382a=_0x3c67b6['activeConversation'];_0x5c382a['isFromHistory']||this['_injectShortcuts'](_0x5c382a);}),this['listenTo'](_0x3c67b6,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x5065e4=['chat','review','translate'];this['_shortcuts']['forEach'](_0xdb110=>{let _0x15d990=!0x0;if(_0xdb110['id']&&_0xdb110['label']&&_0x5065e4['includes'](_0xdb110['type'])?'chat'===_0xdb110['type']&&(_0x15d990='string'==typeof _0xdb110['prompt']):_0x15d990=!0x1,!_0x15d990)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0xdb110});});}['_injectShortcuts'](_0x15e172){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',_0x144d1a=>{const _0x1fcc63=_0x144d1a['source']['id'];this['_executeShortcut'](_0x1fcc63);}),this['_listenedConversation']=_0x15e172,this['listenTo'](_0x15e172,'uploadProgressChanged',(_0x1c4ba4,_0x418c5f)=>{this['_shortcutsView']['isEnabled']=!_0x418c5f['isUploadInProgress'];});}['_removeShortcuts'](){const _0x28fa60=this['context']['plugins']['get'](Bo);_0x28fa60['hasFeedItem'](sa)&&_0x28fa60['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x577f5d){const _0x1ff02d=this['_shortcuts']['find'](_0x473617=>_0x473617['id']===_0x577f5d),_0xcda9c2=_0x1ff02d['type'];'chat'===_0xcda9c2?this['_runChatShortcut'](_0x1ff02d):'review'===_0xcda9c2?_0x1ff02d['commandId']?this['_runReviewShortcut'](_0x1ff02d):this['_switchTab']('reviewMode'):'translate'===_0xcda9c2&&(_0x1ff02d['language']?this['_runTranslateShortcut'](_0x1ff02d):this['_switchTab']('translate'));}['_switchTab'](_0x3cad9b){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x3cad9b});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x3cad9b);}async['_runChatShortcut']({prompt:_0x894a02,draftMode:_0x4c273f,useWebSearch:_0x46b114=!0x1,useReasoning:_0x362fc8=!0x1,model:_0x34dfdd}){const _0x3609de=this['context']['plugins']['get']('AIChatController'),_0x4bc11a=_0x3609de['activeConversation'];let _0x66ea3c;_0x66ea3c=_0x34dfdd?await _0x4bc11a['chatModels']['getModel'](_0x34dfdd):await _0x4bc11a['chatModels']['getDefault'](),_0x66ea3c&&await _0x4bc11a['setModel'](_0x66ea3c),_0x4bc11a['setWebSearch'](_0x46b114),_0x4bc11a['setReasoning'](_0x362fc8),_0x3609de['addCurrentDocumentToChatContext'](),_0x4c273f?(this['_aiChatUI']['setPromptInputValue'](_0x894a02),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x3609de['sendMessage']({'message':_0x894a02});}['_runReviewShortcut']({commandId:_0x3e1f1a,model:_0x32a505,prompt:_0x678690,params:_0x372c0b}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x2c6cbf={'id':_0x3e1f1a,'isCustom':'custom'===_0x3e1f1a};_0x32a505&&_0x678690&&(_0x2c6cbf['args']={'model':_0x32a505,'prompt':_0x678690}),_0x372c0b&&(_0x2c6cbf['params']=_0x372c0b),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x2c6cbf);}['_runTranslateShortcut']({language:_0x34899d}){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':_0x34899d,'args':{'language':_0x34899d}});}},ra=class extends _0x28a08e{constructor(_0xde3dcd){super(_0xde3dcd);const _0x16a9a7=_0xde3dcd['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x16a9a7,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xf6cb48=this['editor']['plugins']['get']('AITabs')['view'];_0xf6cb48['isVisible']=!_0xf6cb48['isVisible'];}},oa=class extends _0x57cbc7{static get['requires'](){return[hs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x330f64=this['editor'];_0x330f64['commands']['add']('toggleAi',new ra(_0x330f64)),_0x330f64['ui']['componentFactory']['add']('toggleAi',()=>{const _0x5c4418=this['_createAIUIButton'](Pt);return _0x5c4418['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x5c4418;}),_0x330f64['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x949d1a=this['_createAIUIButton'](jt);return _0x949d1a['set']({'role':'menuitemcheckbox'}),_0x949d1a;});}['_createAIUIButton'](_0x4320e4){const _0x212e9c=this['editor'],_0x3113fb=_0x212e9c['commands']['get']('toggleAi'),_0x4a8fa7=new _0x4320e4(_0x212e9c['locale']);return _0x4a8fa7['set']({'label':ls(_0x212e9c['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x59cca9,'isToggleable':!0x0}),_0x4a8fa7['bind']('isEnabled')['to'](_0x3113fb),_0x4a8fa7['bind']('isOn')['to'](_0x3113fb,'value',_0x59ce22=>!!_0x59ce22),this['listenTo'](_0x4a8fa7,'execute',()=>{_0x3113fb['execute']();}),_0x4a8fa7;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x223663{['_errorView'];constructor(_0x83899){super(_0x83899),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x4c7e7e){this['showError'](_0x4c7e7e);}['showError'](_0xc86916){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0xc86916,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x50e326=new _0x223663(this['locale']),_0x458552=new _0x223663(this['locale']);return _0x458552['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x50e326['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x43394a=>!_0x43394a)]},'children':[_0x458552]}),_0x50e326;}};const ca=0xa;var la=class extends _0x394116{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'](_0x378f58){const {id:_0x1f29b7}=this['_currentConfig']??{};this['_currentConfig']=_0x378f58,this['_editor']=_0x378f58['targetEditor'];const {id:_0x324548}=this['_currentConfig'];this['isOpen']&&_0x1f29b7===_0x324548?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x509567=this['_editor'];if(!_0x509567)return;const _0x1f9692=_0x509567['plugins']['get']('Dialog');_0x1f9692['isOpen']&&this['_currentConfig']&&_0x1f9692['id']===this['_currentConfig']['id']&&_0x1f9692['hide']();}['_updateDialog'](){const _0x5f07c9=this['_editor']['plugins']['get']('Dialog'),{icon:_0x3f7421,title:_0x23647a}=this['_currentConfig'];_0x5f07c9['view']?.['headerView']&&(_0x5f07c9['view']['headerView']['label']=_0x23647a,_0x5f07c9['view']['headerView']['iconView']&&_0x3f7421&&(_0x5f07c9['view']['headerView']['iconView']['content']=_0x3f7421)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5f07c9['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 _0x259b21=this['_editor']['plugins']['get']('Dialog'),{id:_0x37951d,title:_0x327617,icon:_0x50de15,class:_0x5c2c63,mainView:_0x47874b}=this['_currentConfig'];_0x47874b['delegate'](...aa)['to'](this),_0x259b21['show']({'title':_0x327617,'icon':_0x50de15,'hasCloseButton':!0x0,'id':_0x37951d,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x5c2c63||''),'content':_0x47874b,'onShow':_0xc13627=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0xc13627['view']?.['updatePosition']();const _0x4dfc07=this['_getSelectionElements']();_0x4dfc07&&_0x4dfc07[0x0]&&St({'target':_0x4dfc07[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0xc13627['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x37951d});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x37951d}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x546406,_0x12d053,_0x5d5778){const _0x3e5d8a=_0x12d053||_0x5d5778;if(!_0x3e5d8a)return null;const _0x59f402=this['_getSelectionElements']();if(!_0x59f402||0x0===_0x59f402['length'])return{'left':Math['round'](_0x3e5d8a['left']+_0x3e5d8a['width']/0x2-_0x546406['width']/0x2),'top':Math['round'](_0x3e5d8a['top']+_0x3e5d8a['height']/0x2-_0x546406['height']/0x2)};const _0x3402aa=Math['round'](_0x3e5d8a['left']+_0x3e5d8a['width']/0x2-_0x546406['width']/0x2),_0xbd7bd7=_0x59f402['map'](_0x2a4522=>new gt(_0x2a4522)),_0x1464c3=_0x546406['height'];return{'left':_0x3402aa,'top':this['_calculateOptimalTopPosition'](_0xbd7bd7,_0x1464c3,_0x3e5d8a)};}['_calculateOptimalTopPosition'](_0x535d62,_0x33af14,_0x3de804){const _0x1860a0=new gt(Et['window']),_0x30134c=_0x535d62['map'](_0x34d868=>_0x34d868['getVisible']())['filter'](_0x1e341b=>_0x1e341b),_0x5222a9=gt['getBoundingRect'](_0x30134c);if(!_0x5222a9)return Math['round'](_0x3de804['top']+_0x3de804['height']/0x2);const _0x18d97d=_0x1860a0['getIntersection'](_0x5222a9);if(!_0x18d97d)return Math['round'](_0x3de804['top']+_0x3de804['height']/0x2);const _0x4fb159=_0x3de804['getVisible'](),_0x1582d5=_0x4fb159&&_0x5222a9['height']>_0x4fb159['height'],_0x48cb40=_0x18d97d['top'],_0x11fd41=_0x18d97d['bottom'];if(_0x1582d5){const _0x8800e6=_0x1860a0['top']+_0x1860a0['height']/0x2-_0x33af14/0x2,_0x5d1351=_0x48cb40-ca-_0x1860a0['top'],_0x3f31f5=_0x1860a0['bottom']-_0x11fd41-ca;return _0x5d1351>=_0x33af14?Math['max'](ca,_0x48cb40-_0x33af14-ca):_0x3f31f5>=_0x33af14?_0x11fd41+ca:Math['max'](ca,_0x8800e6);}const _0x3eed5e=_0x48cb40-_0x33af14,_0x428b76=_0x1860a0['bottom']-_0x11fd41-ca,_0x53576e=_0x48cb40-ca-_0x1860a0['top'];let _0x39f61b;return _0x39f61b=_0x428b76>=_0x33af14?_0x11fd41+ca:_0x53576e>=_0x33af14?_0x3eed5e-ca:_0x48cb40+_0x5222a9['height']/0x2-_0x33af14/0x2,_0x39f61b;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x5ebb4b=this['_editor'];this['listenTo'](_0x5ebb4b['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x5ae652,data:{newRange:_0x31dc2d}}of _0x5ebb4b['model']['document']['differ']['getChangedMarkers']())if(_0x5ae652['startsWith']('ai-selection:')&&(_0x31dc2d&&(_0x31dc2d['start']['isEqual'](_0x31dc2d['end'])||'$graveyard'==_0x31dc2d['root']['rootName'])||null==_0x31dc2d)){const _0x3dce4d=ls(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x3dce4d),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x4457a9=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x4457a9['model']['document']);}['_getSelectionElements'](){const _0x4b39ab=this['_editor'];return _0x260303(_0x4b39ab['editing'],[..._0x4b39ab['model']['markers']['getMarkersGroup']('ai-selection'),..._0x4b39ab['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x6b04fb=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x6b04fb&&_0x6b04fb['rootName']?_0x6b04fb['rootName']:null;}},ua=class extends _0x226ece{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x10148f,_0x50df6b={}){super(_0x10148f),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x50df6b};const _0x3d3a59=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x3d3a59?'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'](_0x492adc){this['showChangesButton']['isEnabled']=_0x492adc;}['_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':_0x55835b,'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 _0x1fd65f=new Wt();_0x1fd65f['set']({'content':_0xd806a0}),_0x1fd65f['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'](_0x1fd65f);}['_setupShowChangesButton'](){this['showChangesButton']=new Pt(this['locale']),this['showChangesButton']['set']({'icon':_0x3bb8cb,'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',_0x2f0448=>_0x2f0448?tt:_0x3bb8cb),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(_0x189a5a,_0x42120e){super(_0x189a5a);const _0x504317=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']=_0x42120e,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x189a5a),this['_partToolbarView']=new Wn(_0x189a5a,_0x42120e['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x42120e),this['_stateView']=new Fn(_0x189a5a),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x189a5a,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x189a5a,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x26e7a4,_0x901c58,_0x205184,_0x161350)=>{let _0x9fae12,_0x4e5562;'pending'===_0x161350?(_0x9fae12=this['_partToolbarView'],_0x4e5562=this['_stateView']):(_0x9fae12=this['_stateView'],_0x4e5562=this['_partToolbarView']),this['_stateView']['setState'](_0x205184),_0x9fae12['isVisible']=!0x1,_0x4e5562['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x504317['to']('_state',_0x30d843=>'ck-ai-chat-balloon-main_state_'+_0x30d843)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x42120e);});}['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'](_0x39e1f2){_0x39e1f2?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x39e1f2);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x54aed3){this['_state']=_0x54aed3;}['showError'](_0x25a1b4){super['showError'](_0x25a1b4),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x132dfd){super['showBlockingError'](_0x132dfd),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x340782){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x340782;}['togglePartToolbarEnabled'](_0x25082f){this['_partToolbarView']['isEnabled']=_0x25082f;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x3feac8,showSuggestButton:_0x14c948}){_0x3feac8=_0x3feac8&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x14c948=_0x14c948&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x3feac8,'showSuggestButton':_0x14c948});}['_createNextButtonView'](){const _0x3db0a0=new Pt(this['locale']);return _0x3db0a0['set']({'icon':_0x7a9038,'label':ls(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x3db0a0['on']('execute',()=>{this['fire']('showNext');}),_0x3db0a0;}['_createPreviousButtonView'](){const _0x30c38a=new Pt(this['locale']);return _0x30c38a['set']({'icon':_0x3a61a1,'label':ls(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x30c38a['on']('execute',()=>{this['fire']('showPrevious');}),_0x30c38a;}},_a=class extends _0x223663{constructor(_0x527924,_0x3e56fe){super(_0x527924),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x3e56fe});}},ga=class extends _0x57cbc7{static get['requires'](){return[Ht,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0xabb2dd){super(_0xabb2dd),this['set']('showDiff',!0x1);}['open'](_0x39c9f0){const _0x26734d=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x26734d['plugins']['get']('AIBalloon')['open']({..._0x39c9f0,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x39c9f0['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x39c9f0['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x542195){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x542195);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x4749cd){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x4749cd);}['_createChatBalloonView'](){const _0x5ed227=this['editor'],_0x144f52=_0x5ed227['plugins']['get']('AIBalloon'),_0x56e74b=_0x5ed227['commands']['get']('trackChanges');let _0x2fe4e6=_0x5ed227['config']['get']('ai.availableReplyActions')||[...er];_0x5ed227['plugins']['has']('TrackChanges')||(_0x2fe4e6=_0x2fe4e6['filter'](_0x49d36f=>'insertSuggestion'!=_0x49d36f));const _0x15d0ba=new da(_0x5ed227['locale'],{'availableActions':_0x2fe4e6,'showApplyButton':!0x0,'showSuggestButton':!!_0x56e74b});return _0x15d0ba['bind']('showDiff')['to'](this),_0x15d0ba['delegate'](...Nn)['to'](this),_0x15d0ba['delegate']('showPrevious','showNext')['to'](this),_0x144f52['delegate']('dialogClosed')['to'](this),_0x15d0ba['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x15d0ba['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x15d0ba['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x56e74b&&_0x15d0ba['bind']('isTrackChangesOn')['to'](_0x56e74b,'value'),_0x15d0ba['render'](),_0x15d0ba;}['_toggleRotatorButtonsInDialogHeader'](_0x706d3d){const _0x1be0d7=this['editor'],_0x33bcc3=_0x1be0d7['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x706d3d),_0x33bcc3['has'](this['_chatBalloonView']['previousButtonView'])||(_0x33bcc3['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x1be0d7['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x33bcc3['remove'](this['_chatBalloonView']['previousButtonView']),_0x33bcc3['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x57cbc7{static get['requires'](){return[oa,ga,_0x98c72c];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x39a46e){const {editor:_0x463862,action:_0xf71ce1,withText:_0x7777ea=!0x1,withIcon:_0x568d3e=!0x0,isInDropdown:_0x2fbcea=!0x0,shouldPreventFocus:_0x571259=!0x1,actionButtons:_0xddeff5}=_0x39a46e;return()=>{const _0x28de9d=_0x463862['locale'],_0x2375c3=new Pt(_0x28de9d),_0x237aa9=_0x2375c3['bindTemplate'];_0x2fbcea&&_0x2375c3['extendTemplate']({'on':{'mouseenter':_0x237aa9['to'](()=>{_0x571259&&_0x571259()||_0x2375c3['focus']();})}}),_0xddeff5['push']({'buttonView':_0x2375c3,'action':_0xf71ce1});const _0x2bc01a=_0xf71ce1['icon']??_0xf71ce1['parent']?.['icon'];return _0x2375c3['set']({'label':_0xf71ce1['label'],'withText':_0x7777ea,'role':'menuitem','icon':_0x568d3e?_0x2bc01a??_0x5f28a7:void 0x0,'tooltip':!_0x7777ea,'class':'ck-ai-quick-actions-button','isEnabled':_0xf71ce1['isEnabled']}),_0x2375c3['on']('execute',()=>{_0x463862['editing']['view']['focus'](),_0x463862['commands']['execute']('aiQuickAction',_0xf71ce1);}),_0x2375c3;};}var pa=class extends qt{['arrowView'];constructor(_0x51edfc,_0x55713e){super(_0x51edfc,_0x55713e);const _0x526841=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',_0x541b5f=>String(_0x541b5f)),'data-cke-tooltip-disabled':_0x526841['to']('isOn')},'on':{'mouseenter':_0x526841['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x9cf2ae=new Wt();return _0x9cf2ae['content']=_0x569a5a,_0x9cf2ae['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x9cf2ae;}},ma=class extends zt{['_allListItems'];['_allSearchableItems'];constructor(_0x5e2c3e,_0x8153ba,_0x3f38b5){super(_0x5e2c3e),this['_allListItems']=_0x8153ba,this['_allSearchableItems']=_0x3f38b5;}['filter'](_0x58b3c9){if(!_0x58b3c9)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x1d38b0=_0x58b3c9['source']['toLowerCase']()['trim'](),_0x502325=this['_allSearchableItems']['filter'](_0x408e25=>(_0x408e25['groupLabel']?_0x408e25['label']+'\x20('+_0x408e25['groupLabel']+')':_0x408e25['label'])['toLowerCase']()['includes'](_0x1d38b0));return this['items']['clear'](),this['items']['addMany'](_0x502325['sort']((_0x14d907,_0x3a40af)=>{const _0x298a8d=_0x14d907['groupLabel'],_0x5bb0f0=_0x3a40af['groupLabel'];return _0x298a8d||_0x5bb0f0?_0x298a8d?0x1:-0x1:0x0;})['map'](_0x48d503=>_0x48d503['item'])),this['_highlightQuery'](_0x1d38b0,_0x502325),{'resultsCount':_0x502325['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x355850,_0x245e59){if(!_0x355850)return;const _0x3d822a=new RegExp(_0x423e56(_0x355850),'gi');_0x245e59['forEach'](_0x22280e=>{_0x22280e['highlightViews']&&_0x22280e['highlightViews']['forEach'](_0x4e0f8a=>{'function'==typeof _0x4e0f8a['highlightText']&&_0x4e0f8a['highlightText'](_0x3d822a);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x442867=>{_0x442867['highlightViews']&&_0x442867['highlightViews']['forEach'](_0x5423bb=>{'function'==typeof _0x5423bb['highlightText']&&_0x5423bb['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x223663{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x315250,_0x24b7a3,_0x4e59f2,_0x55268d,_0x19ffbc=!0x1,_0x164b57=[]){const _0x364fb7=_0x315250['locale'];super(_0x364fb7),this['_bodyCollection']=_0x55268d,this['_hasSearch']=_0x19ffbc,this['_actionButtons']=_0x164b57;const _0x7d7765=this['_createListItems'](_0x315250,_0x24b7a3,_0x4e59f2);this['optionsListView']=new ma(_0x364fb7,_0x7d7765,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x7d7765),this['focusTracker']=new ut(),this['keystrokes']=new dt(),_0x19ffbc&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x7d7765,this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x19ffbc&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0xb750c9=_0x19ffbc&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x218b6e(_0xb750c9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x364fb7['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x4c1723(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 _0x84554c=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x84554c);}['_createListItems'](_0x48aed9,_0xa99b1d,_0x3863f4){const _0x12224a=new _0x218b6e();return _0xa99b1d['forEach'](_0x1752e1=>{if('actions'in _0x1752e1){const {listItem:_0x1b0b1d}=this['_createActionGroupButton'](_0x48aed9,_0x1752e1,_0x3863f4);_0x12224a['add'](_0x1b0b1d),_0x1752e1['actions']['forEach'](_0x31964b=>{const {listItem:_0x563823,highlightViews:_0x177d8e}=this['_createSearchResultActionButton'](_0x48aed9,_0x31964b,_0x1752e1['label'],_0x1752e1['icon']);this['_allSearchableItems']['push']({'item':_0x563823,'label':_0x31964b['label'],'groupLabel':_0x1752e1['label'],'highlightViews':_0x177d8e});});}else{const {listItem:_0x50956d}=this['_createActionButton'](_0x48aed9,_0x1752e1);_0x12224a['add'](_0x50956d);const _0x240f49=_0x50956d['children']['first'];if(_0x240f49){const {listItem:_0x427058,highlightViews:_0x144658}=this['_createSearchResultActionButton'](_0x48aed9,_0x1752e1);this['_allSearchableItems']['push']({'item':_0x427058,'label':_0x240f49['label']||'','highlightViews':_0x144658});}}}),_0x12224a;}['_createActionButton'](_0x3e313a,_0x4d01a9,_0x68713f,_0x29d590){const _0x2d34cd=new Xt(this['locale']);if(_0x68713f&&_0x29d590){const _0x3b86e9=new Pt(this['locale']),_0x30bbca=_0x3b86e9['bindTemplate'],_0x1cad12=new Kt();_0x1cad12['text']=_0x4d01a9['label'];const _0xf4bd18=new Kt();_0xf4bd18['text']=_0x68713f;const _0x557c5d=new Wt();_0x557c5d['content']=_0x29d590,_0x557c5d['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5e1a95=new _0x223663(this['locale']);_0x5e1a95['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x3ddb38=new _0x223663(this['locale']);return _0x3ddb38['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3b86e9['set']({'label':_0x4d01a9['label']+'\x20('+_0x68713f+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x4d01a9['isEnabled']}),_0x3b86e9['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x30bbca['if']('isEnabled','ck-disabled',_0x421a1b=>!_0x421a1b)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1cad12,_0x5e1a95,_0x557c5d,_0xf4bd18,_0x3ddb38],'on':{'mouseenter':_0x30bbca['to'](()=>{this['_isSearchFocused']()||_0x3b86e9['focus']();}),'click':_0x30bbca['to'](()=>{_0x3b86e9['fire']('execute');})}}),_0x3b86e9['on']('execute',()=>{_0x3b86e9['isEnabled']&&(_0x3e313a['editing']['view']['focus'](),_0x3e313a['commands']['execute']('aiQuickAction',_0x4d01a9));}),_0x2d34cd['children']['add'](_0x3b86e9),this['_actionButtons']['push']({'buttonView':_0x3b86e9,'action':_0x4d01a9}),{'listItem':_0x2d34cd,'highlightViews':[_0x1cad12,_0xf4bd18]};}{const _0x3aa105=new Dt(),_0x1e4326=new Pt(this['locale'],_0x3aa105),_0x4b9be0=_0x1e4326['bindTemplate'],_0x3c91a2=_0x4d01a9['icon']??_0x4d01a9['parent']?.['icon'],_0x155af4=void 0x0!==_0x4d01a9['icon'];return _0x1e4326['set']({'label':_0x4d01a9['label'],'withText':!0x0,'role':'menuitem','icon':_0x155af4?_0x3c91a2??_0x5f28a7:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x4d01a9['isEnabled']}),_0x1e4326['extendTemplate']({'on':{'mouseenter':_0x4b9be0['to'](()=>{this['_isSearchFocused']()||_0x1e4326['focus']();})}}),_0x1e4326['on']('execute',()=>{_0x3e313a['editing']['view']['focus'](),_0x3e313a['commands']['execute']('aiQuickAction',_0x4d01a9);}),_0x2d34cd['children']['add'](_0x1e4326),this['_actionButtons']['push']({'buttonView':_0x1e4326,'action':_0x4d01a9}),{'listItem':_0x2d34cd,'highlightViews':[_0x3aa105]};}}['_createSearchResultActionButton'](_0x1126cb,_0x4a8d86,_0x9cfeb6,_0x5242dd){return _0x9cfeb6&&_0x5242dd?this['_createSearchResultGroupedActionButton'](_0x1126cb,_0x4a8d86,_0x9cfeb6,_0x5242dd):this['_createSearchResultIndividualActionButton'](_0x1126cb,_0x4a8d86);}['_createSearchResultGroupedActionButton'](_0x5d941,_0x71e6b8,_0x38ae32,_0x28368d){const _0x12cfe8=new Xt(this['locale']),_0x2c397c=new Pt(this['locale']),_0xb6b480=_0x2c397c['bindTemplate'],{view:_0x353c70,highlightView:_0x203330}=this['_createSearchResultGroupRow'](_0x38ae32,_0x28368d),{view:_0x2190ed,highlightView:_0x2cbbdc}=this['_createSearchResultActionRow'](_0x71e6b8['label']),_0x1d36ac=this['_createSearchResultContentView'](_0x353c70,_0x2190ed);return _0x2c397c['set']({'label':_0x71e6b8['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':_0x71e6b8['isEnabled']}),_0x2c397c['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',_0xb6b480['if']('isEnabled','ck-disabled',_0x89cebf=>!_0x89cebf)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1d36ac],'on':{'mouseenter':_0xb6b480['to'](()=>{this['_isSearchFocused']()||_0x2c397c['focus']();}),'click':_0xb6b480['to'](()=>{this['_handleSearchResultButtonClick'](_0x2c397c);})}}),this['_setupActionButtonExecution'](_0x2c397c,_0x5d941,_0x71e6b8),_0x12cfe8['children']['add'](_0x2c397c),this['_actionButtons']['push']({'buttonView':_0x2c397c,'action':_0x71e6b8}),{'listItem':_0x12cfe8,'highlightViews':[_0x203330,_0x2cbbdc]};}['_createSearchResultIndividualActionButton'](_0x5f3e11,_0x223e64){const _0x49bbe8=new Xt(this['locale']),_0x1ea29b=new Dt(),_0x417ae3=new Pt(this['locale'],_0x1ea29b),_0x454819=_0x417ae3['bindTemplate'];return _0x417ae3['set']({'label':_0x223e64['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x223e64['isEnabled']}),_0x417ae3['extendTemplate']({'on':{'mouseenter':_0x454819['to'](()=>{this['_isSearchFocused']()||_0x417ae3['focus']();})}}),this['_setupActionButtonExecution'](_0x417ae3,_0x5f3e11,_0x223e64),_0x49bbe8['children']['add'](_0x417ae3),this['_actionButtons']['push']({'buttonView':_0x417ae3,'action':_0x223e64}),{'listItem':_0x49bbe8,'highlightViews':[_0x1ea29b]};}['_createSearchResultGroupRow'](_0x58741b,_0x13d8a5){const _0x177c71=new _0x223663(this['locale']),_0x33e2db=new Wt();_0x33e2db['content']=_0x13d8a5,_0x33e2db['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x1286ff=new Kt();return _0x1286ff['text']=_0x58741b,_0x177c71['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x33e2db,_0x1286ff]}),{'view':_0x177c71,'highlightView':_0x1286ff};}['_createSearchResultActionRow'](_0x2c4e90){const _0x37bd7c=new _0x223663(this['locale']),_0x10117f=new Kt();return _0x10117f['text']=_0x2c4e90,_0x37bd7c['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x10117f]}),{'view':_0x37bd7c,'highlightView':_0x10117f};}['_createSearchResultContentView'](_0x180e0d,_0x452088){const _0x525391=new _0x223663(this['locale']);return _0x525391['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x180e0d,_0x452088]}),_0x525391;}['_setupActionButtonExecution'](_0x34102a,_0x4d6b09,_0x4e7c6d){_0x34102a['on']('execute',()=>{_0x34102a['isEnabled']&&(_0x4d6b09['editing']['view']['focus'](),_0x4d6b09['commands']['execute']('aiQuickAction',_0x4e7c6d));});}['_createActionGroupButton'](_0x2214b4,_0x2182ac,_0x1ff3f2){const _0x4ac5b5=new Xt(this['locale']),_0x3e38cb=new Dt(),_0x399b58=new pa(this['locale'],_0x3e38cb),_0x2eaaca=_0x399b58['bindTemplate'],_0x230133=this['_getPanelKeystroke'](_0x1ff3f2),_0x53cd0b=this['_createGroupActionsList'](_0x2214b4,_0x2182ac['actions'],_0x1ff3f2);_0x399b58['set']({'label':_0x2182ac['label'],'withText':!0x0,'role':Ta,'icon':_0x2182ac['icon']??_0x5f28a7,'isEnabled':_0x2182ac['actions']['some'](_0x15e20a=>_0x15e20a['isEnabled'])}),_0x399b58['extendTemplate']({'on':{'mouseenter':_0x2eaaca['to'](()=>{this['_isSearchFocused']()||_0x399b58['focus']();})}});const _0x488ff8=new Nt(this['locale']);return _0x488ff8['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x2eaaca['to'](_0x513786=>{this['_handlePanelKeydown'](_0x513786,_0x230133,_0x399b58,_0x488ff8);})}}),_0x399b58['bind']('isOn')['to'](_0x488ff8,'isVisible'),this['_bodyCollection']['add'](_0x488ff8),_0x488ff8['content']['add'](_0x53cd0b),this['_setupGroupMenuBehavior'](_0x399b58,_0x488ff8),_0x4ac5b5['children']['add'](_0x399b58),this['_actionButtons']['push']({'buttonView':_0x399b58,'action':_0x2182ac}),{'listItem':_0x4ac5b5,'highlightView':_0x3e38cb};}['_createGroupActionsList'](_0x3e4ab7,_0x12f9b3,_0x214553){const _0x173f2d=new zt(this['locale']);return _0x173f2d['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x12f9b3['forEach'](_0x3d7946=>{const _0x197886=new Xt(this['locale']),_0x22b5be=Ia({'editor':_0x3e4ab7,'action':_0x3d7946,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x197886['children']['add'](_0x22b5be),_0x214553['focusTracker']['add'](_0x22b5be),_0x173f2d['items']['add'](_0x197886);}),_0x173f2d;}['_setupGroupMenuBehavior'](_0x37adeb,_0x21709e){const _0x3db57c=_0x37adeb['bindTemplate'],_0x3a6c06=this['_getButtonKeystroke'](_0x37adeb);_0x37adeb['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x3db57c['to'](()=>{this['_showNestedPanel'](_0x21709e,_0x37adeb);}),'mouseleave':_0x3db57c['to'](_0x242541=>{const _0x3257f0=_0x242541['relatedTarget'];this['_isMovingToNestedMenu'](_0x3257f0,_0x21709e)||this['_hideNestedPanel'](_0x21709e);}),'keydown':_0x3db57c['to'](_0xf5ba11=>{_0xf5ba11['key']==_0x3a6c06&&(this['_showNestedPanel'](_0x21709e,_0x37adeb),_0x21709e['content']['get'](0x0)['focus']());})}}),_0x21709e['on']('render',()=>{_0x21709e['element']?.['addEventListener']('mouseleave',_0x2620a2=>{const _0x3f0143=_0x2620a2['relatedTarget'];_0x37adeb['element']?.['contains'](_0x3f0143)||this['_isMovingToNestedMenu'](_0x3f0143,_0x21709e)||this['_hideNestedPanel'](_0x21709e);});});}['_showNestedPanel'](_0xaa45b3,_0x779644){this['_openNestedPanels']['forEach'](_0x32ab30=>{_0x32ab30!==_0xaa45b3&&_0x32ab30['isVisible']&&_0x32ab30['hide']();}),_0xaa45b3['show'](),_0xaa45b3['pin']({'positions':[Vt['eastSouth']],'target':_0x779644['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0xaa45b3);}['_hideNestedPanel'](_0x1f7006){_0x1f7006['hide'](),this['_openNestedPanels']['delete'](_0x1f7006);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x3dc494=>_0x3dc494['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x2fae35,_0x2ae50a){if(!_0x2fae35)return!0x1;if(_0x2ae50a['element']?.['contains'](_0x2fae35))return!0x0;const _0x2f31b4=_0x2fae35;return _0x2f31b4['closest']&&(null!==_0x2f31b4['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x2f31b4['closest']('.ck-ai-quick-actions-group-list')||null!==_0x2f31b4['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'](_0x23bddc){return'rtl'===_0x23bddc['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x455706){return'rtl'===_0x455706['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x4cd0d1,_0x1cd96c,_0x11ce88,_0x59e79e){_0x4cd0d1['key']==_0x1cd96c&&(_0x11ce88['focus'](),this['_hideNestedPanel'](_0x59e79e));}['_handleSearchResultButtonClick'](_0x3d6a7f){_0x3d6a7f['fire']('execute');}};function Ca(_0x133b0c){const {editor:_0x7900e6,content:_0x29b5b2,buttonDefinition:_0xd22bfe,bodyCollection:_0xa3e7b3,hasSearch:_0x4cd59c=!0x1,actionButtons:_0x5519a2}=_0x133b0c;return()=>{const _0x4e4594=_0x7900e6['locale'],_0x57ca68=_0x7900e6['commands']['get']('aiQuickAction'),_0x38ddff=_0x1c0a67(_0x4e4594);_0x38ddff['bind']('isEnabled')['to'](_0x57ca68),_0x38ddff['buttonView']['set']({'icon':_0xd22bfe['icon']??_0x5f28a7,'label':_0xd22bfe['label'],'tooltip':!0x0}),_0x38ddff['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x3ec5f8=new wa(_0x7900e6,_0x29b5b2,_0x38ddff,_0xa3e7b3,_0x4cd59c,_0x5519a2);return _0x38ddff['panelView']['children']['add'](_0x3ec5f8),_0x4cd59c&&_0x38ddff['on']('change:isOpen',(_0x1725ba,_0x417f67,_0x1250e7)=>{if(_0x1250e7){if(_0x7900e6['plugins']['has']('AIEditing')){const _0x49e5f4=_0x7900e6['plugins']['get'](As),_0x5ef2fa=_0x7900e6['model']['document']['selection'],_0x2f9bf8=Array['from'](_0x5ef2fa['getRanges']());_0x2f9bf8['length']>0x0&&_0x49e5f4['showFakeVisualSelection']({'editor':_0x7900e6,'ranges':_0x2f9bf8,'id':'quick-action','priority':0x14});}}else _0x7900e6['plugins']['has']('AIEditing')&&_0x7900e6['plugins']['get'](As)['hideFakeVisualSelection']('quick-action'),_0x3ec5f8['resetSearch']();}),_0x38ddff;};}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 _0x57cbc7{['_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 _0x2fbea3=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x2fbea3),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x17d112){return function(_0x247117){const _0x1f3e4b=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x247117['uiLanguage'])||'English';return[{'id':'ask-ai','label':ls(_0x247117,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x4c8f4e},{'id':'chat-commands','label':ls(_0x247117,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x4c8f4e,'actions':[{'id':'explain','label':ls(_0x247117,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':ls(_0x247117,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x1f3e4b),'type':'chat'},{'id':'summarize','label':ls(_0x247117,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':ls(_0x247117,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x1f3e4b),'type':'chat'},{'id':'highlight-key-points','label':ls(_0x247117,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':ls(_0x247117,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x1f3e4b),'type':'chat'}]},{'id':'improve-writing','label':ls(_0x247117,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x351374},{'id':'continue','label':ls(_0x247117,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x47ccb8},{'id':'fix-grammar','label':ls(_0x247117,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x153970},{'id':'adjust-length','label':ls(_0x247117,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x3b6470,'actions':[{'id':'make-shorter','label':ls(_0x247117,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':ls(_0x247117,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':ls(_0x247117,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3b03c5,'actions':[{'id':'make-tone-casual','label':ls(_0x247117,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':ls(_0x247117,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':ls(_0x247117,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':ls(_0x247117,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':ls(_0x247117,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x499c30,'actions':[{'id':'translate-to-english','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':ls(_0x247117,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':ls(_0x247117,'AI_QUICK_ACTIONS_OTHER'),'icon':_0xd06406,'actions':[]}];}(_0x17d112);}['_getDefaultAndCustomActions'](){const _0x320cee=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x3d4237=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x121922=>({..._0x121922,'type':'chat'===_0x121922['type']?'chat':'action','icon':void 0x0}));return _0x320cee['find'](_0x3c48ba=>'other'===_0x3c48ba['id'])['actions']['push'](..._0x3d4237),_0x320cee;}async['_initActionTypeQuickActions'](){try{const _0x386d6e=new Xs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x3757f3=await _0x386d6e['getAll'](),_0x338253=(await _0x386d6e['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x338253),this['_enableButtonsByType']('action',_0x214a5c=>!!_0x3757f3['find'](_0x11c78f=>_0x11c78f['id']===_0x214a5c['model'])||void 0x0===_0x214a5c['model']);}catch(_0x308ee4){const _0x219c9f=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x308ee4});this['_reporter']['logError'](_0x219c9f);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x18dbaf=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x18dbaf,'change:isConversationReady',(_0x569841,_0xf60fe9,_0x48c199)=>{_0x48c199&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x18dbaf['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x3ecddf,_0x38d234){this['_quickActionsDefinition']['forEach'](_0x128640=>{'actions'in _0x128640?_0x128640['actions']['forEach'](_0x103d5d=>{_0x103d5d['type']===_0x3ecddf&&(_0x103d5d['isEnabled']=_0x38d234(_0x103d5d));}):_0x128640['type']===_0x3ecddf&&(_0x128640['isEnabled']=_0x38d234(_0x128640));}),this['_actionButtons']['forEach'](_0x155e30=>{if(va(_0x155e30['action']))return;if(_0x155e30['action']['type']!==_0x3ecddf)return;const _0x46ff94=_0x38d234(_0x155e30['action']);if(_0x155e30['action']['isEnabled']=_0x46ff94,_0x155e30['buttonView']['isEnabled']=_0x46ff94,!_0x46ff94&&_0x155e30['action']['model']){const _0x11159d=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x155e30['action']['id'],'modelId':_0x155e30['action']['model']});this['_reporter']['logError'](_0x11159d);}}),this['_actionButtons']['filter'](_0x1e0878=>va(_0x1e0878['action']))['forEach'](_0x3d93a8=>{_0x3d93a8['buttonView']['isEnabled']=_0x3d93a8['action']['actions']['some'](_0x33c92a=>_0x33c92a['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x7df1fa,group:_0x8d0e93})=>{_0x7df1fa['isEnabled']=_0x8d0e93['actions']['some'](_0x33caf1=>_0x33caf1['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0xa5e24){this['_actionButtons']['forEach'](_0x1f3811=>{va(_0x1f3811['action'])||'action'===_0x1f3811['action']['type']&&(_0x1f3811['action']['model']||(_0x1f3811['action']['model']=_0xa5e24));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x5a78ba=new xt(this['editor']['locale']);_0x5a78ba['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x5a78ba),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x5a78ba);}['_initializeQuickActionsDropdown'](_0x4a8463){const _0xb0859c=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x5f28a7,'label':ls(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x4a8463,'hasSearch':_0xb0859c,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x583561){this['_quickActionsDefinition']=_0x583561['map'](_0x16d6ca=>{if('actions'in _0x16d6ca){const _0x4f6d05=_0x16d6ca;return{..._0x4f6d05,'actions':_0x4f6d05['actions']['map'](_0x2752f4=>{const {actions:_0x3e470d,..._0x3382b4}=_0x4f6d05;return{..._0x2752f4,'isEnabled':!0x1,'parent':_0x3382b4};})['filter'](_0xf9216c=>this['_shouldIncludeAction'](_0xf9216c))};}return{..._0x16d6ca,'isEnabled':!0x1};})['filter'](_0x5210f1=>'actions'in _0x5210f1?_0x5210f1['actions']['length']>0x0:this['_shouldIncludeAction'](_0x5210f1));}['_shouldIncludeAction'](_0x4f7fea){const _0x58e212=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x4f7fea['type']])&&!_0x58e212['includes'](_0x4f7fea['id'])&&!('chat'===_0x4f7fea['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x10a065){this['_quickActionsDefinition']['forEach'](_0x1d44eb=>{if('actions'in _0x1d44eb){const _0x3409f2=Ca({'editor':this['editor'],'content':_0x1d44eb['actions'],'buttonDefinition':_0x1d44eb,'bodyCollection':_0x10a065,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1d44eb['id'],_0x3409f2),_0x1d44eb['actions']['forEach'](_0x4c61bd=>{const _0x38ba9e=Ia({'editor':this['editor'],'action':_0x4c61bd,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4c61bd['id'],_0x38ba9e);});}else{const _0x18be31=Ia({'editor':this['editor'],'action':_0x1d44eb,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1d44eb['id'],_0x18be31);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x116fa1=>{const _0x39b78c=this['editor']['commands']['get']('aiQuickAction'),_0x40b01e=new te(_0x116fa1),_0x13de7e=ls(_0x116fa1,'AI_QUICK_ACTIONS_HEADING');_0x40b01e['buttonView']['set']({'label':_0x13de7e,'icon':_0x5f28a7});const _0x31c688=new Zt(_0x116fa1);return _0x31c688['set']({'ariaLabel':_0x13de7e,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x30125e=>{if('actions'in _0x30125e){const _0x258f2e=_0x30125e,_0x35213a=new Jt(_0x116fa1,_0x40b01e),_0x5ebb36=new te(_0x116fa1),_0x46545a=new Zt(_0x116fa1);_0x5ebb36['buttonView']['set']({'label':_0x258f2e['label'],'icon':_0x258f2e['icon']}),_0x258f2e['actions']['forEach'](_0x2d0f98=>{const _0x4f5486=new Jt(_0x116fa1,_0x5ebb36),_0x4c2500=new jt(_0x116fa1);_0x4c2500['set']({'label':_0x2d0f98['label'],'icon':_0x2d0f98['icon'],'role':'menuitem','isEnabled':_0x2d0f98['isEnabled']}),_0x4c2500['on']('execute',()=>{this['_executeQuickAction'](_0x2d0f98);}),this['_actionButtons']['push']({'buttonView':_0x4c2500,'action':_0x2d0f98}),_0x4c2500['delegate']('execute')['to'](_0x5ebb36),_0x4f5486['children']['add'](_0x4c2500),_0x46545a['items']['add'](_0x4f5486);}),_0x5ebb36['isEnabled']=_0x258f2e['actions']['some'](_0xe1086b=>_0xe1086b['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x5ebb36,'group':_0x258f2e}),_0x5ebb36['panelView']['children']['add'](_0x46545a),_0x35213a['children']['add'](_0x5ebb36),_0x31c688['items']['add'](_0x35213a);}else{const _0x193abc=_0x30125e,_0x54de5c=new Jt(_0x116fa1,_0x40b01e),_0x17efd9=new jt(_0x116fa1);_0x17efd9['set']({'label':_0x193abc['label'],'icon':_0x193abc['icon'],'role':'menuitem','isEnabled':_0x193abc['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x17efd9,'action':_0x193abc}),_0x17efd9['on']('execute',()=>{this['_executeQuickAction'](_0x193abc);}),_0x17efd9['delegate']('execute')['to'](_0x40b01e),_0x54de5c['children']['add'](_0x17efd9),_0x31c688['items']['add'](_0x54de5c);}}),Object['values'](Ra)['some'](_0x46eeb7=>this['editor']['plugins']['has'](_0x46eeb7))?_0x40b01e['bind']('isEnabled')['to'](_0x39b78c):_0x40b01e['set']({'isEnabled':!0x1}),_0x40b01e['panelView']['children']['add'](_0x31c688),_0x40b01e;});}['_executeQuickAction'](_0x2eee4c){const _0xeb4689=this['editor'];_0xeb4689['editing']['view']['focus'](),_0xeb4689['commands']['execute']('aiQuickAction',_0x2eee4c);const _0x3300a7=_0xeb4689['ui']['view']['menuBarView'];_0x3300a7&&_0x3300a7['close']&&_0x3300a7['close']();}};function va(_0x446502){return'actions'in _0x446502;}function ka(_0x5e9cc4,_0x480ed1){const _0x257979=_0x5e9cc4['plugins']['get']('AITabs')['view'];_0x257979['isVisible']=!0x0,_0x257979['activateTab'](_0x480ed1);}var Na=class extends _0x28a08e{['execute'](_0xfa7d77){switch(this['_expandSelectionIfCollapsed'](),_0xfa7d77['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x269dc3=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x269dc3});}this['_handleAIChatAction'](_0xfa7d77);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x26fa50=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x26fa50});}this['_handleAIActionsAction'](_0xfa7d77);}}async['_handleAIChatAction'](_0x591e15){const _0xba9e3c=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x591e15['id'])_0xba9e3c['removeSelectionFromChatContext'](),_0xba9e3c['addSelectionToChatContext'](this['editor']),_0xba9e3c['focusPromptInput']();else await _0xba9e3c['startConversation']({'modelId':_0x591e15['model']}),_0xba9e3c['removeSelectionFromChatContext'](),_0xba9e3c['addSelectionToChatContext'](this['editor']),_0xba9e3c['focusPromptInput'](),await _0xba9e3c['sendMessage']({'message':_0x591e15['prompt']||_0x591e15['displayedPrompt']||_0x591e15['label'],'attributes':{'quickActionData':{'id':_0x591e15['id']},'displayedPrompt':_0x591e15['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0xf9c93b=this['editor'],_0xbc4260=_0xf9c93b['model']['document']['selection'];if(!_0xbc4260['isCollapsed'])return;const _0x1c8605=pt(_0xbc4260['getSelectedBlocks']())||_0xf9c93b['model']['schema']['getLimitElement'](_0xbc4260);_0xf9c93b['model']['change'](_0x27df44=>{_0x27df44['setSelection'](_0x1c8605,'in');});}['_handleAIActionsActionLabel'](_0x48ffa2){return _0x48ffa2['parent']?.['label']&&'other'!==_0x48ffa2['parent']?.['id']?_0x48ffa2['parent']['label']+':\x20'+_0x48ffa2['label']:_0x48ffa2['label'];}async['_handleAIActionsAction'](_0x3e7714){const _0x494daa=this['editor']['plugins']['get']('AIActions'),_0x11675b=_0x3e7714['prompt']?{'userMessage':_0x3e7714['prompt'],'model':_0x3e7714['model']}:{'actionName':_0x3e7714['actionName']||_0x3e7714['id'],'args':_0x3e7714['args']},_0x5a0c5e=this['_handleAIActionsActionLabel'](_0x3e7714);await _0x494daa['executeAction'](_0x11675b,_0x5a0c5e,_0x3e7714['icon']);}},ya=class extends _0x57cbc7{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5009a4=this['editor'],_0xdf63b3=new Na(this['editor']);if(_0x5009a4['commands']['add']('aiQuickAction',_0xdf63b3),_0x5009a4['plugins']['has']('AIChat')){const _0x10314e=this['editor']['plugins']['get']('AIChatController');_0x5009a4['model']['document']['selection']['on']('change:range',(_0x4067a0,_0x37e8a9)=>{_0x37e8a9['directChange']&&_0x10314e['removeSelectionFromChatContext']();});}}},xa=class extends _n{['appendContent'](_0x58b5c5,_0x51969b='text'){'modification'===this['type']&&'text'===_0x51969b&&(_0x51969b=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x58b5c5,_0x51969b);}['updateChangeGroups'](_0x3c70d5){const _0x32b068=this['parsedContent']['get'](_0x3c70d5)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x3c70d5,_0x32b068),this['changeGroups']=[],0x0==_0x32b068['childNodes']['length'])return;Ps(this['documentContextContent']['get'](_0x3c70d5),this['parsedMergedContent']['get'](_0x3c70d5));const _0x1b03b1=_0x2800ac(this['documentContextContent']['get'](_0x3c70d5)['children']['map'](_0x229c08=>({'node':_0x229c08,'id':Cs(_0x229c08,'data-id')})),_0x32b068['children']['map'](_0x3a9867=>({'node':_0x3a9867,'id':Cs(_0x3a9867,'data-id')||Ot()})),{'comparator':(_0xc87954,_0x567388)=>_0xc87954['id']==_0x567388['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x1b03b1['length']&&_0x1b03b1[_0x1b03b1['length']-0x1]['removed'];)_0x1b03b1['pop']();}const _0x28e9ed=_0x1b03b1['map'](_0x6515be=>{const _0x14423c=_0x6515be['added']?'new':_0x6515be['removed']?'removed':'modified';return{'node':_0x6515be['value'][0x0]['node'],'type':_0x14423c,'id':_0x6515be['value'][0x0]['id']};}),_0x3101e3=this['_documentIdToSource']['get'](_0x3c70d5);this['changeGroups']['push']({'changes':_0x28e9ed,'state':'pending','index':this['changeGroups']['length'],'editor':_0x3101e3['editor'],'rootName':_0x3101e3['rootName'],'documentId':_0x3c70d5});}['_getDifferentChangeGroups'](_0x3445ca,_0x217122){return _0x217122;}},La=class extends In{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x328a3f){super(_0x328a3f),this['content']=_0x328a3f['content'],this['version']=_0x328a3f['version'],this['editor']=_0x328a3f['editor'],this['rootName']=_0x328a3f['rootName'],this['actionName']=_0x328a3f['actionName'],this['args']=_0x328a3f['args'],this['userMessage']=_0x328a3f['userMessage'],this['model']=_0x328a3f['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'](_0x1c14de){const _0xf4e09e=this['editor']['config']['get']('collaboration.channelId'),_0x28769e=new xa({..._0x1c14de,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0xf4e09e,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0xf4e09e,this['editor']]])});return this['replies']['push'](_0x28769e),_0x28769e['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x28769e),_0x28769e;}},Da=class extends _0x226ece{constructor(_0x3a8bcc,_0x240f17=!0x0,_0x1b3fb2=!0x0){super(_0x3a8bcc),this['set']('isEnabled',!0x1),_0x240f17&&(this['applyButton']=this['_createButton'](ls(_0x3a8bcc,'AI_BALLOON_APPLY_BUTTON'),an),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x1b3fb2&&(this['suggestButton']=this['_createButton'](ls(_0x3a8bcc,'AI_BALLOON_SUGGEST_BUTTON'),_0x240f17?hn:an),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x240f17,'showSuggestButton':_0x1b3fb2}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x159b63,showSuggestButton:_0x28d214}){this['applyButton']&&(this['applyButton']['isVisible']=_0x159b63),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x28d214);}['_createButton'](_0x248f18,_0x4c379c){const _0x4e2bea=new Pt(this['locale']);return _0x4e2bea['set']({'label':_0x248f18,'class':_0x4c379c,'isVisible':!0x0,'withText':!0x0}),_0x4e2bea;}},Pa=class extends _0x223663{constructor(_0x906caa){super(_0x906caa),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(_0x906caa,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x223663{constructor(_0x16cc91){super(_0x16cc91),this['set']('isVisible',!0x0);const _0x3850fd=new cr('small');_0x3850fd['isVisible']=!0x0;const _0x2734a0=new _0x223663(this['locale']);_0x2734a0['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',_0x8163d3=>!_0x8163d3)]},'children':[_0x3850fd,_0x2734a0]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x14079f,_0x51be31){super(_0x14079f),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x51be31,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 _0x218b6e(),this['_addContentWrapper'](_0x51be31),this['_addDisclaimerView'](),this['_addToolbar'](_0x51be31),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'](_0x51be31);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x2e608c of this['_focusables'])this['_focusTracker']['add'](_0x2e608c['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x30ccc9){-0x1===_0x30ccc9?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x36170b){this['_isLoading']=_0x36170b;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x366976){super['showError'](_0x366976),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x16ad36){super['showBlockingError'](_0x16ad36),this['setErrorState']();}['addMiniToolbarItem'](_0x335cfd){this['_miniToolbarView']['items']['has'](_0x335cfd)||this['_miniToolbarView']['items']['add'](_0x335cfd);}['removeMiniToolbarItem'](_0x3558bf){this['_miniToolbarView']['items']['has'](_0x3558bf)&&this['_miniToolbarView']['items']['remove'](_0x3558bf);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0xe1f6de,showSuggestButton:_0x55f9d4}){_0xe1f6de=_0xe1f6de&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x55f9d4=_0x55f9d4&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0xe1f6de,'showSuggestButton':_0x55f9d4});}async['updateContent'](_0x5a29b0){await this['_streamableContentView']['update'](_0x5a29b0);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x4066d5){this['_contentWrapper']=new _0x223663(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'](_0x4066d5['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x36f43c,showSuggestButton:_0x548751}){this['_toolbarView']=new Da(this['locale'],_0x36f43c,_0x548751),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',(_0x217902,_0x4b09e4,_0x3899db)=>!(_0x217902||_0x4b09e4||_0x3899db)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x36f43c,'showSuggestButton':_0x548751}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x425eef){return this['_miniToolbarView']=new ua(this['locale'],_0x425eef),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',(_0x2760b8,_0x398825)=>!(_0x2760b8||_0x398825)),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 _0x3ea0f9=new Pt(this['locale']),_0x4b9b78=new Pt(this['locale']),_0x53f321=new Va(this['locale']),_0x4b1509=new Pt(this['locale']);_0x3ea0f9['set']({'icon':_0x4129a3,'label':ls(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+cn}),_0x4b9b78['set']({'icon':_0x11934f,'tooltip':ls(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+cn}),_0x4b1509['set']({'icon':_0x3683e0,'tooltip':ls(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+cn}),_0x3ea0f9['bind']('isEnabled')['to'](this,'isBusy',_0x37e8e8=>!_0x37e8e8),_0x3ea0f9['on']('execute',()=>{this['fire']('tryAgain');}),_0x4b9b78['bind']('isEnabled')['to'](this,'isBusy',_0x504d0c=>!_0x504d0c),_0x4b9b78['on']('execute',()=>{this['fire']('showPrevious');}),_0x4b1509['bind']('isEnabled')['to'](this,'isBusy',_0x23a464=>!_0x23a464),_0x4b1509['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x4b9b78,this['_navigationCounter']=_0x53f321,this['_navigationNextButton']=_0x4b1509,this['_navigationTryAgainButton']=_0x3ea0f9;}['updateMiniToolbarButtons'](_0x2ac2cd,_0x538ef0){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x3c49e0=_0x2ac2cd>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x3c49e0){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x1b3cd5=_0x2ac2cd-_0x538ef0;this['_navigationCounter']['setInteractionCount'](_0x1b3cd5+'/'+_0x2ac2cd),this['_navigationPreviousButton']['isEnabled']=_0x538ef0<_0x2ac2cd-0x1,this['_navigationNextButton']['isEnabled']=_0x538ef0>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'](_0x46571b){this['_isLoading']=_0x46571b;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x16115f=this['_streamableContentView']['element'],_0x25ff52=this['_miniToolbarView']['element'],_0x117f19=()=>{Et['window']['requestAnimationFrame'](()=>{const _0x3ad574=_0x16115f['offsetWidth']-_0x16115f['clientWidth'];_0x25ff52['style']['right']='calc('+_0x3ad574+'px\x20+\x20var(--ck-spacing-large))';});};_0x117f19(),this['_miniToolbarResizeObserver']=new At(_0x16115f,()=>{_0x117f19();});}['_initializeScrollManager'](){const _0x28c1a0=this['_getScrollableElement']();_0x28c1a0&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x28c1a0));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x223663{constructor(_0x231331){super(_0x231331);const _0x82acba=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x82acba['to']('interactionCount')}]});}['setInteractionCount'](_0x30e634){this['set']('interactionCount',_0x30e634);}},Ua=class extends _0x57cbc7{static get['requires'](){return[cs,rn,Ht,As,la,_0x2a9bb4];}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(_0x176ba8){super(_0x176ba8),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'](_0x31c6b7,_0x4c56e6,_0x200c80){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x14ea7f,anchorData:_0x1a06db,root:_0x96f256}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x31c6b7,_0x14ea7f,_0x1a06db,_0x96f256,_0x4c56e6,_0x200c80);}const {modelFragment:_0x41712b,anchorData:_0x8c4ab0,root:_0x1a49c1}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x31c6b7,_0x41712b,_0x8c4ab0,_0x1a49c1,_0x4c56e6,_0x200c80);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x474800=this['editor']['plugins']['has']('TrackChanges');let _0x4834ac=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x474800||(_0x4834ac=_0x4834ac['filter'](_0x9725a7=>'insertSuggestion'!=_0x9725a7));const _0x286e0c=this['editor']['commands']['get']('trackChanges'),_0x2f1121=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x474800,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x4834ac});return _0x2f1121['bind']('isBusy')['to'](this),_0x286e0c&&_0x2f1121['bind']('isTrackChangesOn')['to'](_0x286e0c,'value'),_0x2f1121['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x2f1121['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x2f1121['on']('showNext',()=>{this['_navigateToNext']();}),_0x2f1121;}['_normalizeSelectionStart'](){const _0x302f10=this['editor']['model'],_0x42891e=_0x302f10['document']['selection'],_0x3ffc68=_0x42891e['getFirstRange']();if(!_0x3ffc68||_0x3ffc68['isCollapsed'])return;const _0x3bf58c=pt(_0x42891e['getSelectedBlocks']());if(!_0x3bf58c)return;const _0x9cb792=_0x302f10['createPositionAt'](_0x3bf58c,0x0);_0x9cb792['isAfter'](_0x3ffc68['start'])&&_0x302f10['change'](_0x4e9131=>{_0x4e9131['setSelection'](_0x4e9131['createRange'](_0x9cb792,_0x3ffc68['end']));});}['_getExecuteDataRegular'](){const _0x425697=this['editor']['model']['document']['selection'],_0x2f04e8=_0x425697['getFirstRange']()['start']['root'];if(_0x425697['isCollapsed']){const _0x28d1f8=pt(_0x425697['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x425697);this['editor']['model']['change'](_0x3c4b3f=>{_0x3c4b3f['setSelection'](_0x28d1f8,'in');});}this['_normalizeSelectionStart']();const _0x260d57=_0x425697['getFirstRange'](),_0x458a31=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x425697),_0x260d57['start'],_0x260d57['end']);this['_copyMarkersToFragment'](_0x458a31,_0x425697,{'isTableSelection':!0x1});const _0x207b98=_0x425697['getFirstRange']()['start'],_0x261352=new Map();let _0x5b8351=_0x458a31;for(let _0x1680f0=0x0;_0x1680f0<_0x207b98['path']['length'];_0x1680f0++)_0x261352['set'](_0x5b8351,_0x207b98['path'][_0x1680f0]),_0x5b8351=_0x5b8351['getChild'](0x0);return{'modelFragment':_0x458a31,'anchorData':_0x261352,'root':_0x2f04e8};}['_getExecuteDataInTable'](){const _0x2fc7d1=this['editor']['model']['document']['selection'],_0x16dae3=this['editor']['plugins']['get']('TableSelection'),_0x5359e1=_0x2fc7d1['getFirstRange']()['start']['root'],_0x59da1e=_0x16dae3['getSelectionAsFragment'](),_0x496dae=_0x2fc7d1['getFirstRange']()['start']['parent']['parent'],_0x44eb73=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x496dae),this['editor']['model']['createPositionAfter'](_0x496dae)),_0x1cbccd=this['_wrapWithCommonAncestors'](_0x59da1e,_0x44eb73['start'],_0x44eb73['end']);this['_copyMarkersToFragment'](_0x1cbccd,_0x2fc7d1,{'isTableSelection':!0x0});const _0x2911a1=_0x2fc7d1['getFirstRange']()['start'],_0x3122c8=new Map();let _0x12a4e8=_0x1cbccd;for(let _0x236eaf=0x0;_0x236eaf<_0x2911a1['path']['length'];_0x236eaf++)if(_0x3122c8['set'](_0x12a4e8,_0x2911a1['path'][_0x236eaf]),_0x236eaf<_0x2911a1['path']['length']-0x1)_0x12a4e8=_0x12a4e8['getChild'](0x0);else{let _0x2f2724=_0x12a4e8['nextSibling'];for(;_0x2f2724;)_0x3122c8['set'](_0x2f2724,_0x2911a1['path'][_0x236eaf]),_0x2f2724=_0x2f2724['nextSibling'];}return{'modelFragment':_0x1cbccd,'anchorData':_0x3122c8,'root':_0x5359e1};}async['_executeAction'](_0x2faa40,_0x5a7f93,_0x5e8197,_0x345bd3,_0x388634,_0x475f15){const _0x4f1d48=this['editor']['plugins']['get'](As),_0x4ca0c6=this['editor']['plugins']['get'](la),_0x2e34be=this['editor']['model']['document']['selection'],_0x497428=await _0x4f1d48['modelToDataWithIds'](_0x5a7f93,this['editor']),_0x51f03f=this['editor']['model']['document']['version'],_0x11457b=[..._0x2e34be['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x4ca0c6['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x388634,'icon':_0x475f15||_0x5f28a7,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x11457b,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x4ca0c6),this['_interactionParams']={'action':_0x2faa40,'content':_0x497428,'version':_0x51f03f,'aiBalloon':_0x4ca0c6,'modelFragment':_0x5a7f93,'anchorData':_0x5e8197,'root':_0x345bd3},this['_setupApplyListeners'](),this['listenTo'](_0x4ca0c6,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x4ca0c6,'dialogClosed',(_0x364461,{id:_0x4f24d2})=>{if('aiActionsBalloon'===_0x4f24d2){for(const _0x429fd8 of this['_interactions']){if(0x0===_0x429fd8['replies']['length']||_0x429fd8['stoppedExplicitly'])continue;const _0xa51117=_0x429fd8['replies'][_0x429fd8['replies']['length']-0x1],_0x30f064=_0xa51117['changeGroups'][0x0];_0x30f064&&'pending'===_0x30f064['state']&&_0xa51117['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x4ca0c6);}}),this['_createInteraction'](_0x497428,_0x51f03f,_0x4ca0c6,_0x2faa40);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x281b14,anchorData:_0x8d68ee,root:_0x3321fe}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x281b14,_0x8d68ee,_0x3321fe,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x281b14,_0x8d68ee,_0x3321fe,!0x0);});}['_wrapWithCommonAncestors'](_0x43b9c1,_0x9a849c,_0x48483e){const _0xf59421=this['editor']['model']['createRange'](_0x9a849c,_0x48483e)['getCommonAncestor'](),_0x46cd98=_0xf59421['is']('documentFragment')?[]:_0xf59421['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x46cd98['length']){const _0x367983=_0x46cd98['map'](_0x49094b=>_0x49094b['_clone'](!0x1));for(let _0x1b4ad5=0x1;_0x1b4ad5<_0x367983['length'];_0x1b4ad5++)_0x367983[_0x1b4ad5-0x1]['_appendChild'](_0x367983[_0x1b4ad5]);return _0x367983[_0x367983['length']-0x1]['_appendChild'](_0x43b9c1),new _0x53f775(_0x367983[0x0]);}return _0x43b9c1;}['_copyMarkersToFragment'](_0x28a5e3,_0x4cf37e,_0x294302={'isTableSelection':!0x1}){const _0x3c5b87=this['editor']['model'],_0xf64370=Array['from'](_0x4cf37e['getRanges']()),_0x533762=_0x4cf37e['getFirstRange']()['start'];for(const _0x1d3b3a of _0x3c5b87['markers']){if(_0x1d3b3a['name']['startsWith']('ai-selection')||!_0x1d3b3a['affectsData'])continue;const _0x1103a2=_0x1d3b3a['getRange']();if(!_0xf64370['some'](_0x130e31=>_0x130e31['containsRange'](_0x1103a2,!0x0)))continue;const _0x25a7ea=this['_regularCalculateMarkerPath'](_0x1103a2['start'],_0x533762,_0x294302['isTableSelection']),_0x19e596=this['_regularCalculateMarkerPath'](_0x1103a2['end'],_0x533762,_0x294302['isTableSelection']),_0x23a953=_0x3c5b87['createPositionFromPath'](_0x28a5e3,_0x25a7ea),_0x19e1e9=_0x3c5b87['createPositionFromPath'](_0x28a5e3,_0x19e596);if(!_0x23a953['isEqual'](_0x19e1e9)){const _0x42ca00=_0x3c5b87['createRange'](_0x23a953,_0x19e1e9);_0x28a5e3['markers']['set'](_0x1d3b3a['name'],_0x42ca00);}}}['_regularCalculateMarkerPath'](_0x537ef9,_0x900705,_0x36e994=!0x1){const _0x398501=[..._0x537ef9['path']['slice']()];for(let _0x4d8cff=0x0;_0x4d8cff<Math['max'](_0x900705['path']['length'],_0x537ef9['path']['length']);_0x4d8cff++){const _0x241418=_0x900705['path'][_0x4d8cff]||0x0,_0x2cebfb=(_0x537ef9['path'][_0x4d8cff]||0x0)-_0x241418;if(_0x398501[_0x4d8cff]=_0x2cebfb,0x0!==_0x2cebfb&&!_0x36e994)break;}return _0x398501;}async['_createInteraction'](_0x1a6b59,_0x47d00c,_0x1fb93f,_0xa09aa3){const _0x3ec764=this['editor'],_0x2150ae=_0x3ec764['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0xa09aa3,'content':_0x1a6b59,'version':_0x47d00c,'aiBalloon':_0x1fb93f,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x2150ae});const _0xea0003=new La({'connector':this['_aiConnector'],'locale':_0x3ec764['locale'],'content':_0x1a6b59,'version':_0x47d00c,'editor':_0x3ec764,'rootName':_0x2150ae['rootName'],..._0xa09aa3});this['_interactions']['push'](_0xea0003);const _0x5b548b=(_0x45af0b,_0x4e3eae=!0x1,_0x9ae942='streaming')=>{const {isDone:_0x25c6b2}=_0x45af0b;return this['_promiseQueue']['enqueue'](async _0x1a26ed=>{try{const _0x52afb4=Us({'changeGroups':_0x45af0b['changeGroups'],'documentContextContent':_0x45af0b['documentContextContent'],'showDiff':_0x4e3eae,'trimUnchanged':!0x1});_0x52afb4['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x52afb4[0x0],'renderingStrategy':_0x9ae942,'abortSignal':_0x1a26ed}),_0x25c6b2&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x614b7b){if(sn(_0x614b7b))return;throw _0x614b7b;}});};_0xea0003['on']('replyCreated',(_0x509ca2,_0x2612a0)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x5b548b(_0x2612a0)['catch'](_0x4cc8eb=>{this['_reporter']['logError'](_0x4cc8eb,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0xea0003,_0x4cc8eb);});}),_0xea0003['on']('replyContentUpdated',(_0x139a51,_0x13211f)=>{_0x5b548b(_0x13211f)['catch'](_0x50b27c=>{this['_reporter']['logError'](_0x50b27c,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0xea0003,_0x50b27c);});}),_0xea0003['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x585495){this['_reporter']['logError'](_0x585495,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0xea0003,_0x585495);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x50a34a,{showDiff:_0x150428})=>{try{this['_balloonShowDiff']=_0x150428;const _0x3d540c=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x3d540c&&await _0x5b548b(_0x3d540c,_0x150428,'static');}catch(_0x42b40f){this['_reporter']['logError'](_0x42b40f,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0xea0003,_0x42b40f);}}),_0xea0003['on']('replyChangeGroupStateUpdated',()=>{const _0x30cad1={'positiveCount':_0xea0003['replies']['reduce']((_0x587d37,_0x562bcc)=>_0x587d37+_0x562bcc['changeGroups']['filter'](_0x2e72de=>'accepted'===_0x2e72de['state'])['length'],0x0),'totalCount':_0xea0003['replies']['reduce']((_0x46e227,_0x39eab9)=>_0x46e227+_0x39eab9['changeGroups']['length'],0x0)},_0x1bdd22=_0xea0003['actionCallId'],_0x4fa5cd=_0xea0003['actionName'];_0x4fa5cd?this['_aiConnector']['upsertAIActionRating'](_0x4fa5cd,_0x1bdd22,_0x30cad1):this['_aiConnector']['upsertCustomAIActionRating'](_0x1bdd22,_0x30cad1);}),this['_setLoadingState']();try{const _0x5df7c7=await _0xea0003['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x5df7c7;}catch(_0x267f0b){sn(_0x267f0b)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x267f0b,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0xea0003,_0x267f0b);}}['_applyChanges'](_0x11b4bc,_0x3b1ce0,_0x530613,_0x115ce9){const _0x116e5f=this['editor'];if(_0x115ce9&&!_0x116e5f['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x539e08=this['editor']['plugins']['get'](_0x2a9bb4),_0x3c6a0a=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x3c6a0a||!_0x3c6a0a['replies']['length'])return;const _0x469a03=_0x3c6a0a['replies'][_0x3c6a0a['replies']['length']-0x1];_0x469a03['setChangeGroupState'](0x0,'accepted');const _0x32ae00=ks({'documentSuggestions':On({'groups':[_0x469a03['changeGroups'][0x0]],'documentContextContent':_0x469a03['documentContextContent'],'documents':_0x3c6a0a['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x539e08,'documentCompareOptions':{'anchor':_0x116e5f['model']['createPositionAt'](_0x11b4bc,0x0),'markDeletions':_0x115ce9}})['values']()['next']()['value']??[],_0x3b0327=this['_filterOperationsOutsideRange'](_0x32ae00,_0x3b1ce0);for(const _0x23bee9 of _0x3b0327)this['_anchorOperation'](_0x3b1ce0,_0x23bee9,_0x530613);const _0x4f4665=_0x3c6a0a['getDocumentContext']()['documents'][0x0]['version'],_0x302f16=_0xd31715(_0x3b0327,_0x116e5f['model']['document']['history']['getOperations'](_0x4f4665),{'document':_0x116e5f['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];js(_0x302f16,'quickActions');try{_0x116e5f['model']['change'](_0x13d8ee=>{if(_0x13d8ee['setSelection'](_0x116e5f['model']['document']['selection']['focus']),_0x115ce9)_0x116e5f['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x302f16);else{for(const _0x4cad09 of _0x302f16)_0x4cad09['baseVersion']=_0x116e5f['model']['document']['version'],Ns(_0x116e5f,_0x4cad09),_0x13d8ee['batch']['addOperation'](_0x4cad09),_0x116e5f['model']['applyOperation'](_0x4cad09);}});}catch(_0x231b18){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x231b18})),_0x231b18;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x253650,_0x38f621){return _0x253650['filter'](_0x32d952=>{if('rename'==_0x32d952['type']){const _0x2fb4fa=_0x32d952['position']['nodeAfter'];return!_0x38f621['has'](_0x2fb4fa);}if(_0x32d952['type']['indexOf']('Attribute')>-0x1){const _0x4cb10a=_0x32d952['range']['start']['nodeAfter'];return!_0x38f621['has'](_0x4cb10a);}return!0x0;});}['_anchorOperation'](_0x3a792c,_0x19178c,_0x25df9f){const _0x486131=_0x19178c['clone']();for(const _0x314cd5 in _0x19178c){const _0x22bd4b=_0x19178c[_0x314cd5];_0x22bd4b instanceof _0x23ea4f?_0x19178c[_0x314cd5]=new _0x23ea4f(_0x3df594(_0x22bd4b['start']),_0x3df594(_0x22bd4b['end'])):_0x22bd4b instanceof _0x38e1e9&&(_0x19178c[_0x314cd5]=_0x3df594(_0x22bd4b));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x486131['type'])){if(_0x486131['isDocumentOperation']=!0x1,_0x486131['baseVersion']=null,'remove'==_0x486131['type']){const _0x10a61e=_0x486131['sourcePosition'],_0x500024=_0x486131['howMany'];new _0x2142d8(_0x10a61e,_0x500024)['_execute']();}else _0x486131['_execute']();}function _0x3df594(_0x20985a){if('$graveyard'==_0x20985a['root']['rootName'])return _0x20985a;const _0x4a7c15=[];let _0x275012=_0x20985a['root'];for(let _0x1b597f=0x0;_0x1b597f<_0x20985a['path']['length'];_0x1b597f++){const _0x3fd482=_0x3a792c['get'](_0x275012)||0x0;_0x4a7c15[_0x1b597f]=_0x20985a['path'][_0x1b597f]+_0x3fd482,_0x275012=_0x275012['getChildAtOffset'](_0x20985a['path'][_0x1b597f]);}return new _0x38e1e9(_0x25df9f,_0x4a7c15,_0x20985a['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x33e8b8,content:_0x22cc3d,version:_0x381ad9,aiBalloon:_0x18e6fe}=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'](_0x22cc3d,_0x381ad9,_0x18e6fe,_0x33e8b8)['catch'](_0x11811d=>{this['_reporter']['logError'](_0x11811d,{'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 _0x508c80=this['_interactions']['length'];this['_currentInteractionIndex']<_0x508c80-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x122b7f){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x122b7f;const _0x591b75=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x591b75)return;if(_0x591b75['hasError'])return this['_setErrorState'](_0x591b75),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x591b75['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x2d0901=_0x591b75['replies'][_0x591b75['replies']['length']-0x1];if(_0x2d0901)try{const _0x144b5f=Us({'changeGroups':_0x2d0901['changeGroups'],'documentContextContent':_0x2d0901['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x270116=>setTimeout(_0x270116,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x144b5f[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3f6b3a){this['_reporter']['logError'](_0x3f6b3a,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x213c3e,_0xf5c41){if(void 0x0!==_0xf5c41&&sn(_0xf5c41))return;const _0x219800=ls(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x219800),_0x213c3e['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 _0x57cbc7{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2d78b2){super(_0x2d78b2),_0x2d78b2['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x223663{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x2aabd6,_0x12835b){super(_0x2aabd6),this['id']=_0x12835b,this['set']('status','pending'),this['set']('changeId',_0x12835b),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',(_0x2f83d1,_0x1395f6)=>{_0x1395f6&&_0x1395f6['target']&&'A'===_0x1395f6['target']['tagName']&&_0x1395f6['preventDefault'](),this['fire']('activateChange',{'id':_0x12835b,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x12835b,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x12835b,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x40aef4=new _0x223663(this['locale']);return _0x40aef4['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',_0x2d07ac=>!_0x2d07ac)]}}),_0x40aef4;}['_createAcceptButtonView'](){const _0x2175b1=new Pt(this['locale']);return _0x2175b1['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x2175b1['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5bbbc3=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x5bbbc3['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x47a9e1=>'pending'!==_0x47a9e1&&'accepted'!==_0x47a9e1),this['bindTemplate']['if']('status',hn,_0x4c0a78=>'pending'===_0x4c0a78),this['bindTemplate']['if']('status',cn,_0x4f64c9=>'pending'!==_0x4f64c9),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3f1c5b=>'accepted'===_0x3f1c5b)]}}),this['on']('change:status',(_0x54644e,_0x150c2e,_0x10e8d7)=>{_0x2175b1['isEnabled']='pending'===_0x10e8d7,'accepted'===_0x10e8d7&&(_0x2175b1['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x2175b1['icon']=_0xd806a0);}),_0x2175b1;}['_createDismissButtonView'](){const _0xed884a=new Pt(this['locale']);return _0xed884a['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0xed884a['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3a4748=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x3a4748['stopPropagation']();})},'attributes':{'class':[cn,this['bindTemplate']['if']('status','ck-hidden',_0x19bdc0=>'pending'!==_0x19bdc0&&'rejected'!==_0x19bdc0),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x3002b5=>'pending'===_0x3002b5),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x4bfb86=>'rejected'===_0x4bfb86)]}}),this['on']('change:status',(_0x24c718,_0xd25c18,_0x3bc77d)=>{_0xed884a['isEnabled']='pending'===_0x3bc77d,'rejected'===_0x3bc77d&&(_0xed884a['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0xed884a['icon']=_0x3ce603);}),_0xed884a;}['_createInfoButtonView'](){const _0xa978c3=new Pt(this['locale']);return _0xa978c3['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x32b703,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':cn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0xa978c3['bind']('isOn')['to'](this,'isInfoToggleOn',_0x35a944=>_0x35a944),_0xa978c3['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0xa978c3;}['_createOutdatedButtonView'](){const _0x2b959a=new Pt(this['locale']);return _0x2b959a['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x4663c7,'withText':!0x0,'isEnabled':!0x1}),_0x2b959a['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x149353=>'outdated'!==_0x149353)],'disabled':'disabled'}}),_0x2b959a;}},Fa=class extends Nt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x2e8b27,_0x2d8423){super(_0x2e8b27),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']()),_0x2d8423['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x2d8dba){this['resultItemView']['changeId']=_0x2d8dba['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x2d8dba['contentDiffed'];}['showBalloon'](_0x5c7e6a,_0xc601ae,_0x35a6b7,_0x1e10ca,_0x32ba93,_0x4fa0f4){const _0xc28e5a=_0xc601ae();if(!_0xc28e5a)return;this['updateContent'](_0x5c7e6a),this['show']();const _0x31fd4b=Array['from'](_0xc28e5a['getClientRects']())['reverse'](),_0x5459a6=this['_getPointedRectIndexFromEvent'](_0x35a6b7,_0x31fd4b),_0x1cf4c7=_0x31fd4b[_0x5459a6??0x0];'click'===_0x1e10ca?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0xc601ae(),_0x5459a6,_0x5c7e6a['id'],_0x32ba93,_0x4fa0f4)||_0x1cf4c7})):'hover'===_0x1e10ca&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0xc601ae(),_0x5459a6,_0x5c7e6a['id'])||_0x1cf4c7}));}['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'](){_0x36e73c({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x5430f8=[this['element']];return this['_pinnedTargetElement']&&_0x5430f8['push'](this['_pinnedTargetElement']),_0x5430f8;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x2f2f5f=new _0x223663();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x2f2f5f['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']]}]}),_0x2f2f5f;}['_getBestRectPositionOnClick'](_0x1afab6,_0xed3ba8,_0x3e6218,_0x3d2fc8,_0x56032d){if(!_0x1afab6)return null;const _0x54b040=this['position']['replace']('arrow_',''),_0x2d03d9=Array['from'](_0x1afab6['getClientRects']());let _0x5d1d7e,_0x365325=_0x2d03d9['reverse']();return void 0x0!==_0xed3ba8&&this['_isPinnedRectVisible'](_0x365325[_0xed3ba8],_0x3d2fc8,_0x56032d)?(_0x5d1d7e=_0x365325[_0xed3ba8],this['_pinnedRectIndex']=_0xed3ba8):this['_isPinnedRectVisible'](_0x365325[0x0],_0x3d2fc8,_0x56032d)&&void 0x0===_0xed3ba8?_0x5d1d7e=_0x365325[0x0]:(_0x365325='s'==_0x54b040[0x0]?[..._0x2d03d9]['reverse']():_0x2d03d9,_0x365325['forEach'](_0x4e9c22=>{this['_isPinnedRectVisible'](_0x4e9c22,_0x3d2fc8,_0x56032d)&&(_0x5d1d7e=_0x4e9c22);})),this['_pinnedTargetChangeId']=_0x3e6218,this['_pinnedTargetElement']=_0x1afab6,_0x5d1d7e||_0x1afab6['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x394e5f,_0x16c77f,_0x4412f1){if(!_0x394e5f)return null;const _0x3fd7be=Array['from'](_0x394e5f['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x16c77f&&this['_pinnedTargetChangeId']!==_0x4412f1?(this['_pinnedRectIndex']=_0x16c77f,this['_pinnedTargetElement']=_0x394e5f,this['_pinnedTargetChangeId']=_0x4412f1,_0x3fd7be[_0x16c77f]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x4412f1?_0x394e5f!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x3fd7be[this['_pinnedRectIndex']]:void 0x0!==_0x16c77f&&this['_pinnedTargetChangeId']!==_0x4412f1?(this['_pinnedRectIndex']=_0x16c77f,this['_pinnedTargetElement']=_0x394e5f,this['_pinnedTargetChangeId']=_0x4412f1,_0x3fd7be[_0x16c77f]):_0x394e5f['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x18f52d,_0x176771){if(_0x18f52d)for(let _0x128792=0x0;_0x128792<_0x176771['length'];_0x128792++){const _0x538f04=_0x176771[_0x128792];if(_0x18f52d['clientX']>=_0x538f04['left']-0x3&&_0x18f52d['clientX']<=_0x538f04['right']+0x3&&_0x18f52d['clientY']>=_0x538f04['top']-0x3&&_0x18f52d['clientY']<=_0x538f04['bottom']+0x3)return _0x128792;}}['_isPinnedRectVisible'](_0x379517,_0x45dcfd,_0xc60fa4){const _0x4a4880=new gt(_0x379517),_0x24f78f=_0x45dcfd||document['documentElement'],_0x2040db=_0x4a4880['getIntersection'](mt(_0xc60fa4)),_0x15ac5d=new gt(_0x24f78f)['getIntersection'](_0x4a4880);return!!(_0x2040db&&_0x15ac5d&&_0x4a4880['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x394116{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[hs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2836a4){super(_0x2836a4),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 _0x1b5e76=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x1b5e76);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x1e9c5e){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x46de1c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x1e9c5e,_0x46de1c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x2a03e4){_0x2a03e4&&('error-general'!==_0x2a03e4['status']?'error-chunk'!==_0x2a03e4['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x17e7b1){this['_mainView']['addCheckRunResult'](_0x17e7b1);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x1fcf91){this['_mainView']['showGeneralReviewCoreErrorView'](_0x1fcf91??ls(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x5c5e69,_0x381f98){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x5c5e69,_0x381f98);}['setActiveStateInResults'](_0x4a79ea){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x9c20e5=>{_0x9c20e5['id']===_0x4a79ea&&_0x9c20e5['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x1a8b12=>_0x1a8b12['setItemAsInactive']());}['updateChangeState'](_0x3c4d8b,_0x59edf8){'accepted'===_0x59edf8||'rejected'===_0x59edf8||'outdated'===_0x59edf8?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x3c4d8b,_0x59edf8):this['_mainView']['reviewCheckResultsView']['showResult'](_0x3c4d8b,_0x59edf8);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x4619d7,_0x3ac821,_0x1db94f,_0xbf1230,_0x1cc085,_0x3eed86){this['_balloonSuggestionView']['showBalloon'](_0x4619d7,_0x3ac821,_0x1db94f,_0xbf1230,_0x1cc085,_0x3eed86);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x4f8442){const _0x3930f1=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x4d59fe=>_0x4d59fe['id']===_0x4f8442);return _0x3930f1?_0x3930f1['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x223663{constructor(_0x449a0c){super(_0x449a0c),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x136351=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x136351['if']('isVisible','ck-hidden',_0x414262=>!_0x414262)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x136351['to']('errorMessage')}]}]});}},$a=class extends _0x223663{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x5b1984,_0x225e4e){super(_0x5b1984),this['reviewCoreHeader']=_0x225e4e['header'],this['generalErrorView']=new Ya(_0x5b1984),this['reviewCheckListView']=_0x225e4e['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x225e4e['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x225e4e['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'](_0x528dd0){this['reviewCheckResultsView']['addResult'](_0x528dd0),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'](_0x382cc0){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x382cc0;}['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(_0x130a68,_0x4ba994){super(_0x4ba994),this['set']({'label':_0x130a68,'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(_0x4bb22a,_0x50a4ff){super(_0x4bb22a),this['_contents']=_0x50a4ff,this['_resultViews']=new _0x218b6e(),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(_0x4bb22a),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 _0x424e5e=this['_createCombinedSkeletonLoader'](),_0x4da5df=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x4da5df['if']('isLoading','ck-ai_review__check-run_loading',_0x5fcc28=>_0x5fcc28),_0x4da5df['if']('isResultReady','ck-ai_review__check-run_ready',_0x5ad7b3=>_0x5ad7b3),_0x4da5df['if']('isVisible','ck-hidden',_0x5c27ce=>!_0x5c27ce)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x424e5e,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x180b1a){const _0x3b28ce=new Ga(this['locale'],_0x180b1a['id']);_0x3b28ce['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x3b28ce),_0x3b28ce['resultResponseView']['element']['innerHTML']=_0x180b1a['contentDiffed'];}['hideResult'](_0xd1e4c3,_0x25b420){if('pending'===_0x25b420)return;const _0x393773=this['_resultViews']['find'](_0x2cc0bb=>_0x2cc0bb['id']===_0xd1e4c3);_0x393773&&(_0x393773['status']=_0x25b420,_0x393773['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x5b8675,_0x5f47a1){if('pending'!==_0x5f47a1)return;const _0x1bf026=this['_resultViews']['find'](_0xa74822=>_0xa74822['id']===_0x5b8675);_0x1bf026&&(_0x1bf026['status']=_0x5f47a1,_0x1bf026['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x5edddf,_0x36d3b8){this['headerTitle']=_0x5edddf,this['headerSubtitle']=_0x36d3b8||'';}['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 _0x3b5f32=new _0x223663(this['locale']),_0x5e7984=[];for(let _0x2e6a53=0x0;_0x2e6a53<0x10;_0x2e6a53++){const _0x57f963=this['_createSkeletonLoader']();_0x57f963['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x5e7984['push'](_0x57f963);}return _0x3b5f32['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3b3255=>!_0x3b3255)]},'children':_0x5e7984}),_0x3b5f32;}['_createResultsBodyView'](){const _0x4f764d=new _0x223663(this['locale']);return _0x4f764d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1b4698=>_0x1b4698)]},'children':this['_resultViews']}),_0x4f764d;}['_createErrorView'](){const _0x338c8f=new _0x223663(this['locale']),_0x2269dc=new Pt(this['locale']),t=this['locale']['t'];return _0x338c8f['delegate']('retryReview')['to'](this),_0x2269dc['set']({'label':t('Try\x20again'),'withText':!0x0,'class':hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x2269dc['on']('execute',()=>{this['fire']('retryReview');}),_0x338c8f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x138721=>!_0x138721),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x325c5e=>'chunk'===_0x325c5e)]},'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',_0x1a0c0f=>'chunk'===_0x1a0c0f)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x111751=>'general'!==_0x111751)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x132a43=>'chunk'!==_0x132a43)]},'children':[{'text':ls(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x2269dc]}),_0x338c8f;}['_createCancelButtonView'](){const _0x6f299f=new Pt(this['locale']);return _0x6f299f['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[hn+'\x20ck-ai-button-stop-generating'],'icon':et}),_0x6f299f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x26af26=>_0x26af26),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3dcf77=>_0x3dcf77)]}}),_0x6f299f['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x6f299f;}['_createToggleDiffButtonView'](){const _0x590cb4=new Pt(this['locale']);_0x590cb4['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x590cb4['bind']('isEnabled')['to'](this,'isError',_0xe21dc3=>!_0xe21dc3),_0x590cb4['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1e4fc6=>!_0x1e4fc6),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3ca137=>_0x3ca137)]}});const _0x56534e=ls(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x1ffedb=ls(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x590cb4['bind']('isOn')['to'](this,'isToggleDiffOn',_0x3daa19=>_0x3daa19),_0x590cb4['bind']('icon')['to'](this,'isToggleDiffOn',_0x442b5f=>_0x442b5f?_0x370f19:_0x5946b9),_0x590cb4['bind']('label')['to'](this,'isToggleDiffOn',_0x5d4ca1=>_0x5d4ca1?_0x56534e:_0x1ffedb),_0x590cb4['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x590cb4;}['_createAcceptAllButtonView'](){const _0x25582f=new Pt(this['locale']);return _0x25582f['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x25582f['bind']('isEnabled')['to'](this,'isError',_0x16bfc4=>!_0x16bfc4),_0x25582f['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x451b6a=>!_0x451b6a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x380934=>_0x380934)]}}),_0x25582f['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x25582f;}['_createExitReviewButtonView'](){const _0x5f56e6=new Pt(this['locale']);return _0x5f56e6['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x5f56e6['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4bff0c=>!_0x4bff0c),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2bf7ff=>_0x2bf7ff)]}}),_0x5f56e6['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x5f56e6;}['_createResultHeaderView'](){const _0x3cf9ad=new _0x223663(this['locale']),_0x40716b=this['_createTitleView']();return _0x3cf9ad['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x38c2f1=>_0x38c2f1)]},'children':[_0x40716b,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5ad4ae=>!_0x5ad4ae)],'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']]}]}),_0x3cf9ad;}['_createTitleView'](){const _0x300499=new _0x223663(this['locale']),_0x29bbc4=new cr();return _0x29bbc4['bind']('isVisible')['to'](this,'isResultReady',_0x2c5f36=>!_0x2c5f36),_0x300499['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x23a3da=>_0x23a3da)]},'children':[_0x29bbc4,{'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')}]}]}]}),_0x300499;}['_createFinishReviewButtonView'](){const _0x2e3069=new qa(ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x2e3069['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1dc761=>!_0x1dc761)]}}),_0x2e3069['delegate']('finishReview')['to'](this),_0x2e3069;}},Xa=class extends Xt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x35a6c8,_0x112f2b){super(_0x35a6c8),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x112f2b['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x112f2b['headerText']);const _0x529648=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x529648['if']('isVisible','ck-hidden',_0x1cfd3e=>!_0x1cfd3e)]},'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':_0x112f2b['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x3b24ab){const _0xc39f92=new qa(_0x3b24ab,this['locale']);return _0xc39f92['delegate']('finishReview')['to'](this),_0xc39f92;}['_createResultHeaderView'](_0x200382){const _0xe77c7f=new _0x223663(this['locale']);return _0xe77c7f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x200382},'children':[{'text':_0x200382}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0xe77c7f;}},za=class extends _0x223663{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x5dbbb0,_0x3fa8f3){super(_0x5dbbb0),this['_defaultValue']=_0x3fa8f3['default']||(_0x3fa8f3['data']['length']>0x0?_0x3fa8f3['data'][0x0]['id']:''),this['_defaultLabel']=_0x3fa8f3['data']['find'](_0x5e9ae5=>_0x5e9ae5['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x1c0a67(this['locale']);const _0x48a115=this['_prepareListOptions'](_0x3fa8f3['data']);_0x2e1c13(this['_dropdownView'],_0x48a115,{'role':'menu','ariaLabel':_0x3fa8f3['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x8fa7d4=>{_0x8fa7d4['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x105378=>{this['formValue']=_0x105378['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x105378['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'](_0x23a968=[]){const _0x5c7782=new ht();this['resetToDefault']();for(const _0x5bb9a0 of _0x23a968){const _0x1018b3=new _0x56dc21({'label':_0x5bb9a0['label'],'withText':!0x0,'role':'menuitemradio','id':_0x5bb9a0['id'],'model':_0x5bb9a0});_0x1018b3['bind']('isOn')['to'](this,'formValue',_0xa15074=>_0xa15074===_0x1018b3['id']);const _0x5e94de={'type':'button','model':_0x1018b3};_0x5c7782['add'](_0x5e94de);}return _0x5c7782;}},ja=class extends Xt{['_formItem']=null;constructor(_0x219532,_0x51ed3d,_0x280ab2){if(super(_0x219532),this['argsKey']=_0x51ed3d?.['argsKey'],'dropdown'===_0x51ed3d['formType'])this['_formItem']=new za(this['locale'],_0x51ed3d);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x344170=new Ft(this['locale'],{'children':[this['_formItem']],'class':[_0x280ab2?'ck-form__row_with-submit':'']});_0x280ab2&&_0x344170['children']['add'](_0x280ab2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x344170]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x357e4e{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x2b7f1b){super(_0x2b7f1b),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 _0x223663{['focusTracker']=new ut();['keystrokes']=new dt();['focusCycler'];['_focusables']=new _0x218b6e();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x2ad8d9,_0x16bf88,_0x2f98dc=!0x1){super(_0x2ad8d9),this['_check']=_0x16bf88,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x16bf88['defaultModel']?_0x16bf88['defaultModel']['id']:'',this['_defaultLabel']=_0x16bf88['defaultModel']?_0x16bf88['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new $t(this['locale'],()=>new Ja(_0x2ad8d9)),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'](_0x2f98dc),_0x2e1c13(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',(_0x8b0435,_0x2fa0d5)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x2fa0d5()):_0x2fa0d5();}),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'](_0x3d6f4d=>{this['_focusables']['add'](_0x3d6f4d),this['focusTracker']['add'](_0x3d6f4d['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 _0x1012d1 of this['_getFormValidators']()){const _0x2aedcd=_0x1012d1();if(_0x2aedcd)return this['promptInputView']['errorText']=_0x2aedcd,!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 _0x3f3286=new Pt(this['locale']),t=this['locale']['t'];return _0x3f3286['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x3f3286['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x3f3286;}['_createCancelButtonView'](){const _0x1e7c2d=new Pt(this['locale']),t=this['locale']['t'];return _0x1e7c2d['set']({'label':t('Cancel'),'withText':!0x0,'class':cn}),_0x1e7c2d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x205d9d=>{_0x205d9d['stopPropagation']();})}}),_0x1e7c2d['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x1e7c2d;}['_setModelList'](_0x1025ae){this['_modelSelectionDropdownItems']['clear']();const _0x306df8=this['_check']['models'];if(_0x1025ae)this['set']('modelDisplayMode','hidden');else{const _0x152d26=0x1===_0x306df8['length'];this['set']('modelDisplayMode',_0x152d26?'name':'selector');}if(this['resetToDefault'](),_0x306df8?.['length']){0x1===_0x306df8['length']&&this['set']('activeModelName',_0x306df8[0x0]['name']||_0x306df8[0x0]['id']);for(const _0x3d4cb0 of _0x306df8){const _0x3e7765=new _0x56dc21({'label':_0x3d4cb0['name'],'withText':!0x0,'role':'menuitemradio','id':_0x3d4cb0['id'],'model':_0x3d4cb0});_0x3e7765['bind']('isOn')['to'](this,'modelId',_0x1f1554=>_0x1f1554===_0x3d4cb0['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x3e7765,'labelView':new eh(this['locale'],_0x3d4cb0)});}}}['_createModelSelectionDropdown'](){const _0x108b11=_0x1c0a67(this['locale']);return _0x108b11['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x108b11['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':cn}),_0x108b11['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x577165=>'selector'===_0x577165),this['listenTo'](_0x108b11,'execute',_0x119b12=>{this['modelId']=_0x119b12['source']['model']['id'],_0x108b11['buttonView']['label']=_0x119b12['source']['label'];}),_0x108b11;}['_createModelNameView'](){const _0x561dea=new th(this['locale']);return _0x561dea['bind']('text')['to'](this,'activeModelName',_0x47bcbb=>_0x47bcbb??''),_0x561dea['bind']('isVisible')['to'](this,'modelDisplayMode',_0x32e857=>'name'===_0x32e857),_0x561dea;}['_createActionsFooterView'](){const _0x1c6068=new _0x223663(this['locale']);return _0x1c6068['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']]}]}),_0x1c6068;}},th=class extends _0x223663{constructor(_0x5624a3){super(_0x5624a3),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1e754f=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x1e754f['if']('isVisible','ck-hidden',_0x9abc18=>!_0x9abc18)]},'children':[{'text':_0x1e754f['to']('text')}]});}},eh=class extends Lt{constructor(_0x275a98,_0x41b2c7){super();const _0x4d14bf=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x4d14bf['to']('style'),'id':_0x4d14bf['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x4d14bf['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x41b2c7['description']||'']}]}]});}},ih=class extends Xt{['_formItemsCollection']=new _0x218b6e();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x342241,_0x4fda0d,_0x59f535,_0x3d7466=!0x1){super(_0x342241),this['_hideModels']=_0x3d7466,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x4fda0d['isParameterized']);const _0x40e8dc=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',_0x2de85d=>_0x2de85d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x577ed0=>_0x577ed0)],'style':{'--ck-ai-review-check-list-item-index':_0x59f535}},'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':_0x4fda0d['title']}]},_0x40e8dc]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x4fda0d['description']?[{'text':_0x4fda0d['description']}]:[]}]}]},..._0x4fda0d['isParameterized']?[this['_createParameterizedView'](_0x4fda0d)]:[],...'custom'===_0x4fda0d['id']?[this['_createCustomView'](_0x4fda0d,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x4fda0d['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x4fda0d['id'],'args':_0x4fda0d['useArgs']?_0x4fda0d['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x36e73c({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x23ed1b=>{_0x23ed1b['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x490f61=new Wt();return _0x490f61['content']=_0x5ddc75,_0x490f61['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x490f61;}['_createParameterizedView'](_0x33b51b){const _0xd8676e=new _0x223663(),_0xfd78a1=this['_createFormView'](_0x33b51b);return _0xd8676e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x4884a1=>!_0x4884a1)]},'children':[_0xfd78a1]}),_0xd8676e;}['_createFormView'](_0x451f16){const _0x24f388=new _0x223663(),_0xa5ac47=Array['isArray'](_0x451f16['options'])?_0x451f16['options']:[],_0x50a649=new Pt(this['locale']),t=this['locale']['t'];_0x50a649['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x50a649['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x42b530=>{_0x42b530['stopPropagation']();})}}),_0x50a649['on']('execute',()=>{const _0x238cfc=[],_0x31bc44={};this['_formItemsCollection']['forEach'](_0x340f66=>{_0x238cfc['push'](_0x340f66['value']),_0x451f16['useArgs']&&_0x451f16['options']&&(_0x31bc44[_0x340f66['argsKey']]=_0x340f66['value']);}),this['fire']('runReviewCheck',{'id':_0x451f16['id'],'params':_0x238cfc['length']?_0x238cfc:void 0x0,'args':Object['keys'](_0x31bc44)['length']?_0x31bc44:void 0x0});});const _0x4d38dd=_0xa5ac47['length'];return _0xa5ac47['forEach']((_0x247458,_0x2a0db9)=>{const _0x3b5c66=_0x2a0db9===_0x4d38dd-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x247458,_0x3b5c66?_0x50a649:null));}),_0x24f388['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x24f388;}['_createCustomView'](_0x3654b7,_0x350fba=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x3654b7,_0x350fba),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',_0x430d89=>!_0x430d89)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x5d1286,_0x719c95,_0x86f6e6)=>{_0x86f6e6||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends Xt{['_checkViews'];constructor(_0x10e22d){super(_0x10e22d),this['_checkViews']=new _0x218b6e(),this['_setupTemplate']();}['setChecks'](_0x1d026f,_0x2a6fa8=!0x1){this['_checkViews']['clear']();for(const [_0x21d208,_0x3c3538]of _0x1d026f['entries']()){const _0x5ccf9f=new ih(this['locale'],_0x3c3538,_0x21d208,_0x2a6fa8);_0x5ccf9f['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x5ccf9f);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x187abf of this['_checkViews'])_0x187abf instanceof ih&&_0x187abf['resetToDefault']();}['_setupTemplate'](){const _0x473005=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x473005['if']('isVisible','ck-hidden',_0x2ab629=>!_0x2ab629)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x19a58a=this['context']['plugins']['get']('AITabs'),_0x27cda2=this['context']['locale'],_0x1743d2=new Ho(_0x27cda2,{'label':ls(_0x27cda2,'AI_REVIEW_MODE'),'icon':_0x57a69d,'class':'ck-ai-header_review','showResizeButton':_0x19a58a['showResizeButton']});return _0x1743d2['delegate']('resizeTabs')['to'](_0x19a58a),_0x1743d2['bind']('isMaximized')['to'](_0x19a58a['view'],'isMaximized',_0x516b9e=>_0x516b9e),new $a(this['context']['locale'],{'header':_0x1743d2,'list':new sh(_0x27cda2),'results':new Qa(_0x27cda2,{'generalErrorText':ls(_0x27cda2,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x27cda2,{'headerText':ls(_0x27cda2,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':ls(_0x27cda2,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x27cda2,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x32dc6c=this['context']['plugins']['get']('AITabs');_0x32dc6c['view']['on']('activateTab',(_0x3cfa88,{newTab:_0x59d7bd,oldTab:_0x39693a})=>{'reviewMode'===_0x59d7bd?this['fire']('getReviewCheckList'):'reviewMode'===_0x39693a&&this['fire']('leaveReview');}),_0x32dc6c['view']['addTab']({'id':'reviewMode','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x57a69d,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x394116{static get['requires'](){return[_0x2a9bb4,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(_0x2401a1){super(_0x2401a1),this['_domEmitter']=new(ct())(),this['_eventEmitter']=new(lt())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x230860=_0x49343a=>this['_scheduleAttachReviewEditingToEditor'](_0x49343a);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x3dd3ce)return void _0x230860(this['context']);const _0x34a991=this['context'];for(const _0x1e2145 of _0x34a991['editors'])_0x230860(_0x1e2145);this['listenTo'](_0x34a991['editors'],'add',(_0x2d7a6d,_0x3a1185)=>{_0x230860(_0x3a1185);}),this['listenTo'](_0x34a991['editors'],'remove',(_0x5b48c9,_0x1c8eb0)=>{for(const [_0x180577,_0x27a180]of this['_markers'])_0x27a180['editor']===_0x1c8eb0&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x180577,'changeId':_0x27a180['groupId']}),this['_markers']['delete'](_0x180577));});}['_scheduleAttachReviewEditingToEditor'](_0x97a3df){const _0x71b5e7=()=>{'destroyed'!==_0x97a3df['state']&&_0x97a3df['conversion']&&this['_attachReviewEditingToEditor'](_0x97a3df);};if('ready'===_0x97a3df['state'])return void _0x71b5e7();const _0x2b759b=()=>{this['stopListening'](_0x97a3df,'ready',_0x2b759b),_0x71b5e7();};this['listenTo'](_0x97a3df,'ready',_0x2b759b);}['_attachReviewEditingToEditor'](_0x417d49){this['_reviewEditingAttachedEditors']['has'](_0x417d49)||(_0x417d49['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x454108,{writer:_0x216a99})=>{const _0x138b46=this['_markers']['get'](_0x454108['markerName']),_0x4caaec={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x138b46?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x454108['markerName']};return _0x216a99['createUIElement']('span',_0x4caaec,function(_0x3029ff){const _0x4ae4b8=this['toDomElement'](_0x3029ff);return _0x4ae4b8['innerHTML']=_0x138b46?.['content']?.['asString']||'',_0x4ae4b8;});}}),_0x417d49['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x1065a2=>{const _0x2fab1e=this['_markers']['get'](_0x1065a2['markerName']),_0x4beb25=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x2fab1e?.['id']||'')&&_0x4beb25['push']('ck-ai_review__change_active'),{'classes':_0x4beb25,'attributes':{'data-marker-id':_0x1065a2['markerName']}};}}),_0x417d49['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x10f7ff=>{const _0x273ecd=this['_markers']['get'](_0x10f7ff['markerName']),_0x2f7285=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x273ecd?.['id']||'')&&_0x2f7285['push']('ck-ai_review__change_active'),{'classes':_0x2f7285,'attributes':{'data-marker-id':_0x10f7ff['markerName']}};}}),_0x417d49['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0x29062e=>{const _0x2c515e=this['_markers']['get'](_0x29062e['markerName']),_0x212bba=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x2c515e?.['id']||'')&&_0x212bba['push']('ck-ai_review__change_active'),{'classes':_0x212bba,'attributes':{'data-marker-id':_0x29062e['markerName']}};}}),_0x417d49['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x3f8a1b,{writer:_0x2658e8})=>_0x2658e8['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x3f8a1b['isOpening']?'start':'end')})}),_0x417d49['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x583773,'view':_0x3bcf90}),this['_updateMouseMarkerInteractionListeners'](_0x417d49),this['listenTo'](_0x417d49,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x417d49),{'priority':'lowest'}),this['listenTo'](_0x417d49,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x417d49),{'priority':'lowest'}),_0x417d49['model']['document']['registerPostFixer'](_0x140fbc=>this['_validateMarkers'](_0x417d49,_0x140fbc)),_0x417d49['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x417d49)),this['_reviewEditingAttachedEditors']['add'](_0x417d49));}['_updateMouseMarkerInteractionListeners'](_0x658b48){let _0x19a4d4=this['_boundEditables']['get'](_0x658b48);_0x19a4d4||(_0x19a4d4=new Map(),this['_boundEditables']['set'](_0x658b48,_0x19a4d4));const _0x24f9e2=new Set(_0x658b48['ui']['getEditableElementsNames']());for(const _0x5ab83e of _0x24f9e2){if(_0x19a4d4['has'](_0x5ab83e))continue;const _0x15973f=_0x658b48['ui']['getEditableElement'](_0x5ab83e);_0x19a4d4['set'](_0x5ab83e,_0x15973f),this['_attachMouseMarkerInteractionListeners'](_0x15973f);}for(const [_0x512453,_0x108dd2]of _0x19a4d4)_0x24f9e2['has'](_0x512453)||(_0x19a4d4['delete'](_0x512453),this['_domEmitter']['stopListening'](_0x108dd2));}['_attachMouseMarkerInteractionListeners'](_0x52dbe4){this['_domEmitter']['listenTo'](_0x52dbe4,'mouseup',(_0x1d82d7,_0x16f6e5)=>{const _0x3becf9=_0x16f6e5['target'],_0x2dedf5=this['_findMarkerElement'](_0x3becf9);if(!_0x2dedf5)return;const _0x4b5cec=_0x2dedf5['getAttribute']('data-marker-id'),_0x4edf42=_0x4b5cec['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x4b5cec,'changeId':_0x4edf42,'markerElement':()=>this['_findMarkerElementById'](_0x4b5cec),'domEvent':_0x16f6e5});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x52dbe4,'mouseover',(_0x5a4523,_0x2ef2de)=>{const _0x17da77=_0x2ef2de['target'],_0x207bee=_0x2ef2de['relatedTarget'];let _0x1ab10e=this['_findMarkerElement'](_0x17da77);if(!_0x1ab10e&&_0x207bee&&(_0x1ab10e=this['_findMarkerElement'](_0x207bee)),!_0x1ab10e)return;const _0x1b5cfc=_0x1ab10e['getAttribute']('data-marker-id'),_0x55a6ef=_0x1b5cfc['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x55a6ef,'markerElement':()=>this['_findMarkerElementById'](_0x1b5cfc),'domEvent':_0x2ef2de});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x2988fe((_0x65bf66,_0x247547)=>{const _0x35a511=_0x247547['target'];this['_findMarkerElement'](_0x35a511)||_0x35a511['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x16e844=this['context']['plugins']['get']('AIEditing'),_0xedcf22=us(this['context']);if(!_0xedcf22['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x54683c=new Set(),_0x3a84ec=[],_0x2aa8f4=new Map();for(const _0x3d0bf7 of _0xedcf22)for(const _0x3e0da6 of _0x3d0bf7['model']['document']['getRoots']()){if('$graveyard'===_0x3e0da6['rootName'])continue;const _0x18a5d2=this['_buildDocumentDataSliceForRoot'](_0x3d0bf7,_0x3e0da6,_0x16e844,_0x54683c);_0x3a84ec['push'](_0x18a5d2['content']);for(const [_0x130052,_0x15e2a7]of _0x18a5d2['elements'])_0x2aa8f4['set'](_0x130052,_0x15e2a7);}return{'elements':_0x2aa8f4,'content':_0x3a84ec['join']('')};}['_buildDocumentDataSliceForRoot'](_0x38fa69,_0xbfa43b,_0x388d1f,_0x172c85){const _0x416295=_0x38fa69['model'],_0xd3a754=new _0x53f775();for(const _0x1b2c38 of _0xbfa43b['getChildren']())_0xd3a754['_appendChild'](_0x1b2c38['_clone'](!0x0));for(const _0x30e9aa of _0x416295['markers']){const _0x374ec3=_0x30e9aa['getRange']();_0x374ec3&&_0x374ec3['root']['rootName']===_0xbfa43b['rootName']&&_0xd3a754['markers']['set'](_0x30e9aa['name'],this['_changeRangeOwnerDocument'](_0x374ec3['clone'](),_0xd3a754));}const _0x47634e=new Map(),_0x42d79b=_0x416295['document']['version'],_0x2b3a1c=new _0x230f6e({'ignoreElementEnd':!0x0,'startPosition':_0x416295['createPositionAt'](_0xd3a754,0x0)});for(const {item:_0x10291d}of _0x2b3a1c){if(_0x10291d['is']('element')&&_0x10291d['name']&&ah['includes'](_0x10291d['name'])){const _0x33a4e7=this['_upsertDataId'](_0x10291d,()=>_0x388d1f['_nextDataId'](_0x172c85));_0x172c85['add'](_0x33a4e7);}if(!_0x10291d['is']('$textProxy'))continue;const _0x564bff=_0x10291d['parent'];if(!_0x564bff||!_0x564bff['is']('element'))continue;const _0x25d5f2=this['_upsertDataId'](_0x564bff,()=>_0x388d1f['_nextDataId'](_0x172c85));_0x172c85['add'](_0x25d5f2);for(const _0x12bac6 of _0x564bff['getChildren']())_0x12bac6['is']('element')&&(_0x12bac6['name']&&oh['includes'](_0x12bac6['name'])||_0x172c85['add'](this['_upsertDataId'](_0x12bac6,()=>_0x388d1f['_nextDataId'](_0x172c85))));let _0x5c90d3=_0x564bff;for(;_0x5c90d3['parent']&&!_0x5c90d3['parent']['is']('documentFragment');)_0x5c90d3=_0x5c90d3['parent'],_0x5c90d3['hasAttribute'](_0x583773)&&_0x5c90d3['_removeAttribute'](_0x583773);_0x47634e['set'](_0x25d5f2,{'editor':_0x38fa69,'rootName':_0xbfa43b['rootName'],'path':_0x564bff['getPath'](),'documentVersion':_0x42d79b,'getContent':this['_createGetContentUsingDataIdFn'](_0x5c90d3['_clone'](!0x0),_0x25d5f2,_0x38fa69['data'])}),_0x2b3a1c['jumpTo'](_0x416295['createPositionAfter'](_0x564bff));}return{'content':_0x38fa69['data']['processor']['toData'](_0x38fa69['data']['toView'](_0xd3a754)),'elements':_0x47634e};}['diffContent'](_0x2b7c83,_0x181943,_0x29bc14,_0x31c2a3=!0x1){const {contentInitial:_0x90048,contentNew:_0x57206f}=this['_neutralizeChangesOnUnsupportedElements'](_0x181943,_0x29bc14),_0x3381b0=[],_0xe2707b=_0x2b7c83['data']['parse'](_0x57206f,'$documentFragment'),_0x261764=_0x2b7c83['data']['parse'](_0x90048,'$documentFragment'),_0x21145d=_0x2b7c83['model']['createPositionAt'](_0x261764,0x0);if(this['_haveSingleTopLevelElement'](_0xe2707b)){if(!this['_hasSameTopLevelElement'](_0x261764,_0xe2707b))return _0x3381b0;}else{const _0x2aa712=_0x2b7c83['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x261764,_0x2aa712)||!this['_haveOnlyInlineContent'](_0xe2707b,_0x2aa712))return _0x3381b0;}const _0x52a69e=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x90048,_0x57206f,{'targetEditor':_0x2b7c83,'anchor':_0x21145d,'markDeletions':!0x0})['getOperations']()['filter'](_0x1673f3=>'insert'===_0x1673f3['type']||'marker'===_0x1673f3['type']&&_0x1673f3['name']['startsWith']('$markedRemove')),_0x39785b=this['_groupAdjacentOperations'](_0x52a69e),_0x11ade7=[];if(_0x31c2a3){if(_0x39785b['length']){const _0x113631=_0x39785b[0x0]['operations'][0x0],_0x492078='insert'===_0x113631['type']?_0x113631['position']:_0x113631['newRange']['start'],_0x1d289d=this['_getPositionLimitingRange'](_0x492078,_0x2b7c83,'inside'),_0x429927=_0x1d289d?_0xe2707b['getChild'](0x0)['getChildren']():_0xe2707b['getChildren'](),_0x4cee85=_0x1d289d||_0x2b7c83['model']['createRangeIn'](_0x261764),_0x4853a8=[new _0x517bd6('$markedRemove:synthetic'+Ot(),null,_0x4cee85,_0x2b7c83['model']['document']['model']['markers'],!0x0,_0x2b7c83['model']['document']['version']+0x1),new _0x4d3193(_0x4cee85['end'],_0x429927,_0x2b7c83['model']['document']['version']+0x2)];_0x11ade7['push']({'operations':_0x4853a8,'operationsIsolated':_0x4853a8,'groupOffset':0x0});}}else _0x11ade7['push'](..._0x39785b);let _0x2b8507=0x0;return _0x2b7c83['model']['change'](_0x28285f=>{for(let _0x14405b=0x0;_0x14405b<_0x11ade7['length'];_0x14405b++){const _0x2fe8a8=_0x11ade7[_0x14405b],_0xd31481=_0x28285f['createDocumentFragment']();for(const _0x51ebca of _0x261764['getChildren']())_0x28285f['append'](_0x51ebca['_clone'](!0x0),_0xd31481);for(const _0x1aaaa6 of _0x2fe8a8['operationsIsolated'])if('insert'===_0x1aaaa6['type']){const _0x4136c9=_0x1aaaa6;_0x4136c9['baseVersion']=null,_0x4136c9['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4136c9,_0xd31481),_0x28285f['batch']['addOperation'](_0x1aaaa6),_0x2b7c83['model']['applyOperation'](_0x1aaaa6);const _0x11ee45='suggestion:insertion:id:authorId:'+_0x2b8507++,_0x3ff998=_0x2b7c83['model']['createRange'](_0x4136c9['position'],_0x4136c9['position']['getShiftedBy'](_0x4136c9['howMany']));_0xd31481['markers']['set'](_0x11ee45,_0x3ff998);}else{if('marker'===_0x1aaaa6['type']&&_0x1aaaa6['name']['startsWith']('$markedRemove')){const _0x3dfb4f=_0x1aaaa6,_0x22f43b='suggestion:deletion:id:authorId:'+_0x2b8507++;this['_changeOperationOwnerDocument'](_0x3dfb4f,_0xd31481),_0xd31481['markers']['set'](_0x22f43b,_0x3dfb4f['newRange']);}}if(_0x31c2a3)_0x3381b0['push']({..._0x2fe8a8,'context':this['_createGetContentFn'](_0x261764,_0x2b7c83['data']),'content':this['_createGetContentFn'](_0x261764,_0x2b7c83['data'])});else{const _0x5ad979=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x2fe8a8['operationsIsolated'][0x0]),_0xd31481),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x2fe8a8['operationsIsolated'][_0x2fe8a8['operationsIsolated']['length']-0x1]),_0xd31481),_0x2b7c83);_0xd31481['markers']['set'](rh+'suggestion-context',new _0x23ea4f(_0x5ad979['start'],_0x5ad979['end'])),_0x3381b0['push']({..._0x2fe8a8,'context':this['_createGetContextFn'](_0xd31481,_0x2b7c83['data'],{'ellipsisBefore':_0x5ad979['hasContentBefore'],'ellipsisAfter':_0x5ad979['hasContentAfter']}),'content':this['_createGetContentFn'](_0xd31481,_0x2b7c83['data'])});}}}),_0x3381b0;}['markChangePositionInEditorContent'](_0x1201e0,_0x42ab2f){if(!_0x1201e0['length'])return;const _0x429e8d=_0x1201e0[0x0]['parent']['id'],_0x1fc9e4=_0x42ab2f['elements']['get'](_0x429e8d);if(!_0x1fc9e4)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x429e8d);const _0xff6a57=_0x1fc9e4['path'],_0x5975a2=_0x1fc9e4['editor'],_0x1e27f9=_0x5975a2['model']['document']['getRoot'](_0x1fc9e4['rootName']);if(!_0x1e27f9)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x1fc9e4['rootName']);const _0x4933e7=_0x5975a2['model']['document']['history']['getOperations'](_0x1fc9e4['documentVersion']),_0x4fcb6e=[];for(const _0x2f1d28 of _0x1201e0){const _0x3fb005=_0x2f1d28['operationsIsolated']['map'](_0x3ea868=>this['_translateOperationToEditorContent'](_0x3ea868,_0xff6a57,_0x1e27f9));if(!_0x3fb005||!_0x3fb005['length'])continue;const _0x2b04f0=_0x3fb005['every'](_0x5b3c6c=>'marker'===_0x5b3c6c['type']&&_0x5b3c6c['name']['startsWith']('$markedRemove')),_0x229429=_0xd31715(_0x3fb005,_0x4933e7,{'document':_0x5975a2['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x20a52d of _0x229429)if('insert'===_0x20a52d['type']){const _0x4a9434=_0x20a52d,_0xa2e531=_0x4a9434['nodes'];_0x5975a2['model']['change'](_0xdc0519=>{const _0x118e67=_0xdc0519['createDocumentFragment']();for(const _0x4022e7 of _0xa2e531)_0xdc0519['append'](_0x4022e7['_clone'](!0x0),_0x118e67);_0x4fcb6e['push']({'start':_0x4a9434['position'],'end':_0x4a9434['position'],'type':'insert','groupId':_0x2f1d28['id'],'content':{'asString':this['_createGetContentFn'](_0x118e67,_0x5975a2['data'])(),'asFragment':_0x118e67}});});}else{if('marker'===_0x20a52d['type']&&_0x20a52d['name']['startsWith']('$markedRemove')){const _0x478752=_0x20a52d;let _0x4586f2='remove-text';if(_0x2b04f0){const _0x3b05bb=this['_findAdjacentContextDistance'](_0x478752['newRange']['start'],'backward',_0x5975a2['model']['schema']),_0x1f36d6=this['_findAdjacentContextDistance'](_0x478752['newRange']['end'],'forward',_0x5975a2['model']['schema']);if(_0x3b05bb||_0x1f36d6){const _0x107fc1=_0x478752['newRange']['start']['getShiftedBy'](-_0x3b05bb),_0x39f8bc=_0x478752['newRange']['end']['getShiftedBy'](_0x1f36d6);_0x4fcb6e['push']({'start':_0x107fc1,'end':_0x39f8bc,'groupId':_0x2f1d28['id'],'type':'remove-context'});}else _0x4586f2='remove-only';}_0x4fcb6e['push']({'start':_0x478752['newRange']['start'],'end':_0x478752['newRange']['end'],'groupId':_0x2f1d28['id'],'type':_0x4586f2});}}}this['_insertMarkers'](_0x4fcb6e,_0x5975a2);}['clearAllMarkers'](){const _0x19fec8=new Map();for(const _0x38e901 of this['_markers']['keys']()){const _0x1cfc1a=this['_markers']['get'](_0x38e901);_0x1cfc1a?.['editor']&&(_0x19fec8['has'](_0x1cfc1a['editor'])||_0x19fec8['set'](_0x1cfc1a['editor'],[]),_0x19fec8['get'](_0x1cfc1a['editor'])['push'](_0x38e901));}for(const [_0x4d4be2,_0x3bd5b1]of _0x19fec8)_0x4d4be2['model']['change'](_0x3e85a8=>{for(const _0x248fad of _0x3bd5b1)_0x4d4be2['model']['markers']['get'](_0x248fad)&&_0x3e85a8['removeMarker'](_0x248fad);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x33cb03 of us(this['context']))_0x33cb03['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x94282a of us(this['context']))_0x94282a['disableReadOnlyMode']('ai-review');}['applyChange'](_0x42d980,_0x2602c1=null){const _0x6504bc=_0x42d980['map'](_0x120d68=>this['_getMarkersDataForGroup'](_0x120d68))['flat'](),_0x2440e8=new Map();for(const _0x592588 of _0x6504bc)_0x2440e8['has'](_0x592588['editor'])||_0x2440e8['set'](_0x592588['editor'],[]),_0x2440e8['get'](_0x592588['editor'])['push'](_0x592588);for(const [_0x33e7b2,_0x1d14a4]of _0x2440e8){const _0xbbc315=_0x33e7b2['model'],_0x2506cd=_0x33e7b2['plugins']['has']('TrackChangesEditing')?_0x33e7b2['plugins']['get']('TrackChangesEditing'):null,_0x44a238=_0x2602c1&&_0x2506cd?new Set(_0x2506cd['getSuggestions']()['map'](_0x4d3cd0=>_0x4d3cd0['id'])):null;_0xbbc315['change'](_0x386bef=>{const _0x5b6ba9=_0x386bef['batch']['operations']['length'];for(const _0x38384e of _0x1d14a4){const _0x104cef=_0x33e7b2['model']['markers']['get'](_0x38384e['id']);if(_0x104cef){if('insert'===_0x38384e['type']){if(!_0x38384e['content'])continue;_0xbbc315['insertContent'](_0x38384e['content']['asFragment']||null,_0x104cef['getRange']()['start']);}else'remove-text'!==_0x38384e['type']&&'remove-only'!==_0x38384e['type']||_0xbbc315['deleteContent'](_0xbbc315['createSelection'](_0x104cef['getRange']()));_0x386bef['removeMarker'](_0x38384e['id']),this['_markers']['delete'](_0x38384e['id']);}}if(_0x2602c1&&(js(_0x386bef['batch']['operations']['slice'](_0x5b6ba9),_0x2602c1),_0x2506cd)){for(const _0x51583f of _0x2506cd['getSuggestions']())_0x44a238['has'](_0x51583f['id'])||_0x51583f['setAttribute']('@ai',{'type':_0x2602c1});}});}}['rejectChange'](_0x4583e0){const _0x3d1dcb=this['_getMarkersDataForGroup'](_0x4583e0),_0x1542b4=new Map();for(const _0x353703 of _0x3d1dcb)_0x1542b4['has'](_0x353703['editor'])||_0x1542b4['set'](_0x353703['editor'],[]),_0x1542b4['get'](_0x353703['editor'])['push'](_0x353703);for(const [_0x46c215,_0x223298]of _0x1542b4)_0x46c215['model']['change'](_0x273424=>{for(const _0x2285c4 of _0x223298)_0x273424['removeMarker'](_0x2285c4['id']),this['_markers']['delete'](_0x2285c4['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return us(this['context']);}['getEditorForChange'](_0x511c4e){return this['_getMarkersDataForGroup'](_0x511c4e)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x1ca84a){const _0x3f287d=Array['from'](this['_markers']['values']())['filter'](_0x1c910f=>_0x1c910f['groupId']===_0x1ca84a);if(!_0x3f287d['length'])return null;const _0x20a8c1=0x1===_0x3f287d['length']?_0x3f287d[0x0]:this['_sortMarkers'](_0x3f287d)[0x0],_0x3d4b50=_0x20a8c1['editor']['model']['markers']['get'](_0x20a8c1['id']);return _0x3d4b50?{'modelRange':_0x3d4b50['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x20a8c1['id'])}:null;}['getContentElementForChange'](_0x287e34){const _0x2dbbb5=Array['from'](this['_markers']['values']())['filter'](_0x228137=>_0x228137['groupId']===_0x287e34);if(!_0x2dbbb5['length'])return null;const _0x16d9f3=0x1===_0x2dbbb5['length']?_0x2dbbb5[0x0]:this['_sortMarkers'](_0x2dbbb5)[0x0],_0x2e9bc8=_0x16d9f3['editor'],_0x5e61c2=_0x2e9bc8['model']['markers']['get'](_0x16d9f3['id']);if(!_0x5e61c2)return null;const _0x4c3058=_0x5e61c2['getRange'](),_0x557ec8=_0x2e9bc8['editing']['view']['getDomRoot'](_0x4c3058['root']['rootName'])||_0x2e9bc8['editing']['view']['getDomRoot']();if(!_0x557ec8||!_0x4c3058)return null;let _0x32ce17=_0x4c3058['start']['parent'];for(;_0x32ce17['parent']&&!_0x32ce17['parent']['is']('rootElement');)_0x32ce17=_0x32ce17['parent'];if(!_0x32ce17||!_0x32ce17['name'])return null;const _0x526d8c=_0x557ec8['querySelector']('[data-marker-id=\x22'+_0x16d9f3['id']+'\x22]');if(!_0x526d8c)return null;let _0x32edc2=null;_0x2e9bc8['model']['change'](_0x2c772b=>{_0x32edc2=_0x2c772b['createDocumentFragment'](),_0x2c772b['append'](_0x32ce17['_clone'](!0x0),_0x32edc2);});const _0x488f74=_0x2e9bc8['data']['toView'](_0x32edc2)['getChild'](0x0);return _0x526d8c['closest'](_0x488f74['name']);}['reactivateMarkers'](_0x28c0a0){const _0x24478f=this['_getMarkersDataForGroup'](_0x28c0a0);if(!_0x24478f['length'])return;const _0x2dece6=Array['from'](this['_activeMarkers'])['sort'](),_0x3cd065=Array['from'](new Set(_0x24478f['map'](_0x5be0e1=>_0x5be0e1['id'])))['sort']();_0x2dece6['join']('|')!==_0x3cd065['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x28c0a0));}['setMarkersInElementAsActive'](_0x411303){const _0x25b8ae=this['_getMarkersDataForGroup'](_0x411303);if(!_0x25b8ae['length'])return;const _0x38b8c6=_0x25b8ae[0x0]['editor'],_0x23a27b=new Set(_0x25b8ae['map'](_0x2e665c=>_0x2e665c['id'])),_0x33f977=Array['from'](_0x23a27b['values']())['map'](_0xbfb9b5=>_0x38b8c6['model']['markers']['get'](_0xbfb9b5))['filter'](_0x9b99a8=>!!_0x9b99a8);_0x23a27b['forEach'](_0x3ce8b8=>{this['_activeMarkers']['add'](_0x3ce8b8);}),_0x38b8c6['model']['change'](()=>{_0x33f977['forEach'](_0x5ad3a8=>{_0x38b8c6['editing']['reconvertMarker'](_0x5ad3a8);});});}['setAllMarkersAsInactive'](){const _0x1b8773=Array['from'](this['_activeMarkers']);if(!_0x1b8773['length'])return;this['_activeMarkers']['clear']();const _0x1445ef=new Map();for(const _0x3624e9 of _0x1b8773){const _0x2396c0=this['_markers']['get'](_0x3624e9);if(!_0x2396c0)continue;const _0x34e78e=_0x2396c0['editor'],_0x3013f2=_0x34e78e['model']['markers']['get'](_0x3624e9);_0x3013f2&&(_0x1445ef['has'](_0x34e78e)||_0x1445ef['set'](_0x34e78e,[]),_0x1445ef['get'](_0x34e78e)['push'](_0x3013f2));}for(const [_0x51d375,_0x28b159]of _0x1445ef)_0x51d375['model']['change'](()=>{_0x28b159['forEach'](_0x3fb2c6=>{_0x51d375['editing']['reconvertMarker'](_0x3fb2c6);});});}['_getPositionLimitingRange'](_0x398618,_0x22d1c4,_0x445761='outside'){if(!_0x398618)return null;let _0x199296=_0x398618['parent'];for(;_0x199296&&_0x199296['parent']&&!_0x199296['parent']['is']('rootElement')&&!_0x22d1c4['model']['schema']['isLimit'](_0x199296)&&!_0x22d1c4['model']['schema']['isBlock'](_0x199296);)_0x199296=_0x199296['parent'];if(!_0x199296||!_0x199296['name']||_0x199296['is']('rootElement'))return null;let _0x1f16e4=null;return _0x22d1c4['model']['change'](_0x8dc2f6=>{_0x1f16e4='inside'===_0x445761?_0x8dc2f6['createRangeIn'](_0x199296):_0x8dc2f6['createRangeOn'](_0x199296);}),_0x1f16e4;}['_validateMarkers'](_0x227f5f,_0x3f5fad){const _0xb96add=Array['from'](this['_markers']['keys']()),_0x28fc59=new Map();for(const _0x56fd59 of _0xb96add){const _0x28518=_0x227f5f['model']['markers']['get'](_0x56fd59);if(!_0x28518)continue;const _0x2953e5=_0x28518['getStart']()['root']['rootName']+':'+_0x28518['getStart']()['path'][0x0];_0x28fc59['has'](_0x2953e5)||_0x28fc59['set'](_0x2953e5,[]),_0x28fc59['get'](_0x2953e5)['push'](_0x28518);}const _0xaa07f4=new Set();for(const _0x4c2443 of _0x227f5f['model']['document']['differ']['getChanges']()){let _0x449794='',_0x53eb60=null;if('insert'===_0x4c2443['type'])_0x53eb60=new _0x23ea4f(_0x4c2443['position'],_0x4c2443['position']['getShiftedBy'](_0x4c2443['length'])),_0x449794=_0x4c2443['position']['root']['rootName']+':'+_0x4c2443['position']['path'][0x0];else{if('remove'!==_0x4c2443['type'])continue;_0x53eb60=new _0x23ea4f(_0x4c2443['position']),_0x449794=_0x4c2443['position']['root']['rootName']+':'+_0x4c2443['position']['path'][0x0];}const _0x475a26=_0x28fc59['get'](_0x449794)||[];if(_0x475a26['length']){for(const _0xd48bc4 of _0x475a26)if(_0x53eb60['root']['rootName']===_0xd48bc4['getRange']()['root']['rootName']&&('insert'!==_0x4c2443['type']||!_0x53eb60['containsRange'](_0xd48bc4['getRange']()))&&(_0x53eb60['isIntersecting'](_0xd48bc4['getRange']())||_0x53eb60['start']['isTouching'](_0xd48bc4['getRange']()['end'])||_0x53eb60['end']['isTouching'](_0xd48bc4['getRange']()['start']))){const _0x2ea7fb=this['_parseMarkerName'](_0xd48bc4['name']);Array['from'](this['_markers']['values']())['filter'](_0x4e29c0=>_0x4e29c0['groupId']===_0x2ea7fb['groupId'])['forEach'](_0x5715ab=>_0xaa07f4['add'](_0x5715ab['id']));}}}if(_0xaa07f4['size']){for(const _0x7644f of _0xaa07f4)_0x3f5fad['removeMarker'](_0x7644f);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x57b22d){for(const {name:_0x527147,data:_0x770f1e}of _0x57b22d['model']['document']['differ']['getChangedMarkers']()){if(!_0x527147['startsWith'](rh))continue;const _0x4b27e9=_0x770f1e['oldRange'],_0x2f61f9=_0x770f1e['newRange'],_0x4573d4=_0x4b27e9&&'$graveyard'===_0x4b27e9['root']['rootName'],_0x31b219=_0x2f61f9&&'$graveyard'===_0x2f61f9['root']['rootName'];if(_0x4573d4&&_0x31b219)continue;const _0x24d37d=this['_parseMarkerName'](_0x527147);this['_markers']['get'](_0x527147)&&(_0x31b219||!_0x2f61f9?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x527147,'changeId':_0x24d37d['groupId']}):_0x4573d4&&_0x2f61f9&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x527147,'changeId':_0x24d37d['groupId']}));}}['_parseMarkerName'](_0x3786ef){const _0x56577a=_0x3786ef['split'](':'),_0x5e6828=(_0x56577a[0x1]||'')['split']('_');return{'prefix':_0x56577a[0x0],'groupId':_0x5e6828[0x0],'suffix':_0x5e6828[0x1]};}['_translateOperationToEditorContent'](_0x22362b,_0x2ebe10,_0x4f067b){if('insert'===_0x22362b['type']){const _0x401d29=_0x22362b;return new _0x4d3193(this['_changePosition'](_0x2ebe10['concat'](_0x401d29['position']['offset']),_0x4f067b),_0x401d29['nodes'],_0x401d29['baseVersion']);}if('marker'===_0x22362b['type']&&_0x22362b['name']['startsWith']('$markedRemove')){const _0x1ac42c=_0x22362b;return new _0x517bd6(_0x1ac42c['name'],_0x1ac42c['oldRange'],this['_changeRange'](_0x1ac42c['newRange'],_0x2ebe10['concat'](_0x1ac42c['newRange']['start']['offset']),_0x2ebe10['concat'](_0x1ac42c['newRange']['end']['offset']),_0x4f067b),_0x1ac42c['_markers'],_0x1ac42c['affectsData'],_0x1ac42c['baseVersion']);}return _0x22362b;}['_groupAdjacentOperations'](_0x4a4e7c){if(!_0x4a4e7c['length'])return[];const _0x3aff60=[];let _0xfec3d8=0x0,_0x3ad4af=0x0,_0x38b879=[];for(let _0x4ff62=0x0;_0x4ff62<=_0x4a4e7c['length'];_0x4ff62++){const _0xc4e77b=_0x4a4e7c[_0x4ff62],_0x4aef60=_0x4a4e7c[_0x4ff62-0x1];!_0xc4e77b||_0x4aef60&&!this['_getOperationEnd'](_0x4aef60)['isTouching'](this['_getOperationStart'](_0xc4e77b))?(_0x3aff60['push']({'operations':_0x38b879,'operationsIsolated':_0x38b879['map'](_0x4ac2f2=>this['_shiftOperation'](_0x4ac2f2['clone'](),-_0x3ad4af)),'groupOffset':_0xfec3d8}),_0x38b879=_0xc4e77b?[_0xc4e77b]:[],_0x3ad4af+=_0xfec3d8,_0xfec3d8=0x0):_0x38b879['push'](_0xc4e77b),_0xc4e77b&&'insert'===_0xc4e77b['type']&&(_0xfec3d8+=_0xc4e77b['howMany']);}return _0x3aff60;}['_findAdjacentContextDistance'](_0x34e4cf,_0x382f88,_0x3624e8,_0x5e4c48=0x1){const _0x1038c7=new _0x230f6e({'startPosition':_0x34e4cf,'direction':_0x382f88});let _0x37b89d=0x0;for(let _0x2a4fa1=0x0;_0x2a4fa1<_0x5e4c48;_0x2a4fa1++){let _0x2e3047=0x0,_0x419029=!0x1,_0x1b57c4='forward'===_0x382f88?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x1d69d3}of _0x1038c7)if(_0x1d69d3['is']('$textProxy')){const _0x4c8094=_0x1b57c4['exec'](_0x1d69d3['data']);if(_0x4c8094&&_0x4c8094['length']){if(_0x2e3047+='forward'===_0x382f88?_0x4c8094['index']+_0x4c8094[0x0]['length']:_0x1d69d3['data']['length']-_0x4c8094['index'],_0x4c8094[0x0]['length']!==_0x1d69d3['data']['length'])break;_0x419029=!0x0,_0x1b57c4='forward'===_0x382f88?/^\w+/:/\w+$/;}else{if(_0x419029)break;_0x2e3047+=_0x1d69d3['offsetSize'];}}else{if(_0x1d69d3['is']('element')){_0x3624e8['isInline'](_0x1d69d3)&&!_0x419029&&(_0x2e3047+=0x1);break;}}_0x37b89d+=_0x2e3047,_0x1038c7['jumpTo'](_0x34e4cf['getShiftedBy']('forward'===_0x382f88?_0x37b89d:-_0x37b89d));}return _0x37b89d;}['_getChangeContext'](_0x3ddedd,_0x43d050,_0x2ab176){const _0xa5bc4a=_0x2ab176['model']['schema'],_0x17f8fb=this['_findAdjacentContextDistance'](_0x3ddedd,'backward',_0xa5bc4a,0x6),_0x57c3e6=this['_findAdjacentContextDistance'](_0x43d050,'forward',_0xa5bc4a,0x6),_0x4cac9d=_0x3ddedd['getShiftedBy'](-_0x17f8fb),_0x414634=_0x43d050['getShiftedBy'](_0x57c3e6);return{'start':_0x4cac9d,'end':_0x414634,'hasContentBefore':!_0x4cac9d['isAtStart'],'hasContentAfter':!_0x414634['isAtEnd']};}['_insertMarkers'](_0x391646,_0x285ce8){const _0x1a8673=this['context']['plugins']['get']('AIEditing'),_0x145f7e=new Set();_0x285ce8['model']['change'](_0x4f0dfc=>{for(const _0x425f9b of _0x391646){const _0x15773c=''+rh+_0x425f9b['type']+':'+_0x425f9b['groupId']+'_'+_0x1a8673['_nextDataId'](_0x145f7e);this['_markers']['set'](_0x15773c,{'id':_0x15773c,'groupId':_0x425f9b['groupId'],'type':_0x425f9b['type'],'content':_0x425f9b['content'],'editor':_0x285ce8}),_0x4f0dfc['addMarker'](_0x15773c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4f0dfc['createRange'](_0x425f9b['start'],_0x425f9b['end'])});}});}['_createGetContextFn'](_0x452cd6,_0x59fee7,_0x21bf84){let _0x3af0e6='';return()=>{if(!_0x3af0e6){const _0x16aab6=_0x59fee7['toView'](_0x452cd6,{'showSuggestionHighlights':!0x0});let _0x2ce1ed=_0x16aab6['getChild'](0x0);if(_0x2ce1ed['is']('containerElement')||(_0x2ce1ed=_0x16aab6),!_0x2ce1ed)return'';let _0x22a264=!0x1;const _0x1e54da=[];for(const _0x46ba7c of _0x2ce1ed['getChildren']())_0x46ba7c['is']('element','span')&&_0x46ba7c['hasClass']('ck-ai_review-marker_context-end')&&(_0x22a264=!0x1),_0x22a264&&_0x1e54da['push'](_0x46ba7c),_0x46ba7c['is']('element','span')&&_0x46ba7c['hasClass']('ck-ai_review-marker_context-start')&&(_0x22a264=!0x0);_0x2ce1ed['_removeChildren'](0x0,_0x2ce1ed['childCount']),_0x21bf84?.['ellipsisBefore']&&_0x2ce1ed['_appendChild']('…'),_0x2ce1ed['_appendChild'](_0x1e54da),_0x21bf84?.['ellipsisAfter']&&_0x2ce1ed['_appendChild']('…');const _0x3d9aba=_0x59fee7['htmlProcessor']['domConverter']['viewToDom'](_0x16aab6),_0x1dabd0=_0x59fee7['htmlProcessor']['htmlWriter']['getHtml'](_0x3d9aba);_0x3af0e6=this['_removeUnsupportedElements'](_0x1dabd0);}return _0x3af0e6;};}['_createGetContentFn'](_0x2bbb25,_0x1b4c9d){let _0x2729d9='';return()=>(_0x2729d9||(_0x2729d9=this['_removeUnsupportedElements'](_0x1b4c9d['stringify'](_0x2bbb25,{'showSuggestionHighlights':!0x0}))),_0x2729d9);}['_createGetContentUsingDataIdFn'](_0x544995,_0x355114,_0x49c662){let _0x2c1984='';return()=>{if(!_0x2c1984){const _0x2c4abb=_0x49c662['toView'](new _0x53f775(_0x544995));_0x2c1984=_0x49c662['htmlProcessor']['domConverter']['viewToDom'](_0x2c4abb)['querySelector']('[data-id=\x22'+_0x355114+'\x22]')?.['outerHTML']||'';}return _0x2c1984;};}['_removeUnsupportedElements'](_0x42c2a5){if(!_0x42c2a5)return'';const _0x352575=Is(_0x42c2a5,{'decodeEntities':!0x1}),_0x3eec47=Ts(_0x352575);if(!_0x3eec47['length'])return _0x42c2a5;for(const _0x5d3525 of _0x3eec47)_0x3d0f4e(_0x5d3525);return ps(_0x352575,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x4d188f,_0x215961){const _0x12c893=Is(_0x4d188f,{'decodeEntities':!0x1}),_0x25105d=Is(_0x215961,{'decodeEntities':!0x1}),_0x154e30=Ts(_0x12c893),_0x35017d=Ts(_0x25105d);if(!_0x154e30['length']&&!_0x35017d['length'])return{'contentInitial':_0x4d188f,'contentNew':_0x215961};const _0xc52c85=new Map();for(const _0xfab7e3 of _0x154e30)_0xc52c85['set'](Cs(_0xfab7e3,'data-id'),_0xfab7e3);for(const _0x1dcab9 of _0x35017d){const _0x28c3fb=Cs(_0x1dcab9,'data-id'),_0x2bae3f=_0x28c3fb?_0xc52c85['get'](_0x28c3fb):void 0x0;_0x2bae3f?_0x2e5842(_0x1dcab9,_0x1163ea(_0x2bae3f,!0x0)):_0x3d0f4e(_0x1dcab9);}return{'contentInitial':ps(_0x12c893,{'encodeEntities':!0x1}),'contentNew':ps(_0x25105d,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x3fd43f,_0x5ebaa1=0x5){let _0x558638=_0x3fd43f,_0x15dad3=null;for(let _0x5cfc71=0x0;_0x5cfc71<_0x5ebaa1&&_0x558638;_0x5cfc71++)if(_0x558638['className']){if((''+_0x558638['className'])['includes']('ck-ai_review-marker_')){if(!_0x558638['getAttribute']('data-marker-id'))break;_0x15dad3=_0x558638;break;}_0x558638=_0x558638['parentElement'];}else _0x558638=_0x558638['parentElement'];return _0x15dad3;}['_findMarkerElementById'](_0x52eb86){const _0x48963f=this['_markers']['get'](_0x52eb86);if(!_0x48963f)return null;const _0x3acd9b=_0x48963f['editor']['model']['markers']['get'](_0x52eb86);return _0x3acd9b?_0x52b8f8(_0x48963f['editor']['editing'],_0x3acd9b):null;}['_getMarkersDataForGroup'](_0x127825){return Array['from'](this['_markers']['values']())['filter'](_0x294c59=>_0x294c59['groupId']===_0x127825);}['_getOperationStart'](_0x32f77f){return'insert'===_0x32f77f['type']?_0x32f77f['position']:_0x32f77f['newRange']['start'];}['_getOperationEnd'](_0x4f0c10,_0x4a67d5=!0x1){return'insert'===_0x4f0c10['type']?_0x4a67d5?_0x4f0c10['position']:_0x4f0c10['position']['getShiftedBy'](_0x4f0c10['howMany']):_0x4f0c10['newRange']['end'];}['_shiftOperation'](_0x12fde7,_0x5c3b2c){return'insert'===_0x12fde7['type']?_0x12fde7['position']=_0x12fde7['position']['getShiftedBy'](_0x5c3b2c):'marker'===_0x12fde7['type']&&_0x12fde7['newRange']&&(_0x12fde7['newRange']=new _0x23ea4f(_0x12fde7['newRange']['start']['getShiftedBy'](_0x5c3b2c),_0x12fde7['newRange']['end']['getShiftedBy'](_0x5c3b2c))),_0x12fde7;}['_changeOperationOwnerDocument'](_0x471a75,_0x27278e){'insert'===_0x471a75['type']?_0x471a75['position']=this['_changePositionOwnerDocument'](_0x471a75['position'],_0x27278e):'marker'===_0x471a75['type']&&_0x471a75['newRange']&&(_0x471a75['newRange']=this['_changeRangeOwnerDocument'](_0x471a75['newRange'],_0x27278e));}['_changePositionOwnerDocument'](_0x390f04,_0x2618cc){return new _0x38e1e9(_0x2618cc,_0x390f04['path']);}['_changeRangeOwnerDocument'](_0x2d88e7,_0x3d80a7){return new _0x23ea4f(this['_changePositionOwnerDocument'](_0x2d88e7['start'],_0x3d80a7),this['_changePositionOwnerDocument'](_0x2d88e7['end'],_0x3d80a7));}['_changePosition'](_0x271ef7,_0x2f8b8b){return new _0x38e1e9(_0x2f8b8b,[..._0x271ef7]);}['_changeRange'](_0x3cffab,_0x12d2c7,_0x4899ba,_0x1a611a){return new _0x23ea4f(this['_changePosition'](_0x12d2c7,_0x1a611a),this['_changePosition'](_0x4899ba,_0x1a611a));}['_sortMarkers'](_0x4f383d){const _0x1ac387=_0x10bf53=>{switch(_0x10bf53){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x4f383d['sort']((_0x3f2f82,_0x2143b3)=>_0x1ac387(_0x3f2f82['type'])-_0x1ac387(_0x2143b3['type']));}['_hasSameTopLevelElement'](_0x3ed11d,_0x5ec0af){const _0x2400cf=_0x3ed11d['getChild'](0x0),_0x3b635d=_0x5ec0af['getChild'](0x0);return!(!_0x2400cf||!_0x3b635d)&&((!_0x2400cf['is']('element')||!_0x3b635d['is']('element')||_0x2400cf['name']===_0x3b635d['name'])&&!(_0x2400cf['is']('element')&&!_0x3b635d['is']('element')||!_0x2400cf['is']('element')&&_0x3b635d['is']('element')));}['_haveSingleTopLevelElement'](_0x217492){return 0x1===_0x217492['childCount'];}['_haveOnlyInlineContent'](_0x54bdd8,_0x8b0454){for(const _0xa1bd2e of _0x54bdd8['getChildren']())if(_0xa1bd2e['is']('element')&&!_0x8b0454['isInline'](_0xa1bd2e))return!0x1;return!0x0;}['_upsertDataId'](_0x3c0f94,_0x1840cf){let _0x83d826=_0x3c0f94['getAttribute'](_0x583773);return _0x83d826||(_0x83d826=_0x1840cf(),_0x3c0f94['_setAttribute'](_0x583773,_0x83d826)),_0x83d826;}};const ch=/* #__PURE__ -- @preserve */
38
- lt();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x181d39,contentNew:_0x29bb2f,contentInitial:_0x2b970d,documentVersion:_0x2e9437}){super(),this['id']=_0x181d39,this['contentNew']=_0x29bb2f,this['contentInitial']=_0x2b970d,this['documentVersion']=_0x2e9437;}};const uh=/* #__PURE__ -- @preserve */
39
- _t();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x459f1b,_0x1c1067,_0x59ffe0){super(),this['id']=_0x459f1b,this['parent']=_0x59ffe0,this['_data']=_0x1c1067,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(_0x3fbd28,_0x22f693,_0x3f5345,_0x33ff28,_0x565d08){super(),this['_sourceCheck']=_0x22f693,this['_documentData']=_0x3fbd28,this['_aiConnector']=_0x3f5345,this['_reviewParams']=_0x33ff28,this['_reviewArgs']=_0x565d08,this['on']('change:status',(_0x508d92,_0x26f9d4,_0x3646d3)=>{'aborted'==_0x3646d3&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x3646d3,'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'](_0xde3d5e=>'pending'===_0xde3d5e['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x1fa485){this['_documentData']=_0x1fa485;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x224999=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0xac5fc8 of _0x224999)'unmodified'!==_0xac5fc8['data']['operation']&&('error'!==_0xac5fc8['data']['operation']?'review-metadata'!==_0xac5fc8['event']?this['_addReviewCheckResult'](_0xac5fc8['data']['dataId'],_0xac5fc8['data']['textDelta']):this['callId']=_0xac5fc8['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(_0x244988){this['_currentError']=_0x244988,sn(_0x244988)?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'](_0x378772,_0x40b7b6){const _0x586a97=this['_results']['get'](_0x378772);if(!_0x586a97)return;if(0x0===_0x40b7b6['length'])return;const _0x9a4673=[];_0x40b7b6['forEach']((_0x18e656,_0x3bb5ea)=>{const _0x13dc1a=new dh(_0x586a97['id']+'-'+_0x3bb5ea,_0x18e656,_0x586a97);_0x13dc1a['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x13dc1a,'status':_0x13dc1a['status']});}),_0x13dc1a['on']('change:isActivated',()=>{_0x13dc1a['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x13dc1a}):this['fire']('reviewCheckResultDeactivated',{'change':_0x13dc1a});}),this['_changes']['push'](_0x13dc1a),_0x9a4673['push'](_0x13dc1a);}),this['fire']('reviewCheckResultReady',{'changes':_0x9a4673,'result':_0x586a97,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x13d90d){const _0x3f5f9f=this['_changes']['find'](_0x532b66=>_0x532b66['id']===_0x13d90d);return!(!_0x3f5f9f||'pending'!==_0x3f5f9f['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x3b486c=>!0x0===_0x3b486c['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x30173f=>'pending'===_0x30173f['status']);}['getChangeById'](_0x369d7e){return this['_changes']['find'](_0xb083ad=>_0xb083ad['id']===_0x369d7e);}['markAllChangesAsAccepted'](){for(const _0x4881d8 of this['_changes'])'pending'===_0x4881d8['status']&&(_0x4881d8['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x1e10ad){const _0x1f8378=this['_changes']['find'](_0x5f51b5=>_0x5f51b5['id']===_0x1e10ad);_0x1f8378&&'pending'===_0x1f8378['status']&&(_0x1f8378['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x9bfc34){const _0x2d922d=this['_changes']['find'](_0x557970=>_0x557970['id']===_0x9bfc34);_0x2d922d&&'pending'===_0x2d922d['status']&&(_0x2d922d['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x5aad6a){const _0x46b0c0=this['_changes']['find'](_0x5e8746=>_0x5e8746['id']===_0x5aad6a);_0x46b0c0&&'pending'===_0x46b0c0['status']&&(_0x46b0c0['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x1e5432){const _0xdb61a9=this['_changes']['find'](_0x182c8b=>_0x182c8b['id']===_0x1e5432);_0xdb61a9&&'outdated'===_0xdb61a9['status']&&(_0xdb61a9['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x2b0f8c){this['_changes']['filter'](_0xec217b=>_0xec217b['isActivated']&&_0xec217b['id']!==_0x2b0f8c)['forEach'](_0x2eeb1e=>{_0x2eeb1e['isActivated']=!0x1;});const _0x2614f8=this['_changes']['find'](_0x200c7f=>_0x200c7f['id']===_0x2b0f8c);_0x2614f8&&'pending'===_0x2614f8['status']&&(_0x2614f8['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x139205=>_0x139205['isActivated'])['forEach'](_0x5a5541=>{_0x5a5541['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x12df9d){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x27c595;if(_0x12df9d){const _0x51140a=this['_changes']['find'](_0x3c6372=>_0x3c6372['id']===_0x12df9d);if(_0x51140a&&_0x51140a['isRated'])return;_0x51140a&&(_0x27c595=_0x51140a['parent']['id'],_0x51140a['isRated']=!0x0);}const _0x60e7a3={'positiveCount':this['_changes']['filter'](_0x2bb61f=>'accepted'===_0x2bb61f['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x60e7a3,this['callId'],_0x27c595);}['_addReviewCheckResult'](_0x148695,_0x56fa25){const _0x420631=this['_documentData']['elements']['get'](_0x148695);if(!_0x420631)return;const _0x3e3da3=_0x420631['getContent']();if(_0x3e3da3===_0x56fa25)return;const _0x2ba9f0=new lh({'id':_0x148695,'contentInitial':_0x3e3da3,'contentNew':_0x56fa25,'documentVersion':_0x420631['documentVersion']});this['_results']['set'](_0x2ba9f0['id'],_0x2ba9f0),this['fire']('reviewCheckResultAdded',{'result':_0x2ba9f0,'source':this,'editor':_0x420631['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x2e7c0d=>'pending'===_0x2e7c0d['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x1028d0=>'pending'===_0x1028d0['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x85f3ab=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0xa168cc=0x0;_0xa168cc<this['_reviewParams']['length'];_0xa168cc++){if(!this['_reviewParams'][_0xa168cc]||!this['_sourceCheck']['options'][_0xa168cc])continue;const _0x58a0af=this['_sourceCheck']['options'][_0xa168cc]['data']?.['find'](_0x87f8eb=>_0x87f8eb['id']===this['_reviewParams'][_0xa168cc]);_0x58a0af&&_0x85f3ab['push'](_0x58a0af['label']);}return _0x85f3ab['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x5625d1,_0x4707f1,_0x34ef1b){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x4707f1,_0x5625d1,_0x34ef1b);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x394116{['_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',(_0x337f95,_0x338cd1)=>this['runCheck'](_0x338cd1)),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 _0x8328f6=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x8328f6['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x8328f6['map'](_0x56a8e1=>_0x56a8e1['id']),this['_aiSource']);const _0x589fdc=this['_currentReviewCheckRun'];_0x589fdc['markAllChangesAsAccepted'](),_0x589fdc['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x16d86b,_0x45a3f1)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x45a3f1['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x45a3f1['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x45a3f1['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x45a3f1['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x394ec6,_0x402c74)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x402c74['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x402c74['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x402c74['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x402c74['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',(_0x3399de,_0x340c7e)=>{this['_onActivateChange'](_0x340c7e);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x5cc7fd,_0x553235)=>{this['_onDeactivateChange'](_0x553235);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x3a341c,_0x2f152c)=>{this['_onChangeMarkerClicked'](_0x3a341c,_0x2f152c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x420011,_0x4622ad)=>{this['_onChangeMarkerHovered'](_0x420011,_0x4622ad);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4cd78a,_0x539cb2)=>{this['_onChangeMarkerRemoved'](_0x4cd78a,_0x539cb2);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x42033a,_0x13e0cc)=>{this['_onChangeMarkerRestored'](_0x42033a,_0x13e0cc);});}async['runCheck'](_0xf1583c){if(!this['_availableReviewChecks'])return;const _0xe1c0d3=this['_availableReviewChecks']['find'](_0x3cbe4e=>_0x3cbe4e['id']===_0xf1583c['id']);if(_0xe1c0d3){this['_onReviewCheckRun'](_0xf1583c),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0xf1583c,_0xe1c0d3),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x40aeec,_0x4342b8)=>{switch(_0x4342b8['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x4342b8);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'!==_0x4342b8['status']&&'error-chunk'!==_0x4342b8['status']&&'error-general'!==_0x4342b8['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x9d1178,_0x53ce52)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x23e5bf=this['_diffContent'](_0x53ce52['editor'],_0x53ce52['result']['contentInitial'],_0x53ce52['result']['contentNew']);_0x53ce52['source']['addResultChanges'](_0x53ce52['result']['id'],_0x23e5bf);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x318f80,_0xc00ff)=>{for(const _0x446d71 of _0xc00ff['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x446d71);this['_markChangePositionInEditorContent'](_0xc00ff['changes'],_0xc00ff['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x5e81a6,_0x27da25)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x27da25['change']['id'],_0x27da25['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x2b8601,_0x48ac98)=>{this['_onReviewCheckResultActivated'](_0x48ac98);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x487e29){if(sn(_0x487e29))return;_0x487e29 instanceof at?this['_logError'](_0x487e29):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x487e29));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0xf1583c['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x1ff5e3,_0x423a98){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x423a98,this['_aiConnector'],_0x1ff5e3['params'],_0x1ff5e3['args']);}['_onChangeMarkerRemoved'](_0x52025f,_0x39e096){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x39e096['changeId']);}['_onChangeMarkerRestored'](_0x1d1ce0,_0x3b97e8){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x3b97e8['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x2615be=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x2615be&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x246d06 of this['_aiReviewCoreEditing']['getEditors']())_0x246d06['editing']['view']['change'](_0x181aaf=>{for(const _0xa61ca5 of _0x246d06['editing']['view']['document']['getRoots']())_0x181aaf['removeClass']('ck-ai_review-diff',_0xa61ca5),_0x181aaf['removeClass']('ck-ai_review-highlights',_0xa61ca5),_0x181aaf['removeClass']('ck-ai-translate-mode-content',_0xa61ca5);});}['_logError'](_0x3596bc){this['_reporter']['logError'](_0x3596bc),'ai-review-mode-models-unable-to-retrieve'===function(_0x359209){return _0x359209 instanceof nn?_0x359209['code']:_0x359209 instanceof Error?_0x359209['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x3596bc)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x78356e){if('content'===this['_changeActivationSource']){const _0x1900b6=this['_aiReviewCoreUi']['getChangeElement'](_0x78356e);_0x1900b6&&bt(_0x1900b6['closest']('.ck-ai_review__check-run-result')||_0x1900b6);}else{if('panel'===this['_changeActivationSource']){const _0x2269ed=this['_getChangeContentElement'](_0x78356e);if(!_0x2269ed)return;St({'target':_0x2269ed,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0x2ec19b,_0x2270e5,_0x3b2b97,_0x144589,_0x3570ce){super(_0x3b2b97,_0x144589,_0x3570ce),this['_prompt']=_0x2ec19b,this['_model']=_0x2270e5;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x74d359,_0x133eea,_0x125654){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x133eea,_0x74d359,_0x125654);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x23bfa0){this['id']=_0x23bfa0['id'],this['commandId']=_0x23bfa0['commandId'],this['title']=_0x23bfa0['title'],this['description']=_0x23bfa0['description'],this['isParameterized']=_0x23bfa0['isParameterized'],this['useArgs']=_0x23bfa0['useArgs'],this['options']=_0x23bfa0['options'],this['args']=_0x23bfa0['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x190a23,_0x335b62,_0x3e585e){super(_0x190a23),this['prompt']=_0x190a23['prompt'],this['model']=_0x190a23['model'],this['model']?this['_defaultModel']=_0x335b62['find'](_0x5599a3=>_0x5599a3['id']===this['model'])||null:this['_defaultModel']=_0x3e585e;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x2dc259){this['_prompt']=_0x2dc259;}set['model'](_0x2bac6e){this['_model']=_0x2bac6e;}},wh=class extends _0x394116{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'](_0x629cf8){this['_checks']=_0x629cf8['map'](_0x5ed6db=>new mh(_0x5ed6db));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x29818d){return this['checks']['find'](_0x4f1b17=>_0x4f1b17['id']===_0x29818d);}['removeCheckById'](_0x11c5ef){this['_checks']=this['_checks']['filter'](_0x3f80ba=>_0x3f80ba['id']!==_0x11c5ef);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x4c9b15,_0x21b403,_0x23d20b){super(_0x4c9b15),this['_models']=_0x21b403,this['_defaultModel']=_0x23d20b;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0xcc5a7,_0x5152f3,_0x884c7a){super(),this['_allModels']=_0xcc5a7,this['_recommendedModels']=_0x5152f3,this['_defaultModel']=_0x884c7a;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x26213b){this['_checks']=_0x26213b['map'](_0x549b44=>!0x0===_0x549b44['isExtra']?new Eh(_0x549b44,this['_allModels'],this['_defaultModel']):'custom'===_0x549b44['id']?new Sh(_0x549b44,this['_recommendedModels'],this['_defaultModel']):new mh(_0x549b44));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x4aa3db){super(_0x4aa3db),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5dde5c=>({'id':_0x5dde5c['id'],'commandId':_0x5dde5c['id'],'title':_0x5dde5c['label'],'description':_0x5dde5c['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5dde5c['prompt'],'model':_0x5dde5c['model']}));}async['_loadChecksList'](){const _0x509d01=[...Ch,...this['getExtraChecks']()]['map'](_0x36e46a=>_0x36e46a['isExtra']?_0x36e46a:this['_translateReviewCheck'](_0x36e46a)),_0x20f0fd=await this['_getModels'](),_0x4ccdac=new Rh(_0x20f0fd['all'],_0x20f0fd['recommended'],_0x20f0fd['default']);return _0x4ccdac['setupChecks'](_0x509d01),_0x4ccdac;}async['_getModels'](){const _0x2c97c7=this['context']['plugins']['get']('AIConnector');try{const _0x1e480b=new Xs({'connector':_0x2c97c7,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x3c08b7={'all':await _0x1e480b['getAll'](),'recommended':await _0x1e480b['getAvailableModels'](),'default':await _0x1e480b['getDefault']()};return this['_modelsLoadError']=null,_0x3c08b7;}catch(_0x255803){return this['_modelsLoadError']=new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x255803),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x51f29b){const _0x48caaa='AI_REVIEW_CHECK_'+_0x51f29b['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x503ca0={..._0x51f29b,'title':this['_translate'](_0x48caaa+'_TITLE',_0x51f29b['title']),'description':this['_translate'](_0x48caaa+'_DESCRIPTION',_0x51f29b['description'])};return _0x51f29b['options']&&(_0x503ca0['options']=_0x51f29b['options']['map'](_0x30655e=>({..._0x30655e,'label':this['_translate'](_0x48caaa+'_OPTIONS_LABEL',_0x30655e['label']||''),'data':_0x30655e['data']?_0x30655e['data']['map'](_0x56767b=>({..._0x56767b,'label':this['_translate'](_0x48caaa+'_OPTIONS_DATA_'+_0x56767b['id']['toUpperCase'](),_0x56767b['label'])})):void 0x0}))),_0x503ca0;}['_translate'](_0x3d63aa,_0x48afc3){const _0x800120=ls(this['context']['locale'],_0x3d63aa);return _0x800120===_0x3d63aa?_0x48afc3:_0x800120;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[rn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x54a746){super(_0x54a746),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x44dc22=>_0x44dc22['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x2f4737,_0x411fd7)=>{this['_isDiffOn']=_0x411fd7['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x201917,_0x14b03e){if(_0x201917['isCustom'])return new ph(_0x201917['args']['prompt'],_0x201917['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x14b03e,this['_aiConnector']);if(_0x14b03e['isExtra']){const _0x3a8a56=_0x14b03e;return new Th(_0x201917['args']?.['prompt']??_0x3a8a56['prompt'],_0x201917['args']?.['model']??_0x3a8a56['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x14b03e,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x14b03e,this['_aiConnector'],_0x201917['params'],_0x201917['args']);}['_onReviewCheckResultActivated'](_0x4f112c){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x4f112c['change']['id']),this['_scrollToChange'](_0x4f112c['change']['id']);const _0x3ce260=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4f112c['change']['id']);if(!_0x3ce260)return;const _0x34d613=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4f112c['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4f112c['change'],()=>_0x3ce260['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x34d613,_0x3ce260['modelRange']['root']['rootName']),_0x34d613?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x4f112c['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x6e273d){this['_currentReviewCheckRun']&&'click'===_0x6e273d['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x6e273d['id']));}['_onDeactivateChange'](_0xf8059e){this['_currentReviewCheckRun']&&'balloon'===_0xf8059e['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x3e3fa2,_0x1f4fa8){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1f4fa8['changeId']);const _0x135b8f=this['_currentReviewCheckRun']['getChangeById'](_0x1f4fa8['changeId']);if(!_0x135b8f)return;const _0x3a78a4=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1f4fa8['changeId']),_0x34c880=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1f4fa8['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x135b8f,_0x1f4fa8['markerElement'],_0x1f4fa8['domEvent'],'click',this['_getBalloonDomRoot'](_0x34c880,_0x3a78a4?.['modelRange']['root']['rootName']),_0x34c880?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x505aed,_0x14743e){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x49b277=this['_currentReviewCheckRun']['getChangeById'](_0x14743e['changeId']);if(!_0x49b277)return;const _0x512a4d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x14743e['changeId']),_0x28bd4c=this['_aiReviewCoreEditing']['getEditorForChange'](_0x14743e['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x49b277,_0x14743e['markerElement'],_0x14743e['domEvent'],'hover',this['_getBalloonDomRoot'](_0x28bd4c,_0x512a4d?.['modelRange']['root']['rootName']),_0x28bd4c?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x13452b){const _0x285f34=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x13452b);return _0x285f34?_0x285f34['getElement']():null;}['_markChangePositionInEditorContent'](_0x16279e,_0x4263dc){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x16279e,_0x4263dc);}['_diffContent'](_0x1ee864,_0x4734f7,_0x312060){return this['_aiReviewCoreEditing']['diffContent'](_0x1ee864,_0x4734f7,_0x312060,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x4cac27){_0x4cac27?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0xa9f29 of this['_aiReviewCoreEditing']['getEditors']())_0xa9f29['editing']['view']['change'](_0x2ef4d8=>{for(const _0x3a44ff of _0xa9f29['editing']['view']['document']['getRoots']()){for(const _0xd32214 of _0x3a44ff['getClassNames']())_0xd32214['startsWith']('ck-ai_review-')&&_0x2ef4d8['removeClass'](_0xd32214,_0x3a44ff);_0x2ef4d8['addClass'](_0x4cac27?'ck-ai_review-diff':'ck-ai_review-highlights',_0x3a44ff);}});}['_getBalloonDomRoot'](_0x503045,_0x5557da){const _0x19f143=_0x503045['editing']['view'];if(_0x5557da){const _0xa46460=_0x19f143['getDomRoot'](_0x5557da);if(_0xa46460)return _0xa46460;}return _0x19f143['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0xe2eaaa=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x3ddab2=await _0xe2eaaa['getChecksList']();_0xe2eaaa['modelsLoadError']&&this['_logError'](_0xe2eaaa['modelsLoadError']);let _0x5673e4=_0x3ddab2['checks'];const _0x97af8f=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x97af8f,_0x5673e4),this['_usesAvailableCommandsConfig']&&(_0x5673e4=_0x97af8f['map'](_0x3429eb=>_0x5673e4['find'](_0xbfbecf=>_0xbfbecf['id']===_0x3429eb))['filter'](_0x5ddccf=>!!_0x5ddccf)),this['_filterChecksWithMissingModel'](_0x5673e4);}['_logWarningForNonExistentChecks'](_0x4d22dd,_0x3f1636){const _0x5f4762=_0x4d22dd['filter'](_0x2a9513=>!_0x3f1636['some'](_0x2cbbe1=>_0x2cbbe1['id']===_0x2a9513));_0x5f4762['length']&&this['_reporter']['logError'](new nn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x5f4762['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x415328){const _0x42f2cb=[];return _0x415328['forEach'](_0x1ee92e=>{(_0x1ee92e instanceof Eh&&!_0x1ee92e['defaultModel']||_0x1ee92e instanceof Sh&&!_0x1ee92e['models']['length'])&&_0x42f2cb['push'](_0x1ee92e['id']);}),_0x42f2cb['length']&&_0x42f2cb['forEach'](_0x4e6ae7=>{_0x415328=_0x415328['filter'](_0x3ce942=>_0x3ce942['id']!==_0x4e6ae7),this['_reporter']['logError'](new nn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x4e6ae7}}));}),_0x415328;}};function kh(_0x28ed60,_0x3aadbc,_0x153f8d,_0x2db01e){return _0x28ed60 instanceof at?_0x28ed60:new at(_0x3aadbc,_0x153f8d,_0x2db01e,_0x28ed60);}var Nh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x440bdc){this['_affectedBlocks']=_0x440bdc;}},yh=class extends _0x394116{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'](_0x4ff436=>{const _0xf00fbd={'id':_0x4ff436['id'],'title':_0x4ff436['title'],'description':_0x4ff436['description']};return'custom'!==_0x4ff436['id']&&_0x4ff436['options']?.['length']&&(_0xf00fbd['parameters']=_0x4ff436['options'][0x0]['data']['map'](_0x58897d=>({..._0x58897d}))),_0xf00fbd;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x359784,_0x2b50a4){return await this['_runReviewCheck'](_0x359784,()=>this['_createReviewCheckRun'](_0x359784,_0x2b50a4?.['parameterId']),_0x2b50a4?.['signal']);}async['runCustomReview'](_0x15cde9,_0x48d78c){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x15cde9,_0x48d78c?.['model']),_0x48d78c?.['signal']);}['applyReview'](_0x3ae506,_0x483d5e){this['context']['plugins']['get']('AIGateway')['apply'](_0x3ae506,{'applyMethod':_0x483d5e,'aiSource':'review'});}async['_runReviewCheck'](_0x46cc96,_0x29a46b,_0x13b1f7){const _0x14fcb3=ds(this['context']),_0x46f19d=new Nh({'editor':_0x14fcb3,'rootName':_0x14fcb3['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x14fcb3['plugins']['get']('AIEditing')['getSessionId'](_0x14fcb3)});let _0x416a86,_0x4bb743;if(_0x13b1f7){if(_0x13b1f7['aborted'])return _0x46f19d['abort'](),_0x46f19d;const _0x1e7fa9=()=>{_0x46f19d['error']||(_0x46f19d['abort'](),_0x416a86&&_0x416a86['abort']());};_0x13b1f7['addEventListener']('abort',_0x1e7fa9),_0x4bb743=()=>_0x13b1f7['removeEventListener']('abort',_0x1e7fa9);}try{_0x416a86=await _0x29a46b(),_0x46f19d['contentRawOld']=_0x416a86['documentData']['content'],_0x46f19d['documentVersion']=Array['from'](_0x416a86['documentData']['elements'])['find'](([,_0x811b5a])=>_0x811b5a['rootName']===_0x46f19d['rootName'])?.[0x1]['documentVersion']??0x1,_0x416a86['on']('reviewCheckRunUpdated',(_0x3ab298,_0xf1c17c)=>{'aborted'===_0xf1c17c['status']?_0x46f19d['abort']():'error-general'!==_0xf1c17c['status']&&'error-chunk'!==_0xf1c17c['status']||(_0x46f19d['error']=kh(_0xf1c17c['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x46cc96}));}),'aborted'!==_0x46f19d['status']&&await _0x416a86['start']();}catch(_0x38b6dc){_0x46f19d['error']=kh(_0x38b6dc,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x46cc96});}finally{_0x4bb743&&_0x4bb743();}if(!_0x416a86||'aborted'===_0x46f19d['status']||'error'===_0x46f19d['status'])return _0x46f19d;_0x46f19d['affectedBlocks']=_0x416a86['results']['map'](_0x20fe5a=>({'id':_0x20fe5a['id'],'content':_0x20fe5a['contentNew']}));try{_0x46f19d['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x46f19d['affectedBlocks'],_0x46f19d['contentRawOld'],_0x46f19d['editor']));}catch(_0x2c82a9){_0x46f19d['error']=kh(_0x2c82a9,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x46cc96});}return _0x46f19d;}async['_createReviewCheckRun'](_0x59be0e,_0x554bd2){const _0x4dc455=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x3fb87d=>_0x3fb87d['id']===_0x59be0e);if(!_0x4dc455)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x59be0e});if(_0x4dc455 instanceof Sh)throw new at('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x59be0e});const _0x58499c=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x3dc5bb=this['context']['plugins']['get']('AIConnector');if(_0x4dc455 instanceof Eh){if(!_0x4dc455['defaultModel']?.['id'])throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x59be0e});return new Th(_0x4dc455['prompt'],_0x4dc455['defaultModel']['id'],_0x58499c,_0x4dc455,_0x3dc5bb);}return new Ah(_0x58499c,_0x4dc455,_0x3dc5bb,_0x554bd2?[_0x554bd2]:void 0x0);}async['_createCustomReviewCheckRun'](_0x21cf93,_0x5f0e86,_0x2cd42c){const _0x3c68aa=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x3f8ce0=>_0x3f8ce0['id']===_0x21cf93);if(!_0x3c68aa)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x21cf93});if(!(_0x3c68aa instanceof Sh))throw new at('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x21cf93});const _0x33feb1=_0x2cd42c??_0x3c68aa['defaultModel']?.['id'];if(!_0x5f0e86)throw new at('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x21cf93});if(!_0x33feb1)throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x21cf93});return new ph(_0x5f0e86,_0x33feb1,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x3c68aa,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x394116{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'](_0x537e91,_0x43abfe){if(this['assertStartReviewPreconditions'](_0x537e91)instanceof Sh)throw new at('ai-reviewmode-not-a-system-command',this,{'commandId':_0x537e91});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x537e91,'params':_0x43abfe?.['parameterId']?[_0x43abfe['parameterId']]:void 0x0});}async['startCustomReview'](_0x2d9f86,_0x1a960c){if(!_0x2d9f86)throw new at('ai-reviewmode-missing-custom-command-prompt',this);const _0x29d673=Ch['find'](_0x19312d=>'custom'===_0x19312d['commandId'])['id'],_0x47393f=this['assertStartReviewPreconditions'](_0x29d673),_0x473904=_0x1a960c?.['model']??_0x47393f['defaultModel']?.['id'];if(!_0x473904)throw new at('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x29d673,'isCustom':!0x0,'args':{'prompt':_0x2d9f86,'model':_0x473904}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x2b8532=>{const _0x100377={'id':_0x2b8532['id'],'title':_0x2b8532['title'],'description':_0x2b8532['description']};return'custom'!==_0x2b8532['id']&&_0x2b8532['options']?.['length']&&(_0x100377['parameters']=_0x2b8532['options'][0x0]['data']['map'](_0x1e66be=>({..._0x1e66be}))),_0x100377;});}['assertStartReviewPreconditions'](_0x270e57){const _0x4e2554=this['context']['plugins']['get']('AIReviewModeController');if(_0x4e2554['getCurrentCheckRun']())throw new at('ai-reviewmode-review-already-running',this);const _0x103da7=_0x4e2554['getAvailableChecks']()['find'](_0x539ea6=>_0x539ea6['id']===_0x270e57);if(!_0x103da7)throw new at('ai-reviewmode-unknown-command',this,{'commandId':_0x270e57});return _0x103da7;}},Lh=class extends Ah{['_title'];constructor(_0x2294a0,_0x3224d7,_0x2933d0,_0x1d4f32,_0x389448,_0x1595dd){super(_0x2294a0,_0x3224d7,_0x2933d0,_0x389448,_0x1595dd),this['_title']=_0x1d4f32;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x1d3ee7){this['_checks']=_0x1d3ee7['map'](_0xae3cde=>new Dh(_0xae3cde));}};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(_0x39f26b){super(_0x39f26b),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x58dccf=[],_0x41df79=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x589a67 of _0x41df79)_0x58dccf['push']({'title':_0x589a67['label'],'id':_0x589a67['id'],'commandId':_0x589a67['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x589a67['id']}});const _0x751ef6=new Ph();return _0x751ef6['setupChecks'](this['_translateChecks'](_0x58dccf)),_0x751ef6;}['_translateChecks'](_0x5da36e){const _0x2ee70d=this['context']['locale'];return _0x5da36e['map'](_0x4e5fba=>{const _0x325c57='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x4e5fba['title']['toUpperCase']()['replaceAll']('-','_'),_0x1cae34=ls(_0x2ee70d,_0x325c57);return{..._0x4e5fba,'title':_0x1cae34===_0x325c57?_0x4e5fba['title']:_0x1cae34};});}},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'](_0x5123e1,_0x225df8){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x225df8,this['_aiConnector'],ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x5123e1['params'],_0x5123e1['args']);}['_onReviewCheckResultActivated'](_0x30f43e){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x30f43e['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x30f43e['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x42eaf9){this['_currentReviewCheckRun']&&('hover'===_0x42eaf9['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x42eaf9['id'])),'click'===_0x42eaf9['uiInteraction']&&this['_scrollToChange'](_0x42eaf9['id']));}['_onDeactivateChange'](_0x2746e3){this['_currentReviewCheckRun']&&'panel'===_0x2746e3['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4a6504,_0x20f783){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x20f783['changeId']),this['_scrollToChange'](_0x20f783['changeId']));}['_onChangeMarkerHovered'](_0x26ee95,_0x6d3612){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x6d3612['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x6d3612['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x4847a2){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x4847a2);}['_markChangePositionInEditorContent'](_0x485e85,_0x4b8c7d){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x485e85,_0x4b8c7d);}['_diffContent'](_0x1cab60,_0x4b7404,_0x3aeced){return this['_aiReviewCoreEditing']['diffContent'](_0x1cab60,_0x4b7404,_0x3aeced,!0x0);}['_onReviewCheckRun'](){for(const _0x10afa6 of this['_aiReviewCoreEditing']['getEditors']())_0x10afa6['editing']['view']['change'](_0x20a3ca=>{for(const _0x41488f of _0x10afa6['editing']['view']['document']['getRoots']())_0x20a3ca['addClass']('ck-ai-translate-mode-content',_0x41488f);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x19da3c,_0x50c20f){super(_0x19da3c,_0x50c20f),this['on']('set:isLoading',(_0x3c3ebb,_0x31c54d,_0x41189d)=>{_0x41189d&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x3ae5a0,_0x2b3552,_0x3a29c4)=>{_0x3a29c4&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0xf19a97=super['_createAcceptAllButtonView']();return _0xf19a97['set']('label',ls(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0xf19a97;}['_createExitReviewButtonView'](){const _0x59d2de=super['_createExitReviewButtonView']();return _0x59d2de['set']('label',ls(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x59d2de;}},Bh=class extends sh{['_setupTemplate'](){const _0x5e2508=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x5e2508['if']('isVisible','ck-hidden',_0x5707e0=>!_0x5707e0)]},'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',_0x5e2508['if']('isVisible','ck-hidden',_0xa477b0=>!_0xa477b0)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x32d601=this['context']['plugins']['get']('AITabs'),_0x283e11=this['context']['locale'],_0x37a909=new Ho(_0x283e11,{'label':ls(_0x283e11,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x499c30,'class':'ck-ai-header_review-translate','showResizeButton':_0x32d601['showResizeButton']});_0x37a909['delegate']('resizeTabs')['to'](_0x32d601),_0x37a909['bind']('isMaximized')['to'](_0x32d601['view'],'isMaximized',_0x2edad0=>_0x2edad0);const _0x3b46cf=new $a(_0x283e11,{'header':_0x37a909,'list':new Bh(_0x283e11),'results':new Uh(_0x283e11,{'generalErrorText':ls(_0x283e11,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x283e11,{'headerText':ls(_0x283e11,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':ls(_0x283e11,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x283e11,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x3b46cf['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x3b46cf;}['registerTab'](){const _0x3d5bba=this['context']['plugins']['get']('AITabs');_0x3d5bba['view']['on']('activateTab',(_0xa75401,{newTab:_0x542fd1,oldTab:_0x1889fb})=>{'translate'===_0x542fd1?this['fire']('getReviewCheckList'):'translate'===_0x1889fb&&this['fire']('leaveReview');}),_0x3d5bba['view']['addTab']({'id':'translate','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x499c30,'order':0x0,'content':this['_mainView']});}},Fh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x10a6eb){this['_affectedBlocks']=_0x10a6eb;}},Kh=class extends _0x394116{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'](_0x2656c0,_0x133faf){return await this['_runTranslateCheck'](_0x2656c0,()=>this['_createTranslateCheckRun'](_0x2656c0),_0x133faf?.['signal']);}['applyTranslate'](_0xf15c3c,_0x156ba4){this['context']['plugins']['get']('AIGateway')['apply'](_0xf15c3c,_0x156ba4);}async['_runTranslateCheck'](_0x4ca192,_0x2f29a4,_0x2f9404){const _0x4e6157=ds(this['context']),_0x51dbd2=new Fh({'editor':_0x4e6157,'rootName':_0x4e6157['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x4e6157['plugins']['get']('AIEditing')['getSessionId'](_0x4e6157)});let _0x20ee14,_0x2d6609;if(_0x2f9404){if(_0x2f9404['aborted'])return _0x51dbd2['abort'](),_0x51dbd2;const _0x46206b=()=>{_0x51dbd2['error']||(_0x51dbd2['abort'](),_0x20ee14&&_0x20ee14['abort']());};_0x2f9404['addEventListener']('abort',_0x46206b),_0x2d6609=()=>_0x2f9404['removeEventListener']('abort',_0x46206b);}try{_0x20ee14=await _0x2f29a4(),_0x51dbd2['contentRawOld']=_0x20ee14['documentData']['content'],_0x51dbd2['documentVersion']=Array['from'](_0x20ee14['documentData']['elements'])['find'](([,_0x480660])=>_0x480660['rootName']===_0x51dbd2['rootName'])?.[0x1]['documentVersion']??0x1,_0x20ee14['on']('reviewCheckRunUpdated',(_0x39a4cc,_0x3f06d5)=>{'aborted'===_0x3f06d5['status']?_0x51dbd2['abort']():'error-general'!==_0x3f06d5['status']&&'error-chunk'!==_0x3f06d5['status']||(_0x51dbd2['error']=kh(_0x3f06d5['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x4ca192}));}),'aborted'!==_0x51dbd2['status']&&await _0x20ee14['start']();}catch(_0xc85060){_0x51dbd2['error']=kh(_0xc85060,'ai-translategateway-translation-run-failed',this,{'language':_0x4ca192});}finally{_0x2d6609&&_0x2d6609();}if(!_0x20ee14||'aborted'===_0x51dbd2['status']||'error'===_0x51dbd2['status'])return _0x51dbd2;_0x51dbd2['affectedBlocks']=_0x20ee14['results']['map'](_0x34a8e3=>({'id':_0x34a8e3['id'],'content':_0x34a8e3['contentNew']}));try{_0x51dbd2['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x51dbd2['affectedBlocks'],_0x51dbd2['contentRawOld'],_0x51dbd2['editor']));}catch(_0x32f42a){_0x51dbd2['error']=kh(_0x32f42a,'ai-translategateway-translation-run-failed',this,{'language':_0x4ca192});}return _0x51dbd2;}async['_createTranslateCheckRun'](_0x3a80c2){const _0x3e8cc6=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x15424e=this['context']['plugins']['get']('AIConnector');return new Lh(_0x3e8cc6,new Dh({'id':_0x3a80c2,'commandId':_0x3a80c2,'title':_0x3a80c2,'description':'','isParameterized':!0x1}),_0x15424e,ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x3a80c2});}},Wh=class extends _0x394116{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'](_0x2b178d){const _0x350778=this['assertStartTranslatePreconditions'](_0x2b178d);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x350778['id'],'args':_0x350778['useArgs']?_0x350778['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x3acd4a=>({'id':_0x3acd4a['id'],'label':_0x3acd4a['title']}));}['assertStartTranslatePreconditions'](_0x180784){const _0x5254af=this['context']['plugins']['get']('AITranslateController');if(_0x5254af['getCurrentCheckRun']())throw new at('ai-translate-translation-already-running',this);const _0x5df2b8=_0x5254af['getAvailableChecks']()['find'](_0x4ab8c5=>_0x4ab8c5['id']===_0x180784);if(!_0x5df2b8)throw new at('ai-translate-unknown-language',this,{'languageId':_0x180784});return _0x5df2b8;}};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 _0x558985,ContextPlugin as _0x394201,Editor as _0x2e6d5b,Plugin as _0x16e292,rootAcceptsBlocks as _0x4f8797}from'@ckeditor/ckeditor5-core';import{IconAI as _0x43cb5b,IconAIAdjustLength as _0x277bed,IconAIAskAI as _0x30d1f0,IconAIChangeTone as _0x2d4998,IconAIChat as _0x480028,IconAIChatCommands as _0x1a32ec,IconAIContinueWriting as _0x283cdb,IconAIGrammarCheck as _0x3ff1ce,IconAIHistory as _0x4e1b6d,IconAIImproveWriting as _0x2f7d74,IconAIOther as _0x34caf3,IconAIQuickActions as _0x434f07,IconAIReview as _0x1b2515,IconAITranslate as _0x1ea070,IconBoxWithCheck as _0x3428b3,IconBoxWithCross as _0x4836fa,IconBoxWithMarker as _0x5ba252,IconBrowseFiles as _0x5cb106,IconBulb as _0xb0d5f5,IconCancel as _0x16ce26,IconCheck as _0x324330,IconChevronDown as _0x26e683,IconChevronRight as _0x192090,IconChevronUp as _0x678f87,IconCopy as _0x11d6e2,IconDocument as _0x51d1ff,IconDocumentOutline as _0x550d85,IconDropdownArrow as _0x27e475,IconError as _0xc6c85a,IconEye as _0x547c0a,IconEyeCrossedOut as _0xc61baf,IconFileUpload as _0x209362,IconImage as _0x358fa7,IconInfo as _0x35032d,IconLink as _0x4cbb19,IconLoupe as _0x5b13ba,IconMagicWand as _0x24b027,IconMaximize as _0x23d910,IconMinimize as _0x1f0b5c,IconNextArrow as _0x17ed18,IconOutdated as _0x2b660b,IconPaperClip as _0x12f599,IconPin as _0x21c1ea,IconPlus as _0x2fe3ad,IconPreviousArrow as _0x3606c6,IconRefresh as _0x5aa03d,IconRobotPencil as _0x31f471,IconSelection as _0x109bae,IconShowChangesOff as tt,IconShowChangesOn as et,IconStop as it,IconSubmit as st,IconThreeHorizontalDots as nt,IconThumbDown as rt,IconThumbUp as ot,IconWeb as at}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ht,Collection as ct,DomEmitterMixin as lt,EmitterMixin as ut,FocusTracker as dt,KeystrokeHandler as _t,ObservableMixin as gt,Rect as At,ResizeObserver as It,_isMotionReduced as pt,first as mt,getConstrainedViewportRect as Et,global as Tt,insertToPriorityArray as wt,isVisible as Ct,logError as ft,logWarning as bt,scrollAncestorsToShowTarget as St,scrollViewportToShowTarget as Rt,toArray as Ot,uid as vt,version as kt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Nt,BalloonPanelView as yt,BalloonToolbar as xt,BodyCollection as Lt,ButtonLabelView as Dt,ButtonLabelWithHighlightView as Pt,ButtonView as Ht,Dialog as Mt,DialogViewPosition as Vt,DropdownMenuPanelPositioningFunctions as Ut,FileDialogButtonView as Bt,FocusCycler as Gt,FormHeaderView as Ft,FormRowView as Kt,HighlightedTextView as Wt,IconView as Yt,InputTextView as $t,LabeledFieldView as qt,ListItemButtonView as Qt,ListItemGroupView as Xt,ListItemView as zt,ListView as jt,MenuBarMenuListItemButtonView as Jt,MenuBarMenuListItemView as Zt,MenuBarMenuListView as te,MenuBarMenuView as _0x547906,SearchTextView as _0x390b84,SpinnerView as _0x5add43,TextareaView as _0x28d4e5,ToolbarView as _0x311510,UIModel as _0x1ca844,View as _0x2bc1f3,ViewCollection as _0x17d17e,addListToDropdown as _0xee0f07,addMenuToDropdown as _0x318aab,clickOutsideHandler as _0xf3e5e2,createDropdown as _0x4e3ad4,createLabeledInputText as _0x26acbe,createLabeledTextarea as _0x170dd3,submitHandler as _0x39e9cb}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x1353fc,ClipboardPipeline as _0x3f51a5}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0xf4afdb,MarkerOperation as _0x240713,Matcher as _0x282a5,ModelDocumentFragment as _0x31aa53,ModelPosition as _0x56972e,ModelRange as _0x4ab7a9,ModelTreeWalker as _0xaa3b47,ViewDataTransfer as _0x5347ee,ViewDocumentDomEventData as _0x19022f,ViewDowncastWriter as _0x181c4e,ViewUpcastWriter as _0x2f6006,_DetachOperation as _0x4202c4,_insertIntoModelNodeList as _0x2bf055,_removeFromModelNodeList as _0x593264,transformOperationSets as _0xce3122}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x112d5f,debounce as _0xb2e5d9,escape as _0x4ae7b3,escapeRegExp as _0x2444d5,throttle as _0x55e952,unescape as _0x2131a0}from'es-toolkit/compat';import{createParser as _0x2fd08c}from'eventsource-parser';import{CloudServices as _0x11ec1c}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x2e5226,DATA_ID_MODEL_ATTRIBUTE as _0x3d3bc3,DATA_ID_VIEW_ATTRIBUTE as _0x10b9f7,DocumentCompare as _0x4e4fa1,SuggestionsConversion as _0x26e10c,fixElementSuggestionRange as _0x1fc689,getAllMarkersDomElementsSorted as _0x2f0863,getMarkerDomElement as _0x346dae}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x14ef76}from'htmlparser2';import{append as _0x51fd1d,appendChild as _0x4fad71,find as _0x3fb2b0,findAll as _0x2de7b4,findOne as ti,getChildren as _0x8131bf,getParent as _0x58022d,isComment as _0x2aa7e8,isTag as _0x57b23c,prepend as _0x197a81,prependChild as _0x12b04e,removeElement as _0x3b2f55,replaceElement as _0x245e63,textContent as _0x90b1f2}from'domutils';import _0x253579 from'dom-serializer';import{Document as _0x1bffc9,Element as _0x4fab21,NodeWithChildren as _0xc1e367,Text as _0x108c76,cloneNode as _0x1263cf,isDocument as _0x15d293,isText as _0x384927}from'domhandler';import{MarkdownGfmMdToHtml as _0x1a42d9,MarkdownGfmMdToHtmlDefaultPlugins as _0x5482e3}from'@ckeditor/ckeditor5-markdown-gfm';import _0x4232fd from'rehype-sanitize';import _0xf82e6c from'morphdom';import{diffArrays as _0x46d927}from'diff';const fi='_ungrouppedCommands';function bi(_0x5b1b12,_0x1d82e9){const _0x2c6947=(0x0,_0x1d82e9['t'])('Other');return _0x5b1b12['length']?'groupId'in _0x5b1b12[0x0]?_0x5b1b12:[{'groupId':fi,'groupLabel':_0x2c6947,'order':0x1/0x0,'commands':_0x5b1b12}]:[{'groupId':fi,'groupLabel':_0x2c6947,'order':0x1/0x0,'commands':[]}];}const Si=globalThis['DataTransfer'],Ri='ai-ui';var Oi=class extends _0x16e292{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x2f74e0}=this,_0x48fef5=['ck-fake-ai-selection'];_0x2f74e0['config']['get']('ai.assistant.useTheme')&&_0x48fef5['push']('ck-ai-assistant-ui_theme'),_0x2f74e0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Ri,'view':{'classes':_0x48fef5,'priority':0xc}}),_0x2f74e0['conversion']['for']('editingDowncast')['markerToElement']({'model':Ri,'view':(_0x29f4b1,{writer:_0x1c1802})=>{if(!_0x29f4b1['markerRange']['isCollapsed'])return null;const _0x177e68=_0x1c1802['createUIElement']('span');return _0x1c1802['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x177e68),_0x177e68;}});}['afterInit'](){!async function(_0x2b44fe){const _0x5ed045='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x2749da=0x78e40,_0x367edb=window['Date']['now'](),_0xfd962d=_0x2b44fe['editor'],_0x4e856b=new window['Promise'](_0x5857f4=>{_0xfd962d['once']('ready',_0x5857f4);}),_0x1615e0={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x50ccd5=_0xfd962d['config']['get']('licenseKey');async function _0x2b3178(){let _0x17d433,_0x29ef60=null,_0x265e44=null;try{return'GPL'==_0x50ccd5?'NotAllowed':(_0x17d433=_0x4aed38(),_0x17d433?(_0x17d433['usageEndpoint']&&(_0x265e44=_0x82a70e(_0x17d433['usageEndpoint'],_0x17d433['jti'])),await _0x3b56ef()?_0x5ab54e()?_0x2eb87c()?'Expired':_0x2aaad7()?('evaluation'==_0x17d433['licenseType']&&(_0x29ef60=_0x3da955('EvaluationLimit')),await _0x4dc42a()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x2eb87c(){const _0x3c9bca=['evaluation','trial']['includes'](_0x17d433['licenseType'])?_0x367edb/0x3e8:0xe10*_0x2749da;return _0x17d433['exp']<_0x3c9bca;}function _0x5ab54e(){const _0x5658a1=_0x17d433['features'];return!!_0x5658a1&&(!!_0x5658a1['includes']('*')||!!_0x5658a1['includes']('AI'));}function _0x2aaad7(){const _0x263fde=_0x17d433['licensedHosts'];if(!_0x263fde||0x0==_0x263fde['length'])return!0x0;const {hostname:_0x1a3f25}=new URL(window['location']['href']);if(_0x263fde['includes'](_0x1a3f25))return!0x0;const _0x4cf1aa=_0x1a3f25['split']('.');return _0x263fde['filter'](_0x1932e1=>_0x1932e1['includes']('*'))['map'](_0x4c0414=>_0x4c0414['split']('.'))['filter'](_0x2261d6=>_0x2261d6['length']<=_0x4cf1aa['length'])['map'](_0x109c4b=>Array(_0x4cf1aa['length']-_0x109c4b['length'])['fill']('*'===_0x109c4b[0x0]?'*':'')['concat'](_0x109c4b))['some'](_0x500859=>_0x4cf1aa['every']((_0x49ba0a,_0x2994f7)=>_0x500859[_0x2994f7]===_0x49ba0a||'*'===_0x500859[_0x2994f7]));}function _0x4dc42a(){return _0x29ef60&&_0x265e44?new window['Promise']((_0x222772,_0x3973c9)=>{_0x29ef60['then'](_0x222772,_0x3973c9),_0x265e44['then'](_0x460b62=>{'Valid'!=_0x460b62&&_0x222772(_0x460b62);},_0x3973c9);}):_0x29ef60||_0x265e44||'Valid';}}function _0x82a70e(_0x3275f0,_0x14d49c){return new window['Promise'](_0x419e08=>{if(_0x52af26())return _0x419e08('Valid');_0x4396c0(),_0xfd962d['decorate']('_sendUsageRequest');let _0x11e605=!0x1;const _0x2e3809=vt();function _0x5d2a40(_0x27e606){return!!_0x27e606&&('object'==typeof _0x27e606||'function'==typeof _0x27e606)&&'function'==typeof _0x27e606['then']&&'function'==typeof _0x27e606['catch'];}function _0x12e2ac(_0x52ca2a){_0x1cf1d8(_0x52ca2a)['then'](_0x3f1095=>_0x3f1095&&'ok'==_0x3f1095['status']?_0x2871a0(_0x4c1836(_0x2e3809+_0x14d49c))!=_0x3f1095['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x3c8b53=>(_0x4145d8(),_0x3c8b53),()=>{const _0x4cf61c=_0x15798c();return null==_0x4cf61c?(_0x4145d8(),'Valid'):_0x367edb-_0x4cf61c>0x240c8400?'UsageLimit':'Valid';})['then'](_0x419e08)['catch'](()=>{_0x419e08('UsageLimit');});const _0x48a33a=0x36ee80;function _0x4145d8(){const _0x192881='llct-'+_0x2871a0(_0x4c1836(_0x3275f0)),_0x52d1c1=_0x5d6e9a(_0x2871a0(window['Math']['ceil'](_0x367edb/_0x48a33a)));window['localStorage']['setItem'](_0x192881,_0x52d1c1);}function _0x15798c(){const _0x30c6be='llct-'+_0x2871a0(_0x4c1836(_0x3275f0)),_0x57a5cd=window['localStorage']['getItem'](_0x30c6be);return _0x57a5cd?window['parseInt'](_0x5d6e9a(_0x57a5cd),0x10)*_0x48a33a:null;}function _0x1cf1d8(_0x4586ee){return new window['Promise']((_0x20e016,_0x4567ec)=>{_0x4586ee['then'](_0x20e016,_0x4567ec),window['setTimeout'](_0x4567ec,0x1d4c0);});}}_0xfd962d['on']('_sendUsageRequest',(_0x32cebb,_0x3962bf)=>{if(_0x3962bf[0x0]!=_0x3275f0)return _0x419e08('UsageLimit');_0x3962bf[0x1]={..._0x3962bf[0x1],'requestId':_0x2e3809};},{'priority':'high'}),_0xfd962d['on']('_sendUsageRequest',_0x58d47c=>{_0x5d2a40(_0x58d47c['return'])&&(_0x11e605=!0x0,_0x12e2ac(_0x58d47c['return']));},{'priority':'low'}),_0x4e856b['then'](()=>{_0x11e605||_0x419e08('UsageLimit');});});function _0x52af26(){return'auto'==_0xfd962d['editing']['view']['_overlayModeHint'];}function _0x4396c0(){_0xfd962d['editing']['view']['_overlayModeHint']='auto';}}function _0x3da955(_0x211f15){const _0x13f222=[new window['Promise'](_0x4449d8=>setTimeout(_0x4449d8,0x93ecc)),_0x4e856b['then'](()=>new window['Promise'](_0x4db867=>{let _0x3b5b0c=0x0;_0xfd962d['model']['on']('applyOperation',(_0x3788cb,_0x451dfe)=>{_0x451dfe[0x0]['isDocumentOperation']&&_0x3b5b0c++,0x5e8==_0x3b5b0c&&(_0x4db867(),_0x3788cb['off']());});}))];return window['Promise']['race'](_0x13f222)['then'](()=>_0x211f15);}async function _0x35bf96(){await _0x4e856b,_0xfd962d['model']['change']=_0x50eec2,_0xfd962d['model']['enqueueChange']=_0x50eec2,_0xfd962d['enableReadOnlyMode']('model');}function _0x4308fb(_0x32b87d){const _0xdd44e7=_0x2f4d60();_0xfd962d[_0xdd44e7]='aiLicenseKey'+_0x32b87d,'Valid'!=_0x32b87d&&_0x35bf96();}function _0x2f4d60(){const _0xc3f938=window['String'](window['performance']['now']())['replace']('.','');let _0x5d9f55='n';for(let _0x93fc7b=0x0;_0x93fc7b<_0xc3f938['length'];_0x93fc7b+=0x2){let _0xa0dde4=window['parseInt'](_0xc3f938['substring'](_0x93fc7b,_0x93fc7b+0x2));_0xa0dde4>=0x3e&&(_0xa0dde4-=0x3e),_0x5d9f55+=_0x5ed045[_0xa0dde4];}return _0x5d9f55;}function _0x4aed38(){const _0x25faba=_0x50ccd5['split']('.');if(0x3!=_0x25faba['length'])return null;return _0x161d74(_0x25faba[0x1]);function _0x161d74(_0x2384b8){const _0x28a64f=_0x48a3bb(_0x2384b8);return _0x28a64f&&_0x37f48a()?_0x28a64f:null;function _0x37f48a(){const _0x111a68=_0x28a64f['jti'],_0x461f29=window['parseInt'](_0x111a68['substring'](_0x111a68['length']-0x8),0x10),_0x359256={..._0x28a64f,'jti':_0x111a68['substring'](0x0,_0x111a68['length']-0x8)};return delete _0x359256['vc'],_0x4c1836(_0x359256)==_0x461f29;}}}async function _0x3b56ef(){let _0x1920e6=!0x0;try{const [_0x1f7bdc,_0x10fe46,_0x202200]=_0x50ccd5['split']('.');return _0x463199(_0x1f7bdc),await _0x4ba1fb(_0x1f7bdc,_0x10fe46,_0x202200),_0x1920e6;}catch{return!0x1;}function _0x463199(_0x5ad508){const _0x6efd7d=_0x48a3bb(_0x5ad508);_0x6efd7d&&'ES256'==_0x6efd7d['alg']||(_0x1920e6=!0x1);}async function _0x4ba1fb(_0x3cc3f4,_0xab148b,_0xc02970){const _0x344f3c=window['Uint8Array']['from'](_0x18c8b(_0xc02970),_0x545dbe=>_0x545dbe['charCodeAt'](0x0)),_0x1a9fc8=new window['TextEncoder']()['encode'](_0x3cc3f4+'.'+_0xab148b),_0x333bdb=window['crypto']['subtle'];if(!_0x333bdb)return;const _0x5e64a4=await _0x333bdb['importKey']('jwk',_0x1615e0,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x333bdb['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x5e64a4,_0x344f3c,_0x1a9fc8)||(_0x1920e6=!0x1);}}function _0x48a3bb(_0x227d75){return _0x227d75['startsWith']('ey')?JSON['parse'](_0x18c8b(_0x227d75)):null;}function _0x18c8b(_0x4862df){return window['atob'](_0x4862df['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x4c1836(_0xca6f4){let _0x304c64=0x1505;function _0x13a8a6(_0x4b6499){for(let _0x49cb21=0x0;_0x49cb21<_0x4b6499['length'];_0x49cb21++){const _0x1eb04a=_0x4b6499['charCodeAt'](_0x49cb21);_0x304c64=(_0x304c64<<0x5)+_0x304c64+_0x1eb04a,_0x304c64&=_0x304c64;}}function _0x1ad716(_0xefc13d){Array['isArray'](_0xefc13d)?_0xefc13d['forEach'](_0x1ad716):_0xefc13d&&'object'==typeof _0xefc13d?Object['entries'](_0xefc13d)['sort']()['forEach'](([_0x2a994d,_0x20752d])=>{_0x13a8a6(_0x2a994d),_0x1ad716(_0x20752d);}):_0x13a8a6(window['String'](_0xefc13d));}return _0x1ad716(_0xca6f4),_0x304c64>>>0x0;}function _0x2871a0(_0x2edaad){return _0x2edaad['toString'](0x10)['padStart'](0x8,'0');}function _0x5d6e9a(_0x1f01ef){return _0x1f01ef['split']('')['reverse']()['join']('');}function _0x50eec2(){}_0x4308fb(await _0x2b3178());}(this);}['showFakeVisualSelection'](){const _0x3cb0c9=this['editor']['model'];_0x3cb0c9['change'](_0x208232=>{const _0x2e0af6=_0x3cb0c9['document']['selection']['getRanges']();let _0x3458cc=0x0;for(const _0x60f091 of _0x2e0af6){const _0xe85430=Ri+':'+_0x3458cc;if(_0x3cb0c9['markers']['has'](_0xe85430))_0x208232['updateMarker'](_0xe85430,{'range':_0x60f091});else{if(_0x60f091['start']['isAtEnd']){const _0x22a690=_0x60f091['start']['getLastMatchingPosition'](({item:_0x49660d})=>!_0x3cb0c9['schema']['isContent'](_0x49660d),{'boundaries':_0x60f091});_0x208232['addMarker'](_0xe85430,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x208232['createRange'](_0x22a690,_0x60f091['end'])});}else _0x208232['addMarker'](_0xe85430,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x60f091});}_0x3458cc++;}});}['hideFakeVisualSelection'](){const _0x4a7d23=this['editor']['model'],_0x5090d8=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Ri));_0x5090d8['length']&&_0x4a7d23['change'](_0x23c096=>{_0x5090d8['forEach'](_0x220eec=>{_0x23c096['removeMarker'](_0x220eec);});});}['insertContent'](_0x55d666,_0x2c9e2d){const _0x420645=this['_getAISelection'](),_0x92066c=_0x2c9e2d||_0x420645['getFirstRange']();this['editor']['model']['canEditAt'](_0x92066c)&&this['editor']['model']['change'](_0x4b510=>{this['hideFakeVisualSelection'](),_0x2c9e2d||this['_resetContentOfSelectedTableCells'](_0x4b510,_0x420645),this['_pasteHTMLUsingClipboard']({'insertAt':_0x92066c,'writer':_0x4b510,'html':_0x55d666});});}['insertContentBelow'](_0x17ab2d){const {model:_0x304b07}=this['editor'],_0x526e60=this['_getAISelection']();_0x304b07['change'](()=>{const _0x5a1b11=this['_prepareTableInsertBelowPosition'](_0x17ab2d,_0x526e60)||this['_getDefaultInsertBelowPosition'](_0x526e60);this['insertContent'](_0x17ab2d,_0x5a1b11);});}['_getAISelection'](){const _0x3ef225=this['editor']['model'],_0x522491=Array['from'](_0x3ef225['markers']['getMarkersGroup'](Ri))['map'](_0x4676fd=>_0x4676fd['getRange']());return _0x3ef225['createSelection'](_0x522491);}['_pasteHTMLUsingClipboard']({writer:_0x2fcfa1,html:_0x7d10c9,insertAt:_0x3c8035}){const {view:_0x1afe6a}=this['editor']['editing'],_0x447651=this['editor']['plugins']['get'](_0x3f51a5),_0x1316ff=new Si();_0x1316ff['setData']('text/html',_0x7d10c9);const _0x5061e4=new _0x19022f(_0x1afe6a,new ClipboardEvent('paste',{'clipboardData':_0x1316ff}),{'dataTransfer':new _0x5347ee(_0x1316ff)});_0x2fcfa1['setSelection'](_0x3c8035);const _0x3cdb68=(_0x5377e5,_0x3da3c5)=>{_0x3da3c5['resultRange']&&_0x2fcfa1['setSelection'](_0x3da3c5['resultRange']);};_0x447651['once']('contentInsertion',_0x3cdb68,{'priority':'lowest'}),_0x1afe6a['document']['fire']('paste',_0x5061e4),_0x447651['off']('contentInsertion',_0x3cdb68);}['_getDefaultInsertBelowPosition'](_0x5c618e){const {model:_0x3abd18}=this['editor'],_0x24e40d=Array['from'](_0x5c618e['getSelectedBlocks']());return _0x24e40d['length']?_0x3abd18['createPositionAfter'](_0x24e40d['pop']()):_0x5c618e['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x2f2c2a,_0x431fb6){const {model:_0x128356,plugins:_0xc1fde9}=this['editor'];if(_0xc1fde9['has']('TableUtils')){const _0x36774c=_0xc1fde9['get']('TableUtils')['getSelectedTableCells'](_0x431fb6);if(_0x36774c['length']){const _0x1701dc=this['_getTableRowCountFromContent'](_0x2f2c2a),_0x5e88e0=this['_createEmptyTableRows'](_0x36774c,_0x1701dc);return _0x128356['createPositionAt'](_0x5e88e0,0x0);}}return null;}['_getTableRowCountFromContent'](_0x4939ff){const _0x571c44=this['editor']['plugins']['get']('TableUtils'),_0x5f1f82=this['editor']['data']['parse'](_0x4939ff,'$documentFragment'),_0x5d6a94=Array['from'](_0x5f1f82['getChildren']())['filter'](_0x16e687=>_0x16e687['is']('element','table'));let _0x20acf1=0x0;return _0x5d6a94['forEach'](_0x32ab46=>{_0x20acf1+=_0x571c44['getRows'](_0x32ab46);}),_0x20acf1;}['_createEmptyTableRows'](_0xc1920e,_0x8d78c8){const _0x166e0a=this['editor']['plugins']['get']('TableUtils'),_0x468245=_0x166e0a['getRowIndexes'](_0xc1920e),_0x2a7e70=_0x166e0a['getColumnIndexes'](_0xc1920e),_0x4788b9=_0x468245['last']+0x1,_0x3375cb=_0x2a7e70['first'],_0x189a40=_0xc1920e[0x0]['findAncestor']('table');for(let _0x3d05d8=0x0;_0x3d05d8<_0x8d78c8;_0x3d05d8++)_0x166e0a['insertRows'](_0x189a40,{'at':_0x4788b9});return _0x189a40['getChild'](_0x4788b9)['getChild'](_0x3375cb);}['_resetContentOfSelectedTableCells'](_0x443616,_0xdbb473){const {plugins:_0x4bb0fe}=this['editor'],{model:_0x15e546}=_0x443616;_0x4bb0fe['has']('TableUtils')&&_0x4bb0fe['get']('TableUtils')['getSelectedTableCells'](_0xdbb473)['length']&&_0x15e546['deleteContent'](_0xdbb473);}},vi=class extends _0x16e292{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}},ki=class extends Error{constructor(_0x2eb71b){super(_0x2eb71b),this['name']='AIRequestError';}};function Ni(_0x96f635,_0x3498fe,_0x54ba75){const t=_0x96f635['t'];switch(_0x3498fe){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',_0x54ba75);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x54ba75);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'},_0x54ba75);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 _0x3498fe;}}var yi=class extends _0x558985{['_commandDefinitions'];constructor(_0x57565d,_0x55115e){super(_0x57565d),this['_commandDefinitions']=_0x55115e,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x29c101,_0x5d13dc,_0x41a200)=>{this['isEnabled']&&(this['enabledCommandsIds']=xi(this['_commandDefinitions'],_0x41a200));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x8a93b8,_0x2e693c,_0x36d489)=>{this['enabledCommandsIds']=_0x36d489?xi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2df230=this['editor']['model'];this['_hasContext']=function(_0x401691){const _0xd8f177=_0x401691['document']['selection'];return _0xd8f177['isCollapsed']?0x0!==[..._0xd8f177['getSelectedBlocks']()]['length']&&![..._0xd8f177['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x401691['hasContent'](_0xd8f177['getFirstRange']());}(_0x2df230);const _0x256708=_0x2df230['document']['selection'],_0xa81713=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0xc917ac of _0x256708['getRanges']())for(const _0x51b10f of _0xc917ac['getItems']())if(_0x51b10f['is']('element')&&_0xa81713['includes'](_0x51b10f['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x5dc7e2='',_0x941ede='',_0x1adb8c='custom'){this['editor']['plugins']['get'](Xi)['showUI'](_0x5dc7e2,_0x941ede,_0x1adb8c);}};function xi(_0x387017,_0x26efb6){const _0x2be481=new Set();for(const _0x2dfdad of _0x387017['values']())(_0x26efb6||!0x1===_0x2dfdad['requiresContent'])&&_0x2be481['add'](_0x2dfdad['id']);return Array['from'](_0x2be481);}const Li=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Di=/* #__PURE__ -- @preserve */
24
+ gt();var Pi=class extends Di{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0xc6db50,_0x22bddb,_0x44502d){super(),this['editor']=_0xc6db50,this['textAdapter']=_0x22bddb,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x44502d,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x5c07cc,_0x5c9d69,_0x5df7b8)=>{this['view']['value']=this['_sanitizeHTML'](_0x5df7b8);}),this['listenTo'](this['view'],'submitPrompt',(_0x42a49a,_0x446a25)=>{const _0x833a04=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x446a25,_0x833a04,'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:_0x57f8d5,query:_0x4dc90a,htmlContent:_0x59dee6,label:_0x50d836,mainActionLabel:_0x38ed83}){this['view']['prompt']=_0x50d836,this['view']['mainAction']=_0x38ed83,this['initialContext']=_0x59dee6,_0x4dc90a&&(this['view']['isRendered']?this['_handleQuery'](_0x4dc90a,_0x59dee6,_0x57f8d5,_0x50d836):this['view']['once']('render',()=>{this['_handleQuery'](_0x4dc90a,_0x59dee6,_0x57f8d5,_0x50d836);}));}['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'](_0x33f57f,_0x58b717,_0x5131d5,_0x3b9553){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x58b717,this['previousQuery']=_0x33f57f,this['previousLabel']=_0x3b9553||_0x33f57f,this['previousActionId']=_0x5131d5,new Promise(_0x1fba82=>{this['textAdapter']['makeRequest']({'query':_0x33f57f,'context':_0x58b717,'onData':_0x341bbd=>{this['currentResponse']=_0x341bbd,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x5131d5})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x1f3f9c=>{_0x1f3f9c instanceof ki?this['view']['handleError'](_0x1f3f9c['message']):this['view']['handleError'](),_0x1fba82();})['finally'](()=>{this['stopProcessing'](),_0x1fba82();});});}['_parseAndNormalizeContent'](_0xf94efa,_0x25ecdd=!0x1){const _0x242747=Li['exec'](_0xf94efa);_0xf94efa=_0x242747?_0xf94efa['substring'](_0x242747[0x1]['length']):_0xf94efa['length']<0x64&&!_0x25ecdd?'':this['_stripMarkdownSyntax'](_0xf94efa);const _0x282641=this['_domParser']['parseFromString'](_0xf94efa,'text/html');if(_0x242747){const _0x3ab548=Array['from'](_0x282641['body']['childNodes']);_0x3ab548['reverse']();for(const _0x297c9b of _0x3ab548){if(_0x297c9b['nodeType']==Node['ELEMENT_NODE'])break;_0x297c9b['remove']();}}const _0x18d0e=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x282641['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x18d0e);const _0x2a3c69=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x5739b9=this['editor']['data']['toModel'](_0x18d0e);return _0x2a3c69||_0x5739b9['markers']['clear'](),this['editor']['data']['stringify'](_0x5739b9);}['_normalizeResponseHeadings'](_0x4e2142){const _0x543ccf=new _0x2f6006(this['editor']['editing']['view']['document']),_0x1f2d21=new _0x282a5({'name':/^h[1-5]$/}),_0x1eff93=[];let _0x71fba5=!0x1;for(const _0x5c1790 of _0x4e2142)_0x5c1790['is']('element')&&_0x1f2d21['match'](_0x5c1790)&&(_0x1eff93['push'](_0x5c1790),'h1'==_0x5c1790['name']&&(_0x71fba5=!0x0));if(_0x71fba5){for(const _0x4d2f11 of _0x1eff93)_0x543ccf['rename']('h'+(parseInt(_0x4d2f11['name'][0x1])+0x1),_0x4d2f11);}}['_isH1TagSupportEnabled'](){const {data:_0x47754b,editing:_0x1badcd}=this['editor'],_0x417b9c=_0x47754b['htmlProcessor']['toView']('<h1></h1>'),_0x53d46a=_0x47754b['toView'](_0x47754b['toModel'](_0x417b9c));return!!_0x1badcd['view']['domConverter']['viewToDom'](_0x53d46a)['querySelector']('h1');}['_sanitizeHTML'](_0x49033d){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x49033d),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x2ad2c8){const _0x322a4a=_0x2ad2c8['trim']();return _0x322a4a['startsWith']('```html')?_0x322a4a['endsWith']('```')?_0x322a4a['substring'](0x7,_0x322a4a['length']-0x3):_0x322a4a['substring'](0x7):_0x2ad2c8;}};const Hi={'REPLACE':'replace','INSERT':'insert'};var Mi=class extends _0x311510{constructor(_0x45d041){super(_0x45d041),this['set']('isVisible',!0x1),this['set']('mainAction',Hi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x59e6e7=>Ni(_0x45d041,'AI_'+_0x59e6e7['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ni(_0x45d041,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ni(_0x45d041,'Try\x20again')),this['stopButton']=this['_createButton'](Ni(_0x45d041,'Stop'));const _0x4bfb1d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x4bfb1d['if']('isVisible','ck-hidden',_0x40e320=>!_0x40e320)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x5e718d,_0x22bece){const _0x5d7a27=new Ht(this['locale']);return _0x5d7a27['set']({'label':_0x5e718d,'class':_0x22bece||'','isVisible':!0x0,'withText':!0x0}),_0x5d7a27;}},Vi=class extends _0x2bc1f3{['contentFieldView'];['copyButtonView'];constructor(_0x37d0ec,_0x33eadd=''){super(_0x37d0ec),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x2f5d16=this['bindTemplate'];this['contentFieldView']=new Ui(_0x37d0ec,_0x33eadd),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x2f5d16['if']('isVisible','ck-hidden',_0x3b64de=>!_0x3b64de)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x2f5d16['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 _0x3fb0a9=!0x1;this['on']('change:value',(_0x5dde1d,_0x25127d,_0x283d46)=>{const _0x2fc85d=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x283d46),this['isProcessing']&&_0x2fc85d&&!_0x3fb0a9&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x42fa8b,_0x40b2da,_0x571a1a)=>{_0x3fb0a9=!0x1,_0x571a1a?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x3fb0a9=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x3fb0a9=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x4eb24c=this['locale'],_0x5f58cd=new Ht(this['locale']),_0x2b45d8='ck-ai-form__copy-button';return _0x5f58cd['set']({'label':Ni(_0x4eb24c,'Copy'),'icon':_0x11d6e2,'class':_0x2b45d8,'tooltip':!0x0}),_0x5f58cd['bind']('isVisible')['to'](this,'value',_0x5a562e=>!!_0x5a562e),_0x5f58cd['bind']('isEnabled')['to'](this,'isProcessing',_0x4018bf=>!_0x4018bf),_0x5f58cd['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x5f58cd['icon']=_0x324330,_0x5f58cd['class']=_0x2b45d8+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x5f58cd['icon']=_0x11d6e2,_0x5f58cd['class']=_0x2b45d8;},0x3e8);}),_0x5f58cd;}['_copyHTMLToClipboard'](_0x3df3dc){const {window:_0x1a82dd,document:_0x4b6043}=Tt;if(_0x1a82dd['ClipboardItem']){const {Blob:_0xf6cd92,ClipboardItem:_0x5db7af}=_0x1a82dd,_0x5610f2=[new _0x5db7af({'text/html':new _0xf6cd92([_0x3df3dc['innerHTML']],{'type':'text/html'}),'text/plain':new _0xf6cd92([_0x3df3dc['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x5610f2);}else{const _0x3f62f8=_0x4b6043['createElement']('div');_0x3f62f8['style']['position']='absolute',_0x3f62f8['style']['left']='-9999px',_0x3f62f8['innerHTML']='<span>[</span>'+_0x3df3dc['innerHTML']+'<span>]</span>',_0x4b6043['body']['appendChild'](_0x3f62f8);const _0x3db4bf=_0x4b6043['createRange']();_0x3db4bf['setStartAfter'](_0x3f62f8['firstElementChild']),_0x3db4bf['setEndBefore'](_0x3f62f8['lastElementChild']);const _0x1567d5=_0x1a82dd['getSelection']();_0x1567d5['removeAllRanges'](),_0x1567d5['addRange'](_0x3db4bf),_0x4b6043['execCommand']('copy'),_0x3f62f8['remove']();}}},Ui=class extends _0x2bc1f3{constructor(_0x5d644c,_0x1452fa=''){super(_0x5d644c),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1452fa,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x3e6650){this['element']['innerHTML']=_0x3e6650;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x48684c=new _0x2bc1f3(),_0x5f377c=this['locale'],_0xbd961d=new _0x5add43();return _0xbd961d['isVisible']=!0x0,_0x48684c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0xbd961d,{'text':Ni(_0x5f377c,'AI\x20is\x20writing...')}]}),_0x48684c['render'](),_0x48684c;}},Bi=class extends _0x2bc1f3{constructor(_0x58de84,_0xadc659=''){super(_0x58de84);const _0x3ede48=new Yt(),_0x570c77=this['bindTemplate'];this['set']('text',_0xadc659),_0x3ede48['content']=_0xc6c85a,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x3ede48,{'text':_0x570c77['to']('text')}]});}},Gi=class extends Nt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x3ff169,_0x458c54){super(_0x3ff169,_0x458c54),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',(_0x2547b2,_0x3cf52c)=>{_0x2547b2['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3cf52c());});}['_createSubmitButton'](){const _0x5dee8f=new Ht(this['locale']),_0x21212a=this['locale'];return _0x5dee8f['set']({'icon':st,'label':Ni(_0x21212a,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5dee8f['on']('execute',()=>{this['submit']();}),_0x5dee8f['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x2b8968,_0x5e9ab4)=>!_0x2b8968&&_0x5e9ab4),_0x5dee8f;}['_createShowHistoryButton'](){const _0x475903=new Ht(this['locale']),_0x491af2=this['resultsView'],_0x304e71=this['locale'];_0x475903['set']({'label':Ni(_0x304e71,'History'),'withText':!0x1,'icon':_0x4e1b6d,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x475903['bind']('isOn')['to'](_0x491af2,'isVisible'),_0x475903['bind']('isEnabled')['to'](this,'isEnabled'),_0x475903['on']('execute',()=>{_0x491af2['isVisible']=!_0x491af2['isVisible'],_0x491af2['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x5e8791=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x435e83=new At(this['queryView']['fieldView']['element']),_0x173fa9=_0x435e83['width'],_0x1c829c='rtl'===_0x304e71['uiLanguageDirection']?'left':'right';_0x435e83['excludeScrollbarsAndBorders'](),_0x475903['element']['style'][_0x1c829c]=_0x173fa9-_0x435e83['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x5e8791),this['on']('render',_0x5e8791),_0x475903;}['submit'](){const _0x5abbb1=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x5abbb1);}['focus'](_0x188a6d){-0x1===_0x188a6d?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Fi=class extends jt{['historyGroupView'];['clearHistoryButton'];constructor(_0x535f04){super(_0x535f04),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Xt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ni(_0x535f04,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x483098=0x0;for(const _0x7f8cd2 of this['items'])_0x483098+=_0x7f8cd2['items']['length'];return{'resultsCount':_0x483098,'totalItemsCount':_0x483098};}['_createClearHistoryButton'](){const _0x3dad02=this['locale'],_0x3f8567=new Ht(this['locale']);return _0x3f8567['set']({'label':'('+Ni(_0x3dad02,'Clear')+')','withText':!0x0}),_0x3f8567['on']('execute',()=>this['fire']('clearHistory')),_0x3f8567;}},Ki=class extends zt{constructor(_0x43ece1){super();const _0x498a7d=new Dt(),_0x45f9ad=new Ht(this['locale'],_0x498a7d);this['children']['add'](_0x45f9ad),_0x45f9ad['set']({'label':_0x43ece1['prompt'],'withText':!0x0}),_0x45f9ad['on']('execute',()=>{this['fire']('execute',{'value':_0x2131a0(_0x43ece1['prompt'])});});}};const Wi='CKEditor/AIFormView/PromptHistory';var Yi=class extends ct{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x2bef22,_0x316f30)=>{const _0x54a37a=$i(_0x316f30['prompt']);for(const _0x2e793d of this)if(_0x2e793d!=_0x316f30&&$i(_0x2e793d['prompt'])===_0x54a37a){this['remove'](_0x2e793d);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x4b1848=sessionStorage['getItem'](Wi)||'[]';this['addMany'](JSON['parse'](_0x4b1848));}['_saveToSessionStorage'](){sessionStorage['setItem'](Wi,JSON['stringify'](this['map'](_0x1df66a=>_0x1df66a)));}};function $i(_0x5195c1){return _0x5195c1['toLowerCase']()['trim']();}var qi=class extends _0x2bc1f3{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x42bbd7,_0x4a35b5,_0x5248f0=''){super(_0x42bbd7),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Hi['REPLACE']),this['_promptHistory']=new Yi(),this['errorView']=new Bi(_0x42bbd7),this['contentArea']=new Vi(_0x42bbd7,_0x5248f0),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new dt(),this['keystrokes']=new _t(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x5652d3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x4a35b5],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x5652d3['if']('isError','ck-hidden',_0x2e6d11=>!_0x2e6d11)]},'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'](_0x261941=0x1){-0x1===_0x261941?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 _0x224dbb=this['locale'],_0x32af2c=new Gi(_0x224dbb,{'queryView':{'label':Ni(_0x224dbb,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x170dd3,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ni(_0x224dbb,'Empty\x20history'),'secondary':Ni(_0x224dbb,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x32af2c['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x137176,_0x1567c5)=>_0x137176&&!_0x1567c5),this['listenTo'](_0x32af2c,'submit',(_0x1c6cda,_0x5de0aa)=>{this['prompt']=_0x5de0aa;const _0x319a74=_0x4ae7b3(_0x5de0aa);this['fire']('submitPrompt',_0x319a74),_0x5de0aa['trim']()&&this['_promptHistory']['add']({'prompt':_0x319a74},0x0);},{'priority':'high'}),_0x32af2c;}['_createHistoryView'](){const _0x591316=new Fi(this['locale']);return _0x591316['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Ki),_0x591316['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x591316;}['_createToolbar'](){const _0x767398=new Mi(this['locale']);return _0x767398['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1d76fb,_0x93bbae,_0x3d8c1b)=>_0x1d76fb&&!_0x93bbae&&!!_0x3d8c1b),_0x767398['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x767398['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4581d9,_0x369382,_0x451845)=>_0x4581d9&&!_0x369382&&!!_0x451845),_0x767398['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x767398['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x8acc1e,_0x55a748)=>_0x8acc1e&&!_0x55a748),_0x767398['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x767398['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x767398['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x767398;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x320c53=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ni(_0x320c53,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x38bf02){const _0x3f4ff7=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x38bf02||Ni(_0x3f4ff7,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const Qi=globalThis['DataTransfer'];var Xi=class extends _0x16e292{['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[_0x1353fc,Oi,vi,Mt];}constructor(_0x462232){super(_0x462232),_0x462232['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x462232['config']['define']('ai.assistant.contentAreaCssClass',''),_0x462232['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x462232['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x2883e1}=this;this['_aiAdapter']=_0x2883e1['plugins']['get'](vi),this['_dialog']=_0x2883e1['plugins']['get'](Mt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x198fb8=new yi(_0x2883e1,Array['from'](this['_commandDefinitions']['values']()));_0x2883e1['commands']['add']('showAIAssistant',_0x198fb8),_0x2883e1['ui']['componentFactory']['add']('aiCommands',_0xfbd5d8=>{const _0x34dcb2=_0x4e3ad4(_0xfbd5d8);return _0x34dcb2['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x34dcb2['buttonView']['set']({'label':Ni(_0xfbd5d8,'AI\x20Commands'),'icon':_0x24b027,'tooltip':!0x0}),_0x34dcb2['on']('execute',_0x493be1=>this['_onExecute'](_0x493be1['source']['id'])),_0x318aab(_0x34dcb2,_0x2883e1['ui']['view']['body'],function(_0x506703){const _0x513f20=ji(_0x506703,bi(_0x506703['config']['get']('ai.assistant.commands'),_0x506703['locale']))['filter'](_0x2d71d6=>_0x2d71d6['commands']['length']);return 0x1===_0x513f20['length']?ji(_0x506703,_0x513f20[0x0]['commands'])['map'](_0x438887=>({'id':_0x438887['id'],'label':_0x438887['label']})):_0x513f20['map'](_0x1b692c=>{const {groupId:_0x377415,groupLabel:_0x376b57,commands:_0x2fef1a}=_0x1b692c,_0x150d63=ji(_0x506703,_0x2fef1a)['map'](_0x2515bb=>({'id':_0x2515bb['id'],'label':_0x2515bb['label']}));return{'id':_0x377415,'menu':_0x376b57||_0x377415,'children':_0x150d63};});}(_0x2883e1),{'ariaLabel':Ni(_0xfbd5d8,'AI\x20Commands')}),_0x34dcb2['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x198fb8['on']('change:enabledCommandsIds',_0x8cd5e2),_0x34dcb2['menuView']['once']('render',_0x8cd5e2),_0x34dcb2;function _0x8cd5e2(){_0x34dcb2['isEnabled']=_0x198fb8['enabledCommandsIds']['length']>0x0;for(const _0x15eca6 of _0x34dcb2['menuView']['buttons'])_0x15eca6['isEnabled']=_0x198fb8['enabledCommandsIds']['includes'](_0x15eca6['id']);}}),_0x2883e1['ui']['componentFactory']['add']('menuBar:aiCommands',_0x49dee9=>{const _0xbb2ccf=new _0x547906(_0x49dee9);_0xbb2ccf['buttonView']['set']({'label':Ni(_0x49dee9,'AI\x20Commands'),'icon':_0x24b027}),_0xbb2ccf['bind']('isEnabled')['to'](_0x198fb8,'enabledCommandsIds',_0x3c2650=>_0x3c2650['length']>0x0);const _0x28005d=bi(_0x2883e1['config']['get']('ai.assistant.commands'),_0x49dee9);return this['_populateMenuBarMenu'](_0x198fb8,_0xbb2ccf,_0x28005d,_0x33babb=>this['_onExecute'](_0x33babb)),_0xbb2ccf;}),_0x2883e1['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x1feb7f=this['_createAIAssistantUIButton'](Ht);return _0x1feb7f['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x1feb7f;}),_0x2883e1['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x3fd40e=this['_createAIAssistantUIButton'](Jt);return _0x3fd40e['set']({'role':'menuitemcheckbox'}),_0x3fd40e;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x138c05=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x35bf66;for(const _0x1a9eec in _0x138c05){const _0x582d2a=_0x1a9eec,_0x15e00b=_0x138c05[_0x582d2a];if('aiLicenseKeyValid'==_0x15e00b||'aiLicenseKeyInvalid'==_0x15e00b||'aiLicenseKeyExpired'==_0x15e00b||'aiLicenseKeyDomainLimit'==_0x15e00b||'aiLicenseKeyNotAllowed'==_0x15e00b||'aiLicenseKeyEvaluationLimit'==_0x15e00b||'aiLicenseKeyUsageLimit'==_0x15e00b){delete _0x138c05[_0x582d2a],_0x35bf66=_0x15e00b,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x35bf66&&_0x138c05['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x35bf66&&_0x138c05['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x35bf66&&_0x138c05['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x35bf66&&_0x138c05['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x35bf66&&_0x138c05['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x35bf66&&_0x138c05['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x10c2c0='',_0x4c37a0='',_0x264982='custom'){const _0xcaa2d7=this['editor'],_0x4cdc1a=_0xcaa2d7['editing']['view'],_0x438300=_0xcaa2d7['plugins']['get'](Oi),_0x261904=_0xcaa2d7['plugins']['get'](_0x1353fc);_0x438300['showFakeVisualSelection']();const _0x5558c0=new Qi(),_0x26b52a=new ClipboardEvent('copy',{'clipboardData':_0x5558c0}),_0x1eb11c=new _0x5347ee(_0x5558c0),_0x2b5f54=new _0x19022f(_0x4cdc1a,_0x26b52a,{'dataTransfer':_0x1eb11c});_0x261904['_forceMarkersCopy']('comment',()=>{_0x4cdc1a['document']['fire']('copy',_0x2b5f54);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Pi(_0xcaa2d7,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x31caf7=_0x1eb11c['getData']('text/html');const _0x3b58a2=_0xcaa2d7['model']['document']['selection'],_0x246b36=Array['from'](_0x3b58a2['getRanges']());0x1===_0x246b36['length']&&_0x246b36[0x0]['isFlat']&&!_0x3b58a2['getSelectedElement']()&&''!==_0x31caf7['replace'](/&nbsp;/g,'')['trim']()&&(_0x31caf7='<p>'+_0x31caf7+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x264982,'query':_0x10c2c0,'htmlContent':_0x31caf7,'label':_0x4c37a0,'mainActionLabel':Hi[_0xcaa2d7['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x31f471,'title':Ni(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Vt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x438300['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x42d4a0=new Map(),_0x5a3218=bi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x584652 of _0x5a3218)for(const _0x12e33c of _0x584652['commands'])_0x42d4a0['set'](_0x12e33c['id'],{..._0x12e33c,'groupId':_0x584652['groupId'],'groupLabel':_0x584652['groupLabel']||_0x584652['groupId']});return _0x42d4a0;}['_createAIAssistantUIButton'](_0x307305){const _0x113161=this['editor'],_0x6a44bd=_0x113161['commands']['get']('showAIAssistant'),_0x539df3=new _0x307305(_0x113161['locale']);return _0x539df3['set']({'label':Ni(_0x113161['locale'],'AI\x20Assistant'),'icon':_0x31f471,'isToggleable':!0x0}),_0x539df3['bind']('isEnabled')['to'](_0x6a44bd),_0x539df3['bind']('isOn')['to'](this['_dialog'],'id',_0x4f6748=>'aiAssistant'===_0x4f6748),this['listenTo'](_0x539df3,'execute',()=>{_0x539df3['isOn']?this['hideUI']():_0x6a44bd['execute']();}),_0x539df3;}['_initView'](){const _0x43283e=this['editor']['plugins']['get'](Oi);this['_formView']=new qi(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x43283e['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x43283e['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5c2373,ui:{ariaLiveAnnouncer:_0x288c66}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x26bb73,_0x512130,_0x46da1a)=>{const _0x25c23e=this['_aiAssistantController']['currentContext'];_0x46da1a?_0x288c66['announce'](Ni(_0x5c2373,'AI\x20is\x20writing')):_0x25c23e&&_0x288c66['announce'](Ni(_0x5c2373,'Generated\x20content:\x20%0',_0x25c23e),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x33cb1f,_0x18be76,_0x20d78d)=>{if(_0x20d78d){const _0x2cbb29=this['_formView']['errorView']['text'];_0x288c66['announce'](Ni(_0x5c2373,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x2cbb29));}});}['_onExecute'](_0x22706b){const _0x55e7cc=this['_commandDefinitions']['get'](_0x22706b),_0xd43183=this['editor'],_0x323441=_0xd43183['model']['document']['selection'],_0x617980=_0xd43183['commands']['get']('showAIAssistant'),_0x1ae4f8=_0xd43183['plugins']['get'](Oi),_0x344bca=''+('_ungrouppedCommands'!==_0x55e7cc['groupId']?_0x55e7cc['groupLabel']+':\x20':'')+_0x55e7cc['label'];if(!0x1!==_0x55e7cc['requiresContent']&&_0x323441['isCollapsed']){const _0x29310a=mt(_0x323441['getSelectedBlocks']())||_0xd43183['model']['schema']['getLimitElement'](_0x323441);_0xd43183['model']['change'](_0x5c217f=>{_0x5c217f['setSelection'](_0x29310a,'in');});}_0x1ae4f8['showFakeVisualSelection'](),_0x617980['execute'](_0x55e7cc['prompt'],_0x344bca,'command:'+_0x22706b);}['_populateMenuBarMenu'](_0x60e29a,_0x1704db,_0x480934,_0x1340e5){const _0x231f69=this['editor'],_0x28dc49=_0x231f69['locale'],_0x125d4c=new te(_0x28dc49),_0x2f500a=ji(_0x231f69,_0x480934)['filter'](_0x44f967=>_0x44f967['commands']['length']);0x1===_0x2f500a['length']?this['_getMenuBarGroupButtons']({'command':_0x60e29a,'commands':_0x2f500a[0x0]['commands'],'parentMenuView':_0x1704db,'onExecute':_0x1340e5})['forEach'](_0xd80a9d=>_0x125d4c['items']['add'](_0xd80a9d)):_0x2f500a['forEach'](({groupId:_0x366f30,groupLabel:_0x43e786,commands:_0x2f703e})=>{const _0x45382e=new Zt(_0x28dc49,_0x1704db),_0x105f8c=new _0x547906(_0x28dc49),_0x54ddad=new te(_0x28dc49),_0x559677=this['_getMenuBarGroupButtons']({'command':_0x60e29a,'commands':_0x2f703e,'parentMenuView':_0x105f8c,'onExecute':_0x1340e5});_0x105f8c['buttonView']['set']({'label':_0x43e786||_0x366f30}),_0x105f8c['delegate']('execute')['to'](_0x1704db),_0x54ddad['items']['addMany'](_0x559677),_0x105f8c['panelView']['children']['add'](_0x54ddad),_0x45382e['children']['add'](_0x105f8c),_0x125d4c['items']['add'](_0x45382e);}),_0x1704db['panelView']['children']['add'](_0x125d4c);}['_getMenuBarGroupButtons']({command:_0xc523cd,commands:_0x2e62cd,parentMenuView:_0x9da655,onExecute:_0x1a1e53}){const _0x3c5ad4=this['editor'],_0x323985=_0x3c5ad4['locale'];return ji(_0x3c5ad4,_0x2e62cd)['map'](_0x1fec9e=>{const _0x50e6d6=new Zt(_0x323985,_0x9da655),_0xb67c9f=new Jt(_0x323985);return _0xb67c9f['set']({'label':_0x1fec9e['label']}),_0xb67c9f['delegate']('execute')['to'](_0x9da655),_0xb67c9f['on']('execute',()=>_0x1a1e53(_0x1fec9e['id'])),_0xb67c9f['bind']('isEnabled')['to'](_0xc523cd,'enabledCommandsIds',_0x5614a3=>_0x5614a3['includes'](_0x1fec9e['id'])),_0x50e6d6['children']['add'](_0xb67c9f),_0x50e6d6;});}};function zi(_0x39c007,_0x2a482a){return void 0x0!==_0x39c007['order']&&void 0x0===_0x2a482a['order']?0x1:void 0x0===_0x39c007['order']&&void 0x0!==_0x2a482a['order']?-0x1:void 0x0!==_0x39c007['order']&&void 0x0!==_0x2a482a['order']?_0x39c007['order']-_0x2a482a['order']:0x0;}function ji(_0x24cf70,_0x29e715){_0x29e715['sort'](zi);const _0x2b4e41={},_0x897a7a=[];for(const _0x51c97d of _0x29e715)if(void 0x0!==_0x51c97d['order']){if(_0x51c97d['order']in _0x2b4e41)throw new ht('ai-commands-config-order-collision',_0x24cf70,{'conflictingDefinitions':[_0x51c97d,_0x2b4e41[_0x51c97d['order']]]});_0x2b4e41[_0x51c97d['order']]=_0x51c97d,_0x897a7a['splice'](_0x51c97d['order'],0x0,_0x51c97d);}else _0x897a7a['push'](_0x51c97d);return _0x897a7a;}var Ji=class extends _0x16e292{static get['requires'](){return[Xi,Oi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3db534){super(_0x3db534);const _0x5538ec=_0x3db534['config'],_0x262a1d=_0x3db534['locale'];_0x5538ec['define']('ai.assistant.preserveComments',!0x0),_0x5538ec['define']('ai.assistant.commands',Zi(_0x262a1d)),_0x5538ec['define']('ai.assistant.extraCommandGroups',[]),_0x5538ec['define']('ai.assistant.removeCommands',[]);let _0x16d1ea=bi(_0x5538ec['get']('ai.assistant.commands'),_0x262a1d);const _0xefd82=_0x5538ec['get']('ai.assistant.extraCommandGroups'),_0x4165b0=_0x5538ec['get']('ai.assistant.removeCommands');_0xefd82['forEach'](_0x17851c=>{const _0x79dcd0=_0x16d1ea['find'](_0x989652=>_0x989652['groupId']===_0x17851c['groupId']);_0x79dcd0?_0x79dcd0['commands']=_0x79dcd0['commands']['concat'](_0x17851c['commands']):_0x16d1ea['push'](_0x17851c);}),_0x16d1ea=_0x16d1ea['filter'](_0x3c0a3a=>!_0x4165b0['includes'](_0x3c0a3a['groupId'])),_0x16d1ea['forEach'](_0x3899bf=>{_0x3899bf['commands']=_0x3899bf['commands']['filter'](_0x5e8b3e=>!_0x4165b0['includes'](_0x5e8b3e['id']));}),_0x5538ec['set']('ai.assistant.commands',_0x16d1ea);}};function Zi(_0x384fc6){return[{'groupId':'editOrReview','groupLabel':Ni(_0x384fc6,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ni(_0x384fc6,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ni(_0x384fc6,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Ni(_0x384fc6,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ni(_0x384fc6,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Ni(_0x384fc6,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ni(_0x384fc6,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Ni(_0x384fc6,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Ni(_0x384fc6,'Change\x20tone'),'commands':[{'id':'professional','label':Ni(_0x384fc6,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ni(_0x384fc6,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ni(_0x384fc6,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ni(_0x384fc6,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ni(_0x384fc6,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ni(_0x384fc6,'Change\x20style'),'commands':[{'id':'business','label':Ni(_0x384fc6,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ni(_0x384fc6,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ni(_0x384fc6,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ni(_0x384fc6,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ni(_0x384fc6,'Translate'),'commands':[{'id':'translateEnglish','label':Ni(_0x384fc6,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ni(_0x384fc6,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ni(_0x384fc6,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ni(_0x384fc6,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ni(_0x384fc6,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ni(_0x384fc6,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ni(_0x384fc6,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ni(_0x384fc6,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var ts=class extends _0x16e292{['abortController'];static get['requires'](){return[vi];}constructor(_0x407a8b){super(_0x407a8b),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](vi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x48edfe){return this['sendRequest'](_0x48edfe)['catch'](_0x5e0161=>{if(_0x5e0161 instanceof ki)return Promise['reject'](_0x5e0161);if('AbortError'==_0x5e0161['name'])return Promise['resolve']();throw console['error'](_0x5e0161),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x1f1d2e,_0x37d5eb){const _0x1894d9=this['editor']['locale'],_0x38598f={'Content-Type':'application/json'};if('object'==typeof _0x1f1d2e)Object['assign'](_0x38598f,_0x1f1d2e);else{if(_0x1f1d2e)try{const _0x36f86d=await _0x1f1d2e(_0x37d5eb);Object['assign'](_0x38598f,_0x36f86d);}catch{return Promise['reject'](new ki(Ni(_0x1894d9,'AI_ERROR_GET_HEADERS')));}}return _0x38598f;}async['_prepareRequestParameters'](_0x3a84de,_0x1a3c77){const _0x959254=this['editor']['locale'];if('object'==typeof _0x3a84de)return _0x3a84de;try{return await _0x3a84de(_0x1a3c77);}catch{return Promise['reject'](new ki(Ni(_0x959254,'AI_ERROR_GET_PARAMETERS')));}}},es=class extends ts{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x302dc6){super(_0x302dc6),_0x302dc6['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x302dc6['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x302dc6['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x302dc6['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x302dc6['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x302dc6['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x4d623f,context:_0x27cdea,onData:_0x15dcce,actionId:_0x413329}){const _0x170757=this['editor']['locale'],_0x481c6d=await this['prepareMessages'](_0x4d623f,_0x27cdea,_0x413329),_0x1c0e7f=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x413329),_0x200d38=await this['_prepareRequestParameters'](this['_requestParameters'],_0x413329),_0x584cce={'messages':_0x481c6d,..._0x200d38},_0xcf2bb7={'method':'POST','headers':_0x1c0e7f,'body':JSON['stringify'](_0x584cce),'signal':this['abortController']['signal']},_0x4d19ac=await fetch(this['_apiUrl'],_0xcf2bb7);if(_0x4d19ac['ok'])return _0x200d38['stream']?await this['_readStreamableResponse'](_0x4d19ac,_0x15dcce):await this['_readStaticResponse'](_0x4d19ac,_0x15dcce),Promise['resolve']();{const _0x4910cd=await _0x4d19ac['text']();return _0x4910cd['includes']('context_length_exceeded')?Promise['reject'](new ki(Ni(_0x170757,'AI_ERROR_CONTEXT_LENGTH'))):_0x4910cd['includes']('Moderation')?Promise['reject'](new ki(Ni(_0x170757,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x4910cd));}}async['prepareMessages'](_0x218372,_0x3af25f,_0xd24067){let _0x2382e6,_0x4c50e3;return _0x3af25f?(_0x2382e6='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.',_0x4c50e3='Instruction:\x0a'+_0x218372+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x3af25f):(_0x2382e6='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.',_0x4c50e3=_0x218372),[{'role':'system','content':_0x2382e6},{'role':'user','content':_0x4c50e3}];}async['_readStreamableResponse'](_0xe57cac,_0x519892){const _0x2cfef0=_0xe57cac['body']['getReader'](),_0x57a523=new TextDecoder();let _0x1f8d59='',_0x18faf8='',_0x528584='',_0x11b62f=!0x1;for(;!_0x11b62f;){const {done:_0x54aca7,value:_0x2469d3}=await _0x2cfef0['read'](),_0x598cfd=_0x1f8d59+_0x57a523['decode'](_0x2469d3);let _0x3037d6='';_0x11b62f=_0x54aca7;try{_0x3037d6=this['_cleanUpData'](_0x598cfd),_0x1f8d59='';}catch{_0x1f8d59=_0x598cfd;continue;}_0x18faf8+=_0x3037d6,!_0x11b62f&&this['_isBufferIncomplete'](_0x18faf8)||_0x18faf8&&(_0x528584+=_0x18faf8,_0x18faf8='',_0x519892(_0x528584));}return Promise['resolve']();}async['_readStaticResponse'](_0x369842,_0x32ee72){return _0x32ee72((await _0x369842['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x2cf81f){const _0x211875=_0x2cf81f['split']('<')['length']!==_0x2cf81f['split']('>')['length'],_0x221ddd=_0x2cf81f['length']<0x1e;return _0x211875&&_0x221ddd;}['_cleanUpData'](_0x38f4e8){return _0x38f4e8['split'](/\n(?![^{]*\})/g)['map'](_0x36e3b2=>_0x36e3b2['replace']('data:\x20',''))['filter'](_0x264af7=>_0x264af7&&_0x264af7['length']>0x0&&'[DONE]'!==_0x264af7)['map'](_0x5ec8ea=>{const {choices:_0x4e8971}=JSON['parse'](_0x5ec8ea);if(_0x4e8971[0x0]?.['delta']?.['content'])return _0x4e8971[0x0]['delta']['content'];})['filter'](_0x850707=>_0x850707)['join']('');}},is=class extends ts{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),bt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x2576f3){throw ft('ai-aws-adapter-not-supported'),new ki(Ni(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ss=class extends Ht{constructor(_0x33915d,_0x2fb6f4={}){super(_0x33915d),this['isToggleable']=!0x0,this['set']('side',_0x2fb6f4['side']||'top');const _0x1c7dd9=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Ot(_0x2fb6f4['class']||[]),_0x1c7dd9['to']('side',_0x5e501b=>'ck-tab-button_'+_0x5e501b),_0x1c7dd9['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x2bc1f3{['children'];constructor(_0x48f99d,_0x277e41={}){super(_0x48f99d);const _0x28ee74=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Ot(_0x277e41['class']||[]),_0x28ee74['to']('class'),_0x28ee74['if']('isVisible','ck-hidden',_0x90bd86=>!_0x90bd86)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},rs=class extends _0x2bc1f3{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x17e322,_0x16fdee={}){super(_0x17e322),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x16fdee['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x16fdee['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x5e666f,_0x5e880f)=>_0x5e666f&&!_0x5e880f);const _0x5c58e7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Ot(_0x16fdee['class']||[]),_0x5c58e7['to']('side',_0x2ad48a=>'ck-tabs_'+_0x2ad48a),_0x5c58e7['to']('class'),_0x5c58e7['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x5c58e7['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x5c58e7['to']('side',_0x2445bf=>'ck-tabs__buttons-container_'+_0x2445bf)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x5c58e7['to']('side',_0x5f04ab=>'ck-tabs__panels-container_'+_0x5f04ab)]},'children':this['panelViews']},...Ot(_0x16fdee['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x307585){const _0x310efc=this['_tabs']['get'](_0x307585);return _0x310efc||null;}['addTab'](_0xb94f){const _0x578bfe=this['_setupButton']({'id':_0xb94f['id'],'label':_0xb94f['buttonLabel'],'icon':_0xb94f['buttonIcon'],'order':_0xb94f['order']}),_0x626d95=new ns(this['locale']);return _0x626d95['render'](),_0xb94f['content']&&_0x626d95['children']['add'](_0xb94f['content']),this['panelViews']['add'](_0x626d95),this['_tabs']['set'](_0xb94f['id'],{'button':_0x578bfe,'panel':_0x626d95,'order':void 0x0!==_0xb94f['order']?_0xb94f['order']:null}),this['fire']('addTab:'+_0xb94f['id'],{'id':_0xb94f['id'],'button':_0x578bfe,'panel':_0x626d95}),null===this['activeTab']?this['activateTab'](_0xb94f['id']):this['_hidePanel'](_0xb94f['id']),{'button':_0x578bfe,'panel':_0x626d95};}['activateTab'](_0x4ed52d){if(null!==_0x4ed52d&&!this['getTab'](_0x4ed52d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4ed52d});if(this['isCollapsed']=!0x1,this['activeTab']===_0x4ed52d)return;const _0x11078f=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x4ed52d,_0x4ed52d&&this['_showPanel'](_0x4ed52d),this['fire']('activateTab:'+_0x4ed52d,{'newTab':_0x4ed52d,'oldTab':_0x11078f});}['toggleTabPanel'](_0x1a666f){this['activeTab']===_0x1a666f?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x1a666f);}['showTab'](_0x17e11a){if(!this['getTab'](_0x17e11a))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x17e11a});this['_showPanel'](_0x17e11a),this['_showButton'](_0x17e11a),this['fire']('show:'+_0x17e11a,_0x17e11a);}['hideTab'](_0x4abb41){if(!this['getTab'](_0x4abb41))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4abb41});const _0x41055c=this['activeTab'];this['_hidePanel'](_0x4abb41),this['_hideButton'](_0x4abb41);const _0x643361=this['getTabIds']();_0x41055c===_0x4abb41&&_0x643361['length']>0x1&&this['activateTab'](_0x643361['find'](_0x3e4340=>_0x3e4340!==_0x4abb41)),this['fire']('hide:'+_0x4abb41,_0x4abb41);}['_getPanel'](_0x269343){const _0x3f02bb=this['_tabs']['get'](_0x269343);return _0x3f02bb?_0x3f02bb['panel']:null;}['_showPanel'](_0x4ea69c){null!==this['activeTab']&&this['activeTab']!==_0x4ea69c||this['_getPanel'](_0x4ea69c)['show']();}['_hidePanel'](_0x3a337c){const _0x2b92a0=this['_getPanel'](_0x3a337c);_0x2b92a0['isVisible']&&(this['activeTab']===_0x3a337c&&(this['activeTab']=null),_0x2b92a0['hide']());}['_getButton'](_0x1470f5){const _0x4cd084=this['_tabs']['get'](_0x1470f5);return _0x4cd084?_0x4cd084['button']:null;}['_showButton'](_0x247a27){this['_getButton'](_0x247a27)['show']();}['_hideButton'](_0x3c8289){this['_getButton'](_0x3c8289)['hide']();}['_setupButton'](_0x4a56fc){const _0x505ad9=new ss(this['locale'],{'side':this['side']}),_0x53d29d=this['buttonViews'];if(_0x505ad9['set']({'label':_0x4a56fc['label'],'icon':_0x4a56fc['icon'],'tooltip':!0x0,'withText':!0x0}),_0x505ad9['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x237e78,_0x49b643)=>_0x237e78===_0x4a56fc['id']&&!_0x49b643),_0x505ad9['bind']('side')['to'](this,'side'),_0x4a56fc['order']){const _0x2affe5=[...this['_tabs']]['reduce']((_0x264542,_0x70136a)=>{const _0x5aaf11=_0x70136a[0x0],{order:_0x5139ca}=_0x70136a[0x1];return!_0x5139ca||_0x5139ca>_0x4a56fc['order']?_0x264542:_0x5139ca>=_0x264542['order']?{'id':_0x5aaf11,'order':_0x5139ca}:_0x264542;},{'id':'','order':0x0}),_0x5dc071=_0x53d29d['getIndex'](this['_getButton'](_0x2affe5['id']));_0x53d29d['add'](_0x505ad9,_0x5dc071+0x1);}else _0x53d29d['add'](_0x505ad9);return _0x505ad9['on']('execute',()=>{this['toggleTabPanel'](_0x4a56fc['id']);}),_0x505ad9;}};const os=['overlay','sidebar','custom'],as=['left','right'];var hs=class extends rs{constructor(_0x88205b,_0xd969ed={}){super(_0x88205b,_0xd969ed),this['set']('type',_0xd969ed['type']||'sidebar'),this['set']('side',_0xd969ed['side']||'right'),this['set']('isVisible',_0xd969ed['visibleByDefault']??!0x0);const _0x1b9d0b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x1b9d0b['if']('type','ck-ai-tabs__overlay',_0x3575bc=>'overlay'===_0x3575bc),_0x1b9d0b['if']('type','ck-ai-tabs__sidebar',_0x85335f=>'sidebar'===_0x85335f),_0x1b9d0b['if']('isVisible','ck-hidden',_0x5a2b40=>!_0x5a2b40)]}}),this['buttonViews']['on']('add',(_0x5aa9fb,_0x201b6e)=>{_0x201b6e['set']('withText',!0x1);});}},cs=class extends _0x394201{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x89f845){if(super(_0x89f845),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x1b92fa=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x1b92fa['showResizeButton']&&(this['showResizeButton']=_0x1b92fa['showResizeButton']),'sidebar'!==_0x1b92fa['type']&&'overlay'!==_0x1b92fa['type']||_0x1b92fa['side']&&(this['side']=_0x1b92fa['side']),'sidebar'===_0x1b92fa['type']){if(this['container']=_0x1b92fa['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x1b92fa['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new hs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x1b92fa['visibleByDefault'],'collapsible':_0x1b92fa['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 _0x2e6d5b&&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'](_0x50ffa6){if(_0x50ffa6&&this['type']!==_0x50ffa6){if(!os['includes'](_0x50ffa6))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x50ffa6;}}['switchSide'](_0x428559){if(_0x428559&&this['side']!==_0x428559){if(!as['includes'](_0x428559))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x428559;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},ls=class extends _0x394201{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x11ec1c];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4d9904){if(super(_0x4d9904),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x1925bc=this['context']['plugins']['get'](_0x11ec1c);if(!_0x1925bc['token'])throw new ht('ai-missing-token',this);this['_token']=_0x1925bc['token'];}['startConversation'](_0x30371c,_0x33e448){const _0x2b71c5=this['_sendApiRequest']('/conversations','POST',{'id':_0x30371c,'group':_0x33e448});return{'getConversation':async()=>(await _0x2b71c5['request'])['json'](),'abortController':_0x2b71c5['abortController']};}['queryAssistant']({message:_0x125d07,conversationId:_0x59b246,parts:_0x163919,capabilities:_0x322024,model:_0x5172f1,attributes:_0x83a2bb}){const _0x25dcf2={'prompt':_0x125d07,'content':_0x163919,'model':_0x5172f1,..._0x322024&&{'capabilities':_0x322024},..._0x83a2bb&&{'attributes':_0x83a2bb}},_0x62eb2c=this['_sendApiRequest']('/conversations/'+_0x59b246+'/messages','POST',_0x25dcf2,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x3f058d=(await _0x62eb2c['request'])['body'];return this['_getStreamReader'](_0x3f058d);},'abortController':_0x62eb2c['abortController']};}['executeCustomAction']({content:_0x1ada2f,message:_0x306f70,model:_0x51ef8a,outputFormat:_0x2d1169}){const _0x426676={'content':[{'type':'text','content':_0x1ada2f}],'prompt':_0x306f70,'model':_0x51ef8a,'outputFormat':_0x2d1169},_0xd6a319=this['_sendApiRequest']('/actions/custom/calls','POST',_0x426676);return{'getStream':async()=>{const _0x338011=(await _0xd6a319['request'])['body'];return this['_getStreamReader'](_0x338011);},'abortController':_0xd6a319['abortController']};}['executeAction']({actionName:_0x192499,content:_0x137f1c,args:_0x3c843f}){const _0x1ae3cb={'content':[{'type':'text','content':_0x137f1c}],'args':_0x3c843f},_0x22770d=this['_sendApiRequest']('/actions/system/'+_0x192499+'/calls','POST',_0x1ae3cb);return{'getStream':async()=>{const _0xcf70f2=(await _0x22770d['request'])['body'];return this['_getStreamReader'](_0xcf70f2);},'abortController':_0x22770d['abortController']};}['uploadFile'](_0x3eb087,_0x5b3348,_0x54e0be){const _0x4e599c=new FormData();_0x4e599c['append']('file',_0x5b3348,_0x5b3348['name']),_0x54e0be&&_0x4e599c['append']('attributes',JSON['stringify'](_0x54e0be));const _0x43c5f8=this['_sendApiRequest']('/conversations/'+_0x3eb087+'/files','POST',_0x4e599c);return{'getId':async()=>(await _0x43c5f8['request'])['json'](),'abortController':_0x43c5f8['abortController']};}['uploadDocuments'](_0x2ec24c,_0x2829fc){const _0x2a5f0b={'documents':_0x2829fc['map'](_0x37e8c0=>({'content':_0x37e8c0['content'],'attributes':{'version':_0x37e8c0['version'],'sessionId':_0x37e8c0['sessionId'],'channelId':_0x37e8c0['channelId'],'rootName':_0x37e8c0['rootName'],'selections':_0x37e8c0['selections']},...void 0x0!==_0x37e8c0['name']?{'name':_0x37e8c0['name']}:{},...void 0x0!==_0x37e8c0['description']?{'description':_0x37e8c0['description']}:{}}))},_0x2db310=this['_sendApiRequest']('/conversations/'+_0x2ec24c+'/documents/batch','POST',_0x2a5f0b);return{'getIds':async()=>(await _0x2db310['request'])['json'](),'abortController':_0x2db310['abortController']};}['fetchDocuments'](_0x5d872a,_0x24947d){const _0x156961=new URLSearchParams();_0x156961['append']('documentIds',_0x24947d['join'](','));const _0xe7ede0=this['_sendApiRequest']('/conversations/'+_0x5d872a+'/documents/batch?'+_0x156961['toString'](),'GET');return{'getDocuments':async()=>(await _0xe7ede0['request'])['json'](),'abortController':_0xe7ede0['abortController']};}['fetchConversations'](_0x457d63,_0x2e706b={}){const _0x4dbc7b=new URLSearchParams();_0x4dbc7b['append']('group',_0x457d63),_0x4dbc7b['append']('excludeEmpty',!0x1!==_0x2e706b['excludeEmpty']?'true':'false'),_0x4dbc7b['append']('limit',_0x2e706b['limit']?_0x2e706b['limit']['toString']():'100'),_0x4dbc7b['append']('sortBy',_0x2e706b['sortBy']?_0x2e706b['sortBy']:'createdAt'),_0x4dbc7b['append']('order',_0x2e706b['order']?_0x2e706b['order']:'desc');const _0x26d3bf=this['_sendApiRequest']('/conversations?'+_0x4dbc7b['toString'](),'GET');return{'getConversations':async()=>(await(await _0x26d3bf['request'])['json']())['items'],'abortController':_0x26d3bf['abortController']};}['deleteConversation'](_0x15ddf2){const _0x414a5d=this['_sendApiRequest']('/conversations/'+_0x15ddf2,'DELETE');return{'execute':async()=>{await _0x414a5d['request'];},'abortController':_0x414a5d['abortController']};}['updateConversation'](_0x1bd147,_0x1f0b74){const _0x396a9e=this['_sendApiRequest']('/conversations/'+_0x1bd147,'PATCH',_0x1f0b74);return{'getResult':async()=>(await _0x396a9e['request'],_0x1f0b74),'abortController':_0x396a9e['abortController']};}['fetchConversation'](_0x996b25){const _0x341be7=this['_sendApiRequest']('/conversations/'+_0x996b25,'GET');return{'getConversation':async()=>(await _0x341be7['request'])['json'](),'abortController':_0x341be7['abortController']};}['fetchConversationMessages'](_0x1e640a){const _0x40e759=this['_sendApiRequest']('/conversations/'+_0x1e640a+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x40e759['request'])['json']())['items'],'abortController':_0x40e759['abortController']};}['uploadUrl'](_0x5605a4,_0x409806,_0x1e0716){const _0x364f54=this['_sendApiRequest']('/conversations/'+_0x5605a4+'/web-resources','POST',{'url':_0x409806,'attributes':_0x1e0716});return{'getId':async()=>(await _0x364f54['request'])['json'](),'abortController':_0x364f54['abortController']};}['getModels'](_0x51c167='en'){const _0x4a3aaa=new URLSearchParams();_0x4a3aaa['append']('language',_0x51c167);const _0x923631='/models/1?'+_0x4a3aaa['toString'](),_0x53e1f1=this['_sendApiRequest'](_0x923631,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x53e1f1['request'])['json'](),'abortController':_0x53e1f1['abortController']};}['deleteFile'](_0x3f76cc,_0x8e2690){const _0x8ef148=this['_sendApiRequest']('/conversations/'+_0x3f76cc+'/files/'+_0x8e2690,'DELETE');return{'execute':async()=>{await _0x8ef148['request'];},'abortController':_0x8ef148['abortController']};}['deleteDocument'](_0x520447,_0x352033){const _0x569e30=this['_sendApiRequest']('/conversations/'+_0x520447+'/documents/'+_0x352033,'DELETE');return{'execute':async()=>{await _0x569e30['request'];},'abortController':_0x569e30['abortController']};}['deleteWebResource'](_0x26e002,_0x5fba55){const _0x21b728=this['_sendApiRequest']('/conversations/'+_0x26e002+'/web-resources/'+_0x5fba55,'DELETE');return{'execute':async()=>{await _0x21b728['request'];},'abortController':_0x21b728['abortController']};}['cancelStream'](_0x4ab83f,_0x52c77c){const _0x179393=this['_sendApiRequest']('/conversations/'+_0x4ab83f+'/messages/'+_0x52c77c+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x179393['request'];},'abortController':_0x179393['abortController']};}['resumeStream'](_0x21731c,_0x5cf4d0,_0x41b8ae='0-0'){const _0x39ec0b=new URLSearchParams({'lastEventId':_0x41b8ae}),_0x2acd93=this['_sendApiRequest']('/conversations/'+_0x21731c+'/messages/'+_0x5cf4d0+'/stream?'+_0x39ec0b['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x492ec6=await _0x2acd93['request'];return this['_getStreamReader'](_0x492ec6['body']);},'abortController':_0x2acd93['abortController']};}['callSystemReview']({reviewName:_0x1aeb2e,content:_0x4b56ef,args:_0x2ed664}){const _0x3d5fe9=this['_sendApiRequest']('/reviews/system/'+_0x1aeb2e+'/calls','POST',{'content':[{'type':'text','content':_0x4b56ef}],'args':_0x2ed664});return{'getStream':async()=>{const _0x3a12fd=(await _0x3d5fe9['request'])['body'];return this['_getStreamReader'](_0x3a12fd);},'abortController':_0x3d5fe9['abortController']};}['processDocument']({document:_0x7f799c,prompt:_0x392ece,model:_0x16c7ff}){const _0x1a51b4=this['_sendApiRequest']('/documents/process','POST',{'document':_0x7f799c,'prompt':_0x392ece,'model':_0x16c7ff});return{'getResult':async()=>(await _0x1a51b4['request'])['json'](),'abortController':_0x1a51b4['abortController']};}['callCustomReview']({content:_0x58bbfc,prompt:_0x44b108,model:_0x17cf8c}){const _0x29d63b=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x58bbfc}],'prompt':_0x44b108,'model':_0x17cf8c});return{'getStream':async()=>{const _0x2f95ff=(await _0x29d63b['request'])['body'];return this['_getStreamReader'](_0x2f95ff);},'abortController':_0x29d63b['abortController']};}['upsertAIChatRating'](_0x2bc4ea,_0x555d96,_0x37d5d7){const _0x55fcaa=this['_sendApiRequest']('/conversations/'+_0x2bc4ea+'/messages/'+_0x555d96+'/ratings','PUT',{'positiveCount':_0x37d5d7['positiveCount'],'totalCount':_0x37d5d7['totalCount'],'modificationId':_0x37d5d7['modificationId']});return{'execute':async()=>{await _0x55fcaa['request'];},'abortController':_0x55fcaa['abortController']};}['upsertAIActionRating'](_0x4d9ec6,_0x579212,_0x114078){const _0x18943d=this['_sendApiRequest']('/actions/system/'+_0x4d9ec6+'/calls/'+_0x579212+'/ratings','PUT',{'positiveCount':_0x114078['positiveCount'],'totalCount':_0x114078['totalCount']});return{'execute':async()=>{await _0x18943d['request'];},'abortController':_0x18943d['abortController']};}['upsertCustomAIActionRating'](_0x408b1a,_0x41ecd7){const _0x53af2a=this['_sendApiRequest']('/actions/custom/calls/'+_0x408b1a+'/ratings','PUT',{'positiveCount':_0x41ecd7['positiveCount'],'totalCount':_0x41ecd7['totalCount']});return{'execute':async()=>{await _0x53af2a['request'];},'abortController':_0x53af2a['abortController']};}['upsertAIReviewRating'](_0x1de56d,_0x25ab9e,_0xc8419e,_0x104fa2){const _0x1e40dd=this['_sendApiRequest']('/reviews/system/'+_0x1de56d+'/calls/'+_0x25ab9e+'/ratings','PUT',{'positiveCount':_0xc8419e['positiveCount'],'totalCount':_0xc8419e['totalCount'],'dataId':_0x104fa2});return{'execute':async()=>{await _0x1e40dd['request'];},'abortController':_0x1e40dd['abortController']};}['upsertCustomAIReviewRating'](_0x3ea068,_0x5d8dda,_0x532cc2){const _0x2eb45e=this['_sendApiRequest']('/reviews/custom/calls/'+_0x3ea068+'/ratings','PUT',{'positiveCount':_0x5d8dda['positiveCount'],'totalCount':_0x5d8dda['totalCount'],'dataId':_0x532cc2});return{'execute':async()=>{await _0x2eb45e['request'];},'abortController':_0x2eb45e['abortController']};}['_sendApiRequest'](_0x44d58e,_0x25593e,_0x2741f3,_0x311736={}){const {useCache:_0xeee5c3=!0x1,apiUrl:_0x565f64=this['_apiUrl']}=_0x311736,_0x51ae9c=new AbortController(),_0x594ece=_0xeee5c3?_0x25593e+':'+_0x44d58e:null;if(_0x594ece){const _0x3b7d14=this['_responseCache']['get'](_0x594ece);if(_0x3b7d14)return{'request':_0x3b7d14['then'](_0x297370=>_0x297370['clone']()),'abortController':_0x51ae9c};}const _0x5b29d3=_0x2741f3 instanceof FormData,_0x494811={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':kt};_0x2741f3&&!_0x5b29d3&&(_0x494811['Content-Type']='application/json');const _0x4ed2e2={'method':_0x25593e,'headers':_0x494811,'signal':_0x51ae9c['signal']};_0x2741f3&&(_0x4ed2e2['body']=_0x5b29d3?_0x2741f3:JSON['stringify'](_0x2741f3));const _0x5e0c0a=fetch(''+_0x565f64+_0x44d58e,_0x4ed2e2)['catch'](_0x3da3e0=>{_0x594ece&&this['_responseCache']['delete'](_0x594ece),this['_handleError'](_0x3da3e0);})['then'](_0x2890d9=>_0x2890d9['ok']?_0x2890d9:_0x2890d9['json']()['then'](_0x40f232=>{throw _0x594ece&&this['_responseCache']['delete'](_0x594ece),{'url':_0x565f64,'path':_0x44d58e,'method':_0x25593e,'body':_0x2741f3,'status':(_0x2890d9||{})['status'],'statusText':(_0x2890d9||{})['statusText'],'code':_0x40f232['code'],'message':_0x40f232['message'],'traceId':_0x40f232['traceId']};}));return _0x594ece&&this['_responseCache']['set'](_0x594ece,_0x5e0c0a['then'](_0x2baf51=>_0x2baf51['clone']())),{'request':_0x5e0c0a,'abortController':_0x51ae9c};}async*['_getStreamReader'](_0x206ba1){const _0x3f8cb7=[],_0x39dad4=_0x206ba1['getReader'](),_0x339825=_0x2fd08c({'onError':_0x798cbe=>{this['_handleError'](_0x798cbe);},'onEvent':_0x585c91=>{_0x585c91['data']=JSON['parse'](_0x585c91['data']),_0x3f8cb7['push'](_0x585c91);}});try{let _0x17e922=!0x1;for(;!_0x17e922;){const {done:_0x2eafe9,value:_0x4c9408}=await _0x39dad4['read']();_0x2eafe9&&(_0x17e922=!0x0),_0x339825['feed'](this['_decoder']['decode'](_0x4c9408,{'stream':!0x0})),yield*_0x3f8cb7,_0x3f8cb7['length']=0x0;}}catch(_0x7dc9f4){this['_handleError'](_0x7dc9f4);}finally{_0x39dad4['releaseLock'](),_0x339825['reset']();}}['_handleError'](_0x58d51a){if(_0x58d51a instanceof ht)throw _0x58d51a;if(_0x58d51a instanceof Error&&'AbortError'===_0x58d51a['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x58d51a});throw new ht('ai-request-failed',this,{'originalError':_0x58d51a});}};function us(_0x2c26cf,_0x512fc2,_0x3c7add){const t=_0x2c26cf['t'];switch(_0x512fc2){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'},_0x3c7add);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.'},_0x3c7add);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.'},_0x3c7add);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.'},_0x3c7add);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'},_0x3c7add);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x3c7add);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'},_0x3c7add);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.'},_0x3c7add);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.'},_0x3c7add);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.'},_0x3c7add);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.'},_0x3c7add);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'},_0x3c7add);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.'},_0x3c7add);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 _0x512fc2;}}function ds(_0x4b0152){return _0x4b0152?_0x4b0152 instanceof _0x2e6d5b?[_0x4b0152]:_0x4b0152['editors']&&0x0!==_0x4b0152['editors']['length']?Array['from'](_0x4b0152['editors']):[]:[];}function _s(_0x45353c){const _0x50fdbe=ds(_0x45353c);if(!_0x50fdbe['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x50fdbe['length'])return _0x50fdbe[0x0];const _0x185c63=_0x50fdbe['find'](_0x4af99c=>_0x4af99c['ui']?.['focusTracker']?.['isFocused']);if(_0x185c63)return _0x185c63;const _0x233812=function(_0x22ef39){if(_0x22ef39 instanceof _0x2e6d5b)return;const _0x2a84d1=_0x22ef39;if(!_0x2a84d1['plugins']||!_0x2a84d1['plugins']['has']('AIEditing'))return;return _0x2a84d1['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x45353c);return _0x233812&&_0x50fdbe['includes'](_0x233812)?_0x233812:_0x50fdbe[0x0];}const gs='ai-selection',As=['br'];var Is=class extends _0x394201{constructor(_0x2646c3){super(_0x2646c3),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'](_0x4e1960){let _0x37c146=this['_sessionIdByEditor']['get'](_0x4e1960);return _0x37c146||(_0x37c146=_0x4e1960['plugins']['has']('RealTimeCollaborationClient')&&_0x4e1960['plugins']['get']('RealTimeCollaborationClient')['sessionId']||vt(),this['_sessionIdByEditor']['set'](_0x4e1960,_0x37c146)),_0x37c146;}async['getDocumentData'](){const _0x37d695=ds(this['context']);if(!_0x37d695['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x27f39a=[],_0x47a4bd=new Set();for(const _0x43acd8 of _0x37d695){const _0xce0986=_0x43acd8['config']['get']('roots')||{};for(const _0xd8dafe of _0x43acd8['model']['document']['getRoots']()){if('$graveyard'===_0xd8dafe['rootName'])continue;const _0x369ea6=await this['_getDocumentDataForEditorRoot'](_0x43acd8,_0xd8dafe,_0x47a4bd),_0x405bd0=_0xce0986[_0xd8dafe['rootName']],_0x16c13a=_0xd8dafe['getAttribute']('$description')??_0x405bd0?.['description'];let _0x5a50f6=_0xd8dafe['getAttribute']('$title')??_0x405bd0?.['title'];_0x5a50f6||(_0x5a50f6=_0xd8dafe['getAttribute']('$rootEditableOptions')?.['label']??_0x405bd0?.['label']),_0x5a50f6||(bt('ai-document-root-missing-title',{'editor':_0x43acd8,'rootName':_0xd8dafe['rootName']}),_0x5a50f6=_0xd8dafe['rootName']),_0x27f39a['push']({'editor':_0x43acd8,'rootName':_0xd8dafe['rootName'],'content':_0x369ea6['content'],'version':_0x369ea6['version'],'sessionId':this['getSessionId'](_0x43acd8),'channelId':_0x43acd8['config']['get']('collaboration.channelId'),'selections':_0x369ea6['selections'],'name':_0x5a50f6,'description':_0x16c13a});}}return _0x27f39a;}async['_getDocumentDataForEditorRoot'](_0x321da9,_0x59de5f,_0x2f9ab8){const _0x57cdb0=_0x321da9['data']['toView'](_0x59de5f,{'convertAiChatSelectionMarker':!0x0}),_0x2883e5=new _0x181c4e(_0x321da9['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x57cdb0,_0x2883e5,_0x2f9ab8);let _0x25184=await this['_getDocumentDataStringFromView'](_0x57cdb0,_0x321da9);const _0x5ea2cd=this['_getMarkersInDocumentOrder'](_0x321da9,_0x59de5f),_0x3dab97=[];for(const _0x47377e of _0x5ea2cd){const _0x4dce9d='<'+_0x47377e['name']+':start></'+_0x47377e['name']+':start>',_0x4f77f7=_0x25184['indexOf'](_0x4dce9d);_0x25184=_0x25184['substring'](0x0,_0x4f77f7)+_0x25184['substring'](_0x4f77f7+_0x4dce9d['length']);const _0x49e08d='<'+_0x47377e['name']+':end></'+_0x47377e['name']+':end>',_0x1b9272=_0x25184['indexOf'](_0x49e08d);_0x25184=_0x25184['substring'](0x0,_0x1b9272)+_0x25184['substring'](_0x1b9272+_0x49e08d['length']),_0x3dab97['push']({'markerName':_0x47377e['name'],'start':_0x4f77f7,'end':_0x1b9272,'htmlFragment':_0x25184['substring'](_0x4f77f7,_0x1b9272)});}return{'content':_0x25184,'version':_0x321da9['model']['document']['version'],'selections':_0x3dab97};}['afterInit'](){this['context']instanceof _0x2e6d5b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x3ed9a0,_0xd8a2b0)=>{_0xd8a2b0['on']('ready',()=>{this['_integrateEditor'](_0xd8a2b0);});});}['_setOutputDataProcessor'](_0x9e774e){this['_outputDataProcessor']=_0x9e774e;}async['_getDocumentDataStringFromView'](_0x5cec0b,_0x51e8ae){let _0x29556d;if(this['_outputDataProcessor']){const _0x1ab55c=_0x51e8ae['data']['processor']['domConverter']['viewToDom'](_0x5cec0b),_0x484092=await this['_outputDataProcessor'](_0x1ab55c);_0x29556d=_0x51e8ae['data']['processor']['htmlWriter']['getHtml'](_0x484092);}else _0x29556d=_0x51e8ae['data']['processor']['toData'](_0x5cec0b);return _0x29556d;}['_integrateEditor'](_0x3b71e7){if(!_0x3b71e7['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x3b71e7);_0x3b71e7['ui']['focusTracker']['on']('change:isFocused',(_0x33eb72,_0x678b1d,_0x29dca8)=>{_0x29dca8&&(this['_lastContentFocusedEditor']=_0x3b71e7);}),_0x3b71e7['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3b71e7&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3b71e7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':gs,'view':({markerName:_0x283c1b})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x283c1b['split'](':')[0x1]],'priority':0xc})}),_0x3b71e7['conversion']['for']('dataDowncast')['markerToElement']({'model':gs+':context','view':(_0x1d1298,{writer:_0x1b4012,options:_0x3cc889})=>_0x3cc889['convertAiChatSelectionMarker']?_0x1b4012['createUIElement'](_0x1d1298['markerName']+':'+(_0x1d1298['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0xabd8f4){const _0x11b586=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0xabd8f4);const _0x576b9e=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x11b586,_0x576b9e);}['hideFakeVisualSelection'](_0x4ad593){const _0x1b1ab7=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x4ad593);const _0x6fb534=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x1b1ab7,_0x6fb534);}async['modelToDataWithIds'](_0x9f99b0,_0x5601b4){const _0x27e067=_0x5601b4['data']['toView'](_0x9f99b0),_0xeca9f0=new _0x181c4e(_0x5601b4['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x27e067,_0xeca9f0),this['_getDocumentDataStringFromView'](_0x27e067,_0x5601b4);}['_setDataIdsOnChildren'](_0x5a135e,_0x56259e,_0xe96c0a=new Set()){let _0x3ad53b=!0x1;for(const _0x14e1f2 of _0x5a135e['getChildren']()){if(!_0x14e1f2['is']('view:element')||As['includes'](_0x14e1f2['name']))continue;const _0x4eeb77=_0x14e1f2['is']('view:containerElement'),_0x132c73=_0x14e1f2['is']('view:emptyElement'),_0x3ac8a8=_0x14e1f2['is']('view:rawElement'),_0x20df35=this['_setDataIdsOnChildren'](_0x14e1f2,_0x56259e,_0xe96c0a);_0x14e1f2['hasAttribute']('data-id')?(_0x3ad53b=!0x0,_0xe96c0a['add'](_0x14e1f2['getAttribute']('data-id'))):(_0x4eeb77||_0x132c73||_0x3ac8a8||_0x20df35)&&(_0x56259e['setAttribute']('data-id',this['_nextDataId'](_0xe96c0a),_0x14e1f2),_0x3ad53b=!0x0);}return _0x3ad53b;}['_nextDataId'](_0x597183){let _0x1427c1;do{_0x1427c1='';for(let _0x10e46f=0x0;_0x10e46f<0x4;_0x10e46f++)_0x1427c1+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x597183['has'](_0x1427c1));return _0x597183['add'](_0x1427c1),_0x1427c1;}['getSelectionText'](_0x54abd6){const _0x76063a=(_0x54abd6?_0x54abd6['model']:_s(this['context'])['model'])['document']['selection'],_0x126a89=[],_0x171da7=Array['from'](_0x76063a['getRanges']());_0x171da7['sort']((_0x2b1762,_0x129dec)=>_0x2b1762['start']['isBefore'](_0x129dec['start'])?-0x1:0x1);for(const _0x1b70c7 of _0x171da7)for(const _0x2da236 of _0x1b70c7['getItems']())_0x2da236['is']('$textProxy')?_0x126a89['push'](_0x2da236['data']):_0x2da236['is']('element')&&_0x126a89['length']>0x0&&'\x20'!==_0x126a89[_0x126a89['length']-0x1]&&_0x126a89['push']('\x20');return _0x126a89['length']?'\x22'+_0x126a89['join']('')['trim']()+'\x22':us(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x5629d1){for(let _0xbbf145=0x0;_0xbbf145<this['_fakeSelections']['length'];_0xbbf145++)if(this['_fakeSelections'][_0xbbf145]['id']==_0x5629d1)return void this['_fakeSelections']['splice'](_0xbbf145,0x1);}['_addFakeSelection'](_0x1aa7ba){this['_removeFakeSelectionById'](_0x1aa7ba['id']),wt(this['_fakeSelections'],_0x1aa7ba);}['_refreshFakeSelection'](_0x2d7596,_0x209b28){if(_0x2d7596==_0x209b28)return;const _0x3bb4ad=_0x2d7596?_0x2d7596['editor']:null,_0x6f1a9e=_0x209b28?_0x209b28['editor']:null,_0x57e10d=(_0x39b1af,_0x42cf5a)=>{const _0x3425f9=_0x42cf5a['model']['markers']['getMarkersGroup'](gs);for(const _0x7afe0b of _0x3425f9)_0x39b1af['removeMarker'](_0x7afe0b);},_0x421cc4=(_0x25ad66,_0x412f3d,_0x101647)=>{const _0x8b5cd1=_0x412f3d['model'];for(let _0x32f1bd=0x0;_0x32f1bd<_0x101647['ranges']['length'];_0x32f1bd++){let _0x3f7619=_0x101647['ranges'][_0x32f1bd];const _0xae3257=gs+':'+_0x101647['id']+':'+_0x32f1bd;if(_0x3f7619['start']['isAtEnd']){const _0x353aa3=_0x3f7619['start']['getLastMatchingPosition'](({item:_0x262c12})=>!_0x8b5cd1['schema']['isContent'](_0x262c12),{'boundaries':_0x3f7619});_0x3f7619=_0x25ad66['createRange'](_0x353aa3,_0x3f7619['end']);}_0x25ad66['addMarker'](_0xae3257,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3f7619});}};_0x3bb4ad&&_0x6f1a9e&&_0x3bb4ad===_0x6f1a9e&&_0x209b28?_0x3bb4ad['model']['change'](_0x1045e5=>{_0x57e10d(_0x1045e5,_0x3bb4ad),_0x421cc4(_0x1045e5,_0x6f1a9e,_0x209b28);}):(_0x3bb4ad&&_0x3bb4ad['model']['change'](_0x4752b7=>_0x57e10d(_0x4752b7,_0x3bb4ad)),_0x6f1a9e&&_0x209b28&&_0x6f1a9e['model']['change'](_0x336406=>_0x421cc4(_0x336406,_0x6f1a9e,_0x209b28)));}['_getMarkersInDocumentOrder'](_0x62448d,_0x34292a){const _0x5efced=Array['from'](_0x62448d['model']['markers']['getMarkersGroup'](gs+':context'));return(_0x34292a?_0x5efced['filter'](_0x110987=>{const _0x1e0fb4=_0x110987['getRange']();return _0x1e0fb4&&_0x1e0fb4['root']['rootName']===_0x34292a['rootName'];}):_0x5efced)['sort']((_0x5b9f42,_0x221be3)=>_0x5b9f42['getStart']()['isBefore'](_0x221be3['getStart']())?-0x1:_0x5b9f42['getStart']()['isAfter'](_0x221be3['getStart']())?0x1:0x0);}};function ps(_0x6f9135,_0x2eedf7){return _0x14ef76(_0x6f9135,_0x2eedf7);}function ms(_0x2f656d,_0x1f3662){return _0x253579(_0x2f656d,_0x1f3662);}function Es(_0x1cb284,_0x4f9bb,_0x5d3f36){const _0x574cca=null!==_0x4f9bb?_0x5ac809=>_0x5ac809['attribs'][_0x1cb284]===_0x4f9bb:_0x3af97f=>Boolean(_0x3af97f['attribs'][_0x1cb284]);return ti(_0xffe6bf=>_0x57b23c(_0xffe6bf)&&_0x574cca(_0xffe6bf),_0x5d3f36);}function Ts(_0x529866,_0x3689d6,_0x4f6593){const _0x44e41f=null!==_0x3689d6?_0xa612f6=>_0xa612f6['attribs'][_0x529866]===_0x3689d6:_0x385570=>Boolean(_0x385570['attribs'][_0x529866]);return _0x2de7b4(_0x52963d=>_0x57b23c(_0x52963d)&&_0x44e41f(_0x52963d),_0x4f6593);}function ws(_0x1344ac){return _0x2de7b4(_0x27b0c3=>_0x57b23c(_0x27b0c3)&&function(_0x41f246){const _0x16705f=_0x41f246['toLowerCase']();return'script'===_0x16705f||'style'===_0x16705f||_0x16705f['includes']('-');}(_0x27b0c3['name']),_0x1344ac);}function Cs(_0x30e43e){return _0x3fb2b0(_0x31930f=>_0x2aa7e8(_0x31930f),_0x30e43e,!0x0,0x1/0x0);}function fs(_0x58dc19,_0xe3f4f9){return _0x58dc19&&_0x57b23c(_0x58dc19)?_0x58dc19['attribs'][_0xe3f4f9]:null;}function bs(_0x40581d,_0x1fbcf2,_0x3aecad){_0x57b23c(_0x40581d)&&(null===_0x3aecad?delete _0x40581d['attribs'][_0x1fbcf2]:_0x40581d['attribs'][_0x1fbcf2]=_0x3aecad);}function Ss(_0x269adb,_0x741cc9,_0x2f63e8){const _0x3d67f3=_0x741cc9['cloneNode'](!0x0);'beforebegin'===_0x2f63e8?_0x197a81(_0x269adb,_0x3d67f3):'afterbegin'===_0x2f63e8?_0x12b04e(_0x269adb,_0x3d67f3):'beforeend'===_0x2f63e8?_0x4fad71(_0x269adb,_0x3d67f3):'afterend'===_0x2f63e8&&_0x51fd1d(_0x269adb,_0x3d67f3);}function Rs(_0x5e8de4){const _0x13ab41=[];let _0x2d6ddb=_0x5e8de4;for(;_0x2d6ddb;)_0x2d6ddb=_0x58022d(_0x2d6ddb),_0x2d6ddb&&_0x13ab41['push'](_0x2d6ddb);return _0x13ab41;}function Os(_0x23734c){return _0x23734c['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function vs(_0x4375df){let _0x514998=0x0;for(;_0x4375df['parentNode'];)_0x4375df=_0x4375df['parentNode'],_0x514998++;return _0x514998;}function ks(_0x477ffa){const _0x437d1d=[];let _0x52e109=_0x477ffa['nextSibling'];for(;_0x52e109;)_0x437d1d['push'](_0x52e109),_0x52e109=_0x52e109['nextSibling'];_0x437d1d['forEach'](_0x2f309e=>{_0x3b2f55(_0x2f309e);});}function Ns({documentSuggestions:_0x3fe74b,transform:_0x3e91eb,documentCompare:_0xf479,documentCompareOptions:_0x491391}){const _0x463f6a=new Map();for(const [_0x7d8287,{groups:_0xf4ebde,documentContext:_0xa7be73,documentContent:_0x15485d,editor:_0x2261a0}]of _0x3fe74b){const _0x12fa0f=_0xa7be73['content'],_0x479dec=_0xa7be73['version'],_0x3dd715=_0x15485d['cloneNode'](!0x0);for(const {changes:_0x253989}of _0xf4ebde){const _0x27cc68=_0x253989['filter'](_0x5475a6=>'new'!=_0x5475a6['type'])['map'](_0x187ac2=>Es('data-id',_0x187ac2['id'],_0x3dd715))['filter'](_0x49b302=>null!==_0x49b302),_0x3f80aa=_0x253989['filter'](_0x14f3b5=>'removed'!=_0x14f3b5['type'])['map'](_0x1acd2f=>_0x1acd2f['node']['cloneNode'](!0x0));let _0x34b464=null;if(_0x27cc68['length']){_0x34b464=_0x27cc68[0x0]['previousSibling'];for(let _0x3d6da9=0x0;_0x3d6da9<_0x27cc68['length'];_0x3d6da9++)_0x3b2f55(_0x27cc68[_0x3d6da9]);}if(_0x3f80aa['length']){_0x34b464||(_0x253989[0x0]['anchorId']?_0x34b464=Es('data-id',_0x253989[0x0]['anchorId'],_0x3dd715):(_0x34b464=_0x3f80aa['shift'](),_0x12b04e(_0x3dd715,_0x34b464)));for(let _0x13598c=0x0;_0x13598c<_0x3f80aa['length'];_0x13598c++)_0x51fd1d(_0x34b464,_0x3f80aa[_0x13598c]),_0x34b464=_0x3f80aa[_0x13598c];}}const _0x4ea46c=ms(_0x3dd715),_0xec53a9=_0xf479['getDiff'](_0x12fa0f,_0x4ea46c,{'targetEditor':_0x2261a0,'anchor':_0xa7be73['rootName'],..._0x491391})['getOperations']();if(_0x3e91eb){const _0x16286c=_0x2261a0['model']['document']['history']['getOperations'](_0x479dec),_0xc40ddc={'document':_0x2261a0['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x463f6a['set'](_0x7d8287,_0xce3122(_0xec53a9,_0x16286c,_0xc40ddc)['operationsA']);}else _0x463f6a['set'](_0x7d8287,_0xec53a9);}return _0x463f6a;}function ys(_0x2b7c1f,_0x475b62){if('marker'!=_0x475b62['type'])return;const _0x452a4e=_0x2b7c1f['model']['markers']['get'](_0x475b62['name']);_0x452a4e&&(_0x475b62['oldRange']=_0x452a4e['getRange']());}const xs=/* #__PURE__ -- @preserve */
25
+ gt();var Ls=class extends xs{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x5ac969){super(),this['_generateUid']=_0x5ac969||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x360296,_0x228b87,_0x291115){this['_uidCounter']=0x0;const _0xf11a7f=_0x360296['cloneNode'](!0x0);Hs(_0x228b87,_0xf11a7f);const _0x5a8a20=_0xf11a7f['childNodes'],_0xe7afc7=Array['from'](_0x5a8a20)['filter'](_0x1b2089=>!(0x3===_0x1b2089['nodeType']&&''===ms(_0x1b2089)['trim']())),_0x4b2baa=_0xe7afc7['length'];this['_existingDataIds']=new Set(Ts('data-id',null,_0x228b87)['map'](_0x12a5c5=>fs(_0x12a5c5,'data-id'))['filter'](_0x2c0dde=>!!_0x2c0dde));for(const _0x3c196b of _0xe7afc7)_0x3c196b&&_0x57b23c(_0x3c196b)&&void 0x0===_0x3c196b['attribs']['data-id']&&bs(_0x3c196b,'data-id','new-element');if(Ts('data-id',null,_0xf11a7f)['forEach'](_0x41c8ea=>{const _0x4b94e3=fs(_0x41c8ea,'data-id');'new-element'===_0x4b94e3||this['_existingDataIds']['has'](_0x4b94e3)||bs(_0x41c8ea,'data-id','new-element');}),0x0===_0x228b87['childNodes']['length']){const _0x21f2f7=[];return Ts('data-id','new-element',_0xf11a7f)['forEach'](_0x3e4e52=>{const _0x1bde0d=this['_generateUid']();bs(_0x3e4e52,'data-id',_0x1bde0d),_0x21f2f7['push'](_0x1bde0d);}),this['_removeSpecialComments'](_0xf11a7f),{'parsedContent':_0xf11a7f,'newNodeIds':_0x21f2f7,'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 _0x500f35=-0x1,_0x3d3267=!0x1;for(let _0x263ef7=0x0;_0x263ef7<_0x4b2baa;_0x263ef7++){const _0x3ad99d=_0xe7afc7[_0x263ef7],_0x198e86=_0xe7afc7[_0x263ef7+0x1];if(this['_isNewNode'](_0x3ad99d)){if(-0x1===_0x500f35&&(_0x500f35=_0x263ef7),this['_markWrappedElements'](_0x3ad99d),!this['_isNewNode'](_0x198e86)){const [_0x377a93,_0x5d2812]=this['_findReferenceNode'](_0x3ad99d,_0x3d3267,_0x228b87);if(_0x377a93){const _0x1aa8b3=Array['from'](_0xe7afc7)['slice'](_0x500f35,_0x263ef7+0x1);this['_insertNodes'](_0x377a93,_0x1aa8b3,_0x5d2812),_0x500f35=-0x1;}}}else{if(this['_isExistingContentComment'](_0x3ad99d))_0x3d3267=!0x0;else{if(this['_isExistingNode'](_0x3ad99d)){const _0x4373ca=fs(_0x3ad99d,'data-id');if(_0x4373ca&&this['_existingDataIds']['has'](_0x4373ca)){this['_referencedExistingIds']['add'](_0x4373ca);const _0x594aae=Es('data-id',_0x4373ca,_0x228b87);this['_replaceNode'](_0x594aae,_0x3ad99d);}}else{if(Ds(_0x3ad99d)){const _0x2e2684=Ps(_0x3ad99d);Es('data-id',_0x2e2684,_0xf11a7f)||this['_touchedNodesState']['removedIds']['push'](_0x2e2684);}}}}}for(const _0x5c9648 of this['_touchedNodesState']['removedIds']){const _0x2b638f=Es('data-id',_0x5c9648,_0x228b87);_0x2b638f&&(this['_rescueUnwrappedElements'](_0x2b638f),this['_removeNode'](_0x2b638f,_0x5c9648,_0x291115));}if(Ts('data-id','new-element',_0x228b87)['forEach'](_0x58c484=>{const _0xc21ec4=this['_getUid'](_0x58c484);bs(_0x58c484,'data-id',_0xc21ec4),this['_touchedNodesState']['newIds']['push'](_0xc21ec4);}),this['_removeSpecialComments'](_0x228b87),_0x291115&&_0x291115['cutAfterUnstable']){const _0x40811e=this['_findLastConfirmationPoint'](_0xe7afc7),_0x35bb4c=this['_getLastStableElement'](_0x228b87,_0x40811e);this['_markUnstableElements'](_0x228b87,_0x35bb4c);}if(this['_processWrappedElements'](_0x228b87,_0x291115),_0x291115&&_0x291115['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x66ab50=Ts('data-id',this['_touchedNodesState']['lastTouchedId'],_0x228b87);let _0x480e73=_0x66ab50[_0x66ab50['length']-0x1];for(;_0x480e73;)ks(_0x480e73),_0x480e73=_0x480e73['parentNode'];}return{'parsedContent':_0x228b87,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x2568a5,_0x3a9e7f,_0x383335){for(const _0x37be60 of _0x3a9e7f){const _0x1b528a=this['_getUid'](_0x37be60);bs(_0x37be60,'data-id',_0x1b528a),this['_touchedNodesState']['newIds']['push'](_0x1b528a),this['_touchedNodesState']['lastTouchedId']=_0x1b528a;}const _0x47ba81='afterbegin'===_0x383335||'afterend'===_0x383335?_0x3a9e7f['reverse']():_0x3a9e7f;for(const _0x3035ab of _0x47ba81)Ss(_0x2568a5,_0x3035ab,_0x383335);}['_replaceNode'](_0xf00015,_0x45c5ac){if(!_0xf00015)return;if(_0x5207ab=_0x45c5ac,Os(ms(_0xf00015))===Os(ms(_0x5207ab)))return;var _0x5207ab;const _0xb6d6b1=fs(_0xf00015,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0xb6d6b1),this['_touchedNodesState']['lastTouchedId']=_0xb6d6b1,_0x245e63(_0xf00015,_0x45c5ac['cloneNode'](!0x0));}['_removeNode'](_0xc5cb41,_0x4a19cf,_0x417549){if(_0x417549&&_0x417549['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x4a19cf;const _0x35d3f6=_0x417549['replaceRemovedWith']['cloneNode'](!0x0);bs(_0x35d3f6,'data-id',_0x4a19cf),bs(_0x35d3f6,'data-removed','true'),_0x245e63(_0xc5cb41,_0x35d3f6);}else _0x3b2f55(_0xc5cb41);}['_findReferenceNode'](_0x30c85e,_0x29195b,_0x42bf30){const _0x2991b0=this['_findPrevElementWithDataId'](_0x30c85e,!0x1);if(_0x2991b0){const _0x381687=Ps(_0x2991b0),_0x4db592=Es('data-id',_0x381687,_0x42bf30);if(_0x4db592)return[_0x4db592,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x381687);}const _0x4c1316=this['_findNextElementWithDataId'](_0x30c85e,!0x1);if(_0x4c1316){const _0x34c93d=Ps(_0x4c1316),_0x3c357e=Es('data-id',_0x34c93d,_0x42bf30);if(_0x3c357e)return[_0x3c357e,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x34c93d);}return _0x29195b?_0x30c85e['nextSibling']?this['_findFallbackReferenceNode'](_0x30c85e,_0x42bf30):[_0x42bf30['childNodes'][_0x42bf30['childNodes']['length']-0x1],'afterend']:[_0x42bf30['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x5db9a8,_0xe2a89e){const _0x39a755=[],_0x4ece87=this['_findPrevElementWithDataId'](_0x5db9a8,!0x0);if(_0x4ece87){const _0x34a116=Es('data-id',Ps(_0x4ece87),_0xe2a89e);_0x34a116&&_0x39a755['push']([_0x34a116,'afterend']);}const _0x4873e4=this['_findNextElementWithDataId'](_0x5db9a8,!0x0);if(_0x4873e4){const _0x2bdaef=Es('data-id',Ps(_0x4873e4),_0xe2a89e);_0x2bdaef&&_0x39a755['push']([_0x2bdaef,'beforebegin']);}return _0x39a755['length']>0x1?vs(_0x39a755[0x0][0x0])<=vs(_0x39a755[0x1][0x0])?_0x39a755[0x0]:_0x39a755[0x1]:0x1===_0x39a755['length']?_0x39a755[0x0]:[_0xe2a89e['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x4c6470,_0x32d815){let _0x3a7785=_0x4c6470['nextSibling'],_0x45a968=null,_0x557271=!0x1;for(;_0x3a7785;){if(_0x2aa7e8(_0x3a7785)){if(Ds(_0x3a7785)&&(_0x45a968=_0x3a7785),this['_isExistingContentComment'](_0x3a7785)&&_0x32d815&&!_0x557271){_0x557271=!0x0,_0x3a7785=_0x3a7785['nextSibling'];continue;}break;}const _0x45d859=fs(_0x3a7785,'data-id');if(_0x45d859&&'new-element'!==_0x45d859&&this['_existingDataIds']['has'](_0x45d859)){_0x45a968=_0x3a7785;break;}_0x3a7785=_0x3a7785['nextSibling'];}return _0x45a968;}['_findPrevElementWithDataId'](_0x5e8405,_0x30fd7b){let _0x4f2612=_0x5e8405['previousSibling'],_0x17195e=null,_0x175366=!0x1;for(;_0x4f2612;){if(_0x2aa7e8(_0x4f2612)){if(Ds(_0x4f2612)&&(_0x17195e=_0x4f2612),this['_isExistingContentComment'](_0x4f2612)&&_0x30fd7b&&!_0x175366){_0x175366=!0x0,_0x4f2612=_0x4f2612['previousSibling'];continue;}break;}const _0x1cd1f8=fs(_0x4f2612,'data-id');if(_0x1cd1f8&&'new-element'!==_0x1cd1f8&&this['_existingDataIds']['has'](_0x1cd1f8)){_0x17195e=_0x4f2612;break;}_0x4f2612=_0x4f2612['previousSibling'];}return _0x17195e;}['_markWrappedElements'](_0x3449cb){_0x57b23c(_0x3449cb)&&Ts('data-id',null,_0x3449cb)['forEach'](_0x4cfce1=>{this['_isExistingNode'](_0x4cfce1)&&(bs(_0x4cfce1,'data-wrapped-id',fs(_0x4cfce1,'data-id')),bs(_0x4cfce1,'data-id',null));});}['_processWrappedElements'](_0x52d899,_0x1cc034){Ts('data-wrapped-id',null,_0x52d899)['forEach'](_0x48197d=>{const _0x1fc737=fs(_0x48197d,'data-wrapped-id');if(this['_hasUnstableParent'](_0x48197d))return;const _0x11044d=Es('data-id',_0x1fc737,_0x52d899);bs(_0x48197d,'data-id',_0x1fc737),_0x11044d&&(this['_removeNode'](_0x11044d,_0x1fc737,_0x1cc034),this['_touchedNodesState']['removedIds']['push'](_0x1fc737),this['_touchedNodesState']['lastTouchedId']=_0x1fc737);});}['_hasUnstableParent'](_0x3d7cd3){let _0x15f1e3=_0x3d7cd3['parentNode'];for(;_0x15f1e3;){if(fs(_0x15f1e3,'data-unstable'))return!0x0;_0x15f1e3=_0x15f1e3['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x365996){const _0x70c681=new Set(this['_touchedNodesState']['removedIds']),_0x19188d=new Set(this['_touchedNodesState']['newIds']);Ts('data-id',null,_0x365996)['forEach'](_0x509b24=>{const _0x26fcae=fs(_0x509b24,'data-id'),_0x5d5872=!!_0x26fcae&&this['_referencedExistingIds']['has'](_0x26fcae),_0x57efb0=!!_0x26fcae&&_0x19188d['has'](_0x26fcae);if(!_0x26fcae||!_0x5d5872&&!_0x57efb0)return;if(_0x70c681['has'](_0x26fcae))return;let _0x81c138=_0x509b24['parentNode'],_0x39ed53=!0x1;for(;_0x81c138;){if(_0x81c138===_0x365996){_0x39ed53=!0x0;break;}const _0x4a7fe9=fs(_0x81c138,'data-id');if(_0x4a7fe9&&(this['_referencedExistingIds']['has'](_0x4a7fe9)||_0x19188d['has'](_0x4a7fe9)))return;_0x81c138=_0x81c138['parentNode'];}if(_0x39ed53){if(_0x197a81(_0x365996,_0x509b24),_0x5d5872){const _0x9734ab=this['_generateUid'](),_0xcacc9e=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x26fcae);-0x1!==_0xcacc9e&&this['_touchedNodesState']['modifiedIds']['splice'](_0xcacc9e,0x1),bs(_0x509b24,'data-unwrapped-id',_0x26fcae),bs(_0x509b24,'data-id',_0x9734ab),this['_touchedNodesState']['newIds']['push'](_0x9734ab),this['_touchedNodesState']['rescuedNewIds']['add'](_0x9734ab),this['_touchedNodesState']['lastTouchedId']=_0x9734ab;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x26fcae),this['_touchedNodesState']['lastTouchedId']=_0x26fcae;}});}['_getUid'](_0x7dba3a){return this['_isExistingNode'](_0x7dba3a)?fs(_0x7dba3a,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x2a26f6){Cs(_0x2a26f6)['filter'](_0x5a88e5=>Ds(_0x5a88e5)||this['_isExistingContentComment'](_0x5a88e5))['forEach'](_0x3ec4d0=>{_0x3b2f55(_0x3ec4d0);});}['_findLastConfirmationPoint'](_0x5503f5){let _0x50c8b1=null,_0x52a3bc=null,_0x1dfe93=null,_0x2784b5=null;const _0x254941=_0x1da688=>{_0x1da688&&(_0x50c8b1=_0x1da688),_0x1dfe93=null,_0x2784b5=null;};for(let _0x4b6c37=0x0;_0x4b6c37<_0x5503f5['length'];_0x4b6c37++){const _0x40289a=_0x5503f5[_0x4b6c37];if(this['_isExistingContentComment'](_0x40289a)){_0x254941(_0x52a3bc);continue;}if(_0x57b23c(_0x40289a)){const _0x4f3f65=fs(_0x40289a,'data-id'),_0x496654=_0x4b6c37===_0x5503f5['length']-0x1;if(_0x4f3f65&&'new-element'!==_0x4f3f65&&this['_touchedNodesState']['modifiedIds']['includes'](_0x4f3f65)&&!_0x496654){_0x254941(_0x4f3f65),_0x52a3bc=_0x4f3f65;continue;}}let _0x43340b=null;const _0x280545=Ps(_0x40289a);if(_0x280545&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x280545))_0x52a3bc=_0x280545;else{if(_0x280545&&this['_touchedNodesState']['newIds']['includes'](_0x280545))_0x43340b='N';else{if(!Ds(_0x40289a))continue;_0x43340b='R';}_0x43340b===_0x2784b5||null===_0x2784b5?_0x2784b5=_0x43340b:null!==_0x1dfe93?(_0x254941(_0x52a3bc),_0x2784b5=_0x43340b):(_0x1dfe93=_0x2784b5,_0x2784b5=_0x43340b),_0x52a3bc=_0x280545;}}const _0x39ebfb=_0x5503f5[_0x5503f5['length']-0x1];return _0x39ebfb&&!_0x57b23c(_0x39ebfb)&&!Ds(_0x39ebfb)&&_0x52a3bc&&_0x254941(_0x52a3bc),_0x50c8b1;}['_getLastStableElement'](_0x31d079,_0x3c8288){if(!_0x3c8288)return null;const _0x1f2c89=Es('data-id',_0x3c8288,_0x31d079);if(!_0x1f2c89)return null;const _0xfda816=[_0x1f2c89,...Rs(_0x1f2c89)]['at'](-0x2);if(_0xfda816===_0x1f2c89)return _0x1f2c89;let _0x55e633=_0xfda816['previousSibling'];for(;_0x55e633&&!_0x57b23c(_0x55e633);)_0x55e633=_0x55e633['previousSibling'];return _0x55e633;}['_markUnstableElements'](_0x1746cd,_0x499158){const _0xab5dea=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x18c716=_0x499158?_0x499158['nextSibling']:_0x1746cd['firstChild'];for(;_0x18c716;)_0x57b23c(_0x18c716)&&(_0xab5dea['has'](fs(_0x18c716,'data-id'))||Ts('data-id',null,_0x18c716)['some'](_0x3bba39=>_0xab5dea['has'](fs(_0x3bba39,'data-id'))))&&bs(_0x18c716,'data-unstable','true'),_0x18c716=_0x18c716['nextSibling'];}['_isNewNode'](_0x36e9f8){return Boolean('new-element'===fs(_0x36e9f8,'data-id'));}['_isExistingNode'](_0x59d5c0){return Boolean((fs(_0x59d5c0,'data-id')||'')['length']>0x0&&'new-element'!==fs(_0x59d5c0,'data-id'));}['_isExistingContentComment'](_0x55a168){return Boolean(_0x2aa7e8(_0x55a168)&&ms(_0x55a168)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ds(_0x494455){return!!_0x494455&&Boolean(_0x2aa7e8(_0x494455)&&ms(_0x494455)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ps(_0x5d195b){if(!_0x5d195b)return null;if(_0x57b23c(_0x5d195b))return fs(_0x5d195b,'data-id')??null;if(_0x2aa7e8(_0x5d195b)){const _0x163969=ms(_0x5d195b)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x163969&&_0x163969[0x1])return _0x163969[0x1];}return null;}function Hs(_0x4708f0,_0x1a1604){const _0x31079e=new Map();for(const _0x225b68 of ws(_0x4708f0))_0x31079e['set'](fs(_0x225b68,'data-id'),_0x225b68);const _0x4fd390=new Set();for(const _0x455971 of ws(_0x1a1604)){const _0x38d1b4=fs(_0x455971,'data-id'),_0x4bae67=_0x38d1b4?_0x31079e['get'](_0x38d1b4):void 0x0;_0x4bae67?(_0x245e63(_0x455971,_0x1263cf(_0x4bae67,!0x0)),_0x4fd390['add'](_0x38d1b4)):_0x3b2f55(_0x455971);}for(const _0x3aff7d of Cs(_0x1a1604))Ds(_0x3aff7d)&&_0x31079e['has'](Ps(_0x3aff7d))&&_0x3b2f55(_0x3aff7d);const _0x3363f9=new Set(Ts('data-id',null,_0x1a1604)['map'](_0x527731=>fs(_0x527731,'data-id')));for(const [_0x1694ea,_0x1d3bad]of _0x31079e){if(_0x4fd390['has'](_0x1694ea))continue;let _0x250c2e=_0x1d3bad['parent'],_0x3466e2=null;for(;_0x250c2e&&_0x57b23c(_0x250c2e);){const _0x3d5a70=fs(_0x250c2e,'data-id');if(_0x3d5a70&&_0x3363f9['has'](_0x3d5a70)){_0x3466e2=_0x3d5a70;break;}_0x250c2e=_0x250c2e['parent'];}if(!_0x3466e2)continue;const _0x247129=Es('data-id',_0x3466e2,_0x1a1604);_0x247129&&_0x4fad71(_0x247129,_0x1263cf(_0x1d3bad,!0x0));}}const Ms=/* #__PURE__ -- @preserve */
26
+ gt();var Vs=class extends Ms{['_m2html'];constructor(){super();const _0x2d3fec=Object['entries'](_0x5482e3),_0x14ff03=_0x2d3fec['findIndex'](([_0x134a3c])=>'rehypeDomRaw'===_0x134a3c);if(-0x1===_0x14ff03)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x2d3fec['splice'](_0x14ff03+0x1,0x0,['rehypeSanitize',_0x4232fd]),this['_m2html']=new _0x1a42d9({'plugins':Object['fromEntries'](_0x2d3fec)});}['convertMarkdownToHTML'](_0x33223a){const _0x409775=this['_m2html']['parse'](_0x33223a);return this['parseAndNormalizeHTML'](_0x409775);}['parseAndNormalizeHTML'](_0x4b1d37){return this['_parseHTML'](_0x4b1d37);}['_parseHTML'](_0x3bf251){const _0x12e3cb=ps('<dummy>'+_0x3bf251['replace'](/<[^>]*?$/g,'')+'</dummy>');return Us(_0x12e3cb),_0x12e3cb['children']=_0x12e3cb['children'][0x0]['children'],_0x12e3cb;}};function Us(_0xc64ebb){for(const _0xeb422e of _0xc64ebb['children'])_0x57b23c(_0xeb422e)?'pre'!==_0xeb422e['name']&&Us(_0xeb422e):_0x384927(_0xeb422e)&&(_0xeb422e['data']=_0xeb422e['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Bs({changeGroups:_0x20dc22,documentContextContent:_0x1268d8,showDiff:_0x5a8f3a,trimUnchanged:_0x23b438=!0x0}){return _0x20dc22['map'](_0x2b96b6=>{if(!_0x2b96b6['editor']||'destroyed'===_0x2b96b6['editor']['state'])return null;if(!_0x4f8797(_0x2b96b6['editor'],_0x2b96b6['rootName']))return{'type':_0x2b96b6['changes'][0x0]['type'],'index':_0x2b96b6['index'],'content':new _0x1bffc9([]),'hasChanges':!0x1};const _0x46b1fd=new _0x1bffc9([]),_0x2b2d3e=new _0x1bffc9([]),_0x192a3e=new Set();for(const _0x4c5cec of _0x2b96b6['changes'])'new'==_0x4c5cec['type']&&Ts('data-id',null,_0x4c5cec['node'])['forEach'](_0xbf91d6=>{_0x192a3e['add'](fs(_0xbf91d6,'data-id'));});for(const _0x273804 of _0x2b96b6['changes'])if('removed'!=_0x273804['type']?_0x2b2d3e['children']['push'](_0x273804['node']['cloneNode'](!0x0)):_0x5a8f3a||_0x192a3e['has'](_0x273804['id'])||_0x2b2d3e['children']['push'](_0x273804['node']['cloneNode'](!0x0)),'new'!=_0x273804['type']&&(_0x5a8f3a||'removed'!=_0x273804['type'])){const _0x895eee=ti(_0x27fdbb=>fs(_0x27fdbb,'data-id')==_0x273804['id'],_0x1268d8['get'](_0x2b96b6['documentId']),!0x0);_0x895eee&&_0x46b1fd['children']['push'](_0x895eee['cloneNode'](!0x0));}let _0x57ca29,_0x511328;try{({content:_0x57ca29,hasChanges:_0x511328}=Gs(_0x2b96b6['editor'],_0x46b1fd,_0x2b2d3e,_0x5a8f3a,_0x23b438));}catch{return{'type':_0x2b96b6['changes'][0x0]['type'],'index':_0x2b96b6['index'],'content':new _0x1bffc9([]),'hasChanges':!0x1};}return{'type':_0x2b96b6['changes'][0x0]['type'],'index':_0x2b96b6['index'],'content':_0x57ca29,'hasChanges':_0x511328};})['filter'](_0xebd293=>null!==_0xebd293);}function Gs(_0x74025,_0x4b878d,_0xecd836,_0x59e947,_0x37b288=!0x0){const _0x543a05=_0x74025['plugins']['get']('DocumentCompare'),_0x35d7cb=ms(_0x4b878d),_0x5b78a0=ms(_0xecd836),_0x1cf5ad=_0x74025['data']['parse'](_0x35d7cb,'$root'),_0x1739e=_0x74025['model']['createPositionAt'](_0x1cf5ad,0x0),_0x483cb1=_0x543a05['getDiff'](_0x35d7cb,_0x5b78a0,{'anchor':_0x1739e,'markDeletions':_0x59e947,'targetEditor':_0x74025})['getOperations']();if(0x0==_0x483cb1['length'])return{'content':_0x4b878d['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x59e947?function(_0x369176,_0x542c1d,_0x193177){if(0x0==_0x369176['length'])return;const _0x4bb94c=_0x193177['plugins']['get']('DocumentCompare'),_0x51cea2=_0x193177['plugins']['get']('SuggestionsConversion');_0x193177['model']['change'](_0x10e90e=>{const _0x1fb85c=new Set();for(let _0x468fea=0x0;_0x468fea<_0x369176['length'];_0x468fea++){const _0xe2f25b=_0x369176[_0x468fea];if(_0xe2f25b['baseVersion']=null,_0xe2f25b['isDocumentOperation']=!0x1,_0x4bb94c['isMarkedRemoveOperation'](_0xe2f25b)){const _0x34556b=_0x1fc689(_0xe2f25b['newRange'],_0x193177['model']),_0x470eb8='suggestion:deletion:'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x470eb8,_0x34556b);}else switch(_0xe2f25b['type']){case'rename':{if(_0xe2f25b['oldName']==_0xe2f25b['newName'])break;_0x10e90e['batch']['addOperation'](_0xe2f25b),_0x193177['model']['applyOperation'](_0xe2f25b);const _0x42e660='$elementName',_0x24c336=_0xe2f25b['position'],_0x3b7e09=_0x193177['model']['createRange'](_0x24c336,_0x193177['model']['createPositionAt'](_0x24c336['nodeAfter'],'end')),_0x14ff6e='suggestion:attribute:'+_0x42e660+':'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x14ff6e,_0x3b7e09);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0xe2f25b['oldValue']==_0xe2f25b['newValue'])break;_0x10e90e['batch']['addOperation'](_0xe2f25b),_0x193177['model']['applyOperation'](_0xe2f25b);const _0x5d7171=_0xe2f25b['key'];if(!_0x51cea2['isRegisteredAttribute'](_0x5d7171))break;const _0x3a71e3=_0x1fc689(_0xe2f25b['range'],_0x193177['model']),_0x13cc24='suggestion:attribute:'+_0x5d7171+':'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x13cc24,_0x3a71e3);break;}case'insert':{if(_0x10e90e['batch']['addOperation'](_0xe2f25b),_0x193177['model']['applyOperation'](_0xe2f25b),Fs(_0x542c1d,_0xe2f25b),_0x369176[_0x468fea+0x1]&&'move'==_0x369176[_0x468fea+0x1]['type'])break;const _0x2ab8b1=_0xe2f25b['position'],_0xc44660=_0xe2f25b['howMany'],_0x6e6bad=_0x1fc689(_0x193177['model']['createRange'](_0x2ab8b1,_0x2ab8b1['getShiftedBy'](_0xc44660)),_0x193177['model']),_0x465c18='suggestion:insertion:'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x465c18,_0x6e6bad);break;}case'split':{_0x10e90e['batch']['addOperation'](_0xe2f25b),_0x193177['model']['applyOperation'](_0xe2f25b),Fs(_0x542c1d,_0xe2f25b);const _0x1d8584=_0xe2f25b['splitPosition'],_0x484034=_0xe2f25b['moveTargetPosition'],_0x560aff=_0x193177['model']['createRange'](_0x1d8584,_0x484034),_0x45c3b3='suggestion:insertion:'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x45c3b3,_0x560aff);break;}case'move':{_0x10e90e['batch']['addOperation'](_0xe2f25b),_0x193177['model']['applyOperation'](_0xe2f25b),Fs(_0x542c1d,_0xe2f25b);const _0xe33497=_0xe2f25b['getMovedRangeStart'](),_0x13c07e=_0xe2f25b['howMany'];for(let _0x371f32=0x0;_0x371f32<_0x13c07e;_0x371f32++){const _0x498f88=_0xe33497['getShiftedBy'](_0x371f32)['nodeAfter'];_0x1fb85c['add'](_0x498f88);}break;}case'remove':{const _0x12139f=_0xe2f25b['sourcePosition'],_0x53ee77=_0xe2f25b['howMany'],_0x7c12c6=new _0x4202c4(_0x12139f,_0x53ee77);_0x10e90e['batch']['addOperation'](_0x7c12c6),_0x193177['model']['applyOperation'](_0x7c12c6),Fs(_0x542c1d,_0xe2f25b);break;}}}for(const _0x9a57ad of _0x1fb85c){const _0x5b1e10=_0x193177['model']['createRangeOn'](_0x9a57ad),_0x3b65f8='suggestion:formatBlock:$fakeWrap:'+vt()+':$aiSuggestion';_0x542c1d['markers']['set'](_0x3b65f8,_0x1fc689(_0x5b1e10,_0x193177['model']));}});}(_0x483cb1,_0x1cf5ad,_0x74025):_0x74025['model']['change'](_0x2f7ab7=>{for(const _0xb2bad5 of _0x483cb1)if('remove'==_0xb2bad5['type']){const _0x275c82=_0xb2bad5['sourcePosition'],_0x38958d=_0xb2bad5['howMany'],_0x9319be=new _0x4202c4(_0x275c82,_0x38958d);_0x2f7ab7['batch']['addOperation'](_0x9319be),_0x74025['model']['applyOperation'](_0x9319be),Fs(_0x1cf5ad,_0xb2bad5);}else{if('marker'==_0xb2bad5['type']){const _0x1aaaa2=_0xb2bad5['name'],_0x2ccb36=_0xb2bad5['newRange'];null!==_0x2ccb36?_0x1cf5ad['markers']['set'](_0x1aaaa2,_0x2ccb36):_0x1cf5ad['markers']['delete'](_0x1aaaa2);}else _0xb2bad5['baseVersion']=null,_0xb2bad5['isDocumentOperation']=!0x1,_0x2f7ab7['batch']['addOperation'](_0xb2bad5),_0x74025['model']['applyOperation'](_0xb2bad5),Fs(_0x1cf5ad,_0xb2bad5);}}),_0x37b288){const _0x3155b9=Ks(_0x74025,_0x483cb1,_0x1cf5ad);Ys(_0x74025['model'],_0x3155b9),function(_0x1e7bcf,_0x3ea281){const _0xbf5395=_0x3ea281['getFirstRange']()['start'];let _0x5dd96c=_0x3ea281['getFirstRange']()['end'];const _0xb78282=_0xbf5395['root'];(_0x5dd96c['textNode']||_0x5dd96c['nodeAfter']&&_0x5dd96c['nodeAfter']['is']('$text'))&&(_0x2bf055(_0x5dd96c,'...'),Qs(_0xb78282,_0x5dd96c,0x3),_0x5dd96c=_0x5dd96c['getShiftedBy'](0x3)),(_0xbf5395['textNode']||_0xbf5395['nodeBefore']&&_0xbf5395['nodeBefore']['is']('$text'))&&(_0x2bf055(_0xbf5395,'...'),Qs(_0xb78282,_0xbf5395,0x3),_0xbf5395['parent']==_0x5dd96c['parent']&&(_0x5dd96c=_0x5dd96c['getShiftedBy'](0x3)));const _0x2010ac=_0x1e7bcf['createRange'](_0x1e7bcf['createPositionAt'](_0xb78282,0x0),_0xbf5395),_0x41d802=_0x1e7bcf['createRange'](_0x5dd96c,_0x1e7bcf['createPositionAt'](_0xb78282,'end')),_0x368184=[..._0x2010ac['getMinimalFlatRanges'](),..._0x41d802['getMinimalFlatRanges']()];_0x368184['reverse']();for(const _0x49f8bf of _0x368184)_0x593264(_0x49f8bf),qs(_0xb78282,_0x49f8bf);}(_0x74025['model'],_0x3155b9);}return{'content':ps(_0x74025['data']['stringify'](_0x1cf5ad,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Fs(_0x458db9,_0x278ace){for(const [_0x38d97a,_0x150499]of _0x458db9['markers']){const _0x2f4f7a=_0x4ab7a9['_createFromRanges'](_0x150499['getTransformedByOperation'](_0x278ace));_0x2f4f7a['root']==_0x458db9?_0x458db9['markers']['set'](_0x38d97a,_0x2f4f7a):_0x458db9['markers']['delete'](_0x38d97a);}}function Ks(_0xfbf3a9,_0x5b5ea3,_0x4597ff){const _0x1488a1=_0xfbf3a9['plugins']['get']('DocumentCompare');let _0x235f69=_0xfbf3a9['model']['createPositionAt'](_0x4597ff,Number['POSITIVE_INFINITY']),_0x45c4d0=_0xfbf3a9['model']['createPositionAt'](_0x4597ff,0x0);for(const _0x473109 of _0x5b5ea3){let _0x521087,_0x215daa;if(_0x1488a1['isMarkedRemoveOperation'](_0x473109))_0x521087=_0x473109['newRange']['start'],_0x215daa=_0x473109['newRange']['end'];else switch(_0x235f69=Ws(_0x235f69,_0x473109),_0x45c4d0=Ws(_0x45c4d0,_0x473109),_0x473109['type']){case'rename':_0x521087=_0x473109['position'],_0x215daa=_0x521087['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x521087=_0x473109['range']['start'],_0x215daa=_0x473109['range']['end'];break;case'insert':_0x521087=_0x473109['position'],_0x215daa=_0x521087['getShiftedBy'](_0x473109['howMany']);break;case'split':_0x521087=_0x473109['splitPosition'],_0x215daa=_0x473109['moveTargetPosition'];break;case'merge':{const _0x2d0dde=_0x473109['targetPosition']['path']['slice'](0x0,-0x1);_0x521087=_0xfbf3a9['model']['createPositionFromPath'](_0x4597ff,_0x2d0dde),_0x215daa=_0x521087['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x4b60cd=_0x473109['howMany'],_0x4a6f85=_0x473109['sourcePosition']['_getTransformedByInsertion'](_0x473109['targetPosition'],_0x4b60cd),_0x441f38=_0x473109['getMovedRangeStart']();'remove'==_0x473109['type']?(_0x521087=_0x4a6f85,_0x215daa=_0x4a6f85):(_0x521087=_0x441f38,_0x215daa=_0x441f38['getShiftedBy'](_0x4b60cd));break;}}_0x521087&&_0x521087['isBefore'](_0x235f69)&&(_0x235f69=_0x521087['clone'](),_0x235f69['stickiness']='toNone'),_0x215daa&&_0x215daa['isAfter'](_0x45c4d0)&&(_0x45c4d0=_0x215daa['clone'](),_0x45c4d0['stickiness']='toNone');}return _0xfbf3a9['model']['createSelection'](_0xfbf3a9['model']['createRange'](_0x235f69,_0x45c4d0));}function Ws(_0x29129a,_0x4afee1){return'move'!=_0x4afee1['type']&&'remove'!=_0x4afee1['type']||_0x4afee1['sourceRange']['containsPosition'](_0x29129a)&&((_0x29129a=_0x4afee1['sourcePosition']['clone']())['stickiness']='toNone'),_0x29129a['getTransformedByOperation'](_0x4afee1);}function Ys(_0x172b3,_0x1aa9ab){$s(_0x172b3,_0x1aa9ab,'forward');const _0x3cb6b5=_0x1aa9ab['getFirstRange']();_0x1aa9ab['setTo']([]),_0x1aa9ab['setTo'](_0x3cb6b5,{'backward':!0x0}),$s(_0x172b3,_0x1aa9ab,'backward');}function $s(_0x1f7453,_0x444eb5,_0x216360){let _0x3a70c5=0x14;for(;_0x3a70c5;){_0x1f7453['modifySelection'](_0x444eb5,{'unit':'word','direction':_0x216360}),_0x3a70c5--;const _0x1c6deb=_0x444eb5['focus']['forward'==_0x216360?'nodeBefore':'nodeAfter'];if(_0x1c6deb&&_0x1c6deb['is']('element')&&_0x1f7453['schema']['isBlock'](_0x1c6deb)&&_0x1f7453['schema']['isObject'](_0x1c6deb))break;}}function qs(_0x51e934,_0x51cded){for(const [_0x505fa7,_0x3497a2]of _0x51e934['markers']){const _0x22bca4=_0x3497a2['_getTransformedByDeletion'](_0x51cded['start'],_0x51cded['end']['offset']-_0x51cded['start']['offset']);null!=_0x22bca4?_0x51e934['markers']['set'](_0x505fa7,_0x22bca4):_0x51e934['markers']['delete'](_0x505fa7);}}function Qs(_0x3027d3,_0x2541ba,_0x56162d){for(let [_0x2ec63f,_0x23dec8]of _0x3027d3['markers'])_0x23dec8=_0x23dec8['_getTransformedByInsertion'](_0x2541ba,_0x56162d,!0x1)[0x0],_0x3027d3['markers']['set'](_0x2ec63f,_0x23dec8);}const Xs=/* #__PURE__ -- @preserve */
27
+ ut();var zs=class extends Xs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0xf558e3,config:_0x5cdef1,locale:_0x244115}){super(),this['_connector']=_0xf558e3,this['_config']=_0x5cdef1,this['_locale']=_0x244115;}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 _0x5c1a7c=await this['getAll']();let _0x2c95c6;return _0x2c95c6=this['_availableModels']?this['_filterModels'](_0x5c1a7c,this['_availableModels']):_0x5c1a7c['filter'](_0x583bc7=>_0x583bc7['recommended']),_0x2c95c6;}async['getModel'](_0x38e8a1){const _0x20c078=await this['getAll']();if(!_0x20c078['length'])return null;if(_0x38e8a1){const _0xe10359=this['_getModelById'](_0x20c078,_0x38e8a1);if(_0xe10359)return _0xe10359;bt('ai-chat-model-id-unrecognized',{'modelId':_0x38e8a1,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x3ef8f8=await this['getAvailableModels']();if(!_0x3ef8f8['length'])return null;if(this['_defaultModelId']){const _0x211e27=this['_getModelById'](_0x3ef8f8,this['_defaultModelId']);if(_0x211e27)return _0x211e27;bt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x3ef8f8[0x0]['id']});}return _0x3ef8f8[0x0];}async['isAvailable'](_0x12c8d3){return(await this['getAvailableModels']())['some'](_0x2ee972=>_0x2ee972['name']===_0x12c8d3['name']&&_0x2ee972['provider']===_0x12c8d3['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x645fcf=this['_locale']['uiLanguage']||'en',_0x3a136f=await this['_connector']['getModels'](_0x645fcf)['list']();this['_modelList']=_0x3a136f['items']['map'](_0x259a31=>js(_0x259a31)?{..._0x259a31,'name':us(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x259a31);}return[...this['_modelList']];}['_filterModels'](_0x776489,_0x65f6e6){let _0x123159;if(_0x65f6e6){_0x123159=[];const _0x179020=new Set(),_0x22c1d8='string'==typeof _0x65f6e6?[_0x65f6e6['toLocaleLowerCase']()]:_0x65f6e6['map'](_0x1c0dc2=>_0x1c0dc2['toLocaleLowerCase']());for(const _0x197b44 of _0x22c1d8)for(const _0x3241c2 of _0x776489)!_0x179020['has'](_0x3241c2['id'])&&this['_isMatchingFilter'](_0x3241c2,_0x197b44)&&(_0x123159['push'](_0x3241c2),_0x179020['add'](_0x3241c2['id']));}else _0x123159=_0x776489;return _0x123159;}['_isMatchingFilter'](_0x41ab5d,_0x275b07){const _0x445d08=_0x41ab5d['id']['toLocaleLowerCase'](),_0x56dae0=_0x41ab5d['name']['toLocaleLowerCase'](),_0x14d5c6=_0x41ab5d['provider']['toLocaleLowerCase']();return _0x445d08===_0x275b07||_0x56dae0===_0x275b07||js(_0x41ab5d)&&'auto'===_0x275b07||_0x14d5c6===_0x275b07||_0x445d08['startsWith'](_0x275b07);}['_getModelById'](_0x441826,_0x555e47){return _0x441826['find'](_0x498af5=>js(_0x498af5)&&'auto'===_0x555e47?_0x498af5:_0x498af5['id']===_0x555e47)||null;}};function js(_0x1d2124){return _0x1d2124['id']['startsWith']('agent');}function Js(_0x56648e,_0x19938c){for(const _0x3a311b of _0x56648e)'noop'!==_0x3a311b['type']&&(_0x3a311b['_aiSource']=_0x19938c);}var Zs=class extends _0x394201{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x4e4fa1];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new zs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0xb36553,_0x197cf5){if('completed'!==_0xb36553['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0xb36553['status']});const _0x33c45e=_0xb36553['editor'],{applyMethod:_0x279d44}=_0x197cf5;if('suggest'===_0x279d44&&!_0x33c45e['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x49ab03='suggest'===_0x279d44,_0xf97951=this['context']['plugins']['get'](_0x4e4fa1),_0x520888=_0x33c45e['model']['createPositionAt'](_0x33c45e['model']['document']['getRoot'](),0x0),_0x5cc528=_0xf97951['getDiff'](_0xb36553['contentRawOld'],_0xb36553['contentRawNew'],{'anchor':_0x520888,'markDeletions':_0x49ab03,'targetEditor':_0x33c45e}),_0x526903=_0x33c45e['model']['document']['history']['getOperations'](_0xb36553['documentVersion']),_0x36cf56={'document':_0x33c45e['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x4200d8=_0xce3122(_0x5cc528['getOperations'](),_0x526903,_0x36cf56)['operationsA'];Js(_0x4200d8,_0x197cf5['aiSource']??'api'),_0x33c45e['model']['change'](_0x208557=>{if(_0x49ab03)_0x33c45e['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4200d8);else{for(const _0x1a2890 of _0x4200d8)_0x1a2890['baseVersion']=_0x33c45e['model']['document']['version'],ys(_0x33c45e,_0x1a2890),_0x208557['batch']['addOperation'](_0x1a2890),_0x33c45e['model']['applyOperation'](_0x1a2890);}});}['mergeChangesIntoContent'](_0x1f6788,_0x377792,_0x32c2d9){const _0x3b6b73=new Vs(),_0x1865c1=new Ls();let _0xf2ff0f=_0x3b6b73['parseAndNormalizeHTML'](_0x377792);for(const _0x11e2da of _0x1f6788)try{const _0x3d68ca=_0x3b6b73['parseAndNormalizeHTML'](_0x11e2da['content']);_0xf2ff0f=_0x1865c1['merge'](_0x3d68ca,_0xf2ff0f,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x53e20d){throw new ht('ai-gateway-merge-failed',this,{..._0x11e2da},_0x53e20d);}return Gs(_0x32c2d9,_0x3b6b73['parseAndNormalizeHTML'](_0x377792),_0xf2ff0f,!0x1,!0x1)['content'];}},tn=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x41bfd3){this['_editor']=_0x41bfd3['editor'],this['_rootName']=_0x41bfd3['rootName'],this['_channelId']=_0x41bfd3['channelId'],this['_sessionId']=_0x41bfd3['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'](_0x37a0e7){this['_documentVersion']=_0x37a0e7;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x1e8444){this['_contentRawOld']=_0x1e8444;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x6927bc){this['_contentRawNew']=_0x6927bc;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x44cbec){this['_error']=_0x44cbec;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x1738d4){return _0x1738d4['replace'](/ data-id="[a-z0-9]+"/g,'');}},en=class extends tn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x5e6307){this['_summary']=_0x5e6307;}},sn=class extends _0x394201{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x5a816e,_0x4d7980){if(!_0x5a816e)throw new ht('ai-documentprocessinggateway-missing-prompt',this);const _0x29bc46=await this['context']['plugins']['get'](Is)['getDocumentData']();if(!_0x29bc46[0x0])throw new ht('ai-documentprocessinggateway-missing-document',this);const _0x14de5b=new en({'editor':_0x29bc46[0x0]['editor'],'rootName':_0x29bc46[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x29bc46[0x0]['sessionId']});if(_0x14de5b['contentRawOld']=_0x29bc46[0x0]['content'],_0x14de5b['documentVersion']=_0x29bc46[0x0]['version'],_0x4d7980?.['signal']?.['aborted'])return _0x14de5b['abort'](),_0x14de5b;const _0x18a315=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x14de5b['contentRawOld'],'prompt':_0x5a816e,'model':_0x4d7980['model']});let _0x5421d1;if(_0x4d7980?.['signal']){if(_0x4d7980['signal']['aborted'])return _0x18a315['abortController']['abort'](),_0x14de5b['abort'](),_0x14de5b;const _0x3813da=_0x4d7980['signal'],_0x131d09=()=>_0x18a315['abortController']['abort']();_0x3813da['addEventListener']('abort',_0x131d09),_0x5421d1=()=>_0x3813da['removeEventListener']('abort',_0x131d09);}try{const _0x2cde98=await _0x18a315['getResult']();if(!(_0x2cde98&&_0x2cde98['document']&&_0x2cde98['document']['length']>0x0))throw new ht('ai-documentprocessinggateway-empty-reply',this);_0x14de5b['contentRawNew']=_0x2cde98['document'],_0x14de5b['summary']=_0x2cde98['summary']||'';}catch(_0x26a3c0){_0x26a3c0 instanceof Error&&_0x26a3c0['message']['includes']('ai-request-aborted')?_0x14de5b['abort']():_0x14de5b['error']=_0x26a3c0 instanceof ht?_0x26a3c0:new ht('ai-documentprocessinggateway-run-failed',this,{},_0x26a3c0);}finally{_0x5421d1&&_0x5421d1();}return _0x14de5b;}['applyResult'](_0x1cfd81,_0x5a0114){this['context']['plugins']['get']('AIGateway')['apply'](_0x1cfd81,_0x5a0114);}};function nn(_0x216562){return _0x216562 instanceof Error&&('AbortError'===_0x216562['name']||('AICoreError'===_0x216562['name']?!0x0===_0x216562['isAbort']:_0x216562['message']['startsWith']('ai-request-aborted')));}var rn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x21cc79){super(_0x21cc79['code'],_0x21cc79['cause']instanceof Error?{'cause':_0x21cc79['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x21cc79['code'],this['severity']=_0x21cc79['severity']??'error',this['type']=_0x21cc79['type']??'system',this['context']=_0x21cc79['context'],this['isAbort']=_0x21cc79['isAbort']??nn(_0x21cc79['cause']);}},on=class extends _0x394201{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x3019b1){return new an(this,_0x3019b1);}},an=class{['_sink'];['_component'];constructor(_0x322312,_0x72d01c){this['_sink']=_0x322312,this['_component']=_0x72d01c;}['logError'](_0x56b55f,_0x436bca={}){this['_emit'](_0x56b55f,_0x436bca),this['_defaultLog'](_0x56b55f);}['reportError'](_0x3d3813,_0x5f3115={}){this['_emit'](_0x3d3813,_0x5f3115);}['_emit'](_0x1e677f,_0x3d40da){nn(_0x1e677f)||this['_sink']['fire']('error',{'error':_0x1e677f,'component':this['_component'],'context':_0x3d40da['context']});}['_defaultLog'](_0x42e9d6){if(!nn(_0x42e9d6)){if(_0x42e9d6 instanceof rn){if('user'===_0x42e9d6['type']||'network'===_0x42e9d6['type'])return;if('warning'===_0x42e9d6['severity'])return void console['warn'](this['_component'],_0x42e9d6);}console['error'](this['_component'],_0x42e9d6);}}};const hn='ck-ai-button-primary',cn='ck-ai-button-secondary',ln='ck-ai-button-tertiary';function un(_0x196a5d,_0x532853){const _0x6c4d04=new Ht(_0x196a5d),_0x12b959=us(_0x196a5d,'AI_TABS_LABEL_MINIMIZE'),_0x4420f=us(_0x196a5d,'AI_TABS_LABEL_MAXIMIZE');return _0x6c4d04['set']({'withText':!0x1,'icon':_0x23d910,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+ln}),_0x6c4d04['bind']('label')['to'](_0x532853,'isMaximized',_0x1f8874=>_0x1f8874?_0x12b959:_0x4420f),_0x6c4d04['bind']('icon')['to'](_0x532853,'isMaximized',_0x3a1ea7=>_0x3a1ea7?_0x1f0b5c:_0x23d910),_0x6c4d04['bind']('isOn')['to'](_0x532853,'isMaximized'),_0x6c4d04['on']('execute',()=>{_0x532853['fire']('resizeTabs');}),_0x6c4d04;}function dn(_0x3c5d04){const _0x387eb4=new Lt(_0x3c5d04);return _0x387eb4['attachToDom'](),_0x387eb4['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x387eb4;}const _n=/* #__PURE__ -- @preserve */
28
+ gt();var gn=class extends _n{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x109d70,isDone:_0x258b59=!0x1,isComplete:_0x1a2eaa,interactionId:_0xa5b0a8,areActionsDisabled:_0xba0160,isFromHistory:_0x43017f=!0x1,documentContextContent:_0x2fdfe0,locale:_0x27536d,id:_0x1776fe,channelsToEditors:_0x54f8eb}){super(),this['id']=_0x1776fe||vt(),this['interactionId']=_0xa5b0a8,this['type']=_0x109d70,this['areActionsDisabled']=!!_0xba0160,this['isFromHistory']=_0x43017f,this['locale']=_0x27536d,this['aiResponseParser']=new Vs(),this['aiResponseApplier']=new Ls(),this['documentContextContent']=new Map(_0x2fdfe0?.['map'](_0x26f056=>[_0x26f056['id'],ps(_0x26f056['content'])])||[]),this['_documentIdToSource']=new Map(_0x2fdfe0?.['map'](_0x4e25db=>[_0x4e25db['id'],{'editor':_0x54f8eb['get'](_0x4e25db['channelId']),'rootName':_0x4e25db['rootName']}])||[]),this['set']('isDone',_0x258b59),this['set']('isComplete',_0x1a2eaa??_0x258b59),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x37a58b,_0x36143a){const _0x401d4f='text'===this['type']?'text':_0x36143a;this['content']['has'](_0x401d4f)||this['content']['set'](_0x401d4f,''),this['content']['set'](_0x401d4f,this['content']['get'](_0x401d4f)+_0x37a58b),this['onContentChange'](_0x401d4f);}['done'](_0x612e3b=!0x0){this['isComplete']=_0x612e3b,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x34d0b1,_0x30869e){this['changeGroups'][_0x34d0b1]['state']=_0x30869e,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x34d0b1,'state':_0x30869e});}['getContentParts']({showDiff:_0x4b39f1,groupIndex:_0x174686}){const _0x5d102c=this['_getCachedContentParts'](_0x4b39f1,_0x174686);if(_0x5d102c)return _0x5d102c;let _0x3d6c44=[];if(void 0x0===_0x174686)_0x3d6c44=this['changeGroups'];else{const _0x49a8bf=this['changeGroups']['find'](({index:_0x46518})=>_0x46518===_0x174686);if(!_0x49a8bf)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x174686});_0x3d6c44=[_0x49a8bf];}const _0x336344=Bs({'showDiff':_0x4b39f1,'changeGroups':_0x3d6c44,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4b39f1,_0x336344),_0x336344;}['_getCachedContentParts'](_0x3250de,_0x2cbdc8){const _0x11829b=_0x3250de?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x11829b]['length'])return null;const _0x57812b=this['cachedSuggestionContentParts'][_0x11829b];if(void 0x0===_0x2cbdc8)return _0x57812b['length']>0x0&&_0x57812b['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x3250de,null),null):_0x112d5f(_0x57812b);{const _0x458e88=_0x57812b['find'](({index:_0x26ce9b})=>_0x26ce9b===_0x2cbdc8);if(_0x458e88)return[_0x112d5f(_0x458e88)];}return null;}['_setCachedContentParts'](_0x55d289,_0x6e2dc1){const _0x319c13=_0x55d289?'withDiff':'withoutDiff';_0x6e2dc1?_0x6e2dc1['forEach'](_0x2adb24=>{const _0x437c27=this['cachedSuggestionContentParts'][_0x319c13],_0x205ba6=_0x437c27['find'](({index:_0x477a0f})=>_0x477a0f===_0x2adb24['index']);if(_0x205ba6){const _0x387094=_0x437c27['indexOf'](_0x205ba6);_0x437c27['splice'](_0x387094,0x1,_0x2adb24);}else _0x437c27['push'](_0x2adb24);}):this['cachedSuggestionContentParts'][_0x319c13]['length']=0x0;}['onContentChange'](_0x5eb28a){if('modification'===this['type']){if(_0x5eb28a)this['parsedContent']['set'](_0x5eb28a,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x5eb28a)));else{for(const [_0x46d21b,_0x3d25f2]of this['content'])this['parsedContent']['set'](_0x46d21b,this['aiResponseParser']['parseAndNormalizeHTML'](_0x3d25f2));}const _0xdde654=this['changeGroups'];for(const _0xa2227c of this['content']['keys']())this['updateChangeGroups'](_0xa2227c);const _0x100212=this['_getDifferentChangeGroups'](_0xdde654,this['changeGroups']);(_0x100212['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x100212),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'](_0x4cef47,_0x45bc83){const _0x6a8fa0=[];for(const _0x5b8a08 of _0x45bc83){const _0x559769=_0x4cef47[_0x5b8a08['index']];_0x559769?_0x559769['changes']['length']!==_0x5b8a08['changes']['length']?_0x6a8fa0['push'](_0x5b8a08):_0x559769['changes']['forEach']((_0x1b196a,_0x2817fd)=>{const _0x20b1da=_0x5b8a08['changes'][_0x2817fd];_0x1b196a['id']!==_0x20b1da['id']&&_0x6a8fa0['push'](_0x5b8a08);}):_0x6a8fa0['push'](_0x5b8a08);}return _0x6a8fa0;}['updateChangeGroups'](_0x214597){const _0x237880=this['documentContextContent']['get'](_0x214597),_0x4f6596=this['parsedContent']['get'](_0x214597);if(!_0x237880||!_0x4f6596)return;const _0x4422fe=new _0x4fab21('p',{},[new _0x4fab21('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x108c76(us(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x5d167d=this['aiResponseApplier']['merge'](_0x4f6596,_0x237880['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x4422fe});this['parsedMergedContent']['set'](_0x214597,_0x5d167d['parsedContent']);let _0x552f87=[];if(_0x2de7b4(_0x5a6b79=>{const _0x5c889c=fs(_0x5a6b79,'data-id');if(!_0x5c889c||!_0x4f471(_0x5c889c))return!0x1;const _0x7bed80=[_0x5a6b79,...Rs(_0x5a6b79)]['at'](-0x2);if(_0x5a6b79!=_0x7bed80){const _0x50b58b=fs(_0x7bed80,'data-id');_0x4f471(_0x50b58b)||(_0x552f87['push']({'node':_0x7bed80,'id':_0x50b58b,'type':'modified'}),_0x5d167d['modifiedNodeIds']['push'](_0x50b58b));}else _0x5d167d['modifiedNodeIds']['includes'](_0x5c889c)?_0x552f87['push']({'node':_0x5a6b79,'type':'modified','id':_0x5c889c}):_0x5d167d['newNodeIds']['includes'](_0x5c889c)?_0x552f87['push']({'node':_0x5a6b79,'type':'new','id':_0x5c889c,'anchorId':fs(_0x5a6b79['previousSibling'],'data-id')}):_0x552f87['push']({'node':_0x5a6b79,'type':'removed','id':_0x5c889c});return!0x0;},this['parsedMergedContent']['get'](_0x214597)),_0x552f87=_0x552f87['filter'](({node:_0x3f9e2c})=>[...Rs(_0x3f9e2c),_0x3f9e2c]['every'](_0x73602=>!fs(_0x73602,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x4f6984=>_0x4f6984['documentId']!==_0x214597),0x0==_0x552f87['length'])return;const _0x5f47cb=[[_0x552f87[0x0]]];for(let _0x4cd164=0x1;_0x4cd164<_0x552f87['length'];_0x4cd164++){const _0x38d01d=_0x5f47cb[_0x5f47cb['length']-0x1],_0x21b5a2=_0x38d01d[_0x38d01d['length']-0x1];_0x552f87[_0x4cd164]['node']['previousSibling']==_0x21b5a2['node']&&'modified'!=_0x552f87[_0x4cd164]['type']&&'modified'!=_0x21b5a2['type']?_0x38d01d['push'](_0x552f87[_0x4cd164]):_0x5f47cb['push']([_0x552f87[_0x4cd164]]);}for(const _0x221fdf of _0x5f47cb){const _0x5051b2=_0x221fdf[0x0],_0x7f60d8=_0x221fdf[_0x221fdf['length']-0x1],_0x209db2=_0x8cc2c5(_0x5051b2['node']['previousSibling']);_0x209db2&&_0x221fdf['unshift'](_0x209db2);const _0x34a4a8=_0x8cc2c5(_0x7f60d8['node']['nextSibling']);_0x34a4a8&&_0x221fdf['push'](_0x34a4a8);}Ts('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x214597))['forEach'](_0x3c165e=>{bs(_0x3c165e,'data-wrapped-id',null);});const _0x3acb8f=new Map();Ts('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x214597))['forEach'](_0x14ea9d=>{const _0x40334a=fs(_0x14ea9d,'data-unwrapped-id'),_0x48adfd=fs(_0x14ea9d,'data-id');_0x3acb8f['set'](_0x48adfd,_0x40334a),bs(_0x14ea9d,'data-id',_0x40334a),bs(_0x14ea9d,'data-unwrapped-id',null);});for(const _0xa7cd88 of _0x552f87){const _0x18502b=_0x3acb8f['get'](_0xa7cd88['id']);_0x18502b&&(_0xa7cd88['id']=_0x18502b);}this['changeGroups']['push'](..._0x5f47cb['map']((_0x2ead56,_0x59f029)=>({'changes':_0x2ead56,'state':'pending','index':_0x59f029,'editor':this['_documentIdToSource']['get'](_0x214597)['editor'],'rootName':this['_documentIdToSource']['get'](_0x214597)['rootName'],'documentId':_0x214597})));const _0xc969b5=Array['from'](this['documentContextContent']['keys']());function _0x4f471(_0x2a51e9){return _0x5d167d['modifiedNodeIds']['includes'](_0x2a51e9)||_0x5d167d['newNodeIds']['includes'](_0x2a51e9)||_0x5d167d['removedNodeIds']['includes'](_0x2a51e9);}function _0x8cc2c5(_0x1e37ee){if(_0x1e37ee&&fs(_0x1e37ee,'data-id')&&!fs(_0x1e37ee,'data-unstable')){const _0xebd9d8=fs(_0x1e37ee,'data-id');if(!_0x4f471(_0xebd9d8))return{'node':_0x1e37ee,'type':'context','id':_0xebd9d8};}return null;}this['changeGroups']['sort']((_0x6fdb2d,_0x3ee5ae)=>_0xc969b5['indexOf'](_0x6fdb2d['documentId'])-_0xc969b5['indexOf'](_0x3ee5ae['documentId'])),this['changeGroups']['forEach']((_0x36cebe,_0x472793)=>{_0x36cebe['index']=_0x472793;});}};const An=/* #__PURE__ -- @preserve */
29
+ ut(),In=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var pn=class extends An{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x142107,locale:_0x1df1c7,channelsToEditors:_0x53e674}){super(),this['id']=vt(),this['connector']=_0x142107,this['isStopped']=!0x0,this['locale']=_0x1df1c7,this['_channelsToEditors']=_0x53e674||new Map();}async['start'](){await this['_run']();}async['resume'](_0x210963){await this['_run'](_0x210963);}async['_run'](_0x338fdb){const _0x3ad5a9=[];let _0x1b428f,_0x37b979,_0x374449,_0x444878=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x338fdb||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x4c4651=await this['currentRequest']['getStream']();for await(const _0x5376c1 of _0x4c4651){if(this['isStopped'])return;if('error'==_0x5376c1['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x5376c1['event']){case'message-metadata':this['messageId']=_0x5376c1['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x5376c1['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x5376c1['data']['conversationTitle'],!0x0);break;case'source':_0x3ad5a9['push'](_0x5376c1['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'](),_0x1b428f='modification-delta'==_0x5376c1['event']?'modification':'text',_0x37b979='modification-delta'==_0x5376c1['event']?_0x5376c1['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x1b428f&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x1b428f,'interactionId':this['id'],'id':_0x37b979,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x5376c1['event']&&{'documentId':_0x5376c1['data']['documentId']}}),'modification'==_0x1b428f&&(this['currentReply']['sources']=_0x3ad5a9['splice'](0x0))),this['currentReply']['appendContent'](_0x5376c1['data']['textDelta'],_0x5376c1['data']['documentId']);break;case'mcp-tool-result':_0x374449=JSON['parse'](_0x5376c1['data']['result']),this['_handleToolResultData']({'toolName':_0x5376c1['data']['toolName'],'data':_0x374449['data'],'attributes':_0x374449['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x5376c1['data']['toolName'],'data':_0x5376c1['data']['data']});}}_0x444878=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x3ad5a9['length']>0x0&&(this['currentReply']['sources']=_0x3ad5a9['splice'](0x0)),this['_finalizeInteraction'](_0x444878),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x1379ac){return this['replies']['find'](_0x4f1e7e=>_0x4f1e7e['id']===_0x1379ac);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x2e7edf=>_0x2e7edf['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x5988f8){const _0x571f86=this['getDocumentContext'](),_0xefbe27=new gn({'locale':this['locale'],'documentContextContent':_0x571f86?.['documents'],..._0x5988f8});return this['replies']['push'](_0xefbe27),_0xefbe27['delegate'](...In)['to'](this),this['fire']('replyCreated',_0xefbe27),_0xefbe27;}['setConversationTitle'](_0x31e328,_0x1532ed=!0x1){this['fire']('setConversationTitle',_0x31e328,_0x1532ed);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x507954){this['fire']('toolDataReceived',{'type':'result','toolName':_0x507954['toolName'],'data':structuredClone(_0x507954['data']||{}),'attributes':structuredClone(_0x507954['attributes']||{})},this);}['_handleToolNotificationData'](_0x274a8c){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x274a8c['toolName'],'data':structuredClone(_0x274a8c['data'])},this);}['_finalizeInteraction'](_0x4334fe=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x4334fe),this['currentRequest']=this['currentReply']=void 0x0;}};const mn=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),En=/* #__PURE__ -- @preserve */
30
+ gt(),Tn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var wn=class AIChatContext extends En{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x5b8aa1,config:_0xabeabd,ownerId:_0x513a8e}){super(),this['_connector']=_0x5b8aa1,this['_config']=_0xabeabd,this['_ownerId']=_0x513a8e;}['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'](_0x3416cb,_0x2093f8){const _0x508513=new Map(),{contextItem:_0x80a2dd,hasUnmatched:_0x528cd3}=await this['_populateDocumentContextItem'](_0x3416cb,_0x2093f8);_0x80a2dd&&_0x508513['set'](_0x80a2dd['id'],_0x80a2dd);for(const _0x124a43 of _0x3416cb){if('document'===_0x124a43['type'])continue;const _0xdb3bb9=await this['_createContextItemFromContent'](_0x124a43);this['_addToConversationContextItem'](_0xdb3bb9),_0x508513['set'](_0xdb3bb9['id'],_0xdb3bb9);}return{'contextItems':_0x508513,'hasUnmatched':_0x528cd3};}async['_populateDocumentContextItem'](_0x3f984e,_0x1b2f62){const _0x16da41=_0x3f984e['filter'](_0x277a73=>'document'===_0x277a73['type']);if(0x0===_0x16da41['length'])return{'hasUnmatched':!0x1};const _0x872acc=_0x16da41['map'](_0x24fd30=>_0x24fd30['id']),_0xbe616b=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x872acc)['getDocuments'](),_0x5eeaf3=new Map(_0xbe616b['map'](_0x1bf283=>[_0x1bf283['id'],_0x1bf283])),_0x873fb6=[];let _0x287b58=!0x1;for(const _0x1478e5 of _0x16da41){const _0x5909cb=_0x5eeaf3['get'](_0x1478e5['id']);_0x5909cb&&(this['_matchDocumentToRoot'](_0x5909cb,_0x1b2f62)||(_0x287b58=!0x0),_0x873fb6['push']({'id':_0x5909cb['id'],'content':_0x5909cb['content'],'version':_0x5909cb['attributes']?.['version']??0x0,'sessionId':_0x5909cb['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x5909cb['attributes']?.['channelId']??_0x1b2f62[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x5909cb['attributes']?.['rootName']??_0x1b2f62[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x1d98c4={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x873fb6};return this['_addToConversationContextItem'](_0x1d98c4),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x1d98c4,'hasUnmatched':_0x287b58};}['_matchDocumentToRoot'](_0xccdb61,_0x1ab748){const _0x274e27=_0xccdb61['attributes']?.['channelId'],_0x424571=_0xccdb61['attributes']?.['rootName'];if(_0x274e27&&_0x424571){for(const _0xd5cdfb of _0x1ab748)if(_0xd5cdfb['config']['get']('collaboration.channelId')===_0x274e27){for(const _0x149d2a of _0xd5cdfb['model']['document']['getRoots']())if('$graveyard'!==_0x149d2a['rootName']&&_0x149d2a['rootName']===_0x424571)return{'editor':_0xd5cdfb,'rootName':_0x149d2a['rootName']};}}}async['_createContextItemFromContent'](_0x43b1d5){return'mcp-tool-context'===_0x43b1d5['type']?{'id':_0x43b1d5['id'],'uiId':_0x43b1d5['id'],'label':_0x43b1d5['data']?.['label']||_0x43b1d5['id'],'type':'mcp-tool-context','mcpServerName':_0x43b1d5['mcpServerName'],'toolName':_0x43b1d5['toolName'],'data':_0x43b1d5['data']||{}}:{'id':_0x43b1d5['id'],'uiId':_0x43b1d5['id'],'label':_0x43b1d5['attributes']?.['label']||_0x43b1d5['name']||_0x43b1d5['url']||_0x43b1d5['id'],'type':_0x43b1d5['type'],..._0x43b1d5?.['attributes']?.['resourceId']?{'resourceId':_0x43b1d5['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x450dae){this['_pendingContextItems']['get'](_0x450dae)?.['isReadOnly']||this['_removeContextItem'](_0x450dae);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xcde460 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0xcde460['uiId']);const _0x240bf6=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x240bf6&&this['_addContextItem']({..._0x240bf6,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x2bc768){for(const _0x2638fa of _0x2bc768['values']())this['_addToConversationContextItem'](_0x2638fa);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'](_0x4b7771){return Array['from'](_0x4b7771['values']())['flatMap'](_0xfe09b=>this['_mapContextItemToRequestData'](_0xfe09b));}async['addFilesToContext'](_0x585ad9,_0x27bf27,_0x42be54='file'){const _0x589c9d='files-'+vt();this['_startUploadOperation'](_0x589c9d);try{await Promise['all'](_0x585ad9['map'](async _0xb2863c=>{const _0x2ea3e4='file-'+vt(),_0x2ba11f=_0x4ae7b3(_0xb2863c['name']),_0x20e6ea='file'===_0x42be54&&_0xb2863c['type']['startsWith']('image/')?'image':_0x42be54;try{this['_addContextItem']({'type':_0x20e6ea,'label':_0x27bf27?.['label']||_0x2ba11f,'uiId':_0x2ea3e4,'resourceId':_0x27bf27?.['resourceId']},!0x0);const _0x48f7c8=this['_connector']['uploadFile'](this['_ownerId'],_0xb2863c,_0x27bf27);this['_ongoingUploads']['set'](_0x2ea3e4,_0x48f7c8['abortController']);const {id:_0x385421}=await _0x48f7c8['getId']();this['_ongoingUploads']['delete'](_0x2ea3e4),this['_finishContextItemLoading']({'type':_0x20e6ea,'id':_0x385421,'label':_0x27bf27?.['label']||_0x2ba11f,'uiId':_0x2ea3e4,'resourceId':_0x27bf27?.['resourceId']},!0x1);}catch(_0xedc960){if(this['_ongoingUploads']['delete'](_0x2ea3e4),!nn(_0xedc960)){const _0x574c2d=new rn({'code':mn['get'](_0xedc960['code'])||'ai-chat-file-upload-failed','cause':_0xedc960,'context':{'fileName':_0x2ba11f}});this['fire']('error',{'error':_0x574c2d});}this['_removeContextItem'](_0x2ea3e4);}}));}finally{this['_finishUploadOperation'](_0x589c9d);}}['addCurrentDocumentToContext'](_0x5dd3a3){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x4cbd28={'type':'document','uiId':'current-document','label':_0x5dd3a3,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x4cbd28);}async['updateCurrentDocuments'](_0x5d1274){const _0x5ac4b6=this['_pendingContextItems']['get']('current-document');if(!_0x5ac4b6||!_0x5d1274['length']||_0x5d1274['every'](_0x3bd6bc=>!_0x3bd6bc['content']))return;_0x5d1274['length']>0x1&&_0x5d1274['some'](_0x2c1708=>!_0x2c1708['description'])&&bt('ai-chat-documents-missing-description');try{const _0x5cf374=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x5d1274)['getIds']();if(_0x5cf374['length']!==_0x5d1274['length']||_0x5cf374['some'](_0x448751=>!_0x448751?.['id'])){const _0x49a8ab=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x49a8ab});}_0x5ac4b6['documents']=_0x5d1274['map']((_0x5af469,_0x3c6204)=>{return{'id':_0x5cf374[_0x3c6204]['id'],'content':_0x5af469['content'],'version':_0x5af469['version'],'sessionId':_0x5af469['sessionId'],'selection':(_0x25817d=_0x5af469['selections'],_0x25817d?_0x25817d['map'](_0x52db30=>({'start':_0x52db30['start'],'end':_0x52db30['end']})):[]),'channelId':_0x5af469['channelId'],'rootName':_0x5af469['rootName']};var _0x25817d;});}catch(_0x53546c){const _0x3f6c84=new rn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x53546c});this['fire']('error',{'error':_0x3f6c84});}}['addSelectionToContext'](_0x3f2b73){this['_addContextItem']({'type':'selection','label':_0x3f2b73,'uiId':'selection','content':_0x3f2b73});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x1de076,_0x2ee3a3){const _0x224c16='url-'+vt();this['_startUploadOperation'](_0x224c16);const _0x1829a9='url-'+vt();try{this['_addContextItem']({'type':'web-resource','label':_0x2ee3a3?.['label']||_0x1de076,'uiId':_0x1829a9,'resourceId':_0x2ee3a3?.['resourceId']},!0x0);const _0x3b2721=this['_connector']['uploadUrl'](this['_ownerId'],_0x1de076,_0x2ee3a3);this['_ongoingUploads']['set'](_0x1829a9,_0x3b2721['abortController']);const {id:_0xcd415c}=await _0x3b2721['getId']();this['_ongoingUploads']['delete'](_0x1829a9),this['_finishContextItemLoading']({'type':'web-resource','id':_0xcd415c,'label':_0x2ee3a3?.['label']||_0x1de076,'uiId':_0x1829a9,'resourceId':_0x2ee3a3?.['resourceId']},!0x1);}catch(_0x280f46){this['_ongoingUploads']['delete'](_0x1829a9),nn(_0x280f46)||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x1de076,'originalError':_0x280f46}),'url':_0x1de076}),this['_removeContextItem'](_0x1829a9);}finally{this['_finishUploadOperation'](_0x224c16);}}['addToolItemToContext'](_0x5bfd17){_0x5bfd17['id']=_0x5bfd17['id']??vt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x5bfd17['uiId'],_0x5bfd17),this['fire']('contextItemAdded',{'contextItem':_0x5bfd17,'isLoading':!0x1});}async['loadSourceResources'](_0x3d1a41,_0x2eb6ac,_0x2295ad){const _0x2c328e=this['_addContextOptionsState']['sources']['find'](_0x254eca=>_0x254eca['id']===_0x3d1a41);if(!_0x2c328e)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x3d1a41}),'sourceId':_0x3d1a41}),[];try{const _0x228194=(await _0x2c328e['getResources'](_0x2eb6ac))['map'](_0xdc4097=>{const _0x50cb18=this['_isResourceInContext'](_0xdc4097['id']);return{..._0xdc4097,'isInContext':_0x50cb18};});return _0x2c328e['resources']=_0x228194,this['fire']('sourceResourcesLoaded',{'sourceId':_0x3d1a41,'source':_0x2c328e,'resources':_0x228194,'uid':_0x2295ad}),_0x228194;}catch(_0xa2df81){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x3d1a41,'originalError':_0xa2df81}),'sourceId':_0x3d1a41,'sourceLabel':_0x2c328e['label']}),[];}}async['addResourceToContext'](_0x4aa847,_0x2bf0ee){if(this['_isResourceInContext'](_0x2bf0ee['id']))return;let _0x592fd7=_0x2bf0ee['data'];if(!_0x592fd7&&_0x4aa847['getData'])try{_0x592fd7=await _0x4aa847['getData'](_0x2bf0ee['id']);}catch(_0xfb7a3e){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id'],'originalError':_0xfb7a3e}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});}if(_0x592fd7)switch(_0x2bf0ee['type']){case'web-resource':if('string'!=typeof _0x592fd7)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id'],'expectedType':'string','actualType':typeof _0x592fd7}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});await this['addUrlToContext'](_0x592fd7,{'label':_0x2bf0ee['label'],'resourceId':_0x2bf0ee['id']});break;case'file':if(!(_0x592fd7 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id'],'expectedType':'File','actualType':typeof _0x592fd7}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});await this['addFilesToContext']([_0x592fd7],{'label':_0x2bf0ee['label'],'resourceId':_0x2bf0ee['id']});break;case'text':if('object'!=typeof _0x592fd7||!('content'in _0x592fd7)||!('type'in _0x592fd7))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x592fd7}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});_0x592fd7=AIChatContext['_convertTextResourceToFile'](_0x592fd7,_0x2bf0ee['label']),await this['addFilesToContext']([_0x592fd7],{'label':_0x2bf0ee['label'],'resourceId':_0x2bf0ee['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id'],'resourceType':_0x2bf0ee['type']}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']}),'resourceId':_0x2bf0ee['id'],'sourceId':_0x4aa847['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x14f541){if(void 0x0!==_0x14f541)this['_addContextOptionsState']['document']['isHidden']=!_0x14f541;else{const _0x1a260a=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x1a260a;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x4c6b11,_0x447f15){switch(_0x4c6b11['type']){case'markdown':return new File([_0x4c6b11['content']],_0x447f15,{'type':'text/markdown'});case'html':return new File([_0x4c6b11['content']],_0x447f15,{'type':'text/html'});default:return new File([_0x4c6b11['content']],_0x447f15,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x294809){switch(_0x294809['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x294809['id']}];case'web-resource':return[{'type':'web-resource','id':_0x294809['id']}];case'document':return _0x294809['documents']?.['length']?_0x294809['documents']['map'](_0x3e1ab2=>({'type':'document','id':_0x3e1ab2['id'],..._0x3e1ab2['selection']?.['length']&&{'selection':_0x3e1ab2['selection']}})):[];case'mcp-tool-context':{const _0x3eefdf=_0x294809;return[{'type':'mcp-tool-context','mcpServerName':_0x3eefdf['mcpServerName'],'toolName':_0x3eefdf['toolName'],'data':{..._0x3eefdf['data'],'label':_0x3eefdf['label']||_0x3eefdf['data']?.['label']||_0x3eefdf['id']},'id':_0x3eefdf['id']}];}default:return[];}}['_addContextItem'](_0x194c97,_0x21fe79=!0x1){if(this['_pendingContextItems']['set'](_0x194c97['uiId'],_0x194c97),_0x194c97['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x194c97,'isLoading':_0x21fe79}),'current-document'===_0x194c97['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x194c97['resourceId']){const _0x235523=this['_findSourceIdsByResourceId'](_0x194c97['resourceId']);_0x235523&&_0x235523['forEach'](_0x2e59a8=>{this['_updateResourceInContextState'](_0x2e59a8,_0x194c97['resourceId'],!0x0);});}}['_removeContextItem'](_0x57798c){const _0x49548a=this['_pendingContextItems']['get'](_0x57798c),_0x2ac904=this['_ongoingUploads']['get'](_0x57798c);if(_0x2ac904&&(_0x2ac904['abort'](),this['_ongoingUploads']['delete'](_0x57798c)),_0x49548a?.['resourceId']){const _0x4f5a06=this['_findSourceIdsByResourceId'](_0x49548a['resourceId']);_0x4f5a06&&_0x4f5a06['forEach'](_0x416538=>{this['_updateResourceInContextState'](_0x416538,_0x49548a['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x57798c),this['fire']('contextItemRemoved',{'uiId':_0x57798c,'type':_0x49548a?.['type']}),'current-document'===_0x57798c&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x1d07e0,_0x318f9f){if(this['_pendingContextItems']['has'](_0x1d07e0['uiId'])&&(this['_pendingContextItems']['set'](_0x1d07e0['uiId'],_0x1d07e0),this['fire']('contextItemLoadingEnded',{'contextItem':_0x1d07e0,'isLoading':_0x318f9f}),_0x1d07e0['resourceId'])){const _0x47c94e=this['_findSourceIdsByResourceId'](_0x1d07e0['resourceId']);_0x47c94e&&_0x47c94e['forEach'](_0x3930c3=>{this['_updateResourceInContextState'](_0x3930c3,_0x1d07e0['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x2ad5a8){this['_conversationContextItems']['set'](_0x2ad5a8['uiId'],_0x2ad5a8);}['_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'](_0x351d15=>({..._0x351d15,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x381fdd=>({..._0x381fdd,'resources':[]}))??[];}['_isResourceInContext'](_0x149cbd){for(const _0x561b6d of this['_pendingContextItems']['values']())if(_0x561b6d['resourceId']===_0x149cbd)return!0x0;for(const _0x1ae972 of this['_conversationContextItems']['values']())if(_0x1ae972['resourceId']===_0x149cbd)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2dede8){const _0x50f063=[];for(const _0x45ef9b of this['_addContextOptionsState']['sources'])_0x45ef9b['resources']['find'](_0x17b040=>_0x17b040['id']===_0x2dede8)&&_0x50f063['push'](_0x45ef9b['id']);return 0x0===_0x50f063['length']?null:_0x50f063;}['_updateResourceInContextState'](_0x39cefe,_0x495736,_0x2964de){const _0xc07c46=this['_addContextOptionsState']['sources']['find'](_0x54a4cf=>_0x54a4cf['id']===_0x39cefe);if(!_0xc07c46)return;const _0x20bb6b=_0xc07c46['resources']['find'](_0x833138=>_0x833138['id']===_0x495736);_0x20bb6b&&(_0x20bb6b['isInContext']=_0x2964de,this['fire']('resourceStateChanged',{'sourceId':_0x39cefe,'resourceId':_0x495736,'isInContext':_0x2964de}));}['_startUploadOperation'](_0x55b771){this['_ongoingUploadOperations']['set'](_0x55b771,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x26be61){this['_ongoingUploadOperations']['delete'](_0x26be61),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const Cn=/* #__PURE__ -- @preserve */
31
+ ut(),fn=['capabilitiesUpdated'];var bn=class extends Cn{['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x1d9f61){const _0x512c60={};return _0x1d9f61&&_0x1d9f61['isWebSearchEnabled']&&(_0x512c60['webSearch']={}),_0x1d9f61&&_0x1d9f61['isReasoningEnabled']&&(_0x512c60['reasoning']={}),_0x512c60;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x51203c){_0x51203c!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x51203c,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x5332f5){_0x5332f5!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x5332f5,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},Sn=class extends pn{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x4f9623){super(_0x4f9623),this['conversationId']=_0x4f9623['conversationId'],this['contextItems']=_0x4f9623['contextItems'],this['capabilities']=_0x4f9623['capabilities'],this['userMessage']=_0x4f9623['userMessage'],this['model']=_0x4f9623['model'],this['attributes']=_0x4f9623['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':wn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':bn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Rn=/* #__PURE__ -- @preserve */
32
+ ut();var On=class extends Rn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x5551f3){super(),this['options']=_0x5551f3,this['connector']=_0x5551f3['connector'],this['chatModels']=_0x5551f3['chatModels'],this['id']=_0x5551f3['conversationId'],this['isFromHistory']=_0x5551f3['isFromHistory'],this['_channelsToEditors']=_0x5551f3['channelsToEditors'],this['_getSessionId']=_0x5551f3['getSessionId'];}async['init'](_0x1b6c0b){try{this['chatContext']=new wn({'connector':this['connector'],'config':_0x1b6c0b,'ownerId':this['id']}),this['chatContext']['delegate'](...Tn)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new bn(),this['chatCapabilities']['delegate'](...fn)['to'](this),this['chatCapabilities']['init']();const _0x3b928e=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x3b928e});const _0x535f9d=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x535f9d&&await this['setModel'](_0x535f9d);}catch(_0x38757d){const _0x2258ee=new rn({'code':'ai-chat-conversation-init-failed','cause':_0x38757d,'type':'network'});this['fire']('error',{'error':_0x2258ee});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x29d0af}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x29d0af,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x44c6f2){const _0x23f612=new rn({'code':'ai-chat-conversation-start-failed','cause':_0x44c6f2,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x23f612}),_0x23f612;}}async['load'](_0x4ee6b6){try{const _0x2683a3=await this['connector']['fetchConversation'](_0x4ee6b6)['getConversation'](),_0x19691e=await this['connector']['fetchConversationMessages'](_0x4ee6b6)['getMessages'](),_0x28966b=_0x19691e[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x2683a3['id'],'title'in _0x2683a3?this['fire']('setConversationTitle',_0x2683a3['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x4913e6=(await this['chatModels']['getAll']())['find'](_0x524c48=>_0x524c48['id']['toLowerCase']()===_0x28966b['toLowerCase']());this['selectedModel']=_0x4913e6,this['fire']('modelSelected',{'selectedModel':_0x4913e6,'isDisabled':!0x0});const {streamingMessageId:_0x1445d6}=await this['_processMessagesToInteractions'](_0x19691e,_0x28966b);return _0x1445d6&&this['currentInteraction']?this['_resumeStream'](_0x1445d6):this['currentInteraction']=void 0x0,this;}catch(_0x46ab81){const _0x23488b=new rn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x46ab81,'type':'network','context':{'conversationId':_0x4ee6b6}});throw this['fire']('error',{'error':_0x23488b}),_0x23488b;}}async['_processMessagesToInteractions'](_0x53ee94,_0x5509ea){let _0x309e70,_0x524a30,_0x57d66c=!0x1;for(const _0x14c016 of _0x53ee94)if('user'===_0x14c016['role']){const {contextItems:_0x398c71,hasUnmatched:_0x9af5a}=await this['_extractContextItems'](_0x14c016);_0x57d66c=_0x9af5a;const _0x1abe56={'isReasoningEnabled':Object['hasOwn'](_0x14c016['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x14c016['capabilities'],'webSearch')};_0x309e70=this['createInteraction']({'userMessage':_0x14c016['prompt'],'contextItems':_0x398c71,'capabilities':_0x1abe56,'modelId':_0x5509ea,'attributes':_0x14c016['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x309e70,_0x524a30=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x14c016['role']&&_0x309e70){if('streaming'===_0x14c016['status']){_0x524a30=_0x14c016['id'];continue;}if('error'===_0x14c016['status'])continue;const _0x21d76c=[];for(const _0x1cb443 of _0x14c016['content'])switch(_0x1cb443['type']){case'text':case'modification':{const _0x3c11f0=_0x309e70['getDocumentContext'](),_0xd1aec5=this['_hasSessionMismatch'](_0x3c11f0)||_0x57d66c;_0x309e70['currentReply']?.['type']!==_0x1cb443['type']&&(_0x309e70['currentReply']=_0x309e70['createReply']({'type':_0x1cb443['type'],'isDone':!0x0,'interactionId':_0x309e70['id'],'areActionsDisabled':_0xd1aec5,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x21d76c['length']>0x0&&(_0x309e70['currentReply']['sources']=_0x21d76c['splice'](0x0))),_0x309e70['currentReply']['appendContent'](_0x1cb443['content'],_0x1cb443['documentId']);break;}case'url':_0x21d76c['push'](_0x1cb443);break;case'mcp-tool-result':{const {data:_0xa77a7e,attributes:_0x4eae73}=JSON['parse'](_0x1cb443['content']);_0x309e70['_handleToolResultData']({'toolName':_0x1cb443['toolName'],'data':_0xa77a7e,'attributes':_0x4eae73});break;}}'cancelled'===_0x14c016['status']&&this['fire']('error',{'interactionId':_0x309e70['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x524a30};}async['_resumeStream'](_0xa865fe){if(this['currentInteraction'])try{const _0x3bc19f=this['connector']['resumeStream'](this['id'],_0xa865fe);await this['currentInteraction']['resume'](_0x3bc19f);}catch(_0x62c894){_0x62c894 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x62c894});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x73ef1b){return _0x73ef1b['content']?this['chatContext']['populateFromMessage'](_0x73ef1b['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x1e0254,attributes:_0x43cb8a}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x12b25c=new Map(this['getPendingContextItems']()),_0x5e2279=this['chatCapabilities']['getCapabilitiesConfig'](),_0x99af77=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x1e0254,'contextItems':_0x12b25c,'capabilities':_0x5e2279,'modelId':_0x99af77,'attributes':_0x43cb8a,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0xf36840){if(_0xf36840 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0xf36840});else{const _0x522920=mn['get'](_0xf36840['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x522920,null,{'error':_0xf36840})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x282dbc,contextItems:_0x16be5f,capabilities:_0x11d7a5,modelId:_0x30ed3b,attributes:_0x4bb6e3,channelsToEditors:_0x238ea5}){const _0x43a1b3=new Sn({'userMessage':_0x282dbc,'contextItems':_0x16be5f,'capabilities':_0x11d7a5,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x30ed3b,'attributes':_0x4bb6e3,'channelsToEditors':_0x238ea5});return _0x43a1b3['delegate'](...In)['to'](this),this['interactions']['push'](_0x43a1b3),this['fire']('interactionCreated',_0x43a1b3),_0x43a1b3;}['getInteraction'](_0x64da08){return this['interactions']['find'](_0x39cfe5=>_0x39cfe5['id']===_0x64da08);}['removeInteraction'](_0x28aa79){const _0x14f917=this['getInteraction'](_0x28aa79);_0x14f917&&(_0x14f917['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x14f917),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x3a043a=this['lastInteraction'];_0x3a043a?.['conversationId']&&_0x3a043a['messageId']&&this['connector']['cancelStream'](_0x3a043a['conversationId'],_0x3a043a['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x1eb834){this['chatContext']['addCurrentDocumentToContext'](_0x1eb834);}async['updateCurrentDocumentsInContext'](_0x381d16){await this['chatContext']['updateCurrentDocuments'](_0x381d16);}['toggleAddCurrentDocumentOptionVisibility'](_0x405593){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x405593);}['_hasSessionMismatch'](_0x4d731d){return!!_0x4d731d&&_0x4d731d['documents']['some'](_0x37646e=>{const _0x4e4010=this['_channelsToEditors']['get'](_0x37646e['channelId']);return!_0x4e4010||_0x37646e['sessionId']!==this['_getSessionId'](_0x4e4010);});}['addSelectionToContext'](_0x887412){this['chatContext']['addSelectionToContext'](_0x887412);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0xc6fac6){this['chatContext']['addFilesToContext'](_0xc6fac6);}['addUrlToContext'](_0x362f52){this['chatContext']['addUrlToContext'](_0x362f52);}['addToolItemToContext'](_0x41798b){this['chatContext']['addToolItemToContext'](_0x41798b);}['addResourceToContext'](_0x179441,_0x2bab7a){this['chatContext']['addResourceToContext'](_0x179441,_0x2bab7a);}['loadSourceResources'](_0x56a889,_0x271e4d,_0x296f04){return this['chatContext']['loadSourceResources'](_0x56a889,_0x271e4d,_0x296f04);}['removeFromContext'](_0x408a05){this['chatContext']['removeFromContext'](_0x408a05);}['setWebSearch'](_0x2edad7){this['chatCapabilities']['setWebSearch'](_0x2edad7);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x19594c){this['chatCapabilities']['setReasoning'](_0x19594c);}['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'](_0x1b538e){_0x1b538e?!0x1===await this['chatModels']['isAvailable'](_0x1b538e)&&(bt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x1b538e}),_0x1b538e=(await this['chatModels']['getAvailableModels']())[0x0]):(bt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x1b538e=(await this['chatModels']['getAvailableModels']())[0x0]),_0x1b538e['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x1b538e,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x1b538e}));}};function vn({groups:_0x409dc9,documentContextContent:_0x42d2ee,documents:_0x128df2}){const _0x84960a=new Map();for(const _0x2d112a of _0x409dc9){const {documentId:_0x28ed5f}=_0x2d112a,_0x5ef08f=_0x84960a['get'](_0x28ed5f);if(_0x5ef08f)_0x5ef08f['groups']['push'](_0x2d112a),_0x5ef08f['indexes']['push'](_0x2d112a['index']);else{const _0x34965c=_0x128df2['find'](_0x578b5b=>_0x578b5b['id']===_0x28ed5f),_0x1f99b0=_0x42d2ee['get'](_0x28ed5f);if(!_0x34965c||!_0x1f99b0)continue;_0x84960a['set'](_0x28ed5f,{'groups':[_0x2d112a],'documentContext':_0x34965c,'documentContent':_0x1f99b0,'editor':_0x2d112a['editor'],'indexes':[_0x2d112a['index']]});}}return _0x84960a;}function kn(_0x48ab7b,_0x170c02){const _0x2711f8=_0x48ab7b['files']['length']>0x0&&_0x48ab7b['files']['every'](_0x180b1d=>_0x180b1d['type']['startsWith']('image/')),_0x11812c=_0x48ab7b['plainText']['trim']()['length']>0x0;if(_0x48ab7b['files']['length']>0x0&&_0x170c02['filesEnabled']&&(!_0x2711f8||!_0x11812c)){const _0x5ee059=_0x48ab7b['files']['filter'](_0x27e5ff=>_0x27e5ff['name']);return _0x5ee059['length']>0x0?{'type':'file','files':_0x5ee059}:null;}if(_0x170c02['urlsEnabled']){const _0x37a234=function(_0x1ae57c){const _0x481c7b=_0x1ae57c['trim']();if(/\s/['test'](_0x481c7b))return null;try{const _0x109db4=new URL(_0x481c7b);return'http:'!==_0x109db4['protocol']&&'https:'!==_0x109db4['protocol']?null:_0x109db4['toString']();}catch{return null;}}(_0x48ab7b['plainText']);if(_0x37a234)return{'type':'url','url':_0x37a234};}const _0x2cc200=_0x48ab7b['forceTextAttachment']?0x1:_0x170c02['longTextThreshold']??0x1/0x0;if(_0x48ab7b['plainText']['length']>=Math['max'](_0x2cc200,0x1)&&_0x170c02['filesEnabled']){const _0x3b0ee2=_0x170c02['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x48ab7b['plainText']],_0x3b0ee2,{'type':'text/plain'})]};}return null;}var Nn=class extends _0x394201{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[ls,on,_0x4e4fa1];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=dn(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aichat'),this['_aiChatModels']=new zs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x7eb7ee=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x572dbd,_0x3688e6)=>{this['_handleUIUserMessage']({'message':_0x3688e6});}),this['listenTo'](_0x7eb7ee['view'],'change:activeTab',(_0x3416d7,_0x34053f,_0x32d500)=>{'chat'!==_0x32d500&&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',(_0x2c2796,_0x5e40b6)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x5e40b6));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x42c7e4,_0x590257)=>{this['activeConversation']?.['addUrlToContext'](_0x590257);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x50b249,_0x2ddecc)=>{const _0x2ebf3f=this['activeConversation'];if(!_0x2ebf3f)return;_0x2ddecc['hasDirectory']&&(_0x2ddecc['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+vt()}));const _0x755c93=kn(_0x2ddecc,{'pastedTextLabel':us(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x755c93&&(_0x2ddecc['preventDefault'](),'url'===_0x755c93['type']?_0x2ebf3f['addUrlToContext'](_0x755c93['url']):_0x2ebf3f['chatContext']['addFilesToContext'](_0x755c93['files'],void 0x0,_0x755c93['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x78f556,_0x442a6d)=>{_0x442a6d['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x3126b6,_0x204aa5)=>{this['activeConversation']?.['addResourceToContext'](_0x204aa5['source'],_0x204aa5['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x45c446,_0x58374b)=>{this['_removeFromContext'](_0x58374b);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x21212c,_0x3522a2)=>{this['activeConversation']?.['loadSourceResources'](_0x3522a2['sourceId'],_0x3522a2['query'],_0x3522a2['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x5bfc8c,_0x47f33e)=>{this['activeConversation']?.['setModel'](_0x47f33e);}),this['listenTo'](this['_aiChatUi'],'like',(_0x4d1719,{replyId:_0x7cdc7b})=>{console['log']('Liked\x20response',_0x7cdc7b);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x2affdb,{replyId:_0x4889ef})=>{console['log']('Disliked\x20response',_0x4889ef);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x20f52e,_0x40cbec)=>{this['_insertSuggestion'](_0x40cbec);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x51807b,{replyId:_0x299f6b,partIndex:_0x989f3b})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x299f6b,_0x989f3b);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x1f6c3f,{replyId:_0x9a3b9a,partIndex:_0x476ee9})=>{const _0x439dd0=this['_getDocumentRangeForReplyChanges'](_0x9a3b9a,_0x476ee9);if(!_0x439dd0)return;const {reply:_0x5a2890}=this['getInteractionAndReplyById'](_0x9a3b9a);'$graveyard'!=_0x439dd0['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x5a2890['changeGroups'][_0x476ee9]['editor'],'ranges':[_0x439dd0['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x4da6ad,_0x5318ff)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x5318ff);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x1ccfc0,{replyId:_0x329dd7,showDiff:_0x36b0fa})=>{const {interaction:_0xa5aec4,reply:_0x4c22e8}=this['getInteractionAndReplyById'](_0x329dd7),_0x15fd3c=_0x4c22e8['getContentParts']({'showDiff':_0x36b0fa});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xa5aec4['id']+':'+_0x4c22e8['id'],'parts':_0x15fd3c});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x49e46c,{replyId:_0xc17f21,partIndex:_0x5cb063})=>{this['_rejectSuggestion']({'replyId':_0xc17f21,'partIndex':_0x5cb063}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x483317,_0x14f7bc)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x14f7bc);}),this['on']('replyCreated',(_0x13ea99,_0x2be24f)=>{this['_addFeedItemReply'](_0x2be24f);});}['afterInit'](){this['context']instanceof _0x2e6d5b?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x3a80a1,_0x3bd90a)=>{_0x3bd90a['on']('ready',()=>{this['_integrateEditor'](_0x3bd90a);});}),this['_initConversation']();}async['_initConversation'](){const _0x356bc3=this['context']['config']['get']('ai.chat.initialConversation');let _0x50ff52=_0x356bc3;('lastCreated'!=_0x356bc3||(_0x50ff52=await this['_getLastCreatedConversationId'](),_0x50ff52))&&('new'==_0x50ff52?await this['_startConversationSafely']():await this['loadConversation'](_0x50ff52));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x172e74){this['_closeActiveBalloon'](),this['context']['plugins']['get'](cs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x172e74)['getConversation'](),await this['_startConversationSafely']({'id':_0x172e74}),await this['activeConversation']['load'](_0x172e74),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x3c2058){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x172e74}),this['_reporter']['logError'](new ht('ai-chat-conversation-not-found',this,void 0x0,_0x3c2058),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x3853a5){let _0xb9c60c=null,_0x27e3ac=null;this['on']('toolDataReceived',(_0xc687ef,_0x11b452,_0x1bb6fb)=>{_0x1bb6fb['id']!==_0xb9c60c&&(_0xb9c60c=_0x1bb6fb['id'],_0x27e3ac=this['_getAIChatFeedAPI'](_0x1bb6fb)),_0x3853a5(_0x11b452,_0x27e3ac);});}['addCurrentDocumentToChatContext'](){ds(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](us(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x3c127c){const _0x220948=this['_aiEditing']['getSelectionText'](_0x3c127c);this['activeConversation']?.['addSelectionToContext'](_0x220948),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x49c010){await this['_startConversationSafely']({'modelId':_0x49c010?.['modelId']});}async['sendMessage'](_0x2c47c0){await this['_handleUIUserMessage'](_0x2c47c0);}['getGroupId'](){const _0x34782b=this['context']['config']['get']('collaboration.channelId');if(!_0x34782b)throw new ht('ai-missing-channel-id',this);return _0x34782b;}['_handleRemovedConversation'](_0x11a03b){this['activeConversation']['id']===_0x11a03b&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x408f36){const {reply:_0x5d304f,interaction:_0x21657b}=this['getInteractionAndReplyById'](_0x408f36['replyId']),_0xd34f29=void 0x0!==_0x408f36['partIndex']?[_0x5d304f['changeGroups'][_0x408f36['partIndex']]]:_0x5d304f['changeGroups']['filter'](_0x59596f=>'pending'==_0x59596f['state']);return _0xd34f29['map'](_0x62b385=>_0x5d304f['changeGroups']['indexOf'](_0x62b385))['forEach'](_0x1dd818=>{const _0x211f1a=this['_getDocumentRangeForReplyChanges'](_0x408f36['replyId'],_0x1dd818);_0x211f1a&&'$graveyard'!=_0x211f1a['range']['root']['rootName']?(_0x5d304f['setChangeGroupState'](_0x1dd818,'accepted'),void 0x0!==_0x408f36['partIndex']&&this['_scrollToSuggestionRange'](_0x211f1a['range'],!0x1,_0x211f1a['targetEditor'])):_0x5d304f['setChangeGroupState'](_0x1dd818,'outdated');}),vn({'groups':_0xd34f29['filter'](_0x22aefb=>'accepted'===_0x22aefb['state']),'documentContextContent':_0x5d304f['documentContextContent'],'documents':_0x21657b['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x340f09){const _0x2e8579=this['context']['plugins']['get'](_0x4e4fa1),{reply:_0x460ed5,interaction:_0x8be110}=this['getInteractionAndReplyById'](_0x340f09['replyId']),_0x5079b5=this['_prepareDocumentSuggestions'](_0x340f09),_0x326a85=Ns({'documentSuggestions':_0x5079b5,'transform':!0x0,'documentCompare':_0x2e8579,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x454c07,_0x2e20da]of _0x326a85){const {editor:_0x4d25d6,indexes:_0x2408f5}=_0x5079b5['get'](_0x454c07);if(!_0x4d25d6['plugins']['has']('TrackChanges')){bt('ai-no-track-changes',{'editor':_0x4d25d6});continue;}let _0x1a8cb5;Js(_0x2e20da,'chat'),_0x4d25d6['model']['change'](_0x838bd8=>{_0x1a8cb5=_0x838bd8['batch'],_0x4d25d6['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2e20da),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x1a8cb5,{'interactionId':_0x8be110['id'],'replyId':_0x460ed5['id'],'indexes':_0x2408f5});}this['_updateRatings'](_0x460ed5);}['_applySuggestion'](_0x322bca){const _0x38172b=this['context']['plugins']['get'](_0x4e4fa1),{reply:_0x18b3ef,interaction:_0xfdce64}=this['getInteractionAndReplyById'](_0x322bca['replyId']),_0xc246c2=this['_prepareDocumentSuggestions'](_0x322bca),_0x386d82=Ns({'documentSuggestions':_0xc246c2,'transform':!0x0,'documentCompare':_0x38172b,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x74ad50,_0x53fd8e]of _0x386d82){const {editor:_0x615e38,indexes:_0x3b0a78}=_0xc246c2['get'](_0x74ad50);let _0x36b7ed;Js(_0x53fd8e,'chat');try{_0x615e38['model']['change'](_0x17506b=>{_0x36b7ed=_0x17506b['batch'];for(const _0x226e6a of _0x53fd8e)_0x226e6a['baseVersion']=_0x615e38['model']['document']['version'],ys(_0x615e38,_0x226e6a),_0x17506b['batch']['addOperation'](_0x226e6a),_0x615e38['model']['applyOperation'](_0x226e6a);}),this['_batchToChanges']['set'](_0x36b7ed,{'interactionId':_0xfdce64['id'],'replyId':_0x18b3ef['id'],'indexes':_0x3b0a78});}catch(_0x28c4b6){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x28c4b6})),_0x28c4b6;}}this['_updateRatings'](_0x18b3ef);}['_rejectSuggestion'](_0x3d388c){const {reply:_0x139591}=this['getInteractionAndReplyById'](_0x3d388c['replyId']);_0x139591['setChangeGroupState'](_0x3d388c['partIndex'],'rejected');}['_openBalloonFor'](_0x4fabc2,_0x982c49){if(!this['_hasAIChatBalloon'])return;const {reply:_0x168ae3}=this['getInteractionAndReplyById'](_0x4fabc2),_0x2e418d=_0x168ae3['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x2e418d['length'])return;let _0x494712,_0x140f66;if(void 0x0!==_0x982c49?(_0x140f66=_0x2e418d['find'](_0x69d83b=>_0x69d83b['index']==_0x982c49),_0x494712=_0x140f66?.['index']):(_0x140f66=_0x2e418d[0x0],_0x494712=_0x140f66['index']),!_0x140f66)return void _0x168ae3['setChangeGroupState'](_0x982c49??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x4fabc2&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x494712)return;const _0x40ef4e=this['_getUserPresentableContentPartDocumentRange'](_0x4fabc2,_0x168ae3,_0x140f66),_0x2ba577=_0x168ae3['changeGroups']['find'](_0x274060=>_0x274060['index']==_0x494712)['editor'],_0xebf38e=_0x2ba577['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0xebf38e&&this['_activeBalloon']['close'](),!_0x40ef4e)return _0xebf38e['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xebf38e,this['_currentPreviewedChangeGroup']={'replyId':_0x4fabc2,'partIndex':_0x494712},this['_scrollToSuggestionRange'](_0x40ef4e,!0x0,_0x2ba577);const _0x184b5a=this['_getPresentableSiblingContentPartIndex'](_0x4fabc2,_0x494712,'next');_0xebf38e['clearContent'](),_0xebf38e['updateContent']({'part':_0x140f66,'renderingStrategy':'static'}),_0xebf38e['open']({'index':_0x494712,'title':us(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x494712+0x1)['toString']()),'showRotator':null!==_0x184b5a,'ranges':[_0x40ef4e],'areActionsDisabled':_0x168ae3['areActionsDisabled'],'targetEditor':_0x2ba577}),_0xebf38e['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x4fabc2,_0x494712),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x4fabc2,'index':_0x494712,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x572bed,_0x3723a0,_0x3068a2){const {reply:_0x12de6b}=this['getInteractionAndReplyById'](_0x572bed),_0x4c8233=_0x12de6b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x4c8233['length'])return null;const _0x40de5d='next'==_0x3068a2?0x1:-0x1;function _0x11f453(_0xdaf97a){const _0x33760e=(_0xdaf97a+_0x40de5d+_0x4c8233['length'])%_0x4c8233['length'];return{'siblingIndex':_0x33760e,'siblingPart':_0x4c8233[_0x33760e]};}const _0x398195=_0x4c8233['findIndex'](_0x292d58=>_0x292d58['index']==_0x3723a0);let {siblingIndex:_0x1bd4e6,siblingPart:_0x572899}=_0x11f453(_0x398195);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x572bed,_0x12de6b,_0x572899);)if({siblingIndex:_0x1bd4e6,siblingPart:_0x572899}=_0x11f453(_0x1bd4e6),_0x1bd4e6===_0x398195)return null;return _0x572899['index'];}['_getUserPresentableContentPartDocumentRange'](_0x41fb61,_0x42470b,_0xbe5c39){const _0x1a4545=_0x42470b['changeGroups'];if(!_0xbe5c39['hasChanges'])return null;const _0x313c47=_0x1a4545['find'](_0x54d405=>_0x54d405['index']==_0xbe5c39['index']);if('pending'!==_0x313c47?.['state'])return null;if(!_0x313c47?.['editor']||'destroyed'===_0x313c47['editor']['state'])return _0x42470b['setChangeGroupState'](_0xbe5c39['index'],'outdated'),null;const _0xaa3c72=this['_getDocumentRangeForReplyChanges'](_0x41fb61,_0xbe5c39['index']);if(!_0xaa3c72)return _0x42470b['setChangeGroupState'](_0xbe5c39['index'],'outdated'),null;const {range:_0x481524,currentIndex:_0x9bd0ca}=_0xaa3c72;return'$graveyard'==_0x481524['root']['rootName']?(_0x42470b['setChangeGroupState'](_0x9bd0ca,'outdated'),null):_0xaa3c72['range'];}['_getDocumentRangeForReplyChanges'](_0x2e4ad9,_0x3d3a56){const {reply:_0x1938c6,interaction:_0x5f49f9}=this['getInteractionAndReplyById'](_0x2e4ad9),_0xad253e=_0x1938c6['changeGroups']['filter'](_0x2c9f3c=>'pending'==_0x2c9f3c['state']),_0x2a3223=_0xad253e['map'](_0x3b32e7=>_0x1938c6['changeGroups']['indexOf'](_0x3b32e7));void 0x0===_0x3d3a56&&(_0x3d3a56=_0x2a3223[0x0]);const _0x616a52=_0x2a3223['indexOf'](_0x3d3a56);if(-0x1==_0x616a52)return null;const _0x2cff1d=_0xad253e[_0x616a52],_0x1d75cd=_0x2cff1d['editor'];if(!_0x1d75cd||'destroyed'===_0x1d75cd['state'])return null;if(!_0x4f8797(_0x1d75cd,_0x2cff1d['rootName']))return null;const _0x486372=_0x1938c6['documentContextContent']['get'](_0x2cff1d['documentId']),_0x1b5e85=new _0x1bffc9([]),_0x117189=new _0x1bffc9([]);for(const _0x3b22bc of _0x2cff1d['changes'])if('removed'!=_0x3b22bc['type']&&_0x117189['children']['push'](_0x3b22bc['node']['cloneNode'](!0x0)),'new'!=_0x3b22bc['type']){const _0x1c3e84=ti(_0x220f6a=>fs(_0x220f6a,'data-id')==_0x3b22bc['id'],_0x486372,!0x0);_0x1b5e85['children']['push'](_0x1c3e84['cloneNode'](!0x0));}if(0x0==_0x1b5e85['children']['length']){if(_0x2cff1d['changes'][0x0]['anchorId']){const _0x4a0063=Es('data-id',_0x2cff1d['changes'][0x0]['anchorId'],_0x486372);_0x1b5e85['children']['unshift'](_0x4a0063['cloneNode'](!0x0)),_0x117189['children']['unshift'](_0x4a0063['cloneNode'](!0x0)),_0x4a0063['nextSibling']&&(_0x1b5e85['children']['push'](_0x4a0063['nextSibling']['cloneNode'](!0x0)),_0x117189['children']['push'](_0x4a0063['nextSibling']['cloneNode'](!0x0)));}else{const _0x513563=_0x486372['children'][0x0];if(!_0x513563)return null;_0x1b5e85['children']['push'](_0x513563['cloneNode'](!0x0)),_0x117189['children']['push'](_0x513563['cloneNode'](!0x0));}}const _0x1fed0c=_0x5f49f9['getDocumentContext'](),_0x5931a2=_0x1fed0c['documents']['find'](_0x268b00=>_0x268b00['id']==_0x2cff1d['documentId'])['content'],_0x182535=_0x1d75cd['model']['document']['getRoot'](_0x2cff1d['rootName']),_0x365c25=_0x1d75cd['data']['parse'](_0x5931a2,_0x182535),_0x4d4518=ms(_0x1b5e85),_0x334748=_0x1d75cd['data']['parse'](_0x4d4518,_0x182535),_0x5b3a17=_0x1d75cd['data']['parse'](_0x4d4518,_0x182535),_0x5db554=_0x1d75cd['model']['createPositionAt'](_0x334748,0x0),_0x21ce07=ms(_0x117189),_0x4f3a8e={'targetEditor':_0x1d75cd,'anchor':_0x5db554,'markDeletions':!0x1};let _0x18c201;try{_0x18c201=_0x1d75cd['plugins']['get'](_0x4e4fa1)['getDiff'](_0x4d4518,_0x21ce07,_0x4f3a8e)['getOperations']();}catch(_0x4c5b88){return this['_reporter']['reportError'](new rn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x4c5b88,'context':{'replyId':_0x2e4ad9,'partIndex':_0x3d3a56}})),null;}if(!_0x18c201['length'])return null;_0x1d75cd['model']['change'](_0x5ee92a=>{for(const _0x358c6e of _0x18c201)if('remove'==_0x358c6e['type']){const _0x3c17a0=_0x358c6e['sourcePosition'],_0x4352d0=_0x358c6e['howMany'],_0x2e6322=new _0x4202c4(_0x3c17a0,_0x4352d0);_0x5ee92a['batch']['addOperation'](_0x2e6322),_0x1d75cd['model']['applyOperation'](_0x2e6322);}else'marker'!==_0x358c6e['type']&&(_0x358c6e['baseVersion']=null,_0x358c6e['isDocumentOperation']=!0x1,_0x5ee92a['batch']['addOperation'](_0x358c6e),_0x1d75cd['model']['applyOperation'](_0x358c6e));});const _0x543c3a=Ks(_0x1d75cd,_0x18c201,_0x334748);Ys(_0x1d75cd['model'],_0x543c3a);const _0x52dc59=_0x543c3a['getFirstRange']()['start']['path']['slice'](),_0x385113=_0x543c3a['getFirstRange']()['end']['path']['slice'](),_0x5ccc4c=[];let _0x5aff01=_0x334748,_0x36a74f=_0x5b3a17;for(let _0xf9c613=0x0;_0xf9c613<_0x385113['length'];_0xf9c613++){const _0x426afd=_0x5aff01['maxOffset']-_0x385113[_0xf9c613];_0x5ccc4c[_0xf9c613]=_0x36a74f['maxOffset']-_0x426afd,_0x5aff01=_0x5aff01['getChildAtOffset'](_0x385113[_0xf9c613]),_0x36a74f=_0x36a74f['getChildAtOffset'](_0x5ccc4c[_0xf9c613]);}const _0x1951be=_0x1d75cd['model']['createRange'](_0x1d75cd['model']['createPositionFromPath'](_0x5b3a17,_0x52dc59),_0x1d75cd['model']['createPositionFromPath'](_0x5b3a17,_0x5ccc4c)),_0x582b63=_0x5b3a17['getChild'](0x0)['getAttribute'](_0x3d3bc3),_0x3f8104=Array['from'](_0x365c25['getChildren']())['find'](_0x1cdb83=>_0x1cdb83['getAttribute'](_0x3d3bc3)==_0x582b63)['getPath'](),_0x53ddb1=_0x1951be['start']['path']['slice'](),_0xaee507=_0x1951be['end']['path']['slice']();_0x53ddb1[0x0]=_0x3f8104[0x0]+_0x53ddb1[0x0],_0xaee507[0x0]=_0x3f8104[0x0]+_0xaee507[0x0];let _0x4ceeb7=_0x1d75cd['model']['createRange'](_0x1d75cd['model']['createPositionFromPath'](_0x1d75cd['model']['document']['getRoot'](_0x2cff1d['rootName']),_0x53ddb1),_0x1d75cd['model']['createPositionFromPath'](_0x1d75cd['model']['document']['getRoot'](_0x2cff1d['rootName']),_0xaee507));const _0x5745cd=_0x1fed0c['documents']['find'](_0x255015=>_0x255015['id']==_0x2cff1d['documentId'])['version'],_0x13f5cb=_0x1d75cd['model']['document']['history']['getOperations'](_0x5745cd);for(const _0x167865 of _0x13f5cb)_0x4ceeb7=_0x4ab7a9['_createFromRanges'](_0x4ceeb7['getTransformedByOperation'](_0x167865));return{'range':_0x4ceeb7,'currentIndex':_0x3d3a56,'targetEditor':_0x1d75cd};}['_integrateEditorBalloon'](_0x38b5e5){if(!_0x38b5e5['plugins']['has']('AIChatBalloon'))return;const _0x1ec19d=_0x38b5e5['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x1ec19d['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x1ec19d,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x24ed3f,partIndex:_0x3f00ba}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0xe888d0}=this['getInteractionAndReplyById'](_0x24ed3f),_0x4cf9fb=_0xe888d0['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x3f00ba});_0x1ec19d['updateContent']({'part':_0x4cf9fb[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x1ec19d,'applySuggestion',()=>{const {replyId:_0x5aeb8c,partIndex:_0x524ad0}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x5aeb8c,'partIndex':_0x524ad0}),_0x1ec19d['setState']('accepted');}),this['listenTo'](_0x1ec19d,'insertSuggestion',()=>{const {replyId:_0x34af3d,partIndex:_0x280e63}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x34af3d,'partIndex':_0x280e63}),_0x1ec19d['setState']('accepted');}),this['listenTo'](_0x1ec19d,'rejectSuggestion',()=>{const {replyId:_0xf8ccc0,partIndex:_0x48c0ef}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0xf8ccc0,'partIndex':_0x48c0ef}),_0x1ec19d['setState']('rejected');}),this['listenTo'](_0x1ec19d,'showNext',()=>{const {replyId:_0x304f45,partIndex:_0x12517f}=this['_currentPreviewedChangeGroup'],_0x242d2f=this['_getPresentableSiblingContentPartIndex'](_0x304f45,_0x12517f,'next');null!==_0x242d2f&&this['_openBalloonFor'](_0x304f45,_0x242d2f);}),this['listenTo'](_0x1ec19d,'showPrevious',()=>{const {replyId:_0xbcc266,partIndex:_0x35f5ee}=this['_currentPreviewedChangeGroup'],_0x40856b=this['_getPresentableSiblingContentPartIndex'](_0xbcc266,_0x35f5ee,'previous');null!==_0x40856b&&this['_openBalloonFor'](_0xbcc266,_0x40856b);}),this['listenTo'](_0x1ec19d,'dialogClosed',(_0x30479e,{id:_0x5dec3d})=>{if('aiChatBalloon'!==_0x5dec3d)return;const {replyId:_0x4ea804,partIndex:_0x5c6e7c}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x4ea804,'index':_0x5c6e7c,'isActive':!0x1}),this['_activeBalloon']===_0x1ec19d&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x4a1d63){if(this['_channelsToEditors']['set'](_0x4a1d63['config']['get']('collaboration.channelId'),_0x4a1d63),this['_integrateEditorBalloon'](_0x4a1d63),this['addCurrentDocumentToChatContext'](),_0x4a1d63['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x4a1d63['plugins']['has']('Undo')){const _0x29e26e=_0x4a1d63['commands']['get']('undo'),_0x279619=_0x4a1d63['commands']['get']('redo');this['listenTo'](_0x29e26e,'revert',(_0x48c48,_0x24009c,_0x381842)=>{const _0x56dcad=this['_batchToChanges']['get'](_0x24009c);if(!_0x56dcad)return;const _0x390118=this['activeConversation']['getInteraction'](_0x56dcad['interactionId']),_0x2a50b8=_0x390118?.['getReply'](_0x56dcad['replyId']);this['_batchToChanges']['delete'](_0x24009c),_0x390118&&_0x2a50b8&&(_0x56dcad['indexes']['forEach'](_0x582171=>_0x2a50b8['setChangeGroupState'](_0x582171,'pending')),this['_batchToChanges']['set'](_0x381842,_0x56dcad));}),this['listenTo'](_0x279619,'revert',(_0x13c02c,_0x27fb69,_0x550e34)=>{const _0x4a4a7e=this['_batchToChanges']['get'](_0x27fb69);if(!_0x4a4a7e)return;const _0x29b328=this['activeConversation']['getInteraction'](_0x4a4a7e['interactionId']),_0x24f66b=_0x29b328?.['getReply'](_0x4a4a7e['replyId']);this['_batchToChanges']['delete'](_0x27fb69),_0x29b328&&_0x24f66b&&(_0x4a4a7e['indexes']['forEach'](_0x14b594=>_0x24f66b['setChangeGroupState'](_0x14b594,'accepted')),this['_batchToChanges']['set'](_0x550e34,_0x4a4a7e));});}const _0x3d08a4=_0x4a1d63['config']['get']('ai.chat.context');_0x3d08a4['alwaysAddSelection']&&_0x3d08a4['document']['enabled']&&this['listenTo'](_0x4a1d63['model']['document']['selection'],'change:range',(_0x5d708c,_0x992f5a)=>{_0x992f5a['directChange']&&'chat'===_0x4a1d63['plugins']['get']('AITabs')['view']['activeTab']&&(_0x4a1d63['model']['hasContent'](_0x4a1d63['model']['document']['selection'])?this['addSelectionToChatContext'](_0x4a1d63):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x2bd1cb=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x1c66d9=await _0x2bd1cb['getConversations']();return _0x1c66d9['length']?_0x1c66d9[0x0]['id']:'new';}catch(_0x5b80a5){return this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':vt()}),this['_reporter']['logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x5b80a5})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x415b62={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x415b62);}catch(_0x253ec4){this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x415b62['id']||vt()}),this['_reporter']['logError'](_0x253ec4),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x17b9c0,modelId:_0x3344c2}={}){this['_closeActiveBalloon']();let _0x19eb42=_0x3344c2;_0x19eb42||(_0x17b9c0||!this['activeConversation']?_0x19eb42=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x19eb42=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x320fe7=this['getGroupId'](),_0x442bfd=_0x17b9c0||vt();let _0xb3bc94;this['activeConversation']=new On({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x19eb42,'conversationId':_0x442bfd,'group':_0x320fe7,'locale':this['context']['locale'],'isFromHistory':!!_0x17b9c0,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x35e8f6=>this['_aiEditing']['getSessionId'](_0x35e8f6)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x3054f0,_0x8644c2)=>{this['_aiChatUi']['createConversation'](_0x8644c2),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x17b9c0||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x238e61,_0x499b03)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x499b03['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x3c73d0=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3c73d0);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x41d59a=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x41d59a);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x2ab1bb,_0x52311a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x52311a,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x31f67d,_0x9f563e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x9f563e,{'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',(_0x43ab13,_0x33a7bf)=>{this['_aiChatUi']['removeFeedInteraction'](_0x33a7bf['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x1f34b1,_0x273395,_0x15c49f)=>{this['_updateConversationTitle'](_0x273395,_0x15c49f);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x406397,_0x3fb9bc)=>{void 0x0!==_0xb3bc94&&_0xb3bc94!==_0x3fb9bc['id']&&this['_updateReplyContentThrottled']['flush'](),_0xb3bc94=_0x3fb9bc['id'],_0x3fb9bc['isFromHistory']?await this['_updateReplyContent']({'reply':_0x3fb9bc}):await this['_updateReplyContentThrottled']({'reply':_0x3fb9bc});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x522d3c,{reply:_0x40a7de,index:_0x49ef85,state:_0x5454b5})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x40a7de['id'],'index':_0x49ef85,'state':_0x5454b5}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x40a7de['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x49ef85&&this['_activeBalloon']?.['setState'](_0x5454b5);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x2a504c,_0x251c85)=>{if(this['_aiChatUi']['addContextItem'](_0x251c85['contextItem'],_0x251c85['isLoading']),'selection'===_0x251c85['contextItem']['type']){const _0x572bd0=_s(this['context']),_0x16c666=[..._0x572bd0['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x572bd0,'ranges':_0x16c666,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x2c013,_0x19f9ed)=>{this['_aiChatUi']['removeContextItem'](_0x19f9ed['uiId']),'current-document'==_0x19f9ed['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x19f9ed['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x3de112,_0x162667)=>{this['_aiChatUi']['setContextItemLoading'](_0x162667['contextItem']['uiId'],_0x162667['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x301411,_0xe9580b)=>{this['_aiChatUi']['setConversationContext'](_0xe9580b['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x399dc8,_0x571763)=>{this['_aiChatUi']['setAddContextOptions'](_0x571763['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x42a5c9,_0x18578d)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x18578d['sourceId'],_0x18578d['source'],_0x18578d['resources'],_0x18578d['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x3cd5d4,_0x203d24)=>{this['_aiChatUi']['updateResourceState'](_0x203d24['sourceId'],_0x203d24['resourceId'],_0x203d24['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x16d150,_0x5c35bd)=>{this['_aiChatUi']['updateCapabilities'](_0x5c35bd);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x34e853,_0x40046c)=>{try{const _0x4a22fe=(await this['_aiChatModels']['getAll']())['find'](_0xb8563=>_0xb8563['id']===_0x40046c['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x4a22fe,_0x40046c['isDisabled']);}catch(_0x3e68a4){this['_reporter']['logError'](new rn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x3e68a4}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x4cc80e,{error:_0x540701,interactionId:_0x12956f,fileName:_0x36c06e,url:_0xae8c03,sourceId:_0x21d291,sourceLabel:_0x9cf544})=>{const _0x32377b=_0x12956f?_0x12956f+':'+vt():vt();this['_reporter']['reportError'](_0x540701),_0x540701['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':us(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-conversation-init-failed')||_0x540701['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x36c06e),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0xae8c03),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x21d291&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x21d291),this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x9cf544||'source'),'id':_0x32377b})):_0x540701['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x32377b}):_0x540701['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x32377b}):this['_aiChatUi']['addFeedItemError']({'errorMessage':us(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x32377b});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x17b9c0||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x5bba7e,attributes:_0x2c212e}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x3f869a=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x3f869a);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x5bba7e,'attributes':_0x2c212e});}['_removeFromContext'](_0x6ba5ba){this['activeConversation']?.['removeFromContext'](_0x6ba5ba);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x4e46e9){const [_0x1eccbf,_0x144397]=_0x4e46e9['split'](':'),_0x164680=this['activeConversation']['getInteraction'](_0x1eccbf);return{'interaction':_0x164680,'reply':_0x164680['getReply'](_0x144397)};}['_scrollToSuggestionRange'](_0x31a336,_0x297da9=!0x1,_0xe86739){const _0xc28403={'target':_0xe86739['editing']['view']['domConverter']['viewRangeToDom'](_0xe86739['editing']['mapper']['toViewRange'](_0x31a336)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x297da9};_0x297da9&&(_0xc28403['alignToTop']=!0x0),Rt(_0xc28403);}['_updateConversationTitle'](_0x35588f,_0x1b7192=!0x1){this['_aiChatUi']['setConversationTitle'](_0x35588f||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x1b7192);}['_addFeedItemReply'](_0x186c3e){'text'===_0x186c3e['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x186c3e):this['_aiChatUi']['addFeedItemAISuggestion'](_0x186c3e);}async['_updateReplyContent']({reply:_0x14fbfa,renderingStrategy:_0x129dbc}){const {id:_0x432dae,interactionId:_0x91b811,isDone:_0x53d16c,type:_0x5cbdeb,parsedContent:_0x32ae24}=_0x14fbfa,_0x29ee96=_0x91b811+':'+_0x432dae;if('modification'===_0x5cbdeb){const _0x2b1e85=_0x14fbfa['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x29ee96,'parts':_0x2b1e85,'isDone':_0x53d16c,'skipLoadingEffects':_0x14fbfa['isFromHistory']});}else'text'===_0x5cbdeb&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x29ee96,'parsedContent':_0x32ae24['get']('text'),'renderingStrategy':_0x129dbc,'isDone':_0x53d16c});_0x53d16c&&_0x14fbfa['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x29ee96,_0x14fbfa['sources']);}['_updateReplyContentThrottled']=_0x55e952(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x3343f6=this['activeConversation']?.['lastInteraction'];_0x3343f6&&(_0x3343f6['stop'](),this['_aiChatUi']['stopInteraction'](_0x3343f6)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x717caa=this['activeConversation']?.['lastInteraction'];if(_0x717caa){for await(const _0x37cbbd of _0x717caa['replies'])this['_aiChatUi']['hasFeedItem'](_0x37cbbd['id'])||this['_addFeedItemReply'](_0x37cbbd),await this['_updateReplyContent']({'reply':_0x37cbbd,'renderingStrategy':'static'});}}['_updateRatings'](_0x57548d){const _0x587e0a={'positiveCount':_0x57548d['changeGroups']['filter'](_0x2129b4=>'accepted'===_0x2129b4['state'])['length'],'totalCount':_0x57548d['changeGroups']['length'],'modificationId':_0x57548d['id']},_0x4571af=this['activeConversation']['getInteraction'](_0x57548d['interactionId'])['messageId'];_0x4571af&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x4571af,_0x587e0a);}['_getAIChatFeedAPI'](_0x3de92b){const _0x267f8b=this['_aiChatUi'],_0x1bb84a=()=>{_0x3de92b['resetWebSearchState'](),_0x3de92b['resetReasoningState'](),_0x267f8b['clearLoadingMessage']();},_0x1ddbd1=()=>{_0x3de92b['currentReply']&&(_0x3de92b['currentReply']['done'](),_0x3de92b['currentReply']=void 0x0);};return{'insertTextReply':(_0xe268fc,_0x3de4ae)=>{_0x1ddbd1(),_0x1bb84a();const _0x45f885=_0x3de92b['currentReply']=_0x3de92b['createReply']({'type':'text','interactionId':_0x3de92b['id'],'id':_0x3de4ae||vt(),'channelsToEditors':this['_channelsToEditors']});return _0x45f885['appendContent'](_0xe268fc),_0x1ddbd1(),_0x45f885;},'insertCustomElement':async(_0x21b133,_0x22d920)=>(_0x1ddbd1(),_0x1bb84a(),_0x267f8b['addFeedItemCustomElement'](_0x21b133,_0x22d920||vt())),'setLoadingMessage':_0x23fe44=>{_0x267f8b['setLoadingMessage'](_0x23fe44);},'clearLoadingMessage':()=>{_0x267f8b['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ds(this['context'])['find'](_0x1d4f8d=>'destroyed'!==_0x1d4f8d['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const yn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],xn=[...yn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Ln(_0x4a40f8){const _0x4428a4=new AbortController();return{'promise':new Promise((_0x4af259,_0x25d5dc)=>{const _0x5ac99a=setTimeout(_0x4af259,_0x4a40f8);_0x4428a4['signal']['addEventListener']('abort',()=>{clearTimeout(_0x5ac99a),_0x25d5dc();});}),'abortController':_0x4428a4};}var Dn=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x4a81ad){this['options']={'delay':_0x4a81ad?.['delay']??0xa,'textNodeStyle':_0x4a81ad?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x5f426a,targetElement:_0x2dbb7f,abortSignal:_0x112e41}){this['isStreaming']&&this['stop'](),_0x112e41?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x1263cf(_0x5f426a,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x575c0b=0x0;_0x575c0b<this['currentIndex'];_0x575c0b++)this['nodesList'][_0x575c0b]['shouldBeStreamed']=!0x0;do{const _0x38bff5=Date['now'](),_0x5413eb=this['nodesList'][this['currentIndex']],_0x5186ee=_0x38bff5-this['lastUpdateTime'];if(_0x5413eb){_0x5413eb['shouldBeStreamed']=!0x0;let _0x43db5a=_0x5413eb['parent'];for(;_0x43db5a;)_0x43db5a['shouldBeStreamed']=!0x0,_0x43db5a=_0x43db5a['parent'];}if(_0x5186ee<this['options']['delay'])try{const {promise:_0xd7601,abortController:_0x1d8212}=Ln(this['options']['delay']-_0x5186ee);this['timeoutAbortController']=_0x1d8212,await _0xd7601;}catch(_0xddc57d){return;}_0xf82e6c(_0x2dbb7f,'<'+_0x2dbb7f['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x2dbb7f['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:_0x49d211}){Array['from'](_0x49d211['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x58fc97=>{_0x58fc97['replaceWith'](_0x58fc97['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x56abdf){let _0xc3c3e8='';if(function(_0x1ffa99){return _0x15d293(_0x1ffa99);}(_0x56abdf)){for(const _0x4d0393 of _0x56abdf['children'])_0xc3c3e8+=this['renderNode'](_0x4d0393);}else{if(Mn(_0x56abdf)){if(!_0x56abdf['shouldBeStreamed'])return'';const _0x20003f=_0x56abdf,_0x20e8fa=Object['entries'](_0x20003f['attribs'])['map'](([_0x501a2c,_0x32c4e6])=>_0x501a2c+'=\x22'+_0x32c4e6+'\x22')['join']('\x20');_0xc3c3e8+='<'+_0x20003f['tagName']+(_0x20e8fa?'\x20'+_0x20e8fa:'')+'>';for(const _0x1e17ca of _0x8131bf(_0x20003f))_0xc3c3e8+=this['renderNode'](_0x1e17ca);_0xc3c3e8+='</'+_0x20003f['tagName']+'>';}else{if(!Hn(_0x56abdf))return'';if(!_0x56abdf['shouldBeStreamed'])return'';!function(_0x267282){return!(!_0x267282['parent']||!Mn(_0x267282['parent']))&&(!!Pn['includes'](_0x267282['parent']['tagName'])&&!_0x90b1f2(_0x267282)['match'](/^\s*[<>]\s*$/));}(_0x56abdf)?_0xc3c3e8+=_0x253579(_0x56abdf):_0xc3c3e8+=_0x253579(new _0x4fab21('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x56abdf]));}}return _0xc3c3e8;}['getParsedDocumentNodeList'](){const _0xae5267=[];return function(_0x112f49,_0x5a2d5a){const _0x1baac6=_0x409674=>{if(_0x5a2d5a(_0x409674),_0x409674 instanceof _0xc1e367)for(let _0x3703a3=0x0;_0x3703a3<_0x409674['children']['length'];_0x3703a3++){const _0x32ea7a=_0x409674['children'][_0x3703a3];_0x1baac6(_0x32ea7a);}};for(let _0x1ac650=0x0;_0x1ac650<_0x112f49['children']['length'];_0x1ac650++)_0x1baac6(_0x112f49['children'][_0x1ac650]);}(this['document'],_0x487ee6=>{if(Hn(_0x487ee6)){const _0x1922b9=this['splitTextNodeIntoWordNodes'](_0x487ee6);_0x1922b9['length']&&_0xae5267['push'](..._0x1922b9);}_0x487ee6['isWordSplitSource']||_0x487ee6['isWordSplitResult']||_0xae5267['push'](_0x487ee6);}),_0xae5267;}['splitTextNodeIntoWordNodes'](_0x43211d){if(_0x43211d['isWordSplitSource']||_0x43211d['isWordSplitResult'])return[];const _0x2cb342=_0x90b1f2(_0x43211d)['match'](/(?:\s*\S+\s*)/g),_0xdcb4a=[];if(_0x2cb342&&_0x2cb342['length']>0x1){for(const _0x43051b of _0x2cb342){const _0x3c111b=new _0x108c76(_0x43051b);_0x3c111b['isWordSplitResult']=!0x0,_0x197a81(_0x43211d,_0x3c111b),_0xdcb4a['push'](_0x3c111b);}_0x43211d['isWordSplitSource']=!0x0,_0x3b2f55(_0x43211d);}return _0xdcb4a;}};const Pn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Hn(_0x1cf2d3){return _0x384927(_0x1cf2d3);}function Mn(_0x5be2c1){return _0x57b23c(_0x5be2c1);}function Vn(_0x300653,_0xf988f9){_0x300653['cleanUpAnimations']({'targetElement':_0xf988f9}),_0xf988f9['querySelectorAll']('[data-id]')['forEach'](_0x2544b1=>{_0x2544b1['removeAttribute']('data-id');});}var Un=class extends _0x2bc1f3{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x8fec80){super();const _0x4bdede=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Dn(),this['options']=_0x8fec80,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x4bdede['if']('isDone','ck-ai-chat__feed__item_done'),_0x4bdede['if']('isVisible','ck-hidden',_0xbd50be=>!_0xbd50be),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Vn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x26c324,_0x8d3246,_0x198b9c){await this['htmlStreamer']['stream']({'document':_0x26c324,'targetElement':_0x8d3246,'abortSignal':_0x198b9c});}},Bn=class extends _0x2bc1f3{['showChangesToggleView'];constructor(_0x564ba5,_0x4552e8){super(_0x564ba5),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Gn(_0x564ba5),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+ln,'label':us(_0x564ba5,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x4552e8['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0xca1101=>_0xca1101?et:tt),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x5303e9=new Yt();_0x5303e9['content']=_0x51d1ff,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x4552e8['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x5303e9,{'tag':'span','children':[us(_0x564ba5,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Gn=class extends Ht{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Fn={'accepted':_0x3428b3,'rejected':_0x4836fa,'outdated':_0x4836fa};var Kn=class extends _0x2bc1f3{['stateIconView'];constructor(_0x2422c4){super(_0x2422c4);const _0x37e11f=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Wn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x37e11f['to']('state',_0x5ac9c3=>'ck-ai-suggestion__content-part-state_'+_0x5ac9c3),_0x37e11f['if']('isVisible','ck-hidden',_0x193f21=>!_0x193f21)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x37e11f['to']('state',_0xd7ea5a=>{switch(_0xd7ea5a){case'accepted':return us(_0x2422c4,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return us(_0x2422c4,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return us(_0x2422c4,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0xeaf4e){this['state']=_0xeaf4e;}},Wn=class extends Yt{constructor(){super(),this['set']('state','accepted'),this['content']=Fn[this['state']],this['on']('change:state',()=>{this['content']=Fn[this['state']];});}},Yn=class extends _0x311510{['_applyButton'];['_suggestButton'];constructor(_0xa372f0,_0x3a1994,_0x1b7941){super(_0xa372f0);const _0x31ab70=Boolean(_0x1b7941);this['set']('isEnabled',!_0x31ab70),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0xd1553d=[];if(_0x31ab70){const _0x4edcf1=new Ht(_0xa372f0);_0x4edcf1['set']({'label':us(_0xa372f0,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x35032d}),_0x4edcf1['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0xd1553d['push'](_0x4edcf1);}else{_0x3a1994['includes']('applySuggestion')&&(this['_applyButton']=new Ht(_0xa372f0),this['_applyButton']['set']({'label':us(_0xa372f0,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3428b3}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x4f6190=>!_0x4f6190),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0xd1553d['push'](this['_applyButton'])),_0x3a1994['includes']('insertSuggestion')&&(this['_suggestButton']=new Ht(_0xa372f0),this['_suggestButton']['set']({'label':us(_0xa372f0,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x5ba252}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0xd1553d['push'](this['_suggestButton']));const _0x992541=new Ht(_0xa372f0);_0x992541['set']({'label':us(_0xa372f0,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4836fa}),_0x992541['bind']('isEnabled')['to'](this),_0x992541['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0xd1553d['push'](_0x992541);}this['items']['addMany'](_0xd1553d);const _0x3d6b26=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x3d6b26['if']('isVisible','ck-hidden',_0xba3da6=>!_0xba3da6)]}});}['setButtonsVisibility']({showApplyButton:_0x19c31b,showSuggestButton:_0x527323}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x19c31b),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x527323);}},$n=class extends _0x2bc1f3{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x33e324,{part:_0x275ad5,uiIndex:_0x5a02e7,availableActions:_0x33681f,areActionsDisabled:_0x138bfc}){super(_0x33e324),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Yn(_0x33e324,_0x33681f,_0x138bfc),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x275ad5['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x275ad5['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x275ad5['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Kn(_0x33e324),this['titleLabelView']=new qn(_0x33e324,_0x5a02e7),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',(_0x597ffc,_0x29d3c4,_0x3b307b,_0x3b9229)=>{'pending'===_0x3b9229?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x3b307b?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x3b307b),this['children']['add'](this['stateView']));});}},qn=class extends _0x2bc1f3{constructor(_0x4f7f3f,_0x178f08){super(_0x4f7f3f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[us(_0x4f7f3f,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x178f08['toString']())]});}},Qn=class extends _0x2bc1f3{['htmlStreamer'];constructor(_0x591d1a){super(_0x591d1a),this['htmlStreamer']=new Dn(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x4d9208,renderingStrategy:_0xfdf4b1,abortSignal:_0x41782a}){const _0x13f2b2=_0x1263cf(_0x4d9208['content'],!0x0);for(const _0x1b2890 of ws(_0x13f2b2))_0x3b2f55(_0x1b2890);'streaming'===_0xfdf4b1?await this['htmlStreamer']['stream']({'document':_0x13f2b2,'targetElement':this['element'],'abortSignal':_0x41782a}):_0xf82e6c(this['element'],'<'+this['element']['tagName']+'>'+ms(_0x13f2b2)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Vn(this['htmlStreamer'],this['element']);}},Xn=class extends _0x2bc1f3{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x1d4146,{part:_0xaf6fb1,uiIndex:_0x7ce432,areActionsDisabled:_0x5b7925,availableActions:_0x460114}){super(_0x1d4146);const _0x5af211=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 _0x1d9e73=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x5b7925;};this['on']('change:state',_0x1d9e73),this['on']('change:isDone',_0x1d9e73),_0x1d9e73(),this['_children']=this['createCollection'](),this['_headerView']=new $n(_0x1d4146,{'part':_0xaf6fb1,'uiIndex':_0x7ce432,'availableActions':_0x460114,'areActionsDisabled':_0x5b7925}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...yn)['to'](this),this['_streamableContentView']=new Qn(_0x1d4146),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x5af211['to']('state',_0x31aabb=>'ck-ai-suggestion__body__content-part_'+_0x31aabb),_0x5af211['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x5af211['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x5af211['if']('isVisible','ck-hidden',_0x7484a8=>!_0x7484a8)]},'children':this['_children'],'on':{'mouseenter':_0x5af211['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0xaf6fb1['index']});}),'mouseleave':_0x5af211['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0xaf6fb1['index']});}),'click':_0x5af211['to'](_0x1fef11=>{const _0x8f99fe=_0x1fef11['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x8f99fe)&&this['fire']('showChangeInText',{'index':_0xaf6fb1['index']});})}});}async['updateContent']({part:_0x347ed3,showUnchangedParts:_0x70e28b=!0x1,abortSignal:_0x4be86b}){this['partDefinition']=_0x347ed3,this['isVisible']=this['partDefinition']['hasChanges']||_0x70e28b,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x347ed3,'renderingStrategy':'static','abortSignal':_0x4be86b});}['markAsDone'](){this['isDone']=!0x0;}},zn=class extends _0x2bc1f3{constructor(_0x5221c0,_0x3b8f23){super(_0x5221c0),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0xe56293=>!_0xe56293)]},'children':this['_createSkeletonItems'](_0x3b8f23)});}['_createSkeletonItems'](_0x2bb91f){const _0x2f80ef=['ck','ck-ai-skeleton__item'];return _0x2bb91f['map'](_0xc81b=>{let _0x965648='';switch(_0xc81b['attributes']['align']){case'right':_0x965648='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x965648='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x965648='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0xc81b['tag'],'attributes':{'class':[..._0x2f80ef,_0xc81b['attributes']['class']?_0xc81b['attributes']['class']:''],'style':'width:\x20'+_0xc81b['attributes']['width']+';\x20height:\x20'+_0xc81b['attributes']['height']+';'+_0x965648}};});}};const jn={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Jn(0x5,'100%','44px','right'),'aiChatResources':Jn(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Jn(_0x5e36b2,_0x33383d,_0x4d0ed3,_0x449691){return new Array(_0x5e36b2)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x33383d,'height':_0x4d0ed3,'align':_0x449691}}));}const Zn=/* #__PURE__ -- @preserve */
33
+ ut();var tr=class extends Zn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x42534f){const _0x5d2b9b=this['createTask'](_0x42534f);return this['queue']['push'](_0x5d2b9b),this['_processQueue'](),_0x5d2b9b['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(_0x502421=>{this['once']('_queueEmpty',()=>{_0x502421();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x44c91a=this['queue']['shift']();try{await _0x44c91a['callback'](this['_abortController']['signal']),_0x44c91a['resolve']();}catch(_0x2b6cc9){_0x44c91a['reject'](_0x2b6cc9);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x52bcc8){let _0x8e77a8,_0x14db67;const _0x1fc20c=new Promise((_0x2980bf,_0x5b8863)=>{_0x8e77a8=_0x2980bf,_0x14db67=_0x5b8863;});return{'callback':_0x52bcc8,'resolve':_0x8e77a8,'reject':_0x14db67,'completePromise':_0x1fc20c};}},er=class extends Un{constructor(_0x18c6aa){super(_0x18c6aa),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x18c6aa['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x67b60c){this['element']['innerHTML']=_0x67b60c;}};const ir=['applySuggestion','insertSuggestion'];var sr=class extends _0x2bc1f3{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x261d85,_0x17be5d=[...ir],_0x4fa05c){super(_0x261d85);const _0x32992f=this['bindTemplate'],_0x3f9564=Boolean(_0x4fa05c);if(this['set']('isEnabled',!_0x3f9564),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x3f9564){const _0x337f00=new Ht(_0x261d85);_0x337f00['set']({'label':us(_0x261d85,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x35032d}),_0x337f00['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0xe8dff4=new _0x2bc1f3(_0x261d85);_0xe8dff4['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[us(_0x261d85,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x337f00]}]}),this['children']['add'](_0xe8dff4);}else this['_applyChangesButton']=new Ht(_0x261d85),this['_applyChangesButton']['set']({'label':us(_0x261d85,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x17be5d['includes']('applySuggestion'),'class':hn}),this['_insertSuggestionsButton']=new Ht(_0x261d85),this['_insertSuggestionsButton']['set']({'label':us(_0x261d85,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x17be5d['includes']('insertSuggestion'),'class':cn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x16f53f=>{_0x16f53f['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',_0x32992f['if']('isVisible','ck-hidden',_0x488885=>!_0x488885)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x2d734){this['isVisible']=_0x2d734;}['_switchButtonLabelsPlurality'](_0x202a66){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x202a66?(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=us(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},nr=class extends _0x2bc1f3{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x2a5f07,_0x4b4584){super(_0x2a5f07),this['bodyCollection']=_0x4b4584,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',_0x11e040=>!_0x11e040)]},'children':this['children']});const _0x11d87f=new _0x2bc1f3(this['locale']),_0x3e3c76=new Yt();_0x3e3c76['content']=at,_0x11d87f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3e3c76,{'tag':'span','children':[{'text':us(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x11d87f),this['_setupBalloonPanel'](_0x2a5f07);}['addSource'](_0x48eeb3){this['children']['add'](new rr(this['locale'],_0x48eeb3,this['balloonPanelView']));}['_setupBalloonPanel'](_0x378017){this['balloonPanelView']=new yt(_0x378017),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},rr=class extends Ht{['balloonPanelView'];['source'];constructor(_0x4a5c80,_0x18a242,_0x5b2c34){super(_0x4a5c80),this['source']=_0x18a242,this['balloonPanelView']=_0x5b2c34,this['set']({'label':_0x18a242['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x57197a=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x57197a['to'](()=>{window['open'](_0x18a242['url'],'_blank');}),'mouseenter':_0x57197a['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x57197a['to'](()=>{this['_hideTooltip']();})}}),_0x18a242['favicon']){const _0x3841d7=new _0x2bc1f3(_0x4a5c80);_0x3841d7['setTemplate']({'tag':'img','attributes':{'src':_0x18a242['favicon']||at,'alt':_0x18a242['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x3841d7);}else this['set']('icon',at);}['_createTooltipContentView'](_0x5417d9,_0x4c29f1){const _0x50aecb=new _0x2bc1f3(_0x5417d9),_0x1cb131=[];let _0x220eab;_0x4c29f1?.['favicon']?(_0x220eab=new _0x2bc1f3(_0x5417d9),_0x220eab['setTemplate']({'tag':'img','attributes':{'src':_0x4c29f1['favicon'],'alt':_0x4c29f1['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x220eab=new Yt(),_0x220eab['content']=at,_0x220eab['extendTemplate']({'attributes':{'alt':_0x4c29f1['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x1cb131['push'](_0x220eab);const _0x37068c=new _0x2bc1f3(_0x5417d9);_0x37068c['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x4c29f1['url']},'children':[{'text':new URL(_0x4c29f1['url'])?.['hostname']}]}),_0x1cb131['push'](_0x37068c);const _0x343f9a=new _0x2bc1f3(_0x5417d9);_0x343f9a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x1cb131});const _0x375659=new _0x2bc1f3(_0x5417d9);return _0x375659['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x4c29f1['title']['length']>0x190?_0x4c29f1['title']['substring'](0x0,0x190)+'...':_0x4c29f1['title']}]}),_0x50aecb['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x343f9a,_0x375659]}),_0x50aecb;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x45b13a=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x45b13a);}},or=class extends _0x2bc1f3{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0xb2e5d9(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x3583df,_0x3954ab){super(_0x3583df);const {areActionsDisabled:_0x25b0d8,showUnchangedParts:_0x43b45c,availableActions:_0x3a1a0e}=_0x3954ab;this['_areActionsDisabled']=_0x25b0d8,this['_showUnchangedParts']=_0x43b45c,this['_availableActions']=_0x3a1a0e,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new zn(_0x3583df,jn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new tr(),this['_emptyPartsWarningView']=new er({'id':'empty-parts-warning','initialContent':us(_0x3583df,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new sr(_0x3583df,_0x3954ab['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new nr(this['locale'],_0x3954ab['bodyCollection']),_0x3954ab['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...yn)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0xb0f660=>_0xb0f660 instanceof Xn);}async['updateContentParts']({parts:_0x53807e,abortSignal:_0xda04e8,skipLoadingEffects:_0x5576de}){this['_cachedContentParts']['length']?_0x53807e['forEach'](_0x1ea260=>{const _0x5b5d60=this['_cachedContentParts']['findIndex'](_0x4fb022=>_0x4fb022['index']==_0x1ea260['index']);-0x1===_0x5b5d60?this['_cachedContentParts']['push'](_0x1ea260):this['_cachedContentParts'][_0x5b5d60]=_0x1ea260;}):this['_cachedContentParts']=_0x53807e;const _0x15c759=this['_showUnchangedParts']?_0x53807e:_0x53807e['filter'](_0x5a2f1d=>_0x5a2f1d['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x15c759['length']>0x1),_0x5576de&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0xabac1e of _0x15c759)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x3ff0f1=>{let _0x19ae43=this['getPartView'](_0xabac1e['index']);if(!_0x19ae43){if(_0x19ae43=new Xn(this['locale'],{'part':_0xabac1e,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x19ae43['delegate'](...yn)['to'](this),_0x19ae43['bind']('isTrackChangesOn')['to'](this),!_0x5576de&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x3ff0f1),_0x3ff0f1['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x19ae43,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x5576de||this['_showSkeletonDebounced']();}await _0x19ae43['updateContent']({'part':_0xabac1e,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x3ff0f1}),_0x19ae43['markAsDone']();});return _0xda04e8?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x3ba178,_0x1240ed){const _0x2fd325=this['getPartView'](_0x3ba178);_0x2fd325&&(_0x2fd325['state']=_0x1240ed),this['hasPendingParts']='pending'==_0x1240ed||this['_contentPartViews']['some'](_0x3b135d=>'pending'==_0x3b135d['state']);}['setPartActive'](_0x53e456,_0x27e4aa){if(!0x1===_0x53e456){for(const _0x5ec1e4 of this['_contentPartViews'])_0x5ec1e4['isActive']=!0x1;}else{const _0x3752e9=this['getPartView'](_0x53e456);_0x3752e9&&(_0x3752e9['isActive']=_0x27e4aa);}}['updateSources'](_0x59f4cf){_0x59f4cf['forEach'](_0x1bc3b7=>this['_sourcesView']['addSource'](_0x1bc3b7)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x577329){return this['_contentPartViews']['find'](_0x1d8a60=>_0x1d8a60['partDefinition']['index']==_0x577329)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x3474c8=!this['_cachedContentParts']['find'](({hasChanges:_0x5e686b})=>_0x5e686b),_0x2b7644=!!this['_cachedContentParts']['find'](({hasChanges:_0x4d51c0})=>!_0x4d51c0);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x2b7644,_0x3474c8?this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](us(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x31677f=>_0x31677f['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x5eb2da){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x570337=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x570337>0x0){const {promise:_0x3c2a78,abortController:_0xb72131}=Ln(_0x570337);_0x5eb2da?.['addEventListener']('abort',()=>_0xb72131['abort']()),await _0x3c2a78['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x434c56=>_0x434c56['partDefinition']['hasChanges'])['length']>0x0;}},ar=class extends _0x2bc1f3{['bodyView'];['children'];['headerView'];constructor(_0x481be8,_0x443b88,_0x2adcd4){super(_0x481be8);const {showDiff:_0x456fea,areActionsDisabled:_0x3fc96b,showUnchangedParts:_0x47e19c,availableActions:_0x314135}=_0x443b88;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Bn(_0x481be8,{'showDiff':_0x456fea}),this['headerView']['on']('toggleShowChanges',(_0x4039c3,_0x299eac)=>{this['areChangesVisible']=_0x299eac['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x299eac['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new or(_0x481be8,{'areActionsDisabled':_0x3fc96b,'showUnchangedParts':!!_0x47e19c,'availableActions':_0x314135,'bodyCollection':_0x2adcd4}),this['bodyView']['delegate'](...yn)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x4920d8){await this['bodyView']['updateContentParts'](_0x4920d8);}['updateSources'](_0x4aa09f){this['bodyView']['updateSources'](_0x4aa09f);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},hr=class extends Un{['containerView'];constructor(_0x403ccd,_0x23a8cf,_0x490c44){super(_0x23a8cf),this['set']('isTrackChangesOn',!0x1),this['containerView']=new ar(_0x403ccd,{'showDiff':_0x23a8cf['showDiff'],'areActionsDisabled':_0x23a8cf['areActionsDisabled'],'availableActions':_0x23a8cf['availableActions']},_0x490c44),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x29b447,_0x4efa7b)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4efa7b['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',(_0x365fbe,{index:_0xe6acbc})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0xe6acbc});}),this['containerView']['on']('applySuggestion',(_0xa6474f,{index:_0x374c2d}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x374c2d});}),this['containerView']['on']('insertSuggestion',(_0x4b5646,{index:_0x25ed13}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x25ed13});}),this['containerView']['on']('rejectSuggestion',(_0x14b856,{index:_0x5c7576})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5c7576});}),this['containerView']['on']('mouseOverSuggestion',(_0xc139e1,{index:_0x550c48})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x550c48});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x1a7074,{index:_0x2cdb82})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2cdb82});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x34f7a2){await this['containerView']['updateContent'](_0x34f7a2);}['updatePartState'](_0x48e148,_0x528dca){this['containerView']['bodyView']['updatePartState'](_0x48e148,_0x528dca);}['setPartActive'](_0x1ecc63,_0x1087f5){!0x1===_0x1ecc63?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x1ecc63,_0x1087f5);}['updateSources'](_0x34b88a){this['containerView']['updateSources'](_0x34b88a);}['getPartView'](_0xf616ab){return this['containerView']['bodyView']['getPartView'](_0xf616ab);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},cr=class extends Un{['replyContainer'];['_bodyCollection'];constructor(_0x500ff6,_0x4ac0e0,_0x17374d){super(_0x4ac0e0),this['_bodyCollection']=_0x17374d,this['locale']=_0x500ff6,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x2bc1f3(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x1ac544,renderingStrategy:_0x4ac47a,abortSignal:_0x1d2349}){'streaming'===_0x4ac47a?await this['streamIntoElement'](_0x1ac544,this['replyContainer']['element'],_0x1d2349):this['replyContainer']['element']['innerHTML']=_0x253579(_0x1ac544);}['updateSources'](_0x1f5013){const _0x4af4bf=new nr(this['locale'],this['_bodyCollection']);_0x4af4bf['children']['addMany'](_0x1f5013['map'](_0x396112=>new rr(this['locale'],_0x396112,_0x4af4bf['balloonPanelView']))),_0x4af4bf['isVisible']=!0x0,this['children']['add'](_0x4af4bf);}},lr=class extends _0x5add43{constructor(_0x265923=void 0x0){super();const _0x21d3bf=_0x265923?'ck-ai-spinner_'+_0x265923:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x21d3bf]}});}};const ur={'file':_0x209362,'image':_0x358fa7,'document':_0x51d1ff,'web-resource':_0x4cbb19,'text':_0x209362,'selection':_0x109bae,'mcp-tool-context':_0x51d1ff},dr='ck-ai-chat-context-chip',_r='ck-ai-chat-context-chip_wide',gr='ck-ai-chat-context-chip_document',Ar='ck-ai-chat-context-chip__label',Ir='ck-ai-chat-context-chip__type-icon',pr='ck-ai-chat-context-controls__chip-tooltip',mr='n';var Er=class extends Ht{constructor(_0x43d336,_0xdd859f,_0x428701,_0x27fd1d,_0x43ab47=!0x1){super(_0x43d336),this['_isAnimationOnEnterEnabled']=_0x27fd1d,this['_initializeProperties'](_0xdd859f,_0x428701,_0x43ab47),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'](_0x5eccfe,_0x122b7b,_0x52550c){this['set']('label',_0x5eccfe['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x5eccfe['type']),this['set']('id',_0x5eccfe['uiId']),this['set']('readonly',_0x122b7b),this['set']('isLoading',_0x52550c);}['_setupTemplate'](){const _0x1a0664=this['_createIconView'](),_0x5f3665=this['_createRemoveButton'](),_0x38f020=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x38f020),'children':this['_createTemplateChildren'](_0x1a0664,_0x5f3665,_0x38f020)});}['_createTemplateAttributes'](_0x1d1a50){return{'class':[dr,_0x1d1a50['if']('itemType',gr,_0x1aa32f=>'document'==_0x1aa32f),_0x1d1a50['if']('itemType',_r,_0x483950=>'selection'==_0x483950)],'data-cke-tooltip-text':_0x1d1a50['to']('label',Tr),'data-cke-tooltip-position':mr,'data-cke-tooltip-class':pr};}['_createTemplateChildren'](_0xc14df,_0x1bfde1,_0x5c5b22){const _0x327b2d=this['_createLabelElement'](_0x5c5b22),_0x1763b3=this['_createLoaderIcon']();return this['readonly']?[_0xc14df,_0x327b2d]:[_0xc14df,_0x1763b3,_0x327b2d,_0x1bfde1];}['_createLabelElement'](_0x543d55){return{'tag':'span','attributes':{'class':Ar},'children':[{'text':_0x543d55['to']('label')}]};}['_createRemoveButton'](){const _0x175064=new Ht(this['locale']);return _0x175064['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x16ce26}),this['_setupRemoveButtonEvent'](_0x175064),_0x175064;}['_setupRemoveButtonEvent'](_0x320f67){_0x320f67['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x540a6b=this['bindTemplate'],_0x345b22=new Yt();return _0x345b22['content']=ur[this['itemType']],_0x345b22['extendTemplate']({'attributes':{'class':[Ir,_0x540a6b['if']('isLoading','ck-hidden',_0x220d65=>_0x220d65)]}}),_0x345b22;}['_handleAnimationEndOnce'](_0x51c880,_0x1e6b21){if(!_0x51c880)return;const _0x58da4a=()=>{_0x1e6b21(),_0x51c880['removeEventListener']('animationend',_0x58da4a),_0x51c880['removeEventListener']('webkitAnimationEnd',_0x58da4a);};_0x51c880['addEventListener']('animationend',_0x58da4a),_0x51c880['addEventListener']('webkitAnimationEnd',_0x58da4a);}['_createLoaderIcon'](){const _0xf2bcfd=new lr('small');return _0xf2bcfd['bind']('isVisible')['to'](this,'isLoading',_0x26816c=>_0x26816c),_0xf2bcfd;}};function Tr(_0x4feb09){if(!_0x4feb09)return _0x4feb09;if(_0x4feb09['length']<=0x78)return _0x4feb09;const _0x17160c=_0x4feb09['slice'](0x0,0x78),_0x34665c=_0x17160c['lastIndexOf']('\x20');return(_0x34665c>0x0?_0x17160c['slice'](0x0,_0x34665c):_0x17160c)+'…';}const wr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Cr='300px';var fr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x2cb3e9,_0x3af3b7,_0x3658bc,_0x2626c3,_0x189eea){this['_locale']=_0x2cb3e9,this['_visibleChips']=_0x3af3b7,this['_config']={...wr,..._0x3658bc,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x3658bc['cssClasses']}},this['_overflowChips']=new ct(),this['_bodyCollection']=_0x2626c3,this['_parentView']=_0x189eea||null;}['setContainerElement'](_0x18474a){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x18474a,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 _0xb25c79=[...this['_visibleChips'],...this['_overflowChips']],_0x2e9018=this['_createCalculationContainer'](),_0x5b3227=this['_calculateOverflowInContainer'](_0x2e9018,_0xb25c79),_0x4a5735=_0x2e9018['_ancestorsToRestore'];_0x4a5735&&this['_restoreAncestorVisibility'](_0x4a5735),_0x2e9018['remove'](),this['_applyOverflowResults'](_0xb25c79,_0x5b3227);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0xf3e5e2({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x1aef3d=new Ht(this['_locale']);_0x1aef3d['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x3b4357=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x3b4357['push'](this['_config']['cssClasses']['controlsButton']),_0x1aef3d['extendTemplate']({'attributes':{'class':_0x3b4357}}),_0x1aef3d;}['_createShowMoreBalloonPanelView'](){const _0x5ab5be=new yt(this['_locale']);return _0x5ab5be['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x5ab5be),_0x5ab5be;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x218ed9=>{_0x218ed9['disableAnimationOnEnter']();});const _0x2bf060=new _0x2bc1f3(this['_locale']);_0x2bf060['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2bf060);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x959379=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x959379?'':'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'](_0x51d656){const _0x5e9a0a=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x40aaba=this['_containerElement']?.['classList'];if(_0x40aaba){const _0x5753a4=_0x40aaba[0x0]||'',_0x2eccd6=_0x51d656['querySelector']('.'+_0x5753a4),_0x211944=_0x51d656['querySelector'](_0x5e9a0a);return _0x2eccd6||_0x211944||_0x51d656;}return _0x51d656['querySelector'](_0x5e9a0a)||_0x51d656;}['_calculateContainerWidth'](){const _0xa5d02=this['_parentView']?.['element']||this['_containerElement'];if(!_0xa5d02)return Cr;const _0x35f82b=window['getComputedStyle'](_0xa5d02)['width'];if('auto'===_0x35f82b||'0px'===_0x35f82b||!_0x35f82b){const _0x23a66c=_0xa5d02['parentElement'];if(_0x23a66c){const _0x2f0259=window['getComputedStyle'](_0x23a66c);return'auto'!==_0x2f0259['width']?_0x2f0259['width']:Cr;}return Cr;}return _0x35f82b;}['_applyCalculationStyles'](_0x41419c,_0xf940f8){this['_config']['cssClasses']['calculationContainer']&&_0x41419c['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x41419c['style']['width']=_0xf940f8,_0x41419c['style']['position']='absolute',_0x41419c['style']['top']='-9999px',_0x41419c['style']['left']='-9999px',_0x41419c['style']['opacity']='0',_0x41419c['style']['pointerEvents']='none',_0x41419c['style']['zIndex']='-1',_0x41419c['style']['visibility']='visible\x20!important',_0x41419c['style']['display']='block\x20!important',_0x41419c['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x18e2ec){_0x18e2ec['forEach'](({element:_0x576ef8,originalDisplay:_0xc4653f,originalVisibility:_0x5e95fb})=>{_0x576ef8['style']['display']=_0xc4653f,_0x576ef8['style']['visibility']=_0x5e95fb;});}['_makeAncestorsVisible'](_0x3d2bc9){const _0x174d4d=[];let _0x115e95=_0x3d2bc9;for(;_0x115e95&&_0x115e95!==document['body'];){const _0x247945=window['getComputedStyle'](_0x115e95);'none'!==_0x247945['display']&&'hidden'!==_0x247945['visibility']||(_0x174d4d['push']({'element':_0x115e95,'originalDisplay':_0x115e95['style']['display'],'originalVisibility':_0x115e95['style']['visibility']}),_0x115e95['style']['display']='block',_0x115e95['style']['visibility']='visible'),_0x115e95=_0x115e95['parentElement'];}return _0x174d4d;}['_createContainerElements'](){let _0x128ece,_0x5849a4;return this['_parentView']?.['element']?(_0x128ece=this['_parentView']['element']['cloneNode'](!0x0),_0x5849a4=this['_findTargetContainer'](_0x128ece)):(_0x128ece=document['createElement']('div'),_0x5849a4=_0x128ece),{'calculationContainer':_0x128ece,'targetContainer':_0x5849a4};}['_createCalculationContainer'](){const {calculationContainer:_0x28b4dd,targetContainer:_0x4901ff}=this['_createContainerElements'](),_0x41a065=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x28b4dd,_0x41a065);const _0x1ce081=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x1ce081?_0x1ce081['appendChild'](_0x28b4dd):document['body']['appendChild'](_0x28b4dd),_0x28b4dd['_targetContainer']=_0x4901ff;const _0x4a30df=this['_makeAncestorsVisible'](_0x1ce081||null);return _0x28b4dd['offsetWidth'],_0x28b4dd['_ancestorsToRestore']=_0x4a30df,_0x28b4dd;}['_calculateOverflowInContainer'](_0x519d0b,_0x27c3e3){const _0x483792=_0x519d0b['_targetContainer']||_0x519d0b,_0x1a8632=[],{rowCount:_0x4590d5}=this['_renderChipsAndCountRows'](_0x483792,_0x27c3e3);if(_0x4590d5<=this['_config']['maxVisibleRows'])return _0x1a8632;const _0x35613f=_0x27c3e3['slice']();for(;_0x35613f['length']>0x0;){if(this['_testButtonFit'](_0x519d0b,_0x483792,_0x35613f)){const _0x489a0f=_0x27c3e3['filter'](_0x192800=>!_0x35613f['includes'](_0x192800));_0x1a8632['push'](..._0x489a0f);break;}if(!_0x35613f['pop']())break;}return _0x1a8632;}['_renderChipsAndCountRows'](_0x4ef326,_0x3f37d0){_0x4ef326['innerHTML']='',_0x3f37d0['forEach'](_0x2ee22b=>{if(_0x2ee22b['element']){const _0x33b00e=_0x2ee22b['element']['cloneNode'](!0x0);_0x4ef326['appendChild'](_0x33b00e);}}),_0x4ef326['offsetWidth'];const _0x29f6b8=_0x4ef326['children'],_0x351d1f=[];return Array['from'](_0x29f6b8)['forEach'](_0x1392d0=>{const _0x260232=_0x1392d0['getBoundingClientRect']()['top'];_0x351d1f['some'](_0x10eb8e=>Math['abs'](_0x10eb8e-_0x260232)<this['_config']['rowDetectionTolerance'])||_0x351d1f['push'](_0x260232);}),{'rowCount':_0x351d1f['length']};}['_createMockButton'](){const _0x12121b=document['createElement']('button');return _0x12121b['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x12121b['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x12121b['textContent']='+\x201',_0x12121b;}['_testButtonFit'](_0x333947,_0x409578,_0x5e9582){this['_renderChipsAndCountRows'](_0x409578,_0x5e9582);const _0x44c963=this['_createMockButton']();_0x333947['appendChild'](_0x44c963),_0x333947['offsetWidth'];const _0x35dc85=[..._0x409578['children'],_0x44c963],_0x3772ea=[];_0x35dc85['forEach'](_0x4cb8b0=>{const _0x44bc66=_0x4cb8b0['getBoundingClientRect']()['top'];_0x3772ea['some'](_0x138802=>Math['abs'](_0x138802-_0x44bc66)<this['_config']['rowDetectionTolerance'])||_0x3772ea['push'](_0x44bc66);});const _0xb58ace=_0x3772ea['length'];return _0x44c963['remove'](),_0xb58ace<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x2cab5e,_0x344c3e){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x2cab5e['forEach'](_0x29c778=>{_0x344c3e['includes'](_0x29c778)?this['_overflowChips']['add'](_0x29c778):this['_visibleChips']['add'](_0x29c778);});}['_updateOverflowUI'](_0x6ae2a5){if(_0x6ae2a5>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x6ae2a5>0x0&&this['_showMoreButtonView']){const _0x3996ac=''+this['_config']['showMoreLabelPrefix']+(_0x6ae2a5<0x63?_0x6ae2a5:'99');this['_showMoreButtonView']['label']=_0x3996ac;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x447428,_0x46cf17){this['_distributeChips'](_0x447428,_0x46cf17),this['_updateOverflowUI'](_0x46cf17['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x562de2=>{_0x562de2[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 _0x4b35ff=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x4b35ff['width']||0x0===_0x4b35ff['height'])return!0x1;const _0x308d2d=window['innerHeight']||document['documentElement']['clientHeight'],_0x454cbb=window['innerWidth']||document['documentElement']['clientWidth'];return _0x4b35ff['bottom']>=-0xc8&&_0x4b35ff['top']<=_0x308d2d+0xc8&&_0x4b35ff['right']>=-0xc8&&_0x4b35ff['left']<=_0x454cbb+0xc8;}};const br='ck-ai-chat__feed__context-chips',Sr='ck-ai-chat-context-chips-wrapper',Rr='ck-ai-chat-context-chips-wrapper-balloon',Or='ck-ai-chat-controls-button',vr='ck-ai-chat-controls_context_show-more-button',kr='ck-ai-chat-context-controls__show-more-balloon-panel';var Nr=class extends _0x2bc1f3{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x25baee,_0x1ef5db,_0x5303bc){super(_0x25baee),this['_bodyCollection']=_0x5303bc,this['_createContextChips'](_0x1ef5db);const _0x35c5e5={'cssClasses':{'showMoreButton':vr+'\x20'+ln,'showMoreBalloon':kr,'overflowContainer':Rr,'controlsButton':Or}};this['_overflowManager']=new fr(_0x25baee,this['_contextChips'],_0x35c5e5,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[br,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Sr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x359b10=this['element']['querySelector']('.'+Sr);_0x359b10&&(this['_overflowManager']['setContainerElement'](_0x359b10),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x9226be){for(const _0x179744 of _0x9226be){const _0x4ec6ec=new Er(this['locale'],_0x179744,!0x0,!0x1);this['_contextChips']['add'](_0x4ec6ec);}}},yr=class extends Un{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x120619,_0x462290,_0x3cb60c){super(_0x462290),this['_locale']=_0x120619,this['_bodyCollection']=_0x3cb60c,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new Nr(this['_locale'],this['options']['contextItems']['filter'](_0x543793=>!_0x543793['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x2bc1f3(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}},xr=class extends Un{['capabilities'];constructor(_0x14613e,_0x3c1d47){super(_0x3c1d47);const {isWebSearchEnabled:_0x5e1c4d,isReasoningEnabled:_0x17bb8f}=_0x3c1d47['capabilities'],_0x3bcc70=[];let _0x49d852='';_0x5e1c4d&&_0x17bb8f?(_0x49d852=us(_0x14613e,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x3bcc70['push'](Lr(at)),_0x3bcc70['push'](Lr(_0xb0d5f5))):_0x5e1c4d?(_0x49d852=us(_0x14613e,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x3bcc70['push'](Lr(at))):_0x17bb8f&&(_0x49d852=us(_0x14613e,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x3bcc70['push'](Lr(_0xb0d5f5))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x49d852?'':'ck-hidden']}});const _0x296e32=new _0x2bc1f3();_0x296e32['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x3bcc70,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x49d852]}]}),this['children']['add'](_0x296e32),this['capabilities']=_0x3c1d47['capabilities'];}};function Lr(_0x2f6c98){const _0x2cce87=new Yt();return _0x2cce87['content']=_0x2f6c98,_0x2cce87;}const Dr=['wheel','touchstart','pointerdown','keydown'],Pr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Hr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x59a8ef){this['element']=_0x59a8ef,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x57c569 of Dr){const _0x5af088='keydown'!==_0x57c569;this['element']['addEventListener'](_0x57c569,this['_onUserEvent']['bind'](this),{'passive':_0x5af088,'signal':this['abortController']['signal']});}}['start']({smooth:_0x4eac06=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x4eac06?'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'](_0x4dac07){if(this['isRunning']){if('keydown'===_0x4dac07['type']){const _0x36a4c4=_0x4dac07['key'];if(!Pr['includes'](_0x36a4c4))return;}_0x4dac07 instanceof WheelEvent?_0x4dac07['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x2178d6,scrollHeight:_0x184997,clientHeight:_0x1569f7}=this['element'];return _0x184997-_0x2178d6-_0x1569f7<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Mr=class extends Un{constructor(_0xfb4be1){super(_0xfb4be1),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}},Vr=class extends _0x2bc1f3{['children'];['scrollManager'];['_bodyCollection'];constructor(_0xb13679,_0x59ba95){super(_0xb13679),this['_bodyCollection']=_0x59ba95,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...xn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Hr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x595689,_0x15e66c){let _0x5aa2ef;return'ai-reply'===_0x595689?_0x5aa2ef=new cr(this['locale'],_0x15e66c,this['_bodyCollection']):'ai-suggestion-reply'===_0x595689?(_0x5aa2ef=new hr(this['locale'],_0x15e66c,this['_bodyCollection']),_0x5aa2ef['bind']('isTrackChangesOn')['to'](this)):_0x5aa2ef='user-message'===_0x595689?new yr(this['locale'],_0x15e66c,this['_bodyCollection']):'interaction-header'===_0x595689?new xr(this['locale'],_0x15e66c):'custom-element'===_0x595689?new Mr(_0x15e66c):new er(_0x15e66c),this['children']['add'](_0x5aa2ef),_0x5aa2ef;}async['updateReplyItem']({id:_0x33c773,parsedContent:_0x10bdd2,renderingStrategy:_0x5933f,abortSignal:_0xbd8671}){const _0x5a3f89=this['getItemById'](_0x33c773);if(!(_0x5a3f89 instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x5a3f89,'id':_0x33c773,'parsedContent':_0x10bdd2});await _0x5a3f89['updateContent']({'parsedContent':_0x10bdd2,'renderingStrategy':_0x5933f,'abortSignal':_0xbd8671});}async['updateWebSources'](_0x7dcc1,_0x31d132){const _0x3575ba=this['getItemById'](_0x7dcc1);if(_0x3575ba instanceof hr)_0x3575ba['updateSources'](_0x31d132);else{if(!(_0x3575ba instanceof cr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x3575ba,'id':_0x7dcc1,'sources':_0x31d132});_0x3575ba['updateSources'](_0x31d132);}}async['updateSuggestionItem']({id:_0x55f15d,parts:_0x2edb51,abortSignal:_0x1019f8,skipLoadingEffects:_0x197644}){const _0xc7d981=this['getItemById'](_0x55f15d);if(!(_0xc7d981 instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0xc7d981,'id':_0x55f15d,'parts':_0x2edb51});await _0xc7d981['updateContent']({'parts':_0x2edb51,'abortSignal':_0x1019f8,'skipLoadingEffects':_0x197644});}['updateSuggestionPartState']({id:_0x3a1f36,index:_0x1e1fb0,state:_0x3488cb}){const _0x11cf7c=this['getItemById'](_0x3a1f36);if(!(_0x11cf7c instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3a1f36});_0x11cf7c['updatePartState'](_0x1e1fb0,_0x3488cb);}['setSuggestionPartActive']({id:_0x161dec,index:_0x9c0a06,isActive:_0x2ae651}){const _0x52a0ee=this['getItemById'](_0x161dec);if(!(_0x52a0ee instanceof hr))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x161dec});this['children']['filter'](_0x116e66=>_0x116e66 instanceof hr)['forEach'](_0x1ee612=>{_0x1ee612['setPartActive'](!0x1);}),_0x52a0ee['setPartActive'](_0x9c0a06,_0x2ae651);}['markItemAsDone'](_0x14f2d4){this['getItemById'](_0x14f2d4)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x509e65=>_0x509e65['options']['id']);}['removeItem'](_0x460cbd){this['children']['remove'](this['getItemById'](_0x460cbd));}['hasItem'](_0x4fa772){return!!this['children']['find'](_0x990581=>_0x990581['options']['id']['includes'](_0x4fa772));}['scrollToSuggestion'](_0x458f05,_0x29b95f){const _0x2c6041=this['getItemById'](_0x458f05);if(!(_0x2c6041 instanceof hr))return void bt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x458f05,'partIndex':_0x29b95f});const _0x4e669e=_0x2c6041['getPartView'](_0x29b95f);_0x4e669e?St(_0x4e669e['element'],0x14,this['element']['parentElement'],!0x0,!0x0):bt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x458f05,'partIndex':_0x29b95f});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x371e88=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x371e88,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x2cc212=new zn(this['locale'],jn['aiFeed']);return _0x2cc212['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x2cc212;}['_createFeedItems'](){const _0x23f8a9=new _0x2bc1f3(this['locale']);return _0x23f8a9['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x23f8a9;}['_createFeedLoader'](){const _0x1467a1=new _0x2bc1f3(this['locale']);return _0x1467a1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x52ae74=>!_0x52ae74)]},'children':this['_createLoaderChildren']()}),_0x1467a1;}['_createLoaderChildren'](){const _0x488551=new lr();return _0x488551['isVisible']=!0x0,[_0x488551,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x33a203){const _0x16911c=this['children']['find'](_0x3a1ae1=>_0x3a1ae1['options']['id']['includes'](_0x33a203));if(!_0x16911c)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x33a203});return _0x16911c;}['setLoadingMessage'](_0x5b9722){this['set']('loadingMessage',_0x5b9722);}['toggleLoadingSkeleton'](_0x2bf3cc){this['set']('isLoadingSkeletonVisible',_0x2bf3cc);}['startAutoScroll'](_0x2bfa5f={}){this['scrollManager']['start'](_0x2bfa5f);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Ur=class extends jt{['filter'](){let _0x2c9ced=0x0;for(const _0x14376b of this['items'])_0x2c9ced+=_0x14376b['items']['length'];return{'resultsCount':_0x2c9ced,'totalItemsCount':_0x2c9ced};}};function Br(_0x25d54d){const _0x47690e=[];let _0x34560a=!0x1;for(const _0x5ee401 of Array['from'](_0x25d54d['items'])){if('file'!==_0x5ee401['kind'])continue;if(_0x5ee401['webkitGetAsEntry']()?.['isDirectory']){_0x34560a=!0x0;continue;}const _0x46e10a=_0x5ee401['getAsFile']();_0x46e10a&&_0x47690e['push'](_0x46e10a);}return{'files':_0x47690e,'hasDirectory':_0x34560a};}const Gr='ck-ai-chat__prompt-input_highlighted';var Fr=class AIChatPromptInputView extends Nt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x36ab2e,_0x472ba6){super(_0x36ab2e,{'queryView':{'label':'','creator':_0x170dd3,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Ur(_0x36ab2e),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x472ba6,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',(_0x1ac9d0,_0x453bb8)=>!_0x1ac9d0&&!_0x453bb8),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x2716c4,_0x26ece6)=>{this['isUploadInProgress']||this['isEmpty']||_0x2716c4['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x26ece6());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x2efec6=>this['_handlePaste'](_0x2efec6)),this['element']['addEventListener']('drop',_0xd64561=>this['_handleDrop'](_0xd64561));}['_handlePaste'](_0x496582){const _0x1982d2=_0x496582['clipboardData'];if(!_0x1982d2)return;const {files:_0xe4c633,hasDirectory:_0x423093}=Br(_0x1982d2),_0x2b91b5={'files':_0xe4c633,'plainText':_0x1982d2['getData']('text/plain'),'hasDirectory':_0x423093,'forceTextAttachment':!0x1,'preventDefault':()=>_0x496582['preventDefault']()};this['fire']('promptInputPaste',_0x2b91b5);}['_handleDrop'](_0x4635e6){const _0x51fd65=_0x4635e6['dataTransfer'];if(!_0x51fd65)return;const _0x1e2937={'files':[],'plainText':_0x51fd65['getData']('text/uri-list')||_0x51fd65['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x4635e6['preventDefault']()};this['fire']('promptInputPaste',_0x1e2937);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x3b6167=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x3b6167)return this['queryView']['errorText']=us(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x3ead4a=_0x4ae7b3(_0x3b6167);this['fire']('sendUserMessage',_0x3ead4a),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x2a05a4){this['queryView']['fieldView']['set']('placeholder',_0x2a05a4);}['focus'](_0x4217c9=!0x1){super['focus'](),_0x4217c9&&(this['element']['classList']['contains'](Gr)||(this['element']['classList']['add'](Gr),setTimeout(()=>{this['element']['classList']['remove'](Gr);},0x320)));}['_createSubmitButton'](){const _0x40776c=new Ht(this['locale']);return _0x40776c['set']({'icon':st,'label':us(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+hn,'isEnabled':!0x1}),_0x40776c['on']('execute',()=>{this['submit']();}),_0x40776c;}['setIsUploadInProgress'](_0x4122a6){this['isUploadInProgress']=_0x4122a6;}['_setUpAddContextButtonPositioning'](){const _0x9e2b43=this['locale'],_0x35b712=()=>{Tt['window']['requestAnimationFrame'](()=>{if(Ct(this['element'])){const _0x20ae4e=new At(this['queryView']['fieldView']['element']),_0x4597aa=new At(this['_addContextButtonView']['element']),_0x1b8e6f=_0x20ae4e['width'],_0x6413aa='rtl'===_0x9e2b43['uiLanguageDirection']?'right':'left';_0x20ae4e['excludeScrollbarsAndBorders']();const _0x4b9a2a=_0x1b8e6f-_0x20ae4e['width']+0x1;this['_addContextButtonView']['element']['style'][_0x6413aa]='calc('+(_0x1b8e6f-_0x4597aa['width']-_0x4b9a2a)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x35b712),this['on']('render',()=>{_0x35b712(),this['_queryViewResizeObserver']=new It(this['queryView']['fieldView']['element'],()=>{_0x35b712();});});}},Kr=class extends _0x2bc1f3{constructor(_0x2de9f6){super(_0x2de9f6);const _0x272cb2=new Yt();_0x272cb2['content']=_0x209362,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x272cb2,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':us(_0x2de9f6,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x5cb4e4){let _0x385fa8=0x0;_0x5cb4e4['addEventListener']('dragenter',_0x852c6b=>{_0x852c6b['dataTransfer']&&(_0x385fa8++,0x1===_0x385fa8&&this['fire']('dragEnter'),_0x5cb4e4['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x5cb4e4['addEventListener']('dragover',_0x3642f0=>{_0x3642f0['dataTransfer']&&_0x3642f0['preventDefault']();}),_0x5cb4e4['addEventListener']('dragleave',()=>{--_0x385fa8<=0x0&&(_0x385fa8=0x0,_0x5cb4e4['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x5cb4e4['addEventListener']('drop',_0x46076c=>{_0x46076c['preventDefault'](),_0x385fa8=0x0,_0x5cb4e4['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x46076c);});}['_handleDrop'](_0x324f6f){const _0x4b24a1=_0x324f6f['dataTransfer'];if(!_0x4b24a1)return;const {files:_0x39c77b,hasDirectory:_0x2ac875}=Br(_0x4b24a1),_0x3b1149={'files':_0x39c77b,'plainText':_0x4b24a1['getData']('text/uri-list')||_0x4b24a1['getData']('text/plain'),'hasDirectory':_0x2ac875,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x3b1149);}};const Wr='ck-ai-chat__prompt-capabilities',Yr='ck-ai-chat-controls-button',$r='ck-ai-chat-controls-button--commands',qr='ck-ai-chat-controls__model-selection',Qr='ck-ai-chat-controls__model-selection__item-name',Xr='ck-ai-chat-controls__model-selection__item-description',zr='ck-ai-chat-controls__model-selection__item-capabilities',jr='n';var Jr=class extends _0x2bc1f3{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x4b59c2){super(_0x4b59c2),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',_0x66da89=>'selector'===_0x66da89),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x5f1213=>_0x5f1213?this['_modelSelectionDropdown']['buttonView']['label']:us(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x4ace75=>_0x4ace75),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x4a6c5f=>_0x4a6c5f),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x5431c1=>us(this['locale'],_0x5431c1?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x5b9974=>_0x5b9974),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x1a8728=>us(this['locale'],_0x1a8728?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Wr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ct(),_0xee0f07(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x45fb58,_0x98b2d8){if(_0x98b2d8)this['set']('modelDisplayMode','hidden');else{const _0x5175c1=0x1===_0x45fb58['length'];this['set']('modelDisplayMode',_0x5175c1?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x45fb58?.['length'])for(const _0x2dc5c2 of _0x45fb58){const _0x289d78=new _0x1ca844({'label':_0x2dc5c2['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2dc5c2['id'],'model':_0x2dc5c2});_0x289d78['bind']('isOn')['to'](this,'activeModelId',_0xefc1c6=>_0xefc1c6===_0x2dc5c2['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x289d78,'labelView':new Zr(this['locale'],_0x2dc5c2)});}}['setWebSearch'](_0x4c6cb6){this['set']('webSearchActive',_0x4c6cb6);}['setReasoning'](_0x7874fb){this['set']('reasoningActive',_0x7874fb);}['setModel'](_0x1c2158){if(!_0x1c2158)return;this['activeModelId']=_0x1c2158['id'],this['activeModelName']=_0x1c2158['name']||_0x1c2158['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x1c2158['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x1c2158['name']);const _0x1282f2=_0x1c2158['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x1282f2),this['_webSearchButton']['set']('isVisible',_0x1282f2);const _0x3e87a6=_0x1c2158['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3e87a6),this['_reasoningButton']['set']('isVisible',_0x3e87a6);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x6e5ebe){this['set']('modelSelectorEnabled',!0x1),_0x6e5ebe&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x163c35=new Ht();return _0x163c35['set']({'label':us(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':at,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0x163c35['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x163c35;}['_createReasoningButton'](){const _0x46af44=new Ht();return _0x46af44['set']({'label':us(this['locale'],'AI_CHAT_REASONING'),'icon':_0xb0d5f5,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltipPosition':jr}),_0x46af44['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x46af44;}['_createCommandsButton'](){const _0x28a75d=new Ht();return _0x28a75d['set']({'label':us(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x43cb5b,'withText':!0x0,'class':Yr+'\x20'+ln,'isToggleable':!0x0,'tooltip':us(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':jr}),_0x28a75d['extendTemplate']({'attributes':{'class':[$r]}}),_0x28a75d['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x28a75d;}['_createModelSelectionDropdown'](){const _0x1f306c=_0x4e3ad4(this['locale']);return _0x1f306c['set']({'panelPosition':'ne','class':[qr]}),_0x1f306c['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':jr,'class':ln}),this['listenTo'](_0x1f306c,'execute',_0x12fac0=>{this['fire']('selectModel',_0x12fac0['source']['model']);}),_0x1f306c;}['_createModelNameView'](){const _0x121299=new to(this['locale']);return _0x121299['bind']('text')['to'](this,'activeModelName',_0x20d4ef=>_0x20d4ef??''),_0x121299['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5da463=>'name'===_0x5da463),_0x121299;}},Zr=class extends Dt{constructor(_0x34dc84,_0x336f2c){super();const _0x59feb3=this['bindTemplate'],_0x5ce31e=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x59feb3['to']('style'),'id':_0x59feb3['to']('id')},'children':[{'tag':'div','attributes':{'class':[Qr]},'children':[{'text':_0x59feb3['to']('text')}]},{'tag':'div','attributes':{'class':[Xr]},'children':[{'tag':'span','children':[{'text':_0x336f2c['description']}]}]},{'tag':'div','attributes':{'class':[zr]},'children':_0x5ce31e}]}),_0x5ce31e['addMany'](this['_getCapabilityParts'](_0x34dc84,at,'AI_CHAT_SEARCH_WEB',_0x336f2c['capabilities']['webSearch']?.['enabled']??!0x1)),_0x5ce31e['addMany'](this['_getCapabilityParts'](_0x34dc84,_0xb0d5f5,'AI_CHAT_REASONING',_0x336f2c['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0xe8c0fc,_0x2cf187,_0x5a45c8,_0x20e6db){const _0x3932f8=new Yt();_0x3932f8['content']=_0x2cf187;const _0x2ec3e7=new _0x2bc1f3(_0xe8c0fc);_0x2ec3e7['setTemplate']({'tag':'span','children':[{'text':us(_0xe8c0fc,_0x5a45c8)+':\x20'}]});const _0x2dbbeb=new _0x2bc1f3(_0xe8c0fc);return _0x2dbbeb['setTemplate']({'tag':'span','children':[{'text':us(_0xe8c0fc,_0x20e6db?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x3932f8,_0x2ec3e7,_0x2dbbeb];}},to=class extends _0x2bc1f3{constructor(_0x196979){super(_0x196979),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x5b5402=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x5b5402['if']('isVisible','ck-hidden',_0x579c5b=>!_0x579c5b)]},'children':[{'text':_0x5b5402['to']('text')}]});}};const eo='ck-ai-chat-context-controls__url-form',io='ck-ai-chat-context-controls__url-input-section';var so=class extends _0x2bc1f3{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x1fddb0){super(_0x1fddb0),this['focusTracker']=new dt(),this['keystrokes']=new _t(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x239a76=>{this['focusTracker']['add'](_0x239a76['element']),this['keystrokes']['listenTo'](_0x239a76['element']);}),_0x39e9cb({'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'](_0x35aff7){this['urlInputField']['errorText']=_0x35aff7,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x5df4ce=new Ht(this['locale']);return _0x5df4ce['set']({'icon':_0x3606c6,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x40ad56,_0x3af3c2,_0x3f915c)=>{_0x5df4ce['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x3f915c?'':'\x20ck-hidden')]});}),_0x5df4ce;}['_createUrlInputField'](){const _0x5f2737=new qt(this['locale'],_0x26acbe);return _0x5f2737['set']({'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x5f2737['fieldView']['set']({'placeholder':us(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x5f2737;}['_createConfirmButton'](){const _0x1532a1=new Ht(this['locale']);return _0x1532a1['set']({'icon':_0x324330,'tooltip':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x1532a1;}['_setupTemplate'](){const _0x3f015a=new Ft(this['locale'],{'label':us(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3f015a['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':eo,'tabindex':'-1'},'children':[_0x3f015a,{'tag':'div','attributes':{'class':io},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x169082=>{_0x169082['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x1fa150,_0x215448)=>{this['clear'](),this['fire']('cancel'),_0x215448();});}['_handleSubmit'](){const _0x548d43=this['getValue']()['trim']();_0x548d43?this['_isValidUrl'](_0x548d43)?(this['clearError'](),this['fire']('submitUrl',_0x548d43)):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](us(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x3b9a8c=this['getValue']()['trim'](),_0x336e9a=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x3b9a8c['length']>0x0&&!_0x336e9a;}['_isValidUrl'](_0x24fcd4){try{return!!new URL(_0x24fcd4);}catch{return!0x1;}}};const no='ck-ai-chat-resources__item',ro='ck-ai-chat-resources__item--in-context',oo='ck-ai-chat-resources__item-title',ao='ck-ai-chat-resources__item__icon';var ho=class extends zt{['resource'];['_titleView'];['_iconView'];constructor(_0x5af1d8,_0x148ce9){super(_0x5af1d8),this['resource']=_0x148ce9,this['set']('isInContext',!!_0x148ce9['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x29b6c4){if(_0x29b6c4['isInContext'])return _0x324330;switch(_0x29b6c4['type']){case'document':return _0x51d1ff;case'web-resource':return _0x4cbb19;case'file':case'text':return _0x209362;default:return _0x550d85;}}['highlightText'](_0x424d5c){if(!_0x424d5c||''===_0x424d5c['trim']())return void this['_titleView']['highlightText'](null);const _0x2541fb=new RegExp(_0x2444d5(_0x424d5c),'gi');this['_titleView']['highlightText'](_0x2541fb);}['updateResourceState'](_0x40f5f1){this['resource']['isInContext']=_0x40f5f1,this['isInContext']=_0x40f5f1,this['_updateIcon']();}['_createTitleView'](){const _0xc78bbb=new Wt();return _0xc78bbb['text']=this['resource']['label'],_0xc78bbb['extendTemplate']({'tag':'span','attributes':{'class':[oo]}}),_0xc78bbb;}['_createIconView'](){const _0x33452e=new Yt();return _0x33452e['content']=this['getResourceIcon'](this['resource']),_0x33452e;}['_setupTemplate'](){const _0x44565c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[no,_0x44565c['if']('isVisible','ck-hidden',_0x881626=>!_0x881626),_0x44565c['if']('isInContext',ro)]},'children':[{'tag':'div','attributes':{'class':[ao]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x44565c['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const co='ck-ai-chat-resources__list';var lo=class extends jt{['_source'];constructor(_0xde4a82,_0x284840){super(_0xde4a82),this['_source']=_0x284840,this['extendTemplate']({'attributes':{'class':[co]}});}['setResources'](_0x61b8f7,_0x577126){this['items']['clear']();let _0x1fa787=_0x61b8f7;if(this['_source']['useDefaultFiltering']&&_0x577126&&''!==_0x577126['trim']()){const _0x3c292c=new RegExp(_0x577126['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x1fa787=_0x61b8f7['filter'](_0x121ecf=>_0x3c292c['test'](_0x121ecf['label']));}for(const _0x2f3e07 of _0x1fa787){const _0x32f613=new ho(this['locale'],_0x2f3e07);_0x32f613['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x2f3e07);}),this['items']['add'](_0x32f613);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x577126);}['highlightText'](_0x3875d7){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x3e17c0=>{_0x3e17c0['highlightText'](_0x3875d7);});}['updateResourceState'](_0x225c74,_0x130076){for(const _0x561464 of this['items']){const _0x40665b=_0x561464;_0x40665b['resource']['id']===_0x225c74&&_0x40665b['updateResourceState'](_0x130076);}}['_handleResourceSelection'](_0x342086,_0xd7025c){this['fire']('addResourceToContext',{'source':_0x342086,'resource':_0xd7025c});}},uo=class extends qt{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x112e66){const t=_0x112e66['t'],_0x178e51={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x26acbe,'label':us(_0x112e66,'AI_CHAT_SEARCH_RESOURCES')};super(_0x112e66,_0x178e51['creator']),this['label']=_0x178e51['label'],this['_viewConfig']=_0x178e51,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x112e66,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x4c7dca){this['fire']('search',_0x4c7dca);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Yt(),this['iconView']['content']=_0x5b13ba,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x5c19bc,t){this['resetButtonView']=new Ht(_0x5c19bc),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x16ce26,'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',_0x35ee85=>!_0x35ee85),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}},_o=class extends _0x2bc1f3{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x393ac1,_0x10f785){super(_0x393ac1),this['_source']=_0x10f785['source'],this['_searchInputVisibleFrom']=_0x10f785['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 _0x17d17e([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new uo(this['locale']);}['_createSearchSection'](){const _0x261414=new _0x2bc1f3(this['locale']);return _0x261414['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x2b3cdb,_0xb96666)=>{this['loadResources'](_0xb96666),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0xb96666);}),_0x261414;}['_createResourcesListView'](){const _0x19f296=new lo(this['locale'],this['_source']);return _0x19f296['delegate']('addResourceToContext')['to'](this),_0x19f296['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x19f296;}['_createSkeletonView'](){const _0x1afd2a=new zn(this['locale'],jn['aiChatResources']);return _0x1afd2a['bind']('isVisible')['to'](this,'isLoading'),_0x1afd2a;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4f35d7){const _0x384a39=vt();this['_latestLoadResourcesUid']=_0x384a39,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4f35d7,'uid':_0x384a39}),this['isLoading']=!0x0;}['setResources'](_0x460953,_0x2b46a9){if(_0x2b46a9&&_0x2b46a9!==this['_latestLoadResourcesUid'])return;const _0x5e0fc9=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x460953,_0x5e0fc9),_0x460953['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0xd2744,_0x5b76a1){this['_resourcesListView']['updateResourceState'](_0xd2744,_0x5b76a1);}};const go='ck-ai-chat-context-controls__source-balloon-panel',Ao='ck-button-icon\x20ck-button-back',Io='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var po=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x1059dd,_0x29476e,_0x24c9ac){this['_locale']=_0x1059dd,this['_bodyCollection']=_0x29476e,this['_config']=_0x24c9ac;}['showSourceResourcesBalloon']({source:_0x3f6dec,withBackButton:_0x537100}){let _0x5390b2=this['_sourceResourceBalloons']['get'](_0x3f6dec['id']);_0x5390b2||(_0x5390b2=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x3f6dec['id'],_0x5390b2),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x5390b2)),this['_addSourceResourceContent']({'balloonPanel':_0x5390b2,'source':_0x3f6dec,'withBackButton':_0x537100}),_0x5390b2['show']();const _0x37f81=this['_config']['getTargetElement']();_0x37f81&&_0x5390b2['pin']({'target':_0x37f81,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x983035,_0x1cd157,_0x4bffef){const _0x56d8ea=this['_sourceResourceBalloons']['get'](_0x983035);if(!_0x56d8ea)return;const _0x203c28=this['_getResourcesViewFromBalloon'](_0x56d8ea);_0x203c28&&(_0x203c28['setResources'](_0x1cd157,_0x4bffef),_0x203c28['once']('change:isLoading',()=>{_0x56d8ea['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x544347){const _0x51141d=this['_sourceResourceBalloons']['get'](_0x544347);_0x51141d&&requestAnimationFrame(()=>{_0x51141d['hide'](),this['_sourceResourceBalloons']['delete'](_0x544347),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x22d9c0 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x22d9c0);}['isAnyResourceBalloonVisible'](){for(const _0x46f1e4 of this['_sourceResourceBalloons']['values']())if(_0x46f1e4['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x3f5bc1,_0x2cfe7a,_0x3493d4){const _0xb661ec=this['_sourceResourceBalloons']['get'](_0x3f5bc1);if(!_0xb661ec||!_0xb661ec['isVisible'])return;const _0x586dc1=this['_config']['getTargetElement']();if(!_0x586dc1)return;_0xb661ec['pin']({'target':_0x586dc1,'limiter':this['_config']['getLimiterElement']()});const _0x5a4b8f=this['_getResourcesViewFromBalloon'](_0xb661ec);_0x5a4b8f&&_0x5a4b8f['updateResourceState'](_0x2cfe7a,_0x3493d4);}['destroy'](){for(const _0x12cf97 of this['_sourceResourceBalloons']['values']())_0x12cf97['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0xb2dc87=new yt(this['_locale']);return _0xb2dc87['extendTemplate']({'attributes':{'class':go}}),this['_bodyCollection']['add'](_0xb2dc87),_0xb2dc87;}['_addSourceResourceContent']({balloonPanel:_0x42c304,source:_0x132ff2,withBackButton:_0x4c562d}){_0x42c304['content']['clear']();const _0x2634c4=this['_createBalloonHeader']({'balloonPanel':_0x42c304,'source':_0x132ff2,'withBackButton':_0x4c562d});_0x42c304['content']['add'](_0x2634c4);const _0x176a7b=this['_createBalloonResourcesView'](_0x132ff2);_0x42c304['content']['add'](_0x176a7b);}['_createBalloonHeader']({balloonPanel:_0x7c0558,source:_0xf16c3,withBackButton:_0x527c2f}){const _0x36d43f=new Ft(this['_locale'],{'label':_0xf16c3['label'],'class':Io});return _0x527c2f&&_0x36d43f['children']['add'](this['_createBackButton'](_0x7c0558),0x0),_0x36d43f;}['_createBackButton'](_0x449e41){const _0x39e74e=new Ht(this['_locale']);return _0x39e74e['set']({'icon':_0x3606c6,'tooltip':us(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Ao}),_0x39e74e['on']('execute',()=>{_0x449e41['hide'](),this['_config']['onBackToContext']();}),_0x39e74e;}['_createBalloonResourcesView'](_0x205a8d){const _0xa277a7=new _o(this['_locale'],{'source':_0x205a8d,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xa277a7['on']('loadSourceResources',(_0x10eaf7,_0x42adea)=>{this['_config']['onLoadSourceResources'](_0x42adea);}),_0xa277a7['on']('addResourceToContext',(_0x40208f,_0x46ccfa)=>{this['_config']['onResourceSelected'](_0x46ccfa['source'],_0x46ccfa['resource']),this['closeSourceResourceBalloon'](_0x205a8d['id']);}),_0xa277a7;}['_getResourcesViewFromBalloon'](_0x5ef1b2){const _0x261086=_0x5ef1b2['content']['get'](0x1);return _0x261086 instanceof _o?_0x261086:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x238c70){_0xf3e5e2({'emitter':_0x238c70,'contextElements':[_0x238c70['element']],'callback':()=>{_0x238c70['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x238c70['isVisible']});}};const mo=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Eo='ck-ai-chat-context-controls',To='ck-ai-chat-context-controls__pending-contexts',wo='ck-ai-chat-context-controls__add-context-balloon-panel',Co='ck-ai-chat-context-controls__add-context-button',fo='ck-ai-chat-context-controls__url-balloon-panel',bo='ck-ai-chat-context-controls__balloon-button',So='ck-ai-chat-context-controls__balloon-button-source',Ro='ck-ai-chat-controls-button',Oo='ck-ai-chat-context-chips-wrapper-balloon',vo='ck-ai-chat-controls_context_show-more-button',ko='ck-ai-chat-context-controls__show-more-balloon-panel',No='ck-ai-chat',yo=[yt['defaultPositions']['northArrowSouthWest'],yt['defaultPositions']['northArrowSouth'],yt['defaultPositions']['northArrowSouthEast'],yt['defaultPositions']['southArrowNorthWest'],yt['defaultPositions']['southArrowNorth'],yt['defaultPositions']['southArrowNorthEast']];var xo=class extends _0x2bc1f3{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x34508d,_0x38a2dc){super(_0x34508d),this['bodyCollection']=_0x38a2dc['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x34508d),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x34508d),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x34508d),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x34508d,_0x38a2dc);const _0x117e78={'cssClasses':{'showMoreButton':vo+'\x20'+ln,'showMoreBalloon':ko,'overflowContainer':Oo,'controlsButton':Ro}};this['_overflowManager']=new fr(_0x34508d,this['_currentContextsChips'],_0x117e78,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'](_0x48a510,_0x524e05){const _0x8776fb=this['_createContextButton'](_0x48a510,'current',!0x0,_0x524e05);this['_addContextToCollection'](_0x8776fb,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x79e2bb){this['_removeContextFromCollection'](_0x79e2bb,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x79e2bb,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x520428,_0x3b4191){let _0x440ee3=this['_currentContextsChips']['find'](_0x1e5076=>_0x1e5076['id']===_0x520428);_0x440ee3||(_0x440ee3=this['_overflowManager']['overflowChips']['find'](_0x514966=>_0x514966['id']===_0x520428)),_0x440ee3&&(_0x440ee3['isLoading']=_0x3b4191);}['setConversationContext'](_0x1746bd){this['_conversationContextsChips']['clear']();for(const _0x3e1c0c of _0x1746bd){const _0x5fb94b=this['_createContextButton'](_0x3e1c0c,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x5fb94b,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x670ebb,_0xaa4e7b,_0x22eb69){this['_resourcesBalloonView']['updateResourceState'](_0x670ebb,_0xaa4e7b,_0x22eb69);}['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:_0x22cf0d,withBackButton:_0x2d3f2e}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x22cf0d,'withBackButton':_0x2d3f2e}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x3b686c,_0x419634,_0x5bbf38,_0x191423){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x3b686c,_0x5bbf38,_0x191423);}['closeSourceResourceBalloon'](_0x9b1ced){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x9b1ced),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x357382){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x357382),this['_setAddContextButtonEnabled'](_0x357382);}['_setAddContextButtonEnabled'](_0x186323){const _0x5d47eb=!_0x186323['document']['isHidden']&&_0x186323['document']['enabled'],_0x42dbc3=_0x186323['urls']['enabled'],_0x283b23=_0x186323['files']['enabled'],_0x1bb11d=_0x186323['sources']['length']>0x0,_0x2a9d12=_0x186323['customItems']&&_0x186323['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x5d47eb||_0x42dbc3||_0x283b23||_0x1bb11d||_0x2a9d12;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Eo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':To},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x2c386a){const _0x4674de=new Ht(_0x2c386a);return _0x4674de['set']({'label':us(_0x2c386a,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ro+'\x20'+Co+'\x20'+ln,'icon':_0x12f599,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x4674de;}['_createAddContextBalloonPanelView'](_0x4c8dbd){return this['_createBaseBalloonPanel'](_0x4c8dbd,wo);}['_createUrlBalloonPanelView'](_0x3fbf04){const _0x564f39=this['_createBaseBalloonPanel'](_0x3fbf04,fo);return this['_addUrlContent'](_0x564f39,_0x3fbf04),_0x564f39;}['_createResourcesBalloonView'](_0x2046fa,_0x54b16d){const _0x339b8f={'searchInputVisibleFrom':_0x54b16d['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});},'onResourceSelected':(_0x518937,_0x1823e1)=>{this['fire']('addResourceToContext',{'source':_0x518937,'resource':_0x1823e1});},'onLoadSourceResources':_0x1b5ff5=>{this['fire']('loadSourceResources',_0x1b5ff5);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new po(_0x2046fa,_0x54b16d['bodyCollection'],_0x339b8f);}['_getLimiterElement'](){return this['element']?.['closest']('.'+No)||document['body'];}['_createBaseBalloonPanel'](_0x38948b,_0x43242e){const _0x4651d7=new yt(_0x38948b);return _0x4651d7['extendTemplate']({'attributes':{'class':_0x43242e}}),this['bodyCollection']['add'](_0x4651d7),_0x4651d7;}['_setBalloonPanelContent'](_0x51f144,_0x3b8555,_0x1049da){if(_0x51f144['content']['clear'](),!_0x1049da['document']['isHidden']&&_0x1049da['document']['enabled']){const _0x48194d=this['_createBalloonButton'](_0x3b8555,{'label':us(_0x3b8555,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x51d1ff});_0x48194d['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x51f144['content']['add'](_0x48194d);}if(_0x1049da['urls']['enabled']){const _0x313a9b=this['_createBalloonButton'](_0x3b8555,{'label':us(_0x3b8555,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x4cbb19});_0x313a9b['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_urlInputView']['focus']();}),_0x51f144['content']['add'](_0x313a9b);}if(_0x1049da['files']['enabled']){const _0x14995b=new Bt(_0x3b8555);_0x14995b['set']({'label':us(_0x3b8555,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x5cb106,'withText':!0x0,'tooltip':!0x0,'class':bo,'allowMultipleFiles':!0x0}),_0x14995b['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x14995b['on']('done',(_0x48be0d,_0x44abad)=>{this['fire']('addFileToContext',_0x44abad);}),_0x14995b['tooltip']=!0x0,_0x51f144['content']['add'](_0x14995b);}for(const _0x2ca166 of _0x1049da['sources']){const _0x1738f0=this['_createBalloonButton'](_0x3b8555,{'label':_0x2ca166['label'],'icon':_0x2ca166['icon']||_0x550d85,'type':'source'});_0x51f144['content']['add'](_0x1738f0),_0x1738f0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x2ca166,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x483361 of _0x1049da['customItems']||[]){const _0x1d68ae=this['_createBalloonButton'](_0x3b8555,{'label':_0x483361['label'],'icon':_0x483361['icon']||_0x550d85,'type':'customItem'});_0x51f144['content']['add'](_0x1d68ae),_0x1d68ae['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x483361);});}this['_hasExactlyOneSource']=0x1===_0x51f144['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x58cd84,_0x25f9f7){this['_urlInputView']=new so(_0x25f9f7),this['_urlInputView']['on']('submitUrl',(_0x2c3ce1,_0x2dad50)=>{this['_handleUrlSubmit'](_0x2dad50);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo});}),_0x58cd84['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x5a8ba4,_0x1e7414){const _0x3896e9='source'===_0x1e7414['type']?new Lo(_0x5a8ba4):new Ht(_0x5a8ba4);return _0x3896e9['set']({'label':_0x1e7414['label'],'icon':_0x1e7414['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':bo}),_0x3896e9;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0xf3e5e2({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x4536a5){const _0xf8b23b=this['_addContextBalloonConfig'];_0xf8b23b['buttonView']['isOn']=_0x4536a5,_0x4536a5?_0xf8b23b['balloonView']['show']():_0xf8b23b['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x3ea0d5,buttonView:_0x49f134,hideMethod:_0x3f7717}=this['_addContextBalloonConfig'];_0xf3e5e2({'emitter':_0x3ea0d5,'contextElements':[_0x3ea0d5['element'],_0x49f134['element']],'callback':()=>{_0x3f7717();},'activator':()=>_0x49f134['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x1ea8be,_0x34d162,_0x1acc86=!0x1,_0x14aabb=!0x1){const _0x420d0a='conversation'===_0x34d162||!0x0===_0x1ea8be['isReadOnly'],_0x1c7614=new Er(this['locale'],_0x1ea8be,_0x420d0a,_0x1acc86,_0x14aabb);return _0x420d0a||_0x1c7614['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x1c7614['id']);}),_0x1c7614;}['_addContextToCollection'](_0x1df7ad,_0x1fb0af){_0x1fb0af['add'](_0x1df7ad,0x0);}['_removeContextFromCollection'](_0x3ec6b7,_0x522cdc){const _0x590578=_0x522cdc['find'](_0x2c1ef1=>_0x2c1ef1['id']===_0x3ec6b7);_0x590578&&_0x522cdc['remove'](_0x590578);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':yo}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x175c1a){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x175c1a);}},Lo=class extends Ht{['arrowView'];constructor(_0x216b45){super(_0x216b45),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[So]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x3c168a=new Yt();return _0x3c168a['content']=_0x27e475,_0x3c168a['extendTemplate']({'attributes':{'class':So+'__arrow'}}),_0x3c168a;}},Do=class extends _0x2bc1f3{['_cancelButtonView'];['_loaderView'];constructor(_0x33fbfb){super(_0x33fbfb),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 _0x4b79b2=new Ht(this['locale']);return _0x4b79b2['set']({'label':us(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':cn+'\x20ck-ai-button-stop-generating','icon':it}),_0x4b79b2['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x4b79b2;}['_createLoaderView'](){const _0x5c7982=new _0x2bc1f3(this['locale']);return _0x5c7982['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':us(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x5c7982;}},Po=class extends _0x2bc1f3{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x54fe62,_0x56ef19){super(_0x54fe62),this['_filesEnabled']=_0x56ef19['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x54fe62,{'bodyCollection':_0x56ef19['bodyCollection'],'searchInputVisibleFrom':_0x56ef19['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x54fe62),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x54fe62),this['_loaderView']=this['_createLoaderView'](_0x54fe62),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x54fe62),this['_dropZoneView']=new Kr(_0x54fe62),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...mo)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x35026b=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x35026b['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x35026b['if']('isLoading','ck-hidden',_0x289bd4=>_0x289bd4||!this['isModelAvailable']),_0x35026b['if']('isModelAvailable','ck-hidden',_0x370d39=>!_0x370d39||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x35026b['if']('isLoading','ck-hidden',_0x39446b=>!_0x39446b)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x35026b['if']('isModelAvailable','ck-hidden',_0x55d4a5=>_0x55d4a5)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0xf3e5e2({'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'](_0x3010d8,_0x1298c1){return new xo(_0x3010d8,_0x1298c1);}['_createPromptInputView'](_0x1bec95){return new Fr(_0x1bec95,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x268836){return new Jr(_0x268836);}['_createLoaderView'](_0x43a822){return new Do(_0x43a822);}['_createModelUnavailableMessageView'](_0x70bcc7){const _0xe5d6f3=new Ho(_0x70bcc7);return _0xe5d6f3['delegate']('startConversation')['to'](this),_0xe5d6f3;}['_handlePromptInputFocus'](_0x26adff,_0x5feca8,_0x2320cf){_0x2320cf?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x1bfabc,_0x29be8f){this['_contextPanelView']['addContextItem'](_0x1bfabc,_0x29be8f);}['removeContextItem'](_0x26a7eb){this['_contextPanelView']['removeContextItem'](_0x26a7eb);}['setContextItemLoading'](_0x542bdc,_0x47d07a){this['_contextPanelView']['setContextItemLoading'](_0x542bdc,_0x47d07a);}['setIsUploadInProgress'](_0x2d46ab){this['_promptInputView']['setIsUploadInProgress'](_0x2d46ab);}['setConversationContext'](_0xffefe8){this['_contextPanelView']['setConversationContext'](_0xffefe8);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x46a31a,_0x395ea2,_0x1e1a17){this['_contextPanelView']['updateResourceState'](_0x46a31a,_0x395ea2,_0x1e1a17);}['setWebSearch'](_0x4c004a){this['_promptCapabilitiesView']['setWebSearch'](_0x4c004a);}['setReasoning'](_0x573959){this['_promptCapabilitiesView']['setReasoning'](_0x573959);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x4efd46){this['_contextPanelView']['setAddContextOptions'](_0x4efd46);}['setInputPlaceholder'](_0x2e94a5){this['_promptInputView']['setPlaceholderText'](_0x2e94a5);}['setModelList'](_0x1b4286,_0x1dcfba){this['_promptCapabilitiesView']['setModelList'](_0x1b4286,_0x1dcfba);}['setModel'](_0x3edd49){_0x3edd49?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x3edd49)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x139161){this['_promptCapabilitiesView']['disableModelSelector'](_0x139161);}['populateSourceResourceBalloon'](_0x46b675,_0x20017b,_0x57c236,_0x6269ec){this['_contextPanelView']['populateSourceResourceBalloon'](_0x46b675,_0x20017b,_0x57c236,_0x6269ec);}['closeSourceResourceBalloon'](_0x3120fb){this['_contextPanelView']['closeSourceResourceBalloon'](_0x3120fb);}['focusPromptInput'](_0x1a0f08=!0x1){this['_promptInputView']['focus'](_0x1a0f08);}['setPromptInputValue'](_0x52d425){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x52d425;}},Ho=class extends _0x2bc1f3{constructor(_0x485679){super(_0x485679);const _0x420add=new Ht(_0x485679);_0x420add['set']({'label':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x420add['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':us(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x420add]}]});}},Mo=class extends Ft{['resizeButton'];constructor(_0x52ac76,_0x6470f0){super(_0x52ac76,{'label':_0x6470f0['label'],'class':'ck-ai-header\x20'+_0x6470f0['class'],'icon':_0x6470f0['icon']}),this['set']('isMaximized',!0x1),_0x6470f0['content']&&this['children']['add'](_0x6470f0['content']),_0x6470f0['showResizeButton']&&(this['resizeButton']=un(_0x52ac76,this),this['children']['add'](this['resizeButton']));}},Vo=class extends _0x2bc1f3{constructor(_0x9ce5e2){super(_0x9ce5e2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':us(_0x9ce5e2,'AI_DISCLAIMER_TEXT')}]}]});}};function Uo(_0x3df638,_0x17bbde){const _0x2b6257=new Ht(_0x3df638);return _0x2b6257['set']({'label':us(_0x3df638,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x2fe3ad,'class':'ck-ai-chat__start-conversation\x20'+cn}),_0x2b6257['on']('execute',()=>{_0x17bbde['fire']('startConversation');}),_0x2b6257;}var Bo=class extends _0x2bc1f3{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x3785a0,_0x2252a0){super(_0x3785a0),this['_bodyCollection']=dn(_0x3785a0);const _0x310846=Uo(_0x3785a0,this);this['chatHeader']=new Mo(_0x3785a0,{'label':us(_0x3785a0,'AI_CHAT_HEADING'),'icon':_0x480028,'class':'ck-ai-header_chat','content':_0x310846,'showResizeButton':_0x2252a0['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Vr(_0x3785a0,this['_bodyCollection']),this['chatFeed']['delegate'](...xn)['to'](this),this['chatControls']=new Po(_0x3785a0,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2252a0['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2252a0['filesEnabled']}),this['chatControls']['delegate'](...xn)['to'](this),this['chatDisclaimer']=new Vo(_0x3785a0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x3785a0['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x3cb956,_0x4dbbe4,_0x4b6e44,_0x3a5bb2){this['chatControls']['populateSourceResourceBalloon'](_0x3cb956,_0x4dbbe4,_0x4b6e44,_0x3a5bb2);}['closeSourceResourceBalloon'](_0x3fd4b3){this['chatControls']['closeSourceResourceBalloon'](_0x3fd4b3);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Go=class extends _0x394201{static get['requires'](){return[cs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x38c672){super(_0x38c672);const _0x3482c7=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new tr(),this['_view']=new Bo(this['context']['locale'],{'showResizeButton':_0x3482c7['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'](_0x3482c7),this['_view']['delegate'](...xn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x1e786d,{showDiff:_0x1412e5})=>{this['showDiff']=_0x1412e5;}),this['disableControls'](),_0x3482c7['view']['addTab']({'id':'chat','buttonLabel':us(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x480028,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x3482c7['view'],'isMaximized',_0x220f28=>_0x220f28),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0xb806e1=>_0xb806e1),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x3439cf){const _0x43e4c2=this['context']['config']['get']('ai.chat.welcomeMessage')??us(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x3439cf['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x43e4c2}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x13925a,staticMessage:_0x483efb}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x13925a,'initialContent':'<p>'+_0x483efb+'</p>'});});}async['addFeedItemUserMessage'](_0xd00482){const _0x2212e4=_0xd00482['attributes']?.['displayedPrompt']||_0xd00482['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xd00482['contextItems']['values']()),'initialContent':'<p>'+_0x2212e4+'</p>','id':_0xd00482['id']});});}async['addFeedItemError']({errorMessage:_0x38a2d5,id:_0x3a2251}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x38a2d5+'</p>','id':_0x3a2251});});}async['addFeedItemAIReply'](_0x13d2fc){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x13d2fc['interactionId']+':'+_0x13d2fc['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x359017){const _0x10f7b1=ds(this['context']),_0x167107=_0x10f7b1['map'](_0x4ebde0=>_0x4ebde0['config']['get']('ai.availableReplyActions')||[...ir]);let _0x391c04=_0x167107['reduce']((_0x237473,_0x4542d0)=>_0x237473['filter'](_0x1a3c75=>_0x4542d0['includes'](_0x1a3c75)),_0x167107[0x0]||[...ir]);const _0x2cf925=_0x10f7b1['every'](_0x228d65=>_0x228d65['plugins']['has']('TrackChanges')),_0x45d92d=_0x10f7b1['map'](_0x1e7a33=>_0x1e7a33['commands']['get']('trackChanges'));return _0x2cf925?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x45d92d,'value',(..._0x554940)=>_0x554940['some'](_0x5a9086=>_0x5a9086))):_0x391c04=_0x391c04['filter'](_0x20d176=>'insertSuggestion'!=_0x20d176),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x359017['interactionId']+':'+_0x359017['id'],'areActionsDisabled':_0x359017['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x391c04}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x5ed26b,_0x1317e0){return this['_promiseQueue']['enqueue'](async()=>{const _0x3e1a31=this['_view']['chatFeed']['children']['last'];if(_0x3e1a31 instanceof xr)return this['_view']['chatFeed']['children']['remove'](_0x3e1a31),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x5ed26b['id'],'capabilities':{'isWebSearchEnabled':_0x3e1a31['capabilities']['isWebSearchEnabled']||_0x1317e0['isWebSearchEnabled'],'isReasoningEnabled':_0x3e1a31['capabilities']['isReasoningEnabled']||_0x1317e0['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x5ed26b['id'],'capabilities':_0x1317e0});});}async['addFeedItemCustomElement'](_0x1ad1e1,_0x451795){let _0x43f94f;return await this['_promiseQueue']['enqueue'](async()=>{_0x43f94f=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x1ad1e1,'id':_0x451795});}),_0x43f94f;}['removeFeedItem'](_0x253970){this['_view']['chatFeed']['removeItem'](_0x253970);}['hasFeedItem'](_0x373e6){return this['_view']['chatFeed']['hasItem'](_0x373e6);}['updateFeedInteractionHeader'](_0x32ca23){const _0x57bf23=this['_view']['chatFeed']['children']['find'](_0x11d0a7=>_0x11d0a7['options']['id']==_0x32ca23['id']&&_0x11d0a7 instanceof xr);_0x57bf23&&_0x57bf23['set']('isVisible',_0x32ca23['isVisible']);}async['updateFeedItemAIReplyContent'](_0x45ac7b){const _0x15e5a6=_0x45ac7b['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x243cfb=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x45ac7b,'abortSignal':_0x243cfb,'renderingStrategy':_0x15e5a6}),_0x45ac7b['isDone']&&this['markFeedItemAsDone'](_0x45ac7b['id']);});}['updateFeedItemAIReplySources'](_0x472ed8,_0x5457f0){this['_view']['chatFeed']['updateWebSources'](_0x472ed8,_0x5457f0);}async['updateFeedItemAIReplySuggestionContent'](_0x2a9d36){return this['_promiseQueue']['enqueue'](async _0x46d047=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x2a9d36,'abortSignal':_0x46d047}),_0x2a9d36['isDone']&&this['markFeedItemAsDone'](_0x2a9d36['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x37121e){this['_view']['chatFeed']['updateSuggestionPartState'](_0x37121e);}['setFeedItemAIReplySuggestionPartActive'](_0x143553){this['_view']['chatFeed']['setSuggestionPartActive'](_0x143553);}['markFeedItemAsDone'](_0x5692a4){this['_view']['chatFeed']['markItemAsDone'](_0x5692a4);}['removeFeedInteraction'](_0x3d47e2){this['_view']['chatFeed']['getItemIds']()['filter'](_0x5f4094=>_0x5f4094['startsWith'](_0x3d47e2))['forEach'](_0x59c34b=>this['_view']['chatFeed']['removeItem'](_0x59c34b));}['startInteraction'](){const _0x2db91f=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x2db91f),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x5086c9){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x2d8c6e=>_0x2d8c6e['startsWith'](_0x5086c9['id']))['forEach'](_0xe28352=>this['markFeedItemAsDone'](_0xe28352)),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'](_0x4c512f,_0x2345f2){this['_view']['chatControls']['addContextItem'](_0x4c512f,_0x2345f2);}['removeContextItem'](_0x2c1694){this['_view']['chatControls']['removeContextItem'](_0x2c1694);}['setContextItemLoading'](_0x5510f9,_0xed226f){this['_view']['chatControls']['setContextItemLoading'](_0x5510f9,_0xed226f);}['setIsUploadInProgress'](_0x3a3014){this['_view']['chatControls']['setIsUploadInProgress'](_0x3a3014);}['setConversationContext'](_0x4c2975){this['_view']['chatControls']['setConversationContext'](_0x4c2975);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x2bd060,_0x4833bc,_0x318713){this['_view']['chatControls']['updateResourceState'](_0x2bd060,_0x4833bc,_0x318713);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x1ac81b){this['_view']['chatControls']['setAddContextOptions'](_0x1ac81b);}['updateCapabilities'](_0x22cd9f){this['_view']['chatControls']['setWebSearch'](_0x22cd9f['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x22cd9f['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x22cd9f));}['setSelectedModel'](_0x33b217,_0x43ce40){this['_view']['chatControls']['setModel'](_0x33b217),_0x43ce40&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x589cdf){this['feedItemRenderingStrategy']=_0x589cdf;}['toggleLoadingSkeleton'](_0x284f8c){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x284f8c);}['resetConversationTitle'](){this['setConversationTitle'](us(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x2f03af,_0x2e1c92=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x2e1c92&&!pt()&&_0x2f03af['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x2f03af);this['_view']['chatHeader']['label']=_0x2f03af;}['setLoadingMessage'](_0xabb059){this['_view']['chatFeed']['setLoadingMessage'](_0xabb059);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x6bae9b){let _0x1ff50f=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x6bae9b[_0x1ff50f],_0x1ff50f++,_0x1ff50f===_0x6bae9b['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x42c0c){return _0x42c0c['isWebSearchEnabled']&&_0x42c0c['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x42c0c['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x42c0c['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):us(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x26928a){return _0x26928a?_0x26928a['isWebSearchEnabled']&&_0x26928a['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x26928a['isWebSearchEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x26928a['isReasoningEnabled']?us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):us(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x594f8d,_0x3f493c,_0xf9616e,_0x4fdb31){this['_view']['populateSourceResourceBalloon'](_0x594f8d,_0x3f493c,_0xf9616e,_0x4fdb31);}['closeSourceResourceBalloon'](_0x361d92){this['_view']['closeSourceResourceBalloon'](_0x361d92);}['setPromptInputValue'](_0x2c481f){this['_view']['chatControls']['setPromptInputValue'](_0x2c481f);}['focusPromptInput'](_0x4613fd=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x4613fd);}['scrollFeedToSuggestion'](_0x4eedbf,_0x1332ea){this['_view']['chatFeed']['scrollToSuggestion'](_0x4eedbf,_0x1332ea);}['startAutoScroll'](_0x5d9847={}){this['_view']['chatFeed']['startAutoScroll'](_0x5d9847);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Fo=class extends jt{['sections'];constructor(_0x46f370,_0x4b96d5){super(_0x46f370),this['sections']=_0x4b96d5,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x59c407){let _0x3d3fbc=0x0,_0x2ec85d=0x0;for(const _0x5bc770 of this['sections']){const {resultsCount:_0x191b02,totalItemsCount:_0x3b874e}=_0x5bc770['filter'](_0x59c407);_0x3d3fbc+=_0x191b02,_0x2ec85d+=_0x3b874e;}return{'resultsCount':_0x3d3fbc,'totalItemsCount':_0x2ec85d};}},Ko=class extends zt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x1d605e,{title:_0x267eed,items:_0x1cca0b}){super(_0x1d605e);const _0x5e048f=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x267eed,this['itemsViews']=_0x1cca0b;const _0x1895e7=new _0x2bc1f3(_0x1d605e);_0x1895e7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new jt(_0x1d605e),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x5e048f['if']('isVisible','ck-hidden',_0x855907=>!_0x855907)]},'children':[_0x1895e7,this['_itemsListView']]});}['filter'](_0x43c37c){const _0x387ffe=this['itemsViews']['length'];let _0x2b9487=0x0;for(const _0xd811e6 of this['itemsViews'])_0x43c37c?(_0xd811e6['isVisible']=!!_0xd811e6['isMatching'](_0x43c37c),_0xd811e6['highlightText'](_0x43c37c)):(_0xd811e6['isVisible']=!0x0,_0xd811e6['highlightText'](null)),_0xd811e6['isVisible']&&_0x2b9487++;return this['isVisible']=_0x2b9487>0x0,{'resultsCount':_0x2b9487,'totalItemsCount':_0x387ffe};}['getItem'](_0x5bde7d){return this['itemsViews']['find'](_0x190867=>_0x190867['id']===_0x5bde7d);}['removeItem'](_0x2ec940){const _0x167516=this['itemsViews']['indexOf'](_0x2ec940);-0x1!==_0x167516&&(this['itemsViews']['splice'](_0x167516,0x1),this['_itemsListView']['items']['remove'](_0x2ec940));}};const Wo=/* #__PURE__ -- @preserve */
34
+ _0x2e5226(zt);var Yo=class AIChatHistoryListItemView extends Wo{['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x3b0aa5,_0x94f536){super(_0x3b0aa5);const _0x2aea3b=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x94f536['pinned']),this['set']('loadingState',null),this['set']('title',_0x94f536['title']),this['id']=_0x94f536['id'];const {createdAt:_0x7820f6,active:_0x1dd5d7=!0x1}=_0x94f536;this['_titleView']=new Wt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x1afbb6=this['_createCheckView'](),_0x4f2fcb=this['_createPinButtonView'](_0x3b0aa5),_0x39b8b3=this['_createMenuDropdownView'](),_0x597d8b=this['_createEditInputView'](_0x3b0aa5),_0x1c11ca=this['_createAcceptEditButtonView'](_0x3b0aa5,_0x597d8b),_0x4caf5e=this['_createCancelEditButtonView'](_0x3b0aa5);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x4f2fcb),this['actions']['add'](_0x39b8b3),this['on']('change:isEdit',(_0x3d1086,_0x1638a8,_0x43c1c7)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x43c1c7?(this['actions']['add'](_0x1c11ca),this['actions']['add'](_0x4caf5e),this['mainContent']['add'](_0x597d8b),_0x597d8b['element']['value']=this['title']||'',_0x597d8b['element']['focus']()):(this['actions']['add'](_0x4f2fcb),this['actions']['add'](_0x39b8b3),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x1dd5d7?'ck-ai-chat-history__item--active':'',_0x2aea3b['if']('isVisible','ck-hidden',_0xcb5d5=>!_0xcb5d5),_0x2aea3b['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',_0x2aea3b['if']('loadingState','ck-hidden',_0x359880=>!!_0x359880)]},'children':_0x1dd5d7?[_0x1afbb6]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x2aea3b['if']('loadingState','ck-hidden',_0x425df2=>!_0x425df2)]},'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',_0x2aea3b['if']('loadingState','ck-hidden',_0x1e7f84=>!!_0x1e7f84)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x2aea3b['if']('loadingState','ck-hidden',_0x2996=>!_0x2996)]},'children':[{'text':_0x2aea3b['to']('loadingState',_0x4c1811=>_0x4c1811?us(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x4c1811]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x7820f6]}]},{'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'](_0x2bd95f){this['set']('title',_0x2bd95f);}['updateLoadingState'](_0x3b02c8,_0x949d07){this['set']('loadingState',_0x949d07?_0x3b02c8:null);}['_createCheckView'](){const _0x64156c=new Yt();return _0x64156c['set']({'content':_0x324330}),_0x64156c;}['_createPinButtonView'](_0x51e7b1){const _0x202e98=new Ht(_0x51e7b1);return _0x202e98['set']({'label':us(_0x51e7b1,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x21c1ea,'withText':!0x1,'tooltip':!0x0}),_0x202e98['bind']('isOn')['to'](this,'pinned'),_0x202e98['on']('execute',()=>{const _0x24bbbe=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x24bbbe});}),_0x202e98;}['_createMenuDropdownView'](){const _0x323e28=_0x4e3ad4(this['locale']),_0x37a8b6=_0x323e28['panelView']['children'];_0x323e28['buttonView']['set']({'label':us(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':nt}),_0x323e28['panelPosition']='sw';const _0xed4729=new Ht(this['locale']);_0xed4729['label']=us(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xed4729['withText']=!0x0,_0xed4729['on']('execute',()=>{this['isEdit']=!0x0;});const _0x40d6df=new Ht(this['locale']);_0x40d6df['label']=us(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x40d6df['withText']=!0x0,_0x40d6df['on']('execute',()=>{this['showConfirm'](us(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x5b214d=new jt(this['locale']),_0x3efc5a=new zt(this['locale']);_0x3efc5a['children']['add'](_0xed4729);const _0xf504ea=new zt(this['locale']);return _0xf504ea['children']['add'](_0x40d6df),_0x5b214d['items']['addMany']([_0x3efc5a,_0xf504ea]),_0x37a8b6['add'](_0x5b214d),_0x323e28;}['_createEditInputView'](_0x21ca93){const _0x54d221=new $t(_0x21ca93),_0x1b9475=_0x54d221['bindTemplate'];return _0x54d221['extendTemplate']({'on':{'keydown':_0x1b9475['to'](_0x2e02f0=>{'Enter'==_0x2e02f0['key']&&this['_commitEditInputValue'](_0x54d221);})}}),_0x54d221;}['_createAcceptEditButtonView'](_0x4ae663,_0x179843){const _0xedd990=new Ht(_0x4ae663);return _0xedd990['set']({'icon':_0x324330,'withText':!0x1,'tooltip':us(_0x4ae663,'AI_CHAT_HISTORY_ACCEPT')}),_0xedd990['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0xedd990['on']('execute',()=>{this['_commitEditInputValue'](_0x179843);}),_0xedd990;}['_commitEditInputValue'](_0x346a84){const _0x7044b6=_0x346a84['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x7044b6});}['_createCancelEditButtonView'](_0xbc4b26){const _0x28ea08=new Ht(_0xbc4b26);return _0x28ea08['set']({'icon':_0x16ce26,'withText':!0x1,'tooltip':us(_0xbc4b26,'AI_CHAT_HISTORY_CANCEL')}),_0x28ea08['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x28ea08['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x28ea08;}['_createSpinnerView'](){const _0x401a86=new lr('tiny');return _0x401a86['isVisible']=!0x0,_0x401a86;}['isMatching'](_0x199b8d){return'string'==typeof this['title']&&this['title']['match'](_0x199b8d)?{'title':!0x0}:null;}['highlightText'](_0x4f4600){this['_titleView']['highlightText'](_0x4f4600);}},$o=class extends _0x2bc1f3{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x1ecba9,_0x31bca6){super(_0x1ecba9),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x5cb991=Uo(_0x1ecba9,this);this['headerView']=new Mo(_0x1ecba9,{'label':us(_0x1ecba9,'AI_CHAT_HISTORY_HEADING'),'icon':_0x4e1b6d,'class':'ck-ai-header_history','content':_0x5cb991,'showResizeButton':_0x31bca6}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Fo(_0x1ecba9,[]),this['sectionsView']['delegate'](...qo)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x4be15a=>!_0x4be15a)]}}),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 _0x2570b7=new _0x390b84(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x583f60=>us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x583f60),'secondary':us(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x8aaed2=this['_createErrorView']();return _0x8aaed2['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x27efd3=>!_0x27efd3)]}}),_0x2570b7['on']('render',()=>{_0x2570b7['children']['add'](_0x8aaed2,0x1);}),_0x2570b7['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x554b25=>!_0x554b25)]}}),_0x2570b7;}['_createSkeletonView'](){const _0x27f7e7=new zn(this['locale'],jn['aiHistory']);return _0x27f7e7['bind']('isVisible')['to'](this,'isLoading'),_0x27f7e7;}['_createErrorView'](){const _0x1b9282=new _0x2bc1f3(this['locale']),_0x44e6dd=new Ht(this['locale']);_0x44e6dd['set']({'withText':!0x1,'icon':_0x16ce26,'class':'ck-ai-notification_error__dismiss-button'}),_0x44e6dd['bind']('isVisible')['to'](this,'hasItems',_0x1f9e3c=>!!_0x1f9e3c),_0x44e6dd['on']('execute',()=>{this['errorMessage']='';});const _0x30be6a=this['bindTemplate'];return _0x1b9282['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x30be6a['to']('errorMessage')}]},_0x44e6dd]}),_0x1b9282;}['_createEmptyStateView'](){const _0x6fac89=new _0x2bc1f3(this['locale']);return _0x6fac89['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x4f1b1c=>!_0x4f1b1c)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[us(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x6fac89;}['_createListItemViews'](_0x4bae54,_0x43c5f3){const _0x101524=[];for(const _0x352c22 of _0x4bae54){const _0x3678e9=new Yo(_0x43c5f3,_0x352c22);_0x3678e9['delegate'](...qo)['to'](this),_0x101524['push'](_0x3678e9);}return _0x101524;}['updateHistoryItemsWithCategories'](_0x2ea1f6){const _0xcbf720=this['locale']||'en',_0x4057a0=[];for(const _0x499cf6 of _0x2ea1f6){const _0x4ca561=this['_createListItemViews'](_0x499cf6['items'],_0xcbf720);_0x4057a0['push'](new Ko(_0xcbf720,{'title':_0x499cf6['title'],'items':_0x4ca561}));}this['sectionsView']['sections']=_0x4057a0,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x4057a0),this['hasItems']=_0x2ea1f6['some'](_0x2e0ea0=>_0x2e0ea0['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x5957a2){for(const _0x3ba60a of this['sectionsView']['sections']){const _0x3181be=_0x3ba60a['getItem'](_0x5957a2);if(_0x3181be){if(_0x3ba60a['removeItem'](_0x3181be),0x0===_0x3ba60a['itemsViews']['length']){const _0x3431a0=this['sectionsView']['sections']['indexOf'](_0x3ba60a);-0x1!==_0x3431a0&&(this['sectionsView']['sections']['splice'](_0x3431a0,0x1),this['sectionsView']['items']['remove'](_0x3ba60a));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x43f905,_0x1541f8){for(const _0x5e75c8 of this['sectionsView']['sections']){const _0x1289ac=_0x5e75c8['getItem'](_0x43f905);if(_0x1289ac){_0x1289ac['updateTitle'](_0x1541f8);break;}}}['updateItemLoadingState'](_0x27a5f7,_0xed8056,_0x1bb728){for(const _0x482102 of this['sectionsView']['sections']){const _0x1033c9=_0x482102['getItem'](_0x27a5f7);if(_0x1033c9){_0x1033c9['updateLoadingState'](_0xed8056,_0x1bb728);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x2f27d5=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x2f27d5);}}};const qo=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Qo=class extends _0x394201{static get['requires'](){return[cs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5604d2){super(_0x5604d2);const _0x18abb1=this['context']['plugins']['get']('AITabs');this['_historyView']=new $o(this['context']['locale'],_0x18abb1['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x18abb1),this['_historyView']['delegate'](...qo)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x18abb1['view'],'isMaximized',_0x3d632d=>_0x3d632d),_0x18abb1['view']['addTab']({'id':'history','buttonLabel':us(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x4e1b6d,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x2d8783){this['_historyView']['removeHistoryItem'](_0x2d8783);}['updateItems'](_0x3293a2){this['_historyView']['updateHistoryItemsWithCategories'](_0x3293a2);}['updateItemTitle'](_0x32e802,_0x504e52){this['_historyView']['updateItemTitle'](_0x32e802,_0x504e52);}['updateItemLoadingState'](_0x1b8134,_0x1f8090,_0x107fb2){this['_historyView']['updateItemLoadingState'](_0x1b8134,_0x1f8090,_0x107fb2);}['setLoadingSkeleton'](_0x55a141){this['_historyView']['isLoading']=_0x55a141;}['showError'](_0x5334c0){this['_historyView']['errorMessage']=_0x5334c0;}['hideError'](){this['_historyView']['errorMessage']='';}};const Xo=/* #__PURE__ -- @preserve */
35
+ gt();var zo=class extends Xo{['id'];['createdAt'];constructor({id:_0x257b30,title:_0x1d857d,createdAt:_0x1b2fb8,updatedAt:_0x11ef9b,pinned:_0x39e43a}){super(),this['id']=_0x257b30,this['createdAt']=new Date(_0x1b2fb8),this['set']('title',_0x1d857d),this['set']('updatedAt',_0x11ef9b?new Date(_0x11ef9b):null),this['set']('pinned',_0x39e43a||!0x1);}['updateTitle'](_0x9b6213){this['set']('title',_0x9b6213),this['updatedAt']=new Date();}['updatePinned'](_0x421af2){this['set']('pinned',_0x421af2),this['updatedAt']=new Date();}};const jo=/* #__PURE__ -- @preserve */
36
+ ut();var Jo=class extends jo{['items']=[];['connector'];['group'];constructor({connector:_0x4314dd,group:_0x277ea6}){super(),this['connector']=_0x4314dd,this['group']=_0x277ea6;}async['init'](){try{const _0x39e404=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x39e404);}catch(_0x2ce4cb){this['fire']('error',{'error':_0x2ce4cb,'operation':'init'});}}['addItem'](_0x5c09a4){this['items']['push'](_0x5c09a4);}async['removeItem'](_0x299c92){const _0x252176=this['items']['findIndex'](_0x365417=>_0x365417['id']===_0x299c92);if(-0x1===_0x252176)return!0x1;try{return await this['connector']['deleteConversation'](_0x299c92)['execute'](),this['items']['splice'](_0x252176,0x1),this['fire']('itemRemoved',{'itemId':_0x299c92}),!0x0;}catch(_0xa974a0){return this['fire']('error',{'error':_0xa974a0,'operation':'removeItem','itemId':_0x299c92}),!0x1;}}['getItem'](_0x5d1b47){return this['items']['find'](_0x5590e7=>_0x5590e7['id']===_0x5d1b47);}async['updateItemTitle'](_0x1c88d2,_0xae367){const _0x3ff06a=this['getItem'](_0x1c88d2);if(!_0x3ff06a)return!0x1;try{return await this['connector']['updateConversation'](_0x1c88d2,{'title':_0xae367})['getResult'](),_0x3ff06a['updateTitle'](_0xae367),this['fire']('itemUpdated',{'itemId':_0x1c88d2,'updates':{'title':_0xae367}}),!0x0;}catch(_0xb83ff2){return this['fire']('error',{'error':_0xb83ff2,'operation':'updateItemTitle','itemId':_0x1c88d2}),!0x1;}}async['updateItemPinned'](_0x1bed47,_0x500d26){const _0x380c5a=this['getItem'](_0x1bed47);if(!_0x380c5a)return!0x1;try{return await this['connector']['updateConversation'](_0x1bed47,{'pinned':_0x500d26})['getResult'](),_0x380c5a['updatePinned'](_0x500d26),this['fire']('itemUpdated',{'itemId':_0x1bed47,'updates':{'pinned':_0x500d26}}),!0x0;}catch(_0x53b51c){return this['fire']('error',{'error':_0x53b51c,'operation':'updateItemPinned','itemId':_0x1bed47}),!0x1;}}['loadItems'](_0x3cac95){try{this['items']=[],_0x3cac95['map'](_0xceee4f=>{this['addItem'](new zo(_0xceee4f));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x31bca4){this['fire']('error',{'error':_0x31bca4,'operation':'loadItems'});}}['getItems'](_0x29b4c2={}){const _0x2b45c2=void 0x0!==_0x29b4c2['pinned']&&_0x29b4c2['pinned'],_0x23390a=_0x29b4c2['from']?new Date(_0x29b4c2['from']['getFullYear'](),_0x29b4c2['from']['getMonth'](),_0x29b4c2['from']['getDate']()):null,_0x15577e=_0x29b4c2['to']?new Date(_0x29b4c2['to']['getFullYear'](),_0x29b4c2['to']['getMonth'](),_0x29b4c2['to']['getDate']()):null;return this['items']['filter'](_0x3e27f6=>{if(_0x3e27f6['pinned']!==_0x2b45c2)return!0x1;if(_0x15577e){const _0x26b207=new Date(_0x3e27f6['createdAt']['getFullYear'](),_0x3e27f6['createdAt']['getMonth'](),_0x3e27f6['createdAt']['getDate']());return _0x23390a?_0x23390a['getTime']()===_0x15577e['getTime']()?_0x26b207['getTime']()===_0x23390a['getTime']():_0x26b207<_0x15577e&&_0x26b207>=_0x23390a:_0x26b207<_0x15577e;}return!0x0;});}},Zo=class extends _0x394201{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[ls,on,Nn,Qo,cs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](ls),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Qo),this['_aiChatController']=this['context']['plugins']['get'](Nn),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aichathistory');const _0x1fd513=this['context']['plugins']['get'](cs);try{const _0x393bb8=this['_aiChatController']['getGroupId']();this['history']=new Jo({'connector':this['_aiConnector'],'group':_0x393bb8}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x13b0df,_0x4c85fe)=>{this['_setItemLoading'](_0x4c85fe['id'],'remove'),this['_handleRemove'](_0x4c85fe['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x303866,_0x272fb0)=>{this['_setItemLoading'](_0x272fb0['id'],'rename'),this['_handleEditTitle'](_0x272fb0['id'],_0x272fb0['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x338de9,_0x2280b0)=>{void 0x0!==_0x2280b0['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x2280b0['itemId'],_0x2280b0['updates']['title']),void 0x0!==_0x2280b0['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x2280b0['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x3c0348,_0x33517b)=>{this['_aiChatController']['_handleRemovedConversation'](_0x33517b['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x33517b['itemId']),this['_clearItemLoading'](_0x33517b['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x6b74ef,_0x54103b)=>{this['_handleHistoryErrorUI'](_0x54103b['error'],_0x54103b['operation'],_0x54103b['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0xeae2f0,_0x3377da)=>{this['_handleSelectConversation'](_0x3377da['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x1b22cb,_0x379244)=>{const _0x3776a7=_0x379244['pinned']?'pin':'unpin';this['_setItemLoading'](_0x379244['id'],_0x3776a7),this['_handleTogglePin'](_0x379244['id'],_0x379244['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x1fd513['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x1fd513['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x49981a){this['_handleHistoryErrorUI'](_0x49981a,'init');}}async['_handleEditTitle'](_0xf569c1,_0x110eae){await this['history']['updateItemTitle'](_0xf569c1,_0x110eae);}async['_handleTogglePin'](_0x193ac4,_0x461fd1){await this['history']['updateItemPinned'](_0x193ac4,_0x461fd1);}async['_handleRemove'](_0x267f70){await this['history']['removeItem'](_0x267f70);}async['_handleSelectConversation'](_0x1177b7){await this['_aiChatController']['loadConversation'](_0x1177b7);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x2597e3=this['_aiChatController']['activeConversation']?.['id'],_0x425de0=this['_getCategorizedItems']()['map'](_0x47eaf7=>({'title':_0x47eaf7['title'],'items':_0x47eaf7['items']['map'](_0x1dafe7=>({'id':_0x1dafe7['id'],'title':_0x1dafe7['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x1dafe7['createdAt'])['toLocaleDateString'](),'active':_0x1dafe7['id']===_0x2597e3,'pinned':_0x1dafe7['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x425de0);}['_setItemLoading'](_0xb1720,_0x2d284d){this['_aiChatHistoryUi']['updateItemLoadingState'](_0xb1720,_0x2d284d,!0x0);}['_clearItemLoading'](_0x3ff0c7){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3ff0c7,null,!0x1);}['_handleHistoryErrorUI'](_0x48561f,_0x1af77f,_0x372629){const _0x47c50e=this['_generateErrorMessage'](_0x1af77f,_0x372629);this['_aiChatHistoryUi']['showError'](_0x47c50e),this['_reporter']['reportError'](_0x48561f,{'context':{'operation':_0x1af77f}}),_0x372629&&this['_clearItemLoading'](_0x372629),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x91511a,_0x56dbaa){const _0x448808=_0x56dbaa?this['history']['getItem'](_0x56dbaa):null,_0x4211a3=_0x448808?.['title']||us(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x91511a){case'updateItemTitle':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x4211a3);case'updateItemPinned':{const _0x35ac6b=us(this['context']['locale'],_0x448808?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x35ac6b,_0x4211a3]);}case'removeItem':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x4211a3);case'init':case'loadItems':return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return us(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x1fe4d2=new Date(),_0x2e3ccd=new Date(_0x1fe4d2['getFullYear'](),_0x1fe4d2['getMonth'](),_0x1fe4d2['getDate']()),_0x21145a=new Date(_0x2e3ccd);_0x21145a['setDate'](_0x21145a['getDate']()-0x1);const _0x4dab1a=new Date(_0x2e3ccd);_0x4dab1a['setDate'](_0x4dab1a['getDate']()-0xe);const _0x1bd616=this['history']['getItems']({'pinned':!0x0}),_0x54cf23=this['history']['getItems']({'from':_0x2e3ccd,'to':_0x2e3ccd}),_0x55ac87=this['history']['getItems']({'from':_0x21145a,'to':_0x21145a}),_0x45ec0c=this['history']['getItems']({'from':_0x4dab1a,'to':_0x21145a}),_0x1f72ab=this['history']['getItems']({'to':_0x4dab1a}),_0x29123e=[];return _0x1bd616['length']>0x0&&_0x29123e['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x1bd616}),_0x54cf23['length']>0x0&&_0x29123e['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x54cf23}),_0x55ac87['length']>0x0&&_0x29123e['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x55ac87}),_0x45ec0c['length']>0x0&&_0x29123e['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x45ec0c}),_0x1f72ab['length']>0x0&&_0x29123e['push']({'title':us(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x1f72ab}),_0x29123e;}},ta=class extends _0x394201{static get['requires'](){return[Zo,Qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ea=class extends _0x394201{static get['requires'](){return[Nn,Is,Go,ta,sn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x511238){super(_0x511238),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ia=class extends Ht{['id'];constructor(_0x458e24,_0xdd8fc8){super(_0x458e24);const {id:_0x45fecc,type:_0x1f4e73,icon:_0x3b2535}=_0xdd8fc8;this['id']=_0x45fecc,this['set']({'label':_0xdd8fc8['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0xdd8fc8['id']}}),_0x3b2535?this['icon']=_0x3b2535:'chat'===_0x1f4e73?this['icon']=_0x480028:'review'===_0x1f4e73?this['icon']=_0x1b2515:'translate'===_0x1f4e73&&(this['icon']=_0x1ea070);}},sa=class extends _0x2bc1f3{['listView'];constructor(_0xdd6861,_0x88e35c){super(_0xdd6861),this['set']('isEnabled',!0x0);const _0x5c9d1f=_0x88e35c['map'](_0x5f3a92=>{const _0x52d23d=new zt(this['locale']),_0x11411e=new ia(this['locale'],_0x5f3a92);return _0x11411e['bind']('isEnabled')['to'](this),_0x52d23d['children']['add'](_0x11411e),_0x11411e['delegate']('execute')['to'](this),_0x52d23d;});this['listView']=new jt(this['locale']),this['listView']['items']['addMany'](_0x5c9d1f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const na='chat-shortcuts';var ra=class extends _0x394201{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Go];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Go),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x1eb9ed=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x13d795=_0x1eb9ed['activeConversation'];_0x13d795['isFromHistory']||this['_injectShortcuts'](_0x13d795);}),this['listenTo'](_0x1eb9ed,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x25426c=['chat','review','translate'];this['_shortcuts']['forEach'](_0x3a7473=>{let _0x56d616=!0x0;if(_0x3a7473['id']&&_0x3a7473['label']&&_0x25426c['includes'](_0x3a7473['type'])?'chat'===_0x3a7473['type']&&(_0x56d616='string'==typeof _0x3a7473['prompt']):_0x56d616=!0x1,!_0x56d616)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x3a7473});});}['_injectShortcuts'](_0x3dcb8c){this['_removeShortcuts'](),this['_shortcutsView']=new sa(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],na),this['_shortcutsView']['on']('execute',_0x4e7b9b=>{const _0x21c96f=_0x4e7b9b['source']['id'];this['_executeShortcut'](_0x21c96f);}),this['_listenedConversation']=_0x3dcb8c,this['listenTo'](_0x3dcb8c,'uploadProgressChanged',(_0x40c7b5,_0x8d92a0)=>{this['_shortcutsView']['isEnabled']=!_0x8d92a0['isUploadInProgress'];});}['_removeShortcuts'](){const _0x506bef=this['context']['plugins']['get'](Go);_0x506bef['hasFeedItem'](na)&&_0x506bef['removeFeedItem'](na),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x345f87){const _0x5c9201=this['_shortcuts']['find'](_0x3e9887=>_0x3e9887['id']===_0x345f87),_0xabf4fa=_0x5c9201['type'];'chat'===_0xabf4fa?this['_runChatShortcut'](_0x5c9201):'review'===_0xabf4fa?_0x5c9201['commandId']?this['_runReviewShortcut'](_0x5c9201):this['_switchTab']('reviewMode'):'translate'===_0xabf4fa&&(_0x5c9201['language']?this['_runTranslateShortcut'](_0x5c9201):this['_switchTab']('translate'));}['_switchTab'](_0x531609){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x531609});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x531609);}async['_runChatShortcut']({prompt:_0x3841a8,draftMode:_0x1d5b95,useWebSearch:_0x5d20e7=!0x1,useReasoning:_0x4c0dcc=!0x1,model:_0x64e9ae}){const _0x87f10b=this['context']['plugins']['get']('AIChatController'),_0x106350=_0x87f10b['activeConversation'];let _0x3e5c90;_0x3e5c90=_0x64e9ae?await _0x106350['chatModels']['getModel'](_0x64e9ae):await _0x106350['chatModels']['getDefault'](),_0x3e5c90&&await _0x106350['setModel'](_0x3e5c90),_0x106350['setWebSearch'](_0x5d20e7),_0x106350['setReasoning'](_0x4c0dcc),_0x87f10b['addCurrentDocumentToChatContext'](),_0x1d5b95?(this['_aiChatUI']['setPromptInputValue'](_0x3841a8),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x87f10b['sendMessage']({'message':_0x3841a8});}['_runReviewShortcut']({commandId:_0x2a2927,model:_0x56a895,prompt:_0x2d9624,params:_0x3f5952}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x3c09e7={'id':_0x2a2927,'isCustom':'custom'===_0x2a2927};_0x56a895&&_0x2d9624&&(_0x3c09e7['args']={'model':_0x56a895,'prompt':_0x2d9624}),_0x3f5952&&(_0x3c09e7['params']=_0x3f5952),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x3c09e7);}['_runTranslateShortcut']({language:_0x2d05f3}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x2d05f3,'args':{'language':_0x2d05f3}});}},oa=class extends _0x558985{constructor(_0x1480bc){super(_0x1480bc);const _0x5b4e21=_0x1480bc['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x5b4e21,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x960fe6=this['editor']['plugins']['get']('AITabs')['view'];_0x960fe6['isVisible']=!_0x960fe6['isVisible'];}},aa=class extends _0x16e292{static get['requires'](){return[cs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5790fd=this['editor'];_0x5790fd['commands']['add']('toggleAi',new oa(_0x5790fd)),_0x5790fd['ui']['componentFactory']['add']('toggleAi',()=>{const _0xc029be=this['_createAIUIButton'](Ht);return _0xc029be['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0xc029be;}),_0x5790fd['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x5097b5=this['_createAIUIButton'](Jt);return _0x5097b5['set']({'role':'menuitemcheckbox'}),_0x5097b5;});}['_createAIUIButton'](_0x1e138a){const _0x145bd3=this['editor'],_0x737061=_0x145bd3['commands']['get']('toggleAi'),_0x27ba22=new _0x1e138a(_0x145bd3['locale']);return _0x27ba22['set']({'label':us(_0x145bd3['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x30d1f0,'isToggleable':!0x0}),_0x27ba22['bind']('isEnabled')['to'](_0x737061),_0x27ba22['bind']('isOn')['to'](_0x737061,'value',_0x542b23=>!!_0x542b23),this['listenTo'](_0x27ba22,'execute',()=>{_0x737061['execute']();}),_0x27ba22;}};const ha=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ca=class extends _0x2bc1f3{['_errorView'];constructor(_0x87b50a){super(_0x87b50a),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x6d453c){this['showError'](_0x6d453c);}['showError'](_0x3f48af){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x3f48af,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x8393e2=new _0x2bc1f3(this['locale']),_0x473873=new _0x2bc1f3(this['locale']);return _0x473873['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x8393e2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x3dbfd2=>!_0x3dbfd2)]},'children':[_0x473873]}),_0x8393e2;}};const la=0xa;var ua=class extends _0x394201{static get['requires'](){return[Is];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x572412){const {id:_0x1a8d0f}=this['_currentConfig']??{};this['_currentConfig']=_0x572412,this['_editor']=_0x572412['targetEditor'];const {id:_0xc45073}=this['_currentConfig'];this['isOpen']&&_0x1a8d0f===_0xc45073?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x3b8a37=this['_editor'];if(!_0x3b8a37)return;const _0x34e054=_0x3b8a37['plugins']['get']('Dialog');_0x34e054['isOpen']&&this['_currentConfig']&&_0x34e054['id']===this['_currentConfig']['id']&&_0x34e054['hide']();}['_updateDialog'](){const _0x5d87a2=this['_editor']['plugins']['get']('Dialog'),{icon:_0xf8d690,title:_0x5e7034}=this['_currentConfig'];_0x5d87a2['view']?.['headerView']&&(_0x5d87a2['view']['headerView']['label']=_0x5e7034,_0x5d87a2['view']['headerView']['iconView']&&_0xf8d690&&(_0x5d87a2['view']['headerView']['iconView']['content']=_0xf8d690)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5d87a2['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](Is)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](Is)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x2aa371=this['_editor']['plugins']['get']('Dialog'),{id:_0x3fc94,title:_0x1289f4,icon:_0x322d80,class:_0x570605,mainView:_0x4f528c}=this['_currentConfig'];_0x4f528c['delegate'](...ha)['to'](this),_0x2aa371['show']({'title':_0x1289f4,'icon':_0x322d80,'hasCloseButton':!0x0,'id':_0x3fc94,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x570605||''),'content':_0x4f528c,'onShow':_0x323590=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x323590['view']?.['updatePosition']();const _0x465290=this['_getSelectionElements']();_0x465290&&_0x465290[0x0]&&Rt({'target':_0x465290[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x323590['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x3fc94});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x3fc94}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x4eda54,_0x7ffc75,_0x17ade0){const _0x27e5e6=_0x7ffc75||_0x17ade0;if(!_0x27e5e6)return null;const _0x3474fc=this['_getSelectionElements']();if(!_0x3474fc||0x0===_0x3474fc['length'])return{'left':Math['round'](_0x27e5e6['left']+_0x27e5e6['width']/0x2-_0x4eda54['width']/0x2),'top':Math['round'](_0x27e5e6['top']+_0x27e5e6['height']/0x2-_0x4eda54['height']/0x2)};const _0x448ef4=Math['round'](_0x27e5e6['left']+_0x27e5e6['width']/0x2-_0x4eda54['width']/0x2),_0x48dd64=_0x3474fc['map'](_0x128037=>new At(_0x128037)),_0x43df68=_0x4eda54['height'];return{'left':_0x448ef4,'top':this['_calculateOptimalTopPosition'](_0x48dd64,_0x43df68,_0x27e5e6)};}['_calculateOptimalTopPosition'](_0x5d12df,_0x227c40,_0x3fb735){const _0x7cdc77=new At(Tt['window']),_0x58fe2d=_0x5d12df['map'](_0x589a59=>_0x589a59['getVisible']())['filter'](_0x54a91f=>_0x54a91f),_0x331d68=At['getBoundingRect'](_0x58fe2d);if(!_0x331d68)return Math['round'](_0x3fb735['top']+_0x3fb735['height']/0x2);const _0x1b8013=_0x7cdc77['getIntersection'](_0x331d68);if(!_0x1b8013)return Math['round'](_0x3fb735['top']+_0x3fb735['height']/0x2);const _0x5b73ea=_0x3fb735['getVisible'](),_0x546fbb=_0x5b73ea&&_0x331d68['height']>_0x5b73ea['height'],_0x41cbce=_0x1b8013['top'],_0x431400=_0x1b8013['bottom'];if(_0x546fbb){const _0x579317=_0x7cdc77['top']+_0x7cdc77['height']/0x2-_0x227c40/0x2,_0x211118=_0x41cbce-la-_0x7cdc77['top'],_0x10bc2e=_0x7cdc77['bottom']-_0x431400-la;return _0x211118>=_0x227c40?Math['max'](la,_0x41cbce-_0x227c40-la):_0x10bc2e>=_0x227c40?_0x431400+la:Math['max'](la,_0x579317);}const _0x5f2902=_0x41cbce-_0x227c40,_0x4a852c=_0x7cdc77['bottom']-_0x431400-la,_0x4cd5db=_0x41cbce-la-_0x7cdc77['top'];let _0xb0fbb;return _0xb0fbb=_0x4a852c>=_0x227c40?_0x431400+la:_0x4cd5db>=_0x227c40?_0x5f2902-la:_0x41cbce+_0x331d68['height']/0x2-_0x227c40/0x2,_0xb0fbb;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x3401ed=this['_editor'];this['listenTo'](_0x3401ed['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0xcedaf2,data:{newRange:_0x3a13f9}}of _0x3401ed['model']['document']['differ']['getChangedMarkers']())if(_0xcedaf2['startsWith']('ai-selection:')&&(_0x3a13f9&&(_0x3a13f9['start']['isEqual'](_0x3a13f9['end'])||'$graveyard'==_0x3a13f9['root']['rootName'])||null==_0x3a13f9)){const _0x2a9388=us(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x2a9388),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x49e7fe=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x49e7fe['model']['document']);}['_getSelectionElements'](){const _0x24ada0=this['_editor'];return _0x2f0863(_0x24ada0['editing'],[..._0x24ada0['model']['markers']['getMarkersGroup']('ai-selection'),..._0x24ada0['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x33af14=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x33af14&&_0x33af14['rootName']?_0x33af14['rootName']:null;}},da=class extends _0x311510{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x255302,_0x37dbf9={}){super(_0x255302),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x37dbf9};const _0x444099=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x444099?'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'](_0x993f4a){this['showChangesButton']['isEnabled']=_0x993f4a;}['_setupRatingButtons'](){this['likeButton']=new Ht(this['locale']),this['likeButton']['set']({'icon':ot,'label':us(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':ln,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Ht(this['locale']),this['dislikeButton']['set']({'icon':rt,'label':us(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':ln,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Ht(this['locale']),this['copyButton']['set']({'icon':_0x11d6e2,'label':us(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+ln,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x31ee86=new Yt();_0x31ee86['set']({'content':_0x324330}),_0x31ee86['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+ln,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+ln;},0x7d0);}),this['copyButton']['children']['add'](_0x31ee86);}['_setupShowChangesButton'](){this['showChangesButton']=new Ht(this['locale']),this['showChangesButton']['set']({'icon':tt,'label':us(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':ln}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x1030d6=>_0x1030d6?et:tt),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},_a=class extends ca{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0xc0f29d,_0x1a872a){super(_0xc0f29d);const _0x3f8b76=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x1a872a,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new Qn(_0xc0f29d),this['_partToolbarView']=new Yn(_0xc0f29d,_0x1a872a['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x1a872a),this['_stateView']=new Kn(_0xc0f29d),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new da(_0xc0f29d,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new ga(_0xc0f29d,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x271844,_0x388d06,_0x161f76,_0x398b6d)=>{let _0x340ead,_0x1ebf59;'pending'===_0x398b6d?(_0x340ead=this['_partToolbarView'],_0x1ebf59=this['_stateView']):(_0x340ead=this['_stateView'],_0x1ebf59=this['_partToolbarView']),this['_stateView']['setState'](_0x161f76),_0x340ead['isVisible']=!0x1,_0x1ebf59['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x3f8b76['to']('_state',_0x46c57e=>'ck-ai-chat-balloon-main_state_'+_0x46c57e)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x1a872a);});}['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'](_0x3ab478){_0x3ab478?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x3ab478);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0xd6188a){this['_state']=_0xd6188a;}['showError'](_0x179361){super['showError'](_0x179361),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x25fadd){super['showBlockingError'](_0x25fadd),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x2d8aff){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x2d8aff;}['togglePartToolbarEnabled'](_0x54c977){this['_partToolbarView']['isEnabled']=_0x54c977;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x24c817,showSuggestButton:_0x5d0e87}){_0x24c817=_0x24c817&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x5d0e87=_0x5d0e87&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x24c817,'showSuggestButton':_0x5d0e87});}['_createNextButtonView'](){const _0x54f067=new Ht(this['locale']);return _0x54f067['set']({'icon':_0x26e683,'label':us(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x54f067['on']('execute',()=>{this['fire']('showNext');}),_0x54f067;}['_createPreviousButtonView'](){const _0x3fc9d4=new Ht(this['locale']);return _0x3fc9d4['set']({'icon':_0x678f87,'label':us(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x3fc9d4['on']('execute',()=>{this['fire']('showPrevious');}),_0x3fc9d4;}},ga=class extends _0x2bc1f3{constructor(_0x3840b5,_0x49b374){super(_0x3840b5),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x49b374});}},Aa=class extends _0x16e292{static get['requires'](){return[Mt,ua];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x3d8573){super(_0x3d8573),this['set']('showDiff',!0x1);}['open'](_0x24d1f1){const _0x37ced9=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x37ced9['plugins']['get']('AIBalloon')['open']({..._0x24d1f1,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x24d1f1['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x24d1f1['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x37eca4){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x37eca4);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x298c53){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x298c53);}['_createChatBalloonView'](){const _0x42540f=this['editor'],_0x3f5739=_0x42540f['plugins']['get']('AIBalloon'),_0x5b9aac=_0x42540f['commands']['get']('trackChanges');let _0x559fb5=_0x42540f['config']['get']('ai.availableReplyActions')||[...ir];_0x42540f['plugins']['has']('TrackChanges')||(_0x559fb5=_0x559fb5['filter'](_0x2f00d3=>'insertSuggestion'!=_0x2f00d3));const _0x234b7d=new _a(_0x42540f['locale'],{'availableActions':_0x559fb5,'showApplyButton':!0x0,'showSuggestButton':!!_0x5b9aac});return _0x234b7d['bind']('showDiff')['to'](this),_0x234b7d['delegate'](...yn)['to'](this),_0x234b7d['delegate']('showPrevious','showNext')['to'](this),_0x3f5739['delegate']('dialogClosed')['to'](this),_0x234b7d['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x234b7d['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x234b7d['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5b9aac&&_0x234b7d['bind']('isTrackChangesOn')['to'](_0x5b9aac,'value'),_0x234b7d['render'](),_0x234b7d;}['_toggleRotatorButtonsInDialogHeader'](_0xc8dea6){const _0x3e0c76=this['editor'],_0x95388=_0x3e0c76['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0xc8dea6),_0x95388['has'](this['_chatBalloonView']['previousButtonView'])||(_0x95388['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x3e0c76['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x95388['remove'](this['_chatBalloonView']['previousButtonView']),_0x95388['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Ia=class extends _0x16e292{static get['requires'](){return[aa,Aa,_0x26e10c];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function pa(_0xe5bab3){const {editor:_0x46d563,action:_0x477773,withText:_0x4c2145=!0x1,withIcon:_0x38d8bc=!0x0,isInDropdown:_0x163456=!0x0,shouldPreventFocus:_0x11c539=!0x1,actionButtons:_0x1f882d}=_0xe5bab3;return()=>{const _0x4447f1=_0x46d563['locale'],_0x18a4be=new Ht(_0x4447f1),_0xee83be=_0x18a4be['bindTemplate'];_0x163456&&_0x18a4be['extendTemplate']({'on':{'mouseenter':_0xee83be['to'](()=>{_0x11c539&&_0x11c539()||_0x18a4be['focus']();})}}),_0x1f882d['push']({'buttonView':_0x18a4be,'action':_0x477773});const _0x1a88f0=_0x477773['icon']??_0x477773['parent']?.['icon'];return _0x18a4be['set']({'label':_0x477773['label'],'withText':_0x4c2145,'role':'menuitem','icon':_0x38d8bc?_0x1a88f0??_0x434f07:void 0x0,'tooltip':!_0x4c2145,'class':'ck-ai-quick-actions-button','isEnabled':_0x477773['isEnabled']}),_0x18a4be['on']('execute',()=>{_0x46d563['editing']['view']['focus'](),_0x46d563['commands']['execute']('aiQuickAction',_0x477773);}),_0x18a4be;};}var ma=class extends Qt{['arrowView'];constructor(_0x590353,_0x52ce9f){super(_0x590353,_0x52ce9f);const _0x297177=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',_0x131f5b=>String(_0x131f5b)),'data-cke-tooltip-disabled':_0x297177['to']('isOn')},'on':{'mouseenter':_0x297177['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x5674d=new Yt();return _0x5674d['content']=_0x27e475,_0x5674d['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x5674d;}},Ea=class extends jt{['_allListItems'];['_allSearchableItems'];constructor(_0x530d76,_0x589d06,_0x33d461){super(_0x530d76),this['_allListItems']=_0x589d06,this['_allSearchableItems']=_0x33d461;}['filter'](_0x1d79a3){if(!_0x1d79a3)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x1990b6=_0x1d79a3['source']['toLowerCase']()['trim'](),_0x35099a=this['_allSearchableItems']['filter'](_0x4a5ed4=>(_0x4a5ed4['groupLabel']?_0x4a5ed4['label']+'\x20('+_0x4a5ed4['groupLabel']+')':_0x4a5ed4['label'])['toLowerCase']()['includes'](_0x1990b6));return this['items']['clear'](),this['items']['addMany'](_0x35099a['sort']((_0x28da92,_0x4ded7a)=>{const _0x12491a=_0x28da92['groupLabel'],_0x5d3b00=_0x4ded7a['groupLabel'];return _0x12491a||_0x5d3b00?_0x12491a?0x1:-0x1:0x0;})['map'](_0x357e28=>_0x357e28['item'])),this['_highlightQuery'](_0x1990b6,_0x35099a),{'resultsCount':_0x35099a['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0xddb7ee,_0x4933cd){if(!_0xddb7ee)return;const _0x114696=new RegExp(_0x2444d5(_0xddb7ee),'gi');_0x4933cd['forEach'](_0x46fcf1=>{_0x46fcf1['highlightViews']&&_0x46fcf1['highlightViews']['forEach'](_0x14cfdf=>{'function'==typeof _0x14cfdf['highlightText']&&_0x14cfdf['highlightText'](_0x114696);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x7079da=>{_0x7079da['highlightViews']&&_0x7079da['highlightViews']['forEach'](_0x58f7c0=>{'function'==typeof _0x58f7c0['highlightText']&&_0x58f7c0['highlightText'](null);});});}};const Ta='menu',wa='menuitem';var Ca=class extends _0x2bc1f3{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x24e651,_0x39e90a,_0x222877,_0x280139,_0x36ab61=!0x1,_0x16bf39=[]){const _0x169b77=_0x24e651['locale'];super(_0x169b77),this['_bodyCollection']=_0x280139,this['_hasSearch']=_0x36ab61,this['_actionButtons']=_0x16bf39;const _0x1cf914=this['_createListItems'](_0x24e651,_0x39e90a,_0x222877);this['optionsListView']=new Ea(_0x169b77,_0x1cf914,this['_allSearchableItems']),this['optionsListView']['role']=Ta,this['optionsListView']['items']['addMany'](_0x1cf914),this['focusTracker']=new dt(),this['keystrokes']=new _t(),_0x36ab61&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x1cf914,this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x36ab61&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x39c599=_0x36ab61&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x17d17e(_0x39c599),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x169b77['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x390b84(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':us(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x313e14=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x313e14);}['_createListItems'](_0x53e54f,_0x298b56,_0x4e3f16){const _0xdeb5ef=new _0x17d17e();return _0x298b56['forEach'](_0x68b8e0=>{if('actions'in _0x68b8e0){const {listItem:_0x3b1d92}=this['_createActionGroupButton'](_0x53e54f,_0x68b8e0,_0x4e3f16);_0xdeb5ef['add'](_0x3b1d92),_0x68b8e0['actions']['forEach'](_0x5224cd=>{const {listItem:_0x5ba456,highlightViews:_0x5261ce}=this['_createSearchResultActionButton'](_0x53e54f,_0x5224cd,_0x68b8e0['label'],_0x68b8e0['icon']);this['_allSearchableItems']['push']({'item':_0x5ba456,'label':_0x5224cd['label'],'groupLabel':_0x68b8e0['label'],'highlightViews':_0x5261ce});});}else{const {listItem:_0xd1b1a}=this['_createActionButton'](_0x53e54f,_0x68b8e0);_0xdeb5ef['add'](_0xd1b1a);const _0x84f794=_0xd1b1a['children']['first'];if(_0x84f794){const {listItem:_0x444c66,highlightViews:_0xcb2963}=this['_createSearchResultActionButton'](_0x53e54f,_0x68b8e0);this['_allSearchableItems']['push']({'item':_0x444c66,'label':_0x84f794['label']||'','highlightViews':_0xcb2963});}}}),_0xdeb5ef;}['_createActionButton'](_0x29a227,_0x21b39e,_0x427b47,_0x241b8d){const _0x3e55f6=new zt(this['locale']);if(_0x427b47&&_0x241b8d){const _0x33420e=new Ht(this['locale']),_0x3ea1c8=_0x33420e['bindTemplate'],_0x51681e=new Wt();_0x51681e['text']=_0x21b39e['label'];const _0x2e59cc=new Wt();_0x2e59cc['text']=_0x427b47;const _0x5ec90e=new Yt();_0x5ec90e['content']=_0x241b8d,_0x5ec90e['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4088cf=new _0x2bc1f3(this['locale']);_0x4088cf['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x1df49a=new _0x2bc1f3(this['locale']);return _0x1df49a['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x33420e['set']({'label':_0x21b39e['label']+'\x20('+_0x427b47+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x21b39e['isEnabled']}),_0x33420e['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x3ea1c8['if']('isEnabled','ck-disabled',_0x5b8847=>!_0x5b8847)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x51681e,_0x4088cf,_0x5ec90e,_0x2e59cc,_0x1df49a],'on':{'mouseenter':_0x3ea1c8['to'](()=>{this['_isSearchFocused']()||_0x33420e['focus']();}),'click':_0x3ea1c8['to'](()=>{_0x33420e['fire']('execute');})}}),_0x33420e['on']('execute',()=>{_0x33420e['isEnabled']&&(_0x29a227['editing']['view']['focus'](),_0x29a227['commands']['execute']('aiQuickAction',_0x21b39e));}),_0x3e55f6['children']['add'](_0x33420e),this['_actionButtons']['push']({'buttonView':_0x33420e,'action':_0x21b39e}),{'listItem':_0x3e55f6,'highlightViews':[_0x51681e,_0x2e59cc]};}{const _0x52f09a=new Pt(),_0x152de2=new Ht(this['locale'],_0x52f09a),_0x9ea269=_0x152de2['bindTemplate'],_0x19e734=_0x21b39e['icon']??_0x21b39e['parent']?.['icon'],_0x4155f0=void 0x0!==_0x21b39e['icon'];return _0x152de2['set']({'label':_0x21b39e['label'],'withText':!0x0,'role':'menuitem','icon':_0x4155f0?_0x19e734??_0x434f07:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x21b39e['isEnabled']}),_0x152de2['extendTemplate']({'on':{'mouseenter':_0x9ea269['to'](()=>{this['_isSearchFocused']()||_0x152de2['focus']();})}}),_0x152de2['on']('execute',()=>{_0x29a227['editing']['view']['focus'](),_0x29a227['commands']['execute']('aiQuickAction',_0x21b39e);}),_0x3e55f6['children']['add'](_0x152de2),this['_actionButtons']['push']({'buttonView':_0x152de2,'action':_0x21b39e}),{'listItem':_0x3e55f6,'highlightViews':[_0x52f09a]};}}['_createSearchResultActionButton'](_0x16e97b,_0x3e8a97,_0x21c41f,_0x5677b6){return _0x21c41f&&_0x5677b6?this['_createSearchResultGroupedActionButton'](_0x16e97b,_0x3e8a97,_0x21c41f,_0x5677b6):this['_createSearchResultIndividualActionButton'](_0x16e97b,_0x3e8a97);}['_createSearchResultGroupedActionButton'](_0x4a779c,_0x14b2ab,_0x1b8321,_0x2ee2fc){const _0x4d5b64=new zt(this['locale']),_0x1e9ba4=new Ht(this['locale']),_0x1dab35=_0x1e9ba4['bindTemplate'],{view:_0x1cf612,highlightView:_0x359316}=this['_createSearchResultGroupRow'](_0x1b8321,_0x2ee2fc),{view:_0x13feb5,highlightView:_0x4d7829}=this['_createSearchResultActionRow'](_0x14b2ab['label']),_0x37bc99=this['_createSearchResultContentView'](_0x1cf612,_0x13feb5);return _0x1e9ba4['set']({'label':_0x14b2ab['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':_0x14b2ab['isEnabled']}),_0x1e9ba4['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',_0x1dab35['if']('isEnabled','ck-disabled',_0x3b525e=>!_0x3b525e)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x37bc99],'on':{'mouseenter':_0x1dab35['to'](()=>{this['_isSearchFocused']()||_0x1e9ba4['focus']();}),'click':_0x1dab35['to'](()=>{this['_handleSearchResultButtonClick'](_0x1e9ba4);})}}),this['_setupActionButtonExecution'](_0x1e9ba4,_0x4a779c,_0x14b2ab),_0x4d5b64['children']['add'](_0x1e9ba4),this['_actionButtons']['push']({'buttonView':_0x1e9ba4,'action':_0x14b2ab}),{'listItem':_0x4d5b64,'highlightViews':[_0x359316,_0x4d7829]};}['_createSearchResultIndividualActionButton'](_0x30b9d0,_0x3a2c94){const _0x8aff65=new zt(this['locale']),_0x1b8d0f=new Pt(),_0x560f6f=new Ht(this['locale'],_0x1b8d0f),_0x5ad9f0=_0x560f6f['bindTemplate'];return _0x560f6f['set']({'label':_0x3a2c94['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x3a2c94['isEnabled']}),_0x560f6f['extendTemplate']({'on':{'mouseenter':_0x5ad9f0['to'](()=>{this['_isSearchFocused']()||_0x560f6f['focus']();})}}),this['_setupActionButtonExecution'](_0x560f6f,_0x30b9d0,_0x3a2c94),_0x8aff65['children']['add'](_0x560f6f),this['_actionButtons']['push']({'buttonView':_0x560f6f,'action':_0x3a2c94}),{'listItem':_0x8aff65,'highlightViews':[_0x1b8d0f]};}['_createSearchResultGroupRow'](_0x4f4bf5,_0x186c86){const _0x559519=new _0x2bc1f3(this['locale']),_0x276ab5=new Yt();_0x276ab5['content']=_0x186c86,_0x276ab5['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0xbc65f3=new Wt();return _0xbc65f3['text']=_0x4f4bf5,_0x559519['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x276ab5,_0xbc65f3]}),{'view':_0x559519,'highlightView':_0xbc65f3};}['_createSearchResultActionRow'](_0x44b92c){const _0x36d4cc=new _0x2bc1f3(this['locale']),_0x2ecaa6=new Wt();return _0x2ecaa6['text']=_0x44b92c,_0x36d4cc['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x2ecaa6]}),{'view':_0x36d4cc,'highlightView':_0x2ecaa6};}['_createSearchResultContentView'](_0xb2dd1f,_0x520d28){const _0x45baee=new _0x2bc1f3(this['locale']);return _0x45baee['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0xb2dd1f,_0x520d28]}),_0x45baee;}['_setupActionButtonExecution'](_0x1737be,_0x35be94,_0x1ac0ad){_0x1737be['on']('execute',()=>{_0x1737be['isEnabled']&&(_0x35be94['editing']['view']['focus'](),_0x35be94['commands']['execute']('aiQuickAction',_0x1ac0ad));});}['_createActionGroupButton'](_0x3b0ce8,_0x1b3a9d,_0x54adfd){const _0x117d33=new zt(this['locale']),_0x70703c=new Pt(),_0x3a38cd=new ma(this['locale'],_0x70703c),_0x1b87b2=_0x3a38cd['bindTemplate'],_0x49d1be=this['_getPanelKeystroke'](_0x54adfd),_0x5eedc8=this['_createGroupActionsList'](_0x3b0ce8,_0x1b3a9d['actions'],_0x54adfd);_0x3a38cd['set']({'label':_0x1b3a9d['label'],'withText':!0x0,'role':wa,'icon':_0x1b3a9d['icon']??_0x434f07,'isEnabled':_0x1b3a9d['actions']['some'](_0x37281a=>_0x37281a['isEnabled'])}),_0x3a38cd['extendTemplate']({'on':{'mouseenter':_0x1b87b2['to'](()=>{this['_isSearchFocused']()||_0x3a38cd['focus']();})}});const _0x54d346=new yt(this['locale']);return _0x54d346['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x1b87b2['to'](_0x25f32a=>{this['_handlePanelKeydown'](_0x25f32a,_0x49d1be,_0x3a38cd,_0x54d346);})}}),_0x3a38cd['bind']('isOn')['to'](_0x54d346,'isVisible'),this['_bodyCollection']['add'](_0x54d346),_0x54d346['content']['add'](_0x5eedc8),this['_setupGroupMenuBehavior'](_0x3a38cd,_0x54d346),_0x117d33['children']['add'](_0x3a38cd),this['_actionButtons']['push']({'buttonView':_0x3a38cd,'action':_0x1b3a9d}),{'listItem':_0x117d33,'highlightView':_0x70703c};}['_createGroupActionsList'](_0x5c0e52,_0x1c11c9,_0x4c5191){const _0x109d63=new jt(this['locale']);return _0x109d63['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x1c11c9['forEach'](_0x5f46f6=>{const _0x1f3793=new zt(this['locale']),_0x27500b=pa({'editor':_0x5c0e52,'action':_0x5f46f6,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x1f3793['children']['add'](_0x27500b),_0x4c5191['focusTracker']['add'](_0x27500b),_0x109d63['items']['add'](_0x1f3793);}),_0x109d63;}['_setupGroupMenuBehavior'](_0x3414db,_0x3d378e){const _0x225199=_0x3414db['bindTemplate'],_0x28f91a=this['_getButtonKeystroke'](_0x3414db);_0x3414db['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x225199['to'](()=>{this['_showNestedPanel'](_0x3d378e,_0x3414db);}),'mouseleave':_0x225199['to'](_0x593d14=>{const _0x5c6b1f=_0x593d14['relatedTarget'];this['_isMovingToNestedMenu'](_0x5c6b1f,_0x3d378e)||this['_hideNestedPanel'](_0x3d378e);}),'keydown':_0x225199['to'](_0x1e73ed=>{_0x1e73ed['key']==_0x28f91a&&(this['_showNestedPanel'](_0x3d378e,_0x3414db),_0x3d378e['content']['get'](0x0)['focus']());})}}),_0x3d378e['on']('render',()=>{_0x3d378e['element']?.['addEventListener']('mouseleave',_0x1cad97=>{const _0x9eebe1=_0x1cad97['relatedTarget'];_0x3414db['element']?.['contains'](_0x9eebe1)||this['_isMovingToNestedMenu'](_0x9eebe1,_0x3d378e)||this['_hideNestedPanel'](_0x3d378e);});});}['_showNestedPanel'](_0x48f764,_0x501b85){this['_openNestedPanels']['forEach'](_0x437aae=>{_0x437aae!==_0x48f764&&_0x437aae['isVisible']&&_0x437aae['hide']();}),_0x48f764['show'](),_0x48f764['pin']({'positions':[Ut['eastSouth']],'target':_0x501b85['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x48f764);}['_hideNestedPanel'](_0x2ea6e8){_0x2ea6e8['hide'](),this['_openNestedPanels']['delete'](_0x2ea6e8);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x1e9d3f=>_0x1e9d3f['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x5add28,_0x9807a8){if(!_0x5add28)return!0x1;if(_0x9807a8['element']?.['contains'](_0x5add28))return!0x0;const _0x144fec=_0x5add28;return _0x144fec['closest']&&(null!==_0x144fec['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x144fec['closest']('.ck-ai-quick-actions-group-list')||null!==_0x144fec['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'](_0x137966){return'rtl'===_0x137966['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x1bdc75){return'rtl'===_0x1bdc75['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x29e89d,_0x1bd77a,_0x3ef38d,_0x67c25a){_0x29e89d['key']==_0x1bd77a&&(_0x3ef38d['focus'](),this['_hideNestedPanel'](_0x67c25a));}['_handleSearchResultButtonClick'](_0x365d4e){_0x365d4e['fire']('execute');}};function fa(_0x596366){const {editor:_0x6af508,content:_0x3c07c8,buttonDefinition:_0x23bdab,bodyCollection:_0x3f6178,hasSearch:_0x135c7b=!0x1,actionButtons:_0x237d03}=_0x596366;return()=>{const _0x1254fe=_0x6af508['locale'],_0x4b41b8=_0x6af508['commands']['get']('aiQuickAction'),_0x41723f=_0x4e3ad4(_0x1254fe);_0x41723f['bind']('isEnabled')['to'](_0x4b41b8),_0x41723f['buttonView']['set']({'icon':_0x23bdab['icon']??_0x434f07,'label':_0x23bdab['label'],'tooltip':!0x0}),_0x41723f['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x2f9a0f=new Ca(_0x6af508,_0x3c07c8,_0x41723f,_0x3f6178,_0x135c7b,_0x237d03);return _0x41723f['panelView']['children']['add'](_0x2f9a0f),_0x135c7b&&_0x41723f['on']('change:isOpen',(_0x2d859f,_0x2ab16a,_0x35548d)=>{if(_0x35548d){if(_0x6af508['plugins']['has']('AIEditing')){const _0x531864=_0x6af508['plugins']['get'](Is),_0x3eb279=_0x6af508['model']['document']['selection'],_0x57252e=Array['from'](_0x3eb279['getRanges']());_0x57252e['length']>0x0&&_0x531864['showFakeVisualSelection']({'editor':_0x6af508,'ranges':_0x57252e,'id':'quick-action','priority':0x14});}}else _0x6af508['plugins']['has']('AIEditing')&&_0x6af508['plugins']['get'](Is)['hideFakeVisualSelection']('quick-action'),_0x2f9a0f['resetSearch']();}),_0x41723f;};}const ba='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Sa='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Ra='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Oa=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var va=class AIQuickActionsUI extends _0x16e292{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[xt,ls,on];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiquickactions');const _0x429644=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x429644),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x171f7b){return function(_0x3f335b){const _0x4d4126=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3f335b['uiLanguage'])||'English';return[{'id':'ask-ai','label':us(_0x3f335b,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x1a32ec},{'id':'chat-commands','label':us(_0x3f335b,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x1a32ec,'actions':[{'id':'explain','label':us(_0x3f335b,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':us(_0x3f335b,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':ba['replace']('%0',_0x4d4126),'type':'chat'},{'id':'summarize','label':us(_0x3f335b,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':us(_0x3f335b,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Sa['replace']('%0',_0x4d4126),'type':'chat'},{'id':'highlight-key-points','label':us(_0x3f335b,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':us(_0x3f335b,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Ra['replace']('%0',_0x4d4126),'type':'chat'}]},{'id':'improve-writing','label':us(_0x3f335b,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x2f7d74},{'id':'continue','label':us(_0x3f335b,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x283cdb},{'id':'fix-grammar','label':us(_0x3f335b,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x3ff1ce},{'id':'adjust-length','label':us(_0x3f335b,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x277bed,'actions':[{'id':'make-shorter','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':us(_0x3f335b,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2d4998,'actions':[{'id':'make-tone-casual','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':us(_0x3f335b,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x1ea070,'actions':[{'id':'translate-to-english','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':us(_0x3f335b,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':us(_0x3f335b,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x34caf3,'actions':[]}];}(_0x171f7b);}['_getDefaultAndCustomActions'](){const _0x8fe171=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x287f3b=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x3531e2=>({..._0x3531e2,'type':'chat'===_0x3531e2['type']?'chat':'action','icon':void 0x0}));return _0x8fe171['find'](_0x1b9aae=>'other'===_0x1b9aae['id'])['actions']['push'](..._0x287f3b),_0x8fe171;}async['_initActionTypeQuickActions'](){try{const _0x1f0c61=new zs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0xe11861=await _0x1f0c61['getAll'](),_0x20d133=(await _0x1f0c61['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x20d133),this['_enableButtonsByType']('action',_0x10ef05=>!!_0xe11861['find'](_0x1bad52=>_0x1bad52['id']===_0x10ef05['model'])||void 0x0===_0x10ef05['model']);}catch(_0x47170){const _0x20867e=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x47170});this['_reporter']['logError'](_0x20867e);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x5eb88b=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x5eb88b,'change:isConversationReady',(_0x3af2a0,_0x4dc0fd,_0x48c619)=>{_0x48c619&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x5eb88b['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x176fca,_0x531337){this['_quickActionsDefinition']['forEach'](_0x5527c5=>{'actions'in _0x5527c5?_0x5527c5['actions']['forEach'](_0x150747=>{_0x150747['type']===_0x176fca&&(_0x150747['isEnabled']=_0x531337(_0x150747));}):_0x5527c5['type']===_0x176fca&&(_0x5527c5['isEnabled']=_0x531337(_0x5527c5));}),this['_actionButtons']['forEach'](_0x11584b=>{if(ka(_0x11584b['action']))return;if(_0x11584b['action']['type']!==_0x176fca)return;const _0x20840f=_0x531337(_0x11584b['action']);if(_0x11584b['action']['isEnabled']=_0x20840f,_0x11584b['buttonView']['isEnabled']=_0x20840f,!_0x20840f&&_0x11584b['action']['model']){const _0x4f56a1=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x11584b['action']['id'],'modelId':_0x11584b['action']['model']});this['_reporter']['logError'](_0x4f56a1);}}),this['_actionButtons']['filter'](_0x278664=>ka(_0x278664['action']))['forEach'](_0xdf4db5=>{_0xdf4db5['buttonView']['isEnabled']=_0xdf4db5['action']['actions']['some'](_0x5afc19=>_0x5afc19['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x39238a,group:_0x119b6b})=>{_0x39238a['isEnabled']=_0x119b6b['actions']['some'](_0x43e942=>_0x43e942['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x383c1b){this['_actionButtons']['forEach'](_0x30c18a=>{ka(_0x30c18a['action'])||'action'===_0x30c18a['action']['type']&&(_0x30c18a['action']['model']||(_0x30c18a['action']['model']=_0x383c1b));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x4b8744=new Lt(this['editor']['locale']);_0x4b8744['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x4b8744),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x4b8744);}['_initializeQuickActionsDropdown'](_0x421f05){const _0x4f5f75=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',fa({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x434f07,'label':us(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x421f05,'hasSearch':_0x4f5f75,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x37e08c){this['_quickActionsDefinition']=_0x37e08c['map'](_0x138c32=>{if('actions'in _0x138c32){const _0x6ea902=_0x138c32;return{..._0x6ea902,'actions':_0x6ea902['actions']['map'](_0x1d6004=>{const {actions:_0x5dddab,..._0x189494}=_0x6ea902;return{..._0x1d6004,'isEnabled':!0x1,'parent':_0x189494};})['filter'](_0x1680c8=>this['_shouldIncludeAction'](_0x1680c8))};}return{..._0x138c32,'isEnabled':!0x1};})['filter'](_0x402ed3=>'actions'in _0x402ed3?_0x402ed3['actions']['length']>0x0:this['_shouldIncludeAction'](_0x402ed3));}['_shouldIncludeAction'](_0x2f20f6){const _0x13f6e7=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Oa[_0x2f20f6['type']])&&!_0x13f6e7['includes'](_0x2f20f6['id'])&&!('chat'===_0x2f20f6['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x14238d){this['_quickActionsDefinition']['forEach'](_0x237ed7=>{if('actions'in _0x237ed7){const _0x5d482f=fa({'editor':this['editor'],'content':_0x237ed7['actions'],'buttonDefinition':_0x237ed7,'bodyCollection':_0x14238d,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x237ed7['id'],_0x5d482f),_0x237ed7['actions']['forEach'](_0x14bc2d=>{const _0x28d0ed=pa({'editor':this['editor'],'action':_0x14bc2d,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x14bc2d['id'],_0x28d0ed);});}else{const _0x4feb0d=pa({'editor':this['editor'],'action':_0x237ed7,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x237ed7['id'],_0x4feb0d);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x3695b4=>{const _0x53fd48=this['editor']['commands']['get']('aiQuickAction'),_0x7fe0ba=new _0x547906(_0x3695b4),_0xe4892c=us(_0x3695b4,'AI_QUICK_ACTIONS_HEADING');_0x7fe0ba['buttonView']['set']({'label':_0xe4892c,'icon':_0x434f07});const _0x376b2d=new te(_0x3695b4);return _0x376b2d['set']({'ariaLabel':_0xe4892c,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x51e3f6=>{if('actions'in _0x51e3f6){const _0x5995e2=_0x51e3f6,_0x4e06a0=new Zt(_0x3695b4,_0x7fe0ba),_0x2c99db=new _0x547906(_0x3695b4),_0xd3b47b=new te(_0x3695b4);_0x2c99db['buttonView']['set']({'label':_0x5995e2['label'],'icon':_0x5995e2['icon']}),_0x5995e2['actions']['forEach'](_0x245991=>{const _0x4093ad=new Zt(_0x3695b4,_0x2c99db),_0x43883d=new Jt(_0x3695b4);_0x43883d['set']({'label':_0x245991['label'],'icon':_0x245991['icon'],'role':'menuitem','isEnabled':_0x245991['isEnabled']}),_0x43883d['on']('execute',()=>{this['_executeQuickAction'](_0x245991);}),this['_actionButtons']['push']({'buttonView':_0x43883d,'action':_0x245991}),_0x43883d['delegate']('execute')['to'](_0x2c99db),_0x4093ad['children']['add'](_0x43883d),_0xd3b47b['items']['add'](_0x4093ad);}),_0x2c99db['isEnabled']=_0x5995e2['actions']['some'](_0x27c637=>_0x27c637['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x2c99db,'group':_0x5995e2}),_0x2c99db['panelView']['children']['add'](_0xd3b47b),_0x4e06a0['children']['add'](_0x2c99db),_0x376b2d['items']['add'](_0x4e06a0);}else{const _0x284974=_0x51e3f6,_0x2f66a0=new Zt(_0x3695b4,_0x7fe0ba),_0x5655a0=new Jt(_0x3695b4);_0x5655a0['set']({'label':_0x284974['label'],'icon':_0x284974['icon'],'role':'menuitem','isEnabled':_0x284974['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x5655a0,'action':_0x284974}),_0x5655a0['on']('execute',()=>{this['_executeQuickAction'](_0x284974);}),_0x5655a0['delegate']('execute')['to'](_0x7fe0ba),_0x2f66a0['children']['add'](_0x5655a0),_0x376b2d['items']['add'](_0x2f66a0);}}),Object['values'](Oa)['some'](_0x463948=>this['editor']['plugins']['has'](_0x463948))?_0x7fe0ba['bind']('isEnabled')['to'](_0x53fd48):_0x7fe0ba['set']({'isEnabled':!0x1}),_0x7fe0ba['panelView']['children']['add'](_0x376b2d),_0x7fe0ba;});}['_executeQuickAction'](_0xdb876a){const _0x143c51=this['editor'];_0x143c51['editing']['view']['focus'](),_0x143c51['commands']['execute']('aiQuickAction',_0xdb876a);const _0x17450e=_0x143c51['ui']['view']['menuBarView'];_0x17450e&&_0x17450e['close']&&_0x17450e['close']();}};function ka(_0x251cdf){return'actions'in _0x251cdf;}function Na(_0x33e2a3,_0x7de675){const _0xb523b7=_0x33e2a3['plugins']['get']('AITabs')['view'];_0xb523b7['isVisible']=!0x0,_0xb523b7['activateTab'](_0x7de675);}var ya=class extends _0x558985{['execute'](_0x43eb23){switch(this['_expandSelectionIfCollapsed'](),_0x43eb23['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x50c23b=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x50c23b});}this['_handleAIChatAction'](_0x43eb23);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x473d84=us(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x473d84});}this['_handleAIActionsAction'](_0x43eb23);}}async['_handleAIChatAction'](_0x8af17a){const _0x285d34=this['editor']['plugins']['get']('AIChatController');if(Na(this['editor'],'chat'),'ask-ai'===_0x8af17a['id'])_0x285d34['removeSelectionFromChatContext'](),_0x285d34['addSelectionToChatContext'](this['editor']),_0x285d34['focusPromptInput']();else await _0x285d34['startConversation']({'modelId':_0x8af17a['model']}),_0x285d34['removeSelectionFromChatContext'](),_0x285d34['addSelectionToChatContext'](this['editor']),_0x285d34['focusPromptInput'](),await _0x285d34['sendMessage']({'message':_0x8af17a['prompt']||_0x8af17a['displayedPrompt']||_0x8af17a['label'],'attributes':{'quickActionData':{'id':_0x8af17a['id']},'displayedPrompt':_0x8af17a['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x1453bd=this['editor'],_0x141ace=_0x1453bd['model']['document']['selection'];if(!_0x141ace['isCollapsed'])return;const _0x47af7b=mt(_0x141ace['getSelectedBlocks']())||_0x1453bd['model']['schema']['getLimitElement'](_0x141ace);_0x1453bd['model']['change'](_0x494af5=>{_0x494af5['setSelection'](_0x47af7b,'in');});}['_handleAIActionsActionLabel'](_0x44be16){return _0x44be16['parent']?.['label']&&'other'!==_0x44be16['parent']?.['id']?_0x44be16['parent']['label']+':\x20'+_0x44be16['label']:_0x44be16['label'];}async['_handleAIActionsAction'](_0x467994){const _0x53f745=this['editor']['plugins']['get']('AIActions'),_0x2b2737=_0x467994['prompt']?{'userMessage':_0x467994['prompt'],'model':_0x467994['model']}:{'actionName':_0x467994['actionName']||_0x467994['id'],'args':_0x467994['args']},_0x4843c3=this['_handleAIActionsActionLabel'](_0x467994);await _0x53f745['executeAction'](_0x2b2737,_0x4843c3,_0x467994['icon']);}},xa=class extends _0x16e292{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4c825a=this['editor'],_0x342998=new ya(this['editor']);if(_0x4c825a['commands']['add']('aiQuickAction',_0x342998),_0x4c825a['plugins']['has']('AIChat')){const _0x564ce8=this['editor']['plugins']['get']('AIChatController');_0x4c825a['model']['document']['selection']['on']('change:range',(_0xf25b51,_0x4d35ba)=>{_0x4d35ba['directChange']&&_0x564ce8['removeSelectionFromChatContext']();});}}},La=class extends gn{['appendContent'](_0x4b524a,_0x58589b='text'){'modification'===this['type']&&'text'===_0x58589b&&(_0x58589b=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x4b524a,_0x58589b);}['updateChangeGroups'](_0x3827ed){const _0x5de67c=this['parsedContent']['get'](_0x3827ed)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x3827ed,_0x5de67c),this['changeGroups']=[],0x0==_0x5de67c['childNodes']['length'])return;Hs(this['documentContextContent']['get'](_0x3827ed),this['parsedMergedContent']['get'](_0x3827ed));const _0x3322fb=_0x46d927(this['documentContextContent']['get'](_0x3827ed)['children']['map'](_0x1cc4b4=>({'node':_0x1cc4b4,'id':fs(_0x1cc4b4,'data-id')})),_0x5de67c['children']['map'](_0x3d4712=>({'node':_0x3d4712,'id':fs(_0x3d4712,'data-id')||vt()})),{'comparator':(_0x4a8c34,_0x4ae19e)=>_0x4a8c34['id']==_0x4ae19e['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x3322fb['length']&&_0x3322fb[_0x3322fb['length']-0x1]['removed'];)_0x3322fb['pop']();}const _0x2cc21f=_0x3322fb['map'](_0x279e41=>{const _0xf4a465=_0x279e41['added']?'new':_0x279e41['removed']?'removed':'modified';return{'node':_0x279e41['value'][0x0]['node'],'type':_0xf4a465,'id':_0x279e41['value'][0x0]['id']};}),_0x35cc4a=this['_documentIdToSource']['get'](_0x3827ed);this['changeGroups']['push']({'changes':_0x2cc21f,'state':'pending','index':this['changeGroups']['length'],'editor':_0x35cc4a['editor'],'rootName':_0x35cc4a['rootName'],'documentId':_0x3827ed});}['_getDifferentChangeGroups'](_0x4ab298,_0x3e2ce9){return _0x3e2ce9;}},Da=class extends pn{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x5aaef3){super(_0x5aaef3),this['content']=_0x5aaef3['content'],this['version']=_0x5aaef3['version'],this['editor']=_0x5aaef3['editor'],this['rootName']=_0x5aaef3['rootName'],this['actionName']=_0x5aaef3['actionName'],this['args']=_0x5aaef3['args'],this['userMessage']=_0x5aaef3['userMessage'],this['model']=_0x5aaef3['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':vt(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x577a1b){const _0x37b14e=this['editor']['config']['get']('collaboration.channelId'),_0x5ceecd=new La({..._0x577a1b,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x37b14e,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x37b14e,this['editor']]])});return this['replies']['push'](_0x5ceecd),_0x5ceecd['delegate'](...In)['to'](this),this['fire']('replyCreated',_0x5ceecd),_0x5ceecd;}},Pa=class extends _0x311510{constructor(_0x632740,_0x1b1cdb=!0x0,_0x344cca=!0x0){super(_0x632740),this['set']('isEnabled',!0x1),_0x1b1cdb&&(this['applyButton']=this['_createButton'](us(_0x632740,'AI_BALLOON_APPLY_BUTTON'),hn),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x344cca&&(this['suggestButton']=this['_createButton'](us(_0x632740,'AI_BALLOON_SUGGEST_BUTTON'),_0x1b1cdb?cn:hn),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1b1cdb,'showSuggestButton':_0x344cca}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x4f284f,showSuggestButton:_0x1b8a9a}){this['applyButton']&&(this['applyButton']['isVisible']=_0x4f284f),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x1b8a9a);}['_createButton'](_0x2654fe,_0x31d222){const _0x13c59d=new Ht(this['locale']);return _0x13c59d['set']({'label':_0x2654fe,'class':_0x31d222,'isVisible':!0x0,'withText':!0x0}),_0x13c59d;}},Ha=class extends _0x2bc1f3{constructor(_0x3e21bd){super(_0x3e21bd),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':us(_0x3e21bd,'AI_DISCLAIMER_TEXT')}]}]});}},Ma=class extends _0x2bc1f3{constructor(_0x6a135b){super(_0x6a135b),this['set']('isVisible',!0x0);const _0x115a10=new lr('small');_0x115a10['isVisible']=!0x0;const _0x2c31ee=new _0x2bc1f3(this['locale']);_0x2c31ee['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[us(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x11409b=>!_0x11409b)]},'children':[_0x115a10,_0x2c31ee]});}},Va=class extends ca{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x10a7c2,_0xf922e8){super(_0x10a7c2),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xf922e8,this['_focusTracker']=new dt(),this['_keystrokes']=new _t(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x17d17e(),this['_addContentWrapper'](_0xf922e8),this['_addDisclaimerView'](),this['_addToolbar'](_0xf922e8),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'](_0xf922e8);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x422212 of this['_focusables'])this['_focusTracker']['add'](_0x422212['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x2fba6f){-0x1===_0x2fba6f?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x360676){this['_isLoading']=_0x360676;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x3974d2){super['showError'](_0x3974d2),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x30e1fa){super['showBlockingError'](_0x30e1fa),this['setErrorState']();}['addMiniToolbarItem'](_0x35e850){this['_miniToolbarView']['items']['has'](_0x35e850)||this['_miniToolbarView']['items']['add'](_0x35e850);}['removeMiniToolbarItem'](_0x5048a4){this['_miniToolbarView']['items']['has'](_0x5048a4)&&this['_miniToolbarView']['items']['remove'](_0x5048a4);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x472d47,showSuggestButton:_0x50a0d5}){_0x472d47=_0x472d47&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x50a0d5=_0x50a0d5&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x472d47,'showSuggestButton':_0x50a0d5});}async['updateContent'](_0x5e6205){await this['_streamableContentView']['update'](_0x5e6205);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x47efbe){this['_contentWrapper']=new _0x2bc1f3(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x47efbe['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Ha(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x2c2ad3,showSuggestButton:_0x4d55eb}){this['_toolbarView']=new Pa(this['locale'],_0x2c2ad3,_0x4d55eb),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',(_0x18fb72,_0x588e4a,_0x5af5de)=>!(_0x18fb72||_0x588e4a||_0x5af5de)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x2c2ad3,'showSuggestButton':_0x4d55eb}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x2249cb){return this['_miniToolbarView']=new da(this['locale'],_0x2249cb),this['_miniToolbarView']['delegate'](...yn)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x3448a4,_0x4a1d40)=>!(_0x3448a4||_0x4a1d40)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ma(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new Qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x5d7b54=new Ht(this['locale']),_0x5e14a1=new Ht(this['locale']),_0x105acd=new Ua(this['locale']),_0x370ba3=new Ht(this['locale']);_0x5d7b54['set']({'icon':_0x5aa03d,'label':us(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+ln}),_0x5e14a1['set']({'icon':_0x3606c6,'tooltip':us(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+ln}),_0x370ba3['set']({'icon':_0x17ed18,'tooltip':us(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+ln}),_0x5d7b54['bind']('isEnabled')['to'](this,'isBusy',_0x3be07d=>!_0x3be07d),_0x5d7b54['on']('execute',()=>{this['fire']('tryAgain');}),_0x5e14a1['bind']('isEnabled')['to'](this,'isBusy',_0x1c4943=>!_0x1c4943),_0x5e14a1['on']('execute',()=>{this['fire']('showPrevious');}),_0x370ba3['bind']('isEnabled')['to'](this,'isBusy',_0x59924d=>!_0x59924d),_0x370ba3['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x5e14a1,this['_navigationCounter']=_0x105acd,this['_navigationNextButton']=_0x370ba3,this['_navigationTryAgainButton']=_0x5d7b54;}['updateMiniToolbarButtons'](_0x5ccadd,_0x3e26db){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x11846b=_0x5ccadd>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x11846b){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x36d19d=_0x5ccadd-_0x3e26db;this['_navigationCounter']['setInteractionCount'](_0x36d19d+'/'+_0x5ccadd),this['_navigationPreviousButton']['isEnabled']=_0x3e26db<_0x5ccadd-0x1,this['_navigationNextButton']['isEnabled']=_0x3e26db>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'](_0x200ea7){this['_isLoading']=_0x200ea7;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x35bd37=this['_streamableContentView']['element'],_0x5e8c64=this['_miniToolbarView']['element'],_0x5e40f5=()=>{Tt['window']['requestAnimationFrame'](()=>{const _0x279e53=_0x35bd37['offsetWidth']-_0x35bd37['clientWidth'];_0x5e8c64['style']['right']='calc('+_0x279e53+'px\x20+\x20var(--ck-spacing-large))';});};_0x5e40f5(),this['_miniToolbarResizeObserver']=new It(_0x35bd37,()=>{_0x5e40f5();});}['_initializeScrollManager'](){const _0x311ea6=this['_getScrollableElement']();_0x311ea6&&!this['_scrollManager']&&(this['_scrollManager']=new Hr(_0x311ea6));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Ua=class extends _0x2bc1f3{constructor(_0x597154){super(_0x597154);const _0x533c27=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x533c27['to']('interactionCount')}]});}['setInteractionCount'](_0x17a992){this['set']('interactionCount',_0x17a992);}},Ba=class extends _0x16e292{static get['requires'](){return[ls,on,Mt,Is,ua,_0x4e4fa1];}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(_0x27cf18){super(_0x27cf18),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](on)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new tr();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x3ab314,_0x27839b,_0x194f2d){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x49ac53,anchorData:_0x336fcd,root:_0x22a8fa}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3ab314,_0x49ac53,_0x336fcd,_0x22a8fa,_0x27839b,_0x194f2d);}const {modelFragment:_0x511335,anchorData:_0x388d7d,root:_0x5ed850}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3ab314,_0x511335,_0x388d7d,_0x5ed850,_0x27839b,_0x194f2d);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x366ad5=this['editor']['plugins']['has']('TrackChanges');let _0x5a806a=this['editor']['config']['get']('ai.availableReplyActions')||[...ir];_0x366ad5||(_0x5a806a=_0x5a806a['filter'](_0x639454=>'insertSuggestion'!=_0x639454));const _0x1d6efc=this['editor']['commands']['get']('trackChanges'),_0x378f8c=new Va(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x366ad5,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x5a806a});return _0x378f8c['bind']('isBusy')['to'](this),_0x1d6efc&&_0x378f8c['bind']('isTrackChangesOn')['to'](_0x1d6efc,'value'),_0x378f8c['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x378f8c['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x378f8c['on']('showNext',()=>{this['_navigateToNext']();}),_0x378f8c;}['_normalizeSelectionStart'](){const _0x1c4f7c=this['editor']['model'],_0xc415a=_0x1c4f7c['document']['selection'],_0x307d8e=_0xc415a['getFirstRange']();if(!_0x307d8e||_0x307d8e['isCollapsed'])return;const _0xbb67dc=mt(_0xc415a['getSelectedBlocks']());if(!_0xbb67dc)return;const _0x588fe0=_0x1c4f7c['createPositionAt'](_0xbb67dc,0x0);_0x588fe0['isAfter'](_0x307d8e['start'])&&_0x1c4f7c['change'](_0xca9ced=>{_0xca9ced['setSelection'](_0xca9ced['createRange'](_0x588fe0,_0x307d8e['end']));});}['_getExecuteDataRegular'](){const _0x3a2e36=this['editor']['model']['document']['selection'],_0x302618=_0x3a2e36['getFirstRange']()['start']['root'];if(_0x3a2e36['isCollapsed']){const _0x4e019e=mt(_0x3a2e36['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x3a2e36);this['editor']['model']['change'](_0x4214d2=>{_0x4214d2['setSelection'](_0x4e019e,'in');});}this['_normalizeSelectionStart']();const _0x3d3f7d=_0x3a2e36['getFirstRange'](),_0x3a4ff7=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x3a2e36),_0x3d3f7d['start'],_0x3d3f7d['end']);this['_copyMarkersToFragment'](_0x3a4ff7,_0x3a2e36,{'isTableSelection':!0x1});const _0x37b707=_0x3a2e36['getFirstRange']()['start'],_0x9a4f6a=new Map();let _0x3a05d8=_0x3a4ff7;for(let _0x57961b=0x0;_0x57961b<_0x37b707['path']['length'];_0x57961b++)_0x9a4f6a['set'](_0x3a05d8,_0x37b707['path'][_0x57961b]),_0x3a05d8=_0x3a05d8['getChild'](0x0);return{'modelFragment':_0x3a4ff7,'anchorData':_0x9a4f6a,'root':_0x302618};}['_getExecuteDataInTable'](){const _0x1d0576=this['editor']['model']['document']['selection'],_0x22a321=this['editor']['plugins']['get']('TableSelection'),_0x5852a2=_0x1d0576['getFirstRange']()['start']['root'],_0x36a667=_0x22a321['getSelectionAsFragment'](),_0x217548=_0x1d0576['getFirstRange']()['start']['parent']['parent'],_0x3c75fe=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x217548),this['editor']['model']['createPositionAfter'](_0x217548)),_0x488d1e=this['_wrapWithCommonAncestors'](_0x36a667,_0x3c75fe['start'],_0x3c75fe['end']);this['_copyMarkersToFragment'](_0x488d1e,_0x1d0576,{'isTableSelection':!0x0});const _0x23abf6=_0x1d0576['getFirstRange']()['start'],_0x4459cb=new Map();let _0x48ee3c=_0x488d1e;for(let _0x1436a6=0x0;_0x1436a6<_0x23abf6['path']['length'];_0x1436a6++)if(_0x4459cb['set'](_0x48ee3c,_0x23abf6['path'][_0x1436a6]),_0x1436a6<_0x23abf6['path']['length']-0x1)_0x48ee3c=_0x48ee3c['getChild'](0x0);else{let _0x5f0ff2=_0x48ee3c['nextSibling'];for(;_0x5f0ff2;)_0x4459cb['set'](_0x5f0ff2,_0x23abf6['path'][_0x1436a6]),_0x5f0ff2=_0x5f0ff2['nextSibling'];}return{'modelFragment':_0x488d1e,'anchorData':_0x4459cb,'root':_0x5852a2};}async['_executeAction'](_0x22d662,_0x5cb2f2,_0x578e58,_0x3e5ffa,_0x3f9c02,_0x1f8b81){const _0x93a98c=this['editor']['plugins']['get'](Is),_0x1ecb35=this['editor']['plugins']['get'](ua),_0x443017=this['editor']['model']['document']['selection'],_0x2018db=await _0x93a98c['modelToDataWithIds'](_0x5cb2f2,this['editor']),_0x5367fa=this['editor']['model']['document']['version'],_0x1b5e6b=[..._0x443017['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x1ecb35['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x3f9c02,'icon':_0x1f8b81||_0x434f07,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x1b5e6b,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x1ecb35),this['_interactionParams']={'action':_0x22d662,'content':_0x2018db,'version':_0x5367fa,'aiBalloon':_0x1ecb35,'modelFragment':_0x5cb2f2,'anchorData':_0x578e58,'root':_0x3e5ffa},this['_setupApplyListeners'](),this['listenTo'](_0x1ecb35,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x1ecb35,'dialogClosed',(_0x2905de,{id:_0x2608a8})=>{if('aiActionsBalloon'===_0x2608a8){for(const _0x4c9c55 of this['_interactions']){if(0x0===_0x4c9c55['replies']['length']||_0x4c9c55['stoppedExplicitly'])continue;const _0x2a3f02=_0x4c9c55['replies'][_0x4c9c55['replies']['length']-0x1],_0x514758=_0x2a3f02['changeGroups'][0x0];_0x514758&&'pending'===_0x514758['state']&&_0x2a3f02['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x1ecb35);}}),this['_createInteraction'](_0x2018db,_0x5367fa,_0x1ecb35,_0x22d662);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0xd32a2e,anchorData:_0x3e9f45,root:_0x53b59e}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0xd32a2e,_0x3e9f45,_0x53b59e,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0xd32a2e,_0x3e9f45,_0x53b59e,!0x0);});}['_wrapWithCommonAncestors'](_0x45e8cb,_0x4c0bd1,_0x556d92){const _0x487142=this['editor']['model']['createRange'](_0x4c0bd1,_0x556d92)['getCommonAncestor'](),_0x216843=_0x487142['is']('documentFragment')?[]:_0x487142['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x216843['length']){const _0x27fd3a=_0x216843['map'](_0x2488e4=>_0x2488e4['_clone'](!0x1));for(let _0x5d776c=0x1;_0x5d776c<_0x27fd3a['length'];_0x5d776c++)_0x27fd3a[_0x5d776c-0x1]['_appendChild'](_0x27fd3a[_0x5d776c]);return _0x27fd3a[_0x27fd3a['length']-0x1]['_appendChild'](_0x45e8cb),new _0x31aa53(_0x27fd3a[0x0]);}return _0x45e8cb;}['_copyMarkersToFragment'](_0x36326f,_0x5e5c92,_0x3032fd={'isTableSelection':!0x1}){const _0x563a7c=this['editor']['model'],_0x12eeb5=Array['from'](_0x5e5c92['getRanges']()),_0x4160=_0x5e5c92['getFirstRange']()['start'];for(const _0x4a941d of _0x563a7c['markers']){if(_0x4a941d['name']['startsWith']('ai-selection')||!_0x4a941d['affectsData'])continue;const _0xae621d=_0x4a941d['getRange']();if(!_0x12eeb5['some'](_0x4f128d=>_0x4f128d['containsRange'](_0xae621d,!0x0)))continue;const _0x2d17ab=this['_regularCalculateMarkerPath'](_0xae621d['start'],_0x4160,_0x3032fd['isTableSelection']),_0x2cb686=this['_regularCalculateMarkerPath'](_0xae621d['end'],_0x4160,_0x3032fd['isTableSelection']),_0x11a2a3=_0x563a7c['createPositionFromPath'](_0x36326f,_0x2d17ab),_0x597403=_0x563a7c['createPositionFromPath'](_0x36326f,_0x2cb686);if(!_0x11a2a3['isEqual'](_0x597403)){const _0x374fa4=_0x563a7c['createRange'](_0x11a2a3,_0x597403);_0x36326f['markers']['set'](_0x4a941d['name'],_0x374fa4);}}}['_regularCalculateMarkerPath'](_0x42ec3e,_0x4af604,_0x3a3203=!0x1){const _0x4cf7bd=[..._0x42ec3e['path']['slice']()];for(let _0x56c50a=0x0;_0x56c50a<Math['max'](_0x4af604['path']['length'],_0x42ec3e['path']['length']);_0x56c50a++){const _0x4b2151=_0x4af604['path'][_0x56c50a]||0x0,_0x594692=(_0x42ec3e['path'][_0x56c50a]||0x0)-_0x4b2151;if(_0x4cf7bd[_0x56c50a]=_0x594692,0x0!==_0x594692&&!_0x3a3203)break;}return _0x4cf7bd;}async['_createInteraction'](_0xbda981,_0x4cd9e7,_0x3e1a1b,_0x3a16a8){const _0x1a285f=this['editor'],_0x2669b2=_0x1a285f['model']['document']['selection']['getFirstRange']()['start']['root'];if(!_0x4f8797(_0x1a285f,_0x2669b2['rootName']))return this['_actionsBalloonView']['showBlockingError'](us(this['editor']['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),Promise['resolve']();this['_interactionParams']||(this['_interactionParams']={'action':_0x3a16a8,'content':_0xbda981,'version':_0x4cd9e7,'aiBalloon':_0x3e1a1b,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x2669b2});const _0x12268c=new Da({'connector':this['_aiConnector'],'locale':_0x1a285f['locale'],'content':_0xbda981,'version':_0x4cd9e7,'editor':_0x1a285f,'rootName':_0x2669b2['rootName'],..._0x3a16a8});this['_interactions']['push'](_0x12268c);const _0x4bad07=(_0x3439c1,_0x55d7e6=!0x1,_0x845ba1='streaming')=>{const {isDone:_0x44b905}=_0x3439c1;return this['_promiseQueue']['enqueue'](async _0x27d682=>{try{const _0x4cfb09=Bs({'changeGroups':_0x3439c1['changeGroups'],'documentContextContent':_0x3439c1['documentContextContent'],'showDiff':_0x55d7e6,'trimUnchanged':!0x1});_0x4cfb09['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x4cfb09[0x0],'renderingStrategy':_0x845ba1,'abortSignal':_0x27d682}),_0x44b905&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x1bbdc0){if(nn(_0x1bbdc0))return;throw _0x1bbdc0;}});};_0x12268c['on']('replyCreated',(_0x2ef37f,_0x29a6e2)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x4bad07(_0x29a6e2)['catch'](_0x86e366=>{this['_reporter']['logError'](_0x86e366,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x12268c,_0x86e366);});}),_0x12268c['on']('replyContentUpdated',(_0x41716c,_0x487d9a)=>{_0x4bad07(_0x487d9a)['catch'](_0x1e2d7d=>{this['_reporter']['logError'](_0x1e2d7d,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x12268c,_0x1e2d7d);});}),_0x12268c['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x4859bf){this['_reporter']['logError'](_0x4859bf,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x12268c,_0x4859bf);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x3f74dc,{showDiff:_0x265115})=>{try{this['_balloonShowDiff']=_0x265115;const _0x2fe7c1=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x2fe7c1&&await _0x4bad07(_0x2fe7c1,_0x265115,'static');}catch(_0x1cefdb){this['_reporter']['logError'](_0x1cefdb,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x12268c,_0x1cefdb);}}),_0x12268c['on']('replyChangeGroupStateUpdated',()=>{const _0x28d9f4={'positiveCount':_0x12268c['replies']['reduce']((_0x17f31d,_0x3a4c01)=>_0x17f31d+_0x3a4c01['changeGroups']['filter'](_0x2b27bd=>'accepted'===_0x2b27bd['state'])['length'],0x0),'totalCount':_0x12268c['replies']['reduce']((_0x49f1c2,_0x4235bb)=>_0x49f1c2+_0x4235bb['changeGroups']['length'],0x0)},_0x4895d5=_0x12268c['actionCallId'],_0x10ad64=_0x12268c['actionName'];_0x10ad64?this['_aiConnector']['upsertAIActionRating'](_0x10ad64,_0x4895d5,_0x28d9f4):this['_aiConnector']['upsertCustomAIActionRating'](_0x4895d5,_0x28d9f4);}),this['_setLoadingState']();try{const _0x384a14=await _0x12268c['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x384a14;}catch(_0x5ef6e6){nn(_0x5ef6e6)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x5ef6e6,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x12268c,_0x5ef6e6);}}['_applyChanges'](_0x2ef0d5,_0x47bc6c,_0x3cfb27,_0x24f56d){const _0x2b9e16=this['editor'];if(_0x24f56d&&!_0x2b9e16['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x390e59=this['editor']['plugins']['get'](_0x4e4fa1),_0x316c7c=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x316c7c||!_0x316c7c['replies']['length'])return;const _0xded409=_0x316c7c['replies'][_0x316c7c['replies']['length']-0x1];_0xded409['setChangeGroupState'](0x0,'accepted');const _0x55e960=Ns({'documentSuggestions':vn({'groups':[_0xded409['changeGroups'][0x0]],'documentContextContent':_0xded409['documentContextContent'],'documents':_0x316c7c['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x390e59,'documentCompareOptions':{'anchor':_0x2b9e16['model']['createPositionAt'](_0x2ef0d5,0x0),'markDeletions':_0x24f56d}})['values']()['next']()['value']??[],_0x45430f=this['_filterOperationsOutsideRange'](_0x55e960,_0x47bc6c);for(const _0x245649 of _0x45430f)this['_anchorOperation'](_0x47bc6c,_0x245649,_0x3cfb27);const _0x48b2b8=_0x316c7c['getDocumentContext']()['documents'][0x0]['version'],_0x4a99a1=_0xce3122(_0x45430f,_0x2b9e16['model']['document']['history']['getOperations'](_0x48b2b8),{'document':_0x2b9e16['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];Js(_0x4a99a1,'quickActions');try{_0x2b9e16['model']['change'](_0x34d728=>{if(_0x34d728['setSelection'](_0x2b9e16['model']['document']['selection']['focus']),_0x24f56d)_0x2b9e16['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4a99a1);else{for(const _0x1287ec of _0x4a99a1)_0x1287ec['baseVersion']=_0x2b9e16['model']['document']['version'],ys(_0x2b9e16,_0x1287ec),_0x34d728['batch']['addOperation'](_0x1287ec),_0x2b9e16['model']['applyOperation'](_0x1287ec);}});}catch(_0x7b4b00){throw this['_reporter']['logError'](new rn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x7b4b00})),_0x7b4b00;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0xc4530b,_0x1a33ec){return _0xc4530b['filter'](_0x3947b0=>{if('rename'==_0x3947b0['type']){const _0x11b384=_0x3947b0['position']['nodeAfter'];return!_0x1a33ec['has'](_0x11b384);}if(_0x3947b0['type']['indexOf']('Attribute')>-0x1){const _0x23cb3a=_0x3947b0['range']['start']['nodeAfter'];return!_0x1a33ec['has'](_0x23cb3a);}return!0x0;});}['_anchorOperation'](_0x15e690,_0x2ac750,_0x3f726e){const _0x4691f0=_0x2ac750['clone']();for(const _0x37c51b in _0x2ac750){const _0x3de783=_0x2ac750[_0x37c51b];_0x3de783 instanceof _0x4ab7a9?_0x2ac750[_0x37c51b]=new _0x4ab7a9(_0x3667b9(_0x3de783['start']),_0x3667b9(_0x3de783['end'])):_0x3de783 instanceof _0x56972e&&(_0x2ac750[_0x37c51b]=_0x3667b9(_0x3de783));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x4691f0['type'])){if(_0x4691f0['isDocumentOperation']=!0x1,_0x4691f0['baseVersion']=null,'remove'==_0x4691f0['type']){const _0x584f18=_0x4691f0['sourcePosition'],_0x1a64c1=_0x4691f0['howMany'];new _0x4202c4(_0x584f18,_0x1a64c1)['_execute']();}else _0x4691f0['_execute']();}function _0x3667b9(_0x156d0c){if('$graveyard'==_0x156d0c['root']['rootName'])return _0x156d0c;const _0x177f03=[];let _0x344ea7=_0x156d0c['root'];for(let _0x169a1c=0x0;_0x169a1c<_0x156d0c['path']['length'];_0x169a1c++){const _0x119af7=_0x15e690['get'](_0x344ea7)||0x0;_0x177f03[_0x169a1c]=_0x156d0c['path'][_0x169a1c]+_0x119af7,_0x344ea7=_0x344ea7['getChildAtOffset'](_0x156d0c['path'][_0x169a1c]);}return new _0x56972e(_0x3f726e,_0x177f03,_0x156d0c['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1e8f58,content:_0x23bd77,version:_0x9a42c4,aiBalloon:_0x344d28}=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'](_0x23bd77,_0x9a42c4,_0x344d28,_0x1e8f58)['catch'](_0x29f878=>{this['_reporter']['logError'](_0x29f878,{'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 _0x2b8122=this['_interactions']['length'];this['_currentInteractionIndex']<_0x2b8122-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x474681){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x474681;const _0x42c7c0=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x42c7c0)return;if(_0x42c7c0['hasError'])return this['_setErrorState'](_0x42c7c0),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x42c7c0['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x202a27=_0x42c7c0['replies'][_0x42c7c0['replies']['length']-0x1];if(_0x202a27)try{const _0x338602=Bs({'changeGroups':_0x202a27['changeGroups'],'documentContextContent':_0x202a27['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x7a710a=>setTimeout(_0x7a710a,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x338602[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x2e09a6){this['_reporter']['logError'](_0x2e09a6,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x482c57,_0x76a983){if(void 0x0!==_0x76a983&&nn(_0x76a983))return;const _0x55b166=us(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x55b166),_0x482c57['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}},Ga=class extends _0x16e292{static get['requires'](){return[va,xa,Ba];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x39e69a){super(_0x39e69a),_0x39e69a['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Fa=class extends _0x2bc1f3{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x31afb2,_0x34dfd7){super(_0x31afb2),this['id']=_0x34dfd7,this['set']('status','pending'),this['set']('changeId',_0x34dfd7),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',(_0x5c5357,_0x3550ab)=>{_0x3550ab&&_0x3550ab['target']&&'A'===_0x3550ab['target']['tagName']&&_0x3550ab['preventDefault'](),this['fire']('activateChange',{'id':_0x34dfd7,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x34dfd7,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x34dfd7,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x1e7660=new _0x2bc1f3(this['locale']);return _0x1e7660['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',_0x1bd4d3=>!_0x1bd4d3)]}}),_0x1e7660;}['_createAcceptButtonView'](){const _0x4dfeaf=new Ht(this['locale']);return _0x4dfeaf['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x4dfeaf['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x561e26=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x561e26['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x41cc57=>'pending'!==_0x41cc57&&'accepted'!==_0x41cc57),this['bindTemplate']['if']('status',cn,_0x3152c6=>'pending'===_0x3152c6),this['bindTemplate']['if']('status',ln,_0x527ab2=>'pending'!==_0x527ab2),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3ec10d=>'accepted'===_0x3ec10d)]}}),this['on']('change:status',(_0x266e08,_0x39314c,_0x26f054)=>{_0x4dfeaf['isEnabled']='pending'===_0x26f054,'accepted'===_0x26f054&&(_0x4dfeaf['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x4dfeaf['icon']=_0x324330);}),_0x4dfeaf;}['_createDismissButtonView'](){const _0x99982e=new Ht(this['locale']);return _0x99982e['set']({'label':us(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x99982e['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x52bbfc=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x52bbfc['stopPropagation']();})},'attributes':{'class':[ln,this['bindTemplate']['if']('status','ck-hidden',_0x257abf=>'pending'!==_0x257abf&&'rejected'!==_0x257abf),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x3a4ce6=>'pending'===_0x3a4ce6),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x12612e=>'rejected'===_0x12612e)]}}),this['on']('change:status',(_0x4979e3,_0x98510d,_0x361a17)=>{_0x99982e['isEnabled']='pending'===_0x361a17,'rejected'===_0x361a17&&(_0x99982e['label']=us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x99982e['icon']=_0x16ce26);}),_0x99982e;}['_createInfoButtonView'](){const _0x35009b=new Ht(this['locale']);return _0x35009b['set']({'label':us(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x35032d,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':ln+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x35009b['bind']('isOn')['to'](this,'isInfoToggleOn',_0x3d3ae0=>_0x3d3ae0),_0x35009b['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x35009b;}['_createOutdatedButtonView'](){const _0x12e767=new Ht(this['locale']);return _0x12e767['set']({'label':us(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x2b660b,'withText':!0x0,'isEnabled':!0x1}),_0x12e767['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x372fee=>'outdated'!==_0x372fee)],'disabled':'disabled'}}),_0x12e767;}},Ka=class extends yt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x1980cd,_0x5775ff){super(_0x1980cd),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']()),_0x5775ff['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x3bfe2f){this['resultItemView']['changeId']=_0x3bfe2f['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x3bfe2f['contentDiffed'];}['showBalloon'](_0x46eac8,_0x40cf46,_0x155f28,_0x2fa663,_0x6bb8f5,_0x4cefff){const _0x589387=_0x40cf46();if(!_0x589387)return;this['updateContent'](_0x46eac8),this['show']();const _0x2dc178=Array['from'](_0x589387['getClientRects']())['reverse'](),_0x530b60=this['_getPointedRectIndexFromEvent'](_0x155f28,_0x2dc178),_0x846357=_0x2dc178[_0x530b60??0x0];'click'===_0x2fa663?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x40cf46(),_0x530b60,_0x46eac8['id'],_0x6bb8f5,_0x4cefff)||_0x846357})):'hover'===_0x2fa663&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x40cf46(),_0x530b60,_0x46eac8['id'])||_0x846357}));}['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'](){_0xf3e5e2({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x17f25d=[this['element']];return this['_pinnedTargetElement']&&_0x17f25d['push'](this['_pinnedTargetElement']),_0x17f25d;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x24d7f2=new _0x2bc1f3();return this['resultItemView']=new Fa(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x24d7f2['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']]}]}),_0x24d7f2;}['_getBestRectPositionOnClick'](_0x5c175a,_0x46ca85,_0x473318,_0x559821,_0x51ec1a){if(!_0x5c175a)return null;const _0x36bd7f=this['position']['replace']('arrow_',''),_0x3a0d80=Array['from'](_0x5c175a['getClientRects']());let _0x270929,_0x4da96e=_0x3a0d80['reverse']();return void 0x0!==_0x46ca85&&this['_isPinnedRectVisible'](_0x4da96e[_0x46ca85],_0x559821,_0x51ec1a)?(_0x270929=_0x4da96e[_0x46ca85],this['_pinnedRectIndex']=_0x46ca85):this['_isPinnedRectVisible'](_0x4da96e[0x0],_0x559821,_0x51ec1a)&&void 0x0===_0x46ca85?_0x270929=_0x4da96e[0x0]:(_0x4da96e='s'==_0x36bd7f[0x0]?[..._0x3a0d80]['reverse']():_0x3a0d80,_0x4da96e['forEach'](_0x279ec0=>{this['_isPinnedRectVisible'](_0x279ec0,_0x559821,_0x51ec1a)&&(_0x270929=_0x279ec0);})),this['_pinnedTargetChangeId']=_0x473318,this['_pinnedTargetElement']=_0x5c175a,_0x270929||_0x5c175a['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x1b12ac,_0x18d685,_0x4eb968){if(!_0x1b12ac)return null;const _0x3f8a3c=Array['from'](_0x1b12ac['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x18d685&&this['_pinnedTargetChangeId']!==_0x4eb968?(this['_pinnedRectIndex']=_0x18d685,this['_pinnedTargetElement']=_0x1b12ac,this['_pinnedTargetChangeId']=_0x4eb968,_0x3f8a3c[_0x18d685]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x4eb968?_0x1b12ac!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x3f8a3c[this['_pinnedRectIndex']]:void 0x0!==_0x18d685&&this['_pinnedTargetChangeId']!==_0x4eb968?(this['_pinnedRectIndex']=_0x18d685,this['_pinnedTargetElement']=_0x1b12ac,this['_pinnedTargetChangeId']=_0x4eb968,_0x3f8a3c[_0x18d685]):_0x1b12ac['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x2c2eb6,_0x432981){if(_0x2c2eb6)for(let _0x27771b=0x0;_0x27771b<_0x432981['length'];_0x27771b++){const _0x2d99a2=_0x432981[_0x27771b];if(_0x2c2eb6['clientX']>=_0x2d99a2['left']-0x3&&_0x2c2eb6['clientX']<=_0x2d99a2['right']+0x3&&_0x2c2eb6['clientY']>=_0x2d99a2['top']-0x3&&_0x2c2eb6['clientY']<=_0x2d99a2['bottom']+0x3)return _0x27771b;}}['_isPinnedRectVisible'](_0x32b486,_0x29359a,_0x17a9ca){const _0x1752bd=new At(_0x32b486),_0x41c994=_0x29359a||document['documentElement'],_0x322cc1=_0x1752bd['getIntersection'](Et(_0x17a9ca)),_0x479fb5=new At(_0x41c994)['getIntersection'](_0x1752bd);return!!(_0x322cc1&&_0x479fb5&&_0x1752bd['width']>0x0);}};const Wa=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Ya=class extends _0x394201{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[cs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1424ff){super(_0x1424ff),this['_bodyCollection']=dn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Wa)['to'](this),this['_balloonSuggestionView']=new Ka(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4f2aec=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4f2aec);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x3edf54){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x3e6be4=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x3edf54,_0x3e6be4);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x252292){_0x252292&&('error-general'!==_0x252292['status']?'error-chunk'!==_0x252292['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x256443){this['_mainView']['addCheckRunResult'](_0x256443);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x24c5a7){this['_mainView']['showGeneralReviewCoreErrorView'](_0x24c5a7??us(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x2018e7,_0x2a2437){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x2018e7,_0x2a2437);}['setActiveStateInResults'](_0x386e7f){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3d6fd0=>{_0x3d6fd0['id']===_0x386e7f&&_0x3d6fd0['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x154e7f=>_0x154e7f['setItemAsInactive']());}['updateChangeState'](_0x8eb469,_0x3eb328){'accepted'===_0x3eb328||'rejected'===_0x3eb328||'outdated'===_0x3eb328?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x8eb469,_0x3eb328):this['_mainView']['reviewCheckResultsView']['showResult'](_0x8eb469,_0x3eb328);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x5be578,_0x203b74,_0x5dcef4,_0x15677c,_0x54ee54,_0x3245d2){this['_balloonSuggestionView']['showBalloon'](_0x5be578,_0x203b74,_0x5dcef4,_0x15677c,_0x54ee54,_0x3245d2);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x2048c3){const _0x5b30a4=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x7228f4=>_0x7228f4['id']===_0x2048c3);return _0x5b30a4?_0x5b30a4['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},$a=class extends _0x2bc1f3{constructor(_0x402a56){super(_0x402a56),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x88ccc7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x88ccc7['if']('isVisible','ck-hidden',_0xab1efe=>!_0xab1efe)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x88ccc7['to']('errorMessage')}]}]});}},qa=class extends _0x2bc1f3{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x325bb9,_0x1d3e13){super(_0x325bb9),this['reviewCoreHeader']=_0x1d3e13['header'],this['generalErrorView']=new $a(_0x325bb9),this['reviewCheckListView']=_0x1d3e13['list'],this['reviewCheckListView']['delegate'](...Wa)['to'](this),this['reviewCheckResultsView']=_0x1d3e13['results'],this['reviewCheckResultsView']['delegate'](...Wa)['to'](this),this['reviewCompletedView']=_0x1d3e13['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'](_0x5a010f){this['reviewCheckResultsView']['addResult'](_0x5a010f),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'](_0x38cff1){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x38cff1;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},Qa=class extends Ht{constructor(_0x397ec5,_0x1e1bf4){super(_0x1e1bf4),this['set']({'label':_0x397ec5,'withText':!0x0,'class':hn}),this['on']('execute',()=>{this['fire']('finishReview');});}},Xa=class extends zt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x1813a5,_0xad278d){super(_0x1813a5),this['_contents']=_0xad278d,this['_resultViews']=new _0x17d17e(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new Vo(_0x1813a5),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 _0x107834=this['_createCombinedSkeletonLoader'](),_0x13b9f8=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x13b9f8['if']('isLoading','ck-ai_review__check-run_loading',_0x33025c=>_0x33025c),_0x13b9f8['if']('isResultReady','ck-ai_review__check-run_ready',_0xfd8d61=>_0xfd8d61),_0x13b9f8['if']('isVisible','ck-hidden',_0x54fe6e=>!_0x54fe6e)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x107834,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x5f38e2){const _0x787e93=new Fa(this['locale'],_0x5f38e2['id']);_0x787e93['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x787e93),_0x787e93['resultResponseView']['element']['innerHTML']=_0x5f38e2['contentDiffed'];}['hideResult'](_0x20fec3,_0x7e0d70){if('pending'===_0x7e0d70)return;const _0x1c4c6b=this['_resultViews']['find'](_0x5051c0=>_0x5051c0['id']===_0x20fec3);_0x1c4c6b&&(_0x1c4c6b['status']=_0x7e0d70,_0x1c4c6b['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x1ad806,_0x30267e){if('pending'!==_0x30267e)return;const _0xcf0cb4=this['_resultViews']['find'](_0x3b47f3=>_0x3b47f3['id']===_0x1ad806);_0xcf0cb4&&(_0xcf0cb4['status']=_0x30267e,_0xcf0cb4['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x1b1f50,_0x29db7f){this['headerTitle']=_0x1b1f50,this['headerSubtitle']=_0x29db7f||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new zn(this['locale'],jn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x4adc69=new _0x2bc1f3(this['locale']),_0x47a3e5=[];for(let _0x26b609=0x0;_0x26b609<0x10;_0x26b609++){const _0x223239=this['_createSkeletonLoader']();_0x223239['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x47a3e5['push'](_0x223239);}return _0x4adc69['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x2c4b7f=>!_0x2c4b7f)]},'children':_0x47a3e5}),_0x4adc69;}['_createResultsBodyView'](){const _0x11e1d6=new _0x2bc1f3(this['locale']);return _0x11e1d6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x7bd068=>_0x7bd068)]},'children':this['_resultViews']}),_0x11e1d6;}['_createErrorView'](){const _0x5734a2=new _0x2bc1f3(this['locale']),_0x4edd34=new Ht(this['locale']),t=this['locale']['t'];return _0x5734a2['delegate']('retryReview')['to'](this),_0x4edd34['set']({'label':t('Try\x20again'),'withText':!0x0,'class':cn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x4edd34['on']('execute',()=>{this['fire']('retryReview');}),_0x5734a2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x3e8e6e=>!_0x3e8e6e),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x5c162d=>'chunk'===_0x5c162d)]},'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',_0x10d148=>'chunk'===_0x10d148)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x523e93=>'general'!==_0x523e93)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2f1656=>'chunk'!==_0x2f1656)]},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x4edd34]}),_0x5734a2;}['_createCancelButtonView'](){const _0x3352f7=new Ht(this['locale']);return _0x3352f7['set']({'label':us(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[cn+'\x20ck-ai-button-stop-generating'],'icon':it}),_0x3352f7['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1fca0b=>_0x1fca0b),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x183f0c=>_0x183f0c)]}}),_0x3352f7['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3352f7;}['_createToggleDiffButtonView'](){const _0x30383e=new Ht(this['locale']);_0x30383e['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x30383e['bind']('isEnabled')['to'](this,'isError',_0x247056=>!_0x247056),_0x30383e['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x43dc20=>!_0x43dc20),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x370e24=>_0x370e24)]}});const _0x28203c=us(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x7cb0ca=us(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x30383e['bind']('isOn')['to'](this,'isToggleDiffOn',_0x23c60c=>_0x23c60c),_0x30383e['bind']('icon')['to'](this,'isToggleDiffOn',_0x4709a2=>_0x4709a2?_0x547c0a:_0xc61baf),_0x30383e['bind']('label')['to'](this,'isToggleDiffOn',_0x108f5f=>_0x108f5f?_0x28203c:_0x7cb0ca),_0x30383e['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x30383e;}['_createAcceptAllButtonView'](){const _0xf94d96=new Ht(this['locale']);return _0xf94d96['set']({'label':us(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0xf94d96['bind']('isEnabled')['to'](this,'isError',_0x318351=>!_0x318351),_0xf94d96['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x24e0a9=>!_0x24e0a9),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x304d3d=>_0x304d3d)]}}),_0xf94d96['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0xf94d96;}['_createExitReviewButtonView'](){const _0xb62ba7=new Ht(this['locale']);return _0xb62ba7['set']({'label':us(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0xb62ba7['extendTemplate']({'attributes':{'class':[ln,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x49ceca=>!_0x49ceca),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3a62bf=>_0x3a62bf)]}}),_0xb62ba7['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0xb62ba7;}['_createResultHeaderView'](){const _0xe03c27=new _0x2bc1f3(this['locale']),_0x135995=this['_createTitleView']();return _0xe03c27['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x24fed4=>_0x24fed4)]},'children':[_0x135995,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x19b8ea=>!_0x19b8ea)],'title':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0xe03c27;}['_createTitleView'](){const _0x368c2f=new _0x2bc1f3(this['locale']),_0x458c94=new lr();return _0x458c94['bind']('isVisible')['to'](this,'isResultReady',_0x25ab5d=>!_0x25ab5d),_0x368c2f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x37798f=>_0x37798f)]},'children':[_0x458c94,{'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')}]}]}]}),_0x368c2f;}['_createFinishReviewButtonView'](){const _0x19a4d7=new Qa(us(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x19a4d7['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x423576=>!_0x423576)]}}),_0x19a4d7['delegate']('finishReview')['to'](this),_0x19a4d7;}},za=class extends zt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x52c40d,_0x5ce1d5){super(_0x52c40d),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x5ce1d5['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x5ce1d5['headerText']);const _0x22fe4a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x22fe4a['if']('isVisible','ck-hidden',_0x3aee65=>!_0x3aee65)]},'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':_0x5ce1d5['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x5f1076){const _0x151be4=new Qa(_0x5f1076,this['locale']);return _0x151be4['delegate']('finishReview')['to'](this),_0x151be4;}['_createResultHeaderView'](_0x345b78){const _0x59fcae=new _0x2bc1f3(this['locale']);return _0x59fcae['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x345b78},'children':[{'text':_0x345b78}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x59fcae;}},ja=class extends _0x2bc1f3{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0xf0e12a,_0x3d47c9){super(_0xf0e12a),this['_defaultValue']=_0x3d47c9['default']||(_0x3d47c9['data']['length']>0x0?_0x3d47c9['data'][0x0]['id']:''),this['_defaultLabel']=_0x3d47c9['data']['find'](_0x277798=>_0x277798['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x4e3ad4(this['locale']);const _0x4aedca=this['_prepareListOptions'](_0x3d47c9['data']);_0xee0f07(this['_dropdownView'],_0x4aedca,{'role':'menu','ariaLabel':_0x3d47c9['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5b42b5=>{_0x5b42b5['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0xcc370c=>{this['formValue']=_0xcc370c['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0xcc370c['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'](_0x3ea224=[]){const _0x4a82f0=new ct();this['resetToDefault']();for(const _0x47f5db of _0x3ea224){const _0x347494=new _0x1ca844({'label':_0x47f5db['label'],'withText':!0x0,'role':'menuitemradio','id':_0x47f5db['id'],'model':_0x47f5db});_0x347494['bind']('isOn')['to'](this,'formValue',_0x3d1c40=>_0x3d1c40===_0x347494['id']);const _0x9d14e2={'type':'button','model':_0x347494};_0x4a82f0['add'](_0x9d14e2);}return _0x4a82f0;}},Ja=class extends zt{['_formItem']=null;constructor(_0x187306,_0x12aeba,_0x23cbdc){if(super(_0x187306),this['argsKey']=_0x12aeba?.['argsKey'],'dropdown'===_0x12aeba['formType'])this['_formItem']=new ja(this['locale'],_0x12aeba);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x35c31a=new Kt(this['locale'],{'children':[this['_formItem']],'class':[_0x23cbdc?'ck-form__row_with-submit':'']});_0x23cbdc&&_0x35c31a['children']['add'](_0x23cbdc),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x35c31a]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Za=class AIReviewCorePromptInputView extends _0x28d4e5{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x426ed1){super(_0x426ed1),this['set']('isEmpty',!0x0),this['keystrokes']=new _t(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}},th=class extends _0x2bc1f3{['focusTracker']=new dt();['keystrokes']=new _t();['focusCycler'];['_focusables']=new _0x17d17e();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x440f2a,_0x259a89,_0x66919f=!0x1){super(_0x440f2a),this['_check']=_0x259a89,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x259a89['defaultModel']?_0x259a89['defaultModel']['id']:'',this['_defaultLabel']=_0x259a89['defaultModel']?_0x259a89['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new qt(this['locale'],()=>new Za(_0x440f2a)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new ct(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x66919f),_0xee0f07(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Kt(this['locale'],{'children':[this['promptInputView']]}),new Kt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x5ca024,_0x3ebcf6)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x3ebcf6()):_0x3ebcf6();}),this['focusCycler']=new Gt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x35a4bb=>{this['_focusables']['add'](_0x35a4bb),this['focusTracker']['add'](_0x35a4bb['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 _0x45a6f4 of this['_getFormValidators']()){const _0x53b4d5=_0x45a6f4();if(_0x53b4d5)return this['promptInputView']['errorText']=_0x53b4d5,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return us(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x551b5a=new Ht(this['locale']),t=this['locale']['t'];return _0x551b5a['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x551b5a['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x551b5a;}['_createCancelButtonView'](){const _0x2eea05=new Ht(this['locale']),t=this['locale']['t'];return _0x2eea05['set']({'label':t('Cancel'),'withText':!0x0,'class':ln}),_0x2eea05['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xdc760e=>{_0xdc760e['stopPropagation']();})}}),_0x2eea05['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x2eea05;}['_setModelList'](_0x28395e){this['_modelSelectionDropdownItems']['clear']();const _0x457a8c=this['_check']['models'];if(_0x28395e)this['set']('modelDisplayMode','hidden');else{const _0x5768f8=0x1===_0x457a8c['length'];this['set']('modelDisplayMode',_0x5768f8?'name':'selector');}if(this['resetToDefault'](),_0x457a8c?.['length']){0x1===_0x457a8c['length']&&this['set']('activeModelName',_0x457a8c[0x0]['name']||_0x457a8c[0x0]['id']);for(const _0x581ed7 of _0x457a8c){const _0x1887ca=new _0x1ca844({'label':_0x581ed7['name'],'withText':!0x0,'role':'menuitemradio','id':_0x581ed7['id'],'model':_0x581ed7});_0x1887ca['bind']('isOn')['to'](this,'modelId',_0x58e68c=>_0x58e68c===_0x581ed7['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x1887ca,'labelView':new ih(this['locale'],_0x581ed7)});}}}['_createModelSelectionDropdown'](){const _0x24e39c=_0x4e3ad4(this['locale']);return _0x24e39c['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x24e39c['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':ln}),_0x24e39c['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x19cb4f=>'selector'===_0x19cb4f),this['listenTo'](_0x24e39c,'execute',_0xe383fc=>{this['modelId']=_0xe383fc['source']['model']['id'],_0x24e39c['buttonView']['label']=_0xe383fc['source']['label'];}),_0x24e39c;}['_createModelNameView'](){const _0x114fe4=new eh(this['locale']);return _0x114fe4['bind']('text')['to'](this,'activeModelName',_0x228433=>_0x228433??''),_0x114fe4['bind']('isVisible')['to'](this,'modelDisplayMode',_0x47f49c=>'name'===_0x47f49c),_0x114fe4;}['_createActionsFooterView'](){const _0x518287=new _0x2bc1f3(this['locale']);return _0x518287['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']]}]}),_0x518287;}},eh=class extends _0x2bc1f3{constructor(_0x49cb26){super(_0x49cb26),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2568e7=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x2568e7['if']('isVisible','ck-hidden',_0xe7db93=>!_0xe7db93)]},'children':[{'text':_0x2568e7['to']('text')}]});}},ih=class extends Dt{constructor(_0x1c2445,_0x59d657){super();const _0x26d12a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x26d12a['to']('style'),'id':_0x26d12a['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x26d12a['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x59d657['description']||'']}]}]});}},sh=class extends zt{['_formItemsCollection']=new _0x17d17e();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x9217ce,_0x15b0eb,_0x260690,_0x247aeb=!0x1){super(_0x9217ce),this['_hideModels']=_0x247aeb,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x15b0eb['isParameterized']);const _0x2b5254=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',_0x2fc032=>_0x2fc032),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x24fa85=>_0x24fa85)],'style':{'--ck-ai-review-check-list-item-index':_0x260690}},'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':_0x15b0eb['title']}]},_0x2b5254]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x15b0eb['description']?[{'text':_0x15b0eb['description']}]:[]}]}]},..._0x15b0eb['isParameterized']?[this['_createParameterizedView'](_0x15b0eb)]:[],...'custom'===_0x15b0eb['id']?[this['_createCustomView'](_0x15b0eb,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x15b0eb['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x15b0eb['id'],'args':_0x15b0eb['useArgs']?_0x15b0eb['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0xf3e5e2({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x539ab1=>{_0x539ab1['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x4be56f=new Yt();return _0x4be56f['content']=_0x192090,_0x4be56f['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x4be56f;}['_createParameterizedView'](_0x157bd0){const _0x3be139=new _0x2bc1f3(),_0x3748dd=this['_createFormView'](_0x157bd0);return _0x3be139['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3da154=>!_0x3da154)]},'children':[_0x3748dd]}),_0x3be139;}['_createFormView'](_0x149b03){const _0x26ca5e=new _0x2bc1f3(),_0x5126b3=Array['isArray'](_0x149b03['options'])?_0x149b03['options']:[],_0x32ccfd=new Ht(this['locale']),t=this['locale']['t'];_0x32ccfd['set']({'label':t('Submit'),'withText':!0x0,'class':hn}),_0x32ccfd['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1be379=>{_0x1be379['stopPropagation']();})}}),_0x32ccfd['on']('execute',()=>{const _0x4823a8=[],_0x9fa325={};this['_formItemsCollection']['forEach'](_0x144973=>{_0x4823a8['push'](_0x144973['value']),_0x149b03['useArgs']&&_0x149b03['options']&&(_0x9fa325[_0x144973['argsKey']]=_0x144973['value']);}),this['fire']('runReviewCheck',{'id':_0x149b03['id'],'params':_0x4823a8['length']?_0x4823a8:void 0x0,'args':Object['keys'](_0x9fa325)['length']?_0x9fa325:void 0x0});});const _0x18e36d=_0x5126b3['length'];return _0x5126b3['forEach']((_0x3ad859,_0x2f64cd)=>{const _0x94b1a9=_0x2f64cd===_0x18e36d-0x1;this['_formItemsCollection']['add'](new Ja(this['locale'],_0x3ad859,_0x94b1a9?_0x32ccfd:null));}),_0x26ca5e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x26ca5e;}['_createCustomView'](_0x7a709e,_0x2a7b4d=!0x1){return this['_customCheckView']=new th(this['locale'],_0x7a709e,_0x2a7b4d),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',_0x1797de=>!_0x1797de)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x3546ba,_0x1bed48,_0x1c4012)=>{_0x1c4012||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},nh=class extends zt{['_checkViews'];constructor(_0x4f3c2d){super(_0x4f3c2d),this['_checkViews']=new _0x17d17e(),this['_setupTemplate']();}['setChecks'](_0x1862f8,_0x16977d=!0x1){this['_checkViews']['clear']();for(const [_0x57fbb5,_0x3bcc11]of _0x1862f8['entries']()){const _0xecf3cc=new sh(this['locale'],_0x3bcc11,_0x57fbb5,_0x16977d);_0xecf3cc['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0xecf3cc);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x1f352f of this['_checkViews'])_0x1f352f instanceof sh&&_0x1f352f['resetToDefault']();}['_setupTemplate'](){const _0x271f16=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x271f16['if']('isVisible','ck-hidden',_0x2f42c8=>!_0x2f42c8)]},'children':this['_checkViews']});}},rh=class extends Ya{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x54c4ff=this['context']['plugins']['get']('AITabs'),_0x12e6d8=this['context']['locale'],_0x2a1168=new Mo(_0x12e6d8,{'label':us(_0x12e6d8,'AI_REVIEW_MODE'),'icon':_0x1b2515,'class':'ck-ai-header_review','showResizeButton':_0x54c4ff['showResizeButton']});return _0x2a1168['delegate']('resizeTabs')['to'](_0x54c4ff),_0x2a1168['bind']('isMaximized')['to'](_0x54c4ff['view'],'isMaximized',_0x2b1015=>_0x2b1015),new qa(this['context']['locale'],{'header':_0x2a1168,'list':new nh(_0x12e6d8),'results':new Xa(_0x12e6d8,{'generalErrorText':us(_0x12e6d8,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x12e6d8,{'headerText':us(_0x12e6d8,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':us(_0x12e6d8,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x12e6d8,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x3d4356=this['context']['plugins']['get']('AITabs');_0x3d4356['view']['on']('activateTab',(_0x459055,{newTab:_0x1d44e8,oldTab:_0x311170})=>{'reviewMode'===_0x1d44e8?this['fire']('getReviewCheckList'):'reviewMode'===_0x311170&&this['fire']('leaveReview');}),_0x3d4356['view']['addTab']({'id':'reviewMode','buttonLabel':us(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x1b2515,'order':0x0,'content':this['_mainView']});}};const oh='review-',ah=['softBreak'],hh=['htmlScript','htmlStyle','htmlCustomElement'];var ch=class extends _0x394201{static get['requires'](){return[_0x4e4fa1,Is];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x1c9caa){super(_0x1c9caa),this['_domEmitter']=new(lt())(),this['_eventEmitter']=new(ut())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x545a80=_0x50e674=>this['_scheduleAttachReviewEditingToEditor'](_0x50e674);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x2e6d5b)return void _0x545a80(this['context']);const _0x557c72=this['context'];for(const _0x3639ad of _0x557c72['editors'])_0x545a80(_0x3639ad);this['listenTo'](_0x557c72['editors'],'add',(_0x354740,_0x417c47)=>{_0x545a80(_0x417c47);}),this['listenTo'](_0x557c72['editors'],'remove',(_0x1411fa,_0x3518c6)=>{for(const [_0xc62dee,_0x3692d5]of this['_markers'])_0x3692d5['editor']===_0x3518c6&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xc62dee,'changeId':_0x3692d5['groupId']}),this['_markers']['delete'](_0xc62dee));});}['_scheduleAttachReviewEditingToEditor'](_0x193ff2){const _0x3353d1=()=>{'destroyed'!==_0x193ff2['state']&&_0x193ff2['conversion']&&this['_attachReviewEditingToEditor'](_0x193ff2);};if('ready'===_0x193ff2['state'])return void _0x3353d1();const _0x350e15=()=>{this['stopListening'](_0x193ff2,'ready',_0x350e15),_0x3353d1();};this['listenTo'](_0x193ff2,'ready',_0x350e15);}['_attachReviewEditingToEditor'](_0x179cb0){this['_reviewEditingAttachedEditors']['has'](_0x179cb0)||(_0x179cb0['conversion']['for']('editingDowncast')['markerToElement']({'model':oh+'insert','view':(_0x223650,{writer:_0x30da55})=>{const _0x2f9dc4=this['_markers']['get'](_0x223650['markerName']),_0x58996d={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x2f9dc4?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x223650['markerName']};return _0x30da55['createUIElement']('span',_0x58996d,function(_0x208c71){const _0x33fe2d=this['toDomElement'](_0x208c71);return _0x33fe2d['innerHTML']=_0x2f9dc4?.['content']?.['asString']||'',_0x33fe2d;});}}),_0x179cb0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-only','view':_0x37aa47=>{const _0x4c8b2e=this['_markers']['get'](_0x37aa47['markerName']),_0x284cd3=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x4c8b2e?.['id']||'')&&_0x284cd3['push']('ck-ai_review__change_active'),{'classes':_0x284cd3,'attributes':{'data-marker-id':_0x37aa47['markerName']}};}}),_0x179cb0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-context','view':_0x325dfd=>{const _0x1c954d=this['_markers']['get'](_0x325dfd['markerName']),_0x20abd9=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x1c954d?.['id']||'')&&_0x20abd9['push']('ck-ai_review__change_active'),{'classes':_0x20abd9,'attributes':{'data-marker-id':_0x325dfd['markerName']}};}}),_0x179cb0['conversion']['for']('editingDowncast')['markerToHighlight']({'model':oh+'remove-text','view':_0x11ed2b=>{const _0x24330a=this['_markers']['get'](_0x11ed2b['markerName']),_0x3d3c1b=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x24330a?.['id']||'')&&_0x3d3c1b['push']('ck-ai_review__change_active'),{'classes':_0x3d3c1b,'attributes':{'data-marker-id':_0x11ed2b['markerName']}};}}),_0x179cb0['conversion']['for']('dataDowncast')['markerToElement']({'model':oh+'suggestion-context','view':(_0x2c6c11,{writer:_0x4b99f0})=>_0x4b99f0['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x2c6c11['isOpening']?'start':'end')})}),_0x179cb0['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x3d3bc3,'view':_0x10b9f7}),this['_updateMouseMarkerInteractionListeners'](_0x179cb0),this['listenTo'](_0x179cb0,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x179cb0),{'priority':'lowest'}),this['listenTo'](_0x179cb0,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x179cb0),{'priority':'lowest'}),_0x179cb0['model']['document']['registerPostFixer'](_0x4e4394=>this['_validateMarkers'](_0x179cb0,_0x4e4394)),_0x179cb0['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x179cb0)),this['_reviewEditingAttachedEditors']['add'](_0x179cb0));}['_updateMouseMarkerInteractionListeners'](_0x5278c7){let _0x4e29fd=this['_boundEditables']['get'](_0x5278c7);_0x4e29fd||(_0x4e29fd=new Map(),this['_boundEditables']['set'](_0x5278c7,_0x4e29fd));const _0x25e9c5=new Set(_0x5278c7['ui']['getEditableElementsNames']());for(const _0x4cb0b0 of _0x25e9c5){if(_0x4e29fd['has'](_0x4cb0b0))continue;const _0x33e559=_0x5278c7['ui']['getEditableElement'](_0x4cb0b0);_0x4e29fd['set'](_0x4cb0b0,_0x33e559),this['_attachMouseMarkerInteractionListeners'](_0x33e559);}for(const [_0xeacc0e,_0x4f255e]of _0x4e29fd)_0x25e9c5['has'](_0xeacc0e)||(_0x4e29fd['delete'](_0xeacc0e),this['_domEmitter']['stopListening'](_0x4f255e));}['_attachMouseMarkerInteractionListeners'](_0x1799b8){this['_domEmitter']['listenTo'](_0x1799b8,'mouseup',(_0x899ed5,_0x40f55)=>{const _0x32f831=_0x40f55['target'],_0x45026a=this['_findMarkerElement'](_0x32f831);if(!_0x45026a)return;const _0x4fe53f=_0x45026a['getAttribute']('data-marker-id'),_0x48ca66=_0x4fe53f['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x4fe53f,'changeId':_0x48ca66,'markerElement':()=>this['_findMarkerElementById'](_0x4fe53f),'domEvent':_0x40f55});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1799b8,'mouseover',(_0x5c3e2c,_0x3b74d1)=>{const _0x5e5010=_0x3b74d1['target'],_0x1095a9=_0x3b74d1['relatedTarget'];let _0x1dadcc=this['_findMarkerElement'](_0x5e5010);if(!_0x1dadcc&&_0x1095a9&&(_0x1dadcc=this['_findMarkerElement'](_0x1095a9)),!_0x1dadcc)return;const _0x29f7ea=_0x1dadcc['getAttribute']('data-marker-id'),_0x8137c8=_0x29f7ea['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x8137c8,'markerElement':()=>this['_findMarkerElementById'](_0x29f7ea),'domEvent':_0x3b74d1});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0xb2e5d9((_0x4cd665,_0x139166)=>{const _0x3e72ac=_0x139166['target'];this['_findMarkerElement'](_0x3e72ac)||_0x3e72ac['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x29feae=this['context']['plugins']['get']('AIEditing'),_0x51975d=ds(this['context']);if(!_0x51975d['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x538a53=new Set(),_0x3acd2f=[],_0x11a161=new Map();for(const _0x1d835f of _0x51975d)for(const _0x36244e of _0x1d835f['model']['document']['getRoots']()){if('$graveyard'===_0x36244e['rootName'])continue;const _0xc2a420=this['_buildDocumentDataSliceForRoot'](_0x1d835f,_0x36244e,_0x29feae,_0x538a53);_0x3acd2f['push'](_0xc2a420['content']);for(const [_0x304cac,_0x2b408e]of _0xc2a420['elements'])_0x11a161['set'](_0x304cac,_0x2b408e);}return{'elements':_0x11a161,'content':_0x3acd2f['join']('')};}['_buildDocumentDataSliceForRoot'](_0x1217b0,_0x56aeb5,_0x16faf3,_0x2593b7){const _0xed5ba1=_0x1217b0['model'],_0x4ae6b1=new _0x31aa53();for(const _0x2ac999 of _0x56aeb5['getChildren']())_0x4ae6b1['_appendChild'](_0x2ac999['_clone'](!0x0));for(const _0x147b5c of _0xed5ba1['markers']){const _0x3cdd9a=_0x147b5c['getRange']();_0x3cdd9a&&_0x3cdd9a['root']['rootName']===_0x56aeb5['rootName']&&_0x4ae6b1['markers']['set'](_0x147b5c['name'],this['_changeRangeOwnerDocument'](_0x3cdd9a['clone'](),_0x4ae6b1));}const _0x325731=new Map(),_0x5d9cfe=_0xed5ba1['document']['version'],_0x5db41f=new _0xaa3b47({'ignoreElementEnd':!0x0,'startPosition':_0xed5ba1['createPositionAt'](_0x4ae6b1,0x0)});for(const {item:_0x1d1099}of _0x5db41f){if(_0x1d1099['is']('element')&&_0x1d1099['name']&&hh['includes'](_0x1d1099['name'])){const _0x34b7db=this['_upsertDataId'](_0x1d1099,()=>_0x16faf3['_nextDataId'](_0x2593b7));_0x2593b7['add'](_0x34b7db);}if(!_0x1d1099['is']('$textProxy'))continue;const _0x4fe601=_0x1d1099['parent'];if(!_0x4fe601||!_0x4fe601['is']('element'))continue;const _0x591033=this['_upsertDataId'](_0x4fe601,()=>_0x16faf3['_nextDataId'](_0x2593b7));_0x2593b7['add'](_0x591033);for(const _0x2aa8b1 of _0x4fe601['getChildren']())_0x2aa8b1['is']('element')&&(_0x2aa8b1['name']&&ah['includes'](_0x2aa8b1['name'])||_0x2593b7['add'](this['_upsertDataId'](_0x2aa8b1,()=>_0x16faf3['_nextDataId'](_0x2593b7))));let _0x1e6291=_0x4fe601;for(;_0x1e6291['parent']&&!_0x1e6291['parent']['is']('documentFragment');)_0x1e6291=_0x1e6291['parent'],_0x1e6291['hasAttribute'](_0x3d3bc3)&&_0x1e6291['_removeAttribute'](_0x3d3bc3);_0x325731['set'](_0x591033,{'editor':_0x1217b0,'rootName':_0x56aeb5['rootName'],'path':_0x4fe601['getPath'](),'documentVersion':_0x5d9cfe,'getContent':this['_createGetContentUsingDataIdFn'](_0x1e6291['_clone'](!0x0),_0x591033,_0x1217b0['data'])}),_0x5db41f['jumpTo'](_0xed5ba1['createPositionAfter'](_0x4fe601));}return{'content':_0x1217b0['data']['processor']['toData'](_0x1217b0['data']['toView'](_0x4ae6b1)),'elements':_0x325731};}['diffContent'](_0x18dadc,_0x2153c0,_0x36f357,_0x308365=!0x1){const {contentInitial:_0x2f40bb,contentNew:_0x26607f}=this['_neutralizeChangesOnUnsupportedElements'](_0x2153c0,_0x36f357),_0x3cc456=[],_0x336658=_0x18dadc['data']['parse'](_0x26607f,'$documentFragment'),_0x4d49d7=_0x18dadc['data']['parse'](_0x2f40bb,'$documentFragment'),_0x28920d=_0x18dadc['model']['createPositionAt'](_0x4d49d7,0x0);if(this['_haveSingleTopLevelElement'](_0x336658)){if(!this['_hasSameTopLevelElement'](_0x4d49d7,_0x336658))return _0x3cc456;}else{const _0x3dcc0a=_0x18dadc['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x4d49d7,_0x3dcc0a)||!this['_haveOnlyInlineContent'](_0x336658,_0x3dcc0a))return _0x3cc456;}const _0x12b55a=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x2f40bb,_0x26607f,{'targetEditor':_0x18dadc,'anchor':_0x28920d,'markDeletions':!0x0})['getOperations']()['filter'](_0x338d3b=>'insert'===_0x338d3b['type']||'marker'===_0x338d3b['type']&&_0x338d3b['name']['startsWith']('$markedRemove')),_0x53b7e7=this['_groupAdjacentOperations'](_0x12b55a),_0x50b1f4=[];if(_0x308365){if(_0x53b7e7['length']){const _0x332a87=_0x53b7e7[0x0]['operations'][0x0],_0x3fcc16='insert'===_0x332a87['type']?_0x332a87['position']:_0x332a87['newRange']['start'],_0x1f5134=this['_getPositionLimitingRange'](_0x3fcc16,_0x18dadc,'inside'),_0xf77f55=_0x1f5134?_0x336658['getChild'](0x0)['getChildren']():_0x336658['getChildren'](),_0x2d8354=_0x1f5134||_0x18dadc['model']['createRangeIn'](_0x4d49d7),_0x8a6cc7=[new _0x240713('$markedRemove:synthetic'+vt(),null,_0x2d8354,_0x18dadc['model']['document']['model']['markers'],!0x0,_0x18dadc['model']['document']['version']+0x1),new _0xf4afdb(_0x2d8354['end'],_0xf77f55,_0x18dadc['model']['document']['version']+0x2)];_0x50b1f4['push']({'operations':_0x8a6cc7,'operationsIsolated':_0x8a6cc7,'groupOffset':0x0});}}else _0x50b1f4['push'](..._0x53b7e7);let _0x3799cd=0x0;return _0x18dadc['model']['change'](_0x92b568=>{for(let _0x4b9652=0x0;_0x4b9652<_0x50b1f4['length'];_0x4b9652++){const _0x1791b3=_0x50b1f4[_0x4b9652],_0x507315=_0x92b568['createDocumentFragment']();for(const _0x11ebc3 of _0x4d49d7['getChildren']())_0x92b568['append'](_0x11ebc3['_clone'](!0x0),_0x507315);for(const _0x492383 of _0x1791b3['operationsIsolated'])if('insert'===_0x492383['type']){const _0x520b0f=_0x492383;_0x520b0f['baseVersion']=null,_0x520b0f['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x520b0f,_0x507315),_0x92b568['batch']['addOperation'](_0x492383),_0x18dadc['model']['applyOperation'](_0x492383);const _0x4f11ec='suggestion:insertion:id:authorId:'+_0x3799cd++,_0x4136ae=_0x18dadc['model']['createRange'](_0x520b0f['position'],_0x520b0f['position']['getShiftedBy'](_0x520b0f['howMany']));_0x507315['markers']['set'](_0x4f11ec,_0x4136ae);}else{if('marker'===_0x492383['type']&&_0x492383['name']['startsWith']('$markedRemove')){const _0x1c3955=_0x492383,_0x4f82a0='suggestion:deletion:id:authorId:'+_0x3799cd++;this['_changeOperationOwnerDocument'](_0x1c3955,_0x507315),_0x507315['markers']['set'](_0x4f82a0,_0x1c3955['newRange']);}}if(_0x308365)_0x3cc456['push']({..._0x1791b3,'context':this['_createGetContentFn'](_0x4d49d7,_0x18dadc['data']),'content':this['_createGetContentFn'](_0x4d49d7,_0x18dadc['data'])});else{const _0x26663f=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x1791b3['operationsIsolated'][0x0]),_0x507315),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x1791b3['operationsIsolated'][_0x1791b3['operationsIsolated']['length']-0x1]),_0x507315),_0x18dadc);_0x507315['markers']['set'](oh+'suggestion-context',new _0x4ab7a9(_0x26663f['start'],_0x26663f['end'])),_0x3cc456['push']({..._0x1791b3,'context':this['_createGetContextFn'](_0x507315,_0x18dadc['data'],{'ellipsisBefore':_0x26663f['hasContentBefore'],'ellipsisAfter':_0x26663f['hasContentAfter']}),'content':this['_createGetContentFn'](_0x507315,_0x18dadc['data'])});}}}),_0x3cc456;}['markChangePositionInEditorContent'](_0x1aa790,_0x3cdd83){if(!_0x1aa790['length'])return;const _0x44dc8e=_0x1aa790[0x0]['parent']['id'],_0x39dec3=_0x3cdd83['elements']['get'](_0x44dc8e);if(!_0x39dec3)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x44dc8e);const _0x469211=_0x39dec3['path'],_0x4f7ce3=_0x39dec3['editor'],_0xdfb498=_0x4f7ce3['model']['document']['getRoot'](_0x39dec3['rootName']);if(!_0xdfb498)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x39dec3['rootName']);const _0x16496d=_0x4f7ce3['model']['document']['history']['getOperations'](_0x39dec3['documentVersion']),_0x525a0a=[];for(const _0x5634e3 of _0x1aa790){const _0x520de2=_0x5634e3['operationsIsolated']['map'](_0x63fad3=>this['_translateOperationToEditorContent'](_0x63fad3,_0x469211,_0xdfb498));if(!_0x520de2||!_0x520de2['length'])continue;const _0x2d09de=_0x520de2['every'](_0x45a101=>'marker'===_0x45a101['type']&&_0x45a101['name']['startsWith']('$markedRemove')),_0x5a752b=_0xce3122(_0x520de2,_0x16496d,{'document':_0x4f7ce3['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x3302c2 of _0x5a752b)if('insert'===_0x3302c2['type']){const _0x946cf9=_0x3302c2,_0x50f5d7=_0x946cf9['nodes'];_0x4f7ce3['model']['change'](_0xa8aa31=>{const _0x3a765=_0xa8aa31['createDocumentFragment']();for(const _0xb4fb30 of _0x50f5d7)_0xa8aa31['append'](_0xb4fb30['_clone'](!0x0),_0x3a765);_0x525a0a['push']({'start':_0x946cf9['position'],'end':_0x946cf9['position'],'type':'insert','groupId':_0x5634e3['id'],'content':{'asString':this['_createGetContentFn'](_0x3a765,_0x4f7ce3['data'])(),'asFragment':_0x3a765}});});}else{if('marker'===_0x3302c2['type']&&_0x3302c2['name']['startsWith']('$markedRemove')){const _0x2c81b4=_0x3302c2;let _0x9ffd9f='remove-text';if(_0x2d09de){const _0x50dc84=this['_findAdjacentContextDistance'](_0x2c81b4['newRange']['start'],'backward',_0x4f7ce3['model']['schema']),_0x4d20b6=this['_findAdjacentContextDistance'](_0x2c81b4['newRange']['end'],'forward',_0x4f7ce3['model']['schema']);if(_0x50dc84||_0x4d20b6){const _0x177cec=_0x2c81b4['newRange']['start']['getShiftedBy'](-_0x50dc84),_0x527f9b=_0x2c81b4['newRange']['end']['getShiftedBy'](_0x4d20b6);_0x525a0a['push']({'start':_0x177cec,'end':_0x527f9b,'groupId':_0x5634e3['id'],'type':'remove-context'});}else _0x9ffd9f='remove-only';}_0x525a0a['push']({'start':_0x2c81b4['newRange']['start'],'end':_0x2c81b4['newRange']['end'],'groupId':_0x5634e3['id'],'type':_0x9ffd9f});}}}this['_insertMarkers'](_0x525a0a,_0x4f7ce3);}['clearAllMarkers'](){const _0xda094f=new Map();for(const _0x2a1625 of this['_markers']['keys']()){const _0x2e7321=this['_markers']['get'](_0x2a1625);_0x2e7321?.['editor']&&(_0xda094f['has'](_0x2e7321['editor'])||_0xda094f['set'](_0x2e7321['editor'],[]),_0xda094f['get'](_0x2e7321['editor'])['push'](_0x2a1625));}for(const [_0x567aad,_0x110649]of _0xda094f)_0x567aad['model']['change'](_0x1c7d1a=>{for(const _0x185811 of _0x110649)_0x567aad['model']['markers']['get'](_0x185811)&&_0x1c7d1a['removeMarker'](_0x185811);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x1b8dc6 of ds(this['context']))_0x1b8dc6['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x3bf449 of ds(this['context']))_0x3bf449['disableReadOnlyMode']('ai-review');}['applyChange'](_0x487418,_0x3f6d2a=null){const _0x3c257b=_0x487418['map'](_0x2faf0b=>this['_getMarkersDataForGroup'](_0x2faf0b))['flat'](),_0x29c955=new Map();for(const _0x1cead3 of _0x3c257b)_0x29c955['has'](_0x1cead3['editor'])||_0x29c955['set'](_0x1cead3['editor'],[]),_0x29c955['get'](_0x1cead3['editor'])['push'](_0x1cead3);for(const [_0x2c7763,_0x71d3a1]of _0x29c955){const _0x44b037=_0x2c7763['model'],_0x379bed=_0x2c7763['plugins']['has']('TrackChangesEditing')?_0x2c7763['plugins']['get']('TrackChangesEditing'):null,_0x5af578=_0x3f6d2a&&_0x379bed?new Set(_0x379bed['getSuggestions']()['map'](_0x1df482=>_0x1df482['id'])):null;_0x44b037['change'](_0x28e41b=>{const _0x3d9ad1=_0x28e41b['batch']['operations']['length'];for(const _0x181792 of _0x71d3a1){const _0x161bf7=_0x2c7763['model']['markers']['get'](_0x181792['id']);if(_0x161bf7){if('insert'===_0x181792['type']){if(!_0x181792['content'])continue;_0x44b037['insertContent'](_0x181792['content']['asFragment']||null,_0x161bf7['getRange']()['start']);}else'remove-text'!==_0x181792['type']&&'remove-only'!==_0x181792['type']||_0x44b037['deleteContent'](_0x44b037['createSelection'](_0x161bf7['getRange']()));_0x28e41b['removeMarker'](_0x181792['id']),this['_markers']['delete'](_0x181792['id']);}}if(_0x3f6d2a&&(Js(_0x28e41b['batch']['operations']['slice'](_0x3d9ad1),_0x3f6d2a),_0x379bed)){for(const _0x560160 of _0x379bed['getSuggestions']())_0x5af578['has'](_0x560160['id'])||_0x560160['setAttribute']('@ai',{'type':_0x3f6d2a});}});}}['rejectChange'](_0x226d6b){const _0x5d9f78=this['_getMarkersDataForGroup'](_0x226d6b),_0x2ef474=new Map();for(const _0x1bc0b6 of _0x5d9f78)_0x2ef474['has'](_0x1bc0b6['editor'])||_0x2ef474['set'](_0x1bc0b6['editor'],[]),_0x2ef474['get'](_0x1bc0b6['editor'])['push'](_0x1bc0b6);for(const [_0x3d9a0f,_0x5e2502]of _0x2ef474)_0x3d9a0f['model']['change'](_0x4d8a83=>{for(const _0x63301d of _0x5e2502)_0x4d8a83['removeMarker'](_0x63301d['id']),this['_markers']['delete'](_0x63301d['id']);});}['getEditor'](){return _s(this['context']);}['getEditors'](){return ds(this['context']);}['getEditorForChange'](_0x5d5ab1){return this['_getMarkersDataForGroup'](_0x5d5ab1)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x1296e0){const _0xab9f3b=Array['from'](this['_markers']['values']())['filter'](_0x5992c2=>_0x5992c2['groupId']===_0x1296e0);if(!_0xab9f3b['length'])return null;const _0x5bd2d0=0x1===_0xab9f3b['length']?_0xab9f3b[0x0]:this['_sortMarkers'](_0xab9f3b)[0x0],_0x34b5f7=_0x5bd2d0['editor']['model']['markers']['get'](_0x5bd2d0['id']);return _0x34b5f7?{'modelRange':_0x34b5f7['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x5bd2d0['id'])}:null;}['getContentElementForChange'](_0x4a78dd){const _0x1f6862=Array['from'](this['_markers']['values']())['filter'](_0x3efc3a=>_0x3efc3a['groupId']===_0x4a78dd);if(!_0x1f6862['length'])return null;const _0x241abd=0x1===_0x1f6862['length']?_0x1f6862[0x0]:this['_sortMarkers'](_0x1f6862)[0x0],_0x19f5b4=_0x241abd['editor'],_0x287a0c=_0x19f5b4['model']['markers']['get'](_0x241abd['id']);if(!_0x287a0c)return null;const _0x4b7aa5=_0x287a0c['getRange'](),_0x446573=_0x19f5b4['editing']['view']['getDomRoot'](_0x4b7aa5['root']['rootName'])||_0x19f5b4['editing']['view']['getDomRoot']();if(!_0x446573||!_0x4b7aa5)return null;let _0x22b1d2=_0x4b7aa5['start']['parent'];for(;_0x22b1d2['parent']&&!_0x22b1d2['parent']['is']('rootElement');)_0x22b1d2=_0x22b1d2['parent'];if(!_0x22b1d2||!_0x22b1d2['name'])return null;const _0x24d280=_0x446573['querySelector']('[data-marker-id=\x22'+_0x241abd['id']+'\x22]');if(!_0x24d280)return null;let _0x4f6e04=null;_0x19f5b4['model']['change'](_0x49fc32=>{_0x4f6e04=_0x49fc32['createDocumentFragment'](),_0x49fc32['append'](_0x22b1d2['_clone'](!0x0),_0x4f6e04);});const _0x194e4a=_0x19f5b4['data']['toView'](_0x4f6e04)['getChild'](0x0);return _0x24d280['closest'](_0x194e4a['name']);}['reactivateMarkers'](_0x14dbcf){const _0xa01011=this['_getMarkersDataForGroup'](_0x14dbcf);if(!_0xa01011['length'])return;const _0x5e28bd=Array['from'](this['_activeMarkers'])['sort'](),_0x455cd8=Array['from'](new Set(_0xa01011['map'](_0x3c8f9b=>_0x3c8f9b['id'])))['sort']();_0x5e28bd['join']('|')!==_0x455cd8['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x14dbcf));}['setMarkersInElementAsActive'](_0x3d6240){const _0x555c16=this['_getMarkersDataForGroup'](_0x3d6240);if(!_0x555c16['length'])return;const _0x32be29=_0x555c16[0x0]['editor'],_0x234c0a=new Set(_0x555c16['map'](_0x551121=>_0x551121['id'])),_0x17ad7c=Array['from'](_0x234c0a['values']())['map'](_0x5c9658=>_0x32be29['model']['markers']['get'](_0x5c9658))['filter'](_0x2626a8=>!!_0x2626a8);_0x234c0a['forEach'](_0x398db4=>{this['_activeMarkers']['add'](_0x398db4);}),_0x32be29['model']['change'](()=>{_0x17ad7c['forEach'](_0x362455=>{_0x32be29['editing']['reconvertMarker'](_0x362455);});});}['setAllMarkersAsInactive'](){const _0x100b1c=Array['from'](this['_activeMarkers']);if(!_0x100b1c['length'])return;this['_activeMarkers']['clear']();const _0x224bee=new Map();for(const _0x308aa6 of _0x100b1c){const _0x5b0bc7=this['_markers']['get'](_0x308aa6);if(!_0x5b0bc7)continue;const _0x282626=_0x5b0bc7['editor'],_0x5cb038=_0x282626['model']['markers']['get'](_0x308aa6);_0x5cb038&&(_0x224bee['has'](_0x282626)||_0x224bee['set'](_0x282626,[]),_0x224bee['get'](_0x282626)['push'](_0x5cb038));}for(const [_0x4988aa,_0x2948c1]of _0x224bee)_0x4988aa['model']['change'](()=>{_0x2948c1['forEach'](_0x20def6=>{_0x4988aa['editing']['reconvertMarker'](_0x20def6);});});}['_getPositionLimitingRange'](_0x3cc4f6,_0x95561b,_0x22cf9b='outside'){if(!_0x3cc4f6)return null;let _0x1ead57=_0x3cc4f6['parent'];for(;_0x1ead57&&_0x1ead57['parent']&&!_0x1ead57['parent']['is']('rootElement')&&!_0x95561b['model']['schema']['isLimit'](_0x1ead57)&&!_0x95561b['model']['schema']['isBlock'](_0x1ead57);)_0x1ead57=_0x1ead57['parent'];if(!_0x1ead57||!_0x1ead57['name']||_0x1ead57['is']('rootElement'))return null;let _0x59ee8d=null;return _0x95561b['model']['change'](_0x349deb=>{_0x59ee8d='inside'===_0x22cf9b?_0x349deb['createRangeIn'](_0x1ead57):_0x349deb['createRangeOn'](_0x1ead57);}),_0x59ee8d;}['_validateMarkers'](_0x3cc95e,_0xdaa325){const _0x4412fc=Array['from'](this['_markers']['keys']()),_0x1fc8cb=new Map();for(const _0x2e1f88 of _0x4412fc){const _0x2cae48=_0x3cc95e['model']['markers']['get'](_0x2e1f88);if(!_0x2cae48)continue;const _0x45e63c=_0x2cae48['getStart']()['root']['rootName']+':'+_0x2cae48['getStart']()['path'][0x0];_0x1fc8cb['has'](_0x45e63c)||_0x1fc8cb['set'](_0x45e63c,[]),_0x1fc8cb['get'](_0x45e63c)['push'](_0x2cae48);}const _0x277b57=new Set();for(const _0x26b19f of _0x3cc95e['model']['document']['differ']['getChanges']()){let _0x5151de='',_0x3a8bae=null;if('insert'===_0x26b19f['type'])_0x3a8bae=new _0x4ab7a9(_0x26b19f['position'],_0x26b19f['position']['getShiftedBy'](_0x26b19f['length'])),_0x5151de=_0x26b19f['position']['root']['rootName']+':'+_0x26b19f['position']['path'][0x0];else{if('remove'!==_0x26b19f['type'])continue;_0x3a8bae=new _0x4ab7a9(_0x26b19f['position']),_0x5151de=_0x26b19f['position']['root']['rootName']+':'+_0x26b19f['position']['path'][0x0];}const _0x20a539=_0x1fc8cb['get'](_0x5151de)||[];if(_0x20a539['length']){for(const _0x572c96 of _0x20a539)if(_0x3a8bae['root']['rootName']===_0x572c96['getRange']()['root']['rootName']&&('insert'!==_0x26b19f['type']||!_0x3a8bae['containsRange'](_0x572c96['getRange']()))&&(_0x3a8bae['isIntersecting'](_0x572c96['getRange']())||_0x3a8bae['start']['isTouching'](_0x572c96['getRange']()['end'])||_0x3a8bae['end']['isTouching'](_0x572c96['getRange']()['start']))){const _0x57095a=this['_parseMarkerName'](_0x572c96['name']);Array['from'](this['_markers']['values']())['filter'](_0x26aa19=>_0x26aa19['groupId']===_0x57095a['groupId'])['forEach'](_0x3e328f=>_0x277b57['add'](_0x3e328f['id']));}}}if(_0x277b57['size']){for(const _0x3cf437 of _0x277b57)_0xdaa325['removeMarker'](_0x3cf437);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x47c645){for(const {name:_0x169815,data:_0x170167}of _0x47c645['model']['document']['differ']['getChangedMarkers']()){if(!_0x169815['startsWith'](oh))continue;const _0x33a8e7=_0x170167['oldRange'],_0x26cda4=_0x170167['newRange'],_0x6a8232=_0x33a8e7&&'$graveyard'===_0x33a8e7['root']['rootName'],_0x1e1e51=_0x26cda4&&'$graveyard'===_0x26cda4['root']['rootName'];if(_0x6a8232&&_0x1e1e51)continue;const _0x595343=this['_parseMarkerName'](_0x169815);this['_markers']['get'](_0x169815)&&(_0x1e1e51||!_0x26cda4?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x169815,'changeId':_0x595343['groupId']}):_0x6a8232&&_0x26cda4&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x169815,'changeId':_0x595343['groupId']}));}}['_parseMarkerName'](_0x45d7fa){const _0x50e727=_0x45d7fa['split'](':'),_0x4b7781=(_0x50e727[0x1]||'')['split']('_');return{'prefix':_0x50e727[0x0],'groupId':_0x4b7781[0x0],'suffix':_0x4b7781[0x1]};}['_translateOperationToEditorContent'](_0x1f4ee3,_0x1ad82a,_0x57f051){if('insert'===_0x1f4ee3['type']){const _0x59218=_0x1f4ee3;return new _0xf4afdb(this['_changePosition'](_0x1ad82a['concat'](_0x59218['position']['offset']),_0x57f051),_0x59218['nodes'],_0x59218['baseVersion']);}if('marker'===_0x1f4ee3['type']&&_0x1f4ee3['name']['startsWith']('$markedRemove')){const _0x1bfebc=_0x1f4ee3;return new _0x240713(_0x1bfebc['name'],_0x1bfebc['oldRange'],this['_changeRange'](_0x1bfebc['newRange'],_0x1ad82a['concat'](_0x1bfebc['newRange']['start']['offset']),_0x1ad82a['concat'](_0x1bfebc['newRange']['end']['offset']),_0x57f051),_0x1bfebc['_markers'],_0x1bfebc['affectsData'],_0x1bfebc['baseVersion']);}return _0x1f4ee3;}['_groupAdjacentOperations'](_0x38100b){if(!_0x38100b['length'])return[];const _0x3ae02f=[];let _0x21d5cf=0x0,_0x47ad29=0x0,_0x558601=[];for(let _0x3cb593=0x0;_0x3cb593<=_0x38100b['length'];_0x3cb593++){const _0x1475a7=_0x38100b[_0x3cb593],_0x215608=_0x38100b[_0x3cb593-0x1];!_0x1475a7||_0x215608&&!this['_getOperationEnd'](_0x215608)['isTouching'](this['_getOperationStart'](_0x1475a7))?(_0x3ae02f['push']({'operations':_0x558601,'operationsIsolated':_0x558601['map'](_0x2392c=>this['_shiftOperation'](_0x2392c['clone'](),-_0x47ad29)),'groupOffset':_0x21d5cf}),_0x558601=_0x1475a7?[_0x1475a7]:[],_0x47ad29+=_0x21d5cf,_0x21d5cf=0x0):_0x558601['push'](_0x1475a7),_0x1475a7&&'insert'===_0x1475a7['type']&&(_0x21d5cf+=_0x1475a7['howMany']);}return _0x3ae02f;}['_findAdjacentContextDistance'](_0x2dad54,_0x161efa,_0x53bd07,_0x31c0d6=0x1){const _0x3822d4=new _0xaa3b47({'startPosition':_0x2dad54,'direction':_0x161efa});let _0x219a12=0x0;for(let _0x5918a5=0x0;_0x5918a5<_0x31c0d6;_0x5918a5++){let _0x3e89cc=0x0,_0x3369e0=!0x1,_0x1a57f0='forward'===_0x161efa?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x356b6e}of _0x3822d4)if(_0x356b6e['is']('$textProxy')){const _0x41eb15=_0x1a57f0['exec'](_0x356b6e['data']);if(_0x41eb15&&_0x41eb15['length']){if(_0x3e89cc+='forward'===_0x161efa?_0x41eb15['index']+_0x41eb15[0x0]['length']:_0x356b6e['data']['length']-_0x41eb15['index'],_0x41eb15[0x0]['length']!==_0x356b6e['data']['length'])break;_0x3369e0=!0x0,_0x1a57f0='forward'===_0x161efa?/^\w+/:/\w+$/;}else{if(_0x3369e0)break;_0x3e89cc+=_0x356b6e['offsetSize'];}}else{if(_0x356b6e['is']('element')){_0x53bd07['isInline'](_0x356b6e)&&!_0x3369e0&&(_0x3e89cc+=0x1);break;}}_0x219a12+=_0x3e89cc,_0x3822d4['jumpTo'](_0x2dad54['getShiftedBy']('forward'===_0x161efa?_0x219a12:-_0x219a12));}return _0x219a12;}['_getChangeContext'](_0x54e6bb,_0x3c5dd4,_0x290dbf){const _0x30d6b2=_0x290dbf['model']['schema'],_0x279f02=this['_findAdjacentContextDistance'](_0x54e6bb,'backward',_0x30d6b2,0x6),_0x4620cb=this['_findAdjacentContextDistance'](_0x3c5dd4,'forward',_0x30d6b2,0x6),_0x2a150c=_0x54e6bb['getShiftedBy'](-_0x279f02),_0x328fcc=_0x3c5dd4['getShiftedBy'](_0x4620cb);return{'start':_0x2a150c,'end':_0x328fcc,'hasContentBefore':!_0x2a150c['isAtStart'],'hasContentAfter':!_0x328fcc['isAtEnd']};}['_insertMarkers'](_0x103092,_0x49f13c){const _0x1a5427=this['context']['plugins']['get']('AIEditing'),_0x115200=new Set();_0x49f13c['model']['change'](_0x2077d5=>{for(const _0x4e7a93 of _0x103092){const _0xb7cabb=''+oh+_0x4e7a93['type']+':'+_0x4e7a93['groupId']+'_'+_0x1a5427['_nextDataId'](_0x115200);this['_markers']['set'](_0xb7cabb,{'id':_0xb7cabb,'groupId':_0x4e7a93['groupId'],'type':_0x4e7a93['type'],'content':_0x4e7a93['content'],'editor':_0x49f13c}),_0x2077d5['addMarker'](_0xb7cabb,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2077d5['createRange'](_0x4e7a93['start'],_0x4e7a93['end'])});}});}['_createGetContextFn'](_0x3e06ca,_0x39ab4d,_0x1b8dcb){let _0x3e68c2='';return()=>{if(!_0x3e68c2){const _0x5ab4ca=_0x39ab4d['toView'](_0x3e06ca,{'showSuggestionHighlights':!0x0});let _0x5bbdc5=_0x5ab4ca['getChild'](0x0);if(_0x5bbdc5['is']('containerElement')||(_0x5bbdc5=_0x5ab4ca),!_0x5bbdc5)return'';let _0x324846=!0x1;const _0xc96267=[];for(const _0x8ee1ed of _0x5bbdc5['getChildren']())_0x8ee1ed['is']('element','span')&&_0x8ee1ed['hasClass']('ck-ai_review-marker_context-end')&&(_0x324846=!0x1),_0x324846&&_0xc96267['push'](_0x8ee1ed),_0x8ee1ed['is']('element','span')&&_0x8ee1ed['hasClass']('ck-ai_review-marker_context-start')&&(_0x324846=!0x0);_0x5bbdc5['_removeChildren'](0x0,_0x5bbdc5['childCount']),_0x1b8dcb?.['ellipsisBefore']&&_0x5bbdc5['_appendChild']('…'),_0x5bbdc5['_appendChild'](_0xc96267),_0x1b8dcb?.['ellipsisAfter']&&_0x5bbdc5['_appendChild']('…');const _0xf857ca=_0x39ab4d['htmlProcessor']['domConverter']['viewToDom'](_0x5ab4ca),_0x156cfb=_0x39ab4d['htmlProcessor']['htmlWriter']['getHtml'](_0xf857ca);_0x3e68c2=this['_removeUnsupportedElements'](_0x156cfb);}return _0x3e68c2;};}['_createGetContentFn'](_0x509114,_0x13582d){let _0x5bf607='';return()=>(_0x5bf607||(_0x5bf607=this['_removeUnsupportedElements'](_0x13582d['stringify'](_0x509114,{'showSuggestionHighlights':!0x0}))),_0x5bf607);}['_createGetContentUsingDataIdFn'](_0x505dbd,_0x2bede7,_0xa7a068){let _0x193049='';return()=>{if(!_0x193049){const _0x522900=_0xa7a068['toView'](new _0x31aa53(_0x505dbd));_0x193049=_0xa7a068['htmlProcessor']['domConverter']['viewToDom'](_0x522900)['querySelector']('[data-id=\x22'+_0x2bede7+'\x22]')?.['outerHTML']||'';}return _0x193049;};}['_removeUnsupportedElements'](_0x4d388b){if(!_0x4d388b)return'';const _0x58f4e5=ps(_0x4d388b,{'decodeEntities':!0x1}),_0x55966c=ws(_0x58f4e5);if(!_0x55966c['length'])return _0x4d388b;for(const _0x1eef1b of _0x55966c)_0x3b2f55(_0x1eef1b);return ms(_0x58f4e5,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x2f0a41,_0x380262){const _0x635f9e=ps(_0x2f0a41,{'decodeEntities':!0x1}),_0x153fcb=ps(_0x380262,{'decodeEntities':!0x1}),_0x2733fb=ws(_0x635f9e),_0x457706=ws(_0x153fcb);if(!_0x2733fb['length']&&!_0x457706['length'])return{'contentInitial':_0x2f0a41,'contentNew':_0x380262};const _0x3294c1=new Map();for(const _0x58481e of _0x2733fb)_0x3294c1['set'](fs(_0x58481e,'data-id'),_0x58481e);for(const _0x43b630 of _0x457706){const _0x49da07=fs(_0x43b630,'data-id'),_0x2dafa8=_0x49da07?_0x3294c1['get'](_0x49da07):void 0x0;_0x2dafa8?_0x245e63(_0x43b630,_0x1263cf(_0x2dafa8,!0x0)):_0x3b2f55(_0x43b630);}return{'contentInitial':ms(_0x635f9e,{'encodeEntities':!0x1}),'contentNew':ms(_0x153fcb,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x3044fb,_0x66aa03=0x5){let _0x4301f9=_0x3044fb,_0x43b697=null;for(let _0xd0223c=0x0;_0xd0223c<_0x66aa03&&_0x4301f9;_0xd0223c++)if(_0x4301f9['className']){if((''+_0x4301f9['className'])['includes']('ck-ai_review-marker_')){if(!_0x4301f9['getAttribute']('data-marker-id'))break;_0x43b697=_0x4301f9;break;}_0x4301f9=_0x4301f9['parentElement'];}else _0x4301f9=_0x4301f9['parentElement'];return _0x43b697;}['_findMarkerElementById'](_0x41e89a){const _0x5a45d3=this['_markers']['get'](_0x41e89a);if(!_0x5a45d3)return null;const _0x2d6bd3=_0x5a45d3['editor']['model']['markers']['get'](_0x41e89a);return _0x2d6bd3?_0x346dae(_0x5a45d3['editor']['editing'],_0x2d6bd3):null;}['_getMarkersDataForGroup'](_0x37d610){return Array['from'](this['_markers']['values']())['filter'](_0x215d3f=>_0x215d3f['groupId']===_0x37d610);}['_getOperationStart'](_0x447dd7){return'insert'===_0x447dd7['type']?_0x447dd7['position']:_0x447dd7['newRange']['start'];}['_getOperationEnd'](_0x30cfec,_0xdd3cdf=!0x1){return'insert'===_0x30cfec['type']?_0xdd3cdf?_0x30cfec['position']:_0x30cfec['position']['getShiftedBy'](_0x30cfec['howMany']):_0x30cfec['newRange']['end'];}['_shiftOperation'](_0x27cbb2,_0x36dd1f){return'insert'===_0x27cbb2['type']?_0x27cbb2['position']=_0x27cbb2['position']['getShiftedBy'](_0x36dd1f):'marker'===_0x27cbb2['type']&&_0x27cbb2['newRange']&&(_0x27cbb2['newRange']=new _0x4ab7a9(_0x27cbb2['newRange']['start']['getShiftedBy'](_0x36dd1f),_0x27cbb2['newRange']['end']['getShiftedBy'](_0x36dd1f))),_0x27cbb2;}['_changeOperationOwnerDocument'](_0x476e65,_0x2fe6ac){'insert'===_0x476e65['type']?_0x476e65['position']=this['_changePositionOwnerDocument'](_0x476e65['position'],_0x2fe6ac):'marker'===_0x476e65['type']&&_0x476e65['newRange']&&(_0x476e65['newRange']=this['_changeRangeOwnerDocument'](_0x476e65['newRange'],_0x2fe6ac));}['_changePositionOwnerDocument'](_0x296822,_0x30edb6){return new _0x56972e(_0x30edb6,_0x296822['path']);}['_changeRangeOwnerDocument'](_0x14d17f,_0x5a22f6){return new _0x4ab7a9(this['_changePositionOwnerDocument'](_0x14d17f['start'],_0x5a22f6),this['_changePositionOwnerDocument'](_0x14d17f['end'],_0x5a22f6));}['_changePosition'](_0x162505,_0x35b991){return new _0x56972e(_0x35b991,[..._0x162505]);}['_changeRange'](_0x12b187,_0x559495,_0x555ce6,_0x582028){return new _0x4ab7a9(this['_changePosition'](_0x559495,_0x582028),this['_changePosition'](_0x555ce6,_0x582028));}['_sortMarkers'](_0x37d216){const _0x2139df=_0x35a62b=>{switch(_0x35a62b){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x37d216['sort']((_0x18efb5,_0x5d8a4d)=>_0x2139df(_0x18efb5['type'])-_0x2139df(_0x5d8a4d['type']));}['_hasSameTopLevelElement'](_0xec72e,_0x1c2e56){const _0x15aa78=_0xec72e['getChild'](0x0),_0x49637c=_0x1c2e56['getChild'](0x0);return!(!_0x15aa78||!_0x49637c)&&((!_0x15aa78['is']('element')||!_0x49637c['is']('element')||_0x15aa78['name']===_0x49637c['name'])&&!(_0x15aa78['is']('element')&&!_0x49637c['is']('element')||!_0x15aa78['is']('element')&&_0x49637c['is']('element')));}['_haveSingleTopLevelElement'](_0x35698a){return 0x1===_0x35698a['childCount'];}['_haveOnlyInlineContent'](_0x23144b,_0x2ed6da){for(const _0x2dbc35 of _0x23144b['getChildren']())if(_0x2dbc35['is']('element')&&!_0x2ed6da['isInline'](_0x2dbc35))return!0x1;return!0x0;}['_upsertDataId'](_0x4fcabd,_0x4f970f){let _0xa61a9b=_0x4fcabd['getAttribute'](_0x3d3bc3);return _0xa61a9b||(_0xa61a9b=_0x4f970f(),_0x4fcabd['_setAttribute'](_0x3d3bc3,_0xa61a9b)),_0xa61a9b;}};const lh=/* #__PURE__ -- @preserve */
38
+ ut();var uh=class extends lh{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x5e8cb5,contentNew:_0x37f7ef,contentInitial:_0x5caa64,documentVersion:_0x47cb2d}){super(),this['id']=_0x5e8cb5,this['contentNew']=_0x37f7ef,this['contentInitial']=_0x5caa64,this['documentVersion']=_0x47cb2d;}};const dh=/* #__PURE__ -- @preserve */
39
+ gt();var _h=class extends dh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x47967f,_0x274bed,_0xf81ca8){super(),this['id']=_0x47967f,this['parent']=_0xf81ca8,this['_data']=_0x274bed,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const gh=/* #__PURE__ -- @preserve */
40
+ gt();var Ah=class extends gh{['id']=vt();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x5a6800,_0xf987f0,_0x5ca2c2,_0x102ffd,_0x314ebe){super(),this['_sourceCheck']=_0xf987f0,this['_documentData']=_0x5a6800,this['_aiConnector']=_0x5ca2c2,this['_reviewParams']=_0x102ffd,this['_reviewArgs']=_0x314ebe,this['on']('change:status',(_0x434583,_0x221574,_0x361dae)=>{'aborted'==_0x361dae&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x361dae,'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'](_0x433b22=>'pending'===_0x433b22['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0xf99886){this['_documentData']=_0xf99886;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x346216=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0xfd2c7b of _0x346216)'unmodified'!==_0xfd2c7b['data']['operation']&&('error'!==_0xfd2c7b['data']['operation']?'review-metadata'!==_0xfd2c7b['event']?this['_addReviewCheckResult'](_0xfd2c7b['data']['dataId'],_0xfd2c7b['data']['textDelta']):this['callId']=_0xfd2c7b['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(_0x4bb481){this['_currentError']=_0x4bb481,nn(_0x4bb481)?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'](_0xe72137,_0x440770){const _0x253466=this['_results']['get'](_0xe72137);if(!_0x253466)return;if(0x0===_0x440770['length'])return;const _0x29f665=[];_0x440770['forEach']((_0x48a442,_0x40dbae)=>{const _0x483138=new _h(_0x253466['id']+'-'+_0x40dbae,_0x48a442,_0x253466);_0x483138['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x483138,'status':_0x483138['status']});}),_0x483138['on']('change:isActivated',()=>{_0x483138['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x483138}):this['fire']('reviewCheckResultDeactivated',{'change':_0x483138});}),this['_changes']['push'](_0x483138),_0x29f665['push'](_0x483138);}),this['fire']('reviewCheckResultReady',{'changes':_0x29f665,'result':_0x253466,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x3e95af){const _0x557f9a=this['_changes']['find'](_0x25eccd=>_0x25eccd['id']===_0x3e95af);return!(!_0x557f9a||'pending'!==_0x557f9a['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x152787=>!0x0===_0x152787['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x3c3ce8=>'pending'===_0x3c3ce8['status']);}['getChangeById'](_0x5705d2){return this['_changes']['find'](_0x293ac3=>_0x293ac3['id']===_0x5705d2);}['markAllChangesAsAccepted'](){for(const _0x22989d of this['_changes'])'pending'===_0x22989d['status']&&(_0x22989d['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x27afab){const _0x36fd12=this['_changes']['find'](_0x3ae942=>_0x3ae942['id']===_0x27afab);_0x36fd12&&'pending'===_0x36fd12['status']&&(_0x36fd12['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x327d45){const _0x3c8f20=this['_changes']['find'](_0x2d2d62=>_0x2d2d62['id']===_0x327d45);_0x3c8f20&&'pending'===_0x3c8f20['status']&&(_0x3c8f20['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x141123){const _0x51c4b7=this['_changes']['find'](_0x3f4308=>_0x3f4308['id']===_0x141123);_0x51c4b7&&'pending'===_0x51c4b7['status']&&(_0x51c4b7['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x1b237a){const _0x51253f=this['_changes']['find'](_0x4d2b11=>_0x4d2b11['id']===_0x1b237a);_0x51253f&&'outdated'===_0x51253f['status']&&(_0x51253f['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x28ccb8){this['_changes']['filter'](_0x5a6cff=>_0x5a6cff['isActivated']&&_0x5a6cff['id']!==_0x28ccb8)['forEach'](_0x1e8963=>{_0x1e8963['isActivated']=!0x1;});const _0x1b574e=this['_changes']['find'](_0x3350e8=>_0x3350e8['id']===_0x28ccb8);_0x1b574e&&'pending'===_0x1b574e['status']&&(_0x1b574e['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x47d7e9=>_0x47d7e9['isActivated'])['forEach'](_0x3574b0=>{_0x3574b0['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x2f3d8c){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x25a4d6;if(_0x2f3d8c){const _0x5690f7=this['_changes']['find'](_0x5c9b3b=>_0x5c9b3b['id']===_0x2f3d8c);if(_0x5690f7&&_0x5690f7['isRated'])return;_0x5690f7&&(_0x25a4d6=_0x5690f7['parent']['id'],_0x5690f7['isRated']=!0x0);}const _0x1aaafb={'positiveCount':this['_changes']['filter'](_0x34f518=>'accepted'===_0x34f518['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x1aaafb,this['callId'],_0x25a4d6);}['_addReviewCheckResult'](_0x39cd61,_0x3643db){const _0x3394f3=this['_documentData']['elements']['get'](_0x39cd61);if(!_0x3394f3)return;const _0x579be3=_0x3394f3['getContent']();if(_0x579be3===_0x3643db)return;const _0x14c941=new uh({'id':_0x39cd61,'contentInitial':_0x579be3,'contentNew':_0x3643db,'documentVersion':_0x3394f3['documentVersion']});this['_results']['set'](_0x14c941['id'],_0x14c941),this['fire']('reviewCheckResultAdded',{'result':_0x14c941,'source':this,'editor':_0x3394f3['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x3ad6cf=>'pending'===_0x3ad6cf['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x4b0049=>'pending'===_0x4b0049['status'])['length']&&(this['status']='finished');}},Ih=class extends Ah{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x410947=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0xdea94a=0x0;_0xdea94a<this['_reviewParams']['length'];_0xdea94a++){if(!this['_reviewParams'][_0xdea94a]||!this['_sourceCheck']['options'][_0xdea94a])continue;const _0x41e2ba=this['_sourceCheck']['options'][_0xdea94a]['data']?.['find'](_0x5e89d3=>_0x5e89d3['id']===this['_reviewParams'][_0xdea94a]);_0x41e2ba&&_0x410947['push'](_0x41e2ba['label']);}return _0x410947['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x2cd938,_0x2ee167,_0x4d74e7){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x2ee167,_0x2cd938,_0x4d74e7);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},ph=class extends _0x394201{['_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',(_0xacb1c,_0x56c534)=>this['runCheck'](_0x56c534)),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 _0xcdec81=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0xcdec81['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0xcdec81['map'](_0x9947b=>_0x9947b['id']),this['_aiSource']);const _0x423245=this['_currentReviewCheckRun'];_0x423245['markAllChangesAsAccepted'](),_0x423245['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x5d0141,_0x174974)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x174974['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x174974['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x174974['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x174974['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x443eb7,_0x2fa1e3)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x2fa1e3['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x2fa1e3['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x2fa1e3['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x2fa1e3['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',(_0x173d64,_0x4c46d2)=>{this['_onActivateChange'](_0x4c46d2);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x4609b4,_0x138d5c)=>{this['_onDeactivateChange'](_0x138d5c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x5b4c00,_0xac11d9)=>{this['_onChangeMarkerClicked'](_0x5b4c00,_0xac11d9);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x1ad775,_0x529dcf)=>{this['_onChangeMarkerHovered'](_0x1ad775,_0x529dcf);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x24339a,_0x17c921)=>{this['_onChangeMarkerRemoved'](_0x24339a,_0x17c921);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x10f78f,_0x37ce25)=>{this['_onChangeMarkerRestored'](_0x10f78f,_0x37ce25);});}async['runCheck'](_0x2bfbd4){if(!this['_availableReviewChecks'])return;const _0x3033cf=this['_availableReviewChecks']['find'](_0x4241a3=>_0x4241a3['id']===_0x2bfbd4['id']);if(_0x3033cf){this['_onReviewCheckRun'](_0x2bfbd4),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x2bfbd4,_0x3033cf),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x59a522,_0x49c776)=>{switch(_0x49c776['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x49c776);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x49c776['status']&&'error-chunk'!==_0x49c776['status']&&'error-general'!==_0x49c776['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x3812ac,_0xb96880)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x4f8497=this['_diffContent'](_0xb96880['editor'],_0xb96880['result']['contentInitial'],_0xb96880['result']['contentNew']);_0xb96880['source']['addResultChanges'](_0xb96880['result']['id'],_0x4f8497);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x52f686,_0x38a56c)=>{for(const _0x3c363b of _0x38a56c['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x3c363b);this['_markChangePositionInEditorContent'](_0x38a56c['changes'],_0x38a56c['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x59593c,_0x3a1036)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x3a1036['change']['id'],_0x3a1036['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x400ced,_0x5cc018)=>{this['_onReviewCheckResultActivated'](_0x5cc018);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x67066a){if(nn(_0x67066a))return;_0x67066a instanceof ht?this['_logError'](_0x67066a):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x67066a));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x2bfbd4['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x1de29e,_0xefb523){return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0xefb523,this['_aiConnector'],_0x1de29e['params'],_0x1de29e['args']);}['_onChangeMarkerRemoved'](_0x356737,_0x20b0d8){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x20b0d8['changeId']);}['_onChangeMarkerRestored'](_0x1a8350,_0x2ecaa2){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x2ecaa2['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['_onReviewRunLeave'](_0xf02944=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0xf02944&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2b918f of this['_aiReviewCoreEditing']['getEditors']())_0x2b918f['editing']['view']['change'](_0x4e92bf=>{for(const _0x5574a4 of _0x2b918f['editing']['view']['document']['getRoots']())_0x4e92bf['removeClass']('ck-ai_review-diff',_0x5574a4),_0x4e92bf['removeClass']('ck-ai_review-highlights',_0x5574a4),_0x4e92bf['removeClass']('ck-ai-translate-mode-content',_0x5574a4);});}['_logError'](_0x12c564){this['_reporter']['logError'](_0x12c564),'ai-review-mode-models-unable-to-retrieve'===function(_0x2780af){return _0x2780af instanceof rn?_0x2780af['code']:_0x2780af instanceof Error?_0x2780af['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x12c564)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x395513){if('content'===this['_changeActivationSource']){const _0x3d977d=this['_aiReviewCoreUi']['getChangeElement'](_0x395513);_0x3d977d&&St(_0x3d977d['closest']('.ck-ai_review__check-run-result')||_0x3d977d);}else{if('panel'===this['_changeActivationSource']){const _0x23d39b=this['_getChangeContentElement'](_0x395513);if(!_0x23d39b)return;Rt({'target':_0x23d39b,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},mh=class extends Ah{['_prompt'];['_model'];constructor(_0x124f65,_0x477e9d,_0x161daf,_0x2acb47,_0x3bc64a){super(_0x161daf,_0x2acb47,_0x3bc64a),this['_prompt']=_0x124f65,this['_model']=_0x477e9d;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5a9325,_0x534c35,_0x36c61c){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x534c35,_0x5a9325,_0x36c61c);}},Eh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0xc2b038){this['id']=_0xc2b038['id'],this['commandId']=_0xc2b038['commandId'],this['title']=_0xc2b038['title'],this['description']=_0xc2b038['description'],this['isParameterized']=_0xc2b038['isParameterized'],this['useArgs']=_0xc2b038['useArgs'],this['options']=_0xc2b038['options'],this['args']=_0xc2b038['args'];}},Th=class extends Eh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x2884bf,_0x81ec3a,_0x402391){super(_0x2884bf),this['prompt']=_0x2884bf['prompt'],this['model']=_0x2884bf['model'],this['model']?this['_defaultModel']=_0x81ec3a['find'](_0x476dad=>_0x476dad['id']===this['model'])||null:this['_defaultModel']=_0x402391;}get['defaultModel'](){return this['_defaultModel'];}},wh=class extends mh{get['subTitle'](){return'';}set['prompt'](_0x2f55a7){this['_prompt']=_0x2f55a7;}set['model'](_0x3edc61){this['_model']=_0x3edc61;}},Ch=class extends _0x394201{static get['requires'](){return[ls,on];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](on)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const fh=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}],bh=/* #__PURE__ -- @preserve */
41
+ gt();var Sh=class extends bh{['_checks']=[];['setupChecks'](_0x352de8){this['_checks']=_0x352de8['map'](_0x2f77e2=>new Eh(_0x2f77e2));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x1973de){return this['checks']['find'](_0x22cc48=>_0x22cc48['id']===_0x1973de);}['removeCheckById'](_0x291802){this['_checks']=this['_checks']['filter'](_0x55cc33=>_0x55cc33['id']!==_0x291802);}},Rh=class extends Eh{['_models']=[];['_defaultModel']=null;constructor(_0x3b95a8,_0x1a5567,_0x462c52){super(_0x3b95a8),this['_models']=_0x1a5567,this['_defaultModel']=_0x462c52;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Oh=class extends Sh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0xd79640,_0x4b2f57,_0x24fe55){super(),this['_allModels']=_0xd79640,this['_recommendedModels']=_0x4b2f57,this['_defaultModel']=_0x24fe55;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x2228d4){this['_checks']=_0x2228d4['map'](_0x5b3bd2=>!0x0===_0x5b3bd2['isExtra']?new Th(_0x5b3bd2,this['_allModels'],this['_defaultModel']):'custom'===_0x5b3bd2['id']?new Rh(_0x5b3bd2,this['_recommendedModels'],this['_defaultModel']):new Eh(_0x5b3bd2));}},vh=class extends Ch{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x105eb9){super(_0x105eb9),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x1cf8d2=>({'id':_0x1cf8d2['id'],'commandId':_0x1cf8d2['id'],'title':_0x1cf8d2['label'],'description':_0x1cf8d2['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x1cf8d2['prompt'],'model':_0x1cf8d2['model']}));}async['_loadChecksList'](){const _0x582a5c=[...fh,...this['getExtraChecks']()]['map'](_0x4f481b=>_0x4f481b['isExtra']?_0x4f481b:this['_translateReviewCheck'](_0x4f481b)),_0x20fa89=await this['_getModels'](),_0x1710af=new Oh(_0x20fa89['all'],_0x20fa89['recommended'],_0x20fa89['default']);return _0x1710af['setupChecks'](_0x582a5c),_0x1710af;}async['_getModels'](){const _0x5ac389=this['context']['plugins']['get']('AIConnector');try{const _0x36abce=new zs({'connector':_0x5ac389,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x243357={'all':await _0x36abce['getAll'](),'recommended':await _0x36abce['getAvailableModels'](),'default':await _0x36abce['getDefault']()};return this['_modelsLoadError']=null,_0x243357;}catch(_0x17ff6a){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x17ff6a),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x43c6d9){const _0xb2a91='AI_REVIEW_CHECK_'+_0x43c6d9['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x13bee0={..._0x43c6d9,'title':this['_translate'](_0xb2a91+'_TITLE',_0x43c6d9['title']),'description':this['_translate'](_0xb2a91+'_DESCRIPTION',_0x43c6d9['description'])};return _0x43c6d9['options']&&(_0x13bee0['options']=_0x43c6d9['options']['map'](_0x43e950=>({..._0x43e950,'label':this['_translate'](_0xb2a91+'_OPTIONS_LABEL',_0x43e950['label']||''),'data':_0x43e950['data']?_0x43e950['data']['map'](_0x14efe3=>({..._0x14efe3,'label':this['_translate'](_0xb2a91+'_OPTIONS_DATA_'+_0x14efe3['id']['toUpperCase'](),_0x14efe3['label'])})):void 0x0}))),_0x13bee0;}['_translate'](_0x47f59c,_0x4a0bbf){const _0x20bddd=us(this['context']['locale'],_0x47f59c);return _0x20bddd===_0x47f59c?_0x4a0bbf:_0x20bddd;}},kh=class extends ph{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[on,vh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x3d6d96){super(_0x3d6d96),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',fh['map'](_0x11581d=>_0x11581d['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x438a77,_0x3c01af)=>{this['_isDiffOn']=_0x3c01af['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x3edbd0,_0x5bd8a8){if(_0x3edbd0['isCustom'])return new mh(_0x3edbd0['args']['prompt'],_0x3edbd0['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5bd8a8,this['_aiConnector']);if(_0x5bd8a8['isExtra']){const _0x201a0a=_0x5bd8a8;return new wh(_0x3edbd0['args']?.['prompt']??_0x201a0a['prompt'],_0x3edbd0['args']?.['model']??_0x201a0a['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5bd8a8,this['_aiConnector']);}return new Ih(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5bd8a8,this['_aiConnector'],_0x3edbd0['params'],_0x3edbd0['args']);}['_onReviewCheckResultActivated'](_0x9b0a34){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x9b0a34['change']['id']),this['_scrollToChange'](_0x9b0a34['change']['id']);const _0x18b669=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x9b0a34['change']['id']);if(!_0x18b669)return;const _0x55b105=this['_aiReviewCoreEditing']['getEditorForChange'](_0x9b0a34['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x9b0a34['change'],()=>_0x18b669['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x55b105,_0x18b669['modelRange']['root']['rootName']),_0x55b105?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x9b0a34['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x19c1e7){this['_currentReviewCheckRun']&&'click'===_0x19c1e7['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x19c1e7['id']));}['_onDeactivateChange'](_0x14ce93){this['_currentReviewCheckRun']&&'balloon'===_0x14ce93['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4258a2,_0x54ab58){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x54ab58['changeId']);const _0x246f69=this['_currentReviewCheckRun']['getChangeById'](_0x54ab58['changeId']);if(!_0x246f69)return;const _0x37fc58=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x54ab58['changeId']),_0x9251f5=this['_aiReviewCoreEditing']['getEditorForChange'](_0x54ab58['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x246f69,_0x54ab58['markerElement'],_0x54ab58['domEvent'],'click',this['_getBalloonDomRoot'](_0x9251f5,_0x37fc58?.['modelRange']['root']['rootName']),_0x9251f5?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x164d83,_0x51fe31){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x8c9515=this['_currentReviewCheckRun']['getChangeById'](_0x51fe31['changeId']);if(!_0x8c9515)return;const _0x142c91=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x51fe31['changeId']),_0x4c78ff=this['_aiReviewCoreEditing']['getEditorForChange'](_0x51fe31['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x8c9515,_0x51fe31['markerElement'],_0x51fe31['domEvent'],'hover',this['_getBalloonDomRoot'](_0x4c78ff,_0x142c91?.['modelRange']['root']['rootName']),_0x4c78ff?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0x35efb6){const _0x434b30=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x35efb6);return _0x434b30?_0x434b30['getElement']():null;}['_markChangePositionInEditorContent'](_0x450d72,_0x2a5eda){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x450d72,_0x2a5eda);}['_diffContent'](_0x500644,_0x12efe8,_0x9d9ad8){return this['_aiReviewCoreEditing']['diffContent'](_0x500644,_0x12efe8,_0x9d9ad8,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x1af0aa){_0x1af0aa?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0xfdf2fb of this['_aiReviewCoreEditing']['getEditors']())_0xfdf2fb['editing']['view']['change'](_0x37e01e=>{for(const _0x33d486 of _0xfdf2fb['editing']['view']['document']['getRoots']()){for(const _0x177b0e of _0x33d486['getClassNames']())_0x177b0e['startsWith']('ck-ai_review-')&&_0x37e01e['removeClass'](_0x177b0e,_0x33d486);_0x37e01e['addClass'](_0x1af0aa?'ck-ai_review-diff':'ck-ai_review-highlights',_0x33d486);}});}['_getBalloonDomRoot'](_0x3bbe1d,_0x258a4f){const _0x5bd7f1=_0x3bbe1d['editing']['view'];if(_0x258a4f){const _0x56e2fa=_0x5bd7f1['getDomRoot'](_0x258a4f);if(_0x56e2fa)return _0x56e2fa;}return _0x5bd7f1['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x1dda9d=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0xbee282=await _0x1dda9d['getChecksList']();_0x1dda9d['modelsLoadError']&&this['_logError'](_0x1dda9d['modelsLoadError']);let _0xd7b1a2=_0xbee282['checks'];const _0x608781=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x608781,_0xd7b1a2),this['_usesAvailableCommandsConfig']&&(_0xd7b1a2=_0x608781['map'](_0x508a98=>_0xd7b1a2['find'](_0x265351=>_0x265351['id']===_0x508a98))['filter'](_0x5f33a3=>!!_0x5f33a3)),this['_filterChecksWithMissingModel'](_0xd7b1a2);}['_logWarningForNonExistentChecks'](_0x1a06d5,_0x4c19c4){const _0x2dd368=_0x1a06d5['filter'](_0x5c597a=>!_0x4c19c4['some'](_0x514497=>_0x514497['id']===_0x5c597a));_0x2dd368['length']&&this['_reporter']['logError'](new rn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2dd368['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x408a1c){const _0x4d3378=[];return _0x408a1c['forEach'](_0x46842c=>{(_0x46842c instanceof Th&&!_0x46842c['defaultModel']||_0x46842c instanceof Rh&&!_0x46842c['models']['length'])&&_0x4d3378['push'](_0x46842c['id']);}),_0x4d3378['length']&&_0x4d3378['forEach'](_0x4a68ff=>{_0x408a1c=_0x408a1c['filter'](_0x597556=>_0x597556['id']!==_0x4a68ff),this['_reporter']['logError'](new rn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x4a68ff}}));}),_0x408a1c;}};function Nh(_0x30b65a,_0x3b0c76,_0x52eae9,_0x2027a3){return _0x30b65a instanceof ht?_0x30b65a:new ht(_0x3b0c76,_0x52eae9,_0x2027a3,_0x30b65a);}var yh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x4dfc79){this['_affectedBlocks']=_0x4dfc79;}},xh=class extends _0x394201{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[ch,vh,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x11dc95=>{const _0xf279bb={'id':_0x11dc95['id'],'title':_0x11dc95['title'],'description':_0x11dc95['description']};return'custom'!==_0x11dc95['id']&&_0x11dc95['options']?.['length']&&(_0xf279bb['parameters']=_0x11dc95['options'][0x0]['data']['map'](_0x44e805=>({..._0x44e805}))),_0xf279bb;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x549de0,_0x373b95){return await this['_runReviewCheck'](_0x549de0,()=>this['_createReviewCheckRun'](_0x549de0,_0x373b95?.['parameterId']),_0x373b95?.['signal']);}async['runCustomReview'](_0x84c66d,_0x4b421f){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x84c66d,_0x4b421f?.['model']),_0x4b421f?.['signal']);}['applyReview'](_0x29557c,_0x59231b){this['context']['plugins']['get']('AIGateway')['apply'](_0x29557c,{'applyMethod':_0x59231b,'aiSource':'review'});}async['_runReviewCheck'](_0x12f440,_0x1aa7c6,_0x57d7be){const _0x33ff4e=_s(this['context']),_0x26a450=new yh({'editor':_0x33ff4e,'rootName':_0x33ff4e['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x33ff4e['plugins']['get']('AIEditing')['getSessionId'](_0x33ff4e)});let _0x12963f,_0x33bb3d;if(_0x57d7be){if(_0x57d7be['aborted'])return _0x26a450['abort'](),_0x26a450;const _0x2cbbaf=()=>{_0x26a450['error']||(_0x26a450['abort'](),_0x12963f&&_0x12963f['abort']());};_0x57d7be['addEventListener']('abort',_0x2cbbaf),_0x33bb3d=()=>_0x57d7be['removeEventListener']('abort',_0x2cbbaf);}try{_0x12963f=await _0x1aa7c6(),_0x26a450['contentRawOld']=_0x12963f['documentData']['content'],_0x26a450['documentVersion']=Array['from'](_0x12963f['documentData']['elements'])['find'](([,_0xe9108d])=>_0xe9108d['rootName']===_0x26a450['rootName'])?.[0x1]['documentVersion']??0x1,_0x12963f['on']('reviewCheckRunUpdated',(_0x312cc3,_0x478047)=>{'aborted'===_0x478047['status']?_0x26a450['abort']():'error-general'!==_0x478047['status']&&'error-chunk'!==_0x478047['status']||(_0x26a450['error']=Nh(_0x478047['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x12f440}));}),'aborted'!==_0x26a450['status']&&await _0x12963f['start']();}catch(_0x4e4c5b){_0x26a450['error']=Nh(_0x4e4c5b,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x12f440});}finally{_0x33bb3d&&_0x33bb3d();}if(!_0x12963f||'aborted'===_0x26a450['status']||'error'===_0x26a450['status'])return _0x26a450;_0x26a450['affectedBlocks']=_0x12963f['results']['map'](_0x53ad0e=>({'id':_0x53ad0e['id'],'content':_0x53ad0e['contentNew']}));try{_0x26a450['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x26a450['affectedBlocks'],_0x26a450['contentRawOld'],_0x26a450['editor']));}catch(_0x116e4d){_0x26a450['error']=Nh(_0x116e4d,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x12f440});}return _0x26a450;}async['_createReviewCheckRun'](_0x4622a,_0x3bc084){const _0x2d6a59=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x354bad=>_0x354bad['id']===_0x4622a);if(!_0x2d6a59)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x4622a});if(_0x2d6a59 instanceof Rh)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x4622a});const _0x34e0b8=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0xc6e443=this['context']['plugins']['get']('AIConnector');if(_0x2d6a59 instanceof Th){if(!_0x2d6a59['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x4622a});return new wh(_0x2d6a59['prompt'],_0x2d6a59['defaultModel']['id'],_0x34e0b8,_0x2d6a59,_0xc6e443);}return new Ih(_0x34e0b8,_0x2d6a59,_0xc6e443,_0x3bc084?[_0x3bc084]:void 0x0);}async['_createCustomReviewCheckRun'](_0x39c11a,_0x148770,_0x458605){const _0x434423=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x28bc20=>_0x28bc20['id']===_0x39c11a);if(!_0x434423)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x39c11a});if(!(_0x434423 instanceof Rh))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x39c11a});const _0x861ee4=_0x458605??_0x434423['defaultModel']?.['id'];if(!_0x148770)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x39c11a});if(!_0x861ee4)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x39c11a});return new mh(_0x148770,_0x861ee4,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x434423,this['context']['plugins']['get']('AIConnector'));}},Lh=class extends _0x394201{static get['requires'](){return[kh,rh,ch,xh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x5ac0c7,_0x3388c7){if(this['assertStartReviewPreconditions'](_0x5ac0c7)instanceof Rh)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x5ac0c7});Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x5ac0c7,'params':_0x3388c7?.['parameterId']?[_0x3388c7['parameterId']]:void 0x0});}async['startCustomReview'](_0x264eb7,_0x5ab9a9){if(!_0x264eb7)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x29cb8d=fh['find'](_0x315f94=>'custom'===_0x315f94['commandId'])['id'],_0x35da66=this['assertStartReviewPreconditions'](_0x29cb8d),_0x3ea92d=_0x5ab9a9?.['model']??_0x35da66['defaultModel']?.['id'];if(!_0x3ea92d)throw new ht('ai-reviewmode-missing-custom-command-model',this);Na(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x29cb8d,'isCustom':!0x0,'args':{'prompt':_0x264eb7,'model':_0x3ea92d}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x3f5b48=>{const _0x168bd6={'id':_0x3f5b48['id'],'title':_0x3f5b48['title'],'description':_0x3f5b48['description']};return'custom'!==_0x3f5b48['id']&&_0x3f5b48['options']?.['length']&&(_0x168bd6['parameters']=_0x3f5b48['options'][0x0]['data']['map'](_0x1e5dbb=>({..._0x1e5dbb}))),_0x168bd6;});}['assertStartReviewPreconditions'](_0x27a032){const _0x5d01ee=this['context']['plugins']['get']('AIReviewModeController');if(_0x5d01ee['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x2a4a30=_0x5d01ee['getAvailableChecks']()['find'](_0x1c4e65=>_0x1c4e65['id']===_0x27a032);if(!_0x2a4a30)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x27a032});return _0x2a4a30;}},Dh=class extends Ih{['_title'];constructor(_0x2dda96,_0x552800,_0x36e7b9,_0x2cb7ba,_0x297b76,_0x5ec541){super(_0x2dda96,_0x552800,_0x36e7b9,_0x297b76,_0x5ec541),this['_title']=_0x2cb7ba;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Ph=class extends Eh{get['apiId'](){return'translate';}},Hh=class extends Sh{['setupChecks'](_0x2899f6){this['_checks']=_0x2899f6['map'](_0x297d82=>new Ph(_0x297d82));}};const Mh=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];var Vh=class extends Ch{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x41a514){super(_0x41a514),this['context']['config']['define']('ai.translate.languages',Mh);}async['_loadChecksList'](){const _0x47050f=[],_0x2a8e29=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x10b320 of _0x2a8e29)_0x47050f['push']({'title':_0x10b320['label'],'id':_0x10b320['id'],'commandId':_0x10b320['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x10b320['id']}});const _0x4b6316=new Hh();return _0x4b6316['setupChecks'](this['_translateChecks'](_0x47050f)),_0x4b6316;}['_translateChecks'](_0x19e598){const _0x5e5451=this['context']['locale'];return _0x19e598['map'](_0x5e2e5e=>{const _0x25ce57='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x5e2e5e['title']['toUpperCase']()['replaceAll']('-','_'),_0x4791f5=us(_0x5e5451,_0x25ce57);return{..._0x5e2e5e,'title':_0x4791f5===_0x25ce57?_0x5e2e5e['title']:_0x4791f5};});}},Uh=class extends ph{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[on,Vh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x3726e4,_0x5caa26){return new Dh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5caa26,this['_aiConnector'],us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x3726e4['params'],_0x3726e4['args']);}['_onReviewCheckResultActivated'](_0x3b0ace){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x3b0ace['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x3b0ace['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x37d6fd){this['_currentReviewCheckRun']&&('hover'===_0x37d6fd['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x37d6fd['id'])),'click'===_0x37d6fd['uiInteraction']&&this['_scrollToChange'](_0x37d6fd['id']));}['_onDeactivateChange'](_0x468080){this['_currentReviewCheckRun']&&'panel'===_0x468080['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0xe25b50,_0x3f4d9f){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3f4d9f['changeId']),this['_scrollToChange'](_0x3f4d9f['changeId']));}['_onChangeMarkerHovered'](_0x2c1692,_0x1e7512){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1e7512['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x1e7512['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x4fbb18){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x4fbb18);}['_markChangePositionInEditorContent'](_0x39346a,_0x55eafd){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x39346a,_0x55eafd);}['_diffContent'](_0x39d9a9,_0x4cac38,_0x2a481f){return this['_aiReviewCoreEditing']['diffContent'](_0x39d9a9,_0x4cac38,_0x2a481f,!0x0);}['_onReviewCheckRun'](){for(const _0x144413 of this['_aiReviewCoreEditing']['getEditors']())_0x144413['editing']['view']['change'](_0x496ad8=>{for(const _0x49ffa6 of _0x144413['editing']['view']['document']['getRoots']())_0x496ad8['addClass']('ck-ai-translate-mode-content',_0x49ffa6);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Bh=class extends Xa{constructor(_0x7109b,_0x1f1cee){super(_0x7109b,_0x1f1cee),this['on']('set:isLoading',(_0x3eef59,_0x16d09e,_0x3351cf)=>{_0x3351cf&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x4f9e75,_0x3880c6,_0x1d9fa7)=>{_0x1d9fa7&&(this['headerTitle']=us(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x344061=super['_createAcceptAllButtonView']();return _0x344061['set']('label',us(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x344061;}['_createExitReviewButtonView'](){const _0x1ca21d=super['_createExitReviewButtonView']();return _0x1ca21d['set']('label',us(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x1ca21d;}},Gh=class extends nh{['_setupTemplate'](){const _0x4ce0b5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x4ce0b5['if']('isVisible','ck-hidden',_0x547b43=>!_0x547b43)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':us(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x4ce0b5['if']('isVisible','ck-hidden',_0x17da2b=>!_0x17da2b)]},'children':this['_checkViews']}]});}},Fh=class extends Ya{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x569b5d=this['context']['plugins']['get']('AITabs'),_0x4f8519=this['context']['locale'],_0x59affa=new Mo(_0x4f8519,{'label':us(_0x4f8519,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x1ea070,'class':'ck-ai-header_review-translate','showResizeButton':_0x569b5d['showResizeButton']});_0x59affa['delegate']('resizeTabs')['to'](_0x569b5d),_0x59affa['bind']('isMaximized')['to'](_0x569b5d['view'],'isMaximized',_0x4be9e0=>_0x4be9e0);const _0x5aed52=new qa(_0x4f8519,{'header':_0x59affa,'list':new Gh(_0x4f8519),'results':new Bh(_0x4f8519,{'generalErrorText':us(_0x4f8519,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new za(_0x4f8519,{'headerText':us(_0x4f8519,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':us(_0x4f8519,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':us(_0x4f8519,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x5aed52['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x5aed52;}['registerTab'](){const _0x1530b5=this['context']['plugins']['get']('AITabs');_0x1530b5['view']['on']('activateTab',(_0x305804,{newTab:_0x51648e,oldTab:_0x2d8a68})=>{'translate'===_0x51648e?this['fire']('getReviewCheckList'):'translate'===_0x2d8a68&&this['fire']('leaveReview');}),_0x1530b5['view']['addTab']({'id':'translate','buttonLabel':us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x1ea070,'order':0x0,'content':this['_mainView']});}},Kh=class extends tn{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x5a4b9d){this['_affectedBlocks']=_0x5a4b9d;}},Wh=class extends _0x394201{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[ch,ls,Is,Zs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x1ef849,_0x40b92f){return await this['_runTranslateCheck'](_0x1ef849,()=>this['_createTranslateCheckRun'](_0x1ef849),_0x40b92f?.['signal']);}['applyTranslate'](_0x32fdc7,_0xfbaf42){this['context']['plugins']['get']('AIGateway')['apply'](_0x32fdc7,_0xfbaf42);}async['_runTranslateCheck'](_0xc57e0a,_0x39f0e6,_0x1f33e1){const _0x52bc21=_s(this['context']),_0x21dba6=new Kh({'editor':_0x52bc21,'rootName':_0x52bc21['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x52bc21['plugins']['get']('AIEditing')['getSessionId'](_0x52bc21)});let _0x317eb1,_0x16a392;if(_0x1f33e1){if(_0x1f33e1['aborted'])return _0x21dba6['abort'](),_0x21dba6;const _0x580141=()=>{_0x21dba6['error']||(_0x21dba6['abort'](),_0x317eb1&&_0x317eb1['abort']());};_0x1f33e1['addEventListener']('abort',_0x580141),_0x16a392=()=>_0x1f33e1['removeEventListener']('abort',_0x580141);}try{_0x317eb1=await _0x39f0e6(),_0x21dba6['contentRawOld']=_0x317eb1['documentData']['content'],_0x21dba6['documentVersion']=Array['from'](_0x317eb1['documentData']['elements'])['find'](([,_0x30ef77])=>_0x30ef77['rootName']===_0x21dba6['rootName'])?.[0x1]['documentVersion']??0x1,_0x317eb1['on']('reviewCheckRunUpdated',(_0x18e32a,_0x1154cb)=>{'aborted'===_0x1154cb['status']?_0x21dba6['abort']():'error-general'!==_0x1154cb['status']&&'error-chunk'!==_0x1154cb['status']||(_0x21dba6['error']=Nh(_0x1154cb['error'],'ai-translategateway-translation-run-failed',this,{'language':_0xc57e0a}));}),'aborted'!==_0x21dba6['status']&&await _0x317eb1['start']();}catch(_0x5a875d){_0x21dba6['error']=Nh(_0x5a875d,'ai-translategateway-translation-run-failed',this,{'language':_0xc57e0a});}finally{_0x16a392&&_0x16a392();}if(!_0x317eb1||'aborted'===_0x21dba6['status']||'error'===_0x21dba6['status'])return _0x21dba6;_0x21dba6['affectedBlocks']=_0x317eb1['results']['map'](_0x134777=>({'id':_0x134777['id'],'content':_0x134777['contentNew']}));try{_0x21dba6['contentRawNew']=ms(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x21dba6['affectedBlocks'],_0x21dba6['contentRawOld'],_0x21dba6['editor']));}catch(_0x5aeabe){_0x21dba6['error']=Nh(_0x5aeabe,'ai-translategateway-translation-run-failed',this,{'language':_0xc57e0a});}return _0x21dba6;}async['_createTranslateCheckRun'](_0x56b972){const _0x4a6152=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x39e2b9=this['context']['plugins']['get']('AIConnector');return new Dh(_0x4a6152,new Ph({'id':_0x56b972,'commandId':_0x56b972,'title':_0x56b972,'description':'','isParameterized':!0x1}),_0x39e2b9,us(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x56b972});}},Yh=class extends _0x394201{static get['requires'](){return[Uh,Fh,ch,Wh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x12bc00){const _0xca96a2=this['assertStartTranslatePreconditions'](_0x12bc00);Na(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0xca96a2['id'],'args':_0xca96a2['useArgs']?_0xca96a2['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x1abaac=>({'id':_0x1abaac['id'],'label':_0x1abaac['title']}));}['assertStartTranslatePreconditions'](_0x20f310){const _0x2c9c41=this['context']['plugins']['get']('AITranslateController');if(_0x2c9c41['getCurrentCheckRun']())throw new ht('ai-translate-translation-already-running',this);const _0x57f730=_0x2c9c41['getAvailableChecks']()['find'](_0x555a7f=>_0x555a7f['id']===_0x20f310);if(!_0x57f730)throw new ht('ai-translate-unknown-language',this,{'languageId':_0x20f310});return _0x57f730;}};export{Ba as AIActions,vi as AIAdapter,Ji as AIAssistant,Xi as AIAssistantUI,ua as AIBalloon,ea as AIChat,Nn as AIChatController,Mr as AIChatFeedCustomElementView,ta as AIChatHistory,Zo as AIChatHistoryController,Qo as AIChatHistoryUI,Sn as AIChatInteraction,ra as AIChatShortcuts,Go as AIChatUI,ls as AIConnector,rn as AICoreError,sn as AIDocumentProcessingGateway,en as AIDocumentProcessingRunResult,Is as AIEditing,Ia as AIEditorIntegration,an as AIErrorReporter,on as AIErrorSink,Zs as AIGateway,pn as AIInteraction,Ga as AIQuickActions,va as AIQuickActionsUI,gn as AIReply,ki as AIRequestError,Eh as AIReviewCheck,uh as AIReviewCheckResult,_h as AIReviewCheckResultChange,Ah as AIReviewCheckRun,xh as AIReviewGateway,Lh as AIReviewMode,ph as AIReviewModeController,ch as AIReviewModeEditing,rh as AIReviewModeUI,yh as AIReviewRunResult,tn as AIRunResult,cs as AITabs,hs as AITabsMainView,rs as AITabsView,ts as AITextAdapter,aa as AIToggleButtonUI,Yh as AITranslate,Uh as AITranslateController,Wh as AITranslateGateway,Kh as AITranslateRunResult,Fh as AITranslateUI,is as AWSTextAdapter,es as OpenAITextAdapter,yi as ShowAIAssistantCommand,oa as ToggleAICommand,un as createResizeButton,Zi as getDefaultAICommands,Js as markOperationsAsAI};