@ckeditor/ckeditor5-ai 48.2.0-alpha.4 → 48.2.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/index.js +6 -6
  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,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x20e120,Command as _0x338152,ContextPlugin as _0x464fb9,Editor as _0x2fdbcb}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x30ebff,IconCheck as _0x3d9fb7,IconError as _0x212b4b,IconSubmit as _0x18e564,IconAIHistory as _0x2251d5,IconMagicWand as _0x5a09b8,IconRobotPencil as _0xcc780e,IconMaximize as _0x3f28e0,IconMinimize as _0xbe2da2,IconShowChangesOn as _0x18eb20,IconShowChangesOff as _0x552934,IconDocument as _0xe44a24,IconBoxWithCross as _0x138663,IconBoxWithCheck as _0x443913,IconBoxWithMarker as _0x374b23,IconInfo as _0x23d873,IconWeb as _0x224392,IconCancel as _0x346199,IconSelection as _0x2c8354,IconFileUpload as _0x462439,IconLink as _0x3e37f3,IconImage as _0x550514,IconBulb as _0x39c06e,IconAI as _0x51a6e1,IconPreviousArrow as _0x6eeec5,IconDocumentOutline as _0x3d07f2,IconLoupe as _0x105d5c,IconPaperClip as _0x5b5fef,IconBrowseFiles as _0x1b305a,IconDropdownArrow as _0x595cb4,IconStop as _0x53a294,IconPlus as _0x744bad,IconAIChat as _0x57f4ad,IconPin as _0x11440c,IconThreeHorizontalDots as _0x362133,IconAIReview as _0x3b947c,IconAITranslate as _0x16f528,IconAIAskAI as _0x368a55,IconThumbUp as _0x13fa81,IconThumbDown as _0xec4606,IconChevronDown as _0x474b7c,IconChevronUp as _0x82ae1c,IconAIQuickActions as _0x4767a0,IconAIChatCommands as _0x2ffbf5,IconAIImproveWriting as _0x1f321f,IconAIContinueWriting as _0x3185d8,IconAIGrammarCheck as _0x31386c,IconAIAdjustLength as _0x18fe57,IconAIChangeTone as _0x9ebbbd,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x2c4cbe,createLabeledInputText as _0x51ae0e,FormHeaderView as _0x27b307,HighlightedTextView as _0x3afbec,ViewCollection as _0x1bcd70,FileDialogButtonView as _0x1c5873,InputTextView as _0x56df63,SearchTextView as _0x40453d,ListItemButtonView as _0x274ebb,ButtonLabelWithHighlightView as _0x3e1629,DropdownMenuPanelPositioningFunctions as _0x4ced60,BalloonToolbar as _0x5bd781,FormRowView as _0x5658f7,TextareaView as _0x4c7fac}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x2f6bc9,ClipboardMarkersUtils as _0x1adffa}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x3001ff,ViewDataTransfer as _0x21219a,ViewUpcastWriter as _0x439010,Matcher as _0x324701,_DetachOperation as _0x365f09,_insertIntoModelNodeList as _0x26d25f,_removeFromModelNodeList as _0x2156fc,ModelRange as _0x5ca7e7,transformOperationSets as _0x213b3b,ViewDowncastWriter as _0xce794f,ModelDocumentFragment as _0x2751c1,ModelPosition as _0x47f02c,ModelTreeWalker as _0x25b302,MarkerOperation as _0x1b588c,InsertOperation as _0x4c1288}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0xdffc15,escape as _0x7f6d0a,cloneDeep as _0x5c7ed6,throttle as _0x92dabe,debounce as _0x1f2c99,escapeRegExp as _0x6635be}from'es-toolkit/compat';import{createParser as _0x360039}from'eventsource-parser';import{CloudServices as _0x38c39d}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x5ebf01}from'htmlparser2';import{isTag as _0x1abf14,findOne as _0x4fe1af,getParent as _0x55560d,findAll as _0x1621e3,removeElement as _0x2f3801,prepend as _0x208787,prependChild as _0x21afaf,appendChild as _0x27e222,append as _0xdcd537,find as _0x242b4e,isComment as _0x2a8c41,replaceElement as _0x1eb418,getChildren as _0x1dc41b,textContent as ti}from'domutils';import _0x15cd87 from'dom-serializer';import{isText as _0x413ccf,cloneNode as _0x54175e,Document as _0xe22c67,Element as _0x5bc3c5,Text as _0x5f1cc8,isDocument as _0x13eb47,NodeWithChildren as _0x552fe1}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x2032a9,MarkdownGfmMdToHtml as _0x5740d0}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x1d0e43 from'rehype-sanitize';import{fixElementSuggestionRange as _0xfda04b,DocumentCompare as _0x34a64f,DATA_ID_MODEL_ATTRIBUTE as _0x248cc9,ConfirmMixin as _0x277758,getAllMarkersDomElementsSorted as _0x5682e9,SuggestionsConversion as _0x48548a,DATA_ID_VIEW_ATTRIBUTE as _0x331999,getMarkerDomElement as _0x218dfd}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x1009c1 from'morphdom';import{diffArrays as _0x213593}from'diff';const Ti='_ungrouppedCommands';function fi(_0x5a9995,_0x2b61f6){const _0x54489c=(0x0,_0x2b61f6['t'])('Other');return _0x5a9995['length']?'groupId'in _0x5a9995[0x0]?_0x5a9995:[{'groupId':Ti,'groupLabel':_0x54489c,'order':0x1/0x0,'commands':_0x5a9995}]:[{'groupId':Ti,'groupLabel':_0x54489c,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x20e120{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x529179}=this,_0x3818ff=['ck-fake-ai-selection'];_0x529179['config']['get']('ai.assistant.useTheme')&&_0x3818ff['push']('ck-ai-assistant-ui_theme'),_0x529179['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x3818ff,'priority':0xc}}),_0x529179['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x3f08fa,{writer:_0x40fa05})=>{if(!_0x3f08fa['markerRange']['isCollapsed'])return null;const _0x5102fd=_0x40fa05['createUIElement']('span');return _0x40fa05['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5102fd),_0x5102fd;}});}['afterInit'](){!async function(_0x51f433){const _0x5cad62=_0x121968([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x522776=0x3dffc4e1,_0x3d78a8=0x3df84f41^_0x522776,_0x24c186=window[_0x121968([0x44,0x61,0x74,0x65])][_0x121968([0x6e,0x6f,0x77])](),_0x2098c2=_0x51f433[_0x121968([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x2edcd3=new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x190efb=>{_0x2098c2[_0x121968([0x6f,0x6e,0x63,0x65])](_0x121968([0x72,0x65,0x61,0x64,0x79]),_0x190efb);}),_0x5ab780={[_0x121968([0x6b,0x74,0x79])]:_0x121968([0x45,0x43]),[_0x121968([0x75,0x73,0x65])]:_0x121968([0x73,0x69,0x67]),[_0x121968([0x63,0x72,0x76])]:_0x121968([0x50,0x2d,0x32,0x35,0x36]),[_0x121968([0x78])]:_0x121968([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x121968([0x79])]:_0x121968([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x121968([0x61,0x6c,0x67])]:_0x121968([0x45,0x53,0x32,0x35,0x36])},_0xa619e0=_0x2098c2[_0x121968([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x121968([0x67,0x65,0x74])](_0x121968([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x582773(){let _0x52eba9,_0x4437df=null,_0xa2a842=null;try{if(_0xa619e0==_0x121968([0x47,0x50,0x4c]))return _0x121968([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x52eba9=_0x9a3261(),!_0x52eba9)return _0x121968([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x52eba9[_0x121968([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0xa2a842=_0x4f19ec(_0x52eba9[_0x121968([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x52eba9[_0x121968([0x6a,0x74,0x69])])),await _0x18cc51()?_0x31851e()?_0x468d57()?_0x121968([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0xe5c94d()?(_0x52eba9[_0x121968([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x121968([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x4437df=_0x4215ae(_0x121968([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x22eee4()):_0x121968([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x121968([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x121968([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x121968([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x468d57(){const _0x163ae6=[_0x121968([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x121968([0x74,0x72,0x69,0x61,0x6c])][_0x121968([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x52eba9[_0x121968([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x24c186/0x3e8:0xe10*_0x3d78a8;return _0x52eba9[_0x121968([0x65,0x78,0x70])]<_0x163ae6;}function _0x31851e(){const _0x276103=_0x52eba9[_0x121968([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x276103&&(!!_0x276103[_0x121968([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x121968([0x2a]))||!!_0x276103[_0x121968([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x121968([0x41,0x49])));}function _0xe5c94d(){const _0x25ec51=_0x52eba9[_0x121968([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x25ec51||0x0==_0x25ec51[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x5d1091}=new URL(window[_0x121968([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x25ec51[_0x121968([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5d1091))return!0x0;const _0x47df36=_0x5d1091[_0x121968([0x73,0x70,0x6c,0x69,0x74])](_0x121968([0x2e]));return _0x25ec51[_0x121968([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x40ad61=>_0x40ad61[_0x121968([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x121968([0x2a])))[_0x121968([0x6d,0x61,0x70])](_0x2a250e=>_0x2a250e[_0x121968([0x73,0x70,0x6c,0x69,0x74])](_0x121968([0x2e])))[_0x121968([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x2c9d52=>_0x2c9d52[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x47df36[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x121968([0x6d,0x61,0x70])](_0x2e95c6=>Array(_0x47df36[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x2e95c6[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x121968([0x66,0x69,0x6c,0x6c])](_0x2e95c6[0x0]===_0x121968([0x2a])?_0x121968([0x2a]):'')[_0x121968([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x2e95c6))[_0x121968([0x73,0x6f,0x6d,0x65])](_0x30230c=>_0x47df36[_0x121968([0x65,0x76,0x65,0x72,0x79])]((_0x2e8f73,_0x448b8c)=>_0x30230c[_0x448b8c]===_0x2e8f73||_0x30230c[_0x448b8c]===_0x121968([0x2a])));}function _0x22eee4(){return _0x4437df&&_0xa2a842?new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x34c039,_0x1772f4)=>{_0x4437df[_0x121968([0x74,0x68,0x65,0x6e])](_0x34c039,_0x1772f4),_0xa2a842[_0x121968([0x74,0x68,0x65,0x6e])](_0x5140a2=>{_0x5140a2!=_0x121968([0x56,0x61,0x6c,0x69,0x64])&&_0x34c039(_0x5140a2);},_0x1772f4);}):_0x4437df||_0xa2a842||_0x121968([0x56,0x61,0x6c,0x69,0x64]);}}function _0x4f19ec(_0x40d9af,_0x2dbdd0){return new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x337953=>{if(_0x54a581())return _0x337953(_0x121968([0x56,0x61,0x6c,0x69,0x64]));_0x2aeb38(),_0x2098c2[_0x121968([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x121968([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4cb69d=!0x1;const _0xa40d6d=at();function _0x450448(_0x15c324){return!!_0x15c324&&(typeof _0x15c324===_0x121968([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x15c324===_0x121968([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x15c324[_0x121968([0x74,0x68,0x65,0x6e])]===_0x121968([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x15c324[_0x121968([0x63,0x61,0x74,0x63,0x68])]===_0x121968([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0xdd27c8(_0x3c85e0){_0x4547f1(_0x3c85e0)[_0x121968([0x74,0x68,0x65,0x6e])](_0x3aef35=>{if(!_0x3aef35||_0x3aef35[_0x121968([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x121968([0x6f,0x6b]))return _0x121968([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x265e0a(_0x5896fe(_0xa40d6d+_0x2dbdd0))!=_0x3aef35[_0x121968([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x121968([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x121968([0x56,0x61,0x6c,0x69,0x64]);})[_0x121968([0x74,0x68,0x65,0x6e])](_0x189b29=>(_0xd48c2a(),_0x189b29),()=>{const _0x27aac0=_0x3f8ca3();return null==_0x27aac0?(_0xd48c2a(),_0x121968([0x56,0x61,0x6c,0x69,0x64])):_0x121968(_0x24c186-_0x27aac0>(0x19f340e1^_0x522776)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x121968([0x74,0x68,0x65,0x6e])](_0x337953)[_0x121968([0x63,0x61,0x74,0x63,0x68])](()=>{_0x337953(_0x121968([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1d5f5a=0x3dc92a61^_0x522776;function _0xd48c2a(){const _0x1d96ed=_0x121968([0x6c,0x6c,0x63,0x74,0x2d])+_0x265e0a(_0x5896fe(_0x40d9af)),_0x2b5e84=_0x5c64d0(_0x265e0a(window[_0x121968([0x4d,0x61,0x74,0x68])][_0x121968([0x63,0x65,0x69,0x6c])](_0x24c186/_0x1d5f5a)));window[_0x121968([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x121968([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1d96ed,_0x2b5e84);}function _0x3f8ca3(){const _0x4c576e=_0x121968([0x6c,0x6c,0x63,0x74,0x2d])+_0x265e0a(_0x5896fe(_0x40d9af)),_0x4de1c9=window[_0x121968([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x121968([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x4c576e);return _0x4de1c9?window[_0x121968([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x5c64d0(_0x4de1c9),0x10)*_0x1d5f5a:null;}function _0x4547f1(_0x29b8fe){return new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x10322b,_0x39af21)=>{_0x29b8fe[_0x121968([0x74,0x68,0x65,0x6e])](_0x10322b,_0x39af21),window[_0x121968([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x39af21,0x3dfe1021^_0x522776);});}}_0x2098c2[_0x121968([0x6f,0x6e])](_0x121968([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x338410,_0x3b574)=>{if(_0x3b574[0x0]!=_0x40d9af)return _0x337953(_0x121968([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x3b574[0x1]={..._0x3b574[0x1],[_0x121968([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0xa40d6d};},{[_0x121968([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x121968([0x68,0x69,0x67,0x68])}),_0x2098c2[_0x121968([0x6f,0x6e])](_0x121968([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x2ced09=>{_0x450448(_0x2ced09[_0x121968([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4cb69d=!0x0,_0xdd27c8(_0x2ced09[_0x121968([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x121968([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x121968([0x6c,0x6f,0x77])}),_0x2edcd3[_0x121968([0x74,0x68,0x65,0x6e])](()=>{_0x4cb69d||_0x337953(_0x121968([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x54a581(){return _0x2098c2[_0x121968([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x121968([0x76,0x69,0x65,0x77])][_0x121968([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x121968([0x61,0x75,0x74,0x6f]);}function _0x2aeb38(){_0x2098c2[_0x121968([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x121968([0x76,0x69,0x65,0x77])][_0x121968([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x121968([0x61,0x75,0x74,0x6f]);}}function _0x4215ae(_0x2300b1){const _0x2dac78=[new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3f3b65=>setTimeout(_0x3f3b65,0x3df6fa2d^_0x522776)),_0x2edcd3[_0x121968([0x74,0x68,0x65,0x6e])](()=>new window[(_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x20b2a2=>{let _0x3986b2=0x0;_0x2098c2[_0x121968([0x6d,0x6f,0x64,0x65,0x6c])][_0x121968([0x6f,0x6e])](_0x121968([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x450fcf,_0xda6e25)=>{_0xda6e25[0x0][_0x121968([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x3986b2++,_0x3986b2==(0x3dffc109^_0x522776)&&(_0x20b2a2(),_0x450fcf[_0x121968([0x6f,0x66,0x66])]());});}))];return window[_0x121968([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x121968([0x72,0x61,0x63,0x65])](_0x2dac78)[_0x121968([0x74,0x68,0x65,0x6e])](()=>_0x2300b1);}async function _0x49f2d1(){await _0x2edcd3,_0x2098c2[_0x121968([0x6d,0x6f,0x64,0x65,0x6c])][_0x121968([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0xce4c2e,_0x2098c2[_0x121968([0x6d,0x6f,0x64,0x65,0x6c])][_0x121968([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0xce4c2e,_0x2098c2[_0x121968([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x121968([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x2eb06f(_0x10e2c3){const _0x2dff1e=_0x574607();_0x2098c2[_0x2dff1e]=_0x121968([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x10e2c3,_0x10e2c3!=_0x121968([0x56,0x61,0x6c,0x69,0x64])&&_0x49f2d1();}function _0x574607(){const _0x2c8bca=window[_0x121968([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x121968([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x121968([0x6e,0x6f,0x77])]())[_0x121968([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x121968([0x2e]),'');let _0x374117=_0x121968([0x6e]);for(let _0x348c40=0x0;_0x348c40<_0x2c8bca[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x348c40+=0x2){let _0x142d92=window[_0x121968([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x2c8bca[_0x121968([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x348c40,_0x348c40+0x2));_0x142d92>=_0x5cad62[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x142d92-=_0x5cad62[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x374117+=_0x5cad62[_0x142d92];}return _0x374117;}function _0x9a3261(){const _0x53cfc=_0xa619e0[_0x121968([0x73,0x70,0x6c,0x69,0x74])](_0x121968([0x2e]));if(0x3!=_0x53cfc[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x47208f(_0x53cfc[0x1]);function _0x47208f(_0x25f59e){const _0x531aef=_0xdff48(_0x25f59e);return _0x531aef&&_0x4c30c0()?_0x531aef:null;function _0x4c30c0(){const _0x147025=_0x531aef[_0x121968([0x6a,0x74,0x69])],_0x2da312=window[_0x121968([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x147025[_0x121968([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x147025[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x569770={..._0x531aef,[_0x121968([0x6a,0x74,0x69])]:_0x147025[_0x121968([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x147025[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x569770[_0x121968([0x76,0x63])],_0x5896fe(_0x569770)==_0x2da312;}}}async function _0x18cc51(){let _0x59b2ca=!0x0;try{const _0x5939cc=_0xa619e0[_0x121968([0x73,0x70,0x6c,0x69,0x74])](_0x121968([0x2e])),[_0x4b8d9f,_0x438fdf,_0x353c8c]=_0x5939cc;return _0x5198e2(_0x4b8d9f),await _0x23adfd(_0x4b8d9f,_0x438fdf,_0x353c8c),_0x59b2ca;}catch{return!0x1;}function _0x5198e2(_0x178e3e){const _0xa15389=_0xdff48(_0x178e3e);_0xa15389&&_0xa15389[_0x121968([0x61,0x6c,0x67])]==_0x121968([0x45,0x53,0x32,0x35,0x36])||(_0x59b2ca=!0x1);}async function _0x23adfd(_0x21d103,_0x130d85,_0x839ba7){const _0x4a1869=window[_0x121968([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x121968([0x66,0x72,0x6f,0x6d])](_0x30558(_0x839ba7),_0x28af90=>_0x28af90[_0x121968([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x2fcd44=new window[(_0x121968([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x121968([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x21d103+_0x121968([0x2e])+_0x130d85),_0x89e91=window[_0x121968([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x121968([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x89e91)return;const _0x36d752=await _0x89e91[_0x121968([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x121968([0x6a,0x77,0x6b]),_0x5ab780,{[_0x121968([0x6e,0x61,0x6d,0x65])]:_0x121968([0x45,0x43,0x44,0x53,0x41]),[_0x121968([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x121968([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x121968([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x89e91[_0x121968([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x121968([0x6e,0x61,0x6d,0x65])]:_0x121968([0x45,0x43,0x44,0x53,0x41]),[_0x121968([0x68,0x61,0x73,0x68])]:{[_0x121968([0x6e,0x61,0x6d,0x65])]:_0x121968([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x36d752,_0x4a1869,_0x2fcd44)||(_0x59b2ca=!0x1);}}function _0xdff48(_0x463edb){return _0x463edb[_0x121968([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x121968([0x65,0x79]))?JSON[_0x121968([0x70,0x61,0x72,0x73,0x65])](_0x30558(_0x463edb)):null;}function _0x30558(_0x57efbc){return window[_0x121968([0x61,0x74,0x6f,0x62])](_0x57efbc[_0x121968([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x121968([0x2b]))[_0x121968([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x121968([0x2f])));}function _0x5896fe(_0x445bc1){let _0x68eb18=0x1505;function _0xab4971(_0x287836){for(let _0x3a2bca=0x0;_0x3a2bca<_0x287836[_0x121968([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x3a2bca++){const _0x357994=_0x287836[_0x121968([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x3a2bca);_0x68eb18=(_0x68eb18<<0x5)+_0x68eb18+_0x357994,_0x68eb18&=_0x68eb18;}}function _0x333a8f(_0x54f660){Array[_0x121968([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x54f660)?_0x54f660[_0x121968([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x333a8f):_0x54f660&&typeof _0x54f660==_0x121968([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x121968([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x54f660)[_0x121968([0x73,0x6f,0x72,0x74])]()[_0x121968([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x2a0847,_0x1e29d7])=>{_0xab4971(_0x2a0847),_0x333a8f(_0x1e29d7);}):_0xab4971(window[_0x121968([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x54f660));}return _0x333a8f(_0x445bc1),_0x68eb18>>>0x0;}function _0x265e0a(_0x34b3d8){return _0x34b3d8[_0x121968([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x121968([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x121968([0x30]));}function _0x5c64d0(_0x5ab238){return _0x5ab238[_0x121968([0x73,0x70,0x6c,0x69,0x74])]('')[_0x121968([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x121968([0x6a,0x6f,0x69,0x6e])]('');}function _0xce4c2e(){}function _0x121968(_0xfe63e6){return _0xfe63e6['map'](_0x5cf601=>String['fromCharCode'](_0x5cf601))['join']('');}_0x2eb06f(await _0x582773());}(this);}['showFakeVisualSelection'](){const _0x48ab85=this['editor']['model'];_0x48ab85['change'](_0x4430c1=>{const _0x2e1563=_0x48ab85['document']['selection']['getRanges']();let _0x1670d3=0x0;for(const _0x2115b2 of _0x2e1563){const _0x327f7b=bi+':'+_0x1670d3;if(_0x48ab85['markers']['has'](_0x327f7b))_0x4430c1['updateMarker'](_0x327f7b,{'range':_0x2115b2});else{if(_0x2115b2['start']['isAtEnd']){const _0x102756=_0x2115b2['start']['getLastMatchingPosition'](({item:_0x5ba2e6})=>!_0x48ab85['schema']['isContent'](_0x5ba2e6),{'boundaries':_0x2115b2});_0x4430c1['addMarker'](_0x327f7b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4430c1['createRange'](_0x102756,_0x2115b2['end'])});}else _0x4430c1['addMarker'](_0x327f7b,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2115b2});}_0x1670d3++;}});}['hideFakeVisualSelection'](){const _0x10b765=this['editor']['model'],_0x558178=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x558178['length']&&_0x10b765['change'](_0x3b4f97=>{_0x558178['forEach'](_0x2dbcf2=>{_0x3b4f97['removeMarker'](_0x2dbcf2);});});}['insertContent'](_0x33456a,_0x5f581f){const _0xe9410d=this['_getAISelection'](),_0x38ad27=_0x5f581f||_0xe9410d['getFirstRange']();this['editor']['model']['canEditAt'](_0x38ad27)&&this['editor']['model']['change'](_0x47350e=>{this['hideFakeVisualSelection'](),_0x5f581f||this['_resetContentOfSelectedTableCells'](_0x47350e,_0xe9410d),this['_pasteHTMLUsingClipboard']({'insertAt':_0x38ad27,'writer':_0x47350e,'html':_0x33456a});});}['insertContentBelow'](_0x1e5c39){const {model:_0x59dec2}=this['editor'],_0x4cd007=this['_getAISelection']();_0x59dec2['change'](()=>{const _0x4f2cb4=this['_prepareTableInsertBelowPosition'](_0x1e5c39,_0x4cd007)||this['_getDefaultInsertBelowPosition'](_0x4cd007);this['insertContent'](_0x1e5c39,_0x4f2cb4);});}['_getAISelection'](){const _0x5901bf=this['editor']['model'],_0x1ef0ee=Array['from'](_0x5901bf['markers']['getMarkersGroup'](bi))['map'](_0x44907b=>_0x44907b['getRange']());return _0x5901bf['createSelection'](_0x1ef0ee);}['_pasteHTMLUsingClipboard']({writer:_0x10735a,html:_0x14cb20,insertAt:_0x328b1b}){const {view:_0x315674}=this['editor']['editing'],_0x1d2a7a=this['editor']['plugins']['get'](_0x2f6bc9),_0xdf41e9=new Ri();_0xdf41e9['setData']('text/html',_0x14cb20);const _0x2f9df6=new ClipboardEvent('paste',{'clipboardData':_0xdf41e9}),_0x199519=new _0x3001ff(_0x315674,_0x2f9df6,{'dataTransfer':new _0x21219a(_0xdf41e9)});_0x10735a['setSelection'](_0x328b1b);const _0x57b4f5=(_0x4fc887,_0x27dfec)=>{_0x27dfec['resultRange']&&_0x10735a['setSelection'](_0x27dfec['resultRange']);};_0x1d2a7a['once']('contentInsertion',_0x57b4f5,{'priority':'lowest'}),_0x315674['document']['fire']('paste',_0x199519),_0x1d2a7a['off']('contentInsertion',_0x57b4f5);}['_getDefaultInsertBelowPosition'](_0x495a93){const {model:_0x45ffde}=this['editor'],_0x1d4dda=Array['from'](_0x495a93['getSelectedBlocks']());return _0x1d4dda['length']?_0x45ffde['createPositionAfter'](_0x1d4dda['pop']()):_0x495a93['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0xe8e8c3,_0x428463){const {model:_0x47a85b,plugins:_0x300742}=this['editor'];if(_0x300742['has']('TableUtils')){const _0x33d28d=_0x300742['get']('TableUtils')['getSelectedTableCells'](_0x428463);if(_0x33d28d['length']){const _0x27cd1d=this['_getTableRowCountFromContent'](_0xe8e8c3),_0x521ce4=this['_createEmptyTableRows'](_0x33d28d,_0x27cd1d);return _0x47a85b['createPositionAt'](_0x521ce4,0x0);}}return null;}['_getTableRowCountFromContent'](_0x419e65){const _0x154850=this['editor']['plugins']['get']('TableUtils'),_0x3c7471=this['editor']['data']['parse'](_0x419e65,'$documentFragment'),_0xe6d404=Array['from'](_0x3c7471['getChildren']())['filter'](_0x468c63=>_0x468c63['is']('element','table'));let _0x4fc554=0x0;return _0xe6d404['forEach'](_0x4e494a=>{_0x4fc554+=_0x154850['getRows'](_0x4e494a);}),_0x4fc554;}['_createEmptyTableRows'](_0x35eae8,_0x4409e1){const _0x38e6bd=this['editor']['plugins']['get']('TableUtils'),_0x459b6b=_0x38e6bd['getRowIndexes'](_0x35eae8),_0x1d9877=_0x38e6bd['getColumnIndexes'](_0x35eae8),_0x4a14da=_0x459b6b['last']+0x1,_0xf1000b=_0x1d9877['first'],_0x789a65=_0x35eae8[0x0]['findAncestor']('table');for(let _0x3198d3=0x0;_0x3198d3<_0x4409e1;_0x3198d3++)_0x38e6bd['insertRows'](_0x789a65,{'at':_0x4a14da});return _0x789a65['getChild'](_0x4a14da)['getChild'](_0xf1000b);}['_resetContentOfSelectedTableCells'](_0x5b809f,_0x3b205c){const {plugins:_0x532e7f}=this['editor'],{model:_0x58eb7f}=_0x5b809f;if(!_0x532e7f['has']('TableUtils'))return;_0x532e7f['get']('TableUtils')['getSelectedTableCells'](_0x3b205c)['length']&&_0x58eb7f['deleteContent'](_0x3b205c);}}class AIAdapter extends _0x20e120{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);}}class AIRequestError extends Error{constructor(_0x361d40){super(_0x361d40),this['name']='AIRequestError';}}function Si(_0x138ce3,_0x1c8123,_0x1e206b){const t=_0x138ce3['t'];switch(_0x1c8123){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',_0x1e206b);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1e206b);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'},_0x1e206b);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 _0x1c8123;}}class ShowAIAssistantCommand extends _0x338152{['_commandDefinitions'];constructor(_0x439713,_0x151898){super(_0x439713),this['_commandDefinitions']=_0x151898,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x465d89,_0x574346,_0x5cb481)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x5cb481));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x51b4c7,_0x28ce80,_0x242b0a)=>{this['enabledCommandsIds']=_0x242b0a?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x345840=this['editor']['model'];this['_hasContext']=function(_0x32f21b){const _0x38808d=_0x32f21b['document']['selection'];return _0x38808d['isCollapsed']?0x0!==[..._0x38808d['getSelectedBlocks']()]['length']&&![..._0x38808d['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x32f21b['hasContent'](_0x38808d['getFirstRange']());}(_0x345840);const _0x338e04=_0x345840['document']['selection'],_0x1f35a4=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x53a57c of _0x338e04['getRanges']())for(const _0x2b8096 of _0x53a57c['getItems']())if(_0x2b8096['is']('element')&&_0x1f35a4['includes'](_0x2b8096['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x4e497c='',_0x28f278='',_0x8f504e='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x4e497c,_0x28f278,_0x8f504e);}}function Oi(_0x26aa40,_0x4ec1b8){const _0x2fcf76=new Set();for(const _0x176043 of _0x26aa40['values']())(_0x4ec1b8||!0x1===_0x176043['requiresContent'])&&_0x2fcf76['add'](_0x176043['id']);return Array['from'](_0x2fcf76);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
- ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x2178b1,_0x518c37,_0x40ae39){super(),this['editor']=_0x2178b1,this['textAdapter']=_0x518c37,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x40ae39,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x22de73,_0x2d0a70,_0x237e6a)=>{this['view']['value']=this['_sanitizeHTML'](_0x237e6a);}),this['listenTo'](this['view'],'submitPrompt',(_0x4121d6,_0x28aaec)=>{const _0x39de84=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x28aaec,_0x39de84,'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:_0x315c09,query:_0x1425b3,htmlContent:_0x5df88d,label:_0x249a75,mainActionLabel:_0x5ef6cc}){this['view']['prompt']=_0x249a75,this['view']['mainAction']=_0x5ef6cc,this['initialContext']=_0x5df88d,_0x1425b3&&(this['view']['isRendered']?this['_handleQuery'](_0x1425b3,_0x5df88d,_0x315c09,_0x249a75):this['view']['once']('render',()=>{this['_handleQuery'](_0x1425b3,_0x5df88d,_0x315c09,_0x249a75);}));}['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'](_0x560a13,_0x290ed6,_0x3fae90,_0x4dc46b){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x290ed6,this['previousQuery']=_0x560a13,this['previousLabel']=_0x4dc46b||_0x560a13,this['previousActionId']=_0x3fae90,new Promise(_0x13812b=>{this['textAdapter']['makeRequest']({'query':_0x560a13,'context':_0x290ed6,'onData':_0x35f47b=>{this['currentResponse']=_0x35f47b,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x3fae90})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x2ceace=>{_0x2ceace instanceof AIRequestError?this['view']['handleError'](_0x2ceace['message']):this['view']['handleError'](),_0x13812b();})['finally'](()=>{this['stopProcessing'](),_0x13812b();});});}['_parseAndNormalizeContent'](_0x2c05e5,_0x35f4f1=!0x1){const _0xb8e29d=vi['exec'](_0x2c05e5);_0x2c05e5=_0xb8e29d?_0x2c05e5['substring'](_0xb8e29d[0x1]['length']):_0x2c05e5['length']<0x64&&!_0x35f4f1?'':this['_stripMarkdownSyntax'](_0x2c05e5);const _0x2fc504=this['_domParser']['parseFromString'](_0x2c05e5,'text/html');if(_0xb8e29d){const _0x4f7d5c=Array['from'](_0x2fc504['body']['childNodes']);_0x4f7d5c['reverse']();for(const _0x3eaf5f of _0x4f7d5c){if(_0x3eaf5f['nodeType']==Node['ELEMENT_NODE'])break;_0x3eaf5f['remove']();}}const _0x1b2dcc=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x2fc504['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x1b2dcc);const _0xdc39d0=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x4ba2ac=this['editor']['data']['toModel'](_0x1b2dcc);return _0xdc39d0||_0x4ba2ac['markers']['clear'](),this['editor']['data']['stringify'](_0x4ba2ac);}['_normalizeResponseHeadings'](_0x217d4e){const _0x4d4502=new _0x439010(this['editor']['editing']['view']['document']),_0x215a49=new _0x324701({'name':/^h[1-5]$/}),_0x26f66a=[];let _0x2f9573=!0x1;for(const _0x4fc4bb of _0x217d4e)_0x4fc4bb['is']('element')&&_0x215a49['match'](_0x4fc4bb)&&(_0x26f66a['push'](_0x4fc4bb),'h1'==_0x4fc4bb['name']&&(_0x2f9573=!0x0));if(_0x2f9573){for(const _0x45e488 of _0x26f66a)_0x4d4502['rename']('h'+(parseInt(_0x45e488['name'][0x1])+0x1),_0x45e488);}}['_isH1TagSupportEnabled'](){const {data:_0x1870e9,editing:_0x21a2ef}=this['editor'],_0x5962a9=_0x1870e9['htmlProcessor']['toView']('<h1></h1>'),_0x4ddc13=_0x1870e9['toView'](_0x1870e9['toModel'](_0x5962a9));return!!_0x21a2ef['view']['domConverter']['viewToDom'](_0x4ddc13)['querySelector']('h1');}['_sanitizeHTML'](_0x3f3939){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x3f3939),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x587167){const _0x133f79=_0x587167['trim']();return _0x133f79['startsWith']('```html')?_0x133f79['endsWith']('```')?_0x133f79['substring'](0x7,_0x133f79['length']-0x3):_0x133f79['substring'](0x7):_0x587167;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x2ad631){super(_0x2ad631),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x18596f=>Si(_0x2ad631,'AI_'+_0x18596f['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x2ad631,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x2ad631,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x2ad631,'Stop'));const _0x38f678=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x38f678['if']('isVisible','ck-hidden',_0x13a0aa=>!_0x13a0aa)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x3732bb,_0x5f22f0){const _0x28a5ba=new yt(this['locale']);return _0x28a5ba['set']({'label':_0x3732bb,'class':_0x5f22f0||'','isVisible':!0x0,'withText':!0x0}),_0x28a5ba;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x2a8de9,_0x33c14c=''){super(_0x2a8de9),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3c7378=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x2a8de9,_0x33c14c),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3c7378['if']('isVisible','ck-hidden',_0x2d5f87=>!_0x2d5f87)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3c7378['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 _0x94392a=!0x1;this['on']('change:value',(_0x99aae9,_0x17fe9d,_0x594884)=>{const _0x7dda7=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x594884),this['isProcessing']&&_0x7dda7&&!_0x94392a&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x6c8d79,_0x5a7d6f,_0x5aa2f8)=>{_0x94392a=!0x1,_0x5aa2f8?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x94392a=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x94392a=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x33b9f1=this['locale'],_0x512695=new yt(this['locale']),_0x304db2='ck-ai-form__copy-button';return _0x512695['set']({'label':Si(_0x33b9f1,'Copy'),'icon':_0x30ebff,'class':_0x304db2,'tooltip':!0x0}),_0x512695['bind']('isVisible')['to'](this,'value',_0x312b29=>!!_0x312b29),_0x512695['bind']('isEnabled')['to'](this,'isProcessing',_0x41b583=>!_0x41b583),_0x512695['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x512695['icon']=_0x3d9fb7,_0x512695['class']=_0x304db2+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x512695['icon']=_0x30ebff,_0x512695['class']=_0x304db2;},0x3e8);}),_0x512695;}['_copyHTMLToClipboard'](_0x29025f){const {window:_0x429c66,document:_0x56983e}=lt;if(_0x429c66['ClipboardItem']){const {Blob:_0x2800cd,ClipboardItem:_0x16a1f9}=_0x429c66,_0x434e6f=[new _0x16a1f9({'text/html':new _0x2800cd([_0x29025f['innerHTML']],{'type':'text/html'}),'text/plain':new _0x2800cd([_0x29025f['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x434e6f);}else{const _0x2f583c=_0x56983e['createElement']('div');_0x2f583c['style']['position']='absolute',_0x2f583c['style']['left']='-9999px',_0x2f583c['innerHTML']='<span>[</span>'+_0x29025f['innerHTML']+'<span>]</span>',_0x56983e['body']['appendChild'](_0x2f583c);const _0x4e550a=_0x56983e['createRange']();_0x4e550a['setStartAfter'](_0x2f583c['firstElementChild']),_0x4e550a['setEndBefore'](_0x2f583c['lastElementChild']);const _0x3f4773=_0x429c66['getSelection']();_0x3f4773['removeAllRanges'](),_0x3f4773['addRange'](_0x4e550a),_0x56983e['execCommand']('copy'),_0x2f583c['remove']();}}}class ContentFieldView extends Nt{constructor(_0x29ae38,_0xb4f4c5=''){super(_0x29ae38),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0xb4f4c5,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x462bfe){this['element']['innerHTML']=_0x462bfe;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0xd4b6c4=new Nt(),_0xaaf5d1=this['locale'],_0x465668=new xt();return _0x465668['isVisible']=!0x0,_0xd4b6c4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x465668,{'text':Si(_0xaaf5d1,'AI\x20is\x20writing...')}]}),_0xd4b6c4['render'](),_0xd4b6c4;}}class AIFormErrorView extends Nt{constructor(_0x1005d2,_0x3c8e9d=''){super(_0x1005d2);const _0x2c7b7=new Lt(),_0x4e41af=this['bindTemplate'];this['set']('text',_0x3c8e9d),_0x2c7b7['content']=_0x212b4b,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x2c7b7,{'text':_0x4e41af['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0xa98d30,_0x5af546){super(_0xa98d30,_0x5af546),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',(_0x496d3a,_0x110e21)=>{_0x496d3a['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x110e21());});}['_createSubmitButton'](){const _0x14fd66=new yt(this['locale']),_0x2ff039=this['locale'];return _0x14fd66['set']({'icon':_0x18e564,'label':Si(_0x2ff039,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x14fd66['on']('execute',()=>{this['submit']();}),_0x14fd66['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x3e7822,_0xec3c8f)=>!_0x3e7822&&_0xec3c8f),_0x14fd66;}['_createShowHistoryButton'](){const _0x324137=new yt(this['locale']),_0x13c53a=this['resultsView'],_0x627966=this['locale'];_0x324137['set']({'label':Si(_0x627966,'History'),'withText':!0x1,'icon':_0x2251d5,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x324137['bind']('isOn')['to'](_0x13c53a,'isVisible'),_0x324137['bind']('isEnabled')['to'](this,'isEnabled'),_0x324137['on']('execute',()=>{_0x13c53a['isVisible']=!_0x13c53a['isVisible'],_0x13c53a['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x2af840=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x2fdc01=new dt(this['queryView']['fieldView']['element']),_0x10ef00=_0x2fdc01['width'],_0x5acaa2='rtl'===_0x627966['uiLanguageDirection']?'left':'right';_0x2fdc01['excludeScrollbarsAndBorders'](),_0x324137['element']['style'][_0x5acaa2]=_0x10ef00-_0x2fdc01['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x2af840),this['on']('render',_0x2af840),_0x324137;}['submit'](){const _0xd9b306=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0xd9b306);}['focus'](_0x163f53){-0x1===_0x163f53?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x385098){super(_0x385098),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x385098,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x5bd277=0x0;for(const _0x2720c4 of this['items'])_0x5bd277+=_0x2720c4['items']['length'];return{'resultsCount':_0x5bd277,'totalItemsCount':_0x5bd277};}['_createClearHistoryButton'](){const _0x1e5131=this['locale'],_0x283b9a=new yt(this['locale']);return _0x283b9a['set']({'label':'('+Si(_0x1e5131,'Clear')+')','withText':!0x0}),_0x283b9a['on']('execute',()=>this['fire']('clearHistory')),_0x283b9a;}}class AIHistoryListItemView extends Ht{constructor(_0x495794){super();const _0x35a08e=new Mt(),_0x4fa32f=new yt(this['locale'],_0x35a08e);this['children']['add'](_0x4fa32f),_0x4fa32f['set']({'label':_0x495794['prompt'],'withText':!0x0}),_0x4fa32f['on']('execute',()=>{this['fire']('execute',{'value':_0xdffc15(_0x495794['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x3f5a0e,_0x418c4a)=>{const _0x3fae50=Ni(_0x418c4a['prompt']);for(const _0x4b7412 of this)if(_0x4b7412!=_0x418c4a&&Ni(_0x4b7412['prompt'])===_0x3fae50){this['remove'](_0x4b7412);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x5a2a46=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x5a2a46));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x52367e=>_0x52367e)));}}function Ni(_0x3371b5){return _0x3371b5['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x1ee5cd,_0x199a6a,_0x4d713c=''){super(_0x1ee5cd),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x1ee5cd),this['contentArea']=new AIFormContentArea(_0x1ee5cd,_0x4d713c),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 It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'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 _0x4f9fdc=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x199a6a],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x4f9fdc['if']('isError','ck-hidden',_0x45aea1=>!_0x45aea1)]},'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'](_0x2b713c=0x1){-0x1===_0x2b713c?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 _0x13c5be=this['locale'],_0x207e41=new AIFormPromptView(_0x13c5be,{'queryView':{'label':Si(_0x13c5be,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x13c5be,'Empty\x20history'),'secondary':Si(_0x13c5be,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x207e41['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2bf4fc,_0x3eb9d4)=>_0x2bf4fc&&!_0x3eb9d4),this['listenTo'](_0x207e41,'submit',(_0xa0d128,_0x3b8032)=>{this['prompt']=_0x3b8032;const _0x75bf3c=_0x7f6d0a(_0x3b8032);this['fire']('submitPrompt',_0x75bf3c),_0x3b8032['trim']()&&this['_promptHistory']['add']({'prompt':_0x75bf3c},0x0);},{'priority':'high'}),_0x207e41;}['_createHistoryView'](){const _0x462f0c=new AIHistoryListView(this['locale']);return _0x462f0c['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x462f0c['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x462f0c;}['_createToolbar'](){const _0x583ef5=new AIFormToolbarView(this['locale']);return _0x583ef5['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x19d233,_0x365fd5,_0x553691)=>_0x19d233&&!_0x365fd5&&!!_0x553691),_0x583ef5['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x583ef5['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x3d0cea,_0x4a9f08,_0x78f245)=>_0x3d0cea&&!_0x4a9f08&&!!_0x78f245),_0x583ef5['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x583ef5['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x14d48f,_0x2970cc)=>_0x14d48f&&!_0x2970cc),_0x583ef5['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x583ef5['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x583ef5['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x583ef5;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0xb23b47=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0xb23b47,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0xf2fb96){const _0xc28b4b=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0xf2fb96||Si(_0xc28b4b,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x20e120{['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[_0x1adffa,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x502210){super(_0x502210),_0x502210['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x502210['config']['define']('ai.assistant.contentAreaCssClass',''),_0x502210['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x502210['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x454fcf}=this;this['_aiAdapter']=_0x454fcf['plugins']['get'](AIAdapter),this['_dialog']=_0x454fcf['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x26106b=new ShowAIAssistantCommand(_0x454fcf,Array['from'](this['_commandDefinitions']['values']()));_0x454fcf['commands']['add']('showAIAssistant',_0x26106b),_0x454fcf['ui']['componentFactory']['add']('aiCommands',_0x24de42=>{const _0x1db314=Ft(_0x24de42);return _0x1db314['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x1db314['buttonView']['set']({'label':Si(_0x24de42,'AI\x20Commands'),'icon':_0x5a09b8,'tooltip':!0x0}),_0x1db314['on']('execute',_0x3be43f=>this['_onExecute'](_0x3be43f['source']['id'])),Wt(_0x1db314,_0x454fcf['ui']['view']['body'],function(_0x76bc33){const _0xb23c56=fi(_0x76bc33['config']['get']('ai.assistant.commands'),_0x76bc33['locale']),_0x113ecb=Pi(_0x76bc33,_0xb23c56)['filter'](_0xf0c23b=>_0xf0c23b['commands']['length']);if(0x1===_0x113ecb['length'])return Pi(_0x76bc33,_0x113ecb[0x0]['commands'])['map'](_0x22aaf7=>({'id':_0x22aaf7['id'],'label':_0x22aaf7['label']}));return _0x113ecb['map'](_0x168c0b=>{const {groupId:_0x250f4d,groupLabel:_0xc695ab,commands:_0x4f3c7d}=_0x168c0b,_0x5d6994=Pi(_0x76bc33,_0x4f3c7d)['map'](_0x2b1a2b=>({'id':_0x2b1a2b['id'],'label':_0x2b1a2b['label']}));return{'id':_0x250f4d,'menu':_0xc695ab||_0x250f4d,'children':_0x5d6994};});}(_0x454fcf),{'ariaLabel':Si(_0x24de42,'AI\x20Commands')}),_0x1db314['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x26106b['on']('change:enabledCommandsIds',_0x1137b8),_0x1db314['menuView']['once']('render',_0x1137b8),_0x1db314;function _0x1137b8(){_0x1db314['isEnabled']=_0x26106b['enabledCommandsIds']['length']>0x0;for(const _0x503b13 of _0x1db314['menuView']['buttons'])_0x503b13['isEnabled']=_0x26106b['enabledCommandsIds']['includes'](_0x503b13['id']);}}),_0x454fcf['ui']['componentFactory']['add']('menuBar:aiCommands',_0x74c551=>{const _0x5abeef=new Kt(_0x74c551);_0x5abeef['buttonView']['set']({'label':Si(_0x74c551,'AI\x20Commands'),'icon':_0x5a09b8}),_0x5abeef['bind']('isEnabled')['to'](_0x26106b,'enabledCommandsIds',_0x3aa3ce=>_0x3aa3ce['length']>0x0);const _0x4e8549=fi(_0x454fcf['config']['get']('ai.assistant.commands'),_0x74c551);return this['_populateMenuBarMenu'](_0x26106b,_0x5abeef,_0x4e8549,_0x126fd8=>this['_onExecute'](_0x126fd8)),_0x5abeef;}),_0x454fcf['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x53ad88=this['_createAIAssistantUIButton'](yt);return _0x53ad88['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x53ad88;}),_0x454fcf['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x18f0f1=this['_createAIAssistantUIButton'](Yt);return _0x18f0f1['set']({'role':'menuitemcheckbox'}),_0x18f0f1;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x19be46=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x555700;for(const _0x7333d9 in _0x19be46){const _0x4ca40c=_0x7333d9,_0x51c9a6=_0x19be46[_0x4ca40c];if('aiLicenseKeyValid'==_0x51c9a6||'aiLicenseKeyInvalid'==_0x51c9a6||'aiLicenseKeyExpired'==_0x51c9a6||'aiLicenseKeyDomainLimit'==_0x51c9a6||'aiLicenseKeyNotAllowed'==_0x51c9a6||'aiLicenseKeyEvaluationLimit'==_0x51c9a6||'aiLicenseKeyUsageLimit'==_0x51c9a6){delete _0x19be46[_0x4ca40c],_0x555700=_0x51c9a6,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x555700&&_0x19be46['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x555700&&_0x19be46['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x555700&&_0x19be46['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x555700&&_0x19be46['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x555700&&_0x19be46['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x555700&&_0x19be46['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x7ab0f1='',_0x259d17='',_0xc4f22='custom'){const _0x4f5e06=this['editor'],_0x6f10d9=_0x4f5e06['editing']['view'],_0x1518ce=_0x4f5e06['plugins']['get'](AIAssistantEditing),_0x1d44d0=_0x4f5e06['plugins']['get'](_0x1adffa);_0x1518ce['showFakeVisualSelection']();const _0x56e726=new xi(),_0x1ef1d5=new ClipboardEvent('copy',{'clipboardData':_0x56e726}),_0x2beab1=new _0x21219a(_0x56e726),_0x30b014=new _0x3001ff(_0x6f10d9,_0x1ef1d5,{'dataTransfer':_0x2beab1});_0x1d44d0['_forceMarkersCopy']('comment',()=>{_0x6f10d9['document']['fire']('copy',_0x30b014);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x4f5e06,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x3cca17=_0x2beab1['getData']('text/html');const _0x1a08b4=_0x4f5e06['model']['document']['selection'],_0x3c373b=Array['from'](_0x1a08b4['getRanges']());0x1===_0x3c373b['length']&&_0x3c373b[0x0]['isFlat']&&!_0x1a08b4['getSelectedElement']()&&''!==_0x3cca17['replace'](/&nbsp;/g,'')['trim']()&&(_0x3cca17='<p>'+_0x3cca17+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0xc4f22,'query':_0x7ab0f1,'htmlContent':_0x3cca17,'label':_0x259d17,'mainActionLabel':ki[_0x4f5e06['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0xcc780e,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x1518ce['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x134d54=new Map(),_0x448a19=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x268858 of _0x448a19)for(const _0x19c854 of _0x268858['commands'])_0x134d54['set'](_0x19c854['id'],{..._0x19c854,'groupId':_0x268858['groupId'],'groupLabel':_0x268858['groupLabel']||_0x268858['groupId']});return _0x134d54;}['_createAIAssistantUIButton'](_0x303fa3){const _0x254ca3=this['editor'],_0x893c3=_0x254ca3['commands']['get']('showAIAssistant'),_0x2465f9=new _0x303fa3(_0x254ca3['locale']);return _0x2465f9['set']({'label':Si(_0x254ca3['locale'],'AI\x20Assistant'),'icon':_0xcc780e,'isToggleable':!0x0}),_0x2465f9['bind']('isEnabled')['to'](_0x893c3),_0x2465f9['bind']('isOn')['to'](this['_dialog'],'id',_0x282b7e=>'aiAssistant'===_0x282b7e),this['listenTo'](_0x2465f9,'execute',()=>{_0x2465f9['isOn']?this['hideUI']():_0x893c3['execute']();}),_0x2465f9;}['_initView'](){const _0x4672e0=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(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',()=>{_0x4672e0['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x4672e0['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5bc179,ui:{ariaLiveAnnouncer:_0x58f271}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x240f1f,_0x4db2ba,_0x1c006c)=>{const _0x386171=this['_aiAssistantController']['currentContext'];_0x1c006c?_0x58f271['announce'](Si(_0x5bc179,'AI\x20is\x20writing')):_0x386171&&_0x58f271['announce'](Si(_0x5bc179,'Generated\x20content:\x20%0',_0x386171),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x22355a,_0x2466c0,_0x2d95f6)=>{if(_0x2d95f6){const _0x5de65a=this['_formView']['errorView']['text'];_0x58f271['announce'](Si(_0x5bc179,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5de65a));}});}['_onExecute'](_0x4a463f){const _0x5a2542=this['_commandDefinitions']['get'](_0x4a463f),_0x4e2a6d=this['editor'],_0x331c14=_0x4e2a6d['model']['document']['selection'],_0x3646fd=_0x4e2a6d['commands']['get']('showAIAssistant'),_0x286d79=_0x4e2a6d['plugins']['get'](AIAssistantEditing),_0x528288=''+(_0x5a2542['groupId']!==Ti?_0x5a2542['groupLabel']+':\x20':'')+_0x5a2542['label'];if(!0x1!==_0x5a2542['requiresContent']&&_0x331c14['isCollapsed']){const _0x4bd090=gt(_0x331c14['getSelectedBlocks']())||_0x4e2a6d['model']['schema']['getLimitElement'](_0x331c14);_0x4e2a6d['model']['change'](_0x303669=>{_0x303669['setSelection'](_0x4bd090,'in');});}_0x286d79['showFakeVisualSelection'](),_0x3646fd['execute'](_0x5a2542['prompt'],_0x528288,'command:'+_0x4a463f);}['_populateMenuBarMenu'](_0x2886d5,_0x5f345e,_0x4636c4,_0x2d1320){const _0x57c805=this['editor'],_0x4718a2=_0x57c805['locale'],_0x50e493=new qt(_0x4718a2),_0x35ce2e=Pi(_0x57c805,_0x4636c4)['filter'](_0x323f37=>_0x323f37['commands']['length']);0x1===_0x35ce2e['length']?this['_getMenuBarGroupButtons']({'command':_0x2886d5,'commands':_0x35ce2e[0x0]['commands'],'parentMenuView':_0x5f345e,'onExecute':_0x2d1320})['forEach'](_0x450292=>_0x50e493['items']['add'](_0x450292)):_0x35ce2e['forEach'](({groupId:_0x2c85fc,groupLabel:_0x2a4fe9,commands:_0x707397})=>{const _0x530e98=new Qt(_0x4718a2,_0x5f345e),_0x2073bf=new Kt(_0x4718a2),_0x2c0cd8=new qt(_0x4718a2),_0xc43a6e=this['_getMenuBarGroupButtons']({'command':_0x2886d5,'commands':_0x707397,'parentMenuView':_0x2073bf,'onExecute':_0x2d1320});_0x2073bf['buttonView']['set']({'label':_0x2a4fe9||_0x2c85fc}),_0x2073bf['delegate']('execute')['to'](_0x5f345e),_0x2c0cd8['items']['addMany'](_0xc43a6e),_0x2073bf['panelView']['children']['add'](_0x2c0cd8),_0x530e98['children']['add'](_0x2073bf),_0x50e493['items']['add'](_0x530e98);}),_0x5f345e['panelView']['children']['add'](_0x50e493);}['_getMenuBarGroupButtons']({command:_0x4c7ebc,commands:_0x3fd3a9,parentMenuView:_0x1eec91,onExecute:_0xeb602d}){const _0x143c67=this['editor'],_0x1fbfba=_0x143c67['locale'];return Pi(_0x143c67,_0x3fd3a9)['map'](_0x2a1349=>{const _0x428816=new Qt(_0x1fbfba,_0x1eec91),_0x1da60d=new Yt(_0x1fbfba);return _0x1da60d['set']({'label':_0x2a1349['label']}),_0x1da60d['delegate']('execute')['to'](_0x1eec91),_0x1da60d['on']('execute',()=>_0xeb602d(_0x2a1349['id'])),_0x1da60d['bind']('isEnabled')['to'](_0x4c7ebc,'enabledCommandsIds',_0x132d36=>_0x132d36['includes'](_0x2a1349['id'])),_0x428816['children']['add'](_0x1da60d),_0x428816;});}}function Li(_0xe79f44,_0x41225a){return void 0x0!==_0xe79f44['order']&&void 0x0===_0x41225a['order']?0x1:void 0x0===_0xe79f44['order']&&void 0x0!==_0x41225a['order']?-0x1:void 0x0!==_0xe79f44['order']&&void 0x0!==_0x41225a['order']?_0xe79f44['order']-_0x41225a['order']:0x0;}function Pi(_0x12251d,_0x28b928){_0x28b928['sort'](Li);const _0x491b13={},_0x363514=[];for(const _0x39d2d9 of _0x28b928)if(void 0x0!==_0x39d2d9['order']){if(_0x39d2d9['order']in _0x491b13)throw new ht('ai-commands-config-order-collision',_0x12251d,{'conflictingDefinitions':[_0x39d2d9,_0x491b13[_0x39d2d9['order']]]});_0x491b13[_0x39d2d9['order']]=_0x39d2d9,_0x363514['splice'](_0x39d2d9['order'],0x0,_0x39d2d9);}else _0x363514['push'](_0x39d2d9);return _0x363514;}class AIAssistant extends _0x20e120{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9db4f9){super(_0x9db4f9);const _0x502f13=_0x9db4f9['config'],_0x1b29bd=_0x9db4f9['locale'];_0x502f13['define']('ai.assistant.preserveComments',!0x0),_0x502f13['define']('ai.assistant.commands',Di(_0x1b29bd)),_0x502f13['define']('ai.assistant.extraCommandGroups',[]),_0x502f13['define']('ai.assistant.removeCommands',[]);let _0x3af3ea=fi(_0x502f13['get']('ai.assistant.commands'),_0x1b29bd);const _0x24c797=_0x502f13['get']('ai.assistant.extraCommandGroups'),_0x4ea301=_0x502f13['get']('ai.assistant.removeCommands');_0x24c797['forEach'](_0x13f757=>{const _0x45d583=_0x3af3ea['find'](_0x409f2b=>_0x409f2b['groupId']===_0x13f757['groupId']);_0x45d583?_0x45d583['commands']=_0x45d583['commands']['concat'](_0x13f757['commands']):_0x3af3ea['push'](_0x13f757);}),_0x3af3ea=_0x3af3ea['filter'](_0xcfd152=>!_0x4ea301['includes'](_0xcfd152['groupId'])),_0x3af3ea['forEach'](_0x13443a=>{_0x13443a['commands']=_0x13443a['commands']['filter'](_0x443a89=>!_0x4ea301['includes'](_0x443a89['id']));}),_0x502f13['set']('ai.assistant.commands',_0x3af3ea);}}function Di(_0x49417a){return[{'groupId':'editOrReview','groupLabel':Si(_0x49417a,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x49417a,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x49417a,'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':Si(_0x49417a,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x49417a,'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':Si(_0x49417a,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x49417a,'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':Si(_0x49417a,'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':Si(_0x49417a,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x49417a,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x49417a,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x49417a,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x49417a,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x49417a,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x49417a,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x49417a,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x49417a,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x49417a,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x49417a,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x49417a,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x49417a,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x49417a,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x49417a,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x49417a,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x49417a,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x49417a,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x49417a,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x49417a,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x20e120{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x3a2a57){super(_0x3a2a57),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x3144d9){return this['sendRequest'](_0x3144d9)['catch'](_0x59b955=>{if(_0x59b955 instanceof AIRequestError)return Promise['reject'](_0x59b955);if('AbortError'==_0x59b955['name'])return Promise['resolve']();throw console['error'](_0x59b955),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x3be2b5,_0x5cc5e9){const _0x10753c=this['editor']['locale'],_0xfe38cc={'Content-Type':'application/json'};if('object'==typeof _0x3be2b5)Object['assign'](_0xfe38cc,_0x3be2b5);else{if(_0x3be2b5)try{const _0x403978=await _0x3be2b5(_0x5cc5e9);Object['assign'](_0xfe38cc,_0x403978);}catch{return Promise['reject'](new AIRequestError(Si(_0x10753c,'AI_ERROR_GET_HEADERS')));}}return _0xfe38cc;}async['_prepareRequestParameters'](_0x3f124e,_0x502693){const _0x256067=this['editor']['locale'];if('object'==typeof _0x3f124e)return _0x3f124e;try{return await _0x3f124e(_0x502693);}catch{return Promise['reject'](new AIRequestError(Si(_0x256067,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x30dc1b){super(_0x30dc1b),_0x30dc1b['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x30dc1b['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x30dc1b['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x30dc1b['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x30dc1b['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x30dc1b['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x12e4eb,context:_0x363df8,onData:_0x472cae,actionId:_0x1ee977}){const _0x289c51=this['editor']['locale'],_0x12c433=await this['prepareMessages'](_0x12e4eb,_0x363df8,_0x1ee977),_0x2e6743=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x1ee977),_0x2dcce8=await this['_prepareRequestParameters'](this['_requestParameters'],_0x1ee977),_0x6a97a3={'messages':_0x12c433,..._0x2dcce8},_0xd93bbd={'method':'POST','headers':_0x2e6743,'body':JSON['stringify'](_0x6a97a3),'signal':this['abortController']['signal']},_0x4ada2a=await fetch(this['_apiUrl'],_0xd93bbd);if(_0x4ada2a['ok'])return _0x2dcce8['stream']?await this['_readStreamableResponse'](_0x4ada2a,_0x472cae):await this['_readStaticResponse'](_0x4ada2a,_0x472cae),Promise['resolve']();{const _0x2cb17c=await _0x4ada2a['text']();return _0x2cb17c['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x289c51,'AI_ERROR_CONTEXT_LENGTH'))):_0x2cb17c['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x289c51,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x2cb17c));}}async['prepareMessages'](_0x5f11b2,_0x51a810,_0x46980d){let _0x5eb538,_0x5dd5be;return _0x51a810?(_0x5eb538='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.',_0x5dd5be='Instruction:\x0a'+_0x5f11b2+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x51a810):(_0x5eb538='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.',_0x5dd5be=_0x5f11b2),[{'role':'system','content':_0x5eb538},{'role':'user','content':_0x5dd5be}];}async['_readStreamableResponse'](_0x2d842f,_0x3589d9){const _0x1f55bd=_0x2d842f['body']['getReader'](),_0x3abd76=new TextDecoder();let _0x514cf2='',_0x302122='',_0x4f6472='',_0x3dbf7d=!0x1;for(;!_0x3dbf7d;){const {done:_0x2ec7e6,value:_0x1a5a1d}=await _0x1f55bd['read'](),_0xc65279=_0x514cf2+_0x3abd76['decode'](_0x1a5a1d);let _0x51aff1='';_0x3dbf7d=_0x2ec7e6;try{_0x51aff1=this['_cleanUpData'](_0xc65279),_0x514cf2='';}catch{_0x514cf2=_0xc65279;continue;}_0x302122+=_0x51aff1,!_0x3dbf7d&&this['_isBufferIncomplete'](_0x302122)||_0x302122&&(_0x4f6472+=_0x302122,_0x302122='',_0x3589d9(_0x4f6472));}return Promise['resolve']();}async['_readStaticResponse'](_0x534253,_0x160145){return _0x160145((await _0x534253['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x27d9cf){const _0x4831b3=_0x27d9cf['split']('<')['length']!==_0x27d9cf['split']('>')['length'],_0x1b1863=_0x27d9cf['length']<0x1e;return _0x4831b3&&_0x1b1863;}['_cleanUpData'](_0x8e4c11){return _0x8e4c11['split'](/\n(?![^{]*\})/g)['map'](_0x13cce1=>_0x13cce1['replace']('data:\x20',''))['filter'](_0x4c5f81=>_0x4c5f81&&_0x4c5f81['length']>0x0&&'[DONE]'!==_0x4c5f81)['map'](_0x3e232f=>{const {choices:_0x1f0ca9}=JSON['parse'](_0x3e232f);if(_0x1f0ca9[0x0]?.['delta']?.['content'])return _0x1f0ca9[0x0]['delta']['content'];})['filter'](_0x3692fe=>_0x3692fe)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x2cad7a){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x203144,_0x16cd5c={}){super(_0x203144),this['isToggleable']=!0x0,this['set']('side',_0x16cd5c['side']||'top');const _0x651034=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x16cd5c['class']||[]),_0x651034['to']('side',_0x2f1026=>'ck-tab-button_'+_0x2f1026),_0x651034['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x349da8,_0x2e3e14={}){super(_0x349da8);const _0x3f66fd=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x2e3e14['class']||[]),_0x3f66fd['to']('class'),_0x3f66fd['if']('isVisible','ck-hidden',_0x1f35ce=>!_0x1f35ce)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x4de470,_0x188e84={}){super(_0x4de470),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x188e84['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x188e84['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x25df35,_0x5a47b4)=>_0x25df35&&null!==_0x5a47b4);const _0x4f5879=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x188e84['class']||[]),_0x4f5879['to']('side',_0x47f390=>'ck-tabs_'+_0x47f390),_0x4f5879['to']('class'),_0x4f5879['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x4f5879['to']('activeTab',_0x348603=>null===_0x348603?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x4f5879['to']('side',_0x1a7188=>'ck-tabs__buttons-container_'+_0x1a7188)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x4f5879['to']('side',_0x49e2e6=>'ck-tabs__panels-container_'+_0x49e2e6)]},'children':this['panelViews']},...mt(_0x188e84['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x38a8c6){const _0x50a1ce=this['_tabs']['get'](_0x38a8c6);return _0x50a1ce||null;}['addTab'](_0x1753d2){const _0x32d28c=this['_setupButton']({'id':_0x1753d2['id'],'label':_0x1753d2['buttonLabel'],'icon':_0x1753d2['buttonIcon'],'order':_0x1753d2['order']}),_0x3a5dbc=new TabPanelView(this['locale']);return _0x3a5dbc['render'](),_0x1753d2['content']&&_0x3a5dbc['children']['add'](_0x1753d2['content']),this['panelViews']['add'](_0x3a5dbc),this['_tabs']['set'](_0x1753d2['id'],{'button':_0x32d28c,'panel':_0x3a5dbc,'order':void 0x0!==_0x1753d2['order']?_0x1753d2['order']:null}),this['fire']('addTab:'+_0x1753d2['id'],{'id':_0x1753d2['id'],'button':_0x32d28c,'panel':_0x3a5dbc}),null===this['activeTab']?this['activateTab'](_0x1753d2['id']):this['_hidePanel'](_0x1753d2['id']),{'button':_0x32d28c,'panel':_0x3a5dbc};}['activateTab'](_0x4c51a2){if(null!==_0x4c51a2&&!this['getTab'](_0x4c51a2))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4c51a2});if(this['activeTab']===_0x4c51a2)return;const _0x2d7a6e=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x4c51a2,_0x4c51a2&&this['_showPanel'](_0x4c51a2),this['fire']('activateTab:'+_0x4c51a2,{'newTab':_0x4c51a2,'oldTab':_0x2d7a6e});}['toggleTabPanel'](_0x5a00b9){if(!this['getTab'](_0x5a00b9))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5a00b9});this['activeTab']===_0x5a00b9?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x5a00b9);}['showTab'](_0x429647){if(!this['getTab'](_0x429647))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x429647});this['_showPanel'](_0x429647),this['_showButton'](_0x429647),this['fire']('show:'+_0x429647,_0x429647);}['hideTab'](_0x2afb79){if(!this['getTab'](_0x2afb79))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2afb79});const _0x2dbdcb=this['activeTab'];this['_hidePanel'](_0x2afb79),this['_hideButton'](_0x2afb79);const _0x313094=this['getTabIds']();_0x2dbdcb===_0x2afb79&&_0x313094['length']>0x1&&this['activateTab'](_0x313094['find'](_0x599eeb=>_0x599eeb!==_0x2afb79)),this['fire']('hide:'+_0x2afb79,_0x2afb79);}['_getPanel'](_0x29521f){const _0x16291d=this['_tabs']['get'](_0x29521f);return _0x16291d?_0x16291d['panel']:null;}['_showPanel'](_0x1b26d8){null!==this['activeTab']&&this['activeTab']!==_0x1b26d8||this['_getPanel'](_0x1b26d8)['show']();}['_hidePanel'](_0xe01612){const _0x3a931d=this['_getPanel'](_0xe01612);_0x3a931d['isVisible']&&(this['activeTab']===_0xe01612&&(this['activeTab']=null),_0x3a931d['hide']());}['_getButton'](_0x272802){const _0x1c64bf=this['_tabs']['get'](_0x272802);return _0x1c64bf?_0x1c64bf['button']:null;}['_showButton'](_0x42d382){this['_getButton'](_0x42d382)['show']();}['_hideButton'](_0x254f4d){this['_getButton'](_0x254f4d)['hide']();}['_setupButton'](_0x1da17c){const _0x52b3b2=new TabButtonView(this['locale'],{'side':this['side']}),_0x5701ff=this['buttonViews'];if(_0x52b3b2['set']({'label':_0x1da17c['label'],'icon':_0x1da17c['icon'],'tooltip':!0x0,'withText':!0x0}),_0x52b3b2['bind']('isOn')['to'](this,'activeTab',_0x487653=>_0x487653===_0x1da17c['id']),_0x52b3b2['bind']('side')['to'](this,'side'),_0x1da17c['order']){const _0x2e992b=[...this['_tabs']]['reduce']((_0x499f85,_0x1597f3)=>{const _0x28e70e=_0x1597f3[0x0],{order:_0x3b7bb6}=_0x1597f3[0x1];return!_0x3b7bb6||_0x3b7bb6>_0x1da17c['order']?_0x499f85:_0x3b7bb6>=_0x499f85['order']?{'id':_0x28e70e,'order':_0x3b7bb6}:_0x499f85;},{'id':'','order':0x0}),_0xb188c5=_0x5701ff['getIndex'](this['_getButton'](_0x2e992b['id']));_0x5701ff['add'](_0x52b3b2,_0xb188c5+0x1);}else _0x5701ff['add'](_0x52b3b2);return _0x52b3b2['on']('execute',()=>{this['toggleTabPanel'](_0x1da17c['id']);}),_0x52b3b2;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0xc216c9,_0x533b8c={}){super(_0xc216c9,_0x533b8c),this['set']('type',_0x533b8c['type']||'sidebar'),this['set']('side',_0x533b8c['side']||'right'),this['set']('isVisible',_0x533b8c['visibleByDefault']??!0x0);const _0x448f3b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x448f3b['if']('type','ck-ai-tabs__overlay',_0x1e6cef=>'overlay'===_0x1e6cef),_0x448f3b['if']('type','ck-ai-tabs__sidebar',_0x4c61ea=>'sidebar'===_0x4c61ea),_0x448f3b['if']('isVisible','ck-hidden',_0x359b3c=>!_0x359b3c)]}}),this['buttonViews']['on']('add',(_0x4d087f,_0x60ada2)=>{_0x60ada2['set']('withText',!0x1);});}}class AITabs extends _0x464fb9{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x257e83){if(super(_0x257e83),!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 _0x2d8ec7=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x2d8ec7['showResizeButton']&&(this['showResizeButton']=_0x2d8ec7['showResizeButton']),'sidebar'!==_0x2d8ec7['type']&&'overlay'!==_0x2d8ec7['type']||_0x2d8ec7['side']&&(this['side']=_0x2d8ec7['side']),'sidebar'===_0x2d8ec7['type']){if(this['container']=_0x2d8ec7['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x2d8ec7['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x2d8ec7['visibleByDefault'],'collapsible':_0x2d8ec7['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 _0x2fdbcb&&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'](_0x4fc0cb){if(_0x4fc0cb&&this['type']!==_0x4fc0cb){if(!Vi['includes'](_0x4fc0cb))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x4fc0cb;}}['switchSide'](_0x2a6784){if(_0x2a6784&&this['side']!==_0x2a6784){if(!Hi['includes'](_0x2a6784))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x2a6784;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x464fb9{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x38c39d];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5cd4b9){if(super(_0x5cd4b9),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 _0x37131c=this['context']['plugins']['get'](_0x38c39d);if(!_0x37131c['token'])throw new ht('ai-missing-token',this);this['_token']=_0x37131c['token'];}['startConversation'](_0x28bd9e,_0x1eebc9){const _0x3cb5a4=this['_sendApiRequest']('/conversations','POST',{'id':_0x28bd9e,'group':_0x1eebc9});return{'getConversation':async()=>(await _0x3cb5a4['request'])['json'](),'abortController':_0x3cb5a4['abortController']};}['queryAssistant']({message:_0x43f08e,conversationId:_0x4387a0,parts:_0x5a1f31,capabilities:_0x5b86ed,model:_0x3e92ce,attributes:_0xead7a4}){const _0x3bd57a={'prompt':_0x43f08e,'content':_0x5a1f31,'model':_0x3e92ce,..._0x5b86ed&&{'capabilities':_0x5b86ed},..._0xead7a4&&{'attributes':_0xead7a4}},_0x3c00b6=this['_sendApiRequest']('/conversations/'+_0x4387a0+'/messages','POST',_0x3bd57a,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x4d51db=(await _0x3c00b6['request'])['body'];return this['_getStreamReader'](_0x4d51db);},'abortController':_0x3c00b6['abortController']};}['executeCustomAction']({content:_0x8795b4,message:_0x5d4cb9,model:_0x5a47a2,outputFormat:_0x39edf9}){const _0x2bd4ed={'content':[{'type':'text','content':_0x8795b4}],'prompt':_0x5d4cb9,'model':_0x5a47a2,'outputFormat':_0x39edf9},_0x5546c8=this['_sendApiRequest']('/actions/custom/calls','POST',_0x2bd4ed);return{'getStream':async()=>{const _0x110452=(await _0x5546c8['request'])['body'];return this['_getStreamReader'](_0x110452);},'abortController':_0x5546c8['abortController']};}['executeAction']({actionName:_0x35ca51,content:_0xc4123e,args:_0xbb32f7}){const _0x4d17e8={'content':[{'type':'text','content':_0xc4123e}],'args':_0xbb32f7},_0x5e588d=this['_sendApiRequest']('/actions/system/'+_0x35ca51+'/calls','POST',_0x4d17e8);return{'getStream':async()=>{const _0x1c5276=(await _0x5e588d['request'])['body'];return this['_getStreamReader'](_0x1c5276);},'abortController':_0x5e588d['abortController']};}['uploadFile'](_0x4101ba,_0xaa7017,_0x27b7d1){const _0x12041d=new FormData();_0x12041d['append']('file',_0xaa7017,_0xaa7017['name']),_0x27b7d1&&_0x12041d['append']('attributes',JSON['stringify'](_0x27b7d1));const _0x4fceb3=this['_sendApiRequest']('/conversations/'+_0x4101ba+'/files','POST',_0x12041d);return{'getId':async()=>(await _0x4fceb3['request'])['json'](),'abortController':_0x4fceb3['abortController']};}['fetchDocument'](_0x5d76f1,_0x155322){const _0x3ef850=this['_sendApiRequest']('/conversations/'+_0x5d76f1+'/documents/'+_0x155322,'GET');return{'getDocument':async()=>(await _0x3ef850['request'])['json'](),'abortController':_0x3ef850['abortController']};}['uploadDocument'](_0x4b6487,_0x56efa3,_0x4fbc8f){const _0x50e491={'content':_0x56efa3};_0x4fbc8f&&(_0x50e491['attributes']=_0x4fbc8f);const _0x47ea4a=this['_sendApiRequest']('/conversations/'+_0x4b6487+'/documents','POST',_0x50e491);return{'getId':async()=>(await _0x47ea4a['request'])['json'](),'abortController':_0x47ea4a['abortController']};}['uploadDocuments'](_0x2f734f,_0x4f1e8b){const _0x5afd97={'documents':_0x4f1e8b['map'](_0x5d398d=>({'content':_0x5d398d['content'],'attributes':{'version':_0x5d398d['version'],'sessionId':_0x5d398d['sessionId'],'channelId':_0x5d398d['channelId'],'rootName':_0x5d398d['rootName'],'selections':_0x5d398d['selections']},...void 0x0!==_0x5d398d['name']?{'name':_0x5d398d['name']}:{},...void 0x0!==_0x5d398d['description']?{'description':_0x5d398d['description']}:{}}))},_0x3b7366=this['_sendApiRequest']('/conversations/'+_0x2f734f+'/documents/batch','POST',_0x5afd97);return{'getIds':async()=>(await _0x3b7366['request'])['json'](),'abortController':_0x3b7366['abortController']};}['fetchDocuments'](_0x195575,_0x29345b){const _0x40c702=new URLSearchParams();_0x40c702['append']('documentIds',_0x29345b['join'](','));const _0x2b868d=this['_sendApiRequest']('/conversations/'+_0x195575+'/documents/batch?'+_0x40c702['toString'](),'GET');return{'getDocuments':async()=>(await _0x2b868d['request'])['json'](),'abortController':_0x2b868d['abortController']};}['fetchConversations'](_0x413b6a,_0x32d688={}){const _0x168e3e=new URLSearchParams();_0x168e3e['append']('group',_0x413b6a),_0x168e3e['append']('excludeEmpty',!0x1!==_0x32d688['excludeEmpty']?'true':'false'),_0x168e3e['append']('limit',_0x32d688['limit']?_0x32d688['limit']['toString']():'100'),_0x168e3e['append']('sortBy',_0x32d688['sortBy']?_0x32d688['sortBy']:'createdAt'),_0x168e3e['append']('order',_0x32d688['order']?_0x32d688['order']:'desc');const _0x4a6e81=this['_sendApiRequest']('/conversations?'+_0x168e3e['toString'](),'GET');return{'getConversations':async()=>{const _0x43e86b=await _0x4a6e81['request'];return(await _0x43e86b['json']())['items'];},'abortController':_0x4a6e81['abortController']};}['deleteConversation'](_0x254850){const _0x114f18=this['_sendApiRequest']('/conversations/'+_0x254850,'DELETE');return{'execute':async()=>{await _0x114f18['request'];},'abortController':_0x114f18['abortController']};}['updateConversation'](_0x34b3a1,_0x559801){const _0x2ea69d=this['_sendApiRequest']('/conversations/'+_0x34b3a1,'PATCH',_0x559801);return{'getResult':async()=>(await _0x2ea69d['request'],_0x559801),'abortController':_0x2ea69d['abortController']};}['fetchConversation'](_0xe13a3b){const _0x30144e=this['_sendApiRequest']('/conversations/'+_0xe13a3b,'GET');return{'getConversation':async()=>(await _0x30144e['request'])['json'](),'abortController':_0x30144e['abortController']};}['fetchConversationMessages'](_0x2455c1){const _0x5f1f10=this['_sendApiRequest']('/conversations/'+_0x2455c1+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x2cf13d=await _0x5f1f10['request'];return(await _0x2cf13d['json']())['items'];},'abortController':_0x5f1f10['abortController']};}['uploadUrl'](_0x556833,_0x56f52d,_0x597f9c){const _0x256069=this['_sendApiRequest']('/conversations/'+_0x556833+'/web-resources','POST',{'url':_0x56f52d,'attributes':_0x597f9c});return{'getId':async()=>(await _0x256069['request'])['json'](),'abortController':_0x256069['abortController']};}['getModels'](_0x3ae598='en'){const _0x730b68=new URLSearchParams();_0x730b68['append']('language',_0x3ae598);const _0x519268='/models/1?'+_0x730b68['toString'](),_0x4a0c37=this['_sendApiRequest'](_0x519268,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x4a0c37['request'])['json'](),'abortController':_0x4a0c37['abortController']};}['deleteFile'](_0x45a841,_0x3243ae){const _0xbdf33e=this['_sendApiRequest']('/conversations/'+_0x45a841+'/files/'+_0x3243ae,'DELETE');return{'execute':async()=>{await _0xbdf33e['request'];},'abortController':_0xbdf33e['abortController']};}['deleteDocument'](_0x3da8cf,_0x222954){const _0x2d7511=this['_sendApiRequest']('/conversations/'+_0x3da8cf+'/documents/'+_0x222954,'DELETE');return{'execute':async()=>{await _0x2d7511['request'];},'abortController':_0x2d7511['abortController']};}['deleteWebResource'](_0x512639,_0x58083a){const _0x4433d6=this['_sendApiRequest']('/conversations/'+_0x512639+'/web-resources/'+_0x58083a,'DELETE');return{'execute':async()=>{await _0x4433d6['request'];},'abortController':_0x4433d6['abortController']};}['cancelStream'](_0x33ccba,_0x349807){const _0x11c7bc=this['_sendApiRequest']('/conversations/'+_0x33ccba+'/messages/'+_0x349807+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x11c7bc['request'];},'abortController':_0x11c7bc['abortController']};}['resumeStream'](_0x50fe62,_0x368265,_0x1af01f='0-0'){const _0x450bf6=new URLSearchParams({'lastEventId':_0x1af01f}),_0x4823e1=this['_sendApiRequest']('/conversations/'+_0x50fe62+'/messages/'+_0x368265+'/stream?'+_0x450bf6['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x127a41=await _0x4823e1['request'];return this['_getStreamReader'](_0x127a41['body']);},'abortController':_0x4823e1['abortController']};}['callSystemReview']({reviewName:_0x3f99f4,content:_0x16fc57,args:_0x27f561}){const _0x26c4b1=this['_sendApiRequest']('/reviews/system/'+_0x3f99f4+'/calls','POST',{'content':[{'type':'text','content':_0x16fc57}],'args':_0x27f561});return{'getStream':async()=>{const _0x5b5b00=(await _0x26c4b1['request'])['body'];return this['_getStreamReader'](_0x5b5b00);},'abortController':_0x26c4b1['abortController']};}['callCustomReview']({content:_0x2bdad5,prompt:_0x210267,model:_0x49d6dd}){const _0x2973bc=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x2bdad5}],'prompt':_0x210267,'model':_0x49d6dd});return{'getStream':async()=>{const _0xaf6b5=(await _0x2973bc['request'])['body'];return this['_getStreamReader'](_0xaf6b5);},'abortController':_0x2973bc['abortController']};}['upsertAIChatRating'](_0x439529,_0x256181,_0x57f072){const _0x5cf60f=this['_sendApiRequest']('/conversations/'+_0x439529+'/messages/'+_0x256181+'/ratings','PUT',{'positiveCount':_0x57f072['positiveCount'],'totalCount':_0x57f072['totalCount'],'modificationId':_0x57f072['modificationId']});return{'execute':async()=>{await _0x5cf60f['request'];},'abortController':_0x5cf60f['abortController']};}['upsertAIActionRating'](_0x46a1e7,_0x297f37,_0x19bc37){const _0x389e89=this['_sendApiRequest']('/actions/system/'+_0x46a1e7+'/calls/'+_0x297f37+'/ratings','PUT',{'positiveCount':_0x19bc37['positiveCount'],'totalCount':_0x19bc37['totalCount']});return{'execute':async()=>{await _0x389e89['request'];},'abortController':_0x389e89['abortController']};}['upsertCustomAIActionRating'](_0x198c77,_0x4f8daa){const _0x2c8c1c=this['_sendApiRequest']('/actions/custom/calls/'+_0x198c77+'/ratings','PUT',{'positiveCount':_0x4f8daa['positiveCount'],'totalCount':_0x4f8daa['totalCount']});return{'execute':async()=>{await _0x2c8c1c['request'];},'abortController':_0x2c8c1c['abortController']};}['upsertAIReviewRating'](_0x5201ff,_0x4e1609,_0x396a79,_0x1f3394){const _0x53181a=this['_sendApiRequest']('/reviews/system/'+_0x5201ff+'/calls/'+_0x4e1609+'/ratings','PUT',{'positiveCount':_0x396a79['positiveCount'],'totalCount':_0x396a79['totalCount'],'dataId':_0x1f3394});return{'execute':async()=>{await _0x53181a['request'];},'abortController':_0x53181a['abortController']};}['upsertCustomAIReviewRating'](_0x229628,_0x462212,_0xa07ac1){const _0x325248=this['_sendApiRequest']('/reviews/custom/calls/'+_0x229628+'/ratings','PUT',{'positiveCount':_0x462212['positiveCount'],'totalCount':_0x462212['totalCount'],'dataId':_0xa07ac1});return{'execute':async()=>{await _0x325248['request'];},'abortController':_0x325248['abortController']};}['_sendApiRequest'](_0x594d1f,_0x6f4cf,_0x29fe67,_0x346487={}){const {useCache:_0x2509d4=!0x1,apiUrl:_0x1f51e4=this['_apiUrl']}=_0x346487,_0x35b762=new AbortController(),_0x29fc85=_0x2509d4?_0x6f4cf+':'+_0x594d1f:null;if(_0x29fc85){const _0x2c4851=this['_responseCache']['get'](_0x29fc85);if(_0x2c4851)return{'request':_0x2c4851['then'](_0x558491=>_0x558491['clone']()),'abortController':_0x35b762};}const _0x5446ff=_0x29fe67 instanceof FormData,_0x43e26d={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x29fe67&&!_0x5446ff&&(_0x43e26d['Content-Type']='application/json');const _0x1b5162={'method':_0x6f4cf,'headers':_0x43e26d,'signal':_0x35b762['signal']};_0x29fe67&&(_0x1b5162['body']=_0x5446ff?_0x29fe67:JSON['stringify'](_0x29fe67));const _0x384a43=fetch(''+_0x1f51e4+_0x594d1f,_0x1b5162)['catch'](_0x58297b=>{_0x29fc85&&this['_responseCache']['delete'](_0x29fc85),this['_handleError'](_0x58297b);})['then'](_0x17a9bf=>_0x17a9bf['ok']?_0x17a9bf:_0x17a9bf['json']()['then'](_0x4315af=>{throw _0x29fc85&&this['_responseCache']['delete'](_0x29fc85),{'url':_0x1f51e4,'path':_0x594d1f,'method':_0x6f4cf,'body':_0x29fe67,'status':(_0x17a9bf||{})['status'],'statusText':(_0x17a9bf||{})['statusText'],'code':_0x4315af['code'],'message':_0x4315af['message'],'traceId':_0x4315af['traceId']};}));return _0x29fc85&&this['_responseCache']['set'](_0x29fc85,_0x384a43['then'](_0x1b2df5=>_0x1b2df5['clone']())),{'request':_0x384a43,'abortController':_0x35b762};}async*['_getStreamReader'](_0x5f1a90){const _0x20e69b=[],_0x19cc24=_0x5f1a90['getReader'](),_0x446695=_0x360039({'onError':_0x27f454=>{this['_handleError'](_0x27f454);},'onEvent':_0x1192ab=>{_0x1192ab['data']=JSON['parse'](_0x1192ab['data']),_0x20e69b['push'](_0x1192ab);}});try{let _0x36d7d2=!0x1;for(;!_0x36d7d2;){const {done:_0x570f1a,value:_0x41ffbc}=await _0x19cc24['read']();_0x570f1a&&(_0x36d7d2=!0x0),_0x446695['feed'](this['_decoder']['decode'](_0x41ffbc,{'stream':!0x0})),yield*_0x20e69b,_0x20e69b['length']=0x0;}}catch(_0x316863){this['_handleError'](_0x316863);}finally{_0x19cc24['releaseLock'](),_0x446695['reset']();}}['_handleError'](_0x398562){if(_0x398562 instanceof ht)throw _0x398562;if(_0x398562 instanceof Error&&'AbortError'===_0x398562['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x398562});throw new ht('ai-request-failed',this,{'originalError':_0x398562});}}function Mi(_0xd2251c,_0x17511c,_0x1ef5a0){const t=_0xd2251c['t'];switch(_0x17511c){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'},_0x1ef5a0);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.'},_0x1ef5a0);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.'},_0x1ef5a0);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.'},_0x1ef5a0);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'},_0x1ef5a0);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x1ef5a0);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'},_0x1ef5a0);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.'},_0x1ef5a0);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.'},_0x1ef5a0);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.'},_0x1ef5a0);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.'},_0x1ef5a0);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'},_0x1ef5a0);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.'},_0x1ef5a0);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 _0x17511c;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x126521,_0x5e10fc){const _0x213ff5=new yt(_0x126521),_0x4478ed=Mi(_0x126521,'AI_TABS_LABEL_MINIMIZE'),_0x557243=Mi(_0x126521,'AI_TABS_LABEL_MAXIMIZE');return _0x213ff5['set']({'withText':!0x1,'icon':_0x3f28e0,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x213ff5['bind']('label')['to'](_0x5e10fc,'isMaximized',_0x268788=>_0x268788?_0x4478ed:_0x557243),_0x213ff5['bind']('icon')['to'](_0x5e10fc,'isMaximized',_0x5e9c93=>_0x5e9c93?_0xbe2da2:_0x3f28e0),_0x213ff5['bind']('isOn')['to'](_0x5e10fc,'isMaximized'),_0x213ff5['on']('execute',()=>{_0x5e10fc['fire']('resizeTabs');}),_0x213ff5;}function Wi(_0xa30a40,_0x368d33){return _0x5ebf01(_0xa30a40,_0x368d33);}function Ki(_0x5e78bd,_0x38b091){return _0x15cd87(_0x5e78bd,_0x38b091);}function Yi(_0x1bd1f2,_0xb3fb43,_0x454d75){const _0x4aeb60=null!==_0xb3fb43?_0x50b293=>_0x50b293['attribs'][_0x1bd1f2]===_0xb3fb43:_0x598427=>Boolean(_0x598427['attribs'][_0x1bd1f2]);return _0x4fe1af(_0x45030d=>_0x1abf14(_0x45030d)&&_0x4aeb60(_0x45030d),_0x454d75);}function $i(_0x256cbc,_0x30f05c,_0x49ac17){const _0x3b72c9=null!==_0x30f05c?_0x23ebef=>_0x23ebef['attribs'][_0x256cbc]===_0x30f05c:_0x35f41f=>Boolean(_0x35f41f['attribs'][_0x256cbc]);return _0x1621e3(_0x3d2225=>_0x1abf14(_0x3d2225)&&_0x3b72c9(_0x3d2225),_0x49ac17);}function qi(_0x8c44d5){return _0x1621e3(_0x5e5451=>_0x1abf14(_0x5e5451)&&function(_0x55a9b4){const _0x5b271a=_0x55a9b4['toLowerCase']();return'script'===_0x5b271a||'style'===_0x5b271a||_0x5b271a['includes']('-');}(_0x5e5451['name']),_0x8c44d5);}function Qi(_0x1c2b25){return _0x242b4e(_0x53a7e4=>_0x2a8c41(_0x53a7e4),_0x1c2b25,!0x0,0x1/0x0);}function Xi(_0x873874,_0x4a1405){return _0x873874&&_0x1abf14(_0x873874)?_0x873874['attribs'][_0x4a1405]:null;}function zi(_0x378222,_0x511e66,_0x6054cf){_0x1abf14(_0x378222)&&(null===_0x6054cf?delete _0x378222['attribs'][_0x511e66]:_0x378222['attribs'][_0x511e66]=_0x6054cf);}function ji(_0x60cd2f,_0x4fb714,_0x1979ae){const _0x46153a=_0x4fb714['cloneNode'](!0x0);'beforebegin'===_0x1979ae?_0x208787(_0x60cd2f,_0x46153a):'afterbegin'===_0x1979ae?_0x21afaf(_0x60cd2f,_0x46153a):'beforeend'===_0x1979ae?_0x27e222(_0x60cd2f,_0x46153a):'afterend'===_0x1979ae&&_0xdcd537(_0x60cd2f,_0x46153a);}function Ji(_0x35bf52){const _0x3dab8c=[];let _0x114c3e=_0x35bf52;for(;_0x114c3e;)_0x114c3e=_0x55560d(_0x114c3e),_0x114c3e&&_0x3dab8c['push'](_0x114c3e);return _0x3dab8c;}function Zi(_0x505a99){return _0x505a99['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x1a70bc){let _0x2f6344=0x0;for(;_0x1a70bc['parentNode'];)_0x1a70bc=_0x1a70bc['parentNode'],_0x2f6344++;return _0x2f6344;}function es(_0x501705){const _0x588c46=[];let _0x5afd84=_0x501705['nextSibling'];for(;_0x5afd84;)_0x588c46['push'](_0x5afd84),_0x5afd84=_0x5afd84['nextSibling'];_0x588c46['forEach'](_0x5e670d=>{_0x2f3801(_0x5e670d);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
- ct(){['_m2html'];constructor(){super();const _0xd03b65=Object['entries'](_0x2032a9),_0x54a031=_0xd03b65['findIndex'](([_0x24b750])=>'rehypeDomRaw'===_0x24b750);if(-0x1===_0x54a031)throw new ht('ai-response-parser-unable-to-set-up-parser');_0xd03b65['splice'](_0x54a031+0x1,0x0,['rehypeSanitize',_0x1d0e43]),this['_m2html']=new _0x5740d0({'plugins':Object['fromEntries'](_0xd03b65)});}['convertMarkdownToHTML'](_0x37acc5){const _0xf7c6dd=this['_m2html']['parse'](_0x37acc5);return this['parseAndNormalizeHTML'](_0xf7c6dd);}['parseAndNormalizeHTML'](_0x56b7e5){return this['_parseHTML'](_0x56b7e5);}['_parseHTML'](_0x388866){const _0x30994d=Wi('<dummy>'+_0x388866['replace'](/<[^>]*?$/g,'')+'</dummy>');return is(_0x30994d),_0x30994d['children']=_0x30994d['children'][0x0]['children'],_0x30994d;}}function is(_0x45df1c){for(const _0x1a67dd of _0x45df1c['children'])_0x1abf14(_0x1a67dd)?'pre'!==_0x1a67dd['name']&&is(_0x1a67dd):_0x413ccf(_0x1a67dd)&&(_0x1a67dd['data']=_0x1a67dd['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
- ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x3018ea){super(),this['_generateUid']=_0x3018ea||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x4af052,_0x48f56b,_0x3fab10){this['_uidCounter']=0x0;const _0x1c76f3=_0x4af052['cloneNode'](!0x0);rs(_0x48f56b,_0x1c76f3);const _0x21d8fb=_0x1c76f3['childNodes'],_0x488014=Array['from'](_0x21d8fb)['filter'](_0x16f792=>!(0x3===_0x16f792['nodeType']&&''===Ki(_0x16f792)['trim']())),_0x5060fc=_0x488014['length'];for(const _0x2732bf of _0x488014)_0x2732bf&&_0x1abf14(_0x2732bf)&&void 0x0===_0x2732bf['attribs']['data-id']&&zi(_0x2732bf,'data-id','new-element');if(0x0===_0x48f56b['childNodes']['length']){const _0x4c78a4=[];return $i('data-id','new-element',_0x1c76f3)['forEach'](_0x582c17=>{const _0xf4e7df=this['_generateUid']();zi(_0x582c17,'data-id',_0xf4e7df),_0x4c78a4['push'](_0xf4e7df);}),this['_removeSpecialComments'](_0x1c76f3),{'parsedContent':_0x1c76f3,'newNodeIds':_0x4c78a4,'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(),this['_existingDataIds']=new Set($i('data-id',null,_0x48f56b)['map'](_0x3ef750=>Xi(_0x3ef750,'data-id'))['filter'](_0x126993=>!!_0x126993));let _0x644e08=-0x1,_0x1ee25=!0x1;for(let _0x433a22=0x0;_0x433a22<_0x5060fc;_0x433a22++){const _0x444ee6=_0x488014[_0x433a22],_0x2653eb=_0x488014[_0x433a22+0x1];if(this['_isNewNode'](_0x444ee6)){if(-0x1===_0x644e08&&(_0x644e08=_0x433a22),this['_markWrappedElements'](_0x444ee6),!this['_isNewNode'](_0x2653eb)){const [_0x3f01a9,_0x3ea7c9]=this['_findReferenceNode'](_0x444ee6,_0x1ee25,_0x48f56b);if(_0x3f01a9){const _0x5ca571=Array['from'](_0x488014)['slice'](_0x644e08,_0x433a22+0x1);this['_insertNodes'](_0x3f01a9,_0x5ca571,_0x3ea7c9),_0x644e08=-0x1;}}}else{if(this['_isExistingContentComment'](_0x444ee6))_0x1ee25=!0x0;else{if(this['_isExistingNode'](_0x444ee6)){const _0x45a6ae=Xi(_0x444ee6,'data-id');if(_0x45a6ae&&this['_existingDataIds']['has'](_0x45a6ae)){this['_referencedExistingIds']['add'](_0x45a6ae);const _0x35fa39=Yi('data-id',_0x45a6ae,_0x48f56b);this['_replaceNode'](_0x35fa39,_0x444ee6);}}else{if(ss(_0x444ee6)){const _0x59643f=ns(_0x444ee6);!!Yi('data-id',_0x59643f,_0x1c76f3)||this['_touchedNodesState']['removedIds']['push'](_0x59643f);}}}}}for(const _0x4b5b49 of this['_touchedNodesState']['removedIds']){const _0x162412=Yi('data-id',_0x4b5b49,_0x48f56b);_0x162412&&(this['_rescueUnwrappedElements'](_0x162412),this['_removeNode'](_0x162412,_0x4b5b49,_0x3fab10));}if($i('data-id','new-element',_0x48f56b)['forEach'](_0x1d3b55=>{const _0x3dcd97=this['_getUid'](_0x1d3b55);zi(_0x1d3b55,'data-id',_0x3dcd97),this['_touchedNodesState']['newIds']['push'](_0x3dcd97);}),this['_removeSpecialComments'](_0x48f56b),_0x3fab10&&_0x3fab10['cutAfterUnstable']){const _0x44001b=this['_findLastConfirmationPoint'](_0x488014),_0x205316=this['_getLastStableElement'](_0x48f56b,_0x44001b);this['_markUnstableElements'](_0x48f56b,_0x205316);}if(this['_processWrappedElements'](_0x48f56b,_0x3fab10),_0x3fab10&&_0x3fab10['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x6bddc1=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x48f56b);let _0x4a1bfa=_0x6bddc1[_0x6bddc1['length']-0x1];for(;_0x4a1bfa;)es(_0x4a1bfa),_0x4a1bfa=_0x4a1bfa['parentNode'];}return{'parsedContent':_0x48f56b,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x45272c,_0x25bd45,_0x5bb2a9){for(const _0x5c2096 of _0x25bd45){const _0x13a73e=this['_getUid'](_0x5c2096);zi(_0x5c2096,'data-id',_0x13a73e),this['_touchedNodesState']['newIds']['push'](_0x13a73e),this['_touchedNodesState']['lastTouchedId']=_0x13a73e;}const _0x4da084='afterbegin'===_0x5bb2a9||'afterend'===_0x5bb2a9?_0x25bd45['reverse']():_0x25bd45;for(const _0x43fd3f of _0x4da084)ji(_0x45272c,_0x43fd3f,_0x5bb2a9);}['_replaceNode'](_0x45be81,_0x5ed2bb){if(!_0x45be81)return;if(_0x3d3646=_0x5ed2bb,Zi(Ki(_0x45be81))===Zi(Ki(_0x3d3646)))return;var _0x3d3646;const _0x775910=Xi(_0x45be81,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x775910),this['_touchedNodesState']['lastTouchedId']=_0x775910,_0x1eb418(_0x45be81,_0x5ed2bb['cloneNode'](!0x0));}['_removeNode'](_0x24d76b,_0x20de8c,_0xd74822){if(_0xd74822&&_0xd74822['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x20de8c;const _0x7aec87=_0xd74822['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x7aec87,'data-id',_0x20de8c),zi(_0x7aec87,'data-removed','true'),_0x1eb418(_0x24d76b,_0x7aec87);}else _0x2f3801(_0x24d76b);}['_findReferenceNode'](_0x5cda5b,_0x5d4885,_0x83b2d4){const _0x570c6a=this['_findPrevElementWithDataId'](_0x5cda5b,!0x1);if(_0x570c6a){const _0x49946d=ns(_0x570c6a),_0x4227c7=Yi('data-id',_0x49946d,_0x83b2d4);if(_0x4227c7)return[_0x4227c7,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x49946d);}const _0x35159c=this['_findNextElementWithDataId'](_0x5cda5b,!0x1);if(_0x35159c){const _0xfb6c19=ns(_0x35159c),_0x1c61ad=Yi('data-id',_0xfb6c19,_0x83b2d4);if(_0x1c61ad)return[_0x1c61ad,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0xfb6c19);}return _0x5d4885?_0x5cda5b['nextSibling']?this['_findFallbackReferenceNode'](_0x5cda5b,_0x83b2d4):[_0x83b2d4['childNodes'][_0x83b2d4['childNodes']['length']-0x1],'afterend']:[_0x83b2d4['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x2b8968,_0x1a5597){const _0x329af6=[],_0x1e27fb=this['_findPrevElementWithDataId'](_0x2b8968,!0x0);if(_0x1e27fb){const _0xec964=Yi('data-id',ns(_0x1e27fb),_0x1a5597);_0xec964&&_0x329af6['push']([_0xec964,'afterend']);}const _0x223da3=this['_findNextElementWithDataId'](_0x2b8968,!0x0);if(_0x223da3){const _0x3c7331=Yi('data-id',ns(_0x223da3),_0x1a5597);_0x3c7331&&_0x329af6['push']([_0x3c7331,'beforebegin']);}if(_0x329af6['length']>0x1)return ts(_0x329af6[0x0][0x0])<=ts(_0x329af6[0x1][0x0])?_0x329af6[0x0]:_0x329af6[0x1];return 0x1===_0x329af6['length']?_0x329af6[0x0]:[_0x1a5597['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x6371b3,_0x584fd4){let _0x42ab2b=_0x6371b3['nextSibling'],_0x3c2a6f=null,_0x3d3af6=!0x1;for(;_0x42ab2b;){if(_0x2a8c41(_0x42ab2b)){if(ss(_0x42ab2b)&&(_0x3c2a6f=_0x42ab2b),this['_isExistingContentComment'](_0x42ab2b)&&_0x584fd4&&!_0x3d3af6){_0x3d3af6=!0x0,_0x42ab2b=_0x42ab2b['nextSibling'];continue;}break;}const _0x2698b1=Xi(_0x42ab2b,'data-id');if(_0x2698b1&&'new-element'!==_0x2698b1&&this['_existingDataIds']['has'](_0x2698b1)){_0x3c2a6f=_0x42ab2b;break;}_0x42ab2b=_0x42ab2b['nextSibling'];}return _0x3c2a6f;}['_findPrevElementWithDataId'](_0x3b9204,_0x56cc7d){let _0x1eda40=_0x3b9204['previousSibling'],_0x32d379=null,_0x122f94=!0x1;for(;_0x1eda40;){if(_0x2a8c41(_0x1eda40)){if(ss(_0x1eda40)&&(_0x32d379=_0x1eda40),this['_isExistingContentComment'](_0x1eda40)&&_0x56cc7d&&!_0x122f94){_0x122f94=!0x0,_0x1eda40=_0x1eda40['previousSibling'];continue;}break;}const _0x437929=Xi(_0x1eda40,'data-id');if(_0x437929&&'new-element'!==_0x437929&&this['_existingDataIds']['has'](_0x437929)){_0x32d379=_0x1eda40;break;}_0x1eda40=_0x1eda40['previousSibling'];}return _0x32d379;}['_markWrappedElements'](_0x5dd56c){_0x1abf14(_0x5dd56c)&&$i('data-id',null,_0x5dd56c)['forEach'](_0x5d5fdf=>{this['_isExistingNode'](_0x5d5fdf)&&(zi(_0x5d5fdf,'data-wrapped-id',Xi(_0x5d5fdf,'data-id')),zi(_0x5d5fdf,'data-id',null));});}['_processWrappedElements'](_0x25e6ab,_0x1ab180){$i('data-wrapped-id',null,_0x25e6ab)['forEach'](_0x169625=>{const _0x3804d5=Xi(_0x169625,'data-wrapped-id');if(this['_hasUnstableParent'](_0x169625))return;const _0x5f203a=Yi('data-id',_0x3804d5,_0x25e6ab);zi(_0x169625,'data-id',_0x3804d5),_0x5f203a&&(this['_removeNode'](_0x5f203a,_0x3804d5,_0x1ab180),this['_touchedNodesState']['removedIds']['push'](_0x3804d5),this['_touchedNodesState']['lastTouchedId']=_0x3804d5);});}['_hasUnstableParent'](_0x245e3b){let _0x1d5bc2=_0x245e3b['parentNode'];for(;_0x1d5bc2;){if(Xi(_0x1d5bc2,'data-unstable'))return!0x0;_0x1d5bc2=_0x1d5bc2['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x8f5b47){const _0x3e6c47=new Set(this['_touchedNodesState']['removedIds']),_0x4bbe87=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x8f5b47)['forEach'](_0x5b1f6a=>{const _0x2dbea6=Xi(_0x5b1f6a,'data-id'),_0x5d404b=!!_0x2dbea6&&this['_referencedExistingIds']['has'](_0x2dbea6),_0x1fc8de=!!_0x2dbea6&&_0x4bbe87['has'](_0x2dbea6);if(!_0x2dbea6||!_0x5d404b&&!_0x1fc8de)return;if(_0x3e6c47['has'](_0x2dbea6))return;let _0x414397=_0x5b1f6a['parentNode'],_0x35205a=!0x1;for(;_0x414397;){if(_0x414397===_0x8f5b47){_0x35205a=!0x0;break;}const _0x50d30b=Xi(_0x414397,'data-id');if(_0x50d30b&&(this['_referencedExistingIds']['has'](_0x50d30b)||_0x4bbe87['has'](_0x50d30b)))return;_0x414397=_0x414397['parentNode'];}if(_0x35205a){if(_0x208787(_0x8f5b47,_0x5b1f6a),_0x5d404b){const _0x27435f=this['_generateUid'](),_0x1b8db4=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x2dbea6);-0x1!==_0x1b8db4&&this['_touchedNodesState']['modifiedIds']['splice'](_0x1b8db4,0x1),zi(_0x5b1f6a,'data-unwrapped-id',_0x2dbea6),zi(_0x5b1f6a,'data-id',_0x27435f),this['_touchedNodesState']['newIds']['push'](_0x27435f),this['_touchedNodesState']['rescuedNewIds']['add'](_0x27435f),this['_touchedNodesState']['lastTouchedId']=_0x27435f;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x2dbea6),this['_touchedNodesState']['lastTouchedId']=_0x2dbea6;}});}['_getUid'](_0x321f0f){return this['_isExistingNode'](_0x321f0f)?Xi(_0x321f0f,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x20a5aa){Qi(_0x20a5aa)['filter'](_0x18bebe=>ss(_0x18bebe)||this['_isExistingContentComment'](_0x18bebe))['forEach'](_0x2be08c=>{_0x2f3801(_0x2be08c);});}['_findLastConfirmationPoint'](_0x28a371){let _0x36bcd4=null,_0x498aca=null,_0x43260f=null,_0x16f252=null;const _0x4da951=_0x4cf7e2=>{_0x4cf7e2&&(_0x36bcd4=_0x4cf7e2),_0x43260f=null,_0x16f252=null;};for(let _0x2220a1=0x0;_0x2220a1<_0x28a371['length'];_0x2220a1++){const _0x28a700=_0x28a371[_0x2220a1];if(this['_isExistingContentComment'](_0x28a700)){_0x4da951(_0x498aca);continue;}if(_0x1abf14(_0x28a700)){const _0x13b8d5=Xi(_0x28a700,'data-id'),_0x329d72=_0x2220a1===_0x28a371['length']-0x1;if(_0x13b8d5&&'new-element'!==_0x13b8d5&&this['_touchedNodesState']['modifiedIds']['includes'](_0x13b8d5)&&!_0x329d72){_0x4da951(_0x13b8d5),_0x498aca=_0x13b8d5;continue;}}let _0x4c0f65=null;const _0x446bc2=ns(_0x28a700);if(_0x446bc2&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x446bc2))_0x498aca=_0x446bc2;else{if(_0x446bc2&&this['_touchedNodesState']['newIds']['includes'](_0x446bc2))_0x4c0f65='N';else{if(!ss(_0x28a700))continue;_0x4c0f65='R';}_0x4c0f65===_0x16f252||null===_0x16f252?_0x16f252=_0x4c0f65:null!==_0x43260f?(_0x4da951(_0x498aca),_0x16f252=_0x4c0f65):(_0x43260f=_0x16f252,_0x16f252=_0x4c0f65),_0x498aca=_0x446bc2;}}const _0xf58111=_0x28a371[_0x28a371['length']-0x1];return _0xf58111&&!_0x1abf14(_0xf58111)&&!ss(_0xf58111)&&_0x498aca&&_0x4da951(_0x498aca),_0x36bcd4;}['_getLastStableElement'](_0x5e9192,_0x311c1f){if(!_0x311c1f)return null;const _0x355618=Yi('data-id',_0x311c1f,_0x5e9192);if(!_0x355618)return null;const _0x18f54f=[_0x355618,...Ji(_0x355618)]['at'](-0x2);if(_0x18f54f===_0x355618)return _0x355618;let _0x594905=_0x18f54f['previousSibling'];for(;_0x594905&&!_0x1abf14(_0x594905);)_0x594905=_0x594905['previousSibling'];return _0x594905;}['_markUnstableElements'](_0x89687b,_0x25326f){const _0x521593=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x11d805=_0x25326f?_0x25326f['nextSibling']:_0x89687b['firstChild'];for(;_0x11d805;){_0x1abf14(_0x11d805)&&((_0x521593['has'](Xi(_0x11d805,'data-id'))||$i('data-id',null,_0x11d805)['some'](_0x53ab92=>_0x521593['has'](Xi(_0x53ab92,'data-id'))))&&zi(_0x11d805,'data-unstable','true')),_0x11d805=_0x11d805['nextSibling'];}}['_isNewNode'](_0x8c7537){return Boolean('new-element'===Xi(_0x8c7537,'data-id'));}['_isExistingNode'](_0x46969c){return Boolean((Xi(_0x46969c,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0x46969c,'data-id'));}['_isExistingContentComment'](_0x73969e){return Boolean(_0x2a8c41(_0x73969e)&&Ki(_0x73969e)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function ss(_0x20b138){return!!_0x20b138&&Boolean(_0x2a8c41(_0x20b138)&&Ki(_0x20b138)['match'](/removed[\s*-]data-id="[^"]+"/));}function ns(_0x62fb11){if(!_0x62fb11)return null;if(_0x1abf14(_0x62fb11))return Xi(_0x62fb11,'data-id')??null;if(_0x2a8c41(_0x62fb11)){const _0x221811=Ki(_0x62fb11)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x221811&&_0x221811[0x1])return _0x221811[0x1];}return null;}function rs(_0x1b1a60,_0x583df3){const _0x33cd49=new Map();for(const _0x534395 of qi(_0x1b1a60))_0x33cd49['set'](Xi(_0x534395,'data-id'),_0x534395);const _0x209f89=new Set();for(const _0x533c87 of qi(_0x583df3)){const _0x4845d2=Xi(_0x533c87,'data-id'),_0x44bab4=_0x4845d2?_0x33cd49['get'](_0x4845d2):void 0x0;_0x44bab4?(_0x1eb418(_0x533c87,_0x54175e(_0x44bab4,!0x0)),_0x209f89['add'](_0x4845d2)):_0x2f3801(_0x533c87);}for(const _0x588e9d of Qi(_0x583df3))ss(_0x588e9d)&&_0x33cd49['has'](ns(_0x588e9d))&&_0x2f3801(_0x588e9d);const _0x296084=new Set($i('data-id',null,_0x583df3)['map'](_0x1fa12c=>Xi(_0x1fa12c,'data-id')));for(const [_0x13f5fd,_0x434d35]of _0x33cd49){if(_0x209f89['has'](_0x13f5fd))continue;let _0x4eb9a8=_0x434d35['parent'],_0x1def78=null;for(;_0x4eb9a8&&_0x1abf14(_0x4eb9a8);){const _0x505d81=Xi(_0x4eb9a8,'data-id');if(_0x505d81&&_0x296084['has'](_0x505d81)){_0x1def78=_0x505d81;break;}_0x4eb9a8=_0x4eb9a8['parent'];}if(!_0x1def78)continue;const _0x47df96=Yi('data-id',_0x1def78,_0x583df3);_0x47df96&&_0x27e222(_0x47df96,_0x54175e(_0x434d35,!0x0));}}function os({changeGroups:_0x590278,documentContextContent:_0xc6acb5,showDiff:_0x516a52,trimUnchanged:_0x33cd33=!0x0}){return _0x590278['map'](_0x4ab8b6=>{if('destroyed'===_0x4ab8b6['editor']['state'])return null;const _0xc16ee4=new _0xe22c67([]),_0x5b7d1c=new _0xe22c67([]),_0x2ebd86=new Set();for(const _0x25d503 of _0x4ab8b6['changes'])'new'==_0x25d503['type']&&$i('data-id',null,_0x25d503['node'])['forEach'](_0x47d985=>{_0x2ebd86['add'](Xi(_0x47d985,'data-id'));});for(const _0x1a3253 of _0x4ab8b6['changes'])if('removed'!=_0x1a3253['type']?_0x5b7d1c['children']['push'](_0x1a3253['node']['cloneNode'](!0x0)):_0x516a52||_0x2ebd86['has'](_0x1a3253['id'])||_0x5b7d1c['children']['push'](_0x1a3253['node']['cloneNode'](!0x0)),'new'!=_0x1a3253['type']&&(_0x516a52||'removed'!=_0x1a3253['type'])){const _0x8acd5a=_0x4fe1af(_0x1040b0=>Xi(_0x1040b0,'data-id')==_0x1a3253['id'],_0xc6acb5['get'](_0x4ab8b6['documentId']),!0x0);_0x8acd5a&&_0xc16ee4['children']['push'](_0x8acd5a['cloneNode'](!0x0));}const {content:_0x44dc42,hasChanges:_0x3840d4}=as(_0x4ab8b6['editor'],_0xc16ee4,_0x5b7d1c,_0x516a52,_0x33cd33);return{'type':_0x4ab8b6['changes'][0x0]['type'],'index':_0x4ab8b6['index'],'content':_0x44dc42,'hasChanges':_0x3840d4};})['filter'](_0x29c0c0=>null!==_0x29c0c0);}function as(_0x57377c,_0x5cc3a4,_0x27b2d1,_0x71a8d3,_0x5ece5f=!0x0){const _0x187394=_0x57377c['plugins']['get']('DocumentCompare'),_0x42a934=Ki(_0x5cc3a4),_0x5489de=Ki(_0x27b2d1),_0x392ee6=_0x57377c['data']['parse'](_0x42a934,'$root'),_0x28f7f1=_0x57377c['model']['createPositionAt'](_0x392ee6,0x0),_0x2a339b=_0x187394['getDiff'](_0x42a934,_0x5489de,{'anchor':_0x28f7f1,'markDeletions':_0x71a8d3,'targetEditor':_0x57377c})['getOperations']();if(0x0==_0x2a339b['length'])return{'content':_0x5cc3a4['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x71a8d3?function(_0x2851eb,_0x5199ba,_0x166ea5){if(0x0==_0x2851eb['length'])return;const _0x5c448d=_0x166ea5['plugins']['get']('DocumentCompare'),_0x1b5095=_0x166ea5['plugins']['get']('SuggestionsConversion');_0x166ea5['model']['change'](_0x399e0f=>{const _0x4bd8c3=new Set();for(let _0x5823d9=0x0;_0x5823d9<_0x2851eb['length'];_0x5823d9++){const _0x468523=_0x2851eb[_0x5823d9];if(_0x468523['baseVersion']=null,_0x468523['isDocumentOperation']=!0x1,_0x5c448d['isMarkedRemoveOperation'](_0x468523)){const _0x46e1c6=_0xfda04b(_0x468523['newRange'],_0x166ea5['model']),_0x3770fb='suggestion:deletion:'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x3770fb,_0x46e1c6);}else switch(_0x468523['type']){case'rename':{if(_0x468523['oldName']==_0x468523['newName'])break;_0x399e0f['batch']['addOperation'](_0x468523),_0x166ea5['model']['applyOperation'](_0x468523);const _0x49ad0e='$elementName',_0x2cb861=_0x468523['position'],_0x2e030b=_0x166ea5['model']['createRange'](_0x2cb861,_0x166ea5['model']['createPositionAt'](_0x2cb861['nodeAfter'],'end')),_0x530c92='suggestion:attribute:'+_0x49ad0e+':'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x530c92,_0x2e030b);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x468523['oldValue']==_0x468523['newValue'])break;_0x399e0f['batch']['addOperation'](_0x468523),_0x166ea5['model']['applyOperation'](_0x468523);const _0x1c0e92=_0x468523['key'];if(!_0x1b5095['isRegisteredAttribute'](_0x1c0e92))break;const _0x573c33=_0xfda04b(_0x468523['range'],_0x166ea5['model']),_0x23380b='suggestion:attribute:'+_0x1c0e92+':'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x23380b,_0x573c33);break;}case'insert':{_0x399e0f['batch']['addOperation'](_0x468523),_0x166ea5['model']['applyOperation'](_0x468523);if(_0x2851eb[_0x5823d9+0x1]&&'move'==_0x2851eb[_0x5823d9+0x1]['type']){hs(_0x5199ba,_0x468523);break;}const _0x1e072a=_0x468523['position'],_0x518535=_0x468523['howMany'],_0x5e3230=_0xfda04b(_0x166ea5['model']['createRange'](_0x1e072a,_0x1e072a['getShiftedBy'](_0x518535)),_0x166ea5['model']),_0x2bbc9a='suggestion:insertion:'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x2bbc9a,_0x5e3230);break;}case'split':{_0x399e0f['batch']['addOperation'](_0x468523),_0x166ea5['model']['applyOperation'](_0x468523);const _0xff1c4a=_0x468523['splitPosition'],_0x539329=_0x468523['moveTargetPosition'],_0x3ba220=_0x166ea5['model']['createRange'](_0xff1c4a,_0x539329),_0x1940a6='suggestion:insertion:'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x1940a6,_0x3ba220);break;}case'move':{_0x399e0f['batch']['addOperation'](_0x468523),_0x166ea5['model']['applyOperation'](_0x468523),_0x2851eb[_0x5823d9-0x1]&&'insert'==_0x2851eb[_0x5823d9-0x1]['type']&&hs(_0x5199ba,_0x468523);const _0x2ecbed=_0x468523['getMovedRangeStart'](),_0x18a559=_0x468523['howMany'];for(let _0x469a90=0x0;_0x469a90<_0x18a559;_0x469a90++){const _0x388496=_0x2ecbed['getShiftedBy'](_0x469a90)['nodeAfter'];_0x4bd8c3['add'](_0x388496);}break;}case'remove':{const _0x2e3e00=_0x468523['sourcePosition'],_0x553b7b=_0x468523['howMany'],_0x380040=new _0x365f09(_0x2e3e00,_0x553b7b);_0x399e0f['batch']['addOperation'](_0x380040),_0x166ea5['model']['applyOperation'](_0x380040);break;}}}for(const _0x4002d5 of _0x4bd8c3){const _0x51a6df=_0x166ea5['model']['createRangeOn'](_0x4002d5),_0x1fba2d='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x5199ba['markers']['set'](_0x1fba2d,_0xfda04b(_0x51a6df,_0x166ea5['model']));}});}(_0x2a339b,_0x392ee6,_0x57377c):_0x57377c['model']['change'](_0x3807d9=>{for(const _0x53dec2 of _0x2a339b)if('remove'==_0x53dec2['type']){const _0x4b2136=_0x53dec2['sourcePosition'],_0x3c9c44=_0x53dec2['howMany'],_0x2935e3=new _0x365f09(_0x4b2136,_0x3c9c44);_0x3807d9['batch']['addOperation'](_0x2935e3),_0x57377c['model']['applyOperation'](_0x2935e3);}else{if('marker'==_0x53dec2['type']){const _0x5387b8=_0x53dec2['name'],_0x1dde2f=_0x53dec2['newRange'];null!==_0x1dde2f?_0x392ee6['markers']['set'](_0x5387b8,_0x1dde2f):_0x392ee6['markers']['delete'](_0x5387b8);}else _0x53dec2['baseVersion']=null,_0x53dec2['isDocumentOperation']=!0x1,_0x3807d9['batch']['addOperation'](_0x53dec2),_0x57377c['model']['applyOperation'](_0x53dec2);}}),_0x5ece5f){const _0x48545b=cs(_0x57377c,_0x2a339b,_0x392ee6);us(_0x57377c['model'],_0x48545b),function(_0x32d866,_0x149546){const _0x25de3b=_0x149546['getFirstRange']()['start'];let _0x44a5c3=_0x149546['getFirstRange']()['end'];const _0x4c654b=_0x25de3b['root'];(_0x44a5c3['textNode']||_0x44a5c3['nodeAfter']&&_0x44a5c3['nodeAfter']['is']('$text'))&&(_0x26d25f(_0x44a5c3,'...'),_0x44a5c3=_0x44a5c3['getShiftedBy'](0x3)),(_0x25de3b['textNode']||_0x25de3b['nodeBefore']&&_0x25de3b['nodeBefore']['is']('$text'))&&(_0x26d25f(_0x25de3b,'...'),function(_0x1d28d3,_0x15dba4,_0x490153){for(let [_0x3b75b6,_0x3a054f]of _0x1d28d3['markers']){const _0xe044d=_0x3a054f['_getTransformedByInsertion'](_0x15dba4,_0x490153,!0x1);_0x3a054f=_0xe044d[0x0],_0x1d28d3['markers']['set'](_0x3b75b6,_0x3a054f);}}(_0x4c654b,_0x25de3b,0x3),_0x25de3b['parent']==_0x44a5c3['parent']&&(_0x44a5c3=_0x44a5c3['getShiftedBy'](0x3)));const _0x4aa73e=_0x32d866['createRange'](_0x32d866['createPositionAt'](_0x4c654b,0x0),_0x25de3b),_0x1b6026=_0x32d866['createRange'](_0x44a5c3,_0x32d866['createPositionAt'](_0x4c654b,'end')),_0x204d93=[..._0x4aa73e['getMinimalFlatRanges'](),..._0x1b6026['getMinimalFlatRanges']()];_0x204d93['reverse']();for(const _0x3d2d50 of _0x204d93)_0x2156fc(_0x3d2d50),_s(_0x4c654b,_0x3d2d50);}(_0x57377c['model'],_0x48545b);}return{'content':Wi(_0x57377c['data']['stringify'](_0x392ee6,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function hs(_0x4793fe,_0x58e108){for(const [_0x1b54f8,_0x201bb3]of _0x4793fe['markers']){const _0x53403e=_0x5ca7e7['_createFromRanges'](_0x201bb3['getTransformedByOperation'](_0x58e108));_0x4793fe['markers']['set'](_0x1b54f8,_0x53403e);}}function cs(_0x3f07d9,_0x14651c,_0x16de02){const _0x1e917e=_0x3f07d9['plugins']['get']('DocumentCompare');let _0xed72f=_0x3f07d9['model']['createPositionAt'](_0x16de02,Number['POSITIVE_INFINITY']),_0x13bba4=_0x3f07d9['model']['createPositionAt'](_0x16de02,0x0);for(const _0x5dbce7 of _0x14651c){let _0x3f4af4,_0x1702bc;if(_0x1e917e['isMarkedRemoveOperation'](_0x5dbce7))_0x3f4af4=_0x5dbce7['newRange']['start'],_0x1702bc=_0x5dbce7['newRange']['end'];else switch(_0xed72f=ls(_0xed72f,_0x5dbce7),_0x13bba4=ls(_0x13bba4,_0x5dbce7),_0x5dbce7['type']){case'rename':_0x3f4af4=_0x5dbce7['position'],_0x1702bc=_0x3f4af4['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x3f4af4=_0x5dbce7['range']['start'],_0x1702bc=_0x5dbce7['range']['end'];break;case'insert':_0x3f4af4=_0x5dbce7['position'],_0x1702bc=_0x3f4af4['getShiftedBy'](_0x5dbce7['howMany']);break;case'split':_0x3f4af4=_0x5dbce7['splitPosition'],_0x1702bc=_0x5dbce7['moveTargetPosition'];break;case'merge':{const _0xb8415=_0x5dbce7['targetPosition']['path']['slice'](0x0,-0x1);_0x3f4af4=_0x3f07d9['model']['createPositionFromPath'](_0x16de02,_0xb8415),_0x1702bc=_0x3f4af4['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x5c14a2=_0x5dbce7['howMany'],_0x2cd81a=_0x5dbce7['sourcePosition']['_getTransformedByInsertion'](_0x5dbce7['targetPosition'],_0x5c14a2),_0x1a84ce=_0x5dbce7['getMovedRangeStart']();'remove'==_0x5dbce7['type']?(_0x3f4af4=_0x2cd81a,_0x1702bc=_0x2cd81a):(_0x3f4af4=_0x1a84ce,_0x1702bc=_0x1a84ce['getShiftedBy'](_0x5c14a2));break;}}_0x3f4af4&&_0x3f4af4['isBefore'](_0xed72f)&&(_0xed72f=_0x3f4af4['clone'](),_0xed72f['stickiness']='toNone'),_0x1702bc&&_0x1702bc['isAfter'](_0x13bba4)&&(_0x13bba4=_0x1702bc['clone'](),_0x13bba4['stickiness']='toNone');}return _0x3f07d9['model']['createSelection'](_0x3f07d9['model']['createRange'](_0xed72f,_0x13bba4));}function ls(_0x716cb0,_0x57f2c){return'move'!=_0x57f2c['type']&&'remove'!=_0x57f2c['type']||_0x57f2c['sourceRange']['containsPosition'](_0x716cb0)&&((_0x716cb0=_0x57f2c['sourcePosition']['clone']())['stickiness']='toNone'),_0x716cb0['getTransformedByOperation'](_0x57f2c);}function us(_0x1aceef,_0x2f096c){ds(_0x1aceef,_0x2f096c,'forward');const _0x5643b6=_0x2f096c['getFirstRange']();_0x2f096c['setTo']([]),_0x2f096c['setTo'](_0x5643b6,{'backward':!0x0}),ds(_0x1aceef,_0x2f096c,'backward');}function ds(_0x4400b1,_0x225e10,_0x569274){let _0x203629=0x14;for(;_0x203629;){_0x4400b1['modifySelection'](_0x225e10,{'unit':'word','direction':_0x569274}),_0x203629--;const _0x13ccc6=_0x225e10['focus']['forward'==_0x569274?'nodeBefore':'nodeAfter'];if(_0x13ccc6&&_0x13ccc6['is']('element')&&_0x4400b1['schema']['isBlock'](_0x13ccc6)&&_0x4400b1['schema']['isObject'](_0x13ccc6))break;}}function _s(_0x4a9b72,_0x41f32d){for(const [_0x422461,_0x2f710f]of _0x4a9b72['markers']){const _0x248668=_0x2f710f['_getTransformedByDeletion'](_0x41f32d['start'],_0x41f32d['end']['offset']-_0x41f32d['start']['offset']);null!=_0x248668?_0x4a9b72['markers']['set'](_0x422461,_0x248668):_0x4a9b72['markers']['delete'](_0x422461);}}class AIReply extends ct(){['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:_0x108318,isDone:_0xe6ba7a=!0x1,isComplete:_0x4ff355,interactionId:_0x489a4d,areActionsDisabled:_0x927ab6,isFromHistory:_0x1dd190=!0x1,documentContextContent:_0x1cf87f,locale:_0x25555a,id:_0x2c3225,channelsToEditors:_0x3f8e36}){super(),this['id']=_0x2c3225||at(),this['interactionId']=_0x489a4d,this['type']=_0x108318,this['areActionsDisabled']=!!_0x927ab6,this['isFromHistory']=_0x1dd190,this['locale']=_0x25555a,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x1cf87f?.['map'](_0x1878e7=>[_0x1878e7['id'],Wi(_0x1878e7['content'])])||[]),this['_documentIdToSource']=new Map(_0x1cf87f?.['map'](_0x3f39aa=>[_0x3f39aa['id'],{'editor':_0x3f8e36['get'](_0x3f39aa['channelId']),'rootName':_0x3f39aa['rootName']}])||[]),this['set']('isDone',_0xe6ba7a),this['set']('isComplete',_0x4ff355??_0xe6ba7a),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x3bc947,_0x10d039){const _0x3ee0c2='text'===this['type']?'text':_0x10d039;this['content']['has'](_0x3ee0c2)||this['content']['set'](_0x3ee0c2,''),this['content']['set'](_0x3ee0c2,this['content']['get'](_0x3ee0c2)+_0x3bc947),this['onContentChange'](_0x3ee0c2);}['done'](_0x286872=!0x0){this['isComplete']=_0x286872,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x4a90b7,_0x59af25){this['changeGroups'][_0x4a90b7]['state']=_0x59af25,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x4a90b7,'state':_0x59af25});}['getContentParts']({showDiff:_0x49f245,groupIndex:_0x3372bc}){const _0x1cc5c2=this['_getCachedContentParts'](_0x49f245,_0x3372bc);if(_0x1cc5c2)return _0x1cc5c2;let _0x3d464c=[];if(void 0x0===_0x3372bc)_0x3d464c=this['changeGroups'];else{const _0x389643=this['changeGroups']['find'](({index:_0x3b2348})=>_0x3b2348===_0x3372bc);if(!_0x389643)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x3372bc});_0x3d464c=[_0x389643];}const _0x1ce676=os({'showDiff':_0x49f245,'changeGroups':_0x3d464c,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x49f245,_0x1ce676),_0x1ce676;}['_getCachedContentParts'](_0x5e868e,_0x4527a9){const _0x3af277=_0x5e868e?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x3af277]['length'])return null;const _0x2f88cd=this['cachedSuggestionContentParts'][_0x3af277];if(void 0x0===_0x4527a9)return _0x2f88cd['length']>0x0&&_0x2f88cd['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x5e868e,null),null):_0x5c7ed6(_0x2f88cd);{const _0x50eda9=_0x2f88cd['find'](({index:_0x32b28b})=>_0x32b28b===_0x4527a9);if(_0x50eda9)return[_0x5c7ed6(_0x50eda9)];}return null;}['_setCachedContentParts'](_0x269f90,_0x2eb255){const _0x202d8a=_0x269f90?'withDiff':'withoutDiff';_0x2eb255?_0x2eb255['forEach'](_0x4bbf11=>{const _0x34dab0=this['cachedSuggestionContentParts'][_0x202d8a],_0xa2c0e2=_0x34dab0['find'](({index:_0x366208})=>_0x366208===_0x4bbf11['index']);if(_0xa2c0e2){const _0xf299f2=_0x34dab0['indexOf'](_0xa2c0e2);_0x34dab0['splice'](_0xf299f2,0x1,_0x4bbf11);}else _0x34dab0['push'](_0x4bbf11);}):this['cachedSuggestionContentParts'][_0x202d8a]['length']=0x0;}['onContentChange'](_0x2f69ce){if('modification'===this['type']){if(_0x2f69ce)this['parsedContent']['set'](_0x2f69ce,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x2f69ce)));else{for(const [_0x557c86,_0x3b7ee8]of this['content'])this['parsedContent']['set'](_0x557c86,this['aiResponseParser']['parseAndNormalizeHTML'](_0x3b7ee8));}const _0x48cb04=this['changeGroups'];for(const _0x22956f of this['content']['keys']())this['updateChangeGroups'](_0x22956f);const _0xce1890=this['_getDifferentChangeGroups'](_0x48cb04,this['changeGroups']);(_0xce1890['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0xce1890),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'](_0x184209,_0x2d6bca){const _0x5cdb70=[];for(const _0x21800e of _0x2d6bca){const _0x167ae7=_0x184209[_0x21800e['index']];_0x167ae7?_0x167ae7['changes']['length']!==_0x21800e['changes']['length']?_0x5cdb70['push'](_0x21800e):_0x167ae7['changes']['forEach']((_0xe36f27,_0x5671c5)=>{const _0x33d24b=_0x21800e['changes'][_0x5671c5];_0xe36f27['id']!==_0x33d24b['id']&&_0x5cdb70['push'](_0x21800e);}):_0x5cdb70['push'](_0x21800e);}return _0x5cdb70;}['updateChangeGroups'](_0x9808e9){const _0x2a400c=this['documentContextContent']['get'](_0x9808e9),_0x4f455c=this['parsedContent']['get'](_0x9808e9);if(!_0x2a400c||!_0x4f455c)return;const _0x1a9ad3=new _0x5bc3c5('p',{},[new _0x5bc3c5('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x5f1cc8(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x14a63a=this['aiResponseApplier']['merge'](_0x4f455c,_0x2a400c['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x1a9ad3});this['parsedMergedContent']['set'](_0x9808e9,_0x14a63a['parsedContent']);let _0x607f2d=[];if(_0x1621e3(_0x1d3c29=>{const _0x36385d=Xi(_0x1d3c29,'data-id');if(!_0x36385d||!_0x5b3555(_0x36385d))return!0x1;const _0x5ecddd=[_0x1d3c29,...Ji(_0x1d3c29)]['at'](-0x2);if(_0x1d3c29!=_0x5ecddd){const _0x5b9965=Xi(_0x5ecddd,'data-id');_0x5b3555(_0x5b9965)||(_0x607f2d['push']({'node':_0x5ecddd,'id':_0x5b9965,'type':'modified'}),_0x14a63a['modifiedNodeIds']['push'](_0x5b9965));}else _0x14a63a['modifiedNodeIds']['includes'](_0x36385d)?_0x607f2d['push']({'node':_0x1d3c29,'type':'modified','id':_0x36385d}):_0x14a63a['newNodeIds']['includes'](_0x36385d)?_0x607f2d['push']({'node':_0x1d3c29,'type':'new','id':_0x36385d,'anchorId':Xi(_0x1d3c29['previousSibling'],'data-id')}):_0x607f2d['push']({'node':_0x1d3c29,'type':'removed','id':_0x36385d});return!0x0;},this['parsedMergedContent']['get'](_0x9808e9)),_0x607f2d=_0x607f2d['filter'](({node:_0xc5a8bd})=>[...Ji(_0xc5a8bd),_0xc5a8bd]['every'](_0x93fea4=>!Xi(_0x93fea4,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x252da3=>_0x252da3['documentId']!==_0x9808e9),0x0==_0x607f2d['length'])return;const _0x35052b=[[_0x607f2d[0x0]]];for(let _0x50601a=0x1;_0x50601a<_0x607f2d['length'];_0x50601a++){const _0x2ee7a1=_0x35052b[_0x35052b['length']-0x1],_0x9c421e=_0x2ee7a1[_0x2ee7a1['length']-0x1];_0x607f2d[_0x50601a]['node']['previousSibling']==_0x9c421e['node']&&'modified'!=_0x607f2d[_0x50601a]['type']&&'modified'!=_0x9c421e['type']?_0x2ee7a1['push'](_0x607f2d[_0x50601a]):_0x35052b['push']([_0x607f2d[_0x50601a]]);}for(const _0xc0bf9 of _0x35052b){const _0x406fc7=_0xc0bf9[0x0],_0x3e405a=_0xc0bf9[_0xc0bf9['length']-0x1],_0x2b6a67=_0x1bdcdc(_0x406fc7['node']['previousSibling']);_0x2b6a67&&_0xc0bf9['unshift'](_0x2b6a67);const _0x255de0=_0x1bdcdc(_0x3e405a['node']['nextSibling']);_0x255de0&&_0xc0bf9['push'](_0x255de0);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x9808e9))['forEach'](_0x28a07a=>{zi(_0x28a07a,'data-wrapped-id',null);});const _0xce929c=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x9808e9))['forEach'](_0x185478=>{const _0x379531=Xi(_0x185478,'data-unwrapped-id'),_0x4b818a=Xi(_0x185478,'data-id');_0xce929c['set'](_0x4b818a,_0x379531),zi(_0x185478,'data-id',_0x379531),zi(_0x185478,'data-unwrapped-id',null);});for(const _0x95a236 of _0x607f2d){const _0x1667b9=_0xce929c['get'](_0x95a236['id']);_0x1667b9&&(_0x95a236['id']=_0x1667b9);}this['changeGroups']['push'](..._0x35052b['map']((_0x248dc7,_0x40ac9b)=>({'changes':_0x248dc7,'state':'pending','index':_0x40ac9b,'editor':this['_documentIdToSource']['get'](_0x9808e9)['editor'],'rootName':this['_documentIdToSource']['get'](_0x9808e9)['rootName'],'documentId':_0x9808e9})));const _0x3b561b=Array['from'](this['documentContextContent']['keys']());function _0x5b3555(_0x40c567){return _0x14a63a['modifiedNodeIds']['includes'](_0x40c567)||_0x14a63a['newNodeIds']['includes'](_0x40c567)||_0x14a63a['removedNodeIds']['includes'](_0x40c567);}function _0x1bdcdc(_0x5ca1aa){if(_0x5ca1aa&&Xi(_0x5ca1aa,'data-id')&&!Xi(_0x5ca1aa,'data-unstable')){const _0x488bde=Xi(_0x5ca1aa,'data-id');if(!_0x5b3555(_0x488bde))return{'node':_0x5ca1aa,'type':'context','id':_0x488bde};}return null;}this['changeGroups']['sort']((_0x52db4e,_0x36c91a)=>_0x3b561b['indexOf'](_0x52db4e['documentId'])-_0x3b561b['indexOf'](_0x36c91a['documentId'])),this['changeGroups']['forEach']((_0x3342ee,_0x360634)=>{_0x3342ee['index']=_0x360634;});}}const Is=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x5ddbe6,locale:_0x413803,channelsToEditors:_0x1499de}){super(),this['id']=at(),this['connector']=_0x5ddbe6,this['isStopped']=!0x0,this['locale']=_0x413803,this['_channelsToEditors']=_0x1499de||new Map();}async['start'](){await this['_run']();}async['resume'](_0x2d8d63){await this['_run'](_0x2d8d63);}async['_run'](_0x35d50e){const _0x40c4cf=[];let _0x3aab58,_0x1afb5f,_0x5c385e,_0xe05d24=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x35d50e||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0xc62f6=await this['currentRequest']['getStream']();for await(const _0x669599 of _0xc62f6){if(this['isStopped'])return;if('error'==_0x669599['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x669599['event']){case'message-metadata':this['messageId']=_0x669599['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x669599['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x669599['data']['conversationTitle'],!0x0);break;case'source':_0x40c4cf['push'](_0x669599['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'](),_0x3aab58='modification-delta'==_0x669599['event']?'modification':'text',_0x1afb5f='modification-delta'==_0x669599['event']?_0x669599['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x3aab58&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x3aab58,'interactionId':this['id'],'id':_0x1afb5f,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x669599['event']&&{'documentId':_0x669599['data']['documentId']}}),'modification'==_0x3aab58&&(this['currentReply']['sources']=_0x40c4cf['splice'](0x0))),this['currentReply']['appendContent'](_0x669599['data']['textDelta'],_0x669599['data']['documentId']);break;case'mcp-tool-result':_0x5c385e=JSON['parse'](_0x669599['data']['result']),this['_handleToolResultData']({'toolName':_0x669599['data']['toolName'],'data':_0x5c385e['data'],'attributes':_0x5c385e['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x669599['data']['toolName'],'data':_0x669599['data']['data']});}}_0xe05d24=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x40c4cf['length']>0x0&&(this['currentReply']['sources']=_0x40c4cf['splice'](0x0)),this['_finalizeInteraction'](_0xe05d24),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x474c4a){return this['replies']['find'](_0x36c3eb=>_0x36c3eb['id']===_0x474c4a);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x36c105=>_0x36c105['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x974290){const _0x22c6bf=this['getDocumentContext'](),_0x23f850=new AIReply({'locale':this['locale'],'documentContextContent':_0x22c6bf?.['documents'],..._0x974290});return this['replies']['push'](_0x23f850),_0x23f850['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x23f850),_0x23f850;}['setConversationTitle'](_0x35b38d,_0x50c6d8=!0x1){this['fire']('setConversationTitle',_0x35b38d,_0x50c6d8);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0xa43990){this['fire']('toolDataReceived',{'type':'result','toolName':_0xa43990['toolName'],'data':structuredClone(_0xa43990['data']||{}),'attributes':structuredClone(_0xa43990['attributes']||{})},this);}['_handleToolNotificationData'](_0x2f4b91){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x2f4b91['toolName'],'data':structuredClone(_0x2f4b91['data'])},this);}['_finalizeInteraction'](_0xfea75c=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0xfea75c),this['currentRequest']=this['currentReply']=void 0x0;}}const As=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']]),gs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x23e8fc,config:_0x4837bb,ownerId:_0x192b83}){super(),this['_connector']=_0x23e8fc,this['_config']=_0x4837bb,this['_ownerId']=_0x192b83;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x5b5305){const _0x81aace=await this['_createContextItemFromContent'](_0x5b5305);return this['_addToConversationContextItem'](_0x81aace),'current-document'===_0x81aace['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x81aace;}async['populateDocumentsFromMessage'](_0x2469ad,_0x39ddc7){const _0x2378a8=_0x2469ad['filter'](_0x1abe6a=>'document'===_0x1abe6a['type']);if(0x0===_0x2378a8['length'])return{'hasUnmatched':!0x1};const _0x45b81b=_0x2378a8['map'](_0x5d9d1f=>_0x5d9d1f['id']),_0x13fce2=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x45b81b)['getDocuments'](),_0x4c2ab4=new Map(_0x13fce2['map'](_0x506b4f=>[_0x506b4f['id'],_0x506b4f])),_0x405589=[];let _0x219b65=!0x1;for(const _0x29dd64 of _0x2378a8){const _0x2004d4=_0x4c2ab4['get'](_0x29dd64['id']);_0x2004d4&&(this['_matchDocumentToRoot'](_0x2004d4,_0x39ddc7)||(_0x219b65=!0x0),_0x405589['push']({'id':_0x2004d4['id'],'content':_0x2004d4['content'],'version':_0x2004d4['attributes']?.['version']??0x0,'sessionId':_0x2004d4['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x2004d4['attributes']?.['channelId']??_0x39ddc7[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x2004d4['attributes']?.['rootName']??_0x39ddc7[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x33f909={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x405589};return this['_addToConversationContextItem'](_0x33f909),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x33f909,'hasUnmatched':_0x219b65};}['_matchDocumentToRoot'](_0x1812df,_0x2e0a2b){const _0x8a112c=_0x1812df['attributes']?.['channelId'],_0x474840=_0x1812df['attributes']?.['rootName'];if(_0x8a112c&&_0x474840){for(const _0x2b10bb of _0x2e0a2b)if(_0x2b10bb['config']['get']('collaboration.channelId')===_0x8a112c){for(const _0x2618c1 of _0x2b10bb['model']['document']['getRoots']())if('$graveyard'!==_0x2618c1['rootName']&&_0x2618c1['rootName']===_0x474840)return{'editor':_0x2b10bb,'rootName':_0x2618c1['rootName']};}}}async['_createContextItemFromContent'](_0x66b9d2){if('document'===_0x66b9d2['type']){const _0x531d92=await this['_connector']['fetchDocument'](this['_ownerId'],_0x66b9d2['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x66b9d2['type'],'content':_0x531d92['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x531d92['attributes']?.['version'],'sessionId':_0x531d92['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x66b9d2['type'])return{'id':_0x66b9d2['id'],'uiId':_0x66b9d2['id'],'label':_0x66b9d2['data']?.['label']||_0x66b9d2['id'],'type':'mcp-tool-context','mcpServerName':_0x66b9d2['mcpServerName'],'toolName':_0x66b9d2['toolName'],'data':_0x66b9d2['data']||{}};return{'id':_0x66b9d2['id'],'uiId':_0x66b9d2['id'],'label':_0x66b9d2['attributes']?.['label']||_0x66b9d2['name']||_0x66b9d2['url']||_0x66b9d2['id'],'type':_0x66b9d2['type'],..._0x66b9d2?.['attributes']?.['resourceId']?{'resourceId':_0x66b9d2['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x53d359){const _0x235350=this['_pendingContextItems']['get'](_0x53d359);_0x235350?.['isReadOnly']||this['_removeContextItem'](_0x53d359);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x24c4a6 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x24c4a6['uiId']);const _0x11db2f=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x11db2f&&this['_addContextItem']({..._0x11db2f,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x5e9597){for(const _0x26fdff of _0x5e9597['values']())this['_addToConversationContextItem'](_0x26fdff);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'](_0x1e832b){return Array['from'](_0x1e832b['values']())['flatMap'](_0x3e977d=>this['_mapContextItemToRequestData'](_0x3e977d));}async['addFilesToContext'](_0x1a1244,_0x484419,_0x21d646='file'){const _0x22b288='files-'+at();this['_startUploadOperation'](_0x22b288);try{await Promise['all'](_0x1a1244['map'](async _0x5e13d1=>{const _0x1c12b9='file-'+at(),_0x527626=_0x7f6d0a(_0x5e13d1['name']),_0x352146='file'===_0x21d646&&_0x5e13d1['type']['startsWith']('image/')?'image':_0x21d646;try{this['_addContextItem']({'type':_0x352146,'label':_0x484419?.['label']||_0x527626,'uiId':_0x1c12b9,'resourceId':_0x484419?.['resourceId']},!0x0);const _0x201f05=this['_connector']['uploadFile'](this['_ownerId'],_0x5e13d1,_0x484419);this['_ongoingUploads']['set'](_0x1c12b9,_0x201f05['abortController']);const {id:_0x813ffb}=await _0x201f05['getId']();this['_ongoingUploads']['delete'](_0x1c12b9),this['_finishContextItemLoading']({'type':_0x352146,'id':_0x813ffb,'label':_0x484419?.['label']||_0x527626,'uiId':_0x1c12b9,'resourceId':_0x484419?.['resourceId']},!0x1);}catch(_0x1f5f62){this['_ongoingUploads']['delete'](_0x1c12b9);if(!(_0x1f5f62 instanceof ht&&_0x1f5f62['message']['startsWith']('ai-request-aborted'))){const _0x377754=As['get'](_0x1f5f62['code'])||'ai-chat-file-upload-failed',_0x3e30c7=new ht(_0x377754,null,{'fileName':_0x527626,..._0x1f5f62});_0x3e30c7['stack']=_0x1f5f62['stack'],this['fire']('error',{'error':_0x3e30c7});}this['_removeContextItem'](_0x1c12b9);}}));}finally{this['_finishUploadOperation'](_0x22b288);}}['addCurrentDocumentToContext'](_0xbbc89d){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x406e5f={'type':'document','uiId':'current-document','label':_0xbbc89d,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x406e5f);}async['updateCurrentDocuments'](_0x31df7b){const _0x5db1ea=this['_pendingContextItems']['get']('current-document');if(!_0x5db1ea||!_0x31df7b['length']||_0x31df7b['every'](_0x376230=>!_0x376230['content']))return;_0x31df7b['length']>0x1&&_0x31df7b['some'](_0x2d03af=>!_0x2d03af['description'])&&wt('ai-chat-documents-missing-description');try{const _0x1f9961=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x31df7b)['getIds']();if(_0x1f9961['length']!==_0x31df7b['length']||_0x1f9961['some'](_0x9bbc81=>!_0x9bbc81?.['id'])){const _0x8cd2dd=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x8cd2dd});}_0x5db1ea['documents']=_0x31df7b['map']((_0x3cacc5,_0x38e852)=>{return{'id':_0x1f9961[_0x38e852]['id'],'content':_0x3cacc5['content'],'version':_0x3cacc5['version'],'sessionId':_0x3cacc5['sessionId'],'selection':(_0x249070=_0x3cacc5['selections'],_0x249070?_0x249070['map'](_0x1010e0=>({'start':_0x1010e0['start'],'end':_0x1010e0['end']})):[]),'channelId':_0x3cacc5['channelId'],'rootName':_0x3cacc5['rootName']};var _0x249070;});}catch(_0x7efadf){const _0x7e3732=new ht('ai-chat-document-upload-failed',null);_0x7e3732['stack']=_0x7efadf['stack'],this['fire']('error',{'error':_0x7e3732});}}['addSelectionToContext'](_0x2ae22f){this['_addContextItem']({'type':'selection','label':_0x2ae22f,'uiId':'selection','content':_0x2ae22f});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x4f00ff,_0x232295){const _0x3b3ed1='url-'+at();this['_startUploadOperation'](_0x3b3ed1);const _0x530198='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x232295?.['label']||_0x4f00ff,'uiId':_0x530198,'resourceId':_0x232295?.['resourceId']},!0x0);const _0xd1b87c=this['_connector']['uploadUrl'](this['_ownerId'],_0x4f00ff,_0x232295);this['_ongoingUploads']['set'](_0x530198,_0xd1b87c['abortController']);const {id:_0x5dc600}=await _0xd1b87c['getId']();this['_ongoingUploads']['delete'](_0x530198),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5dc600,'label':_0x232295?.['label']||_0x4f00ff,'uiId':_0x530198,'resourceId':_0x232295?.['resourceId']},!0x1);}catch(_0x32f918){this['_ongoingUploads']['delete'](_0x530198),(_0x32f918['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x4f00ff,'originalError':_0x32f918}),'url':_0x4f00ff}),this['_removeContextItem'](_0x530198));}finally{this['_finishUploadOperation'](_0x3b3ed1);}}['addToolItemToContext'](_0x34ee68){_0x34ee68['id']=_0x34ee68['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x34ee68['uiId'],_0x34ee68),this['fire']('contextItemAdded',{'contextItem':_0x34ee68,'isLoading':!0x1});}async['loadSourceResources'](_0x1e2722,_0x4037c5,_0x10dafc){const _0x3e51fe=this['_addContextOptionsState']['sources']['find'](_0x227e52=>_0x227e52['id']===_0x1e2722);if(!_0x3e51fe)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x1e2722}),'sourceId':_0x1e2722}),[];try{const _0x22a981=(await _0x3e51fe['getResources'](_0x4037c5))['map'](_0x3f51af=>{const _0x8ad37f=this['_isResourceInContext'](_0x3f51af['id']);return{..._0x3f51af,'isInContext':_0x8ad37f};});return _0x3e51fe['resources']=_0x22a981,this['fire']('sourceResourcesLoaded',{'sourceId':_0x1e2722,'source':_0x3e51fe,'resources':_0x22a981,'uid':_0x10dafc}),_0x22a981;}catch(_0x279d86){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x1e2722,'originalError':_0x279d86}),'sourceId':_0x1e2722,'sourceLabel':_0x3e51fe['label']}),[];}}async['addResourceToContext'](_0x164ec4,_0x262d25){if(this['_isResourceInContext'](_0x262d25['id']))return;let _0x18deff=_0x262d25['data'];if(!_0x18deff&&_0x164ec4['getData'])try{_0x18deff=await _0x164ec4['getData'](_0x262d25['id']);}catch(_0x33aba5){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id'],'originalError':_0x33aba5}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});}if(_0x18deff)switch(_0x262d25['type']){case'web-resource':if('string'!=typeof _0x18deff)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id'],'expectedType':'string','actualType':typeof _0x18deff}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});await this['addUrlToContext'](_0x18deff,{'label':_0x262d25['label'],'resourceId':_0x262d25['id']});break;case'file':if(!(_0x18deff instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id'],'expectedType':'File','actualType':typeof _0x18deff}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});await this['addFilesToContext']([_0x18deff],{'label':_0x262d25['label'],'resourceId':_0x262d25['id']});break;case'text':if('object'!=typeof _0x18deff||!('content'in _0x18deff)||!('type'in _0x18deff))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x18deff}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});_0x18deff=AIChatContext['_convertTextResourceToFile'](_0x18deff,_0x262d25['label']),await this['addFilesToContext']([_0x18deff],{'label':_0x262d25['label'],'resourceId':_0x262d25['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id'],'resourceType':_0x262d25['type']}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']}),'resourceId':_0x262d25['id'],'sourceId':_0x164ec4['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x35f1d4){if(void 0x0!==_0x35f1d4)this['_addContextOptionsState']['document']['isHidden']=!_0x35f1d4;else{const _0xe4fce6=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0xe4fce6;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x43066d,_0x2d6594){switch(_0x43066d['type']){case'markdown':return new File([_0x43066d['content']],_0x2d6594,{'type':'text/markdown'});case'html':return new File([_0x43066d['content']],_0x2d6594,{'type':'text/html'});default:return new File([_0x43066d['content']],_0x2d6594,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x40572c){switch(_0x40572c['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x40572c['id']}];case'web-resource':return[{'type':'web-resource','id':_0x40572c['id']}];case'document':return _0x40572c['documents']?.['length']?_0x40572c['documents']['map'](_0x105d02=>({'type':'document','id':_0x105d02['id'],..._0x105d02['selection']?.['length']&&{'selection':_0x105d02['selection']}})):[{'type':'document','id':_0x40572c['id'],..._0x40572c['selection']?.['length']&&{'selection':_0x40572c['selection']}}];case'mcp-tool-context':{const _0x570260=_0x40572c;return[{'type':'mcp-tool-context','mcpServerName':_0x570260['mcpServerName'],'toolName':_0x570260['toolName'],'data':{..._0x570260['data'],'label':_0x570260['label']||_0x570260['data']?.['label']||_0x570260['id']},'id':_0x570260['id']}];}default:return[];}}['_addContextItem'](_0x5c7fd3,_0x57e87a=!0x1){if(this['_pendingContextItems']['set'](_0x5c7fd3['uiId'],_0x5c7fd3),_0x5c7fd3['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x5c7fd3,'isLoading':_0x57e87a}),'current-document'===_0x5c7fd3['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x5c7fd3['resourceId']){const _0x4ed4ce=this['_findSourceIdsByResourceId'](_0x5c7fd3['resourceId']);_0x4ed4ce&&_0x4ed4ce['forEach'](_0x2ad315=>{this['_updateResourceInContextState'](_0x2ad315,_0x5c7fd3['resourceId'],!0x0);});}}['_removeContextItem'](_0x341b84){const _0x1ad372=this['_pendingContextItems']['get'](_0x341b84),_0x26c2eb=this['_ongoingUploads']['get'](_0x341b84);if(_0x26c2eb&&(_0x26c2eb['abort'](),this['_ongoingUploads']['delete'](_0x341b84)),_0x1ad372?.['resourceId']){const _0x2fe5eb=this['_findSourceIdsByResourceId'](_0x1ad372['resourceId']);_0x2fe5eb&&_0x2fe5eb['forEach'](_0x144939=>{this['_updateResourceInContextState'](_0x144939,_0x1ad372['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x341b84),this['fire']('contextItemRemoved',{'uiId':_0x341b84,'type':_0x1ad372?.['type']}),'current-document'===_0x341b84&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x5f5607,_0x2d40f5){if(this['_pendingContextItems']['has'](_0x5f5607['uiId'])&&(this['_pendingContextItems']['set'](_0x5f5607['uiId'],_0x5f5607),this['fire']('contextItemLoadingEnded',{'contextItem':_0x5f5607,'isLoading':_0x2d40f5}),_0x5f5607['resourceId'])){const _0x3955a1=this['_findSourceIdsByResourceId'](_0x5f5607['resourceId']);_0x3955a1&&_0x3955a1['forEach'](_0xe46ce=>{this['_updateResourceInContextState'](_0xe46ce,_0x5f5607['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x135c37){this['_conversationContextItems']['set'](_0x135c37['uiId'],_0x135c37);}['_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'](_0x4ab0b6=>({..._0x4ab0b6,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0xc46195=>({..._0xc46195,'resources':[]}))??[];}['_isResourceInContext'](_0x8c5ab6){for(const _0x3bf006 of this['_pendingContextItems']['values']())if(_0x3bf006['resourceId']===_0x8c5ab6)return!0x0;for(const _0x53da3b of this['_conversationContextItems']['values']())if(_0x53da3b['resourceId']===_0x8c5ab6)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x30309b){const _0x928dca=[];for(const _0x35a055 of this['_addContextOptionsState']['sources']){_0x35a055['resources']['find'](_0x19ab48=>_0x19ab48['id']===_0x30309b)&&_0x928dca['push'](_0x35a055['id']);}return 0x0===_0x928dca['length']?null:_0x928dca;}['_updateResourceInContextState'](_0x1047f9,_0x31967c,_0x4d8709){const _0x54998b=this['_addContextOptionsState']['sources']['find'](_0x45358c=>_0x45358c['id']===_0x1047f9);if(!_0x54998b)return;const _0x36bb2c=_0x54998b['resources']['find'](_0x3b7ae3=>_0x3b7ae3['id']===_0x31967c);_0x36bb2c&&(_0x36bb2c['isInContext']=_0x4d8709,this['fire']('resourceStateChanged',{'sourceId':_0x1047f9,'resourceId':_0x31967c,'isInContext':_0x4d8709}));}['_startUploadOperation'](_0x185c8a){this['_ongoingUploadOperations']['set'](_0x185c8a,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x452bc6){this['_ongoingUploadOperations']['delete'](_0x452bc6),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const ws=['capabilitiesUpdated'];class AICapabilities extends Et(){['_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'](_0x366df4){const _0x2f72b3={};return _0x366df4&&_0x366df4['isWebSearchEnabled']&&(_0x2f72b3['webSearch']={}),_0x366df4&&_0x366df4['isReasoningEnabled']&&(_0x2f72b3['reasoning']={}),_0x2f72b3;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x1a53c5){_0x1a53c5!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x1a53c5,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x347449){_0x347449!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x347449,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x56fb5d){super(_0x56fb5d),this['conversationId']=_0x56fb5d['conversationId'],this['contextItems']=_0x56fb5d['contextItems'],this['capabilities']=_0x56fb5d['capabilities'],this['userMessage']=_0x56fb5d['userMessage'],this['model']=_0x56fb5d['model'],this['attributes']=_0x56fb5d['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x1d2fd8){super(),this['options']=_0x1d2fd8,this['connector']=_0x1d2fd8['connector'],this['chatModels']=_0x1d2fd8['chatModels'],this['id']=_0x1d2fd8['conversationId'],this['isFromHistory']=_0x1d2fd8['isFromHistory'],this['_channelsToEditors']=_0x1d2fd8['channelsToEditors'],this['_getSessionId']=_0x1d2fd8['getSessionId'];}async['init'](_0x421de8){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x421de8,'ownerId':this['id']}),this['chatContext']['delegate'](...gs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...ws)['to'](this),this['chatCapabilities']['init']();const _0x56bf13=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x56bf13});const _0xd88f10=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0xd88f10&&await this['setModel'](_0xd88f10);}catch(_0x2aecc8){const _0x1fd3d2=new ht('ai-chat-conversation-init-failed',null,{'message':_0x2aecc8['message']||_0x2aecc8});_0x1fd3d2['stack']=_0x2aecc8['stack'],this['fire']('error',{'error':_0x1fd3d2});}}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:_0x325751}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x325751,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x4c8445){const _0x40c94f=new ht('ai-chat-conversation-start-failed',null,{'message':_0x4c8445['message'],'conversationId':this['id']});throw _0x40c94f['stack']=_0x4c8445['stack'],this['fire']('error',{'error':_0x40c94f}),_0x40c94f;}}async['load'](_0x138904){try{const _0x17c10f=await this['connector']['fetchConversation'](_0x138904)['getConversation'](),_0x509508=await this['connector']['fetchConversationMessages'](_0x138904)['getMessages'](),_0x35fe92=_0x509508[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x17c10f['id'],'title'in _0x17c10f?this['fire']('setConversationTitle',_0x17c10f['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x4649bc=(await this['chatModels']['getAll']())['find'](_0x1649aa=>_0x1649aa['id']['toLowerCase']()===_0x35fe92['toLowerCase']());this['selectedModel']=_0x4649bc,this['fire']('modelSelected',{'selectedModel':_0x4649bc,'isDisabled':!0x0});const {streamingMessageId:_0x5a0d83}=await this['_processMessagesToInteractions'](_0x509508,_0x35fe92);return _0x5a0d83&&this['currentInteraction']?this['_resumeStream'](_0x5a0d83):this['currentInteraction']=void 0x0,this;}catch(_0x587fe7){const _0x307511=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0x587fe7['message'],'conversationId':_0x138904});throw _0x307511['stack']=_0x587fe7['stack'],this['fire']('error',{'error':_0x307511}),_0x307511;}}async['_processMessagesToInteractions'](_0x132ba4,_0x46f247){let _0x2bf9ca,_0xee8066,_0x374195=!0x1;for(const _0x51dbde of _0x132ba4)if('user'===_0x51dbde['role']){const {contextItems:_0x39e477,hasUnmatched:_0x5304b9}=await this['_extractContextItems'](_0x51dbde);_0x374195=_0x5304b9;const _0x1626ad={'isReasoningEnabled':Object['hasOwn'](_0x51dbde['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x51dbde['capabilities'],'webSearch')};_0x2bf9ca=this['createInteraction']({'userMessage':_0x51dbde['prompt'],'contextItems':_0x39e477,'capabilities':_0x1626ad,'modelId':_0x46f247,'attributes':_0x51dbde['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x2bf9ca,_0xee8066=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x51dbde['role']&&_0x2bf9ca){if('streaming'===_0x51dbde['status']){_0xee8066=_0x51dbde['id'];continue;}if('error'===_0x51dbde['status'])continue;const _0x419f22=[];for(const _0x4ca575 of _0x51dbde['content'])switch(_0x4ca575['type']){case'text':case'modification':{const _0x5c4a66=_0x2bf9ca['getDocumentContext'](),_0x2070b8=this['_hasSessionMismatch'](_0x5c4a66)||_0x374195;_0x2bf9ca['currentReply']?.['type']!==_0x4ca575['type']&&(_0x2bf9ca['currentReply']=_0x2bf9ca['createReply']({'type':_0x4ca575['type'],'isDone':!0x0,'interactionId':_0x2bf9ca['id'],'areActionsDisabled':_0x2070b8,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x419f22['length']>0x0&&(_0x2bf9ca['currentReply']['sources']=_0x419f22['splice'](0x0))),_0x2bf9ca['currentReply']['appendContent'](_0x4ca575['content'],_0x4ca575['documentId']);break;}case'url':_0x419f22['push'](_0x4ca575);break;case'mcp-tool-result':{const {data:_0x5b54bf,attributes:_0x305483}=JSON['parse'](_0x4ca575['content']);_0x2bf9ca['_handleToolResultData']({'toolName':_0x4ca575['toolName'],'data':_0x5b54bf,'attributes':_0x305483});break;}}'cancelled'===_0x51dbde['status']&&this['fire']('error',{'interactionId':_0x2bf9ca['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0xee8066};}async['_resumeStream'](_0x30a8e2){if(this['currentInteraction'])try{const _0x2c29bb=this['connector']['resumeStream'](this['id'],_0x30a8e2);await this['currentInteraction']['resume'](_0x2c29bb);}catch(_0x151ed8){_0x151ed8 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x151ed8});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x1cf072){const _0x9f5c3f=new Map();if(!_0x1cf072['content'])return{'contextItems':_0x9f5c3f,'hasUnmatched':!0x1};const {contextItem:_0x12bca9,hasUnmatched:_0x9124a2}=await this['chatContext']['populateDocumentsFromMessage'](_0x1cf072['content'],Array['from'](this['_channelsToEditors']['values']()));_0x12bca9&&_0x9f5c3f['set'](_0x12bca9['id'],_0x12bca9);for(const _0x226f38 of _0x1cf072['content']){if('document'===_0x226f38['type'])continue;const _0x95082b=await this['chatContext']['populateFromMessage'](_0x226f38);_0x95082b&&_0x9f5c3f['set'](_0x95082b['id'],_0x95082b);}return{'contextItems':_0x9f5c3f,'hasUnmatched':_0x9124a2};}async['handleUserInteraction']({userMessage:_0x1ae442,attributes:_0x857ed}){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 _0x9a0cdf=new Map(this['getPendingContextItems']()),_0x33c9ba=this['chatCapabilities']['getCapabilitiesConfig'](),_0x27f753=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x1ae442,'contextItems':_0x9a0cdf,'capabilities':_0x33c9ba,'modelId':_0x27f753,'attributes':_0x857ed,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x40c660){if(_0x40c660 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x40c660});else{const _0x4491dd=As['get'](_0x40c660['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x4491dd,null,{'error':_0x40c660})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x175e69,contextItems:_0x3436e2,capabilities:_0x268330,modelId:_0x6092de,attributes:_0x1adcf9,channelsToEditors:_0x1d253a}){const _0x288c21=new AIChatInteraction({'userMessage':_0x175e69,'contextItems':_0x3436e2,'capabilities':_0x268330,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x6092de,'attributes':_0x1adcf9,'channelsToEditors':_0x1d253a});return _0x288c21['delegate'](...Is)['to'](this),this['interactions']['push'](_0x288c21),this['fire']('interactionCreated',_0x288c21),_0x288c21;}['getInteraction'](_0x1dfb88){return this['interactions']['find'](_0x4bc76d=>_0x4bc76d['id']===_0x1dfb88);}['removeInteraction'](_0x58211e){const _0x75bb3b=this['getInteraction'](_0x58211e);_0x75bb3b&&(_0x75bb3b['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x75bb3b),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x39ad50=this['lastInteraction'];_0x39ad50?.['conversationId']&&_0x39ad50['messageId']&&this['connector']['cancelStream'](_0x39ad50['conversationId'],_0x39ad50['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x5cbe2e){this['chatContext']['addCurrentDocumentToContext'](_0x5cbe2e);}async['updateCurrentDocumentsInContext'](_0x4ea0cf){await this['chatContext']['updateCurrentDocuments'](_0x4ea0cf);}['toggleAddCurrentDocumentOptionVisibility'](_0x4e7306){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x4e7306);}['_hasSessionMismatch'](_0x146cf){return!!_0x146cf&&_0x146cf['documents']['some'](_0x17f4af=>{const _0xf81941=this['_channelsToEditors']['get'](_0x17f4af['channelId']);return!_0xf81941||_0x17f4af['sessionId']!==this['_getSessionId'](_0xf81941);});}['addSelectionToContext'](_0x35b0fb){this['chatContext']['addSelectionToContext'](_0x35b0fb);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x4ba9f9){this['chatContext']['addFilesToContext'](_0x4ba9f9);}['addUrlToContext'](_0x40bd4f){this['chatContext']['addUrlToContext'](_0x40bd4f);}['addToolItemToContext'](_0x285cd2){this['chatContext']['addToolItemToContext'](_0x285cd2);}['addResourceToContext'](_0x310619,_0x124ebd){this['chatContext']['addResourceToContext'](_0x310619,_0x124ebd);}['loadSourceResources'](_0x234dcd,_0x5edadc,_0x53361d){return this['chatContext']['loadSourceResources'](_0x234dcd,_0x5edadc,_0x53361d);}['removeFromContext'](_0x38b552){this['chatContext']['removeFromContext'](_0x38b552);}['setWebSearch'](_0x3cdac8){this['chatCapabilities']['setWebSearch'](_0x3cdac8);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x3be73d){this['chatCapabilities']['setReasoning'](_0x3be73d);}['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'](_0x5e90c6){_0x5e90c6?!0x1===await this['chatModels']['isAvailable'](_0x5e90c6)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x5e90c6}),_0x5e90c6=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x5e90c6=(await this['chatModels']['getAvailableModels']())[0x0]),_0x5e90c6['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x5e90c6,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x5e90c6}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x255d68,config:_0x5ef648,locale:_0x4ddeac}){super(),this['_connector']=_0x255d68,this['_config']=_0x5ef648,this['_locale']=_0x4ddeac;}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 _0x2cd1db=await this['getAll']();let _0x2d734c;return _0x2d734c=this['_availableModels']?this['_filterModels'](_0x2cd1db,this['_availableModels']):_0x2cd1db['filter'](_0x5628f9=>_0x5628f9['recommended']),_0x2d734c;}async['getModel'](_0x8270d2){const _0xdddd4d=await this['getAll']();if(!_0xdddd4d['length'])return null;if(_0x8270d2){const _0x3ecf31=this['_getModelById'](_0xdddd4d,_0x8270d2);if(_0x3ecf31)return _0x3ecf31;wt('ai-chat-model-id-unrecognized',{'modelId':_0x8270d2,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x3e6f47=await this['getAvailableModels']();if(!_0x3e6f47['length'])return null;if(this['_defaultModelId']){const _0x5a9fa6=this['_getModelById'](_0x3e6f47,this['_defaultModelId']);if(_0x5a9fa6)return _0x5a9fa6;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x3e6f47[0x0]['id']});}return _0x3e6f47[0x0];}async['isAvailable'](_0x1eb06e){return(await this['getAvailableModels']())['some'](_0x1eb4f6=>_0x1eb4f6['name']===_0x1eb06e['name']&&_0x1eb4f6['provider']===_0x1eb06e['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x16d0e6=this['_locale']['uiLanguage']||'en',_0x1a13bf=this['_connector']['getModels'](_0x16d0e6),_0x396960=await _0x1a13bf['list']();this['_modelList']=_0x396960['items']['map'](_0x5588ad=>Cs(_0x5588ad)?{..._0x5588ad,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x5588ad);}catch(_0x4a9e0c){throw Ct('ai-models-unable-to-retrieve',{'error':_0x4a9e0c}),_0x4a9e0c;}return[...this['_modelList']];}['_filterModels'](_0x53fcb4,_0x2bc6ae){let _0x1d0822;if(_0x2bc6ae){_0x1d0822=[];const _0x5c4eeb=new Set(),_0x4134b2='string'==typeof _0x2bc6ae?[_0x2bc6ae['toLocaleLowerCase']()]:_0x2bc6ae['map'](_0x3e9ca7=>_0x3e9ca7['toLocaleLowerCase']());for(const _0x15c070 of _0x4134b2)for(const _0x46e77e of _0x53fcb4)!_0x5c4eeb['has'](_0x46e77e['id'])&&this['_isMatchingFilter'](_0x46e77e,_0x15c070)&&(_0x1d0822['push'](_0x46e77e),_0x5c4eeb['add'](_0x46e77e['id']));}else _0x1d0822=_0x53fcb4;return _0x1d0822;}['_isMatchingFilter'](_0x53b4a4,_0x28fb17){const _0x4e77aa=_0x53b4a4['id']['toLocaleLowerCase'](),_0x2ad07a=_0x53b4a4['name']['toLocaleLowerCase'](),_0x469496=_0x53b4a4['provider']['toLocaleLowerCase']();return _0x4e77aa===_0x28fb17||_0x2ad07a===_0x28fb17||Cs(_0x53b4a4)&&'auto'===_0x28fb17||_0x469496===_0x28fb17||_0x4e77aa['startsWith'](_0x28fb17);}['_getModelById'](_0x2a6c32,_0x5e77bc){return _0x2a6c32['find'](_0x545d7e=>Cs(_0x545d7e)&&'auto'===_0x5e77bc?_0x545d7e:_0x545d7e['id']===_0x5e77bc)||null;}}function Cs(_0x29dfa5){return _0x29dfa5['id']['startsWith']('agent');}function ms(_0x5ae587){return _0x5ae587?_0x5ae587 instanceof _0x2fdbcb?[_0x5ae587]:_0x5ae587['editors']&&0x0!==_0x5ae587['editors']['length']?Array['from'](_0x5ae587['editors']):[]:[];}function ps(_0x636adc){const _0x4167b0=ms(_0x636adc);if(!_0x4167b0['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x4167b0['length'])return _0x4167b0[0x0];const _0x4ace4a=_0x4167b0['find'](_0x1aaa4a=>_0x1aaa4a['ui']?.['focusTracker']?.['isFocused']);if(_0x4ace4a)return _0x4ace4a;const _0x2b65b6=function(_0xc4f95b){if(_0xc4f95b instanceof _0x2fdbcb)return;const _0x376898=_0xc4f95b;if(!_0x376898['plugins']||!_0x376898['plugins']['has']('AIEditing'))return;const _0xaa93f2=_0x376898['plugins']['get']('AIEditing');return _0xaa93f2['getLastContentFocusedEditor']?.();}(_0x636adc);return _0x2b65b6&&_0x4167b0['includes'](_0x2b65b6)?_0x2b65b6:_0x4167b0[0x0];}function Es({interaction:_0x3fa4d1,reply:_0x258009,groups:_0x40e302,transform:_0x410bff,documentCompare:_0x55cd9e,documentCompareOptions:_0x392a1a}){const _0x223aab=_0x3fa4d1['getDocumentContext']()['documents']['find'](_0x253955=>_0x253955['id']==_0x40e302[0x0]['documentId']),_0x573475=_0x40e302[0x0]['editor'];if(!_0x223aab)return[];const _0x1bee53=_0x223aab['content'],_0x2f907d=_0x223aab['version'],_0x5c6ff9=_0x258009['documentContextContent']['get'](_0x40e302[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x4f6041}of _0x40e302){const _0x5acf42=_0x4f6041['filter'](_0x5b7d3b=>'new'!=_0x5b7d3b['type'])['map'](_0x834c84=>Yi('data-id',_0x834c84['id'],_0x5c6ff9)),_0x5d86a7=_0x4f6041['filter'](_0x5f06d3=>'removed'!=_0x5f06d3['type'])['map'](_0x319815=>_0x319815['node']['cloneNode'](!0x0));let _0x36b014=null;if(_0x5acf42['length']){_0x36b014=_0x5acf42[0x0]['previousSibling'];for(let _0x25aa8b=0x0;_0x25aa8b<_0x5acf42['length'];_0x25aa8b++)_0x2f3801(_0x5acf42[_0x25aa8b]);}if(_0x5d86a7['length']){_0x36b014||(_0x4f6041[0x0]['anchorId']?_0x36b014=Yi('data-id',_0x4f6041[0x0]['anchorId'],_0x5c6ff9):(_0x36b014=_0x5d86a7['shift'](),_0x21afaf(_0x5c6ff9,_0x36b014)));for(let _0x1baf47=0x0;_0x1baf47<_0x5d86a7['length'];_0x1baf47++)_0xdcd537(_0x36b014,_0x5d86a7[_0x1baf47]),_0x36b014=_0x5d86a7[_0x1baf47];}}const _0x158e6b=Ki(_0x5c6ff9),_0x5530ee=_0x55cd9e['getDiff'](_0x1bee53,_0x158e6b,{'targetEditor':_0x573475,..._0x392a1a})['getOperations']();if(_0x410bff){const _0x413f01=_0x573475['model']['document']['history']['getOperations'](_0x2f907d),_0x39d253={'document':_0x573475['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x213b3b(_0x5530ee,_0x413f01,_0x39d253)['operationsA'];}return _0x5530ee;}function Ts(_0x4884af,_0x26b2e5){if('marker'!=_0x26b2e5['type'])return;const _0x47a6f9=_0x4884af['model']['markers']['get'](_0x26b2e5['name']);_0x47a6f9&&(_0x26b2e5['oldRange']=_0x47a6f9['getRange']());}function fs(_0x120248,_0x5a2f11){if(_0x120248['files']['length']>0x0&&_0x5a2f11['filesEnabled']){const _0x2ef741=_0x120248['files']['filter'](_0x2ce9db=>_0x2ce9db['name']);return _0x2ef741['length']>0x0?{'type':'file','files':_0x2ef741}:null;}if(_0x5a2f11['urlsEnabled']){const _0x159193=function(_0x4cbc4f){const _0x1b11a6=_0x4cbc4f['trim']();if(/\s/['test'](_0x1b11a6))return null;try{const _0x415fc9=new URL(_0x1b11a6);return'http:'!==_0x415fc9['protocol']&&'https:'!==_0x415fc9['protocol']?null:_0x415fc9['toString']();}catch{return null;}}(_0x120248['plainText']);if(_0x159193)return{'type':'url','url':_0x159193};}const _0xb88a5e=_0x120248['forceTextAttachment']?0x1:_0x5a2f11['longTextThreshold']??0x1/0x0;if(_0x120248['plainText']['length']>=Math['max'](_0xb88a5e,0x1)&&_0x5a2f11['filesEnabled']){const _0x17909a=_0x5a2f11['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x120248['plainText']],_0x17909a,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x464fb9{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x34a64f];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x3e1f5a=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x1c7e7d,_0x1df1f7)=>{this['_handleUIUserMessage']({'message':_0x1df1f7});}),this['listenTo'](_0x3e1f5a['view'],'change:activeTab',(_0x1765f6,_0xa7e26c,_0x1bb8bb)=>{'chat'!==_0x1bb8bb&&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',(_0x29fb89,_0x189255)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x189255));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x2f06c6,_0x20f508)=>{this['activeConversation']?.['addUrlToContext'](_0x20f508);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x6bc9cb,_0x22d26c)=>{const _0x3241ad=this['activeConversation'];if(!_0x3241ad)return;_0x22d26c['hasDirectory']&&(_0x22d26c['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x457ca9=fs(_0x22d26c,{'pastedTextLabel':Mi(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')});_0x457ca9&&(_0x22d26c['preventDefault'](),'url'===_0x457ca9['type']?_0x3241ad['addUrlToContext'](_0x457ca9['url']):_0x3241ad['chatContext']['addFilesToContext'](_0x457ca9['files'],void 0x0,_0x457ca9['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x13a944,_0x342149)=>{_0x342149['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x3858d1,_0xcb0740)=>{this['activeConversation']?.['addResourceToContext'](_0xcb0740['source'],_0xcb0740['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x68916a,_0x4e3b60)=>{this['_removeFromContext'](_0x4e3b60);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x35547a,_0x55019c)=>{this['activeConversation']?.['loadSourceResources'](_0x55019c['sourceId'],_0x55019c['query'],_0x55019c['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x58ff72,_0x225871)=>{this['activeConversation']?.['setModel'](_0x225871);}),this['listenTo'](this['_aiChatUi'],'like',(_0xe74049,{replyId:_0x27acc1})=>{console['log']('Liked\x20response',_0x27acc1);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x236a67,{replyId:_0x4bed41})=>{console['log']('Disliked\x20response',_0x4bed41);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x2b039a,_0x2d7efb)=>{this['_insertSuggestion'](_0x2d7efb);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3f560e,{replyId:_0xb6b1c0,partIndex:_0x2ead68})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0xb6b1c0,_0x2ead68);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0xe0faa4,{replyId:_0x53f610,partIndex:_0x3988bd})=>{const _0x46a2d2=this['_getDocumentRangeForReplyChanges'](_0x53f610,_0x3988bd);if(!_0x46a2d2)return;const {reply:_0x17066b}=this['getInteractionAndReplyById'](_0x53f610);'$graveyard'!=_0x46a2d2['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x17066b['changeGroups'][_0x3988bd]['editor'],'ranges':[_0x46a2d2['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x334ebe,_0x3a5f5c)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3a5f5c);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x5172df,{replyId:_0x3c8c7f,showDiff:_0x2385dd})=>{const {interaction:_0x6ba134,reply:_0x472971}=this['getInteractionAndReplyById'](_0x3c8c7f),_0x1cda23=_0x472971['getContentParts']({'showDiff':_0x2385dd});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x6ba134['id']+':'+_0x472971['id'],'parts':_0x1cda23});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x594222,{replyId:_0x206389,partIndex:_0x11eb16})=>{this['_rejectSuggestion']({'replyId':_0x206389,'partIndex':_0x11eb16}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x5d64f4,_0x289fa9)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x289fa9);}),this['on']('replyCreated',(_0x12f5d5,_0x4afeaa)=>{this['_addFeedItemReply'](_0x4afeaa);});}['afterInit'](){this['context']instanceof _0x2fdbcb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xb2303e,_0x2d03ff)=>{_0x2d03ff['on']('ready',()=>{this['_integrateEditor'](_0x2d03ff);});}),this['_initConversation']();}async['_initConversation'](){const _0x326343=this['context']['config']['get']('ai.chat.initialConversation');let _0x5cacad=_0x326343;('lastCreated'!=_0x326343||(_0x5cacad=await this['_getLastCreatedConversationId'](),_0x5cacad))&&('new'==_0x5cacad?await this['_startConversationSafely']():await this['loadConversation'](_0x5cacad));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0xede5fc){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0xede5fc)['getConversation'](),await this['_startConversationSafely']({'id':_0xede5fc}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0xede5fc),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x44a3d3){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0xede5fc}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x44a3d3}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x4e6b7e){let _0x8cc18f=null,_0x1597ea=null;this['on']('toolDataReceived',(_0x172bdd,_0x918164,_0x15cbfd)=>{_0x15cbfd['id']!==_0x8cc18f&&(_0x8cc18f=_0x15cbfd['id'],_0x1597ea=this['_getAIChatFeedAPI'](_0x15cbfd)),_0x4e6b7e(_0x918164,_0x1597ea);});}['addCurrentDocumentToChatContext'](){ms(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x51c76b){const _0x2364a=this['_aiEditing']['getSelectionText'](_0x51c76b);this['activeConversation']?.['addSelectionToContext'](_0x2364a),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x4147c8){await this['_startConversationSafely']({'modelId':_0x4147c8?.['modelId']});}async['sendMessage'](_0x12fcba){await this['_handleUIUserMessage'](_0x12fcba);}['getGroupId'](){const _0x498fe2=this['context']['config']['get']('collaboration.channelId');if(!_0x498fe2)throw new ht('ai-missing-channel-id',this);return _0x498fe2;}['_handleRemovedConversation'](_0x95e9c9){this['activeConversation']['id']===_0x95e9c9&&this['_startConversationSafely']();}['_insertSuggestion'](_0x296171){const _0x2e18ba=this['context']['plugins']['get'](_0x34a64f),{reply:_0x4aee75,interaction:_0x2a0386}=this['getInteractionAndReplyById'](_0x296171['replyId']),_0x656157=void 0x0!==_0x296171['partIndex']?[_0x4aee75['changeGroups'][_0x296171['partIndex']]]:_0x4aee75['changeGroups']['filter'](_0x3c1319=>'pending'==_0x3c1319['state']);_0x656157['map'](_0x5b37f3=>_0x4aee75['changeGroups']['indexOf'](_0x5b37f3))['forEach'](_0x360c91=>{const _0x4b7d59=this['_getDocumentRangeForReplyChanges'](_0x296171['replyId'],_0x360c91);_0x4b7d59&&'$graveyard'!=_0x4b7d59['range']['root']['rootName']?(_0x4aee75['setChangeGroupState'](_0x360c91,'accepted'),void 0x0!==_0x296171['partIndex']&&this['_scrollToSuggestionRange'](_0x4b7d59['range'],!0x1,_0x4b7d59['targetEditor'])):_0x4aee75['setChangeGroupState'](_0x360c91,'outdated');});const _0x2993cc={},_0x1cece9=_0x656157['reduce']((_0xd94d65,_0x5c443d)=>('outdated'===_0x5c443d['state']||(_0xd94d65[_0x5c443d['documentId']]=[..._0xd94d65[_0x5c443d['documentId']]||[],_0x5c443d],_0x2993cc[_0x5c443d['documentId']]=[..._0x2993cc[_0x5c443d['documentId']]||[],_0x4aee75['changeGroups']['indexOf'](_0x5c443d)]),_0xd94d65),{});for(const [_0x22c37d,_0x2fd433]of Object['entries'](_0x1cece9)){const _0x538064=_0x2fd433[0x0]['editor'];if(!_0x538064['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x538064});continue;}const _0x53c5ef=Es({'reply':_0x4aee75,'interaction':_0x2a0386,'groups':_0x2fd433,'transform':!0x0,'documentCompare':_0x2e18ba,'documentCompareOptions':{'anchor':_0x2fd433[0x0]['rootName'],'markDeletions':!0x0}});let _0x2b8233;_0x538064['model']['change'](_0x6bda56=>{_0x2b8233=_0x6bda56['batch'],_0x538064['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x53c5ef),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x2b8233,{'interactionId':_0x2a0386['id'],'replyId':_0x4aee75['id'],'indexes':_0x2993cc[_0x22c37d]});}this['_updateRatings'](_0x4aee75);}['_applySuggestion'](_0x4a964e){const _0x52b10c=this['context']['plugins']['get'](_0x34a64f),{reply:_0x3b78c1,interaction:_0x3f0186}=this['getInteractionAndReplyById'](_0x4a964e['replyId']),_0x154736=void 0x0!==_0x4a964e['partIndex']?[_0x3b78c1['changeGroups'][_0x4a964e['partIndex']]]:_0x3b78c1['changeGroups']['filter'](_0x47a115=>'pending'==_0x47a115['state']);_0x154736['map'](_0x2f094c=>_0x3b78c1['changeGroups']['indexOf'](_0x2f094c))['forEach'](_0x33139c=>{const _0x3ab1bd=this['_getDocumentRangeForReplyChanges'](_0x4a964e['replyId'],_0x33139c);_0x3ab1bd&&'$graveyard'!=_0x3ab1bd['range']['root']['rootName']?(_0x3b78c1['setChangeGroupState'](_0x33139c,'accepted'),void 0x0!==_0x4a964e['partIndex']&&this['_scrollToSuggestionRange'](_0x3ab1bd['range'],!0x1,_0x3ab1bd['targetEditor'])):_0x3b78c1['setChangeGroupState'](_0x33139c,'outdated');});const _0xadb157={},_0x42291f=_0x154736['reduce']((_0x30b934,_0x4a06ec)=>('outdated'===_0x4a06ec['state']||(_0x30b934[_0x4a06ec['documentId']]=[..._0x30b934[_0x4a06ec['documentId']]||[],_0x4a06ec],_0xadb157[_0x4a06ec['documentId']]=[..._0xadb157[_0x4a06ec['documentId']]||[],_0x3b78c1['changeGroups']['indexOf'](_0x4a06ec)]),_0x30b934),{});for(const [_0x54adda,_0x2282ad]of Object['entries'](_0x42291f)){const _0x7c470e=Es({'reply':_0x3b78c1,'interaction':_0x3f0186,'groups':_0x2282ad,'transform':!0x0,'documentCompare':_0x52b10c,'documentCompareOptions':{'anchor':_0x2282ad[0x0]['rootName'],'markDeletions':!0x1}});let _0x26b67d;const _0x30bee4=_0x2282ad[0x0]['editor'];_0x30bee4['model']['change'](_0x37ed99=>{_0x26b67d=_0x37ed99['batch'];for(const _0x4957e4 of _0x7c470e)_0x4957e4['baseVersion']=_0x30bee4['model']['document']['version'],Ts(_0x30bee4,_0x4957e4),_0x37ed99['batch']['addOperation'](_0x4957e4),_0x30bee4['model']['applyOperation'](_0x4957e4);}),this['_batchToChanges']['set'](_0x26b67d,{'interactionId':_0x3f0186['id'],'replyId':_0x3b78c1['id'],'indexes':_0xadb157[_0x54adda]});}this['_updateRatings'](_0x3b78c1);}['_rejectSuggestion'](_0x23768b){const {reply:_0x59b372}=this['getInteractionAndReplyById'](_0x23768b['replyId']);_0x59b372['setChangeGroupState'](_0x23768b['partIndex'],'rejected');}['_openBalloonFor'](_0x785f3b,_0x41e22c){if(!this['_hasAIChatBalloon'])return;const {reply:_0x269c6b}=this['getInteractionAndReplyById'](_0x785f3b),_0x348353=_0x269c6b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x348353['length'])return;let _0x21b424,_0x5c1f6e;if(void 0x0!==_0x41e22c?(_0x5c1f6e=_0x348353['find'](_0x22af04=>_0x22af04['index']==_0x41e22c),_0x21b424=_0x5c1f6e?.['index']):(_0x5c1f6e=_0x348353[0x0],_0x21b424=_0x5c1f6e['index']),!_0x5c1f6e)return void _0x269c6b['setChangeGroupState'](_0x41e22c??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x785f3b&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x21b424)return;const _0x391a2a=this['_getUserPresentableContentPartDocumentRange'](_0x785f3b,_0x269c6b,_0x5c1f6e),_0x2d3269=_0x269c6b['changeGroups']['find'](_0xdece0f=>_0xdece0f['index']==_0x21b424)['editor'],_0x2bdc1d=_0x2d3269['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x2bdc1d&&this['_activeBalloon']['close'](),!_0x391a2a)return _0x2bdc1d['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x2bdc1d,this['_currentPreviewedChangeGroup']={'replyId':_0x785f3b,'partIndex':_0x21b424},this['_scrollToSuggestionRange'](_0x391a2a,!0x0,_0x2d3269);const _0x50d565=this['_getPresentableSiblingContentPartIndex'](_0x785f3b,_0x21b424,'next');_0x2bdc1d['clearContent'](),_0x2bdc1d['updateContent']({'part':_0x5c1f6e,'renderingStrategy':'static'}),_0x2bdc1d['open']({'index':_0x21b424,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x21b424+0x1)['toString']()),'showRotator':null!==_0x50d565,'ranges':[_0x391a2a],'areActionsDisabled':_0x269c6b['areActionsDisabled'],'targetEditor':_0x2d3269}),_0x2bdc1d['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x785f3b,_0x21b424),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x785f3b,'index':_0x21b424,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0xb2a219,_0x41b63d,_0x5c2ba3){const {reply:_0x290cb7}=this['getInteractionAndReplyById'](_0xb2a219),_0x3e5a86=_0x290cb7['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x3e5a86['length'])return null;const _0xcbe870='next'==_0x5c2ba3?0x1:-0x1;function _0x536860(_0x317c8d){const _0x236226=(_0x317c8d+_0xcbe870+_0x3e5a86['length'])%_0x3e5a86['length'];return{'siblingIndex':_0x236226,'siblingPart':_0x3e5a86[_0x236226]};}const _0x5125c8=_0x3e5a86['findIndex'](_0x2f0bc7=>_0x2f0bc7['index']==_0x41b63d);let {siblingIndex:_0x3f8363,siblingPart:_0x3dff46}=_0x536860(_0x5125c8);for(;!this['_getUserPresentableContentPartDocumentRange'](_0xb2a219,_0x290cb7,_0x3dff46);)if({siblingIndex:_0x3f8363,siblingPart:_0x3dff46}=_0x536860(_0x3f8363),_0x3f8363===_0x5125c8)return null;return _0x3dff46['index'];}['_getUserPresentableContentPartDocumentRange'](_0x1d14b3,_0x4a8c52,_0x5c5720){const _0x4edbc4=_0x4a8c52['changeGroups'];if(!_0x5c5720['hasChanges'])return null;const _0x449fa5=_0x4edbc4['find'](_0x51e60d=>_0x51e60d['index']==_0x5c5720['index']);if('pending'!==_0x449fa5?.['state'])return null;if('destroyed'===_0x449fa5?.['editor']['state'])return _0x4a8c52['setChangeGroupState'](_0x5c5720['index'],'outdated'),null;const _0x5a6e4b=this['_getDocumentRangeForReplyChanges'](_0x1d14b3,_0x5c5720['index']);if(!_0x5a6e4b)return _0x4a8c52['setChangeGroupState'](_0x5c5720['index'],'outdated'),null;const {range:_0x3507f3,currentIndex:_0x5096de}=_0x5a6e4b;return'$graveyard'==_0x3507f3['root']['rootName']?(_0x4a8c52['setChangeGroupState'](_0x5096de,'outdated'),null):_0x5a6e4b['range'];}['_getDocumentRangeForReplyChanges'](_0xc09a12,_0x1bddd8){const {reply:_0x29d065,interaction:_0x44b491}=this['getInteractionAndReplyById'](_0xc09a12),_0x17a55a=_0x29d065['changeGroups']['filter'](_0x27d95d=>'pending'==_0x27d95d['state']),_0x164437=_0x17a55a['map'](_0xbca5b1=>_0x29d065['changeGroups']['indexOf'](_0xbca5b1));void 0x0===_0x1bddd8&&(_0x1bddd8=_0x164437[0x0]);const _0x21ecdc=_0x164437['indexOf'](_0x1bddd8);if(-0x1==_0x21ecdc)return null;const _0x2a699f=_0x17a55a[_0x21ecdc],_0x419921=_0x2a699f['editor'];if('destroyed'===_0x419921['state'])return null;const _0x5025b8=_0x29d065['documentContextContent']['get'](_0x2a699f['documentId']),_0x5b8f1f=new _0xe22c67([]),_0x501c8e=new _0xe22c67([]);for(const _0x498913 of _0x2a699f['changes'])if('removed'!=_0x498913['type']&&_0x501c8e['children']['push'](_0x498913['node']['cloneNode'](!0x0)),'new'!=_0x498913['type']){const _0x20a8d8=_0x4fe1af(_0x3f32e0=>Xi(_0x3f32e0,'data-id')==_0x498913['id'],_0x5025b8,!0x0);_0x5b8f1f['children']['push'](_0x20a8d8['cloneNode'](!0x0));}if(0x0==_0x5b8f1f['children']['length']){if(_0x2a699f['changes'][0x0]['anchorId']){const _0x51be31=Yi('data-id',_0x2a699f['changes'][0x0]['anchorId'],_0x5025b8);_0x5b8f1f['children']['unshift'](_0x51be31['cloneNode'](!0x0)),_0x501c8e['children']['unshift'](_0x51be31['cloneNode'](!0x0)),_0x51be31['nextSibling']&&(_0x5b8f1f['children']['push'](_0x51be31['nextSibling']['cloneNode'](!0x0)),_0x501c8e['children']['push'](_0x51be31['nextSibling']['cloneNode'](!0x0)));}else{const _0x942d0e=_0x5025b8['children'][0x0];if(!_0x942d0e)return null;_0x5b8f1f['children']['push'](_0x942d0e['cloneNode'](!0x0)),_0x501c8e['children']['push'](_0x942d0e['cloneNode'](!0x0));}}const _0x3101b4=_0x44b491['getDocumentContext'](),_0x50da76=_0x3101b4['content']||_0x3101b4['documents']['find'](_0x4dd7c6=>_0x4dd7c6['id']==_0x2a699f['documentId'])['content'],_0x2e3f53=_0x419921['model']['document']['getRoot'](_0x2a699f['rootName']),_0x32e229=_0x419921['data']['parse'](_0x50da76,_0x2e3f53),_0x3af58c=Ki(_0x5b8f1f),_0x56ae2f=_0x419921['data']['parse'](_0x3af58c,_0x2e3f53),_0x20c44e=_0x419921['data']['parse'](_0x3af58c,_0x2e3f53),_0xcbb5b4=_0x419921['model']['createPositionAt'](_0x56ae2f,0x0),_0x47f54b=Ki(_0x501c8e),_0x53dded={'targetEditor':_0x419921,'anchor':_0xcbb5b4,'markDeletions':!0x1},_0x1eb8fb=_0x419921['plugins']['get'](_0x34a64f)['getDiff'](_0x3af58c,_0x47f54b,_0x53dded)['getOperations']();if(!_0x1eb8fb['length'])return null;_0x419921['model']['change'](_0x57bd6c=>{for(const _0x38b6ed of _0x1eb8fb)if('remove'==_0x38b6ed['type']){const _0x54889=_0x38b6ed['sourcePosition'],_0x4dbeff=_0x38b6ed['howMany'],_0x2b52a8=new _0x365f09(_0x54889,_0x4dbeff);_0x57bd6c['batch']['addOperation'](_0x2b52a8),_0x419921['model']['applyOperation'](_0x2b52a8);}else'marker'!==_0x38b6ed['type']&&(_0x38b6ed['baseVersion']=null,_0x38b6ed['isDocumentOperation']=!0x1,_0x57bd6c['batch']['addOperation'](_0x38b6ed),_0x419921['model']['applyOperation'](_0x38b6ed));});const _0xe1ba74=cs(_0x419921,_0x1eb8fb,_0x56ae2f);us(_0x419921['model'],_0xe1ba74);const _0x168c7e=_0xe1ba74['getFirstRange']()['start']['path']['slice'](),_0x154768=_0xe1ba74['getFirstRange']()['end']['path']['slice'](),_0x10bc0f=[];let _0x1917e3=_0x56ae2f,_0x5d338f=_0x20c44e;for(let _0x49bd18=0x0;_0x49bd18<_0x154768['length'];_0x49bd18++){const _0x53ed25=_0x1917e3['maxOffset']-_0x154768[_0x49bd18];_0x10bc0f[_0x49bd18]=_0x5d338f['maxOffset']-_0x53ed25,_0x1917e3=_0x1917e3['getChildAtOffset'](_0x154768[_0x49bd18]),_0x5d338f=_0x5d338f['getChildAtOffset'](_0x10bc0f[_0x49bd18]);}const _0x159b33=_0x419921['model']['createRange'](_0x419921['model']['createPositionFromPath'](_0x20c44e,_0x168c7e),_0x419921['model']['createPositionFromPath'](_0x20c44e,_0x10bc0f)),_0x2dfb4a=_0x20c44e['getChild'](0x0)['getAttribute'](_0x248cc9),_0x406601=Array['from'](_0x32e229['getChildren']())['find'](_0x21cef6=>_0x21cef6['getAttribute'](_0x248cc9)==_0x2dfb4a)['getPath'](),_0x34fa32=_0x159b33['start']['path']['slice'](),_0x5a7ae3=_0x159b33['end']['path']['slice']();_0x34fa32[0x0]=_0x406601[0x0]+_0x34fa32[0x0],_0x5a7ae3[0x0]=_0x406601[0x0]+_0x5a7ae3[0x0];let _0x1ca1e9=_0x419921['model']['createRange'](_0x419921['model']['createPositionFromPath'](_0x419921['model']['document']['getRoot'](_0x2a699f['rootName']),_0x34fa32),_0x419921['model']['createPositionFromPath'](_0x419921['model']['document']['getRoot'](_0x2a699f['rootName']),_0x5a7ae3));const _0x34bc38=_0x3101b4['documents']['find'](_0x4da971=>_0x4da971['id']==_0x2a699f['documentId'])['version'],_0x4dc737=_0x419921['model']['document']['history']['getOperations'](_0x34bc38);for(const _0x55c3a9 of _0x4dc737)_0x1ca1e9=_0x5ca7e7['_createFromRanges'](_0x1ca1e9['getTransformedByOperation'](_0x55c3a9));return{'range':_0x1ca1e9,'currentIndex':_0x1bddd8,'targetEditor':_0x419921};}['_integrateEditorBalloon'](_0x236bb1){if(!_0x236bb1['plugins']['has']('AIChatBalloon'))return;const _0x4562bf=_0x236bb1['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x4562bf['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x4562bf,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x59be0e,partIndex:_0x485ebb}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x459948}=this['getInteractionAndReplyById'](_0x59be0e),_0x236813=_0x459948['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x485ebb});_0x4562bf['updateContent']({'part':_0x236813[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x4562bf,'applySuggestion',()=>{const {replyId:_0x3a37a9,partIndex:_0x5e2616}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x3a37a9,'partIndex':_0x5e2616}),_0x4562bf['setState']('accepted');}),this['listenTo'](_0x4562bf,'insertSuggestion',()=>{const {replyId:_0x3adbfe,partIndex:_0x3dcc2d}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x3adbfe,'partIndex':_0x3dcc2d}),_0x4562bf['setState']('accepted');}),this['listenTo'](_0x4562bf,'rejectSuggestion',()=>{const {replyId:_0x4829ec,partIndex:_0x424517}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x4829ec,'partIndex':_0x424517}),_0x4562bf['setState']('rejected');}),this['listenTo'](_0x4562bf,'showNext',()=>{const {replyId:_0x314dc5,partIndex:_0x3759e9}=this['_currentPreviewedChangeGroup'],_0x1cba77=this['_getPresentableSiblingContentPartIndex'](_0x314dc5,_0x3759e9,'next');null!==_0x1cba77&&this['_openBalloonFor'](_0x314dc5,_0x1cba77);}),this['listenTo'](_0x4562bf,'showPrevious',()=>{const {replyId:_0x3d6c61,partIndex:_0x4bec2c}=this['_currentPreviewedChangeGroup'],_0x45404d=this['_getPresentableSiblingContentPartIndex'](_0x3d6c61,_0x4bec2c,'previous');null!==_0x45404d&&this['_openBalloonFor'](_0x3d6c61,_0x45404d);}),this['listenTo'](_0x4562bf,'dialogClosed',(_0x2e9de9,{id:_0x165139})=>{if('aiChatBalloon'!==_0x165139)return;const {replyId:_0x409f5e,partIndex:_0x4bba9b}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x409f5e,'index':_0x4bba9b,'isActive':!0x1}),this['_activeBalloon']===_0x4562bf&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x302471){if(this['_channelsToEditors']['set'](_0x302471['config']['get']('collaboration.channelId'),_0x302471),this['_integrateEditorBalloon'](_0x302471),this['addCurrentDocumentToChatContext'](),_0x302471['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x302471['plugins']['has']('Undo')){const _0x50f646=_0x302471['commands']['get']('undo'),_0x498bfb=_0x302471['commands']['get']('redo');this['listenTo'](_0x50f646,'revert',(_0xb1ba83,_0x530b65,_0x5047ab)=>{const _0x3874e4=this['_batchToChanges']['get'](_0x530b65);if(!_0x3874e4)return;const _0x38f3cc=this['activeConversation']['getInteraction'](_0x3874e4['interactionId']),_0x4fdcf5=_0x38f3cc?.['getReply'](_0x3874e4['replyId']);this['_batchToChanges']['delete'](_0x530b65),_0x38f3cc&&_0x4fdcf5&&(_0x3874e4['indexes']['forEach'](_0x3d5984=>_0x4fdcf5['setChangeGroupState'](_0x3d5984,'pending')),this['_batchToChanges']['set'](_0x5047ab,_0x3874e4));}),this['listenTo'](_0x498bfb,'revert',(_0x3d0a6b,_0x2d5ed3,_0x122ab6)=>{const _0x25c197=this['_batchToChanges']['get'](_0x2d5ed3);if(!_0x25c197)return;const _0x10539f=this['activeConversation']['getInteraction'](_0x25c197['interactionId']),_0x5d8130=_0x10539f?.['getReply'](_0x25c197['replyId']);this['_batchToChanges']['delete'](_0x2d5ed3),_0x10539f&&_0x5d8130&&(_0x25c197['indexes']['forEach'](_0x2b8829=>_0x5d8130['setChangeGroupState'](_0x2b8829,'accepted')),this['_batchToChanges']['set'](_0x122ab6,_0x25c197));});}const _0x1d7d25=_0x302471['config']['get']('ai.chat.context');_0x1d7d25['alwaysAddSelection']&&_0x1d7d25['document']['enabled']&&this['listenTo'](_0x302471['model']['document']['selection'],'change:range',(_0x511804,_0x23ea75)=>{if(!_0x23ea75['directChange'])return;'chat'===_0x302471['plugins']['get']('AITabs')['view']['activeTab']&&(_0x302471['model']['hasContent'](_0x302471['model']['document']['selection'])?this['addSelectionToChatContext'](_0x302471):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x33add0=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x2748c7=await _0x33add0['getConversations']();return _0x2748c7['length']?_0x2748c7[0x0]['id']:'new';}catch(_0x522faa){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x522faa})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x2eeb59={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x2eeb59);}catch(_0x3cf2aa){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2eeb59['id']||at()}),console['error'](_0x3cf2aa),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x6d730b,modelId:_0x407704}={}){this['_closeActiveBalloon']();let _0x488cf7=_0x407704;_0x488cf7||(_0x6d730b||!this['activeConversation']?_0x488cf7=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x488cf7=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x24c4d5=this['getGroupId'](),_0x1e4d1b=_0x6d730b||at();let _0x4b871a;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x488cf7,'conversationId':_0x1e4d1b,'group':_0x24c4d5,'locale':this['context']['locale'],'isFromHistory':!!_0x6d730b,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0xcdb60a=>this['_aiEditing']['getSessionId'](_0xcdb60a)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x467552,_0x11d157)=>{this['_aiChatUi']['createConversation'](_0x11d157),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x6d730b||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x4cea2a,_0x3f01b0)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x3f01b0['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x26e094=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x26e094);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x14fe60=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x14fe60);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x368d28,_0x408c1a)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x408c1a,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x12f270,_0x3abdba)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3abdba,{'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',(_0xd5df0e,_0x1c9f1e)=>{this['_aiChatUi']['removeFeedInteraction'](_0x1c9f1e['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x2daaac,_0x23ed97,_0x3ba2ae)=>{this['_updateConversationTitle'](_0x23ed97,_0x3ba2ae);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x2643b9,_0x1f856d)=>{void 0x0!==_0x4b871a&&_0x4b871a!==_0x1f856d['id']&&this['_updateReplyContentThrottled']['flush'](),_0x4b871a=_0x1f856d['id'],_0x1f856d['isFromHistory']?await this['_updateReplyContent']({'reply':_0x1f856d}):await this['_updateReplyContentThrottled']({'reply':_0x1f856d});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x50e002,{reply:_0x20ee3c,index:_0x1e3cc1,state:_0x12efb7})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x20ee3c['id'],'index':_0x1e3cc1,'state':_0x12efb7}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x20ee3c['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x1e3cc1&&this['_activeBalloon']?.['setState'](_0x12efb7);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x54a22e,_0x8e16d8)=>{if(this['_aiChatUi']['addContextItem'](_0x8e16d8['contextItem'],_0x8e16d8['isLoading']),'selection'===_0x8e16d8['contextItem']['type']){const _0x242cc3=ps(this['context']),_0x18cce0=[..._0x242cc3['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x242cc3,'ranges':_0x18cce0,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x458d55,_0x568367)=>{this['_aiChatUi']['removeContextItem'](_0x568367['uiId']),'current-document'==_0x568367['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x568367['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x33395d,_0x44d486)=>{this['_aiChatUi']['setContextItemLoading'](_0x44d486['contextItem']['uiId'],_0x44d486['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0xfe2f6d,_0x4a1918)=>{this['_aiChatUi']['setConversationContext'](_0x4a1918['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x593558,_0x546436)=>{this['_aiChatUi']['setAddContextOptions'](_0x546436['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x23ea23,_0x532fd2)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x532fd2['sourceId'],_0x532fd2['source'],_0x532fd2['resources'],_0x532fd2['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x34970f,_0x5a667b)=>{this['_aiChatUi']['updateResourceState'](_0x5a667b['sourceId'],_0x5a667b['resourceId'],_0x5a667b['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x4d7b5d,_0x1778b1)=>{this['_aiChatUi']['updateCapabilities'](_0x1778b1);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x92b76d,_0x2f1498)=>{const _0x30975a=(await this['_aiChatModels']['getAll']())['find'](_0x2bec86=>_0x2bec86['id']===_0x2f1498['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x30975a,_0x2f1498['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x236b4f,{error:_0xfea705,interactionId:_0x289831,fileName:_0x190bc2,url:_0x48078c,sourceId:_0x1f205a,sourceLabel:_0x3df9f1})=>{const _0x2138cc=_0x289831?_0x289831+':'+at():at();_0xfea705['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x2138cc}):_0xfea705['message']['startsWith']('ai-chat-conversation-init-failed')||_0xfea705['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x190bc2),'id':_0x2138cc}):_0xfea705['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x48078c),'id':_0x2138cc}):_0xfea705['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x2138cc}):_0xfea705['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x2138cc}):_0xfea705['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x1f205a&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x1f205a),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x3df9f1||'source'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x2138cc}),this['_logError'](_0xfea705)):_0xfea705['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x2138cc}),this['_logError'](_0xfea705)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x2138cc}),this['_logError'](_0xfea705));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x6d730b||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x3d8dab,attributes:_0x2f02bf}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x980f07=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x980f07);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x3d8dab,'attributes':_0x2f02bf});}['_logError'](_0x15e4bb){Ct(_0x15e4bb['message'],_0x15e4bb['data']);}['_removeFromContext'](_0x194bbc){this['activeConversation']?.['removeFromContext'](_0x194bbc);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x4cb0bf){const [_0x342934,_0x8f10f3]=_0x4cb0bf['split'](':'),_0x24da9a=this['activeConversation']['getInteraction'](_0x342934),_0x439565=_0x24da9a['getReply'](_0x8f10f3);return{'interaction':_0x24da9a,'reply':_0x439565};}['_scrollToSuggestionRange'](_0xf3138d,_0x354fa1=!0x1,_0xaff3a2){const _0x438f63={'target':_0xaff3a2['editing']['view']['domConverter']['viewRangeToDom'](_0xaff3a2['editing']['mapper']['toViewRange'](_0xf3138d)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x354fa1};_0x354fa1&&(_0x438f63['alignToTop']=!0x0),Tt(_0x438f63);}['_updateConversationTitle'](_0x52820a,_0x28b2f5=!0x1){this['_aiChatUi']['setConversationTitle'](_0x52820a||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x28b2f5);}['_addFeedItemReply'](_0xcc21d){'text'===_0xcc21d['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xcc21d):this['_aiChatUi']['addFeedItemAISuggestion'](_0xcc21d);}async['_updateReplyContent']({reply:_0x5815a7,renderingStrategy:_0xb6e8cf}){const {id:_0x4012dc,interactionId:_0x1249f8,isDone:_0x4f69fd,type:_0x2158db,parsedContent:_0x173f13}=_0x5815a7,_0x4517b0=_0x1249f8+':'+_0x4012dc;if('modification'===_0x2158db){const _0xaeb7bd=_0x5815a7['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4517b0,'parts':_0xaeb7bd,'isDone':_0x4f69fd,'skipLoadingEffects':_0x5815a7['isFromHistory']});}else'text'===_0x2158db&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x4517b0,'parsedContent':_0x173f13['get']('text'),'renderingStrategy':_0xb6e8cf,'isDone':_0x4f69fd});_0x4f69fd&&_0x5815a7['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x4517b0,_0x5815a7['sources']);}['_updateReplyContentThrottled']=_0x92dabe(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x9a09ae=this['activeConversation']?.['lastInteraction'];_0x9a09ae&&(_0x9a09ae['stop'](),this['_aiChatUi']['stopInteraction'](_0x9a09ae)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x159c24=this['activeConversation']?.['lastInteraction'];if(_0x159c24){for await(const _0x5eca9c of _0x159c24['replies'])this['_aiChatUi']['hasFeedItem'](_0x5eca9c['id'])||this['_addFeedItemReply'](_0x5eca9c),await this['_updateReplyContent']({'reply':_0x5eca9c,'renderingStrategy':'static'});}}['_updateRatings'](_0x52fb5a){const _0x3f36d4={'positiveCount':_0x52fb5a['changeGroups']['filter'](_0x1dc222=>'accepted'===_0x1dc222['state'])['length'],'totalCount':_0x52fb5a['changeGroups']['length'],'modificationId':_0x52fb5a['id']},_0x508b04=this['activeConversation']['getInteraction'](_0x52fb5a['interactionId'])['messageId'];_0x508b04&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x508b04,_0x3f36d4);}['_getAIChatFeedAPI'](_0x44669a){const _0x5162d2=this['_aiChatUi'],_0x68d59c=()=>{_0x44669a['resetWebSearchState'](),_0x44669a['resetReasoningState'](),_0x5162d2['clearLoadingMessage']();},_0x3264dc=()=>{_0x44669a['currentReply']&&(_0x44669a['currentReply']['done'](),_0x44669a['currentReply']=void 0x0);};return{'insertTextReply':(_0x17d2a4,_0x3a7d11)=>{_0x3264dc(),_0x68d59c();const _0x556426=_0x44669a['currentReply']=_0x44669a['createReply']({'type':'text','interactionId':_0x44669a['id'],'id':_0x3a7d11||at(),'channelsToEditors':this['_channelsToEditors']});return _0x556426['appendContent'](_0x17d2a4),_0x3264dc(),_0x556426;},'insertCustomElement':async(_0x394ee6,_0x577270)=>(_0x3264dc(),_0x68d59c(),_0x5162d2['addFeedItemCustomElement'](_0x394ee6,_0x577270||at())),'setLoadingMessage':_0x22ac6e=>{_0x5162d2['setLoadingMessage'](_0x22ac6e);},'clearLoadingMessage':()=>{_0x5162d2['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ms(this['context'])['find'](_0x4551b9=>'destroyed'!==_0x4551b9['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const Rs='ai-selection',bs=['br'];class AIEditing extends _0x464fb9{constructor(_0x41bc48){super(_0x41bc48),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'](_0x2f59e6){let _0x57add5=this['_sessionIdByEditor']['get'](_0x2f59e6);return!_0x57add5&&(_0x57add5=_0x2f59e6['plugins']['has']('RealTimeCollaborationClient')&&_0x2f59e6['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x2f59e6,_0x57add5)),_0x57add5;}async['getDocumentData'](){const _0x546860=ms(this['context']);if(!_0x546860['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x1091e1=[],_0x43fbb0=new Set();for(const _0x4510a5 of _0x546860){const _0x4533a5=_0x4510a5['config']['get']('roots')||{};for(const _0x1ceeba of _0x4510a5['model']['document']['getRoots']()){if('$graveyard'===_0x1ceeba['rootName'])continue;const _0x125128=await this['_getDocumentDataForEditorRoot'](_0x4510a5,_0x1ceeba,_0x43fbb0),_0xecb81e=_0x4533a5[_0x1ceeba['rootName']];let _0x5c62f8;_0xecb81e?.['label']?_0x5c62f8=_0xecb81e['label']:(wt('ai-document-root-missing-label',{'editor':_0x4510a5,'rootConfig':_0xecb81e}),_0x5c62f8=_0x1ceeba['rootName']),_0x1091e1['push']({'editor':_0x4510a5,'rootName':_0x1ceeba['rootName'],'content':_0x125128['content'],'version':_0x125128['version'],'sessionId':this['getSessionId'](_0x4510a5),'channelId':_0x4510a5['config']['get']('collaboration.channelId'),'selections':_0x125128['selections'],'name':_0x5c62f8,'description':_0xecb81e?.['description']});}}return _0x1091e1;}async['_getDocumentDataForEditorRoot'](_0x2433c5,_0x9663b6,_0x2d095f){const _0x51b111=_0x2433c5['data']['toView'](_0x9663b6,{'convertAiChatSelectionMarker':!0x0}),_0xb4b576=new _0xce794f(_0x2433c5['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x51b111,_0xb4b576,_0x2d095f);let _0x19e081=await this['_getDocumentDataStringFromView'](_0x51b111,_0x2433c5);const _0x58256c=this['_getMarkersInDocumentOrder'](_0x2433c5,_0x9663b6),_0x2ac771=[];for(const _0x18b22d of _0x58256c){const _0x4e9076='<'+_0x18b22d['name']+':start></'+_0x18b22d['name']+':start>',_0x383307=_0x19e081['indexOf'](_0x4e9076);_0x19e081=_0x19e081['substring'](0x0,_0x383307)+_0x19e081['substring'](_0x383307+_0x4e9076['length']);const _0x2bacfb='<'+_0x18b22d['name']+':end></'+_0x18b22d['name']+':end>',_0x5f18d3=_0x19e081['indexOf'](_0x2bacfb);_0x19e081=_0x19e081['substring'](0x0,_0x5f18d3)+_0x19e081['substring'](_0x5f18d3+_0x2bacfb['length']),_0x2ac771['push']({'markerName':_0x18b22d['name'],'start':_0x383307,'end':_0x5f18d3,'htmlFragment':_0x19e081['substring'](_0x383307,_0x5f18d3)});}return{'content':_0x19e081,'version':_0x2433c5['model']['document']['version'],'selections':_0x2ac771};}['afterInit'](){this['context']instanceof _0x2fdbcb?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x4e80ac,_0x987c3c)=>{_0x987c3c['on']('ready',()=>{this['_integrateEditor'](_0x987c3c);});});}['_setOutputDataProcessor'](_0x5ebfb6){this['_outputDataProcessor']=_0x5ebfb6;}async['_getDocumentDataStringFromView'](_0x1b41d9,_0x232f54){let _0x3800ae;if(this['_outputDataProcessor']){const _0x340435=_0x232f54['data']['processor']['domConverter']['viewToDom'](_0x1b41d9),_0x341a74=await this['_outputDataProcessor'](_0x340435);_0x3800ae=_0x232f54['data']['processor']['htmlWriter']['getHtml'](_0x341a74);}else _0x3800ae=_0x232f54['data']['processor']['toData'](_0x1b41d9);return _0x3800ae;}['_integrateEditor'](_0x329850){if(!_0x329850['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x329850);_0x329850['ui']['focusTracker']['on']('change:isFocused',(_0x3459dc,_0xa76477,_0x2a3136)=>{_0x2a3136&&(this['_lastContentFocusedEditor']=_0x329850);}),_0x329850['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x329850&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x329850['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Rs,'view':({markerName:_0x10f164})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x10f164['split'](':')[0x1]],'priority':0xc})}),_0x329850['conversion']['for']('dataDowncast')['markerToElement']({'model':Rs+':context','view':(_0x1f02ab,{writer:_0x3df1ea,options:_0x6b85b9})=>_0x6b85b9['convertAiChatSelectionMarker']?_0x3df1ea['createUIElement'](_0x1f02ab['markerName']+':'+(_0x1f02ab['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x1634c1){const _0x4a5e7e=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x1634c1);const _0x33403e=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4a5e7e,_0x33403e);}['hideFakeVisualSelection'](_0x5486d4){const _0x55090f=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x5486d4);const _0x4ec256=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x55090f,_0x4ec256);}async['modelToDataWithIds'](_0x1341d1,_0x352d77){const _0x67cd1=_0x352d77['data']['toView'](_0x1341d1),_0x4167e5=new _0xce794f(_0x352d77['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x67cd1,_0x4167e5),this['_getDocumentDataStringFromView'](_0x67cd1,_0x352d77);}['_setDataIdsOnChildren'](_0xe7ceaa,_0x66b709,_0x418b54=new Set()){let _0x2ea9de=!0x1;for(const _0x341dc8 of _0xe7ceaa['getChildren']()){if(!_0x341dc8['is']('view:element')||bs['includes'](_0x341dc8['name']))continue;const _0x43dd8=_0x341dc8['is']('view:containerElement'),_0xc97113=_0x341dc8['is']('view:emptyElement'),_0x4f846f=_0x341dc8['is']('view:rawElement'),_0x4c5862=this['_setDataIdsOnChildren'](_0x341dc8,_0x66b709,_0x418b54);if(_0x341dc8['hasAttribute']('data-id')){_0x2ea9de=!0x0,_0x418b54['add'](_0x341dc8['getAttribute']('data-id'));continue;}(_0x43dd8||_0xc97113||_0x4f846f||_0x4c5862)&&(_0x66b709['setAttribute']('data-id',this['_nextDataId'](_0x418b54),_0x341dc8),_0x2ea9de=!0x0);}return _0x2ea9de;}['_nextDataId'](_0x54d101){let _0x54b1f7;do{_0x54b1f7='';for(let _0x5f32ba=0x0;_0x5f32ba<0x4;_0x5f32ba++)_0x54b1f7+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x54d101['has'](_0x54b1f7));return _0x54d101['add'](_0x54b1f7),_0x54b1f7;}['getSelectionText'](_0x125858){const _0x56c352=(_0x125858?_0x125858['model']:ps(this['context'])['model'])['document']['selection'],_0x5bc74d=[],_0x4078d2=Array['from'](_0x56c352['getRanges']());_0x4078d2['sort']((_0x56cd81,_0x4a1f83)=>_0x56cd81['start']['isBefore'](_0x4a1f83['start'])?-0x1:0x1);for(const _0x239342 of _0x4078d2)for(const _0x1654ec of _0x239342['getItems']())_0x1654ec['is']('$textProxy')?_0x5bc74d['push'](_0x1654ec['data']):_0x1654ec['is']('element')&&_0x5bc74d['length']>0x0&&'\x20'!==_0x5bc74d[_0x5bc74d['length']-0x1]&&_0x5bc74d['push']('\x20');return _0x5bc74d['length']?'\x22'+_0x5bc74d['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x56da42){for(let _0x4ab32d=0x0;_0x4ab32d<this['_fakeSelections']['length'];_0x4ab32d++)if(this['_fakeSelections'][_0x4ab32d]['id']==_0x56da42)return void this['_fakeSelections']['splice'](_0x4ab32d,0x1);}['_addFakeSelection'](_0x4b2c02){this['_removeFakeSelectionById'](_0x4b2c02['id']),ft(this['_fakeSelections'],_0x4b2c02);}['_refreshFakeSelection'](_0x331d6a,_0x46844f){if(_0x331d6a==_0x46844f)return;const _0x437321=_0x331d6a?_0x331d6a['editor']:null,_0x2dbe6b=_0x46844f?_0x46844f['editor']:null,_0x53ea64=(_0x546344,_0x19817d)=>{const _0x2e438c=_0x19817d['model']['markers']['getMarkersGroup'](Rs);for(const _0xd21ad2 of _0x2e438c)_0x546344['removeMarker'](_0xd21ad2);},_0x14f330=(_0x23a2c6,_0x52370f,_0x2b8255)=>{const _0x1e0f98=_0x52370f['model'];for(let _0x57fa47=0x0;_0x57fa47<_0x2b8255['ranges']['length'];_0x57fa47++){let _0x371e42=_0x2b8255['ranges'][_0x57fa47];const _0x3fc13f=Rs+':'+_0x2b8255['id']+':'+_0x57fa47;if(_0x371e42['start']['isAtEnd']){const _0x3280ba=_0x371e42['start']['getLastMatchingPosition'](({item:_0x2cfe82})=>!_0x1e0f98['schema']['isContent'](_0x2cfe82),{'boundaries':_0x371e42});_0x371e42=_0x23a2c6['createRange'](_0x3280ba,_0x371e42['end']);}_0x23a2c6['addMarker'](_0x3fc13f,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x371e42});}};_0x437321&&_0x2dbe6b&&_0x437321===_0x2dbe6b&&_0x46844f?_0x437321['model']['change'](_0x8a5e1a=>{_0x53ea64(_0x8a5e1a,_0x437321),_0x14f330(_0x8a5e1a,_0x2dbe6b,_0x46844f);}):(_0x437321&&_0x437321['model']['change'](_0x3d1bc4=>_0x53ea64(_0x3d1bc4,_0x437321)),_0x2dbe6b&&_0x46844f&&_0x2dbe6b['model']['change'](_0x4587=>_0x14f330(_0x4587,_0x2dbe6b,_0x46844f)));}['_getMarkersInDocumentOrder'](_0x5087e5,_0x3d256b){const _0xe759eb=Array['from'](_0x5087e5['model']['markers']['getMarkersGroup'](Rs+':context'));return(_0x3d256b?_0xe759eb['filter'](_0x5d675b=>{const _0x2e4ae3=_0x5d675b['getRange']();return _0x2e4ae3&&_0x2e4ae3['root']['rootName']===_0x3d256b['rootName'];}):_0xe759eb)['sort']((_0x531145,_0x2b7f4b)=>_0x531145['getStart']()['isBefore'](_0x2b7f4b['getStart']())?-0x1:_0x531145['getStart']()['isAfter'](_0x2b7f4b['getStart']())?0x1:0x0);}}const Ss=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Os=[...Ss,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function vs(_0x502492){const _0x2739d3=new AbortController();return{'promise':new Promise((_0x294403,_0x2375ce)=>{const _0x1bcc66=setTimeout(_0x294403,_0x502492);_0x2739d3['signal']['addEventListener']('abort',()=>{clearTimeout(_0x1bcc66),_0x2375ce();});}),'abortController':_0x2739d3};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0xabe349){this['options']={'delay':_0xabe349?.['delay']??0xa,'textNodeStyle':_0xabe349?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x3a4ba9,targetElement:_0x2967f7,abortSignal:_0x538180}){this['isStreaming']&&this['stop'](),_0x538180?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x54175e(_0x3a4ba9,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0xb3113=0x0;_0xb3113<this['currentIndex'];_0xb3113++)this['nodesList'][_0xb3113]['shouldBeStreamed']=!0x0;do{const _0x3f743f=Date['now'](),_0x4af399=this['nodesList'][this['currentIndex']],_0x31b181=_0x3f743f-this['lastUpdateTime'];if(_0x4af399){_0x4af399['shouldBeStreamed']=!0x0;let _0x18a915=_0x4af399['parent'];for(;_0x18a915;)_0x18a915['shouldBeStreamed']=!0x0,_0x18a915=_0x18a915['parent'];}if(_0x31b181<this['options']['delay'])try{const {promise:_0x278953,abortController:_0x18cc3e}=vs(this['options']['delay']-_0x31b181);this['timeoutAbortController']=_0x18cc3e,await _0x278953;}catch(_0x55726c){return;}_0x1009c1(_0x2967f7,'<'+_0x2967f7['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x2967f7['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:_0x2abb07}){Array['from'](_0x2abb07['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x5ee5cf=>{_0x5ee5cf['replaceWith'](_0x5ee5cf['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x2c1ee7){let _0x59cf57='';if(function(_0x1355fd){return _0x13eb47(_0x1355fd);}(_0x2c1ee7)){for(const _0xa28489 of _0x2c1ee7['children'])_0x59cf57+=this['renderNode'](_0xa28489);}else{if(Ns(_0x2c1ee7)){if(!_0x2c1ee7['shouldBeStreamed'])return'';const _0x1de120=_0x2c1ee7,_0x1a9bc3=Object['entries'](_0x1de120['attribs'])['map'](([_0x6f5c81,_0x2a743b])=>_0x6f5c81+'=\x22'+_0x2a743b+'\x22')['join']('\x20');_0x59cf57+='<'+_0x1de120['tagName']+(_0x1a9bc3?'\x20'+_0x1a9bc3:'')+'>';for(const _0x26c205 of _0x1dc41b(_0x1de120))_0x59cf57+=this['renderNode'](_0x26c205);_0x59cf57+='</'+_0x1de120['tagName']+'>';}else{if(!ys(_0x2c1ee7))return'';if(!_0x2c1ee7['shouldBeStreamed'])return'';!function(_0x3daecc){if(!_0x3daecc['parent']||!Ns(_0x3daecc['parent']))return!0x1;if(!ks['includes'](_0x3daecc['parent']['tagName']))return!0x1;return!ti(_0x3daecc)['match'](/^\s*[<>]\s*$/);}(_0x2c1ee7)?_0x59cf57+=_0x15cd87(_0x2c1ee7):_0x59cf57+=_0x15cd87(new _0x5bc3c5('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x2c1ee7]));}}return _0x59cf57;}['getParsedDocumentNodeList'](){const _0x30b1dd=[];return function(_0x1444d7,_0x237c22){const _0x56a3ad=_0x3df323=>{if(_0x237c22(_0x3df323),_0x3df323 instanceof _0x552fe1)for(let _0x500870=0x0;_0x500870<_0x3df323['children']['length'];_0x500870++){const _0x5b6cf7=_0x3df323['children'][_0x500870];_0x56a3ad(_0x5b6cf7);}};for(let _0x1f2af9=0x0;_0x1f2af9<_0x1444d7['children']['length'];_0x1f2af9++)_0x56a3ad(_0x1444d7['children'][_0x1f2af9]);}(this['document'],_0x5c17bb=>{if(ys(_0x5c17bb)){const _0x4671f0=this['splitTextNodeIntoWordNodes'](_0x5c17bb);_0x4671f0['length']&&_0x30b1dd['push'](..._0x4671f0);}_0x5c17bb['isWordSplitSource']||_0x5c17bb['isWordSplitResult']||_0x30b1dd['push'](_0x5c17bb);}),_0x30b1dd;}['splitTextNodeIntoWordNodes'](_0x1bd0a7){if(_0x1bd0a7['isWordSplitSource']||_0x1bd0a7['isWordSplitResult'])return[];const _0xf75e05=ti(_0x1bd0a7)['match'](/(?:\s*\S+\s*)/g),_0x333f5d=[];if(_0xf75e05&&_0xf75e05['length']>0x1){for(const _0x15c68a of _0xf75e05){const _0x26d71f=new _0x5f1cc8(_0x15c68a);_0x26d71f['isWordSplitResult']=!0x0,_0x208787(_0x1bd0a7,_0x26d71f),_0x333f5d['push'](_0x26d71f);}_0x1bd0a7['isWordSplitSource']=!0x0,_0x2f3801(_0x1bd0a7);}return _0x333f5d;}}const ks=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ys(_0xb6582e){return _0x413ccf(_0xb6582e);}function Ns(_0x4935d1){return _0x1abf14(_0x4935d1);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x2fca97){super();const _0x170889=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x2fca97,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x170889['if']('isDone','ck-ai-chat__feed__item_done'),_0x170889['if']('isVisible','ck-hidden',_0x3cf997=>!_0x3cf997),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x28c893=>{_0x28c893['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x5e5844,_0x166133,_0xc69940){await this['htmlStreamer']['stream']({'document':_0x5e5844,'targetElement':_0x166133,'abortSignal':_0xc69940});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x2ae518,_0x3565a5){super(_0x2ae518),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x2ae518),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x2ae518,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x3565a5['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x185272=>_0x185272?_0x18eb20:_0x552934),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x8fa12c=new Lt();_0x8fa12c['content']=_0xe44a24,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x3565a5['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x8fa12c,{'tag':'span','children':[Mi(_0x2ae518,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const xs={'accepted':_0x443913,'rejected':_0x138663,'outdated':_0x138663};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x2d4220){super(_0x2d4220);const _0x47758a=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x47758a['to']('state',_0x570273=>'ck-ai-suggestion__content-part-state_'+_0x570273),_0x47758a['if']('isVisible','ck-hidden',_0x524b97=>!_0x524b97)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x47758a['to']('state',_0x1daa6f=>{switch(_0x1daa6f){case'accepted':return Mi(_0x2d4220,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x2d4220,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x2d4220,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x100700){this['state']=_0x100700;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=xs[this['state']],this['on']('change:state',()=>{this['content']=xs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x581a9a,_0x5e458a,_0x1cc04d){super(_0x581a9a);const _0x5edb94=Boolean(_0x1cc04d);this['set']('isEnabled',!_0x5edb94),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x386066=[];if(_0x5edb94){const _0x5e6cf0=new yt(_0x581a9a);_0x5e6cf0['set']({'label':Mi(_0x581a9a,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x23d873}),_0x5e6cf0['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x386066['push'](_0x5e6cf0);}else{_0x5e458a['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x581a9a),this['_applyButton']['set']({'label':Mi(_0x581a9a,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x443913}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0xb001d1=>!_0xb001d1),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x386066['push'](this['_applyButton'])),_0x5e458a['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x581a9a),this['_suggestButton']['set']({'label':Mi(_0x581a9a,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x374b23}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x386066['push'](this['_suggestButton']));const _0x3fa236=new yt(_0x581a9a);_0x3fa236['set']({'label':Mi(_0x581a9a,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x138663}),_0x3fa236['bind']('isEnabled')['to'](this),_0x3fa236['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x386066['push'](_0x3fa236);}this['items']['addMany'](_0x386066);const _0x15d851=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x15d851['if']('isVisible','ck-hidden',_0x5db19b=>!_0x5db19b)]}});}['setButtonsVisibility']({showApplyButton:_0xfe9516,showSuggestButton:_0x4ed992}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0xfe9516),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x4ed992);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x29d41c,{part:_0x17c4dc,uiIndex:_0x571d40,availableActions:_0x1ab316,areActionsDisabled:_0x1c37d8}){super(_0x29d41c),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x29d41c,_0x1ab316,_0x1c37d8),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x17c4dc['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x17c4dc['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x17c4dc['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x29d41c),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x29d41c,_0x571d40),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',(_0x17b498,_0x5e709c,_0x85a4e6,_0x173757)=>{'pending'===_0x173757?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x85a4e6?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x85a4e6),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x259007,_0x4f1937){super(_0x259007),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x259007,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x4f1937['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x22d3f4){super(_0x22d3f4),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0xe694ca,renderingStrategy:_0x2939b4,abortSignal:_0xdd8dd9}){const _0x5858e3=_0x54175e(_0xe694ca['content'],!0x0);for(const _0x1b9d01 of qi(_0x5858e3))_0x2f3801(_0x1b9d01);'streaming'===_0x2939b4?await this['htmlStreamer']['stream']({'document':_0x5858e3,'targetElement':this['element'],'abortSignal':_0xdd8dd9}):_0x1009c1(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x5858e3)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x316ee9,{part:_0x20ae87,uiIndex:_0x5ab8d3,areActionsDisabled:_0x15c52f,availableActions:_0xb81a3}){super(_0x316ee9);const _0x7228fe=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 _0x442912=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x15c52f;};this['on']('change:state',_0x442912),this['on']('change:isDone',_0x442912),_0x442912(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x316ee9,{'part':_0x20ae87,'uiIndex':_0x5ab8d3,'availableActions':_0xb81a3,'areActionsDisabled':_0x15c52f}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Ss)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x316ee9),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x7228fe['to']('state',_0x370d6f=>'ck-ai-suggestion__body__content-part_'+_0x370d6f),_0x7228fe['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x7228fe['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x7228fe['if']('isVisible','ck-hidden',_0x2aea08=>!_0x2aea08)]},'children':this['_children'],'on':{'mouseenter':_0x7228fe['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x20ae87['index']});}),'mouseleave':_0x7228fe['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x20ae87['index']});}),'click':_0x7228fe['to'](_0x3f4598=>{const _0x2a45ef=_0x3f4598['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2a45ef)&&this['fire']('showChangeInText',{'index':_0x20ae87['index']});})}});}async['updateContent']({part:_0x30e6ba,showUnchangedParts:_0x5ae387=!0x1,abortSignal:_0x4704a6}){this['partDefinition']=_0x30e6ba,this['isVisible']=this['partDefinition']['hasChanges']||_0x5ae387,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x30e6ba,'renderingStrategy':'static','abortSignal':_0x4704a6});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x38e392,_0x6e4a6d){super(_0x38e392),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x36ba4d=>!_0x36ba4d)]},'children':this['_createSkeletonItems'](_0x6e4a6d)});}['_createSkeletonItems'](_0x433b17){const _0x5e4735=['ck','ck-ai-skeleton__item'];return _0x433b17['map'](_0xe3b2f8=>{let _0x25b088='';switch(_0xe3b2f8['attributes']['align']){case'right':_0x25b088='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x25b088='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x25b088='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0xe3b2f8['tag'],'attributes':{'class':[..._0x5e4735,_0xe3b2f8['attributes']['class']?_0xe3b2f8['attributes']['class']:''],'style':'width:\x20'+_0xe3b2f8['attributes']['width']+';\x20height:\x20'+_0xe3b2f8['attributes']['height']+';'+_0x25b088}};});}}const Ls={'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':Ps(0x5,'100%','44px','right'),'aiChatResources':Ps(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 Ps(_0x306b8c,_0x3abb6d,_0x23262e,_0x522338){return new Array(_0x306b8c)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x3abb6d,'height':_0x23262e,'align':_0x522338}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x59e189){const _0x574a48=this['createTask'](_0x59e189);return this['queue']['push'](_0x574a48),this['_processQueue'](),_0x574a48['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(_0x512937=>{this['once']('_queueEmpty',()=>{_0x512937();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1cd907=this['queue']['shift']();try{await _0x1cd907['callback'](this['_abortController']['signal']),_0x1cd907['resolve']();}catch(_0x30a880){_0x1cd907['reject'](_0x30a880);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x282d97){let _0x58b24d,_0xd23c38;const _0x2b2134=new Promise((_0x4eedcd,_0x4b2080)=>{_0x58b24d=_0x4eedcd,_0xd23c38=_0x4b2080;});return{'callback':_0x282d97,'resolve':_0x58b24d,'reject':_0xd23c38,'completePromise':_0x2b2134};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x448a60){super(_0x448a60),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x448a60['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x4b6c7b){this['element']['innerHTML']=_0x4b6c7b;}}const Ds=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x466ff3,_0x425ec0=[...Ds],_0x211338){super(_0x466ff3);const _0x4b44df=this['bindTemplate'],_0x257ab8=Boolean(_0x211338);if(this['set']('isEnabled',!_0x257ab8),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x257ab8){const _0x417fd5=new yt(_0x466ff3);_0x417fd5['set']({'label':Mi(_0x466ff3,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x23d873}),_0x417fd5['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x3d4b61=new Nt(_0x466ff3);_0x3d4b61['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x466ff3,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x417fd5]}]}),this['children']['add'](_0x3d4b61);}else this['_applyChangesButton']=new yt(_0x466ff3),this['_applyChangesButton']['set']({'label':Mi(_0x466ff3,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x425ec0['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x466ff3),this['_insertSuggestionsButton']['set']({'label':Mi(_0x466ff3,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x425ec0['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x44a2dc=>{_0x44a2dc['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',_0x4b44df['if']('isVisible','ck-hidden',_0xaf3089=>!_0xaf3089)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x368794){this['isVisible']=_0x368794;}['_switchButtonLabelsPlurality'](_0x30a4a2){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x30a4a2?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x3acecd,_0x18414c){super(_0x3acecd),this['bodyCollection']=_0x18414c,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',_0x376605=>!_0x376605)]},'children':this['children']});const _0x216e8c=new Nt(this['locale']),_0x209fa8=new Lt();_0x209fa8['content']=_0x224392,_0x216e8c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x209fa8,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x216e8c),this['_setupBalloonPanel'](_0x3acecd);}['addSource'](_0x373a22){this['children']['add'](new AIWebSourceView(this['locale'],_0x373a22,this['balloonPanelView']));}['_setupBalloonPanel'](_0x4ac8ab){this['balloonPanelView']=new zt(_0x4ac8ab),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x52565d,_0x40bae8,_0x280953){super(_0x52565d),this['source']=_0x40bae8,this['balloonPanelView']=_0x280953,this['set']({'label':_0x40bae8['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x17565e=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x17565e['to'](()=>{window['open'](_0x40bae8['url'],'_blank');}),'mouseenter':_0x17565e['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x17565e['to'](()=>{this['_hideTooltip']();})}}),_0x40bae8['favicon']){const _0x29bbcc=new Nt(_0x52565d);_0x29bbcc['setTemplate']({'tag':'img','attributes':{'src':_0x40bae8['favicon']||_0x224392,'alt':_0x40bae8['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x29bbcc);}else this['set']('icon',_0x224392);}['_createTooltipContentView'](_0x10bf15,_0x5ee59d){const _0x468c76=new Nt(_0x10bf15),_0x485907=[];let _0x3cc39d;_0x5ee59d?.['favicon']?(_0x3cc39d=new Nt(_0x10bf15),_0x3cc39d['setTemplate']({'tag':'img','attributes':{'src':_0x5ee59d['favicon'],'alt':_0x5ee59d['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3cc39d=new Lt(),_0x3cc39d['content']=_0x224392,_0x3cc39d['extendTemplate']({'attributes':{'alt':_0x5ee59d['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x485907['push'](_0x3cc39d);const _0x35d41a=new Nt(_0x10bf15);_0x35d41a['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x5ee59d['url']},'children':[{'text':new URL(_0x5ee59d['url'])?.['hostname']}]}),_0x485907['push'](_0x35d41a);const _0x37d38f=new Nt(_0x10bf15);_0x37d38f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x485907});const _0xac616c=new Nt(_0x10bf15);return _0xac616c['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x5ee59d['title']['length']>0x190?_0x5ee59d['title']['substring'](0x0,0x190)+'...':_0x5ee59d['title']}]}),_0x468c76['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x37d38f,_0xac616c]}),_0x468c76;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['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 _0x1be46b=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x1be46b);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x1f2c99(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x23915a,_0x15fc45){super(_0x23915a);const {areActionsDisabled:_0x19f8fe,showUnchangedParts:_0x47c2ee,availableActions:_0x50e411}=_0x15fc45;this['_areActionsDisabled']=_0x19f8fe,this['_showUnchangedParts']=_0x47c2ee,this['_availableActions']=_0x50e411,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x23915a,Ls['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x23915a,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x23915a,_0x15fc45['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x15fc45['bodyCollection']),_0x15fc45['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Ss)['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'](_0x3a623c=>_0x3a623c instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x33a8a4,abortSignal:_0x103ac9,skipLoadingEffects:_0x2e8021}){this['_cachedContentParts']['length']?_0x33a8a4['forEach'](_0x1923e6=>{const _0x2e3fc8=this['_cachedContentParts']['findIndex'](_0x40fe8a=>_0x40fe8a['index']==_0x1923e6['index']);-0x1===_0x2e3fc8?this['_cachedContentParts']['push'](_0x1923e6):this['_cachedContentParts'][_0x2e3fc8]=_0x1923e6;}):this['_cachedContentParts']=_0x33a8a4;const _0x586925=this['_showUnchangedParts']?_0x33a8a4:_0x33a8a4['filter'](_0x2aebbe=>_0x2aebbe['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x586925['length']>0x1),_0x2e8021&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x3b95e8 of _0x586925)this['_updateContentPartsPromiseQueue']['enqueue'](async _0xb56fc6=>{let _0x3ec246=this['getPartView'](_0x3b95e8['index']);if(!_0x3ec246){if(_0x3ec246=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x3b95e8,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x3ec246['delegate'](...Ss)['to'](this),_0x3ec246['bind']('isTrackChangesOn')['to'](this),!_0x2e8021&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0xb56fc6),_0xb56fc6['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x3ec246,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x2e8021||this['_showSkeletonDebounced']();}await _0x3ec246['updateContent']({'part':_0x3b95e8,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0xb56fc6}),_0x3ec246['markAsDone']();});return _0x103ac9?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x478823,_0x55ce31){const _0x153a97=this['getPartView'](_0x478823);_0x153a97&&(_0x153a97['state']=_0x55ce31),this['hasPendingParts']='pending'==_0x55ce31||this['_contentPartViews']['some'](_0xd49507=>'pending'==_0xd49507['state']);}['setPartActive'](_0x26448d,_0x235ce1){if(!0x1===_0x26448d){for(const _0x4b634c of this['_contentPartViews'])_0x4b634c['isActive']=!0x1;}else{const _0x1ecfed=this['getPartView'](_0x26448d);_0x1ecfed&&(_0x1ecfed['isActive']=_0x235ce1);}}['updateSources'](_0x3f3e78){_0x3f3e78['forEach'](_0x34b31c=>this['_sourcesView']['addSource'](_0x34b31c)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x27e032){return this['_contentPartViews']['find'](_0x5099f3=>_0x5099f3['partDefinition']['index']==_0x27e032)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x5c9997=!this['_cachedContentParts']['find'](({hasChanges:_0x1954ee})=>_0x1954ee),_0x29fa3d=!!this['_cachedContentParts']['find'](({hasChanges:_0x5244b5})=>!_0x5244b5);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x29fa3d,_0x5c9997?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x1bc997=>_0x1bc997['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x5e8778){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x30e1bd=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x30e1bd>0x0){const {promise:_0x28c829,abortController:_0x32cacf}=vs(_0x30e1bd);_0x5e8778?.['addEventListener']('abort',()=>_0x32cacf['abort']()),await _0x28c829['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x4bf164=>_0x4bf164['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4cb394,_0x2f2c27,_0xd75941){super(_0x4cb394);const {showDiff:_0x27b793,areActionsDisabled:_0x5edd5e,showUnchangedParts:_0x502223,availableActions:_0x382b13}=_0x2f2c27;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4cb394,{'showDiff':_0x27b793}),this['headerView']['on']('toggleShowChanges',(_0x336e83,_0x1df1f0)=>{this['areChangesVisible']=_0x1df1f0['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x1df1f0['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4cb394,{'areActionsDisabled':_0x5edd5e,'showUnchangedParts':!!_0x502223,'availableActions':_0x382b13,'bodyCollection':_0xd75941}),this['bodyView']['delegate'](...Ss)['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'](_0x2ee14f){await this['bodyView']['updateContentParts'](_0x2ee14f);}['updateSources'](_0x2ea844){this['bodyView']['updateSources'](_0x2ea844);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x41f104,_0x1695a9,_0x231ffd){super(_0x1695a9),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x41f104,{'showDiff':_0x1695a9['showDiff'],'areActionsDisabled':_0x1695a9['areActionsDisabled'],'availableActions':_0x1695a9['availableActions']},_0x231ffd),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x11b0d0,_0x3d9eb9)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x3d9eb9['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',(_0x3207a2,{index:_0x1480ae})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1480ae});}),this['containerView']['on']('applySuggestion',(_0x21972e,{index:_0x1e2546}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x1e2546});}),this['containerView']['on']('insertSuggestion',(_0x1b3ef0,{index:_0x14a9bd}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x14a9bd});}),this['containerView']['on']('rejectSuggestion',(_0x5ce9da,{index:_0x27b782})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x27b782});}),this['containerView']['on']('mouseOverSuggestion',(_0x24740d,{index:_0x1962ea})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1962ea});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x2642d0,{index:_0x54d25d})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x54d25d});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x1822ad){await this['containerView']['updateContent'](_0x1822ad);}['updatePartState'](_0x2e387f,_0x1d3db3){this['containerView']['bodyView']['updatePartState'](_0x2e387f,_0x1d3db3);}['setPartActive'](_0x276c43,_0x4d23ca){!0x1===_0x276c43?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x276c43,_0x4d23ca);}['updateSources'](_0x440e70){this['containerView']['updateSources'](_0x440e70);}['getPartView'](_0x132e9f){return this['containerView']['bodyView']['getPartView'](_0x132e9f);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0xa4aeaa,_0x313487,_0x38b501){super(_0x313487),this['_bodyCollection']=_0x38b501,this['locale']=_0xa4aeaa,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),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':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x29f271,renderingStrategy:_0x9fe05f,abortSignal:_0x1f75c0}){'streaming'===_0x9fe05f?await this['streamIntoElement'](_0x29f271,this['replyContainer']['element'],_0x1f75c0):this['replyContainer']['element']['innerHTML']=_0x15cd87(_0x29f271);}['updateSources'](_0x603f0b){const _0x3c6595=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x3c6595['children']['addMany'](_0x603f0b['map'](_0xb73ae9=>new AIWebSourceView(this['locale'],_0xb73ae9,_0x3c6595['balloonPanelView']))),_0x3c6595['isVisible']=!0x0,this['children']['add'](_0x3c6595);}}class AISpinnerView extends xt{constructor(_0x1c2c33=void 0x0){super();const _0x42d8cd=_0x1c2c33?'ck-ai-spinner_'+_0x1c2c33:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x42d8cd]}});}}const Vs={'file':_0x462439,'image':_0x550514,'document':_0xe44a24,'web-resource':_0x3e37f3,'text':_0x462439,'selection':_0x2c8354,'mcp-tool-context':_0xe44a24},Hs='ck-ai-chat-context-chip',Ms='ck-ai-chat-context-chip_wide',Us='ck-ai-chat-context-chip_document',Bs='ck-ai-chat-context-chip__label',Gs='ck-ai-chat-context-chip__type-icon',Fs='ck-ai-chat-context-controls__chip-tooltip',Ws='n';class AIChatContextItemButtonView extends yt{constructor(_0x400d7f,_0x11419d,_0x210325,_0x4d8560,_0x40f82e=!0x1){super(_0x400d7f),this['_isAnimationOnEnterEnabled']=_0x4d8560,this['_initializeProperties'](_0x11419d,_0x210325,_0x40f82e),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'](_0x302af0,_0x3b7b0c,_0x301d1e){this['set']('label',_0x302af0['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x302af0['type']),this['set']('id',_0x302af0['uiId']),this['set']('readonly',_0x3b7b0c),this['set']('isLoading',_0x301d1e);}['_setupTemplate'](){const _0x22cc69=this['_createIconView'](),_0x57c6d9=this['_createRemoveButton'](),_0x35be1b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x35be1b),'children':this['_createTemplateChildren'](_0x22cc69,_0x57c6d9,_0x35be1b)});}['_createTemplateAttributes'](_0xd1c55a){return{'class':[Hs,_0xd1c55a['if']('itemType',Us,_0x2b7334=>'document'==_0x2b7334),_0xd1c55a['if']('itemType',Ms,_0x13bf08=>'selection'==_0x13bf08)],'data-cke-tooltip-text':_0xd1c55a['to']('label',Ks),'data-cke-tooltip-position':Ws,'data-cke-tooltip-class':Fs};}['_createTemplateChildren'](_0x51cec7,_0x24e4b3,_0x47e11a){const _0x3a689d=this['_createLabelElement'](_0x47e11a),_0x143b9f=this['_createLoaderIcon']();return this['readonly']?[_0x51cec7,_0x3a689d]:[_0x51cec7,_0x143b9f,_0x3a689d,_0x24e4b3];}['_createLabelElement'](_0x8ad34f){return{'tag':'span','attributes':{'class':Bs},'children':[{'text':_0x8ad34f['to']('label')}]};}['_createRemoveButton'](){const _0x5d4e66=new yt(this['locale']);return _0x5d4e66['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x346199}),this['_setupRemoveButtonEvent'](_0x5d4e66),_0x5d4e66;}['_setupRemoveButtonEvent'](_0x30b736){_0x30b736['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x4d3e09=this['bindTemplate'],_0x5b6126=new Lt();return _0x5b6126['content']=Vs[this['itemType']],_0x5b6126['extendTemplate']({'attributes':{'class':[Gs,_0x4d3e09['if']('isLoading','ck-hidden',_0x5c2b35=>_0x5c2b35)]}}),_0x5b6126;}['_handleAnimationEndOnce'](_0x19bb5b,_0x24a3ca){if(!_0x19bb5b)return;const _0x3daffe=()=>{_0x24a3ca(),_0x19bb5b['removeEventListener']('animationend',_0x3daffe),_0x19bb5b['removeEventListener']('webkitAnimationEnd',_0x3daffe);};_0x19bb5b['addEventListener']('animationend',_0x3daffe),_0x19bb5b['addEventListener']('webkitAnimationEnd',_0x3daffe);}['_createLoaderIcon'](){const _0x55647d=new AISpinnerView('small');return _0x55647d['bind']('isVisible')['to'](this,'isLoading',_0x15faf9=>_0x15faf9),_0x55647d;}}function Ks(_0x34b1e1){if(!_0x34b1e1)return _0x34b1e1;if(_0x34b1e1['length']<=0x78)return _0x34b1e1;const _0x2f607d=_0x34b1e1['slice'](0x0,0x78),_0x54ddc7=_0x2f607d['lastIndexOf']('\x20');return(_0x54ddc7>0x0?_0x2f607d['slice'](0x0,_0x54ddc7):_0x2f607d)+'…';}const Ys={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},$s='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x4fdc5a,_0x2536fc,_0x486445,_0x24fa06,_0x9ca4ca){this['_locale']=_0x4fdc5a,this['_visibleChips']=_0x2536fc,this['_config']={...Ys,..._0x486445,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x486445['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x24fa06,this['_parentView']=_0x9ca4ca||null;}['setContainerElement'](_0x1e83b3){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x1e83b3,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 _0x57b7fa=[...this['_visibleChips'],...this['_overflowChips']],_0x140b30=this['_createCalculationContainer'](),_0x58d2ae=this['_calculateOverflowInContainer'](_0x140b30,_0x57b7fa),_0xde63f4=_0x140b30['_ancestorsToRestore'];_0xde63f4&&this['_restoreAncestorVisibility'](_0xde63f4),_0x140b30['remove'](),this['_applyOverflowResults'](_0x57b7fa,_0x58d2ae);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x1e77c6=new yt(this['_locale']);_0x1e77c6['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x3c2332=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x3c2332['push'](this['_config']['cssClasses']['controlsButton']),_0x1e77c6['extendTemplate']({'attributes':{'class':_0x3c2332}}),_0x1e77c6;}['_createShowMoreBalloonPanelView'](){const _0x3831cf=new zt(this['_locale']);return _0x3831cf['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x3831cf),_0x3831cf;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x59613f=>{_0x59613f['disableAnimationOnEnter']();});const _0xc46507=new Nt(this['_locale']);_0xc46507['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0xc46507);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0xee4185=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0xee4185?'':'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'](_0x3ec614){const _0x27b96a=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x36c437=this['_containerElement']?.['classList'];if(_0x36c437){const _0x4546d9=_0x36c437[0x0]||'',_0x5667b3=_0x3ec614['querySelector']('.'+_0x4546d9),_0xf0e034=_0x3ec614['querySelector'](_0x27b96a);return _0x5667b3||_0xf0e034||_0x3ec614;}return _0x3ec614['querySelector'](_0x27b96a)||_0x3ec614;}['_calculateContainerWidth'](){const _0x121ec1=this['_parentView']?.['element']||this['_containerElement'];if(!_0x121ec1)return $s;const _0xaec832=window['getComputedStyle'](_0x121ec1)['width'];if('auto'===_0xaec832||'0px'===_0xaec832||!_0xaec832){const _0xd476e9=_0x121ec1['parentElement'];if(_0xd476e9){const _0x2dddbd=window['getComputedStyle'](_0xd476e9);return'auto'!==_0x2dddbd['width']?_0x2dddbd['width']:$s;}return $s;}return _0xaec832;}['_applyCalculationStyles'](_0x212bce,_0x11621f){this['_config']['cssClasses']['calculationContainer']&&_0x212bce['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x212bce['style']['width']=_0x11621f,_0x212bce['style']['position']='absolute',_0x212bce['style']['top']='-9999px',_0x212bce['style']['left']='-9999px',_0x212bce['style']['opacity']='0',_0x212bce['style']['pointerEvents']='none',_0x212bce['style']['zIndex']='-1',_0x212bce['style']['visibility']='visible\x20!important',_0x212bce['style']['display']='block\x20!important',_0x212bce['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x14f53c){_0x14f53c['forEach'](({element:_0x255d24,originalDisplay:_0x4bf54c,originalVisibility:_0x437207})=>{_0x255d24['style']['display']=_0x4bf54c,_0x255d24['style']['visibility']=_0x437207;});}['_makeAncestorsVisible'](_0x1bf763){const _0x5764bb=[];let _0x8c86fa=_0x1bf763;for(;_0x8c86fa&&_0x8c86fa!==document['body'];){const _0x51ae7d=window['getComputedStyle'](_0x8c86fa);'none'!==_0x51ae7d['display']&&'hidden'!==_0x51ae7d['visibility']||(_0x5764bb['push']({'element':_0x8c86fa,'originalDisplay':_0x8c86fa['style']['display'],'originalVisibility':_0x8c86fa['style']['visibility']}),_0x8c86fa['style']['display']='block',_0x8c86fa['style']['visibility']='visible'),_0x8c86fa=_0x8c86fa['parentElement'];}return _0x5764bb;}['_createContainerElements'](){let _0x138c1c,_0x1e885f;return this['_parentView']?.['element']?(_0x138c1c=this['_parentView']['element']['cloneNode'](!0x0),_0x1e885f=this['_findTargetContainer'](_0x138c1c)):(_0x138c1c=document['createElement']('div'),_0x1e885f=_0x138c1c),{'calculationContainer':_0x138c1c,'targetContainer':_0x1e885f};}['_createCalculationContainer'](){const {calculationContainer:_0x5448c2,targetContainer:_0x3c8410}=this['_createContainerElements'](),_0x7a7d08=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x5448c2,_0x7a7d08);const _0x2266b3=this['_parentView']?.['element']||this['_containerElement'],_0x1d3801=_0x2266b3?.['parentElement'];_0x1d3801?_0x1d3801['appendChild'](_0x5448c2):document['body']['appendChild'](_0x5448c2),_0x5448c2['_targetContainer']=_0x3c8410;const _0x1422c5=this['_makeAncestorsVisible'](_0x1d3801||null);return _0x5448c2['offsetWidth'],_0x5448c2['_ancestorsToRestore']=_0x1422c5,_0x5448c2;}['_calculateOverflowInContainer'](_0x1e9d8d,_0x33fb9d){const _0x1cbc10=_0x1e9d8d['_targetContainer']||_0x1e9d8d,_0x1ad986=[],{rowCount:_0xcae907}=this['_renderChipsAndCountRows'](_0x1cbc10,_0x33fb9d);if(_0xcae907<=this['_config']['maxVisibleRows'])return _0x1ad986;const _0x37a0ab=_0x33fb9d['slice']();for(;_0x37a0ab['length']>0x0;){if(this['_testButtonFit'](_0x1e9d8d,_0x1cbc10,_0x37a0ab)){const _0x590ce0=_0x33fb9d['filter'](_0x37d265=>!_0x37a0ab['includes'](_0x37d265));_0x1ad986['push'](..._0x590ce0);break;}if(!_0x37a0ab['pop']())break;}return _0x1ad986;}['_renderChipsAndCountRows'](_0x437121,_0x530975){_0x437121['innerHTML']='',_0x530975['forEach'](_0x5dc4f3=>{if(_0x5dc4f3['element']){const _0x76c078=_0x5dc4f3['element']['cloneNode'](!0x0);_0x437121['appendChild'](_0x76c078);}}),_0x437121['offsetWidth'];const _0x37ff9=_0x437121['children'],_0x423e34=[];return Array['from'](_0x37ff9)['forEach'](_0xbf7479=>{const _0x3fad75=_0xbf7479['getBoundingClientRect']()['top'];_0x423e34['some'](_0x5d1ad7=>Math['abs'](_0x5d1ad7-_0x3fad75)<this['_config']['rowDetectionTolerance'])||_0x423e34['push'](_0x3fad75);}),{'rowCount':_0x423e34['length']};}['_createMockButton'](){const _0x2c6510=document['createElement']('button');return _0x2c6510['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x2c6510['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x2c6510['textContent']='+\x201',_0x2c6510;}['_testButtonFit'](_0x3ca0e3,_0x1cf63a,_0x57a66c){this['_renderChipsAndCountRows'](_0x1cf63a,_0x57a66c);const _0x1713e7=this['_createMockButton']();_0x3ca0e3['appendChild'](_0x1713e7),_0x3ca0e3['offsetWidth'];const _0x1bc314=[..._0x1cf63a['children'],_0x1713e7],_0x4f6b48=[];_0x1bc314['forEach'](_0x4c3bbd=>{const _0x1cb300=_0x4c3bbd['getBoundingClientRect']()['top'];_0x4f6b48['some'](_0x1ba005=>Math['abs'](_0x1ba005-_0x1cb300)<this['_config']['rowDetectionTolerance'])||_0x4f6b48['push'](_0x1cb300);});const _0xa62224=_0x4f6b48['length'];return _0x1713e7['remove'](),_0xa62224<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x508646,_0x3662ea){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x508646['forEach'](_0x3015a2=>{_0x3662ea['includes'](_0x3015a2)?this['_overflowChips']['add'](_0x3015a2):this['_visibleChips']['add'](_0x3015a2);});}['_updateOverflowUI'](_0x1ac9d5){if(_0x1ac9d5>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x1ac9d5>0x0&&this['_showMoreButtonView']){const _0x4d32f2=''+this['_config']['showMoreLabelPrefix']+(_0x1ac9d5<0x63?_0x1ac9d5:'99');this['_showMoreButtonView']['label']=_0x4d32f2;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x414426,_0x37e75b){this['_distributeChips'](_0x414426,_0x37e75b),this['_updateOverflowUI'](_0x37e75b['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x25558d=>{_0x25558d[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 _0x48a59f=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x48a59f['width']||0x0===_0x48a59f['height'])return!0x1;const _0x27321b=window['innerHeight']||document['documentElement']['clientHeight'],_0x541eaf=window['innerWidth']||document['documentElement']['clientWidth'],_0x1c6f21=0xc8;return _0x48a59f['bottom']>=-0xc8&&_0x48a59f['top']<=_0x27321b+_0x1c6f21&&_0x48a59f['right']>=-0xc8&&_0x48a59f['left']<=_0x541eaf+_0x1c6f21;}}const qs='ck-ai-chat__feed__context-chips',Qs='ck-ai-chat-context-chips-wrapper',Xs='ck-ai-chat-context-chips-wrapper-balloon',zs='ck-ai-chat-controls-button',js='ck-ai-chat-controls_context_show-more-button',Js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x46313f,_0x264130,_0x3ddba2){super(_0x46313f),this['_bodyCollection']=_0x3ddba2,this['_createContextChips'](_0x264130);const _0x438759={'cssClasses':{'showMoreButton':js+'\x20'+Gi,'showMoreBalloon':Js,'overflowContainer':Xs,'controlsButton':zs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x46313f,this['_contextChips'],_0x438759,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[qs,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x509c52=this['element']['querySelector']('.'+Qs);_0x509c52&&(this['_overflowManager']['setContainerElement'](_0x509c52),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x4e0c96){for(const _0x46923a of _0x4e0c96){const _0x59cc89=new AIChatContextItemButtonView(this['locale'],_0x46923a,!0x0,!0x1);this['_contextChips']['add'](_0x59cc89);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x46ec53,_0x5f2c01,_0x2cee2a){super(_0x5f2c01),this['_locale']=_0x46ec53,this['_bodyCollection']=_0x2cee2a,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 AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0xf95699=>!_0xf95699['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(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']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x4e54fb,_0x1260d0){super(_0x1260d0);const {isWebSearchEnabled:_0xdc66ab,isReasoningEnabled:_0x501f8a}=_0x1260d0['capabilities'],_0x29f7c4=[];let _0x282249='';_0xdc66ab&&_0x501f8a?(_0x282249=Mi(_0x4e54fb,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x29f7c4['push'](Zs(_0x224392)),_0x29f7c4['push'](Zs(_0x39c06e))):_0xdc66ab?(_0x282249=Mi(_0x4e54fb,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x29f7c4['push'](Zs(_0x224392))):_0x501f8a&&(_0x282249=Mi(_0x4e54fb,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x29f7c4['push'](Zs(_0x39c06e))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x282249?'':'ck-hidden']}});const _0x2ad4fa=new Nt();_0x2ad4fa['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x29f7c4,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x282249]}]}),this['children']['add'](_0x2ad4fa),this['capabilities']=_0x1260d0['capabilities'];}}function Zs(_0x9c20c6){const _0x5ce88c=new Lt();return _0x5ce88c['content']=_0x9c20c6,_0x5ce88c;}const tn=['wheel','touchstart','pointerdown','keydown'],en=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x57f6d0){this['element']=_0x57f6d0,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x4a74ee of tn){const _0x342d48='keydown'!==_0x4a74ee;this['element']['addEventListener'](_0x4a74ee,this['_onUserEvent']['bind'](this),{'passive':_0x342d48,'signal':this['abortController']['signal']});}}['start']({smooth:_0x288c86=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x288c86?'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'](_0x3515ec){if(this['isRunning']){if('keydown'===_0x3515ec['type']){const _0x370411=_0x3515ec['key'];if(!en['includes'](_0x370411))return;}_0x3515ec instanceof WheelEvent?_0x3515ec['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x33fb99,scrollHeight:_0x471052,clientHeight:_0x1f2481}=this['element'];return _0x471052-_0x33fb99-_0x1f2481<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x189b16){super(_0x189b16),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']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x4b890d,_0x58e6f6){super(_0x4b890d),this['_bodyCollection']=_0x58e6f6,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Os)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x2b7c44,_0x20b13a){let _0x4f3032;return'ai-reply'===_0x2b7c44?_0x4f3032=new AIChatFeedReplyItemView(this['locale'],_0x20b13a,this['_bodyCollection']):'ai-suggestion-reply'===_0x2b7c44?(_0x4f3032=new AIChatFeedSuggestionItemView(this['locale'],_0x20b13a,this['_bodyCollection']),_0x4f3032['bind']('isTrackChangesOn')['to'](this)):_0x4f3032='user-message'===_0x2b7c44?new AIChatFeedUserMessageItemView(this['locale'],_0x20b13a,this['_bodyCollection']):'interaction-header'===_0x2b7c44?new AIChatFeedInteractionHeaderView(this['locale'],_0x20b13a):'custom-element'===_0x2b7c44?new AIChatFeedCustomElementView(_0x20b13a):new AIChatFeedErrorItemView(_0x20b13a),this['children']['add'](_0x4f3032),_0x4f3032;}async['updateReplyItem']({id:_0x5e51de,parsedContent:_0x20cb70,renderingStrategy:_0x3553c7,abortSignal:_0x5e74a8}){const _0x4cf249=this['getItemById'](_0x5e51de);if(!(_0x4cf249 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x4cf249,'id':_0x5e51de,'parsedContent':_0x20cb70});await _0x4cf249['updateContent']({'parsedContent':_0x20cb70,'renderingStrategy':_0x3553c7,'abortSignal':_0x5e74a8});}async['updateWebSources'](_0x53cd1b,_0x515ff4){const _0x2ee58d=this['getItemById'](_0x53cd1b);if(_0x2ee58d instanceof AIChatFeedSuggestionItemView)_0x2ee58d['updateSources'](_0x515ff4);else{if(!(_0x2ee58d instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x2ee58d,'id':_0x53cd1b,'sources':_0x515ff4});_0x2ee58d['updateSources'](_0x515ff4);}}async['updateSuggestionItem']({id:_0x29ac35,parts:_0x11a0f9,abortSignal:_0x3c6b70,skipLoadingEffects:_0x18ef5f}){const _0x47269e=this['getItemById'](_0x29ac35);if(!(_0x47269e instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x47269e,'id':_0x29ac35,'parts':_0x11a0f9});await _0x47269e['updateContent']({'parts':_0x11a0f9,'abortSignal':_0x3c6b70,'skipLoadingEffects':_0x18ef5f});}['updateSuggestionPartState']({id:_0x5e38ef,index:_0x41fc5c,state:_0x1663cb}){const _0x59f93c=this['getItemById'](_0x5e38ef);if(!(_0x59f93c instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5e38ef});_0x59f93c['updatePartState'](_0x41fc5c,_0x1663cb);}['setSuggestionPartActive']({id:_0x49e5a0,index:_0x4f70c6,isActive:_0x417ad3}){const _0x30956a=this['getItemById'](_0x49e5a0);if(!(_0x30956a instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x49e5a0});this['children']['filter'](_0x143eb2=>_0x143eb2 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x25df63=>{_0x25df63['setPartActive'](!0x1);}),_0x30956a['setPartActive'](_0x4f70c6,_0x417ad3);}['markItemAsDone'](_0x561d23){this['getItemById'](_0x561d23)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x37c770=>_0x37c770['options']['id']);}['removeItem'](_0x24125d){this['children']['remove'](this['getItemById'](_0x24125d));}['hasItem'](_0x2209af){return!!this['children']['find'](_0x3c13c2=>_0x3c13c2['options']['id']['includes'](_0x2209af));}['scrollToSuggestion'](_0x478d66,_0x31f28c){const _0xf029cd=this['getItemById'](_0x478d66);if(!(_0xf029cd instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x478d66,'partIndex':_0x31f28c});const _0x18585f=_0xf029cd['getPartView'](_0x31f28c);_0x18585f?Rt(_0x18585f['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x478d66,'partIndex':_0x31f28c});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x2224b2=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x2224b2,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x3bcbae=new AISkeletonView(this['locale'],Ls['aiFeed']);return _0x3bcbae['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x3bcbae;}['_createFeedItems'](){const _0x161d97=new Nt(this['locale']);return _0x161d97['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x161d97;}['_createFeedLoader'](){const _0x49209b=new Nt(this['locale']);return _0x49209b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x2fd8c5=>!_0x2fd8c5)]},'children':this['_createLoaderChildren']()}),_0x49209b;}['_createLoaderChildren'](){const _0x59e119=new AISpinnerView();return _0x59e119['isVisible']=!0x0,[_0x59e119,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x2f21bb){const _0x4cb3f8=this['children']['find'](_0x32f7db=>_0x32f7db['options']['id']['includes'](_0x2f21bb));if(!_0x4cb3f8)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x2f21bb});return _0x4cb3f8;}['setLoadingMessage'](_0x52b21c){this['set']('loadingMessage',_0x52b21c);}['toggleLoadingSkeleton'](_0x538d81){this['set']('isLoadingSkeletonVisible',_0x538d81);}['startAutoScroll'](_0x5ad8a8={}){this['scrollManager']['start'](_0x5ad8a8);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x2087c1=0x0;for(const _0x16cf29 of this['items'])_0x2087c1+=_0x16cf29['items']['length'];return{'resultsCount':_0x2087c1,'totalItemsCount':_0x2087c1};}}function sn(_0x108b9a){const _0x159d60=[];let _0x15fa94=!0x1;for(const _0x11de26 of Array['from'](_0x108b9a['items'])){if('file'!==_0x11de26['kind'])continue;const _0x386d9f=_0x11de26['webkitGetAsEntry']();if(_0x386d9f?.['isDirectory']){_0x15fa94=!0x0;continue;}const _0x8458f6=_0x11de26['getAsFile']();_0x8458f6&&_0x159d60['push'](_0x8458f6);}return{'files':_0x159d60,'hasDirectory':_0x15fa94};}const nn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x40d5ec,_0x30240e){super(_0x40d5ec,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x40d5ec),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x30240e,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',(_0x58ba65,_0x33c0fa)=>!_0x58ba65&&!_0x33c0fa),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x4e5724,_0x3e28c9)=>{this['isUploadInProgress']||this['isEmpty']||_0x4e5724['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3e28c9());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x576e25=>this['_handlePaste'](_0x576e25)),this['element']['addEventListener']('drop',_0x8b1e73=>this['_handleDrop'](_0x8b1e73));}['_handlePaste'](_0x46ed17){const _0x5ad2bb=_0x46ed17['clipboardData'];if(!_0x5ad2bb)return;const {files:_0x1fe1c9,hasDirectory:_0xbee1e6}=sn(_0x5ad2bb),_0x3b2e08={'files':_0x1fe1c9,'plainText':_0x5ad2bb['getData']('text/plain'),'hasDirectory':_0xbee1e6,'forceTextAttachment':!0x1,'preventDefault':()=>_0x46ed17['preventDefault']()};this['fire']('promptInputPaste',_0x3b2e08);}['_handleDrop'](_0x13966c){const _0x1d4a3d=_0x13966c['dataTransfer'];if(!_0x1d4a3d)return;const _0x423d95={'files':[],'plainText':_0x1d4a3d['getData']('text/uri-list')||_0x1d4a3d['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x13966c['preventDefault']()};this['fire']('promptInputPaste',_0x423d95);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x498529=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x498529)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x5196e2=_0x7f6d0a(_0x498529);this['fire']('sendUserMessage',_0x5196e2),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x4da144){this['queryView']['fieldView']['set']('placeholder',_0x4da144);}['focus'](_0x1b7631=!0x1){super['focus'](),_0x1b7631&&(this['element']['classList']['contains'](nn)||(this['element']['classList']['add'](nn),setTimeout(()=>{this['element']['classList']['remove'](nn);},0x320)));}['_createSubmitButton'](){const _0x2a1fe7=new yt(this['locale']);return _0x2a1fe7['set']({'icon':_0x18e564,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x2a1fe7['on']('execute',()=>{this['submit']();}),_0x2a1fe7;}['setIsUploadInProgress'](_0xae20e3){this['isUploadInProgress']=_0xae20e3;}['_setUpAddContextButtonPositioning'](){const _0x4541ab=this['locale'],_0x3e2f3e=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x5787e4=new dt(this['queryView']['fieldView']['element']),_0x720bce=new dt(this['_addContextButtonView']['element']),_0x4cbf4f=_0x5787e4['width'],_0x54c7ab='rtl'===_0x4541ab['uiLanguageDirection']?'right':'left';_0x5787e4['excludeScrollbarsAndBorders']();const _0x66887e=_0x4cbf4f-_0x5787e4['width']+0x1;this['_addContextButtonView']['element']['style'][_0x54c7ab]='calc('+(_0x4cbf4f-_0x720bce['width']-_0x66887e)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x3e2f3e),this['on']('render',()=>{_0x3e2f3e(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x3e2f3e();});});}}class AIChatDropZoneView extends Nt{constructor(_0xd9bb90){super(_0xd9bb90);const _0x5d7324=new Lt();_0x5d7324['content']=_0x462439,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x5d7324,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0xd9bb90,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x3a9146){let _0x3913b4=0x0;_0x3a9146['addEventListener']('dragenter',_0x1844e6=>{_0x1844e6['dataTransfer']&&(_0x3913b4++,0x1===_0x3913b4&&this['fire']('dragEnter'),_0x3a9146['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x3a9146['addEventListener']('dragover',_0x2d9037=>{_0x2d9037['dataTransfer']&&_0x2d9037['preventDefault']();}),_0x3a9146['addEventListener']('dragleave',()=>{--_0x3913b4<=0x0&&(_0x3913b4=0x0,_0x3a9146['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x3a9146['addEventListener']('drop',_0x1d091b=>{_0x1d091b['preventDefault'](),_0x3913b4=0x0,_0x3a9146['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x1d091b);});}['_handleDrop'](_0x5231b5){const _0x15cb03=_0x5231b5['dataTransfer'];if(!_0x15cb03)return;const {files:_0x1b704f,hasDirectory:_0x165250}=sn(_0x15cb03),_0x52a362={'files':_0x1b704f,'plainText':_0x15cb03['getData']('text/uri-list')||_0x15cb03['getData']('text/plain'),'hasDirectory':_0x165250,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x52a362);}}const rn='ck-ai-chat__prompt-capabilities',on='ck-ai-chat-controls-button',an='ck-ai-chat-controls-button--commands',hn='ck-ai-chat-controls__model-selection',cn='ck-ai-chat-controls__model-selection__item-name',ln='ck-ai-chat-controls__model-selection__item-description',un='ck-ai-chat-controls__model-selection__item-capabilities',dn='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x4ccd80){super(_0x4ccd80),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',_0x48cb0f=>'selector'===_0x48cb0f),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x1c9ec6=>_0x1c9ec6?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x4d9b0e=>_0x4d9b0e),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x159c84=>_0x159c84),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x1bcca9=>Mi(this['locale'],_0x1bcca9?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x15a0cf=>_0x15a0cf),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x111671=>Mi(this['locale'],_0x111671?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[rn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x5d5a93,_0x2f6a18){if(_0x2f6a18)this['set']('modelDisplayMode','hidden');else{const _0x3dce23=0x1===_0x5d5a93['length'];this['set']('modelDisplayMode',_0x3dce23?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x5d5a93?.['length'])for(const _0x2c0447 of _0x5d5a93){const _0x32f4d2=new Zt({'label':_0x2c0447['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2c0447['id'],'model':_0x2c0447});_0x32f4d2['bind']('isOn')['to'](this,'activeModelId',_0x5b13b9=>_0x5b13b9===_0x2c0447['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x32f4d2,'labelView':new _n(this['locale'],_0x2c0447)});}}['setWebSearch'](_0x4100ba){this['set']('webSearchActive',_0x4100ba);}['setReasoning'](_0x5167ed){this['set']('reasoningActive',_0x5167ed);}['setModel'](_0x20515a){if(!_0x20515a)return;this['activeModelId']=_0x20515a['id'],this['activeModelName']=_0x20515a['name']||_0x20515a['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x20515a['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x20515a['name']);const _0x43bf04=_0x20515a['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x43bf04),this['_webSearchButton']['set']('isVisible',_0x43bf04);const _0x17e8bc=_0x20515a['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x17e8bc),this['_reasoningButton']['set']('isVisible',_0x17e8bc);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x439125){this['set']('modelSelectorEnabled',!0x1),_0x439125&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x1c6076=new yt();return _0x1c6076['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x224392,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x1c6076['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x1c6076;}['_createReasoningButton'](){const _0xf860be=new yt();return _0xf860be['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x39c06e,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0xf860be['on']('execute',()=>{this['fire']('toggleReasoning');}),_0xf860be;}['_createCommandsButton'](){const _0x4e57d1=new yt();return _0x4e57d1['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x51a6e1,'withText':!0x0,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':dn}),_0x4e57d1['extendTemplate']({'attributes':{'class':[an]}}),_0x4e57d1['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x4e57d1;}['_createModelSelectionDropdown'](){const _0xd57dfc=Ft(this['locale']);return _0xd57dfc['set']({'panelPosition':'ne','class':[hn]}),_0xd57dfc['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':dn,'class':Gi}),this['listenTo'](_0xd57dfc,'execute',_0x30f0c7=>{this['fire']('selectModel',_0x30f0c7['source']['model']);}),_0xd57dfc;}['_createModelNameView'](){const _0x10d089=new In(this['locale']);return _0x10d089['bind']('text')['to'](this,'activeModelName',_0x279a95=>_0x279a95??''),_0x10d089['bind']('isVisible')['to'](this,'modelDisplayMode',_0x5d6b0a=>'name'===_0x5d6b0a),_0x10d089;}}let _n=class ModelButtonLabelView extends Mt{constructor(_0x385c8f,_0x1f7239){super();const _0x10b350=this['bindTemplate'],_0x425113=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x10b350['to']('style'),'id':_0x10b350['to']('id')},'children':[{'tag':'div','attributes':{'class':[cn]},'children':[{'text':_0x10b350['to']('text')}]},{'tag':'div','attributes':{'class':[ln]},'children':[{'tag':'span','children':[{'text':_0x1f7239['description']}]}]},{'tag':'div','attributes':{'class':[un]},'children':_0x425113}]}),_0x425113['addMany'](this['_getCapabilityParts'](_0x385c8f,_0x224392,'AI_CHAT_SEARCH_WEB',_0x1f7239['capabilities']['webSearch']?.['enabled']??!0x1)),_0x425113['addMany'](this['_getCapabilityParts'](_0x385c8f,_0x39c06e,'AI_CHAT_REASONING',_0x1f7239['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x4cbc7a,_0x4f9de6,_0x4f5d9b,_0x7d36a7){const _0x27579e=new Lt();_0x27579e['content']=_0x4f9de6;const _0x3d7b44=new Nt(_0x4cbc7a);_0x3d7b44['setTemplate']({'tag':'span','children':[{'text':Mi(_0x4cbc7a,_0x4f5d9b)+':\x20'}]});const _0x53fef6=new Nt(_0x4cbc7a);return _0x53fef6['setTemplate']({'tag':'span','children':[{'text':Mi(_0x4cbc7a,_0x7d36a7?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x27579e,_0x3d7b44,_0x53fef6];}},In=class ModelNameView extends Nt{constructor(_0x365f9d){super(_0x365f9d),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1592e5=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x1592e5['if']('isVisible','ck-hidden',_0x2da2ac=>!_0x2da2ac)]},'children':[{'text':_0x1592e5['to']('text')}]});}};const An='ck-ai-chat-context-controls__url-form',gn='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0xd3efae){super(_0xd3efae),this['focusTracker']=new It(),this['keystrokes']=new At(),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 Ut({'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'](_0x53b11b=>{this['focusTracker']['add'](_0x53b11b['element']),this['keystrokes']['listenTo'](_0x53b11b['element']);}),te({'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'](_0x55949c){this['urlInputField']['errorText']=_0x55949c,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x332706=new yt(this['locale']);return _0x332706['set']({'icon':_0x6eeec5,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x3c3573,_0x3cc407,_0x3b3c36)=>{_0x332706['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x3b3c36?'':'\x20ck-hidden')]});}),_0x332706;}['_createUrlInputField'](){const _0x59eb06=new _0x2c4cbe(this['locale'],_0x51ae0e);return _0x59eb06['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x59eb06['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x59eb06;}['_createConfirmButton'](){const _0x37c03b=new yt(this['locale']);return _0x37c03b['set']({'icon':_0x3d9fb7,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x37c03b;}['_setupTemplate'](){const _0x1c0be4=new _0x27b307(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x1c0be4['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':An,'tabindex':'-1'},'children':[_0x1c0be4,{'tag':'div','attributes':{'class':gn},'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',_0x11f288=>{_0x11f288['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x566361,_0x41a8bf)=>{this['clear'](),this['fire']('cancel'),_0x41a8bf();});}['_handleSubmit'](){const _0x7aee52=this['getValue']()['trim']();_0x7aee52?this['_isValidUrl'](_0x7aee52)?(this['clearError'](),this['fire']('submitUrl',_0x7aee52)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x2a97a1=this['getValue']()['trim'](),_0x37b211=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x2a97a1['length']>0x0&&!_0x37b211;}['_isValidUrl'](_0x1c42ab){try{return!!new URL(_0x1c42ab);}catch{return!0x1;}}}const wn='ck-ai-chat-resources__item',Cn='ck-ai-chat-resources__item--in-context',mn='ck-ai-chat-resources__item-title',pn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x222a20,_0x4e0e50){super(_0x222a20),this['resource']=_0x4e0e50,this['set']('isInContext',!!_0x4e0e50['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x4f5949){if(_0x4f5949['isInContext'])return _0x3d9fb7;switch(_0x4f5949['type']){case'document':return _0xe44a24;case'web-resource':return _0x3e37f3;case'file':case'text':return _0x462439;default:return _0x3d07f2;}}['highlightText'](_0x44db9f){if(!_0x44db9f||''===_0x44db9f['trim']())return void this['_titleView']['highlightText'](null);const _0x9a0a7=new RegExp(_0x6635be(_0x44db9f),'gi');this['_titleView']['highlightText'](_0x9a0a7);}['updateResourceState'](_0xfbde09){this['resource']['isInContext']=_0xfbde09,this['isInContext']=_0xfbde09,this['_updateIcon']();}['_createTitleView'](){const _0x3e930c=new _0x3afbec();return _0x3e930c['text']=this['resource']['label'],_0x3e930c['extendTemplate']({'tag':'span','attributes':{'class':[mn]}}),_0x3e930c;}['_createIconView'](){const _0x2042b3=new Lt();return _0x2042b3['content']=this['getResourceIcon'](this['resource']),_0x2042b3;}['_setupTemplate'](){const _0x59db19=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[wn,_0x59db19['if']('isVisible','ck-hidden',_0x53772f=>!_0x53772f),_0x59db19['if']('isInContext',Cn)]},'children':[{'tag':'div','attributes':{'class':[pn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x59db19['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const En='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x79b105,_0x653993){super(_0x79b105),this['_source']=_0x653993,this['extendTemplate']({'attributes':{'class':[En]}});}['setResources'](_0x1c25a5,_0x3c0067){this['items']['clear']();let _0x2ae90a=_0x1c25a5;if(this['_source']['useDefaultFiltering']&&_0x3c0067&&''!==_0x3c0067['trim']()){const _0x3d631b=new RegExp(_0x3c0067['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x2ae90a=_0x1c25a5['filter'](_0x170d6e=>_0x3d631b['test'](_0x170d6e['label']));}for(const _0x1c8379 of _0x2ae90a){const _0x3470f3=new AIChatResourceListItemView(this['locale'],_0x1c8379);_0x3470f3['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x1c8379);}),this['items']['add'](_0x3470f3);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x3c0067);}['highlightText'](_0x251531){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x1fa08e=>{_0x1fa08e['highlightText'](_0x251531);});}['updateResourceState'](_0x317aa0,_0x9c5d76){for(const _0x37f31a of this['items']){const _0x80ad1a=_0x37f31a;_0x80ad1a['resource']['id']===_0x317aa0&&_0x80ad1a['updateResourceState'](_0x9c5d76);}}['_handleResourceSelection'](_0x52733b,_0x13d26f){this['fire']('addResourceToContext',{'source':_0x52733b,'resource':_0x13d26f});}}class AIChatContextResourcesSearchInputView extends _0x2c4cbe{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x54eaf1){const t=_0x54eaf1['t'],_0x230983={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x51ae0e,'label':Mi(_0x54eaf1,'AI_CHAT_SEARCH_RESOURCES')};super(_0x54eaf1,_0x230983['creator']),this['label']=_0x230983['label'],this['_viewConfig']=_0x230983,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x54eaf1,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x39ddf5){this['fire']('search',_0x39ddf5);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x105d5c,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x1ddec1,t){this['resetButtonView']=new yt(_0x1ddec1),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x346199,'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',_0x578a98=>!_0x578a98),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);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x53e9f7,_0x20f553){super(_0x53e9f7),this['_source']=_0x20f553['source'],this['_searchInputVisibleFrom']=_0x20f553['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 _0x1bcd70([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x25cbe4=new Nt(this['locale']);return _0x25cbe4['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x68dbf2,_0x20035e)=>{this['loadResources'](_0x20035e),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x20035e);}),_0x25cbe4;}['_createResourcesListView'](){const _0x38e161=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x38e161['delegate']('addResourceToContext')['to'](this),_0x38e161['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x38e161;}['_createSkeletonView'](){const _0x5dcaa7=new AISkeletonView(this['locale'],Ls['aiChatResources']);return _0x5dcaa7['bind']('isVisible')['to'](this,'isLoading'),_0x5dcaa7;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1e1e21){const _0x5d82af=at();this['_latestLoadResourcesUid']=_0x5d82af,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1e1e21,'uid':_0x5d82af}),this['isLoading']=!0x0;}['setResources'](_0x346a83,_0x589c0e){if(_0x589c0e&&_0x589c0e!==this['_latestLoadResourcesUid'])return;const _0x2e8ce8=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x346a83,_0x2e8ce8),_0x346a83['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x20f9e6,_0x3d8786){this['_resourcesListView']['updateResourceState'](_0x20f9e6,_0x3d8786);}}const Tn='ck-ai-chat-context-controls__source-balloon-panel',fn='ck-button-icon\x20ck-button-back',Rn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x4a2331,_0x4a55aa,_0xfad349){this['_locale']=_0x4a2331,this['_bodyCollection']=_0x4a55aa,this['_config']=_0xfad349;}['showSourceResourcesBalloon']({source:_0x5e1284,withBackButton:_0x538d25}){let _0x2f1214=this['_sourceResourceBalloons']['get'](_0x5e1284['id']);_0x2f1214||(_0x2f1214=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x5e1284['id'],_0x2f1214),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x2f1214)),this['_addSourceResourceContent']({'balloonPanel':_0x2f1214,'source':_0x5e1284,'withBackButton':_0x538d25}),_0x2f1214['show']();const _0x4e1d39=this['_config']['getTargetElement']();_0x4e1d39&&_0x2f1214['pin']({'target':_0x4e1d39,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x53446a,_0x1ca556,_0x2cb80f){const _0x3b0243=this['_sourceResourceBalloons']['get'](_0x53446a);if(!_0x3b0243)return;const _0x3e092b=this['_getResourcesViewFromBalloon'](_0x3b0243);_0x3e092b&&(_0x3e092b['setResources'](_0x1ca556,_0x2cb80f),_0x3e092b['once']('change:isLoading',()=>{_0x3b0243['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x4455e5){const _0x12c727=this['_sourceResourceBalloons']['get'](_0x4455e5);_0x12c727&&requestAnimationFrame(()=>{_0x12c727['hide'](),this['_sourceResourceBalloons']['delete'](_0x4455e5),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x2fd1c0 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x2fd1c0);}['isAnyResourceBalloonVisible'](){for(const _0x4db7c1 of this['_sourceResourceBalloons']['values']())if(_0x4db7c1['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0xe261ac,_0x1a6080,_0x541724){const _0x308bb0=this['_sourceResourceBalloons']['get'](_0xe261ac);if(!_0x308bb0||!_0x308bb0['isVisible'])return;const _0x3649b0=this['_config']['getTargetElement']();if(!_0x3649b0)return;_0x308bb0['pin']({'target':_0x3649b0,'limiter':this['_config']['getLimiterElement']()});const _0x3b3e80=this['_getResourcesViewFromBalloon'](_0x308bb0);_0x3b3e80&&_0x3b3e80['updateResourceState'](_0x1a6080,_0x541724);}['destroy'](){for(const _0x359aa3 of this['_sourceResourceBalloons']['values']())_0x359aa3['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x3713db=new zt(this['_locale']);return _0x3713db['extendTemplate']({'attributes':{'class':Tn}}),this['_bodyCollection']['add'](_0x3713db),_0x3713db;}['_addSourceResourceContent']({balloonPanel:_0x4a9fac,source:_0x559690,withBackButton:_0x3817a7}){_0x4a9fac['content']['clear']();const _0x4d8a7f=this['_createBalloonHeader']({'balloonPanel':_0x4a9fac,'source':_0x559690,'withBackButton':_0x3817a7});_0x4a9fac['content']['add'](_0x4d8a7f);const _0x209c87=this['_createBalloonResourcesView'](_0x559690);_0x4a9fac['content']['add'](_0x209c87);}['_createBalloonHeader']({balloonPanel:_0x5cf75a,source:_0x28fb4b,withBackButton:_0x5ba650}){const _0x4ee774=new _0x27b307(this['_locale'],{'label':_0x28fb4b['label'],'class':Rn});return _0x5ba650&&_0x4ee774['children']['add'](this['_createBackButton'](_0x5cf75a),0x0),_0x4ee774;}['_createBackButton'](_0x24cefa){const _0x19e7c0=new yt(this['_locale']);return _0x19e7c0['set']({'icon':_0x6eeec5,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':fn}),_0x19e7c0['on']('execute',()=>{_0x24cefa['hide'](),this['_config']['onBackToContext']();}),_0x19e7c0;}['_createBalloonResourcesView'](_0x527c1e){const _0x13dbea=new AIChatContextResourcesView(this['_locale'],{'source':_0x527c1e,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x13dbea['on']('loadSourceResources',(_0x73d02d,_0x478611)=>{this['_config']['onLoadSourceResources'](_0x478611);}),_0x13dbea['on']('addResourceToContext',(_0x468170,_0x2bc8a3)=>{this['_config']['onResourceSelected'](_0x2bc8a3['source'],_0x2bc8a3['resource']),this['closeSourceResourceBalloon'](_0x527c1e['id']);}),_0x13dbea;}['_getResourcesViewFromBalloon'](_0x53b4c5){const _0x230223=_0x53b4c5['content']['get'](0x1);return _0x230223 instanceof AIChatContextResourcesView?_0x230223:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x4da13d){jt({'emitter':_0x4da13d,'contextElements':[_0x4da13d['element']],'callback':()=>{_0x4da13d['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x4da13d['isVisible']});}}const bn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Sn='ck-ai-chat-context-controls',On='ck-ai-chat-context-controls__pending-contexts',vn='ck-ai-chat-context-controls__add-context-balloon-panel',kn='ck-ai-chat-context-controls__add-context-button',yn='ck-ai-chat-context-controls__url-balloon-panel',Nn='ck-ai-chat-context-controls__balloon-button',xn='ck-ai-chat-context-controls__balloon-button-source',Ln='ck-ai-chat-controls-button',Pn='ck-ai-chat-context-chips-wrapper-balloon',Dn='ck-ai-chat-controls_context_show-more-button',Vn='ck-ai-chat-context-controls__show-more-balloon-panel',Hn='ck-ai-chat',Mn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x149009,_0x25e941){super(_0x149009),this['bodyCollection']=_0x25e941['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x149009),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x149009),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x149009),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x149009,_0x25e941);const _0x59477c={'cssClasses':{'showMoreButton':Dn+'\x20'+Gi,'showMoreBalloon':Vn,'overflowContainer':Pn,'controlsButton':Ln}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x149009,this['_currentContextsChips'],_0x59477c,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'](_0x129128,_0x2e06e1){const _0x7d15b5=this['_createContextButton'](_0x129128,'current',!0x0,_0x2e06e1);this['_addContextToCollection'](_0x7d15b5,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x1d955f){this['_removeContextFromCollection'](_0x1d955f,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x1d955f,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x416e0b,_0x3a8b06){let _0x5d3569=this['_currentContextsChips']['find'](_0x29f700=>_0x29f700['id']===_0x416e0b);_0x5d3569||(_0x5d3569=this['_overflowManager']['overflowChips']['find'](_0x13a94d=>_0x13a94d['id']===_0x416e0b)),_0x5d3569&&(_0x5d3569['isLoading']=_0x3a8b06);}['setConversationContext'](_0x17803e){this['_conversationContextsChips']['clear']();for(const _0x35845d of _0x17803e){const _0x38afe7=this['_createContextButton'](_0x35845d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x38afe7,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x29cb2d,_0x5ce5ab,_0x526929){this['_resourcesBalloonView']['updateResourceState'](_0x29cb2d,_0x5ce5ab,_0x526929);}['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:_0x30ccd2,withBackButton:_0x1deb49}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x30ccd2,'withBackButton':_0x1deb49}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x4b129c,_0x542c48,_0x58aad5,_0x49233b){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x4b129c,_0x58aad5,_0x49233b);}['closeSourceResourceBalloon'](_0x2b82fb){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x2b82fb),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x1a458a){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x1a458a),this['_setAddContextButtonEnabled'](_0x1a458a);}['_setAddContextButtonEnabled'](_0x1a0189){const _0x1e0a01=!_0x1a0189['document']['isHidden']&&_0x1a0189['document']['enabled'],_0x358d6f=_0x1a0189['urls']['enabled'],_0x188ddd=_0x1a0189['files']['enabled'],_0x44dc95=_0x1a0189['sources']['length']>0x0,_0x2bfd70=_0x1a0189['customItems']&&_0x1a0189['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x1e0a01||_0x358d6f||_0x188ddd||_0x44dc95||_0x2bfd70;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Sn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':On},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x22e8af){const _0x301c3b=new yt(_0x22e8af);return _0x301c3b['set']({'label':Mi(_0x22e8af,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ln+'\x20'+kn+'\x20'+Gi,'icon':_0x5b5fef,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x301c3b;}['_createAddContextBalloonPanelView'](_0x3c6b8e){return this['_createBaseBalloonPanel'](_0x3c6b8e,vn);}['_createUrlBalloonPanelView'](_0x2c4f81){const _0x1986d8=this['_createBaseBalloonPanel'](_0x2c4f81,yn);return this['_addUrlContent'](_0x1986d8,_0x2c4f81),_0x1986d8;}['_createResourcesBalloonView'](_0x43eaf6,_0x361461){const _0xc8a22f={'searchInputVisibleFrom':_0x361461['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});},'onResourceSelected':(_0x94815e,_0x2a861a)=>{this['fire']('addResourceToContext',{'source':_0x94815e,'resource':_0x2a861a});},'onLoadSourceResources':_0x52251b=>{this['fire']('loadSourceResources',_0x52251b);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x43eaf6,_0x361461['bodyCollection'],_0xc8a22f);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Hn)||document['body'];}['_createBaseBalloonPanel'](_0x3d46fe,_0x3bf7f5){const _0x2c5cfe=new zt(_0x3d46fe);return _0x2c5cfe['extendTemplate']({'attributes':{'class':_0x3bf7f5}}),this['bodyCollection']['add'](_0x2c5cfe),_0x2c5cfe;}['_setBalloonPanelContent'](_0x8ee302,_0x1f61ae,_0x21da25){if(_0x8ee302['content']['clear'](),!_0x21da25['document']['isHidden']&&_0x21da25['document']['enabled']){const _0x2c4b4a=this['_createBalloonButton'](_0x1f61ae,{'label':Mi(_0x1f61ae,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0xe44a24});_0x2c4b4a['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x8ee302['content']['add'](_0x2c4b4a);}if(_0x21da25['urls']['enabled']){const _0x4e9071=this['_createBalloonButton'](_0x1f61ae,{'label':Mi(_0x1f61ae,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x3e37f3});_0x4e9071['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_urlInputView']['focus']();}),_0x8ee302['content']['add'](_0x4e9071);}if(_0x21da25['files']['enabled']){const _0x4e4e40=new _0x1c5873(_0x1f61ae);_0x4e4e40['set']({'label':Mi(_0x1f61ae,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x1b305a,'withText':!0x0,'tooltip':!0x0,'class':Nn,'allowMultipleFiles':!0x0}),_0x4e4e40['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x4e4e40['on']('done',(_0x21f9ba,_0x114758)=>{this['fire']('addFileToContext',_0x114758);}),_0x4e4e40['tooltip']=!0x0,_0x8ee302['content']['add'](_0x4e4e40);}for(const _0x1109d0 of _0x21da25['sources']){const _0xf1c6b0=this['_createBalloonButton'](_0x1f61ae,{'label':_0x1109d0['label'],'icon':_0x1109d0['icon']||_0x3d07f2,'type':'source'});_0x8ee302['content']['add'](_0xf1c6b0),_0xf1c6b0['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x1109d0,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x16975e of _0x21da25['customItems']||[]){const _0x43d575=this['_createBalloonButton'](_0x1f61ae,{'label':_0x16975e['label'],'icon':_0x16975e['icon']||_0x3d07f2,'type':'customItem'});_0x8ee302['content']['add'](_0x43d575),_0x43d575['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x16975e);});}this['_hasExactlyOneSource']=0x1===_0x8ee302['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x4be8a8,_0x1a5011){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x1a5011),this['_urlInputView']['on']('submitUrl',(_0x445417,_0x4b8eb2)=>{this['_handleUrlSubmit'](_0x4b8eb2);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});}),_0x4be8a8['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x46aeb4,_0x44b28e){const _0x50a65c='source'===_0x44b28e['type']?new SourcesBalloonButtonView(_0x46aeb4):new yt(_0x46aeb4);return _0x50a65c['set']({'label':_0x44b28e['label'],'icon':_0x44b28e['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Nn}),_0x50a65c;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x199f72){const _0x23b297=this['_addContextBalloonConfig'];_0x23b297['buttonView']['isOn']=_0x199f72,_0x199f72?_0x23b297['balloonView']['show']():_0x23b297['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x473b82,buttonView:_0x1c3a22,hideMethod:_0x4d5d3b}=this['_addContextBalloonConfig'];jt({'emitter':_0x473b82,'contextElements':[_0x473b82['element'],_0x1c3a22['element']],'callback':()=>{_0x4d5d3b();},'activator':()=>_0x1c3a22['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0xd6e99d,_0x5cbfaa,_0x51b7d3=!0x1,_0x4cb2c8=!0x1){const _0x200cad='conversation'===_0x5cbfaa||!0x0===_0xd6e99d['isReadOnly'],_0x20f959=new AIChatContextItemButtonView(this['locale'],_0xd6e99d,_0x200cad,_0x51b7d3,_0x4cb2c8);return _0x200cad||_0x20f959['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x20f959['id']);}),_0x20f959;}['_addContextToCollection'](_0x514cc2,_0x20af49){_0x20af49['add'](_0x514cc2,0x0);}['_removeContextFromCollection'](_0x7453ff,_0x109ccd){const _0x596642=_0x109ccd['find'](_0x599e4b=>_0x599e4b['id']===_0x7453ff);_0x596642&&_0x109ccd['remove'](_0x596642);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x35a75d){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x35a75d);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x109e60){super(_0x109e60),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[xn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x59e6ed=new Lt();return _0x59e6ed['content']=_0x595cb4,_0x59e6ed['extendTemplate']({'attributes':{'class':xn+'__arrow'}}),_0x59e6ed;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x4550cb){super(_0x4550cb),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 _0x23a0dd=new yt(this['locale']);return _0x23a0dd['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x53a294}),_0x23a0dd['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x23a0dd;}['_createLoaderView'](){const _0x2304a8=new Nt(this['locale']);return _0x2304a8['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':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x2304a8;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0xcbb66c,_0x17ba65){super(_0xcbb66c),this['_filesEnabled']=_0x17ba65['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0xcbb66c,{'bodyCollection':_0x17ba65['bodyCollection'],'searchInputVisibleFrom':_0x17ba65['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0xcbb66c),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0xcbb66c),this['_loaderView']=this['_createLoaderView'](_0xcbb66c),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0xcbb66c),this['_dropZoneView']=new AIChatDropZoneView(_0xcbb66c),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'](...bn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x35b6e9=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x35b6e9['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x35b6e9['if']('isLoading','ck-hidden',_0x349124=>_0x349124||!this['isModelAvailable']),_0x35b6e9['if']('isModelAvailable','ck-hidden',_0x523b32=>!_0x523b32||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x35b6e9['if']('isLoading','ck-hidden',_0x53665e=>!_0x53665e)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x35b6e9['if']('isModelAvailable','ck-hidden',_0x329345=>_0x329345)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'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'](_0x3575a9,_0x533979){return new AIChatContextPanelView(_0x3575a9,_0x533979);}['_createPromptInputView'](_0x23f8b7){return new AIChatPromptInputView(_0x23f8b7,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x3a715a){return new AIChatPromptCapabilitiesView(_0x3a715a);}['_createLoaderView'](_0x29c385){return new AIChatControlsLoaderView(_0x29c385);}['_createModelUnavailableMessageView'](_0x5c579a){const _0x55a9fc=new AIChatModelUnavailableMessageView(_0x5c579a);return _0x55a9fc['delegate']('startConversation')['to'](this),_0x55a9fc;}['_handlePromptInputFocus'](_0x2db952,_0x46efa3,_0x1e35c0){_0x1e35c0?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x2672a3,_0x33e8fb){this['_contextPanelView']['addContextItem'](_0x2672a3,_0x33e8fb);}['removeContextItem'](_0x3a1950){this['_contextPanelView']['removeContextItem'](_0x3a1950);}['setContextItemLoading'](_0x3d2976,_0x36fcf6){this['_contextPanelView']['setContextItemLoading'](_0x3d2976,_0x36fcf6);}['setIsUploadInProgress'](_0x37f030){this['_promptInputView']['setIsUploadInProgress'](_0x37f030);}['setConversationContext'](_0x245640){this['_contextPanelView']['setConversationContext'](_0x245640);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0xd90eac,_0x3056b5,_0x558034){this['_contextPanelView']['updateResourceState'](_0xd90eac,_0x3056b5,_0x558034);}['setWebSearch'](_0x4d1117){this['_promptCapabilitiesView']['setWebSearch'](_0x4d1117);}['setReasoning'](_0x135a8e){this['_promptCapabilitiesView']['setReasoning'](_0x135a8e);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x4b3eb6){this['_contextPanelView']['setAddContextOptions'](_0x4b3eb6);}['setInputPlaceholder'](_0x32f626){this['_promptInputView']['setPlaceholderText'](_0x32f626);}['setModelList'](_0x910d5f,_0x34ca60){this['_promptCapabilitiesView']['setModelList'](_0x910d5f,_0x34ca60);}['setModel'](_0x1aedf0){_0x1aedf0?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x1aedf0)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x2af197){this['_promptCapabilitiesView']['disableModelSelector'](_0x2af197);}['populateSourceResourceBalloon'](_0x158932,_0x1c924e,_0x2afad6,_0x5c9bde){this['_contextPanelView']['populateSourceResourceBalloon'](_0x158932,_0x1c924e,_0x2afad6,_0x5c9bde);}['closeSourceResourceBalloon'](_0x24d93d){this['_contextPanelView']['closeSourceResourceBalloon'](_0x24d93d);}['focusPromptInput'](_0x53c9c1=!0x1){this['_promptInputView']['focus'](_0x53c9c1);}['setPromptInputValue'](_0x5ef60b){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x5ef60b;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x3e3769){super(_0x3e3769);const _0x5f6a4e=new yt(_0x3e3769);_0x5f6a4e['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x5f6a4e['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x5f6a4e]}]});}}class AIHeaderView extends _0x27b307{['resizeButton'];constructor(_0x1aefbc,_0x4df47a){super(_0x1aefbc,{'label':_0x4df47a['label'],'class':'ck-ai-header\x20'+_0x4df47a['class'],'icon':_0x4df47a['icon']}),this['set']('isMaximized',!0x1),_0x4df47a['content']&&this['children']['add'](_0x4df47a['content']),_0x4df47a['showResizeButton']&&(this['resizeButton']=Fi(_0x1aefbc,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x6065f2){super(_0x6065f2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x6065f2,'AI_DISCLAIMER_TEXT')}]}]});}}function Un(_0x3a5713,_0xdedddc){const _0x4d05c6=new yt(_0x3a5713);return _0x4d05c6['set']({'label':Mi(_0x3a5713,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x744bad,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x4d05c6['on']('execute',()=>{_0xdedddc['fire']('startConversation');}),_0x4d05c6;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0xe20035,_0x48e168){super(_0xe20035),this['_bodyCollection']=new Xt(_0xe20035),this['_bodyCollection']['attachToDom']();const _0x3594f4=Un(_0xe20035,this);this['chatHeader']=new AIHeaderView(_0xe20035,{'label':Mi(_0xe20035,'AI_CHAT_HEADING'),'icon':_0x57f4ad,'class':'ck-ai-header_chat','content':_0x3594f4,'showResizeButton':_0x48e168['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0xe20035,this['_bodyCollection']),this['chatFeed']['delegate'](...Os)['to'](this),this['chatControls']=new AIChatControlsView(_0xe20035,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x48e168['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x48e168['filesEnabled']}),this['chatControls']['delegate'](...Os)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0xe20035),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0xe20035['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x4147a1,_0x307ae0,_0xbb2d98,_0x42e6dc){this['chatControls']['populateSourceResourceBalloon'](_0x4147a1,_0x307ae0,_0xbb2d98,_0x42e6dc);}['closeSourceResourceBalloon'](_0x480b9d){this['chatControls']['closeSourceResourceBalloon'](_0x480b9d);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x464fb9{static get['requires'](){return[AITabs];}['_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(_0x37a46d){super(_0x37a46d);const _0x417897=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x417897['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'](_0x417897),this['_view']['delegate'](...Os)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x38e2b4,{showDiff:_0x5a79ae})=>{this['showDiff']=_0x5a79ae;}),this['disableControls'](),_0x417897['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x57f4ad,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x417897['view'],'isMaximized',_0x1d3099=>_0x1d3099),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x1aa03b=>_0x1aa03b),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x2f3ee6){const _0x20f3fc=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x2f3ee6['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x20f3fc}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x5b23ab,staticMessage:_0x129b40}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x5b23ab,'initialContent':'<p>'+_0x129b40+'</p>'});});}async['addFeedItemUserMessage'](_0x12ac33){const _0xb15858=_0x12ac33['attributes']?.['displayedPrompt']||_0x12ac33['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x12ac33['contextItems']['values']()),'initialContent':'<p>'+_0xb15858+'</p>','id':_0x12ac33['id']});});}async['addFeedItemError']({errorMessage:_0x4be16a,id:_0xecd70b}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4be16a+'</p>','id':_0xecd70b});});}async['addFeedItemAIReply'](_0x37b309){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x37b309['interactionId']+':'+_0x37b309['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x4bf5b4){const _0x632467=ms(this['context']),_0x360103=_0x632467['map'](_0x3daa97=>_0x3daa97['config']['get']('ai.availableReplyActions')||[...Ds]);let _0x31f60d=_0x360103['reduce']((_0x247672,_0x1ebf60)=>_0x247672['filter'](_0x15cb10=>_0x1ebf60['includes'](_0x15cb10)),_0x360103[0x0]||[...Ds]);const _0x22ff89=_0x632467['every'](_0xe70181=>_0xe70181['plugins']['has']('TrackChanges')),_0x298fee=_0x632467['map'](_0x4d3667=>_0x4d3667['commands']['get']('trackChanges'));return _0x22ff89?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x298fee,'value',(..._0x1ef8c8)=>_0x1ef8c8['some'](_0x400624=>_0x400624))):_0x31f60d=_0x31f60d['filter'](_0x5f1d36=>'insertSuggestion'!=_0x5f1d36),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4bf5b4['interactionId']+':'+_0x4bf5b4['id'],'areActionsDisabled':_0x4bf5b4['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x31f60d}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x1801fb,_0x409263){return this['_promiseQueue']['enqueue'](async()=>{const _0x26e97b=this['_view']['chatFeed']['children']['last'];if(_0x26e97b instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x26e97b),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1801fb['id'],'capabilities':{'isWebSearchEnabled':_0x26e97b['capabilities']['isWebSearchEnabled']||_0x409263['isWebSearchEnabled'],'isReasoningEnabled':_0x26e97b['capabilities']['isReasoningEnabled']||_0x409263['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1801fb['id'],'capabilities':_0x409263});});}async['addFeedItemCustomElement'](_0xffd712,_0x3c07ba){let _0x575544;return await this['_promiseQueue']['enqueue'](async()=>{_0x575544=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0xffd712,'id':_0x3c07ba});}),_0x575544;}['removeFeedItem'](_0x359acd){this['_view']['chatFeed']['removeItem'](_0x359acd);}['hasFeedItem'](_0x24955){return this['_view']['chatFeed']['hasItem'](_0x24955);}['updateFeedInteractionHeader'](_0x4501b9){const _0x518288=this['_view']['chatFeed']['children']['find'](_0x3821e9=>_0x3821e9['options']['id']==_0x4501b9['id']&&_0x3821e9 instanceof AIChatFeedInteractionHeaderView);_0x518288&&_0x518288['set']('isVisible',_0x4501b9['isVisible']);}async['updateFeedItemAIReplyContent'](_0x32f0a1){const _0x20369c=_0x32f0a1['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x16ef8e=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x32f0a1,'abortSignal':_0x16ef8e,'renderingStrategy':_0x20369c}),_0x32f0a1['isDone']&&this['markFeedItemAsDone'](_0x32f0a1['id']);});}['updateFeedItemAIReplySources'](_0x2d155f,_0x1a50e6){this['_view']['chatFeed']['updateWebSources'](_0x2d155f,_0x1a50e6);}async['updateFeedItemAIReplySuggestionContent'](_0x5cfe49){return this['_promiseQueue']['enqueue'](async _0x3de942=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x5cfe49,'abortSignal':_0x3de942}),_0x5cfe49['isDone']&&this['markFeedItemAsDone'](_0x5cfe49['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x56ff3c){this['_view']['chatFeed']['updateSuggestionPartState'](_0x56ff3c);}['setFeedItemAIReplySuggestionPartActive'](_0x4b648e){this['_view']['chatFeed']['setSuggestionPartActive'](_0x4b648e);}['markFeedItemAsDone'](_0x14416a){this['_view']['chatFeed']['markItemAsDone'](_0x14416a);}['removeFeedInteraction'](_0x521c87){this['_view']['chatFeed']['getItemIds']()['filter'](_0x19f852=>_0x19f852['startsWith'](_0x521c87))['forEach'](_0xac29c3=>this['_view']['chatFeed']['removeItem'](_0xac29c3));}['startInteraction'](){const _0x4daac9=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x4daac9),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x23a0e4){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x36a795=>_0x36a795['startsWith'](_0x23a0e4['id']))['forEach'](_0x5bfe35=>this['markFeedItemAsDone'](_0x5bfe35)),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'](_0x5394dd,_0x7fde14){this['_view']['chatControls']['addContextItem'](_0x5394dd,_0x7fde14);}['removeContextItem'](_0x22f5d2){this['_view']['chatControls']['removeContextItem'](_0x22f5d2);}['setContextItemLoading'](_0x4d533d,_0xeae1f9){this['_view']['chatControls']['setContextItemLoading'](_0x4d533d,_0xeae1f9);}['setIsUploadInProgress'](_0x294d15){this['_view']['chatControls']['setIsUploadInProgress'](_0x294d15);}['setConversationContext'](_0x53c365){this['_view']['chatControls']['setConversationContext'](_0x53c365);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x9d8c76,_0x4d3132,_0x572ae0){this['_view']['chatControls']['updateResourceState'](_0x9d8c76,_0x4d3132,_0x572ae0);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x424073){this['_view']['chatControls']['setAddContextOptions'](_0x424073);}['updateCapabilities'](_0x48e6b2){this['_view']['chatControls']['setWebSearch'](_0x48e6b2['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x48e6b2['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x48e6b2));}['setSelectedModel'](_0x588609,_0x54d561){this['_view']['chatControls']['setModel'](_0x588609),_0x54d561&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0xe444da){this['feedItemRenderingStrategy']=_0xe444da;}['toggleLoadingSkeleton'](_0x41bd1d){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x41bd1d);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x4455ba,_0x3e870a=!0x1){if(_0x3e870a&&!St()&&_0x4455ba['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x4455ba);this['_view']['chatHeader']['label']=_0x4455ba;}['setLoadingMessage'](_0x31a2d6){this['_view']['chatFeed']['setLoadingMessage'](_0x31a2d6);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x268329){let _0x3211d7=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x268329[_0x3211d7],_0x3211d7++,_0x3211d7===_0x268329['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x19389e){return _0x19389e['isWebSearchEnabled']&&_0x19389e['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x19389e['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x19389e['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x2f54ae){return _0x2f54ae?_0x2f54ae['isWebSearchEnabled']&&_0x2f54ae['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x2f54ae['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x2f54ae['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x43e5a5,_0x559ac2,_0x339904,_0x9f0a99){this['_view']['populateSourceResourceBalloon'](_0x43e5a5,_0x559ac2,_0x339904,_0x9f0a99);}['closeSourceResourceBalloon'](_0x5033ca){this['_view']['closeSourceResourceBalloon'](_0x5033ca);}['setPromptInputValue'](_0x4a945d){this['_view']['chatControls']['setPromptInputValue'](_0x4a945d);}['focusPromptInput'](_0x17c555=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x17c555);}['scrollFeedToSuggestion'](_0x20b2d6,_0x567d8c){this['_view']['chatFeed']['scrollToSuggestion'](_0x20b2d6,_0x567d8c);}['startAutoScroll'](_0x106438={}){this['_view']['chatFeed']['startAutoScroll'](_0x106438);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x4cc208,_0x985c30){super(_0x4cc208),this['sections']=_0x985c30,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x56d288){let _0x4be4ef=0x0,_0x34d0d3=0x0;for(const _0xa4e38a of this['sections']){const {resultsCount:_0x111568,totalItemsCount:_0x297327}=_0xa4e38a['filter'](_0x56d288);_0x4be4ef+=_0x111568,_0x34d0d3+=_0x297327;}return{'resultsCount':_0x4be4ef,'totalItemsCount':_0x34d0d3};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x5188e3,{title:_0x2e4daa,items:_0x1a828e}){super(_0x5188e3);const _0xfc4cd0=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x2e4daa,this['itemsViews']=_0x1a828e;const _0x42363d=new Nt(_0x5188e3);_0x42363d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x5188e3),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0xfc4cd0['if']('isVisible','ck-hidden',_0x3602b3=>!_0x3602b3)]},'children':[_0x42363d,this['_itemsListView']]});}['filter'](_0x368fa6){const _0x488ee4=this['itemsViews']['length'];let _0x1aaab3=0x0;for(const _0x34de5a of this['itemsViews']){if(_0x368fa6){const _0x395bdd=_0x34de5a['isMatching'](_0x368fa6);_0x34de5a['isVisible']=!!_0x395bdd,_0x34de5a['highlightText'](_0x368fa6);}else _0x34de5a['isVisible']=!0x0,_0x34de5a['highlightText'](null);_0x34de5a['isVisible']&&_0x1aaab3++;}return this['isVisible']=_0x1aaab3>0x0,{'resultsCount':_0x1aaab3,'totalItemsCount':_0x488ee4};}['getItem'](_0x1970e8){return this['itemsViews']['find'](_0x4dc419=>_0x4dc419['id']===_0x1970e8);}['removeItem'](_0x1948a5){const _0x497e63=this['itemsViews']['indexOf'](_0x1948a5);-0x1!==_0x497e63&&(this['itemsViews']['splice'](_0x497e63,0x1),this['_itemsListView']['items']['remove'](_0x1948a5));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
- _0x277758(Ht){['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(_0x3c7732,_0x1a9daa){super(_0x3c7732);const _0xc05e5f=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x1a9daa['pinned']),this['set']('loadingState',null),this['set']('title',_0x1a9daa['title']),this['id']=_0x1a9daa['id'];const {createdAt:_0x4d3d86,active:_0x46b832=!0x1}=_0x1a9daa;this['_titleView']=new _0x3afbec(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x130ca0=this['_createCheckView'](),_0x598640=this['_createPinButtonView'](_0x3c7732),_0x2680d5=this['_createMenuDropdownView'](),_0x4c243a=this['_createEditInputView'](_0x3c7732),_0x4a3497=this['_createAcceptEditButtonView'](_0x3c7732,_0x4c243a),_0x1ba997=this['_createCancelEditButtonView'](_0x3c7732);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x598640),this['actions']['add'](_0x2680d5),this['on']('change:isEdit',(_0x26f0d9,_0x1fea19,_0x30c5aa)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x30c5aa?(this['actions']['add'](_0x4a3497),this['actions']['add'](_0x1ba997),this['mainContent']['add'](_0x4c243a),_0x4c243a['element']['value']=this['title']||'',_0x4c243a['element']['focus']()):(this['actions']['add'](_0x598640),this['actions']['add'](_0x2680d5),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x46b832?'ck-ai-chat-history__item--active':'',_0xc05e5f['if']('isVisible','ck-hidden',_0x3ddc91=>!_0x3ddc91),_0xc05e5f['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',_0xc05e5f['if']('loadingState','ck-hidden',_0x36cf06=>!!_0x36cf06)]},'children':_0x46b832?[_0x130ca0]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0xc05e5f['if']('loadingState','ck-hidden',_0x271613=>!_0x271613)]},'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',_0xc05e5f['if']('loadingState','ck-hidden',_0xb32265=>!!_0xb32265)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0xc05e5f['if']('loadingState','ck-hidden',_0x506b4b=>!_0x506b4b)]},'children':[{'text':_0xc05e5f['to']('loadingState',_0x3a576a=>_0x3a576a?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x3a576a]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4d3d86]}]},{'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'](_0x3afa33){this['set']('title',_0x3afa33);}['updateLoadingState'](_0x532841,_0x4b24d4){this['set']('loadingState',_0x4b24d4?_0x532841:null);}['_createCheckView'](){const _0xbedef0=new Lt();return _0xbedef0['set']({'content':_0x3d9fb7}),_0xbedef0;}['_createPinButtonView'](_0x16a2d1){const _0x2bf2ca=new yt(_0x16a2d1);return _0x2bf2ca['set']({'label':Mi(_0x16a2d1,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x11440c,'withText':!0x1,'tooltip':!0x0}),_0x2bf2ca['bind']('isOn')['to'](this,'pinned'),_0x2bf2ca['on']('execute',()=>{const _0x317f8e=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x317f8e});}),_0x2bf2ca;}['_createMenuDropdownView'](){const _0x48d5b1=Ft(this['locale']),_0x2bc534=_0x48d5b1['panelView']['children'];_0x48d5b1['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x362133}),_0x48d5b1['panelPosition']='sw';const _0x57c331=new yt(this['locale']);_0x57c331['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x57c331['withText']=!0x0,_0x57c331['on']('execute',()=>{this['isEdit']=!0x0;});const _0xf3f4bf=new yt(this['locale']);_0xf3f4bf['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0xf3f4bf['withText']=!0x0,_0xf3f4bf['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x475bbc=new Dt(this['locale']),_0x4d155a=new Ht(this['locale']);_0x4d155a['children']['add'](_0x57c331);const _0x255c38=new Ht(this['locale']);return _0x255c38['children']['add'](_0xf3f4bf),_0x475bbc['items']['addMany']([_0x4d155a,_0x255c38]),_0x2bc534['add'](_0x475bbc),_0x48d5b1;}['_createEditInputView'](_0x2a7a81){const _0x47df8a=new _0x56df63(_0x2a7a81),_0x512da9=_0x47df8a['bindTemplate'];return _0x47df8a['extendTemplate']({'on':{'keydown':_0x512da9['to'](_0x34602d=>{'Enter'==_0x34602d['key']&&this['_commitEditInputValue'](_0x47df8a);})}}),_0x47df8a;}['_createAcceptEditButtonView'](_0x349f52,_0x5852cf){const _0x1dafa6=new yt(_0x349f52);return _0x1dafa6['set']({'icon':_0x3d9fb7,'withText':!0x1,'tooltip':Mi(_0x349f52,'AI_CHAT_HISTORY_ACCEPT')}),_0x1dafa6['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x1dafa6['on']('execute',()=>{this['_commitEditInputValue'](_0x5852cf);}),_0x1dafa6;}['_commitEditInputValue'](_0x450166){const _0x523dac=_0x450166['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x523dac});}['_createCancelEditButtonView'](_0x41bf25){const _0x2e5e45=new yt(_0x41bf25);return _0x2e5e45['set']({'icon':_0x346199,'withText':!0x1,'tooltip':Mi(_0x41bf25,'AI_CHAT_HISTORY_CANCEL')}),_0x2e5e45['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x2e5e45['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x2e5e45;}['_createSpinnerView'](){const _0x189df3=new AISpinnerView('tiny');return _0x189df3['isVisible']=!0x0,_0x189df3;}['isMatching'](_0x216436){return'string'==typeof this['title']&&this['title']['match'](_0x216436)?{'title':!0x0}:null;}['highlightText'](_0x3ed58f){this['_titleView']['highlightText'](_0x3ed58f);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x11f426,_0xb8d1ba){super(_0x11f426),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x395dde=Un(_0x11f426,this);this['headerView']=new AIHeaderView(_0x11f426,{'label':Mi(_0x11f426,'AI_CHAT_HISTORY_HEADING'),'icon':_0x2251d5,'class':'ck-ai-header_history','content':_0x395dde,'showResizeButton':_0xb8d1ba}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x11f426,[]),this['sectionsView']['delegate'](...Bn)['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',_0x50fdb9=>!_0x50fdb9)]}}),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 _0x55bd25=new _0x40453d(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x4519c0=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x4519c0),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x53f459=this['_createErrorView']();return _0x53f459['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x58b9de=>!_0x58b9de)]}}),_0x55bd25['on']('render',()=>{_0x55bd25['children']['add'](_0x53f459,0x1);}),_0x55bd25['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x5137bb=>!_0x5137bb)]}}),_0x55bd25;}['_createSkeletonView'](){const _0x165b3e=new AISkeletonView(this['locale'],Ls['aiHistory']);return _0x165b3e['bind']('isVisible')['to'](this,'isLoading'),_0x165b3e;}['_createErrorView'](){const _0x131011=new Nt(this['locale']),_0x31aa06=new yt(this['locale']);_0x31aa06['set']({'withText':!0x1,'icon':_0x346199,'class':'ck-ai-notification_error__dismiss-button'}),_0x31aa06['bind']('isVisible')['to'](this,'hasItems',_0x33ea90=>!!_0x33ea90),_0x31aa06['on']('execute',()=>{this['errorMessage']='';});const _0x1f5e09=this['bindTemplate'];return _0x131011['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x1f5e09['to']('errorMessage')}]},_0x31aa06]}),_0x131011;}['_createEmptyStateView'](){const _0x557ab8=new Nt(this['locale']);return _0x557ab8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x3cc305=>!_0x3cc305)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x557ab8;}['_createListItemViews'](_0x10c203,_0x4b54dc){const _0x5c511=[];for(const _0x1985b9 of _0x10c203){const _0x1d1336=new AIChatHistoryListItemView(_0x4b54dc,_0x1985b9);_0x1d1336['delegate'](...Bn)['to'](this),_0x5c511['push'](_0x1d1336);}return _0x5c511;}['updateHistoryItemsWithCategories'](_0x205bdc){const _0x2381bc=this['locale']||'en',_0x324a22=[];for(const _0x224db0 of _0x205bdc){const _0x46a90a=this['_createListItemViews'](_0x224db0['items'],_0x2381bc);_0x324a22['push'](new AIChatHistoryListView(_0x2381bc,{'title':_0x224db0['title'],'items':_0x46a90a}));}this['sectionsView']['sections']=_0x324a22,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x324a22),this['hasItems']=_0x205bdc['some'](_0x1e5dc9=>_0x1e5dc9['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x45a784){for(const _0xa83c77 of this['sectionsView']['sections']){const _0xbacaf=_0xa83c77['getItem'](_0x45a784);if(_0xbacaf){if(_0xa83c77['removeItem'](_0xbacaf),0x0===_0xa83c77['itemsViews']['length']){const _0x19b8b9=this['sectionsView']['sections']['indexOf'](_0xa83c77);-0x1!==_0x19b8b9&&(this['sectionsView']['sections']['splice'](_0x19b8b9,0x1),this['sectionsView']['items']['remove'](_0xa83c77));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x1ab835,_0x104ac6){for(const _0x4128c5 of this['sectionsView']['sections']){const _0x660427=_0x4128c5['getItem'](_0x1ab835);if(_0x660427){_0x660427['updateTitle'](_0x104ac6);break;}}}['updateItemLoadingState'](_0x3ca1c7,_0x15db99,_0x34d54a){for(const _0x38d8a5 of this['sectionsView']['sections']){const _0x3c3cc6=_0x38d8a5['getItem'](_0x3ca1c7);if(_0x3c3cc6){_0x3c3cc6['updateLoadingState'](_0x15db99,_0x34d54a);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x5ead7c=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x5ead7c);}}}const Bn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x464fb9{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x571535){super(_0x571535);const _0x122bd6=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x122bd6['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x122bd6),this['_historyView']['delegate'](...Bn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x122bd6['view'],'isMaximized',_0xfd9695=>_0xfd9695),_0x122bd6['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x2251d5,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x49be8e){this['_historyView']['removeHistoryItem'](_0x49be8e);}['updateItems'](_0x1444cd){this['_historyView']['updateHistoryItemsWithCategories'](_0x1444cd);}['updateItemTitle'](_0x2f2080,_0x192aa2){this['_historyView']['updateItemTitle'](_0x2f2080,_0x192aa2);}['updateItemLoadingState'](_0x1af5f4,_0x42c142,_0x54cde3){this['_historyView']['updateItemLoadingState'](_0x1af5f4,_0x42c142,_0x54cde3);}['setLoadingSkeleton'](_0x471faa){this['_historyView']['isLoading']=_0x471faa;}['showError'](_0x328868){this['_historyView']['errorMessage']=_0x328868;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x27be0c,title:_0x4e2036,createdAt:_0x2a8a45,updatedAt:_0x2f7ee6,pinned:_0x18ffa3}){super(),this['id']=_0x27be0c,this['createdAt']=new Date(_0x2a8a45),this['set']('title',_0x4e2036),this['set']('updatedAt',_0x2f7ee6?new Date(_0x2f7ee6):null),this['set']('pinned',_0x18ffa3||!0x1);}['updateTitle'](_0xf63af7){this['set']('title',_0xf63af7),this['updatedAt']=new Date();}['updatePinned'](_0x46fc3e){this['set']('pinned',_0x46fc3e),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x177c02,group:_0x370a81}){super(),this['connector']=_0x177c02,this['group']=_0x370a81;}async['init'](){try{const _0x253919=this['connector']['fetchConversations'](this['group']),_0x35a5d5=await _0x253919['getConversations']();this['loadItems'](_0x35a5d5);}catch(_0x21b801){this['fire']('error',{'error':_0x21b801,'operation':'init'});}}['addItem'](_0x8c935d){this['items']['push'](_0x8c935d);}async['removeItem'](_0x52b563){const _0x5f1a26=this['items']['findIndex'](_0x866510=>_0x866510['id']===_0x52b563);if(-0x1===_0x5f1a26)return!0x1;try{return await this['connector']['deleteConversation'](_0x52b563)['execute'](),this['items']['splice'](_0x5f1a26,0x1),this['fire']('itemRemoved',{'itemId':_0x52b563}),!0x0;}catch(_0x4f8138){return this['fire']('error',{'error':_0x4f8138,'operation':'removeItem','itemId':_0x52b563}),!0x1;}}['getItem'](_0x1efd4d){return this['items']['find'](_0x1f4a5d=>_0x1f4a5d['id']===_0x1efd4d);}async['updateItemTitle'](_0x16c85a,_0x3849ca){const _0x2845f6=this['getItem'](_0x16c85a);if(!_0x2845f6)return!0x1;try{return await this['connector']['updateConversation'](_0x16c85a,{'title':_0x3849ca})['getResult'](),_0x2845f6['updateTitle'](_0x3849ca),this['fire']('itemUpdated',{'itemId':_0x16c85a,'updates':{'title':_0x3849ca}}),!0x0;}catch(_0x502e56){return this['fire']('error',{'error':_0x502e56,'operation':'updateItemTitle','itemId':_0x16c85a}),!0x1;}}async['updateItemPinned'](_0x3853da,_0x2cedaf){const _0x1edef0=this['getItem'](_0x3853da);if(!_0x1edef0)return!0x1;try{return await this['connector']['updateConversation'](_0x3853da,{'pinned':_0x2cedaf})['getResult'](),_0x1edef0['updatePinned'](_0x2cedaf),this['fire']('itemUpdated',{'itemId':_0x3853da,'updates':{'pinned':_0x2cedaf}}),!0x0;}catch(_0x5c6e93){return this['fire']('error',{'error':_0x5c6e93,'operation':'updateItemPinned','itemId':_0x3853da}),!0x1;}}['loadItems'](_0x4b6def){try{this['items']=[],_0x4b6def['map'](_0x38bf5d=>{this['addItem'](new AIChatHistoryItem(_0x38bf5d));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2294e9){this['fire']('error',{'error':_0x2294e9,'operation':'loadItems'});}}['getItems'](_0x2adf79={}){const _0xa38a86=void 0x0!==_0x2adf79['pinned']&&_0x2adf79['pinned'],_0x155444=_0x2adf79['from']?new Date(_0x2adf79['from']['getFullYear'](),_0x2adf79['from']['getMonth'](),_0x2adf79['from']['getDate']()):null,_0xf3fac8=_0x2adf79['to']?new Date(_0x2adf79['to']['getFullYear'](),_0x2adf79['to']['getMonth'](),_0x2adf79['to']['getDate']()):null;return this['items']['filter'](_0x412090=>{if(_0x412090['pinned']!==_0xa38a86)return!0x1;if(_0xf3fac8){const _0x4a848c=new Date(_0x412090['createdAt']['getFullYear'](),_0x412090['createdAt']['getMonth'](),_0x412090['createdAt']['getDate']());return _0x155444?_0x155444['getTime']()===_0xf3fac8['getTime']()?_0x4a848c['getTime']()===_0x155444['getTime']():_0x4a848c<_0xf3fac8&&_0x4a848c>=_0x155444:_0x4a848c<_0xf3fac8;}return!0x0;});}}class AIChatHistoryController extends _0x464fb9{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x4ee810=this['context']['plugins']['get'](AITabs);try{const _0x202231=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x202231}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0xe05425,_0x2a900f)=>{this['_setItemLoading'](_0x2a900f['id'],'remove'),this['_handleRemove'](_0x2a900f['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x4eb89f,_0x11cebd)=>{this['_setItemLoading'](_0x11cebd['id'],'rename'),this['_handleEditTitle'](_0x11cebd['id'],_0x11cebd['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x22c29b,_0x1bc53c)=>{void 0x0!==_0x1bc53c['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x1bc53c['itemId'],_0x1bc53c['updates']['title']),void 0x0!==_0x1bc53c['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x1bc53c['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x4ebd60,_0x19d688)=>{this['_aiChatController']['_handleRemovedConversation'](_0x19d688['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x19d688['itemId']),this['_clearItemLoading'](_0x19d688['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x587f1d,_0x1459a4)=>{this['_handleHistoryErrorUI'](_0x1459a4['error'],_0x1459a4['operation'],_0x1459a4['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x7f7b30,_0x847f6a)=>{this['_handleSelectConversation'](_0x847f6a['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x14615e,_0x2e8fad)=>{const _0x1d361a=_0x2e8fad['pinned']?'pin':'unpin';this['_setItemLoading'](_0x2e8fad['id'],_0x1d361a),this['_handleTogglePin'](_0x2e8fad['id'],_0x2e8fad['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x4ee810['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x4ee810['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x167cf9){this['_handleHistoryErrorUI'](_0x167cf9,'init');}}async['_handleEditTitle'](_0x25dcd7,_0x548254){await this['history']['updateItemTitle'](_0x25dcd7,_0x548254);}async['_handleTogglePin'](_0x3e80b2,_0x4ddfc6){await this['history']['updateItemPinned'](_0x3e80b2,_0x4ddfc6);}async['_handleRemove'](_0x359887){await this['history']['removeItem'](_0x359887);}async['_handleSelectConversation'](_0xe3d52){await this['_aiChatController']['loadConversation'](_0xe3d52);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x256819=this['_aiChatController']['activeConversation']?.['id'],_0x5e320f=this['_getCategorizedItems']()['map'](_0x52ff68=>({'title':_0x52ff68['title'],'items':_0x52ff68['items']['map'](_0x5b8b03=>({'id':_0x5b8b03['id'],'title':_0x5b8b03['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x5b8b03['createdAt'])['toLocaleDateString'](),'active':_0x5b8b03['id']===_0x256819,'pinned':_0x5b8b03['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x5e320f);}['_setItemLoading'](_0x307af0,_0x3c552c){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x307af0,_0x3c552c,!0x0);}['_clearItemLoading'](_0x28ddfb){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x28ddfb,null,!0x1);}['_handleHistoryErrorUI'](_0x2374ac,_0x2acb78,_0x226706){const _0x4947fd=this['_generateErrorMessage'](_0x2acb78,_0x226706);this['_aiChatHistoryUi']['showError'](_0x4947fd),_0x226706&&this['_clearItemLoading'](_0x226706),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x125772,_0x5cfb86){const _0x23940a=_0x5cfb86?this['history']['getItem'](_0x5cfb86):null,_0x191cab=_0x23940a?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x125772){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x191cab);case'updateItemPinned':{const _0x3deac7=Mi(this['context']['locale'],_0x23940a?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x3deac7,_0x191cab]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x191cab);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x5769b2=new Date(),_0x33d1cf=new Date(_0x5769b2['getFullYear'](),_0x5769b2['getMonth'](),_0x5769b2['getDate']()),_0x5ca4de=new Date(_0x33d1cf);_0x5ca4de['setDate'](_0x5ca4de['getDate']()-0x1);const _0x39bc58=new Date(_0x33d1cf);_0x39bc58['setDate'](_0x39bc58['getDate']()-0xe);const _0x441e09=this['history']['getItems']({'pinned':!0x0}),_0x2cc058=this['history']['getItems']({'from':_0x33d1cf,'to':_0x33d1cf}),_0x5d57a4=this['history']['getItems']({'from':_0x5ca4de,'to':_0x5ca4de}),_0x2bd92c=this['history']['getItems']({'from':_0x39bc58,'to':_0x5ca4de}),_0x52dbe9=this['history']['getItems']({'to':_0x39bc58}),_0x2d4d78=[];return _0x441e09['length']>0x0&&_0x2d4d78['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x441e09}),_0x2cc058['length']>0x0&&_0x2d4d78['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x2cc058}),_0x5d57a4['length']>0x0&&_0x2d4d78['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x5d57a4}),_0x2bd92c['length']>0x0&&_0x2d4d78['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x2bd92c}),_0x52dbe9['length']>0x0&&_0x2d4d78['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x52dbe9}),_0x2d4d78;}}class AIChatHistory extends _0x464fb9{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x464fb9{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x398faf){super(_0x398faf),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');}}class AIChatShortcutView extends yt{['id'];constructor(_0x1e1fb6,_0x1a217f){super(_0x1e1fb6);const {id:_0x169238,type:_0x211a6f,icon:_0x55737e}=_0x1a217f;this['id']=_0x169238,this['set']({'label':_0x1a217f['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x1a217f['id']}}),_0x55737e?this['icon']=_0x55737e:'chat'===_0x211a6f?this['icon']=_0x57f4ad:'review'===_0x211a6f?this['icon']=_0x3b947c:'translate'===_0x211a6f&&(this['icon']=_0x16f528);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x2d4343,_0x32a9b1){super(_0x2d4343),this['set']('isEnabled',!0x0);const _0x22b3db=_0x32a9b1['map'](_0x41e939=>{const _0x5d9663=new Ht(this['locale']),_0x52fb89=new AIChatShortcutView(this['locale'],_0x41e939);return _0x52fb89['bind']('isEnabled')['to'](this),_0x5d9663['children']['add'](_0x52fb89),_0x52fb89['delegate']('execute')['to'](this),_0x5d9663;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x22b3db),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Gn='chat-shortcuts';class AIChatShortcuts extends _0x464fb9{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x1c1f33=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x4f0e6d=_0x1c1f33['activeConversation'];_0x4f0e6d['isFromHistory']||this['_injectShortcuts'](_0x4f0e6d);}),this['listenTo'](_0x1c1f33,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x5c2610=['chat','review','translate'];this['_shortcuts']['forEach'](_0x345400=>{let _0x3eda1a=!0x0;if(_0x345400['id']&&_0x345400['label']&&_0x5c2610['includes'](_0x345400['type'])?'chat'===_0x345400['type']&&(_0x3eda1a='string'==typeof _0x345400['prompt']):_0x3eda1a=!0x1,!_0x3eda1a)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x345400});});}['_injectShortcuts'](_0x324835){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Gn),this['_shortcutsView']['on']('execute',_0x10c975=>{const _0x8376a2=_0x10c975['source']['id'];this['_executeShortcut'](_0x8376a2);}),this['_listenedConversation']=_0x324835,this['listenTo'](_0x324835,'uploadProgressChanged',(_0x152ba2,_0x44adc0)=>{this['_shortcutsView']['isEnabled']=!_0x44adc0['isUploadInProgress'];});}['_removeShortcuts'](){const _0x13a876=this['context']['plugins']['get'](AIChatUI);_0x13a876['hasFeedItem'](Gn)&&_0x13a876['removeFeedItem'](Gn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x54d981){const _0x55d546=this['_shortcuts']['find'](_0x53f83e=>_0x53f83e['id']===_0x54d981),_0x3e498b=_0x55d546['type'];'chat'===_0x3e498b?this['_runChatShortcut'](_0x55d546):'review'===_0x3e498b?_0x55d546['commandId']?this['_runReviewShortcut'](_0x55d546):this['_switchTab']('reviewMode'):'translate'===_0x3e498b&&(_0x55d546['language']?this['_runTranslateShortcut'](_0x55d546):this['_switchTab']('translate'));}['_switchTab'](_0x448844){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x448844});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x448844);}async['_runChatShortcut']({prompt:_0x45a4f4,draftMode:_0x443058,useWebSearch:_0x4bbe6f=!0x1,useReasoning:_0x408699=!0x1,model:_0x4a5c63}){const _0x249117=this['context']['plugins']['get']('AIChatController'),_0x1ec98c=_0x249117['activeConversation'];let _0x5c6a33;_0x5c6a33=_0x4a5c63?await _0x1ec98c['chatModels']['getModel'](_0x4a5c63):await _0x1ec98c['chatModels']['getDefault'](),_0x5c6a33&&await _0x1ec98c['setModel'](_0x5c6a33),_0x1ec98c['setWebSearch'](_0x4bbe6f),_0x1ec98c['setReasoning'](_0x408699),_0x249117['addCurrentDocumentToChatContext'](),_0x443058?(this['_aiChatUI']['setPromptInputValue'](_0x45a4f4),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x249117['sendMessage']({'message':_0x45a4f4});}['_runReviewShortcut']({commandId:_0x3be077,model:_0x41093a,prompt:_0x1eb6d9,params:_0x251e34}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x589d84={'id':_0x3be077,'isCustom':'custom'===_0x3be077};_0x41093a&&_0x1eb6d9&&(_0x589d84['args']={'model':_0x41093a,'prompt':_0x1eb6d9}),_0x251e34&&(_0x589d84['params']=_0x251e34),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x589d84);}['_runTranslateShortcut']({language:_0x82ab70}){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':_0x82ab70,'args':{'language':_0x82ab70}});}}class ToggleAICommand extends _0x338152{constructor(_0xde116c){super(_0xde116c);const _0x2e261a=_0xde116c['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x2e261a,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xa34983=this['editor']['plugins']['get']('AITabs')['view'];_0xa34983['isVisible']=!_0xa34983['isVisible'];}}class AIToggleButtonUI extends _0x20e120{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x813e12=this['editor'];_0x813e12['commands']['add']('toggleAi',new ToggleAICommand(_0x813e12)),_0x813e12['ui']['componentFactory']['add']('toggleAi',()=>{const _0x4b2025=this['_createAIUIButton'](yt);return _0x4b2025['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x4b2025;}),_0x813e12['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x496640=this['_createAIUIButton'](Yt);return _0x496640['set']({'role':'menuitemcheckbox'}),_0x496640;});}['_createAIUIButton'](_0x17514b){const _0x2d8466=this['editor'],_0x5a1d33=_0x2d8466['commands']['get']('toggleAi'),_0x1c93ad=new _0x17514b(_0x2d8466['locale']);return _0x1c93ad['set']({'label':Mi(_0x2d8466['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x368a55,'isToggleable':!0x0}),_0x1c93ad['bind']('isEnabled')['to'](_0x5a1d33),_0x1c93ad['bind']('isOn')['to'](_0x5a1d33,'value',_0x40f1f2=>!!_0x40f1f2),this['listenTo'](_0x1c93ad,'execute',()=>{_0x5a1d33['execute']();}),_0x1c93ad;}}const Fn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x182ef7){super(_0x182ef7),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x2d2ad9){this['showError'](_0x2d2ad9);}['showError'](_0x411346){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x411346,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x3c78c2=new Nt(this['locale']),_0x4b4bad=new Nt(this['locale']);return _0x4b4bad['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x3c78c2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x36e0a8=>!_0x36e0a8)]},'children':[_0x4b4bad]}),_0x3c78c2;}}const Wn=0xa;class AIBalloon extends _0x464fb9{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x5b3391){const {id:_0x4e2ad1}=this['_currentConfig']??{};this['_currentConfig']=_0x5b3391,this['_editor']=_0x5b3391['targetEditor'];const {id:_0x4fc088}=this['_currentConfig'];this['isOpen']&&_0x4e2ad1===_0x4fc088?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x1dd746=this['_editor'];if(!_0x1dd746)return;const _0x20931c=_0x1dd746['plugins']['get']('Dialog');_0x20931c['isOpen']&&this['_currentConfig']&&_0x20931c['id']===this['_currentConfig']['id']&&_0x20931c['hide']();}['_updateDialog'](){const _0x147568=this['_editor']['plugins']['get']('Dialog'),{icon:_0x29a116,title:_0x3ff696}=this['_currentConfig'];_0x147568['view']?.['headerView']&&(_0x147568['view']['headerView']['label']=_0x3ff696,_0x147568['view']['headerView']['iconView']&&_0x29a116&&(_0x147568['view']['headerView']['iconView']['content']=_0x29a116)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x147568['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x388be3=this['_editor']['plugins']['get']('Dialog'),{id:_0x4b2463,title:_0x65e7c4,icon:_0x3205eb,class:_0x4eedff,mainView:_0x5495e8}=this['_currentConfig'];_0x5495e8['delegate'](...Fn)['to'](this),_0x388be3['show']({'title':_0x65e7c4,'icon':_0x3205eb,'hasCloseButton':!0x0,'id':_0x4b2463,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x4eedff||''),'content':_0x5495e8,'onShow':_0x5d5c4b=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x5d5c4b['view']?.['updatePosition']();const _0x5dd84f=this['_getSelectionElements']();_0x5dd84f&&_0x5dd84f[0x0]&&Tt({'target':_0x5dd84f[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x5d5c4b['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x4b2463});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x4b2463}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x4045f3,_0x4e2a44){if(!_0x4e2a44){const _0x4fa1bc=this['_getTargetRootDomRect']();if(!_0x4fa1bc)return null;_0x4e2a44=_0x4fa1bc;}const _0x58f2f8=this['_getSelectionElements']();if(!_0x58f2f8||0x0===_0x58f2f8['length'])return{'left':Math['round'](_0x4e2a44['left']+_0x4e2a44['width']/0x2-_0x4045f3['width']/0x2),'top':Math['round'](_0x4e2a44['top']+_0x4e2a44['height']/0x2-_0x4045f3['height']/0x2)};const _0x5c2be3=Math['round'](_0x4e2a44['left']+_0x4e2a44['width']/0x2-_0x4045f3['width']/0x2),_0x3faae9=_0x58f2f8['map'](_0x6e0106=>new dt(_0x6e0106)),_0x540bc2=_0x4045f3['height'];return{'left':_0x5c2be3,'top':this['_calculateOptimalTopPosition'](_0x3faae9,_0x540bc2,_0x4e2a44)};}['_calculateOptimalTopPosition'](_0x266760,_0x4770a6,_0x1633cb){const _0x9ae2eb=new dt(lt['window']),_0x222696=_0x266760['map'](_0x5d49ab=>_0x5d49ab['getVisible']())['filter'](_0x244419=>_0x244419),_0x4f510c=dt['getBoundingRect'](_0x222696);if(!_0x4f510c)return Math['round'](_0x1633cb['top']+_0x1633cb['height']/0x2);const _0x4dd95e=_0x9ae2eb['getIntersection'](_0x4f510c);if(!_0x4dd95e)return Math['round'](_0x1633cb['top']+_0x1633cb['height']/0x2);const _0x39144d=_0x1633cb['getVisible'](),_0x43ef3f=_0x39144d&&_0x4f510c['height']>_0x39144d['height'],_0x1df215=_0x4dd95e['top'],_0x11c63c=_0x4dd95e['bottom'];if(_0x43ef3f){const _0x263166=(_0x39144d||_0x9ae2eb)['height']/0x2-_0x4770a6/0x2,_0x12e2a7=_0x1df215-Wn-_0x1633cb['top'],_0x124ca7=_0x1633cb['bottom']-_0x11c63c-Wn;return _0x12e2a7>=_0x4770a6?Math['max'](Wn,_0x1df215-_0x4770a6-Wn):_0x124ca7>=_0x4770a6?_0x11c63c+Wn:Math['max'](Wn,_0x263166);}const _0xa7cae3=_0x1df215-_0x4770a6,_0x28559a=_0x1633cb['bottom']-_0x11c63c-Wn,_0x2da108=_0x1df215-Wn-_0x1633cb['top'];let _0x21b06a;if(_0x28559a>=_0x4770a6)_0x21b06a=_0x11c63c+Wn;else{if(_0x2da108>=_0x4770a6)_0x21b06a=_0xa7cae3-Wn;else _0x21b06a=_0x1df215+_0x4f510c['height']/0x2-_0x4770a6/0x2;}return _0x21b06a;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x5592be=this['_editor'];this['listenTo'](_0x5592be['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x5cff67,data:{newRange:_0x5ad578}}of _0x5592be['model']['document']['differ']['getChangedMarkers']())if(_0x5cff67['startsWith'](Rs+':')&&(_0x5ad578&&(_0x5ad578['start']['isEqual'](_0x5ad578['end'])||'$graveyard'==_0x5ad578['root']['rootName'])||null==_0x5ad578)){const _0x4f25fb=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x4f25fb),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x355c2c=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x355c2c['model']['document']);}['_getSelectionElements'](){const _0x32d96b=this['_editor'];return _0x5682e9(_0x32d96b['editing'],[..._0x32d96b['model']['markers']['getMarkersGroup']('ai-selection'),..._0x32d96b['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x11c38f=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x11c38f)return null;const _0x56b4b7=this['_editor'],_0x2107db=_0x56b4b7['editing']['view']['document']['getRoot'](_0x11c38f['rootName']);if(!_0x2107db)return null;const _0x386345=_0x56b4b7['editing']['view']['domConverter']['mapViewToDom'](_0x2107db);return _0x386345&&_0x386345 instanceof HTMLElement?new dt(_0x386345):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x3cb8a4,_0x184b99={}){super(_0x3cb8a4),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x184b99};const _0x17451c=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x17451c?'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'](_0x427b16){this['showChangesButton']['isEnabled']=_0x427b16;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x13fa81,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0xec4606,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x30ebff,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x3a8313=new Lt();_0x3a8313['set']({'content':_0x3d9fb7}),_0x3a8313['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'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x3a8313);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x552934,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x454409=>_0x454409?_0x18eb20:_0x552934),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x430680,_0x1f3b20){super(_0x430680);const _0x4220e7=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x1f3b20,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x430680),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x430680,_0x1f3b20['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x1f3b20),this['_stateView']=new AISuggestionContentPartStateView(_0x430680),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x430680,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x430680,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x354e6e,_0x26a47e,_0x5402be,_0x5d93ba)=>{let _0x46420c,_0x196149;'pending'===_0x5d93ba?(_0x46420c=this['_partToolbarView'],_0x196149=this['_stateView']):(_0x46420c=this['_stateView'],_0x196149=this['_partToolbarView']),this['_stateView']['setState'](_0x5402be),_0x46420c['isVisible']=!0x1,_0x196149['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x4220e7['to']('_state',_0x46eae5=>'ck-ai-chat-balloon-main_state_'+_0x46eae5)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x1f3b20);});}['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'](_0x23bfff){_0x23bfff?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x23bfff);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x4816f6){this['_state']=_0x4816f6;}['showError'](_0xcba511){super['showError'](_0xcba511),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x35af6d){super['showBlockingError'](_0x35af6d),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x22e64d){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x22e64d;}['togglePartToolbarEnabled'](_0x37288d){this['_partToolbarView']['isEnabled']=_0x37288d;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x1501cf,showSuggestButton:_0x55c31a}){_0x1501cf=_0x1501cf&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x55c31a=_0x55c31a&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x1501cf,'showSuggestButton':_0x55c31a});}['_createNextButtonView'](){const _0x48d790=new yt(this['locale']);return _0x48d790['set']({'icon':_0x474b7c,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x48d790['on']('execute',()=>{this['fire']('showNext');}),_0x48d790;}['_createPreviousButtonView'](){const _0x14ebfd=new yt(this['locale']);return _0x14ebfd['set']({'icon':_0x82ae1c,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x14ebfd['on']('execute',()=>{this['fire']('showPrevious');}),_0x14ebfd;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x38ae98,_0x2b8d04){super(_0x38ae98),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x2b8d04});}}class AIChatBalloon extends _0x20e120{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x334b28){super(_0x334b28),this['set']('showDiff',!0x1);}['open'](_0x3024c4){const _0x2a36fe=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x2a36fe['plugins']['get']('AIBalloon')['open']({..._0x3024c4,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x3024c4['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x3024c4['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x291d73){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x291d73);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x1c5261){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x1c5261);}['_createChatBalloonView'](){const _0x219349=this['editor'],_0x1803cf=_0x219349['plugins']['get']('AIBalloon'),_0x138404=_0x219349['commands']['get']('trackChanges');let _0x3df6af=_0x219349['config']['get']('ai.availableReplyActions')||[...Ds];_0x219349['plugins']['has']('TrackChanges')||(_0x3df6af=_0x3df6af['filter'](_0x96ea07=>'insertSuggestion'!=_0x96ea07));const _0x3bfd11=new AIChatBalloonView(_0x219349['locale'],{'availableActions':_0x3df6af,'showApplyButton':!0x0,'showSuggestButton':!!_0x138404});return _0x3bfd11['bind']('showDiff')['to'](this),_0x3bfd11['delegate'](...Ss)['to'](this),_0x3bfd11['delegate']('showPrevious','showNext')['to'](this),_0x1803cf['delegate']('dialogClosed')['to'](this),_0x3bfd11['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3bfd11['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3bfd11['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x138404&&_0x3bfd11['bind']('isTrackChangesOn')['to'](_0x138404,'value'),_0x3bfd11['render'](),_0x3bfd11;}['_toggleRotatorButtonsInDialogHeader'](_0x46ae8f){const _0x2a6d24=this['editor'],_0x8147ff=_0x2a6d24['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x46ae8f),_0x8147ff['has'](this['_chatBalloonView']['previousButtonView'])||(_0x8147ff['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2a6d24['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x8147ff['remove'](this['_chatBalloonView']['previousButtonView']),_0x8147ff['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x20e120{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x48548a];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Kn(_0x37bee6){const {editor:_0x52b2b8,action:_0x5ab9b4,withText:_0x2b193f=!0x1,withIcon:_0xe959a7=!0x0,isInDropdown:_0x37017f=!0x0,shouldPreventFocus:_0x58d83f=!0x1,actionButtons:_0x571839}=_0x37bee6;return()=>{const _0x5c8927=_0x52b2b8['locale'],_0x5567ac=new yt(_0x5c8927),_0xee018=_0x5567ac['bindTemplate'];_0x37017f&&_0x5567ac['extendTemplate']({'on':{'mouseenter':_0xee018['to'](()=>{_0x58d83f&&_0x58d83f()||_0x5567ac['focus']();})}}),_0x571839['push']({'buttonView':_0x5567ac,'action':_0x5ab9b4});const _0x3ebe25=_0x5ab9b4['icon']??_0x5ab9b4['parent']?.['icon'];return _0x5567ac['set']({'label':_0x5ab9b4['label'],'withText':_0x2b193f,'role':'menuitem','icon':_0xe959a7?_0x3ebe25??_0x4767a0:void 0x0,'tooltip':!_0x2b193f,'class':'ck-ai-quick-actions-button','isEnabled':_0x5ab9b4['isEnabled']}),_0x5567ac['on']('execute',()=>{_0x52b2b8['editing']['view']['focus'](),_0x52b2b8['commands']['execute']('aiQuickAction',_0x5ab9b4);}),_0x5567ac;};}class DropdownMenuButtonWithHighlightView extends _0x274ebb{['arrowView'];constructor(_0x43d5c5,_0x1e6611){super(_0x43d5c5,_0x1e6611);const _0x4bc842=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',_0x2707bc=>String(_0x2707bc)),'data-cke-tooltip-disabled':_0x4bc842['to']('isOn')},'on':{'mouseenter':_0x4bc842['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x439260=new Lt();return _0x439260['content']=_0x595cb4,_0x439260['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x439260;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x52cb32,_0x42c53d,_0x45694b){super(_0x52cb32),this['_allListItems']=_0x42c53d,this['_allSearchableItems']=_0x45694b;}['filter'](_0x33cdf0){if(!_0x33cdf0)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x4a5d6b=_0x33cdf0['source']['toLowerCase']()['trim'](),_0x382157=this['_allSearchableItems']['filter'](_0x3aa215=>(_0x3aa215['groupLabel']?_0x3aa215['label']+'\x20('+_0x3aa215['groupLabel']+')':_0x3aa215['label'])['toLowerCase']()['includes'](_0x4a5d6b));return this['items']['clear'](),this['items']['addMany'](_0x382157['sort']((_0x2bc563,_0x362aca)=>{const _0x27ff29=_0x2bc563['groupLabel'],_0x512c25=_0x362aca['groupLabel'];return _0x27ff29||_0x512c25?_0x27ff29?0x1:-0x1:0x0;})['map'](_0x3902d9=>_0x3902d9['item'])),this['_highlightQuery'](_0x4a5d6b,_0x382157),{'resultsCount':_0x382157['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x53362c,_0x48a423){if(!_0x53362c)return;const _0x235a88=new RegExp(_0x6635be(_0x53362c),'gi');_0x48a423['forEach'](_0x18ce8c=>{_0x18ce8c['highlightViews']&&_0x18ce8c['highlightViews']['forEach'](_0x4abbec=>{'function'==typeof _0x4abbec['highlightText']&&_0x4abbec['highlightText'](_0x235a88);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x47dc5d=>{_0x47dc5d['highlightViews']&&_0x47dc5d['highlightViews']['forEach'](_0x153039=>{'function'==typeof _0x153039['highlightText']&&_0x153039['highlightText'](null);});});}}const Yn='menu',$n='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x240cdb,_0xc4ff28,_0x127ac9,_0x3f6a31,_0x20f17a=!0x1,_0x10f159=[]){const _0x3de021=_0x240cdb['locale'];super(_0x3de021),this['_bodyCollection']=_0x3f6a31,this['_hasSearch']=_0x20f17a,this['_actionButtons']=_0x10f159;const _0x2ff954=this['_createListItems'](_0x240cdb,_0xc4ff28,_0x127ac9);this['optionsListView']=new AIQuickActionsFilteredListView(_0x3de021,_0x2ff954,this['_allSearchableItems']),this['optionsListView']['role']=Yn,this['optionsListView']['items']['addMany'](_0x2ff954),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x20f17a&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x2ff954,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x20f17a&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x1aa332=_0x20f17a&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x1bcd70(_0x1aa332),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x3de021['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x40453d(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x3c04ea=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3c04ea);}['_createListItems'](_0x13149f,_0x186789,_0x2fb351){const _0x45ea87=new _0x1bcd70();return _0x186789['forEach'](_0x131872=>{if('actions'in _0x131872){const {listItem:_0x5df4a5}=this['_createActionGroupButton'](_0x13149f,_0x131872,_0x2fb351);_0x45ea87['add'](_0x5df4a5),_0x131872['actions']['forEach'](_0x448877=>{const {listItem:_0x437120,highlightViews:_0x3ac364}=this['_createSearchResultActionButton'](_0x13149f,_0x448877,_0x131872['label'],_0x131872['icon']);this['_allSearchableItems']['push']({'item':_0x437120,'label':_0x448877['label'],'groupLabel':_0x131872['label'],'highlightViews':_0x3ac364});});}else{const {listItem:_0x3aa1da}=this['_createActionButton'](_0x13149f,_0x131872);_0x45ea87['add'](_0x3aa1da);const _0x49444f=_0x3aa1da['children']['first'];if(_0x49444f){const {listItem:_0x6e9173,highlightViews:_0x1a7c93}=this['_createSearchResultActionButton'](_0x13149f,_0x131872);this['_allSearchableItems']['push']({'item':_0x6e9173,'label':_0x49444f['label']||'','highlightViews':_0x1a7c93});}}}),_0x45ea87;}['_createActionButton'](_0x9857a9,_0x4e697f,_0x3252dc,_0x5d8198){const _0x247f01=new Ht(this['locale']);if(_0x3252dc&&_0x5d8198){const _0x83fae=new yt(this['locale']),_0x4cb15e=_0x83fae['bindTemplate'],_0x1af247=new _0x3afbec();_0x1af247['text']=_0x4e697f['label'];const _0x43ced2=new _0x3afbec();_0x43ced2['text']=_0x3252dc;const _0xd968cf=new Lt();_0xd968cf['content']=_0x5d8198,_0xd968cf['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x37a407=new Nt(this['locale']);_0x37a407['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x32fb2c=new Nt(this['locale']);return _0x32fb2c['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x83fae['set']({'label':_0x4e697f['label']+'\x20('+_0x3252dc+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x4e697f['isEnabled']}),_0x83fae['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x4cb15e['if']('isEnabled','ck-disabled',_0x2cb868=>!_0x2cb868)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1af247,_0x37a407,_0xd968cf,_0x43ced2,_0x32fb2c],'on':{'mouseenter':_0x4cb15e['to'](()=>{this['_isSearchFocused']()||_0x83fae['focus']();}),'click':_0x4cb15e['to'](()=>{_0x83fae['fire']('execute');})}}),_0x83fae['on']('execute',()=>{_0x83fae['isEnabled']&&(_0x9857a9['editing']['view']['focus'](),_0x9857a9['commands']['execute']('aiQuickAction',_0x4e697f));}),_0x247f01['children']['add'](_0x83fae),this['_actionButtons']['push']({'buttonView':_0x83fae,'action':_0x4e697f}),{'listItem':_0x247f01,'highlightViews':[_0x1af247,_0x43ced2]};}{const _0x2b93e3=new _0x3e1629(),_0x55ef47=new yt(this['locale'],_0x2b93e3),_0x1393fc=_0x55ef47['bindTemplate'],_0x5b5f64=_0x4e697f['icon']??_0x4e697f['parent']?.['icon'],_0x2b94ca=void 0x0!==_0x4e697f['icon'];return _0x55ef47['set']({'label':_0x4e697f['label'],'withText':!0x0,'role':'menuitem','icon':_0x2b94ca?_0x5b5f64??_0x4767a0:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x4e697f['isEnabled']}),_0x55ef47['extendTemplate']({'on':{'mouseenter':_0x1393fc['to'](()=>{this['_isSearchFocused']()||_0x55ef47['focus']();})}}),_0x55ef47['on']('execute',()=>{_0x9857a9['editing']['view']['focus'](),_0x9857a9['commands']['execute']('aiQuickAction',_0x4e697f);}),_0x247f01['children']['add'](_0x55ef47),this['_actionButtons']['push']({'buttonView':_0x55ef47,'action':_0x4e697f}),{'listItem':_0x247f01,'highlightViews':[_0x2b93e3]};}}['_createSearchResultActionButton'](_0x2904e4,_0x844286,_0x559843,_0x249b5f){return _0x559843&&_0x249b5f?this['_createSearchResultGroupedActionButton'](_0x2904e4,_0x844286,_0x559843,_0x249b5f):this['_createSearchResultIndividualActionButton'](_0x2904e4,_0x844286);}['_createSearchResultGroupedActionButton'](_0x557026,_0xff74b1,_0x515884,_0x2927d1){const _0x541b1c=new Ht(this['locale']),_0x52b348=new yt(this['locale']),_0x3da53f=_0x52b348['bindTemplate'],{view:_0x12fcce,highlightView:_0x2b8557}=this['_createSearchResultGroupRow'](_0x515884,_0x2927d1),{view:_0xf150a0,highlightView:_0x47890d}=this['_createSearchResultActionRow'](_0xff74b1['label']),_0x454554=this['_createSearchResultContentView'](_0x12fcce,_0xf150a0);return _0x52b348['set']({'label':_0xff74b1['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':_0xff74b1['isEnabled']}),_0x52b348['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',_0x3da53f['if']('isEnabled','ck-disabled',_0x56ffe1=>!_0x56ffe1)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x454554],'on':{'mouseenter':_0x3da53f['to'](()=>{this['_isSearchFocused']()||_0x52b348['focus']();}),'click':_0x3da53f['to'](()=>{this['_handleSearchResultButtonClick'](_0x52b348);})}}),this['_setupActionButtonExecution'](_0x52b348,_0x557026,_0xff74b1),_0x541b1c['children']['add'](_0x52b348),this['_actionButtons']['push']({'buttonView':_0x52b348,'action':_0xff74b1}),{'listItem':_0x541b1c,'highlightViews':[_0x2b8557,_0x47890d]};}['_createSearchResultIndividualActionButton'](_0x139801,_0x5d5dcc){const _0x33d04e=new Ht(this['locale']),_0xb4e525=new _0x3e1629(),_0x381025=new yt(this['locale'],_0xb4e525),_0x42ff89=_0x381025['bindTemplate'];return _0x381025['set']({'label':_0x5d5dcc['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x5d5dcc['isEnabled']}),_0x381025['extendTemplate']({'on':{'mouseenter':_0x42ff89['to'](()=>{this['_isSearchFocused']()||_0x381025['focus']();})}}),this['_setupActionButtonExecution'](_0x381025,_0x139801,_0x5d5dcc),_0x33d04e['children']['add'](_0x381025),this['_actionButtons']['push']({'buttonView':_0x381025,'action':_0x5d5dcc}),{'listItem':_0x33d04e,'highlightViews':[_0xb4e525]};}['_createSearchResultGroupRow'](_0x2743c6,_0x52c93f){const _0x5ad077=new Nt(this['locale']),_0x4ef5f9=new Lt();_0x4ef5f9['content']=_0x52c93f,_0x4ef5f9['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4d0281=new _0x3afbec();return _0x4d0281['text']=_0x2743c6,_0x5ad077['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x4ef5f9,_0x4d0281]}),{'view':_0x5ad077,'highlightView':_0x4d0281};}['_createSearchResultActionRow'](_0x574ac6){const _0x1e1312=new Nt(this['locale']),_0x19506a=new _0x3afbec();return _0x19506a['text']=_0x574ac6,_0x1e1312['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x19506a]}),{'view':_0x1e1312,'highlightView':_0x19506a};}['_createSearchResultContentView'](_0x3b5bb1,_0x20cad5){const _0x3e0bc2=new Nt(this['locale']);return _0x3e0bc2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x3b5bb1,_0x20cad5]}),_0x3e0bc2;}['_setupActionButtonExecution'](_0x35d1bc,_0x3984ec,_0x2471da){_0x35d1bc['on']('execute',()=>{_0x35d1bc['isEnabled']&&(_0x3984ec['editing']['view']['focus'](),_0x3984ec['commands']['execute']('aiQuickAction',_0x2471da));});}['_createActionGroupButton'](_0x319c83,_0x511c3f,_0x72480e){const _0x29012c=new Ht(this['locale']),_0x1f4c92=new _0x3e1629(),_0x24adab=new DropdownMenuButtonWithHighlightView(this['locale'],_0x1f4c92),_0x30301a=_0x24adab['bindTemplate'],_0x14dcec=this['_getPanelKeystroke'](_0x72480e),_0x595a71=this['_createGroupActionsList'](_0x319c83,_0x511c3f['actions'],_0x72480e);_0x24adab['set']({'label':_0x511c3f['label'],'withText':!0x0,'role':$n,'icon':_0x511c3f['icon']??_0x4767a0,'isEnabled':_0x511c3f['actions']['some'](_0x3222ab=>_0x3222ab['isEnabled'])}),_0x24adab['extendTemplate']({'on':{'mouseenter':_0x30301a['to'](()=>{this['_isSearchFocused']()||_0x24adab['focus']();})}});const _0x5e5e9c=new zt(this['locale']);return _0x5e5e9c['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x30301a['to'](_0x6265df=>{this['_handlePanelKeydown'](_0x6265df,_0x14dcec,_0x24adab,_0x5e5e9c);})}}),_0x24adab['bind']('isOn')['to'](_0x5e5e9c,'isVisible'),this['_bodyCollection']['add'](_0x5e5e9c),_0x5e5e9c['content']['add'](_0x595a71),this['_setupGroupMenuBehavior'](_0x24adab,_0x5e5e9c),_0x29012c['children']['add'](_0x24adab),this['_actionButtons']['push']({'buttonView':_0x24adab,'action':_0x511c3f}),{'listItem':_0x29012c,'highlightView':_0x1f4c92};}['_createGroupActionsList'](_0xa12454,_0x593a97,_0x4a83a3){const _0xa9178a=new Dt(this['locale']);return _0xa9178a['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x593a97['forEach'](_0x3fa011=>{const _0x34c67a=new Ht(this['locale']),_0x49ad37=Kn({'editor':_0xa12454,'action':_0x3fa011,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x34c67a['children']['add'](_0x49ad37),_0x4a83a3['focusTracker']['add'](_0x49ad37),_0xa9178a['items']['add'](_0x34c67a);}),_0xa9178a;}['_setupGroupMenuBehavior'](_0x3511d5,_0x4daef3){const _0x1cce3b=_0x3511d5['bindTemplate'],_0x4a1589=this['_getButtonKeystroke'](_0x3511d5);_0x3511d5['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x1cce3b['to'](()=>{this['_showNestedPanel'](_0x4daef3,_0x3511d5);}),'mouseleave':_0x1cce3b['to'](_0x3460cd=>{const _0x79740a=_0x3460cd['relatedTarget'];this['_isMovingToNestedMenu'](_0x79740a,_0x4daef3)||this['_hideNestedPanel'](_0x4daef3);}),'keydown':_0x1cce3b['to'](_0x4e3739=>{_0x4e3739['key']==_0x4a1589&&(this['_showNestedPanel'](_0x4daef3,_0x3511d5),_0x4daef3['content']['get'](0x0)['focus']());})}}),_0x4daef3['on']('render',()=>{_0x4daef3['element']?.['addEventListener']('mouseleave',_0x3bea1f=>{const _0x4f5a3b=_0x3bea1f['relatedTarget'];_0x3511d5['element']?.['contains'](_0x4f5a3b)||this['_isMovingToNestedMenu'](_0x4f5a3b,_0x4daef3)||this['_hideNestedPanel'](_0x4daef3);});});}['_showNestedPanel'](_0x8775ab,_0x59a375){this['_openNestedPanels']['forEach'](_0x415851=>{_0x415851!==_0x8775ab&&_0x415851['isVisible']&&_0x415851['hide']();}),_0x8775ab['show'](),_0x8775ab['pin']({'positions':[_0x4ced60['eastSouth']],'target':_0x59a375['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x8775ab);}['_hideNestedPanel'](_0x29364d){_0x29364d['hide'](),this['_openNestedPanels']['delete'](_0x29364d);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x1d3309=>_0x1d3309['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x18626a,_0x53fda0){if(!_0x18626a)return!0x1;if(_0x53fda0['element']?.['contains'](_0x18626a))return!0x0;const _0x40d2df=_0x18626a;return _0x40d2df['closest']&&(null!==_0x40d2df['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x40d2df['closest']('.ck-ai-quick-actions-group-list')||null!==_0x40d2df['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'](_0x33b6c3){return'rtl'===_0x33b6c3['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x17289d){return'rtl'===_0x17289d['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x56f98e,_0x69d361,_0x58833c,_0x56fbb3){_0x56f98e['key']==_0x69d361&&(_0x58833c['focus'](),this['_hideNestedPanel'](_0x56fbb3));}['_handleSearchResultButtonClick'](_0x12f3bf){_0x12f3bf['fire']('execute');}}function qn(_0x2e840c){const {editor:_0x4ccd05,content:_0x46231d,buttonDefinition:_0x51bfa6,bodyCollection:_0x166587,hasSearch:_0xa794bf=!0x1,actionButtons:_0x7b76d2}=_0x2e840c;return()=>{const _0x25a922=_0x4ccd05['locale'],_0xaeb327=_0x4ccd05['commands']['get']('aiQuickAction'),_0x9136da=Ft(_0x25a922);_0x9136da['bind']('isEnabled')['to'](_0xaeb327),_0x9136da['buttonView']['set']({'icon':_0x51bfa6['icon']??_0x4767a0,'label':_0x51bfa6['label'],'tooltip':!0x0}),_0x9136da['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x3766e2=new AIQuickActionsDropdownContentView(_0x4ccd05,_0x46231d,_0x9136da,_0x166587,_0xa794bf,_0x7b76d2);return _0x9136da['panelView']['children']['add'](_0x3766e2),_0xa794bf&&_0x9136da['on']('change:isOpen',(_0x1da673,_0x4608d9,_0x48666c)=>{if(_0x48666c){if(_0x4ccd05['plugins']['has']('AIEditing')){const _0x30f033=_0x4ccd05['plugins']['get'](AIEditing),_0xbbe5b5=_0x4ccd05['model']['document']['selection'],_0xff58fe=Array['from'](_0xbbe5b5['getRanges']());_0xff58fe['length']>0x0&&_0x30f033['showFakeVisualSelection']({'editor':_0x4ccd05,'ranges':_0xff58fe,'id':'quick-action','priority':0x14});}}else _0x4ccd05['plugins']['has']('AIEditing')&&_0x4ccd05['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x3766e2['resetSearch']();}),_0x9136da;};}const Qn='<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>',Xn='<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>',zn='<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>',jn=/* #__PURE__ -- @preserve */
28
- ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x20e120{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x5bd781,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3ba7ad=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x3ba7ad),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x4223df){return function(_0x50464c){const _0x439a2b=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x50464c['uiLanguage']),_0x5231ff=_0x439a2b||'English',_0x6f7586=[{'id':'ask-ai','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x2ffbf5},{'id':'chat-commands','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x2ffbf5,'actions':[{'id':'explain','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x50464c,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Qn['replace']('%0',_0x5231ff),'type':'chat'},{'id':'summarize','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x50464c,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Xn['replace']('%0',_0x5231ff),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x50464c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':zn['replace']('%0',_0x5231ff),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x1f321f},{'id':'continue','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x3185d8},{'id':'fix-grammar','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x31386c},{'id':'adjust-length','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x18fe57,'actions':[{'id':'make-shorter','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x9ebbbd,'actions':[{'id':'make-tone-casual','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x16f528,'actions':[{'id':'translate-to-english','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x50464c,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x6f7586;}(_0x4223df);}['_getDefaultAndCustomActions'](){const _0x19cc26=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x574367=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x525b2c=>({..._0x525b2c,'type':'chat'===_0x525b2c['type']?'chat':'action','icon':void 0x0}));return _0x19cc26['find'](_0x28dfa6=>'other'===_0x28dfa6['id'])['actions']['push'](..._0x574367),_0x19cc26;}async['_initActionTypeQuickActions'](){try{const _0x105357=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x1af12e=await _0x105357['getAll'](),_0x335f1a=(await _0x105357['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x335f1a),this['_enableButtonsByType']('action',_0x32a34a=>!!_0x1af12e['find'](_0x58cbdb=>_0x58cbdb['id']===_0x32a34a['model'])||void 0x0===_0x32a34a['model']);}catch(_0x430ee7){const _0x546a7e=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x430ee7});Ct(_0x546a7e['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x179ef1=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x179ef1,'change:isConversationReady',(_0x34dc95,_0x21c1ec,_0x31c7e7)=>{_0x31c7e7&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x179ef1['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0xd8eed2,_0x23f220){this['_quickActionsDefinition']['forEach'](_0x39fa60=>{'actions'in _0x39fa60?_0x39fa60['actions']['forEach'](_0x4d02b8=>{_0x4d02b8['type']===_0xd8eed2&&(_0x4d02b8['isEnabled']=_0x23f220(_0x4d02b8));}):_0x39fa60['type']===_0xd8eed2&&(_0x39fa60['isEnabled']=_0x23f220(_0x39fa60));}),this['_actionButtons']['forEach'](_0x4deb83=>{if(Jn(_0x4deb83['action']))return;if(_0x4deb83['action']['type']!==_0xd8eed2)return;const _0x29c5bb=_0x23f220(_0x4deb83['action']);if(_0x4deb83['action']['isEnabled']=_0x29c5bb,_0x4deb83['buttonView']['isEnabled']=_0x29c5bb,!_0x29c5bb&&_0x4deb83['action']['model']){const _0x4d5f06=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x4deb83['action']['id'],'modelId':_0x4deb83['action']['model']});Ct(_0x4d5f06['message']);}}),this['_actionButtons']['filter'](_0x3da96e=>Jn(_0x3da96e['action']))['forEach'](_0x2ab898=>{_0x2ab898['buttonView']['isEnabled']=_0x2ab898['action']['actions']['some'](_0x5a04dd=>_0x5a04dd['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0xf54092,group:_0x1d2d66})=>{_0xf54092['isEnabled']=_0x1d2d66['actions']['some'](_0x835f21=>_0x835f21['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x28de2e){this['_actionButtons']['forEach'](_0x5415d1=>{Jn(_0x5415d1['action'])||'action'===_0x5415d1['action']['type']&&(_0x5415d1['action']['model']||(_0x5415d1['action']['model']=_0x28de2e));});}['_initializeQuickActionsComponentsAndCommands'](){const _0xcde137=new Xt(this['editor']['locale']);_0xcde137['attachToDom'](),this['_initializeQuickActionsDropdown'](_0xcde137),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0xcde137);}['_initializeQuickActionsDropdown'](_0x19abb6){const _0x1ae19b=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',qn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x4767a0,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x19abb6,'hasSearch':_0x1ae19b,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x46e79c){this['_quickActionsDefinition']=_0x46e79c['map'](_0x5135f4=>{if('actions'in _0x5135f4){const _0x211a26=_0x5135f4;return{..._0x211a26,'actions':_0x211a26['actions']['map'](_0x557441=>{const {actions:_0x1cd516,..._0x4919b4}=_0x211a26;return{..._0x557441,'isEnabled':!0x1,'parent':_0x4919b4};})['filter'](_0x237a92=>this['_shouldIncludeAction'](_0x237a92))};}return{..._0x5135f4,'isEnabled':!0x1};})['filter'](_0x402c6e=>'actions'in _0x402c6e?_0x402c6e['actions']['length']>0x0:this['_shouldIncludeAction'](_0x402c6e));}['_shouldIncludeAction'](_0x4ccde4){const _0x5111f4=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](jn[_0x4ccde4['type']])&&!_0x5111f4['includes'](_0x4ccde4['id'])&&!('chat'===_0x4ccde4['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x59257c){this['_quickActionsDefinition']['forEach'](_0x3ee45d=>{if('actions'in _0x3ee45d){const _0x302240=qn({'editor':this['editor'],'content':_0x3ee45d['actions'],'buttonDefinition':_0x3ee45d,'bodyCollection':_0x59257c,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3ee45d['id'],_0x302240),_0x3ee45d['actions']['forEach'](_0x1cb458=>{const _0x275d2f=Kn({'editor':this['editor'],'action':_0x1cb458,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x1cb458['id'],_0x275d2f);});}else{const _0x2f09e1=Kn({'editor':this['editor'],'action':_0x3ee45d,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x3ee45d['id'],_0x2f09e1);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x4cdb79=>{const _0x100eaa=this['editor']['commands']['get']('aiQuickAction'),_0x59c0aa=new Kt(_0x4cdb79),_0x4aff1b=Mi(_0x4cdb79,'AI_QUICK_ACTIONS_HEADING');_0x59c0aa['buttonView']['set']({'label':_0x4aff1b,'icon':_0x4767a0});const _0x43f4f9=new qt(_0x4cdb79);return _0x43f4f9['set']({'ariaLabel':_0x4aff1b,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x422f0a=>{if('actions'in _0x422f0a){const _0x4ecc64=_0x422f0a,_0x5441af=new Qt(_0x4cdb79,_0x59c0aa),_0x2e0318=new Kt(_0x4cdb79),_0x44b227=new qt(_0x4cdb79);_0x2e0318['buttonView']['set']({'label':_0x4ecc64['label'],'icon':_0x4ecc64['icon']}),_0x4ecc64['actions']['forEach'](_0x531c95=>{const _0x11b538=new Qt(_0x4cdb79,_0x2e0318),_0x45f068=new Yt(_0x4cdb79);_0x45f068['set']({'label':_0x531c95['label'],'icon':_0x531c95['icon'],'role':'menuitem','isEnabled':_0x531c95['isEnabled']}),_0x45f068['on']('execute',()=>{this['_executeQuickAction'](_0x531c95);}),this['_actionButtons']['push']({'buttonView':_0x45f068,'action':_0x531c95}),_0x45f068['delegate']('execute')['to'](_0x2e0318),_0x11b538['children']['add'](_0x45f068),_0x44b227['items']['add'](_0x11b538);}),_0x2e0318['isEnabled']=_0x4ecc64['actions']['some'](_0x401e4a=>_0x401e4a['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x2e0318,'group':_0x4ecc64}),_0x2e0318['panelView']['children']['add'](_0x44b227),_0x5441af['children']['add'](_0x2e0318),_0x43f4f9['items']['add'](_0x5441af);}else{const _0x4aaa9f=_0x422f0a,_0x4af816=new Qt(_0x4cdb79,_0x59c0aa),_0x39775e=new Yt(_0x4cdb79);_0x39775e['set']({'label':_0x4aaa9f['label'],'icon':_0x4aaa9f['icon'],'role':'menuitem','isEnabled':_0x4aaa9f['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x39775e,'action':_0x4aaa9f}),_0x39775e['on']('execute',()=>{this['_executeQuickAction'](_0x4aaa9f);}),_0x39775e['delegate']('execute')['to'](_0x59c0aa),_0x4af816['children']['add'](_0x39775e),_0x43f4f9['items']['add'](_0x4af816);}}),(Object['values'](jn)['some'](_0x306a75=>this['editor']['plugins']['has'](_0x306a75))?_0x59c0aa['bind']('isEnabled')['to'](_0x100eaa):_0x59c0aa['set']({'isEnabled':!0x1}),_0x59c0aa['panelView']['children']['add'](_0x43f4f9),_0x59c0aa);});}['_executeQuickAction'](_0x506b20){const _0x3c241d=this['editor'];_0x3c241d['editing']['view']['focus'](),_0x3c241d['commands']['execute']('aiQuickAction',_0x506b20);const _0x2b7a83=_0x3c241d['ui']['view']['menuBarView'];_0x2b7a83&&_0x2b7a83['close']&&_0x2b7a83['close']();}}function Jn(_0x369290){return'actions'in _0x369290;}class AIQuickActionsCommand extends _0x338152{['execute'](_0x5abc8a){switch(this['_expandSelectionIfCollapsed'](),_0x5abc8a['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3e30fe=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3e30fe});}this['_handleAIChatAction'](_0x5abc8a);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x22badf=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x22badf});}this['_handleAIActionsAction'](_0x5abc8a);}}async['_handleAIChatAction'](_0x53e46a){const _0x43a8b0=this['editor']['plugins']['get']('AIChatController'),_0x14e286=this['editor']['plugins']['get']('AITabs')['view'];if(_0x14e286['isVisible']||(_0x14e286['isVisible']=!0x0),'chat'!==_0x14e286['activeTab']&&_0x14e286['activateTab']('chat'),'ask-ai'===_0x53e46a['id'])_0x43a8b0['removeSelectionFromChatContext'](),_0x43a8b0['addSelectionToChatContext'](this['editor']),_0x43a8b0['focusPromptInput']();else await _0x43a8b0['startConversation']({'modelId':_0x53e46a['model']}),_0x43a8b0['removeSelectionFromChatContext'](),_0x43a8b0['addSelectionToChatContext'](this['editor']),_0x43a8b0['focusPromptInput'](),await _0x43a8b0['sendMessage']({'message':_0x53e46a['prompt']||_0x53e46a['displayedPrompt']||_0x53e46a['label'],'attributes':{'quickActionData':{'id':_0x53e46a['id']},'displayedPrompt':_0x53e46a['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x4d8987=this['editor'],_0x48b833=_0x4d8987['model']['document']['selection'];if(!_0x48b833['isCollapsed'])return;const _0x2e6cb3=gt(_0x48b833['getSelectedBlocks']())||_0x4d8987['model']['schema']['getLimitElement'](_0x48b833);_0x4d8987['model']['change'](_0x1f4d9f=>{_0x1f4d9f['setSelection'](_0x2e6cb3,'in');});}['_handleAIActionsActionLabel'](_0x1657d3){return _0x1657d3['parent']?.['label']&&'other'!==_0x1657d3['parent']?.['id']?_0x1657d3['parent']['label']+':\x20'+_0x1657d3['label']:_0x1657d3['label'];}async['_handleAIActionsAction'](_0x31f57f){const _0x9de22d=this['editor']['plugins']['get']('AIActions'),_0x508c6a=_0x31f57f['prompt']?{'userMessage':_0x31f57f['prompt'],'model':_0x31f57f['model']}:{'actionName':_0x31f57f['actionName']||_0x31f57f['id'],'args':_0x31f57f['args']},_0x50db26=this['_handleAIActionsActionLabel'](_0x31f57f);await _0x9de22d['executeAction'](_0x508c6a,_0x50db26,_0x31f57f['icon']);}}class AIQuickActionsEditing extends _0x20e120{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1e07c3=this['editor'],_0x10e9b9=new AIQuickActionsCommand(this['editor']);if(_0x1e07c3['commands']['add']('aiQuickAction',_0x10e9b9),_0x1e07c3['plugins']['has']('AIChat')){const _0x3c4f1d=this['editor']['plugins']['get']('AIChatController');_0x1e07c3['model']['document']['selection']['on']('change:range',(_0x1904a9,_0x22a605)=>{_0x22a605['directChange']&&_0x3c4f1d['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x48114e,_0xc07c0b='text'){'modification'===this['type']&&'text'===_0xc07c0b&&(_0xc07c0b=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x48114e,_0xc07c0b);}['updateChangeGroups'](_0x19b677){const _0x20e2b0=this['parsedContent']['get'](_0x19b677)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x19b677,_0x20e2b0),this['changeGroups']=[],0x0==_0x20e2b0['childNodes']['length'])return;rs(this['documentContextContent']['get'](_0x19b677),this['parsedMergedContent']['get'](_0x19b677));const _0x37264a=this['documentContextContent']['get'](_0x19b677)['children']['map'](_0x4ecee7=>({'node':_0x4ecee7,'id':Xi(_0x4ecee7,'data-id')})),_0x444985=_0x20e2b0['children']['map'](_0x56234b=>({'node':_0x56234b,'id':Xi(_0x56234b,'data-id')||at()})),_0x18692f=_0x213593(_0x37264a,_0x444985,{'comparator':(_0x5686f1,_0x4923b8)=>_0x5686f1['id']==_0x4923b8['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x18692f['length']&&_0x18692f[_0x18692f['length']-0x1]['removed'];)_0x18692f['pop']();}const _0x54246c=_0x18692f['map'](_0x337e10=>{const _0x77b476=_0x337e10['added']?'new':_0x337e10['removed']?'removed':'modified';return{'node':_0x337e10['value'][0x0]['node'],'type':_0x77b476,'id':_0x337e10['value'][0x0]['id']};}),_0xd19209=this['_documentIdToSource']['get'](_0x19b677);this['changeGroups']['push']({'changes':_0x54246c,'state':'pending','index':this['changeGroups']['length'],'editor':_0xd19209['editor'],'rootName':_0xd19209['rootName'],'documentId':_0x19b677});}['_getDifferentChangeGroups'](_0x573f27,_0x927181){return _0x927181;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x53d7ca){super(_0x53d7ca),this['content']=_0x53d7ca['content'],this['version']=_0x53d7ca['version'],this['editor']=_0x53d7ca['editor'],this['rootName']=_0x53d7ca['rootName'],this['actionName']=_0x53d7ca['actionName'],this['args']=_0x53d7ca['args'],this['userMessage']=_0x53d7ca['userMessage'],this['model']=_0x53d7ca['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':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x288c0e){const _0x5f018b=this['editor']['config']['get']('collaboration.channelId'),_0x195c50=new AIActionsReply({..._0x288c0e,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x5f018b,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x5f018b,this['editor']]])});return this['replies']['push'](_0x195c50),_0x195c50['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x195c50),_0x195c50;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x18f2e1,_0x463b87=!0x0,_0x59cfe5=!0x0){super(_0x18f2e1),this['set']('isEnabled',!0x1),_0x463b87&&(this['applyButton']=this['_createButton'](Mi(_0x18f2e1,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x59cfe5&&(this['suggestButton']=this['_createButton'](Mi(_0x18f2e1,'AI_BALLOON_SUGGEST_BUTTON'),_0x463b87?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x463b87,'showSuggestButton':_0x59cfe5}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x4ef60f,showSuggestButton:_0x194352}){this['applyButton']&&(this['applyButton']['isVisible']=_0x4ef60f),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x194352);}['_createButton'](_0x2a13c8,_0x21727d){const _0x57ef27=new yt(this['locale']);return _0x57ef27['set']({'label':_0x2a13c8,'class':_0x21727d,'isVisible':!0x0,'withText':!0x0}),_0x57ef27;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x3059b7){super(_0x3059b7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0x3059b7,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x1567c7){super(_0x1567c7),this['set']('isVisible',!0x0);const _0x175c1e=new AISpinnerView('small');_0x175c1e['isVisible']=!0x0;const _0x4c77f6=new Nt(this['locale']);_0x4c77f6['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0xf3a470=>!_0xf3a470)]},'children':[_0x175c1e,_0x4c77f6]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x1571d7,_0x33751e){super(_0x1571d7),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x33751e,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x1bcd70(),this['_addContentWrapper'](_0x33751e),this['_addDisclaimerView'](),this['_addToolbar'](_0x33751e),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'](_0x33751e);});}['render'](){super['render']();for(const _0x365fb2 of this['_focusables'])this['_focusTracker']['add'](_0x365fb2['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x332570){-0x1===_0x332570?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x1ace37){this['_isLoading']=_0x1ace37;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x58ee5c){super['showError'](_0x58ee5c),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0xff8f25){super['showBlockingError'](_0xff8f25),this['setErrorState']();}['addMiniToolbarItem'](_0x1b2367){this['_miniToolbarView']['items']['has'](_0x1b2367)||this['_miniToolbarView']['items']['add'](_0x1b2367);}['removeMiniToolbarItem'](_0x1295cf){this['_miniToolbarView']['items']['has'](_0x1295cf)&&this['_miniToolbarView']['items']['remove'](_0x1295cf);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x278197,showSuggestButton:_0x4b4b51}){_0x278197=_0x278197&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x4b4b51=_0x4b4b51&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x278197,'showSuggestButton':_0x4b4b51});}async['updateContent'](_0xc8468c){await this['_streamableContentView']['update'](_0xc8468c);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x224fb8){this['_contentWrapper']=new Nt(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'](_0x224fb8['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x4c3731,showSuggestButton:_0x382164}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x4c3731,_0x382164),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',(_0x58adf7,_0x4d5175,_0x570563)=>!(_0x58adf7||_0x4d5175||_0x570563)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x4c3731,'showSuggestButton':_0x382164}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x307302){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x307302),this['_miniToolbarView']['delegate'](...Ss)['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',(_0x100cca,_0x530e10)=>!(_0x100cca||_0x530e10)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x23226c=new yt(this['locale']),_0x4bda3b=new yt(this['locale']),_0x206160=new AIActionsBalloonNavigationCounterView(this['locale']),_0x516ae3=new yt(this['locale']);_0x23226c['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x4bda3b['set']({'icon':_0x6eeec5,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x516ae3['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x23226c['bind']('isEnabled')['to'](this,'isBusy',_0x323667=>!_0x323667),_0x23226c['on']('execute',()=>{this['fire']('tryAgain');}),_0x4bda3b['bind']('isEnabled')['to'](this,'isBusy',_0x2f7151=>!_0x2f7151),_0x4bda3b['on']('execute',()=>{this['fire']('showPrevious');}),_0x516ae3['bind']('isEnabled')['to'](this,'isBusy',_0x31d7b1=>!_0x31d7b1),_0x516ae3['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x4bda3b,this['_navigationCounter']=_0x206160,this['_navigationNextButton']=_0x516ae3,this['_navigationTryAgainButton']=_0x23226c;}['updateMiniToolbarButtons'](_0x296b00,_0x25d27c){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x30b10f=_0x296b00>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x30b10f){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x5afb16=_0x296b00-_0x25d27c;this['_navigationCounter']['setInteractionCount'](_0x5afb16+'/'+_0x296b00),this['_navigationPreviousButton']['isEnabled']=_0x25d27c<_0x296b00-0x1,this['_navigationNextButton']['isEnabled']=_0x25d27c>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'](_0x2ba315){this['_isLoading']=_0x2ba315;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x4567c6=this['_getScrollableElement']();_0x4567c6&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x4567c6));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x156ea0){super(_0x156ea0);const _0xab94f7=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0xab94f7['to']('interactionCount')}]});}['setInteractionCount'](_0x21dbe3){this['set']('interactionCount',_0x21dbe3);}}class AIActions extends _0x20e120{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x34a64f];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x59c1f9){super(_0x59c1f9),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x4f56c5,_0x3cbc40,_0x3f99d5){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x41d225,anchorData:_0x5b6c60,root:_0x525e68}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x4f56c5,_0x41d225,_0x5b6c60,_0x525e68,_0x3cbc40,_0x3f99d5);}}const {modelFragment:_0xffc302,anchorData:_0x2e1a5d,root:_0xa414c7}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x4f56c5,_0xffc302,_0x2e1a5d,_0xa414c7,_0x3cbc40,_0x3f99d5);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x1c7048=this['editor']['plugins']['has']('TrackChanges');let _0x42a688=this['editor']['config']['get']('ai.availableReplyActions')||[...Ds];_0x1c7048||(_0x42a688=_0x42a688['filter'](_0x76efbd=>'insertSuggestion'!=_0x76efbd));const _0xf5786a=this['editor']['commands']['get']('trackChanges'),_0x160c84=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x1c7048,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x42a688});return _0x160c84['bind']('isBusy')['to'](this),_0xf5786a&&_0x160c84['bind']('isTrackChangesOn')['to'](_0xf5786a,'value'),_0x160c84['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x160c84['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x160c84['on']('showNext',()=>{this['_navigateToNext']();}),_0x160c84;}['_normalizeSelectionStart'](){const _0x21c30e=this['editor']['model'],_0x5a945f=_0x21c30e['document']['selection'],_0x63f8ee=_0x5a945f['getFirstRange']();if(!_0x63f8ee||_0x63f8ee['isCollapsed'])return;const _0x426e65=gt(_0x5a945f['getSelectedBlocks']());if(!_0x426e65)return;const _0x8cf06d=_0x21c30e['createPositionAt'](_0x426e65,0x0);_0x8cf06d['isAfter'](_0x63f8ee['start'])&&_0x21c30e['change'](_0x268119=>{_0x268119['setSelection'](_0x268119['createRange'](_0x8cf06d,_0x63f8ee['end']));});}['_getExecuteDataRegular'](){const _0x4d73b8=this['editor']['model']['document']['selection'],_0xb69d10=_0x4d73b8['getFirstRange']()['start']['root'];if(_0x4d73b8['isCollapsed']){const _0x2a2bef=gt(_0x4d73b8['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x4d73b8);this['editor']['model']['change'](_0x1211f4=>{_0x1211f4['setSelection'](_0x2a2bef,'in');});}this['_normalizeSelectionStart']();const _0x6ede16=_0x4d73b8['getFirstRange'](),_0x23cd95=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x4d73b8),_0x6ede16['start'],_0x6ede16['end']);this['_copyMarkersToFragment'](_0x23cd95,_0x4d73b8,{'isTableSelection':!0x1});const _0x229dd2=_0x4d73b8['getFirstRange']()['start'],_0x127730=new Map();let _0x3d0fd4=_0x23cd95;for(let _0x1c86d5=0x0;_0x1c86d5<_0x229dd2['path']['length'];_0x1c86d5++)_0x127730['set'](_0x3d0fd4,_0x229dd2['path'][_0x1c86d5]),_0x3d0fd4=_0x3d0fd4['getChild'](0x0);return{'modelFragment':_0x23cd95,'anchorData':_0x127730,'root':_0xb69d10};}['_getExecuteDataInTable'](){const _0x5ba4b7=this['editor']['model']['document']['selection'],_0x225e06=this['editor']['plugins']['get']('TableSelection'),_0xd3f219=_0x5ba4b7['getFirstRange']()['start']['root'],_0x2a428c=_0x225e06['getSelectionAsFragment'](),_0x250bce=_0x5ba4b7['getFirstRange']()['start']['parent']['parent'],_0x4ba6dc=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x250bce),this['editor']['model']['createPositionAfter'](_0x250bce)),_0x1ff4ec=this['_wrapWithCommonAncestors'](_0x2a428c,_0x4ba6dc['start'],_0x4ba6dc['end']);this['_copyMarkersToFragment'](_0x1ff4ec,_0x5ba4b7,{'isTableSelection':!0x0});const _0x5efd8c=_0x5ba4b7['getFirstRange']()['start'],_0x303f18=new Map();let _0x4c2bd2=_0x1ff4ec;for(let _0xd31c0e=0x0;_0xd31c0e<_0x5efd8c['path']['length'];_0xd31c0e++)if(_0x303f18['set'](_0x4c2bd2,_0x5efd8c['path'][_0xd31c0e]),_0xd31c0e<_0x5efd8c['path']['length']-0x1)_0x4c2bd2=_0x4c2bd2['getChild'](0x0);else{let _0x13c387=_0x4c2bd2['nextSibling'];for(;_0x13c387;)_0x303f18['set'](_0x13c387,_0x5efd8c['path'][_0xd31c0e]),_0x13c387=_0x13c387['nextSibling'];}return{'modelFragment':_0x1ff4ec,'anchorData':_0x303f18,'root':_0xd3f219};}async['_executeAction'](_0x4dc464,_0x524f98,_0x5766ec,_0x4a38e2,_0x352647,_0xf613d1){const _0x102474=this['editor']['plugins']['get'](AIEditing),_0x357d80=this['editor']['plugins']['get'](AIBalloon),_0x4aa5a1=this['editor']['model']['document']['selection'],_0x576861=await _0x102474['modelToDataWithIds'](_0x524f98,this['editor']),_0x50c743=this['editor']['model']['document']['version'],_0x34dc70=[..._0x4aa5a1['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x357d80['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x352647,'icon':_0xf613d1||_0x4767a0,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x34dc70,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x357d80),this['_interactionParams']={'action':_0x4dc464,'content':_0x576861,'version':_0x50c743,'aiBalloon':_0x357d80,'modelFragment':_0x524f98,'anchorData':_0x5766ec,'root':_0x4a38e2},this['_setupApplyListeners'](),this['listenTo'](_0x357d80,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x357d80,'dialogClosed',(_0x14d538,{id:_0x1b1395})=>{if('aiActionsBalloon'===_0x1b1395){for(const _0x29aa1b of this['_interactions']){if(0x0===_0x29aa1b['replies']['length']||_0x29aa1b['stoppedExplicitly'])continue;const _0x2ae8bc=_0x29aa1b['replies'][_0x29aa1b['replies']['length']-0x1],_0x57f598=_0x2ae8bc['changeGroups'][0x0];_0x57f598&&'pending'===_0x57f598['state']&&_0x2ae8bc['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x357d80);}}),this['_createInteraction'](_0x576861,_0x50c743,_0x357d80,_0x4dc464);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x5a92ad,anchorData:_0x3d7eee,root:_0x4ec156}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x5a92ad,_0x3d7eee,_0x4ec156,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x5a92ad,_0x3d7eee,_0x4ec156,!0x0);});}['_wrapWithCommonAncestors'](_0x3b0ce5,_0x5ba130,_0x31b57d){const _0x213c1f=this['editor']['model']['createRange'](_0x5ba130,_0x31b57d)['getCommonAncestor'](),_0x3d3956=_0x213c1f['is']('documentFragment')?[]:_0x213c1f['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x3d3956['length']){const _0x1632cf=_0x3d3956['map'](_0x4ff580=>_0x4ff580['_clone'](!0x1));for(let _0x3a52cd=0x1;_0x3a52cd<_0x1632cf['length'];_0x3a52cd++)_0x1632cf[_0x3a52cd-0x1]['_appendChild'](_0x1632cf[_0x3a52cd]);return _0x1632cf[_0x1632cf['length']-0x1]['_appendChild'](_0x3b0ce5),new _0x2751c1(_0x1632cf[0x0]);}return _0x3b0ce5;}['_copyMarkersToFragment'](_0x3ef496,_0x50bfc7,_0x27a12a={'isTableSelection':!0x1}){const _0x498042=this['editor']['model'],_0x3f7817=Array['from'](_0x50bfc7['getRanges']()),_0x110862=_0x50bfc7['getFirstRange']()['start'];for(const _0x38f858 of _0x498042['markers']){if(_0x38f858['name']['startsWith'](Rs)||!_0x38f858['affectsData'])continue;const _0x4dd8c0=_0x38f858['getRange']();if(!_0x3f7817['some'](_0x1ce6bc=>_0x1ce6bc['containsRange'](_0x4dd8c0,!0x0)))continue;const _0xe68a7=this['_regularCalculateMarkerPath'](_0x4dd8c0['start'],_0x110862,_0x27a12a['isTableSelection']),_0x14bd29=this['_regularCalculateMarkerPath'](_0x4dd8c0['end'],_0x110862,_0x27a12a['isTableSelection']),_0x38e9b1=_0x498042['createPositionFromPath'](_0x3ef496,_0xe68a7),_0x1b73fd=_0x498042['createPositionFromPath'](_0x3ef496,_0x14bd29);if(!_0x38e9b1['isEqual'](_0x1b73fd)){const _0x2a884b=_0x498042['createRange'](_0x38e9b1,_0x1b73fd);_0x3ef496['markers']['set'](_0x38f858['name'],_0x2a884b);}}}['_regularCalculateMarkerPath'](_0x3ca40a,_0x341ed6,_0x46bb2e=!0x1){const _0x59a68f=[..._0x3ca40a['path']['slice']()];for(let _0x5b8d1f=0x0;_0x5b8d1f<Math['max'](_0x341ed6['path']['length'],_0x3ca40a['path']['length']);_0x5b8d1f++){const _0x2c4a02=_0x341ed6['path'][_0x5b8d1f]||0x0,_0x27dd4b=(_0x3ca40a['path'][_0x5b8d1f]||0x0)-_0x2c4a02;if(_0x59a68f[_0x5b8d1f]=_0x27dd4b,0x0!==_0x27dd4b&&!_0x46bb2e)break;}return _0x59a68f;}async['_createInteraction'](_0x13191e,_0x19a284,_0x503394,_0x1e7267){const _0x14e787=this['editor'],_0xfdaae1=_0x14e787['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x1e7267,'content':_0x13191e,'version':_0x19a284,'aiBalloon':_0x503394,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0xfdaae1});const _0x499d22=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x14e787['locale'],'content':_0x13191e,'version':_0x19a284,'editor':_0x14e787,'rootName':_0xfdaae1['rootName'],..._0x1e7267});this['_interactions']['push'](_0x499d22);const _0x5ca361=(_0x1693a8,_0x209926=!0x1,_0x48d8c9='streaming')=>this['_promiseQueue']['enqueue'](async _0x35c0e1=>{try{const _0x478ab4=os({'changeGroups':_0x1693a8['changeGroups'],'documentContextContent':_0x1693a8['documentContextContent'],'showDiff':_0x209926,'trimUnchanged':!0x1});_0x478ab4['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x478ab4[0x0],'renderingStrategy':_0x48d8c9,'abortSignal':_0x35c0e1});}catch(_0x45d591){if(this['_isAbortError'](_0x45d591))return;throw _0x45d591;}});_0x499d22['on']('replyCreated',(_0x4da431,_0x53a166)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x5ca361(_0x53a166)['catch'](_0x154460=>{this['_isAbortError'](_0x154460)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x154460),this['_setErrorState'](_0x499d22));});}),_0x499d22['on']('replyContentUpdated',(_0x1ceaa5,_0x13c855)=>{_0x5ca361(_0x13c855)['catch'](_0x2bd2b3=>{this['_isAbortError'](_0x2bd2b3)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x2bd2b3),this['_setErrorState'](_0x499d22));});}),_0x499d22['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x24c34e){this['_isAbortError'](_0x24c34e)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x24c34e),this['_setErrorState'](_0x499d22));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0xcb53d0,{showDiff:_0x2a573e})=>{try{this['_balloonShowDiff']=_0x2a573e;const _0x4c410e=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x4c410e&&await _0x5ca361(_0x4c410e,_0x2a573e,'static');}catch(_0x27da55){this['_isAbortError'](_0x27da55)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x27da55),this['_setErrorState'](_0x499d22));}}),_0x499d22['on']('replyChangeGroupStateUpdated',()=>{const _0x99dedc={'positiveCount':_0x499d22['replies']['reduce']((_0x5984c2,_0x156093)=>_0x5984c2+_0x156093['changeGroups']['filter'](_0x45a7d3=>'accepted'===_0x45a7d3['state'])['length'],0x0),'totalCount':_0x499d22['replies']['reduce']((_0x39283b,_0xdf9567)=>_0x39283b+_0xdf9567['changeGroups']['length'],0x0)},_0x307429=_0x499d22['actionCallId'],_0x33f72d=_0x499d22['actionName'];_0x33f72d?this['_aiConnector']['upsertAIActionRating'](_0x33f72d,_0x307429,_0x99dedc):this['_aiConnector']['upsertCustomAIActionRating'](_0x307429,_0x99dedc);}),this['_setLoadingState']();try{const _0x4e669c=await _0x499d22['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x4e669c;}catch(_0x513423){if(this['_isAbortError'](_0x513423))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x499d22);}}['_applyChanges'](_0x165e24,_0x2fbb52,_0x1ff5d7,_0x37f798){const _0x201dd4=this['editor'];if(_0x37f798&&!_0x201dd4['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x42dd7f=this['editor']['plugins']['get'](_0x34a64f),_0x49db66=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x49db66||!_0x49db66['replies']['length'])return;const _0x29e7f4=_0x49db66['replies'][_0x49db66['replies']['length']-0x1],_0x5ae980=_0x29e7f4['changeGroups'];_0x29e7f4['setChangeGroupState'](0x0,'accepted');let _0x4490dc=Es({'reply':_0x29e7f4,'interaction':_0x49db66,'groups':_0x5ae980,'transform':!0x1,'documentCompare':_0x42dd7f,'documentCompareOptions':{'anchor':_0x201dd4['model']['createPositionAt'](_0x165e24,0x0),'markDeletions':_0x37f798}});_0x4490dc=this['_filterOperationsOutsideRange'](_0x4490dc,_0x2fbb52);for(const _0x54d2a7 of _0x4490dc)this['_anchorOperation'](_0x2fbb52,_0x54d2a7,_0x1ff5d7);const _0x4ff6fd=_0x49db66['getDocumentContext']()['documents'][0x0]['version'],_0x1f1b89=_0x201dd4['model']['document']['history']['getOperations'](_0x4ff6fd),_0x454376={'document':_0x201dd4['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0xab38e0=_0x213b3b(_0x4490dc,_0x1f1b89,_0x454376)['operationsA'];_0x201dd4['model']['change'](_0x1bea04=>{if(_0x1bea04['setSelection'](_0x201dd4['model']['document']['selection']['focus']),_0x37f798)_0x201dd4['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0xab38e0);else{for(const _0x1345bf of _0xab38e0)_0x1345bf['baseVersion']=_0x201dd4['model']['document']['version'],Ts(_0x201dd4,_0x1345bf),_0x1bea04['batch']['addOperation'](_0x1345bf),_0x201dd4['model']['applyOperation'](_0x1345bf);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x34eb4f,_0x30cb94){return _0x34eb4f['filter'](_0x565733=>{if('rename'==_0x565733['type']){const _0x3da225=_0x565733['position']['nodeAfter'];return!_0x30cb94['has'](_0x3da225);}if(_0x565733['type']['indexOf']('Attribute')>-0x1){const _0x4237cc=_0x565733['range']['start']['nodeAfter'];return!_0x30cb94['has'](_0x4237cc);}return!0x0;});}['_anchorOperation'](_0x4ac471,_0x1671d1,_0x29e37e){const _0x277850=_0x1671d1['clone']();for(const _0x14cd92 in _0x1671d1){const _0x5d2ad1=_0x1671d1[_0x14cd92];_0x5d2ad1 instanceof _0x5ca7e7?_0x1671d1[_0x14cd92]=new _0x5ca7e7(_0x477b10(_0x5d2ad1['start']),_0x477b10(_0x5d2ad1['end'])):_0x5d2ad1 instanceof _0x47f02c&&(_0x1671d1[_0x14cd92]=_0x477b10(_0x5d2ad1));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x277850['type'])){if(_0x277850['isDocumentOperation']=!0x1,_0x277850['baseVersion']=null,'remove'==_0x277850['type']){const _0x5332c0=_0x277850['sourcePosition'],_0x4abf98=_0x277850['howMany'];new _0x365f09(_0x5332c0,_0x4abf98)['_execute']();}else _0x277850['_execute']();}function _0x477b10(_0x5554d0){if('$graveyard'==_0x5554d0['root']['rootName'])return _0x5554d0;const _0x2946ec=[];let _0x266b54=_0x5554d0['root'];for(let _0xcd7747=0x0;_0xcd7747<_0x5554d0['path']['length'];_0xcd7747++){const _0x4d6f3a=_0x4ac471['get'](_0x266b54)||0x0;_0x2946ec[_0xcd7747]=_0x5554d0['path'][_0xcd7747]+_0x4d6f3a,_0x266b54=_0x266b54['getChildAtOffset'](_0x5554d0['path'][_0xcd7747]);}return new _0x47f02c(_0x29e37e,_0x2946ec,_0x5554d0['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x29552e,content:_0x5007cd,version:_0x12a115,aiBalloon:_0x38d8f4}=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'](_0x5007cd,_0x12a115,_0x38d8f4,_0x29552e)['catch'](_0x565291=>{this['_isAbortError'](_0x565291)||console['error']('Error\x20refreshing\x20interaction:',_0x565291);});}['_isAbortError'](_0xba3d74){return!!_0xba3d74['message']&&_0xba3d74['message']['startsWith']('ai-request-aborted');}['_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 _0x317cfa=this['_interactions']['length'];this['_currentInteractionIndex']<_0x317cfa-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x20f0ea){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x20f0ea;const _0x86628e=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x86628e)return;if(_0x86628e['hasError'])return this['_setErrorState'](_0x86628e),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x86628e['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x4e2b52=_0x86628e['replies'][_0x86628e['replies']['length']-0x1];if(_0x4e2b52)try{const _0x133546=os({'changeGroups':_0x4e2b52['changeGroups'],'documentContextContent':_0x4e2b52['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x30bd47=>setTimeout(_0x30bd47,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x133546[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x58c7a7){this['_isAbortError'](_0x58c7a7)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x58c7a7);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x108ddf){const _0x4fdbef=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x4fdbef),_0x108ddf['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);}}class AIQuickActions extends _0x20e120{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2e5b87){super(_0x2e5b87),_0x2e5b87['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x15e22b,_0x3b90a4){super(_0x15e22b),this['id']=_0x3b90a4,this['set']('status','pending'),this['set']('changeId',_0x3b90a4),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',(_0xcdb113,_0x30621b)=>{_0x30621b&&_0x30621b['target']&&'A'===_0x30621b['target']['tagName']&&_0x30621b['preventDefault'](),this['fire']('activateChange',{'id':_0x3b90a4,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x3b90a4,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x3b90a4,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x198990=new Nt(this['locale']);return _0x198990['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',_0x5c019d=>!_0x5c019d)]}}),_0x198990;}['_createAcceptButtonView'](){const _0x19f625=new yt(this['locale']);return _0x19f625['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x19f625['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xafe4a9=>{this['fire']('acceptChange',{'id':this['changeId']}),_0xafe4a9['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x287e90=>'pending'!==_0x287e90&&'accepted'!==_0x287e90),this['bindTemplate']['if']('status',Bi,_0x6d115b=>'pending'===_0x6d115b),this['bindTemplate']['if']('status',Gi,_0x492356=>'pending'!==_0x492356),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x599ec3=>'accepted'===_0x599ec3)]}}),this['on']('change:status',(_0x4c4361,_0x339d1c,_0x7ed00d)=>{_0x19f625['isEnabled']='pending'===_0x7ed00d,'accepted'===_0x7ed00d&&(_0x19f625['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x19f625['icon']=_0x3d9fb7);}),_0x19f625;}['_createDismissButtonView'](){const _0x24f9a6=new yt(this['locale']);return _0x24f9a6['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x24f9a6['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2ccdc4=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x2ccdc4['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x11c506=>'pending'!==_0x11c506&&'rejected'!==_0x11c506),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x498a08=>'pending'===_0x498a08),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3f26bb=>'rejected'===_0x3f26bb)]}}),this['on']('change:status',(_0x249f51,_0x5a80a7,_0x188afb)=>{_0x24f9a6['isEnabled']='pending'===_0x188afb,'rejected'===_0x188afb&&(_0x24f9a6['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x24f9a6['icon']=_0x346199);}),_0x24f9a6;}['_createInfoButtonView'](){const _0xbebe80=new yt(this['locale']);return _0xbebe80['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x23d873,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0xbebe80['bind']('isOn')['to'](this,'isInfoToggleOn',_0x22236c=>_0x22236c),_0xbebe80['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0xbebe80;}['_createOutdatedButtonView'](){const _0xc83b13=new yt(this['locale']);return _0xc83b13['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0xc83b13['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0xc1fba6=>'outdated'!==_0xc1fba6)],'disabled':'disabled'}}),_0xc83b13;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x4176ec,_0x28f542){super(_0x4176ec),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']()),_0x28f542['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x46fc1e){this['resultItemView']['changeId']=_0x46fc1e['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x46fc1e['contentDiffed'];}['showBalloon'](_0x3666af,_0x323a8a,_0x14cd7d,_0x5b5811,_0x11bc59,_0x1c6c77){const _0x49dde9=_0x323a8a();if(!_0x49dde9)return;this['updateContent'](_0x3666af),this['show']();const _0x2a90d0=Array['from'](_0x49dde9['getClientRects']())['reverse'](),_0x32b249=this['_getPointedRectIndexFromEvent'](_0x14cd7d,_0x2a90d0),_0x32d78d=_0x2a90d0[_0x32b249??0x0];'click'===_0x5b5811?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x323a8a(),_0x32b249,_0x3666af['id'],_0x11bc59,_0x1c6c77)||_0x32d78d})):'hover'===_0x5b5811&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x323a8a(),_0x32b249,_0x3666af['id'])||_0x32d78d}));}['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'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x3be951=[this['element']];return this['_pinnedTargetElement']&&_0x3be951['push'](this['_pinnedTargetElement']),_0x3be951;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0xaa0e80=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0xaa0e80['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']]}]}),_0xaa0e80;}['_getBestRectPositionOnClick'](_0x72156c,_0x4c2a9c,_0x29cd65,_0x4409ae,_0x31fcda){if(!_0x72156c)return null;const _0xaf5727=this['position']['replace']('arrow_',''),_0x23f8e3=Array['from'](_0x72156c['getClientRects']());let _0x13dcfb,_0x3f9472=_0x23f8e3['reverse']();return void 0x0!==_0x4c2a9c&&this['_isPinnedRectVisible'](_0x3f9472[_0x4c2a9c],_0x4409ae,_0x31fcda)?(_0x13dcfb=_0x3f9472[_0x4c2a9c],this['_pinnedRectIndex']=_0x4c2a9c):this['_isPinnedRectVisible'](_0x3f9472[0x0],_0x4409ae,_0x31fcda)&&void 0x0===_0x4c2a9c?_0x13dcfb=_0x3f9472[0x0]:(_0x3f9472='s'==_0xaf5727[0x0]?[..._0x23f8e3]['reverse']():_0x23f8e3,_0x3f9472['forEach'](_0x5a9987=>{this['_isPinnedRectVisible'](_0x5a9987,_0x4409ae,_0x31fcda)&&(_0x13dcfb=_0x5a9987);})),this['_pinnedTargetChangeId']=_0x29cd65,this['_pinnedTargetElement']=_0x72156c,_0x13dcfb||_0x72156c['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x19255a,_0x26e853,_0x35ace5){if(!_0x19255a)return null;const _0x540f41=Array['from'](_0x19255a['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x26e853&&this['_pinnedTargetChangeId']!==_0x35ace5)return this['_pinnedRectIndex']=_0x26e853,this['_pinnedTargetElement']=_0x19255a,this['_pinnedTargetChangeId']=_0x35ace5,_0x540f41[_0x26e853];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x35ace5){if(_0x19255a!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x540f41[this['_pinnedRectIndex']];}return void 0x0!==_0x26e853&&this['_pinnedTargetChangeId']!==_0x35ace5?(this['_pinnedRectIndex']=_0x26e853,this['_pinnedTargetElement']=_0x19255a,this['_pinnedTargetChangeId']=_0x35ace5,_0x540f41[_0x26e853]):_0x19255a['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x491f27,_0x1d2bd8){if(_0x491f27)for(let _0x568338=0x0;_0x568338<_0x1d2bd8['length'];_0x568338++){const _0x4777b5=_0x1d2bd8[_0x568338];if(_0x491f27['clientX']>=_0x4777b5['left']-0x3&&_0x491f27['clientX']<=_0x4777b5['right']+0x3&&_0x491f27['clientY']>=_0x4777b5['top']-0x3&&_0x491f27['clientY']<=_0x4777b5['bottom']+0x3)return _0x568338;}}['_isPinnedRectVisible'](_0x1cee32,_0x4c6e48,_0x56332a){const _0x3d041f=new dt(_0x1cee32),_0x34d6d7=_0x4c6e48||document['documentElement'],_0x1f223c=_0x3d041f['getIntersection'](Ot(_0x56332a)),_0x4a119a=new dt(_0x34d6d7)['getIntersection'](_0x3d041f);return!!(_0x1f223c&&_0x4a119a&&_0x3d041f['width']>0x0);}}const Zn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x464fb9{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x110a44){super(_0x110a44),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Zn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x204426=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x204426);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x280f9a){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x49542c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x280f9a,_0x49542c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x5b4d80){_0x5b4d80&&('error-general'!==_0x5b4d80['status']?'error-chunk'!==_0x5b4d80['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x4aaa92){this['_mainView']['addCheckRunResult'](_0x4aaa92);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x1862af){this['_mainView']['showGeneralReviewCoreErrorView'](_0x1862af??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x211421,_0x53ec46){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x211421,_0x53ec46);}['setActiveStateInResults'](_0x509fe8){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x46baee=>{_0x46baee['id']===_0x509fe8&&_0x46baee['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0xd26277=>_0xd26277['setItemAsInactive']());}['updateChangeState'](_0x35da6d,_0x17ef4f){'accepted'===_0x17ef4f||'rejected'===_0x17ef4f||'outdated'===_0x17ef4f?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x35da6d,_0x17ef4f):this['_mainView']['reviewCheckResultsView']['showResult'](_0x35da6d,_0x17ef4f);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x5380cc,_0x33656f,_0x41319f,_0x267e50,_0x57f371,_0x5199ab){this['_balloonSuggestionView']['showBalloon'](_0x5380cc,_0x33656f,_0x41319f,_0x267e50,_0x57f371,_0x5199ab);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x33c984){const _0x45b234=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x15cb95=>_0x15cb95['id']===_0x33c984);return _0x45b234?_0x45b234['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x554130){super(_0x554130),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x56031e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x56031e['if']('isVisible','ck-hidden',_0xcc471f=>!_0xcc471f)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x56031e['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x14c747,_0x5f5752){super(_0x14c747),this['reviewCoreHeader']=_0x5f5752['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x14c747),this['reviewCheckListView']=_0x5f5752['list'],this['reviewCheckListView']['delegate'](...Zn)['to'](this),this['reviewCheckResultsView']=_0x5f5752['results'],this['reviewCheckResultsView']['delegate'](...Zn)['to'](this),this['reviewCompletedView']=_0x5f5752['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'](_0x206dba){this['reviewCheckResultsView']['addResult'](_0x206dba),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'](_0x3fe161){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x3fe161;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x5ca11a,_0x572ffb){super(_0x572ffb),this['set']({'label':_0x5ca11a,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x1af721,_0x45f6c5){super(_0x1af721),this['_contents']=_0x45f6c5,this['_resultViews']=new _0x1bcd70(),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 AIDisclaimerView(_0x1af721),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 _0x298df0=this['_createCombinedSkeletonLoader'](),_0x2d05c0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x2d05c0['if']('isLoading','ck-ai_review__check-run_loading',_0x1f5dbf=>_0x1f5dbf),_0x2d05c0['if']('isResultReady','ck-ai_review__check-run_ready',_0x20b1c6=>_0x20b1c6),_0x2d05c0['if']('isVisible','ck-hidden',_0x2cea99=>!_0x2cea99)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x298df0,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x51ac15){const _0x12e7f2=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x51ac15['id']);_0x12e7f2['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x12e7f2),_0x12e7f2['resultResponseView']['element']['innerHTML']=_0x51ac15['contentDiffed'];}['hideResult'](_0x57097c,_0x36f6fd){if('pending'===_0x36f6fd)return;const _0x246f33=this['_resultViews']['find'](_0x40f50f=>_0x40f50f['id']===_0x57097c);_0x246f33&&(_0x246f33['status']=_0x36f6fd,_0x246f33['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x2c3ef3,_0x3584b4){if('pending'!==_0x3584b4)return;const _0x27b0e4=this['_resultViews']['find'](_0x57aadb=>_0x57aadb['id']===_0x2c3ef3);_0x27b0e4&&(_0x27b0e4['status']=_0x3584b4,_0x27b0e4['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x1d0975,_0xc36817){this['headerTitle']=_0x1d0975,this['headerSubtitle']=_0xc36817||'';}['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 AISkeletonView(this['locale'],Ls['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x33c3ef=new Nt(this['locale']),_0x7bdbd3=[];for(let _0x3e3896=0x0;_0x3e3896<0x10;_0x3e3896++){const _0x3dd08e=this['_createSkeletonLoader']();_0x3dd08e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x7bdbd3['push'](_0x3dd08e);}return _0x33c3ef['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1e1e2f=>!_0x1e1e2f)]},'children':_0x7bdbd3}),_0x33c3ef;}['_createResultsBodyView'](){const _0x3d7b3e=new Nt(this['locale']);return _0x3d7b3e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x41f5b0=>_0x41f5b0)]},'children':this['_resultViews']}),_0x3d7b3e;}['_createErrorView'](){const _0x53af51=new Nt(this['locale']),_0x55fe99=new yt(this['locale']),t=this['locale']['t'];return _0x53af51['delegate']('retryReview')['to'](this),_0x55fe99['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x55fe99['on']('execute',()=>{this['fire']('retryReview');}),_0x53af51['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x14431d=>!_0x14431d),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x18dec5=>'chunk'===_0x18dec5)]},'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',_0x67f521=>'chunk'===_0x67f521)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x28a4e7=>'general'!==_0x28a4e7)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x4ff0a5=>'chunk'!==_0x4ff0a5)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x55fe99]}),_0x53af51;}['_createCancelButtonView'](){const _0x3b65a8=new yt(this['locale']);return _0x3b65a8['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x53a294}),_0x3b65a8['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x142362=>_0x142362),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2f88e2=>_0x2f88e2)]}}),_0x3b65a8['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3b65a8;}['_createToggleDiffButtonView'](){const _0x41b6e3=new yt(this['locale']);_0x41b6e3['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x41b6e3['bind']('isEnabled')['to'](this,'isError',_0x2aade6=>!_0x2aade6),_0x41b6e3['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x201293=>!_0x201293),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3b4eec=>_0x3b4eec)]}});const _0x274e2e=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x371ef3=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x41b6e3['bind']('isOn')['to'](this,'isToggleDiffOn',_0x65cf6=>_0x65cf6),_0x41b6e3['bind']('icon')['to'](this,'isToggleDiffOn',_0x304fe7=>_0x304fe7?nt:rt),_0x41b6e3['bind']('label')['to'](this,'isToggleDiffOn',_0x2f9d5b=>_0x2f9d5b?_0x274e2e:_0x371ef3),_0x41b6e3['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x41b6e3;}['_createAcceptAllButtonView'](){const _0x3e8a16=new yt(this['locale']);return _0x3e8a16['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x3e8a16['bind']('isEnabled')['to'](this,'isError',_0x27c909=>!_0x27c909),_0x3e8a16['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x183455=>!_0x183455),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2454c0=>_0x2454c0)]}}),_0x3e8a16['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x3e8a16;}['_createExitReviewButtonView'](){const _0x1f0567=new yt(this['locale']);return _0x1f0567['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x1f0567['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x59f7b7=>!_0x59f7b7),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x234951=>_0x234951)]}}),_0x1f0567['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x1f0567;}['_createResultHeaderView'](){const _0x2b48c8=new Nt(this['locale']),_0x5d6993=this['_createTitleView']();return _0x2b48c8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x18f153=>_0x18f153)]},'children':[_0x5d6993,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x57d5ba=>!_0x57d5ba)],'title':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Mi(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']]}]}),_0x2b48c8;}['_createTitleView'](){const _0x36996d=new Nt(this['locale']),_0x18fb45=new AISpinnerView();return _0x18fb45['bind']('isVisible')['to'](this,'isResultReady',_0x140be9=>!_0x140be9),_0x36996d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x1c0fdf=>_0x1c0fdf)]},'children':[_0x18fb45,{'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')}]}]}]}),_0x36996d;}['_createFinishReviewButtonView'](){const _0x2c5520=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x2c5520['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xd2f858=>!_0xd2f858)]}}),_0x2c5520['delegate']('finishReview')['to'](this),_0x2c5520;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x3dabcc,_0x166c55){super(_0x3dabcc),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x166c55['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x166c55['headerText']);const _0x20bb48=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x20bb48['if']('isVisible','ck-hidden',_0x5a4d5d=>!_0x5a4d5d)]},'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':_0x166c55['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x3be33f){const _0x283eb5=new AIReviewCoreFinishReviewButtonView(_0x3be33f,this['locale']);return _0x283eb5['delegate']('finishReview')['to'](this),_0x283eb5;}['_createResultHeaderView'](_0x4a0f9b){const _0x25a99c=new Nt(this['locale']);return _0x25a99c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x4a0f9b},'children':[{'text':_0x4a0f9b}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x25a99c;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x452598,_0x2f7dcf){super(_0x452598),this['_defaultValue']=_0x2f7dcf['default']||(_0x2f7dcf['data']['length']>0x0?_0x2f7dcf['data'][0x0]['id']:''),this['_defaultLabel']=_0x2f7dcf['data']['find'](_0x53c810=>_0x53c810['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x213f04=this['_prepareListOptions'](_0x2f7dcf['data']);Jt(this['_dropdownView'],_0x213f04,{'role':'menu','ariaLabel':_0x2f7dcf['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4ee130=>{_0x4ee130['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x150509=>{this['formValue']=_0x150509['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x150509['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'](_0x32aa53=[]){const _0x1d8f48=new _t();this['resetToDefault']();for(const _0x4bb9d5 of _0x32aa53){const _0x4fdb65=new Zt({'label':_0x4bb9d5['label'],'withText':!0x0,'role':'menuitemradio','id':_0x4bb9d5['id'],'model':_0x4bb9d5});_0x4fdb65['bind']('isOn')['to'](this,'formValue',_0x43e54c=>_0x43e54c===_0x4fdb65['id']);const _0xac0f38={'type':'button','model':_0x4fdb65};_0x1d8f48['add'](_0xac0f38);}return _0x1d8f48;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x7861e6,_0x3764b1,_0x2231e1){super(_0x7861e6),this['argsKey']=_0x3764b1?.['argsKey'];if('dropdown'===_0x3764b1['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x3764b1);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x2b5c04=new _0x5658f7(this['locale'],{'children':[this['_formItem']],'class':[_0x2231e1?'ck-form__row_with-submit':'']});_0x2231e1&&_0x2b5c04['children']['add'](_0x2231e1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x2b5c04]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x4c7fac{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x5d9114){super(_0x5d9114),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),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']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x1bcd70();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x1f1e9b,_0x353115,_0xd2e6dd=!0x1){super(_0x1f1e9b),this['_check']=_0x353115,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x353115['defaultModel']?_0x353115['defaultModel']['id']:'',this['_defaultLabel']=_0x353115['defaultModel']?_0x353115['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x2c4cbe(this['locale'],()=>new AIReviewCorePromptInputView(_0x1f1e9b)),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 _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0xd2e6dd),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x5658f7(this['locale'],{'children':[this['promptInputView']]}),new _0x5658f7(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x3809b8,_0x4be744)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x4be744()):_0x4be744();}),this['focusCycler']=new Ut({'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'](_0x272c12=>{this['_focusables']['add'](_0x272c12),this['focusTracker']['add'](_0x272c12['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 _0x1630a5 of this['_getFormValidators']()){const _0x205c8c=_0x1630a5();if(_0x205c8c)return this['promptInputView']['errorText']=_0x205c8c,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x5ada8f=new yt(this['locale']),t=this['locale']['t'];return _0x5ada8f['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x5ada8f['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x5ada8f;}['_createCancelButtonView'](){const _0x57af90=new yt(this['locale']),t=this['locale']['t'];return _0x57af90['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x57af90['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x495905=>{_0x495905['stopPropagation']();})}}),_0x57af90['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x57af90;}['_setModelList'](_0x480bc0){this['_modelSelectionDropdownItems']['clear']();const _0x34c956=this['_check']['models'];if(_0x480bc0)this['set']('modelDisplayMode','hidden');else{const _0x117dfe=0x1===_0x34c956['length'];this['set']('modelDisplayMode',_0x117dfe?'name':'selector');}if(this['resetToDefault'](),_0x34c956?.['length']){0x1===_0x34c956['length']&&this['set']('activeModelName',_0x34c956[0x0]['name']||_0x34c956[0x0]['id']);for(const _0x45f22d of _0x34c956){const _0x322417=new Zt({'label':_0x45f22d['name'],'withText':!0x0,'role':'menuitemradio','id':_0x45f22d['id'],'model':_0x45f22d});_0x322417['bind']('isOn')['to'](this,'modelId',_0x128535=>_0x128535===_0x45f22d['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x322417,'labelView':new ModelButtonLabelView(this['locale'],_0x45f22d)});}}}['_createModelSelectionDropdown'](){const _0x3c7ade=Ft(this['locale']);return _0x3c7ade['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x3c7ade['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x3c7ade['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3464ec=>'selector'===_0x3464ec),this['listenTo'](_0x3c7ade,'execute',_0xb0222=>{this['modelId']=_0xb0222['source']['model']['id'],_0x3c7ade['buttonView']['label']=_0xb0222['source']['label'];}),_0x3c7ade;}['_createModelNameView'](){const _0x21bbb8=new ModelNameView(this['locale']);return _0x21bbb8['bind']('text')['to'](this,'activeModelName',_0x418368=>_0x418368??''),_0x21bbb8['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3db952=>'name'===_0x3db952),_0x21bbb8;}['_createActionsFooterView'](){const _0x2db933=new Nt(this['locale']);return _0x2db933['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']]}]}),_0x2db933;}}class ModelNameView extends Nt{constructor(_0x57edee){super(_0x57edee),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x2395fe=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x2395fe['if']('isVisible','ck-hidden',_0x129b45=>!_0x129b45)]},'children':[{'text':_0x2395fe['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x28c019,_0x2194de){super();const _0x25d872=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x25d872['to']('style'),'id':_0x25d872['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x25d872['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x2194de['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x1bcd70();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x2481e1,_0x4b339f,_0x3942ec,_0x2909e6=!0x1){super(_0x2481e1),this['_hideModels']=_0x2909e6,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x4b339f['isParameterized']);const _0x233b5d=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',_0x4cac44=>_0x4cac44),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x493fb1=>_0x493fb1)],'style':{'--ck-ai-review-check-list-item-index':_0x3942ec}},'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':_0x4b339f['title']}]},_0x233b5d]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x4b339f['description']?[{'text':_0x4b339f['description']}]:[]}]}]},..._0x4b339f['isParameterized']?[this['_createParameterizedView'](_0x4b339f)]:[],...'custom'===_0x4b339f['id']?[this['_createCustomView'](_0x4b339f,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x4b339f['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x4b339f['id'],'args':_0x4b339f['useArgs']?_0x4b339f['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x3398c8=>{_0x3398c8['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x6bc0b8=new Lt();return _0x6bc0b8['content']=ot,_0x6bc0b8['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x6bc0b8;}['_createParameterizedView'](_0x3af1d2){const _0x3a776e=new Nt(),_0x2d7c2e=this['_createFormView'](_0x3af1d2);return _0x3a776e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x2888f5=>!_0x2888f5)]},'children':[_0x2d7c2e]}),_0x3a776e;}['_createFormView'](_0xd1c58c){const _0x2de00f=new Nt(),_0x451310=Array['isArray'](_0xd1c58c['options'])?_0xd1c58c['options']:[],_0x1d1635=new yt(this['locale']),t=this['locale']['t'];_0x1d1635['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x1d1635['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x34df5a=>{_0x34df5a['stopPropagation']();})}}),_0x1d1635['on']('execute',()=>{const _0x16751b=[],_0x479349={};this['_formItemsCollection']['forEach'](_0x28824b=>{_0x16751b['push'](_0x28824b['value']),_0xd1c58c['useArgs']&&_0xd1c58c['options']&&(_0x479349[_0x28824b['argsKey']]=_0x28824b['value']);}),this['fire']('runReviewCheck',{'id':_0xd1c58c['id'],'params':_0x16751b['length']?_0x16751b:void 0x0,'args':Object['keys'](_0x479349)['length']?_0x479349:void 0x0});});const _0x3bf957=_0x451310['length'];return _0x451310['forEach']((_0x19589f,_0x3a0636)=>{const _0x136877=_0x3a0636===_0x3bf957-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x19589f,_0x136877?_0x1d1635:null));}),_0x2de00f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x2de00f;}['_createCustomView'](_0x3df5fa,_0x2c8481=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x3df5fa,_0x2c8481),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',_0x1ee729=>!_0x1ee729)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0xb2ff6,_0x2ec674,_0x586f75)=>{_0x586f75||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x4a564c){super(_0x4a564c),this['_checkViews']=new _0x1bcd70(),this['_setupTemplate']();}['setChecks'](_0x3bb20b,_0x20c595=!0x1){this['_checkViews']['clear']();for(const [_0x4cefb1,_0xa422aa]of _0x3bb20b['entries']()){const _0x47be8b=new AIReviewCoreReviewCommandListItemView(this['locale'],_0xa422aa,_0x4cefb1,_0x20c595);_0x47be8b['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x47be8b);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x5a46eb of this['_checkViews'])_0x5a46eb instanceof AIReviewCoreReviewCommandListItemView&&_0x5a46eb['resetToDefault']();}['_setupTemplate'](){const _0x58052b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x58052b['if']('isVisible','ck-hidden',_0x13dc3b=>!_0x13dc3b)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x4f694d=this['context']['plugins']['get']('AITabs'),_0x206071=this['context']['locale'],_0x4d1265=new AIHeaderView(_0x206071,{'label':Mi(_0x206071,'AI_REVIEW_MODE'),'icon':_0x3b947c,'class':'ck-ai-header_review','showResizeButton':_0x4f694d['showResizeButton']});return _0x4d1265['delegate']('resizeTabs')['to'](_0x4f694d),_0x4d1265['bind']('isMaximized')['to'](_0x4f694d['view'],'isMaximized',_0x12f423=>_0x12f423),new AIReviewCoreView(this['context']['locale'],{'header':_0x4d1265,'list':new AIReviewCoreReviewCheckListView(_0x206071),'results':new AIReviewCoreUICheckResultsView(_0x206071,{'generalErrorText':Mi(_0x206071,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x206071,{'headerText':Mi(_0x206071,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x206071,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x206071,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x4c3160=this['context']['plugins']['get']('AITabs');_0x4c3160['view']['on']('activateTab',(_0xd0528c,{newTab:_0x238cdf,oldTab:_0x29d96f})=>{'reviewMode'===_0x238cdf?this['fire']('getReviewCheckList'):'reviewMode'===_0x29d96f&&this['fire']('leaveReview');}),_0x4c3160['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x3b947c,'order':0x0,'content':this['_mainView']});}}const tr='review-',er=['softBreak'],ir=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x464fb9{static get['requires'](){return[_0x34a64f,AIEditing];}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(_0x521fc2){super(_0x521fc2),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x2d7d86=_0x37d638=>this['_scheduleAttachReviewEditingToEditor'](_0x37d638);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x2fdbcb)return void _0x2d7d86(this['context']);const _0x34cd94=this['context'];for(const _0x3720c1 of _0x34cd94['editors'])_0x2d7d86(_0x3720c1);this['listenTo'](_0x34cd94['editors'],'add',(_0x59e1d1,_0x1702dc)=>{_0x2d7d86(_0x1702dc);}),this['listenTo'](_0x34cd94['editors'],'remove',(_0x24b5fa,_0x34d408)=>{for(const [_0x1148b5,_0x24a43f]of this['_markers'])_0x24a43f['editor']===_0x34d408&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x1148b5,'changeId':_0x24a43f['groupId']}),this['_markers']['delete'](_0x1148b5));});}['_scheduleAttachReviewEditingToEditor'](_0x45abb6){const _0x41ff34=()=>{'destroyed'!==_0x45abb6['state']&&_0x45abb6['conversion']&&this['_attachReviewEditingToEditor'](_0x45abb6);};if('ready'===_0x45abb6['state'])return void _0x41ff34();const _0x541535=()=>{this['stopListening'](_0x45abb6,'ready',_0x541535),_0x41ff34();};this['listenTo'](_0x45abb6,'ready',_0x541535);}['_attachReviewEditingToEditor'](_0x33c979){this['_reviewEditingAttachedEditors']['has'](_0x33c979)||(_0x33c979['conversion']['for']('editingDowncast')['markerToElement']({'model':tr+'insert','view':(_0x3c1cf7,{writer:_0x1ac166})=>{const _0x1b5e0a=this['_markers']['get'](_0x3c1cf7['markerName']),_0x5a34c3={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x1b5e0a?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x3c1cf7['markerName']};return _0x1ac166['createUIElement']('span',_0x5a34c3,function(_0x2328ef){const _0x4d355b=this['toDomElement'](_0x2328ef);return _0x4d355b['innerHTML']=_0x1b5e0a?.['content']?.['asString']||'',_0x4d355b;});}}),_0x33c979['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-only','view':_0x13ad43=>{const _0x1a2421=this['_markers']['get'](_0x13ad43['markerName']),_0x5840d1=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x1a2421?.['id']||'')&&_0x5840d1['push']('ck-ai_review__change_active'),{'classes':_0x5840d1,'attributes':{'data-marker-id':_0x13ad43['markerName']}};}}),_0x33c979['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-context','view':_0x155a99=>{const _0x3cb179=this['_markers']['get'](_0x155a99['markerName']),_0x5f1750=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x3cb179?.['id']||'')&&_0x5f1750['push']('ck-ai_review__change_active'),{'classes':_0x5f1750,'attributes':{'data-marker-id':_0x155a99['markerName']}};}}),_0x33c979['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-text','view':_0x4ac923=>{const _0x233d05=this['_markers']['get'](_0x4ac923['markerName']),_0x45bbfb=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x233d05?.['id']||'')&&_0x45bbfb['push']('ck-ai_review__change_active'),{'classes':_0x45bbfb,'attributes':{'data-marker-id':_0x4ac923['markerName']}};}}),_0x33c979['conversion']['for']('dataDowncast')['markerToElement']({'model':tr+'suggestion-context','view':(_0x15f2dc,{writer:_0xfb86d8})=>_0xfb86d8['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x15f2dc['isOpening']?'start':'end')})}),_0x33c979['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x248cc9,'view':_0x331999}),this['_updateMouseMarkerInteractionListeners'](_0x33c979),this['listenTo'](_0x33c979,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x33c979),{'priority':'lowest'}),this['listenTo'](_0x33c979,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x33c979),{'priority':'lowest'}),_0x33c979['model']['document']['registerPostFixer'](_0xd9c167=>this['_validateMarkers'](_0x33c979,_0xd9c167)),_0x33c979['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x33c979)),this['_reviewEditingAttachedEditors']['add'](_0x33c979));}['_updateMouseMarkerInteractionListeners'](_0x4a4279){let _0x282afc=this['_boundEditables']['get'](_0x4a4279);_0x282afc||(_0x282afc=new Map(),this['_boundEditables']['set'](_0x4a4279,_0x282afc));const _0x5c1f2e=new Set(_0x4a4279['ui']['getEditableElementsNames']());for(const _0x4af752 of _0x5c1f2e){if(_0x282afc['has'](_0x4af752))continue;const _0x5b29e4=_0x4a4279['ui']['getEditableElement'](_0x4af752);_0x282afc['set'](_0x4af752,_0x5b29e4),this['_attachMouseMarkerInteractionListeners'](_0x5b29e4);}for(const [_0x5615bd,_0x4f8ac4]of _0x282afc)_0x5c1f2e['has'](_0x5615bd)||(_0x282afc['delete'](_0x5615bd),this['_domEmitter']['stopListening'](_0x4f8ac4));}['_attachMouseMarkerInteractionListeners'](_0x42dd86){this['_domEmitter']['listenTo'](_0x42dd86,'mouseup',(_0x10a534,_0x145881)=>{const _0x5cec36=_0x145881['target'],_0xad9d39=this['_findMarkerElement'](_0x5cec36);if(!_0xad9d39)return;const _0x18bf62=_0xad9d39['getAttribute']('data-marker-id'),_0x13db7e=_0x18bf62['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x18bf62,'changeId':_0x13db7e,'markerElement':()=>this['_findMarkerElementById'](_0x18bf62),'domEvent':_0x145881});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x42dd86,'mouseover',(_0x1dc8a8,_0x4d4f99)=>{const _0x43ea10=_0x4d4f99['target'],_0x46c346=_0x4d4f99['relatedTarget'];let _0x535c81=this['_findMarkerElement'](_0x43ea10);if(!_0x535c81&&_0x46c346&&(_0x535c81=this['_findMarkerElement'](_0x46c346)),!_0x535c81)return;const _0x1e96b7=_0x535c81['getAttribute']('data-marker-id'),_0x27f369=_0x1e96b7['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x27f369,'markerElement':()=>this['_findMarkerElementById'](_0x1e96b7),'domEvent':_0x4d4f99});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x1f2c99((_0x3c68ea,_0x8b8296)=>{const _0x38feff=_0x8b8296['target'];if(this['_findMarkerElement'](_0x38feff))return;_0x38feff['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5d24d8=this['context']['plugins']['get']('AIEditing'),_0x38dc83=ms(this['context']);if(!_0x38dc83['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x5cc5af=new Set(),_0x29af06=[],_0x3bd639=new Map();for(const _0x4e989d of _0x38dc83)for(const _0x281a74 of _0x4e989d['model']['document']['getRoots']()){if('$graveyard'===_0x281a74['rootName'])continue;const _0x103e46=this['_buildDocumentDataSliceForRoot'](_0x4e989d,_0x281a74,_0x5d24d8,_0x5cc5af);_0x29af06['push'](_0x103e46['content']);for(const [_0x1558ab,_0x4342d2]of _0x103e46['elements'])_0x3bd639['set'](_0x1558ab,_0x4342d2);}return{'elements':_0x3bd639,'content':_0x29af06['join']('')};}['_buildDocumentDataSliceForRoot'](_0xbaf015,_0xfc146a,_0xeb16e6,_0x529975){const _0x3e5d67=_0xbaf015['model'],_0x396a55=new _0x2751c1();for(const _0x305213 of _0xfc146a['getChildren']())_0x396a55['_appendChild'](_0x305213['_clone'](!0x0));for(const _0x322f50 of _0x3e5d67['markers']){const _0x37b649=_0x322f50['getRange']();_0x37b649&&_0x37b649['root']['rootName']===_0xfc146a['rootName']&&_0x396a55['markers']['set'](_0x322f50['name'],this['_changeRangeOwnerDocument'](_0x37b649['clone'](),_0x396a55));}const _0x1ee2ec=new Map(),_0x2d63f7=_0x3e5d67['document']['version'],_0x43867b=new _0x25b302({'ignoreElementEnd':!0x0,'startPosition':_0x3e5d67['createPositionAt'](_0x396a55,0x0)});for(const {item:_0x6d81c}of _0x43867b){if(_0x6d81c['is']('element')&&_0x6d81c['name']&&ir['includes'](_0x6d81c['name'])){const _0x5601a2=this['_upsertDataId'](_0x6d81c,()=>_0xeb16e6['_nextDataId'](_0x529975));_0x529975['add'](_0x5601a2);}if(!_0x6d81c['is']('$textProxy'))continue;const _0x3a488a=_0x6d81c['parent'];if(!_0x3a488a||!_0x3a488a['is']('element'))continue;const _0x284434=this['_upsertDataId'](_0x3a488a,()=>_0xeb16e6['_nextDataId'](_0x529975));_0x529975['add'](_0x284434);for(const _0x4a8521 of _0x3a488a['getChildren']())_0x4a8521['is']('element')&&(_0x4a8521['name']&&er['includes'](_0x4a8521['name'])||_0x529975['add'](this['_upsertDataId'](_0x4a8521,()=>_0xeb16e6['_nextDataId'](_0x529975))));let _0x2a71f8=_0x3a488a;for(;_0x2a71f8['parent']&&!_0x2a71f8['parent']['is']('documentFragment');)_0x2a71f8=_0x2a71f8['parent'],_0x2a71f8['hasAttribute'](_0x248cc9)&&_0x2a71f8['_removeAttribute'](_0x248cc9);_0x1ee2ec['set'](_0x284434,{'editor':_0xbaf015,'rootName':_0xfc146a['rootName'],'path':_0x3a488a['getPath'](),'documentVersion':_0x2d63f7,'getContent':this['_createGetContentUsingDataIdFn'](_0x2a71f8['_clone'](!0x0),_0x284434,_0xbaf015['data'])}),_0x43867b['jumpTo'](_0x3e5d67['createPositionAfter'](_0x3a488a));}return{'content':_0xbaf015['data']['processor']['toData'](_0xbaf015['data']['toView'](_0x396a55)),'elements':_0x1ee2ec};}['diffContent'](_0x42fe95,_0x14c162,_0x3198e8,_0x298156=!0x1){const {contentInitial:_0x326b5b,contentNew:_0x3509be}=this['_neutralizeChangesOnUnsupportedElements'](_0x14c162,_0x3198e8),_0x12310d=[],_0x1abce7=_0x42fe95['data']['parse'](_0x3509be,'$documentFragment'),_0x33a5ae=_0x42fe95['data']['parse'](_0x326b5b,'$documentFragment'),_0x2d3bf6=_0x42fe95['model']['createPositionAt'](_0x33a5ae,0x0);if(this['_haveSingleTopLevelElement'](_0x1abce7)){if(!this['_hasSameTopLevelElement'](_0x33a5ae,_0x1abce7))return _0x12310d;}else{const _0x2ced62=_0x42fe95['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x33a5ae,_0x2ced62)||!this['_haveOnlyInlineContent'](_0x1abce7,_0x2ced62))return _0x12310d;}const _0x5e2d3d=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x326b5b,_0x3509be,{'targetEditor':_0x42fe95,'anchor':_0x2d3bf6,'markDeletions':!0x0})['getOperations']()['filter'](_0x5ecc63=>'insert'===_0x5ecc63['type']||'marker'===_0x5ecc63['type']&&_0x5ecc63['name']['startsWith']('$markedRemove')),_0x39bc17=this['_groupAdjacentOperations'](_0x5e2d3d),_0x53c25a=[];if(_0x298156){if(_0x39bc17['length']){const _0x251e42=_0x39bc17[0x0]['operations'][0x0],_0x296aa7='insert'===_0x251e42['type']?_0x251e42['position']:_0x251e42['newRange']['start'],_0x4ca54e=this['_getPositionLimitingRange'](_0x296aa7,_0x42fe95,'inside'),_0x30eba5=_0x4ca54e?_0x1abce7['getChild'](0x0)['getChildren']():_0x1abce7['getChildren'](),_0x36fb74=_0x4ca54e||_0x42fe95['model']['createRangeIn'](_0x33a5ae),_0x8b6fb2=[new _0x1b588c('$markedRemove:synthetic'+at(),null,_0x36fb74,_0x42fe95['model']['document']['model']['markers'],!0x0,_0x42fe95['model']['document']['version']+0x1),new _0x4c1288(_0x36fb74['end'],_0x30eba5,_0x42fe95['model']['document']['version']+0x2)];_0x53c25a['push']({'operations':_0x8b6fb2,'operationsIsolated':_0x8b6fb2,'groupOffset':0x0});}}else _0x53c25a['push'](..._0x39bc17);let _0x14df8a=0x0;return _0x42fe95['model']['change'](_0x560bcb=>{for(let _0x215687=0x0;_0x215687<_0x53c25a['length'];_0x215687++){const _0x40f8f4=_0x53c25a[_0x215687],_0x34114c=_0x560bcb['createDocumentFragment']();for(const _0x33aec5 of _0x33a5ae['getChildren']())_0x560bcb['append'](_0x33aec5['_clone'](!0x0),_0x34114c);for(const _0x4d284d of _0x40f8f4['operationsIsolated'])if('insert'===_0x4d284d['type']){const _0x17e8d4=_0x4d284d;_0x17e8d4['baseVersion']=null,_0x17e8d4['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x17e8d4,_0x34114c),_0x560bcb['batch']['addOperation'](_0x4d284d),_0x42fe95['model']['applyOperation'](_0x4d284d);const _0x30aea8='suggestion:insertion:id:authorId:'+_0x14df8a++,_0x257849=_0x42fe95['model']['createRange'](_0x17e8d4['position'],_0x17e8d4['position']['getShiftedBy'](_0x17e8d4['howMany']));_0x34114c['markers']['set'](_0x30aea8,_0x257849);}else{if('marker'===_0x4d284d['type']&&_0x4d284d['name']['startsWith']('$markedRemove')){const _0xdb6ca6=_0x4d284d,_0x49085a='suggestion:deletion:id:authorId:'+_0x14df8a++;this['_changeOperationOwnerDocument'](_0xdb6ca6,_0x34114c),_0x34114c['markers']['set'](_0x49085a,_0xdb6ca6['newRange']);}}if(_0x298156)_0x12310d['push']({..._0x40f8f4,'context':this['_createGetContentFn'](_0x33a5ae,_0x42fe95['data']),'content':this['_createGetContentFn'](_0x33a5ae,_0x42fe95['data'])});else{const _0x493110=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x40f8f4['operationsIsolated'][0x0]),_0x34114c),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x40f8f4['operationsIsolated'][_0x40f8f4['operationsIsolated']['length']-0x1]),_0x34114c),_0x42fe95);_0x34114c['markers']['set'](tr+'suggestion-context',new _0x5ca7e7(_0x493110['start'],_0x493110['end'])),_0x12310d['push']({..._0x40f8f4,'context':this['_createGetContextFn'](_0x34114c,_0x42fe95['data'],{'ellipsisBefore':_0x493110['hasContentBefore'],'ellipsisAfter':_0x493110['hasContentAfter']}),'content':this['_createGetContentFn'](_0x34114c,_0x42fe95['data'])});}}}),_0x12310d;}['markChangePositionInEditorContent'](_0x222592,_0x5c788e){if(!_0x222592['length'])return;const _0x39f904=_0x222592[0x0]['parent']['id'],_0x51836=_0x5c788e['elements']['get'](_0x39f904);if(!_0x51836)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x39f904);const _0x11b9d8=_0x51836['path'],_0x65b3a2=_0x51836['editor'],_0x16bcdb=_0x65b3a2['model']['document']['getRoot'](_0x51836['rootName']);if(!_0x16bcdb)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x51836['rootName']);const _0x285a80=_0x65b3a2['model']['document']['history']['getOperations'](_0x51836['documentVersion']),_0x422629=[];for(const _0x1cbe85 of _0x222592){const _0x3153e4=_0x1cbe85['operationsIsolated']['map'](_0x5b390b=>this['_translateOperationToEditorContent'](_0x5b390b,_0x11b9d8,_0x16bcdb));if(!_0x3153e4||!_0x3153e4['length'])continue;const _0x4a22a5=_0x3153e4['every'](_0x31369e=>'marker'===_0x31369e['type']&&_0x31369e['name']['startsWith']('$markedRemove')),_0x21d649={'document':_0x65b3a2['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x42324e=_0x213b3b(_0x3153e4,_0x285a80,_0x21d649)['operationsA'];for(const _0x4bb237 of _0x42324e)if('insert'===_0x4bb237['type']){const _0x4660a2=_0x4bb237,_0x33c8dd=_0x4660a2['nodes'];_0x65b3a2['model']['change'](_0x7a2587=>{const _0x410853=_0x7a2587['createDocumentFragment']();for(const _0x98175f of _0x33c8dd)_0x7a2587['append'](_0x98175f['_clone'](!0x0),_0x410853);_0x422629['push']({'start':_0x4660a2['position'],'end':_0x4660a2['position'],'type':'insert','groupId':_0x1cbe85['id'],'content':{'asString':this['_createGetContentFn'](_0x410853,_0x65b3a2['data'])(),'asFragment':_0x410853}});});}else{if('marker'===_0x4bb237['type']&&_0x4bb237['name']['startsWith']('$markedRemove')){const _0x15c2a2=_0x4bb237;let _0x1d5301='remove-text';if(_0x4a22a5){const _0x468b58=this['_findAdjacentContextDistance'](_0x15c2a2['newRange']['start'],'backward',_0x65b3a2['model']['schema']),_0x2dbd26=this['_findAdjacentContextDistance'](_0x15c2a2['newRange']['end'],'forward',_0x65b3a2['model']['schema']);if(_0x468b58||_0x2dbd26){const _0x38edfe=_0x15c2a2['newRange']['start']['getShiftedBy'](-_0x468b58),_0x261b69=_0x15c2a2['newRange']['end']['getShiftedBy'](_0x2dbd26);_0x422629['push']({'start':_0x38edfe,'end':_0x261b69,'groupId':_0x1cbe85['id'],'type':'remove-context'});}else _0x1d5301='remove-only';}_0x422629['push']({'start':_0x15c2a2['newRange']['start'],'end':_0x15c2a2['newRange']['end'],'groupId':_0x1cbe85['id'],'type':_0x1d5301});}}}this['_insertMarkers'](_0x422629,_0x65b3a2);}['clearAllMarkers'](){const _0x39ac12=new Map();for(const _0x3e796d of this['_markers']['keys']()){const _0x4bf2dd=this['_markers']['get'](_0x3e796d);_0x4bf2dd?.['editor']&&(_0x39ac12['has'](_0x4bf2dd['editor'])||_0x39ac12['set'](_0x4bf2dd['editor'],[]),_0x39ac12['get'](_0x4bf2dd['editor'])['push'](_0x3e796d));}for(const [_0x1eef39,_0x2800f6]of _0x39ac12)_0x1eef39['model']['change'](_0x173105=>{for(const _0x5da3d2 of _0x2800f6)_0x1eef39['model']['markers']['get'](_0x5da3d2)&&_0x173105['removeMarker'](_0x5da3d2);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x1a68ba of ms(this['context']))_0x1a68ba['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x4bf527 of ms(this['context']))_0x4bf527['disableReadOnlyMode']('ai-review');}['applyChange'](_0x4dd822){const _0x3fe36d=_0x4dd822['map'](_0x57b4be=>this['_getMarkersDataForGroup'](_0x57b4be))['flat'](),_0x21bb6e=new Map();for(const _0x4ba0a8 of _0x3fe36d)_0x21bb6e['has'](_0x4ba0a8['editor'])||_0x21bb6e['set'](_0x4ba0a8['editor'],[]),_0x21bb6e['get'](_0x4ba0a8['editor'])['push'](_0x4ba0a8);for(const [_0x392d8d,_0x48aeb4]of _0x21bb6e){const _0x36697f=_0x392d8d['model'];_0x36697f['change'](_0x2acdff=>{for(const _0x19bd87 of _0x48aeb4){const _0x62ec0a=_0x392d8d['model']['markers']['get'](_0x19bd87['id']);if(_0x62ec0a){if('insert'===_0x19bd87['type']){if(!_0x19bd87['content'])continue;_0x36697f['insertContent'](_0x19bd87['content']['asFragment']||null,_0x62ec0a['getRange']()['start']);}else'remove-text'!==_0x19bd87['type']&&'remove-only'!==_0x19bd87['type']||_0x36697f['deleteContent'](_0x36697f['createSelection'](_0x62ec0a['getRange']()));_0x2acdff['removeMarker'](_0x19bd87['id']),this['_markers']['delete'](_0x19bd87['id']);}}});}}['rejectChange'](_0x3e03bf){const _0xc9f897=this['_getMarkersDataForGroup'](_0x3e03bf),_0x46670f=new Map();for(const _0x4b4fb3 of _0xc9f897)_0x46670f['has'](_0x4b4fb3['editor'])||_0x46670f['set'](_0x4b4fb3['editor'],[]),_0x46670f['get'](_0x4b4fb3['editor'])['push'](_0x4b4fb3);for(const [_0xde7f99,_0x5efe79]of _0x46670f)_0xde7f99['model']['change'](_0x251263=>{for(const _0x3f5981 of _0x5efe79)_0x251263['removeMarker'](_0x3f5981['id']),this['_markers']['delete'](_0x3f5981['id']);});}['getEditor'](){return ps(this['context']);}['getEditors'](){return ms(this['context']);}['getEditorForChange'](_0x282932){const _0x635389=this['_getMarkersDataForGroup'](_0x282932);return _0x635389[0x0]?.['editor'];}['getMarkerElementForChange'](_0x7cd98f){const _0x53525b=Array['from'](this['_markers']['values']())['filter'](_0x1c8b29=>_0x1c8b29['groupId']===_0x7cd98f);if(!_0x53525b['length'])return null;const _0x32f0f5=0x1===_0x53525b['length']?_0x53525b[0x0]:this['_sortMarkers'](_0x53525b)[0x0],_0x2d2e7a=_0x32f0f5['editor']['model']['markers']['get'](_0x32f0f5['id']);if(!_0x2d2e7a)return null;return{'modelRange':_0x2d2e7a['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x32f0f5['id'])};}['getContentElementForChange'](_0x42104e){const _0x1ea874=Array['from'](this['_markers']['values']())['filter'](_0x5f3f94=>_0x5f3f94['groupId']===_0x42104e);if(!_0x1ea874['length'])return null;const _0x1b757f=0x1===_0x1ea874['length']?_0x1ea874[0x0]:this['_sortMarkers'](_0x1ea874)[0x0],_0x3def02=_0x1b757f['editor'],_0x4cc2c=_0x3def02['model']['markers']['get'](_0x1b757f['id']);if(!_0x4cc2c)return null;const _0x4dc026=_0x4cc2c['getRange'](),_0x26f1ac=_0x3def02['editing']['view']['getDomRoot'](_0x4dc026['root']['rootName'])||_0x3def02['editing']['view']['getDomRoot']();if(!_0x26f1ac||!_0x4dc026)return null;let _0x1b2d66=_0x4dc026['start']['parent'];for(;_0x1b2d66['parent']&&!_0x1b2d66['parent']['is']('rootElement');)_0x1b2d66=_0x1b2d66['parent'];if(!_0x1b2d66||!_0x1b2d66['name'])return null;const _0x28b407=_0x26f1ac['querySelector']('[data-marker-id=\x22'+_0x1b757f['id']+'\x22]');if(!_0x28b407)return null;let _0x141fb3=null;_0x3def02['model']['change'](_0x258685=>{_0x141fb3=_0x258685['createDocumentFragment'](),_0x258685['append'](_0x1b2d66['_clone'](!0x0),_0x141fb3);});const _0x2decc5=_0x3def02['data']['toView'](_0x141fb3)['getChild'](0x0);return _0x28b407['closest'](_0x2decc5['name']);}['reactivateMarkers'](_0x117d51){const _0x1094a1=this['_getMarkersDataForGroup'](_0x117d51);if(!_0x1094a1['length'])return;const _0x2ac11e=Array['from'](this['_activeMarkers'])['sort'](),_0x13657f=Array['from'](new Set(_0x1094a1['map'](_0x4f2536=>_0x4f2536['id'])))['sort']();_0x2ac11e['join']('|')!==_0x13657f['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x117d51));}['setMarkersInElementAsActive'](_0x2dd312){const _0x3c1126=this['_getMarkersDataForGroup'](_0x2dd312);if(!_0x3c1126['length'])return;const _0x31d488=_0x3c1126[0x0]['editor'],_0x34ea8d=new Set(_0x3c1126['map'](_0x348bfc=>_0x348bfc['id'])),_0x1f882d=Array['from'](_0x34ea8d['values']())['map'](_0x42cae9=>_0x31d488['model']['markers']['get'](_0x42cae9))['filter'](_0x5c338b=>!!_0x5c338b);_0x34ea8d['forEach'](_0x249629=>{this['_activeMarkers']['add'](_0x249629);}),_0x31d488['model']['change'](()=>{_0x1f882d['forEach'](_0x36c9e2=>{_0x31d488['editing']['reconvertMarker'](_0x36c9e2);});});}['setAllMarkersAsInactive'](){const _0x925be7=Array['from'](this['_activeMarkers']);if(!_0x925be7['length'])return;this['_activeMarkers']['clear']();const _0x350d1b=new Map();for(const _0x38e3a3 of _0x925be7){const _0x24e2d=this['_markers']['get'](_0x38e3a3);if(!_0x24e2d)continue;const _0x443beb=_0x24e2d['editor'],_0x3d6b0c=_0x443beb['model']['markers']['get'](_0x38e3a3);_0x3d6b0c&&(_0x350d1b['has'](_0x443beb)||_0x350d1b['set'](_0x443beb,[]),_0x350d1b['get'](_0x443beb)['push'](_0x3d6b0c));}for(const [_0x1c84be,_0x4f1a5b]of _0x350d1b)_0x1c84be['model']['change'](()=>{_0x4f1a5b['forEach'](_0x3e3832=>{_0x1c84be['editing']['reconvertMarker'](_0x3e3832);});});}['_getPositionLimitingRange'](_0x171f30,_0x59db36,_0x40bb5b='outside'){if(!_0x171f30)return null;let _0x16b640=_0x171f30['parent'];for(;_0x16b640&&_0x16b640['parent']&&!_0x16b640['parent']['is']('rootElement')&&!_0x59db36['model']['schema']['isLimit'](_0x16b640)&&!_0x59db36['model']['schema']['isBlock'](_0x16b640);)_0x16b640=_0x16b640['parent'];if(!_0x16b640||!_0x16b640['name']||_0x16b640['is']('rootElement'))return null;let _0x4bfb71=null;return _0x59db36['model']['change'](_0x47195c=>{_0x4bfb71='inside'===_0x40bb5b?_0x47195c['createRangeIn'](_0x16b640):_0x47195c['createRangeOn'](_0x16b640);}),_0x4bfb71;}['_validateMarkers'](_0x79c19e,_0x12700e){const _0x279cbc=Array['from'](this['_markers']['keys']()),_0x2670af=new Map();for(const _0x4b43f5 of _0x279cbc){const _0x2c75b9=_0x79c19e['model']['markers']['get'](_0x4b43f5);if(!_0x2c75b9)continue;const _0x58cf18=_0x2c75b9['getStart']()['root']['rootName']+':'+_0x2c75b9['getStart']()['path'][0x0];_0x2670af['has'](_0x58cf18)||_0x2670af['set'](_0x58cf18,[]),_0x2670af['get'](_0x58cf18)['push'](_0x2c75b9);}const _0xfc3788=new Set();for(const _0x14fd93 of _0x79c19e['model']['document']['differ']['getChanges']()){let _0x2d1b45='',_0x2de97f=null;if('insert'===_0x14fd93['type'])_0x2de97f=new _0x5ca7e7(_0x14fd93['position'],_0x14fd93['position']['getShiftedBy'](_0x14fd93['length'])),_0x2d1b45=_0x14fd93['position']['root']['rootName']+':'+_0x14fd93['position']['path'][0x0];else{if('remove'!==_0x14fd93['type'])continue;_0x2de97f=new _0x5ca7e7(_0x14fd93['position']),_0x2d1b45=_0x14fd93['position']['root']['rootName']+':'+_0x14fd93['position']['path'][0x0];}const _0x15ead0=_0x2670af['get'](_0x2d1b45)||[];if(_0x15ead0['length']){for(const _0x2a984b of _0x15ead0)if(_0x2de97f['root']['rootName']===_0x2a984b['getRange']()['root']['rootName']&&('insert'!==_0x14fd93['type']||!_0x2de97f['containsRange'](_0x2a984b['getRange']()))&&(_0x2de97f['isIntersecting'](_0x2a984b['getRange']())||_0x2de97f['start']['isTouching'](_0x2a984b['getRange']()['end'])||_0x2de97f['end']['isTouching'](_0x2a984b['getRange']()['start']))){const _0x29a9b5=this['_parseMarkerName'](_0x2a984b['name']);Array['from'](this['_markers']['values']())['filter'](_0x502fc7=>_0x502fc7['groupId']===_0x29a9b5['groupId'])['forEach'](_0x2f9dcb=>_0xfc3788['add'](_0x2f9dcb['id']));}}}if(_0xfc3788['size']){for(const _0x596bf0 of _0xfc3788)_0x12700e['removeMarker'](_0x596bf0);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x58ae08){for(const {name:_0x4e07fd,data:_0x4c0a30}of _0x58ae08['model']['document']['differ']['getChangedMarkers']()){if(!_0x4e07fd['startsWith'](tr))continue;const _0x140d5d=_0x4c0a30['oldRange'],_0x2b8767=_0x4c0a30['newRange'],_0x5eb032=_0x140d5d&&'$graveyard'===_0x140d5d['root']['rootName'],_0x21f21e=_0x2b8767&&'$graveyard'===_0x2b8767['root']['rootName'];if(_0x5eb032&&_0x21f21e)continue;const _0x3f08de=this['_parseMarkerName'](_0x4e07fd);this['_markers']['get'](_0x4e07fd)&&(_0x21f21e||!_0x2b8767?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x4e07fd,'changeId':_0x3f08de['groupId']}):_0x5eb032&&_0x2b8767&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x4e07fd,'changeId':_0x3f08de['groupId']}));}}['_parseMarkerName'](_0x50618f){const _0x21eb6b=_0x50618f['split'](':'),_0x4ad945=(_0x21eb6b[0x1]||'')['split']('_');return{'prefix':_0x21eb6b[0x0],'groupId':_0x4ad945[0x0],'suffix':_0x4ad945[0x1]};}['_translateOperationToEditorContent'](_0x311bd8,_0x16d3d6,_0x36741a){if('insert'===_0x311bd8['type']){const _0x154ca9=_0x311bd8;return new _0x4c1288(this['_changePosition'](_0x16d3d6['concat'](_0x154ca9['position']['offset']),_0x36741a),_0x154ca9['nodes'],_0x154ca9['baseVersion']);}if('marker'===_0x311bd8['type']&&_0x311bd8['name']['startsWith']('$markedRemove')){const _0x73f8a0=_0x311bd8;return new _0x1b588c(_0x73f8a0['name'],_0x73f8a0['oldRange'],this['_changeRange'](_0x73f8a0['newRange'],_0x16d3d6['concat'](_0x73f8a0['newRange']['start']['offset']),_0x16d3d6['concat'](_0x73f8a0['newRange']['end']['offset']),_0x36741a),_0x73f8a0['_markers'],_0x73f8a0['affectsData'],_0x73f8a0['baseVersion']);}return _0x311bd8;}['_groupAdjacentOperations'](_0x4371a0){if(!_0x4371a0['length'])return[];const _0x49c532=[];let _0x45f70d=0x0,_0x177711=0x0,_0x34a1db=[];for(let _0x1c3b2a=0x0;_0x1c3b2a<=_0x4371a0['length'];_0x1c3b2a++){const _0x19f039=_0x4371a0[_0x1c3b2a],_0x1bf092=_0x4371a0[_0x1c3b2a-0x1];!_0x19f039||_0x1bf092&&!this['_getOperationEnd'](_0x1bf092)['isTouching'](this['_getOperationStart'](_0x19f039))?(_0x49c532['push']({'operations':_0x34a1db,'operationsIsolated':_0x34a1db['map'](_0x4d7e10=>this['_shiftOperation'](_0x4d7e10['clone'](),-_0x177711)),'groupOffset':_0x45f70d}),_0x34a1db=_0x19f039?[_0x19f039]:[],_0x177711+=_0x45f70d,_0x45f70d=0x0):_0x34a1db['push'](_0x19f039),_0x19f039&&'insert'===_0x19f039['type']&&(_0x45f70d+=_0x19f039['howMany']);}return _0x49c532;}['_findAdjacentContextDistance'](_0x26f1cc,_0x590624,_0x5c85b9,_0x3206fa=0x1){const _0x114980=new _0x25b302({'startPosition':_0x26f1cc,'direction':_0x590624});let _0x31bca1=0x0;for(let _0x3a223c=0x0;_0x3a223c<_0x3206fa;_0x3a223c++){let _0x16b7ed=0x0,_0x363da9=!0x1,_0x44c9b0='forward'===_0x590624?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x4aa7cf}of _0x114980)if(_0x4aa7cf['is']('$textProxy')){const _0x73a032=_0x44c9b0['exec'](_0x4aa7cf['data']);if(_0x73a032&&_0x73a032['length']){if(_0x16b7ed+='forward'===_0x590624?_0x73a032['index']+_0x73a032[0x0]['length']:_0x4aa7cf['data']['length']-_0x73a032['index'],_0x73a032[0x0]['length']!==_0x4aa7cf['data']['length'])break;_0x363da9=!0x0,_0x44c9b0='forward'===_0x590624?/^\w+/:/\w+$/;}else{if(_0x363da9)break;_0x16b7ed+=_0x4aa7cf['offsetSize'];}}else{if(_0x4aa7cf['is']('element')){_0x5c85b9['isInline'](_0x4aa7cf)&&!_0x363da9&&(_0x16b7ed+=0x1);break;}}_0x31bca1+=_0x16b7ed,_0x114980['jumpTo'](_0x26f1cc['getShiftedBy']('forward'===_0x590624?_0x31bca1:-_0x31bca1));}return _0x31bca1;}['_getChangeContext'](_0x4c88ce,_0x480bab,_0x2d45ff){const _0x1aa0a2=_0x2d45ff['model']['schema'],_0xe9b4cf=this['_findAdjacentContextDistance'](_0x4c88ce,'backward',_0x1aa0a2,0x6),_0x570a47=this['_findAdjacentContextDistance'](_0x480bab,'forward',_0x1aa0a2,0x6),_0x76468c=_0x4c88ce['getShiftedBy'](-_0xe9b4cf),_0xeeaf61=_0x480bab['getShiftedBy'](_0x570a47);return{'start':_0x76468c,'end':_0xeeaf61,'hasContentBefore':!_0x76468c['isAtStart'],'hasContentAfter':!_0xeeaf61['isAtEnd']};}['_insertMarkers'](_0x2d9c67,_0x1087b3){const _0x2a12ca=this['context']['plugins']['get']('AIEditing'),_0x272dc5=new Set();_0x1087b3['model']['change'](_0x1ecbc6=>{for(const _0x4e8b8f of _0x2d9c67){const _0x31e500=''+tr+_0x4e8b8f['type']+':'+_0x4e8b8f['groupId']+'_'+_0x2a12ca['_nextDataId'](_0x272dc5);this['_markers']['set'](_0x31e500,{'id':_0x31e500,'groupId':_0x4e8b8f['groupId'],'type':_0x4e8b8f['type'],'content':_0x4e8b8f['content'],'editor':_0x1087b3}),_0x1ecbc6['addMarker'](_0x31e500,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1ecbc6['createRange'](_0x4e8b8f['start'],_0x4e8b8f['end'])});}});}['_createGetContextFn'](_0x342001,_0x144457,_0x3dc617){let _0xad3813='';return()=>{if(!_0xad3813){const _0x4b160c=_0x144457['toView'](_0x342001,{'showSuggestionHighlights':!0x0});let _0x310afa=_0x4b160c['getChild'](0x0);if(_0x310afa['is']('containerElement')||(_0x310afa=_0x4b160c),!_0x310afa)return'';let _0x179363=!0x1;const _0x57453a=[];for(const _0xc91b2f of _0x310afa['getChildren']())_0xc91b2f['is']('element','span')&&_0xc91b2f['hasClass']('ck-ai_review-marker_context-end')&&(_0x179363=!0x1),_0x179363&&_0x57453a['push'](_0xc91b2f),_0xc91b2f['is']('element','span')&&_0xc91b2f['hasClass']('ck-ai_review-marker_context-start')&&(_0x179363=!0x0);_0x310afa['_removeChildren'](0x0,_0x310afa['childCount']),_0x3dc617?.['ellipsisBefore']&&_0x310afa['_appendChild']('…'),_0x310afa['_appendChild'](_0x57453a),_0x3dc617?.['ellipsisAfter']&&_0x310afa['_appendChild']('…');const _0x2e1d9d=_0x144457['htmlProcessor']['domConverter']['viewToDom'](_0x4b160c),_0x28ebb0=_0x144457['htmlProcessor']['htmlWriter']['getHtml'](_0x2e1d9d);_0xad3813=this['_removeUnsupportedElements'](_0x28ebb0);}return _0xad3813;};}['_createGetContentFn'](_0x1f63d6,_0x3f88e1){let _0x367d80='';return()=>(_0x367d80||(_0x367d80=this['_removeUnsupportedElements'](_0x3f88e1['stringify'](_0x1f63d6,{'showSuggestionHighlights':!0x0}))),_0x367d80);}['_createGetContentUsingDataIdFn'](_0x1b0aad,_0x4c7aa3,_0x20a024){let _0x39cd0c='';return()=>{if(!_0x39cd0c){const _0x1a3173=_0x20a024['toView'](new _0x2751c1(_0x1b0aad)),_0x236eab=_0x20a024['htmlProcessor']['domConverter']['viewToDom'](_0x1a3173)['querySelector']('[data-id=\x22'+_0x4c7aa3+'\x22]');_0x39cd0c=_0x236eab?.['outerHTML']||'';}return _0x39cd0c;};}['_removeUnsupportedElements'](_0x5deb7c){if(!_0x5deb7c)return'';const _0x8b40dd=Wi(_0x5deb7c,{'decodeEntities':!0x1}),_0x3305cc=qi(_0x8b40dd);if(!_0x3305cc['length'])return _0x5deb7c;for(const _0x4f707e of _0x3305cc)_0x2f3801(_0x4f707e);return Ki(_0x8b40dd,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x37d042,_0x3156ae){const _0x22ce99=Wi(_0x37d042,{'decodeEntities':!0x1}),_0x447e04=Wi(_0x3156ae,{'decodeEntities':!0x1}),_0x50415b=qi(_0x22ce99),_0x115e0f=qi(_0x447e04);if(!_0x50415b['length']&&!_0x115e0f['length'])return{'contentInitial':_0x37d042,'contentNew':_0x3156ae};const _0x4eacde=new Map();for(const _0x2c06f6 of _0x50415b)_0x4eacde['set'](Xi(_0x2c06f6,'data-id'),_0x2c06f6);for(const _0x1b9ffa of _0x115e0f){const _0x17bfdc=Xi(_0x1b9ffa,'data-id'),_0xc1958c=_0x17bfdc?_0x4eacde['get'](_0x17bfdc):void 0x0;_0xc1958c?_0x1eb418(_0x1b9ffa,_0x54175e(_0xc1958c,!0x0)):_0x2f3801(_0x1b9ffa);}return{'contentInitial':Ki(_0x22ce99,{'encodeEntities':!0x1}),'contentNew':Ki(_0x447e04,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x12d991,_0x3d2121=0x5){let _0x148a0a=_0x12d991,_0xd89cf7=null;for(let _0x192c80=0x0;_0x192c80<_0x3d2121&&_0x148a0a;_0x192c80++){if(!_0x148a0a['className']){_0x148a0a=_0x148a0a['parentElement'];continue;}if(!(''+_0x148a0a['className'])['includes']('ck-ai_review-marker_')){_0x148a0a=_0x148a0a['parentElement'];continue;}if(!_0x148a0a['getAttribute']('data-marker-id'))break;_0xd89cf7=_0x148a0a;break;}return _0xd89cf7;}['_findMarkerElementById'](_0x5ef298){const _0x3b2f9d=this['_markers']['get'](_0x5ef298);if(!_0x3b2f9d)return null;const _0x328e08=_0x3b2f9d['editor']['model']['markers']['get'](_0x5ef298);return _0x328e08?_0x218dfd(_0x3b2f9d['editor']['editing'],_0x328e08):null;}['_getMarkersDataForGroup'](_0x4864c5){return Array['from'](this['_markers']['values']())['filter'](_0x10ad20=>_0x10ad20['groupId']===_0x4864c5);}['_getOperationStart'](_0x37750f){return'insert'===_0x37750f['type']?_0x37750f['position']:_0x37750f['newRange']['start'];}['_getOperationEnd'](_0x54f238,_0x58ca78=!0x1){return'insert'===_0x54f238['type']?_0x58ca78?_0x54f238['position']:_0x54f238['position']['getShiftedBy'](_0x54f238['howMany']):_0x54f238['newRange']['end'];}['_shiftOperation'](_0x5d06a7,_0x1ac664){return'insert'===_0x5d06a7['type']?_0x5d06a7['position']=_0x5d06a7['position']['getShiftedBy'](_0x1ac664):'marker'===_0x5d06a7['type']&&_0x5d06a7['newRange']&&(_0x5d06a7['newRange']=new _0x5ca7e7(_0x5d06a7['newRange']['start']['getShiftedBy'](_0x1ac664),_0x5d06a7['newRange']['end']['getShiftedBy'](_0x1ac664))),_0x5d06a7;}['_changeOperationOwnerDocument'](_0x1b1bf0,_0x318c4f){'insert'===_0x1b1bf0['type']?_0x1b1bf0['position']=this['_changePositionOwnerDocument'](_0x1b1bf0['position'],_0x318c4f):'marker'===_0x1b1bf0['type']&&_0x1b1bf0['newRange']&&(_0x1b1bf0['newRange']=this['_changeRangeOwnerDocument'](_0x1b1bf0['newRange'],_0x318c4f));}['_changePositionOwnerDocument'](_0x554a0a,_0x55d628){return new _0x47f02c(_0x55d628,_0x554a0a['path']);}['_changeRangeOwnerDocument'](_0x2694b0,_0x186a54){return new _0x5ca7e7(this['_changePositionOwnerDocument'](_0x2694b0['start'],_0x186a54),this['_changePositionOwnerDocument'](_0x2694b0['end'],_0x186a54));}['_changePosition'](_0x4d74e9,_0x33a12e){return new _0x47f02c(_0x33a12e,[..._0x4d74e9]);}['_changeRange'](_0x3cce93,_0x54ec14,_0x5bbcd4,_0x3a222c){return new _0x5ca7e7(this['_changePosition'](_0x54ec14,_0x3a222c),this['_changePosition'](_0x5bbcd4,_0x3a222c));}['_sortMarkers'](_0x7bad1){const _0x2b8e6c=_0x5f241e=>{switch(_0x5f241e){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x7bad1['sort']((_0x43f26e,_0x3887e1)=>_0x2b8e6c(_0x43f26e['type'])-_0x2b8e6c(_0x3887e1['type']));}['_hasSameTopLevelElement'](_0x59b6b6,_0x4aab3a){const _0x3f35a9=_0x59b6b6['getChild'](0x0),_0x2aabcb=_0x4aab3a['getChild'](0x0);return!(!_0x3f35a9||!_0x2aabcb)&&((!_0x3f35a9['is']('element')||!_0x2aabcb['is']('element')||_0x3f35a9['name']===_0x2aabcb['name'])&&!(_0x3f35a9['is']('element')&&!_0x2aabcb['is']('element')||!_0x3f35a9['is']('element')&&_0x2aabcb['is']('element')));}['_haveSingleTopLevelElement'](_0x1cf6b7){return 0x1===_0x1cf6b7['childCount'];}['_haveOnlyInlineContent'](_0x57c4d1,_0x1397c4){for(const _0x2f61b4 of _0x57c4d1['getChildren']())if(_0x2f61b4['is']('element')&&!_0x1397c4['isInline'](_0x2f61b4))return!0x1;return!0x0;}['_upsertDataId'](_0xfb0aec,_0x2d5899){let _0x70a394=_0xfb0aec['getAttribute'](_0x248cc9);return _0x70a394||(_0x70a394=_0x2d5899(),_0xfb0aec['_setAttribute'](_0x248cc9,_0x70a394)),_0x70a394;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x43551d,contentNew:_0x57f06a,contentInitial:_0x1f141f,documentVersion:_0x961fea}){super(),this['id']=_0x43551d,this['contentNew']=_0x57f06a,this['contentInitial']=_0x1f141f,this['documentVersion']=_0x961fea;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x16dca9,_0x2437c1,_0x5b9b0b){super(),this['id']=_0x16dca9,this['parent']=_0x5b9b0b,this['_data']=_0x2437c1,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'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x3721b5,_0x2bf17e,_0x340491,_0x539e2c,_0x1029b8){super(),this['_sourceCheck']=_0x2bf17e,this['_documentData']=_0x3721b5,this['_aiConnector']=_0x340491,this['_reviewParams']=_0x539e2c,this['_reviewArgs']=_0x1029b8,this['on']('change:status',(_0xa5c290,_0x2d145f,_0x48d439)=>{'aborted'==_0x48d439&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x48d439,'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'](_0x43933d=>'pending'===_0x43933d['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x5528f6){this['_documentData']=_0x5528f6;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x569c46=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x588a69 of _0x569c46)'unmodified'!==_0x588a69['data']['operation']&&('error'!==_0x588a69['data']['operation']?'review-metadata'!==_0x588a69['event']?this['_addReviewCheckResult'](_0x588a69['data']['dataId'],_0x588a69['data']['textDelta']):this['callId']=_0x588a69['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(_0x105672){this['_currentError']=_0x105672,_0x105672 instanceof Error&&_0x105672['message']['includes']('ai-request-aborted')?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'](_0x5c014b,_0x574413){const _0x579ab6=this['_results']['get'](_0x5c014b);if(!_0x579ab6)return;if(0x0===_0x574413['length'])return;const _0x20ca0b=[];_0x574413['forEach']((_0x554ef4,_0x3dae6c)=>{const _0x423d92=new AIReviewCheckResultChange(_0x579ab6['id']+'-'+_0x3dae6c,_0x554ef4,_0x579ab6);_0x423d92['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x423d92,'status':_0x423d92['status']});}),_0x423d92['on']('change:isActivated',()=>{_0x423d92['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x423d92}):this['fire']('reviewCheckResultDeactivated',{'change':_0x423d92});}),this['_changes']['push'](_0x423d92),_0x20ca0b['push'](_0x423d92);}),this['fire']('reviewCheckResultReady',{'changes':_0x20ca0b,'result':_0x579ab6,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x42f1f8){const _0x5f496b=this['_changes']['find'](_0x104a1f=>_0x104a1f['id']===_0x42f1f8);return!(!_0x5f496b||'pending'!==_0x5f496b['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x16e0f5=>!0x0===_0x16e0f5['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x3ff821=>'pending'===_0x3ff821['status']);}['getChangeById'](_0x4df6b8){return this['_changes']['find'](_0x1c7ae5=>_0x1c7ae5['id']===_0x4df6b8);}['markAllChangesAsAccepted'](){for(const _0x351409 of this['_changes'])'pending'===_0x351409['status']&&(_0x351409['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x2f2f9a){const _0x132c53=this['_changes']['find'](_0x5ee493=>_0x5ee493['id']===_0x2f2f9a);_0x132c53&&'pending'===_0x132c53['status']&&(_0x132c53['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x4b5448){const _0xd1ace3=this['_changes']['find'](_0x3713d0=>_0x3713d0['id']===_0x4b5448);_0xd1ace3&&'pending'===_0xd1ace3['status']&&(_0xd1ace3['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x6d2c2a){const _0x505ffa=this['_changes']['find'](_0x4d6abe=>_0x4d6abe['id']===_0x6d2c2a);_0x505ffa&&'pending'===_0x505ffa['status']&&(_0x505ffa['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x579543){const _0x3fd488=this['_changes']['find'](_0x52708=>_0x52708['id']===_0x579543);_0x3fd488&&'outdated'===_0x3fd488['status']&&(_0x3fd488['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x5e6aea){this['_changes']['filter'](_0x1632d6=>_0x1632d6['isActivated']&&_0x1632d6['id']!==_0x5e6aea)['forEach'](_0x3d31bd=>{_0x3d31bd['isActivated']=!0x1;});const _0x3552d8=this['_changes']['find'](_0x333c36=>_0x333c36['id']===_0x5e6aea);_0x3552d8&&'pending'===_0x3552d8['status']&&(_0x3552d8['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x1fa447=>_0x1fa447['isActivated'])['forEach'](_0x2cec5e=>{_0x2cec5e['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x3b7eab){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x4cce90;if(_0x3b7eab){const _0x19a81d=this['_changes']['find'](_0x4f95b9=>_0x4f95b9['id']===_0x3b7eab);if(_0x19a81d&&_0x19a81d['isRated'])return;_0x19a81d&&(_0x4cce90=_0x19a81d['parent']['id'],_0x19a81d['isRated']=!0x0);}const _0x445834={'positiveCount':this['_changes']['filter'](_0x2568f3=>'accepted'===_0x2568f3['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x445834,this['callId'],_0x4cce90);}['_addReviewCheckResult'](_0x4da251,_0xdab8b0){const _0x1fe088=this['_documentData']['elements']['get'](_0x4da251);if(!_0x1fe088)return;const _0x5e15c9=_0x1fe088['getContent']();if(_0x5e15c9===_0xdab8b0)return;const _0xc1a4ee=new AIReviewCheckResult({'id':_0x4da251,'contentInitial':_0x5e15c9,'contentNew':_0xdab8b0,'documentVersion':_0x1fe088['documentVersion']});this['_results']['set'](_0xc1a4ee['id'],_0xc1a4ee),this['fire']('reviewCheckResultAdded',{'result':_0xc1a4ee,'source':this,'editor':_0x1fe088['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x1cf1e7=>'pending'===_0x1cf1e7['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x38df31=>'pending'===_0x38df31['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x1a5944=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x1e5982=0x0;_0x1e5982<this['_reviewParams']['length'];_0x1e5982++){if(!this['_reviewParams'][_0x1e5982]||!this['_sourceCheck']['options'][_0x1e5982])continue;const _0x492d24=this['_sourceCheck']['options'][_0x1e5982],_0x3898c2=_0x492d24['data']?.['find'](_0x4016b7=>_0x4016b7['id']===this['_reviewParams'][_0x1e5982]);_0x3898c2&&_0x1a5944['push'](_0x3898c2['label']);}return _0x1a5944['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x24acd4,_0x44e934,_0x287f22){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x44e934,_0x24acd4,_0x287f22);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x464fb9{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_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',(_0x296325,_0x557b9d)=>this['runCheck'](_0x557b9d)),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 _0x5b100f=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x5b100f['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x5b100f['map'](_0x1515c0=>_0x1515c0['id']));const _0x541ee5=this['_currentReviewCheckRun'];_0x541ee5['markAllChangesAsAccepted'](),_0x541ee5['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x2d2d7a,_0x35d3f7)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x35d3f7['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x35d3f7['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x35d3f7['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x35d3f7['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x32b0c0,_0x12555f)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x12555f['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x12555f['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x12555f['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x12555f['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',(_0x289fc4,_0xa9bcc6)=>{this['_onActivateChange'](_0xa9bcc6);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x395d56,_0x75836)=>{this['_onDeactivateChange'](_0x75836);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x4713c7,_0x47c697)=>{this['_onChangeMarkerClicked'](_0x4713c7,_0x47c697);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x1dc875,_0x19961b)=>{this['_onChangeMarkerHovered'](_0x1dc875,_0x19961b);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x2ace51,_0x1d3c24)=>{this['_onChangeMarkerRemoved'](_0x2ace51,_0x1d3c24);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x2a02c6,_0x335c6b)=>{this['_onChangeMarkerRestored'](_0x2a02c6,_0x335c6b);});}async['runCheck'](_0x27c340){if(!this['_availableReviewChecks'])return;const _0x5d7e62=this['_availableReviewChecks']['find'](_0x19c822=>_0x19c822['id']===_0x27c340['id']);if(_0x5d7e62){this['_onReviewCheckRun'](_0x27c340),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x27c340,_0x5d7e62),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x328a97,_0x2ed359)=>{switch(_0x2ed359['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x2ed359);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'!==_0x2ed359['status']&&'error-chunk'!==_0x2ed359['status']&&'error-general'!==_0x2ed359['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2fea65,_0x3eacf1)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x5384f2=this['_diffContent'](_0x3eacf1['editor'],_0x3eacf1['result']['contentInitial'],_0x3eacf1['result']['contentNew']);_0x3eacf1['source']['addResultChanges'](_0x3eacf1['result']['id'],_0x5384f2);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x3135e6,_0x2ac0c3)=>{for(const _0xa63610 of _0x2ac0c3['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0xa63610);this['_markChangePositionInEditorContent'](_0x2ac0c3['changes'],_0x2ac0c3['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x484bbf,_0x560f71)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x560f71['change']['id'],_0x560f71['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x19ac8c,_0x576cc6)=>{this['_onReviewCheckResultActivated'](_0x576cc6);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x39ccdb){_0x39ccdb instanceof Error&&_0x39ccdb['message']['includes']('ai-request-aborted')||(_0x39ccdb instanceof ht?this['_logError'](_0x39ccdb):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x39ccdb)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x27c340['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x255dc9,_0x4b9d48){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4b9d48,this['_aiConnector'],_0x255dc9['params'],_0x255dc9['args']);}['_onChangeMarkerRemoved'](_0x4fe000,_0x341415){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x341415['changeId']);}['_onChangeMarkerRestored'](_0xd11dce,_0x49416b){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x49416b['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x3824b1=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x3824b1&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x4c62f1 of this['_aiReviewCoreEditing']['getEditors']())_0x4c62f1['editing']['view']['change'](_0x2a6d99=>{for(const _0x61663a of _0x4c62f1['editing']['view']['document']['getRoots']())_0x2a6d99['removeClass']('ck-ai_review-diff',_0x61663a),_0x2a6d99['removeClass']('ck-ai_review-highlights',_0x61663a),_0x2a6d99['removeClass']('ck-ai-translate-mode-content',_0x61663a);});}['_logError'](_0x1df95f,_0x2e5c91=!0x1){Ct(_0x1df95f['message']),_0x2e5c91||(_0x1df95f['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x5c1911){if('content'===this['_changeActivationSource']){const _0x3e10ba=this['_aiReviewCoreUi']['getChangeElement'](_0x5c1911);_0x3e10ba&&Rt(_0x3e10ba['closest']('.ck-ai_review__check-run-result')||_0x3e10ba);}else{if('panel'===this['_changeActivationSource']){const _0x54210b=this['_getChangeContentElement'](_0x5c1911);if(!_0x54210b)return;Tt({'target':_0x54210b,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x2016b9,_0x306055,_0x14259c,_0x509121,_0x42b189){super(_0x14259c,_0x509121,_0x42b189),this['_prompt']=_0x2016b9,this['_model']=_0x306055;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x20b0f6,_0x3536b6,_0x2290de){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x3536b6,_0x20b0f6,_0x2290de);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x233eac){this['id']=_0x233eac['id'],this['commandId']=_0x233eac['commandId'],this['title']=_0x233eac['title'],this['description']=_0x233eac['description'],this['isParameterized']=_0x233eac['isParameterized'],this['useArgs']=_0x233eac['useArgs'],this['options']=_0x233eac['options'],this['args']=_0x233eac['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x54268f,_0x23fc17,_0x17b282){super(_0x54268f),this['prompt']=_0x54268f['prompt'],this['model']=_0x54268f['model'],this['model']?this['_defaultModel']=_0x23fc17['find'](_0x10716b=>_0x10716b['id']===this['model'])||null:this['_defaultModel']=_0x17b282;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x3ce20a){this['_prompt']=_0x3ce20a;}set['model'](_0x2c3260){this['_model']=_0x2c3260;}}class AIReviewCoreCheckRegistry extends _0x464fb9{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const sr=[{'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'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x517761){this['_checks']=_0x517761['map'](_0x10149e=>new AIReviewCheck(_0x10149e));}get['checks'](){return this['_checks'];}['getCheckById'](_0x19f846){return this['checks']['find'](_0x51dbc6=>_0x51dbc6['id']===_0x19f846);}['removeCheckById'](_0x1c2eb2){this['_checks']=this['_checks']['filter'](_0x44edc7=>_0x44edc7['id']!==_0x1c2eb2);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x265860,_0xb9e7c7,_0x28128c){super(_0x265860),this['_models']=_0xb9e7c7,this['_defaultModel']=_0x28128c;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x57df10,_0x58162c,_0x31cd6d){super(),this['_allModels']=_0x57df10,this['_recommendedModels']=_0x58162c,this['_defaultModel']=_0x31cd6d;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x3b5095){this['_checks']=_0x3b5095['map'](_0x11d95a=>!0x0===_0x11d95a['isExtra']?new AIReviewCheckExtra(_0x11d95a,this['_allModels'],this['_defaultModel']):'custom'===_0x11d95a['id']?new AIReviewCheckCustom(_0x11d95a,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x11d95a));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x11ec94){super(_0x11ec94),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x8ce5b4=>({'id':_0x8ce5b4['id'],'commandId':_0x8ce5b4['id'],'title':_0x8ce5b4['label'],'description':_0x8ce5b4['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x8ce5b4['prompt'],'model':_0x8ce5b4['model']}));}async['_loadChecksList'](){const _0x4b463b=[...sr,...this['getExtraChecks']()]['map'](_0x43f8b0=>_0x43f8b0['isExtra']?_0x43f8b0:this['_translateReviewCheck'](_0x43f8b0)),_0x80391b=await this['_getModels'](),_0x15c06b=new AIReviewModeCheckList(_0x80391b['all'],_0x80391b['recommended'],_0x80391b['default']);return _0x15c06b['setupChecks'](_0x4b463b),_0x15c06b;}async['_getModels'](){const _0x862f33=this['context']['plugins']['get']('AIConnector');try{const _0x1d5d37=new AIModels({'connector':_0x862f33,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x5a081d={'all':await _0x1d5d37['getAll'](),'recommended':await _0x1d5d37['getAvailableModels'](),'default':await _0x1d5d37['getDefault']()};return this['_modelsLoadError']=null,_0x5a081d;}catch(_0x1688d9){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x1688d9),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0xdb8fe1){const _0x478a76='AI_REVIEW_CHECK_'+_0xdb8fe1['id']['toUpperCase']()['replaceAll']('-','_'),_0x4b64a4={..._0xdb8fe1,'title':this['_translate'](_0x478a76+'_TITLE',_0xdb8fe1['title']),'description':this['_translate'](_0x478a76+'_DESCRIPTION',_0xdb8fe1['description'])};return _0xdb8fe1['options']&&(_0x4b64a4['options']=_0xdb8fe1['options']['map'](_0x98bc49=>({..._0x98bc49,'label':this['_translate'](_0x478a76+'_OPTIONS_LABEL',_0x98bc49['label']||''),'data':_0x98bc49['data']?_0x98bc49['data']['map'](_0x24abfc=>({..._0x24abfc,'label':this['_translate'](_0x478a76+'_OPTIONS_DATA_'+_0x24abfc['id']['toUpperCase'](),_0x24abfc['label'])})):void 0x0}))),_0x4b64a4;}['_translate'](_0x16cda6,_0x357007){const _0x259e07=Mi(this['context']['locale'],_0x16cda6);return _0x259e07===_0x16cda6?_0x357007:_0x259e07;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x2f0e74){super(_0x2f0e74),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',sr['map'](_0x22f632=>_0x22f632['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x57e6b7,_0x45da43)=>{this['_isDiffOn']=_0x45da43['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x2db8af,_0x4b42ac){if(_0x2db8af['isCustom'])return new AIReviewCustomCheckRun(_0x2db8af['args']['prompt'],_0x2db8af['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x4b42ac,this['_aiConnector']);if(_0x4b42ac['isExtra']){const _0xc034ed=_0x4b42ac;return new AIReviewExtraCheckRun(_0x2db8af['args']?.['prompt']??_0xc034ed['prompt'],_0x2db8af['args']?.['model']??_0xc034ed['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x4b42ac,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x4b42ac,this['_aiConnector'],_0x2db8af['params'],_0x2db8af['args']);}['_onReviewCheckResultActivated'](_0x3d5a9a){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x3d5a9a['change']['id']),this['_scrollToChange'](_0x3d5a9a['change']['id']);const _0x6e344=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3d5a9a['change']['id']);if(!_0x6e344)return;const _0x2d72c9=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3d5a9a['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3d5a9a['change'],()=>_0x6e344['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x2d72c9,_0x6e344['modelRange']['root']['rootName']),_0x2d72c9?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x3d5a9a['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x2850bc){this['_currentReviewCheckRun']&&'click'===_0x2850bc['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x2850bc['id']));}['_onDeactivateChange'](_0x21e369){this['_currentReviewCheckRun']&&'balloon'===_0x21e369['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1de6b5,_0x183b45){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x183b45['changeId']);const _0x417414=this['_currentReviewCheckRun']['getChangeById'](_0x183b45['changeId']);if(!_0x417414)return;const _0x48fc56=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x183b45['changeId']),_0x75319a=this['_aiReviewCoreEditing']['getEditorForChange'](_0x183b45['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x417414,_0x183b45['markerElement'],_0x183b45['domEvent'],'click',this['_getBalloonDomRoot'](_0x75319a,_0x48fc56?.['modelRange']['root']['rootName']),_0x75319a?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x1c7738,_0x1df6b3){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x11300a=this['_currentReviewCheckRun']['getChangeById'](_0x1df6b3['changeId']);if(!_0x11300a)return;const _0x58806d=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1df6b3['changeId']),_0x3b6722=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1df6b3['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x11300a,_0x1df6b3['markerElement'],_0x1df6b3['domEvent'],'hover',this['_getBalloonDomRoot'](_0x3b6722,_0x58806d?.['modelRange']['root']['rootName']),_0x3b6722?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x44546c){const _0x1d7ae6=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x44546c);return _0x1d7ae6?_0x1d7ae6['getElement']():null;}['_markChangePositionInEditorContent'](_0x22a965,_0x52e492){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x22a965,_0x52e492);}['_diffContent'](_0x162231,_0x217ee5,_0x2af4ca){return this['_aiReviewCoreEditing']['diffContent'](_0x162231,_0x217ee5,_0x2af4ca,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x4a6a05){_0x4a6a05?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x53dd20 of this['_aiReviewCoreEditing']['getEditors']())_0x53dd20['editing']['view']['change'](_0x16ecfb=>{for(const _0x5e0670 of _0x53dd20['editing']['view']['document']['getRoots']()){for(const _0x1cf506 of _0x5e0670['getClassNames']())_0x1cf506['startsWith']('ck-ai_review-')&&_0x16ecfb['removeClass'](_0x1cf506,_0x5e0670);_0x16ecfb['addClass'](_0x4a6a05?'ck-ai_review-diff':'ck-ai_review-highlights',_0x5e0670);}});}['_getBalloonDomRoot'](_0x5818a6,_0x4034ff){const _0x22ef5c=_0x5818a6['editing']['view'];if(_0x4034ff){const _0x3ab712=_0x22ef5c['getDomRoot'](_0x4034ff);if(_0x3ab712)return _0x3ab712;}return _0x22ef5c['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x1e52f6=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x379216=await _0x1e52f6['getChecksList']();_0x1e52f6['modelsLoadError']&&this['_logError'](_0x1e52f6['modelsLoadError']);let _0x27982b=_0x379216['checks'];const _0x1d23da=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x1d23da,_0x27982b),this['_usesAvailableCommandsConfig']&&(_0x27982b=_0x1d23da['map'](_0x52f883=>_0x27982b['find'](_0x2ab07a=>_0x2ab07a['id']===_0x52f883))['filter'](_0x5eacc5=>!!_0x5eacc5)),this['_filterChecksWithMissingModel'](_0x27982b);}['_logWarningForNonExistentChecks'](_0x378d6f,_0x50c300){const _0x1ce810=_0x378d6f['filter'](_0x14d9d9=>!_0x50c300['some'](_0x5e4b8a=>_0x5e4b8a['id']===_0x14d9d9));if(_0x1ce810['length']){const _0x20248b=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x1ce810['join'](',\x20')});wt(_0x20248b['message']);}}['_filterChecksWithMissingModel'](_0x3b3c9a){const _0x377d0b=[];return _0x3b3c9a['forEach'](_0x8facd3=>{(_0x8facd3 instanceof AIReviewCheckExtra&&!_0x8facd3['defaultModel']||_0x8facd3 instanceof AIReviewCheckCustom&&!_0x8facd3['models']['length'])&&_0x377d0b['push'](_0x8facd3['id']);}),_0x377d0b['length']&&_0x377d0b['forEach'](_0x2c03e1=>{_0x3b3c9a=_0x3b3c9a['filter'](_0x3865d4=>_0x3865d4['id']!==_0x2c03e1);const _0x3c4dc1=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x2c03e1});Ct(_0x3c4dc1['message']);}),_0x3b3c9a;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x2c0dec){this['_editor']=_0x2c0dec['editor'],this['_rootName']=_0x2c0dec['rootName'],this['_channelId']=_0x2c0dec['channelId'],this['_sessionId']=_0x2c0dec['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'](_0x17dfa2){this['_documentVersion']=_0x17dfa2;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x18dc5c){this['_contentRawOld']=_0x18dc5c;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x2990e7){this['_contentRawNew']=_0x2990e7;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x387c0e){this['_error']=_0x387c0e;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0xe3a674){return _0xe3a674['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x3b3ac1){this['_affectedBlocks']=_0x3b3ac1;}}class AIGateway extends _0x464fb9{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x31b41b,_0x267229){if('completed'!==_0x31b41b['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x31b41b['status']});const _0x424f0b=_0x31b41b['editor'];if('suggest'===_0x267229&&!_0x424f0b['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x16456d='suggest'===_0x267229,_0x3d9679=this['context']['plugins']['get'](_0x34a64f),_0x3ae39a=_0x424f0b['model']['createPositionAt'](_0x424f0b['model']['document']['getRoot'](),0x0),_0x1d090f=_0x3d9679['getDiff'](_0x31b41b['contentRawOld'],_0x31b41b['contentRawNew'],{'anchor':_0x3ae39a,'markDeletions':_0x16456d,'targetEditor':_0x424f0b}),_0x2197f6=_0x424f0b['model']['document']['history']['getOperations'](_0x31b41b['documentVersion']),_0xecbb05={'document':_0x424f0b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x50605d=_0x213b3b(_0x1d090f['getOperations'](),_0x2197f6,_0xecbb05)['operationsA'];_0x424f0b['model']['change'](_0x2f3e53=>{if(_0x16456d)_0x424f0b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x50605d);else{for(const _0x2fe01d of _0x50605d)_0x2fe01d['baseVersion']=_0x424f0b['model']['document']['version'],Ts(_0x424f0b,_0x2fe01d),_0x2f3e53['batch']['addOperation'](_0x2fe01d),_0x424f0b['model']['applyOperation'](_0x2fe01d);}});}['mergeChangesIntoContent'](_0x3974c7,_0x1c0424,_0x358762){const _0x5af6ad=new AIResponseParser(),_0xeb3d3f=new AIResponseApplier();let _0x3f2509=_0x5af6ad['parseAndNormalizeHTML'](_0x1c0424);for(const _0xc31525 of _0x3974c7)try{const _0x5e1f65=_0x5af6ad['parseAndNormalizeHTML'](_0xc31525['content']);_0x3f2509=_0xeb3d3f['merge'](_0x5e1f65,_0x3f2509,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0xc80108){throw new ht('ai-gateway-merge-failed',this,{..._0xc31525},_0xc80108);}return as(_0x358762,_0x5af6ad['parseAndNormalizeHTML'](_0x1c0424),_0x3f2509,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x464fb9{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0x4d36c8=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x4d36c8['getChecksList']())['checks']['map'](_0x28cb2c=>{const _0x2c7192={'id':_0x28cb2c['id'],'title':_0x28cb2c['title'],'description':_0x28cb2c['description']};return'custom'!==_0x28cb2c['id']&&_0x28cb2c['options']?.['length']&&(_0x2c7192['parameters']=_0x28cb2c['options'][0x0]['data']['map'](_0x2c2fec=>({..._0x2c2fec}))),_0x2c7192;});}async['getAvailableModels'](){const _0x52a2cc=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x52a2cc,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x144671,_0x25f619){return await this['_runReviewCheck'](_0x144671,()=>this['_createReviewCheckRun'](_0x144671,_0x25f619?.['parameterId']),_0x25f619?.['signal']);}async['runCustomReview'](_0x4b2123,_0x54db55){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x4b2123,_0x54db55?.['model']),_0x54db55?.['signal']);}['applyReview'](_0x3a75d2,_0x3612ec){this['context']['plugins']['get']('AIGateway')['apply'](_0x3a75d2,_0x3612ec);}async['_runReviewCheck'](_0x346627,_0x1c55f7,_0x2a96cc){const _0x5a2bb7=ps(this['context']),_0x7880f9=new AIReviewRunResult({'editor':_0x5a2bb7,'rootName':_0x5a2bb7['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x5a2bb7['plugins']['get']('AIEditing')['getSessionId'](_0x5a2bb7)});let _0x32009f,_0xc5e332;if(_0x2a96cc){if(_0x2a96cc['aborted'])return _0x7880f9['abort'](),_0x7880f9;const _0x42654f=()=>{_0x7880f9['error']||(_0x7880f9['abort'](),_0x32009f&&_0x32009f['abort']());};_0x2a96cc['addEventListener']('abort',_0x42654f),_0xc5e332=()=>_0x2a96cc['removeEventListener']('abort',_0x42654f);}try{_0x32009f=await _0x1c55f7(),_0x7880f9['contentRawOld']=_0x32009f['documentData']['content'],_0x7880f9['documentVersion']=Array['from'](_0x32009f['documentData']['elements'])['find'](([,_0x30966a])=>_0x30966a['rootName']===_0x7880f9['rootName'])?.[0x1]['documentVersion']??0x1,_0x32009f['on']('reviewCheckRunUpdated',(_0x5bda27,_0x265cce)=>{'aborted'===_0x265cce['status']?_0x7880f9['abort']():'error-general'!==_0x265cce['status']&&'error-chunk'!==_0x265cce['status']||(_0x7880f9['error']=this['_normalizeError'](_0x265cce['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x346627}));}),'aborted'!==_0x7880f9['status']&&await _0x32009f['start']();}catch(_0x1967dc){_0x7880f9['error']=this['_normalizeError'](_0x1967dc,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x346627});}finally{_0xc5e332&&_0xc5e332();}if(!_0x32009f||'aborted'===_0x7880f9['status']||'error'===_0x7880f9['status'])return _0x7880f9;_0x7880f9['affectedBlocks']=_0x32009f['results']['map'](_0x286d33=>({'id':_0x286d33['id'],'content':_0x286d33['contentNew']}));try{_0x7880f9['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x7880f9['affectedBlocks'],_0x7880f9['contentRawOld'],_0x7880f9['editor']));}catch(_0x38456a){_0x7880f9['error']=this['_normalizeError'](_0x38456a,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x346627});}return _0x7880f9;}async['_createReviewCheckRun'](_0x360daf,_0xbc4458){const _0x5614e6=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x58c3e3=>_0x58c3e3['id']===_0x360daf);if(!_0x5614e6)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x360daf});if(_0x5614e6 instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x360daf});const _0x38f12b=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1ed293=this['context']['plugins']['get']('AIConnector');if(_0x5614e6 instanceof AIReviewCheckExtra){if(!_0x5614e6['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x360daf});return new AIReviewExtraCheckRun(_0x5614e6['prompt'],_0x5614e6['defaultModel']['id'],_0x38f12b,_0x5614e6,_0x1ed293);}return new AIReviewSystemCheckRun(_0x38f12b,_0x5614e6,_0x1ed293,_0xbc4458?[_0xbc4458]:void 0x0);}async['_createCustomReviewCheckRun'](_0x2c1704,_0x3503bd,_0x71bca5){const _0x3bc854=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x392f47=>_0x392f47['id']===_0x2c1704);if(!_0x3bc854)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x2c1704});if(!(_0x3bc854 instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x2c1704});const _0x32a906=_0x71bca5??_0x3bc854['defaultModel']?.['id'];if(!_0x3503bd)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x2c1704});if(!_0x32a906)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x2c1704});return new AIReviewCustomCheckRun(_0x3503bd,_0x32a906,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x3bc854,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x4f2f72,_0x3b1155,_0x35f107){let _0xb1228d=_0x4f2f72;return _0x4f2f72 instanceof ht||(_0xb1228d=new ht(_0x3b1155,this,_0x35f107,_0x4f2f72)),_0xb1228d;}}class AIReviewMode extends _0x464fb9{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x151aec,_0x578733){if(this['assertStartReviewPreconditions'](_0x151aec)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x151aec});const _0x3e368d=this['context']['plugins']['get']('AIReviewModeController');await _0x3e368d['runCheck']({'id':_0x151aec,'params':_0x578733?.['parameterId']?[_0x578733['parameterId']]:void 0x0});}async['startCustomReview'](_0x3ae3f0,_0x2812cf){if(!_0x3ae3f0)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x20c0c5=sr['find'](_0x218873=>'custom'===_0x218873['commandId'])['id'],_0x4c7133=this['assertStartReviewPreconditions'](_0x20c0c5),_0x5344b4=_0x2812cf?.['model']??_0x4c7133['defaultModel']?.['id'];if(!_0x5344b4)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x1a102e=this['context']['plugins']['get']('AIReviewModeController');await _0x1a102e['runCheck']({'id':_0x20c0c5,'isCustom':!0x0,'args':{'prompt':_0x3ae3f0,'model':_0x5344b4}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x20389d=>{const _0x5d047f={'id':_0x20389d['id'],'title':_0x20389d['title'],'description':_0x20389d['description']};return'custom'!==_0x20389d['id']&&_0x20389d['options']?.['length']&&(_0x5d047f['parameters']=_0x20389d['options'][0x0]['data']['map'](_0x29e68b=>({..._0x29e68b}))),_0x5d047f;});}['assertStartReviewPreconditions'](_0x54184c){const _0xafb1a3=this['context']['plugins']['get']('AIReviewModeController');if(_0xafb1a3['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x27804a=_0xafb1a3['getAvailableChecks']()['find'](_0x2c1ab4=>_0x2c1ab4['id']===_0x54184c);if(!_0x27804a)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x54184c});const _0x5621ae=this['context']['plugins']['get']('AITabs')['view'];return _0x5621ae['isVisible']=!0x0,_0x5621ae['activateTab']('reviewMode'),_0x27804a;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0xa0b575,_0x46251a,_0x55e9db,_0x2f4bb4,_0x48c863,_0x1dace9){super(_0xa0b575,_0x46251a,_0x55e9db,_0x48c863,_0x1dace9),this['_title']=_0x2f4bb4;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x3d6dba){this['_checks']=_0x3d6dba['map'](_0x348a91=>new AITranslateCheck(_0x348a91));}}const nr=[{'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'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x4a215d){super(_0x4a215d),this['context']['config']['define']('ai.translate.languages',nr);}async['_loadChecksList'](){const _0x5e7ccb=[],_0x21a763=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x48418b of _0x21a763)_0x5e7ccb['push']({'title':_0x48418b['label'],'id':_0x48418b['id'],'commandId':_0x48418b['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x48418b['id']}});const _0x59971e=new AITranslateCheckList();return _0x59971e['setupChecks'](this['_translateChecks'](_0x5e7ccb)),_0x59971e;}['_translateChecks'](_0x550bfe){const _0x41fc1a=this['context']['locale'];return _0x550bfe['map'](_0x1dd900=>{const _0x391945='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x1dd900['title']['toUpperCase']()['replaceAll']('-','_'),_0x3b789f=Mi(_0x41fc1a,_0x391945);return{..._0x1dd900,'title':_0x3b789f===_0x391945?_0x1dd900['title']:_0x3b789f};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0xd0866b,_0xbef141){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0xbef141,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0xd0866b['params'],_0xd0866b['args']);}['_onReviewCheckResultActivated'](_0x5bab9b){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5bab9b['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5bab9b['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x179538){this['_currentReviewCheckRun']&&('hover'===_0x179538['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x179538['id'])),'click'===_0x179538['uiInteraction']&&this['_scrollToChange'](_0x179538['id']));}['_onDeactivateChange'](_0x5d633b){this['_currentReviewCheckRun']&&'panel'===_0x5d633b['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x463d24,_0x18059d){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x18059d['changeId']),this['_scrollToChange'](_0x18059d['changeId']));}['_onChangeMarkerHovered'](_0x4251d9,_0x19da20){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x19da20['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x19da20['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x1d946c){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x1d946c);}['_markChangePositionInEditorContent'](_0xcd3745,_0x169d39){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0xcd3745,_0x169d39);}['_diffContent'](_0x601cac,_0x4d6ae1,_0xdf2ec9){return this['_aiReviewCoreEditing']['diffContent'](_0x601cac,_0x4d6ae1,_0xdf2ec9,!0x0);}['_onReviewCheckRun'](){for(const _0x5a4d14 of this['_aiReviewCoreEditing']['getEditors']())_0x5a4d14['editing']['view']['change'](_0x55cecd=>{for(const _0x93816c of _0x5a4d14['editing']['view']['document']['getRoots']())_0x55cecd['addClass']('ck-ai-translate-mode-content',_0x93816c);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x1b9328,_0x33fcc5){super(_0x1b9328,_0x33fcc5),this['on']('set:isLoading',(_0x5dc2f6,_0x570d0a,_0x316820)=>{_0x316820&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x5bd7ba,_0x4d2a13,_0x337102)=>{_0x337102&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x526372=super['_createAcceptAllButtonView']();return _0x526372['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x526372;}['_createExitReviewButtonView'](){const _0x19ee60=super['_createExitReviewButtonView']();return _0x19ee60['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x19ee60;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x12c865=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x12c865['if']('isVisible','ck-hidden',_0x22bf25=>!_0x22bf25)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x12c865['if']('isVisible','ck-hidden',_0xad160=>!_0xad160)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x512213=this['context']['plugins']['get']('AITabs'),_0x47fc75=this['context']['locale'],_0x446e3e=new AIHeaderView(_0x47fc75,{'label':Mi(_0x47fc75,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x16f528,'class':'ck-ai-header_review-translate','showResizeButton':_0x512213['showResizeButton']});_0x446e3e['delegate']('resizeTabs')['to'](_0x512213),_0x446e3e['bind']('isMaximized')['to'](_0x512213['view'],'isMaximized',_0x42c66b=>_0x42c66b);const _0x49f8f9=new AIReviewCoreView(_0x47fc75,{'header':_0x446e3e,'list':new AITranslateCheckListView(_0x47fc75),'results':new AITranslateCheckResultsView(_0x47fc75,{'generalErrorText':Mi(_0x47fc75,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x47fc75,{'headerText':Mi(_0x47fc75,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0x47fc75,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x47fc75,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x49f8f9['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x49f8f9;}['registerTab'](){const _0x47191e=this['context']['plugins']['get']('AITabs');_0x47191e['view']['on']('activateTab',(_0x38405a,{newTab:_0xe24a10,oldTab:_0x3a6a0a})=>{'translate'===_0xe24a10?this['fire']('getReviewCheckList'):'translate'===_0x3a6a0a&&this['fire']('leaveReview');}),_0x47191e['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x16f528,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x464fb9{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};
23
+ import{Plugin as _0x1fd9d0,Command as _0x513222,ContextPlugin as _0x21ae07,Editor as _0x1d8ba0}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x5722d5,IconCheck as _0x22df45,IconError as _0x34f98a,IconSubmit as _0xe82bda,IconAIHistory as _0xd48db1,IconMagicWand as _0x5e59dc,IconRobotPencil as _0x53ffa9,IconMaximize as _0x7b2340,IconMinimize as _0x483f10,IconShowChangesOn as _0x44a600,IconShowChangesOff as _0x52b20e,IconDocument as _0x4ffc28,IconBoxWithCross as _0x6ed2e8,IconBoxWithCheck as _0x1310e3,IconBoxWithMarker as _0x4f1eee,IconInfo as _0x2d9b50,IconWeb as _0x5043d9,IconCancel as _0x1c0648,IconSelection as _0x391111,IconFileUpload as _0x3b9c45,IconLink as _0x22c1bd,IconImage as _0x4fce7c,IconBulb as _0x10af08,IconAI as _0x277018,IconPreviousArrow as _0x3617a8,IconDocumentOutline as _0x1e0ba4,IconLoupe as _0xd334bd,IconPaperClip as _0x2f18c8,IconBrowseFiles as _0x1b2e70,IconDropdownArrow as _0x5215ec,IconStop as _0x236653,IconPlus as _0x23b63a,IconAIChat as _0xe943b8,IconPin as _0xfb1eb,IconThreeHorizontalDots as _0x1becc0,IconAIReview as _0x3b9a9d,IconAITranslate as _0x8eaaa1,IconAIAskAI as _0xb22cd6,IconThumbUp as _0x237f67,IconThumbDown as _0x31a52f,IconChevronDown as _0x43b72f,IconChevronUp as _0x100f97,IconAIQuickActions as _0x31731d,IconAIChatCommands as _0x453f5b,IconAIImproveWriting as _0x555af1,IconAIContinueWriting as _0x5ea3f4,IconAIGrammarCheck as _0x19ad65,IconAIAdjustLength as _0x116a19,IconAIChangeTone as _0x58845b,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x190a2c,createLabeledInputText as _0x5dd3ab,FormHeaderView as _0x2e05e4,HighlightedTextView as _0x3bdb10,ViewCollection as _0x246137,FileDialogButtonView as _0x48142e,InputTextView as _0x2e95a6,SearchTextView as _0x22189f,ListItemButtonView as _0x489e61,ButtonLabelWithHighlightView as _0xa37838,DropdownMenuPanelPositioningFunctions as _0x505fe2,BalloonToolbar as _0x41d537,FormRowView as _0xc27f4e,TextareaView as _0x36717f}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x31e4ab,ClipboardMarkersUtils as _0x3ab959}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x168c0b,ViewDataTransfer as _0x5cfddb,ViewUpcastWriter as _0x4f46d7,Matcher as _0xde5339,_DetachOperation as _0x1e4528,_insertIntoModelNodeList as _0x559ec4,_removeFromModelNodeList as _0x5862d1,ModelRange as _0x10082a,transformOperationSets as _0x437900,ViewDowncastWriter as _0x44fce9,ModelDocumentFragment as _0x26fdcd,ModelPosition as _0x8826d0,ModelTreeWalker as _0x2cb75b,MarkerOperation as _0x570f93,InsertOperation as _0x586276}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x1339f4,escape as _0x2f8e1d,cloneDeep as _0x1d48b8,throttle as _0x1ee39e,debounce as _0x315a1f,escapeRegExp as _0x3f0ae7}from'es-toolkit/compat';import{createParser as _0x3f39fe}from'eventsource-parser';import{CloudServices as _0x48a108}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x1faf1a}from'htmlparser2';import{isTag as _0x1b26d5,findOne as _0x43180a,getParent as _0xe59de9,findAll as _0x4edc31,removeElement as _0x1da415,prepend as _0x2bd8f5,prependChild as _0x15734a,appendChild as _0x1cf467,append as _0x962aa,find as _0x3540a9,isComment as _0x22f44d,replaceElement as _0x425be6,getChildren as _0x44cd73,textContent as ti}from'domutils';import _0x1441a0 from'dom-serializer';import{isText as _0x16cddc,cloneNode as _0x54443e,Document as _0x597933,Element as _0x43db7e,Text as _0x9b91ab,isDocument as _0x49200d,NodeWithChildren as _0x20060f}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0xd184b0,MarkdownGfmMdToHtml as _0x367c9e}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x38b678 from'rehype-sanitize';import{fixElementSuggestionRange as _0x50329e,DocumentCompare as _0x76057,DATA_ID_MODEL_ATTRIBUTE as _0x2be294,ConfirmMixin as _0x302506,getAllMarkersDomElementsSorted as _0x2dfed1,SuggestionsConversion as _0x166574,DATA_ID_VIEW_ATTRIBUTE as _0x20284a,getMarkerDomElement as _0x24f01c}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x3adf3c from'morphdom';import{diffArrays as _0x55fd12}from'diff';const Ti='_ungrouppedCommands';function fi(_0xf7ddbb,_0x4765d5){const _0x4e4250=(0x0,_0x4765d5['t'])('Other');return _0xf7ddbb['length']?'groupId'in _0xf7ddbb[0x0]?_0xf7ddbb:[{'groupId':Ti,'groupLabel':_0x4e4250,'order':0x1/0x0,'commands':_0xf7ddbb}]:[{'groupId':Ti,'groupLabel':_0x4e4250,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x1fd9d0{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x3c83ee}=this,_0x1fde0c=['ck-fake-ai-selection'];_0x3c83ee['config']['get']('ai.assistant.useTheme')&&_0x1fde0c['push']('ck-ai-assistant-ui_theme'),_0x3c83ee['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x1fde0c,'priority':0xc}}),_0x3c83ee['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x186a3c,{writer:_0x1ecd9c})=>{if(!_0x186a3c['markerRange']['isCollapsed'])return null;const _0x3ee7b4=_0x1ecd9c['createUIElement']('span');return _0x1ecd9c['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3ee7b4),_0x3ee7b4;}});}['afterInit'](){!async function(_0x1ba5dd){const _0x10a5f5=_0x2f388b([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x14d925=0x3dffc4e1,_0x228d4=0x3df84f59^_0x14d925,_0x450444=window[_0x2f388b([0x44,0x61,0x74,0x65])][_0x2f388b([0x6e,0x6f,0x77])](),_0x355147=_0x1ba5dd[_0x2f388b([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x3b6cea=new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x3fbd40=>{_0x355147[_0x2f388b([0x6f,0x6e,0x63,0x65])](_0x2f388b([0x72,0x65,0x61,0x64,0x79]),_0x3fbd40);}),_0x349fd4={[_0x2f388b([0x6b,0x74,0x79])]:_0x2f388b([0x45,0x43]),[_0x2f388b([0x75,0x73,0x65])]:_0x2f388b([0x73,0x69,0x67]),[_0x2f388b([0x63,0x72,0x76])]:_0x2f388b([0x50,0x2d,0x32,0x35,0x36]),[_0x2f388b([0x78])]:_0x2f388b([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x2f388b([0x79])]:_0x2f388b([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x2f388b([0x61,0x6c,0x67])]:_0x2f388b([0x45,0x53,0x32,0x35,0x36])},_0x325e20=_0x355147[_0x2f388b([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x2f388b([0x67,0x65,0x74])](_0x2f388b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x518149(){let _0x1eee17,_0x4502f1=null,_0x2012b2=null;try{if(_0x325e20==_0x2f388b([0x47,0x50,0x4c]))return _0x2f388b([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x1eee17=_0x137c31(),!_0x1eee17)return _0x2f388b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x1eee17[_0x2f388b([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x2012b2=_0x1a3e54(_0x1eee17[_0x2f388b([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x1eee17[_0x2f388b([0x6a,0x74,0x69])])),await _0x2fd161()?_0x2c8800()?_0x22abc9()?_0x2f388b([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x8d1b5d()?(_0x1eee17[_0x2f388b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x2f388b([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x4502f1=_0x1c4c75(_0x2f388b([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x15e54f()):_0x2f388b([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x2f388b([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x2f388b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x2f388b([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x22abc9(){const _0x59718e=[_0x2f388b([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x2f388b([0x74,0x72,0x69,0x61,0x6c])][_0x2f388b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x1eee17[_0x2f388b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x450444/0x3e8:0xe10*_0x228d4;return _0x1eee17[_0x2f388b([0x65,0x78,0x70])]<_0x59718e;}function _0x2c8800(){const _0x2ccae6=_0x1eee17[_0x2f388b([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x2ccae6&&(!!_0x2ccae6[_0x2f388b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2f388b([0x2a]))||!!_0x2ccae6[_0x2f388b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2f388b([0x41,0x49])));}function _0x8d1b5d(){const _0x8fd51f=_0x1eee17[_0x2f388b([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x8fd51f||0x0==_0x8fd51f[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x339e25}=new URL(window[_0x2f388b([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x8fd51f[_0x2f388b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x339e25))return!0x0;const _0x2a483c=_0x339e25[_0x2f388b([0x73,0x70,0x6c,0x69,0x74])](_0x2f388b([0x2e]));return _0x8fd51f[_0x2f388b([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x3315b4=>_0x3315b4[_0x2f388b([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x2f388b([0x2a])))[_0x2f388b([0x6d,0x61,0x70])](_0x491b21=>_0x491b21[_0x2f388b([0x73,0x70,0x6c,0x69,0x74])](_0x2f388b([0x2e])))[_0x2f388b([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x170c9d=>_0x170c9d[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x2a483c[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x2f388b([0x6d,0x61,0x70])](_0x50b26b=>Array(_0x2a483c[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x50b26b[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x2f388b([0x66,0x69,0x6c,0x6c])](_0x50b26b[0x0]===_0x2f388b([0x2a])?_0x2f388b([0x2a]):'')[_0x2f388b([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x50b26b))[_0x2f388b([0x73,0x6f,0x6d,0x65])](_0x357111=>_0x2a483c[_0x2f388b([0x65,0x76,0x65,0x72,0x79])]((_0x1dfdf4,_0x4020b7)=>_0x357111[_0x4020b7]===_0x1dfdf4||_0x357111[_0x4020b7]===_0x2f388b([0x2a])));}function _0x15e54f(){return _0x4502f1&&_0x2012b2?new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x5210fe,_0x537923)=>{_0x4502f1[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x5210fe,_0x537923),_0x2012b2[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x5a5e66=>{_0x5a5e66!=_0x2f388b([0x56,0x61,0x6c,0x69,0x64])&&_0x5210fe(_0x5a5e66);},_0x537923);}):_0x4502f1||_0x2012b2||_0x2f388b([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1a3e54(_0x2d6348,_0x331e03){return new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2fad2d=>{if(_0x31c3fd())return _0x2fad2d(_0x2f388b([0x56,0x61,0x6c,0x69,0x64]));_0x5b1b74(),_0x355147[_0x2f388b([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x2f388b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x26ba44=!0x1;const _0x37d635=at();function _0x502d80(_0x361574){return!!_0x361574&&(typeof _0x361574===_0x2f388b([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x361574===_0x2f388b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x361574[_0x2f388b([0x74,0x68,0x65,0x6e])]===_0x2f388b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x361574[_0x2f388b([0x63,0x61,0x74,0x63,0x68])]===_0x2f388b([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x2d3d37(_0x2cae48){_0xd4d275(_0x2cae48)[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x1e0822=>{if(!_0x1e0822||_0x1e0822[_0x2f388b([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x2f388b([0x6f,0x6b]))return _0x2f388b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x5597f6(_0x31f2c0(_0x37d635+_0x331e03))!=_0x1e0822[_0x2f388b([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x2f388b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x2f388b([0x56,0x61,0x6c,0x69,0x64]);})[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x1dc22f=>(_0x55a8fe(),_0x1dc22f),()=>{const _0x1a728f=_0x30db02();return null==_0x1a728f?(_0x55a8fe(),_0x2f388b([0x56,0x61,0x6c,0x69,0x64])):_0x2f388b(_0x450444-_0x1a728f>(0x19f340e1^_0x14d925)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x2fad2d)[_0x2f388b([0x63,0x61,0x74,0x63,0x68])](()=>{_0x2fad2d(_0x2f388b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x57828f=0x3dc92a61^_0x14d925;function _0x55a8fe(){const _0x15e4fe=_0x2f388b([0x6c,0x6c,0x63,0x74,0x2d])+_0x5597f6(_0x31f2c0(_0x2d6348)),_0x4f2e20=_0x26aac1(_0x5597f6(window[_0x2f388b([0x4d,0x61,0x74,0x68])][_0x2f388b([0x63,0x65,0x69,0x6c])](_0x450444/_0x57828f)));window[_0x2f388b([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x2f388b([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x15e4fe,_0x4f2e20);}function _0x30db02(){const _0x25ba6e=_0x2f388b([0x6c,0x6c,0x63,0x74,0x2d])+_0x5597f6(_0x31f2c0(_0x2d6348)),_0x43f714=window[_0x2f388b([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x2f388b([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x25ba6e);return _0x43f714?window[_0x2f388b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x26aac1(_0x43f714),0x10)*_0x57828f:null;}function _0xd4d275(_0x54e10d){return new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x3811db,_0x390f11)=>{_0x54e10d[_0x2f388b([0x74,0x68,0x65,0x6e])](_0x3811db,_0x390f11),window[_0x2f388b([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x390f11,0x3dfe1021^_0x14d925);});}}_0x355147[_0x2f388b([0x6f,0x6e])](_0x2f388b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x347894,_0x2377b8)=>{if(_0x2377b8[0x0]!=_0x2d6348)return _0x2fad2d(_0x2f388b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x2377b8[0x1]={..._0x2377b8[0x1],[_0x2f388b([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x37d635};},{[_0x2f388b([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x2f388b([0x68,0x69,0x67,0x68])}),_0x355147[_0x2f388b([0x6f,0x6e])](_0x2f388b([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x14e00a=>{_0x502d80(_0x14e00a[_0x2f388b([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x26ba44=!0x0,_0x2d3d37(_0x14e00a[_0x2f388b([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x2f388b([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x2f388b([0x6c,0x6f,0x77])}),_0x3b6cea[_0x2f388b([0x74,0x68,0x65,0x6e])](()=>{_0x26ba44||_0x2fad2d(_0x2f388b([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x31c3fd(){return _0x355147[_0x2f388b([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x2f388b([0x76,0x69,0x65,0x77])][_0x2f388b([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x2f388b([0x61,0x75,0x74,0x6f]);}function _0x5b1b74(){_0x355147[_0x2f388b([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x2f388b([0x76,0x69,0x65,0x77])][_0x2f388b([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x2f388b([0x61,0x75,0x74,0x6f]);}}function _0x1c4c75(_0x3c8fbd){const _0x136e5a=[new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x516112=>setTimeout(_0x516112,0x3df6fa2d^_0x14d925)),_0x3b6cea[_0x2f388b([0x74,0x68,0x65,0x6e])](()=>new window[(_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x477161=>{let _0x168e75=0x0;_0x355147[_0x2f388b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2f388b([0x6f,0x6e])](_0x2f388b([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0xa2bbcf,_0x439edb)=>{_0x439edb[0x0][_0x2f388b([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x168e75++,_0x168e75==(0x3dffc109^_0x14d925)&&(_0x477161(),_0xa2bbcf[_0x2f388b([0x6f,0x66,0x66])]());});}))];return window[_0x2f388b([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x2f388b([0x72,0x61,0x63,0x65])](_0x136e5a)[_0x2f388b([0x74,0x68,0x65,0x6e])](()=>_0x3c8fbd);}async function _0x3dead7(){await _0x3b6cea,_0x355147[_0x2f388b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2f388b([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x55c3b9,_0x355147[_0x2f388b([0x6d,0x6f,0x64,0x65,0x6c])][_0x2f388b([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x55c3b9,_0x355147[_0x2f388b([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x2f388b([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x52c0f8(_0x7274e9){const _0x5dd4c3=_0x4a02f7();_0x355147[_0x5dd4c3]=_0x2f388b([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x7274e9,_0x7274e9!=_0x2f388b([0x56,0x61,0x6c,0x69,0x64])&&_0x3dead7();}function _0x4a02f7(){const _0x85b14a=window[_0x2f388b([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x2f388b([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x2f388b([0x6e,0x6f,0x77])]())[_0x2f388b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x2f388b([0x2e]),'');let _0x27c64f=_0x2f388b([0x6e]);for(let _0x148ad2=0x0;_0x148ad2<_0x85b14a[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x148ad2+=0x2){let _0x286023=window[_0x2f388b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x85b14a[_0x2f388b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x148ad2,_0x148ad2+0x2));_0x286023>=_0x10a5f5[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x286023-=_0x10a5f5[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x27c64f+=_0x10a5f5[_0x286023];}return _0x27c64f;}function _0x137c31(){const _0xbc4975=_0x325e20[_0x2f388b([0x73,0x70,0x6c,0x69,0x74])](_0x2f388b([0x2e]));if(0x3!=_0xbc4975[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x3938ec(_0xbc4975[0x1]);function _0x3938ec(_0x249628){const _0x1ca134=_0x280356(_0x249628);return _0x1ca134&&_0x468946()?_0x1ca134:null;function _0x468946(){const _0xe3b46f=_0x1ca134[_0x2f388b([0x6a,0x74,0x69])],_0x2e05b4=window[_0x2f388b([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xe3b46f[_0x2f388b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0xe3b46f[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x5b8d7c={..._0x1ca134,[_0x2f388b([0x6a,0x74,0x69])]:_0xe3b46f[_0x2f388b([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0xe3b46f[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x5b8d7c[_0x2f388b([0x76,0x63])],_0x31f2c0(_0x5b8d7c)==_0x2e05b4;}}}async function _0x2fd161(){let _0x32c244=!0x0;try{const _0x51c4da=_0x325e20[_0x2f388b([0x73,0x70,0x6c,0x69,0x74])](_0x2f388b([0x2e])),[_0x512432,_0x5a23bf,_0xfdfaea]=_0x51c4da;return _0xcb4cf5(_0x512432),await _0x987ede(_0x512432,_0x5a23bf,_0xfdfaea),_0x32c244;}catch{return!0x1;}function _0xcb4cf5(_0x33a2cc){const _0x42342a=_0x280356(_0x33a2cc);_0x42342a&&_0x42342a[_0x2f388b([0x61,0x6c,0x67])]==_0x2f388b([0x45,0x53,0x32,0x35,0x36])||(_0x32c244=!0x1);}async function _0x987ede(_0x17a117,_0x29a602,_0x2448ec){const _0x140967=window[_0x2f388b([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x2f388b([0x66,0x72,0x6f,0x6d])](_0x24f1e4(_0x2448ec),_0x64563d=>_0x64563d[_0x2f388b([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x56de25=new window[(_0x2f388b([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x2f388b([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x17a117+_0x2f388b([0x2e])+_0x29a602),_0x1789fd=window[_0x2f388b([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x2f388b([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x1789fd)return;const _0x73ccd4=await _0x1789fd[_0x2f388b([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x2f388b([0x6a,0x77,0x6b]),_0x349fd4,{[_0x2f388b([0x6e,0x61,0x6d,0x65])]:_0x2f388b([0x45,0x43,0x44,0x53,0x41]),[_0x2f388b([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x2f388b([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x2f388b([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x1789fd[_0x2f388b([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x2f388b([0x6e,0x61,0x6d,0x65])]:_0x2f388b([0x45,0x43,0x44,0x53,0x41]),[_0x2f388b([0x68,0x61,0x73,0x68])]:{[_0x2f388b([0x6e,0x61,0x6d,0x65])]:_0x2f388b([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x73ccd4,_0x140967,_0x56de25)||(_0x32c244=!0x1);}}function _0x280356(_0x2d4db1){return _0x2d4db1[_0x2f388b([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x2f388b([0x65,0x79]))?JSON[_0x2f388b([0x70,0x61,0x72,0x73,0x65])](_0x24f1e4(_0x2d4db1)):null;}function _0x24f1e4(_0x5716f6){return window[_0x2f388b([0x61,0x74,0x6f,0x62])](_0x5716f6[_0x2f388b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x2f388b([0x2b]))[_0x2f388b([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x2f388b([0x2f])));}function _0x31f2c0(_0x1a3fae){let _0x2ee802=0x1505;function _0x252bd2(_0x4bb2dc){for(let _0x101f87=0x0;_0x101f87<_0x4bb2dc[_0x2f388b([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x101f87++){const _0x14eb1c=_0x4bb2dc[_0x2f388b([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x101f87);_0x2ee802=(_0x2ee802<<0x5)+_0x2ee802+_0x14eb1c,_0x2ee802&=_0x2ee802;}}function _0x5e0f67(_0x32d2df){Array[_0x2f388b([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x32d2df)?_0x32d2df[_0x2f388b([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x5e0f67):_0x32d2df&&typeof _0x32d2df==_0x2f388b([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x2f388b([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x32d2df)[_0x2f388b([0x73,0x6f,0x72,0x74])]()[_0x2f388b([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x2f7fa6,_0x2f4adb])=>{_0x252bd2(_0x2f7fa6),_0x5e0f67(_0x2f4adb);}):_0x252bd2(window[_0x2f388b([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x32d2df));}return _0x5e0f67(_0x1a3fae),_0x2ee802>>>0x0;}function _0x5597f6(_0xb5a50c){return _0xb5a50c[_0x2f388b([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x2f388b([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x2f388b([0x30]));}function _0x26aac1(_0x452ad9){return _0x452ad9[_0x2f388b([0x73,0x70,0x6c,0x69,0x74])]('')[_0x2f388b([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x2f388b([0x6a,0x6f,0x69,0x6e])]('');}function _0x55c3b9(){}function _0x2f388b(_0x588225){return _0x588225['map'](_0x561c49=>String['fromCharCode'](_0x561c49))['join']('');}_0x52c0f8(await _0x518149());}(this);}['showFakeVisualSelection'](){const _0x3390bd=this['editor']['model'];_0x3390bd['change'](_0x33b84f=>{const _0x390d08=_0x3390bd['document']['selection']['getRanges']();let _0x5a0fd7=0x0;for(const _0x45be2b of _0x390d08){const _0x28ded5=bi+':'+_0x5a0fd7;if(_0x3390bd['markers']['has'](_0x28ded5))_0x33b84f['updateMarker'](_0x28ded5,{'range':_0x45be2b});else{if(_0x45be2b['start']['isAtEnd']){const _0x3e0f26=_0x45be2b['start']['getLastMatchingPosition'](({item:_0x37ecc4})=>!_0x3390bd['schema']['isContent'](_0x37ecc4),{'boundaries':_0x45be2b});_0x33b84f['addMarker'](_0x28ded5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x33b84f['createRange'](_0x3e0f26,_0x45be2b['end'])});}else _0x33b84f['addMarker'](_0x28ded5,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x45be2b});}_0x5a0fd7++;}});}['hideFakeVisualSelection'](){const _0x25df52=this['editor']['model'],_0x129cec=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x129cec['length']&&_0x25df52['change'](_0x1867ba=>{_0x129cec['forEach'](_0x4aa84f=>{_0x1867ba['removeMarker'](_0x4aa84f);});});}['insertContent'](_0x346c59,_0x199218){const _0x18708a=this['_getAISelection'](),_0x56932c=_0x199218||_0x18708a['getFirstRange']();this['editor']['model']['canEditAt'](_0x56932c)&&this['editor']['model']['change'](_0x34e11b=>{this['hideFakeVisualSelection'](),_0x199218||this['_resetContentOfSelectedTableCells'](_0x34e11b,_0x18708a),this['_pasteHTMLUsingClipboard']({'insertAt':_0x56932c,'writer':_0x34e11b,'html':_0x346c59});});}['insertContentBelow'](_0x36ed9d){const {model:_0x1c2ae3}=this['editor'],_0x3059b0=this['_getAISelection']();_0x1c2ae3['change'](()=>{const _0x3d3ecb=this['_prepareTableInsertBelowPosition'](_0x36ed9d,_0x3059b0)||this['_getDefaultInsertBelowPosition'](_0x3059b0);this['insertContent'](_0x36ed9d,_0x3d3ecb);});}['_getAISelection'](){const _0x19d918=this['editor']['model'],_0x2b142f=Array['from'](_0x19d918['markers']['getMarkersGroup'](bi))['map'](_0x47873a=>_0x47873a['getRange']());return _0x19d918['createSelection'](_0x2b142f);}['_pasteHTMLUsingClipboard']({writer:_0x80fe72,html:_0x2b1aba,insertAt:_0x334463}){const {view:_0x10476f}=this['editor']['editing'],_0x3ee2e0=this['editor']['plugins']['get'](_0x31e4ab),_0x27464a=new Ri();_0x27464a['setData']('text/html',_0x2b1aba);const _0xd9cf4b=new ClipboardEvent('paste',{'clipboardData':_0x27464a}),_0x23c5c2=new _0x168c0b(_0x10476f,_0xd9cf4b,{'dataTransfer':new _0x5cfddb(_0x27464a)});_0x80fe72['setSelection'](_0x334463);const _0x408487=(_0x440aa6,_0x47e285)=>{_0x47e285['resultRange']&&_0x80fe72['setSelection'](_0x47e285['resultRange']);};_0x3ee2e0['once']('contentInsertion',_0x408487,{'priority':'lowest'}),_0x10476f['document']['fire']('paste',_0x23c5c2),_0x3ee2e0['off']('contentInsertion',_0x408487);}['_getDefaultInsertBelowPosition'](_0x5bce6a){const {model:_0xc54d02}=this['editor'],_0x4ecb60=Array['from'](_0x5bce6a['getSelectedBlocks']());return _0x4ecb60['length']?_0xc54d02['createPositionAfter'](_0x4ecb60['pop']()):_0x5bce6a['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x596775,_0x105884){const {model:_0x271c70,plugins:_0x55ea8f}=this['editor'];if(_0x55ea8f['has']('TableUtils')){const _0x3048e0=_0x55ea8f['get']('TableUtils')['getSelectedTableCells'](_0x105884);if(_0x3048e0['length']){const _0x34b471=this['_getTableRowCountFromContent'](_0x596775),_0x139892=this['_createEmptyTableRows'](_0x3048e0,_0x34b471);return _0x271c70['createPositionAt'](_0x139892,0x0);}}return null;}['_getTableRowCountFromContent'](_0x3c2dfd){const _0x132249=this['editor']['plugins']['get']('TableUtils'),_0x1548b1=this['editor']['data']['parse'](_0x3c2dfd,'$documentFragment'),_0x1c3f28=Array['from'](_0x1548b1['getChildren']())['filter'](_0x185465=>_0x185465['is']('element','table'));let _0x132115=0x0;return _0x1c3f28['forEach'](_0x47f0f7=>{_0x132115+=_0x132249['getRows'](_0x47f0f7);}),_0x132115;}['_createEmptyTableRows'](_0xee29c3,_0x2ababc){const _0x5d7939=this['editor']['plugins']['get']('TableUtils'),_0x49caae=_0x5d7939['getRowIndexes'](_0xee29c3),_0x53c149=_0x5d7939['getColumnIndexes'](_0xee29c3),_0x106040=_0x49caae['last']+0x1,_0x16c549=_0x53c149['first'],_0x450b8c=_0xee29c3[0x0]['findAncestor']('table');for(let _0xc89b23=0x0;_0xc89b23<_0x2ababc;_0xc89b23++)_0x5d7939['insertRows'](_0x450b8c,{'at':_0x106040});return _0x450b8c['getChild'](_0x106040)['getChild'](_0x16c549);}['_resetContentOfSelectedTableCells'](_0x5cd3d6,_0x12cdf0){const {plugins:_0x160cfd}=this['editor'],{model:_0x472668}=_0x5cd3d6;if(!_0x160cfd['has']('TableUtils'))return;_0x160cfd['get']('TableUtils')['getSelectedTableCells'](_0x12cdf0)['length']&&_0x472668['deleteContent'](_0x12cdf0);}}class AIAdapter extends _0x1fd9d0{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);}}class AIRequestError extends Error{constructor(_0x4672e0){super(_0x4672e0),this['name']='AIRequestError';}}function Si(_0x216645,_0x31a137,_0x586cd6){const t=_0x216645['t'];switch(_0x31a137){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',_0x586cd6);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x586cd6);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'},_0x586cd6);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 _0x31a137;}}class ShowAIAssistantCommand extends _0x513222{['_commandDefinitions'];constructor(_0x196492,_0x273f89){super(_0x196492),this['_commandDefinitions']=_0x273f89,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x2f5493,_0x204109,_0x4c82ac)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x4c82ac));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x5038a6,_0x309e5f,_0x3a59b3)=>{this['enabledCommandsIds']=_0x3a59b3?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x7079ac=this['editor']['model'];this['_hasContext']=function(_0x58f5d6){const _0x1999a8=_0x58f5d6['document']['selection'];return _0x1999a8['isCollapsed']?0x0!==[..._0x1999a8['getSelectedBlocks']()]['length']&&![..._0x1999a8['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x58f5d6['hasContent'](_0x1999a8['getFirstRange']());}(_0x7079ac);const _0x7372b4=_0x7079ac['document']['selection'],_0x1ab5bb=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x569455 of _0x7372b4['getRanges']())for(const _0x25e193 of _0x569455['getItems']())if(_0x25e193['is']('element')&&_0x1ab5bb['includes'](_0x25e193['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x3f6f95='',_0x4101e1='',_0x1c1820='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x3f6f95,_0x4101e1,_0x1c1820);}}function Oi(_0x1340b3,_0x13a29d){const _0x88e48f=new Set();for(const _0xd207bb of _0x1340b3['values']())(_0x13a29d||!0x1===_0xd207bb['requiresContent'])&&_0x88e48f['add'](_0xd207bb['id']);return Array['from'](_0x88e48f);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
+ ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x21c5b7,_0x1b89d5,_0x154856){super(),this['editor']=_0x21c5b7,this['textAdapter']=_0x1b89d5,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x154856,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x184655,_0xb7fc4b,_0x3f5d72)=>{this['view']['value']=this['_sanitizeHTML'](_0x3f5d72);}),this['listenTo'](this['view'],'submitPrompt',(_0x3cff5e,_0x48d0e5)=>{const _0x1d0cae=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x48d0e5,_0x1d0cae,'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:_0x24f43d,query:_0x867dc7,htmlContent:_0x48d10a,label:_0x22a8d8,mainActionLabel:_0x370f0a}){this['view']['prompt']=_0x22a8d8,this['view']['mainAction']=_0x370f0a,this['initialContext']=_0x48d10a,_0x867dc7&&(this['view']['isRendered']?this['_handleQuery'](_0x867dc7,_0x48d10a,_0x24f43d,_0x22a8d8):this['view']['once']('render',()=>{this['_handleQuery'](_0x867dc7,_0x48d10a,_0x24f43d,_0x22a8d8);}));}['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'](_0x2b9c3b,_0xbf39cf,_0x2d707f,_0x3001d7){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0xbf39cf,this['previousQuery']=_0x2b9c3b,this['previousLabel']=_0x3001d7||_0x2b9c3b,this['previousActionId']=_0x2d707f,new Promise(_0x244e6f=>{this['textAdapter']['makeRequest']({'query':_0x2b9c3b,'context':_0xbf39cf,'onData':_0x164381=>{this['currentResponse']=_0x164381,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x2d707f})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x4f6c8e=>{_0x4f6c8e instanceof AIRequestError?this['view']['handleError'](_0x4f6c8e['message']):this['view']['handleError'](),_0x244e6f();})['finally'](()=>{this['stopProcessing'](),_0x244e6f();});});}['_parseAndNormalizeContent'](_0x23f8ad,_0x4ef2f5=!0x1){const _0x48b36b=vi['exec'](_0x23f8ad);_0x23f8ad=_0x48b36b?_0x23f8ad['substring'](_0x48b36b[0x1]['length']):_0x23f8ad['length']<0x64&&!_0x4ef2f5?'':this['_stripMarkdownSyntax'](_0x23f8ad);const _0x52f364=this['_domParser']['parseFromString'](_0x23f8ad,'text/html');if(_0x48b36b){const _0x2f2574=Array['from'](_0x52f364['body']['childNodes']);_0x2f2574['reverse']();for(const _0x4b4e1e of _0x2f2574){if(_0x4b4e1e['nodeType']==Node['ELEMENT_NODE'])break;_0x4b4e1e['remove']();}}const _0x4e655a=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x52f364['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x4e655a);const _0xd34a7e=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x587c83=this['editor']['data']['toModel'](_0x4e655a);return _0xd34a7e||_0x587c83['markers']['clear'](),this['editor']['data']['stringify'](_0x587c83);}['_normalizeResponseHeadings'](_0x38a232){const _0x347241=new _0x4f46d7(this['editor']['editing']['view']['document']),_0x114228=new _0xde5339({'name':/^h[1-5]$/}),_0x508dd0=[];let _0x15e9af=!0x1;for(const _0x34b171 of _0x38a232)_0x34b171['is']('element')&&_0x114228['match'](_0x34b171)&&(_0x508dd0['push'](_0x34b171),'h1'==_0x34b171['name']&&(_0x15e9af=!0x0));if(_0x15e9af){for(const _0x4e0627 of _0x508dd0)_0x347241['rename']('h'+(parseInt(_0x4e0627['name'][0x1])+0x1),_0x4e0627);}}['_isH1TagSupportEnabled'](){const {data:_0x3db18e,editing:_0x2686ce}=this['editor'],_0x39bd5d=_0x3db18e['htmlProcessor']['toView']('<h1></h1>'),_0x2450f9=_0x3db18e['toView'](_0x3db18e['toModel'](_0x39bd5d));return!!_0x2686ce['view']['domConverter']['viewToDom'](_0x2450f9)['querySelector']('h1');}['_sanitizeHTML'](_0x103ee0){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x103ee0),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x4f14db){const _0x29a678=_0x4f14db['trim']();return _0x29a678['startsWith']('```html')?_0x29a678['endsWith']('```')?_0x29a678['substring'](0x7,_0x29a678['length']-0x3):_0x29a678['substring'](0x7):_0x4f14db;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x3502e6){super(_0x3502e6),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x58ca98=>Si(_0x3502e6,'AI_'+_0x58ca98['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x3502e6,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x3502e6,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x3502e6,'Stop'));const _0x5a576e=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x5a576e['if']('isVisible','ck-hidden',_0x850d8=>!_0x850d8)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x58bb15,_0x3d3bc6){const _0x503cc0=new yt(this['locale']);return _0x503cc0['set']({'label':_0x58bb15,'class':_0x3d3bc6||'','isVisible':!0x0,'withText':!0x0}),_0x503cc0;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x4a1be7,_0x1be30f=''){super(_0x4a1be7),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x1d3f01=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x4a1be7,_0x1be30f),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x1d3f01['if']('isVisible','ck-hidden',_0x541b24=>!_0x541b24)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x1d3f01['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 _0x71af3d=!0x1;this['on']('change:value',(_0x147a13,_0x22b256,_0x12af6e)=>{const _0x245c9d=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x12af6e),this['isProcessing']&&_0x245c9d&&!_0x71af3d&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xaf4da,_0x509db5,_0x31afab)=>{_0x71af3d=!0x1,_0x31afab?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x71af3d=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x71af3d=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x14d595=this['locale'],_0x387357=new yt(this['locale']),_0x53a7f4='ck-ai-form__copy-button';return _0x387357['set']({'label':Si(_0x14d595,'Copy'),'icon':_0x5722d5,'class':_0x53a7f4,'tooltip':!0x0}),_0x387357['bind']('isVisible')['to'](this,'value',_0x489c6b=>!!_0x489c6b),_0x387357['bind']('isEnabled')['to'](this,'isProcessing',_0xc48c6c=>!_0xc48c6c),_0x387357['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x387357['icon']=_0x22df45,_0x387357['class']=_0x53a7f4+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x387357['icon']=_0x5722d5,_0x387357['class']=_0x53a7f4;},0x3e8);}),_0x387357;}['_copyHTMLToClipboard'](_0x21b22d){const {window:_0x3e83c2,document:_0x614575}=lt;if(_0x3e83c2['ClipboardItem']){const {Blob:_0x55e3e9,ClipboardItem:_0x4839f5}=_0x3e83c2,_0x579169=[new _0x4839f5({'text/html':new _0x55e3e9([_0x21b22d['innerHTML']],{'type':'text/html'}),'text/plain':new _0x55e3e9([_0x21b22d['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x579169);}else{const _0x4c446d=_0x614575['createElement']('div');_0x4c446d['style']['position']='absolute',_0x4c446d['style']['left']='-9999px',_0x4c446d['innerHTML']='<span>[</span>'+_0x21b22d['innerHTML']+'<span>]</span>',_0x614575['body']['appendChild'](_0x4c446d);const _0x59cd4d=_0x614575['createRange']();_0x59cd4d['setStartAfter'](_0x4c446d['firstElementChild']),_0x59cd4d['setEndBefore'](_0x4c446d['lastElementChild']);const _0x16f1eb=_0x3e83c2['getSelection']();_0x16f1eb['removeAllRanges'](),_0x16f1eb['addRange'](_0x59cd4d),_0x614575['execCommand']('copy'),_0x4c446d['remove']();}}}class ContentFieldView extends Nt{constructor(_0x5339df,_0x68888=''){super(_0x5339df),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x68888,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x63fbce){this['element']['innerHTML']=_0x63fbce;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x1c9ae4=new Nt(),_0x23e2b6=this['locale'],_0x1945fb=new xt();return _0x1945fb['isVisible']=!0x0,_0x1c9ae4['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x1945fb,{'text':Si(_0x23e2b6,'AI\x20is\x20writing...')}]}),_0x1c9ae4['render'](),_0x1c9ae4;}}class AIFormErrorView extends Nt{constructor(_0x1f2dbd,_0x55db20=''){super(_0x1f2dbd);const _0x3f715d=new Lt(),_0x5ac5c1=this['bindTemplate'];this['set']('text',_0x55db20),_0x3f715d['content']=_0x34f98a,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x3f715d,{'text':_0x5ac5c1['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x3cdb89,_0x45d9da){super(_0x3cdb89,_0x45d9da),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',(_0x548f7e,_0x20c3a7)=>{_0x548f7e['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x20c3a7());});}['_createSubmitButton'](){const _0x343f13=new yt(this['locale']),_0x3f82ec=this['locale'];return _0x343f13['set']({'icon':_0xe82bda,'label':Si(_0x3f82ec,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x343f13['on']('execute',()=>{this['submit']();}),_0x343f13['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x26a3b6,_0xf71a1d)=>!_0x26a3b6&&_0xf71a1d),_0x343f13;}['_createShowHistoryButton'](){const _0xdbc769=new yt(this['locale']),_0xcd3aa9=this['resultsView'],_0xe3dd8d=this['locale'];_0xdbc769['set']({'label':Si(_0xe3dd8d,'History'),'withText':!0x1,'icon':_0xd48db1,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0xdbc769['bind']('isOn')['to'](_0xcd3aa9,'isVisible'),_0xdbc769['bind']('isEnabled')['to'](this,'isEnabled'),_0xdbc769['on']('execute',()=>{_0xcd3aa9['isVisible']=!_0xcd3aa9['isVisible'],_0xcd3aa9['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x2589d0=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x3ffdf0=new dt(this['queryView']['fieldView']['element']),_0x13039d=_0x3ffdf0['width'],_0x473558='rtl'===_0xe3dd8d['uiLanguageDirection']?'left':'right';_0x3ffdf0['excludeScrollbarsAndBorders'](),_0xdbc769['element']['style'][_0x473558]=_0x13039d-_0x3ffdf0['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x2589d0),this['on']('render',_0x2589d0),_0xdbc769;}['submit'](){const _0x31fddd=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x31fddd);}['focus'](_0x27a652){-0x1===_0x27a652?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x3b18f5){super(_0x3b18f5),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x3b18f5,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0xbdf178=0x0;for(const _0x24f9f9 of this['items'])_0xbdf178+=_0x24f9f9['items']['length'];return{'resultsCount':_0xbdf178,'totalItemsCount':_0xbdf178};}['_createClearHistoryButton'](){const _0x400526=this['locale'],_0x3fa5f8=new yt(this['locale']);return _0x3fa5f8['set']({'label':'('+Si(_0x400526,'Clear')+')','withText':!0x0}),_0x3fa5f8['on']('execute',()=>this['fire']('clearHistory')),_0x3fa5f8;}}class AIHistoryListItemView extends Ht{constructor(_0x880553){super();const _0x22e114=new Mt(),_0x76685d=new yt(this['locale'],_0x22e114);this['children']['add'](_0x76685d),_0x76685d['set']({'label':_0x880553['prompt'],'withText':!0x0}),_0x76685d['on']('execute',()=>{this['fire']('execute',{'value':_0x1339f4(_0x880553['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x228252,_0x2fed3b)=>{const _0x5b5187=Ni(_0x2fed3b['prompt']);for(const _0x58dd29 of this)if(_0x58dd29!=_0x2fed3b&&Ni(_0x58dd29['prompt'])===_0x5b5187){this['remove'](_0x58dd29);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x232188=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x232188));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x473e86=>_0x473e86)));}}function Ni(_0x71fb87){return _0x71fb87['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x3fbbb5,_0x412950,_0x219b71=''){super(_0x3fbbb5),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x3fbbb5),this['contentArea']=new AIFormContentArea(_0x3fbbb5,_0x219b71),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 It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'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 _0x3e7dd7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x412950],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x3e7dd7['if']('isError','ck-hidden',_0x39a73e=>!_0x39a73e)]},'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'](_0x294e56=0x1){-0x1===_0x294e56?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 _0x5e0c2f=this['locale'],_0x411593=new AIFormPromptView(_0x5e0c2f,{'queryView':{'label':Si(_0x5e0c2f,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x5e0c2f,'Empty\x20history'),'secondary':Si(_0x5e0c2f,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x411593['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3e3b2f,_0x573925)=>_0x3e3b2f&&!_0x573925),this['listenTo'](_0x411593,'submit',(_0x555490,_0x3f5231)=>{this['prompt']=_0x3f5231;const _0x1a8d88=_0x2f8e1d(_0x3f5231);this['fire']('submitPrompt',_0x1a8d88),_0x3f5231['trim']()&&this['_promptHistory']['add']({'prompt':_0x1a8d88},0x0);},{'priority':'high'}),_0x411593;}['_createHistoryView'](){const _0x2b2fa8=new AIHistoryListView(this['locale']);return _0x2b2fa8['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x2b2fa8['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2b2fa8;}['_createToolbar'](){const _0x24b350=new AIFormToolbarView(this['locale']);return _0x24b350['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x29e0bc,_0x598d7d,_0xe477a5)=>_0x29e0bc&&!_0x598d7d&&!!_0xe477a5),_0x24b350['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x24b350['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x55a0f1,_0x4740dc,_0x441fc9)=>_0x55a0f1&&!_0x4740dc&&!!_0x441fc9),_0x24b350['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x24b350['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x294034,_0xfa68c9)=>_0x294034&&!_0xfa68c9),_0x24b350['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x24b350['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x24b350['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x24b350;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x36b05b=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x36b05b,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x40bd36){const _0xf00e50=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x40bd36||Si(_0xf00e50,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x1fd9d0{['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[_0x3ab959,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x205f57){super(_0x205f57),_0x205f57['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x205f57['config']['define']('ai.assistant.contentAreaCssClass',''),_0x205f57['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x205f57['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x2818b6}=this;this['_aiAdapter']=_0x2818b6['plugins']['get'](AIAdapter),this['_dialog']=_0x2818b6['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x385841=new ShowAIAssistantCommand(_0x2818b6,Array['from'](this['_commandDefinitions']['values']()));_0x2818b6['commands']['add']('showAIAssistant',_0x385841),_0x2818b6['ui']['componentFactory']['add']('aiCommands',_0x4854ee=>{const _0x3bf6b4=Ft(_0x4854ee);return _0x3bf6b4['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x3bf6b4['buttonView']['set']({'label':Si(_0x4854ee,'AI\x20Commands'),'icon':_0x5e59dc,'tooltip':!0x0}),_0x3bf6b4['on']('execute',_0x1efb2b=>this['_onExecute'](_0x1efb2b['source']['id'])),Wt(_0x3bf6b4,_0x2818b6['ui']['view']['body'],function(_0x5525ef){const _0x250a06=fi(_0x5525ef['config']['get']('ai.assistant.commands'),_0x5525ef['locale']),_0x26aef0=Pi(_0x5525ef,_0x250a06)['filter'](_0x2a829b=>_0x2a829b['commands']['length']);if(0x1===_0x26aef0['length'])return Pi(_0x5525ef,_0x26aef0[0x0]['commands'])['map'](_0x42f2d9=>({'id':_0x42f2d9['id'],'label':_0x42f2d9['label']}));return _0x26aef0['map'](_0x47d9f5=>{const {groupId:_0x565b1f,groupLabel:_0x4b28ec,commands:_0x2720f7}=_0x47d9f5,_0x17ed6b=Pi(_0x5525ef,_0x2720f7)['map'](_0xf31970=>({'id':_0xf31970['id'],'label':_0xf31970['label']}));return{'id':_0x565b1f,'menu':_0x4b28ec||_0x565b1f,'children':_0x17ed6b};});}(_0x2818b6),{'ariaLabel':Si(_0x4854ee,'AI\x20Commands')}),_0x3bf6b4['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x385841['on']('change:enabledCommandsIds',_0x194855),_0x3bf6b4['menuView']['once']('render',_0x194855),_0x3bf6b4;function _0x194855(){_0x3bf6b4['isEnabled']=_0x385841['enabledCommandsIds']['length']>0x0;for(const _0x403006 of _0x3bf6b4['menuView']['buttons'])_0x403006['isEnabled']=_0x385841['enabledCommandsIds']['includes'](_0x403006['id']);}}),_0x2818b6['ui']['componentFactory']['add']('menuBar:aiCommands',_0x34b924=>{const _0x2d6561=new Kt(_0x34b924);_0x2d6561['buttonView']['set']({'label':Si(_0x34b924,'AI\x20Commands'),'icon':_0x5e59dc}),_0x2d6561['bind']('isEnabled')['to'](_0x385841,'enabledCommandsIds',_0x43a386=>_0x43a386['length']>0x0);const _0x3f6960=fi(_0x2818b6['config']['get']('ai.assistant.commands'),_0x34b924);return this['_populateMenuBarMenu'](_0x385841,_0x2d6561,_0x3f6960,_0xc5093a=>this['_onExecute'](_0xc5093a)),_0x2d6561;}),_0x2818b6['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x35cb5f=this['_createAIAssistantUIButton'](yt);return _0x35cb5f['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x35cb5f;}),_0x2818b6['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0xb1c238=this['_createAIAssistantUIButton'](Yt);return _0xb1c238['set']({'role':'menuitemcheckbox'}),_0xb1c238;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x32c176=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x260ac7;for(const _0x228b86 in _0x32c176){const _0x5039bc=_0x228b86,_0x2ed12b=_0x32c176[_0x5039bc];if('aiLicenseKeyValid'==_0x2ed12b||'aiLicenseKeyInvalid'==_0x2ed12b||'aiLicenseKeyExpired'==_0x2ed12b||'aiLicenseKeyDomainLimit'==_0x2ed12b||'aiLicenseKeyNotAllowed'==_0x2ed12b||'aiLicenseKeyEvaluationLimit'==_0x2ed12b||'aiLicenseKeyUsageLimit'==_0x2ed12b){delete _0x32c176[_0x5039bc],_0x260ac7=_0x2ed12b,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x260ac7&&_0x32c176['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x260ac7&&_0x32c176['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x260ac7&&_0x32c176['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x260ac7&&_0x32c176['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x260ac7&&_0x32c176['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x260ac7&&_0x32c176['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x3379c2='',_0x3171b6='',_0x41ec9e='custom'){const _0x45e7f4=this['editor'],_0x172686=_0x45e7f4['editing']['view'],_0x1a1518=_0x45e7f4['plugins']['get'](AIAssistantEditing),_0x1c039c=_0x45e7f4['plugins']['get'](_0x3ab959);_0x1a1518['showFakeVisualSelection']();const _0x5b0a74=new xi(),_0x201c9d=new ClipboardEvent('copy',{'clipboardData':_0x5b0a74}),_0x1dff34=new _0x5cfddb(_0x5b0a74),_0x166342=new _0x168c0b(_0x172686,_0x201c9d,{'dataTransfer':_0x1dff34});_0x1c039c['_forceMarkersCopy']('comment',()=>{_0x172686['document']['fire']('copy',_0x166342);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x45e7f4,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x56d9dd=_0x1dff34['getData']('text/html');const _0x258ac9=_0x45e7f4['model']['document']['selection'],_0x4b0b06=Array['from'](_0x258ac9['getRanges']());0x1===_0x4b0b06['length']&&_0x4b0b06[0x0]['isFlat']&&!_0x258ac9['getSelectedElement']()&&''!==_0x56d9dd['replace'](/&nbsp;/g,'')['trim']()&&(_0x56d9dd='<p>'+_0x56d9dd+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x41ec9e,'query':_0x3379c2,'htmlContent':_0x56d9dd,'label':_0x3171b6,'mainActionLabel':ki[_0x45e7f4['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x53ffa9,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x1a1518['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x315424=new Map(),_0x66dfb2=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x3c9a31 of _0x66dfb2)for(const _0x3e744e of _0x3c9a31['commands'])_0x315424['set'](_0x3e744e['id'],{..._0x3e744e,'groupId':_0x3c9a31['groupId'],'groupLabel':_0x3c9a31['groupLabel']||_0x3c9a31['groupId']});return _0x315424;}['_createAIAssistantUIButton'](_0x4c2a77){const _0x8b6bcf=this['editor'],_0x4230a5=_0x8b6bcf['commands']['get']('showAIAssistant'),_0x2957e5=new _0x4c2a77(_0x8b6bcf['locale']);return _0x2957e5['set']({'label':Si(_0x8b6bcf['locale'],'AI\x20Assistant'),'icon':_0x53ffa9,'isToggleable':!0x0}),_0x2957e5['bind']('isEnabled')['to'](_0x4230a5),_0x2957e5['bind']('isOn')['to'](this['_dialog'],'id',_0x115e45=>'aiAssistant'===_0x115e45),this['listenTo'](_0x2957e5,'execute',()=>{_0x2957e5['isOn']?this['hideUI']():_0x4230a5['execute']();}),_0x2957e5;}['_initView'](){const _0x5e7cdd=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(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',()=>{_0x5e7cdd['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x5e7cdd['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x5e7aeb,ui:{ariaLiveAnnouncer:_0xb6754d}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x1e0d4f,_0xe0231e,_0x4d1425)=>{const _0x4485fa=this['_aiAssistantController']['currentContext'];_0x4d1425?_0xb6754d['announce'](Si(_0x5e7aeb,'AI\x20is\x20writing')):_0x4485fa&&_0xb6754d['announce'](Si(_0x5e7aeb,'Generated\x20content:\x20%0',_0x4485fa),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x47d1fd,_0x2a9b90,_0x302f9e)=>{if(_0x302f9e){const _0x9ba16a=this['_formView']['errorView']['text'];_0xb6754d['announce'](Si(_0x5e7aeb,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x9ba16a));}});}['_onExecute'](_0x183c16){const _0x4e337e=this['_commandDefinitions']['get'](_0x183c16),_0x1814dd=this['editor'],_0x328b79=_0x1814dd['model']['document']['selection'],_0xfb9dbc=_0x1814dd['commands']['get']('showAIAssistant'),_0x35630d=_0x1814dd['plugins']['get'](AIAssistantEditing),_0x179db9=''+(_0x4e337e['groupId']!==Ti?_0x4e337e['groupLabel']+':\x20':'')+_0x4e337e['label'];if(!0x1!==_0x4e337e['requiresContent']&&_0x328b79['isCollapsed']){const _0x1aa4a5=gt(_0x328b79['getSelectedBlocks']())||_0x1814dd['model']['schema']['getLimitElement'](_0x328b79);_0x1814dd['model']['change'](_0x50e91e=>{_0x50e91e['setSelection'](_0x1aa4a5,'in');});}_0x35630d['showFakeVisualSelection'](),_0xfb9dbc['execute'](_0x4e337e['prompt'],_0x179db9,'command:'+_0x183c16);}['_populateMenuBarMenu'](_0x19005b,_0x32769b,_0x488024,_0x18b81d){const _0x4e78d6=this['editor'],_0x5d6263=_0x4e78d6['locale'],_0x35a3fc=new qt(_0x5d6263),_0x44e398=Pi(_0x4e78d6,_0x488024)['filter'](_0x469081=>_0x469081['commands']['length']);0x1===_0x44e398['length']?this['_getMenuBarGroupButtons']({'command':_0x19005b,'commands':_0x44e398[0x0]['commands'],'parentMenuView':_0x32769b,'onExecute':_0x18b81d})['forEach'](_0xf883cd=>_0x35a3fc['items']['add'](_0xf883cd)):_0x44e398['forEach'](({groupId:_0x169804,groupLabel:_0x137eed,commands:_0x33bd94})=>{const _0x3de619=new Qt(_0x5d6263,_0x32769b),_0x519443=new Kt(_0x5d6263),_0xe711fd=new qt(_0x5d6263),_0x3e2919=this['_getMenuBarGroupButtons']({'command':_0x19005b,'commands':_0x33bd94,'parentMenuView':_0x519443,'onExecute':_0x18b81d});_0x519443['buttonView']['set']({'label':_0x137eed||_0x169804}),_0x519443['delegate']('execute')['to'](_0x32769b),_0xe711fd['items']['addMany'](_0x3e2919),_0x519443['panelView']['children']['add'](_0xe711fd),_0x3de619['children']['add'](_0x519443),_0x35a3fc['items']['add'](_0x3de619);}),_0x32769b['panelView']['children']['add'](_0x35a3fc);}['_getMenuBarGroupButtons']({command:_0x115321,commands:_0x546a2d,parentMenuView:_0x41f2ba,onExecute:_0x46ba2c}){const _0x316391=this['editor'],_0x487f85=_0x316391['locale'];return Pi(_0x316391,_0x546a2d)['map'](_0x30c53b=>{const _0x12f199=new Qt(_0x487f85,_0x41f2ba),_0x19a15a=new Yt(_0x487f85);return _0x19a15a['set']({'label':_0x30c53b['label']}),_0x19a15a['delegate']('execute')['to'](_0x41f2ba),_0x19a15a['on']('execute',()=>_0x46ba2c(_0x30c53b['id'])),_0x19a15a['bind']('isEnabled')['to'](_0x115321,'enabledCommandsIds',_0x1f5982=>_0x1f5982['includes'](_0x30c53b['id'])),_0x12f199['children']['add'](_0x19a15a),_0x12f199;});}}function Li(_0x49aa02,_0x32ea84){return void 0x0!==_0x49aa02['order']&&void 0x0===_0x32ea84['order']?0x1:void 0x0===_0x49aa02['order']&&void 0x0!==_0x32ea84['order']?-0x1:void 0x0!==_0x49aa02['order']&&void 0x0!==_0x32ea84['order']?_0x49aa02['order']-_0x32ea84['order']:0x0;}function Pi(_0x15f39e,_0x3bddba){_0x3bddba['sort'](Li);const _0x3154da={},_0xe749bc=[];for(const _0x7279ac of _0x3bddba)if(void 0x0!==_0x7279ac['order']){if(_0x7279ac['order']in _0x3154da)throw new ht('ai-commands-config-order-collision',_0x15f39e,{'conflictingDefinitions':[_0x7279ac,_0x3154da[_0x7279ac['order']]]});_0x3154da[_0x7279ac['order']]=_0x7279ac,_0xe749bc['splice'](_0x7279ac['order'],0x0,_0x7279ac);}else _0xe749bc['push'](_0x7279ac);return _0xe749bc;}class AIAssistant extends _0x1fd9d0{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x903119){super(_0x903119);const _0x4d8d43=_0x903119['config'],_0x7e44f3=_0x903119['locale'];_0x4d8d43['define']('ai.assistant.preserveComments',!0x0),_0x4d8d43['define']('ai.assistant.commands',Di(_0x7e44f3)),_0x4d8d43['define']('ai.assistant.extraCommandGroups',[]),_0x4d8d43['define']('ai.assistant.removeCommands',[]);let _0x1fd73d=fi(_0x4d8d43['get']('ai.assistant.commands'),_0x7e44f3);const _0x1a2450=_0x4d8d43['get']('ai.assistant.extraCommandGroups'),_0x42aaba=_0x4d8d43['get']('ai.assistant.removeCommands');_0x1a2450['forEach'](_0x195503=>{const _0x4b1df5=_0x1fd73d['find'](_0x208ce6=>_0x208ce6['groupId']===_0x195503['groupId']);_0x4b1df5?_0x4b1df5['commands']=_0x4b1df5['commands']['concat'](_0x195503['commands']):_0x1fd73d['push'](_0x195503);}),_0x1fd73d=_0x1fd73d['filter'](_0x4d85d6=>!_0x42aaba['includes'](_0x4d85d6['groupId'])),_0x1fd73d['forEach'](_0x47fe85=>{_0x47fe85['commands']=_0x47fe85['commands']['filter'](_0x4ac303=>!_0x42aaba['includes'](_0x4ac303['id']));}),_0x4d8d43['set']('ai.assistant.commands',_0x1fd73d);}}function Di(_0x17247f){return[{'groupId':'editOrReview','groupLabel':Si(_0x17247f,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x17247f,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x17247f,'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':Si(_0x17247f,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x17247f,'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':Si(_0x17247f,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x17247f,'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':Si(_0x17247f,'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':Si(_0x17247f,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x17247f,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x17247f,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x17247f,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x17247f,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x17247f,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x17247f,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x17247f,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x17247f,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x17247f,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x17247f,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x17247f,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x17247f,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x17247f,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x17247f,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x17247f,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x17247f,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x17247f,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x17247f,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x17247f,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x1fd9d0{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x5a8af2){super(_0x5a8af2),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x3f5674){return this['sendRequest'](_0x3f5674)['catch'](_0x40d05a=>{if(_0x40d05a instanceof AIRequestError)return Promise['reject'](_0x40d05a);if('AbortError'==_0x40d05a['name'])return Promise['resolve']();throw console['error'](_0x40d05a),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x48b99e,_0x5cf801){const _0xf69719=this['editor']['locale'],_0x52ccf0={'Content-Type':'application/json'};if('object'==typeof _0x48b99e)Object['assign'](_0x52ccf0,_0x48b99e);else{if(_0x48b99e)try{const _0x3936ee=await _0x48b99e(_0x5cf801);Object['assign'](_0x52ccf0,_0x3936ee);}catch{return Promise['reject'](new AIRequestError(Si(_0xf69719,'AI_ERROR_GET_HEADERS')));}}return _0x52ccf0;}async['_prepareRequestParameters'](_0x46d6ba,_0x955086){const _0x1c8f5b=this['editor']['locale'];if('object'==typeof _0x46d6ba)return _0x46d6ba;try{return await _0x46d6ba(_0x955086);}catch{return Promise['reject'](new AIRequestError(Si(_0x1c8f5b,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x20c88f){super(_0x20c88f),_0x20c88f['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x20c88f['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x20c88f['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x20c88f['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x20c88f['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x20c88f['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x318de4,context:_0x34d31f,onData:_0x4a903f,actionId:_0x386608}){const _0x1c75e7=this['editor']['locale'],_0x31fc61=await this['prepareMessages'](_0x318de4,_0x34d31f,_0x386608),_0x35323e=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x386608),_0x2dc2db=await this['_prepareRequestParameters'](this['_requestParameters'],_0x386608),_0x41d567={'messages':_0x31fc61,..._0x2dc2db},_0xc9bb9b={'method':'POST','headers':_0x35323e,'body':JSON['stringify'](_0x41d567),'signal':this['abortController']['signal']},_0x15d4e5=await fetch(this['_apiUrl'],_0xc9bb9b);if(_0x15d4e5['ok'])return _0x2dc2db['stream']?await this['_readStreamableResponse'](_0x15d4e5,_0x4a903f):await this['_readStaticResponse'](_0x15d4e5,_0x4a903f),Promise['resolve']();{const _0x467592=await _0x15d4e5['text']();return _0x467592['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x1c75e7,'AI_ERROR_CONTEXT_LENGTH'))):_0x467592['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x1c75e7,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x467592));}}async['prepareMessages'](_0x4ee05c,_0x2587fc,_0x46acc2){let _0x15a09d,_0x50101a;return _0x2587fc?(_0x15a09d='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.',_0x50101a='Instruction:\x0a'+_0x4ee05c+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x2587fc):(_0x15a09d='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.',_0x50101a=_0x4ee05c),[{'role':'system','content':_0x15a09d},{'role':'user','content':_0x50101a}];}async['_readStreamableResponse'](_0x39b821,_0xbc714f){const _0x404464=_0x39b821['body']['getReader'](),_0x50a303=new TextDecoder();let _0x86a486='',_0x21cc49='',_0x76f4ae='',_0x53264e=!0x1;for(;!_0x53264e;){const {done:_0x167db0,value:_0x100d19}=await _0x404464['read'](),_0x54e74b=_0x86a486+_0x50a303['decode'](_0x100d19);let _0xaf47d8='';_0x53264e=_0x167db0;try{_0xaf47d8=this['_cleanUpData'](_0x54e74b),_0x86a486='';}catch{_0x86a486=_0x54e74b;continue;}_0x21cc49+=_0xaf47d8,!_0x53264e&&this['_isBufferIncomplete'](_0x21cc49)||_0x21cc49&&(_0x76f4ae+=_0x21cc49,_0x21cc49='',_0xbc714f(_0x76f4ae));}return Promise['resolve']();}async['_readStaticResponse'](_0x4e86ac,_0x166ae2){return _0x166ae2((await _0x4e86ac['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x5acba2){const _0x15a5fd=_0x5acba2['split']('<')['length']!==_0x5acba2['split']('>')['length'],_0x12cc5a=_0x5acba2['length']<0x1e;return _0x15a5fd&&_0x12cc5a;}['_cleanUpData'](_0xd3bee){return _0xd3bee['split'](/\n(?![^{]*\})/g)['map'](_0x42a64a=>_0x42a64a['replace']('data:\x20',''))['filter'](_0xafe225=>_0xafe225&&_0xafe225['length']>0x0&&'[DONE]'!==_0xafe225)['map'](_0x58117c=>{const {choices:_0x104f64}=JSON['parse'](_0x58117c);if(_0x104f64[0x0]?.['delta']?.['content'])return _0x104f64[0x0]['delta']['content'];})['filter'](_0x452f29=>_0x452f29)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x19d3b0){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x283597,_0x4cc630={}){super(_0x283597),this['isToggleable']=!0x0,this['set']('side',_0x4cc630['side']||'top');const _0x34f0b5=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x4cc630['class']||[]),_0x34f0b5['to']('side',_0x2b1fa2=>'ck-tab-button_'+_0x2b1fa2),_0x34f0b5['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x4f4421,_0x5150dd={}){super(_0x4f4421);const _0x4c9ac2=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x5150dd['class']||[]),_0x4c9ac2['to']('class'),_0x4c9ac2['if']('isVisible','ck-hidden',_0x3dbc9c=>!_0x3dbc9c)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x1f3726,_0x671518={}){super(_0x1f3726),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x671518['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x671518['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x13bef0,_0x4a4850)=>_0x13bef0&&null!==_0x4a4850);const _0x352df7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x671518['class']||[]),_0x352df7['to']('side',_0x210e57=>'ck-tabs_'+_0x210e57),_0x352df7['to']('class'),_0x352df7['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x352df7['to']('activeTab',_0x3d6bd3=>null===_0x3d6bd3?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x352df7['to']('side',_0x4b1b11=>'ck-tabs__buttons-container_'+_0x4b1b11)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x352df7['to']('side',_0x322df7=>'ck-tabs__panels-container_'+_0x322df7)]},'children':this['panelViews']},...mt(_0x671518['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x260181){const _0x2572c1=this['_tabs']['get'](_0x260181);return _0x2572c1||null;}['addTab'](_0x51ae66){const _0x563ba7=this['_setupButton']({'id':_0x51ae66['id'],'label':_0x51ae66['buttonLabel'],'icon':_0x51ae66['buttonIcon'],'order':_0x51ae66['order']}),_0x2c6744=new TabPanelView(this['locale']);return _0x2c6744['render'](),_0x51ae66['content']&&_0x2c6744['children']['add'](_0x51ae66['content']),this['panelViews']['add'](_0x2c6744),this['_tabs']['set'](_0x51ae66['id'],{'button':_0x563ba7,'panel':_0x2c6744,'order':void 0x0!==_0x51ae66['order']?_0x51ae66['order']:null}),this['fire']('addTab:'+_0x51ae66['id'],{'id':_0x51ae66['id'],'button':_0x563ba7,'panel':_0x2c6744}),null===this['activeTab']?this['activateTab'](_0x51ae66['id']):this['_hidePanel'](_0x51ae66['id']),{'button':_0x563ba7,'panel':_0x2c6744};}['activateTab'](_0x306177){if(null!==_0x306177&&!this['getTab'](_0x306177))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x306177});if(this['activeTab']===_0x306177)return;const _0x5d6b19=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x306177,_0x306177&&this['_showPanel'](_0x306177),this['fire']('activateTab:'+_0x306177,{'newTab':_0x306177,'oldTab':_0x5d6b19});}['toggleTabPanel'](_0x5b9a28){if(!this['getTab'](_0x5b9a28))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5b9a28});this['activeTab']===_0x5b9a28?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x5b9a28);}['showTab'](_0x2fef3f){if(!this['getTab'](_0x2fef3f))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2fef3f});this['_showPanel'](_0x2fef3f),this['_showButton'](_0x2fef3f),this['fire']('show:'+_0x2fef3f,_0x2fef3f);}['hideTab'](_0x1bc093){if(!this['getTab'](_0x1bc093))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x1bc093});const _0x157105=this['activeTab'];this['_hidePanel'](_0x1bc093),this['_hideButton'](_0x1bc093);const _0x336652=this['getTabIds']();_0x157105===_0x1bc093&&_0x336652['length']>0x1&&this['activateTab'](_0x336652['find'](_0x511313=>_0x511313!==_0x1bc093)),this['fire']('hide:'+_0x1bc093,_0x1bc093);}['_getPanel'](_0x1ca7b5){const _0x1f0bc4=this['_tabs']['get'](_0x1ca7b5);return _0x1f0bc4?_0x1f0bc4['panel']:null;}['_showPanel'](_0x10b957){null!==this['activeTab']&&this['activeTab']!==_0x10b957||this['_getPanel'](_0x10b957)['show']();}['_hidePanel'](_0x7812d7){const _0x4d0e3c=this['_getPanel'](_0x7812d7);_0x4d0e3c['isVisible']&&(this['activeTab']===_0x7812d7&&(this['activeTab']=null),_0x4d0e3c['hide']());}['_getButton'](_0x528d88){const _0xfd87a4=this['_tabs']['get'](_0x528d88);return _0xfd87a4?_0xfd87a4['button']:null;}['_showButton'](_0x243ef5){this['_getButton'](_0x243ef5)['show']();}['_hideButton'](_0x1dea34){this['_getButton'](_0x1dea34)['hide']();}['_setupButton'](_0x459c83){const _0x2afa58=new TabButtonView(this['locale'],{'side':this['side']}),_0x3cde18=this['buttonViews'];if(_0x2afa58['set']({'label':_0x459c83['label'],'icon':_0x459c83['icon'],'tooltip':!0x0,'withText':!0x0}),_0x2afa58['bind']('isOn')['to'](this,'activeTab',_0x1ab18e=>_0x1ab18e===_0x459c83['id']),_0x2afa58['bind']('side')['to'](this,'side'),_0x459c83['order']){const _0x5728a5=[...this['_tabs']]['reduce']((_0x3e0914,_0x4d6574)=>{const _0x53ed85=_0x4d6574[0x0],{order:_0x35b47b}=_0x4d6574[0x1];return!_0x35b47b||_0x35b47b>_0x459c83['order']?_0x3e0914:_0x35b47b>=_0x3e0914['order']?{'id':_0x53ed85,'order':_0x35b47b}:_0x3e0914;},{'id':'','order':0x0}),_0x33cad8=_0x3cde18['getIndex'](this['_getButton'](_0x5728a5['id']));_0x3cde18['add'](_0x2afa58,_0x33cad8+0x1);}else _0x3cde18['add'](_0x2afa58);return _0x2afa58['on']('execute',()=>{this['toggleTabPanel'](_0x459c83['id']);}),_0x2afa58;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x51263e,_0x238b2b={}){super(_0x51263e,_0x238b2b),this['set']('type',_0x238b2b['type']||'sidebar'),this['set']('side',_0x238b2b['side']||'right'),this['set']('isVisible',_0x238b2b['visibleByDefault']??!0x0);const _0x2ef4e2=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x2ef4e2['if']('type','ck-ai-tabs__overlay',_0x275ad0=>'overlay'===_0x275ad0),_0x2ef4e2['if']('type','ck-ai-tabs__sidebar',_0x2fc94c=>'sidebar'===_0x2fc94c),_0x2ef4e2['if']('isVisible','ck-hidden',_0x45920c=>!_0x45920c)]}}),this['buttonViews']['on']('add',(_0x324235,_0x35e386)=>{_0x35e386['set']('withText',!0x1);});}}class AITabs extends _0x21ae07{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x47ba4a){if(super(_0x47ba4a),!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 _0x3b6579=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x3b6579['showResizeButton']&&(this['showResizeButton']=_0x3b6579['showResizeButton']),'sidebar'!==_0x3b6579['type']&&'overlay'!==_0x3b6579['type']||_0x3b6579['side']&&(this['side']=_0x3b6579['side']),'sidebar'===_0x3b6579['type']){if(this['container']=_0x3b6579['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x3b6579['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x3b6579['visibleByDefault'],'collapsible':_0x3b6579['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 _0x1d8ba0&&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'](_0x52bebb){if(_0x52bebb&&this['type']!==_0x52bebb){if(!Vi['includes'](_0x52bebb))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x52bebb;}}['switchSide'](_0x1ce89c){if(_0x1ce89c&&this['side']!==_0x1ce89c){if(!Hi['includes'](_0x1ce89c))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x1ce89c;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x21ae07{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x48a108];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x13f853){if(super(_0x13f853),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 _0x3b1b0e=this['context']['plugins']['get'](_0x48a108);if(!_0x3b1b0e['token'])throw new ht('ai-missing-token',this);this['_token']=_0x3b1b0e['token'];}['startConversation'](_0x5e031b,_0x122a35){const _0x31f175=this['_sendApiRequest']('/conversations','POST',{'id':_0x5e031b,'group':_0x122a35});return{'getConversation':async()=>(await _0x31f175['request'])['json'](),'abortController':_0x31f175['abortController']};}['queryAssistant']({message:_0x381714,conversationId:_0x5f1513,parts:_0x4e5fdc,capabilities:_0x2a6127,model:_0x1f277b,attributes:_0x57af97}){const _0x3100b2={'prompt':_0x381714,'content':_0x4e5fdc,'model':_0x1f277b,..._0x2a6127&&{'capabilities':_0x2a6127},..._0x57af97&&{'attributes':_0x57af97}},_0x30a9b6=this['_sendApiRequest']('/conversations/'+_0x5f1513+'/messages','POST',_0x3100b2,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x31c2ea=(await _0x30a9b6['request'])['body'];return this['_getStreamReader'](_0x31c2ea);},'abortController':_0x30a9b6['abortController']};}['executeCustomAction']({content:_0x2d912d,message:_0x548df4,model:_0x2f63ca,outputFormat:_0x8fb0a2}){const _0x3a80c5={'content':[{'type':'text','content':_0x2d912d}],'prompt':_0x548df4,'model':_0x2f63ca,'outputFormat':_0x8fb0a2},_0x391bda=this['_sendApiRequest']('/actions/custom/calls','POST',_0x3a80c5);return{'getStream':async()=>{const _0x37150f=(await _0x391bda['request'])['body'];return this['_getStreamReader'](_0x37150f);},'abortController':_0x391bda['abortController']};}['executeAction']({actionName:_0x48557f,content:_0x21b2c9,args:_0x4a5b92}){const _0x2f2041={'content':[{'type':'text','content':_0x21b2c9}],'args':_0x4a5b92},_0x272565=this['_sendApiRequest']('/actions/system/'+_0x48557f+'/calls','POST',_0x2f2041);return{'getStream':async()=>{const _0x40968c=(await _0x272565['request'])['body'];return this['_getStreamReader'](_0x40968c);},'abortController':_0x272565['abortController']};}['uploadFile'](_0x50ec29,_0x51bdf1,_0x59dc79){const _0xf90215=new FormData();_0xf90215['append']('file',_0x51bdf1,_0x51bdf1['name']),_0x59dc79&&_0xf90215['append']('attributes',JSON['stringify'](_0x59dc79));const _0x42d38e=this['_sendApiRequest']('/conversations/'+_0x50ec29+'/files','POST',_0xf90215);return{'getId':async()=>(await _0x42d38e['request'])['json'](),'abortController':_0x42d38e['abortController']};}['fetchDocument'](_0x1c2fd1,_0xb7f414){const _0x270a93=this['_sendApiRequest']('/conversations/'+_0x1c2fd1+'/documents/'+_0xb7f414,'GET');return{'getDocument':async()=>(await _0x270a93['request'])['json'](),'abortController':_0x270a93['abortController']};}['uploadDocument'](_0x373e29,_0x549513,_0x3fd37a){const _0x465e23={'content':_0x549513};_0x3fd37a&&(_0x465e23['attributes']=_0x3fd37a);const _0x11d88a=this['_sendApiRequest']('/conversations/'+_0x373e29+'/documents','POST',_0x465e23);return{'getId':async()=>(await _0x11d88a['request'])['json'](),'abortController':_0x11d88a['abortController']};}['uploadDocuments'](_0x3761c3,_0x47ebec){const _0x5f18be={'documents':_0x47ebec['map'](_0x3af506=>({'content':_0x3af506['content'],'attributes':{'version':_0x3af506['version'],'sessionId':_0x3af506['sessionId'],'channelId':_0x3af506['channelId'],'rootName':_0x3af506['rootName'],'selections':_0x3af506['selections']},...void 0x0!==_0x3af506['name']?{'name':_0x3af506['name']}:{},...void 0x0!==_0x3af506['description']?{'description':_0x3af506['description']}:{}}))},_0x166d0a=this['_sendApiRequest']('/conversations/'+_0x3761c3+'/documents/batch','POST',_0x5f18be);return{'getIds':async()=>(await _0x166d0a['request'])['json'](),'abortController':_0x166d0a['abortController']};}['fetchDocuments'](_0x24bee2,_0x28f032){const _0x2fdad7=new URLSearchParams();_0x2fdad7['append']('documentIds',_0x28f032['join'](','));const _0x1d9750=this['_sendApiRequest']('/conversations/'+_0x24bee2+'/documents/batch?'+_0x2fdad7['toString'](),'GET');return{'getDocuments':async()=>(await _0x1d9750['request'])['json'](),'abortController':_0x1d9750['abortController']};}['fetchConversations'](_0x22be3c,_0x268db6={}){const _0x38077b=new URLSearchParams();_0x38077b['append']('group',_0x22be3c),_0x38077b['append']('excludeEmpty',!0x1!==_0x268db6['excludeEmpty']?'true':'false'),_0x38077b['append']('limit',_0x268db6['limit']?_0x268db6['limit']['toString']():'100'),_0x38077b['append']('sortBy',_0x268db6['sortBy']?_0x268db6['sortBy']:'createdAt'),_0x38077b['append']('order',_0x268db6['order']?_0x268db6['order']:'desc');const _0xb67719=this['_sendApiRequest']('/conversations?'+_0x38077b['toString'](),'GET');return{'getConversations':async()=>{const _0x5b191c=await _0xb67719['request'];return(await _0x5b191c['json']())['items'];},'abortController':_0xb67719['abortController']};}['deleteConversation'](_0x1e7067){const _0x5bafe7=this['_sendApiRequest']('/conversations/'+_0x1e7067,'DELETE');return{'execute':async()=>{await _0x5bafe7['request'];},'abortController':_0x5bafe7['abortController']};}['updateConversation'](_0x1356a3,_0x3c3d97){const _0x3fbd8f=this['_sendApiRequest']('/conversations/'+_0x1356a3,'PATCH',_0x3c3d97);return{'getResult':async()=>(await _0x3fbd8f['request'],_0x3c3d97),'abortController':_0x3fbd8f['abortController']};}['fetchConversation'](_0x473f97){const _0x3c0146=this['_sendApiRequest']('/conversations/'+_0x473f97,'GET');return{'getConversation':async()=>(await _0x3c0146['request'])['json'](),'abortController':_0x3c0146['abortController']};}['fetchConversationMessages'](_0x4fdf79){const _0x37781d=this['_sendApiRequest']('/conversations/'+_0x4fdf79+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x1677c3=await _0x37781d['request'];return(await _0x1677c3['json']())['items'];},'abortController':_0x37781d['abortController']};}['uploadUrl'](_0x490440,_0x3193b8,_0xdc667c){const _0xa7a5b0=this['_sendApiRequest']('/conversations/'+_0x490440+'/web-resources','POST',{'url':_0x3193b8,'attributes':_0xdc667c});return{'getId':async()=>(await _0xa7a5b0['request'])['json'](),'abortController':_0xa7a5b0['abortController']};}['getModels'](_0x3100ed='en'){const _0x2ec6fd=new URLSearchParams();_0x2ec6fd['append']('language',_0x3100ed);const _0x222066='/models/1?'+_0x2ec6fd['toString'](),_0x339177=this['_sendApiRequest'](_0x222066,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x339177['request'])['json'](),'abortController':_0x339177['abortController']};}['deleteFile'](_0x366b57,_0x38564b){const _0x1acbe4=this['_sendApiRequest']('/conversations/'+_0x366b57+'/files/'+_0x38564b,'DELETE');return{'execute':async()=>{await _0x1acbe4['request'];},'abortController':_0x1acbe4['abortController']};}['deleteDocument'](_0x5a0dca,_0x100b71){const _0x284f98=this['_sendApiRequest']('/conversations/'+_0x5a0dca+'/documents/'+_0x100b71,'DELETE');return{'execute':async()=>{await _0x284f98['request'];},'abortController':_0x284f98['abortController']};}['deleteWebResource'](_0x416b80,_0x34fe3b){const _0x59e13c=this['_sendApiRequest']('/conversations/'+_0x416b80+'/web-resources/'+_0x34fe3b,'DELETE');return{'execute':async()=>{await _0x59e13c['request'];},'abortController':_0x59e13c['abortController']};}['cancelStream'](_0xa474e7,_0x19d29a){const _0x1a0de8=this['_sendApiRequest']('/conversations/'+_0xa474e7+'/messages/'+_0x19d29a+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x1a0de8['request'];},'abortController':_0x1a0de8['abortController']};}['resumeStream'](_0x5c175f,_0x530819,_0x3b0962='0-0'){const _0xd807ab=new URLSearchParams({'lastEventId':_0x3b0962}),_0x35576c=this['_sendApiRequest']('/conversations/'+_0x5c175f+'/messages/'+_0x530819+'/stream?'+_0xd807ab['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x3922a3=await _0x35576c['request'];return this['_getStreamReader'](_0x3922a3['body']);},'abortController':_0x35576c['abortController']};}['callSystemReview']({reviewName:_0xa278b1,content:_0x2d428b,args:_0x123f26}){const _0x53f435=this['_sendApiRequest']('/reviews/system/'+_0xa278b1+'/calls','POST',{'content':[{'type':'text','content':_0x2d428b}],'args':_0x123f26});return{'getStream':async()=>{const _0x4115a0=(await _0x53f435['request'])['body'];return this['_getStreamReader'](_0x4115a0);},'abortController':_0x53f435['abortController']};}['callCustomReview']({content:_0x5007de,prompt:_0x3392b4,model:_0x5bc985}){const _0x46742a=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x5007de}],'prompt':_0x3392b4,'model':_0x5bc985});return{'getStream':async()=>{const _0x1154a8=(await _0x46742a['request'])['body'];return this['_getStreamReader'](_0x1154a8);},'abortController':_0x46742a['abortController']};}['upsertAIChatRating'](_0x37ad28,_0x2301b4,_0x23ed72){const _0x269023=this['_sendApiRequest']('/conversations/'+_0x37ad28+'/messages/'+_0x2301b4+'/ratings','PUT',{'positiveCount':_0x23ed72['positiveCount'],'totalCount':_0x23ed72['totalCount'],'modificationId':_0x23ed72['modificationId']});return{'execute':async()=>{await _0x269023['request'];},'abortController':_0x269023['abortController']};}['upsertAIActionRating'](_0x32fcc3,_0x318cbe,_0x264103){const _0x3e1485=this['_sendApiRequest']('/actions/system/'+_0x32fcc3+'/calls/'+_0x318cbe+'/ratings','PUT',{'positiveCount':_0x264103['positiveCount'],'totalCount':_0x264103['totalCount']});return{'execute':async()=>{await _0x3e1485['request'];},'abortController':_0x3e1485['abortController']};}['upsertCustomAIActionRating'](_0x10bd6b,_0x13a376){const _0x2ac0e6=this['_sendApiRequest']('/actions/custom/calls/'+_0x10bd6b+'/ratings','PUT',{'positiveCount':_0x13a376['positiveCount'],'totalCount':_0x13a376['totalCount']});return{'execute':async()=>{await _0x2ac0e6['request'];},'abortController':_0x2ac0e6['abortController']};}['upsertAIReviewRating'](_0x48bac4,_0x4167d2,_0x2ddddf,_0xa51537){const _0x231cf6=this['_sendApiRequest']('/reviews/system/'+_0x48bac4+'/calls/'+_0x4167d2+'/ratings','PUT',{'positiveCount':_0x2ddddf['positiveCount'],'totalCount':_0x2ddddf['totalCount'],'dataId':_0xa51537});return{'execute':async()=>{await _0x231cf6['request'];},'abortController':_0x231cf6['abortController']};}['upsertCustomAIReviewRating'](_0x2d8385,_0x2f48d0,_0x3ff545){const _0x1f36f3=this['_sendApiRequest']('/reviews/custom/calls/'+_0x2d8385+'/ratings','PUT',{'positiveCount':_0x2f48d0['positiveCount'],'totalCount':_0x2f48d0['totalCount'],'dataId':_0x3ff545});return{'execute':async()=>{await _0x1f36f3['request'];},'abortController':_0x1f36f3['abortController']};}['_sendApiRequest'](_0x58ac71,_0x5e4871,_0x5c2f7d,_0x555113={}){const {useCache:_0x1e7b00=!0x1,apiUrl:_0x5b0e5d=this['_apiUrl']}=_0x555113,_0x203150=new AbortController(),_0x3adb4e=_0x1e7b00?_0x5e4871+':'+_0x58ac71:null;if(_0x3adb4e){const _0x15856d=this['_responseCache']['get'](_0x3adb4e);if(_0x15856d)return{'request':_0x15856d['then'](_0x26d87e=>_0x26d87e['clone']()),'abortController':_0x203150};}const _0x463830=_0x5c2f7d instanceof FormData,_0x46620f={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x5c2f7d&&!_0x463830&&(_0x46620f['Content-Type']='application/json');const _0xc27ae6={'method':_0x5e4871,'headers':_0x46620f,'signal':_0x203150['signal']};_0x5c2f7d&&(_0xc27ae6['body']=_0x463830?_0x5c2f7d:JSON['stringify'](_0x5c2f7d));const _0x34ef20=fetch(''+_0x5b0e5d+_0x58ac71,_0xc27ae6)['catch'](_0x5dac0b=>{_0x3adb4e&&this['_responseCache']['delete'](_0x3adb4e),this['_handleError'](_0x5dac0b);})['then'](_0x1318cb=>_0x1318cb['ok']?_0x1318cb:_0x1318cb['json']()['then'](_0x2affc0=>{throw _0x3adb4e&&this['_responseCache']['delete'](_0x3adb4e),{'url':_0x5b0e5d,'path':_0x58ac71,'method':_0x5e4871,'body':_0x5c2f7d,'status':(_0x1318cb||{})['status'],'statusText':(_0x1318cb||{})['statusText'],'code':_0x2affc0['code'],'message':_0x2affc0['message'],'traceId':_0x2affc0['traceId']};}));return _0x3adb4e&&this['_responseCache']['set'](_0x3adb4e,_0x34ef20['then'](_0x18371c=>_0x18371c['clone']())),{'request':_0x34ef20,'abortController':_0x203150};}async*['_getStreamReader'](_0x8eb26b){const _0x179380=[],_0x23313a=_0x8eb26b['getReader'](),_0x149e3b=_0x3f39fe({'onError':_0x117d79=>{this['_handleError'](_0x117d79);},'onEvent':_0x23b457=>{_0x23b457['data']=JSON['parse'](_0x23b457['data']),_0x179380['push'](_0x23b457);}});try{let _0x5e556c=!0x1;for(;!_0x5e556c;){const {done:_0x59912b,value:_0x16b522}=await _0x23313a['read']();_0x59912b&&(_0x5e556c=!0x0),_0x149e3b['feed'](this['_decoder']['decode'](_0x16b522,{'stream':!0x0})),yield*_0x179380,_0x179380['length']=0x0;}}catch(_0x3baa04){this['_handleError'](_0x3baa04);}finally{_0x23313a['releaseLock'](),_0x149e3b['reset']();}}['_handleError'](_0x31e1c1){if(_0x31e1c1 instanceof ht)throw _0x31e1c1;if(_0x31e1c1 instanceof Error&&'AbortError'===_0x31e1c1['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x31e1c1});throw new ht('ai-request-failed',this,{'originalError':_0x31e1c1});}}function Mi(_0x50b2c9,_0x3d1eb8,_0x2c4bad){const t=_0x50b2c9['t'];switch(_0x3d1eb8){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'},_0x2c4bad);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.'},_0x2c4bad);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.'},_0x2c4bad);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.'},_0x2c4bad);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'},_0x2c4bad);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x2c4bad);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'},_0x2c4bad);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.'},_0x2c4bad);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.'},_0x2c4bad);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.'},_0x2c4bad);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.'},_0x2c4bad);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'},_0x2c4bad);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.'},_0x2c4bad);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 _0x3d1eb8;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x37c622,_0x174bf9){const _0x3ee347=new yt(_0x37c622),_0x1f5657=Mi(_0x37c622,'AI_TABS_LABEL_MINIMIZE'),_0x1dcfe1=Mi(_0x37c622,'AI_TABS_LABEL_MAXIMIZE');return _0x3ee347['set']({'withText':!0x1,'icon':_0x7b2340,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x3ee347['bind']('label')['to'](_0x174bf9,'isMaximized',_0x42eb41=>_0x42eb41?_0x1f5657:_0x1dcfe1),_0x3ee347['bind']('icon')['to'](_0x174bf9,'isMaximized',_0x2e1ca5=>_0x2e1ca5?_0x483f10:_0x7b2340),_0x3ee347['bind']('isOn')['to'](_0x174bf9,'isMaximized'),_0x3ee347['on']('execute',()=>{_0x174bf9['fire']('resizeTabs');}),_0x3ee347;}function Wi(_0x2fb8ac,_0x2446c9){return _0x1faf1a(_0x2fb8ac,_0x2446c9);}function Ki(_0x217d6c,_0x3c2a4d){return _0x1441a0(_0x217d6c,_0x3c2a4d);}function Yi(_0x529c83,_0x220cfe,_0x30e519){const _0x24f95d=null!==_0x220cfe?_0x475a50=>_0x475a50['attribs'][_0x529c83]===_0x220cfe:_0x3f460c=>Boolean(_0x3f460c['attribs'][_0x529c83]);return _0x43180a(_0x18de1a=>_0x1b26d5(_0x18de1a)&&_0x24f95d(_0x18de1a),_0x30e519);}function $i(_0x2b0508,_0x382599,_0x363917){const _0x73596=null!==_0x382599?_0xa88e70=>_0xa88e70['attribs'][_0x2b0508]===_0x382599:_0x434cf6=>Boolean(_0x434cf6['attribs'][_0x2b0508]);return _0x4edc31(_0x43f579=>_0x1b26d5(_0x43f579)&&_0x73596(_0x43f579),_0x363917);}function qi(_0x1ffb4c){return _0x4edc31(_0x189a8f=>_0x1b26d5(_0x189a8f)&&function(_0x5d6b7d){const _0x3a7030=_0x5d6b7d['toLowerCase']();return'script'===_0x3a7030||'style'===_0x3a7030||_0x3a7030['includes']('-');}(_0x189a8f['name']),_0x1ffb4c);}function Qi(_0x59ecbf){return _0x3540a9(_0x61d274=>_0x22f44d(_0x61d274),_0x59ecbf,!0x0,0x1/0x0);}function Xi(_0x3024ac,_0x2e4748){return _0x3024ac&&_0x1b26d5(_0x3024ac)?_0x3024ac['attribs'][_0x2e4748]:null;}function zi(_0x370ae2,_0x2f1a08,_0x164137){_0x1b26d5(_0x370ae2)&&(null===_0x164137?delete _0x370ae2['attribs'][_0x2f1a08]:_0x370ae2['attribs'][_0x2f1a08]=_0x164137);}function ji(_0x533bcf,_0x4e330f,_0xc4a071){const _0x60953c=_0x4e330f['cloneNode'](!0x0);'beforebegin'===_0xc4a071?_0x2bd8f5(_0x533bcf,_0x60953c):'afterbegin'===_0xc4a071?_0x15734a(_0x533bcf,_0x60953c):'beforeend'===_0xc4a071?_0x1cf467(_0x533bcf,_0x60953c):'afterend'===_0xc4a071&&_0x962aa(_0x533bcf,_0x60953c);}function Ji(_0x5c14b1){const _0x4aa3cd=[];let _0x582951=_0x5c14b1;for(;_0x582951;)_0x582951=_0xe59de9(_0x582951),_0x582951&&_0x4aa3cd['push'](_0x582951);return _0x4aa3cd;}function Zi(_0x32e9ac){return _0x32e9ac['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x4365a3){let _0x20b8f7=0x0;for(;_0x4365a3['parentNode'];)_0x4365a3=_0x4365a3['parentNode'],_0x20b8f7++;return _0x20b8f7;}function es(_0x1367ca){const _0x596bda=[];let _0x54f739=_0x1367ca['nextSibling'];for(;_0x54f739;)_0x596bda['push'](_0x54f739),_0x54f739=_0x54f739['nextSibling'];_0x596bda['forEach'](_0x54559a=>{_0x1da415(_0x54559a);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
+ ct(){['_m2html'];constructor(){super();const _0x164991=Object['entries'](_0xd184b0),_0x5dfc42=_0x164991['findIndex'](([_0x546c04])=>'rehypeDomRaw'===_0x546c04);if(-0x1===_0x5dfc42)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x164991['splice'](_0x5dfc42+0x1,0x0,['rehypeSanitize',_0x38b678]),this['_m2html']=new _0x367c9e({'plugins':Object['fromEntries'](_0x164991)});}['convertMarkdownToHTML'](_0x4dafd2){const _0x3e3192=this['_m2html']['parse'](_0x4dafd2);return this['parseAndNormalizeHTML'](_0x3e3192);}['parseAndNormalizeHTML'](_0x582c73){return this['_parseHTML'](_0x582c73);}['_parseHTML'](_0x3f32a3){const _0x4f0cf6=Wi('<dummy>'+_0x3f32a3['replace'](/<[^>]*?$/g,'')+'</dummy>');return is(_0x4f0cf6),_0x4f0cf6['children']=_0x4f0cf6['children'][0x0]['children'],_0x4f0cf6;}}function is(_0x220399){for(const _0x4ff5be of _0x220399['children'])_0x1b26d5(_0x4ff5be)?'pre'!==_0x4ff5be['name']&&is(_0x4ff5be):_0x16cddc(_0x4ff5be)&&(_0x4ff5be['data']=_0x4ff5be['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
+ ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x3cabc0){super(),this['_generateUid']=_0x3cabc0||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x296452,_0x109be8,_0xbb4a8c){this['_uidCounter']=0x0;const _0x1dc8ad=_0x296452['cloneNode'](!0x0);rs(_0x109be8,_0x1dc8ad);const _0x3a4c28=_0x1dc8ad['childNodes'],_0x109144=Array['from'](_0x3a4c28)['filter'](_0x559b42=>!(0x3===_0x559b42['nodeType']&&''===Ki(_0x559b42)['trim']())),_0x4f43c8=_0x109144['length'];for(const _0x2e108e of _0x109144)_0x2e108e&&_0x1b26d5(_0x2e108e)&&void 0x0===_0x2e108e['attribs']['data-id']&&zi(_0x2e108e,'data-id','new-element');if(0x0===_0x109be8['childNodes']['length']){const _0x379aa8=[];return $i('data-id','new-element',_0x1dc8ad)['forEach'](_0x3d4a55=>{const _0x2447cc=this['_generateUid']();zi(_0x3d4a55,'data-id',_0x2447cc),_0x379aa8['push'](_0x2447cc);}),this['_removeSpecialComments'](_0x1dc8ad),{'parsedContent':_0x1dc8ad,'newNodeIds':_0x379aa8,'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(),this['_existingDataIds']=new Set($i('data-id',null,_0x109be8)['map'](_0x42501=>Xi(_0x42501,'data-id'))['filter'](_0x2b3534=>!!_0x2b3534));let _0x3be7bd=-0x1,_0xe6eee8=!0x1;for(let _0x7a61cc=0x0;_0x7a61cc<_0x4f43c8;_0x7a61cc++){const _0x4f1bcb=_0x109144[_0x7a61cc],_0x497c7f=_0x109144[_0x7a61cc+0x1];if(this['_isNewNode'](_0x4f1bcb)){if(-0x1===_0x3be7bd&&(_0x3be7bd=_0x7a61cc),this['_markWrappedElements'](_0x4f1bcb),!this['_isNewNode'](_0x497c7f)){const [_0xbbe0f4,_0x118240]=this['_findReferenceNode'](_0x4f1bcb,_0xe6eee8,_0x109be8);if(_0xbbe0f4){const _0x55b811=Array['from'](_0x109144)['slice'](_0x3be7bd,_0x7a61cc+0x1);this['_insertNodes'](_0xbbe0f4,_0x55b811,_0x118240),_0x3be7bd=-0x1;}}}else{if(this['_isExistingContentComment'](_0x4f1bcb))_0xe6eee8=!0x0;else{if(this['_isExistingNode'](_0x4f1bcb)){const _0xa43f92=Xi(_0x4f1bcb,'data-id');if(_0xa43f92&&this['_existingDataIds']['has'](_0xa43f92)){this['_referencedExistingIds']['add'](_0xa43f92);const _0x6ae6ea=Yi('data-id',_0xa43f92,_0x109be8);this['_replaceNode'](_0x6ae6ea,_0x4f1bcb);}}else{if(ss(_0x4f1bcb)){const _0x2ae4fa=ns(_0x4f1bcb);!!Yi('data-id',_0x2ae4fa,_0x1dc8ad)||this['_touchedNodesState']['removedIds']['push'](_0x2ae4fa);}}}}}for(const _0x2e4b8 of this['_touchedNodesState']['removedIds']){const _0x3bcabd=Yi('data-id',_0x2e4b8,_0x109be8);_0x3bcabd&&(this['_rescueUnwrappedElements'](_0x3bcabd),this['_removeNode'](_0x3bcabd,_0x2e4b8,_0xbb4a8c));}if($i('data-id','new-element',_0x109be8)['forEach'](_0x51a9a6=>{const _0x5c3142=this['_getUid'](_0x51a9a6);zi(_0x51a9a6,'data-id',_0x5c3142),this['_touchedNodesState']['newIds']['push'](_0x5c3142);}),this['_removeSpecialComments'](_0x109be8),_0xbb4a8c&&_0xbb4a8c['cutAfterUnstable']){const _0x5bcbd9=this['_findLastConfirmationPoint'](_0x109144),_0x3f02d9=this['_getLastStableElement'](_0x109be8,_0x5bcbd9);this['_markUnstableElements'](_0x109be8,_0x3f02d9);}if(this['_processWrappedElements'](_0x109be8,_0xbb4a8c),_0xbb4a8c&&_0xbb4a8c['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x2eb968=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x109be8);let _0x3ae1c8=_0x2eb968[_0x2eb968['length']-0x1];for(;_0x3ae1c8;)es(_0x3ae1c8),_0x3ae1c8=_0x3ae1c8['parentNode'];}return{'parsedContent':_0x109be8,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x24b949,_0x465fcf,_0x3315ad){for(const _0x43b738 of _0x465fcf){const _0x10899c=this['_getUid'](_0x43b738);zi(_0x43b738,'data-id',_0x10899c),this['_touchedNodesState']['newIds']['push'](_0x10899c),this['_touchedNodesState']['lastTouchedId']=_0x10899c;}const _0x223bd0='afterbegin'===_0x3315ad||'afterend'===_0x3315ad?_0x465fcf['reverse']():_0x465fcf;for(const _0x3ef6bb of _0x223bd0)ji(_0x24b949,_0x3ef6bb,_0x3315ad);}['_replaceNode'](_0x5c4f30,_0x304d15){if(!_0x5c4f30)return;if(_0x13e89d=_0x304d15,Zi(Ki(_0x5c4f30))===Zi(Ki(_0x13e89d)))return;var _0x13e89d;const _0x93566e=Xi(_0x5c4f30,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x93566e),this['_touchedNodesState']['lastTouchedId']=_0x93566e,_0x425be6(_0x5c4f30,_0x304d15['cloneNode'](!0x0));}['_removeNode'](_0x2e9b63,_0x31bb6c,_0x4ec028){if(_0x4ec028&&_0x4ec028['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x31bb6c;const _0x1ae938=_0x4ec028['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x1ae938,'data-id',_0x31bb6c),zi(_0x1ae938,'data-removed','true'),_0x425be6(_0x2e9b63,_0x1ae938);}else _0x1da415(_0x2e9b63);}['_findReferenceNode'](_0x941072,_0x5c8669,_0x147c9d){const _0x404cfe=this['_findPrevElementWithDataId'](_0x941072,!0x1);if(_0x404cfe){const _0x75f0dc=ns(_0x404cfe),_0x7fb8c9=Yi('data-id',_0x75f0dc,_0x147c9d);if(_0x7fb8c9)return[_0x7fb8c9,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x75f0dc);}const _0x41b287=this['_findNextElementWithDataId'](_0x941072,!0x1);if(_0x41b287){const _0x106e48=ns(_0x41b287),_0x94926a=Yi('data-id',_0x106e48,_0x147c9d);if(_0x94926a)return[_0x94926a,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x106e48);}return _0x5c8669?_0x941072['nextSibling']?this['_findFallbackReferenceNode'](_0x941072,_0x147c9d):[_0x147c9d['childNodes'][_0x147c9d['childNodes']['length']-0x1],'afterend']:[_0x147c9d['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x88f9f6,_0x30ca7c){const _0x3db682=[],_0x13cf51=this['_findPrevElementWithDataId'](_0x88f9f6,!0x0);if(_0x13cf51){const _0x1ab9d5=Yi('data-id',ns(_0x13cf51),_0x30ca7c);_0x1ab9d5&&_0x3db682['push']([_0x1ab9d5,'afterend']);}const _0x1560d3=this['_findNextElementWithDataId'](_0x88f9f6,!0x0);if(_0x1560d3){const _0x21aaa7=Yi('data-id',ns(_0x1560d3),_0x30ca7c);_0x21aaa7&&_0x3db682['push']([_0x21aaa7,'beforebegin']);}if(_0x3db682['length']>0x1)return ts(_0x3db682[0x0][0x0])<=ts(_0x3db682[0x1][0x0])?_0x3db682[0x0]:_0x3db682[0x1];return 0x1===_0x3db682['length']?_0x3db682[0x0]:[_0x30ca7c['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x43acb7,_0x341594){let _0x495e43=_0x43acb7['nextSibling'],_0x457a7e=null,_0x3a9892=!0x1;for(;_0x495e43;){if(_0x22f44d(_0x495e43)){if(ss(_0x495e43)&&(_0x457a7e=_0x495e43),this['_isExistingContentComment'](_0x495e43)&&_0x341594&&!_0x3a9892){_0x3a9892=!0x0,_0x495e43=_0x495e43['nextSibling'];continue;}break;}const _0x25a668=Xi(_0x495e43,'data-id');if(_0x25a668&&'new-element'!==_0x25a668&&this['_existingDataIds']['has'](_0x25a668)){_0x457a7e=_0x495e43;break;}_0x495e43=_0x495e43['nextSibling'];}return _0x457a7e;}['_findPrevElementWithDataId'](_0x295403,_0x2b6210){let _0x2e68de=_0x295403['previousSibling'],_0x36a064=null,_0x71a11c=!0x1;for(;_0x2e68de;){if(_0x22f44d(_0x2e68de)){if(ss(_0x2e68de)&&(_0x36a064=_0x2e68de),this['_isExistingContentComment'](_0x2e68de)&&_0x2b6210&&!_0x71a11c){_0x71a11c=!0x0,_0x2e68de=_0x2e68de['previousSibling'];continue;}break;}const _0x131b57=Xi(_0x2e68de,'data-id');if(_0x131b57&&'new-element'!==_0x131b57&&this['_existingDataIds']['has'](_0x131b57)){_0x36a064=_0x2e68de;break;}_0x2e68de=_0x2e68de['previousSibling'];}return _0x36a064;}['_markWrappedElements'](_0x13e682){_0x1b26d5(_0x13e682)&&$i('data-id',null,_0x13e682)['forEach'](_0x16bf68=>{this['_isExistingNode'](_0x16bf68)&&(zi(_0x16bf68,'data-wrapped-id',Xi(_0x16bf68,'data-id')),zi(_0x16bf68,'data-id',null));});}['_processWrappedElements'](_0x4c5799,_0x21350b){$i('data-wrapped-id',null,_0x4c5799)['forEach'](_0x178b7f=>{const _0x3c6eab=Xi(_0x178b7f,'data-wrapped-id');if(this['_hasUnstableParent'](_0x178b7f))return;const _0x3a910e=Yi('data-id',_0x3c6eab,_0x4c5799);zi(_0x178b7f,'data-id',_0x3c6eab),_0x3a910e&&(this['_removeNode'](_0x3a910e,_0x3c6eab,_0x21350b),this['_touchedNodesState']['removedIds']['push'](_0x3c6eab),this['_touchedNodesState']['lastTouchedId']=_0x3c6eab);});}['_hasUnstableParent'](_0x46dba7){let _0x434ac1=_0x46dba7['parentNode'];for(;_0x434ac1;){if(Xi(_0x434ac1,'data-unstable'))return!0x0;_0x434ac1=_0x434ac1['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x3ee021){const _0x3c40f4=new Set(this['_touchedNodesState']['removedIds']),_0x5d0db8=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x3ee021)['forEach'](_0x3d9316=>{const _0x8114c7=Xi(_0x3d9316,'data-id'),_0x3954d6=!!_0x8114c7&&this['_referencedExistingIds']['has'](_0x8114c7),_0x58d6c4=!!_0x8114c7&&_0x5d0db8['has'](_0x8114c7);if(!_0x8114c7||!_0x3954d6&&!_0x58d6c4)return;if(_0x3c40f4['has'](_0x8114c7))return;let _0x15544a=_0x3d9316['parentNode'],_0x48d626=!0x1;for(;_0x15544a;){if(_0x15544a===_0x3ee021){_0x48d626=!0x0;break;}const _0x359e8b=Xi(_0x15544a,'data-id');if(_0x359e8b&&(this['_referencedExistingIds']['has'](_0x359e8b)||_0x5d0db8['has'](_0x359e8b)))return;_0x15544a=_0x15544a['parentNode'];}if(_0x48d626){if(_0x2bd8f5(_0x3ee021,_0x3d9316),_0x3954d6){const _0xe669e2=this['_generateUid'](),_0x31d4c5=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x8114c7);-0x1!==_0x31d4c5&&this['_touchedNodesState']['modifiedIds']['splice'](_0x31d4c5,0x1),zi(_0x3d9316,'data-unwrapped-id',_0x8114c7),zi(_0x3d9316,'data-id',_0xe669e2),this['_touchedNodesState']['newIds']['push'](_0xe669e2),this['_touchedNodesState']['rescuedNewIds']['add'](_0xe669e2),this['_touchedNodesState']['lastTouchedId']=_0xe669e2;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x8114c7),this['_touchedNodesState']['lastTouchedId']=_0x8114c7;}});}['_getUid'](_0x54d5d4){return this['_isExistingNode'](_0x54d5d4)?Xi(_0x54d5d4,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x3b146e){Qi(_0x3b146e)['filter'](_0x44d73e=>ss(_0x44d73e)||this['_isExistingContentComment'](_0x44d73e))['forEach'](_0x267b80=>{_0x1da415(_0x267b80);});}['_findLastConfirmationPoint'](_0x56aadc){let _0x20330e=null,_0x15a480=null,_0x15d643=null,_0x4b46af=null;const _0x4f59b2=_0x20f72d=>{_0x20f72d&&(_0x20330e=_0x20f72d),_0x15d643=null,_0x4b46af=null;};for(let _0x59fb68=0x0;_0x59fb68<_0x56aadc['length'];_0x59fb68++){const _0x596285=_0x56aadc[_0x59fb68];if(this['_isExistingContentComment'](_0x596285)){_0x4f59b2(_0x15a480);continue;}if(_0x1b26d5(_0x596285)){const _0x451c64=Xi(_0x596285,'data-id'),_0x23e5f1=_0x59fb68===_0x56aadc['length']-0x1;if(_0x451c64&&'new-element'!==_0x451c64&&this['_touchedNodesState']['modifiedIds']['includes'](_0x451c64)&&!_0x23e5f1){_0x4f59b2(_0x451c64),_0x15a480=_0x451c64;continue;}}let _0x2f626d=null;const _0x252f43=ns(_0x596285);if(_0x252f43&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x252f43))_0x15a480=_0x252f43;else{if(_0x252f43&&this['_touchedNodesState']['newIds']['includes'](_0x252f43))_0x2f626d='N';else{if(!ss(_0x596285))continue;_0x2f626d='R';}_0x2f626d===_0x4b46af||null===_0x4b46af?_0x4b46af=_0x2f626d:null!==_0x15d643?(_0x4f59b2(_0x15a480),_0x4b46af=_0x2f626d):(_0x15d643=_0x4b46af,_0x4b46af=_0x2f626d),_0x15a480=_0x252f43;}}const _0x3bc4d5=_0x56aadc[_0x56aadc['length']-0x1];return _0x3bc4d5&&!_0x1b26d5(_0x3bc4d5)&&!ss(_0x3bc4d5)&&_0x15a480&&_0x4f59b2(_0x15a480),_0x20330e;}['_getLastStableElement'](_0x51e05b,_0x487281){if(!_0x487281)return null;const _0x1ce1f9=Yi('data-id',_0x487281,_0x51e05b);if(!_0x1ce1f9)return null;const _0x200d82=[_0x1ce1f9,...Ji(_0x1ce1f9)]['at'](-0x2);if(_0x200d82===_0x1ce1f9)return _0x1ce1f9;let _0x2046d3=_0x200d82['previousSibling'];for(;_0x2046d3&&!_0x1b26d5(_0x2046d3);)_0x2046d3=_0x2046d3['previousSibling'];return _0x2046d3;}['_markUnstableElements'](_0x428165,_0x2c5d97){const _0x3a7c01=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0xd9b558=_0x2c5d97?_0x2c5d97['nextSibling']:_0x428165['firstChild'];for(;_0xd9b558;){_0x1b26d5(_0xd9b558)&&((_0x3a7c01['has'](Xi(_0xd9b558,'data-id'))||$i('data-id',null,_0xd9b558)['some'](_0x14eea0=>_0x3a7c01['has'](Xi(_0x14eea0,'data-id'))))&&zi(_0xd9b558,'data-unstable','true')),_0xd9b558=_0xd9b558['nextSibling'];}}['_isNewNode'](_0x364d6b){return Boolean('new-element'===Xi(_0x364d6b,'data-id'));}['_isExistingNode'](_0x588abe){return Boolean((Xi(_0x588abe,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0x588abe,'data-id'));}['_isExistingContentComment'](_0x204051){return Boolean(_0x22f44d(_0x204051)&&Ki(_0x204051)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function ss(_0x4d930e){return!!_0x4d930e&&Boolean(_0x22f44d(_0x4d930e)&&Ki(_0x4d930e)['match'](/removed[\s*-]data-id="[^"]+"/));}function ns(_0xc46486){if(!_0xc46486)return null;if(_0x1b26d5(_0xc46486))return Xi(_0xc46486,'data-id')??null;if(_0x22f44d(_0xc46486)){const _0x14096a=Ki(_0xc46486)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x14096a&&_0x14096a[0x1])return _0x14096a[0x1];}return null;}function rs(_0x255f0e,_0x464570){const _0x324cdf=new Map();for(const _0x7341fb of qi(_0x255f0e))_0x324cdf['set'](Xi(_0x7341fb,'data-id'),_0x7341fb);const _0x1de1dd=new Set();for(const _0x189163 of qi(_0x464570)){const _0x265f72=Xi(_0x189163,'data-id'),_0x231bf6=_0x265f72?_0x324cdf['get'](_0x265f72):void 0x0;_0x231bf6?(_0x425be6(_0x189163,_0x54443e(_0x231bf6,!0x0)),_0x1de1dd['add'](_0x265f72)):_0x1da415(_0x189163);}for(const _0x25b4f4 of Qi(_0x464570))ss(_0x25b4f4)&&_0x324cdf['has'](ns(_0x25b4f4))&&_0x1da415(_0x25b4f4);const _0x101aa5=new Set($i('data-id',null,_0x464570)['map'](_0x100989=>Xi(_0x100989,'data-id')));for(const [_0x4cf870,_0x366103]of _0x324cdf){if(_0x1de1dd['has'](_0x4cf870))continue;let _0x3a347e=_0x366103['parent'],_0x56f4e5=null;for(;_0x3a347e&&_0x1b26d5(_0x3a347e);){const _0x259c24=Xi(_0x3a347e,'data-id');if(_0x259c24&&_0x101aa5['has'](_0x259c24)){_0x56f4e5=_0x259c24;break;}_0x3a347e=_0x3a347e['parent'];}if(!_0x56f4e5)continue;const _0x5b27f4=Yi('data-id',_0x56f4e5,_0x464570);_0x5b27f4&&_0x1cf467(_0x5b27f4,_0x54443e(_0x366103,!0x0));}}function os({changeGroups:_0x4113b4,documentContextContent:_0x341573,showDiff:_0x516055,trimUnchanged:_0x39d4da=!0x0}){return _0x4113b4['map'](_0x118bd0=>{if('destroyed'===_0x118bd0['editor']['state'])return null;const _0x11f311=new _0x597933([]),_0x346538=new _0x597933([]),_0x1d4ebd=new Set();for(const _0x49c22d of _0x118bd0['changes'])'new'==_0x49c22d['type']&&$i('data-id',null,_0x49c22d['node'])['forEach'](_0x7a4801=>{_0x1d4ebd['add'](Xi(_0x7a4801,'data-id'));});for(const _0xcbed74 of _0x118bd0['changes'])if('removed'!=_0xcbed74['type']?_0x346538['children']['push'](_0xcbed74['node']['cloneNode'](!0x0)):_0x516055||_0x1d4ebd['has'](_0xcbed74['id'])||_0x346538['children']['push'](_0xcbed74['node']['cloneNode'](!0x0)),'new'!=_0xcbed74['type']&&(_0x516055||'removed'!=_0xcbed74['type'])){const _0x455c9a=_0x43180a(_0x29ab53=>Xi(_0x29ab53,'data-id')==_0xcbed74['id'],_0x341573['get'](_0x118bd0['documentId']),!0x0);_0x455c9a&&_0x11f311['children']['push'](_0x455c9a['cloneNode'](!0x0));}const {content:_0x3eba6f,hasChanges:_0x5996fe}=as(_0x118bd0['editor'],_0x11f311,_0x346538,_0x516055,_0x39d4da);return{'type':_0x118bd0['changes'][0x0]['type'],'index':_0x118bd0['index'],'content':_0x3eba6f,'hasChanges':_0x5996fe};})['filter'](_0x339e97=>null!==_0x339e97);}function as(_0x25f4f8,_0x4c1c7d,_0x5b0392,_0x5798ee,_0xbe37c5=!0x0){const _0x374253=_0x25f4f8['plugins']['get']('DocumentCompare'),_0x19393b=Ki(_0x4c1c7d),_0x3d15c9=Ki(_0x5b0392),_0x384459=_0x25f4f8['data']['parse'](_0x19393b,'$root'),_0x48bfed=_0x25f4f8['model']['createPositionAt'](_0x384459,0x0),_0x372155=_0x374253['getDiff'](_0x19393b,_0x3d15c9,{'anchor':_0x48bfed,'markDeletions':_0x5798ee,'targetEditor':_0x25f4f8})['getOperations']();if(0x0==_0x372155['length'])return{'content':_0x4c1c7d['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x5798ee?function(_0x2016c0,_0x5da303,_0x48dcc1){if(0x0==_0x2016c0['length'])return;const _0x5ddce0=_0x48dcc1['plugins']['get']('DocumentCompare'),_0x246183=_0x48dcc1['plugins']['get']('SuggestionsConversion');_0x48dcc1['model']['change'](_0x4b292c=>{const _0x21ece8=new Set();for(let _0x3adec7=0x0;_0x3adec7<_0x2016c0['length'];_0x3adec7++){const _0x217ba8=_0x2016c0[_0x3adec7];if(_0x217ba8['baseVersion']=null,_0x217ba8['isDocumentOperation']=!0x1,_0x5ddce0['isMarkedRemoveOperation'](_0x217ba8)){const _0x56b061=_0x50329e(_0x217ba8['newRange'],_0x48dcc1['model']),_0x1690b6='suggestion:deletion:'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x1690b6,_0x56b061);}else switch(_0x217ba8['type']){case'rename':{if(_0x217ba8['oldName']==_0x217ba8['newName'])break;_0x4b292c['batch']['addOperation'](_0x217ba8),_0x48dcc1['model']['applyOperation'](_0x217ba8);const _0x2a809f='$elementName',_0x32d268=_0x217ba8['position'],_0x58f74c=_0x48dcc1['model']['createRange'](_0x32d268,_0x48dcc1['model']['createPositionAt'](_0x32d268['nodeAfter'],'end')),_0x4dc1b8='suggestion:attribute:'+_0x2a809f+':'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x4dc1b8,_0x58f74c);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x217ba8['oldValue']==_0x217ba8['newValue'])break;_0x4b292c['batch']['addOperation'](_0x217ba8),_0x48dcc1['model']['applyOperation'](_0x217ba8);const _0x15f773=_0x217ba8['key'];if(!_0x246183['isRegisteredAttribute'](_0x15f773))break;const _0x5cdfa2=_0x50329e(_0x217ba8['range'],_0x48dcc1['model']),_0x5721ae='suggestion:attribute:'+_0x15f773+':'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x5721ae,_0x5cdfa2);break;}case'insert':{_0x4b292c['batch']['addOperation'](_0x217ba8),_0x48dcc1['model']['applyOperation'](_0x217ba8);if(_0x2016c0[_0x3adec7+0x1]&&'move'==_0x2016c0[_0x3adec7+0x1]['type']){hs(_0x5da303,_0x217ba8);break;}const _0x9cf420=_0x217ba8['position'],_0x49bab1=_0x217ba8['howMany'],_0x22c51a=_0x50329e(_0x48dcc1['model']['createRange'](_0x9cf420,_0x9cf420['getShiftedBy'](_0x49bab1)),_0x48dcc1['model']),_0x50d429='suggestion:insertion:'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x50d429,_0x22c51a);break;}case'split':{_0x4b292c['batch']['addOperation'](_0x217ba8),_0x48dcc1['model']['applyOperation'](_0x217ba8);const _0x324445=_0x217ba8['splitPosition'],_0x57b9d5=_0x217ba8['moveTargetPosition'],_0x14bde7=_0x48dcc1['model']['createRange'](_0x324445,_0x57b9d5),_0x81b186='suggestion:insertion:'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x81b186,_0x14bde7);break;}case'move':{_0x4b292c['batch']['addOperation'](_0x217ba8),_0x48dcc1['model']['applyOperation'](_0x217ba8),_0x2016c0[_0x3adec7-0x1]&&'insert'==_0x2016c0[_0x3adec7-0x1]['type']&&hs(_0x5da303,_0x217ba8);const _0x5abdba=_0x217ba8['getMovedRangeStart'](),_0x1e6fd4=_0x217ba8['howMany'];for(let _0x4243d8=0x0;_0x4243d8<_0x1e6fd4;_0x4243d8++){const _0x2137b2=_0x5abdba['getShiftedBy'](_0x4243d8)['nodeAfter'];_0x21ece8['add'](_0x2137b2);}break;}case'remove':{const _0x426266=_0x217ba8['sourcePosition'],_0x5c8f28=_0x217ba8['howMany'],_0x503cfe=new _0x1e4528(_0x426266,_0x5c8f28);_0x4b292c['batch']['addOperation'](_0x503cfe),_0x48dcc1['model']['applyOperation'](_0x503cfe);break;}}}for(const _0x55dcb9 of _0x21ece8){const _0x3adbc7=_0x48dcc1['model']['createRangeOn'](_0x55dcb9),_0x377d82='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x5da303['markers']['set'](_0x377d82,_0x50329e(_0x3adbc7,_0x48dcc1['model']));}});}(_0x372155,_0x384459,_0x25f4f8):_0x25f4f8['model']['change'](_0x4bbe31=>{for(const _0x2d3b83 of _0x372155)if('remove'==_0x2d3b83['type']){const _0x121156=_0x2d3b83['sourcePosition'],_0x375d97=_0x2d3b83['howMany'],_0x411e5d=new _0x1e4528(_0x121156,_0x375d97);_0x4bbe31['batch']['addOperation'](_0x411e5d),_0x25f4f8['model']['applyOperation'](_0x411e5d);}else{if('marker'==_0x2d3b83['type']){const _0x5ac6b3=_0x2d3b83['name'],_0x67dac2=_0x2d3b83['newRange'];null!==_0x67dac2?_0x384459['markers']['set'](_0x5ac6b3,_0x67dac2):_0x384459['markers']['delete'](_0x5ac6b3);}else _0x2d3b83['baseVersion']=null,_0x2d3b83['isDocumentOperation']=!0x1,_0x4bbe31['batch']['addOperation'](_0x2d3b83),_0x25f4f8['model']['applyOperation'](_0x2d3b83);}}),_0xbe37c5){const _0x3b970a=cs(_0x25f4f8,_0x372155,_0x384459);us(_0x25f4f8['model'],_0x3b970a),function(_0x4261fb,_0x56d940){const _0x243004=_0x56d940['getFirstRange']()['start'];let _0x469170=_0x56d940['getFirstRange']()['end'];const _0x1406f1=_0x243004['root'];(_0x469170['textNode']||_0x469170['nodeAfter']&&_0x469170['nodeAfter']['is']('$text'))&&(_0x559ec4(_0x469170,'...'),_0x469170=_0x469170['getShiftedBy'](0x3)),(_0x243004['textNode']||_0x243004['nodeBefore']&&_0x243004['nodeBefore']['is']('$text'))&&(_0x559ec4(_0x243004,'...'),function(_0x2dc756,_0x9ae7e9,_0x1630cf){for(let [_0x2791d8,_0x5b399f]of _0x2dc756['markers']){const _0x3da722=_0x5b399f['_getTransformedByInsertion'](_0x9ae7e9,_0x1630cf,!0x1);_0x5b399f=_0x3da722[0x0],_0x2dc756['markers']['set'](_0x2791d8,_0x5b399f);}}(_0x1406f1,_0x243004,0x3),_0x243004['parent']==_0x469170['parent']&&(_0x469170=_0x469170['getShiftedBy'](0x3)));const _0x8517d5=_0x4261fb['createRange'](_0x4261fb['createPositionAt'](_0x1406f1,0x0),_0x243004),_0x39c8be=_0x4261fb['createRange'](_0x469170,_0x4261fb['createPositionAt'](_0x1406f1,'end')),_0x54a72c=[..._0x8517d5['getMinimalFlatRanges'](),..._0x39c8be['getMinimalFlatRanges']()];_0x54a72c['reverse']();for(const _0x4f91ca of _0x54a72c)_0x5862d1(_0x4f91ca),_s(_0x1406f1,_0x4f91ca);}(_0x25f4f8['model'],_0x3b970a);}return{'content':Wi(_0x25f4f8['data']['stringify'](_0x384459,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function hs(_0x49cc0c,_0x4429bb){for(const [_0x38e07d,_0x3006c2]of _0x49cc0c['markers']){const _0xf5057f=_0x10082a['_createFromRanges'](_0x3006c2['getTransformedByOperation'](_0x4429bb));_0x49cc0c['markers']['set'](_0x38e07d,_0xf5057f);}}function cs(_0x18c2a7,_0x59c293,_0x273e38){const _0x4466e0=_0x18c2a7['plugins']['get']('DocumentCompare');let _0x518314=_0x18c2a7['model']['createPositionAt'](_0x273e38,Number['POSITIVE_INFINITY']),_0x124c5f=_0x18c2a7['model']['createPositionAt'](_0x273e38,0x0);for(const _0x592160 of _0x59c293){let _0x196a40,_0xb7a170;if(_0x4466e0['isMarkedRemoveOperation'](_0x592160))_0x196a40=_0x592160['newRange']['start'],_0xb7a170=_0x592160['newRange']['end'];else switch(_0x518314=ls(_0x518314,_0x592160),_0x124c5f=ls(_0x124c5f,_0x592160),_0x592160['type']){case'rename':_0x196a40=_0x592160['position'],_0xb7a170=_0x196a40['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x196a40=_0x592160['range']['start'],_0xb7a170=_0x592160['range']['end'];break;case'insert':_0x196a40=_0x592160['position'],_0xb7a170=_0x196a40['getShiftedBy'](_0x592160['howMany']);break;case'split':_0x196a40=_0x592160['splitPosition'],_0xb7a170=_0x592160['moveTargetPosition'];break;case'merge':{const _0x446275=_0x592160['targetPosition']['path']['slice'](0x0,-0x1);_0x196a40=_0x18c2a7['model']['createPositionFromPath'](_0x273e38,_0x446275),_0xb7a170=_0x196a40['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x69f104=_0x592160['howMany'],_0x31bbb6=_0x592160['sourcePosition']['_getTransformedByInsertion'](_0x592160['targetPosition'],_0x69f104),_0x14d3f9=_0x592160['getMovedRangeStart']();'remove'==_0x592160['type']?(_0x196a40=_0x31bbb6,_0xb7a170=_0x31bbb6):(_0x196a40=_0x14d3f9,_0xb7a170=_0x14d3f9['getShiftedBy'](_0x69f104));break;}}_0x196a40&&_0x196a40['isBefore'](_0x518314)&&(_0x518314=_0x196a40['clone'](),_0x518314['stickiness']='toNone'),_0xb7a170&&_0xb7a170['isAfter'](_0x124c5f)&&(_0x124c5f=_0xb7a170['clone'](),_0x124c5f['stickiness']='toNone');}return _0x18c2a7['model']['createSelection'](_0x18c2a7['model']['createRange'](_0x518314,_0x124c5f));}function ls(_0x10e715,_0xdc8b7e){return'move'!=_0xdc8b7e['type']&&'remove'!=_0xdc8b7e['type']||_0xdc8b7e['sourceRange']['containsPosition'](_0x10e715)&&((_0x10e715=_0xdc8b7e['sourcePosition']['clone']())['stickiness']='toNone'),_0x10e715['getTransformedByOperation'](_0xdc8b7e);}function us(_0x20ece9,_0x50bd92){ds(_0x20ece9,_0x50bd92,'forward');const _0x24badb=_0x50bd92['getFirstRange']();_0x50bd92['setTo']([]),_0x50bd92['setTo'](_0x24badb,{'backward':!0x0}),ds(_0x20ece9,_0x50bd92,'backward');}function ds(_0x3fc1a1,_0x5b6a54,_0x2f91fb){let _0x5163c2=0x14;for(;_0x5163c2;){_0x3fc1a1['modifySelection'](_0x5b6a54,{'unit':'word','direction':_0x2f91fb}),_0x5163c2--;const _0x1ce292=_0x5b6a54['focus']['forward'==_0x2f91fb?'nodeBefore':'nodeAfter'];if(_0x1ce292&&_0x1ce292['is']('element')&&_0x3fc1a1['schema']['isBlock'](_0x1ce292)&&_0x3fc1a1['schema']['isObject'](_0x1ce292))break;}}function _s(_0x262480,_0x1a92d5){for(const [_0x117fd7,_0x183961]of _0x262480['markers']){const _0x167ed7=_0x183961['_getTransformedByDeletion'](_0x1a92d5['start'],_0x1a92d5['end']['offset']-_0x1a92d5['start']['offset']);null!=_0x167ed7?_0x262480['markers']['set'](_0x117fd7,_0x167ed7):_0x262480['markers']['delete'](_0x117fd7);}}class AIReply extends ct(){['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:_0x4cb8a6,isDone:_0x502ae4=!0x1,isComplete:_0x4a4000,interactionId:_0x31ef4f,areActionsDisabled:_0xc6a629,isFromHistory:_0x360b99=!0x1,documentContextContent:_0x323818,locale:_0x5573b7,id:_0x4448e2,channelsToEditors:_0x4cfd53}){super(),this['id']=_0x4448e2||at(),this['interactionId']=_0x31ef4f,this['type']=_0x4cb8a6,this['areActionsDisabled']=!!_0xc6a629,this['isFromHistory']=_0x360b99,this['locale']=_0x5573b7,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x323818?.['map'](_0x3f33=>[_0x3f33['id'],Wi(_0x3f33['content'])])||[]),this['_documentIdToSource']=new Map(_0x323818?.['map'](_0x125391=>[_0x125391['id'],{'editor':_0x4cfd53['get'](_0x125391['channelId']),'rootName':_0x125391['rootName']}])||[]),this['set']('isDone',_0x502ae4),this['set']('isComplete',_0x4a4000??_0x502ae4),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x61d811,_0x490fe7){const _0x1949e7='text'===this['type']?'text':_0x490fe7;this['content']['has'](_0x1949e7)||this['content']['set'](_0x1949e7,''),this['content']['set'](_0x1949e7,this['content']['get'](_0x1949e7)+_0x61d811),this['onContentChange'](_0x1949e7);}['done'](_0x3e8a65=!0x0){this['isComplete']=_0x3e8a65,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x3fae0a,_0x1d684b){this['changeGroups'][_0x3fae0a]['state']=_0x1d684b,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x3fae0a,'state':_0x1d684b});}['getContentParts']({showDiff:_0x1c1a88,groupIndex:_0x3a352c}){const _0x4aaf91=this['_getCachedContentParts'](_0x1c1a88,_0x3a352c);if(_0x4aaf91)return _0x4aaf91;let _0x5c0b3c=[];if(void 0x0===_0x3a352c)_0x5c0b3c=this['changeGroups'];else{const _0xb78eac=this['changeGroups']['find'](({index:_0x5ecdd0})=>_0x5ecdd0===_0x3a352c);if(!_0xb78eac)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x3a352c});_0x5c0b3c=[_0xb78eac];}const _0x16d6dd=os({'showDiff':_0x1c1a88,'changeGroups':_0x5c0b3c,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x1c1a88,_0x16d6dd),_0x16d6dd;}['_getCachedContentParts'](_0x1b60fe,_0x3cff15){const _0x2713db=_0x1b60fe?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x2713db]['length'])return null;const _0x20f93a=this['cachedSuggestionContentParts'][_0x2713db];if(void 0x0===_0x3cff15)return _0x20f93a['length']>0x0&&_0x20f93a['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x1b60fe,null),null):_0x1d48b8(_0x20f93a);{const _0x1ca987=_0x20f93a['find'](({index:_0x2be074})=>_0x2be074===_0x3cff15);if(_0x1ca987)return[_0x1d48b8(_0x1ca987)];}return null;}['_setCachedContentParts'](_0x1f9028,_0x44f597){const _0x462c1c=_0x1f9028?'withDiff':'withoutDiff';_0x44f597?_0x44f597['forEach'](_0x1d715b=>{const _0x3c13a5=this['cachedSuggestionContentParts'][_0x462c1c],_0x46faec=_0x3c13a5['find'](({index:_0x5147f7})=>_0x5147f7===_0x1d715b['index']);if(_0x46faec){const _0x588c52=_0x3c13a5['indexOf'](_0x46faec);_0x3c13a5['splice'](_0x588c52,0x1,_0x1d715b);}else _0x3c13a5['push'](_0x1d715b);}):this['cachedSuggestionContentParts'][_0x462c1c]['length']=0x0;}['onContentChange'](_0x7e144e){if('modification'===this['type']){if(_0x7e144e)this['parsedContent']['set'](_0x7e144e,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x7e144e)));else{for(const [_0x6f573,_0x4707b4]of this['content'])this['parsedContent']['set'](_0x6f573,this['aiResponseParser']['parseAndNormalizeHTML'](_0x4707b4));}const _0x59914a=this['changeGroups'];for(const _0x546b5b of this['content']['keys']())this['updateChangeGroups'](_0x546b5b);const _0x5bb678=this['_getDifferentChangeGroups'](_0x59914a,this['changeGroups']);(_0x5bb678['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x5bb678),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'](_0x273b55,_0x3d8ec5){const _0x36aa65=[];for(const _0xe947bf of _0x3d8ec5){const _0x317b0b=_0x273b55[_0xe947bf['index']];_0x317b0b?_0x317b0b['changes']['length']!==_0xe947bf['changes']['length']?_0x36aa65['push'](_0xe947bf):_0x317b0b['changes']['forEach']((_0x59a74a,_0x14180f)=>{const _0x2db6a7=_0xe947bf['changes'][_0x14180f];_0x59a74a['id']!==_0x2db6a7['id']&&_0x36aa65['push'](_0xe947bf);}):_0x36aa65['push'](_0xe947bf);}return _0x36aa65;}['updateChangeGroups'](_0x277d1a){const _0x2652e9=this['documentContextContent']['get'](_0x277d1a),_0x3ad9dd=this['parsedContent']['get'](_0x277d1a);if(!_0x2652e9||!_0x3ad9dd)return;const _0x2ae88c=new _0x43db7e('p',{},[new _0x43db7e('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x9b91ab(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x5e2892=this['aiResponseApplier']['merge'](_0x3ad9dd,_0x2652e9['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x2ae88c});this['parsedMergedContent']['set'](_0x277d1a,_0x5e2892['parsedContent']);let _0x26e366=[];if(_0x4edc31(_0x1b7987=>{const _0x216aec=Xi(_0x1b7987,'data-id');if(!_0x216aec||!_0x334de7(_0x216aec))return!0x1;const _0x1a58a8=[_0x1b7987,...Ji(_0x1b7987)]['at'](-0x2);if(_0x1b7987!=_0x1a58a8){const _0xcf8fa9=Xi(_0x1a58a8,'data-id');_0x334de7(_0xcf8fa9)||(_0x26e366['push']({'node':_0x1a58a8,'id':_0xcf8fa9,'type':'modified'}),_0x5e2892['modifiedNodeIds']['push'](_0xcf8fa9));}else _0x5e2892['modifiedNodeIds']['includes'](_0x216aec)?_0x26e366['push']({'node':_0x1b7987,'type':'modified','id':_0x216aec}):_0x5e2892['newNodeIds']['includes'](_0x216aec)?_0x26e366['push']({'node':_0x1b7987,'type':'new','id':_0x216aec,'anchorId':Xi(_0x1b7987['previousSibling'],'data-id')}):_0x26e366['push']({'node':_0x1b7987,'type':'removed','id':_0x216aec});return!0x0;},this['parsedMergedContent']['get'](_0x277d1a)),_0x26e366=_0x26e366['filter'](({node:_0xebd3f4})=>[...Ji(_0xebd3f4),_0xebd3f4]['every'](_0x3d4662=>!Xi(_0x3d4662,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x4e3b1b=>_0x4e3b1b['documentId']!==_0x277d1a),0x0==_0x26e366['length'])return;const _0x20da06=[[_0x26e366[0x0]]];for(let _0x3de425=0x1;_0x3de425<_0x26e366['length'];_0x3de425++){const _0x4e9b3d=_0x20da06[_0x20da06['length']-0x1],_0x5ab242=_0x4e9b3d[_0x4e9b3d['length']-0x1];_0x26e366[_0x3de425]['node']['previousSibling']==_0x5ab242['node']&&'modified'!=_0x26e366[_0x3de425]['type']&&'modified'!=_0x5ab242['type']?_0x4e9b3d['push'](_0x26e366[_0x3de425]):_0x20da06['push']([_0x26e366[_0x3de425]]);}for(const _0x5d184d of _0x20da06){const _0x2da759=_0x5d184d[0x0],_0x626b7b=_0x5d184d[_0x5d184d['length']-0x1],_0x8fb0a0=_0x37a714(_0x2da759['node']['previousSibling']);_0x8fb0a0&&_0x5d184d['unshift'](_0x8fb0a0);const _0x1c56df=_0x37a714(_0x626b7b['node']['nextSibling']);_0x1c56df&&_0x5d184d['push'](_0x1c56df);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x277d1a))['forEach'](_0x318ff5=>{zi(_0x318ff5,'data-wrapped-id',null);});const _0x44abe2=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x277d1a))['forEach'](_0xcf1916=>{const _0x38d019=Xi(_0xcf1916,'data-unwrapped-id'),_0xce9132=Xi(_0xcf1916,'data-id');_0x44abe2['set'](_0xce9132,_0x38d019),zi(_0xcf1916,'data-id',_0x38d019),zi(_0xcf1916,'data-unwrapped-id',null);});for(const _0x335058 of _0x26e366){const _0x148443=_0x44abe2['get'](_0x335058['id']);_0x148443&&(_0x335058['id']=_0x148443);}this['changeGroups']['push'](..._0x20da06['map']((_0xe8d4a6,_0x59e125)=>({'changes':_0xe8d4a6,'state':'pending','index':_0x59e125,'editor':this['_documentIdToSource']['get'](_0x277d1a)['editor'],'rootName':this['_documentIdToSource']['get'](_0x277d1a)['rootName'],'documentId':_0x277d1a})));const _0x4ebed2=Array['from'](this['documentContextContent']['keys']());function _0x334de7(_0x1bdfb7){return _0x5e2892['modifiedNodeIds']['includes'](_0x1bdfb7)||_0x5e2892['newNodeIds']['includes'](_0x1bdfb7)||_0x5e2892['removedNodeIds']['includes'](_0x1bdfb7);}function _0x37a714(_0xb2e9f4){if(_0xb2e9f4&&Xi(_0xb2e9f4,'data-id')&&!Xi(_0xb2e9f4,'data-unstable')){const _0x8ad4a0=Xi(_0xb2e9f4,'data-id');if(!_0x334de7(_0x8ad4a0))return{'node':_0xb2e9f4,'type':'context','id':_0x8ad4a0};}return null;}this['changeGroups']['sort']((_0x1b5635,_0xf33ff7)=>_0x4ebed2['indexOf'](_0x1b5635['documentId'])-_0x4ebed2['indexOf'](_0xf33ff7['documentId'])),this['changeGroups']['forEach']((_0x345ded,_0x47ab3c)=>{_0x345ded['index']=_0x47ab3c;});}}const Is=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x141b98,locale:_0x3edf06,channelsToEditors:_0x38b3c3}){super(),this['id']=at(),this['connector']=_0x141b98,this['isStopped']=!0x0,this['locale']=_0x3edf06,this['_channelsToEditors']=_0x38b3c3||new Map();}async['start'](){await this['_run']();}async['resume'](_0x3b5357){await this['_run'](_0x3b5357);}async['_run'](_0x346d5a){const _0x2aa237=[];let _0x2a691f,_0x361090,_0x1a09de,_0xdb36f9=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x346d5a||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0xe28ceb=await this['currentRequest']['getStream']();for await(const _0x254ff8 of _0xe28ceb){if(this['isStopped'])return;if('error'==_0x254ff8['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x254ff8['event']){case'message-metadata':this['messageId']=_0x254ff8['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x254ff8['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x254ff8['data']['conversationTitle'],!0x0);break;case'source':_0x2aa237['push'](_0x254ff8['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'](),_0x2a691f='modification-delta'==_0x254ff8['event']?'modification':'text',_0x361090='modification-delta'==_0x254ff8['event']?_0x254ff8['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x2a691f&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x2a691f,'interactionId':this['id'],'id':_0x361090,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x254ff8['event']&&{'documentId':_0x254ff8['data']['documentId']}}),'modification'==_0x2a691f&&(this['currentReply']['sources']=_0x2aa237['splice'](0x0))),this['currentReply']['appendContent'](_0x254ff8['data']['textDelta'],_0x254ff8['data']['documentId']);break;case'mcp-tool-result':_0x1a09de=JSON['parse'](_0x254ff8['data']['result']),this['_handleToolResultData']({'toolName':_0x254ff8['data']['toolName'],'data':_0x1a09de['data'],'attributes':_0x1a09de['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x254ff8['data']['toolName'],'data':_0x254ff8['data']['data']});}}_0xdb36f9=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x2aa237['length']>0x0&&(this['currentReply']['sources']=_0x2aa237['splice'](0x0)),this['_finalizeInteraction'](_0xdb36f9),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x277c46){return this['replies']['find'](_0x318df7=>_0x318df7['id']===_0x277c46);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x4e0903=>_0x4e0903['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x5a3854){const _0x433259=this['getDocumentContext'](),_0x23a34a=new AIReply({'locale':this['locale'],'documentContextContent':_0x433259?.['documents'],..._0x5a3854});return this['replies']['push'](_0x23a34a),_0x23a34a['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x23a34a),_0x23a34a;}['setConversationTitle'](_0x28e60c,_0x4b28d1=!0x1){this['fire']('setConversationTitle',_0x28e60c,_0x4b28d1);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x5618ea){this['fire']('toolDataReceived',{'type':'result','toolName':_0x5618ea['toolName'],'data':structuredClone(_0x5618ea['data']||{}),'attributes':structuredClone(_0x5618ea['attributes']||{})},this);}['_handleToolNotificationData'](_0x43c6eb){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x43c6eb['toolName'],'data':structuredClone(_0x43c6eb['data'])},this);}['_finalizeInteraction'](_0xe42323=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0xe42323),this['currentRequest']=this['currentReply']=void 0x0;}}const As=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']]),gs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x21926f,config:_0x2242c5,ownerId:_0x4a6cb8}){super(),this['_connector']=_0x21926f,this['_config']=_0x2242c5,this['_ownerId']=_0x4a6cb8;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x4cbf92){const _0x2f1900=await this['_createContextItemFromContent'](_0x4cbf92);return this['_addToConversationContextItem'](_0x2f1900),'current-document'===_0x2f1900['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x2f1900;}async['populateDocumentsFromMessage'](_0x1869a1,_0x56540f){const _0x5a2b46=_0x1869a1['filter'](_0x9446f3=>'document'===_0x9446f3['type']);if(0x0===_0x5a2b46['length'])return{'hasUnmatched':!0x1};const _0x5b5c91=_0x5a2b46['map'](_0x2d2e48=>_0x2d2e48['id']),_0x5458a2=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x5b5c91)['getDocuments'](),_0x3fae10=new Map(_0x5458a2['map'](_0x197988=>[_0x197988['id'],_0x197988])),_0x287d9d=[];let _0x410b48=!0x1;for(const _0x1a1ba3 of _0x5a2b46){const _0x16a9da=_0x3fae10['get'](_0x1a1ba3['id']);_0x16a9da&&(this['_matchDocumentToRoot'](_0x16a9da,_0x56540f)||(_0x410b48=!0x0),_0x287d9d['push']({'id':_0x16a9da['id'],'content':_0x16a9da['content'],'version':_0x16a9da['attributes']?.['version']??0x0,'sessionId':_0x16a9da['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x16a9da['attributes']?.['channelId']??_0x56540f[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x16a9da['attributes']?.['rootName']??_0x56540f[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x3fc125={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x287d9d};return this['_addToConversationContextItem'](_0x3fc125),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x3fc125,'hasUnmatched':_0x410b48};}['_matchDocumentToRoot'](_0x176aab,_0x4bda04){const _0x1c2cd8=_0x176aab['attributes']?.['channelId'],_0x5274c6=_0x176aab['attributes']?.['rootName'];if(_0x1c2cd8&&_0x5274c6){for(const _0x1392ed of _0x4bda04)if(_0x1392ed['config']['get']('collaboration.channelId')===_0x1c2cd8){for(const _0xb14230 of _0x1392ed['model']['document']['getRoots']())if('$graveyard'!==_0xb14230['rootName']&&_0xb14230['rootName']===_0x5274c6)return{'editor':_0x1392ed,'rootName':_0xb14230['rootName']};}}}async['_createContextItemFromContent'](_0x2c7833){if('document'===_0x2c7833['type']){const _0x31a21b=await this['_connector']['fetchDocument'](this['_ownerId'],_0x2c7833['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x2c7833['type'],'content':_0x31a21b['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x31a21b['attributes']?.['version'],'sessionId':_0x31a21b['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x2c7833['type'])return{'id':_0x2c7833['id'],'uiId':_0x2c7833['id'],'label':_0x2c7833['data']?.['label']||_0x2c7833['id'],'type':'mcp-tool-context','mcpServerName':_0x2c7833['mcpServerName'],'toolName':_0x2c7833['toolName'],'data':_0x2c7833['data']||{}};return{'id':_0x2c7833['id'],'uiId':_0x2c7833['id'],'label':_0x2c7833['attributes']?.['label']||_0x2c7833['name']||_0x2c7833['url']||_0x2c7833['id'],'type':_0x2c7833['type'],..._0x2c7833?.['attributes']?.['resourceId']?{'resourceId':_0x2c7833['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x2f9c3d){const _0xa49a2a=this['_pendingContextItems']['get'](_0x2f9c3d);_0xa49a2a?.['isReadOnly']||this['_removeContextItem'](_0x2f9c3d);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x486124 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x486124['uiId']);const _0x10a07c=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x10a07c&&this['_addContextItem']({..._0x10a07c,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x44f94c){for(const _0x2a1112 of _0x44f94c['values']())this['_addToConversationContextItem'](_0x2a1112);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'](_0xbe2515){return Array['from'](_0xbe2515['values']())['flatMap'](_0x31dc14=>this['_mapContextItemToRequestData'](_0x31dc14));}async['addFilesToContext'](_0x1a571d,_0x381e25,_0x4c7f93='file'){const _0xc05e5='files-'+at();this['_startUploadOperation'](_0xc05e5);try{await Promise['all'](_0x1a571d['map'](async _0x589a3b=>{const _0x2ce155='file-'+at(),_0x4a7fd3=_0x2f8e1d(_0x589a3b['name']),_0x44ab39='file'===_0x4c7f93&&_0x589a3b['type']['startsWith']('image/')?'image':_0x4c7f93;try{this['_addContextItem']({'type':_0x44ab39,'label':_0x381e25?.['label']||_0x4a7fd3,'uiId':_0x2ce155,'resourceId':_0x381e25?.['resourceId']},!0x0);const _0x3d2234=this['_connector']['uploadFile'](this['_ownerId'],_0x589a3b,_0x381e25);this['_ongoingUploads']['set'](_0x2ce155,_0x3d2234['abortController']);const {id:_0x2c8f0e}=await _0x3d2234['getId']();this['_ongoingUploads']['delete'](_0x2ce155),this['_finishContextItemLoading']({'type':_0x44ab39,'id':_0x2c8f0e,'label':_0x381e25?.['label']||_0x4a7fd3,'uiId':_0x2ce155,'resourceId':_0x381e25?.['resourceId']},!0x1);}catch(_0x38a495){this['_ongoingUploads']['delete'](_0x2ce155);if(!(_0x38a495 instanceof ht&&_0x38a495['message']['startsWith']('ai-request-aborted'))){const _0xdc4a6d=As['get'](_0x38a495['code'])||'ai-chat-file-upload-failed',_0x4afb83=new ht(_0xdc4a6d,null,{'fileName':_0x4a7fd3,..._0x38a495});_0x4afb83['stack']=_0x38a495['stack'],this['fire']('error',{'error':_0x4afb83});}this['_removeContextItem'](_0x2ce155);}}));}finally{this['_finishUploadOperation'](_0xc05e5);}}['addCurrentDocumentToContext'](_0x118737){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x269db3={'type':'document','uiId':'current-document','label':_0x118737,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x269db3);}async['updateCurrentDocuments'](_0x24c8ec){const _0x5ca8bf=this['_pendingContextItems']['get']('current-document');if(!_0x5ca8bf||!_0x24c8ec['length']||_0x24c8ec['every'](_0x1a3fb3=>!_0x1a3fb3['content']))return;_0x24c8ec['length']>0x1&&_0x24c8ec['some'](_0x96d7f9=>!_0x96d7f9['description'])&&wt('ai-chat-documents-missing-description');try{const _0x2b5740=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x24c8ec)['getIds']();if(_0x2b5740['length']!==_0x24c8ec['length']||_0x2b5740['some'](_0x34b7c3=>!_0x34b7c3?.['id'])){const _0x19eac4=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x19eac4});}_0x5ca8bf['documents']=_0x24c8ec['map']((_0x4866c1,_0x5ecc54)=>{return{'id':_0x2b5740[_0x5ecc54]['id'],'content':_0x4866c1['content'],'version':_0x4866c1['version'],'sessionId':_0x4866c1['sessionId'],'selection':(_0x4a071d=_0x4866c1['selections'],_0x4a071d?_0x4a071d['map'](_0x29de39=>({'start':_0x29de39['start'],'end':_0x29de39['end']})):[]),'channelId':_0x4866c1['channelId'],'rootName':_0x4866c1['rootName']};var _0x4a071d;});}catch(_0x15cc0c){const _0x2db770=new ht('ai-chat-document-upload-failed',null);_0x2db770['stack']=_0x15cc0c['stack'],this['fire']('error',{'error':_0x2db770});}}['addSelectionToContext'](_0x5286d0){this['_addContextItem']({'type':'selection','label':_0x5286d0,'uiId':'selection','content':_0x5286d0});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x29dbb0,_0x2717eb){const _0x21b73f='url-'+at();this['_startUploadOperation'](_0x21b73f);const _0x5b6a6d='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x2717eb?.['label']||_0x29dbb0,'uiId':_0x5b6a6d,'resourceId':_0x2717eb?.['resourceId']},!0x0);const _0x498b39=this['_connector']['uploadUrl'](this['_ownerId'],_0x29dbb0,_0x2717eb);this['_ongoingUploads']['set'](_0x5b6a6d,_0x498b39['abortController']);const {id:_0x4a8c72}=await _0x498b39['getId']();this['_ongoingUploads']['delete'](_0x5b6a6d),this['_finishContextItemLoading']({'type':'web-resource','id':_0x4a8c72,'label':_0x2717eb?.['label']||_0x29dbb0,'uiId':_0x5b6a6d,'resourceId':_0x2717eb?.['resourceId']},!0x1);}catch(_0x36844e){this['_ongoingUploads']['delete'](_0x5b6a6d),(_0x36844e['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x29dbb0,'originalError':_0x36844e}),'url':_0x29dbb0}),this['_removeContextItem'](_0x5b6a6d));}finally{this['_finishUploadOperation'](_0x21b73f);}}['addToolItemToContext'](_0x72c0f2){_0x72c0f2['id']=_0x72c0f2['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x72c0f2['uiId'],_0x72c0f2),this['fire']('contextItemAdded',{'contextItem':_0x72c0f2,'isLoading':!0x1});}async['loadSourceResources'](_0x361564,_0x59a599,_0x30cee2){const _0x424cf3=this['_addContextOptionsState']['sources']['find'](_0x589e63=>_0x589e63['id']===_0x361564);if(!_0x424cf3)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x361564}),'sourceId':_0x361564}),[];try{const _0x218f8a=(await _0x424cf3['getResources'](_0x59a599))['map'](_0x3e5496=>{const _0x1a2ecf=this['_isResourceInContext'](_0x3e5496['id']);return{..._0x3e5496,'isInContext':_0x1a2ecf};});return _0x424cf3['resources']=_0x218f8a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x361564,'source':_0x424cf3,'resources':_0x218f8a,'uid':_0x30cee2}),_0x218f8a;}catch(_0x790606){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x361564,'originalError':_0x790606}),'sourceId':_0x361564,'sourceLabel':_0x424cf3['label']}),[];}}async['addResourceToContext'](_0x367090,_0x48bb8c){if(this['_isResourceInContext'](_0x48bb8c['id']))return;let _0x46c8b0=_0x48bb8c['data'];if(!_0x46c8b0&&_0x367090['getData'])try{_0x46c8b0=await _0x367090['getData'](_0x48bb8c['id']);}catch(_0x51937f){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id'],'originalError':_0x51937f}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});}if(_0x46c8b0)switch(_0x48bb8c['type']){case'web-resource':if('string'!=typeof _0x46c8b0)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id'],'expectedType':'string','actualType':typeof _0x46c8b0}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});await this['addUrlToContext'](_0x46c8b0,{'label':_0x48bb8c['label'],'resourceId':_0x48bb8c['id']});break;case'file':if(!(_0x46c8b0 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id'],'expectedType':'File','actualType':typeof _0x46c8b0}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});await this['addFilesToContext']([_0x46c8b0],{'label':_0x48bb8c['label'],'resourceId':_0x48bb8c['id']});break;case'text':if('object'!=typeof _0x46c8b0||!('content'in _0x46c8b0)||!('type'in _0x46c8b0))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x46c8b0}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});_0x46c8b0=AIChatContext['_convertTextResourceToFile'](_0x46c8b0,_0x48bb8c['label']),await this['addFilesToContext']([_0x46c8b0],{'label':_0x48bb8c['label'],'resourceId':_0x48bb8c['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id'],'resourceType':_0x48bb8c['type']}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']}),'resourceId':_0x48bb8c['id'],'sourceId':_0x367090['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x5d669e){if(void 0x0!==_0x5d669e)this['_addContextOptionsState']['document']['isHidden']=!_0x5d669e;else{const _0x54b62e=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x54b62e;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x1fd18b,_0x538771){switch(_0x1fd18b['type']){case'markdown':return new File([_0x1fd18b['content']],_0x538771,{'type':'text/markdown'});case'html':return new File([_0x1fd18b['content']],_0x538771,{'type':'text/html'});default:return new File([_0x1fd18b['content']],_0x538771,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x49423c){switch(_0x49423c['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x49423c['id']}];case'web-resource':return[{'type':'web-resource','id':_0x49423c['id']}];case'document':return _0x49423c['documents']?.['length']?_0x49423c['documents']['map'](_0x1f99fa=>({'type':'document','id':_0x1f99fa['id'],..._0x1f99fa['selection']?.['length']&&{'selection':_0x1f99fa['selection']}})):[{'type':'document','id':_0x49423c['id'],..._0x49423c['selection']?.['length']&&{'selection':_0x49423c['selection']}}];case'mcp-tool-context':{const _0x105446=_0x49423c;return[{'type':'mcp-tool-context','mcpServerName':_0x105446['mcpServerName'],'toolName':_0x105446['toolName'],'data':{..._0x105446['data'],'label':_0x105446['label']||_0x105446['data']?.['label']||_0x105446['id']},'id':_0x105446['id']}];}default:return[];}}['_addContextItem'](_0x4adbf1,_0x5c077c=!0x1){if(this['_pendingContextItems']['set'](_0x4adbf1['uiId'],_0x4adbf1),_0x4adbf1['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x4adbf1,'isLoading':_0x5c077c}),'current-document'===_0x4adbf1['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x4adbf1['resourceId']){const _0x3b958c=this['_findSourceIdsByResourceId'](_0x4adbf1['resourceId']);_0x3b958c&&_0x3b958c['forEach'](_0x484848=>{this['_updateResourceInContextState'](_0x484848,_0x4adbf1['resourceId'],!0x0);});}}['_removeContextItem'](_0x2c4a3d){const _0x4efe38=this['_pendingContextItems']['get'](_0x2c4a3d),_0x3bc9a1=this['_ongoingUploads']['get'](_0x2c4a3d);if(_0x3bc9a1&&(_0x3bc9a1['abort'](),this['_ongoingUploads']['delete'](_0x2c4a3d)),_0x4efe38?.['resourceId']){const _0x1c8339=this['_findSourceIdsByResourceId'](_0x4efe38['resourceId']);_0x1c8339&&_0x1c8339['forEach'](_0x2867e8=>{this['_updateResourceInContextState'](_0x2867e8,_0x4efe38['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x2c4a3d),this['fire']('contextItemRemoved',{'uiId':_0x2c4a3d,'type':_0x4efe38?.['type']}),'current-document'===_0x2c4a3d&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x3f5f61,_0x5df07f){if(this['_pendingContextItems']['has'](_0x3f5f61['uiId'])&&(this['_pendingContextItems']['set'](_0x3f5f61['uiId'],_0x3f5f61),this['fire']('contextItemLoadingEnded',{'contextItem':_0x3f5f61,'isLoading':_0x5df07f}),_0x3f5f61['resourceId'])){const _0x5d32cd=this['_findSourceIdsByResourceId'](_0x3f5f61['resourceId']);_0x5d32cd&&_0x5d32cd['forEach'](_0x16cd79=>{this['_updateResourceInContextState'](_0x16cd79,_0x3f5f61['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x5d66d6){this['_conversationContextItems']['set'](_0x5d66d6['uiId'],_0x5d66d6);}['_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'](_0x226993=>({..._0x226993,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x3ba54d=>({..._0x3ba54d,'resources':[]}))??[];}['_isResourceInContext'](_0x2ff55d){for(const _0x2b2bf3 of this['_pendingContextItems']['values']())if(_0x2b2bf3['resourceId']===_0x2ff55d)return!0x0;for(const _0x37c4ac of this['_conversationContextItems']['values']())if(_0x37c4ac['resourceId']===_0x2ff55d)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x53f8bc){const _0xfce91=[];for(const _0x5501e4 of this['_addContextOptionsState']['sources']){_0x5501e4['resources']['find'](_0x465fa5=>_0x465fa5['id']===_0x53f8bc)&&_0xfce91['push'](_0x5501e4['id']);}return 0x0===_0xfce91['length']?null:_0xfce91;}['_updateResourceInContextState'](_0x269869,_0x1d4c87,_0x38b1ff){const _0x2f696b=this['_addContextOptionsState']['sources']['find'](_0x16b3b6=>_0x16b3b6['id']===_0x269869);if(!_0x2f696b)return;const _0x180a9a=_0x2f696b['resources']['find'](_0x4b04c2=>_0x4b04c2['id']===_0x1d4c87);_0x180a9a&&(_0x180a9a['isInContext']=_0x38b1ff,this['fire']('resourceStateChanged',{'sourceId':_0x269869,'resourceId':_0x1d4c87,'isInContext':_0x38b1ff}));}['_startUploadOperation'](_0x17eee9){this['_ongoingUploadOperations']['set'](_0x17eee9,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x332ea3){this['_ongoingUploadOperations']['delete'](_0x332ea3),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const ws=['capabilitiesUpdated'];class AICapabilities extends Et(){['_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'](_0x42c25e){const _0x2da743={};return _0x42c25e&&_0x42c25e['isWebSearchEnabled']&&(_0x2da743['webSearch']={}),_0x42c25e&&_0x42c25e['isReasoningEnabled']&&(_0x2da743['reasoning']={}),_0x2da743;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x347569){_0x347569!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x347569,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x292a00){_0x292a00!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x292a00,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x1d37a){super(_0x1d37a),this['conversationId']=_0x1d37a['conversationId'],this['contextItems']=_0x1d37a['contextItems'],this['capabilities']=_0x1d37a['capabilities'],this['userMessage']=_0x1d37a['userMessage'],this['model']=_0x1d37a['model'],this['attributes']=_0x1d37a['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x5bfc82){super(),this['options']=_0x5bfc82,this['connector']=_0x5bfc82['connector'],this['chatModels']=_0x5bfc82['chatModels'],this['id']=_0x5bfc82['conversationId'],this['isFromHistory']=_0x5bfc82['isFromHistory'],this['_channelsToEditors']=_0x5bfc82['channelsToEditors'],this['_getSessionId']=_0x5bfc82['getSessionId'];}async['init'](_0x1b4d6e){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x1b4d6e,'ownerId':this['id']}),this['chatContext']['delegate'](...gs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...ws)['to'](this),this['chatCapabilities']['init']();const _0xbc732a=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0xbc732a});const _0x54dc83=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x54dc83&&await this['setModel'](_0x54dc83);}catch(_0x5b0cdb){const _0xe6d5b8=new ht('ai-chat-conversation-init-failed',null,{'message':_0x5b0cdb['message']||_0x5b0cdb});_0xe6d5b8['stack']=_0x5b0cdb['stack'],this['fire']('error',{'error':_0xe6d5b8});}}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:_0x5852d8}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x5852d8,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x38ce28){const _0x35fc8a=new ht('ai-chat-conversation-start-failed',null,{'message':_0x38ce28['message'],'conversationId':this['id']});throw _0x35fc8a['stack']=_0x38ce28['stack'],this['fire']('error',{'error':_0x35fc8a}),_0x35fc8a;}}async['load'](_0x1076ff){try{const _0x471d67=await this['connector']['fetchConversation'](_0x1076ff)['getConversation'](),_0x27bae4=await this['connector']['fetchConversationMessages'](_0x1076ff)['getMessages'](),_0x4849f6=_0x27bae4[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x471d67['id'],'title'in _0x471d67?this['fire']('setConversationTitle',_0x471d67['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x356ad6=(await this['chatModels']['getAll']())['find'](_0x589696=>_0x589696['id']['toLowerCase']()===_0x4849f6['toLowerCase']());this['selectedModel']=_0x356ad6,this['fire']('modelSelected',{'selectedModel':_0x356ad6,'isDisabled':!0x0});const {streamingMessageId:_0x16cc9e}=await this['_processMessagesToInteractions'](_0x27bae4,_0x4849f6);return _0x16cc9e&&this['currentInteraction']?this['_resumeStream'](_0x16cc9e):this['currentInteraction']=void 0x0,this;}catch(_0x56d563){const _0x5ff5e3=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0x56d563['message'],'conversationId':_0x1076ff});throw _0x5ff5e3['stack']=_0x56d563['stack'],this['fire']('error',{'error':_0x5ff5e3}),_0x5ff5e3;}}async['_processMessagesToInteractions'](_0x539636,_0x2bac04){let _0x470f9f,_0x10d0a1,_0x4e181a=!0x1;for(const _0x3eb789 of _0x539636)if('user'===_0x3eb789['role']){const {contextItems:_0x16ebcb,hasUnmatched:_0x329e68}=await this['_extractContextItems'](_0x3eb789);_0x4e181a=_0x329e68;const _0x222ef8={'isReasoningEnabled':Object['hasOwn'](_0x3eb789['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x3eb789['capabilities'],'webSearch')};_0x470f9f=this['createInteraction']({'userMessage':_0x3eb789['prompt'],'contextItems':_0x16ebcb,'capabilities':_0x222ef8,'modelId':_0x2bac04,'attributes':_0x3eb789['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x470f9f,_0x10d0a1=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x3eb789['role']&&_0x470f9f){if('streaming'===_0x3eb789['status']){_0x10d0a1=_0x3eb789['id'];continue;}if('error'===_0x3eb789['status'])continue;const _0x3cc719=[];for(const _0x4e9ce4 of _0x3eb789['content'])switch(_0x4e9ce4['type']){case'text':case'modification':{const _0x586304=_0x470f9f['getDocumentContext'](),_0x18062c=this['_hasSessionMismatch'](_0x586304)||_0x4e181a;_0x470f9f['currentReply']?.['type']!==_0x4e9ce4['type']&&(_0x470f9f['currentReply']=_0x470f9f['createReply']({'type':_0x4e9ce4['type'],'isDone':!0x0,'interactionId':_0x470f9f['id'],'areActionsDisabled':_0x18062c,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3cc719['length']>0x0&&(_0x470f9f['currentReply']['sources']=_0x3cc719['splice'](0x0))),_0x470f9f['currentReply']['appendContent'](_0x4e9ce4['content'],_0x4e9ce4['documentId']);break;}case'url':_0x3cc719['push'](_0x4e9ce4);break;case'mcp-tool-result':{const {data:_0x14a67c,attributes:_0x5c1017}=JSON['parse'](_0x4e9ce4['content']);_0x470f9f['_handleToolResultData']({'toolName':_0x4e9ce4['toolName'],'data':_0x14a67c,'attributes':_0x5c1017});break;}}'cancelled'===_0x3eb789['status']&&this['fire']('error',{'interactionId':_0x470f9f['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x10d0a1};}async['_resumeStream'](_0x501719){if(this['currentInteraction'])try{const _0x26c4e7=this['connector']['resumeStream'](this['id'],_0x501719);await this['currentInteraction']['resume'](_0x26c4e7);}catch(_0x30a739){_0x30a739 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x30a739});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x19fd49){const _0x2d757f=new Map();if(!_0x19fd49['content'])return{'contextItems':_0x2d757f,'hasUnmatched':!0x1};const {contextItem:_0x1e0cf5,hasUnmatched:_0x1be122}=await this['chatContext']['populateDocumentsFromMessage'](_0x19fd49['content'],Array['from'](this['_channelsToEditors']['values']()));_0x1e0cf5&&_0x2d757f['set'](_0x1e0cf5['id'],_0x1e0cf5);for(const _0x42e3cd of _0x19fd49['content']){if('document'===_0x42e3cd['type'])continue;const _0x589faa=await this['chatContext']['populateFromMessage'](_0x42e3cd);_0x589faa&&_0x2d757f['set'](_0x589faa['id'],_0x589faa);}return{'contextItems':_0x2d757f,'hasUnmatched':_0x1be122};}async['handleUserInteraction']({userMessage:_0x3f0ec5,attributes:_0x29a7e6}){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 _0x32f4f7=new Map(this['getPendingContextItems']()),_0x26d400=this['chatCapabilities']['getCapabilitiesConfig'](),_0x450797=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x3f0ec5,'contextItems':_0x32f4f7,'capabilities':_0x26d400,'modelId':_0x450797,'attributes':_0x29a7e6,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x56e706){if(_0x56e706 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x56e706});else{const _0x43450c=As['get'](_0x56e706['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x43450c,null,{'error':_0x56e706})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x55b0dd,contextItems:_0x180c3a,capabilities:_0xe2d9c7,modelId:_0x5addb0,attributes:_0x5ad9d3,channelsToEditors:_0x52b01c}){const _0x46e908=new AIChatInteraction({'userMessage':_0x55b0dd,'contextItems':_0x180c3a,'capabilities':_0xe2d9c7,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x5addb0,'attributes':_0x5ad9d3,'channelsToEditors':_0x52b01c});return _0x46e908['delegate'](...Is)['to'](this),this['interactions']['push'](_0x46e908),this['fire']('interactionCreated',_0x46e908),_0x46e908;}['getInteraction'](_0x6eec94){return this['interactions']['find'](_0x1e7b16=>_0x1e7b16['id']===_0x6eec94);}['removeInteraction'](_0x26c8af){const _0x1d863f=this['getInteraction'](_0x26c8af);_0x1d863f&&(_0x1d863f['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x1d863f),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x206335=this['lastInteraction'];_0x206335?.['conversationId']&&_0x206335['messageId']&&this['connector']['cancelStream'](_0x206335['conversationId'],_0x206335['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x4b32e8){this['chatContext']['addCurrentDocumentToContext'](_0x4b32e8);}async['updateCurrentDocumentsInContext'](_0x2166e2){await this['chatContext']['updateCurrentDocuments'](_0x2166e2);}['toggleAddCurrentDocumentOptionVisibility'](_0x4b30ab){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x4b30ab);}['_hasSessionMismatch'](_0x482b2a){return!!_0x482b2a&&_0x482b2a['documents']['some'](_0x4fa76b=>{const _0x3c5b3d=this['_channelsToEditors']['get'](_0x4fa76b['channelId']);return!_0x3c5b3d||_0x4fa76b['sessionId']!==this['_getSessionId'](_0x3c5b3d);});}['addSelectionToContext'](_0x20b112){this['chatContext']['addSelectionToContext'](_0x20b112);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x44cfa1){this['chatContext']['addFilesToContext'](_0x44cfa1);}['addUrlToContext'](_0x399db6){this['chatContext']['addUrlToContext'](_0x399db6);}['addToolItemToContext'](_0x4329b2){this['chatContext']['addToolItemToContext'](_0x4329b2);}['addResourceToContext'](_0x979096,_0x43fe0b){this['chatContext']['addResourceToContext'](_0x979096,_0x43fe0b);}['loadSourceResources'](_0x57b4e9,_0x40a443,_0x134663){return this['chatContext']['loadSourceResources'](_0x57b4e9,_0x40a443,_0x134663);}['removeFromContext'](_0x48b4db){this['chatContext']['removeFromContext'](_0x48b4db);}['setWebSearch'](_0x226c08){this['chatCapabilities']['setWebSearch'](_0x226c08);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x1aec8f){this['chatCapabilities']['setReasoning'](_0x1aec8f);}['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'](_0x397589){_0x397589?!0x1===await this['chatModels']['isAvailable'](_0x397589)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x397589}),_0x397589=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x397589=(await this['chatModels']['getAvailableModels']())[0x0]),_0x397589['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x397589,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x397589}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x5c8ce9,config:_0x43f30d,locale:_0x2eb142}){super(),this['_connector']=_0x5c8ce9,this['_config']=_0x43f30d,this['_locale']=_0x2eb142;}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 _0x16480f=await this['getAll']();let _0x22d4d6;return _0x22d4d6=this['_availableModels']?this['_filterModels'](_0x16480f,this['_availableModels']):_0x16480f['filter'](_0x39fb0e=>_0x39fb0e['recommended']),_0x22d4d6;}async['getModel'](_0x3480a3){const _0x1809d1=await this['getAll']();if(!_0x1809d1['length'])return null;if(_0x3480a3){const _0x4f198c=this['_getModelById'](_0x1809d1,_0x3480a3);if(_0x4f198c)return _0x4f198c;wt('ai-chat-model-id-unrecognized',{'modelId':_0x3480a3,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x30c6db=await this['getAvailableModels']();if(!_0x30c6db['length'])return null;if(this['_defaultModelId']){const _0x1d549b=this['_getModelById'](_0x30c6db,this['_defaultModelId']);if(_0x1d549b)return _0x1d549b;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x30c6db[0x0]['id']});}return _0x30c6db[0x0];}async['isAvailable'](_0x5b9170){return(await this['getAvailableModels']())['some'](_0x54ad95=>_0x54ad95['name']===_0x5b9170['name']&&_0x54ad95['provider']===_0x5b9170['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0xbb433f=this['_locale']['uiLanguage']||'en',_0x42139d=this['_connector']['getModels'](_0xbb433f),_0x2c87fb=await _0x42139d['list']();this['_modelList']=_0x2c87fb['items']['map'](_0xcd442a=>Cs(_0xcd442a)?{..._0xcd442a,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0xcd442a);}catch(_0x5540e2){throw Ct('ai-models-unable-to-retrieve',{'error':_0x5540e2}),_0x5540e2;}return[...this['_modelList']];}['_filterModels'](_0x2e391c,_0x51e16e){let _0x24d5fb;if(_0x51e16e){_0x24d5fb=[];const _0x25d439=new Set(),_0x222cfc='string'==typeof _0x51e16e?[_0x51e16e['toLocaleLowerCase']()]:_0x51e16e['map'](_0x544f6e=>_0x544f6e['toLocaleLowerCase']());for(const _0x4b45fd of _0x222cfc)for(const _0xc6aaf5 of _0x2e391c)!_0x25d439['has'](_0xc6aaf5['id'])&&this['_isMatchingFilter'](_0xc6aaf5,_0x4b45fd)&&(_0x24d5fb['push'](_0xc6aaf5),_0x25d439['add'](_0xc6aaf5['id']));}else _0x24d5fb=_0x2e391c;return _0x24d5fb;}['_isMatchingFilter'](_0x5f09f0,_0x45b10f){const _0x1a048f=_0x5f09f0['id']['toLocaleLowerCase'](),_0x333990=_0x5f09f0['name']['toLocaleLowerCase'](),_0x31e5b3=_0x5f09f0['provider']['toLocaleLowerCase']();return _0x1a048f===_0x45b10f||_0x333990===_0x45b10f||Cs(_0x5f09f0)&&'auto'===_0x45b10f||_0x31e5b3===_0x45b10f||_0x1a048f['startsWith'](_0x45b10f);}['_getModelById'](_0x3374a8,_0x470b6e){return _0x3374a8['find'](_0xc7ae55=>Cs(_0xc7ae55)&&'auto'===_0x470b6e?_0xc7ae55:_0xc7ae55['id']===_0x470b6e)||null;}}function Cs(_0x85c63f){return _0x85c63f['id']['startsWith']('agent');}function ms(_0x571560){return _0x571560?_0x571560 instanceof _0x1d8ba0?[_0x571560]:_0x571560['editors']&&0x0!==_0x571560['editors']['length']?Array['from'](_0x571560['editors']):[]:[];}function ps(_0x4db77d){const _0x5c49d8=ms(_0x4db77d);if(!_0x5c49d8['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x5c49d8['length'])return _0x5c49d8[0x0];const _0x4b1d42=_0x5c49d8['find'](_0x257a4c=>_0x257a4c['ui']?.['focusTracker']?.['isFocused']);if(_0x4b1d42)return _0x4b1d42;const _0x575c3d=function(_0x444e74){if(_0x444e74 instanceof _0x1d8ba0)return;const _0x342ab5=_0x444e74;if(!_0x342ab5['plugins']||!_0x342ab5['plugins']['has']('AIEditing'))return;const _0x22f2ac=_0x342ab5['plugins']['get']('AIEditing');return _0x22f2ac['getLastContentFocusedEditor']?.();}(_0x4db77d);return _0x575c3d&&_0x5c49d8['includes'](_0x575c3d)?_0x575c3d:_0x5c49d8[0x0];}function Es({interaction:_0x5a8b3c,reply:_0x213f8f,groups:_0x4045ff,transform:_0x2ad608,documentCompare:_0x54e290,documentCompareOptions:_0x1d403b}){const _0xb64c36=_0x5a8b3c['getDocumentContext']()['documents']['find'](_0x17e020=>_0x17e020['id']==_0x4045ff[0x0]['documentId']),_0x553531=_0x4045ff[0x0]['editor'];if(!_0xb64c36)return[];const _0x232463=_0xb64c36['content'],_0x2cc84f=_0xb64c36['version'],_0x396ab4=_0x213f8f['documentContextContent']['get'](_0x4045ff[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x3d5833}of _0x4045ff){const _0x4dee82=_0x3d5833['filter'](_0x1c1297=>'new'!=_0x1c1297['type'])['map'](_0xb2e03f=>Yi('data-id',_0xb2e03f['id'],_0x396ab4)),_0x10fc45=_0x3d5833['filter'](_0x465550=>'removed'!=_0x465550['type'])['map'](_0x1bcad=>_0x1bcad['node']['cloneNode'](!0x0));let _0x545feb=null;if(_0x4dee82['length']){_0x545feb=_0x4dee82[0x0]['previousSibling'];for(let _0x19ea82=0x0;_0x19ea82<_0x4dee82['length'];_0x19ea82++)_0x1da415(_0x4dee82[_0x19ea82]);}if(_0x10fc45['length']){_0x545feb||(_0x3d5833[0x0]['anchorId']?_0x545feb=Yi('data-id',_0x3d5833[0x0]['anchorId'],_0x396ab4):(_0x545feb=_0x10fc45['shift'](),_0x15734a(_0x396ab4,_0x545feb)));for(let _0x36a06f=0x0;_0x36a06f<_0x10fc45['length'];_0x36a06f++)_0x962aa(_0x545feb,_0x10fc45[_0x36a06f]),_0x545feb=_0x10fc45[_0x36a06f];}}const _0x59846f=Ki(_0x396ab4),_0x3e0232=_0x54e290['getDiff'](_0x232463,_0x59846f,{'targetEditor':_0x553531,..._0x1d403b})['getOperations']();if(_0x2ad608){const _0x5974ef=_0x553531['model']['document']['history']['getOperations'](_0x2cc84f),_0x1b5366={'document':_0x553531['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x437900(_0x3e0232,_0x5974ef,_0x1b5366)['operationsA'];}return _0x3e0232;}function Ts(_0x2a9677,_0x28343c){if('marker'!=_0x28343c['type'])return;const _0x4d8972=_0x2a9677['model']['markers']['get'](_0x28343c['name']);_0x4d8972&&(_0x28343c['oldRange']=_0x4d8972['getRange']());}function fs(_0x5cadf5,_0x548796){if(_0x5cadf5['files']['length']>0x0&&_0x548796['filesEnabled']){const _0x4524f2=_0x5cadf5['files']['filter'](_0x2c938c=>_0x2c938c['name']);return _0x4524f2['length']>0x0?{'type':'file','files':_0x4524f2}:null;}if(_0x548796['urlsEnabled']){const _0xd17a61=function(_0x4c2521){const _0x1c4212=_0x4c2521['trim']();if(/\s/['test'](_0x1c4212))return null;try{const _0x40cfe0=new URL(_0x1c4212);return'http:'!==_0x40cfe0['protocol']&&'https:'!==_0x40cfe0['protocol']?null:_0x40cfe0['toString']();}catch{return null;}}(_0x5cadf5['plainText']);if(_0xd17a61)return{'type':'url','url':_0xd17a61};}const _0x5f4ef8=_0x5cadf5['forceTextAttachment']?0x1:_0x548796['longTextThreshold']??0x1/0x0;if(_0x5cadf5['plainText']['length']>=Math['max'](_0x5f4ef8,0x1)&&_0x548796['filesEnabled']){const _0x320aa0=_0x548796['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x5cadf5['plainText']],_0x320aa0,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x21ae07{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x76057];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x53fdd8=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x4c92b1,_0x2fb440)=>{this['_handleUIUserMessage']({'message':_0x2fb440});}),this['listenTo'](_0x53fdd8['view'],'change:activeTab',(_0x34ff41,_0xb80b25,_0x3b53e1)=>{'chat'!==_0x3b53e1&&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',(_0x5d9670,_0x4736a6)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x4736a6));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x4a0c6a,_0x3200d7)=>{this['activeConversation']?.['addUrlToContext'](_0x3200d7);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x395663,_0x186c9c)=>{const _0x396c54=this['activeConversation'];if(!_0x396c54)return;_0x186c9c['hasDirectory']&&(_0x186c9c['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x126121=fs(_0x186c9c,{'pastedTextLabel':Mi(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')});_0x126121&&(_0x186c9c['preventDefault'](),'url'===_0x126121['type']?_0x396c54['addUrlToContext'](_0x126121['url']):_0x396c54['chatContext']['addFilesToContext'](_0x126121['files'],void 0x0,_0x126121['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5933b6,_0x5be870)=>{_0x5be870['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x3f2bfa,_0x48a5ef)=>{this['activeConversation']?.['addResourceToContext'](_0x48a5ef['source'],_0x48a5ef['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x259799,_0x34a9ab)=>{this['_removeFromContext'](_0x34a9ab);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x27045c,_0x18f256)=>{this['activeConversation']?.['loadSourceResources'](_0x18f256['sourceId'],_0x18f256['query'],_0x18f256['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x332a76,_0x5479b5)=>{this['activeConversation']?.['setModel'](_0x5479b5);}),this['listenTo'](this['_aiChatUi'],'like',(_0x581ab0,{replyId:_0x55bed0})=>{console['log']('Liked\x20response',_0x55bed0);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x478f33,{replyId:_0x1b2681})=>{console['log']('Disliked\x20response',_0x1b2681);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4d12fd,_0x1bf860)=>{this['_insertSuggestion'](_0x1bf860);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x35bf02,{replyId:_0x423856,partIndex:_0x3094ef})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x423856,_0x3094ef);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0xdde402,{replyId:_0x4bc47a,partIndex:_0xbfab2c})=>{const _0x211f24=this['_getDocumentRangeForReplyChanges'](_0x4bc47a,_0xbfab2c);if(!_0x211f24)return;const {reply:_0x309e64}=this['getInteractionAndReplyById'](_0x4bc47a);'$graveyard'!=_0x211f24['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x309e64['changeGroups'][_0xbfab2c]['editor'],'ranges':[_0x211f24['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x15f69a,_0x1b6557)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x1b6557);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x1fd146,{replyId:_0x287e22,showDiff:_0x2f8e3c})=>{const {interaction:_0x3bfbae,reply:_0x3bc8e5}=this['getInteractionAndReplyById'](_0x287e22),_0x367cff=_0x3bc8e5['getContentParts']({'showDiff':_0x2f8e3c});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3bfbae['id']+':'+_0x3bc8e5['id'],'parts':_0x367cff});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x555056,{replyId:_0x2cdbb9,partIndex:_0xb0516d})=>{this['_rejectSuggestion']({'replyId':_0x2cdbb9,'partIndex':_0xb0516d}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x15eb1f,_0x571213)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x571213);}),this['on']('replyCreated',(_0x236d79,_0x52b7f8)=>{this['_addFeedItemReply'](_0x52b7f8);});}['afterInit'](){this['context']instanceof _0x1d8ba0?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x45f406,_0x105e68)=>{_0x105e68['on']('ready',()=>{this['_integrateEditor'](_0x105e68);});}),this['_initConversation']();}async['_initConversation'](){const _0x5e0c34=this['context']['config']['get']('ai.chat.initialConversation');let _0x4bca27=_0x5e0c34;('lastCreated'!=_0x5e0c34||(_0x4bca27=await this['_getLastCreatedConversationId'](),_0x4bca27))&&('new'==_0x4bca27?await this['_startConversationSafely']():await this['loadConversation'](_0x4bca27));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x52ec09){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x52ec09)['getConversation'](),await this['_startConversationSafely']({'id':_0x52ec09}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x52ec09),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x2ba4ee){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x52ec09}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x2ba4ee}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x554a5c){let _0x2ab2bf=null,_0x5c3746=null;this['on']('toolDataReceived',(_0x152ccd,_0x5af016,_0x39efa8)=>{_0x39efa8['id']!==_0x2ab2bf&&(_0x2ab2bf=_0x39efa8['id'],_0x5c3746=this['_getAIChatFeedAPI'](_0x39efa8)),_0x554a5c(_0x5af016,_0x5c3746);});}['addCurrentDocumentToChatContext'](){ms(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x4b8ae8){const _0x5b8cb3=this['_aiEditing']['getSelectionText'](_0x4b8ae8);this['activeConversation']?.['addSelectionToContext'](_0x5b8cb3),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x9d7d66){await this['_startConversationSafely']({'modelId':_0x9d7d66?.['modelId']});}async['sendMessage'](_0x329da7){await this['_handleUIUserMessage'](_0x329da7);}['getGroupId'](){const _0x6917ef=this['context']['config']['get']('collaboration.channelId');if(!_0x6917ef)throw new ht('ai-missing-channel-id',this);return _0x6917ef;}['_handleRemovedConversation'](_0x4297a1){this['activeConversation']['id']===_0x4297a1&&this['_startConversationSafely']();}['_insertSuggestion'](_0x419692){const _0x4ab06e=this['context']['plugins']['get'](_0x76057),{reply:_0x255911,interaction:_0x5e2504}=this['getInteractionAndReplyById'](_0x419692['replyId']),_0x118fce=void 0x0!==_0x419692['partIndex']?[_0x255911['changeGroups'][_0x419692['partIndex']]]:_0x255911['changeGroups']['filter'](_0x3bba58=>'pending'==_0x3bba58['state']);_0x118fce['map'](_0x509362=>_0x255911['changeGroups']['indexOf'](_0x509362))['forEach'](_0x1755eb=>{const _0x2b9543=this['_getDocumentRangeForReplyChanges'](_0x419692['replyId'],_0x1755eb);_0x2b9543&&'$graveyard'!=_0x2b9543['range']['root']['rootName']?(_0x255911['setChangeGroupState'](_0x1755eb,'accepted'),void 0x0!==_0x419692['partIndex']&&this['_scrollToSuggestionRange'](_0x2b9543['range'],!0x1,_0x2b9543['targetEditor'])):_0x255911['setChangeGroupState'](_0x1755eb,'outdated');});const _0x20f89b={},_0x9796dc=_0x118fce['reduce']((_0x381d20,_0xddf3ff)=>('outdated'===_0xddf3ff['state']||(_0x381d20[_0xddf3ff['documentId']]=[..._0x381d20[_0xddf3ff['documentId']]||[],_0xddf3ff],_0x20f89b[_0xddf3ff['documentId']]=[..._0x20f89b[_0xddf3ff['documentId']]||[],_0x255911['changeGroups']['indexOf'](_0xddf3ff)]),_0x381d20),{});for(const [_0x377e5d,_0x4cb80c]of Object['entries'](_0x9796dc)){const _0x4e87db=_0x4cb80c[0x0]['editor'];if(!_0x4e87db['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x4e87db});continue;}const _0x57054b=Es({'reply':_0x255911,'interaction':_0x5e2504,'groups':_0x4cb80c,'transform':!0x0,'documentCompare':_0x4ab06e,'documentCompareOptions':{'anchor':_0x4cb80c[0x0]['rootName'],'markDeletions':!0x0}});let _0x5e8a7c;_0x4e87db['model']['change'](_0x48cf5b=>{_0x5e8a7c=_0x48cf5b['batch'],_0x4e87db['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x57054b),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x5e8a7c,{'interactionId':_0x5e2504['id'],'replyId':_0x255911['id'],'indexes':_0x20f89b[_0x377e5d]});}this['_updateRatings'](_0x255911);}['_applySuggestion'](_0x5f3b71){const _0x1177a7=this['context']['plugins']['get'](_0x76057),{reply:_0x31c07f,interaction:_0x2974d8}=this['getInteractionAndReplyById'](_0x5f3b71['replyId']),_0x2310e5=void 0x0!==_0x5f3b71['partIndex']?[_0x31c07f['changeGroups'][_0x5f3b71['partIndex']]]:_0x31c07f['changeGroups']['filter'](_0x5b1105=>'pending'==_0x5b1105['state']);_0x2310e5['map'](_0x2c87e3=>_0x31c07f['changeGroups']['indexOf'](_0x2c87e3))['forEach'](_0x50eb9b=>{const _0x1692a8=this['_getDocumentRangeForReplyChanges'](_0x5f3b71['replyId'],_0x50eb9b);_0x1692a8&&'$graveyard'!=_0x1692a8['range']['root']['rootName']?(_0x31c07f['setChangeGroupState'](_0x50eb9b,'accepted'),void 0x0!==_0x5f3b71['partIndex']&&this['_scrollToSuggestionRange'](_0x1692a8['range'],!0x1,_0x1692a8['targetEditor'])):_0x31c07f['setChangeGroupState'](_0x50eb9b,'outdated');});const _0x43e74c={},_0x10cb2f=_0x2310e5['reduce']((_0x143b2a,_0x51843f)=>('outdated'===_0x51843f['state']||(_0x143b2a[_0x51843f['documentId']]=[..._0x143b2a[_0x51843f['documentId']]||[],_0x51843f],_0x43e74c[_0x51843f['documentId']]=[..._0x43e74c[_0x51843f['documentId']]||[],_0x31c07f['changeGroups']['indexOf'](_0x51843f)]),_0x143b2a),{});for(const [_0x3f0e21,_0x185461]of Object['entries'](_0x10cb2f)){const _0x39c0dc=Es({'reply':_0x31c07f,'interaction':_0x2974d8,'groups':_0x185461,'transform':!0x0,'documentCompare':_0x1177a7,'documentCompareOptions':{'anchor':_0x185461[0x0]['rootName'],'markDeletions':!0x1}});let _0x982420;const _0x18da05=_0x185461[0x0]['editor'];_0x18da05['model']['change'](_0x1d6389=>{_0x982420=_0x1d6389['batch'];for(const _0x1892b5 of _0x39c0dc)_0x1892b5['baseVersion']=_0x18da05['model']['document']['version'],Ts(_0x18da05,_0x1892b5),_0x1d6389['batch']['addOperation'](_0x1892b5),_0x18da05['model']['applyOperation'](_0x1892b5);}),this['_batchToChanges']['set'](_0x982420,{'interactionId':_0x2974d8['id'],'replyId':_0x31c07f['id'],'indexes':_0x43e74c[_0x3f0e21]});}this['_updateRatings'](_0x31c07f);}['_rejectSuggestion'](_0x219830){const {reply:_0x12bf5e}=this['getInteractionAndReplyById'](_0x219830['replyId']);_0x12bf5e['setChangeGroupState'](_0x219830['partIndex'],'rejected');}['_openBalloonFor'](_0x11f5ab,_0x37eb93){if(!this['_hasAIChatBalloon'])return;const {reply:_0xb847b}=this['getInteractionAndReplyById'](_0x11f5ab),_0x38fc74=_0xb847b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x38fc74['length'])return;let _0x17f99c,_0x3d606f;if(void 0x0!==_0x37eb93?(_0x3d606f=_0x38fc74['find'](_0x205fe5=>_0x205fe5['index']==_0x37eb93),_0x17f99c=_0x3d606f?.['index']):(_0x3d606f=_0x38fc74[0x0],_0x17f99c=_0x3d606f['index']),!_0x3d606f)return void _0xb847b['setChangeGroupState'](_0x37eb93??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x11f5ab&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x17f99c)return;const _0x3d103a=this['_getUserPresentableContentPartDocumentRange'](_0x11f5ab,_0xb847b,_0x3d606f),_0x53ba1c=_0xb847b['changeGroups']['find'](_0x565971=>_0x565971['index']==_0x17f99c)['editor'],_0x222f5f=_0x53ba1c['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x222f5f&&this['_activeBalloon']['close'](),!_0x3d103a)return _0x222f5f['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x222f5f,this['_currentPreviewedChangeGroup']={'replyId':_0x11f5ab,'partIndex':_0x17f99c},this['_scrollToSuggestionRange'](_0x3d103a,!0x0,_0x53ba1c);const _0x2bb22e=this['_getPresentableSiblingContentPartIndex'](_0x11f5ab,_0x17f99c,'next');_0x222f5f['clearContent'](),_0x222f5f['updateContent']({'part':_0x3d606f,'renderingStrategy':'static'}),_0x222f5f['open']({'index':_0x17f99c,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x17f99c+0x1)['toString']()),'showRotator':null!==_0x2bb22e,'ranges':[_0x3d103a],'areActionsDisabled':_0xb847b['areActionsDisabled'],'targetEditor':_0x53ba1c}),_0x222f5f['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x11f5ab,_0x17f99c),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x11f5ab,'index':_0x17f99c,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x12ca6d,_0x4ccd81,_0x3e75ae){const {reply:_0x5a0b2b}=this['getInteractionAndReplyById'](_0x12ca6d),_0x1bbf21=_0x5a0b2b['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x1bbf21['length'])return null;const _0x5f1339='next'==_0x3e75ae?0x1:-0x1;function _0x288a7c(_0x1a7061){const _0x16e8f7=(_0x1a7061+_0x5f1339+_0x1bbf21['length'])%_0x1bbf21['length'];return{'siblingIndex':_0x16e8f7,'siblingPart':_0x1bbf21[_0x16e8f7]};}const _0x215e5d=_0x1bbf21['findIndex'](_0x450304=>_0x450304['index']==_0x4ccd81);let {siblingIndex:_0x1b6d75,siblingPart:_0x32e057}=_0x288a7c(_0x215e5d);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x12ca6d,_0x5a0b2b,_0x32e057);)if({siblingIndex:_0x1b6d75,siblingPart:_0x32e057}=_0x288a7c(_0x1b6d75),_0x1b6d75===_0x215e5d)return null;return _0x32e057['index'];}['_getUserPresentableContentPartDocumentRange'](_0x3bba25,_0xda81ad,_0x3a5302){const _0x300738=_0xda81ad['changeGroups'];if(!_0x3a5302['hasChanges'])return null;const _0x435f3f=_0x300738['find'](_0x2adc77=>_0x2adc77['index']==_0x3a5302['index']);if('pending'!==_0x435f3f?.['state'])return null;if('destroyed'===_0x435f3f?.['editor']['state'])return _0xda81ad['setChangeGroupState'](_0x3a5302['index'],'outdated'),null;const _0x47dbb0=this['_getDocumentRangeForReplyChanges'](_0x3bba25,_0x3a5302['index']);if(!_0x47dbb0)return _0xda81ad['setChangeGroupState'](_0x3a5302['index'],'outdated'),null;const {range:_0x299816,currentIndex:_0x425833}=_0x47dbb0;return'$graveyard'==_0x299816['root']['rootName']?(_0xda81ad['setChangeGroupState'](_0x425833,'outdated'),null):_0x47dbb0['range'];}['_getDocumentRangeForReplyChanges'](_0x236e86,_0x2235fa){const {reply:_0x4edc11,interaction:_0x59f4ae}=this['getInteractionAndReplyById'](_0x236e86),_0x317adf=_0x4edc11['changeGroups']['filter'](_0x495dc9=>'pending'==_0x495dc9['state']),_0x562644=_0x317adf['map'](_0x96b7dd=>_0x4edc11['changeGroups']['indexOf'](_0x96b7dd));void 0x0===_0x2235fa&&(_0x2235fa=_0x562644[0x0]);const _0xd75cd2=_0x562644['indexOf'](_0x2235fa);if(-0x1==_0xd75cd2)return null;const _0x73792c=_0x317adf[_0xd75cd2],_0x2454ab=_0x73792c['editor'];if('destroyed'===_0x2454ab['state'])return null;const _0x3adcfa=_0x4edc11['documentContextContent']['get'](_0x73792c['documentId']),_0x414419=new _0x597933([]),_0x5cfdd0=new _0x597933([]);for(const _0x2a641d of _0x73792c['changes'])if('removed'!=_0x2a641d['type']&&_0x5cfdd0['children']['push'](_0x2a641d['node']['cloneNode'](!0x0)),'new'!=_0x2a641d['type']){const _0x53772d=_0x43180a(_0x4d7c49=>Xi(_0x4d7c49,'data-id')==_0x2a641d['id'],_0x3adcfa,!0x0);_0x414419['children']['push'](_0x53772d['cloneNode'](!0x0));}if(0x0==_0x414419['children']['length']){if(_0x73792c['changes'][0x0]['anchorId']){const _0x26200b=Yi('data-id',_0x73792c['changes'][0x0]['anchorId'],_0x3adcfa);_0x414419['children']['unshift'](_0x26200b['cloneNode'](!0x0)),_0x5cfdd0['children']['unshift'](_0x26200b['cloneNode'](!0x0)),_0x26200b['nextSibling']&&(_0x414419['children']['push'](_0x26200b['nextSibling']['cloneNode'](!0x0)),_0x5cfdd0['children']['push'](_0x26200b['nextSibling']['cloneNode'](!0x0)));}else{const _0x567c30=_0x3adcfa['children'][0x0];if(!_0x567c30)return null;_0x414419['children']['push'](_0x567c30['cloneNode'](!0x0)),_0x5cfdd0['children']['push'](_0x567c30['cloneNode'](!0x0));}}const _0x73eb1a=_0x59f4ae['getDocumentContext'](),_0x626c4c=_0x73eb1a['content']||_0x73eb1a['documents']['find'](_0x3f5d88=>_0x3f5d88['id']==_0x73792c['documentId'])['content'],_0x3b0f13=_0x2454ab['model']['document']['getRoot'](_0x73792c['rootName']),_0x2dc48e=_0x2454ab['data']['parse'](_0x626c4c,_0x3b0f13),_0x26d1d6=Ki(_0x414419),_0x43ee99=_0x2454ab['data']['parse'](_0x26d1d6,_0x3b0f13),_0x2c2c71=_0x2454ab['data']['parse'](_0x26d1d6,_0x3b0f13),_0x2d9dcc=_0x2454ab['model']['createPositionAt'](_0x43ee99,0x0),_0x5837b5=Ki(_0x5cfdd0),_0x15f701={'targetEditor':_0x2454ab,'anchor':_0x2d9dcc,'markDeletions':!0x1},_0x26e485=_0x2454ab['plugins']['get'](_0x76057)['getDiff'](_0x26d1d6,_0x5837b5,_0x15f701)['getOperations']();if(!_0x26e485['length'])return null;_0x2454ab['model']['change'](_0x77be06=>{for(const _0x1cd12e of _0x26e485)if('remove'==_0x1cd12e['type']){const _0x2b0e24=_0x1cd12e['sourcePosition'],_0x5c4ec4=_0x1cd12e['howMany'],_0x39a8f7=new _0x1e4528(_0x2b0e24,_0x5c4ec4);_0x77be06['batch']['addOperation'](_0x39a8f7),_0x2454ab['model']['applyOperation'](_0x39a8f7);}else'marker'!==_0x1cd12e['type']&&(_0x1cd12e['baseVersion']=null,_0x1cd12e['isDocumentOperation']=!0x1,_0x77be06['batch']['addOperation'](_0x1cd12e),_0x2454ab['model']['applyOperation'](_0x1cd12e));});const _0x4b72ca=cs(_0x2454ab,_0x26e485,_0x43ee99);us(_0x2454ab['model'],_0x4b72ca);const _0x360682=_0x4b72ca['getFirstRange']()['start']['path']['slice'](),_0x26ee06=_0x4b72ca['getFirstRange']()['end']['path']['slice'](),_0xfe4302=[];let _0x4d78ae=_0x43ee99,_0x88fc16=_0x2c2c71;for(let _0x496a35=0x0;_0x496a35<_0x26ee06['length'];_0x496a35++){const _0x2a0be6=_0x4d78ae['maxOffset']-_0x26ee06[_0x496a35];_0xfe4302[_0x496a35]=_0x88fc16['maxOffset']-_0x2a0be6,_0x4d78ae=_0x4d78ae['getChildAtOffset'](_0x26ee06[_0x496a35]),_0x88fc16=_0x88fc16['getChildAtOffset'](_0xfe4302[_0x496a35]);}const _0x373c94=_0x2454ab['model']['createRange'](_0x2454ab['model']['createPositionFromPath'](_0x2c2c71,_0x360682),_0x2454ab['model']['createPositionFromPath'](_0x2c2c71,_0xfe4302)),_0x4ba531=_0x2c2c71['getChild'](0x0)['getAttribute'](_0x2be294),_0x7322b=Array['from'](_0x2dc48e['getChildren']())['find'](_0x4ded17=>_0x4ded17['getAttribute'](_0x2be294)==_0x4ba531)['getPath'](),_0x5e7d4f=_0x373c94['start']['path']['slice'](),_0x202b53=_0x373c94['end']['path']['slice']();_0x5e7d4f[0x0]=_0x7322b[0x0]+_0x5e7d4f[0x0],_0x202b53[0x0]=_0x7322b[0x0]+_0x202b53[0x0];let _0x54cbec=_0x2454ab['model']['createRange'](_0x2454ab['model']['createPositionFromPath'](_0x2454ab['model']['document']['getRoot'](_0x73792c['rootName']),_0x5e7d4f),_0x2454ab['model']['createPositionFromPath'](_0x2454ab['model']['document']['getRoot'](_0x73792c['rootName']),_0x202b53));const _0x3b82b1=_0x73eb1a['documents']['find'](_0x3a58fe=>_0x3a58fe['id']==_0x73792c['documentId'])['version'],_0x4c3092=_0x2454ab['model']['document']['history']['getOperations'](_0x3b82b1);for(const _0x53d12a of _0x4c3092)_0x54cbec=_0x10082a['_createFromRanges'](_0x54cbec['getTransformedByOperation'](_0x53d12a));return{'range':_0x54cbec,'currentIndex':_0x2235fa,'targetEditor':_0x2454ab};}['_integrateEditorBalloon'](_0x554ab8){if(!_0x554ab8['plugins']['has']('AIChatBalloon'))return;const _0x5978f6=_0x554ab8['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x5978f6['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x5978f6,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x4e1153,partIndex:_0x3970d7}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x1dce1f}=this['getInteractionAndReplyById'](_0x4e1153),_0xdab231=_0x1dce1f['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x3970d7});_0x5978f6['updateContent']({'part':_0xdab231[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x5978f6,'applySuggestion',()=>{const {replyId:_0x188d10,partIndex:_0x14c01b}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x188d10,'partIndex':_0x14c01b}),_0x5978f6['setState']('accepted');}),this['listenTo'](_0x5978f6,'insertSuggestion',()=>{const {replyId:_0x544467,partIndex:_0x4dc1fa}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x544467,'partIndex':_0x4dc1fa}),_0x5978f6['setState']('accepted');}),this['listenTo'](_0x5978f6,'rejectSuggestion',()=>{const {replyId:_0x18b9ec,partIndex:_0x394238}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x18b9ec,'partIndex':_0x394238}),_0x5978f6['setState']('rejected');}),this['listenTo'](_0x5978f6,'showNext',()=>{const {replyId:_0x4fb25d,partIndex:_0x48a5bd}=this['_currentPreviewedChangeGroup'],_0x3734df=this['_getPresentableSiblingContentPartIndex'](_0x4fb25d,_0x48a5bd,'next');null!==_0x3734df&&this['_openBalloonFor'](_0x4fb25d,_0x3734df);}),this['listenTo'](_0x5978f6,'showPrevious',()=>{const {replyId:_0x2986d1,partIndex:_0x25cf30}=this['_currentPreviewedChangeGroup'],_0x54029b=this['_getPresentableSiblingContentPartIndex'](_0x2986d1,_0x25cf30,'previous');null!==_0x54029b&&this['_openBalloonFor'](_0x2986d1,_0x54029b);}),this['listenTo'](_0x5978f6,'dialogClosed',(_0x7389c3,{id:_0xdbafcf})=>{if('aiChatBalloon'!==_0xdbafcf)return;const {replyId:_0x49e622,partIndex:_0x50f15e}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x49e622,'index':_0x50f15e,'isActive':!0x1}),this['_activeBalloon']===_0x5978f6&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x5b8d33){if(this['_channelsToEditors']['set'](_0x5b8d33['config']['get']('collaboration.channelId'),_0x5b8d33),this['_integrateEditorBalloon'](_0x5b8d33),this['addCurrentDocumentToChatContext'](),_0x5b8d33['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x5b8d33['plugins']['has']('Undo')){const _0x25f9d0=_0x5b8d33['commands']['get']('undo'),_0x386a2b=_0x5b8d33['commands']['get']('redo');this['listenTo'](_0x25f9d0,'revert',(_0x153f60,_0x3ca928,_0x508dc0)=>{const _0x49d349=this['_batchToChanges']['get'](_0x3ca928);if(!_0x49d349)return;const _0x3b8d65=this['activeConversation']['getInteraction'](_0x49d349['interactionId']),_0x1af9cf=_0x3b8d65?.['getReply'](_0x49d349['replyId']);this['_batchToChanges']['delete'](_0x3ca928),_0x3b8d65&&_0x1af9cf&&(_0x49d349['indexes']['forEach'](_0x1758c6=>_0x1af9cf['setChangeGroupState'](_0x1758c6,'pending')),this['_batchToChanges']['set'](_0x508dc0,_0x49d349));}),this['listenTo'](_0x386a2b,'revert',(_0x3e9c9c,_0x19f9e0,_0x46407b)=>{const _0x58b661=this['_batchToChanges']['get'](_0x19f9e0);if(!_0x58b661)return;const _0x57d673=this['activeConversation']['getInteraction'](_0x58b661['interactionId']),_0xb71d47=_0x57d673?.['getReply'](_0x58b661['replyId']);this['_batchToChanges']['delete'](_0x19f9e0),_0x57d673&&_0xb71d47&&(_0x58b661['indexes']['forEach'](_0x18f92a=>_0xb71d47['setChangeGroupState'](_0x18f92a,'accepted')),this['_batchToChanges']['set'](_0x46407b,_0x58b661));});}const _0x35feb7=_0x5b8d33['config']['get']('ai.chat.context');_0x35feb7['alwaysAddSelection']&&_0x35feb7['document']['enabled']&&this['listenTo'](_0x5b8d33['model']['document']['selection'],'change:range',(_0x351dd6,_0x3d967e)=>{if(!_0x3d967e['directChange'])return;'chat'===_0x5b8d33['plugins']['get']('AITabs')['view']['activeTab']&&(_0x5b8d33['model']['hasContent'](_0x5b8d33['model']['document']['selection'])?this['addSelectionToChatContext'](_0x5b8d33):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x3071b6=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x358b52=await _0x3071b6['getConversations']();return _0x358b52['length']?_0x358b52[0x0]['id']:'new';}catch(_0x357442){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x357442})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x1d2f91={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x1d2f91);}catch(_0x203522){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x1d2f91['id']||at()}),console['error'](_0x203522),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x496f32,modelId:_0xe70114}={}){this['_closeActiveBalloon']();let _0x59a155=_0xe70114;_0x59a155||(_0x496f32||!this['activeConversation']?_0x59a155=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x59a155=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x24a2f7=this['getGroupId'](),_0x9a2019=_0x496f32||at();let _0x1f48ca;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x59a155,'conversationId':_0x9a2019,'group':_0x24a2f7,'locale':this['context']['locale'],'isFromHistory':!!_0x496f32,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x4d0459=>this['_aiEditing']['getSessionId'](_0x4d0459)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x4475c3,_0x5d9302)=>{this['_aiChatUi']['createConversation'](_0x5d9302),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x496f32||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x219cb0,_0x3b69bf)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x3b69bf['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0xed1363=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0xed1363);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x11ed88=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x11ed88);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x48895a,_0x3cca32)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3cca32,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x527958,_0x520bc7)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x520bc7,{'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',(_0x41d21d,_0x37d27f)=>{this['_aiChatUi']['removeFeedInteraction'](_0x37d27f['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x270d31,_0x5b08ee,_0x2f0776)=>{this['_updateConversationTitle'](_0x5b08ee,_0x2f0776);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x1580f0,_0x8c3502)=>{void 0x0!==_0x1f48ca&&_0x1f48ca!==_0x8c3502['id']&&this['_updateReplyContentThrottled']['flush'](),_0x1f48ca=_0x8c3502['id'],_0x8c3502['isFromHistory']?await this['_updateReplyContent']({'reply':_0x8c3502}):await this['_updateReplyContentThrottled']({'reply':_0x8c3502});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x3002cd,{reply:_0x5ea606,index:_0x2dccc8,state:_0xba2c80})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x5ea606['id'],'index':_0x2dccc8,'state':_0xba2c80}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x5ea606['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x2dccc8&&this['_activeBalloon']?.['setState'](_0xba2c80);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0xfc87f,_0x387765)=>{if(this['_aiChatUi']['addContextItem'](_0x387765['contextItem'],_0x387765['isLoading']),'selection'===_0x387765['contextItem']['type']){const _0x194934=ps(this['context']),_0x13ea45=[..._0x194934['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x194934,'ranges':_0x13ea45,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x44ab55,_0x2636b6)=>{this['_aiChatUi']['removeContextItem'](_0x2636b6['uiId']),'current-document'==_0x2636b6['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x2636b6['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x303fea,_0x426988)=>{this['_aiChatUi']['setContextItemLoading'](_0x426988['contextItem']['uiId'],_0x426988['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x46466d,_0x309695)=>{this['_aiChatUi']['setConversationContext'](_0x309695['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x1848c5,_0x4b3474)=>{this['_aiChatUi']['setAddContextOptions'](_0x4b3474['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x2eb04b,_0x2582aa)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x2582aa['sourceId'],_0x2582aa['source'],_0x2582aa['resources'],_0x2582aa['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x43d794,_0x14bee6)=>{this['_aiChatUi']['updateResourceState'](_0x14bee6['sourceId'],_0x14bee6['resourceId'],_0x14bee6['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x503536,_0x494a6e)=>{this['_aiChatUi']['updateCapabilities'](_0x494a6e);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0xa8bfd3,_0x5bd514)=>{const _0x4f9af1=(await this['_aiChatModels']['getAll']())['find'](_0x12675c=>_0x12675c['id']===_0x5bd514['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x4f9af1,_0x5bd514['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x5e8a09,{error:_0x2af77c,interactionId:_0x2832b7,fileName:_0x41df14,url:_0x2554ad,sourceId:_0x5a8e85,sourceLabel:_0x4e7615})=>{const _0x4896df=_0x2832b7?_0x2832b7+':'+at():at();_0x2af77c['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x4896df}):_0x2af77c['message']['startsWith']('ai-chat-conversation-init-failed')||_0x2af77c['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x41df14),'id':_0x4896df}):_0x2af77c['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x2554ad),'id':_0x4896df}):_0x2af77c['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x4896df}):_0x2af77c['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x4896df}):_0x2af77c['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x5a8e85&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x5a8e85),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x4e7615||'source'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x4896df}),this['_logError'](_0x2af77c)):_0x2af77c['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x4896df}),this['_logError'](_0x2af77c)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x4896df}),this['_logError'](_0x2af77c));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x496f32||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0xee2de7,attributes:_0x3c3fb0}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x21e19f=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x21e19f);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0xee2de7,'attributes':_0x3c3fb0});}['_logError'](_0x73af3){Ct(_0x73af3['message'],_0x73af3['data']);}['_removeFromContext'](_0x9f52d){this['activeConversation']?.['removeFromContext'](_0x9f52d);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x394602){const [_0x3c824e,_0x71dcc8]=_0x394602['split'](':'),_0x50acc0=this['activeConversation']['getInteraction'](_0x3c824e),_0x4677be=_0x50acc0['getReply'](_0x71dcc8);return{'interaction':_0x50acc0,'reply':_0x4677be};}['_scrollToSuggestionRange'](_0x40d283,_0x596abe=!0x1,_0x2c88fa){const _0x441ef1={'target':_0x2c88fa['editing']['view']['domConverter']['viewRangeToDom'](_0x2c88fa['editing']['mapper']['toViewRange'](_0x40d283)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x596abe};_0x596abe&&(_0x441ef1['alignToTop']=!0x0),Tt(_0x441ef1);}['_updateConversationTitle'](_0x518831,_0x127264=!0x1){this['_aiChatUi']['setConversationTitle'](_0x518831||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x127264);}['_addFeedItemReply'](_0x483a00){'text'===_0x483a00['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x483a00):this['_aiChatUi']['addFeedItemAISuggestion'](_0x483a00);}async['_updateReplyContent']({reply:_0x2b5673,renderingStrategy:_0x2ee635}){const {id:_0x5da5db,interactionId:_0x5a257f,isDone:_0x44b542,type:_0x294dc4,parsedContent:_0x252c27}=_0x2b5673,_0x1855c5=_0x5a257f+':'+_0x5da5db;if('modification'===_0x294dc4){const _0x40dae5=_0x2b5673['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1855c5,'parts':_0x40dae5,'isDone':_0x44b542,'skipLoadingEffects':_0x2b5673['isFromHistory']});}else'text'===_0x294dc4&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x1855c5,'parsedContent':_0x252c27['get']('text'),'renderingStrategy':_0x2ee635,'isDone':_0x44b542});_0x44b542&&_0x2b5673['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x1855c5,_0x2b5673['sources']);}['_updateReplyContentThrottled']=_0x1ee39e(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x5d3841=this['activeConversation']?.['lastInteraction'];_0x5d3841&&(_0x5d3841['stop'](),this['_aiChatUi']['stopInteraction'](_0x5d3841)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x3c1601=this['activeConversation']?.['lastInteraction'];if(_0x3c1601){for await(const _0x3af6b9 of _0x3c1601['replies'])this['_aiChatUi']['hasFeedItem'](_0x3af6b9['id'])||this['_addFeedItemReply'](_0x3af6b9),await this['_updateReplyContent']({'reply':_0x3af6b9,'renderingStrategy':'static'});}}['_updateRatings'](_0x5222cb){const _0x5b42e7={'positiveCount':_0x5222cb['changeGroups']['filter'](_0x295cda=>'accepted'===_0x295cda['state'])['length'],'totalCount':_0x5222cb['changeGroups']['length'],'modificationId':_0x5222cb['id']},_0x44931d=this['activeConversation']['getInteraction'](_0x5222cb['interactionId'])['messageId'];_0x44931d&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x44931d,_0x5b42e7);}['_getAIChatFeedAPI'](_0x4cd2b4){const _0x40dc15=this['_aiChatUi'],_0x42a9e3=()=>{_0x4cd2b4['resetWebSearchState'](),_0x4cd2b4['resetReasoningState'](),_0x40dc15['clearLoadingMessage']();},_0x1bf98f=()=>{_0x4cd2b4['currentReply']&&(_0x4cd2b4['currentReply']['done'](),_0x4cd2b4['currentReply']=void 0x0);};return{'insertTextReply':(_0x4ae451,_0x47f8b6)=>{_0x1bf98f(),_0x42a9e3();const _0x2fc937=_0x4cd2b4['currentReply']=_0x4cd2b4['createReply']({'type':'text','interactionId':_0x4cd2b4['id'],'id':_0x47f8b6||at(),'channelsToEditors':this['_channelsToEditors']});return _0x2fc937['appendContent'](_0x4ae451),_0x1bf98f(),_0x2fc937;},'insertCustomElement':async(_0x250877,_0x1c676e)=>(_0x1bf98f(),_0x42a9e3(),_0x40dc15['addFeedItemCustomElement'](_0x250877,_0x1c676e||at())),'setLoadingMessage':_0x22196f=>{_0x40dc15['setLoadingMessage'](_0x22196f);},'clearLoadingMessage':()=>{_0x40dc15['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ms(this['context'])['find'](_0x3951ae=>'destroyed'!==_0x3951ae['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const Rs='ai-selection',bs=['br'];class AIEditing extends _0x21ae07{constructor(_0x13c947){super(_0x13c947),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'](_0x1ea807){let _0x494329=this['_sessionIdByEditor']['get'](_0x1ea807);return!_0x494329&&(_0x494329=_0x1ea807['plugins']['has']('RealTimeCollaborationClient')&&_0x1ea807['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x1ea807,_0x494329)),_0x494329;}async['getDocumentData'](){const _0x45897e=ms(this['context']);if(!_0x45897e['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x2da033=[],_0x3e7d2c=new Set();for(const _0x3219bd of _0x45897e){const _0x2f30e1=_0x3219bd['config']['get']('roots')||{};for(const _0x39acb5 of _0x3219bd['model']['document']['getRoots']()){if('$graveyard'===_0x39acb5['rootName'])continue;const _0x2e7394=await this['_getDocumentDataForEditorRoot'](_0x3219bd,_0x39acb5,_0x3e7d2c),_0x1c7ebc=_0x2f30e1[_0x39acb5['rootName']];let _0x24c1db;_0x1c7ebc?.['label']?_0x24c1db=_0x1c7ebc['label']:(wt('ai-document-root-missing-label',{'editor':_0x3219bd,'rootConfig':_0x1c7ebc}),_0x24c1db=_0x39acb5['rootName']),_0x2da033['push']({'editor':_0x3219bd,'rootName':_0x39acb5['rootName'],'content':_0x2e7394['content'],'version':_0x2e7394['version'],'sessionId':this['getSessionId'](_0x3219bd),'channelId':_0x3219bd['config']['get']('collaboration.channelId'),'selections':_0x2e7394['selections'],'name':_0x24c1db,'description':_0x1c7ebc?.['description']});}}return _0x2da033;}async['_getDocumentDataForEditorRoot'](_0x182b23,_0x176548,_0x3ccd49){const _0x12bf71=_0x182b23['data']['toView'](_0x176548,{'convertAiChatSelectionMarker':!0x0}),_0x1510fb=new _0x44fce9(_0x182b23['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x12bf71,_0x1510fb,_0x3ccd49);let _0x55d0ae=await this['_getDocumentDataStringFromView'](_0x12bf71,_0x182b23);const _0x4298ed=this['_getMarkersInDocumentOrder'](_0x182b23,_0x176548),_0x47d893=[];for(const _0x3caed7 of _0x4298ed){const _0x3caf97='<'+_0x3caed7['name']+':start></'+_0x3caed7['name']+':start>',_0x298854=_0x55d0ae['indexOf'](_0x3caf97);_0x55d0ae=_0x55d0ae['substring'](0x0,_0x298854)+_0x55d0ae['substring'](_0x298854+_0x3caf97['length']);const _0x1dfb52='<'+_0x3caed7['name']+':end></'+_0x3caed7['name']+':end>',_0x4b5b2a=_0x55d0ae['indexOf'](_0x1dfb52);_0x55d0ae=_0x55d0ae['substring'](0x0,_0x4b5b2a)+_0x55d0ae['substring'](_0x4b5b2a+_0x1dfb52['length']),_0x47d893['push']({'markerName':_0x3caed7['name'],'start':_0x298854,'end':_0x4b5b2a,'htmlFragment':_0x55d0ae['substring'](_0x298854,_0x4b5b2a)});}return{'content':_0x55d0ae,'version':_0x182b23['model']['document']['version'],'selections':_0x47d893};}['afterInit'](){this['context']instanceof _0x1d8ba0?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x292721,_0x535439)=>{_0x535439['on']('ready',()=>{this['_integrateEditor'](_0x535439);});});}['_setOutputDataProcessor'](_0xeb3b69){this['_outputDataProcessor']=_0xeb3b69;}async['_getDocumentDataStringFromView'](_0x13f13a,_0x5ce04a){let _0x1a02a4;if(this['_outputDataProcessor']){const _0xcb2b7a=_0x5ce04a['data']['processor']['domConverter']['viewToDom'](_0x13f13a),_0x326bbb=await this['_outputDataProcessor'](_0xcb2b7a);_0x1a02a4=_0x5ce04a['data']['processor']['htmlWriter']['getHtml'](_0x326bbb);}else _0x1a02a4=_0x5ce04a['data']['processor']['toData'](_0x13f13a);return _0x1a02a4;}['_integrateEditor'](_0x551343){if(!_0x551343['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x551343);_0x551343['ui']['focusTracker']['on']('change:isFocused',(_0x4f1944,_0xbcce93,_0x74332f)=>{_0x74332f&&(this['_lastContentFocusedEditor']=_0x551343);}),_0x551343['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x551343&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x551343['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Rs,'view':({markerName:_0x2e1c9e})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2e1c9e['split'](':')[0x1]],'priority':0xc})}),_0x551343['conversion']['for']('dataDowncast')['markerToElement']({'model':Rs+':context','view':(_0x21a86f,{writer:_0x90760f,options:_0x4e8e26})=>_0x4e8e26['convertAiChatSelectionMarker']?_0x90760f['createUIElement'](_0x21a86f['markerName']+':'+(_0x21a86f['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x19b664){const _0x36c551=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x19b664);const _0x182041=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x36c551,_0x182041);}['hideFakeVisualSelection'](_0x224603){const _0x48876c=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x224603);const _0x35bdcd=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x48876c,_0x35bdcd);}async['modelToDataWithIds'](_0x3c44e3,_0x3d6403){const _0x3dc3a9=_0x3d6403['data']['toView'](_0x3c44e3),_0x3defa3=new _0x44fce9(_0x3d6403['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x3dc3a9,_0x3defa3),this['_getDocumentDataStringFromView'](_0x3dc3a9,_0x3d6403);}['_setDataIdsOnChildren'](_0x3e245b,_0x1f7bcd,_0x457e05=new Set()){let _0x217f7a=!0x1;for(const _0x543dc8 of _0x3e245b['getChildren']()){if(!_0x543dc8['is']('view:element')||bs['includes'](_0x543dc8['name']))continue;const _0x153e8f=_0x543dc8['is']('view:containerElement'),_0x815264=_0x543dc8['is']('view:emptyElement'),_0x2b3515=_0x543dc8['is']('view:rawElement'),_0x4b9641=this['_setDataIdsOnChildren'](_0x543dc8,_0x1f7bcd,_0x457e05);if(_0x543dc8['hasAttribute']('data-id')){_0x217f7a=!0x0,_0x457e05['add'](_0x543dc8['getAttribute']('data-id'));continue;}(_0x153e8f||_0x815264||_0x2b3515||_0x4b9641)&&(_0x1f7bcd['setAttribute']('data-id',this['_nextDataId'](_0x457e05),_0x543dc8),_0x217f7a=!0x0);}return _0x217f7a;}['_nextDataId'](_0x36ba16){let _0x23739c;do{_0x23739c='';for(let _0x2456e3=0x0;_0x2456e3<0x4;_0x2456e3++)_0x23739c+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x36ba16['has'](_0x23739c));return _0x36ba16['add'](_0x23739c),_0x23739c;}['getSelectionText'](_0x5d36b9){const _0x2f64fd=(_0x5d36b9?_0x5d36b9['model']:ps(this['context'])['model'])['document']['selection'],_0x5b202c=[],_0x1a89f6=Array['from'](_0x2f64fd['getRanges']());_0x1a89f6['sort']((_0x38e3fc,_0x8cac08)=>_0x38e3fc['start']['isBefore'](_0x8cac08['start'])?-0x1:0x1);for(const _0x54976d of _0x1a89f6)for(const _0x5a0947 of _0x54976d['getItems']())_0x5a0947['is']('$textProxy')?_0x5b202c['push'](_0x5a0947['data']):_0x5a0947['is']('element')&&_0x5b202c['length']>0x0&&'\x20'!==_0x5b202c[_0x5b202c['length']-0x1]&&_0x5b202c['push']('\x20');return _0x5b202c['length']?'\x22'+_0x5b202c['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x36c256){for(let _0x4d6a8b=0x0;_0x4d6a8b<this['_fakeSelections']['length'];_0x4d6a8b++)if(this['_fakeSelections'][_0x4d6a8b]['id']==_0x36c256)return void this['_fakeSelections']['splice'](_0x4d6a8b,0x1);}['_addFakeSelection'](_0x3552f3){this['_removeFakeSelectionById'](_0x3552f3['id']),ft(this['_fakeSelections'],_0x3552f3);}['_refreshFakeSelection'](_0x74600e,_0x2506fa){if(_0x74600e==_0x2506fa)return;const _0x2c914e=_0x74600e?_0x74600e['editor']:null,_0x4e76cd=_0x2506fa?_0x2506fa['editor']:null,_0x709ec8=(_0x2ff319,_0x126c8c)=>{const _0x237c25=_0x126c8c['model']['markers']['getMarkersGroup'](Rs);for(const _0x9c2c2 of _0x237c25)_0x2ff319['removeMarker'](_0x9c2c2);},_0x21cc33=(_0x268011,_0x1e91a4,_0x1626ff)=>{const _0x187ca7=_0x1e91a4['model'];for(let _0x205110=0x0;_0x205110<_0x1626ff['ranges']['length'];_0x205110++){let _0x229769=_0x1626ff['ranges'][_0x205110];const _0x341034=Rs+':'+_0x1626ff['id']+':'+_0x205110;if(_0x229769['start']['isAtEnd']){const _0x448a91=_0x229769['start']['getLastMatchingPosition'](({item:_0x307a89})=>!_0x187ca7['schema']['isContent'](_0x307a89),{'boundaries':_0x229769});_0x229769=_0x268011['createRange'](_0x448a91,_0x229769['end']);}_0x268011['addMarker'](_0x341034,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x229769});}};_0x2c914e&&_0x4e76cd&&_0x2c914e===_0x4e76cd&&_0x2506fa?_0x2c914e['model']['change'](_0x629a23=>{_0x709ec8(_0x629a23,_0x2c914e),_0x21cc33(_0x629a23,_0x4e76cd,_0x2506fa);}):(_0x2c914e&&_0x2c914e['model']['change'](_0x4a5a40=>_0x709ec8(_0x4a5a40,_0x2c914e)),_0x4e76cd&&_0x2506fa&&_0x4e76cd['model']['change'](_0x6ebdb5=>_0x21cc33(_0x6ebdb5,_0x4e76cd,_0x2506fa)));}['_getMarkersInDocumentOrder'](_0x43ac4c,_0x2355e0){const _0x1f3069=Array['from'](_0x43ac4c['model']['markers']['getMarkersGroup'](Rs+':context'));return(_0x2355e0?_0x1f3069['filter'](_0x942d9=>{const _0x4adb85=_0x942d9['getRange']();return _0x4adb85&&_0x4adb85['root']['rootName']===_0x2355e0['rootName'];}):_0x1f3069)['sort']((_0x36d99e,_0x10e791)=>_0x36d99e['getStart']()['isBefore'](_0x10e791['getStart']())?-0x1:_0x36d99e['getStart']()['isAfter'](_0x10e791['getStart']())?0x1:0x0);}}const Ss=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Os=[...Ss,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function vs(_0x38ae71){const _0x379408=new AbortController();return{'promise':new Promise((_0x2e3a1e,_0x1c2a5f)=>{const _0x54cbba=setTimeout(_0x2e3a1e,_0x38ae71);_0x379408['signal']['addEventListener']('abort',()=>{clearTimeout(_0x54cbba),_0x1c2a5f();});}),'abortController':_0x379408};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x1ef57f){this['options']={'delay':_0x1ef57f?.['delay']??0xa,'textNodeStyle':_0x1ef57f?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x2f1718,targetElement:_0x1b07f8,abortSignal:_0x3b1dbf}){this['isStreaming']&&this['stop'](),_0x3b1dbf?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x54443e(_0x2f1718,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x17e65b=0x0;_0x17e65b<this['currentIndex'];_0x17e65b++)this['nodesList'][_0x17e65b]['shouldBeStreamed']=!0x0;do{const _0x465a5f=Date['now'](),_0x19f5b5=this['nodesList'][this['currentIndex']],_0x5f3adb=_0x465a5f-this['lastUpdateTime'];if(_0x19f5b5){_0x19f5b5['shouldBeStreamed']=!0x0;let _0x405a84=_0x19f5b5['parent'];for(;_0x405a84;)_0x405a84['shouldBeStreamed']=!0x0,_0x405a84=_0x405a84['parent'];}if(_0x5f3adb<this['options']['delay'])try{const {promise:_0xf5facb,abortController:_0x7a7c1e}=vs(this['options']['delay']-_0x5f3adb);this['timeoutAbortController']=_0x7a7c1e,await _0xf5facb;}catch(_0x569bba){return;}_0x3adf3c(_0x1b07f8,'<'+_0x1b07f8['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x1b07f8['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:_0x40e391}){Array['from'](_0x40e391['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x4448ac=>{_0x4448ac['replaceWith'](_0x4448ac['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x2f8861){let _0x39a02e='';if(function(_0x41a4fd){return _0x49200d(_0x41a4fd);}(_0x2f8861)){for(const _0x591178 of _0x2f8861['children'])_0x39a02e+=this['renderNode'](_0x591178);}else{if(Ns(_0x2f8861)){if(!_0x2f8861['shouldBeStreamed'])return'';const _0x448239=_0x2f8861,_0x15c12e=Object['entries'](_0x448239['attribs'])['map'](([_0x236e09,_0x144af8])=>_0x236e09+'=\x22'+_0x144af8+'\x22')['join']('\x20');_0x39a02e+='<'+_0x448239['tagName']+(_0x15c12e?'\x20'+_0x15c12e:'')+'>';for(const _0x32350e of _0x44cd73(_0x448239))_0x39a02e+=this['renderNode'](_0x32350e);_0x39a02e+='</'+_0x448239['tagName']+'>';}else{if(!ys(_0x2f8861))return'';if(!_0x2f8861['shouldBeStreamed'])return'';!function(_0x5e56ac){if(!_0x5e56ac['parent']||!Ns(_0x5e56ac['parent']))return!0x1;if(!ks['includes'](_0x5e56ac['parent']['tagName']))return!0x1;return!ti(_0x5e56ac)['match'](/^\s*[<>]\s*$/);}(_0x2f8861)?_0x39a02e+=_0x1441a0(_0x2f8861):_0x39a02e+=_0x1441a0(new _0x43db7e('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x2f8861]));}}return _0x39a02e;}['getParsedDocumentNodeList'](){const _0x46f377=[];return function(_0xd60469,_0x3eb55d){const _0x13c027=_0x436115=>{if(_0x3eb55d(_0x436115),_0x436115 instanceof _0x20060f)for(let _0x35e4b7=0x0;_0x35e4b7<_0x436115['children']['length'];_0x35e4b7++){const _0x73810a=_0x436115['children'][_0x35e4b7];_0x13c027(_0x73810a);}};for(let _0x2a23ae=0x0;_0x2a23ae<_0xd60469['children']['length'];_0x2a23ae++)_0x13c027(_0xd60469['children'][_0x2a23ae]);}(this['document'],_0x131d31=>{if(ys(_0x131d31)){const _0x38acb6=this['splitTextNodeIntoWordNodes'](_0x131d31);_0x38acb6['length']&&_0x46f377['push'](..._0x38acb6);}_0x131d31['isWordSplitSource']||_0x131d31['isWordSplitResult']||_0x46f377['push'](_0x131d31);}),_0x46f377;}['splitTextNodeIntoWordNodes'](_0x3c25cd){if(_0x3c25cd['isWordSplitSource']||_0x3c25cd['isWordSplitResult'])return[];const _0x87a36=ti(_0x3c25cd)['match'](/(?:\s*\S+\s*)/g),_0x43e76c=[];if(_0x87a36&&_0x87a36['length']>0x1){for(const _0x293a02 of _0x87a36){const _0x19ab4c=new _0x9b91ab(_0x293a02);_0x19ab4c['isWordSplitResult']=!0x0,_0x2bd8f5(_0x3c25cd,_0x19ab4c),_0x43e76c['push'](_0x19ab4c);}_0x3c25cd['isWordSplitSource']=!0x0,_0x1da415(_0x3c25cd);}return _0x43e76c;}}const ks=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ys(_0x3b1f03){return _0x16cddc(_0x3b1f03);}function Ns(_0x2062b1){return _0x1b26d5(_0x2062b1);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x5b9f02){super();const _0x45e354=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x5b9f02,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x45e354['if']('isDone','ck-ai-chat__feed__item_done'),_0x45e354['if']('isVisible','ck-hidden',_0x2597a1=>!_0x2597a1),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x577044=>{_0x577044['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x2b4e9f,_0x6e4ed6,_0x59d86b){await this['htmlStreamer']['stream']({'document':_0x2b4e9f,'targetElement':_0x6e4ed6,'abortSignal':_0x59d86b});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x326018,_0x2cacb8){super(_0x326018),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x326018),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x326018,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x2cacb8['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x215643=>_0x215643?_0x44a600:_0x52b20e),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x54fe59=new Lt();_0x54fe59['content']=_0x4ffc28,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x2cacb8['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x54fe59,{'tag':'span','children':[Mi(_0x326018,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const xs={'accepted':_0x1310e3,'rejected':_0x6ed2e8,'outdated':_0x6ed2e8};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x1a593b){super(_0x1a593b);const _0x59c4c1=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x59c4c1['to']('state',_0x52c439=>'ck-ai-suggestion__content-part-state_'+_0x52c439),_0x59c4c1['if']('isVisible','ck-hidden',_0x379721=>!_0x379721)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x59c4c1['to']('state',_0x2f410b=>{switch(_0x2f410b){case'accepted':return Mi(_0x1a593b,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x1a593b,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x1a593b,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x449f83){this['state']=_0x449f83;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=xs[this['state']],this['on']('change:state',()=>{this['content']=xs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x30e00d,_0x41fedf,_0x3f5a18){super(_0x30e00d);const _0x3eccb8=Boolean(_0x3f5a18);this['set']('isEnabled',!_0x3eccb8),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x1d6ee4=[];if(_0x3eccb8){const _0x456ef6=new yt(_0x30e00d);_0x456ef6['set']({'label':Mi(_0x30e00d,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2d9b50}),_0x456ef6['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x1d6ee4['push'](_0x456ef6);}else{_0x41fedf['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x30e00d),this['_applyButton']['set']({'label':Mi(_0x30e00d,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x1310e3}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x4be2fa=>!_0x4be2fa),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x1d6ee4['push'](this['_applyButton'])),_0x41fedf['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x30e00d),this['_suggestButton']['set']({'label':Mi(_0x30e00d,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4f1eee}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x1d6ee4['push'](this['_suggestButton']));const _0x1b5289=new yt(_0x30e00d);_0x1b5289['set']({'label':Mi(_0x30e00d,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x6ed2e8}),_0x1b5289['bind']('isEnabled')['to'](this),_0x1b5289['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x1d6ee4['push'](_0x1b5289);}this['items']['addMany'](_0x1d6ee4);const _0xe054b2=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0xe054b2['if']('isVisible','ck-hidden',_0x28ada7=>!_0x28ada7)]}});}['setButtonsVisibility']({showApplyButton:_0x244c28,showSuggestButton:_0x3c5be4}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x244c28),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x3c5be4);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x384282,{part:_0x3cb18c,uiIndex:_0x840cff,availableActions:_0x471565,areActionsDisabled:_0x591c6f}){super(_0x384282),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x384282,_0x471565,_0x591c6f),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x3cb18c['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x3cb18c['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x3cb18c['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x384282),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x384282,_0x840cff),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',(_0x1cec13,_0x59fc0c,_0x217562,_0x152cb2)=>{'pending'===_0x152cb2?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x217562?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x217562),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x4978e6,_0x667966){super(_0x4978e6),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x4978e6,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x667966['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x20a2cd){super(_0x20a2cd),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x464acb,renderingStrategy:_0x576856,abortSignal:_0x25c2f2}){const _0x1b9192=_0x54443e(_0x464acb['content'],!0x0);for(const _0xd93ead of qi(_0x1b9192))_0x1da415(_0xd93ead);'streaming'===_0x576856?await this['htmlStreamer']['stream']({'document':_0x1b9192,'targetElement':this['element'],'abortSignal':_0x25c2f2}):_0x3adf3c(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x1b9192)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x4e24c4,{part:_0x46e9f3,uiIndex:_0x2304d9,areActionsDisabled:_0x674a01,availableActions:_0x1827b8}){super(_0x4e24c4);const _0x551233=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 _0x71c1fb=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x674a01;};this['on']('change:state',_0x71c1fb),this['on']('change:isDone',_0x71c1fb),_0x71c1fb(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x4e24c4,{'part':_0x46e9f3,'uiIndex':_0x2304d9,'availableActions':_0x1827b8,'areActionsDisabled':_0x674a01}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Ss)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x4e24c4),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x551233['to']('state',_0x207ff0=>'ck-ai-suggestion__body__content-part_'+_0x207ff0),_0x551233['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x551233['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x551233['if']('isVisible','ck-hidden',_0x45c038=>!_0x45c038)]},'children':this['_children'],'on':{'mouseenter':_0x551233['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x46e9f3['index']});}),'mouseleave':_0x551233['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x46e9f3['index']});}),'click':_0x551233['to'](_0x250b6d=>{const _0x200dff=_0x250b6d['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x200dff)&&this['fire']('showChangeInText',{'index':_0x46e9f3['index']});})}});}async['updateContent']({part:_0x93c983,showUnchangedParts:_0x238458=!0x1,abortSignal:_0xeb42d7}){this['partDefinition']=_0x93c983,this['isVisible']=this['partDefinition']['hasChanges']||_0x238458,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x93c983,'renderingStrategy':'static','abortSignal':_0xeb42d7});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x2b443b,_0x37b21e){super(_0x2b443b),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4da438=>!_0x4da438)]},'children':this['_createSkeletonItems'](_0x37b21e)});}['_createSkeletonItems'](_0x3ada39){const _0x24c09f=['ck','ck-ai-skeleton__item'];return _0x3ada39['map'](_0x1a0d64=>{let _0x2968f5='';switch(_0x1a0d64['attributes']['align']){case'right':_0x2968f5='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x2968f5='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x2968f5='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x1a0d64['tag'],'attributes':{'class':[..._0x24c09f,_0x1a0d64['attributes']['class']?_0x1a0d64['attributes']['class']:''],'style':'width:\x20'+_0x1a0d64['attributes']['width']+';\x20height:\x20'+_0x1a0d64['attributes']['height']+';'+_0x2968f5}};});}}const Ls={'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':Ps(0x5,'100%','44px','right'),'aiChatResources':Ps(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 Ps(_0x1fe593,_0x2ee7a1,_0x51e5c4,_0x370907){return new Array(_0x1fe593)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x2ee7a1,'height':_0x51e5c4,'align':_0x370907}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x49dcf0){const _0x2436dc=this['createTask'](_0x49dcf0);return this['queue']['push'](_0x2436dc),this['_processQueue'](),_0x2436dc['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(_0x944357=>{this['once']('_queueEmpty',()=>{_0x944357();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x46bf23=this['queue']['shift']();try{await _0x46bf23['callback'](this['_abortController']['signal']),_0x46bf23['resolve']();}catch(_0x58e055){_0x46bf23['reject'](_0x58e055);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x374494){let _0x180aee,_0x23389d;const _0x2277e4=new Promise((_0xbd42fd,_0x5c55dc)=>{_0x180aee=_0xbd42fd,_0x23389d=_0x5c55dc;});return{'callback':_0x374494,'resolve':_0x180aee,'reject':_0x23389d,'completePromise':_0x2277e4};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x1fd72f){super(_0x1fd72f),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x1fd72f['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x1291a5){this['element']['innerHTML']=_0x1291a5;}}const Ds=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x1f61a8,_0x1bbc69=[...Ds],_0xe0a651){super(_0x1f61a8);const _0x3ca20e=this['bindTemplate'],_0x556dcd=Boolean(_0xe0a651);if(this['set']('isEnabled',!_0x556dcd),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x556dcd){const _0x41f97f=new yt(_0x1f61a8);_0x41f97f['set']({'label':Mi(_0x1f61a8,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x2d9b50}),_0x41f97f['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x340356=new Nt(_0x1f61a8);_0x340356['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x1f61a8,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x41f97f]}]}),this['children']['add'](_0x340356);}else this['_applyChangesButton']=new yt(_0x1f61a8),this['_applyChangesButton']['set']({'label':Mi(_0x1f61a8,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1bbc69['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x1f61a8),this['_insertSuggestionsButton']['set']({'label':Mi(_0x1f61a8,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x1bbc69['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x4b6826=>{_0x4b6826['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',_0x3ca20e['if']('isVisible','ck-hidden',_0x2cbf69=>!_0x2cbf69)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x4b48d2){this['isVisible']=_0x4b48d2;}['_switchButtonLabelsPlurality'](_0x1562f8){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x1562f8?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x3c3ccc,_0xa2cf73){super(_0x3c3ccc),this['bodyCollection']=_0xa2cf73,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',_0xde7f21=>!_0xde7f21)]},'children':this['children']});const _0x30019d=new Nt(this['locale']),_0x21a644=new Lt();_0x21a644['content']=_0x5043d9,_0x30019d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x21a644,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x30019d),this['_setupBalloonPanel'](_0x3c3ccc);}['addSource'](_0x14cda6){this['children']['add'](new AIWebSourceView(this['locale'],_0x14cda6,this['balloonPanelView']));}['_setupBalloonPanel'](_0x22fd2f){this['balloonPanelView']=new zt(_0x22fd2f),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x853465,_0x285c7b,_0x381c17){super(_0x853465),this['source']=_0x285c7b,this['balloonPanelView']=_0x381c17,this['set']({'label':_0x285c7b['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x3c935f=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x3c935f['to'](()=>{window['open'](_0x285c7b['url'],'_blank');}),'mouseenter':_0x3c935f['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x3c935f['to'](()=>{this['_hideTooltip']();})}}),_0x285c7b['favicon']){const _0x31f186=new Nt(_0x853465);_0x31f186['setTemplate']({'tag':'img','attributes':{'src':_0x285c7b['favicon']||_0x5043d9,'alt':_0x285c7b['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x31f186);}else this['set']('icon',_0x5043d9);}['_createTooltipContentView'](_0xbfff05,_0x5c5a9a){const _0x1cd8be=new Nt(_0xbfff05),_0x3bbcd8=[];let _0x339dde;_0x5c5a9a?.['favicon']?(_0x339dde=new Nt(_0xbfff05),_0x339dde['setTemplate']({'tag':'img','attributes':{'src':_0x5c5a9a['favicon'],'alt':_0x5c5a9a['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x339dde=new Lt(),_0x339dde['content']=_0x5043d9,_0x339dde['extendTemplate']({'attributes':{'alt':_0x5c5a9a['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x3bbcd8['push'](_0x339dde);const _0x4fad9b=new Nt(_0xbfff05);_0x4fad9b['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x5c5a9a['url']},'children':[{'text':new URL(_0x5c5a9a['url'])?.['hostname']}]}),_0x3bbcd8['push'](_0x4fad9b);const _0x2d9a2f=new Nt(_0xbfff05);_0x2d9a2f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x3bbcd8});const _0x300a16=new Nt(_0xbfff05);return _0x300a16['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x5c5a9a['title']['length']>0x190?_0x5c5a9a['title']['substring'](0x0,0x190)+'...':_0x5c5a9a['title']}]}),_0x1cd8be['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x2d9a2f,_0x300a16]}),_0x1cd8be;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['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 _0x167eeb=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x167eeb);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x315a1f(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x11b0e6,_0x201a79){super(_0x11b0e6);const {areActionsDisabled:_0xe943f1,showUnchangedParts:_0x26099d,availableActions:_0x141987}=_0x201a79;this['_areActionsDisabled']=_0xe943f1,this['_showUnchangedParts']=_0x26099d,this['_availableActions']=_0x141987,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x11b0e6,Ls['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x11b0e6,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x11b0e6,_0x201a79['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x201a79['bodyCollection']),_0x201a79['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Ss)['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'](_0x29e42d=>_0x29e42d instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x564feb,abortSignal:_0x27fd3a,skipLoadingEffects:_0x336cbb}){this['_cachedContentParts']['length']?_0x564feb['forEach'](_0x2ec5c=>{const _0x177270=this['_cachedContentParts']['findIndex'](_0x2ba889=>_0x2ba889['index']==_0x2ec5c['index']);-0x1===_0x177270?this['_cachedContentParts']['push'](_0x2ec5c):this['_cachedContentParts'][_0x177270]=_0x2ec5c;}):this['_cachedContentParts']=_0x564feb;const _0x1e535f=this['_showUnchangedParts']?_0x564feb:_0x564feb['filter'](_0x4ccaec=>_0x4ccaec['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x1e535f['length']>0x1),_0x336cbb&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x469c51 of _0x1e535f)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x1a3b09=>{let _0x11ce0c=this['getPartView'](_0x469c51['index']);if(!_0x11ce0c){if(_0x11ce0c=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x469c51,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x11ce0c['delegate'](...Ss)['to'](this),_0x11ce0c['bind']('isTrackChangesOn')['to'](this),!_0x336cbb&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x1a3b09),_0x1a3b09['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x11ce0c,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x336cbb||this['_showSkeletonDebounced']();}await _0x11ce0c['updateContent']({'part':_0x469c51,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x1a3b09}),_0x11ce0c['markAsDone']();});return _0x27fd3a?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x3e96d3,_0x8c12f7){const _0x241c3f=this['getPartView'](_0x3e96d3);_0x241c3f&&(_0x241c3f['state']=_0x8c12f7),this['hasPendingParts']='pending'==_0x8c12f7||this['_contentPartViews']['some'](_0x123a60=>'pending'==_0x123a60['state']);}['setPartActive'](_0xcb3e22,_0x23a302){if(!0x1===_0xcb3e22){for(const _0x266c08 of this['_contentPartViews'])_0x266c08['isActive']=!0x1;}else{const _0x1743c6=this['getPartView'](_0xcb3e22);_0x1743c6&&(_0x1743c6['isActive']=_0x23a302);}}['updateSources'](_0x4b71a0){_0x4b71a0['forEach'](_0x4dca6b=>this['_sourcesView']['addSource'](_0x4dca6b)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x2ed54c){return this['_contentPartViews']['find'](_0x18d075=>_0x18d075['partDefinition']['index']==_0x2ed54c)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x114fda=!this['_cachedContentParts']['find'](({hasChanges:_0x526db0})=>_0x526db0),_0x1c2dc6=!!this['_cachedContentParts']['find'](({hasChanges:_0x3adf70})=>!_0x3adf70);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x1c2dc6,_0x114fda?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x4f4dc7=>_0x4f4dc7['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x193d36){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x55bd6a=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x55bd6a>0x0){const {promise:_0x1a69bb,abortController:_0x549e26}=vs(_0x55bd6a);_0x193d36?.['addEventListener']('abort',()=>_0x549e26['abort']()),await _0x1a69bb['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x229ccf=>_0x229ccf['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x4095e6,_0x1b775f,_0x367879){super(_0x4095e6);const {showDiff:_0x5da8a5,areActionsDisabled:_0x131c8f,showUnchangedParts:_0x188296,availableActions:_0x5b24ac}=_0x1b775f;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x4095e6,{'showDiff':_0x5da8a5}),this['headerView']['on']('toggleShowChanges',(_0x5e1e04,_0x3e70c3)=>{this['areChangesVisible']=_0x3e70c3['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x3e70c3['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x4095e6,{'areActionsDisabled':_0x131c8f,'showUnchangedParts':!!_0x188296,'availableActions':_0x5b24ac,'bodyCollection':_0x367879}),this['bodyView']['delegate'](...Ss)['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'](_0x580628){await this['bodyView']['updateContentParts'](_0x580628);}['updateSources'](_0x476466){this['bodyView']['updateSources'](_0x476466);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x5af26b,_0x4a6c4d,_0x6a987){super(_0x4a6c4d),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x5af26b,{'showDiff':_0x4a6c4d['showDiff'],'areActionsDisabled':_0x4a6c4d['areActionsDisabled'],'availableActions':_0x4a6c4d['availableActions']},_0x6a987),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x1c7c7f,_0x154a44)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x154a44['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',(_0x4ff043,{index:_0x282d8f})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x282d8f});}),this['containerView']['on']('applySuggestion',(_0x256859,{index:_0x15e13f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x15e13f});}),this['containerView']['on']('insertSuggestion',(_0x3b2ea2,{index:_0x589efb}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x589efb});}),this['containerView']['on']('rejectSuggestion',(_0x48eb05,{index:_0x49b6b9})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x49b6b9});}),this['containerView']['on']('mouseOverSuggestion',(_0xd7d0d4,{index:_0x5c4761})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x5c4761});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x4a7c54,{index:_0x38e584})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x38e584});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x558c14){await this['containerView']['updateContent'](_0x558c14);}['updatePartState'](_0x3ed03a,_0x172bf1){this['containerView']['bodyView']['updatePartState'](_0x3ed03a,_0x172bf1);}['setPartActive'](_0x5dba4a,_0x5c267a){!0x1===_0x5dba4a?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x5dba4a,_0x5c267a);}['updateSources'](_0x3e5068){this['containerView']['updateSources'](_0x3e5068);}['getPartView'](_0x505579){return this['containerView']['bodyView']['getPartView'](_0x505579);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x3ae12c,_0x56e71b,_0x2ea988){super(_0x56e71b),this['_bodyCollection']=_0x2ea988,this['locale']=_0x3ae12c,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),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':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x11611b,renderingStrategy:_0x1a8058,abortSignal:_0x5343b3}){'streaming'===_0x1a8058?await this['streamIntoElement'](_0x11611b,this['replyContainer']['element'],_0x5343b3):this['replyContainer']['element']['innerHTML']=_0x1441a0(_0x11611b);}['updateSources'](_0x3a9edd){const _0x33e0de=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x33e0de['children']['addMany'](_0x3a9edd['map'](_0x15eefa=>new AIWebSourceView(this['locale'],_0x15eefa,_0x33e0de['balloonPanelView']))),_0x33e0de['isVisible']=!0x0,this['children']['add'](_0x33e0de);}}class AISpinnerView extends xt{constructor(_0x2d2b8f=void 0x0){super();const _0x3c0fc0=_0x2d2b8f?'ck-ai-spinner_'+_0x2d2b8f:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x3c0fc0]}});}}const Vs={'file':_0x3b9c45,'image':_0x4fce7c,'document':_0x4ffc28,'web-resource':_0x22c1bd,'text':_0x3b9c45,'selection':_0x391111,'mcp-tool-context':_0x4ffc28},Hs='ck-ai-chat-context-chip',Ms='ck-ai-chat-context-chip_wide',Us='ck-ai-chat-context-chip_document',Bs='ck-ai-chat-context-chip__label',Gs='ck-ai-chat-context-chip__type-icon',Fs='ck-ai-chat-context-controls__chip-tooltip',Ws='n';class AIChatContextItemButtonView extends yt{constructor(_0x355f95,_0x1f4205,_0x3c2c21,_0x3fc179,_0x619c5e=!0x1){super(_0x355f95),this['_isAnimationOnEnterEnabled']=_0x3fc179,this['_initializeProperties'](_0x1f4205,_0x3c2c21,_0x619c5e),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'](_0x240f77,_0x3feaf0,_0x2c163f){this['set']('label',_0x240f77['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x240f77['type']),this['set']('id',_0x240f77['uiId']),this['set']('readonly',_0x3feaf0),this['set']('isLoading',_0x2c163f);}['_setupTemplate'](){const _0x4799d1=this['_createIconView'](),_0x13b73b=this['_createRemoveButton'](),_0xae2149=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0xae2149),'children':this['_createTemplateChildren'](_0x4799d1,_0x13b73b,_0xae2149)});}['_createTemplateAttributes'](_0x4f62c9){return{'class':[Hs,_0x4f62c9['if']('itemType',Us,_0x156a66=>'document'==_0x156a66),_0x4f62c9['if']('itemType',Ms,_0x258e58=>'selection'==_0x258e58)],'data-cke-tooltip-text':_0x4f62c9['to']('label',Ks),'data-cke-tooltip-position':Ws,'data-cke-tooltip-class':Fs};}['_createTemplateChildren'](_0xf792ec,_0x21cdb4,_0x245cdf){const _0x3ea3ad=this['_createLabelElement'](_0x245cdf),_0x2f8361=this['_createLoaderIcon']();return this['readonly']?[_0xf792ec,_0x3ea3ad]:[_0xf792ec,_0x2f8361,_0x3ea3ad,_0x21cdb4];}['_createLabelElement'](_0x31ef23){return{'tag':'span','attributes':{'class':Bs},'children':[{'text':_0x31ef23['to']('label')}]};}['_createRemoveButton'](){const _0x4362ee=new yt(this['locale']);return _0x4362ee['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x1c0648}),this['_setupRemoveButtonEvent'](_0x4362ee),_0x4362ee;}['_setupRemoveButtonEvent'](_0x179962){_0x179962['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x4222c1=this['bindTemplate'],_0x4128ee=new Lt();return _0x4128ee['content']=Vs[this['itemType']],_0x4128ee['extendTemplate']({'attributes':{'class':[Gs,_0x4222c1['if']('isLoading','ck-hidden',_0x1cbaa0=>_0x1cbaa0)]}}),_0x4128ee;}['_handleAnimationEndOnce'](_0x2f6a4b,_0x11d3db){if(!_0x2f6a4b)return;const _0x3f649e=()=>{_0x11d3db(),_0x2f6a4b['removeEventListener']('animationend',_0x3f649e),_0x2f6a4b['removeEventListener']('webkitAnimationEnd',_0x3f649e);};_0x2f6a4b['addEventListener']('animationend',_0x3f649e),_0x2f6a4b['addEventListener']('webkitAnimationEnd',_0x3f649e);}['_createLoaderIcon'](){const _0x2a82e9=new AISpinnerView('small');return _0x2a82e9['bind']('isVisible')['to'](this,'isLoading',_0x2dead1=>_0x2dead1),_0x2a82e9;}}function Ks(_0x5040cb){if(!_0x5040cb)return _0x5040cb;if(_0x5040cb['length']<=0x78)return _0x5040cb;const _0x85bbda=_0x5040cb['slice'](0x0,0x78),_0xde56fa=_0x85bbda['lastIndexOf']('\x20');return(_0xde56fa>0x0?_0x85bbda['slice'](0x0,_0xde56fa):_0x85bbda)+'…';}const Ys={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},$s='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x4654f4,_0x31878a,_0x1d032c,_0x4ddb07,_0x32dde9){this['_locale']=_0x4654f4,this['_visibleChips']=_0x31878a,this['_config']={...Ys,..._0x1d032c,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1d032c['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x4ddb07,this['_parentView']=_0x32dde9||null;}['setContainerElement'](_0x1c79e9){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x1c79e9,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 _0x153c2a=[...this['_visibleChips'],...this['_overflowChips']],_0x38932d=this['_createCalculationContainer'](),_0x16856a=this['_calculateOverflowInContainer'](_0x38932d,_0x153c2a),_0x27cf52=_0x38932d['_ancestorsToRestore'];_0x27cf52&&this['_restoreAncestorVisibility'](_0x27cf52),_0x38932d['remove'](),this['_applyOverflowResults'](_0x153c2a,_0x16856a);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x57c57c=new yt(this['_locale']);_0x57c57c['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x23cd0d=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x23cd0d['push'](this['_config']['cssClasses']['controlsButton']),_0x57c57c['extendTemplate']({'attributes':{'class':_0x23cd0d}}),_0x57c57c;}['_createShowMoreBalloonPanelView'](){const _0x1dc995=new zt(this['_locale']);return _0x1dc995['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x1dc995),_0x1dc995;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x2ed17b=>{_0x2ed17b['disableAnimationOnEnter']();});const _0x49d88e=new Nt(this['_locale']);_0x49d88e['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x49d88e);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x296ef2=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x296ef2?'':'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'](_0x347fea){const _0x10cbf0=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x5028a3=this['_containerElement']?.['classList'];if(_0x5028a3){const _0xd499ab=_0x5028a3[0x0]||'',_0x1925a9=_0x347fea['querySelector']('.'+_0xd499ab),_0x14836a=_0x347fea['querySelector'](_0x10cbf0);return _0x1925a9||_0x14836a||_0x347fea;}return _0x347fea['querySelector'](_0x10cbf0)||_0x347fea;}['_calculateContainerWidth'](){const _0x4decaa=this['_parentView']?.['element']||this['_containerElement'];if(!_0x4decaa)return $s;const _0x1ba641=window['getComputedStyle'](_0x4decaa)['width'];if('auto'===_0x1ba641||'0px'===_0x1ba641||!_0x1ba641){const _0x57182c=_0x4decaa['parentElement'];if(_0x57182c){const _0x489bcb=window['getComputedStyle'](_0x57182c);return'auto'!==_0x489bcb['width']?_0x489bcb['width']:$s;}return $s;}return _0x1ba641;}['_applyCalculationStyles'](_0x116e47,_0x4a0d86){this['_config']['cssClasses']['calculationContainer']&&_0x116e47['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x116e47['style']['width']=_0x4a0d86,_0x116e47['style']['position']='absolute',_0x116e47['style']['top']='-9999px',_0x116e47['style']['left']='-9999px',_0x116e47['style']['opacity']='0',_0x116e47['style']['pointerEvents']='none',_0x116e47['style']['zIndex']='-1',_0x116e47['style']['visibility']='visible\x20!important',_0x116e47['style']['display']='block\x20!important',_0x116e47['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x38f0e7){_0x38f0e7['forEach'](({element:_0x31b132,originalDisplay:_0x30a56b,originalVisibility:_0x1b0e41})=>{_0x31b132['style']['display']=_0x30a56b,_0x31b132['style']['visibility']=_0x1b0e41;});}['_makeAncestorsVisible'](_0x30fcd8){const _0x42f9a1=[];let _0x390307=_0x30fcd8;for(;_0x390307&&_0x390307!==document['body'];){const _0x2033d0=window['getComputedStyle'](_0x390307);'none'!==_0x2033d0['display']&&'hidden'!==_0x2033d0['visibility']||(_0x42f9a1['push']({'element':_0x390307,'originalDisplay':_0x390307['style']['display'],'originalVisibility':_0x390307['style']['visibility']}),_0x390307['style']['display']='block',_0x390307['style']['visibility']='visible'),_0x390307=_0x390307['parentElement'];}return _0x42f9a1;}['_createContainerElements'](){let _0x5574b7,_0x221368;return this['_parentView']?.['element']?(_0x5574b7=this['_parentView']['element']['cloneNode'](!0x0),_0x221368=this['_findTargetContainer'](_0x5574b7)):(_0x5574b7=document['createElement']('div'),_0x221368=_0x5574b7),{'calculationContainer':_0x5574b7,'targetContainer':_0x221368};}['_createCalculationContainer'](){const {calculationContainer:_0x5c0d78,targetContainer:_0x3a4a40}=this['_createContainerElements'](),_0x16e796=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x5c0d78,_0x16e796);const _0x53a2c8=this['_parentView']?.['element']||this['_containerElement'],_0x1dde5d=_0x53a2c8?.['parentElement'];_0x1dde5d?_0x1dde5d['appendChild'](_0x5c0d78):document['body']['appendChild'](_0x5c0d78),_0x5c0d78['_targetContainer']=_0x3a4a40;const _0x3ba9b8=this['_makeAncestorsVisible'](_0x1dde5d||null);return _0x5c0d78['offsetWidth'],_0x5c0d78['_ancestorsToRestore']=_0x3ba9b8,_0x5c0d78;}['_calculateOverflowInContainer'](_0x4e5ee4,_0x245898){const _0x41dfb3=_0x4e5ee4['_targetContainer']||_0x4e5ee4,_0x368809=[],{rowCount:_0x2064f8}=this['_renderChipsAndCountRows'](_0x41dfb3,_0x245898);if(_0x2064f8<=this['_config']['maxVisibleRows'])return _0x368809;const _0x82ffb9=_0x245898['slice']();for(;_0x82ffb9['length']>0x0;){if(this['_testButtonFit'](_0x4e5ee4,_0x41dfb3,_0x82ffb9)){const _0x3870f9=_0x245898['filter'](_0x5d67f3=>!_0x82ffb9['includes'](_0x5d67f3));_0x368809['push'](..._0x3870f9);break;}if(!_0x82ffb9['pop']())break;}return _0x368809;}['_renderChipsAndCountRows'](_0x2c2c68,_0x5b517b){_0x2c2c68['innerHTML']='',_0x5b517b['forEach'](_0x196c60=>{if(_0x196c60['element']){const _0xf17648=_0x196c60['element']['cloneNode'](!0x0);_0x2c2c68['appendChild'](_0xf17648);}}),_0x2c2c68['offsetWidth'];const _0x538ac5=_0x2c2c68['children'],_0x4c6321=[];return Array['from'](_0x538ac5)['forEach'](_0x1ca681=>{const _0x1400f6=_0x1ca681['getBoundingClientRect']()['top'];_0x4c6321['some'](_0x299d88=>Math['abs'](_0x299d88-_0x1400f6)<this['_config']['rowDetectionTolerance'])||_0x4c6321['push'](_0x1400f6);}),{'rowCount':_0x4c6321['length']};}['_createMockButton'](){const _0x718d00=document['createElement']('button');return _0x718d00['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x718d00['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x718d00['textContent']='+\x201',_0x718d00;}['_testButtonFit'](_0x80e0c7,_0x1f6b3f,_0x2fd5ac){this['_renderChipsAndCountRows'](_0x1f6b3f,_0x2fd5ac);const _0x29201d=this['_createMockButton']();_0x80e0c7['appendChild'](_0x29201d),_0x80e0c7['offsetWidth'];const _0x31f399=[..._0x1f6b3f['children'],_0x29201d],_0x515f48=[];_0x31f399['forEach'](_0x3d330e=>{const _0x322dea=_0x3d330e['getBoundingClientRect']()['top'];_0x515f48['some'](_0x20c5ee=>Math['abs'](_0x20c5ee-_0x322dea)<this['_config']['rowDetectionTolerance'])||_0x515f48['push'](_0x322dea);});const _0x138bde=_0x515f48['length'];return _0x29201d['remove'](),_0x138bde<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x3578aa,_0x55d2a6){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x3578aa['forEach'](_0x59c1f9=>{_0x55d2a6['includes'](_0x59c1f9)?this['_overflowChips']['add'](_0x59c1f9):this['_visibleChips']['add'](_0x59c1f9);});}['_updateOverflowUI'](_0xecff3d){if(_0xecff3d>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0xecff3d>0x0&&this['_showMoreButtonView']){const _0xc0db7=''+this['_config']['showMoreLabelPrefix']+(_0xecff3d<0x63?_0xecff3d:'99');this['_showMoreButtonView']['label']=_0xc0db7;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x23ee0f,_0x7e0f45){this['_distributeChips'](_0x23ee0f,_0x7e0f45),this['_updateOverflowUI'](_0x7e0f45['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x35e634=>{_0x35e634[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 _0x2d4fad=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x2d4fad['width']||0x0===_0x2d4fad['height'])return!0x1;const _0x3dd20e=window['innerHeight']||document['documentElement']['clientHeight'],_0x260751=window['innerWidth']||document['documentElement']['clientWidth'],_0x6ec8e4=0xc8;return _0x2d4fad['bottom']>=-0xc8&&_0x2d4fad['top']<=_0x3dd20e+_0x6ec8e4&&_0x2d4fad['right']>=-0xc8&&_0x2d4fad['left']<=_0x260751+_0x6ec8e4;}}const qs='ck-ai-chat__feed__context-chips',Qs='ck-ai-chat-context-chips-wrapper',Xs='ck-ai-chat-context-chips-wrapper-balloon',zs='ck-ai-chat-controls-button',js='ck-ai-chat-controls_context_show-more-button',Js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x45446b,_0x47d11d,_0x2061e1){super(_0x45446b),this['_bodyCollection']=_0x2061e1,this['_createContextChips'](_0x47d11d);const _0x1ee943={'cssClasses':{'showMoreButton':js+'\x20'+Gi,'showMoreBalloon':Js,'overflowContainer':Xs,'controlsButton':zs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x45446b,this['_contextChips'],_0x1ee943,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[qs,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x28147e=this['element']['querySelector']('.'+Qs);_0x28147e&&(this['_overflowManager']['setContainerElement'](_0x28147e),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0xa1d0eb){for(const _0x5e6d1c of _0xa1d0eb){const _0x4e06af=new AIChatContextItemButtonView(this['locale'],_0x5e6d1c,!0x0,!0x1);this['_contextChips']['add'](_0x4e06af);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x36948b,_0x13a644,_0x59ca10){super(_0x13a644),this['_locale']=_0x36948b,this['_bodyCollection']=_0x59ca10,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 AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x497118=>!_0x497118['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(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']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x2473de,_0x30e5e9){super(_0x30e5e9);const {isWebSearchEnabled:_0x335417,isReasoningEnabled:_0x863d07}=_0x30e5e9['capabilities'],_0x468e2e=[];let _0x33aaa8='';_0x335417&&_0x863d07?(_0x33aaa8=Mi(_0x2473de,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x468e2e['push'](Zs(_0x5043d9)),_0x468e2e['push'](Zs(_0x10af08))):_0x335417?(_0x33aaa8=Mi(_0x2473de,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x468e2e['push'](Zs(_0x5043d9))):_0x863d07&&(_0x33aaa8=Mi(_0x2473de,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x468e2e['push'](Zs(_0x10af08))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x33aaa8?'':'ck-hidden']}});const _0x33bdbb=new Nt();_0x33bdbb['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x468e2e,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x33aaa8]}]}),this['children']['add'](_0x33bdbb),this['capabilities']=_0x30e5e9['capabilities'];}}function Zs(_0x437ac1){const _0x3534af=new Lt();return _0x3534af['content']=_0x437ac1,_0x3534af;}const tn=['wheel','touchstart','pointerdown','keydown'],en=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x1727c6){this['element']=_0x1727c6,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x21bd06 of tn){const _0x3a67d4='keydown'!==_0x21bd06;this['element']['addEventListener'](_0x21bd06,this['_onUserEvent']['bind'](this),{'passive':_0x3a67d4,'signal':this['abortController']['signal']});}}['start']({smooth:_0x246d57=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x246d57?'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'](_0x1d3c64){if(this['isRunning']){if('keydown'===_0x1d3c64['type']){const _0x4a2f5e=_0x1d3c64['key'];if(!en['includes'](_0x4a2f5e))return;}_0x1d3c64 instanceof WheelEvent?_0x1d3c64['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0xe9acb5,scrollHeight:_0x466b14,clientHeight:_0x3757ac}=this['element'];return _0x466b14-_0xe9acb5-_0x3757ac<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x1ed04c){super(_0x1ed04c),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']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x217159,_0x5a0833){super(_0x217159),this['_bodyCollection']=_0x5a0833,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Os)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x7c7795,_0x2d944d){let _0x568738;return'ai-reply'===_0x7c7795?_0x568738=new AIChatFeedReplyItemView(this['locale'],_0x2d944d,this['_bodyCollection']):'ai-suggestion-reply'===_0x7c7795?(_0x568738=new AIChatFeedSuggestionItemView(this['locale'],_0x2d944d,this['_bodyCollection']),_0x568738['bind']('isTrackChangesOn')['to'](this)):_0x568738='user-message'===_0x7c7795?new AIChatFeedUserMessageItemView(this['locale'],_0x2d944d,this['_bodyCollection']):'interaction-header'===_0x7c7795?new AIChatFeedInteractionHeaderView(this['locale'],_0x2d944d):'custom-element'===_0x7c7795?new AIChatFeedCustomElementView(_0x2d944d):new AIChatFeedErrorItemView(_0x2d944d),this['children']['add'](_0x568738),_0x568738;}async['updateReplyItem']({id:_0x5ab532,parsedContent:_0x1210df,renderingStrategy:_0x446f61,abortSignal:_0x3d9b0f}){const _0x521ca7=this['getItemById'](_0x5ab532);if(!(_0x521ca7 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x521ca7,'id':_0x5ab532,'parsedContent':_0x1210df});await _0x521ca7['updateContent']({'parsedContent':_0x1210df,'renderingStrategy':_0x446f61,'abortSignal':_0x3d9b0f});}async['updateWebSources'](_0x55d865,_0xdd0df7){const _0x274890=this['getItemById'](_0x55d865);if(_0x274890 instanceof AIChatFeedSuggestionItemView)_0x274890['updateSources'](_0xdd0df7);else{if(!(_0x274890 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x274890,'id':_0x55d865,'sources':_0xdd0df7});_0x274890['updateSources'](_0xdd0df7);}}async['updateSuggestionItem']({id:_0x104667,parts:_0x11f860,abortSignal:_0x553112,skipLoadingEffects:_0x4d0b78}){const _0x11ad21=this['getItemById'](_0x104667);if(!(_0x11ad21 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x11ad21,'id':_0x104667,'parts':_0x11f860});await _0x11ad21['updateContent']({'parts':_0x11f860,'abortSignal':_0x553112,'skipLoadingEffects':_0x4d0b78});}['updateSuggestionPartState']({id:_0x374c0f,index:_0x2e1620,state:_0x4494be}){const _0x19aa09=this['getItemById'](_0x374c0f);if(!(_0x19aa09 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x374c0f});_0x19aa09['updatePartState'](_0x2e1620,_0x4494be);}['setSuggestionPartActive']({id:_0x4d28a0,index:_0x347be9,isActive:_0x304592}){const _0x3dd466=this['getItemById'](_0x4d28a0);if(!(_0x3dd466 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4d28a0});this['children']['filter'](_0x1037a9=>_0x1037a9 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x4409ff=>{_0x4409ff['setPartActive'](!0x1);}),_0x3dd466['setPartActive'](_0x347be9,_0x304592);}['markItemAsDone'](_0x521928){this['getItemById'](_0x521928)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x4c4456=>_0x4c4456['options']['id']);}['removeItem'](_0x52e8b2){this['children']['remove'](this['getItemById'](_0x52e8b2));}['hasItem'](_0x3fa7a0){return!!this['children']['find'](_0x449789=>_0x449789['options']['id']['includes'](_0x3fa7a0));}['scrollToSuggestion'](_0x4eb834,_0x3b2dc5){const _0x2aee43=this['getItemById'](_0x4eb834);if(!(_0x2aee43 instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x4eb834,'partIndex':_0x3b2dc5});const _0x5a3bb1=_0x2aee43['getPartView'](_0x3b2dc5);_0x5a3bb1?Rt(_0x5a3bb1['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x4eb834,'partIndex':_0x3b2dc5});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x287032=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x287032,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x52f65c=new AISkeletonView(this['locale'],Ls['aiFeed']);return _0x52f65c['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x52f65c;}['_createFeedItems'](){const _0xe7e2f8=new Nt(this['locale']);return _0xe7e2f8['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0xe7e2f8;}['_createFeedLoader'](){const _0x39828a=new Nt(this['locale']);return _0x39828a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0xcfc947=>!_0xcfc947)]},'children':this['_createLoaderChildren']()}),_0x39828a;}['_createLoaderChildren'](){const _0x390163=new AISpinnerView();return _0x390163['isVisible']=!0x0,[_0x390163,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0xae3152){const _0x4130c9=this['children']['find'](_0x4f5485=>_0x4f5485['options']['id']['includes'](_0xae3152));if(!_0x4130c9)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0xae3152});return _0x4130c9;}['setLoadingMessage'](_0xb9a937){this['set']('loadingMessage',_0xb9a937);}['toggleLoadingSkeleton'](_0x22d477){this['set']('isLoadingSkeletonVisible',_0x22d477);}['startAutoScroll'](_0x4dfa9c={}){this['scrollManager']['start'](_0x4dfa9c);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x3f5863=0x0;for(const _0x1c070 of this['items'])_0x3f5863+=_0x1c070['items']['length'];return{'resultsCount':_0x3f5863,'totalItemsCount':_0x3f5863};}}function sn(_0x2182ed){const _0x543d94=[];let _0x2e74a9=!0x1;for(const _0x3590a2 of Array['from'](_0x2182ed['items'])){if('file'!==_0x3590a2['kind'])continue;const _0x269248=_0x3590a2['webkitGetAsEntry']();if(_0x269248?.['isDirectory']){_0x2e74a9=!0x0;continue;}const _0x4ebcca=_0x3590a2['getAsFile']();_0x4ebcca&&_0x543d94['push'](_0x4ebcca);}return{'files':_0x543d94,'hasDirectory':_0x2e74a9};}const nn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x55e3d0,_0x1a2005){super(_0x55e3d0,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x55e3d0),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x1a2005,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',(_0x350329,_0x505aa1)=>!_0x350329&&!_0x505aa1),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x4b4882,_0x515797)=>{this['isUploadInProgress']||this['isEmpty']||_0x4b4882['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x515797());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x5063a4=>this['_handlePaste'](_0x5063a4)),this['element']['addEventListener']('drop',_0x360d76=>this['_handleDrop'](_0x360d76));}['_handlePaste'](_0x222751){const _0x1d2d50=_0x222751['clipboardData'];if(!_0x1d2d50)return;const {files:_0x2d3131,hasDirectory:_0x222a7f}=sn(_0x1d2d50),_0x1b959c={'files':_0x2d3131,'plainText':_0x1d2d50['getData']('text/plain'),'hasDirectory':_0x222a7f,'forceTextAttachment':!0x1,'preventDefault':()=>_0x222751['preventDefault']()};this['fire']('promptInputPaste',_0x1b959c);}['_handleDrop'](_0x38c0f4){const _0x2544c0=_0x38c0f4['dataTransfer'];if(!_0x2544c0)return;const _0x3396c6={'files':[],'plainText':_0x2544c0['getData']('text/uri-list')||_0x2544c0['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x38c0f4['preventDefault']()};this['fire']('promptInputPaste',_0x3396c6);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0xf55738=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0xf55738)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0xbc37c=_0x2f8e1d(_0xf55738);this['fire']('sendUserMessage',_0xbc37c),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x52cedf){this['queryView']['fieldView']['set']('placeholder',_0x52cedf);}['focus'](_0x3b04a3=!0x1){super['focus'](),_0x3b04a3&&(this['element']['classList']['contains'](nn)||(this['element']['classList']['add'](nn),setTimeout(()=>{this['element']['classList']['remove'](nn);},0x320)));}['_createSubmitButton'](){const _0x1b3242=new yt(this['locale']);return _0x1b3242['set']({'icon':_0xe82bda,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x1b3242['on']('execute',()=>{this['submit']();}),_0x1b3242;}['setIsUploadInProgress'](_0x27a8b1){this['isUploadInProgress']=_0x27a8b1;}['_setUpAddContextButtonPositioning'](){const _0xa35392=this['locale'],_0x2c9eca=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x1548d9=new dt(this['queryView']['fieldView']['element']),_0xa79a8a=new dt(this['_addContextButtonView']['element']),_0x4620c1=_0x1548d9['width'],_0x78a84d='rtl'===_0xa35392['uiLanguageDirection']?'right':'left';_0x1548d9['excludeScrollbarsAndBorders']();const _0x17fba3=_0x4620c1-_0x1548d9['width']+0x1;this['_addContextButtonView']['element']['style'][_0x78a84d]='calc('+(_0x4620c1-_0xa79a8a['width']-_0x17fba3)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x2c9eca),this['on']('render',()=>{_0x2c9eca(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x2c9eca();});});}}class AIChatDropZoneView extends Nt{constructor(_0x13e9dd){super(_0x13e9dd);const _0x41d1cb=new Lt();_0x41d1cb['content']=_0x3b9c45,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x41d1cb,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x13e9dd,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x1db7d7){let _0xdedf03=0x0;_0x1db7d7['addEventListener']('dragenter',_0x5144f4=>{_0x5144f4['dataTransfer']&&(_0xdedf03++,0x1===_0xdedf03&&this['fire']('dragEnter'),_0x1db7d7['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x1db7d7['addEventListener']('dragover',_0x86ec8f=>{_0x86ec8f['dataTransfer']&&_0x86ec8f['preventDefault']();}),_0x1db7d7['addEventListener']('dragleave',()=>{--_0xdedf03<=0x0&&(_0xdedf03=0x0,_0x1db7d7['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x1db7d7['addEventListener']('drop',_0x3698c9=>{_0x3698c9['preventDefault'](),_0xdedf03=0x0,_0x1db7d7['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x3698c9);});}['_handleDrop'](_0x3a991f){const _0x49ba7e=_0x3a991f['dataTransfer'];if(!_0x49ba7e)return;const {files:_0x505606,hasDirectory:_0x4cd1e7}=sn(_0x49ba7e),_0x55e01c={'files':_0x505606,'plainText':_0x49ba7e['getData']('text/uri-list')||_0x49ba7e['getData']('text/plain'),'hasDirectory':_0x4cd1e7,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x55e01c);}}const rn='ck-ai-chat__prompt-capabilities',on='ck-ai-chat-controls-button',an='ck-ai-chat-controls-button--commands',hn='ck-ai-chat-controls__model-selection',cn='ck-ai-chat-controls__model-selection__item-name',ln='ck-ai-chat-controls__model-selection__item-description',un='ck-ai-chat-controls__model-selection__item-capabilities',dn='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x252d67){super(_0x252d67),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',_0x56e756=>'selector'===_0x56e756),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x5cb507=>_0x5cb507?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x49eccb=>_0x49eccb),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x58fa5a=>_0x58fa5a),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x461b84=>Mi(this['locale'],_0x461b84?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x31d101=>_0x31d101),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x1ba5f6=>Mi(this['locale'],_0x1ba5f6?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[rn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x25bb33,_0x591d68){if(_0x591d68)this['set']('modelDisplayMode','hidden');else{const _0x4a6c02=0x1===_0x25bb33['length'];this['set']('modelDisplayMode',_0x4a6c02?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x25bb33?.['length'])for(const _0x505008 of _0x25bb33){const _0x2d2961=new Zt({'label':_0x505008['name'],'withText':!0x0,'role':'menuitemradio','id':_0x505008['id'],'model':_0x505008});_0x2d2961['bind']('isOn')['to'](this,'activeModelId',_0x4f6626=>_0x4f6626===_0x505008['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x2d2961,'labelView':new _n(this['locale'],_0x505008)});}}['setWebSearch'](_0x511e53){this['set']('webSearchActive',_0x511e53);}['setReasoning'](_0x40e396){this['set']('reasoningActive',_0x40e396);}['setModel'](_0x390c9e){if(!_0x390c9e)return;this['activeModelId']=_0x390c9e['id'],this['activeModelName']=_0x390c9e['name']||_0x390c9e['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x390c9e['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x390c9e['name']);const _0x524a5c=_0x390c9e['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x524a5c),this['_webSearchButton']['set']('isVisible',_0x524a5c);const _0x3a9081=_0x390c9e['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x3a9081),this['_reasoningButton']['set']('isVisible',_0x3a9081);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x28beb7){this['set']('modelSelectorEnabled',!0x1),_0x28beb7&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x3a20ea=new yt();return _0x3a20ea['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x5043d9,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x3a20ea['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x3a20ea;}['_createReasoningButton'](){const _0x37eecd=new yt();return _0x37eecd['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x10af08,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x37eecd['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x37eecd;}['_createCommandsButton'](){const _0x45375b=new yt();return _0x45375b['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x277018,'withText':!0x0,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':dn}),_0x45375b['extendTemplate']({'attributes':{'class':[an]}}),_0x45375b['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x45375b;}['_createModelSelectionDropdown'](){const _0x62f389=Ft(this['locale']);return _0x62f389['set']({'panelPosition':'ne','class':[hn]}),_0x62f389['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':dn,'class':Gi}),this['listenTo'](_0x62f389,'execute',_0x308901=>{this['fire']('selectModel',_0x308901['source']['model']);}),_0x62f389;}['_createModelNameView'](){const _0x8a1ca9=new In(this['locale']);return _0x8a1ca9['bind']('text')['to'](this,'activeModelName',_0x3b8bbf=>_0x3b8bbf??''),_0x8a1ca9['bind']('isVisible')['to'](this,'modelDisplayMode',_0x556eeb=>'name'===_0x556eeb),_0x8a1ca9;}}let _n=class ModelButtonLabelView extends Mt{constructor(_0xc14817,_0x4d762d){super();const _0x31056a=this['bindTemplate'],_0x49fa80=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x31056a['to']('style'),'id':_0x31056a['to']('id')},'children':[{'tag':'div','attributes':{'class':[cn]},'children':[{'text':_0x31056a['to']('text')}]},{'tag':'div','attributes':{'class':[ln]},'children':[{'tag':'span','children':[{'text':_0x4d762d['description']}]}]},{'tag':'div','attributes':{'class':[un]},'children':_0x49fa80}]}),_0x49fa80['addMany'](this['_getCapabilityParts'](_0xc14817,_0x5043d9,'AI_CHAT_SEARCH_WEB',_0x4d762d['capabilities']['webSearch']?.['enabled']??!0x1)),_0x49fa80['addMany'](this['_getCapabilityParts'](_0xc14817,_0x10af08,'AI_CHAT_REASONING',_0x4d762d['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x2f58c4,_0x30bfd,_0x3dfe14,_0x44c19c){const _0xcd2ed2=new Lt();_0xcd2ed2['content']=_0x30bfd;const _0xe05800=new Nt(_0x2f58c4);_0xe05800['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2f58c4,_0x3dfe14)+':\x20'}]});const _0x54360d=new Nt(_0x2f58c4);return _0x54360d['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2f58c4,_0x44c19c?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0xcd2ed2,_0xe05800,_0x54360d];}},In=class ModelNameView extends Nt{constructor(_0x5930a2){super(_0x5930a2),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x27eefd=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x27eefd['if']('isVisible','ck-hidden',_0x21fe2b=>!_0x21fe2b)]},'children':[{'text':_0x27eefd['to']('text')}]});}};const An='ck-ai-chat-context-controls__url-form',gn='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x299e47){super(_0x299e47),this['focusTracker']=new It(),this['keystrokes']=new At(),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 Ut({'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'](_0x300b7b=>{this['focusTracker']['add'](_0x300b7b['element']),this['keystrokes']['listenTo'](_0x300b7b['element']);}),te({'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'](_0x2e3220){this['urlInputField']['errorText']=_0x2e3220,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x977d01=new yt(this['locale']);return _0x977d01['set']({'icon':_0x3617a8,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x264aa6,_0x404f37,_0x2b8e17)=>{_0x977d01['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x2b8e17?'':'\x20ck-hidden')]});}),_0x977d01;}['_createUrlInputField'](){const _0x410edb=new _0x190a2c(this['locale'],_0x5dd3ab);return _0x410edb['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x410edb['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x410edb;}['_createConfirmButton'](){const _0x5a38d2=new yt(this['locale']);return _0x5a38d2['set']({'icon':_0x22df45,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x5a38d2;}['_setupTemplate'](){const _0x146556=new _0x2e05e4(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x146556['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':An,'tabindex':'-1'},'children':[_0x146556,{'tag':'div','attributes':{'class':gn},'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',_0x1d1ed7=>{_0x1d1ed7['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x55812e,_0x3e611e)=>{this['clear'](),this['fire']('cancel'),_0x3e611e();});}['_handleSubmit'](){const _0x1e792b=this['getValue']()['trim']();_0x1e792b?this['_isValidUrl'](_0x1e792b)?(this['clearError'](),this['fire']('submitUrl',_0x1e792b)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0xcd6ac1=this['getValue']()['trim'](),_0x23fa34=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0xcd6ac1['length']>0x0&&!_0x23fa34;}['_isValidUrl'](_0x2f70d6){try{return!!new URL(_0x2f70d6);}catch{return!0x1;}}}const wn='ck-ai-chat-resources__item',Cn='ck-ai-chat-resources__item--in-context',mn='ck-ai-chat-resources__item-title',pn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x3b0ed2,_0x2a6fce){super(_0x3b0ed2),this['resource']=_0x2a6fce,this['set']('isInContext',!!_0x2a6fce['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x2e1f42){if(_0x2e1f42['isInContext'])return _0x22df45;switch(_0x2e1f42['type']){case'document':return _0x4ffc28;case'web-resource':return _0x22c1bd;case'file':case'text':return _0x3b9c45;default:return _0x1e0ba4;}}['highlightText'](_0x485096){if(!_0x485096||''===_0x485096['trim']())return void this['_titleView']['highlightText'](null);const _0x1139ee=new RegExp(_0x3f0ae7(_0x485096),'gi');this['_titleView']['highlightText'](_0x1139ee);}['updateResourceState'](_0x287284){this['resource']['isInContext']=_0x287284,this['isInContext']=_0x287284,this['_updateIcon']();}['_createTitleView'](){const _0x465cb5=new _0x3bdb10();return _0x465cb5['text']=this['resource']['label'],_0x465cb5['extendTemplate']({'tag':'span','attributes':{'class':[mn]}}),_0x465cb5;}['_createIconView'](){const _0x18edb6=new Lt();return _0x18edb6['content']=this['getResourceIcon'](this['resource']),_0x18edb6;}['_setupTemplate'](){const _0x426d98=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[wn,_0x426d98['if']('isVisible','ck-hidden',_0x59928d=>!_0x59928d),_0x426d98['if']('isInContext',Cn)]},'children':[{'tag':'div','attributes':{'class':[pn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x426d98['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const En='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x3c8686,_0x237e09){super(_0x3c8686),this['_source']=_0x237e09,this['extendTemplate']({'attributes':{'class':[En]}});}['setResources'](_0x461119,_0x2ba27f){this['items']['clear']();let _0x5b0a77=_0x461119;if(this['_source']['useDefaultFiltering']&&_0x2ba27f&&''!==_0x2ba27f['trim']()){const _0x2bf605=new RegExp(_0x2ba27f['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x5b0a77=_0x461119['filter'](_0x30e7c2=>_0x2bf605['test'](_0x30e7c2['label']));}for(const _0x1671ef of _0x5b0a77){const _0x19f09d=new AIChatResourceListItemView(this['locale'],_0x1671ef);_0x19f09d['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x1671ef);}),this['items']['add'](_0x19f09d);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x2ba27f);}['highlightText'](_0x15f759){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x1b722a=>{_0x1b722a['highlightText'](_0x15f759);});}['updateResourceState'](_0x5095ee,_0x13fd01){for(const _0x502764 of this['items']){const _0x2212b9=_0x502764;_0x2212b9['resource']['id']===_0x5095ee&&_0x2212b9['updateResourceState'](_0x13fd01);}}['_handleResourceSelection'](_0x1188f8,_0x1630af){this['fire']('addResourceToContext',{'source':_0x1188f8,'resource':_0x1630af});}}class AIChatContextResourcesSearchInputView extends _0x190a2c{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x1fb541){const t=_0x1fb541['t'],_0x1c9698={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x5dd3ab,'label':Mi(_0x1fb541,'AI_CHAT_SEARCH_RESOURCES')};super(_0x1fb541,_0x1c9698['creator']),this['label']=_0x1c9698['label'],this['_viewConfig']=_0x1c9698,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x1fb541,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x2b1ae2){this['fire']('search',_0x2b1ae2);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0xd334bd,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x5db41f,t){this['resetButtonView']=new yt(_0x5db41f),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x1c0648,'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',_0x25e141=>!_0x25e141),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);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x5e62ee,_0x448a7a){super(_0x5e62ee),this['_source']=_0x448a7a['source'],this['_searchInputVisibleFrom']=_0x448a7a['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 _0x246137([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x1b7d3b=new Nt(this['locale']);return _0x1b7d3b['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1f86d7,_0xdf1d4)=>{this['loadResources'](_0xdf1d4),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0xdf1d4);}),_0x1b7d3b;}['_createResourcesListView'](){const _0x5e2811=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x5e2811['delegate']('addResourceToContext')['to'](this),_0x5e2811['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x5e2811;}['_createSkeletonView'](){const _0xf09404=new AISkeletonView(this['locale'],Ls['aiChatResources']);return _0xf09404['bind']('isVisible')['to'](this,'isLoading'),_0xf09404;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x13bd87){const _0x5d83ad=at();this['_latestLoadResourcesUid']=_0x5d83ad,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x13bd87,'uid':_0x5d83ad}),this['isLoading']=!0x0;}['setResources'](_0x6e0432,_0x209c20){if(_0x209c20&&_0x209c20!==this['_latestLoadResourcesUid'])return;const _0x51f612=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x6e0432,_0x51f612),_0x6e0432['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x25f2cf,_0x5f44d0){this['_resourcesListView']['updateResourceState'](_0x25f2cf,_0x5f44d0);}}const Tn='ck-ai-chat-context-controls__source-balloon-panel',fn='ck-button-icon\x20ck-button-back',Rn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x1b66d2,_0xb33aff,_0x134451){this['_locale']=_0x1b66d2,this['_bodyCollection']=_0xb33aff,this['_config']=_0x134451;}['showSourceResourcesBalloon']({source:_0x4ff758,withBackButton:_0x541101}){let _0x89f315=this['_sourceResourceBalloons']['get'](_0x4ff758['id']);_0x89f315||(_0x89f315=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x4ff758['id'],_0x89f315),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x89f315)),this['_addSourceResourceContent']({'balloonPanel':_0x89f315,'source':_0x4ff758,'withBackButton':_0x541101}),_0x89f315['show']();const _0x35cd21=this['_config']['getTargetElement']();_0x35cd21&&_0x89f315['pin']({'target':_0x35cd21,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x7cc2ca,_0x473448,_0x43096d){const _0x3c62ea=this['_sourceResourceBalloons']['get'](_0x7cc2ca);if(!_0x3c62ea)return;const _0x296cca=this['_getResourcesViewFromBalloon'](_0x3c62ea);_0x296cca&&(_0x296cca['setResources'](_0x473448,_0x43096d),_0x296cca['once']('change:isLoading',()=>{_0x3c62ea['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x2d5aef){const _0x54e06b=this['_sourceResourceBalloons']['get'](_0x2d5aef);_0x54e06b&&requestAnimationFrame(()=>{_0x54e06b['hide'](),this['_sourceResourceBalloons']['delete'](_0x2d5aef),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x3beeb6 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x3beeb6);}['isAnyResourceBalloonVisible'](){for(const _0x166a28 of this['_sourceResourceBalloons']['values']())if(_0x166a28['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x4b7679,_0x2352ab,_0x454e04){const _0x4b3fc8=this['_sourceResourceBalloons']['get'](_0x4b7679);if(!_0x4b3fc8||!_0x4b3fc8['isVisible'])return;const _0x6d7680=this['_config']['getTargetElement']();if(!_0x6d7680)return;_0x4b3fc8['pin']({'target':_0x6d7680,'limiter':this['_config']['getLimiterElement']()});const _0x29938e=this['_getResourcesViewFromBalloon'](_0x4b3fc8);_0x29938e&&_0x29938e['updateResourceState'](_0x2352ab,_0x454e04);}['destroy'](){for(const _0x2134ae of this['_sourceResourceBalloons']['values']())_0x2134ae['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x42c3a3=new zt(this['_locale']);return _0x42c3a3['extendTemplate']({'attributes':{'class':Tn}}),this['_bodyCollection']['add'](_0x42c3a3),_0x42c3a3;}['_addSourceResourceContent']({balloonPanel:_0x3e3f0e,source:_0x112cb4,withBackButton:_0x5d3d23}){_0x3e3f0e['content']['clear']();const _0x729fc7=this['_createBalloonHeader']({'balloonPanel':_0x3e3f0e,'source':_0x112cb4,'withBackButton':_0x5d3d23});_0x3e3f0e['content']['add'](_0x729fc7);const _0x37cf1f=this['_createBalloonResourcesView'](_0x112cb4);_0x3e3f0e['content']['add'](_0x37cf1f);}['_createBalloonHeader']({balloonPanel:_0x40093a,source:_0x499a59,withBackButton:_0x37f8dc}){const _0x3de975=new _0x2e05e4(this['_locale'],{'label':_0x499a59['label'],'class':Rn});return _0x37f8dc&&_0x3de975['children']['add'](this['_createBackButton'](_0x40093a),0x0),_0x3de975;}['_createBackButton'](_0x510edd){const _0x506613=new yt(this['_locale']);return _0x506613['set']({'icon':_0x3617a8,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':fn}),_0x506613['on']('execute',()=>{_0x510edd['hide'](),this['_config']['onBackToContext']();}),_0x506613;}['_createBalloonResourcesView'](_0x1cf477){const _0x312424=new AIChatContextResourcesView(this['_locale'],{'source':_0x1cf477,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x312424['on']('loadSourceResources',(_0x467fef,_0x36b694)=>{this['_config']['onLoadSourceResources'](_0x36b694);}),_0x312424['on']('addResourceToContext',(_0x4a73a1,_0x57c0e4)=>{this['_config']['onResourceSelected'](_0x57c0e4['source'],_0x57c0e4['resource']),this['closeSourceResourceBalloon'](_0x1cf477['id']);}),_0x312424;}['_getResourcesViewFromBalloon'](_0x240092){const _0x3ad76c=_0x240092['content']['get'](0x1);return _0x3ad76c instanceof AIChatContextResourcesView?_0x3ad76c:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x12e314){jt({'emitter':_0x12e314,'contextElements':[_0x12e314['element']],'callback':()=>{_0x12e314['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x12e314['isVisible']});}}const bn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Sn='ck-ai-chat-context-controls',On='ck-ai-chat-context-controls__pending-contexts',vn='ck-ai-chat-context-controls__add-context-balloon-panel',kn='ck-ai-chat-context-controls__add-context-button',yn='ck-ai-chat-context-controls__url-balloon-panel',Nn='ck-ai-chat-context-controls__balloon-button',xn='ck-ai-chat-context-controls__balloon-button-source',Ln='ck-ai-chat-controls-button',Pn='ck-ai-chat-context-chips-wrapper-balloon',Dn='ck-ai-chat-controls_context_show-more-button',Vn='ck-ai-chat-context-controls__show-more-balloon-panel',Hn='ck-ai-chat',Mn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x59868c,_0xf98d62){super(_0x59868c),this['bodyCollection']=_0xf98d62['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x59868c),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x59868c),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x59868c),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x59868c,_0xf98d62);const _0x45d768={'cssClasses':{'showMoreButton':Dn+'\x20'+Gi,'showMoreBalloon':Vn,'overflowContainer':Pn,'controlsButton':Ln}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x59868c,this['_currentContextsChips'],_0x45d768,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'](_0x342966,_0x2fc2bd){const _0x131596=this['_createContextButton'](_0x342966,'current',!0x0,_0x2fc2bd);this['_addContextToCollection'](_0x131596,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x14d341){this['_removeContextFromCollection'](_0x14d341,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x14d341,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x4d843c,_0x49ebc8){let _0x226ec8=this['_currentContextsChips']['find'](_0x16a23e=>_0x16a23e['id']===_0x4d843c);_0x226ec8||(_0x226ec8=this['_overflowManager']['overflowChips']['find'](_0x3e62fc=>_0x3e62fc['id']===_0x4d843c)),_0x226ec8&&(_0x226ec8['isLoading']=_0x49ebc8);}['setConversationContext'](_0xc46b9c){this['_conversationContextsChips']['clear']();for(const _0x84373c of _0xc46b9c){const _0x32a50e=this['_createContextButton'](_0x84373c,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x32a50e,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x1a4935,_0x56c65e,_0x364b6c){this['_resourcesBalloonView']['updateResourceState'](_0x1a4935,_0x56c65e,_0x364b6c);}['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:_0x257621,withBackButton:_0x487c2d}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x257621,'withBackButton':_0x487c2d}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x4c3767,_0x4f7789,_0x169f12,_0xa3eeb){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x4c3767,_0x169f12,_0xa3eeb);}['closeSourceResourceBalloon'](_0x38ffe3){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x38ffe3),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x401392){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x401392),this['_setAddContextButtonEnabled'](_0x401392);}['_setAddContextButtonEnabled'](_0x4999b9){const _0x2c3743=!_0x4999b9['document']['isHidden']&&_0x4999b9['document']['enabled'],_0x1988a0=_0x4999b9['urls']['enabled'],_0x564d79=_0x4999b9['files']['enabled'],_0x25299b=_0x4999b9['sources']['length']>0x0,_0x5a7899=_0x4999b9['customItems']&&_0x4999b9['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x2c3743||_0x1988a0||_0x564d79||_0x25299b||_0x5a7899;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Sn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':On},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x2328af){const _0xf7a2f9=new yt(_0x2328af);return _0xf7a2f9['set']({'label':Mi(_0x2328af,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ln+'\x20'+kn+'\x20'+Gi,'icon':_0x2f18c8,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0xf7a2f9;}['_createAddContextBalloonPanelView'](_0x5c1038){return this['_createBaseBalloonPanel'](_0x5c1038,vn);}['_createUrlBalloonPanelView'](_0x43a172){const _0x5d1062=this['_createBaseBalloonPanel'](_0x43a172,yn);return this['_addUrlContent'](_0x5d1062,_0x43a172),_0x5d1062;}['_createResourcesBalloonView'](_0x109009,_0x4a9b0c){const _0x131f72={'searchInputVisibleFrom':_0x4a9b0c['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});},'onResourceSelected':(_0x262b04,_0x4a5c71)=>{this['fire']('addResourceToContext',{'source':_0x262b04,'resource':_0x4a5c71});},'onLoadSourceResources':_0x30599a=>{this['fire']('loadSourceResources',_0x30599a);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x109009,_0x4a9b0c['bodyCollection'],_0x131f72);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Hn)||document['body'];}['_createBaseBalloonPanel'](_0x131a1b,_0x2d63b3){const _0x22fdc4=new zt(_0x131a1b);return _0x22fdc4['extendTemplate']({'attributes':{'class':_0x2d63b3}}),this['bodyCollection']['add'](_0x22fdc4),_0x22fdc4;}['_setBalloonPanelContent'](_0x9b8bb1,_0x321189,_0x1e34fa){if(_0x9b8bb1['content']['clear'](),!_0x1e34fa['document']['isHidden']&&_0x1e34fa['document']['enabled']){const _0x2a7571=this['_createBalloonButton'](_0x321189,{'label':Mi(_0x321189,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x4ffc28});_0x2a7571['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x9b8bb1['content']['add'](_0x2a7571);}if(_0x1e34fa['urls']['enabled']){const _0x194185=this['_createBalloonButton'](_0x321189,{'label':Mi(_0x321189,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x22c1bd});_0x194185['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_urlInputView']['focus']();}),_0x9b8bb1['content']['add'](_0x194185);}if(_0x1e34fa['files']['enabled']){const _0x5b7116=new _0x48142e(_0x321189);_0x5b7116['set']({'label':Mi(_0x321189,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x1b2e70,'withText':!0x0,'tooltip':!0x0,'class':Nn,'allowMultipleFiles':!0x0}),_0x5b7116['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x5b7116['on']('done',(_0x47e249,_0x43f7f2)=>{this['fire']('addFileToContext',_0x43f7f2);}),_0x5b7116['tooltip']=!0x0,_0x9b8bb1['content']['add'](_0x5b7116);}for(const _0x74efab of _0x1e34fa['sources']){const _0x35a954=this['_createBalloonButton'](_0x321189,{'label':_0x74efab['label'],'icon':_0x74efab['icon']||_0x1e0ba4,'type':'source'});_0x9b8bb1['content']['add'](_0x35a954),_0x35a954['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x74efab,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x550eb2 of _0x1e34fa['customItems']||[]){const _0x4430d4=this['_createBalloonButton'](_0x321189,{'label':_0x550eb2['label'],'icon':_0x550eb2['icon']||_0x1e0ba4,'type':'customItem'});_0x9b8bb1['content']['add'](_0x4430d4),_0x4430d4['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x550eb2);});}this['_hasExactlyOneSource']=0x1===_0x9b8bb1['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x4cc543,_0x483855){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x483855),this['_urlInputView']['on']('submitUrl',(_0x36d673,_0x277812)=>{this['_handleUrlSubmit'](_0x277812);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});}),_0x4cc543['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x16e51a,_0x1cf3a9){const _0xa70335='source'===_0x1cf3a9['type']?new SourcesBalloonButtonView(_0x16e51a):new yt(_0x16e51a);return _0xa70335['set']({'label':_0x1cf3a9['label'],'icon':_0x1cf3a9['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Nn}),_0xa70335;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x2e17b3){const _0x39a7e0=this['_addContextBalloonConfig'];_0x39a7e0['buttonView']['isOn']=_0x2e17b3,_0x2e17b3?_0x39a7e0['balloonView']['show']():_0x39a7e0['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0xecd0a,buttonView:_0x25c3bd,hideMethod:_0x5b9761}=this['_addContextBalloonConfig'];jt({'emitter':_0xecd0a,'contextElements':[_0xecd0a['element'],_0x25c3bd['element']],'callback':()=>{_0x5b9761();},'activator':()=>_0x25c3bd['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x5b91ea,_0x138cf4,_0x351ef8=!0x1,_0x248159=!0x1){const _0x10d965='conversation'===_0x138cf4||!0x0===_0x5b91ea['isReadOnly'],_0x38007a=new AIChatContextItemButtonView(this['locale'],_0x5b91ea,_0x10d965,_0x351ef8,_0x248159);return _0x10d965||_0x38007a['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x38007a['id']);}),_0x38007a;}['_addContextToCollection'](_0x188a76,_0xfd8284){_0xfd8284['add'](_0x188a76,0x0);}['_removeContextFromCollection'](_0x1ab27d,_0x4ffa7c){const _0x28322c=_0x4ffa7c['find'](_0x40c18c=>_0x40c18c['id']===_0x1ab27d);_0x28322c&&_0x4ffa7c['remove'](_0x28322c);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x282efc){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x282efc);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x5a749d){super(_0x5a749d),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[xn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x2c3524=new Lt();return _0x2c3524['content']=_0x5215ec,_0x2c3524['extendTemplate']({'attributes':{'class':xn+'__arrow'}}),_0x2c3524;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x5b42d4){super(_0x5b42d4),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 _0x2a9687=new yt(this['locale']);return _0x2a9687['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x236653}),_0x2a9687['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x2a9687;}['_createLoaderView'](){const _0x16eecd=new Nt(this['locale']);return _0x16eecd['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':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x16eecd;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x3752be,_0x21ec9f){super(_0x3752be),this['_filesEnabled']=_0x21ec9f['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x3752be,{'bodyCollection':_0x21ec9f['bodyCollection'],'searchInputVisibleFrom':_0x21ec9f['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x3752be),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x3752be),this['_loaderView']=this['_createLoaderView'](_0x3752be),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x3752be),this['_dropZoneView']=new AIChatDropZoneView(_0x3752be),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'](...bn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x510dab=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x510dab['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x510dab['if']('isLoading','ck-hidden',_0x12fc15=>_0x12fc15||!this['isModelAvailable']),_0x510dab['if']('isModelAvailable','ck-hidden',_0x22f216=>!_0x22f216||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x510dab['if']('isLoading','ck-hidden',_0x49ac2e=>!_0x49ac2e)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x510dab['if']('isModelAvailable','ck-hidden',_0x2a3e71=>_0x2a3e71)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'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'](_0x5c0fc8,_0x2f47ae){return new AIChatContextPanelView(_0x5c0fc8,_0x2f47ae);}['_createPromptInputView'](_0x5b873c){return new AIChatPromptInputView(_0x5b873c,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x2027fc){return new AIChatPromptCapabilitiesView(_0x2027fc);}['_createLoaderView'](_0x486bab){return new AIChatControlsLoaderView(_0x486bab);}['_createModelUnavailableMessageView'](_0x54b750){const _0xa5264f=new AIChatModelUnavailableMessageView(_0x54b750);return _0xa5264f['delegate']('startConversation')['to'](this),_0xa5264f;}['_handlePromptInputFocus'](_0x11f178,_0x387305,_0xe8f03b){_0xe8f03b?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x47dabd,_0x893849){this['_contextPanelView']['addContextItem'](_0x47dabd,_0x893849);}['removeContextItem'](_0x4e66d4){this['_contextPanelView']['removeContextItem'](_0x4e66d4);}['setContextItemLoading'](_0x3320b0,_0xc9f0a4){this['_contextPanelView']['setContextItemLoading'](_0x3320b0,_0xc9f0a4);}['setIsUploadInProgress'](_0x21be69){this['_promptInputView']['setIsUploadInProgress'](_0x21be69);}['setConversationContext'](_0x43cfe1){this['_contextPanelView']['setConversationContext'](_0x43cfe1);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x2c540e,_0x26edf0,_0x2c7487){this['_contextPanelView']['updateResourceState'](_0x2c540e,_0x26edf0,_0x2c7487);}['setWebSearch'](_0x3348e5){this['_promptCapabilitiesView']['setWebSearch'](_0x3348e5);}['setReasoning'](_0x4fc9f2){this['_promptCapabilitiesView']['setReasoning'](_0x4fc9f2);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x51c4e4){this['_contextPanelView']['setAddContextOptions'](_0x51c4e4);}['setInputPlaceholder'](_0x50b607){this['_promptInputView']['setPlaceholderText'](_0x50b607);}['setModelList'](_0x28f3a3,_0x4c72b4){this['_promptCapabilitiesView']['setModelList'](_0x28f3a3,_0x4c72b4);}['setModel'](_0x2624a1){_0x2624a1?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x2624a1)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x56681e){this['_promptCapabilitiesView']['disableModelSelector'](_0x56681e);}['populateSourceResourceBalloon'](_0x2a4475,_0x25daaf,_0x3664ba,_0x467376){this['_contextPanelView']['populateSourceResourceBalloon'](_0x2a4475,_0x25daaf,_0x3664ba,_0x467376);}['closeSourceResourceBalloon'](_0x266ccf){this['_contextPanelView']['closeSourceResourceBalloon'](_0x266ccf);}['focusPromptInput'](_0x1e352e=!0x1){this['_promptInputView']['focus'](_0x1e352e);}['setPromptInputValue'](_0x2a2c3b){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x2a2c3b;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x25121e){super(_0x25121e);const _0x589c8e=new yt(_0x25121e);_0x589c8e['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x589c8e['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x589c8e]}]});}}class AIHeaderView extends _0x2e05e4{['resizeButton'];constructor(_0x8ce278,_0x4739e0){super(_0x8ce278,{'label':_0x4739e0['label'],'class':'ck-ai-header\x20'+_0x4739e0['class'],'icon':_0x4739e0['icon']}),this['set']('isMaximized',!0x1),_0x4739e0['content']&&this['children']['add'](_0x4739e0['content']),_0x4739e0['showResizeButton']&&(this['resizeButton']=Fi(_0x8ce278,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x4972b0){super(_0x4972b0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x4972b0,'AI_DISCLAIMER_TEXT')}]}]});}}function Un(_0x2ed419,_0x2da008){const _0xd7b190=new yt(_0x2ed419);return _0xd7b190['set']({'label':Mi(_0x2ed419,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x23b63a,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0xd7b190['on']('execute',()=>{_0x2da008['fire']('startConversation');}),_0xd7b190;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x4e40d4,_0x2e097b){super(_0x4e40d4),this['_bodyCollection']=new Xt(_0x4e40d4),this['_bodyCollection']['attachToDom']();const _0x1f87f5=Un(_0x4e40d4,this);this['chatHeader']=new AIHeaderView(_0x4e40d4,{'label':Mi(_0x4e40d4,'AI_CHAT_HEADING'),'icon':_0xe943b8,'class':'ck-ai-header_chat','content':_0x1f87f5,'showResizeButton':_0x2e097b['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x4e40d4,this['_bodyCollection']),this['chatFeed']['delegate'](...Os)['to'](this),this['chatControls']=new AIChatControlsView(_0x4e40d4,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2e097b['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2e097b['filesEnabled']}),this['chatControls']['delegate'](...Os)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x4e40d4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x4e40d4['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x31fdb9,_0x387650,_0x90b8e,_0x1a301a){this['chatControls']['populateSourceResourceBalloon'](_0x31fdb9,_0x387650,_0x90b8e,_0x1a301a);}['closeSourceResourceBalloon'](_0x487935){this['chatControls']['closeSourceResourceBalloon'](_0x487935);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x21ae07{static get['requires'](){return[AITabs];}['_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(_0x553e1f){super(_0x553e1f);const _0x1a8935=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x1a8935['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'](_0x1a8935),this['_view']['delegate'](...Os)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x3f877c,{showDiff:_0x1468c4})=>{this['showDiff']=_0x1468c4;}),this['disableControls'](),_0x1a8935['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0xe943b8,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x1a8935['view'],'isMaximized',_0x213824=>_0x213824),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x23bcad=>_0x23bcad),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x2b78bc){const _0x5c436e=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x2b78bc['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x5c436e}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x3c27ee,staticMessage:_0xb1854a}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x3c27ee,'initialContent':'<p>'+_0xb1854a+'</p>'});});}async['addFeedItemUserMessage'](_0xfa28c3){const _0x545733=_0xfa28c3['attributes']?.['displayedPrompt']||_0xfa28c3['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0xfa28c3['contextItems']['values']()),'initialContent':'<p>'+_0x545733+'</p>','id':_0xfa28c3['id']});});}async['addFeedItemError']({errorMessage:_0x167d33,id:_0x13d4c4}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x167d33+'</p>','id':_0x13d4c4});});}async['addFeedItemAIReply'](_0x502e0b){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x502e0b['interactionId']+':'+_0x502e0b['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x4da0d9){const _0x3243e9=ms(this['context']),_0xa69ac2=_0x3243e9['map'](_0x14deac=>_0x14deac['config']['get']('ai.availableReplyActions')||[...Ds]);let _0xb8c25a=_0xa69ac2['reduce']((_0x5ea2f3,_0x2add43)=>_0x5ea2f3['filter'](_0x5ea92d=>_0x2add43['includes'](_0x5ea92d)),_0xa69ac2[0x0]||[...Ds]);const _0x360523=_0x3243e9['every'](_0x41ee23=>_0x41ee23['plugins']['has']('TrackChanges')),_0x46019f=_0x3243e9['map'](_0x5ef5ad=>_0x5ef5ad['commands']['get']('trackChanges'));return _0x360523?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x46019f,'value',(..._0x1e9656)=>_0x1e9656['some'](_0x23359c=>_0x23359c))):_0xb8c25a=_0xb8c25a['filter'](_0x46e041=>'insertSuggestion'!=_0x46e041),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4da0d9['interactionId']+':'+_0x4da0d9['id'],'areActionsDisabled':_0x4da0d9['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0xb8c25a}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x23ac01,_0x4e52f1){return this['_promiseQueue']['enqueue'](async()=>{const _0x137ca4=this['_view']['chatFeed']['children']['last'];if(_0x137ca4 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x137ca4),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x23ac01['id'],'capabilities':{'isWebSearchEnabled':_0x137ca4['capabilities']['isWebSearchEnabled']||_0x4e52f1['isWebSearchEnabled'],'isReasoningEnabled':_0x137ca4['capabilities']['isReasoningEnabled']||_0x4e52f1['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x23ac01['id'],'capabilities':_0x4e52f1});});}async['addFeedItemCustomElement'](_0x1796b9,_0x47ae29){let _0x519459;return await this['_promiseQueue']['enqueue'](async()=>{_0x519459=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x1796b9,'id':_0x47ae29});}),_0x519459;}['removeFeedItem'](_0x5946cf){this['_view']['chatFeed']['removeItem'](_0x5946cf);}['hasFeedItem'](_0xb15673){return this['_view']['chatFeed']['hasItem'](_0xb15673);}['updateFeedInteractionHeader'](_0x5f1a36){const _0xb79940=this['_view']['chatFeed']['children']['find'](_0x539df=>_0x539df['options']['id']==_0x5f1a36['id']&&_0x539df instanceof AIChatFeedInteractionHeaderView);_0xb79940&&_0xb79940['set']('isVisible',_0x5f1a36['isVisible']);}async['updateFeedItemAIReplyContent'](_0x585f13){const _0x3fce2b=_0x585f13['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0xd56cae=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x585f13,'abortSignal':_0xd56cae,'renderingStrategy':_0x3fce2b}),_0x585f13['isDone']&&this['markFeedItemAsDone'](_0x585f13['id']);});}['updateFeedItemAIReplySources'](_0x5c0e98,_0x1e35e1){this['_view']['chatFeed']['updateWebSources'](_0x5c0e98,_0x1e35e1);}async['updateFeedItemAIReplySuggestionContent'](_0xdb3428){return this['_promiseQueue']['enqueue'](async _0x5e638d=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0xdb3428,'abortSignal':_0x5e638d}),_0xdb3428['isDone']&&this['markFeedItemAsDone'](_0xdb3428['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x3694c7){this['_view']['chatFeed']['updateSuggestionPartState'](_0x3694c7);}['setFeedItemAIReplySuggestionPartActive'](_0xabba75){this['_view']['chatFeed']['setSuggestionPartActive'](_0xabba75);}['markFeedItemAsDone'](_0x1d2876){this['_view']['chatFeed']['markItemAsDone'](_0x1d2876);}['removeFeedInteraction'](_0x3ef3a1){this['_view']['chatFeed']['getItemIds']()['filter'](_0x210e60=>_0x210e60['startsWith'](_0x3ef3a1))['forEach'](_0x2cb367=>this['_view']['chatFeed']['removeItem'](_0x2cb367));}['startInteraction'](){const _0x57b45f=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x57b45f),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x45dbb0){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x36452e=>_0x36452e['startsWith'](_0x45dbb0['id']))['forEach'](_0x46640d=>this['markFeedItemAsDone'](_0x46640d)),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'](_0x49e0e9,_0x402a39){this['_view']['chatControls']['addContextItem'](_0x49e0e9,_0x402a39);}['removeContextItem'](_0xefdc9b){this['_view']['chatControls']['removeContextItem'](_0xefdc9b);}['setContextItemLoading'](_0x1ae3db,_0x3cfae4){this['_view']['chatControls']['setContextItemLoading'](_0x1ae3db,_0x3cfae4);}['setIsUploadInProgress'](_0x52c700){this['_view']['chatControls']['setIsUploadInProgress'](_0x52c700);}['setConversationContext'](_0x333dbb){this['_view']['chatControls']['setConversationContext'](_0x333dbb);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x45be69,_0x14bbbe,_0x2a10a9){this['_view']['chatControls']['updateResourceState'](_0x45be69,_0x14bbbe,_0x2a10a9);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x23b522){this['_view']['chatControls']['setAddContextOptions'](_0x23b522);}['updateCapabilities'](_0x346614){this['_view']['chatControls']['setWebSearch'](_0x346614['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x346614['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x346614));}['setSelectedModel'](_0x2f81c9,_0x453fc5){this['_view']['chatControls']['setModel'](_0x2f81c9),_0x453fc5&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x925594){this['feedItemRenderingStrategy']=_0x925594;}['toggleLoadingSkeleton'](_0x151371){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x151371);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x256d49,_0x1d90ff=!0x1){if(_0x1d90ff&&!St()&&_0x256d49['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x256d49);this['_view']['chatHeader']['label']=_0x256d49;}['setLoadingMessage'](_0x24b2ba){this['_view']['chatFeed']['setLoadingMessage'](_0x24b2ba);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x449b77){let _0x2996a2=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x449b77[_0x2996a2],_0x2996a2++,_0x2996a2===_0x449b77['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0xababd6){return _0xababd6['isWebSearchEnabled']&&_0xababd6['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0xababd6['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0xababd6['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0xe3d10d){return _0xe3d10d?_0xe3d10d['isWebSearchEnabled']&&_0xe3d10d['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0xe3d10d['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0xe3d10d['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x49b065,_0x200dd0,_0x35d4ea,_0x431ed0){this['_view']['populateSourceResourceBalloon'](_0x49b065,_0x200dd0,_0x35d4ea,_0x431ed0);}['closeSourceResourceBalloon'](_0x49f480){this['_view']['closeSourceResourceBalloon'](_0x49f480);}['setPromptInputValue'](_0x38f5d0){this['_view']['chatControls']['setPromptInputValue'](_0x38f5d0);}['focusPromptInput'](_0x202d99=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x202d99);}['scrollFeedToSuggestion'](_0xc9db84,_0x41a515){this['_view']['chatFeed']['scrollToSuggestion'](_0xc9db84,_0x41a515);}['startAutoScroll'](_0x14d884={}){this['_view']['chatFeed']['startAutoScroll'](_0x14d884);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x3501c8,_0x3d4e6a){super(_0x3501c8),this['sections']=_0x3d4e6a,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x27f780){let _0x4235cc=0x0,_0x222433=0x0;for(const _0x3e5e9e of this['sections']){const {resultsCount:_0x2309a8,totalItemsCount:_0x475258}=_0x3e5e9e['filter'](_0x27f780);_0x4235cc+=_0x2309a8,_0x222433+=_0x475258;}return{'resultsCount':_0x4235cc,'totalItemsCount':_0x222433};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x4e7805,{title:_0x5a223d,items:_0x503909}){super(_0x4e7805);const _0x2fadbb=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5a223d,this['itemsViews']=_0x503909;const _0x288079=new Nt(_0x4e7805);_0x288079['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x4e7805),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x2fadbb['if']('isVisible','ck-hidden',_0x5a1b6a=>!_0x5a1b6a)]},'children':[_0x288079,this['_itemsListView']]});}['filter'](_0x27c30d){const _0x4e21cb=this['itemsViews']['length'];let _0x3d5448=0x0;for(const _0x475216 of this['itemsViews']){if(_0x27c30d){const _0x2c2168=_0x475216['isMatching'](_0x27c30d);_0x475216['isVisible']=!!_0x2c2168,_0x475216['highlightText'](_0x27c30d);}else _0x475216['isVisible']=!0x0,_0x475216['highlightText'](null);_0x475216['isVisible']&&_0x3d5448++;}return this['isVisible']=_0x3d5448>0x0,{'resultsCount':_0x3d5448,'totalItemsCount':_0x4e21cb};}['getItem'](_0x17cf27){return this['itemsViews']['find'](_0x352974=>_0x352974['id']===_0x17cf27);}['removeItem'](_0x5db068){const _0x546217=this['itemsViews']['indexOf'](_0x5db068);-0x1!==_0x546217&&(this['itemsViews']['splice'](_0x546217,0x1),this['_itemsListView']['items']['remove'](_0x5db068));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
+ _0x302506(Ht){['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(_0x58affb,_0x2674c3){super(_0x58affb);const _0x54525f=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x2674c3['pinned']),this['set']('loadingState',null),this['set']('title',_0x2674c3['title']),this['id']=_0x2674c3['id'];const {createdAt:_0x3613f5,active:_0x3611b4=!0x1}=_0x2674c3;this['_titleView']=new _0x3bdb10(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x403c60=this['_createCheckView'](),_0x4a50cb=this['_createPinButtonView'](_0x58affb),_0x174265=this['_createMenuDropdownView'](),_0x550f00=this['_createEditInputView'](_0x58affb),_0x3cb9b9=this['_createAcceptEditButtonView'](_0x58affb,_0x550f00),_0x559cf5=this['_createCancelEditButtonView'](_0x58affb);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x4a50cb),this['actions']['add'](_0x174265),this['on']('change:isEdit',(_0x5324cd,_0x57c3cc,_0x14e34a)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x14e34a?(this['actions']['add'](_0x3cb9b9),this['actions']['add'](_0x559cf5),this['mainContent']['add'](_0x550f00),_0x550f00['element']['value']=this['title']||'',_0x550f00['element']['focus']()):(this['actions']['add'](_0x4a50cb),this['actions']['add'](_0x174265),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x3611b4?'ck-ai-chat-history__item--active':'',_0x54525f['if']('isVisible','ck-hidden',_0xa063af=>!_0xa063af),_0x54525f['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',_0x54525f['if']('loadingState','ck-hidden',_0x4baf95=>!!_0x4baf95)]},'children':_0x3611b4?[_0x403c60]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x54525f['if']('loadingState','ck-hidden',_0x27ae52=>!_0x27ae52)]},'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',_0x54525f['if']('loadingState','ck-hidden',_0xd1e92f=>!!_0xd1e92f)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x54525f['if']('loadingState','ck-hidden',_0x5391f5=>!_0x5391f5)]},'children':[{'text':_0x54525f['to']('loadingState',_0x10b90d=>_0x10b90d?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x10b90d]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x3613f5]}]},{'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'](_0x34fc73){this['set']('title',_0x34fc73);}['updateLoadingState'](_0x21102d,_0x5c0aca){this['set']('loadingState',_0x5c0aca?_0x21102d:null);}['_createCheckView'](){const _0x224d3f=new Lt();return _0x224d3f['set']({'content':_0x22df45}),_0x224d3f;}['_createPinButtonView'](_0x5aad4a){const _0x48e4e0=new yt(_0x5aad4a);return _0x48e4e0['set']({'label':Mi(_0x5aad4a,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0xfb1eb,'withText':!0x1,'tooltip':!0x0}),_0x48e4e0['bind']('isOn')['to'](this,'pinned'),_0x48e4e0['on']('execute',()=>{const _0x42b397=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x42b397});}),_0x48e4e0;}['_createMenuDropdownView'](){const _0x1b8baa=Ft(this['locale']),_0x5ed0c0=_0x1b8baa['panelView']['children'];_0x1b8baa['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x1becc0}),_0x1b8baa['panelPosition']='sw';const _0x5350d0=new yt(this['locale']);_0x5350d0['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x5350d0['withText']=!0x0,_0x5350d0['on']('execute',()=>{this['isEdit']=!0x0;});const _0x447714=new yt(this['locale']);_0x447714['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x447714['withText']=!0x0,_0x447714['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x1d8c95=new Dt(this['locale']),_0x2bcb88=new Ht(this['locale']);_0x2bcb88['children']['add'](_0x5350d0);const _0x5adb87=new Ht(this['locale']);return _0x5adb87['children']['add'](_0x447714),_0x1d8c95['items']['addMany']([_0x2bcb88,_0x5adb87]),_0x5ed0c0['add'](_0x1d8c95),_0x1b8baa;}['_createEditInputView'](_0xed0a77){const _0x281646=new _0x2e95a6(_0xed0a77),_0x3f1490=_0x281646['bindTemplate'];return _0x281646['extendTemplate']({'on':{'keydown':_0x3f1490['to'](_0x7a9391=>{'Enter'==_0x7a9391['key']&&this['_commitEditInputValue'](_0x281646);})}}),_0x281646;}['_createAcceptEditButtonView'](_0xd0bede,_0x4e3d8a){const _0x1288e9=new yt(_0xd0bede);return _0x1288e9['set']({'icon':_0x22df45,'withText':!0x1,'tooltip':Mi(_0xd0bede,'AI_CHAT_HISTORY_ACCEPT')}),_0x1288e9['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x1288e9['on']('execute',()=>{this['_commitEditInputValue'](_0x4e3d8a);}),_0x1288e9;}['_commitEditInputValue'](_0x39f8c4){const _0x423750=_0x39f8c4['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x423750});}['_createCancelEditButtonView'](_0x389fa0){const _0x24b40f=new yt(_0x389fa0);return _0x24b40f['set']({'icon':_0x1c0648,'withText':!0x1,'tooltip':Mi(_0x389fa0,'AI_CHAT_HISTORY_CANCEL')}),_0x24b40f['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x24b40f['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x24b40f;}['_createSpinnerView'](){const _0x590e7a=new AISpinnerView('tiny');return _0x590e7a['isVisible']=!0x0,_0x590e7a;}['isMatching'](_0x4646f1){return'string'==typeof this['title']&&this['title']['match'](_0x4646f1)?{'title':!0x0}:null;}['highlightText'](_0x6e4a1f){this['_titleView']['highlightText'](_0x6e4a1f);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x3e5ad8,_0xe3aae3){super(_0x3e5ad8),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x19173b=Un(_0x3e5ad8,this);this['headerView']=new AIHeaderView(_0x3e5ad8,{'label':Mi(_0x3e5ad8,'AI_CHAT_HISTORY_HEADING'),'icon':_0xd48db1,'class':'ck-ai-header_history','content':_0x19173b,'showResizeButton':_0xe3aae3}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x3e5ad8,[]),this['sectionsView']['delegate'](...Bn)['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',_0x2f2679=>!_0x2f2679)]}}),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 _0x4eae0e=new _0x22189f(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x19d7c8=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x19d7c8),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x1cd7fa=this['_createErrorView']();return _0x1cd7fa['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x204ed7=>!_0x204ed7)]}}),_0x4eae0e['on']('render',()=>{_0x4eae0e['children']['add'](_0x1cd7fa,0x1);}),_0x4eae0e['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x22819e=>!_0x22819e)]}}),_0x4eae0e;}['_createSkeletonView'](){const _0x97be3a=new AISkeletonView(this['locale'],Ls['aiHistory']);return _0x97be3a['bind']('isVisible')['to'](this,'isLoading'),_0x97be3a;}['_createErrorView'](){const _0x3929cd=new Nt(this['locale']),_0x31df1c=new yt(this['locale']);_0x31df1c['set']({'withText':!0x1,'icon':_0x1c0648,'class':'ck-ai-notification_error__dismiss-button'}),_0x31df1c['bind']('isVisible')['to'](this,'hasItems',_0x20a239=>!!_0x20a239),_0x31df1c['on']('execute',()=>{this['errorMessage']='';});const _0x2e4106=this['bindTemplate'];return _0x3929cd['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x2e4106['to']('errorMessage')}]},_0x31df1c]}),_0x3929cd;}['_createEmptyStateView'](){const _0x391644=new Nt(this['locale']);return _0x391644['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x1defba=>!_0x1defba)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x391644;}['_createListItemViews'](_0x4e56d3,_0x18fe32){const _0x30578d=[];for(const _0x40d665 of _0x4e56d3){const _0x3f4cf1=new AIChatHistoryListItemView(_0x18fe32,_0x40d665);_0x3f4cf1['delegate'](...Bn)['to'](this),_0x30578d['push'](_0x3f4cf1);}return _0x30578d;}['updateHistoryItemsWithCategories'](_0x4ae1f6){const _0x379005=this['locale']||'en',_0x1c614f=[];for(const _0x2baf1b of _0x4ae1f6){const _0x51884e=this['_createListItemViews'](_0x2baf1b['items'],_0x379005);_0x1c614f['push'](new AIChatHistoryListView(_0x379005,{'title':_0x2baf1b['title'],'items':_0x51884e}));}this['sectionsView']['sections']=_0x1c614f,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x1c614f),this['hasItems']=_0x4ae1f6['some'](_0x400d8e=>_0x400d8e['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x322c88){for(const _0x458201 of this['sectionsView']['sections']){const _0x2a54fb=_0x458201['getItem'](_0x322c88);if(_0x2a54fb){if(_0x458201['removeItem'](_0x2a54fb),0x0===_0x458201['itemsViews']['length']){const _0x2f5297=this['sectionsView']['sections']['indexOf'](_0x458201);-0x1!==_0x2f5297&&(this['sectionsView']['sections']['splice'](_0x2f5297,0x1),this['sectionsView']['items']['remove'](_0x458201));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x322e3c,_0x2bbe20){for(const _0x53f271 of this['sectionsView']['sections']){const _0x5c7bc0=_0x53f271['getItem'](_0x322e3c);if(_0x5c7bc0){_0x5c7bc0['updateTitle'](_0x2bbe20);break;}}}['updateItemLoadingState'](_0xcd28e0,_0x562e8c,_0x50bcb8){for(const _0x86751f of this['sectionsView']['sections']){const _0x528e44=_0x86751f['getItem'](_0xcd28e0);if(_0x528e44){_0x528e44['updateLoadingState'](_0x562e8c,_0x50bcb8);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0xff7e0a=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0xff7e0a);}}}const Bn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x21ae07{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xe4e842){super(_0xe4e842);const _0x5d1b5b=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x5d1b5b['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x5d1b5b),this['_historyView']['delegate'](...Bn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x5d1b5b['view'],'isMaximized',_0x273058=>_0x273058),_0x5d1b5b['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0xd48db1,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x22704a){this['_historyView']['removeHistoryItem'](_0x22704a);}['updateItems'](_0x515b3d){this['_historyView']['updateHistoryItemsWithCategories'](_0x515b3d);}['updateItemTitle'](_0x5b5a7d,_0x425091){this['_historyView']['updateItemTitle'](_0x5b5a7d,_0x425091);}['updateItemLoadingState'](_0x3978db,_0x3454b7,_0x4aa36c){this['_historyView']['updateItemLoadingState'](_0x3978db,_0x3454b7,_0x4aa36c);}['setLoadingSkeleton'](_0x1f71bc){this['_historyView']['isLoading']=_0x1f71bc;}['showError'](_0x250106){this['_historyView']['errorMessage']=_0x250106;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x41f72a,title:_0x52eec6,createdAt:_0x6a11bb,updatedAt:_0x38d42e,pinned:_0x455ec4}){super(),this['id']=_0x41f72a,this['createdAt']=new Date(_0x6a11bb),this['set']('title',_0x52eec6),this['set']('updatedAt',_0x38d42e?new Date(_0x38d42e):null),this['set']('pinned',_0x455ec4||!0x1);}['updateTitle'](_0x430cb7){this['set']('title',_0x430cb7),this['updatedAt']=new Date();}['updatePinned'](_0x20bf61){this['set']('pinned',_0x20bf61),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x50666f,group:_0x263533}){super(),this['connector']=_0x50666f,this['group']=_0x263533;}async['init'](){try{const _0x188c63=this['connector']['fetchConversations'](this['group']),_0x2dfc34=await _0x188c63['getConversations']();this['loadItems'](_0x2dfc34);}catch(_0x493903){this['fire']('error',{'error':_0x493903,'operation':'init'});}}['addItem'](_0x572d05){this['items']['push'](_0x572d05);}async['removeItem'](_0x5c27f7){const _0x2f512f=this['items']['findIndex'](_0x3f95fb=>_0x3f95fb['id']===_0x5c27f7);if(-0x1===_0x2f512f)return!0x1;try{return await this['connector']['deleteConversation'](_0x5c27f7)['execute'](),this['items']['splice'](_0x2f512f,0x1),this['fire']('itemRemoved',{'itemId':_0x5c27f7}),!0x0;}catch(_0x3cfe75){return this['fire']('error',{'error':_0x3cfe75,'operation':'removeItem','itemId':_0x5c27f7}),!0x1;}}['getItem'](_0x3c3dc1){return this['items']['find'](_0x5c9c90=>_0x5c9c90['id']===_0x3c3dc1);}async['updateItemTitle'](_0x4d1971,_0xbc82ab){const _0x248e41=this['getItem'](_0x4d1971);if(!_0x248e41)return!0x1;try{return await this['connector']['updateConversation'](_0x4d1971,{'title':_0xbc82ab})['getResult'](),_0x248e41['updateTitle'](_0xbc82ab),this['fire']('itemUpdated',{'itemId':_0x4d1971,'updates':{'title':_0xbc82ab}}),!0x0;}catch(_0x5f04cc){return this['fire']('error',{'error':_0x5f04cc,'operation':'updateItemTitle','itemId':_0x4d1971}),!0x1;}}async['updateItemPinned'](_0x1e4654,_0x41f82d){const _0x11f554=this['getItem'](_0x1e4654);if(!_0x11f554)return!0x1;try{return await this['connector']['updateConversation'](_0x1e4654,{'pinned':_0x41f82d})['getResult'](),_0x11f554['updatePinned'](_0x41f82d),this['fire']('itemUpdated',{'itemId':_0x1e4654,'updates':{'pinned':_0x41f82d}}),!0x0;}catch(_0x3bb12a){return this['fire']('error',{'error':_0x3bb12a,'operation':'updateItemPinned','itemId':_0x1e4654}),!0x1;}}['loadItems'](_0x5d6842){try{this['items']=[],_0x5d6842['map'](_0x457651=>{this['addItem'](new AIChatHistoryItem(_0x457651));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x1b8b4a){this['fire']('error',{'error':_0x1b8b4a,'operation':'loadItems'});}}['getItems'](_0x354653={}){const _0x5cfbeb=void 0x0!==_0x354653['pinned']&&_0x354653['pinned'],_0x44bb94=_0x354653['from']?new Date(_0x354653['from']['getFullYear'](),_0x354653['from']['getMonth'](),_0x354653['from']['getDate']()):null,_0x51ae83=_0x354653['to']?new Date(_0x354653['to']['getFullYear'](),_0x354653['to']['getMonth'](),_0x354653['to']['getDate']()):null;return this['items']['filter'](_0x4593b6=>{if(_0x4593b6['pinned']!==_0x5cfbeb)return!0x1;if(_0x51ae83){const _0x316f1a=new Date(_0x4593b6['createdAt']['getFullYear'](),_0x4593b6['createdAt']['getMonth'](),_0x4593b6['createdAt']['getDate']());return _0x44bb94?_0x44bb94['getTime']()===_0x51ae83['getTime']()?_0x316f1a['getTime']()===_0x44bb94['getTime']():_0x316f1a<_0x51ae83&&_0x316f1a>=_0x44bb94:_0x316f1a<_0x51ae83;}return!0x0;});}}class AIChatHistoryController extends _0x21ae07{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0x12d88c=this['context']['plugins']['get'](AITabs);try{const _0x4a20a7=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x4a20a7}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x4982a9,_0x296258)=>{this['_setItemLoading'](_0x296258['id'],'remove'),this['_handleRemove'](_0x296258['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x3cefb9,_0x390094)=>{this['_setItemLoading'](_0x390094['id'],'rename'),this['_handleEditTitle'](_0x390094['id'],_0x390094['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0xe61689,_0x3283c7)=>{void 0x0!==_0x3283c7['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x3283c7['itemId'],_0x3283c7['updates']['title']),void 0x0!==_0x3283c7['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x3283c7['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x50e1b7,_0x219dee)=>{this['_aiChatController']['_handleRemovedConversation'](_0x219dee['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x219dee['itemId']),this['_clearItemLoading'](_0x219dee['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x446280,_0x45be21)=>{this['_handleHistoryErrorUI'](_0x45be21['error'],_0x45be21['operation'],_0x45be21['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x2d7294,_0x37d667)=>{this['_handleSelectConversation'](_0x37d667['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x41c030,_0x159d96)=>{const _0x160db0=_0x159d96['pinned']?'pin':'unpin';this['_setItemLoading'](_0x159d96['id'],_0x160db0),this['_handleTogglePin'](_0x159d96['id'],_0x159d96['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x12d88c['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x12d88c['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x34d6cd){this['_handleHistoryErrorUI'](_0x34d6cd,'init');}}async['_handleEditTitle'](_0x57b1b6,_0x3cf15f){await this['history']['updateItemTitle'](_0x57b1b6,_0x3cf15f);}async['_handleTogglePin'](_0x1691d3,_0x28d4db){await this['history']['updateItemPinned'](_0x1691d3,_0x28d4db);}async['_handleRemove'](_0x1cf49c){await this['history']['removeItem'](_0x1cf49c);}async['_handleSelectConversation'](_0x5c9d65){await this['_aiChatController']['loadConversation'](_0x5c9d65);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x3ee5cf=this['_aiChatController']['activeConversation']?.['id'],_0x4f2c61=this['_getCategorizedItems']()['map'](_0x106919=>({'title':_0x106919['title'],'items':_0x106919['items']['map'](_0x112416=>({'id':_0x112416['id'],'title':_0x112416['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x112416['createdAt'])['toLocaleDateString'](),'active':_0x112416['id']===_0x3ee5cf,'pinned':_0x112416['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x4f2c61);}['_setItemLoading'](_0x4c384a,_0x362d1d){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4c384a,_0x362d1d,!0x0);}['_clearItemLoading'](_0x16aff3){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x16aff3,null,!0x1);}['_handleHistoryErrorUI'](_0x7d4a0a,_0x398d49,_0x29e23a){const _0x4b8c2f=this['_generateErrorMessage'](_0x398d49,_0x29e23a);this['_aiChatHistoryUi']['showError'](_0x4b8c2f),_0x29e23a&&this['_clearItemLoading'](_0x29e23a),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x4433e0,_0x4b2137){const _0x3c6718=_0x4b2137?this['history']['getItem'](_0x4b2137):null,_0x45e789=_0x3c6718?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x4433e0){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x45e789);case'updateItemPinned':{const _0x1e34ec=Mi(this['context']['locale'],_0x3c6718?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x1e34ec,_0x45e789]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x45e789);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x5d9a63=new Date(),_0x1c40b9=new Date(_0x5d9a63['getFullYear'](),_0x5d9a63['getMonth'](),_0x5d9a63['getDate']()),_0x216daa=new Date(_0x1c40b9);_0x216daa['setDate'](_0x216daa['getDate']()-0x1);const _0x173145=new Date(_0x1c40b9);_0x173145['setDate'](_0x173145['getDate']()-0xe);const _0x971267=this['history']['getItems']({'pinned':!0x0}),_0x3ea3be=this['history']['getItems']({'from':_0x1c40b9,'to':_0x1c40b9}),_0x3d2523=this['history']['getItems']({'from':_0x216daa,'to':_0x216daa}),_0x42086e=this['history']['getItems']({'from':_0x173145,'to':_0x216daa}),_0x3e5cb1=this['history']['getItems']({'to':_0x173145}),_0x43ed4b=[];return _0x971267['length']>0x0&&_0x43ed4b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x971267}),_0x3ea3be['length']>0x0&&_0x43ed4b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x3ea3be}),_0x3d2523['length']>0x0&&_0x43ed4b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x3d2523}),_0x42086e['length']>0x0&&_0x43ed4b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x42086e}),_0x3e5cb1['length']>0x0&&_0x43ed4b['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x3e5cb1}),_0x43ed4b;}}class AIChatHistory extends _0x21ae07{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x21ae07{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3c871e){super(_0x3c871e),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');}}class AIChatShortcutView extends yt{['id'];constructor(_0x23accd,_0x314dd6){super(_0x23accd);const {id:_0x163e48,type:_0xade08a,icon:_0x2a2fee}=_0x314dd6;this['id']=_0x163e48,this['set']({'label':_0x314dd6['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x314dd6['id']}}),_0x2a2fee?this['icon']=_0x2a2fee:'chat'===_0xade08a?this['icon']=_0xe943b8:'review'===_0xade08a?this['icon']=_0x3b9a9d:'translate'===_0xade08a&&(this['icon']=_0x8eaaa1);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x31b078,_0x44324d){super(_0x31b078),this['set']('isEnabled',!0x0);const _0x56b019=_0x44324d['map'](_0x41b8d0=>{const _0x70dd0e=new Ht(this['locale']),_0x36edc2=new AIChatShortcutView(this['locale'],_0x41b8d0);return _0x36edc2['bind']('isEnabled')['to'](this),_0x70dd0e['children']['add'](_0x36edc2),_0x36edc2['delegate']('execute')['to'](this),_0x70dd0e;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x56b019),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Gn='chat-shortcuts';class AIChatShortcuts extends _0x21ae07{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x365385=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x27553c=_0x365385['activeConversation'];_0x27553c['isFromHistory']||this['_injectShortcuts'](_0x27553c);}),this['listenTo'](_0x365385,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x43b468=['chat','review','translate'];this['_shortcuts']['forEach'](_0x1a09c8=>{let _0x182e97=!0x0;if(_0x1a09c8['id']&&_0x1a09c8['label']&&_0x43b468['includes'](_0x1a09c8['type'])?'chat'===_0x1a09c8['type']&&(_0x182e97='string'==typeof _0x1a09c8['prompt']):_0x182e97=!0x1,!_0x182e97)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x1a09c8});});}['_injectShortcuts'](_0x4c7fa7){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Gn),this['_shortcutsView']['on']('execute',_0x451e69=>{const _0x2f24a1=_0x451e69['source']['id'];this['_executeShortcut'](_0x2f24a1);}),this['_listenedConversation']=_0x4c7fa7,this['listenTo'](_0x4c7fa7,'uploadProgressChanged',(_0x3c6374,_0x29fd85)=>{this['_shortcutsView']['isEnabled']=!_0x29fd85['isUploadInProgress'];});}['_removeShortcuts'](){const _0x380e04=this['context']['plugins']['get'](AIChatUI);_0x380e04['hasFeedItem'](Gn)&&_0x380e04['removeFeedItem'](Gn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x5375eb){const _0x4cb7bd=this['_shortcuts']['find'](_0x2e36e3=>_0x2e36e3['id']===_0x5375eb),_0xc28d7f=_0x4cb7bd['type'];'chat'===_0xc28d7f?this['_runChatShortcut'](_0x4cb7bd):'review'===_0xc28d7f?_0x4cb7bd['commandId']?this['_runReviewShortcut'](_0x4cb7bd):this['_switchTab']('reviewMode'):'translate'===_0xc28d7f&&(_0x4cb7bd['language']?this['_runTranslateShortcut'](_0x4cb7bd):this['_switchTab']('translate'));}['_switchTab'](_0x3bcb09){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x3bcb09});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x3bcb09);}async['_runChatShortcut']({prompt:_0x3ec1c7,draftMode:_0xad44ec,useWebSearch:_0x34fa5e=!0x1,useReasoning:_0x2e6722=!0x1,model:_0x5b5f40}){const _0x3aacfb=this['context']['plugins']['get']('AIChatController'),_0x355a31=_0x3aacfb['activeConversation'];let _0x5c8a55;_0x5c8a55=_0x5b5f40?await _0x355a31['chatModels']['getModel'](_0x5b5f40):await _0x355a31['chatModels']['getDefault'](),_0x5c8a55&&await _0x355a31['setModel'](_0x5c8a55),_0x355a31['setWebSearch'](_0x34fa5e),_0x355a31['setReasoning'](_0x2e6722),_0x3aacfb['addCurrentDocumentToChatContext'](),_0xad44ec?(this['_aiChatUI']['setPromptInputValue'](_0x3ec1c7),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x3aacfb['sendMessage']({'message':_0x3ec1c7});}['_runReviewShortcut']({commandId:_0x105b93,model:_0x12bc62,prompt:_0x334a99,params:_0x3b5ef0}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x40828={'id':_0x105b93,'isCustom':'custom'===_0x105b93};_0x12bc62&&_0x334a99&&(_0x40828['args']={'model':_0x12bc62,'prompt':_0x334a99}),_0x3b5ef0&&(_0x40828['params']=_0x3b5ef0),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x40828);}['_runTranslateShortcut']({language:_0x4c3330}){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':_0x4c3330,'args':{'language':_0x4c3330}});}}class ToggleAICommand extends _0x513222{constructor(_0x5ad5a2){super(_0x5ad5a2);const _0x1e7b73=_0x5ad5a2['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1e7b73,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0xf7374a=this['editor']['plugins']['get']('AITabs')['view'];_0xf7374a['isVisible']=!_0xf7374a['isVisible'];}}class AIToggleButtonUI extends _0x1fd9d0{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x12c863=this['editor'];_0x12c863['commands']['add']('toggleAi',new ToggleAICommand(_0x12c863)),_0x12c863['ui']['componentFactory']['add']('toggleAi',()=>{const _0x56c71c=this['_createAIUIButton'](yt);return _0x56c71c['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x56c71c;}),_0x12c863['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x2b9f75=this['_createAIUIButton'](Yt);return _0x2b9f75['set']({'role':'menuitemcheckbox'}),_0x2b9f75;});}['_createAIUIButton'](_0x1c613d){const _0x2693e5=this['editor'],_0x47cbb3=_0x2693e5['commands']['get']('toggleAi'),_0x35ca53=new _0x1c613d(_0x2693e5['locale']);return _0x35ca53['set']({'label':Mi(_0x2693e5['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0xb22cd6,'isToggleable':!0x0}),_0x35ca53['bind']('isEnabled')['to'](_0x47cbb3),_0x35ca53['bind']('isOn')['to'](_0x47cbb3,'value',_0x244714=>!!_0x244714),this['listenTo'](_0x35ca53,'execute',()=>{_0x47cbb3['execute']();}),_0x35ca53;}}const Fn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x30070e){super(_0x30070e),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x144a23){this['showError'](_0x144a23);}['showError'](_0x577652){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x577652,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x4adb59=new Nt(this['locale']),_0x16bea5=new Nt(this['locale']);return _0x16bea5['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x4adb59['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x1b1609=>!_0x1b1609)]},'children':[_0x16bea5]}),_0x4adb59;}}const Wn=0xa;class AIBalloon extends _0x21ae07{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0xc7ffd3){const {id:_0x4c3e2b}=this['_currentConfig']??{};this['_currentConfig']=_0xc7ffd3,this['_editor']=_0xc7ffd3['targetEditor'];const {id:_0x443c18}=this['_currentConfig'];this['isOpen']&&_0x4c3e2b===_0x443c18?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x55e112=this['_editor'];if(!_0x55e112)return;const _0x4064d1=_0x55e112['plugins']['get']('Dialog');_0x4064d1['isOpen']&&this['_currentConfig']&&_0x4064d1['id']===this['_currentConfig']['id']&&_0x4064d1['hide']();}['_updateDialog'](){const _0x47c4f2=this['_editor']['plugins']['get']('Dialog'),{icon:_0x42c1c2,title:_0x221158}=this['_currentConfig'];_0x47c4f2['view']?.['headerView']&&(_0x47c4f2['view']['headerView']['label']=_0x221158,_0x47c4f2['view']['headerView']['iconView']&&_0x42c1c2&&(_0x47c4f2['view']['headerView']['iconView']['content']=_0x42c1c2)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x47c4f2['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x4f5d91=this['_editor']['plugins']['get']('Dialog'),{id:_0x113c65,title:_0x48939e,icon:_0x6563ee,class:_0x489936,mainView:_0x1bec4c}=this['_currentConfig'];_0x1bec4c['delegate'](...Fn)['to'](this),_0x4f5d91['show']({'title':_0x48939e,'icon':_0x6563ee,'hasCloseButton':!0x0,'id':_0x113c65,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x489936||''),'content':_0x1bec4c,'onShow':_0x490b33=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x490b33['view']?.['updatePosition']();const _0x43ffba=this['_getSelectionElements']();_0x43ffba&&_0x43ffba[0x0]&&Tt({'target':_0x43ffba[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x490b33['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x113c65});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x113c65}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x335c05,_0x368d23){if(!_0x368d23){const _0x458aad=this['_getTargetRootDomRect']();if(!_0x458aad)return null;_0x368d23=_0x458aad;}const _0x25b04a=this['_getSelectionElements']();if(!_0x25b04a||0x0===_0x25b04a['length'])return{'left':Math['round'](_0x368d23['left']+_0x368d23['width']/0x2-_0x335c05['width']/0x2),'top':Math['round'](_0x368d23['top']+_0x368d23['height']/0x2-_0x335c05['height']/0x2)};const _0x51beba=Math['round'](_0x368d23['left']+_0x368d23['width']/0x2-_0x335c05['width']/0x2),_0x235342=_0x25b04a['map'](_0x480f34=>new dt(_0x480f34)),_0x3b8485=_0x335c05['height'];return{'left':_0x51beba,'top':this['_calculateOptimalTopPosition'](_0x235342,_0x3b8485,_0x368d23)};}['_calculateOptimalTopPosition'](_0x3cb17c,_0x380d9e,_0x1a950f){const _0x20a9de=new dt(lt['window']),_0x53059c=_0x3cb17c['map'](_0xdaf914=>_0xdaf914['getVisible']())['filter'](_0x56d0db=>_0x56d0db),_0x45c01e=dt['getBoundingRect'](_0x53059c);if(!_0x45c01e)return Math['round'](_0x1a950f['top']+_0x1a950f['height']/0x2);const _0xb97686=_0x20a9de['getIntersection'](_0x45c01e);if(!_0xb97686)return Math['round'](_0x1a950f['top']+_0x1a950f['height']/0x2);const _0x1668a2=_0x1a950f['getVisible'](),_0x2b57f6=_0x1668a2&&_0x45c01e['height']>_0x1668a2['height'],_0xe86f09=_0xb97686['top'],_0x5e835e=_0xb97686['bottom'];if(_0x2b57f6){const _0xa574b3=(_0x1668a2||_0x20a9de)['height']/0x2-_0x380d9e/0x2,_0x86ce84=_0xe86f09-Wn-_0x1a950f['top'],_0x57c97a=_0x1a950f['bottom']-_0x5e835e-Wn;return _0x86ce84>=_0x380d9e?Math['max'](Wn,_0xe86f09-_0x380d9e-Wn):_0x57c97a>=_0x380d9e?_0x5e835e+Wn:Math['max'](Wn,_0xa574b3);}const _0x16eb91=_0xe86f09-_0x380d9e,_0x4dfedd=_0x1a950f['bottom']-_0x5e835e-Wn,_0x18cece=_0xe86f09-Wn-_0x1a950f['top'];let _0x4c22e4;if(_0x4dfedd>=_0x380d9e)_0x4c22e4=_0x5e835e+Wn;else{if(_0x18cece>=_0x380d9e)_0x4c22e4=_0x16eb91-Wn;else _0x4c22e4=_0xe86f09+_0x45c01e['height']/0x2-_0x380d9e/0x2;}return _0x4c22e4;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x46236c=this['_editor'];this['listenTo'](_0x46236c['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x1ff84e,data:{newRange:_0x29b224}}of _0x46236c['model']['document']['differ']['getChangedMarkers']())if(_0x1ff84e['startsWith'](Rs+':')&&(_0x29b224&&(_0x29b224['start']['isEqual'](_0x29b224['end'])||'$graveyard'==_0x29b224['root']['rootName'])||null==_0x29b224)){const _0x12b0eb=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x12b0eb),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x4953c1=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x4953c1['model']['document']);}['_getSelectionElements'](){const _0x6cb092=this['_editor'];return _0x2dfed1(_0x6cb092['editing'],[..._0x6cb092['model']['markers']['getMarkersGroup']('ai-selection'),..._0x6cb092['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x283fc3=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x283fc3)return null;const _0x12a8ff=this['_editor'],_0x5a38a9=_0x12a8ff['editing']['view']['document']['getRoot'](_0x283fc3['rootName']);if(!_0x5a38a9)return null;const _0x5baef7=_0x12a8ff['editing']['view']['domConverter']['mapViewToDom'](_0x5a38a9);return _0x5baef7&&_0x5baef7 instanceof HTMLElement?new dt(_0x5baef7):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x10f8ba,_0x38d0ec={}){super(_0x10f8ba),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x38d0ec};const _0x33a51b=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x33a51b?'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'](_0x25ee59){this['showChangesButton']['isEnabled']=_0x25ee59;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x237f67,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0x31a52f,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x5722d5,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x55fd44=new Lt();_0x55fd44['set']({'content':_0x22df45}),_0x55fd44['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'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x55fd44);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x52b20e,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x5316ea=>_0x5316ea?_0x44a600:_0x52b20e),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x3a798e,_0x792028){super(_0x3a798e);const _0x54457c=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x792028,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x3a798e),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x3a798e,_0x792028['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x792028),this['_stateView']=new AISuggestionContentPartStateView(_0x3a798e),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x3a798e,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x3a798e,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x4dcc4f,_0x2ded15,_0x3f7143,_0x2fc740)=>{let _0x21593b,_0x2991c1;'pending'===_0x2fc740?(_0x21593b=this['_partToolbarView'],_0x2991c1=this['_stateView']):(_0x21593b=this['_stateView'],_0x2991c1=this['_partToolbarView']),this['_stateView']['setState'](_0x3f7143),_0x21593b['isVisible']=!0x1,_0x2991c1['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x54457c['to']('_state',_0x35bcdf=>'ck-ai-chat-balloon-main_state_'+_0x35bcdf)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x792028);});}['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'](_0x395b6c){_0x395b6c?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x395b6c);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x16cf3f){this['_state']=_0x16cf3f;}['showError'](_0x4d6781){super['showError'](_0x4d6781),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x215532){super['showBlockingError'](_0x215532),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x14f1d7){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x14f1d7;}['togglePartToolbarEnabled'](_0x2f3714){this['_partToolbarView']['isEnabled']=_0x2f3714;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x1b0a12,showSuggestButton:_0x48d100}){_0x1b0a12=_0x1b0a12&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x48d100=_0x48d100&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x1b0a12,'showSuggestButton':_0x48d100});}['_createNextButtonView'](){const _0x487577=new yt(this['locale']);return _0x487577['set']({'icon':_0x43b72f,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x487577['on']('execute',()=>{this['fire']('showNext');}),_0x487577;}['_createPreviousButtonView'](){const _0x36067a=new yt(this['locale']);return _0x36067a['set']({'icon':_0x100f97,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x36067a['on']('execute',()=>{this['fire']('showPrevious');}),_0x36067a;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x5be5b6,_0x7d15ac){super(_0x5be5b6),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x7d15ac});}}class AIChatBalloon extends _0x1fd9d0{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x2f3357){super(_0x2f3357),this['set']('showDiff',!0x1);}['open'](_0x59d3ac){const _0x3a6c4e=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x3a6c4e['plugins']['get']('AIBalloon')['open']({..._0x59d3ac,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x59d3ac['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x59d3ac['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x3c8c18){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x3c8c18);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x228635){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x228635);}['_createChatBalloonView'](){const _0x2807f6=this['editor'],_0x597316=_0x2807f6['plugins']['get']('AIBalloon'),_0x43e98f=_0x2807f6['commands']['get']('trackChanges');let _0xcc55b1=_0x2807f6['config']['get']('ai.availableReplyActions')||[...Ds];_0x2807f6['plugins']['has']('TrackChanges')||(_0xcc55b1=_0xcc55b1['filter'](_0x26c614=>'insertSuggestion'!=_0x26c614));const _0x511d02=new AIChatBalloonView(_0x2807f6['locale'],{'availableActions':_0xcc55b1,'showApplyButton':!0x0,'showSuggestButton':!!_0x43e98f});return _0x511d02['bind']('showDiff')['to'](this),_0x511d02['delegate'](...Ss)['to'](this),_0x511d02['delegate']('showPrevious','showNext')['to'](this),_0x597316['delegate']('dialogClosed')['to'](this),_0x511d02['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x511d02['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x511d02['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x43e98f&&_0x511d02['bind']('isTrackChangesOn')['to'](_0x43e98f,'value'),_0x511d02['render'](),_0x511d02;}['_toggleRotatorButtonsInDialogHeader'](_0x517968){const _0x5d5690=this['editor'],_0x511498=_0x5d5690['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x517968),_0x511498['has'](this['_chatBalloonView']['previousButtonView'])||(_0x511498['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x5d5690['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x511498['remove'](this['_chatBalloonView']['previousButtonView']),_0x511498['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x1fd9d0{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x166574];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Kn(_0x47a5f5){const {editor:_0x242c0f,action:_0x8c9cb,withText:_0x558851=!0x1,withIcon:_0x28e51e=!0x0,isInDropdown:_0x1dea5c=!0x0,shouldPreventFocus:_0x14bf58=!0x1,actionButtons:_0x1d8a7e}=_0x47a5f5;return()=>{const _0xdbb8e7=_0x242c0f['locale'],_0x1c3597=new yt(_0xdbb8e7),_0x53594b=_0x1c3597['bindTemplate'];_0x1dea5c&&_0x1c3597['extendTemplate']({'on':{'mouseenter':_0x53594b['to'](()=>{_0x14bf58&&_0x14bf58()||_0x1c3597['focus']();})}}),_0x1d8a7e['push']({'buttonView':_0x1c3597,'action':_0x8c9cb});const _0x117d02=_0x8c9cb['icon']??_0x8c9cb['parent']?.['icon'];return _0x1c3597['set']({'label':_0x8c9cb['label'],'withText':_0x558851,'role':'menuitem','icon':_0x28e51e?_0x117d02??_0x31731d:void 0x0,'tooltip':!_0x558851,'class':'ck-ai-quick-actions-button','isEnabled':_0x8c9cb['isEnabled']}),_0x1c3597['on']('execute',()=>{_0x242c0f['editing']['view']['focus'](),_0x242c0f['commands']['execute']('aiQuickAction',_0x8c9cb);}),_0x1c3597;};}class DropdownMenuButtonWithHighlightView extends _0x489e61{['arrowView'];constructor(_0x18320c,_0x509600){super(_0x18320c,_0x509600);const _0x57857a=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',_0x432ae2=>String(_0x432ae2)),'data-cke-tooltip-disabled':_0x57857a['to']('isOn')},'on':{'mouseenter':_0x57857a['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x5923e5=new Lt();return _0x5923e5['content']=_0x5215ec,_0x5923e5['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x5923e5;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x5ea26f,_0x2a139c,_0x564b14){super(_0x5ea26f),this['_allListItems']=_0x2a139c,this['_allSearchableItems']=_0x564b14;}['filter'](_0x2c5747){if(!_0x2c5747)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x15b8b3=_0x2c5747['source']['toLowerCase']()['trim'](),_0x581a8c=this['_allSearchableItems']['filter'](_0x242880=>(_0x242880['groupLabel']?_0x242880['label']+'\x20('+_0x242880['groupLabel']+')':_0x242880['label'])['toLowerCase']()['includes'](_0x15b8b3));return this['items']['clear'](),this['items']['addMany'](_0x581a8c['sort']((_0x15ec91,_0xdd7ed5)=>{const _0x5b2360=_0x15ec91['groupLabel'],_0x5879a3=_0xdd7ed5['groupLabel'];return _0x5b2360||_0x5879a3?_0x5b2360?0x1:-0x1:0x0;})['map'](_0x4b6748=>_0x4b6748['item'])),this['_highlightQuery'](_0x15b8b3,_0x581a8c),{'resultsCount':_0x581a8c['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x2c897a,_0x5d7af1){if(!_0x2c897a)return;const _0x38d749=new RegExp(_0x3f0ae7(_0x2c897a),'gi');_0x5d7af1['forEach'](_0x3d525c=>{_0x3d525c['highlightViews']&&_0x3d525c['highlightViews']['forEach'](_0x355ac1=>{'function'==typeof _0x355ac1['highlightText']&&_0x355ac1['highlightText'](_0x38d749);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x37f2b0=>{_0x37f2b0['highlightViews']&&_0x37f2b0['highlightViews']['forEach'](_0x383193=>{'function'==typeof _0x383193['highlightText']&&_0x383193['highlightText'](null);});});}}const Yn='menu',$n='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x167611,_0x37d542,_0x1ca201,_0x11f60c,_0x51536b=!0x1,_0x202a5b=[]){const _0x554224=_0x167611['locale'];super(_0x554224),this['_bodyCollection']=_0x11f60c,this['_hasSearch']=_0x51536b,this['_actionButtons']=_0x202a5b;const _0x1c3fcd=this['_createListItems'](_0x167611,_0x37d542,_0x1ca201);this['optionsListView']=new AIQuickActionsFilteredListView(_0x554224,_0x1c3fcd,this['_allSearchableItems']),this['optionsListView']['role']=Yn,this['optionsListView']['items']['addMany'](_0x1c3fcd),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x51536b&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x1c3fcd,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x51536b&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x562e2e=_0x51536b&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x246137(_0x562e2e),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x554224['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x22189f(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x246dfe=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x246dfe);}['_createListItems'](_0x4fc559,_0x1a35f7,_0x5530b5){const _0x4a8428=new _0x246137();return _0x1a35f7['forEach'](_0x510bee=>{if('actions'in _0x510bee){const {listItem:_0x17b54b}=this['_createActionGroupButton'](_0x4fc559,_0x510bee,_0x5530b5);_0x4a8428['add'](_0x17b54b),_0x510bee['actions']['forEach'](_0x25c58c=>{const {listItem:_0x5a9243,highlightViews:_0x217517}=this['_createSearchResultActionButton'](_0x4fc559,_0x25c58c,_0x510bee['label'],_0x510bee['icon']);this['_allSearchableItems']['push']({'item':_0x5a9243,'label':_0x25c58c['label'],'groupLabel':_0x510bee['label'],'highlightViews':_0x217517});});}else{const {listItem:_0x3506be}=this['_createActionButton'](_0x4fc559,_0x510bee);_0x4a8428['add'](_0x3506be);const _0x2b2be8=_0x3506be['children']['first'];if(_0x2b2be8){const {listItem:_0x1e745e,highlightViews:_0x152e3c}=this['_createSearchResultActionButton'](_0x4fc559,_0x510bee);this['_allSearchableItems']['push']({'item':_0x1e745e,'label':_0x2b2be8['label']||'','highlightViews':_0x152e3c});}}}),_0x4a8428;}['_createActionButton'](_0x18fdd3,_0x447c37,_0x5c77c3,_0x564673){const _0x2d0084=new Ht(this['locale']);if(_0x5c77c3&&_0x564673){const _0xfa0956=new yt(this['locale']),_0x6f5a7c=_0xfa0956['bindTemplate'],_0x2453ee=new _0x3bdb10();_0x2453ee['text']=_0x447c37['label'];const _0x9e044c=new _0x3bdb10();_0x9e044c['text']=_0x5c77c3;const _0x5397a0=new Lt();_0x5397a0['content']=_0x564673,_0x5397a0['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4466a5=new Nt(this['locale']);_0x4466a5['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x53112e=new Nt(this['locale']);return _0x53112e['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0xfa0956['set']({'label':_0x447c37['label']+'\x20('+_0x5c77c3+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x447c37['isEnabled']}),_0xfa0956['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x6f5a7c['if']('isEnabled','ck-disabled',_0x198901=>!_0x198901)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2453ee,_0x4466a5,_0x5397a0,_0x9e044c,_0x53112e],'on':{'mouseenter':_0x6f5a7c['to'](()=>{this['_isSearchFocused']()||_0xfa0956['focus']();}),'click':_0x6f5a7c['to'](()=>{_0xfa0956['fire']('execute');})}}),_0xfa0956['on']('execute',()=>{_0xfa0956['isEnabled']&&(_0x18fdd3['editing']['view']['focus'](),_0x18fdd3['commands']['execute']('aiQuickAction',_0x447c37));}),_0x2d0084['children']['add'](_0xfa0956),this['_actionButtons']['push']({'buttonView':_0xfa0956,'action':_0x447c37}),{'listItem':_0x2d0084,'highlightViews':[_0x2453ee,_0x9e044c]};}{const _0x405527=new _0xa37838(),_0x10a991=new yt(this['locale'],_0x405527),_0x32b56f=_0x10a991['bindTemplate'],_0x48c96c=_0x447c37['icon']??_0x447c37['parent']?.['icon'],_0x11dcad=void 0x0!==_0x447c37['icon'];return _0x10a991['set']({'label':_0x447c37['label'],'withText':!0x0,'role':'menuitem','icon':_0x11dcad?_0x48c96c??_0x31731d:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x447c37['isEnabled']}),_0x10a991['extendTemplate']({'on':{'mouseenter':_0x32b56f['to'](()=>{this['_isSearchFocused']()||_0x10a991['focus']();})}}),_0x10a991['on']('execute',()=>{_0x18fdd3['editing']['view']['focus'](),_0x18fdd3['commands']['execute']('aiQuickAction',_0x447c37);}),_0x2d0084['children']['add'](_0x10a991),this['_actionButtons']['push']({'buttonView':_0x10a991,'action':_0x447c37}),{'listItem':_0x2d0084,'highlightViews':[_0x405527]};}}['_createSearchResultActionButton'](_0x3262b7,_0x542764,_0x2dc6aa,_0x3a7460){return _0x2dc6aa&&_0x3a7460?this['_createSearchResultGroupedActionButton'](_0x3262b7,_0x542764,_0x2dc6aa,_0x3a7460):this['_createSearchResultIndividualActionButton'](_0x3262b7,_0x542764);}['_createSearchResultGroupedActionButton'](_0xc894aa,_0x5d4f83,_0x5ba2e5,_0x551325){const _0x5cfd11=new Ht(this['locale']),_0x480831=new yt(this['locale']),_0xcc2303=_0x480831['bindTemplate'],{view:_0x261a80,highlightView:_0xdaba0}=this['_createSearchResultGroupRow'](_0x5ba2e5,_0x551325),{view:_0x52e281,highlightView:_0x170224}=this['_createSearchResultActionRow'](_0x5d4f83['label']),_0x3de698=this['_createSearchResultContentView'](_0x261a80,_0x52e281);return _0x480831['set']({'label':_0x5d4f83['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':_0x5d4f83['isEnabled']}),_0x480831['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',_0xcc2303['if']('isEnabled','ck-disabled',_0x607bca=>!_0x607bca)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x3de698],'on':{'mouseenter':_0xcc2303['to'](()=>{this['_isSearchFocused']()||_0x480831['focus']();}),'click':_0xcc2303['to'](()=>{this['_handleSearchResultButtonClick'](_0x480831);})}}),this['_setupActionButtonExecution'](_0x480831,_0xc894aa,_0x5d4f83),_0x5cfd11['children']['add'](_0x480831),this['_actionButtons']['push']({'buttonView':_0x480831,'action':_0x5d4f83}),{'listItem':_0x5cfd11,'highlightViews':[_0xdaba0,_0x170224]};}['_createSearchResultIndividualActionButton'](_0x1941ef,_0x3c510e){const _0x5179e7=new Ht(this['locale']),_0x1dddbd=new _0xa37838(),_0x36923f=new yt(this['locale'],_0x1dddbd),_0x14614e=_0x36923f['bindTemplate'];return _0x36923f['set']({'label':_0x3c510e['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x3c510e['isEnabled']}),_0x36923f['extendTemplate']({'on':{'mouseenter':_0x14614e['to'](()=>{this['_isSearchFocused']()||_0x36923f['focus']();})}}),this['_setupActionButtonExecution'](_0x36923f,_0x1941ef,_0x3c510e),_0x5179e7['children']['add'](_0x36923f),this['_actionButtons']['push']({'buttonView':_0x36923f,'action':_0x3c510e}),{'listItem':_0x5179e7,'highlightViews':[_0x1dddbd]};}['_createSearchResultGroupRow'](_0x58f75a,_0x5fcb99){const _0x50dd86=new Nt(this['locale']),_0x6766bc=new Lt();_0x6766bc['content']=_0x5fcb99,_0x6766bc['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x312973=new _0x3bdb10();return _0x312973['text']=_0x58f75a,_0x50dd86['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x6766bc,_0x312973]}),{'view':_0x50dd86,'highlightView':_0x312973};}['_createSearchResultActionRow'](_0x1a441f){const _0x5c75fb=new Nt(this['locale']),_0xc5a240=new _0x3bdb10();return _0xc5a240['text']=_0x1a441f,_0x5c75fb['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0xc5a240]}),{'view':_0x5c75fb,'highlightView':_0xc5a240};}['_createSearchResultContentView'](_0x14cbac,_0x4909a0){const _0x582e32=new Nt(this['locale']);return _0x582e32['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x14cbac,_0x4909a0]}),_0x582e32;}['_setupActionButtonExecution'](_0x363fcb,_0x442aec,_0x2d8035){_0x363fcb['on']('execute',()=>{_0x363fcb['isEnabled']&&(_0x442aec['editing']['view']['focus'](),_0x442aec['commands']['execute']('aiQuickAction',_0x2d8035));});}['_createActionGroupButton'](_0x29f7d5,_0x4bd7d7,_0x3a157d){const _0x3b58a8=new Ht(this['locale']),_0x5446a8=new _0xa37838(),_0x173f00=new DropdownMenuButtonWithHighlightView(this['locale'],_0x5446a8),_0x1fd2aa=_0x173f00['bindTemplate'],_0x251dbe=this['_getPanelKeystroke'](_0x3a157d),_0x28d49d=this['_createGroupActionsList'](_0x29f7d5,_0x4bd7d7['actions'],_0x3a157d);_0x173f00['set']({'label':_0x4bd7d7['label'],'withText':!0x0,'role':$n,'icon':_0x4bd7d7['icon']??_0x31731d,'isEnabled':_0x4bd7d7['actions']['some'](_0x3fe3fa=>_0x3fe3fa['isEnabled'])}),_0x173f00['extendTemplate']({'on':{'mouseenter':_0x1fd2aa['to'](()=>{this['_isSearchFocused']()||_0x173f00['focus']();})}});const _0x5159da=new zt(this['locale']);return _0x5159da['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x1fd2aa['to'](_0x425873=>{this['_handlePanelKeydown'](_0x425873,_0x251dbe,_0x173f00,_0x5159da);})}}),_0x173f00['bind']('isOn')['to'](_0x5159da,'isVisible'),this['_bodyCollection']['add'](_0x5159da),_0x5159da['content']['add'](_0x28d49d),this['_setupGroupMenuBehavior'](_0x173f00,_0x5159da),_0x3b58a8['children']['add'](_0x173f00),this['_actionButtons']['push']({'buttonView':_0x173f00,'action':_0x4bd7d7}),{'listItem':_0x3b58a8,'highlightView':_0x5446a8};}['_createGroupActionsList'](_0x1c7a22,_0x1c553b,_0x287bf6){const _0x35a422=new Dt(this['locale']);return _0x35a422['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x1c553b['forEach'](_0x25fb0b=>{const _0x132dfc=new Ht(this['locale']),_0x4261ac=Kn({'editor':_0x1c7a22,'action':_0x25fb0b,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x132dfc['children']['add'](_0x4261ac),_0x287bf6['focusTracker']['add'](_0x4261ac),_0x35a422['items']['add'](_0x132dfc);}),_0x35a422;}['_setupGroupMenuBehavior'](_0x5508f3,_0x5ab81e){const _0x43034e=_0x5508f3['bindTemplate'],_0x425ae2=this['_getButtonKeystroke'](_0x5508f3);_0x5508f3['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x43034e['to'](()=>{this['_showNestedPanel'](_0x5ab81e,_0x5508f3);}),'mouseleave':_0x43034e['to'](_0x414022=>{const _0x551fd7=_0x414022['relatedTarget'];this['_isMovingToNestedMenu'](_0x551fd7,_0x5ab81e)||this['_hideNestedPanel'](_0x5ab81e);}),'keydown':_0x43034e['to'](_0x31e6b3=>{_0x31e6b3['key']==_0x425ae2&&(this['_showNestedPanel'](_0x5ab81e,_0x5508f3),_0x5ab81e['content']['get'](0x0)['focus']());})}}),_0x5ab81e['on']('render',()=>{_0x5ab81e['element']?.['addEventListener']('mouseleave',_0xfec51d=>{const _0x5cdbef=_0xfec51d['relatedTarget'];_0x5508f3['element']?.['contains'](_0x5cdbef)||this['_isMovingToNestedMenu'](_0x5cdbef,_0x5ab81e)||this['_hideNestedPanel'](_0x5ab81e);});});}['_showNestedPanel'](_0x8307de,_0x46f7e0){this['_openNestedPanels']['forEach'](_0x17a431=>{_0x17a431!==_0x8307de&&_0x17a431['isVisible']&&_0x17a431['hide']();}),_0x8307de['show'](),_0x8307de['pin']({'positions':[_0x505fe2['eastSouth']],'target':_0x46f7e0['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x8307de);}['_hideNestedPanel'](_0x1580aa){_0x1580aa['hide'](),this['_openNestedPanels']['delete'](_0x1580aa);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0xf4ca67=>_0xf4ca67['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x465398,_0x78173f){if(!_0x465398)return!0x1;if(_0x78173f['element']?.['contains'](_0x465398))return!0x0;const _0x5a085e=_0x465398;return _0x5a085e['closest']&&(null!==_0x5a085e['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x5a085e['closest']('.ck-ai-quick-actions-group-list')||null!==_0x5a085e['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'](_0x9a1b7){return'rtl'===_0x9a1b7['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x4bd092){return'rtl'===_0x4bd092['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x1c4ab0,_0x4bb97a,_0x48289a,_0x34626f){_0x1c4ab0['key']==_0x4bb97a&&(_0x48289a['focus'](),this['_hideNestedPanel'](_0x34626f));}['_handleSearchResultButtonClick'](_0x242f66){_0x242f66['fire']('execute');}}function qn(_0x2e37eb){const {editor:_0x152bf6,content:_0x39d7df,buttonDefinition:_0x5084ec,bodyCollection:_0xf346c0,hasSearch:_0x183627=!0x1,actionButtons:_0x740e}=_0x2e37eb;return()=>{const _0x3f6a68=_0x152bf6['locale'],_0x3f42f0=_0x152bf6['commands']['get']('aiQuickAction'),_0x399733=Ft(_0x3f6a68);_0x399733['bind']('isEnabled')['to'](_0x3f42f0),_0x399733['buttonView']['set']({'icon':_0x5084ec['icon']??_0x31731d,'label':_0x5084ec['label'],'tooltip':!0x0}),_0x399733['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x1fea05=new AIQuickActionsDropdownContentView(_0x152bf6,_0x39d7df,_0x399733,_0xf346c0,_0x183627,_0x740e);return _0x399733['panelView']['children']['add'](_0x1fea05),_0x183627&&_0x399733['on']('change:isOpen',(_0x117a1b,_0x170985,_0x455df4)=>{if(_0x455df4){if(_0x152bf6['plugins']['has']('AIEditing')){const _0x5e9249=_0x152bf6['plugins']['get'](AIEditing),_0x1465e7=_0x152bf6['model']['document']['selection'],_0x25d0c4=Array['from'](_0x1465e7['getRanges']());_0x25d0c4['length']>0x0&&_0x5e9249['showFakeVisualSelection']({'editor':_0x152bf6,'ranges':_0x25d0c4,'id':'quick-action','priority':0x14});}}else _0x152bf6['plugins']['has']('AIEditing')&&_0x152bf6['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x1fea05['resetSearch']();}),_0x399733;};}const Qn='<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>',Xn='<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>',zn='<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>',jn=/* #__PURE__ -- @preserve */
28
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x1fd9d0{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x41d537,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x5208d0=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x5208d0),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0xc5a3b){return function(_0x3b7da5){const _0x113589=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3b7da5['uiLanguage']),_0x2718be=_0x113589||'English',_0x527355=[{'id':'ask-ai','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x453f5b},{'id':'chat-commands','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x453f5b,'actions':[{'id':'explain','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Qn['replace']('%0',_0x2718be),'type':'chat'},{'id':'summarize','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Xn['replace']('%0',_0x2718be),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':zn['replace']('%0',_0x2718be),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x555af1},{'id':'continue','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x5ea3f4},{'id':'fix-grammar','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x19ad65},{'id':'adjust-length','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x116a19,'actions':[{'id':'make-shorter','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x58845b,'actions':[{'id':'make-tone-casual','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x8eaaa1,'actions':[{'id':'translate-to-english','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x3b7da5,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x527355;}(_0xc5a3b);}['_getDefaultAndCustomActions'](){const _0x53930a=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x2e0b47=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x8bbce4=>({..._0x8bbce4,'type':'chat'===_0x8bbce4['type']?'chat':'action','icon':void 0x0}));return _0x53930a['find'](_0x2b393a=>'other'===_0x2b393a['id'])['actions']['push'](..._0x2e0b47),_0x53930a;}async['_initActionTypeQuickActions'](){try{const _0x130f3e=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x174232=await _0x130f3e['getAll'](),_0x77d58a=(await _0x130f3e['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x77d58a),this['_enableButtonsByType']('action',_0x38cad3=>!!_0x174232['find'](_0x602715=>_0x602715['id']===_0x38cad3['model'])||void 0x0===_0x38cad3['model']);}catch(_0x113ea5){const _0x7675ba=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x113ea5});Ct(_0x7675ba['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x3a17c4=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x3a17c4,'change:isConversationReady',(_0x4f09f9,_0x400678,_0x4cce39)=>{_0x4cce39&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x3a17c4['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x1aa730,_0x52feab){this['_quickActionsDefinition']['forEach'](_0x2269ed=>{'actions'in _0x2269ed?_0x2269ed['actions']['forEach'](_0x3febf7=>{_0x3febf7['type']===_0x1aa730&&(_0x3febf7['isEnabled']=_0x52feab(_0x3febf7));}):_0x2269ed['type']===_0x1aa730&&(_0x2269ed['isEnabled']=_0x52feab(_0x2269ed));}),this['_actionButtons']['forEach'](_0x1a9f3d=>{if(Jn(_0x1a9f3d['action']))return;if(_0x1a9f3d['action']['type']!==_0x1aa730)return;const _0x4bf9d7=_0x52feab(_0x1a9f3d['action']);if(_0x1a9f3d['action']['isEnabled']=_0x4bf9d7,_0x1a9f3d['buttonView']['isEnabled']=_0x4bf9d7,!_0x4bf9d7&&_0x1a9f3d['action']['model']){const _0x381b6e=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x1a9f3d['action']['id'],'modelId':_0x1a9f3d['action']['model']});Ct(_0x381b6e['message']);}}),this['_actionButtons']['filter'](_0x4fcfa4=>Jn(_0x4fcfa4['action']))['forEach'](_0x505966=>{_0x505966['buttonView']['isEnabled']=_0x505966['action']['actions']['some'](_0x3b063c=>_0x3b063c['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x20817f,group:_0x3fec21})=>{_0x20817f['isEnabled']=_0x3fec21['actions']['some'](_0x3a3ae9=>_0x3a3ae9['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x2f849e){this['_actionButtons']['forEach'](_0x523cf5=>{Jn(_0x523cf5['action'])||'action'===_0x523cf5['action']['type']&&(_0x523cf5['action']['model']||(_0x523cf5['action']['model']=_0x2f849e));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x1641d7=new Xt(this['editor']['locale']);_0x1641d7['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x1641d7),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x1641d7);}['_initializeQuickActionsDropdown'](_0x184e10){const _0xfeef81=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',qn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x31731d,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x184e10,'hasSearch':_0xfeef81,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0xb8c0d2){this['_quickActionsDefinition']=_0xb8c0d2['map'](_0x33e267=>{if('actions'in _0x33e267){const _0x5aad94=_0x33e267;return{..._0x5aad94,'actions':_0x5aad94['actions']['map'](_0x31c898=>{const {actions:_0xfb1506,..._0x15ec2c}=_0x5aad94;return{..._0x31c898,'isEnabled':!0x1,'parent':_0x15ec2c};})['filter'](_0x3ae85d=>this['_shouldIncludeAction'](_0x3ae85d))};}return{..._0x33e267,'isEnabled':!0x1};})['filter'](_0x1f0806=>'actions'in _0x1f0806?_0x1f0806['actions']['length']>0x0:this['_shouldIncludeAction'](_0x1f0806));}['_shouldIncludeAction'](_0x587ec1){const _0x471437=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](jn[_0x587ec1['type']])&&!_0x471437['includes'](_0x587ec1['id'])&&!('chat'===_0x587ec1['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x3bca20){this['_quickActionsDefinition']['forEach'](_0x4802a2=>{if('actions'in _0x4802a2){const _0x4a40ca=qn({'editor':this['editor'],'content':_0x4802a2['actions'],'buttonDefinition':_0x4802a2,'bodyCollection':_0x3bca20,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4802a2['id'],_0x4a40ca),_0x4802a2['actions']['forEach'](_0x5cb4dc=>{const _0x2feffd=Kn({'editor':this['editor'],'action':_0x5cb4dc,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x5cb4dc['id'],_0x2feffd);});}else{const _0x2493d8=Kn({'editor':this['editor'],'action':_0x4802a2,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4802a2['id'],_0x2493d8);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x259f84=>{const _0x3ea69d=this['editor']['commands']['get']('aiQuickAction'),_0x53c2d9=new Kt(_0x259f84),_0x36b985=Mi(_0x259f84,'AI_QUICK_ACTIONS_HEADING');_0x53c2d9['buttonView']['set']({'label':_0x36b985,'icon':_0x31731d});const _0x49b187=new qt(_0x259f84);return _0x49b187['set']({'ariaLabel':_0x36b985,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x2c26d1=>{if('actions'in _0x2c26d1){const _0x409bc4=_0x2c26d1,_0x489ee9=new Qt(_0x259f84,_0x53c2d9),_0x2af9c0=new Kt(_0x259f84),_0x5a8e7=new qt(_0x259f84);_0x2af9c0['buttonView']['set']({'label':_0x409bc4['label'],'icon':_0x409bc4['icon']}),_0x409bc4['actions']['forEach'](_0x317662=>{const _0x513623=new Qt(_0x259f84,_0x2af9c0),_0x619702=new Yt(_0x259f84);_0x619702['set']({'label':_0x317662['label'],'icon':_0x317662['icon'],'role':'menuitem','isEnabled':_0x317662['isEnabled']}),_0x619702['on']('execute',()=>{this['_executeQuickAction'](_0x317662);}),this['_actionButtons']['push']({'buttonView':_0x619702,'action':_0x317662}),_0x619702['delegate']('execute')['to'](_0x2af9c0),_0x513623['children']['add'](_0x619702),_0x5a8e7['items']['add'](_0x513623);}),_0x2af9c0['isEnabled']=_0x409bc4['actions']['some'](_0x3e6ea5=>_0x3e6ea5['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x2af9c0,'group':_0x409bc4}),_0x2af9c0['panelView']['children']['add'](_0x5a8e7),_0x489ee9['children']['add'](_0x2af9c0),_0x49b187['items']['add'](_0x489ee9);}else{const _0x35ef50=_0x2c26d1,_0x40e618=new Qt(_0x259f84,_0x53c2d9),_0x285c71=new Yt(_0x259f84);_0x285c71['set']({'label':_0x35ef50['label'],'icon':_0x35ef50['icon'],'role':'menuitem','isEnabled':_0x35ef50['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x285c71,'action':_0x35ef50}),_0x285c71['on']('execute',()=>{this['_executeQuickAction'](_0x35ef50);}),_0x285c71['delegate']('execute')['to'](_0x53c2d9),_0x40e618['children']['add'](_0x285c71),_0x49b187['items']['add'](_0x40e618);}}),(Object['values'](jn)['some'](_0x453966=>this['editor']['plugins']['has'](_0x453966))?_0x53c2d9['bind']('isEnabled')['to'](_0x3ea69d):_0x53c2d9['set']({'isEnabled':!0x1}),_0x53c2d9['panelView']['children']['add'](_0x49b187),_0x53c2d9);});}['_executeQuickAction'](_0x5ba5c5){const _0x742d5c=this['editor'];_0x742d5c['editing']['view']['focus'](),_0x742d5c['commands']['execute']('aiQuickAction',_0x5ba5c5);const _0x114270=_0x742d5c['ui']['view']['menuBarView'];_0x114270&&_0x114270['close']&&_0x114270['close']();}}function Jn(_0xbcd6eb){return'actions'in _0xbcd6eb;}class AIQuickActionsCommand extends _0x513222{['execute'](_0xd49cbe){switch(this['_expandSelectionIfCollapsed'](),_0xd49cbe['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3a2361=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3a2361});}this['_handleAIChatAction'](_0xd49cbe);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x57846a=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x57846a});}this['_handleAIActionsAction'](_0xd49cbe);}}async['_handleAIChatAction'](_0x42d5a0){const _0x3820df=this['editor']['plugins']['get']('AIChatController'),_0x5ea5a0=this['editor']['plugins']['get']('AITabs')['view'];if(_0x5ea5a0['isVisible']||(_0x5ea5a0['isVisible']=!0x0),'chat'!==_0x5ea5a0['activeTab']&&_0x5ea5a0['activateTab']('chat'),'ask-ai'===_0x42d5a0['id'])_0x3820df['removeSelectionFromChatContext'](),_0x3820df['addSelectionToChatContext'](this['editor']),_0x3820df['focusPromptInput']();else await _0x3820df['startConversation']({'modelId':_0x42d5a0['model']}),_0x3820df['removeSelectionFromChatContext'](),_0x3820df['addSelectionToChatContext'](this['editor']),_0x3820df['focusPromptInput'](),await _0x3820df['sendMessage']({'message':_0x42d5a0['prompt']||_0x42d5a0['displayedPrompt']||_0x42d5a0['label'],'attributes':{'quickActionData':{'id':_0x42d5a0['id']},'displayedPrompt':_0x42d5a0['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x4cc6cf=this['editor'],_0x47acfa=_0x4cc6cf['model']['document']['selection'];if(!_0x47acfa['isCollapsed'])return;const _0x318dfd=gt(_0x47acfa['getSelectedBlocks']())||_0x4cc6cf['model']['schema']['getLimitElement'](_0x47acfa);_0x4cc6cf['model']['change'](_0x5f0156=>{_0x5f0156['setSelection'](_0x318dfd,'in');});}['_handleAIActionsActionLabel'](_0x2f3b22){return _0x2f3b22['parent']?.['label']&&'other'!==_0x2f3b22['parent']?.['id']?_0x2f3b22['parent']['label']+':\x20'+_0x2f3b22['label']:_0x2f3b22['label'];}async['_handleAIActionsAction'](_0x1eba2f){const _0x52d51a=this['editor']['plugins']['get']('AIActions'),_0x20e1df=_0x1eba2f['prompt']?{'userMessage':_0x1eba2f['prompt'],'model':_0x1eba2f['model']}:{'actionName':_0x1eba2f['actionName']||_0x1eba2f['id'],'args':_0x1eba2f['args']},_0x3fd291=this['_handleAIActionsActionLabel'](_0x1eba2f);await _0x52d51a['executeAction'](_0x20e1df,_0x3fd291,_0x1eba2f['icon']);}}class AIQuickActionsEditing extends _0x1fd9d0{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x298f60=this['editor'],_0x4d04de=new AIQuickActionsCommand(this['editor']);if(_0x298f60['commands']['add']('aiQuickAction',_0x4d04de),_0x298f60['plugins']['has']('AIChat')){const _0x153446=this['editor']['plugins']['get']('AIChatController');_0x298f60['model']['document']['selection']['on']('change:range',(_0x576420,_0x4b5e03)=>{_0x4b5e03['directChange']&&_0x153446['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x5595dc,_0x5249cc='text'){'modification'===this['type']&&'text'===_0x5249cc&&(_0x5249cc=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x5595dc,_0x5249cc);}['updateChangeGroups'](_0x2bd698){const _0x15e813=this['parsedContent']['get'](_0x2bd698)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x2bd698,_0x15e813),this['changeGroups']=[],0x0==_0x15e813['childNodes']['length'])return;rs(this['documentContextContent']['get'](_0x2bd698),this['parsedMergedContent']['get'](_0x2bd698));const _0x2ab8e4=this['documentContextContent']['get'](_0x2bd698)['children']['map'](_0xf6dec1=>({'node':_0xf6dec1,'id':Xi(_0xf6dec1,'data-id')})),_0x33dac9=_0x15e813['children']['map'](_0x53c248=>({'node':_0x53c248,'id':Xi(_0x53c248,'data-id')||at()})),_0x198eb0=_0x55fd12(_0x2ab8e4,_0x33dac9,{'comparator':(_0x4ede04,_0x2c8c49)=>_0x4ede04['id']==_0x2c8c49['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x198eb0['length']&&_0x198eb0[_0x198eb0['length']-0x1]['removed'];)_0x198eb0['pop']();}const _0x4d2b5b=_0x198eb0['map'](_0x23bc1c=>{const _0x56b6e6=_0x23bc1c['added']?'new':_0x23bc1c['removed']?'removed':'modified';return{'node':_0x23bc1c['value'][0x0]['node'],'type':_0x56b6e6,'id':_0x23bc1c['value'][0x0]['id']};}),_0x1da3f5=this['_documentIdToSource']['get'](_0x2bd698);this['changeGroups']['push']({'changes':_0x4d2b5b,'state':'pending','index':this['changeGroups']['length'],'editor':_0x1da3f5['editor'],'rootName':_0x1da3f5['rootName'],'documentId':_0x2bd698});}['_getDifferentChangeGroups'](_0x1cad86,_0xc34c9c){return _0xc34c9c;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x21029e){super(_0x21029e),this['content']=_0x21029e['content'],this['version']=_0x21029e['version'],this['editor']=_0x21029e['editor'],this['rootName']=_0x21029e['rootName'],this['actionName']=_0x21029e['actionName'],this['args']=_0x21029e['args'],this['userMessage']=_0x21029e['userMessage'],this['model']=_0x21029e['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':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x50d80f){const _0x36fa54=this['editor']['config']['get']('collaboration.channelId'),_0x4addb9=new AIActionsReply({..._0x50d80f,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x36fa54,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x36fa54,this['editor']]])});return this['replies']['push'](_0x4addb9),_0x4addb9['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x4addb9),_0x4addb9;}}class AIActionsBalloonToolbarView extends kt{constructor(_0xc065ac,_0x3d3c3c=!0x0,_0xcd6a9e=!0x0){super(_0xc065ac),this['set']('isEnabled',!0x1),_0x3d3c3c&&(this['applyButton']=this['_createButton'](Mi(_0xc065ac,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0xcd6a9e&&(this['suggestButton']=this['_createButton'](Mi(_0xc065ac,'AI_BALLOON_SUGGEST_BUTTON'),_0x3d3c3c?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x3d3c3c,'showSuggestButton':_0xcd6a9e}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x3806f5,showSuggestButton:_0x128faf}){this['applyButton']&&(this['applyButton']['isVisible']=_0x3806f5),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x128faf);}['_createButton'](_0x4c8528,_0x217b6f){const _0x275847=new yt(this['locale']);return _0x275847['set']({'label':_0x4c8528,'class':_0x217b6f,'isVisible':!0x0,'withText':!0x0}),_0x275847;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x1a01d2){super(_0x1a01d2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0x1a01d2,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x5c9255){super(_0x5c9255),this['set']('isVisible',!0x0);const _0x477595=new AISpinnerView('small');_0x477595['isVisible']=!0x0;const _0x1937e0=new Nt(this['locale']);_0x1937e0['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4203b7=>!_0x4203b7)]},'children':[_0x477595,_0x1937e0]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x55a105,_0x277ec6){super(_0x55a105),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x277ec6,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x246137(),this['_addContentWrapper'](_0x277ec6),this['_addDisclaimerView'](),this['_addToolbar'](_0x277ec6),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'](_0x277ec6);});}['render'](){super['render']();for(const _0x2b7fe4 of this['_focusables'])this['_focusTracker']['add'](_0x2b7fe4['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x593bbd){-0x1===_0x593bbd?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x5df35c){this['_isLoading']=_0x5df35c;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0xfbb5d3){super['showError'](_0xfbb5d3),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x43b35e){super['showBlockingError'](_0x43b35e),this['setErrorState']();}['addMiniToolbarItem'](_0x1ef941){this['_miniToolbarView']['items']['has'](_0x1ef941)||this['_miniToolbarView']['items']['add'](_0x1ef941);}['removeMiniToolbarItem'](_0x197a70){this['_miniToolbarView']['items']['has'](_0x197a70)&&this['_miniToolbarView']['items']['remove'](_0x197a70);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x318334,showSuggestButton:_0x2ce5a2}){_0x318334=_0x318334&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2ce5a2=_0x2ce5a2&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x318334,'showSuggestButton':_0x2ce5a2});}async['updateContent'](_0x52386d){await this['_streamableContentView']['update'](_0x52386d);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x33a90f){this['_contentWrapper']=new Nt(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'](_0x33a90f['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x1ca271,showSuggestButton:_0x518f92}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x1ca271,_0x518f92),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',(_0x24d8c6,_0x1a8c1e,_0x1bdd79)=>!(_0x24d8c6||_0x1a8c1e||_0x1bdd79)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x1ca271,'showSuggestButton':_0x518f92}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x324581){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x324581),this['_miniToolbarView']['delegate'](...Ss)['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',(_0x500c29,_0x4c1250)=>!(_0x500c29||_0x4c1250)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x63147e=new yt(this['locale']),_0x1f0f85=new yt(this['locale']),_0x4e11a3=new AIActionsBalloonNavigationCounterView(this['locale']),_0x35e340=new yt(this['locale']);_0x63147e['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x1f0f85['set']({'icon':_0x3617a8,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x35e340['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x63147e['bind']('isEnabled')['to'](this,'isBusy',_0x292e38=>!_0x292e38),_0x63147e['on']('execute',()=>{this['fire']('tryAgain');}),_0x1f0f85['bind']('isEnabled')['to'](this,'isBusy',_0x332aaf=>!_0x332aaf),_0x1f0f85['on']('execute',()=>{this['fire']('showPrevious');}),_0x35e340['bind']('isEnabled')['to'](this,'isBusy',_0x34d81f=>!_0x34d81f),_0x35e340['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x1f0f85,this['_navigationCounter']=_0x4e11a3,this['_navigationNextButton']=_0x35e340,this['_navigationTryAgainButton']=_0x63147e;}['updateMiniToolbarButtons'](_0x37ec81,_0x5539fe){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x579850=_0x37ec81>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x579850){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x403b4c=_0x37ec81-_0x5539fe;this['_navigationCounter']['setInteractionCount'](_0x403b4c+'/'+_0x37ec81),this['_navigationPreviousButton']['isEnabled']=_0x5539fe<_0x37ec81-0x1,this['_navigationNextButton']['isEnabled']=_0x5539fe>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'](_0x46bdf1){this['_isLoading']=_0x46bdf1;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x4613f4=this['_getScrollableElement']();_0x4613f4&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x4613f4));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x4fe416){super(_0x4fe416);const _0x1c928a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x1c928a['to']('interactionCount')}]});}['setInteractionCount'](_0x1ee3d8){this['set']('interactionCount',_0x1ee3d8);}}class AIActions extends _0x1fd9d0{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x76057];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x24ae4b){super(_0x24ae4b),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x246e8a,_0x487627,_0x5441fe){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x13985f,anchorData:_0x1f6d50,root:_0x384ebf}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x246e8a,_0x13985f,_0x1f6d50,_0x384ebf,_0x487627,_0x5441fe);}}const {modelFragment:_0x29d86f,anchorData:_0x2db775,root:_0xd5651a}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x246e8a,_0x29d86f,_0x2db775,_0xd5651a,_0x487627,_0x5441fe);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x3191d7=this['editor']['plugins']['has']('TrackChanges');let _0x27d3a6=this['editor']['config']['get']('ai.availableReplyActions')||[...Ds];_0x3191d7||(_0x27d3a6=_0x27d3a6['filter'](_0x241079=>'insertSuggestion'!=_0x241079));const _0x35f3e6=this['editor']['commands']['get']('trackChanges'),_0x39e9de=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x3191d7,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x27d3a6});return _0x39e9de['bind']('isBusy')['to'](this),_0x35f3e6&&_0x39e9de['bind']('isTrackChangesOn')['to'](_0x35f3e6,'value'),_0x39e9de['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x39e9de['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x39e9de['on']('showNext',()=>{this['_navigateToNext']();}),_0x39e9de;}['_normalizeSelectionStart'](){const _0x1535d4=this['editor']['model'],_0x469791=_0x1535d4['document']['selection'],_0x717a96=_0x469791['getFirstRange']();if(!_0x717a96||_0x717a96['isCollapsed'])return;const _0x6f8325=gt(_0x469791['getSelectedBlocks']());if(!_0x6f8325)return;const _0x10acd5=_0x1535d4['createPositionAt'](_0x6f8325,0x0);_0x10acd5['isAfter'](_0x717a96['start'])&&_0x1535d4['change'](_0x36a43e=>{_0x36a43e['setSelection'](_0x36a43e['createRange'](_0x10acd5,_0x717a96['end']));});}['_getExecuteDataRegular'](){const _0x24e0f6=this['editor']['model']['document']['selection'],_0xeef84b=_0x24e0f6['getFirstRange']()['start']['root'];if(_0x24e0f6['isCollapsed']){const _0x1e0ca7=gt(_0x24e0f6['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x24e0f6);this['editor']['model']['change'](_0x5c1a97=>{_0x5c1a97['setSelection'](_0x1e0ca7,'in');});}this['_normalizeSelectionStart']();const _0x281c8e=_0x24e0f6['getFirstRange'](),_0x683672=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x24e0f6),_0x281c8e['start'],_0x281c8e['end']);this['_copyMarkersToFragment'](_0x683672,_0x24e0f6,{'isTableSelection':!0x1});const _0x3c6fba=_0x24e0f6['getFirstRange']()['start'],_0xf79e83=new Map();let _0x433247=_0x683672;for(let _0x531c68=0x0;_0x531c68<_0x3c6fba['path']['length'];_0x531c68++)_0xf79e83['set'](_0x433247,_0x3c6fba['path'][_0x531c68]),_0x433247=_0x433247['getChild'](0x0);return{'modelFragment':_0x683672,'anchorData':_0xf79e83,'root':_0xeef84b};}['_getExecuteDataInTable'](){const _0x5a57e1=this['editor']['model']['document']['selection'],_0x5f35cf=this['editor']['plugins']['get']('TableSelection'),_0x3d37a7=_0x5a57e1['getFirstRange']()['start']['root'],_0x48e984=_0x5f35cf['getSelectionAsFragment'](),_0x44be94=_0x5a57e1['getFirstRange']()['start']['parent']['parent'],_0xe5da3d=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x44be94),this['editor']['model']['createPositionAfter'](_0x44be94)),_0x16d32e=this['_wrapWithCommonAncestors'](_0x48e984,_0xe5da3d['start'],_0xe5da3d['end']);this['_copyMarkersToFragment'](_0x16d32e,_0x5a57e1,{'isTableSelection':!0x0});const _0x3ce45f=_0x5a57e1['getFirstRange']()['start'],_0x1a8df5=new Map();let _0x6fb930=_0x16d32e;for(let _0x5c027c=0x0;_0x5c027c<_0x3ce45f['path']['length'];_0x5c027c++)if(_0x1a8df5['set'](_0x6fb930,_0x3ce45f['path'][_0x5c027c]),_0x5c027c<_0x3ce45f['path']['length']-0x1)_0x6fb930=_0x6fb930['getChild'](0x0);else{let _0x454114=_0x6fb930['nextSibling'];for(;_0x454114;)_0x1a8df5['set'](_0x454114,_0x3ce45f['path'][_0x5c027c]),_0x454114=_0x454114['nextSibling'];}return{'modelFragment':_0x16d32e,'anchorData':_0x1a8df5,'root':_0x3d37a7};}async['_executeAction'](_0x52c575,_0x38b7c8,_0x3ee14f,_0x2ecb6a,_0x347e9d,_0x289b7e){const _0x20cd70=this['editor']['plugins']['get'](AIEditing),_0x46f5ab=this['editor']['plugins']['get'](AIBalloon),_0x142590=this['editor']['model']['document']['selection'],_0x492e34=await _0x20cd70['modelToDataWithIds'](_0x38b7c8,this['editor']),_0x18ff36=this['editor']['model']['document']['version'],_0x48bfc6=[..._0x142590['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x46f5ab['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x347e9d,'icon':_0x289b7e||_0x31731d,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x48bfc6,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x46f5ab),this['_interactionParams']={'action':_0x52c575,'content':_0x492e34,'version':_0x18ff36,'aiBalloon':_0x46f5ab,'modelFragment':_0x38b7c8,'anchorData':_0x3ee14f,'root':_0x2ecb6a},this['_setupApplyListeners'](),this['listenTo'](_0x46f5ab,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x46f5ab,'dialogClosed',(_0x5a15c3,{id:_0x186b69})=>{if('aiActionsBalloon'===_0x186b69){for(const _0x2be281 of this['_interactions']){if(0x0===_0x2be281['replies']['length']||_0x2be281['stoppedExplicitly'])continue;const _0xd33f6f=_0x2be281['replies'][_0x2be281['replies']['length']-0x1],_0x4dca47=_0xd33f6f['changeGroups'][0x0];_0x4dca47&&'pending'===_0x4dca47['state']&&_0xd33f6f['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x46f5ab);}}),this['_createInteraction'](_0x492e34,_0x18ff36,_0x46f5ab,_0x52c575);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x14bf16,anchorData:_0x5f48dd,root:_0xd174d0}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x14bf16,_0x5f48dd,_0xd174d0,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x14bf16,_0x5f48dd,_0xd174d0,!0x0);});}['_wrapWithCommonAncestors'](_0x587b6e,_0x539076,_0x206244){const _0x21f6e0=this['editor']['model']['createRange'](_0x539076,_0x206244)['getCommonAncestor'](),_0x43413c=_0x21f6e0['is']('documentFragment')?[]:_0x21f6e0['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x43413c['length']){const _0x1cfd3e=_0x43413c['map'](_0x36450b=>_0x36450b['_clone'](!0x1));for(let _0x3c8f31=0x1;_0x3c8f31<_0x1cfd3e['length'];_0x3c8f31++)_0x1cfd3e[_0x3c8f31-0x1]['_appendChild'](_0x1cfd3e[_0x3c8f31]);return _0x1cfd3e[_0x1cfd3e['length']-0x1]['_appendChild'](_0x587b6e),new _0x26fdcd(_0x1cfd3e[0x0]);}return _0x587b6e;}['_copyMarkersToFragment'](_0x2293c5,_0x253c82,_0x4e268c={'isTableSelection':!0x1}){const _0x4fbe7d=this['editor']['model'],_0x5c2a04=Array['from'](_0x253c82['getRanges']()),_0x1633d0=_0x253c82['getFirstRange']()['start'];for(const _0x32efa9 of _0x4fbe7d['markers']){if(_0x32efa9['name']['startsWith'](Rs)||!_0x32efa9['affectsData'])continue;const _0x2b2a74=_0x32efa9['getRange']();if(!_0x5c2a04['some'](_0x32ff9f=>_0x32ff9f['containsRange'](_0x2b2a74,!0x0)))continue;const _0x3b5658=this['_regularCalculateMarkerPath'](_0x2b2a74['start'],_0x1633d0,_0x4e268c['isTableSelection']),_0x3905b7=this['_regularCalculateMarkerPath'](_0x2b2a74['end'],_0x1633d0,_0x4e268c['isTableSelection']),_0x42eda2=_0x4fbe7d['createPositionFromPath'](_0x2293c5,_0x3b5658),_0x5b997d=_0x4fbe7d['createPositionFromPath'](_0x2293c5,_0x3905b7);if(!_0x42eda2['isEqual'](_0x5b997d)){const _0x4c1216=_0x4fbe7d['createRange'](_0x42eda2,_0x5b997d);_0x2293c5['markers']['set'](_0x32efa9['name'],_0x4c1216);}}}['_regularCalculateMarkerPath'](_0x258946,_0xf7c02e,_0x19cd73=!0x1){const _0x42c691=[..._0x258946['path']['slice']()];for(let _0x4e24c9=0x0;_0x4e24c9<Math['max'](_0xf7c02e['path']['length'],_0x258946['path']['length']);_0x4e24c9++){const _0x197877=_0xf7c02e['path'][_0x4e24c9]||0x0,_0x184007=(_0x258946['path'][_0x4e24c9]||0x0)-_0x197877;if(_0x42c691[_0x4e24c9]=_0x184007,0x0!==_0x184007&&!_0x19cd73)break;}return _0x42c691;}async['_createInteraction'](_0x2f52ac,_0x1ff9da,_0x67e06c,_0x2bc55d){const _0x32fb04=this['editor'],_0x4cfcb9=_0x32fb04['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x2bc55d,'content':_0x2f52ac,'version':_0x1ff9da,'aiBalloon':_0x67e06c,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x4cfcb9});const _0x1904c7=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x32fb04['locale'],'content':_0x2f52ac,'version':_0x1ff9da,'editor':_0x32fb04,'rootName':_0x4cfcb9['rootName'],..._0x2bc55d});this['_interactions']['push'](_0x1904c7);const _0x2a133f=(_0x41149e,_0x4cf3d8=!0x1,_0x2bac2f='streaming')=>this['_promiseQueue']['enqueue'](async _0x2400ec=>{try{const _0x10868d=os({'changeGroups':_0x41149e['changeGroups'],'documentContextContent':_0x41149e['documentContextContent'],'showDiff':_0x4cf3d8,'trimUnchanged':!0x1});_0x10868d['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x10868d[0x0],'renderingStrategy':_0x2bac2f,'abortSignal':_0x2400ec});}catch(_0x431422){if(this['_isAbortError'](_0x431422))return;throw _0x431422;}});_0x1904c7['on']('replyCreated',(_0x1fb15e,_0x36609b)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x2a133f(_0x36609b)['catch'](_0xb1c61a=>{this['_isAbortError'](_0xb1c61a)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0xb1c61a),this['_setErrorState'](_0x1904c7));});}),_0x1904c7['on']('replyContentUpdated',(_0x2df52a,_0x401b78)=>{_0x2a133f(_0x401b78)['catch'](_0x4cc401=>{this['_isAbortError'](_0x4cc401)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x4cc401),this['_setErrorState'](_0x1904c7));});}),_0x1904c7['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x5be2ec){this['_isAbortError'](_0x5be2ec)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x5be2ec),this['_setErrorState'](_0x1904c7));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x3daf99,{showDiff:_0x686dc9})=>{try{this['_balloonShowDiff']=_0x686dc9;const _0x1c7aa4=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x1c7aa4&&await _0x2a133f(_0x1c7aa4,_0x686dc9,'static');}catch(_0x13e19c){this['_isAbortError'](_0x13e19c)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x13e19c),this['_setErrorState'](_0x1904c7));}}),_0x1904c7['on']('replyChangeGroupStateUpdated',()=>{const _0x1b8de7={'positiveCount':_0x1904c7['replies']['reduce']((_0x560c20,_0x5ae859)=>_0x560c20+_0x5ae859['changeGroups']['filter'](_0x2e63e0=>'accepted'===_0x2e63e0['state'])['length'],0x0),'totalCount':_0x1904c7['replies']['reduce']((_0x1cef4a,_0x516c67)=>_0x1cef4a+_0x516c67['changeGroups']['length'],0x0)},_0x4c0640=_0x1904c7['actionCallId'],_0x43c80a=_0x1904c7['actionName'];_0x43c80a?this['_aiConnector']['upsertAIActionRating'](_0x43c80a,_0x4c0640,_0x1b8de7):this['_aiConnector']['upsertCustomAIActionRating'](_0x4c0640,_0x1b8de7);}),this['_setLoadingState']();try{const _0xaa8ea2=await _0x1904c7['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0xaa8ea2;}catch(_0x4f8cfb){if(this['_isAbortError'](_0x4f8cfb))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x1904c7);}}['_applyChanges'](_0x59b58f,_0x53b2b5,_0x173efc,_0x34a5d9){const _0x3a24d7=this['editor'];if(_0x34a5d9&&!_0x3a24d7['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0xddafc5=this['editor']['plugins']['get'](_0x76057),_0x5aaa89=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5aaa89||!_0x5aaa89['replies']['length'])return;const _0x4f8ef5=_0x5aaa89['replies'][_0x5aaa89['replies']['length']-0x1],_0x40a61f=_0x4f8ef5['changeGroups'];_0x4f8ef5['setChangeGroupState'](0x0,'accepted');let _0x305e98=Es({'reply':_0x4f8ef5,'interaction':_0x5aaa89,'groups':_0x40a61f,'transform':!0x1,'documentCompare':_0xddafc5,'documentCompareOptions':{'anchor':_0x3a24d7['model']['createPositionAt'](_0x59b58f,0x0),'markDeletions':_0x34a5d9}});_0x305e98=this['_filterOperationsOutsideRange'](_0x305e98,_0x53b2b5);for(const _0x2d8c11 of _0x305e98)this['_anchorOperation'](_0x53b2b5,_0x2d8c11,_0x173efc);const _0x4989aa=_0x5aaa89['getDocumentContext']()['documents'][0x0]['version'],_0x12df3d=_0x3a24d7['model']['document']['history']['getOperations'](_0x4989aa),_0x29baa4={'document':_0x3a24d7['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x51814d=_0x437900(_0x305e98,_0x12df3d,_0x29baa4)['operationsA'];_0x3a24d7['model']['change'](_0x1db5f6=>{if(_0x1db5f6['setSelection'](_0x3a24d7['model']['document']['selection']['focus']),_0x34a5d9)_0x3a24d7['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x51814d);else{for(const _0x263f63 of _0x51814d)_0x263f63['baseVersion']=_0x3a24d7['model']['document']['version'],Ts(_0x3a24d7,_0x263f63),_0x1db5f6['batch']['addOperation'](_0x263f63),_0x3a24d7['model']['applyOperation'](_0x263f63);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x2060c5,_0x19d2d2){return _0x2060c5['filter'](_0x36eb48=>{if('rename'==_0x36eb48['type']){const _0x4842c6=_0x36eb48['position']['nodeAfter'];return!_0x19d2d2['has'](_0x4842c6);}if(_0x36eb48['type']['indexOf']('Attribute')>-0x1){const _0xad5b3e=_0x36eb48['range']['start']['nodeAfter'];return!_0x19d2d2['has'](_0xad5b3e);}return!0x0;});}['_anchorOperation'](_0x2de021,_0x37e57f,_0x58eb0d){const _0x555300=_0x37e57f['clone']();for(const _0x516ef1 in _0x37e57f){const _0x20297a=_0x37e57f[_0x516ef1];_0x20297a instanceof _0x10082a?_0x37e57f[_0x516ef1]=new _0x10082a(_0x40e611(_0x20297a['start']),_0x40e611(_0x20297a['end'])):_0x20297a instanceof _0x8826d0&&(_0x37e57f[_0x516ef1]=_0x40e611(_0x20297a));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x555300['type'])){if(_0x555300['isDocumentOperation']=!0x1,_0x555300['baseVersion']=null,'remove'==_0x555300['type']){const _0x1b7431=_0x555300['sourcePosition'],_0x270856=_0x555300['howMany'];new _0x1e4528(_0x1b7431,_0x270856)['_execute']();}else _0x555300['_execute']();}function _0x40e611(_0x22b857){if('$graveyard'==_0x22b857['root']['rootName'])return _0x22b857;const _0x54b240=[];let _0x541cd8=_0x22b857['root'];for(let _0x42bfbe=0x0;_0x42bfbe<_0x22b857['path']['length'];_0x42bfbe++){const _0x8d2ecb=_0x2de021['get'](_0x541cd8)||0x0;_0x54b240[_0x42bfbe]=_0x22b857['path'][_0x42bfbe]+_0x8d2ecb,_0x541cd8=_0x541cd8['getChildAtOffset'](_0x22b857['path'][_0x42bfbe]);}return new _0x8826d0(_0x58eb0d,_0x54b240,_0x22b857['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x1e5813,content:_0x461c71,version:_0x51619f,aiBalloon:_0x17d076}=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'](_0x461c71,_0x51619f,_0x17d076,_0x1e5813)['catch'](_0x12d617=>{this['_isAbortError'](_0x12d617)||console['error']('Error\x20refreshing\x20interaction:',_0x12d617);});}['_isAbortError'](_0x32d821){return!!_0x32d821['message']&&_0x32d821['message']['startsWith']('ai-request-aborted');}['_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 _0x3c05c1=this['_interactions']['length'];this['_currentInteractionIndex']<_0x3c05c1-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x44a3c6){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x44a3c6;const _0x2f3e08=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x2f3e08)return;if(_0x2f3e08['hasError'])return this['_setErrorState'](_0x2f3e08),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x2f3e08['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x48f8ba=_0x2f3e08['replies'][_0x2f3e08['replies']['length']-0x1];if(_0x48f8ba)try{const _0x261d2c=os({'changeGroups':_0x48f8ba['changeGroups'],'documentContextContent':_0x48f8ba['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x1f8f07=>setTimeout(_0x1f8f07,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x261d2c[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x22cc62){this['_isAbortError'](_0x22cc62)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x22cc62);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x356218){const _0x541c02=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x541c02),_0x356218['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);}}class AIQuickActions extends _0x1fd9d0{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5485b7){super(_0x5485b7),_0x5485b7['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x5bc20c,_0x214ddf){super(_0x5bc20c),this['id']=_0x214ddf,this['set']('status','pending'),this['set']('changeId',_0x214ddf),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',(_0x16877a,_0x4693bb)=>{_0x4693bb&&_0x4693bb['target']&&'A'===_0x4693bb['target']['tagName']&&_0x4693bb['preventDefault'](),this['fire']('activateChange',{'id':_0x214ddf,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x214ddf,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x214ddf,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x5216bb=new Nt(this['locale']);return _0x5216bb['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',_0x4a864d=>!_0x4a864d)]}}),_0x5216bb;}['_createAcceptButtonView'](){const _0x4dda93=new yt(this['locale']);return _0x4dda93['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x4dda93['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3044f1=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x3044f1['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x2ed779=>'pending'!==_0x2ed779&&'accepted'!==_0x2ed779),this['bindTemplate']['if']('status',Bi,_0x358de9=>'pending'===_0x358de9),this['bindTemplate']['if']('status',Gi,_0x912488=>'pending'!==_0x912488),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0xea0868=>'accepted'===_0xea0868)]}}),this['on']('change:status',(_0x100a32,_0x56c26f,_0x197a82)=>{_0x4dda93['isEnabled']='pending'===_0x197a82,'accepted'===_0x197a82&&(_0x4dda93['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x4dda93['icon']=_0x22df45);}),_0x4dda93;}['_createDismissButtonView'](){const _0x5305b4=new yt(this['locale']);return _0x5305b4['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x5305b4['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4f81f4=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x4f81f4['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x25a00d=>'pending'!==_0x25a00d&&'rejected'!==_0x25a00d),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x4b5e62=>'pending'===_0x4b5e62),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x12a210=>'rejected'===_0x12a210)]}}),this['on']('change:status',(_0x197a0b,_0x17ed55,_0x46ca56)=>{_0x5305b4['isEnabled']='pending'===_0x46ca56,'rejected'===_0x46ca56&&(_0x5305b4['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x5305b4['icon']=_0x1c0648);}),_0x5305b4;}['_createInfoButtonView'](){const _0x90e53d=new yt(this['locale']);return _0x90e53d['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x2d9b50,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x90e53d['bind']('isOn')['to'](this,'isInfoToggleOn',_0x11cc51=>_0x11cc51),_0x90e53d['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x90e53d;}['_createOutdatedButtonView'](){const _0x41a6fd=new yt(this['locale']);return _0x41a6fd['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x41a6fd['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x1e2ef9=>'outdated'!==_0x1e2ef9)],'disabled':'disabled'}}),_0x41a6fd;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x7b0b6f,_0x456347){super(_0x7b0b6f),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']()),_0x456347['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x5ce5d8){this['resultItemView']['changeId']=_0x5ce5d8['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x5ce5d8['contentDiffed'];}['showBalloon'](_0x38935e,_0x42a8d3,_0x5b4308,_0x781abe,_0x86c3b2,_0x364b22){const _0x4fbfeb=_0x42a8d3();if(!_0x4fbfeb)return;this['updateContent'](_0x38935e),this['show']();const _0xef3012=Array['from'](_0x4fbfeb['getClientRects']())['reverse'](),_0x151937=this['_getPointedRectIndexFromEvent'](_0x5b4308,_0xef3012),_0x1463d1=_0xef3012[_0x151937??0x0];'click'===_0x781abe?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x42a8d3(),_0x151937,_0x38935e['id'],_0x86c3b2,_0x364b22)||_0x1463d1})):'hover'===_0x781abe&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x42a8d3(),_0x151937,_0x38935e['id'])||_0x1463d1}));}['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'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x4029d4=[this['element']];return this['_pinnedTargetElement']&&_0x4029d4['push'](this['_pinnedTargetElement']),_0x4029d4;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0xfa77e0=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0xfa77e0['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']]}]}),_0xfa77e0;}['_getBestRectPositionOnClick'](_0x26d7de,_0x1314a2,_0x18ef39,_0x572b96,_0x3fdea4){if(!_0x26d7de)return null;const _0x43b1ef=this['position']['replace']('arrow_',''),_0x442058=Array['from'](_0x26d7de['getClientRects']());let _0x2b55e4,_0x4ecd8a=_0x442058['reverse']();return void 0x0!==_0x1314a2&&this['_isPinnedRectVisible'](_0x4ecd8a[_0x1314a2],_0x572b96,_0x3fdea4)?(_0x2b55e4=_0x4ecd8a[_0x1314a2],this['_pinnedRectIndex']=_0x1314a2):this['_isPinnedRectVisible'](_0x4ecd8a[0x0],_0x572b96,_0x3fdea4)&&void 0x0===_0x1314a2?_0x2b55e4=_0x4ecd8a[0x0]:(_0x4ecd8a='s'==_0x43b1ef[0x0]?[..._0x442058]['reverse']():_0x442058,_0x4ecd8a['forEach'](_0x3b1997=>{this['_isPinnedRectVisible'](_0x3b1997,_0x572b96,_0x3fdea4)&&(_0x2b55e4=_0x3b1997);})),this['_pinnedTargetChangeId']=_0x18ef39,this['_pinnedTargetElement']=_0x26d7de,_0x2b55e4||_0x26d7de['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x26611e,_0x91ba5,_0xaa4899){if(!_0x26611e)return null;const _0x4ea492=Array['from'](_0x26611e['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x91ba5&&this['_pinnedTargetChangeId']!==_0xaa4899)return this['_pinnedRectIndex']=_0x91ba5,this['_pinnedTargetElement']=_0x26611e,this['_pinnedTargetChangeId']=_0xaa4899,_0x4ea492[_0x91ba5];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0xaa4899){if(_0x26611e!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x4ea492[this['_pinnedRectIndex']];}return void 0x0!==_0x91ba5&&this['_pinnedTargetChangeId']!==_0xaa4899?(this['_pinnedRectIndex']=_0x91ba5,this['_pinnedTargetElement']=_0x26611e,this['_pinnedTargetChangeId']=_0xaa4899,_0x4ea492[_0x91ba5]):_0x26611e['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x178305,_0x69721d){if(_0x178305)for(let _0x48ee7f=0x0;_0x48ee7f<_0x69721d['length'];_0x48ee7f++){const _0xb29e2e=_0x69721d[_0x48ee7f];if(_0x178305['clientX']>=_0xb29e2e['left']-0x3&&_0x178305['clientX']<=_0xb29e2e['right']+0x3&&_0x178305['clientY']>=_0xb29e2e['top']-0x3&&_0x178305['clientY']<=_0xb29e2e['bottom']+0x3)return _0x48ee7f;}}['_isPinnedRectVisible'](_0x2cd091,_0x3dd257,_0x45f48f){const _0x4f4612=new dt(_0x2cd091),_0x58a344=_0x3dd257||document['documentElement'],_0x190228=_0x4f4612['getIntersection'](Ot(_0x45f48f)),_0x51aeeb=new dt(_0x58a344)['getIntersection'](_0x4f4612);return!!(_0x190228&&_0x51aeeb&&_0x4f4612['width']>0x0);}}const Zn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x21ae07{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41212b){super(_0x41212b),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Zn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x23709a=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x23709a);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x43834b){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x134bd2=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x43834b,_0x134bd2);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x48eb33){_0x48eb33&&('error-general'!==_0x48eb33['status']?'error-chunk'!==_0x48eb33['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x58f88c){this['_mainView']['addCheckRunResult'](_0x58f88c);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x23e38e){this['_mainView']['showGeneralReviewCoreErrorView'](_0x23e38e??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x5dfc49,_0x3ca013){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x5dfc49,_0x3ca013);}['setActiveStateInResults'](_0x37f16c){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x33ed61=>{_0x33ed61['id']===_0x37f16c&&_0x33ed61['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x326a28=>_0x326a28['setItemAsInactive']());}['updateChangeState'](_0x4c2928,_0x41129f){'accepted'===_0x41129f||'rejected'===_0x41129f||'outdated'===_0x41129f?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x4c2928,_0x41129f):this['_mainView']['reviewCheckResultsView']['showResult'](_0x4c2928,_0x41129f);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x3a6125,_0x1fa30c,_0xb980a,_0x5b8090,_0x2b4087,_0x494b83){this['_balloonSuggestionView']['showBalloon'](_0x3a6125,_0x1fa30c,_0xb980a,_0x5b8090,_0x2b4087,_0x494b83);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x283c09){const _0x2819a1=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x41d2e1=>_0x41d2e1['id']===_0x283c09);return _0x2819a1?_0x2819a1['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x37a860){super(_0x37a860),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0xc33a56=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0xc33a56['if']('isVisible','ck-hidden',_0x2fd793=>!_0x2fd793)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0xc33a56['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x2e2566,_0xd77b36){super(_0x2e2566),this['reviewCoreHeader']=_0xd77b36['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x2e2566),this['reviewCheckListView']=_0xd77b36['list'],this['reviewCheckListView']['delegate'](...Zn)['to'](this),this['reviewCheckResultsView']=_0xd77b36['results'],this['reviewCheckResultsView']['delegate'](...Zn)['to'](this),this['reviewCompletedView']=_0xd77b36['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'](_0x4f4ac8){this['reviewCheckResultsView']['addResult'](_0x4f4ac8),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'](_0x5dc3ec){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x5dc3ec;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x5da78a,_0xc5f593){super(_0xc5f593),this['set']({'label':_0x5da78a,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0xc754de,_0x31086c){super(_0xc754de),this['_contents']=_0x31086c,this['_resultViews']=new _0x246137(),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 AIDisclaimerView(_0xc754de),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 _0x56948c=this['_createCombinedSkeletonLoader'](),_0x16c884=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x16c884['if']('isLoading','ck-ai_review__check-run_loading',_0x3ac61e=>_0x3ac61e),_0x16c884['if']('isResultReady','ck-ai_review__check-run_ready',_0x4aaa91=>_0x4aaa91),_0x16c884['if']('isVisible','ck-hidden',_0x29b6e5=>!_0x29b6e5)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x56948c,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x28b607){const _0x19449d=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x28b607['id']);_0x19449d['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x19449d),_0x19449d['resultResponseView']['element']['innerHTML']=_0x28b607['contentDiffed'];}['hideResult'](_0x31e872,_0x50aab6){if('pending'===_0x50aab6)return;const _0x526cc3=this['_resultViews']['find'](_0x335baf=>_0x335baf['id']===_0x31e872);_0x526cc3&&(_0x526cc3['status']=_0x50aab6,_0x526cc3['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x32fa1e,_0x104f4c){if('pending'!==_0x104f4c)return;const _0x17dc08=this['_resultViews']['find'](_0x239f02=>_0x239f02['id']===_0x32fa1e);_0x17dc08&&(_0x17dc08['status']=_0x104f4c,_0x17dc08['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x230edc,_0x2cd1f1){this['headerTitle']=_0x230edc,this['headerSubtitle']=_0x2cd1f1||'';}['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 AISkeletonView(this['locale'],Ls['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x2e017c=new Nt(this['locale']),_0x2ecf4f=[];for(let _0x3e7b3c=0x0;_0x3e7b3c<0x10;_0x3e7b3c++){const _0x571a8d=this['_createSkeletonLoader']();_0x571a8d['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x2ecf4f['push'](_0x571a8d);}return _0x2e017c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x13c2be=>!_0x13c2be)]},'children':_0x2ecf4f}),_0x2e017c;}['_createResultsBodyView'](){const _0x5dcdbb=new Nt(this['locale']);return _0x5dcdbb['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1a7bf1=>_0x1a7bf1)]},'children':this['_resultViews']}),_0x5dcdbb;}['_createErrorView'](){const _0x529b5e=new Nt(this['locale']),_0x3c9129=new yt(this['locale']),t=this['locale']['t'];return _0x529b5e['delegate']('retryReview')['to'](this),_0x3c9129['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x3c9129['on']('execute',()=>{this['fire']('retryReview');}),_0x529b5e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0xe4299=>!_0xe4299),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x1e9acd=>'chunk'===_0x1e9acd)]},'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',_0xfd04=>'chunk'===_0xfd04)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3c9004=>'general'!==_0x3c9004)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x593e18=>'chunk'!==_0x593e18)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x3c9129]}),_0x529b5e;}['_createCancelButtonView'](){const _0x1bc565=new yt(this['locale']);return _0x1bc565['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x236653}),_0x1bc565['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2926a6=>_0x2926a6),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x29ad37=>_0x29ad37)]}}),_0x1bc565['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1bc565;}['_createToggleDiffButtonView'](){const _0x1de897=new yt(this['locale']);_0x1de897['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x1de897['bind']('isEnabled')['to'](this,'isError',_0x3cfb71=>!_0x3cfb71),_0x1de897['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x587a18=>!_0x587a18),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x534e10=>_0x534e10)]}});const _0x19e392=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x32aadf=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x1de897['bind']('isOn')['to'](this,'isToggleDiffOn',_0x3ebe27=>_0x3ebe27),_0x1de897['bind']('icon')['to'](this,'isToggleDiffOn',_0x2e64fd=>_0x2e64fd?nt:rt),_0x1de897['bind']('label')['to'](this,'isToggleDiffOn',_0x503a12=>_0x503a12?_0x19e392:_0x32aadf),_0x1de897['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x1de897;}['_createAcceptAllButtonView'](){const _0x5e38d2=new yt(this['locale']);return _0x5e38d2['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x5e38d2['bind']('isEnabled')['to'](this,'isError',_0x4297c5=>!_0x4297c5),_0x5e38d2['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2a0b14=>!_0x2a0b14),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2211b1=>_0x2211b1)]}}),_0x5e38d2['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x5e38d2;}['_createExitReviewButtonView'](){const _0x12d921=new yt(this['locale']);return _0x12d921['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x12d921['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x243ced=>!_0x243ced),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xa31319=>_0xa31319)]}}),_0x12d921['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x12d921;}['_createResultHeaderView'](){const _0x2d1930=new Nt(this['locale']),_0x1f3ab9=this['_createTitleView']();return _0x2d1930['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x5b3312=>_0x5b3312)]},'children':[_0x1f3ab9,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4dcde9=>!_0x4dcde9)],'title':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Mi(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']]}]}),_0x2d1930;}['_createTitleView'](){const _0x5e0087=new Nt(this['locale']),_0x368bfc=new AISpinnerView();return _0x368bfc['bind']('isVisible')['to'](this,'isResultReady',_0x3a4d24=>!_0x3a4d24),_0x5e0087['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3b017f=>_0x3b017f)]},'children':[_0x368bfc,{'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')}]}]}]}),_0x5e0087;}['_createFinishReviewButtonView'](){const _0x4d9b01=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x4d9b01['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xf0ab1e=>!_0xf0ab1e)]}}),_0x4d9b01['delegate']('finishReview')['to'](this),_0x4d9b01;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x266206,_0x3de434){super(_0x266206),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x3de434['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x3de434['headerText']);const _0x1ab84b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x1ab84b['if']('isVisible','ck-hidden',_0x7e8363=>!_0x7e8363)]},'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':_0x3de434['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x4dddd1){const _0x1ccd35=new AIReviewCoreFinishReviewButtonView(_0x4dddd1,this['locale']);return _0x1ccd35['delegate']('finishReview')['to'](this),_0x1ccd35;}['_createResultHeaderView'](_0x5acd49){const _0x473162=new Nt(this['locale']);return _0x473162['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x5acd49},'children':[{'text':_0x5acd49}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x473162;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x2f319a,_0x58748b){super(_0x2f319a),this['_defaultValue']=_0x58748b['default']||(_0x58748b['data']['length']>0x0?_0x58748b['data'][0x0]['id']:''),this['_defaultLabel']=_0x58748b['data']['find'](_0x438b39=>_0x438b39['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x1cb4a0=this['_prepareListOptions'](_0x58748b['data']);Jt(this['_dropdownView'],_0x1cb4a0,{'role':'menu','ariaLabel':_0x58748b['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x35b7be=>{_0x35b7be['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x268bb9=>{this['formValue']=_0x268bb9['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x268bb9['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'](_0x902305=[]){const _0x56df5d=new _t();this['resetToDefault']();for(const _0x2ad8a8 of _0x902305){const _0x34d4c9=new Zt({'label':_0x2ad8a8['label'],'withText':!0x0,'role':'menuitemradio','id':_0x2ad8a8['id'],'model':_0x2ad8a8});_0x34d4c9['bind']('isOn')['to'](this,'formValue',_0xf256e4=>_0xf256e4===_0x34d4c9['id']);const _0x531798={'type':'button','model':_0x34d4c9};_0x56df5d['add'](_0x531798);}return _0x56df5d;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x2b5bb5,_0x565cda,_0x5c739d){super(_0x2b5bb5),this['argsKey']=_0x565cda?.['argsKey'];if('dropdown'===_0x565cda['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x565cda);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x492c0d=new _0xc27f4e(this['locale'],{'children':[this['_formItem']],'class':[_0x5c739d?'ck-form__row_with-submit':'']});_0x5c739d&&_0x492c0d['children']['add'](_0x5c739d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x492c0d]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x36717f{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x28cd0c){super(_0x28cd0c),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),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']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x246137();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0xb11bc9,_0x327703,_0x3c7753=!0x1){super(_0xb11bc9),this['_check']=_0x327703,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x327703['defaultModel']?_0x327703['defaultModel']['id']:'',this['_defaultLabel']=_0x327703['defaultModel']?_0x327703['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x190a2c(this['locale'],()=>new AIReviewCorePromptInputView(_0xb11bc9)),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 _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x3c7753),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0xc27f4e(this['locale'],{'children':[this['promptInputView']]}),new _0xc27f4e(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x17de32,_0x42f467)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x42f467()):_0x42f467();}),this['focusCycler']=new Ut({'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'](_0x234462=>{this['_focusables']['add'](_0x234462),this['focusTracker']['add'](_0x234462['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 _0x33723a of this['_getFormValidators']()){const _0x3bad55=_0x33723a();if(_0x3bad55)return this['promptInputView']['errorText']=_0x3bad55,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x535cc6=new yt(this['locale']),t=this['locale']['t'];return _0x535cc6['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x535cc6['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x535cc6;}['_createCancelButtonView'](){const _0x2e7e03=new yt(this['locale']),t=this['locale']['t'];return _0x2e7e03['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x2e7e03['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x619528=>{_0x619528['stopPropagation']();})}}),_0x2e7e03['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x2e7e03;}['_setModelList'](_0x2c37ec){this['_modelSelectionDropdownItems']['clear']();const _0x35df30=this['_check']['models'];if(_0x2c37ec)this['set']('modelDisplayMode','hidden');else{const _0x2d8006=0x1===_0x35df30['length'];this['set']('modelDisplayMode',_0x2d8006?'name':'selector');}if(this['resetToDefault'](),_0x35df30?.['length']){0x1===_0x35df30['length']&&this['set']('activeModelName',_0x35df30[0x0]['name']||_0x35df30[0x0]['id']);for(const _0x56ff35 of _0x35df30){const _0x29a0e4=new Zt({'label':_0x56ff35['name'],'withText':!0x0,'role':'menuitemradio','id':_0x56ff35['id'],'model':_0x56ff35});_0x29a0e4['bind']('isOn')['to'](this,'modelId',_0x6b8c76=>_0x6b8c76===_0x56ff35['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x29a0e4,'labelView':new ModelButtonLabelView(this['locale'],_0x56ff35)});}}}['_createModelSelectionDropdown'](){const _0x22a5ac=Ft(this['locale']);return _0x22a5ac['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x22a5ac['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x22a5ac['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x35d99=>'selector'===_0x35d99),this['listenTo'](_0x22a5ac,'execute',_0x215907=>{this['modelId']=_0x215907['source']['model']['id'],_0x22a5ac['buttonView']['label']=_0x215907['source']['label'];}),_0x22a5ac;}['_createModelNameView'](){const _0x681202=new ModelNameView(this['locale']);return _0x681202['bind']('text')['to'](this,'activeModelName',_0x2de279=>_0x2de279??''),_0x681202['bind']('isVisible')['to'](this,'modelDisplayMode',_0x27a1bf=>'name'===_0x27a1bf),_0x681202;}['_createActionsFooterView'](){const _0x445554=new Nt(this['locale']);return _0x445554['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']]}]}),_0x445554;}}class ModelNameView extends Nt{constructor(_0x28ace3){super(_0x28ace3),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0xf02810=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0xf02810['if']('isVisible','ck-hidden',_0x38f891=>!_0x38f891)]},'children':[{'text':_0xf02810['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x1f38a6,_0x28b4ba){super();const _0xcdb629=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0xcdb629['to']('style'),'id':_0xcdb629['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0xcdb629['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x28b4ba['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x246137();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x5c4eb7,_0x34f321,_0x3da789,_0x45e3f9=!0x1){super(_0x5c4eb7),this['_hideModels']=_0x45e3f9,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x34f321['isParameterized']);const _0xe69fec=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',_0x2eda84=>_0x2eda84),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0xcf8dea=>_0xcf8dea)],'style':{'--ck-ai-review-check-list-item-index':_0x3da789}},'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':_0x34f321['title']}]},_0xe69fec]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x34f321['description']?[{'text':_0x34f321['description']}]:[]}]}]},..._0x34f321['isParameterized']?[this['_createParameterizedView'](_0x34f321)]:[],...'custom'===_0x34f321['id']?[this['_createCustomView'](_0x34f321,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x34f321['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x34f321['id'],'args':_0x34f321['useArgs']?_0x34f321['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x55e3b6=>{_0x55e3b6['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0xcac78c=new Lt();return _0xcac78c['content']=ot,_0xcac78c['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0xcac78c;}['_createParameterizedView'](_0x423618){const _0x5cf0b1=new Nt(),_0x36c421=this['_createFormView'](_0x423618);return _0x5cf0b1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x3ecf2d=>!_0x3ecf2d)]},'children':[_0x36c421]}),_0x5cf0b1;}['_createFormView'](_0x470830){const _0x27cb9c=new Nt(),_0x146fcd=Array['isArray'](_0x470830['options'])?_0x470830['options']:[],_0x49a929=new yt(this['locale']),t=this['locale']['t'];_0x49a929['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x49a929['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x47f64d=>{_0x47f64d['stopPropagation']();})}}),_0x49a929['on']('execute',()=>{const _0x5af02f=[],_0x4929ed={};this['_formItemsCollection']['forEach'](_0x4a80c2=>{_0x5af02f['push'](_0x4a80c2['value']),_0x470830['useArgs']&&_0x470830['options']&&(_0x4929ed[_0x4a80c2['argsKey']]=_0x4a80c2['value']);}),this['fire']('runReviewCheck',{'id':_0x470830['id'],'params':_0x5af02f['length']?_0x5af02f:void 0x0,'args':Object['keys'](_0x4929ed)['length']?_0x4929ed:void 0x0});});const _0x23fbb6=_0x146fcd['length'];return _0x146fcd['forEach']((_0x5b7b7a,_0xc4b9e)=>{const _0x379926=_0xc4b9e===_0x23fbb6-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x5b7b7a,_0x379926?_0x49a929:null));}),_0x27cb9c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x27cb9c;}['_createCustomView'](_0x4af122,_0x3bb4da=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x4af122,_0x3bb4da),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',_0x50417c=>!_0x50417c)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x2c503d,_0x13f1c2,_0x461920)=>{_0x461920||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x43d415){super(_0x43d415),this['_checkViews']=new _0x246137(),this['_setupTemplate']();}['setChecks'](_0x566a8e,_0x12322c=!0x1){this['_checkViews']['clear']();for(const [_0x1994ae,_0x1a5689]of _0x566a8e['entries']()){const _0x1d5c2b=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x1a5689,_0x1994ae,_0x12322c);_0x1d5c2b['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x1d5c2b);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0xc45462 of this['_checkViews'])_0xc45462 instanceof AIReviewCoreReviewCommandListItemView&&_0xc45462['resetToDefault']();}['_setupTemplate'](){const _0xc9138a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0xc9138a['if']('isVisible','ck-hidden',_0x1ae300=>!_0x1ae300)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x40af28=this['context']['plugins']['get']('AITabs'),_0x45f559=this['context']['locale'],_0x43682d=new AIHeaderView(_0x45f559,{'label':Mi(_0x45f559,'AI_REVIEW_MODE'),'icon':_0x3b9a9d,'class':'ck-ai-header_review','showResizeButton':_0x40af28['showResizeButton']});return _0x43682d['delegate']('resizeTabs')['to'](_0x40af28),_0x43682d['bind']('isMaximized')['to'](_0x40af28['view'],'isMaximized',_0x370181=>_0x370181),new AIReviewCoreView(this['context']['locale'],{'header':_0x43682d,'list':new AIReviewCoreReviewCheckListView(_0x45f559),'results':new AIReviewCoreUICheckResultsView(_0x45f559,{'generalErrorText':Mi(_0x45f559,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x45f559,{'headerText':Mi(_0x45f559,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x45f559,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x45f559,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x43de7d=this['context']['plugins']['get']('AITabs');_0x43de7d['view']['on']('activateTab',(_0x36a7d1,{newTab:_0x378e0d,oldTab:_0x161250})=>{'reviewMode'===_0x378e0d?this['fire']('getReviewCheckList'):'reviewMode'===_0x161250&&this['fire']('leaveReview');}),_0x43de7d['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x3b9a9d,'order':0x0,'content':this['_mainView']});}}const tr='review-',er=['softBreak'],ir=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x21ae07{static get['requires'](){return[_0x76057,AIEditing];}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(_0x45d677){super(_0x45d677),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x1f31e1=_0x13463e=>this['_scheduleAttachReviewEditingToEditor'](_0x13463e);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1d8ba0)return void _0x1f31e1(this['context']);const _0x3e8172=this['context'];for(const _0x4c81a4 of _0x3e8172['editors'])_0x1f31e1(_0x4c81a4);this['listenTo'](_0x3e8172['editors'],'add',(_0xa49b6,_0x57d763)=>{_0x1f31e1(_0x57d763);}),this['listenTo'](_0x3e8172['editors'],'remove',(_0x56b127,_0x171085)=>{for(const [_0x1bcb02,_0x4f0b5e]of this['_markers'])_0x4f0b5e['editor']===_0x171085&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x1bcb02,'changeId':_0x4f0b5e['groupId']}),this['_markers']['delete'](_0x1bcb02));});}['_scheduleAttachReviewEditingToEditor'](_0x3053a9){const _0x2b02bf=()=>{'destroyed'!==_0x3053a9['state']&&_0x3053a9['conversion']&&this['_attachReviewEditingToEditor'](_0x3053a9);};if('ready'===_0x3053a9['state'])return void _0x2b02bf();const _0x2df287=()=>{this['stopListening'](_0x3053a9,'ready',_0x2df287),_0x2b02bf();};this['listenTo'](_0x3053a9,'ready',_0x2df287);}['_attachReviewEditingToEditor'](_0xb9f9e){this['_reviewEditingAttachedEditors']['has'](_0xb9f9e)||(_0xb9f9e['conversion']['for']('editingDowncast')['markerToElement']({'model':tr+'insert','view':(_0x17ed42,{writer:_0x21dfbc})=>{const _0x163fc3=this['_markers']['get'](_0x17ed42['markerName']),_0x169873={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x163fc3?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x17ed42['markerName']};return _0x21dfbc['createUIElement']('span',_0x169873,function(_0x51d845){const _0x58091b=this['toDomElement'](_0x51d845);return _0x58091b['innerHTML']=_0x163fc3?.['content']?.['asString']||'',_0x58091b;});}}),_0xb9f9e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-only','view':_0x154a59=>{const _0x52b506=this['_markers']['get'](_0x154a59['markerName']),_0x2239f5=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x52b506?.['id']||'')&&_0x2239f5['push']('ck-ai_review__change_active'),{'classes':_0x2239f5,'attributes':{'data-marker-id':_0x154a59['markerName']}};}}),_0xb9f9e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-context','view':_0x211fad=>{const _0x4f89c9=this['_markers']['get'](_0x211fad['markerName']),_0x2f0c4e=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x4f89c9?.['id']||'')&&_0x2f0c4e['push']('ck-ai_review__change_active'),{'classes':_0x2f0c4e,'attributes':{'data-marker-id':_0x211fad['markerName']}};}}),_0xb9f9e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-text','view':_0x3e041e=>{const _0x1d8c3b=this['_markers']['get'](_0x3e041e['markerName']),_0x55b868=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x1d8c3b?.['id']||'')&&_0x55b868['push']('ck-ai_review__change_active'),{'classes':_0x55b868,'attributes':{'data-marker-id':_0x3e041e['markerName']}};}}),_0xb9f9e['conversion']['for']('dataDowncast')['markerToElement']({'model':tr+'suggestion-context','view':(_0x508faa,{writer:_0x59ea9e})=>_0x59ea9e['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x508faa['isOpening']?'start':'end')})}),_0xb9f9e['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x2be294,'view':_0x20284a}),this['_updateMouseMarkerInteractionListeners'](_0xb9f9e),this['listenTo'](_0xb9f9e,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xb9f9e),{'priority':'lowest'}),this['listenTo'](_0xb9f9e,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0xb9f9e),{'priority':'lowest'}),_0xb9f9e['model']['document']['registerPostFixer'](_0x259ad3=>this['_validateMarkers'](_0xb9f9e,_0x259ad3)),_0xb9f9e['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0xb9f9e)),this['_reviewEditingAttachedEditors']['add'](_0xb9f9e));}['_updateMouseMarkerInteractionListeners'](_0x5c5404){let _0x2f01e0=this['_boundEditables']['get'](_0x5c5404);_0x2f01e0||(_0x2f01e0=new Map(),this['_boundEditables']['set'](_0x5c5404,_0x2f01e0));const _0x208271=new Set(_0x5c5404['ui']['getEditableElementsNames']());for(const _0x5664bd of _0x208271){if(_0x2f01e0['has'](_0x5664bd))continue;const _0x537286=_0x5c5404['ui']['getEditableElement'](_0x5664bd);_0x2f01e0['set'](_0x5664bd,_0x537286),this['_attachMouseMarkerInteractionListeners'](_0x537286);}for(const [_0x1e574,_0x48ac04]of _0x2f01e0)_0x208271['has'](_0x1e574)||(_0x2f01e0['delete'](_0x1e574),this['_domEmitter']['stopListening'](_0x48ac04));}['_attachMouseMarkerInteractionListeners'](_0x235e60){this['_domEmitter']['listenTo'](_0x235e60,'mouseup',(_0x5d660a,_0x6e2a66)=>{const _0x1eafa5=_0x6e2a66['target'],_0x452ca0=this['_findMarkerElement'](_0x1eafa5);if(!_0x452ca0)return;const _0x5d64a6=_0x452ca0['getAttribute']('data-marker-id'),_0x466af5=_0x5d64a6['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x5d64a6,'changeId':_0x466af5,'markerElement':()=>this['_findMarkerElementById'](_0x5d64a6),'domEvent':_0x6e2a66});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x235e60,'mouseover',(_0x4e32a2,_0x4717ee)=>{const _0x25be40=_0x4717ee['target'],_0x115011=_0x4717ee['relatedTarget'];let _0x229904=this['_findMarkerElement'](_0x25be40);if(!_0x229904&&_0x115011&&(_0x229904=this['_findMarkerElement'](_0x115011)),!_0x229904)return;const _0x8080f=_0x229904['getAttribute']('data-marker-id'),_0x21b90a=_0x8080f['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x21b90a,'markerElement':()=>this['_findMarkerElementById'](_0x8080f),'domEvent':_0x4717ee});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x315a1f((_0x11caf5,_0x58e524)=>{const _0x299444=_0x58e524['target'];if(this['_findMarkerElement'](_0x299444))return;_0x299444['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x36be6f=this['context']['plugins']['get']('AIEditing'),_0x47084d=ms(this['context']);if(!_0x47084d['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x41accf=new Set(),_0x3dff55=[],_0x3a7378=new Map();for(const _0x4baba2 of _0x47084d)for(const _0x2192a5 of _0x4baba2['model']['document']['getRoots']()){if('$graveyard'===_0x2192a5['rootName'])continue;const _0x3458b1=this['_buildDocumentDataSliceForRoot'](_0x4baba2,_0x2192a5,_0x36be6f,_0x41accf);_0x3dff55['push'](_0x3458b1['content']);for(const [_0x4e077c,_0x52ff65]of _0x3458b1['elements'])_0x3a7378['set'](_0x4e077c,_0x52ff65);}return{'elements':_0x3a7378,'content':_0x3dff55['join']('')};}['_buildDocumentDataSliceForRoot'](_0x5c9d13,_0x24f391,_0x3cb784,_0x80209f){const _0x5befdd=_0x5c9d13['model'],_0x12dabc=new _0x26fdcd();for(const _0x598e7d of _0x24f391['getChildren']())_0x12dabc['_appendChild'](_0x598e7d['_clone'](!0x0));for(const _0x46193c of _0x5befdd['markers']){const _0x1599f3=_0x46193c['getRange']();_0x1599f3&&_0x1599f3['root']['rootName']===_0x24f391['rootName']&&_0x12dabc['markers']['set'](_0x46193c['name'],this['_changeRangeOwnerDocument'](_0x1599f3['clone'](),_0x12dabc));}const _0x2dbd28=new Map(),_0x1b222f=_0x5befdd['document']['version'],_0x41cb25=new _0x2cb75b({'ignoreElementEnd':!0x0,'startPosition':_0x5befdd['createPositionAt'](_0x12dabc,0x0)});for(const {item:_0x54ff4a}of _0x41cb25){if(_0x54ff4a['is']('element')&&_0x54ff4a['name']&&ir['includes'](_0x54ff4a['name'])){const _0x55203d=this['_upsertDataId'](_0x54ff4a,()=>_0x3cb784['_nextDataId'](_0x80209f));_0x80209f['add'](_0x55203d);}if(!_0x54ff4a['is']('$textProxy'))continue;const _0x369f27=_0x54ff4a['parent'];if(!_0x369f27||!_0x369f27['is']('element'))continue;const _0x5c8668=this['_upsertDataId'](_0x369f27,()=>_0x3cb784['_nextDataId'](_0x80209f));_0x80209f['add'](_0x5c8668);for(const _0x2c6bbe of _0x369f27['getChildren']())_0x2c6bbe['is']('element')&&(_0x2c6bbe['name']&&er['includes'](_0x2c6bbe['name'])||_0x80209f['add'](this['_upsertDataId'](_0x2c6bbe,()=>_0x3cb784['_nextDataId'](_0x80209f))));let _0x2018e9=_0x369f27;for(;_0x2018e9['parent']&&!_0x2018e9['parent']['is']('documentFragment');)_0x2018e9=_0x2018e9['parent'],_0x2018e9['hasAttribute'](_0x2be294)&&_0x2018e9['_removeAttribute'](_0x2be294);_0x2dbd28['set'](_0x5c8668,{'editor':_0x5c9d13,'rootName':_0x24f391['rootName'],'path':_0x369f27['getPath'](),'documentVersion':_0x1b222f,'getContent':this['_createGetContentUsingDataIdFn'](_0x2018e9['_clone'](!0x0),_0x5c8668,_0x5c9d13['data'])}),_0x41cb25['jumpTo'](_0x5befdd['createPositionAfter'](_0x369f27));}return{'content':_0x5c9d13['data']['processor']['toData'](_0x5c9d13['data']['toView'](_0x12dabc)),'elements':_0x2dbd28};}['diffContent'](_0x140c10,_0x196413,_0x385ed5,_0x220687=!0x1){const {contentInitial:_0x2c841f,contentNew:_0x56fcf5}=this['_neutralizeChangesOnUnsupportedElements'](_0x196413,_0x385ed5),_0x1d90d9=[],_0x5b1aca=_0x140c10['data']['parse'](_0x56fcf5,'$documentFragment'),_0x41ade8=_0x140c10['data']['parse'](_0x2c841f,'$documentFragment'),_0x5ee858=_0x140c10['model']['createPositionAt'](_0x41ade8,0x0);if(this['_haveSingleTopLevelElement'](_0x5b1aca)){if(!this['_hasSameTopLevelElement'](_0x41ade8,_0x5b1aca))return _0x1d90d9;}else{const _0x44c74c=_0x140c10['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x41ade8,_0x44c74c)||!this['_haveOnlyInlineContent'](_0x5b1aca,_0x44c74c))return _0x1d90d9;}const _0x37736f=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x2c841f,_0x56fcf5,{'targetEditor':_0x140c10,'anchor':_0x5ee858,'markDeletions':!0x0})['getOperations']()['filter'](_0x4fa52d=>'insert'===_0x4fa52d['type']||'marker'===_0x4fa52d['type']&&_0x4fa52d['name']['startsWith']('$markedRemove')),_0xaf6a49=this['_groupAdjacentOperations'](_0x37736f),_0x124601=[];if(_0x220687){if(_0xaf6a49['length']){const _0x3745a8=_0xaf6a49[0x0]['operations'][0x0],_0x5c11cd='insert'===_0x3745a8['type']?_0x3745a8['position']:_0x3745a8['newRange']['start'],_0x369a58=this['_getPositionLimitingRange'](_0x5c11cd,_0x140c10,'inside'),_0x130ce1=_0x369a58?_0x5b1aca['getChild'](0x0)['getChildren']():_0x5b1aca['getChildren'](),_0x14f7aa=_0x369a58||_0x140c10['model']['createRangeIn'](_0x41ade8),_0x491766=[new _0x570f93('$markedRemove:synthetic'+at(),null,_0x14f7aa,_0x140c10['model']['document']['model']['markers'],!0x0,_0x140c10['model']['document']['version']+0x1),new _0x586276(_0x14f7aa['end'],_0x130ce1,_0x140c10['model']['document']['version']+0x2)];_0x124601['push']({'operations':_0x491766,'operationsIsolated':_0x491766,'groupOffset':0x0});}}else _0x124601['push'](..._0xaf6a49);let _0x3fc0bb=0x0;return _0x140c10['model']['change'](_0x30934c=>{for(let _0x42039e=0x0;_0x42039e<_0x124601['length'];_0x42039e++){const _0x58db2d=_0x124601[_0x42039e],_0x5f510e=_0x30934c['createDocumentFragment']();for(const _0x1930b9 of _0x41ade8['getChildren']())_0x30934c['append'](_0x1930b9['_clone'](!0x0),_0x5f510e);for(const _0x4ba743 of _0x58db2d['operationsIsolated'])if('insert'===_0x4ba743['type']){const _0x4de38d=_0x4ba743;_0x4de38d['baseVersion']=null,_0x4de38d['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x4de38d,_0x5f510e),_0x30934c['batch']['addOperation'](_0x4ba743),_0x140c10['model']['applyOperation'](_0x4ba743);const _0x55a9cf='suggestion:insertion:id:authorId:'+_0x3fc0bb++,_0x4e1ad3=_0x140c10['model']['createRange'](_0x4de38d['position'],_0x4de38d['position']['getShiftedBy'](_0x4de38d['howMany']));_0x5f510e['markers']['set'](_0x55a9cf,_0x4e1ad3);}else{if('marker'===_0x4ba743['type']&&_0x4ba743['name']['startsWith']('$markedRemove')){const _0x2ca7bf=_0x4ba743,_0x371c37='suggestion:deletion:id:authorId:'+_0x3fc0bb++;this['_changeOperationOwnerDocument'](_0x2ca7bf,_0x5f510e),_0x5f510e['markers']['set'](_0x371c37,_0x2ca7bf['newRange']);}}if(_0x220687)_0x1d90d9['push']({..._0x58db2d,'context':this['_createGetContentFn'](_0x41ade8,_0x140c10['data']),'content':this['_createGetContentFn'](_0x41ade8,_0x140c10['data'])});else{const _0x1a0b01=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x58db2d['operationsIsolated'][0x0]),_0x5f510e),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x58db2d['operationsIsolated'][_0x58db2d['operationsIsolated']['length']-0x1]),_0x5f510e),_0x140c10);_0x5f510e['markers']['set'](tr+'suggestion-context',new _0x10082a(_0x1a0b01['start'],_0x1a0b01['end'])),_0x1d90d9['push']({..._0x58db2d,'context':this['_createGetContextFn'](_0x5f510e,_0x140c10['data'],{'ellipsisBefore':_0x1a0b01['hasContentBefore'],'ellipsisAfter':_0x1a0b01['hasContentAfter']}),'content':this['_createGetContentFn'](_0x5f510e,_0x140c10['data'])});}}}),_0x1d90d9;}['markChangePositionInEditorContent'](_0x3ca650,_0xd81279){if(!_0x3ca650['length'])return;const _0x29ccb4=_0x3ca650[0x0]['parent']['id'],_0xcb070a=_0xd81279['elements']['get'](_0x29ccb4);if(!_0xcb070a)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x29ccb4);const _0x36aef8=_0xcb070a['path'],_0x48bb56=_0xcb070a['editor'],_0x5e484f=_0x48bb56['model']['document']['getRoot'](_0xcb070a['rootName']);if(!_0x5e484f)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0xcb070a['rootName']);const _0x37c21e=_0x48bb56['model']['document']['history']['getOperations'](_0xcb070a['documentVersion']),_0x649835=[];for(const _0x1106cf of _0x3ca650){const _0xd677e3=_0x1106cf['operationsIsolated']['map'](_0x56222f=>this['_translateOperationToEditorContent'](_0x56222f,_0x36aef8,_0x5e484f));if(!_0xd677e3||!_0xd677e3['length'])continue;const _0x3785d4=_0xd677e3['every'](_0x2c8ebe=>'marker'===_0x2c8ebe['type']&&_0x2c8ebe['name']['startsWith']('$markedRemove')),_0x12b9c3={'document':_0x48bb56['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x7094d3=_0x437900(_0xd677e3,_0x37c21e,_0x12b9c3)['operationsA'];for(const _0x172758 of _0x7094d3)if('insert'===_0x172758['type']){const _0x4e9502=_0x172758,_0xe057e2=_0x4e9502['nodes'];_0x48bb56['model']['change'](_0x25eefb=>{const _0x21eb2b=_0x25eefb['createDocumentFragment']();for(const _0x1d1488 of _0xe057e2)_0x25eefb['append'](_0x1d1488['_clone'](!0x0),_0x21eb2b);_0x649835['push']({'start':_0x4e9502['position'],'end':_0x4e9502['position'],'type':'insert','groupId':_0x1106cf['id'],'content':{'asString':this['_createGetContentFn'](_0x21eb2b,_0x48bb56['data'])(),'asFragment':_0x21eb2b}});});}else{if('marker'===_0x172758['type']&&_0x172758['name']['startsWith']('$markedRemove')){const _0x469439=_0x172758;let _0x461911='remove-text';if(_0x3785d4){const _0x423203=this['_findAdjacentContextDistance'](_0x469439['newRange']['start'],'backward',_0x48bb56['model']['schema']),_0x468f20=this['_findAdjacentContextDistance'](_0x469439['newRange']['end'],'forward',_0x48bb56['model']['schema']);if(_0x423203||_0x468f20){const _0x4bf85d=_0x469439['newRange']['start']['getShiftedBy'](-_0x423203),_0x26d124=_0x469439['newRange']['end']['getShiftedBy'](_0x468f20);_0x649835['push']({'start':_0x4bf85d,'end':_0x26d124,'groupId':_0x1106cf['id'],'type':'remove-context'});}else _0x461911='remove-only';}_0x649835['push']({'start':_0x469439['newRange']['start'],'end':_0x469439['newRange']['end'],'groupId':_0x1106cf['id'],'type':_0x461911});}}}this['_insertMarkers'](_0x649835,_0x48bb56);}['clearAllMarkers'](){const _0xf833a7=new Map();for(const _0x4be70a of this['_markers']['keys']()){const _0x14013f=this['_markers']['get'](_0x4be70a);_0x14013f?.['editor']&&(_0xf833a7['has'](_0x14013f['editor'])||_0xf833a7['set'](_0x14013f['editor'],[]),_0xf833a7['get'](_0x14013f['editor'])['push'](_0x4be70a));}for(const [_0x28ed92,_0x4e1986]of _0xf833a7)_0x28ed92['model']['change'](_0x3d5ad7=>{for(const _0x2563e3 of _0x4e1986)_0x28ed92['model']['markers']['get'](_0x2563e3)&&_0x3d5ad7['removeMarker'](_0x2563e3);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x4170f5 of ms(this['context']))_0x4170f5['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x25b9ba of ms(this['context']))_0x25b9ba['disableReadOnlyMode']('ai-review');}['applyChange'](_0x17fbc1){const _0x2d768c=_0x17fbc1['map'](_0x4b2d52=>this['_getMarkersDataForGroup'](_0x4b2d52))['flat'](),_0x48f241=new Map();for(const _0x48c5ee of _0x2d768c)_0x48f241['has'](_0x48c5ee['editor'])||_0x48f241['set'](_0x48c5ee['editor'],[]),_0x48f241['get'](_0x48c5ee['editor'])['push'](_0x48c5ee);for(const [_0x1eaf1d,_0x750774]of _0x48f241){const _0x1b7810=_0x1eaf1d['model'];_0x1b7810['change'](_0x51e158=>{for(const _0x18e6f2 of _0x750774){const _0x49c5c8=_0x1eaf1d['model']['markers']['get'](_0x18e6f2['id']);if(_0x49c5c8){if('insert'===_0x18e6f2['type']){if(!_0x18e6f2['content'])continue;_0x1b7810['insertContent'](_0x18e6f2['content']['asFragment']||null,_0x49c5c8['getRange']()['start']);}else'remove-text'!==_0x18e6f2['type']&&'remove-only'!==_0x18e6f2['type']||_0x1b7810['deleteContent'](_0x1b7810['createSelection'](_0x49c5c8['getRange']()));_0x51e158['removeMarker'](_0x18e6f2['id']),this['_markers']['delete'](_0x18e6f2['id']);}}});}}['rejectChange'](_0x3e7333){const _0x14da20=this['_getMarkersDataForGroup'](_0x3e7333),_0x46c77a=new Map();for(const _0x19da69 of _0x14da20)_0x46c77a['has'](_0x19da69['editor'])||_0x46c77a['set'](_0x19da69['editor'],[]),_0x46c77a['get'](_0x19da69['editor'])['push'](_0x19da69);for(const [_0xdb4a3a,_0x4c0aca]of _0x46c77a)_0xdb4a3a['model']['change'](_0x2305e4=>{for(const _0x28c858 of _0x4c0aca)_0x2305e4['removeMarker'](_0x28c858['id']),this['_markers']['delete'](_0x28c858['id']);});}['getEditor'](){return ps(this['context']);}['getEditors'](){return ms(this['context']);}['getEditorForChange'](_0x443c50){const _0x3b0309=this['_getMarkersDataForGroup'](_0x443c50);return _0x3b0309[0x0]?.['editor'];}['getMarkerElementForChange'](_0x4df689){const _0x46760f=Array['from'](this['_markers']['values']())['filter'](_0x221d57=>_0x221d57['groupId']===_0x4df689);if(!_0x46760f['length'])return null;const _0x100a8f=0x1===_0x46760f['length']?_0x46760f[0x0]:this['_sortMarkers'](_0x46760f)[0x0],_0x2f0733=_0x100a8f['editor']['model']['markers']['get'](_0x100a8f['id']);if(!_0x2f0733)return null;return{'modelRange':_0x2f0733['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x100a8f['id'])};}['getContentElementForChange'](_0x15e481){const _0x302bfc=Array['from'](this['_markers']['values']())['filter'](_0xa0e988=>_0xa0e988['groupId']===_0x15e481);if(!_0x302bfc['length'])return null;const _0x4213ae=0x1===_0x302bfc['length']?_0x302bfc[0x0]:this['_sortMarkers'](_0x302bfc)[0x0],_0x55e54a=_0x4213ae['editor'],_0x2e3dea=_0x55e54a['model']['markers']['get'](_0x4213ae['id']);if(!_0x2e3dea)return null;const _0x435a76=_0x2e3dea['getRange'](),_0x57b3c3=_0x55e54a['editing']['view']['getDomRoot'](_0x435a76['root']['rootName'])||_0x55e54a['editing']['view']['getDomRoot']();if(!_0x57b3c3||!_0x435a76)return null;let _0x5afebb=_0x435a76['start']['parent'];for(;_0x5afebb['parent']&&!_0x5afebb['parent']['is']('rootElement');)_0x5afebb=_0x5afebb['parent'];if(!_0x5afebb||!_0x5afebb['name'])return null;const _0x33d1d2=_0x57b3c3['querySelector']('[data-marker-id=\x22'+_0x4213ae['id']+'\x22]');if(!_0x33d1d2)return null;let _0x2bb2ca=null;_0x55e54a['model']['change'](_0x2b7830=>{_0x2bb2ca=_0x2b7830['createDocumentFragment'](),_0x2b7830['append'](_0x5afebb['_clone'](!0x0),_0x2bb2ca);});const _0x5fdac=_0x55e54a['data']['toView'](_0x2bb2ca)['getChild'](0x0);return _0x33d1d2['closest'](_0x5fdac['name']);}['reactivateMarkers'](_0x5a9785){const _0x3b58c7=this['_getMarkersDataForGroup'](_0x5a9785);if(!_0x3b58c7['length'])return;const _0x2367c7=Array['from'](this['_activeMarkers'])['sort'](),_0x31df51=Array['from'](new Set(_0x3b58c7['map'](_0xc3b139=>_0xc3b139['id'])))['sort']();_0x2367c7['join']('|')!==_0x31df51['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x5a9785));}['setMarkersInElementAsActive'](_0x425c5c){const _0x144979=this['_getMarkersDataForGroup'](_0x425c5c);if(!_0x144979['length'])return;const _0x695ffa=_0x144979[0x0]['editor'],_0x16b42=new Set(_0x144979['map'](_0x430488=>_0x430488['id'])),_0x318f8e=Array['from'](_0x16b42['values']())['map'](_0x55c822=>_0x695ffa['model']['markers']['get'](_0x55c822))['filter'](_0x23b45b=>!!_0x23b45b);_0x16b42['forEach'](_0x7e5a5a=>{this['_activeMarkers']['add'](_0x7e5a5a);}),_0x695ffa['model']['change'](()=>{_0x318f8e['forEach'](_0x4800d4=>{_0x695ffa['editing']['reconvertMarker'](_0x4800d4);});});}['setAllMarkersAsInactive'](){const _0x28035e=Array['from'](this['_activeMarkers']);if(!_0x28035e['length'])return;this['_activeMarkers']['clear']();const _0x43ca17=new Map();for(const _0x372356 of _0x28035e){const _0x5c1f6a=this['_markers']['get'](_0x372356);if(!_0x5c1f6a)continue;const _0x1de699=_0x5c1f6a['editor'],_0xf2cf7a=_0x1de699['model']['markers']['get'](_0x372356);_0xf2cf7a&&(_0x43ca17['has'](_0x1de699)||_0x43ca17['set'](_0x1de699,[]),_0x43ca17['get'](_0x1de699)['push'](_0xf2cf7a));}for(const [_0x3bf703,_0x58fdf1]of _0x43ca17)_0x3bf703['model']['change'](()=>{_0x58fdf1['forEach'](_0x5e4e2b=>{_0x3bf703['editing']['reconvertMarker'](_0x5e4e2b);});});}['_getPositionLimitingRange'](_0x165bd1,_0x590546,_0x578469='outside'){if(!_0x165bd1)return null;let _0x2c3f9e=_0x165bd1['parent'];for(;_0x2c3f9e&&_0x2c3f9e['parent']&&!_0x2c3f9e['parent']['is']('rootElement')&&!_0x590546['model']['schema']['isLimit'](_0x2c3f9e)&&!_0x590546['model']['schema']['isBlock'](_0x2c3f9e);)_0x2c3f9e=_0x2c3f9e['parent'];if(!_0x2c3f9e||!_0x2c3f9e['name']||_0x2c3f9e['is']('rootElement'))return null;let _0x408818=null;return _0x590546['model']['change'](_0x260e2b=>{_0x408818='inside'===_0x578469?_0x260e2b['createRangeIn'](_0x2c3f9e):_0x260e2b['createRangeOn'](_0x2c3f9e);}),_0x408818;}['_validateMarkers'](_0x49c03b,_0x286c31){const _0x406a0e=Array['from'](this['_markers']['keys']()),_0x1ad541=new Map();for(const _0x22550d of _0x406a0e){const _0x1a55a2=_0x49c03b['model']['markers']['get'](_0x22550d);if(!_0x1a55a2)continue;const _0x1778bd=_0x1a55a2['getStart']()['root']['rootName']+':'+_0x1a55a2['getStart']()['path'][0x0];_0x1ad541['has'](_0x1778bd)||_0x1ad541['set'](_0x1778bd,[]),_0x1ad541['get'](_0x1778bd)['push'](_0x1a55a2);}const _0x59afc6=new Set();for(const _0x21b239 of _0x49c03b['model']['document']['differ']['getChanges']()){let _0x36a865='',_0x3ff166=null;if('insert'===_0x21b239['type'])_0x3ff166=new _0x10082a(_0x21b239['position'],_0x21b239['position']['getShiftedBy'](_0x21b239['length'])),_0x36a865=_0x21b239['position']['root']['rootName']+':'+_0x21b239['position']['path'][0x0];else{if('remove'!==_0x21b239['type'])continue;_0x3ff166=new _0x10082a(_0x21b239['position']),_0x36a865=_0x21b239['position']['root']['rootName']+':'+_0x21b239['position']['path'][0x0];}const _0x5ca56b=_0x1ad541['get'](_0x36a865)||[];if(_0x5ca56b['length']){for(const _0x2fb5a6 of _0x5ca56b)if(_0x3ff166['root']['rootName']===_0x2fb5a6['getRange']()['root']['rootName']&&('insert'!==_0x21b239['type']||!_0x3ff166['containsRange'](_0x2fb5a6['getRange']()))&&(_0x3ff166['isIntersecting'](_0x2fb5a6['getRange']())||_0x3ff166['start']['isTouching'](_0x2fb5a6['getRange']()['end'])||_0x3ff166['end']['isTouching'](_0x2fb5a6['getRange']()['start']))){const _0x132c57=this['_parseMarkerName'](_0x2fb5a6['name']);Array['from'](this['_markers']['values']())['filter'](_0x3ea278=>_0x3ea278['groupId']===_0x132c57['groupId'])['forEach'](_0x150dac=>_0x59afc6['add'](_0x150dac['id']));}}}if(_0x59afc6['size']){for(const _0x5bd02c of _0x59afc6)_0x286c31['removeMarker'](_0x5bd02c);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x30c69c){for(const {name:_0x3145e5,data:_0x3bfb36}of _0x30c69c['model']['document']['differ']['getChangedMarkers']()){if(!_0x3145e5['startsWith'](tr))continue;const _0x29dac0=_0x3bfb36['oldRange'],_0x2178b3=_0x3bfb36['newRange'],_0x5afb9e=_0x29dac0&&'$graveyard'===_0x29dac0['root']['rootName'],_0x132649=_0x2178b3&&'$graveyard'===_0x2178b3['root']['rootName'];if(_0x5afb9e&&_0x132649)continue;const _0x15ffce=this['_parseMarkerName'](_0x3145e5);this['_markers']['get'](_0x3145e5)&&(_0x132649||!_0x2178b3?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x3145e5,'changeId':_0x15ffce['groupId']}):_0x5afb9e&&_0x2178b3&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x3145e5,'changeId':_0x15ffce['groupId']}));}}['_parseMarkerName'](_0x2896b3){const _0x5161ac=_0x2896b3['split'](':'),_0x39456e=(_0x5161ac[0x1]||'')['split']('_');return{'prefix':_0x5161ac[0x0],'groupId':_0x39456e[0x0],'suffix':_0x39456e[0x1]};}['_translateOperationToEditorContent'](_0x4b0b29,_0x4c255b,_0x45a5d3){if('insert'===_0x4b0b29['type']){const _0xc0ae27=_0x4b0b29;return new _0x586276(this['_changePosition'](_0x4c255b['concat'](_0xc0ae27['position']['offset']),_0x45a5d3),_0xc0ae27['nodes'],_0xc0ae27['baseVersion']);}if('marker'===_0x4b0b29['type']&&_0x4b0b29['name']['startsWith']('$markedRemove')){const _0x22756d=_0x4b0b29;return new _0x570f93(_0x22756d['name'],_0x22756d['oldRange'],this['_changeRange'](_0x22756d['newRange'],_0x4c255b['concat'](_0x22756d['newRange']['start']['offset']),_0x4c255b['concat'](_0x22756d['newRange']['end']['offset']),_0x45a5d3),_0x22756d['_markers'],_0x22756d['affectsData'],_0x22756d['baseVersion']);}return _0x4b0b29;}['_groupAdjacentOperations'](_0x4395e4){if(!_0x4395e4['length'])return[];const _0x49602a=[];let _0x5a5261=0x0,_0x5d3ddb=0x0,_0x4db60d=[];for(let _0x5c617a=0x0;_0x5c617a<=_0x4395e4['length'];_0x5c617a++){const _0x5b2819=_0x4395e4[_0x5c617a],_0x16a5e2=_0x4395e4[_0x5c617a-0x1];!_0x5b2819||_0x16a5e2&&!this['_getOperationEnd'](_0x16a5e2)['isTouching'](this['_getOperationStart'](_0x5b2819))?(_0x49602a['push']({'operations':_0x4db60d,'operationsIsolated':_0x4db60d['map'](_0x2abe75=>this['_shiftOperation'](_0x2abe75['clone'](),-_0x5d3ddb)),'groupOffset':_0x5a5261}),_0x4db60d=_0x5b2819?[_0x5b2819]:[],_0x5d3ddb+=_0x5a5261,_0x5a5261=0x0):_0x4db60d['push'](_0x5b2819),_0x5b2819&&'insert'===_0x5b2819['type']&&(_0x5a5261+=_0x5b2819['howMany']);}return _0x49602a;}['_findAdjacentContextDistance'](_0x30b826,_0x5bade6,_0xfc82d9,_0x111b78=0x1){const _0x22e58b=new _0x2cb75b({'startPosition':_0x30b826,'direction':_0x5bade6});let _0x913a55=0x0;for(let _0x27b152=0x0;_0x27b152<_0x111b78;_0x27b152++){let _0x460850=0x0,_0x4861eb=!0x1,_0x16b044='forward'===_0x5bade6?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x1676e3}of _0x22e58b)if(_0x1676e3['is']('$textProxy')){const _0x19780d=_0x16b044['exec'](_0x1676e3['data']);if(_0x19780d&&_0x19780d['length']){if(_0x460850+='forward'===_0x5bade6?_0x19780d['index']+_0x19780d[0x0]['length']:_0x1676e3['data']['length']-_0x19780d['index'],_0x19780d[0x0]['length']!==_0x1676e3['data']['length'])break;_0x4861eb=!0x0,_0x16b044='forward'===_0x5bade6?/^\w+/:/\w+$/;}else{if(_0x4861eb)break;_0x460850+=_0x1676e3['offsetSize'];}}else{if(_0x1676e3['is']('element')){_0xfc82d9['isInline'](_0x1676e3)&&!_0x4861eb&&(_0x460850+=0x1);break;}}_0x913a55+=_0x460850,_0x22e58b['jumpTo'](_0x30b826['getShiftedBy']('forward'===_0x5bade6?_0x913a55:-_0x913a55));}return _0x913a55;}['_getChangeContext'](_0x48bcc4,_0x300c80,_0x5922eb){const _0x2653ac=_0x5922eb['model']['schema'],_0x30a2b8=this['_findAdjacentContextDistance'](_0x48bcc4,'backward',_0x2653ac,0x6),_0x228438=this['_findAdjacentContextDistance'](_0x300c80,'forward',_0x2653ac,0x6),_0x2e3686=_0x48bcc4['getShiftedBy'](-_0x30a2b8),_0x2fcf29=_0x300c80['getShiftedBy'](_0x228438);return{'start':_0x2e3686,'end':_0x2fcf29,'hasContentBefore':!_0x2e3686['isAtStart'],'hasContentAfter':!_0x2fcf29['isAtEnd']};}['_insertMarkers'](_0x21a36e,_0x57b194){const _0x38844b=this['context']['plugins']['get']('AIEditing'),_0x49357a=new Set();_0x57b194['model']['change'](_0x5da5a7=>{for(const _0x565b42 of _0x21a36e){const _0x32a0b4=''+tr+_0x565b42['type']+':'+_0x565b42['groupId']+'_'+_0x38844b['_nextDataId'](_0x49357a);this['_markers']['set'](_0x32a0b4,{'id':_0x32a0b4,'groupId':_0x565b42['groupId'],'type':_0x565b42['type'],'content':_0x565b42['content'],'editor':_0x57b194}),_0x5da5a7['addMarker'](_0x32a0b4,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5da5a7['createRange'](_0x565b42['start'],_0x565b42['end'])});}});}['_createGetContextFn'](_0x3478ff,_0x142378,_0xb95a41){let _0x2ec248='';return()=>{if(!_0x2ec248){const _0x52ef33=_0x142378['toView'](_0x3478ff,{'showSuggestionHighlights':!0x0});let _0x597116=_0x52ef33['getChild'](0x0);if(_0x597116['is']('containerElement')||(_0x597116=_0x52ef33),!_0x597116)return'';let _0x55597c=!0x1;const _0x59251d=[];for(const _0x3d004a of _0x597116['getChildren']())_0x3d004a['is']('element','span')&&_0x3d004a['hasClass']('ck-ai_review-marker_context-end')&&(_0x55597c=!0x1),_0x55597c&&_0x59251d['push'](_0x3d004a),_0x3d004a['is']('element','span')&&_0x3d004a['hasClass']('ck-ai_review-marker_context-start')&&(_0x55597c=!0x0);_0x597116['_removeChildren'](0x0,_0x597116['childCount']),_0xb95a41?.['ellipsisBefore']&&_0x597116['_appendChild']('…'),_0x597116['_appendChild'](_0x59251d),_0xb95a41?.['ellipsisAfter']&&_0x597116['_appendChild']('…');const _0x5ecad4=_0x142378['htmlProcessor']['domConverter']['viewToDom'](_0x52ef33),_0x52e4e2=_0x142378['htmlProcessor']['htmlWriter']['getHtml'](_0x5ecad4);_0x2ec248=this['_removeUnsupportedElements'](_0x52e4e2);}return _0x2ec248;};}['_createGetContentFn'](_0xb60626,_0x201853){let _0xfa0170='';return()=>(_0xfa0170||(_0xfa0170=this['_removeUnsupportedElements'](_0x201853['stringify'](_0xb60626,{'showSuggestionHighlights':!0x0}))),_0xfa0170);}['_createGetContentUsingDataIdFn'](_0x202d1e,_0x5d4b15,_0x6ea353){let _0x3cc951='';return()=>{if(!_0x3cc951){const _0x143264=_0x6ea353['toView'](new _0x26fdcd(_0x202d1e)),_0x593386=_0x6ea353['htmlProcessor']['domConverter']['viewToDom'](_0x143264)['querySelector']('[data-id=\x22'+_0x5d4b15+'\x22]');_0x3cc951=_0x593386?.['outerHTML']||'';}return _0x3cc951;};}['_removeUnsupportedElements'](_0x2787be){if(!_0x2787be)return'';const _0x4b60ea=Wi(_0x2787be,{'decodeEntities':!0x1}),_0x1b8bea=qi(_0x4b60ea);if(!_0x1b8bea['length'])return _0x2787be;for(const _0x22f2b8 of _0x1b8bea)_0x1da415(_0x22f2b8);return Ki(_0x4b60ea,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x5b557c,_0x24a311){const _0xc693f6=Wi(_0x5b557c,{'decodeEntities':!0x1}),_0x3d9b7e=Wi(_0x24a311,{'decodeEntities':!0x1}),_0x182ba3=qi(_0xc693f6),_0x24d3b7=qi(_0x3d9b7e);if(!_0x182ba3['length']&&!_0x24d3b7['length'])return{'contentInitial':_0x5b557c,'contentNew':_0x24a311};const _0x51c9ab=new Map();for(const _0x2066ab of _0x182ba3)_0x51c9ab['set'](Xi(_0x2066ab,'data-id'),_0x2066ab);for(const _0x2eae74 of _0x24d3b7){const _0x46b344=Xi(_0x2eae74,'data-id'),_0x33ac97=_0x46b344?_0x51c9ab['get'](_0x46b344):void 0x0;_0x33ac97?_0x425be6(_0x2eae74,_0x54443e(_0x33ac97,!0x0)):_0x1da415(_0x2eae74);}return{'contentInitial':Ki(_0xc693f6,{'encodeEntities':!0x1}),'contentNew':Ki(_0x3d9b7e,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x149579,_0x3a76a4=0x5){let _0x45e57e=_0x149579,_0x4c2ef4=null;for(let _0x225b81=0x0;_0x225b81<_0x3a76a4&&_0x45e57e;_0x225b81++){if(!_0x45e57e['className']){_0x45e57e=_0x45e57e['parentElement'];continue;}if(!(''+_0x45e57e['className'])['includes']('ck-ai_review-marker_')){_0x45e57e=_0x45e57e['parentElement'];continue;}if(!_0x45e57e['getAttribute']('data-marker-id'))break;_0x4c2ef4=_0x45e57e;break;}return _0x4c2ef4;}['_findMarkerElementById'](_0x3fdc84){const _0x2b2288=this['_markers']['get'](_0x3fdc84);if(!_0x2b2288)return null;const _0x5697e7=_0x2b2288['editor']['model']['markers']['get'](_0x3fdc84);return _0x5697e7?_0x24f01c(_0x2b2288['editor']['editing'],_0x5697e7):null;}['_getMarkersDataForGroup'](_0x5c42b9){return Array['from'](this['_markers']['values']())['filter'](_0x5c7182=>_0x5c7182['groupId']===_0x5c42b9);}['_getOperationStart'](_0xb7e6aa){return'insert'===_0xb7e6aa['type']?_0xb7e6aa['position']:_0xb7e6aa['newRange']['start'];}['_getOperationEnd'](_0x45fe65,_0x3666a2=!0x1){return'insert'===_0x45fe65['type']?_0x3666a2?_0x45fe65['position']:_0x45fe65['position']['getShiftedBy'](_0x45fe65['howMany']):_0x45fe65['newRange']['end'];}['_shiftOperation'](_0x191c63,_0xbf0a7d){return'insert'===_0x191c63['type']?_0x191c63['position']=_0x191c63['position']['getShiftedBy'](_0xbf0a7d):'marker'===_0x191c63['type']&&_0x191c63['newRange']&&(_0x191c63['newRange']=new _0x10082a(_0x191c63['newRange']['start']['getShiftedBy'](_0xbf0a7d),_0x191c63['newRange']['end']['getShiftedBy'](_0xbf0a7d))),_0x191c63;}['_changeOperationOwnerDocument'](_0x1b7257,_0x4ca19e){'insert'===_0x1b7257['type']?_0x1b7257['position']=this['_changePositionOwnerDocument'](_0x1b7257['position'],_0x4ca19e):'marker'===_0x1b7257['type']&&_0x1b7257['newRange']&&(_0x1b7257['newRange']=this['_changeRangeOwnerDocument'](_0x1b7257['newRange'],_0x4ca19e));}['_changePositionOwnerDocument'](_0x5b5e1a,_0x323c90){return new _0x8826d0(_0x323c90,_0x5b5e1a['path']);}['_changeRangeOwnerDocument'](_0x9b2faa,_0x1b9b93){return new _0x10082a(this['_changePositionOwnerDocument'](_0x9b2faa['start'],_0x1b9b93),this['_changePositionOwnerDocument'](_0x9b2faa['end'],_0x1b9b93));}['_changePosition'](_0x1b1066,_0x58269e){return new _0x8826d0(_0x58269e,[..._0x1b1066]);}['_changeRange'](_0x3b3e95,_0x19cc32,_0x4425a7,_0x3dc089){return new _0x10082a(this['_changePosition'](_0x19cc32,_0x3dc089),this['_changePosition'](_0x4425a7,_0x3dc089));}['_sortMarkers'](_0x175ae4){const _0x2afdc3=_0x46895a=>{switch(_0x46895a){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x175ae4['sort']((_0x585330,_0x4a8cbf)=>_0x2afdc3(_0x585330['type'])-_0x2afdc3(_0x4a8cbf['type']));}['_hasSameTopLevelElement'](_0xb00c04,_0x47b2f4){const _0x3a271f=_0xb00c04['getChild'](0x0),_0xe5d03b=_0x47b2f4['getChild'](0x0);return!(!_0x3a271f||!_0xe5d03b)&&((!_0x3a271f['is']('element')||!_0xe5d03b['is']('element')||_0x3a271f['name']===_0xe5d03b['name'])&&!(_0x3a271f['is']('element')&&!_0xe5d03b['is']('element')||!_0x3a271f['is']('element')&&_0xe5d03b['is']('element')));}['_haveSingleTopLevelElement'](_0x113ee0){return 0x1===_0x113ee0['childCount'];}['_haveOnlyInlineContent'](_0x322263,_0x39a05f){for(const _0x2991a3 of _0x322263['getChildren']())if(_0x2991a3['is']('element')&&!_0x39a05f['isInline'](_0x2991a3))return!0x1;return!0x0;}['_upsertDataId'](_0x114a3d,_0x202604){let _0x18c586=_0x114a3d['getAttribute'](_0x2be294);return _0x18c586||(_0x18c586=_0x202604(),_0x114a3d['_setAttribute'](_0x2be294,_0x18c586)),_0x18c586;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x1118c2,contentNew:_0x4c2e3c,contentInitial:_0x175486,documentVersion:_0x50455f}){super(),this['id']=_0x1118c2,this['contentNew']=_0x4c2e3c,this['contentInitial']=_0x175486,this['documentVersion']=_0x50455f;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x420b1e,_0x4f53b9,_0x25d51a){super(),this['id']=_0x420b1e,this['parent']=_0x25d51a,this['_data']=_0x4f53b9,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'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x263752,_0x5a6e4a,_0xa4e9f9,_0x758ff0,_0x2b5136){super(),this['_sourceCheck']=_0x5a6e4a,this['_documentData']=_0x263752,this['_aiConnector']=_0xa4e9f9,this['_reviewParams']=_0x758ff0,this['_reviewArgs']=_0x2b5136,this['on']('change:status',(_0x372b81,_0x5316cf,_0x39370f)=>{'aborted'==_0x39370f&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x39370f,'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'](_0x4e0ea5=>'pending'===_0x4e0ea5['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x1d4841){this['_documentData']=_0x1d4841;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x3b128e=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x2a8276 of _0x3b128e)'unmodified'!==_0x2a8276['data']['operation']&&('error'!==_0x2a8276['data']['operation']?'review-metadata'!==_0x2a8276['event']?this['_addReviewCheckResult'](_0x2a8276['data']['dataId'],_0x2a8276['data']['textDelta']):this['callId']=_0x2a8276['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(_0xc36161){this['_currentError']=_0xc36161,_0xc36161 instanceof Error&&_0xc36161['message']['includes']('ai-request-aborted')?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'](_0x54d137,_0x1d34ee){const _0xc556c=this['_results']['get'](_0x54d137);if(!_0xc556c)return;if(0x0===_0x1d34ee['length'])return;const _0x2c7c4c=[];_0x1d34ee['forEach']((_0x5bc287,_0x2ac143)=>{const _0xcb741f=new AIReviewCheckResultChange(_0xc556c['id']+'-'+_0x2ac143,_0x5bc287,_0xc556c);_0xcb741f['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0xcb741f,'status':_0xcb741f['status']});}),_0xcb741f['on']('change:isActivated',()=>{_0xcb741f['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0xcb741f}):this['fire']('reviewCheckResultDeactivated',{'change':_0xcb741f});}),this['_changes']['push'](_0xcb741f),_0x2c7c4c['push'](_0xcb741f);}),this['fire']('reviewCheckResultReady',{'changes':_0x2c7c4c,'result':_0xc556c,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x1ed488){const _0x35ddfd=this['_changes']['find'](_0x5e1529=>_0x5e1529['id']===_0x1ed488);return!(!_0x35ddfd||'pending'!==_0x35ddfd['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x2350a1=>!0x0===_0x2350a1['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0xade81a=>'pending'===_0xade81a['status']);}['getChangeById'](_0xdfc0fb){return this['_changes']['find'](_0x3f366b=>_0x3f366b['id']===_0xdfc0fb);}['markAllChangesAsAccepted'](){for(const _0x128cbf of this['_changes'])'pending'===_0x128cbf['status']&&(_0x128cbf['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x1840f5){const _0x503c93=this['_changes']['find'](_0x25ec1b=>_0x25ec1b['id']===_0x1840f5);_0x503c93&&'pending'===_0x503c93['status']&&(_0x503c93['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x3edf0a){const _0x1a5f86=this['_changes']['find'](_0x2cdfab=>_0x2cdfab['id']===_0x3edf0a);_0x1a5f86&&'pending'===_0x1a5f86['status']&&(_0x1a5f86['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x5963ab){const _0x1e1b26=this['_changes']['find'](_0x273f73=>_0x273f73['id']===_0x5963ab);_0x1e1b26&&'pending'===_0x1e1b26['status']&&(_0x1e1b26['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x2e1570){const _0x12c2c2=this['_changes']['find'](_0x1a58f4=>_0x1a58f4['id']===_0x2e1570);_0x12c2c2&&'outdated'===_0x12c2c2['status']&&(_0x12c2c2['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x40170e){this['_changes']['filter'](_0x4c2f1d=>_0x4c2f1d['isActivated']&&_0x4c2f1d['id']!==_0x40170e)['forEach'](_0x465252=>{_0x465252['isActivated']=!0x1;});const _0x113cc9=this['_changes']['find'](_0x4f903a=>_0x4f903a['id']===_0x40170e);_0x113cc9&&'pending'===_0x113cc9['status']&&(_0x113cc9['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x5a9842=>_0x5a9842['isActivated'])['forEach'](_0x22ef5d=>{_0x22ef5d['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x129be1){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x1796bc;if(_0x129be1){const _0x737faf=this['_changes']['find'](_0x16fbee=>_0x16fbee['id']===_0x129be1);if(_0x737faf&&_0x737faf['isRated'])return;_0x737faf&&(_0x1796bc=_0x737faf['parent']['id'],_0x737faf['isRated']=!0x0);}const _0x1a2713={'positiveCount':this['_changes']['filter'](_0x38a1c5=>'accepted'===_0x38a1c5['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x1a2713,this['callId'],_0x1796bc);}['_addReviewCheckResult'](_0x432fbb,_0x2b2592){const _0x4759ca=this['_documentData']['elements']['get'](_0x432fbb);if(!_0x4759ca)return;const _0xb4fb3=_0x4759ca['getContent']();if(_0xb4fb3===_0x2b2592)return;const _0x275c82=new AIReviewCheckResult({'id':_0x432fbb,'contentInitial':_0xb4fb3,'contentNew':_0x2b2592,'documentVersion':_0x4759ca['documentVersion']});this['_results']['set'](_0x275c82['id'],_0x275c82),this['fire']('reviewCheckResultAdded',{'result':_0x275c82,'source':this,'editor':_0x4759ca['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x58a0df=>'pending'===_0x58a0df['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x29791e=>'pending'===_0x29791e['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x4c2b4b=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x53417d=0x0;_0x53417d<this['_reviewParams']['length'];_0x53417d++){if(!this['_reviewParams'][_0x53417d]||!this['_sourceCheck']['options'][_0x53417d])continue;const _0x2a332d=this['_sourceCheck']['options'][_0x53417d],_0x457efa=_0x2a332d['data']?.['find'](_0xe8036b=>_0xe8036b['id']===this['_reviewParams'][_0x53417d]);_0x457efa&&_0x4c2b4b['push'](_0x457efa['label']);}return _0x4c2b4b['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x1ffcf9,_0x902b9f,_0x308c7){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x902b9f,_0x1ffcf9,_0x308c7);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x21ae07{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_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',(_0x23050d,_0x4e3e66)=>this['runCheck'](_0x4e3e66)),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 _0x136bf2=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x136bf2['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x136bf2['map'](_0x4b86bb=>_0x4b86bb['id']));const _0x50ee9a=this['_currentReviewCheckRun'];_0x50ee9a['markAllChangesAsAccepted'](),_0x50ee9a['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x3d272c,_0x116cb0)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x116cb0['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x116cb0['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x116cb0['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x116cb0['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x5e217f,_0xae08be)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0xae08be['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0xae08be['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0xae08be['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0xae08be['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',(_0x13f73d,_0x245d97)=>{this['_onActivateChange'](_0x245d97);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x341f2b,_0x3bf61c)=>{this['_onDeactivateChange'](_0x3bf61c);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x24a274,_0x48505d)=>{this['_onChangeMarkerClicked'](_0x24a274,_0x48505d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x2efdb4,_0x2a2406)=>{this['_onChangeMarkerHovered'](_0x2efdb4,_0x2a2406);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x24bb12,_0x193e67)=>{this['_onChangeMarkerRemoved'](_0x24bb12,_0x193e67);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x43204c,_0x2a4374)=>{this['_onChangeMarkerRestored'](_0x43204c,_0x2a4374);});}async['runCheck'](_0x3c349e){if(!this['_availableReviewChecks'])return;const _0x440584=this['_availableReviewChecks']['find'](_0xbc3a61=>_0xbc3a61['id']===_0x3c349e['id']);if(_0x440584){this['_onReviewCheckRun'](_0x3c349e),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x3c349e,_0x440584),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x48457a,_0xc88b1b)=>{switch(_0xc88b1b['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0xc88b1b);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'!==_0xc88b1b['status']&&'error-chunk'!==_0xc88b1b['status']&&'error-general'!==_0xc88b1b['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x1ceb37,_0x459fa6)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x3ddbff=this['_diffContent'](_0x459fa6['editor'],_0x459fa6['result']['contentInitial'],_0x459fa6['result']['contentNew']);_0x459fa6['source']['addResultChanges'](_0x459fa6['result']['id'],_0x3ddbff);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x1eeab2,_0x3df9a1)=>{for(const _0x1ef76b of _0x3df9a1['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x1ef76b);this['_markChangePositionInEditorContent'](_0x3df9a1['changes'],_0x3df9a1['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x83b742,_0x4e4a07)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x4e4a07['change']['id'],_0x4e4a07['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x5e450b,_0x59f916)=>{this['_onReviewCheckResultActivated'](_0x59f916);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x591192){_0x591192 instanceof Error&&_0x591192['message']['includes']('ai-request-aborted')||(_0x591192 instanceof ht?this['_logError'](_0x591192):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x591192)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x3c349e['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x5cda4b,_0xc67d07){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0xc67d07,this['_aiConnector'],_0x5cda4b['params'],_0x5cda4b['args']);}['_onChangeMarkerRemoved'](_0x265660,_0x2779ae){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x2779ae['changeId']);}['_onChangeMarkerRestored'](_0x299b26,_0x12ccb8){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x12ccb8['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x557a24=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x557a24&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x160a49 of this['_aiReviewCoreEditing']['getEditors']())_0x160a49['editing']['view']['change'](_0x20a15=>{for(const _0x3fa98f of _0x160a49['editing']['view']['document']['getRoots']())_0x20a15['removeClass']('ck-ai_review-diff',_0x3fa98f),_0x20a15['removeClass']('ck-ai_review-highlights',_0x3fa98f),_0x20a15['removeClass']('ck-ai-translate-mode-content',_0x3fa98f);});}['_logError'](_0x49ce79,_0x4d7851=!0x1){Ct(_0x49ce79['message']),_0x4d7851||(_0x49ce79['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x57424b){if('content'===this['_changeActivationSource']){const _0x48733a=this['_aiReviewCoreUi']['getChangeElement'](_0x57424b);_0x48733a&&Rt(_0x48733a['closest']('.ck-ai_review__check-run-result')||_0x48733a);}else{if('panel'===this['_changeActivationSource']){const _0x80e7ad=this['_getChangeContentElement'](_0x57424b);if(!_0x80e7ad)return;Tt({'target':_0x80e7ad,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x1189ca,_0x220261,_0x122f18,_0x1e4fa0,_0x361178){super(_0x122f18,_0x1e4fa0,_0x361178),this['_prompt']=_0x1189ca,this['_model']=_0x220261;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x50268a,_0x407611,_0x3b7bb1){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x407611,_0x50268a,_0x3b7bb1);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x2fc169){this['id']=_0x2fc169['id'],this['commandId']=_0x2fc169['commandId'],this['title']=_0x2fc169['title'],this['description']=_0x2fc169['description'],this['isParameterized']=_0x2fc169['isParameterized'],this['useArgs']=_0x2fc169['useArgs'],this['options']=_0x2fc169['options'],this['args']=_0x2fc169['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x157092,_0x54b868,_0x358a83){super(_0x157092),this['prompt']=_0x157092['prompt'],this['model']=_0x157092['model'],this['model']?this['_defaultModel']=_0x54b868['find'](_0x360921=>_0x360921['id']===this['model'])||null:this['_defaultModel']=_0x358a83;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0xa263d1){this['_prompt']=_0xa263d1;}set['model'](_0xfdabb5){this['_model']=_0xfdabb5;}}class AIReviewCoreCheckRegistry extends _0x21ae07{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const sr=[{'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'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x43aeed){this['_checks']=_0x43aeed['map'](_0x469c86=>new AIReviewCheck(_0x469c86));}get['checks'](){return this['_checks'];}['getCheckById'](_0x4cf105){return this['checks']['find'](_0x546d85=>_0x546d85['id']===_0x4cf105);}['removeCheckById'](_0x4b0218){this['_checks']=this['_checks']['filter'](_0x505a15=>_0x505a15['id']!==_0x4b0218);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x4389e6,_0x5f0768,_0x80079a){super(_0x4389e6),this['_models']=_0x5f0768,this['_defaultModel']=_0x80079a;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x804cd9,_0xb155a7,_0x571e05){super(),this['_allModels']=_0x804cd9,this['_recommendedModels']=_0xb155a7,this['_defaultModel']=_0x571e05;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x3c45c7){this['_checks']=_0x3c45c7['map'](_0x49f9e3=>!0x0===_0x49f9e3['isExtra']?new AIReviewCheckExtra(_0x49f9e3,this['_allModels'],this['_defaultModel']):'custom'===_0x49f9e3['id']?new AIReviewCheckCustom(_0x49f9e3,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x49f9e3));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x5cb002){super(_0x5cb002),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x5a9e72=>({'id':_0x5a9e72['id'],'commandId':_0x5a9e72['id'],'title':_0x5a9e72['label'],'description':_0x5a9e72['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x5a9e72['prompt'],'model':_0x5a9e72['model']}));}async['_loadChecksList'](){const _0xb42f2b=[...sr,...this['getExtraChecks']()]['map'](_0x2af6b5=>_0x2af6b5['isExtra']?_0x2af6b5:this['_translateReviewCheck'](_0x2af6b5)),_0xdd4a15=await this['_getModels'](),_0x42a220=new AIReviewModeCheckList(_0xdd4a15['all'],_0xdd4a15['recommended'],_0xdd4a15['default']);return _0x42a220['setupChecks'](_0xb42f2b),_0x42a220;}async['_getModels'](){const _0x25b7e0=this['context']['plugins']['get']('AIConnector');try{const _0x37e2e6=new AIModels({'connector':_0x25b7e0,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0xf00e64={'all':await _0x37e2e6['getAll'](),'recommended':await _0x37e2e6['getAvailableModels'](),'default':await _0x37e2e6['getDefault']()};return this['_modelsLoadError']=null,_0xf00e64;}catch(_0x1eb4e5){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x1eb4e5),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x80dde2){const _0x515fff='AI_REVIEW_CHECK_'+_0x80dde2['id']['toUpperCase']()['replaceAll']('-','_'),_0x5cc9a6={..._0x80dde2,'title':this['_translate'](_0x515fff+'_TITLE',_0x80dde2['title']),'description':this['_translate'](_0x515fff+'_DESCRIPTION',_0x80dde2['description'])};return _0x80dde2['options']&&(_0x5cc9a6['options']=_0x80dde2['options']['map'](_0x5dcabf=>({..._0x5dcabf,'label':this['_translate'](_0x515fff+'_OPTIONS_LABEL',_0x5dcabf['label']||''),'data':_0x5dcabf['data']?_0x5dcabf['data']['map'](_0x2b5823=>({..._0x2b5823,'label':this['_translate'](_0x515fff+'_OPTIONS_DATA_'+_0x2b5823['id']['toUpperCase'](),_0x2b5823['label'])})):void 0x0}))),_0x5cc9a6;}['_translate'](_0x112c1f,_0x341929){const _0x339a2e=Mi(this['context']['locale'],_0x112c1f);return _0x339a2e===_0x112c1f?_0x341929:_0x339a2e;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x43b23f){super(_0x43b23f),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',sr['map'](_0x1a1ea9=>_0x1a1ea9['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x1b7759,_0x5a9013)=>{this['_isDiffOn']=_0x5a9013['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x56398a,_0x247e1d){if(_0x56398a['isCustom'])return new AIReviewCustomCheckRun(_0x56398a['args']['prompt'],_0x56398a['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x247e1d,this['_aiConnector']);if(_0x247e1d['isExtra']){const _0x24654e=_0x247e1d;return new AIReviewExtraCheckRun(_0x56398a['args']?.['prompt']??_0x24654e['prompt'],_0x56398a['args']?.['model']??_0x24654e['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x247e1d,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x247e1d,this['_aiConnector'],_0x56398a['params'],_0x56398a['args']);}['_onReviewCheckResultActivated'](_0x3882f5){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x3882f5['change']['id']),this['_scrollToChange'](_0x3882f5['change']['id']);const _0x2bd6dd=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3882f5['change']['id']);if(!_0x2bd6dd)return;const _0x87d38a=this['_aiReviewCoreEditing']['getEditorForChange'](_0x3882f5['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3882f5['change'],()=>_0x2bd6dd['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x87d38a,_0x2bd6dd['modelRange']['root']['rootName']),_0x87d38a?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x3882f5['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x11f377){this['_currentReviewCheckRun']&&'click'===_0x11f377['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x11f377['id']));}['_onDeactivateChange'](_0x5d8e57){this['_currentReviewCheckRun']&&'balloon'===_0x5d8e57['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x5a48b8,_0x33e89c){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x33e89c['changeId']);const _0x5b467d=this['_currentReviewCheckRun']['getChangeById'](_0x33e89c['changeId']);if(!_0x5b467d)return;const _0xcd0fee=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x33e89c['changeId']),_0x239bd7=this['_aiReviewCoreEditing']['getEditorForChange'](_0x33e89c['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5b467d,_0x33e89c['markerElement'],_0x33e89c['domEvent'],'click',this['_getBalloonDomRoot'](_0x239bd7,_0xcd0fee?.['modelRange']['root']['rootName']),_0x239bd7?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x47cdd4,_0x18ecbb){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x24b009=this['_currentReviewCheckRun']['getChangeById'](_0x18ecbb['changeId']);if(!_0x24b009)return;const _0x4e3af5=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x18ecbb['changeId']),_0x32e498=this['_aiReviewCoreEditing']['getEditorForChange'](_0x18ecbb['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x24b009,_0x18ecbb['markerElement'],_0x18ecbb['domEvent'],'hover',this['_getBalloonDomRoot'](_0x32e498,_0x4e3af5?.['modelRange']['root']['rootName']),_0x32e498?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x35ede1){const _0xaf1ab6=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x35ede1);return _0xaf1ab6?_0xaf1ab6['getElement']():null;}['_markChangePositionInEditorContent'](_0x472ffa,_0x47e997){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x472ffa,_0x47e997);}['_diffContent'](_0x33eda0,_0x577ac7,_0x438915){return this['_aiReviewCoreEditing']['diffContent'](_0x33eda0,_0x577ac7,_0x438915,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x955118){_0x955118?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x46886d of this['_aiReviewCoreEditing']['getEditors']())_0x46886d['editing']['view']['change'](_0x465d21=>{for(const _0x3f5d4f of _0x46886d['editing']['view']['document']['getRoots']()){for(const _0x376d23 of _0x3f5d4f['getClassNames']())_0x376d23['startsWith']('ck-ai_review-')&&_0x465d21['removeClass'](_0x376d23,_0x3f5d4f);_0x465d21['addClass'](_0x955118?'ck-ai_review-diff':'ck-ai_review-highlights',_0x3f5d4f);}});}['_getBalloonDomRoot'](_0x5103ec,_0x2d6ef6){const _0x5c0629=_0x5103ec['editing']['view'];if(_0x2d6ef6){const _0x23dabd=_0x5c0629['getDomRoot'](_0x2d6ef6);if(_0x23dabd)return _0x23dabd;}return _0x5c0629['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x22a008=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x3c3bb1=await _0x22a008['getChecksList']();_0x22a008['modelsLoadError']&&this['_logError'](_0x22a008['modelsLoadError']);let _0x23f387=_0x3c3bb1['checks'];const _0x2f755b=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x2f755b,_0x23f387),this['_usesAvailableCommandsConfig']&&(_0x23f387=_0x2f755b['map'](_0x48019d=>_0x23f387['find'](_0x59b69b=>_0x59b69b['id']===_0x48019d))['filter'](_0x130bda=>!!_0x130bda)),this['_filterChecksWithMissingModel'](_0x23f387);}['_logWarningForNonExistentChecks'](_0x435a45,_0x3f1339){const _0x97d3de=_0x435a45['filter'](_0x4bf0ef=>!_0x3f1339['some'](_0x3af989=>_0x3af989['id']===_0x4bf0ef));if(_0x97d3de['length']){const _0x4bd7b3=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x97d3de['join'](',\x20')});wt(_0x4bd7b3['message']);}}['_filterChecksWithMissingModel'](_0x24d4bf){const _0x4aea50=[];return _0x24d4bf['forEach'](_0x5e2d61=>{(_0x5e2d61 instanceof AIReviewCheckExtra&&!_0x5e2d61['defaultModel']||_0x5e2d61 instanceof AIReviewCheckCustom&&!_0x5e2d61['models']['length'])&&_0x4aea50['push'](_0x5e2d61['id']);}),_0x4aea50['length']&&_0x4aea50['forEach'](_0x1ff856=>{_0x24d4bf=_0x24d4bf['filter'](_0x5b4b05=>_0x5b4b05['id']!==_0x1ff856);const _0x5aedcb=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x1ff856});Ct(_0x5aedcb['message']);}),_0x24d4bf;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x15f183){this['_editor']=_0x15f183['editor'],this['_rootName']=_0x15f183['rootName'],this['_channelId']=_0x15f183['channelId'],this['_sessionId']=_0x15f183['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'](_0x917ef4){this['_documentVersion']=_0x917ef4;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0xfda1db){this['_contentRawOld']=_0xfda1db;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x2266e3){this['_contentRawNew']=_0x2266e3;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x48ef51){this['_error']=_0x48ef51;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x1867c6){return _0x1867c6['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x506983){this['_affectedBlocks']=_0x506983;}}class AIGateway extends _0x21ae07{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x409742,_0x4898a0){if('completed'!==_0x409742['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x409742['status']});const _0x46a2ae=_0x409742['editor'];if('suggest'===_0x4898a0&&!_0x46a2ae['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x4a1eb6='suggest'===_0x4898a0,_0x562f1e=this['context']['plugins']['get'](_0x76057),_0x4cfb92=_0x46a2ae['model']['createPositionAt'](_0x46a2ae['model']['document']['getRoot'](),0x0),_0x364320=_0x562f1e['getDiff'](_0x409742['contentRawOld'],_0x409742['contentRawNew'],{'anchor':_0x4cfb92,'markDeletions':_0x4a1eb6,'targetEditor':_0x46a2ae}),_0x198191=_0x46a2ae['model']['document']['history']['getOperations'](_0x409742['documentVersion']),_0x3ba36b={'document':_0x46a2ae['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x36b583=_0x437900(_0x364320['getOperations'](),_0x198191,_0x3ba36b)['operationsA'];_0x46a2ae['model']['change'](_0x46a2ea=>{if(_0x4a1eb6)_0x46a2ae['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x36b583);else{for(const _0x4c7052 of _0x36b583)_0x4c7052['baseVersion']=_0x46a2ae['model']['document']['version'],Ts(_0x46a2ae,_0x4c7052),_0x46a2ea['batch']['addOperation'](_0x4c7052),_0x46a2ae['model']['applyOperation'](_0x4c7052);}});}['mergeChangesIntoContent'](_0x4016d9,_0x4cf80b,_0x3c1ae8){const _0x5c8fb=new AIResponseParser(),_0xd9c201=new AIResponseApplier();let _0x556a74=_0x5c8fb['parseAndNormalizeHTML'](_0x4cf80b);for(const _0x2b7efd of _0x4016d9)try{const _0x4fe387=_0x5c8fb['parseAndNormalizeHTML'](_0x2b7efd['content']);_0x556a74=_0xd9c201['merge'](_0x4fe387,_0x556a74,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x2feef3){throw new ht('ai-gateway-merge-failed',this,{..._0x2b7efd},_0x2feef3);}return as(_0x3c1ae8,_0x5c8fb['parseAndNormalizeHTML'](_0x4cf80b),_0x556a74,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x21ae07{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0x419b7b=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x419b7b['getChecksList']())['checks']['map'](_0xe233ad=>{const _0x33cf42={'id':_0xe233ad['id'],'title':_0xe233ad['title'],'description':_0xe233ad['description']};return'custom'!==_0xe233ad['id']&&_0xe233ad['options']?.['length']&&(_0x33cf42['parameters']=_0xe233ad['options'][0x0]['data']['map'](_0x4dbe6a=>({..._0x4dbe6a}))),_0x33cf42;});}async['getAvailableModels'](){const _0x275c5c=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x275c5c,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0xa76d36,_0xd99794){return await this['_runReviewCheck'](_0xa76d36,()=>this['_createReviewCheckRun'](_0xa76d36,_0xd99794?.['parameterId']),_0xd99794?.['signal']);}async['runCustomReview'](_0x3cf9e7,_0x5ab25f){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x3cf9e7,_0x5ab25f?.['model']),_0x5ab25f?.['signal']);}['applyReview'](_0x5ba29b,_0x931f4c){this['context']['plugins']['get']('AIGateway')['apply'](_0x5ba29b,_0x931f4c);}async['_runReviewCheck'](_0x206ed1,_0x4e4f59,_0x36f30e){const _0xbca9f5=ps(this['context']),_0x30a562=new AIReviewRunResult({'editor':_0xbca9f5,'rootName':_0xbca9f5['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0xbca9f5['plugins']['get']('AIEditing')['getSessionId'](_0xbca9f5)});let _0x230d0e,_0xdcf151;if(_0x36f30e){if(_0x36f30e['aborted'])return _0x30a562['abort'](),_0x30a562;const _0x37fa37=()=>{_0x30a562['error']||(_0x30a562['abort'](),_0x230d0e&&_0x230d0e['abort']());};_0x36f30e['addEventListener']('abort',_0x37fa37),_0xdcf151=()=>_0x36f30e['removeEventListener']('abort',_0x37fa37);}try{_0x230d0e=await _0x4e4f59(),_0x30a562['contentRawOld']=_0x230d0e['documentData']['content'],_0x30a562['documentVersion']=Array['from'](_0x230d0e['documentData']['elements'])['find'](([,_0x449bbd])=>_0x449bbd['rootName']===_0x30a562['rootName'])?.[0x1]['documentVersion']??0x1,_0x230d0e['on']('reviewCheckRunUpdated',(_0xadbcc6,_0x2f919f)=>{'aborted'===_0x2f919f['status']?_0x30a562['abort']():'error-general'!==_0x2f919f['status']&&'error-chunk'!==_0x2f919f['status']||(_0x30a562['error']=this['_normalizeError'](_0x2f919f['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x206ed1}));}),'aborted'!==_0x30a562['status']&&await _0x230d0e['start']();}catch(_0x176777){_0x30a562['error']=this['_normalizeError'](_0x176777,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x206ed1});}finally{_0xdcf151&&_0xdcf151();}if(!_0x230d0e||'aborted'===_0x30a562['status']||'error'===_0x30a562['status'])return _0x30a562;_0x30a562['affectedBlocks']=_0x230d0e['results']['map'](_0x1cde97=>({'id':_0x1cde97['id'],'content':_0x1cde97['contentNew']}));try{_0x30a562['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x30a562['affectedBlocks'],_0x30a562['contentRawOld'],_0x30a562['editor']));}catch(_0x687436){_0x30a562['error']=this['_normalizeError'](_0x687436,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x206ed1});}return _0x30a562;}async['_createReviewCheckRun'](_0x352971,_0x333356){const _0x802f6=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x327efa=>_0x327efa['id']===_0x352971);if(!_0x802f6)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x352971});if(_0x802f6 instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x352971});const _0x9c688f=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1db643=this['context']['plugins']['get']('AIConnector');if(_0x802f6 instanceof AIReviewCheckExtra){if(!_0x802f6['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x352971});return new AIReviewExtraCheckRun(_0x802f6['prompt'],_0x802f6['defaultModel']['id'],_0x9c688f,_0x802f6,_0x1db643);}return new AIReviewSystemCheckRun(_0x9c688f,_0x802f6,_0x1db643,_0x333356?[_0x333356]:void 0x0);}async['_createCustomReviewCheckRun'](_0x4688ae,_0x34f0fa,_0x18407d){const _0x552981=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x20f70c=>_0x20f70c['id']===_0x4688ae);if(!_0x552981)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x4688ae});if(!(_0x552981 instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x4688ae});const _0x47f1b7=_0x18407d??_0x552981['defaultModel']?.['id'];if(!_0x34f0fa)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x4688ae});if(!_0x47f1b7)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x4688ae});return new AIReviewCustomCheckRun(_0x34f0fa,_0x47f1b7,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x552981,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x38c376,_0x443a59,_0x1b934e){let _0x200baa=_0x38c376;return _0x38c376 instanceof ht||(_0x200baa=new ht(_0x443a59,this,_0x1b934e,_0x38c376)),_0x200baa;}}class AIReviewMode extends _0x21ae07{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x1001bb,_0x23a88c){if(this['assertStartReviewPreconditions'](_0x1001bb)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x1001bb});const _0x2c6527=this['context']['plugins']['get']('AIReviewModeController');await _0x2c6527['runCheck']({'id':_0x1001bb,'params':_0x23a88c?.['parameterId']?[_0x23a88c['parameterId']]:void 0x0});}async['startCustomReview'](_0x28f725,_0x5ee400){if(!_0x28f725)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x68f58c=sr['find'](_0x9df1b2=>'custom'===_0x9df1b2['commandId'])['id'],_0x221a99=this['assertStartReviewPreconditions'](_0x68f58c),_0x2bc270=_0x5ee400?.['model']??_0x221a99['defaultModel']?.['id'];if(!_0x2bc270)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x4f5cab=this['context']['plugins']['get']('AIReviewModeController');await _0x4f5cab['runCheck']({'id':_0x68f58c,'isCustom':!0x0,'args':{'prompt':_0x28f725,'model':_0x2bc270}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x37ceff=>{const _0x4a4af1={'id':_0x37ceff['id'],'title':_0x37ceff['title'],'description':_0x37ceff['description']};return'custom'!==_0x37ceff['id']&&_0x37ceff['options']?.['length']&&(_0x4a4af1['parameters']=_0x37ceff['options'][0x0]['data']['map'](_0x2766d1=>({..._0x2766d1}))),_0x4a4af1;});}['assertStartReviewPreconditions'](_0x484a82){const _0x33f15a=this['context']['plugins']['get']('AIReviewModeController');if(_0x33f15a['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x1cfd76=_0x33f15a['getAvailableChecks']()['find'](_0x3a35d8=>_0x3a35d8['id']===_0x484a82);if(!_0x1cfd76)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x484a82});const _0x3f6a6a=this['context']['plugins']['get']('AITabs')['view'];return _0x3f6a6a['isVisible']=!0x0,_0x3f6a6a['activateTab']('reviewMode'),_0x1cfd76;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x1e2145,_0x151c85,_0x28b4c3,_0x3d6193,_0x1c1a95,_0x74a5f0){super(_0x1e2145,_0x151c85,_0x28b4c3,_0x1c1a95,_0x74a5f0),this['_title']=_0x3d6193;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x887d5f){this['_checks']=_0x887d5f['map'](_0xb4abbb=>new AITranslateCheck(_0xb4abbb));}}const nr=[{'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'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x4c422b){super(_0x4c422b),this['context']['config']['define']('ai.translate.languages',nr);}async['_loadChecksList'](){const _0x1b4d7a=[],_0x34043d=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x12c146 of _0x34043d)_0x1b4d7a['push']({'title':_0x12c146['label'],'id':_0x12c146['id'],'commandId':_0x12c146['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x12c146['id']}});const _0xfce3a6=new AITranslateCheckList();return _0xfce3a6['setupChecks'](this['_translateChecks'](_0x1b4d7a)),_0xfce3a6;}['_translateChecks'](_0x4f4a46){const _0x2c3c87=this['context']['locale'];return _0x4f4a46['map'](_0x126183=>{const _0x3bd404='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x126183['title']['toUpperCase']()['replaceAll']('-','_'),_0xf410c7=Mi(_0x2c3c87,_0x3bd404);return{..._0x126183,'title':_0xf410c7===_0x3bd404?_0x126183['title']:_0xf410c7};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0xeaa925,_0x36f256){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x36f256,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0xeaa925['params'],_0xeaa925['args']);}['_onReviewCheckResultActivated'](_0xb57ae){this['_aiReviewCoreUi']['setActiveStateInResults'](_0xb57ae['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0xb57ae['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x4450a8){this['_currentReviewCheckRun']&&('hover'===_0x4450a8['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4450a8['id'])),'click'===_0x4450a8['uiInteraction']&&this['_scrollToChange'](_0x4450a8['id']));}['_onDeactivateChange'](_0x2b0cdd){this['_currentReviewCheckRun']&&'panel'===_0x2b0cdd['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x211962,_0x2702b5){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x2702b5['changeId']),this['_scrollToChange'](_0x2702b5['changeId']));}['_onChangeMarkerHovered'](_0x2cc15a,_0x1590ce){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x1590ce['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x1590ce['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x3e4de8){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x3e4de8);}['_markChangePositionInEditorContent'](_0x56fd28,_0x11a9db){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x56fd28,_0x11a9db);}['_diffContent'](_0x32388b,_0x20e4ea,_0x4fffd8){return this['_aiReviewCoreEditing']['diffContent'](_0x32388b,_0x20e4ea,_0x4fffd8,!0x0);}['_onReviewCheckRun'](){for(const _0x2662ab of this['_aiReviewCoreEditing']['getEditors']())_0x2662ab['editing']['view']['change'](_0x48e6d4=>{for(const _0x523961 of _0x2662ab['editing']['view']['document']['getRoots']())_0x48e6d4['addClass']('ck-ai-translate-mode-content',_0x523961);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x375d27,_0x1db1c4){super(_0x375d27,_0x1db1c4),this['on']('set:isLoading',(_0x2fea9c,_0x167838,_0x441440)=>{_0x441440&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x34fb19,_0x523213,_0x244be6)=>{_0x244be6&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x1e47c5=super['_createAcceptAllButtonView']();return _0x1e47c5['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x1e47c5;}['_createExitReviewButtonView'](){const _0x113c89=super['_createExitReviewButtonView']();return _0x113c89['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x113c89;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x1743a5=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x1743a5['if']('isVisible','ck-hidden',_0x32698b=>!_0x32698b)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1743a5['if']('isVisible','ck-hidden',_0x566bac=>!_0x566bac)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0xa58f5c=this['context']['plugins']['get']('AITabs'),_0x371910=this['context']['locale'],_0x57dc13=new AIHeaderView(_0x371910,{'label':Mi(_0x371910,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x8eaaa1,'class':'ck-ai-header_review-translate','showResizeButton':_0xa58f5c['showResizeButton']});_0x57dc13['delegate']('resizeTabs')['to'](_0xa58f5c),_0x57dc13['bind']('isMaximized')['to'](_0xa58f5c['view'],'isMaximized',_0x4d62f6=>_0x4d62f6);const _0x12ce13=new AIReviewCoreView(_0x371910,{'header':_0x57dc13,'list':new AITranslateCheckListView(_0x371910),'results':new AITranslateCheckResultsView(_0x371910,{'generalErrorText':Mi(_0x371910,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x371910,{'headerText':Mi(_0x371910,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0x371910,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x371910,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x12ce13['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x12ce13;}['registerTab'](){const _0x143871=this['context']['plugins']['get']('AITabs');_0x143871['view']['on']('activateTab',(_0x6af60a,{newTab:_0x31b2a7,oldTab:_0x5b5a96})=>{'translate'===_0x31b2a7?this['fire']('getReviewCheckList'):'translate'===_0x5b5a96&&this['fire']('leaveReview');}),_0x143871['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x8eaaa1,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x21ae07{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};